/* The shell every game page shares: title block, HUD, board stage, overlay and side panels.
   A new game under games/<slug>/ gets all of this by linking this one file —
   only the bits unique to that game belong in games/<slug>/style.css. */

/* ---------- NAV, on a game page ----------
   This file only loads on game pages, so the nav is shorter here than on the
   rest of the site — the height goes to the board. */
@media (min-width: 981px) {
    .nav-inner {
        height: 54px;
    }
}

/* ---------- PAGE HEAD ---------- */
/* One slim row, so the board gets the height: back link, ages and a small
   title on the left, the best-score card on the right. */
.page-head {
    /* padding-block only — the side padding comes from .wrap-wide */
    padding-block: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px 16px;
    flex-wrap: wrap;
}
.page-head > div:first-child {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 12px;
}
.page-head h1 {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0;
    margin: 0;
}
.page-head .eyebrow {
    font-size: 11px;
    padding: 3px 10px;
    gap: 6px;
}
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
    transition: color 0.15s;
}
.back-link:hover {
    color: var(--blue);
}
.best-card {
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: var(--r-md);
    padding: 3px 12px;
    box-shadow: var(--shadow-card);
    text-align: right;
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.best-card span {
    font-family: "DM Mono", monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-soft);
}
.best-card strong {
    font-family: "Bricolage Grotesque";
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

/* ---------- GAME LAYOUT ---------- */
.game {
    /* everything above the board: nav, page head, HUD, the card's padding and
       a little breathing room. A game with more above its board (a question
       bar, say) raises this in its own style.css. */
    --above: 178px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 292px;
    gap: 18px;
    align-items: start;
    padding-bottom: 10px;
}
.board-card {
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: var(--r-lg);
    padding: 10px;
    box-shadow: var(--shadow-lift);
}
.hud {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 0 2px 8px;
}
.hud .stat {
    background: var(--tint);
    border-radius: 999px;
    padding: 4px 12px;
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.hud .stat u {
    text-decoration: none;
    font-family: "DM Mono", monospace;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-soft);
}
.hud .stat b {
    font-family: "Bricolage Grotesque";
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.hud .stat.warm {
    background: var(--tint-warm);
}
.hud-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}
.mini {
    border: 1.5px solid var(--line);
    background: var(--surface);
    border-radius: 999px;
    padding: 5px 13px;
    font-weight: 600;
    font-size: 13px;
    color: var(--ink);
    transition:
        background 0.15s,
        border-color 0.15s;
}
.mini:hover {
    background: var(--tint);
    border-color: var(--blue);
}

.stage {
    position: relative;
    border-radius: var(--r-md);
    overflow: hidden;
    background: #eef1e8;
    /* as wide as the column allows, but short enough that the whole board
       fits on the screen without a scroll */
    width: min(100%, max(420px, calc((100vh - var(--above)) * 4 / 3)));
    width: min(100%, max(420px, calc((100dvh - var(--above)) * 4 / 3)));
    margin-inline: auto;
}
.stage canvas {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    touch-action: manipulation;
}
.overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(27, 34, 64, 0.62);
    backdrop-filter: blur(3px);
    text-align: center;
    color: #fff;
    transition: opacity 0.2s;
}
.overlay[hidden] {
    display: none;
}
.overlay h2 {
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 800;
}
.overlay p {
    color: rgba(255, 255, 255, 0.82);
    max-width: 420px;
    margin: 12px auto 0;
    font-size: 15px;
}
.overlay .btn-primary {
    margin-top: 22px;
}
.final {
    display: flex;
    gap: 26px;
    justify-content: center;
    margin-top: 20px;
    font-family: "DM Mono", monospace;
    font-size: 12.5px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
}
.final[hidden] {
    display: none;
}
.final b {
    display: block;
    font-family: "Bricolage Grotesque";
    font-size: 30px;
    color: #fff;
    letter-spacing: -0.02em;
}

/* ---------- SIDE PANELS ---------- */
.side {
    display: grid;
    gap: 16px;
}
.panel {
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: var(--r-lg);
    padding: 18px;
    box-shadow: var(--shadow-card);
}
.panel h3 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 4px;
}
.panel .sub {
    font-size: 13.5px;
    color: var(--ink-soft);
    margin-bottom: 14px;
}

/* "For grown-ups" facts list (filled from the catalogue) */
.panel .facts {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 14px;
    font-size: 13.5px;
}
.panel .facts dt {
    color: var(--ink-soft);
}
.panel .facts dd {
    margin: 0;
    font-weight: 600;
}

/* progress / happiness meter */
.meter {
    height: 12px;
    border-radius: 999px;
    background: var(--tint);
    overflow: hidden;
    margin-top: 4px;
}
.meter i {
    display: block;
    height: 100%;
    width: 100%;
    background: var(--teal);
    border-radius: 999px;
    transition:
        width 0.2s linear,
        background 0.3s;
}

/* "how to play" list */
.rules {
    display: grid;
    gap: 10px;
    font-size: 14px;
    color: var(--ink-soft);
    margin: 0;
    list-style: none;
}
.rules li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.rules li span {
    flex: none;
    width: 22px;
    height: 22px;
    border-radius: 7px;
    display: grid;
    place-items: center;
    font-size: 12px;
    background: var(--tint);
}
.rules b {
    color: var(--ink);
    font-weight: 600;
}

/* "how to play" popup — game-shell.js moves the panel in here on page open */
.how-to {
    width: min(440px, calc(100vw - 32px));
    max-height: calc(100dvh - 32px);
    margin: auto;
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: var(--r-lg);
    padding: 22px;
    box-shadow: var(--shadow-lift);
    color: var(--ink);
}
.how-to::backdrop {
    background: rgba(27, 34, 64, 0.62);
    backdrop-filter: blur(3px);
}
.how-to h3 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 14px;
}
.how-to .btn-primary {
    margin-top: 20px;
    width: 100%;
    justify-content: center;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 980px) {
    .game {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 560px) {
    .best-card {
        text-align: left;
    }
    .hud {
        gap: 7px;
    }
    .hud .stat {
        padding: 6px 11px;
    }
    .hud .stat b {
        font-size: 16px;
    }
    .hud-actions {
        margin-left: 0;
    }
}
