/* ============================================================
   /1to50/game.css — minimal styles needed for the 1-to-50 game
   to work alongside the Memphis design system. Everything else
   (header, footer, page chrome) comes from /css/design-system.css.
   The selectors here MUST keep their names because /js/gridgame.js
   queries them by id and class.
   ============================================================ */

/* Local container — design system uses .ds-container, the game uses .wrap */
.wrap {
    width: 100%;
    max-width: 540px;
    margin: 0 auto;
    position: relative;
    overflow-x: hidden;
}

/* Result-completed splash (full-screen overlay link triggered when game ends) */
.resultLink {
    display: none;
}
#grid .resultLink {
    display: block;
    position: absolute;
    top: 110px;
    left: 0;
    width: 100%;
    padding: 30px 16px;
    text-align: center;
    text-decoration: none;
    z-index: 100;
    line-height: 1.4;
}
#test-completed {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 800;
    color: var(--c-ink);
    background-color: var(--c-yellow);
    border: 3px solid var(--c-ink);
    border-radius: var(--r-md);
    box-shadow: var(--sh-sticker);
    padding: 18px 24px;
}

/* Timer + level readout — Memphis sticker bar */
.headerFix {
    position: static;
    height: auto;
    width: 100%;
    margin: 0 0 var(--s-5);
}
.header {
    width: 100%;
    height: auto;
    margin: 0;
}
.topInfo {
    width: 100%;
    background-color: var(--c-paper);
    border: 2px solid var(--c-ink);
    border-radius: var(--r-md);
    box-shadow: var(--sh-sticker-sm);
    padding: var(--s-3) var(--s-5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
}
.topInfo #time {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 800;
    color: var(--c-cobalt);
    line-height: 1.1;
    letter-spacing: -0.02em;
    width: auto;
    margin: 0;
}
.topInfo .level {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    color: var(--c-ink-muted);
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0;
}
.topInfo #score {
    font-family: var(--font-display);
    color: var(--c-ink);
    font-weight: 800;
    font-size: 22px;
    margin-left: 6px;
}

/* Caption + reset button above the grid */
.description {
    text-align: center;
    margin: 0 0 var(--s-5);
}
.description .game-caption {
    font-family: var(--font-body);
    font-size: 16px;
    color: var(--c-ink);
    line-height: 1.5;
    margin: 0 0 var(--s-3);
}
.description .game-caption b {
    font-weight: 700;
    color: var(--c-cobalt);
}
.description .resetBtn {
    display: inline-block;
    background-color: var(--c-paper);
    color: var(--c-ink);
    padding: 8px 18px;
    border: 2px solid var(--c-ink);
    border-radius: var(--r-pill);
    box-shadow: 2px 2px 0 0 var(--c-ink);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    font-family: var(--font-body);
    line-height: 1;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}
.description .resetBtn:hover {
    background-color: var(--c-yellow);
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 0 var(--c-ink);
    text-decoration: none;
}
.description .resetBtn:active {
    transform: translate(0, 0);
    box-shadow: 1px 1px 0 0 var(--c-ink);
}

/* Game grid — the part /js/gridgame.js actually drives */
.stage { padding: 0; }
.grid {
    margin: 0 auto;
    width: 100%;
    max-width: 360px;
    height: 360px;
    padding: 0;
    background-color: var(--c-mist);
    border: 2px solid var(--c-ink);
    border-radius: var(--r-md);
    box-shadow: var(--sh-sticker-sm);
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
}
.grid div {
    float: left;
    margin: 0.5%;
    background-color: var(--c-cobalt);
    color: var(--c-paper);
    text-align: center;
    font-family: var(--font-display);
    font-weight: 800;
    border-radius: 8px;
    border: 2px solid var(--c-ink);
    box-shadow: 1px 1px 0 0 var(--c-ink);
    position: relative;
    overflow: visible;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.08s ease;
    box-sizing: border-box;
}
.grid div:active {
    transform: scale(0.94);
}
.grid div span {
    position: absolute;
    left: -20%;
    top: -20%;
    width: 140%;
    height: 140%;
    z-index: 1;
}
.grid div.second {
    background-color: var(--c-pink);
    color: var(--c-paper);
}

/* Sizing variants — 1to50 uses x5. Use line-height to vertical-center
   since /js/gridgame.js sets the cell text directly as innerHTML. */
.grid.x2 div { width: 49%; height: 49%; line-height: 170px; font-size: 56px; }
.grid.x3 div { width: 32.3%; height: 32.3%; line-height: 110px; font-size: 44px; }
.grid.x4 div { width: 24%; height: 24%; line-height: 78px; font-size: 32px; }
.grid.x5 div { width: 19%; height: 19%; line-height: 64px; font-size: 26px; }
.grid.x8 div { width: 11.5%; height: 11.5%; line-height: 36px; font-size: 16px; }

/* Mobile tweak — grid scales down to fit */
@media (max-width: 380px) {
    .grid { height: 320px; }
    .grid.x5 div { line-height: 56px; font-size: 22px; }
    .topInfo #time { font-size: 26px; }
}
