/* ── 덴장게임 2048 ── */
.game-page { max-width: 600px; margin: 0 auto; padding: 16px; }

/* 설명 카드 */
.game-info-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.game-info-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 10px; padding: 14px; }
.game-info-title { font-size: 13px; font-weight: 800; margin-bottom: 8px; }
.game-info-list { list-style: none; padding: 0; margin: 0; font-size: 12px; color: var(--color-text-secondary); line-height: 1.8; }
.game-info-list li::before { content: '• '; color: var(--color-primary); font-weight: 700; }
.game-tile-preview { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.game-tile-preview span { font-size: 11px; background: var(--color-bg); border-radius: 4px; padding: 2px 5px; white-space: nowrap; }
@media (max-width: 480px) {
  .game-info-row { grid-template-columns: 1fr; }
}
.game-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.game-header h2 { font-size: 20px; font-weight: 800; margin: 0; }
.game-scores { display: flex; gap: 8px; }
.game-score-box { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 8px; padding: 6px 14px; text-align: center; min-width: 70px; }
.game-score-box .label { font-size: 10px; font-weight: 700; color: var(--color-text-secondary); text-transform: uppercase; }
.game-score-box .value { font-size: 18px; font-weight: 800; color: var(--color-primary); }

.game-board-wrap { position: relative; width: 100%; max-width: 400px; margin: 0 auto 16px; aspect-ratio: 1; touch-action: none; user-select: none; -webkit-user-select: none; }
.game-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 8px; background: var(--color-surface-2, #bbada0); border-radius: 12px; width: 100%; height: 100%; }
.game-cell { background: var(--color-bg, rgba(238,228,218,0.35)); border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 28px; font-weight: 800; position: relative; transition: all 0.1s; aspect-ratio: 1; overflow: hidden; }

/* 타일 색상 */
.tile-2    { background: #eee4da; }
.tile-4    { background: #ede0c8; }
.tile-8    { background: #f2b179; color: #fff; }
.tile-16   { background: #f59563; color: #fff; }
.tile-32   { background: #f67c5f; color: #fff; }
.tile-64   { background: #f65e3b; color: #fff; }
.tile-128  { background: #edcf72; color: #fff; font-size: 24px; }
.tile-256  { background: #edcc61; color: #fff; font-size: 24px; }
.tile-512  { background: #edc850; color: #fff; font-size: 24px; }
.tile-1024 { background: #edc53f; color: #fff; font-size: 20px; }
.tile-2048 { background: #edc22e; color: #fff; font-size: 20px; }
.tile-4096 { background: #3c3a32; color: #fff; font-size: 20px; }
.tile-8192 { background: #3c3a32; color: #f9f6f2; font-size: 18px; }

[data-theme="dark"] .game-board { background: #3a3530; }
[data-theme="dark"] .game-cell { background: rgba(255,255,255,0.08); }
[data-theme="dark"] .tile-2 { background: #504a44; color: #eee; }
[data-theme="dark"] .tile-4 { background: #5a5348; color: #eee; }

.tile-emoji { font-size: 26px; line-height: 1; }
.tile-num { font-size: 11px; opacity: 0.7; margin-top: 1px; }

@keyframes tile-pop { 0% { transform: scale(0); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }
.tile-new { animation: tile-pop 0.15s ease; }
@keyframes tile-merge { 0% { transform: scale(1); } 50% { transform: scale(1.2); } 100% { transform: scale(1); } }
.tile-merged { animation: tile-merge 0.15s ease; }

.game-controls { display: flex; gap: 8px; justify-content: center; margin-bottom: 20px; }
.game-controls button { padding: 10px 20px; border-radius: 8px; font-weight: 700; font-size: 14px; }

.game-over-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; z-index: 10; }
.game-over-overlay h3 { color: #fff; font-size: 24px; font-weight: 800; margin: 0; }
.game-over-overlay .final-score { color: #fbbf24; font-size: 32px; font-weight: 800; }

/* 리더보드 */
.game-leaderboard { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 12px; padding: 16px; }
.game-leaderboard h3 { font-size: 16px; font-weight: 700; margin: 0 0 12px; }
.lb-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--color-border); font-size: 13px; }
.lb-row:last-child { border-bottom: none; }
.lb-rank { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex-shrink: 0; }
.lb-rank-1 { background: #fbbf24; color: #78350f; }
.lb-rank-2 { background: #d1d5db; color: #374151; }
.lb-rank-3 { background: #d97706; color: #fff; }
.lb-rank-default { background: var(--color-bg); color: var(--color-text-secondary); }
.lb-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-weight: 800; color: var(--color-primary); }
.lb-tile { font-size: 16px; }

/* 뱃지 */
.game-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.game-badge { padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; background: var(--color-surface); border: 1px solid var(--color-border); }
.game-badge-1024 { border-color: #10b981; color: #10b981; }
.game-badge-2048 { border-color: #f59e0b; color: #f59e0b; }
.game-badge-4096 { border-color: #ef4444; color: #ef4444; }

/* 모바일 방향키 */
.game-dpad { display: none; margin: 0 auto 16px; width: fit-content; }
@media (max-width: 768px) {
  .game-dpad { display: grid; grid-template-columns: 60px 60px 60px; grid-template-rows: 60px 60px; gap: 4px; }
  .game-dpad button { border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-surface); font-size: 22px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
  .game-cell { font-size: 20px; }
  .tile-emoji { font-size: 20px; }
  .tile-128 .tile-emoji, .tile-256 .tile-emoji, .tile-512 .tile-emoji { font-size: 18px; }
  .tile-1024 .tile-emoji, .tile-2048 .tile-emoji { font-size: 16px; }
}
