/* ============================================
   2048 — Game-specific styles
   ============================================ */

.game-2048-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.score-board {
  display: flex;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
  font-family: 'Space Mono', monospace;
}

.score-box {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-lg);
  text-align: center;
  min-width: 100px;
}

.score-box .label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}

.score-box .value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent-gold);
}

/* ---- GRID ---- */
.grid-container {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 10px;
  position: relative;
  touch-action: none;
}

.grid-bg {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.grid-bg-cell {
  width: 80px;
  height: 80px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
}

.tiles-layer {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
}

.tile {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  border-radius: var(--radius-sm);
  transition: top 120ms ease, left 120ms ease;
  user-select: none;
  z-index: 1;
}

.tile.new {
  animation: tileAppear 0.25s var(--transition-bounce);
}

.tile.merged {
  animation: pop 0.25s ease;
  z-index: 2;
}

/* Tile colors */
.tile[data-value="2"]    { background: #2a2a3e; color: var(--text-primary); font-size: 1.6rem; }
.tile[data-value="4"]    { background: #33334a; color: var(--text-primary); font-size: 1.6rem; }
.tile[data-value="8"]    { background: #c25e2e; color: #fff; font-size: 1.6rem; }
.tile[data-value="16"]   { background: #d4732a; color: #fff; font-size: 1.5rem; }
.tile[data-value="32"]   { background: #e05a3a; color: #fff; font-size: 1.5rem; }
.tile[data-value="64"]   { background: #e03030; color: #fff; font-size: 1.5rem; }
.tile[data-value="128"]  { background: #d4a017; color: #fff; font-size: 1.3rem; box-shadow: 0 0 16px rgba(212, 160, 23, 0.4); }
.tile[data-value="256"]  { background: #d4a017; color: #fff; font-size: 1.3rem; box-shadow: 0 0 24px rgba(212, 160, 23, 0.5); }
.tile[data-value="512"]  { background: #edc22e; color: #fff; font-size: 1.3rem; box-shadow: 0 0 30px rgba(237, 194, 46, 0.5); }
.tile[data-value="1024"] { background: #edc22e; color: #fff; font-size: 1.1rem; box-shadow: 0 0 36px rgba(237, 194, 46, 0.6); }
.tile[data-value="2048"] { background: var(--accent-primary); color: var(--bg-primary); font-size: 1.1rem; box-shadow: 0 0 50px rgba(0, 229, 160, 0.6); }

/* Super tiles (4096+) */
.tile.super {
  background: var(--accent-secondary);
  color: #fff;
  font-size: 0.95rem;
  box-shadow: var(--glow-secondary);
}

@keyframes tileAppear {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---- GAME OVER OVERLAY ---- */
.game-over-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(4px);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-normal);
  z-index: 10;
}

.game-over-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.game-over-overlay h2 {
  font-family: 'Space Mono', monospace;
  font-size: 1.5rem;
}

/* ---- CONTROLS ---- */
.game-controls {
  margin-top: var(--space-lg);
  display: flex;
  gap: var(--space-md);
}

.swipe-hint {
  margin-top: var(--space-md);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: 'Space Mono', monospace;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 420px) {
  .grid-bg-cell {
    width: 65px;
    height: 65px;
  }

  .grid-bg {
    gap: 8px;
  }

  .grid-container {
    padding: 8px;
  }

  .tile {
    font-size: 1.2rem !important;
  }

  .score-box .value {
    font-size: 1.3rem;
  }
}
