/* Codalata 2048 — play.php styling (loaded with topbar.css only, no global site CSS).
 * Night chrome locked to module tokens; tile color ramp is an intentional in-game palette. */

* { box-sizing: border-box; }

html, body.t48-root {
    margin: 0;
    padding: 0;
    height: 100%;
    background: #0b0d18;
    color: #f3f0e7;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    overflow: hidden;
    overscroll-behavior: none;
}

.t48-container {
    position: relative;
    width: 100%;
    height: calc(100vh - 40px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.t48-screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    text-align: center;
    padding: 1.5rem;
}

.t48-screen.hidden { display: none; }

.t48-screen h1 {
    margin: 0;
    font-size: 2.4rem;
    letter-spacing: 1px;
    text-shadow: 0 2px 0 #000;
}

.t48-tagline {
    margin: 0;
    max-width: 28rem;
    opacity: 0.8;
    line-height: 1.5;
}

.t48-best { margin: 0; font-size: 1.1rem; opacity: 0.9; }
.t48-best span,
.stats span { font-variant-numeric: tabular-nums; font-weight: 700; }

.t48-guest-note,
.t48-go-message {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.85;
    max-width: 28rem;
}

.t48-guest-note a,
.t48-go-message a {
    color: #ffcf5c;
    font-weight: 600;
}

/* Score bar above the board */
.t48-scorebar {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    background: #111426;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.4rem 1rem;
}

.t48-scorelabel {
    font-size: 0.75rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    opacity: 0.6;
}

#hud-score {
    font-size: 1.6rem;
    font-weight: 800;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.t48-hint { margin: 0; font-size: 0.8rem; opacity: 0.55; }

/* Board */
.t48-board {
    width: min(86vw, 64vh, 460px);
    aspect-ratio: 1 / 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 2.6%;
    padding: 2.6%;
    background: #0f1426;
    border-radius: 12px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
    touch-action: none;
    user-select: none;
}

.t48-cell {
    background: rgba(255, 255, 255, 0.045);
    border-radius: 8px;
    position: relative;
}

.t48-tile {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    /* Scales with board size; clamps keep big numbers readable */
    font-size: clamp(1rem, 6vw, 2.2rem);
    color: #f3f0e7;
    background: #2b3252;
}

/* Tile color ramp — slate -> blue accent -> teal -> amber/gold */
.t48-tile[data-val="2"]    { background: #2b3252; }
.t48-tile[data-val="4"]    { background: #394066; }
.t48-tile[data-val="8"]    { background: #4a5180; }
.t48-tile[data-val="16"]   { background: #5a6acf; }
.t48-tile[data-val="32"]   { background: #4f7fd1; }
.t48-tile[data-val="64"]   { background: #4fb0d1; }
.t48-tile[data-val="128"]  { background: #4fd1c5; color: #0c1a18; font-size: clamp(0.9rem, 5.4vw, 2rem); }
.t48-tile[data-val="256"]  { background: #6fd9a0; color: #0c1a14; font-size: clamp(0.9rem, 5.4vw, 2rem); }
.t48-tile[data-val="512"]  { background: #b8c84f; color: #1a1d06; font-size: clamp(0.9rem, 5.4vw, 2rem); }
.t48-tile[data-val="1024"] { background: #e0a82e; color: #1a1206; font-size: clamp(0.8rem, 4.6vw, 1.7rem); }
.t48-tile[data-val="2048"] { background: #ffcf5c; color: #1a1206; font-size: clamp(0.8rem, 4.6vw, 1.7rem); box-shadow: 0 0 18px rgba(255, 207, 92, 0.6); }
/* Beyond 2048 */
.t48-tile[data-val="4096"],
.t48-tile[data-val="8192"],
.t48-tile.t48-super { background: #ff8c42; color: #1a1206; font-size: clamp(0.75rem, 4.2vw, 1.5rem); box-shadow: 0 0 18px rgba(255, 140, 66, 0.6); }

@keyframes t48-pop {
    0%   { transform: scale(0.5); }
    70%  { transform: scale(1.08); }
    100% { transform: scale(1); }
}

@keyframes t48-merge-pop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.18); }
    100% { transform: scale(1); }
}

.t48-tile.t48-new    { animation: t48-pop 0.14s ease-out; }
.t48-tile.t48-merged { animation: t48-merge-pop 0.16s ease-out; }

.stats { margin: 0; line-height: 1.6; }
.stats p { margin: 0.15rem 0; font-size: 1.15rem; }

.game-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 0.5rem;
}

#start-game,
#play-again,
.game-actions .btn {
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    border: 1px solid #555;
    background-color: #2b2b2b;
    color: #f0f0f0;
    cursor: pointer;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
}

#start-game,
#play-again {
    background-color: #e0a82e;
    border-color: #e0a82e;
    color: #1a1206;
}

#start-game:hover,
#play-again:hover,
.game-actions .btn:hover { filter: brightness(1.1); }

@media (max-width: 720px) {
    .t48-container { height: calc(100vh - 36px); }
    .t48-screen h1 { font-size: 1.9rem; }
}
