@font-face {
    font-family: "Barlow Condensed";
    src: url("fonts/barlow-condensed-600.ttf") format("truetype");
    font-weight: 600;
    font-display: swap;
}

@font-face {
    font-family: "Barlow Condensed";
    src: url("fonts/barlow-condensed-700.ttf") format("truetype");
    font-weight: 700;
    font-display: swap;
}

@font-face {
    font-family: "Barlow Condensed";
    src: url("fonts/barlow-condensed-800.ttf") format("truetype");
    font-weight: 800;
    font-display: swap;
}

:root {
    color-scheme: dark;
    --ink: #090d14;
    --ink-soft: #121926;
    --paper: #eee2c8;
    --paper-bright: #f8efd9;
    --paper-quiet: #cbbfa7;
    --print: #15191f;
    --red: #f0442c;
    --red-dark: #b8271b;
    --blue: #2254bc;
    --blue-dark: #12347e;
    --lime: #d8ff38;
    --focus: #8eb8ff;
    --display: "Barlow Condensed", sans-serif;
    --body: "Avenir Next", Avenir, "Segoe UI", sans-serif;
    --ease-out: cubic-bezier(.16, 1, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { min-width: 320px; background: var(--ink); }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--paper-bright);
    font-family: var(--body);
    background:
        radial-gradient(ellipse at 88% 8%, rgba(34, 84, 188, .24), transparent 29rem),
        radial-gradient(ellipse at 7% 92%, rgba(240, 68, 44, .13), transparent 27rem),
        linear-gradient(145deg, #080b11 0%, #0b1019 56%, #080b10 100%);
    accent-color: var(--red);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: .26;
    background-image: url("images/ticket-paper.png");
    background-size: 760px;
    mix-blend-mode: soft-light;
}

::selection { background: var(--red); color: var(--paper-bright); }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: var(--blue); border: 3px solid var(--ink); }

