/*
 * Stadium - the shell's look.
 *
 * One dark page, a card per mini-game, and a board that keeps its 16:9 shape at
 * any width. The colours match the game canvas (config.js / clearcut.js) so the
 * page and the playfield read as one surface.
 */

:root {
    --bg: #0a0f1a;
    --panel: #131b2b;
    --panel-2: #182338;
    --line: #24314a;
    --text: #e6edf7;
    --muted: #93a3bd;
    --accent: #ffd23f;
    --accent-2: #38bdf8;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    color: var(--text);
    background:
        radial-gradient(900px 420px at 12% -10%, rgba(56, 189, 248, 0.12), transparent 60%),
        radial-gradient(760px 420px at 100% 0%, rgba(255, 210, 63, 0.08), transparent 55%),
        var(--bg);
    font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.stadium {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ------------------------------- top bar ------------------------------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    background: rgba(10, 15, 26, 0.86);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}

.topbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: 1040px;
    margin: 0 auto;
    padding: 12px 20px;
}

.topbar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.topbar__mark {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #ffd23f, #f72585, #4cc9f0, #80ed99, #ffd23f);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12) inset;
}

.topbar__sub {
    color: var(--muted);
    font-weight: 500;
}

.topbar__home {
    color: var(--accent-2);
    text-decoration: none;
    font-size: 0.9rem;
    white-space: nowrap;
}

.topbar__home:hover {
    text-decoration: underline;
}

/* --------------------------------- main -------------------------------- */

.main {
    flex: 1;
    width: 100%;
    max-width: 1040px;
    margin: 0 auto;
    padding: 26px 20px 48px;
}

.screen--wide {
    max-width: none;
}

.lede {
    margin: 0 0 20px;
    color: var(--muted);
    max-width: 68ch;
}

.screen__title {
    margin: 0 0 6px;
    font-size: clamp(1.4rem, 3vw, 1.9rem);
}

.screen__blurb {
    margin: 0 0 4px;
    color: var(--text);
}

.screen__control {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 0.9rem;
}

/* -------------------------------- games -------------------------------- */

.games {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.game {
    display: flex;
}

.game__button {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    padding: 14px 16px;
    text-align: left;
    color: var(--text);
    background: linear-gradient(180deg, var(--panel), var(--panel-2));
    border: 1px solid var(--line);
    border-radius: 14px;
    font: inherit;
    cursor: pointer;
    transition: border-color 120ms ease, transform 120ms ease;
}

.game__button:hover:enabled {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.game__button:focus-visible {
    outline: 2px solid var(--accent-2);
    outline-offset: 2px;
}

.game__button:disabled {
    cursor: default;
    opacity: 0.62;
}

.game__name {
    font-weight: 700;
    font-size: 1.02rem;
}

.game__mon {
    color: var(--accent-2);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.game__blurb {
    color: var(--muted);
    font-size: 0.88rem;
}

.game__tag {
    align-self: flex-start;
    margin-top: 6px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #0a0f1a;
    background: var(--accent);
}

.game--soon .game__tag {
    color: var(--muted);
    background: transparent;
    border: 1px solid var(--line);
}

/* ------------------------------ seat setup ----------------------------- */

.field {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.field__label {
    font-weight: 600;
}

.chips {
    display: flex;
    gap: 8px;
}

.chip {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--text);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.chip[aria-pressed="true"] {
    border-color: var(--accent);
    background: var(--accent);
    color: #0a0f1a;
}

.chip:focus-visible {
    outline: 2px solid var(--accent-2);
    outline-offset: 2px;
}

.hint {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 10px 0 0;
}

.hint--center {
    text-align: center;
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 22px;
}

.button {
    padding: 11px 20px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: var(--accent);
    color: #0a0f1a;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.button:hover {
    filter: brightness(1.06);
}

.button:focus-visible {
    outline: 2px solid var(--accent-2);
    outline-offset: 2px;
}

.button--ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--line);
}

/* -------------------------------- board -------------------------------- */

.board {
    position: relative;
    width: 100%;
    max-width: 1040px;
    margin: 0 auto;
    padding: 8px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #060a12;
}

.board canvas {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    border-radius: 10px;
    background: #0a0f1a;
}

/* The between-rounds card: the board holds still until this is dismissed. */

.round-pop {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 18px;
    border-radius: 15px;
    background: rgba(4, 7, 12, 0.74);
    backdrop-filter: blur(3px);
}

.round-pop[hidden] {
    display: none;
}

.round-pop__card {
    width: min(440px, 100%);
    max-height: 100%;
    overflow: auto;
    padding: 20px 22px 18px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, var(--panel-2), var(--panel));
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
    text-align: center;
}

.round-pop__eyebrow {
    margin: 0;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.round-pop__title {
    margin: 4px 0 14px;
    font-size: 1.35rem;
}

.round-pop__list {
    margin: 0 0 16px;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}

.round-pop__row {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) auto auto auto;
    align-items: baseline;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
}

.round-pop__row--win {
    background: rgba(255, 210, 63, 0.14);
}

.round-pop__place {
    color: var(--muted);
    font-weight: 800;
    text-align: center;
}

.round-pop__name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.round-pop__gap {
    color: var(--muted);
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.round-pop__points,
.round-pop__total {
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.round-pop__total {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.82rem;
}

.round-pop__hint {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.82rem;
}

/* ------------------------------ standings ------------------------------ */

.standings {
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.row {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--panel);
}

.row--win {
    border-color: var(--accent);
    background: linear-gradient(180deg, rgba(255, 210, 63, 0.10), var(--panel));
}

.row__place {
    font-weight: 800;
    color: var(--muted);
    text-align: center;
}

.row--win .row__place {
    color: var(--accent);
}

.row__name {
    font-weight: 600;
}

.row__score {
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

/* --------------------------------- foot -------------------------------- */

.foot {
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.8rem;
}

.foot p {
    max-width: 1040px;
    margin: 0 auto;
    padding: 16px 20px;
}

.foot__stamp {
    color: var(--line);
}

@media (max-width: 560px) {
    .topbar__brand {
        font-size: 0.95rem;
    }

    .topbar__sub {
        display: none;
    }

    .main {
        padding: 20px 14px 40px;
    }

    /* The card has to fit a phone-width board: drop the distance column and
       tighten the rows rather than let the card scroll inside 200px. */
    .round-pop {
        padding: 10px;
    }

    .round-pop__card {
        padding: 14px 14px 12px;
    }

    .round-pop__title {
        margin-bottom: 10px;
        font-size: 1.15rem;
    }

    .round-pop__row {
        grid-template-columns: 20px minmax(0, 1fr) auto auto;
        gap: 6px;
        padding: 6px 8px;
    }

    .round-pop__gap {
        display: none;
    }
}

