/*
 * pixel.css — Shared styles for the pixel games collection.
 * Dark retro aesthetic with pixel-perfect rendering and mobile support.
 */

/* ── Reset ─────────────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0f0f1a;
  color: #d0d0d0;
  font-family: 'Courier New', 'Consolas', 'Monaco', monospace;
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
}

/* ── Game Container ────────────────────────────────────────────────────────── */

#game-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100vw;
  height: 100vh;
  position: relative;
}

/* ── Canvas ────────────────────────────────────────────────────────────────── */

canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  image-rendering: -moz-crisp-edges;
  -ms-interpolation-mode: nearest-neighbor;
}

/* ── UI Overlay ────────────────────────────────────────────────────────────── */

.ui-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: center;
}

.ui-overlay > * {
  pointer-events: auto;
}

/* ── Hub / Game List ───────────────────────────────────────────────────────── */

.game-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  padding: 24px;
  max-width: 960px;
  width: 100%;
}

.game-card {
  background: #1a1a2e;
  border: 2px solid #2a2a4a;
  border-radius: 4px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.game-card:hover {
  border-color: #5a5aff;
  transform: translateY(-2px);
}

.game-card:active {
  transform: translateY(0);
}

.game-card h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: #e0e0ff;
}

.game-card p {
  font-size: 0.8rem;
  color: #8888aa;
}

.game-card .thumbnail {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0f0f1a;
  margin-bottom: 12px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border-radius: 2px;
  overflow: hidden;
}

.game-card .thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ── Hub Header ────────────────────────────────────────────────────────────── */

.hub-header {
  text-align: center;
  padding: 32px 16px 16px;
}

.hub-header h1 {
  font-size: 2rem;
  color: #e0e0ff;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.hub-header p {
  font-size: 0.9rem;
  color: #6666aa;
  margin-top: 8px;
}

/* ── Utility Classes ───────────────────────────────────────────────────────── */

.hidden {
  display: none !important;
}

.center {
  display: flex;
  justify-content: center;
  align-items: center;
}

.fade-in {
  animation: fadeIn 0.4s ease-in forwards;
  opacity: 0;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

/* ── Scrollbar (for hub page) ──────────────────────────────────────────────── */

.scrollable {
  overflow-y: auto;
  height: 100vh;
}

.scrollable::-webkit-scrollbar {
  width: 8px;
}

.scrollable::-webkit-scrollbar-track {
  background: #0f0f1a;
}

.scrollable::-webkit-scrollbar-thumb {
  background: #2a2a4a;
  border-radius: 4px;
}

.scrollable::-webkit-scrollbar-thumb:hover {
  background: #3a3a6a;
}

/* ── Mobile Responsive ─────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .game-list {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 12px;
  }

  .hub-header h1 {
    font-size: 1.4rem;
  }

  .hub-header {
    padding: 20px 12px 12px;
  }
}

@media (max-width: 400px) {
  .game-card {
    padding: 12px;
  }

  .game-card h3 {
    font-size: 1rem;
  }
}

/* ── Touch / Mobile Fixes ──────────────────────────────────────────────────── */

@media (hover: none) {
  /* Disable hover effects on touch devices */
  .game-card:hover {
    border-color: #2a2a4a;
    transform: none;
  }

  /* Prevent text selection on touch */
  canvas {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
  }
}