button, input, a { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
a { color: inherit; text-underline-offset: .2em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }

.site-shell { min-height: 100vh; }

.game-stage {
    width: min(1180px, calc(100% - 40px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 24px 0 34px;
    display: flex;
    flex-direction: column;
    isolation: isolate;
}

.masthead {
    min-height: 62px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    border-bottom: 1px solid rgba(238, 226, 200, .25);
}

.masthead p {
    margin: 0;
    color: var(--paper-quiet);
    font-family: var(--display);
    font-size: 1.16rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.wordmark {
    display: inline-flex;
    width: max-content;
    align-items: center;
    gap: 10px;
    color: var(--paper-bright);
    text-decoration: none;
    font-family: var(--display);
    font-size: clamp(1.7rem, 3vw, 2.45rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.025em;
    text-transform: uppercase;
}

.wordmark svg { width: 30px; fill: var(--red); }

.language-switch {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 9px;
    font-family: var(--display);
    font-size: 1.12rem;
    font-weight: 700;
    letter-spacing: .06em;
}

.language-switch a { color: var(--paper-quiet); text-decoration: none; padding: 7px 1px; }
.language-switch a.active { color: var(--red); border-bottom: 2px solid currentColor; }

.pass-rail {
    position: relative;
    z-index: 3;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    margin: 18px 16px -10px;
    padding: 0;
    list-style: none;
    filter: drop-shadow(0 14px 16px rgba(0, 0, 0, .32));
}

.pass-tab {
    min-width: 0;
    min-height: 86px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 14px 12px;
    color: rgba(21, 25, 31, .62);
    background-color: #c9bea7;
    background-image: linear-gradient(rgba(238, 226, 200, .78), rgba(238, 226, 200, .78)), url("images/ticket-paper.png");
    background-size: auto, 580px;
    border-right: 2px dotted rgba(21, 25, 31, .45);
    font-family: var(--display);
    font-size: clamp(1rem, 2.3vw, 1.8rem);
    font-weight: 800;
    letter-spacing: -.015em;
    text-transform: uppercase;
    transition: transform .35s var(--ease-out), color .35s var(--ease-out), background-color .35s var(--ease-out);
}

.pass-tab:first-child { clip-path: polygon(0 12%, 4% 12%, 4% 0, 96% 0, 96% 12%, 100% 12%, 100% 88%, 96% 88%, 96% 100%, 4% 100%, 4% 88%, 0 88%); }
.pass-tab:last-child { border-right: 0; }
.pass-tab.active { color: var(--paper-bright); background-color: var(--red); background-image: linear-gradient(rgba(240, 68, 44, .82), rgba(240, 68, 44, .82)), url("images/ticket-paper.png"); transform: translateY(-5px) rotate(-.35deg); }
.pass-tab.complete { color: var(--paper-bright); background-color: var(--blue); background-image: linear-gradient(rgba(34, 84, 188, .84), rgba(34, 84, 188, .84)), url("images/ticket-paper.png"); }
.pass-status { display: inline-flex; width: 20px; height: 20px; flex: 0 0 auto; }
.pass-status svg { width: 100%; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.active-pass,
.loading-pass,
.error-pass,
.result-board {
    position: relative;
    width: 100%;
    min-height: 610px;
    color: var(--print);
    background-color: var(--paper);
    background-image: linear-gradient(rgba(238, 226, 200, .8), rgba(238, 226, 200, .8)), url("images/ticket-paper.png");
    background-size: auto, 760px;
    filter: drop-shadow(0 32px 38px rgba(0, 0, 0, .46));
    clip-path: polygon(0 2%, 1.2% 2%, 1.2% 0, 98.8% 0, 98.8% 2%, 100% 2%, 100% 98%, 98.8% 98%, 98.8% 100%, 1.2% 100%, 1.2% 98%, 0 98%);
}

.active-pass {
    display: grid;
    grid-template-columns: 74px 1fr;
    overflow: visible;
    background: none;
    filter: none;
    clip-path: none;
    isolation: isolate;
}

.active-pass::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    background-color: var(--paper);
    background-image: linear-gradient(rgba(238, 226, 200, .8), rgba(238, 226, 200, .8)), url("images/ticket-paper.png");
    background-size: auto, 760px;
    filter: drop-shadow(0 32px 38px rgba(0, 0, 0, .46));
    clip-path: polygon(0 2%, 1.2% 2%, 1.2% 0, 98.8% 0, 98.8% 2%, 100% 2%, 100% 98%, 98.8% 98%, 98.8% 100%, 1.2% 100%, 1.2% 98%, 0 98%);
}

.ticket-spine {
    border-right: 2px dashed rgba(21, 25, 31, .36);
    padding: 28px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    color: var(--red-dark);
    font-family: var(--display);
    font-weight: 800;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    letter-spacing: .1em;
}

.barcode {
    width: 24px;
    height: 118px;
    background: linear-gradient(90deg, var(--print) 0 8%, transparent 8% 15%, var(--print) 15% 21%, transparent 21% 32%, var(--print) 32% 45%, transparent 45% 50%, var(--print) 50% 57%, transparent 57% 69%, var(--print) 69% 86%, transparent 86% 91%, var(--print) 91%);
}

.pass-content { min-width: 0; padding: 42px clamp(30px, 6vw, 78px) 36px; }

.game-heading-row { display: flex; align-items: end; justify-content: space-between; gap: 24px; border-bottom: 3px solid var(--red); }
.game-heading-row h1 { margin: 0 0 8px; font-family: var(--display); font-size: clamp(2.5rem, 6vw, 5.6rem); font-weight: 800; line-height: .86; letter-spacing: -.035em; text-transform: uppercase; }
.serial { margin-bottom: 13px; font-family: var(--display); font-size: 1rem; font-weight: 700; letter-spacing: .14em; white-space: nowrap; }

.player-grid {
    display: grid;
    grid-template-columns: minmax(170px, 250px) minmax(220px, 1fr) minmax(150px, 210px);
    align-items: center;
    gap: clamp(24px, 5vw, 64px);
    padding: 38px 0 30px;
}

.play-button {
    aspect-ratio: 1;
    width: min(100%, 218px);
    border: 7px solid var(--red);
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--paper-bright);
    background: var(--red);
    box-shadow: inset 0 0 0 8px var(--paper), inset 0 0 0 12px var(--red), 0 14px 25px rgba(69, 27, 18, .2);
    transition: transform .25s var(--ease-out), background-color .25s var(--ease-out), box-shadow .25s var(--ease-out);
}

.play-button:hover:not(:disabled) { transform: scale(1.035) rotate(-1.5deg); background: var(--red-dark); box-shadow: inset 0 0 0 8px var(--paper), inset 0 0 0 12px var(--red), 0 18px 34px rgba(69, 27, 18, .3); }
.play-button:active:not(:disabled) { transform: scale(.97); }
.play-button svg { grid-area: 1 / 1; width: 42%; fill: currentColor; }
.play-button .pause-icon { display: none; }
.play-button.is-playing { background: var(--red-dark); }
.play-button.is-playing .play-icon { display: none; }
.play-button.is-playing .pause-icon { display: block; }

.time-readout { display: flex; align-items: baseline; gap: 12px; }
.time-readout strong { color: var(--red); font-family: var(--display); font-size: clamp(4.2rem, 10vw, 8.2rem); font-weight: 800; line-height: .8; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.time-readout span { font-family: var(--display); font-size: clamp(1.35rem, 3vw, 2.3rem); font-weight: 700; text-transform: uppercase; }

.attempt-readout { border-top: 2px solid var(--blue); border-bottom: 2px solid var(--blue); padding: 14px 0; font-family: var(--display); text-transform: uppercase; }
.attempt-readout span { display: block; color: var(--blue-dark); font-size: 1rem; font-weight: 700; letter-spacing: .1em; }
.attempt-readout strong { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; }

.punch-row {
    position: relative;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: clamp(12px, 3vw, 38px);
    margin: 0;
    padding: 0 0 30px;
    list-style: none;
}

.punch-row::before { content: ""; position: absolute; top: 25px; left: 6%; right: 6%; height: 2px; background: rgba(21, 25, 31, .26); }
.punch-row li { position: relative; z-index: 1; min-width: 0; display: grid; justify-items: center; gap: 7px; color: rgba(21, 25, 31, .56); font-family: var(--display); font-weight: 800; font-variant-numeric: tabular-nums; }
.punch-mark { width: 52px; height: 52px; border: 3px solid rgba(21, 25, 31, .35); border-radius: 50%; display: grid; place-items: center; background: var(--paper); transition: transform .28s var(--ease-out), background-color .28s var(--ease-out), color .28s var(--ease-out); }
.punch-row li small { padding: 1px 5px; color: #4c4a45; background: var(--paper); font-family: var(--display); font-size: .9rem; font-weight: 700; line-height: 1; white-space: nowrap; }
.punch-row li.current .punch-mark { border-color: var(--red); color: var(--red-dark); box-shadow: inset 0 0 0 5px var(--paper), inset 0 0 0 8px var(--red); }
.punch-row li.current small { color: var(--red-dark); }
.punch-row li.spent .punch-mark { color: var(--paper-quiet); background: var(--print); border-color: var(--print); transform: rotate(-8deg) scale(.9); }
.punch-row li.spent small { color: var(--print); text-decoration: line-through; text-decoration-thickness: 2px; }

.attempt-history {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 24px;
    margin: 0 0 22px;
    padding: 0;
    list-style: none;
    border-top: 2px solid var(--blue-dark);
}

.attempt-history li { min-width: 0; min-height: 54px; display: grid; grid-template-columns: 26px 22px minmax(0, 1fr) auto; gap: 9px; align-items: center; border-bottom: 2px dotted rgba(21, 25, 31, .28); }
.history-number { color: var(--blue-dark); font-family: var(--display); font-size: 1.2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.history-icon { width: 20px; height: 20px; display: inline-flex; color: var(--red-dark); }
.history-icon svg { width: 100%; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.attempt-history li.skipped .history-icon svg { fill: currentColor; stroke: none; }
.attempt-history li.correct .history-icon { color: #2d5400; }
.attempt-history li.artist-match .history-icon { color: var(--blue-dark); }
.history-copy { min-width: 0; display: flex; flex-direction: column; }
.history-copy strong, .history-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-copy strong { font-size: .96rem; }
.history-copy small { color: #4c4a45; }
.history-state { color: var(--red-dark); font-family: var(--display); font-size: .85rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.attempt-history li.skipped .history-state { color: var(--blue-dark); }
.attempt-history li.correct .history-state { color: #2d5400; }
.attempt-history li.artist-match .history-state { color: var(--blue-dark); }

.clue-hints {
    display: flex;
    align-items: center;
    gap: 18px;
    margin: -8px 0 22px;
    border-block: 2px dotted rgba(18, 52, 126, .46);
    padding: 11px 0;
    color: var(--print);
}
.clue-hints > span { flex: 0 0 auto; color: var(--red-dark); font-family: var(--display); font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.clue-hints dl, .reveal-metadata { min-width: 0; display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0; }
.clue-hints dl > div, .reveal-metadata > div { min-width: 0; display: flex; gap: 7px; align-items: baseline; }
.clue-hints dt, .reveal-metadata dt { color: #4c4a45; font-family: var(--display); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.clue-hints dd, .reveal-metadata dd { min-width: 0; margin: 0; overflow-wrap: anywhere; font-weight: 700; }

.answer-zone { position: relative; z-index: 20; }
.search-wrap { height: 68px; display: flex; align-items: center; border: 3px solid var(--blue-dark); background: rgba(248, 239, 217, .58); transition: box-shadow .25s var(--ease-out), background .25s var(--ease-out); }
.search-wrap:focus-within { background: var(--paper-bright); box-shadow: 0 12px 24px rgba(18, 52, 126, .18); }
.search-wrap > svg { width: 27px; margin: 0 18px; fill: none; stroke: var(--blue-dark); stroke-width: 2; stroke-linecap: round; }
.search-wrap input { min-width: 0; flex: 1; height: 100%; border: 0; outline: 0; color: var(--print); background: transparent; font-size: 1.08rem; caret-color: var(--red); }
.search-wrap input::placeholder { color: #565b60; opacity: 1; }
.submit-guess { align-self: stretch; border: 0; padding: 0 28px; color: var(--paper-bright); background: var(--blue); font-family: var(--display); font-size: 1.25rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.submit-guess:hover { background: var(--blue-dark); }

.suggestions { position: absolute; z-index: 30; inset: 72px 0 auto; max-height: min(310px, 46vh); overflow-y: auto; margin: 0; padding: 8px; list-style: none; color: var(--paper-bright); background: var(--ink-soft); box-shadow: 0 22px 32px rgba(0, 0, 0, .42); }
.suggestions button { width: 100%; border: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .7fr); gap: 20px; padding: 12px 14px; color: inherit; text-align: left; background: transparent; }
.suggestions button:hover, .suggestions button.highlighted { color: var(--ink); background: var(--paper); }
.suggestions strong, .suggestions span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggestions span { color: var(--paper-quiet); }
.suggestions button:hover span, .suggestions button.highlighted span { color: #4d4a43; }

.game-actions { display: flex; align-items: center; justify-content: center; gap: 34px; margin-top: 22px; }
.ticket-button { min-height: 56px; border: 0; padding: 12px 34px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-family: var(--display); font-size: 1.35rem; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; clip-path: polygon(0 15%, 4% 15%, 4% 0, 96% 0, 96% 15%, 100% 15%, 100% 85%, 96% 85%, 96% 100%, 4% 100%, 4% 85%, 0 85%); transition: transform .22s var(--ease-out), filter .22s var(--ease-out); }
.ticket-button:hover { transform: translateY(-2px) rotate(-.35deg); filter: brightness(1.08); }
.ticket-button.primary { color: var(--paper-bright); background: var(--red); }
.ticket-button.secondary { color: var(--paper-bright); background: var(--blue); }
.ticket-button svg { width: 22px; fill: currentColor; }
.give-up { border: 0; border-bottom: 2px solid currentColor; padding: 8px 3px 5px; color: #3f4243; background: transparent; font-family: var(--display); font-size: 1.1rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.give-up:hover { color: var(--red-dark); }

.stage-footer { display: flex; justify-content: space-between; padding: 15px 30px 0; color: var(--paper-quiet); font-family: var(--display); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }

.reveal-panel { min-height: 520px; display: grid; grid-template-columns: minmax(220px, 380px) 1fr; gap: 32px 64px; align-items: center; padding: 12px 0; }
.cover-wrap { position: relative; aspect-ratio: 1; transform: rotate(-2deg); animation: pass-in .65s var(--ease-out) both; }
.cover-wrap img, .cover-fallback { width: 100%; height: 100%; display: grid; place-items: center; object-fit: cover; color: var(--paper-bright); background: var(--blue); font-family: var(--display); font-size: 7rem; font-weight: 800; box-shadow: 0 25px 34px rgba(36, 28, 18, .26); }
.reveal-stamp { position: absolute; right: -18px; bottom: 24px; border: 6px double currentColor; padding: 7px 18px; font-family: var(--display); font-size: clamp(1.5rem, 4vw, 3rem); font-weight: 800; letter-spacing: .04em; text-transform: uppercase; transform: rotate(-8deg) scale(1); animation: stamp-in .55s .3s var(--ease-out) both; }
.reveal-stamp.solved { color: #2d5400; background: var(--lime); }
.reveal-stamp.unsolved { color: var(--paper-bright); background: var(--red-dark); }
.reveal-copy { min-width: 0; animation: copy-in .55s .18s var(--ease-out) both; }
.reveal-copy > span { color: var(--blue-dark); font-family: var(--display); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.reveal-copy h1 { max-width: 12ch; margin: 18px 0 8px; overflow-wrap: anywhere; font-family: var(--display); font-size: clamp(3.2rem, 7vw, 6rem); font-weight: 800; line-height: .87; letter-spacing: -.035em; text-transform: uppercase; }
.reveal-copy p { margin: 0 0 22px; font-size: clamp(1.25rem, 2.5vw, 1.8rem); }
.reveal-metadata { margin: -8px 0 20px; }
.reveal-metadata > div { border-bottom: 2px dotted rgba(21, 25, 31, .28); padding-bottom: 4px; }
.reveal-copy strong { display: block; width: max-content; margin-bottom: 20px; padding: 5px 12px; color: var(--paper-bright); background: var(--blue); font-family: var(--display); font-size: 1.5rem; }
.reveal-copy a { color: var(--blue-dark); font-weight: 700; }
.reveal-audio { grid-column: 1 / -1; display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 18px; align-items: center; border-top: 2px solid var(--blue-dark); border-bottom: 2px solid var(--blue-dark); padding: 16px 0; animation: copy-in .55s .28s var(--ease-out) both; }
.reveal-play-toggle { width: 58px; height: 58px; border: 0; border-radius: 50%; display: grid; place-items: center; color: var(--paper-bright); background: var(--blue); transition: transform .22s var(--ease-out), background-color .22s var(--ease-out); }
.reveal-play-toggle:hover { transform: scale(1.04) rotate(-1deg); background: var(--blue-dark); }
.reveal-play-toggle svg { grid-area: 1 / 1; width: 28px; fill: currentColor; }
.reveal-play-toggle .pause-icon { display: none; }
.reveal-play-toggle[data-playing="true"] .play-icon { display: none; }
.reveal-play-toggle[data-playing="true"] .pause-icon { display: block; }
.reveal-timeline-wrap { min-width: 0; }
.reveal-time-row { display: flex; justify-content: space-between; gap: 18px; margin-bottom: 10px; font-family: var(--display); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.reveal-time-row span { color: var(--blue-dark); font-variant-numeric: tabular-nums; white-space: nowrap; }
.reveal-timeline { --seek-progress: 0%; width: 100%; height: 28px; margin: 0; appearance: none; cursor: pointer; background: transparent; }
.reveal-timeline::-webkit-slider-runnable-track { height: 7px; background: linear-gradient(90deg, var(--red) 0 var(--seek-progress), rgba(21, 25, 31, .24) var(--seek-progress) 100%); }
.reveal-timeline::-moz-range-track { height: 7px; background: rgba(21, 25, 31, .24); }
.reveal-timeline::-moz-range-progress { height: 7px; background: var(--red); }
.reveal-timeline::-webkit-slider-thumb { width: 22px; height: 22px; margin-top: -7px; appearance: none; border: 4px solid var(--paper); border-radius: 50%; background: var(--red); box-shadow: 0 3px 8px rgba(21, 25, 31, .32); }
.reveal-timeline::-moz-range-thumb { width: 16px; height: 16px; border: 4px solid var(--paper); border-radius: 50%; background: var(--red); box-shadow: 0 3px 8px rgba(21, 25, 31, .32); }
.reveal-history { grid-column: 1 / -1; width: 100%; margin-bottom: 0; }
.next-button { grid-column: 1 / -1; justify-self: center; min-width: 280px; }

.result-board { padding: 58px clamp(28px, 7vw, 88px); display: grid; grid-template-columns: .8fr 1.4fr; gap: 60px; align-items: center; }
.result-total { display: flex; flex-direction: column; align-items: start; }
.result-total span, .result-total small { font-family: var(--display); font-size: 1.4rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.result-total strong { color: var(--red); font-family: var(--display); font-size: clamp(6rem, 15vw, 11rem); font-weight: 800; line-height: .85; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.result-board > ol { margin: 0; padding: 0; list-style: none; }
.result-board li { display: grid; grid-template-columns: 100px 1fr auto; gap: 18px; align-items: baseline; padding: 13px 0; border-bottom: 2px dotted rgba(21, 25, 31, .28); }
.result-board li > span { color: var(--blue-dark); font-family: var(--display); font-weight: 800; text-transform: uppercase; }
.result-board li strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-board li small { color: #4c4a45; }
.result-actions { grid-column: 1 / -1; display: flex; justify-content: center; gap: 24px; }

.loading-pass, .error-pass { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; }
.loading-pass strong, .error-pass strong { font-family: var(--display); font-size: 2.5rem; font-weight: 800; text-transform: uppercase; }
.loading-pass small { color: #565149; }
.error-pass p { max-width: 52ch; margin: 0 0 18px; color: #3e3b36; }
.spinner { width: 60px; height: 60px; border: 7px dotted var(--red); border-radius: 50%; animation: spin 1.1s linear infinite; }

.has-wrong-pulse .active-pass { animation: wrong-punch .38s var(--ease-out); }
.confetti-canvas { position: fixed; inset: 0; z-index: 100; width: 100%; height: 100%; pointer-events: none; }

#blazor-error-ui { position: fixed; z-index: 1000; inset: auto 0 0; display: none; padding: 12px 20px; color: var(--paper-bright); background: var(--red-dark); }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes wrong-punch { 35% { transform: translateX(-10px) rotate(-.4deg); filter: saturate(1.4); } 70% { transform: translateX(7px) rotate(.25deg); } }
@keyframes pass-in { from { opacity: .25; transform: translateY(40px) rotate(5deg) scale(.9); filter: blur(8px); } }
@keyframes copy-in { from { opacity: .25; transform: translateX(36px); filter: blur(6px); } }
@keyframes stamp-in { from { opacity: 0; transform: rotate(-18deg) scale(1.7); filter: blur(4px); } }

@media (max-width: 800px) {
    .game-stage { width: min(100% - 20px, 660px); padding-top: 10px; }
    .masthead { grid-template-columns: 1fr auto; min-height: 54px; }
    .masthead p { display: none; }
    .wordmark { font-size: 1.85rem; }
    .wordmark svg { width: 24px; }
    .pass-rail { margin: 12px 6px -7px; }
    .pass-tab { min-height: 62px; flex-direction: column; gap: 2px; padding: 7px 2px; font-size: clamp(.7rem, 3.4vw, 1rem); letter-spacing: 0; }
    .pass-status { width: 14px; height: 14px; }
    .active-pass, .loading-pass, .error-pass, .result-board { min-height: calc(100vh - 150px); }
    .loading-pass, .error-pass, .result-board, .active-pass::before { clip-path: polygon(0 1%, 2% 1%, 2% 0, 98% 0, 98% 1%, 100% 1%, 100% 99%, 98% 99%, 98% 100%, 2% 100%, 2% 99%, 0 99%); }
    .active-pass { grid-template-columns: 38px 1fr; }
    .ticket-spine { padding: 18px 8px; font-size: .72rem; }
    .barcode { width: 16px; height: 82px; }
    .pass-content { padding: 28px 18px 24px; }
    .game-heading-row { align-items: center; }
    .game-heading-row h1 { font-size: clamp(2.25rem, 11vw, 3.6rem); }
    .serial { display: none; }
    .player-grid { grid-template-columns: 115px 1fr; gap: 20px; padding: 30px 0 24px; }
    .play-button { width: 112px; border-width: 5px; }
    .time-readout { align-self: center; flex-wrap: wrap; gap: 3px 8px; }
    .time-readout strong { font-size: clamp(4rem, 21vw, 6rem); }
    .time-readout span { font-size: 1.2rem; }
    .attempt-readout { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; padding: 8px 0; }
    .attempt-readout span { display: inline; }
    .attempt-readout strong { font-size: 1.5rem; }
    .punch-row { gap: 8px; padding-bottom: 24px; }
    .punch-row::before { top: 18px; }
    .punch-mark { width: 38px; height: 38px; }
    .punch-row li small { font-size: .76rem; }
    .attempt-history { grid-template-columns: 1fr; }
    .clue-hints { align-items: flex-start; }
    .clue-hints dl { gap: 6px 18px; }
    .search-wrap { height: 60px; }
    .search-wrap > svg { width: 23px; margin: 0 12px; }
    .search-wrap input { font-size: 1rem; }
    .submit-guess { padding: 0 14px; font-size: 1rem; }
    .suggestions button { grid-template-columns: 1fr; gap: 3px; }
    .game-actions { flex-direction: column; gap: 10px; margin-top: 18px; }
    .ticket-button { width: 100%; }
    .stage-footer { padding-inline: 10px; font-size: .78rem; }
    .reveal-panel { min-height: calc(100vh - 210px); grid-template-columns: 1fr; gap: 24px; align-content: center; text-align: center; }
    .cover-wrap { width: min(64vw, 260px); justify-self: center; }
    .reveal-copy { display: flex; flex-direction: column; align-items: center; }
    .reveal-copy h1 { max-width: 10ch; margin-top: 10px; font-size: clamp(2.8rem, 14vw, 4.5rem); }
    .reveal-audio, .reveal-history { grid-column: auto; }
    .reveal-time-row { text-align: left; }
    .next-button { grid-column: auto; width: 100%; min-width: 0; }
    .result-board { grid-template-columns: 1fr; gap: 28px; padding: 36px 24px; }
    .result-total { align-items: center; }
    .result-total strong { font-size: clamp(6rem, 35vw, 9rem); }
    .result-board li { grid-template-columns: 76px 1fr; gap: 10px; }
    .result-board li small { grid-column: 2; }
    .result-actions { grid-column: auto; flex-direction: column; }
}

@media (max-width: 520px) {
    .game-stage { width: 100%; padding-top: 0; }
    .masthead { padding: 0 12px; }
    .pass-rail { margin-inline: 3px; }
    .pass-tab { min-height: 56px; font-size: .68rem; }
    .loading-pass, .error-pass, .result-board, .active-pass::before { clip-path: none; }
    .active-pass { grid-template-columns: minmax(0, 1fr); }
    .ticket-spine { display: none; }
    .pass-content { padding-inline: 14px; }
    .play-button { width: 96px; }
    .game-heading-row h1 { min-width: 0; overflow-wrap: anywhere; }
    .player-grid { grid-template-columns: 98px minmax(0, 1fr); gap: 14px; }
    .punch-mark { width: 34px; height: 34px; border-width: 2px; }
    .punch-row li small { font-size: .7rem; }
    .attempt-history li { grid-template-columns: 22px 19px minmax(0, 1fr); gap: 7px; }
    .history-state { grid-column: 3; justify-self: start; margin-top: -7px; }
    .clue-hints { flex-direction: column; gap: 5px; }
    .reveal-audio { grid-template-columns: 50px minmax(0, 1fr); gap: 12px; }
    .reveal-play-toggle { width: 48px; height: 48px; }
    .punch-row::before { top: 16px; }
    .stage-footer { gap: 14px; padding-bottom: 10px; }
    .stage-footer span { min-width: 0; }
    .stage-footer span:last-child { text-align: right; overflow-wrap: anywhere; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
    .spinner { animation: none; border-style: solid; border-color: var(--red) var(--paper-quiet) var(--paper-quiet); }
}
