/* ============================================================
   2048 — Game Styles
   ============================================================ */

.scores-row {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
    justify-content: center;
}

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

.score-label {
    display: block;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.score-value {
    display: block;
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-primary);
}

/* ---- Board ---- */
.board {
    position: relative;
    width: min(90vw, 400px);
    aspect-ratio: 1;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 2px solid var(--color-surface-2);
    padding: var(--space-sm);
    touch-action: none;
}

.board-bg {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: var(--space-sm);
    width: 100%;
    height: 100%;
}

.grid-cell {
    background: var(--color-surface-2);
    border-radius: var(--radius-md);
}

/* ---- Tile Layer ---- */
.tile-layer {
    position: absolute;
    inset: var(--space-sm);
    pointer-events: none;
}

.tile {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    border-radius: var(--radius-md);
    transition: transform 120ms ease, left 120ms ease, top 120ms ease;
    --tile-size: calc((100% - 3 * var(--space-sm)) / 4);
    width: var(--tile-size);
    height: var(--tile-size);
}

/* Tile states by value */
.tile-2    { background: #eee4da; color: #776e65; font-size: 1.8rem; }
.tile-4    { background: #ede0c8; color: #776e65; font-size: 1.8rem; }
.tile-8    { background: #f2b179; color: #f9f6f2; font-size: 1.8rem; }
.tile-16   { background: #f59563; color: #f9f6f2; font-size: 1.8rem; }
.tile-32   { background: #f67c5f; color: #f9f6f2; font-size: 1.8rem; }
.tile-64   { background: #f65e3b; color: #f9f6f2; font-size: 1.8rem; }
.tile-128  { background: #edcf72; color: #f9f6f2; font-size: 1.5rem; }
.tile-256  { background: #edcc61; color: #f9f6f2; font-size: 1.5rem; }
.tile-512  { background: #edc850; color: #f9f6f2; font-size: 1.5rem; }
.tile-1024 { background: #edc53f; color: #f9f6f2; font-size: 1.2rem; }
.tile-2048 { background: #edc22e; color: #f9f6f2; font-size: 1.2rem; }

.tile-new {
    animation: tile-pop 200ms ease;
}

.tile-merged {
    animation: tile-merge 200ms ease;
    z-index: 2;
}

@keyframes tile-pop {
    0%   { transform: scale(0); }
    80%  { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes tile-merge {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.25); }
    100% { transform: scale(1); }
}

/* Responsive font sizing */
@media (max-width: 420px) {
    .tile-2, .tile-4, .tile-8, .tile-16, .tile-32, .tile-64 { font-size: 1.4rem; }
    .tile-128, .tile-256, .tile-512 { font-size: 1.1rem; }
    .tile-1024, .tile-2048 { font-size: 0.95rem; }
}
