/* 2048 game — matches shared theme vars from games/style.css */
#gm2048Stage { max-width: 460px; margin: 0 auto; }

.gm-2048-statsbar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.gm-2048-stat {
  flex: 1;
  background: var(--primary-tint);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  text-align: center;
}
.gm-2048-stat .gm-stat-label {
  display: block; font-size: .68rem; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); margin-bottom: 2px;
}
.gm-2048-stat .gm-stat-value {
  display: block; font-weight: 800; font-size: 1.15rem; color: var(--primary);
}

.gm-2048-board-wrap {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 10px;
}

.gm-2048-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 10px;
  aspect-ratio: 1 / 1;
  touch-action: none;
  user-select: none;
}

.gm-2048-cell {
  background: rgba(0,0,0,.05);
  border-radius: 8px;
}

.gm-2048-tile {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-weight: 800;
  font-family: var(--font-display);
  transition: top .12s ease, left .12s ease, transform .12s ease;
  z-index: 2;
}

.gm-2048-tile.gm-tile-new { animation: gmTileAppear .18s ease; }
.gm-2048-tile.gm-tile-merged { animation: gmTileMerge .18s ease; z-index: 3; }

@keyframes gmTileAppear {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}
@keyframes gmTileMerge {
  0% { transform: scale(1); }
  50% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* Tile color scale — bold, saturated tones for strong contrast against a light page background */
.gm-2048-tile { font-size: 1.7rem; }
.gm-2048-tile[data-value="2"]    { background: #e0dfff; color: #4c3d99; }
.gm-2048-tile[data-value="4"]    { background: #c7c1ff; color: #3a2e80; }
.gm-2048-tile[data-value="8"]    { background: #ff9f43; color: #fff; }
.gm-2048-tile[data-value="16"]   { background: #ff7e29; color: #fff; }
.gm-2048-tile[data-value="32"]   { background: #ff5e1a; color: #fff; }
.gm-2048-tile[data-value="64"]   { background: #ff3d0d; color: #fff; }
.gm-2048-tile[data-value="128"]  { background: #ffd23f; color: #4a3a00; font-size: 1.5em; }
.gm-2048-tile[data-value="256"]  { background: #ffc300; color: #4a3a00; font-size: 1.5em; }
.gm-2048-tile[data-value="512"]  { background: #ffb100; color: #fff; font-size: 1.5em; }
.gm-2048-tile[data-value="1024"] { background: #ff9500; color: #fff; font-size: 1.3em; }
.gm-2048-tile[data-value="2048"] { background: #22C55E; color: #fff; font-size: 1.3em; box-shadow: 0 0 20px rgba(34,197,94,.6); }
.gm-2048-tile[data-value="4096"],
.gm-2048-tile[data-value="8192"] { background: var(--primary); color: #fff; font-size: 1.1em; }

.gm-2048-hint { color: var(--muted); font-size: .82rem; }

/* On-screen directional controls */
.gm-2048-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}
.gm-2048-controls-row {
  display: flex;
  gap: 8px;
}
.gm-2048-arrow-btn {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .1s ease, background .15s ease;
}
.gm-2048-arrow-btn:active {
  transform: scale(0.92);
  background: var(--primary-dark);
}

@media (max-width: 575.98px) {
  .gm-2048-board { gap: 7px; }
  .gm-2048-board-wrap { padding: 6px; }
}

/* ===================== 2048 — Result overlay ===================== */
.gm-result-overlay {
  text-align: center;
  padding: 34px 20px;
  animation: gm2048ResultFadeIn .35s ease;
}
.gm-result-overlay .gm-result-icon {
  font-size: 3.6rem;
  line-height: 1;
  margin-bottom: 10px;
  display: block;
  color: #ff9500;
  animation: gm2048IconPop .5s cubic-bezier(.34,1.56,.64,1);
}
.gm-result-overlay h3 {
  font-weight: 800;
  margin-bottom: 4px;
  color: var(--ink, #16241E);
}
.gm-result-score {
  display: inline-block;
  margin: 16px 0;
  background: linear-gradient(135deg, #ffb100, #ff5e1a);
  color: #fff;
  font-weight: 800;
  font-size: 1.9rem;
  padding: 12px 34px;
  border-radius: 50px;
  box-shadow: 0 6px 18px rgba(255, 94, 26, .35);
  animation: gm2048ScorePop .45s .1s cubic-bezier(.34,1.56,.64,1) backwards;
}
.gm-login-prompt {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 12px;
  padding: 16px;
  margin-top: 14px;
  color: #7a5c00;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

@keyframes gm2048ResultFadeIn {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes gm2048IconPop {
  0% { transform: scale(0) rotate(-15deg); opacity: 0; }
  60% { transform: scale(1.15) rotate(5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); }
}
@keyframes gm2048ScorePop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}