/* =============================================================================
   2048 — game-specific styles (board, tiles per value).
   Loaded together with games.css via $extraCss. Uses site design tokens;
   the per-value tile colours are deliberate literals (the classic 2048 palette),
   like the classic number colours in games-saper.css.
   ============================================================================= */

.g2048-grid-wrap {
    max-width: 480px;
    margin: 0 auto;
}

.g2048-grid {
    --g2048-gap: 10px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: var(--g2048-gap);
    width: 100%;
    aspect-ratio: 1;
    background: var(--color-gray-300);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: var(--g2048-gap);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.g2048-grid:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* ---------------- Tiles ---------------- */

.g2048-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
    background: var(--color-gray-200);
    color: var(--color-gray-900);
    font-family: var(--font-family);
    font-weight: 700;
    font-size: clamp(1.1rem, 6vw, 2.1rem);
    line-height: 1;
    aspect-ratio: 1;
    transition: var(--transition-fast);
}

.g2048-tile--filled {
    box-shadow: var(--shadow-sm);
}

/* Per-value tile colours (classic 2048 palette — deliberate literals). */
.g2048-t-2    { background: #eee4da; color: #776e65; }
.g2048-t-4    { background: #ede0c8; color: #776e65; }
.g2048-t-8    { background: #f2b179; color: #f9f6f2; }
.g2048-t-16   { background: #f59563; color: #f9f6f2; }
.g2048-t-32   { background: #f67c5f; color: #f9f6f2; }
.g2048-t-64   { background: #f65e3b; color: #f9f6f2; }
.g2048-t-128  { background: #edcf72; color: #f9f6f2; font-size: clamp(1rem, 5.2vw, 1.85rem); }
.g2048-t-256  { background: #edcc61; color: #f9f6f2; font-size: clamp(1rem, 5.2vw, 1.85rem); }
.g2048-t-512  { background: #edc850; color: #f9f6f2; font-size: clamp(1rem, 5.2vw, 1.85rem); }
.g2048-t-1024 { background: #edc53f; color: #f9f6f2; font-size: clamp(0.85rem, 4.2vw, 1.5rem); }
.g2048-t-2048 { background: #edc22e; color: #f9f6f2; font-size: clamp(0.85rem, 4.2vw, 1.5rem); }

/* Anything beyond 2048. */
.g2048-t-super { background: #3c3a32; color: #f9f6f2; font-size: clamp(0.8rem, 4vw, 1.4rem); }

/* ---------------- Stats modal extra ---------------- */

.g2048-best-line {
    margin-top: 0.75rem;
    color: var(--color-gray-700);
}

/* ---------------- Responsive ---------------- */

@media (max-width: 600px) {
    .g2048-grid {
        --g2048-gap: 8px;
    }
}
