/* ===== 2048 — 정사각 타일판 ===== */
.stage {
  display: flex; flex-direction: column; align-items: center;
  padding: 18px 16px 40px;
}
.board-area {
  position: relative;
  width: min(460px, 92vw, calc(100vh - 210px));
}
.board {
  width: 100%; aspect-ratio: 1;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  background: #17141F;
  border: 3px solid var(--wall);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  touch-action: none;
  outline: none;
}
.tile {
  display: grid; place-items: center;
  border-radius: 8px;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(.7rem, 3.4vw, 1.05rem);
  font-weight: 700;
  background: var(--panel);
  color: var(--ink-2);
  user-select: none;
}
.tile[data-v="2"] { background:#3A3350; color:#F4EFFA; }
.tile[data-v="4"] { background:#4A3F66; color:#F4EFFA; }
.tile[data-v="8"] { background:#6A5AE0; color:#fff; }
.tile[data-v="16"] { background:#8B7CFF; color:#fff; }
.tile[data-v="32"] { background:#5CE0B3; color:#17141F; }
.tile[data-v="64"] { background:#3FBF8F; color:#fff; }
.tile[data-v="128"] { background:#FFD166; color:#201A33; }
.tile[data-v="256"] { background:#FFB347; color:#201A33; }
.tile[data-v="512"] { background:#FF9F6E; color:#201A33; }
.tile[data-v="1024"] { background:#FF6B5E; color:#fff; font-size:.7em; }
.tile[data-v="2048"] { background:#FFD166; color:#201A33; font-size:.7em; box-shadow:0 0 18px rgba(255,209,102,.7); }
.tile.big { font-size:.62em; }
.tile.pop { animation: tilePop .14s ease; }
@keyframes tilePop { 0% { transform: scale(.4); } 80% { transform: scale(1.08); } }

.score-line {
  margin-top: 12px; font-size: .9rem; color: var(--ink-2);
}
.score-line b { color: var(--gold); font-variant-numeric: tabular-nums; }

.overlay-btns { display: grid; gap: 10px; justify-items: center; }
.overlay-btns-sub { display: flex; gap: 8px; }

.modal {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center;
  background: rgba(14,11,20,.7);
  backdrop-filter: blur(6px);
  padding: 20px;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 26px 26px 24px;
  max-width: 480px; width: 100%;
  max-height: 85vh; overflow-y: auto;
}
.modal-card h2 { font-size: 1.1rem; font-weight: 800; margin-bottom: 14px; }
.modal-card .btn-primary { margin-top: 18px; width: 100%; }
.how-list { list-style: none; display: grid; gap: 10px; }
.how-list li { font-size: .88rem; line-height: 1.6; color: var(--ink-2); }
.how-controls {
  margin-top: 14px; padding-top: 12px;
  border-top: 1px dashed rgba(255,255,255,.12);
  font-size: .78rem; color: var(--ink-2);
}
.log-table .rank-1 td:first-child { color: #FFD166; font-weight: 800; }
.log-table .rank-2 td:first-child { color: #C9C3DD; font-weight: 800; }
.log-table .rank-3 td:first-child { color: #D2936B; font-weight: 800; }
