/* An arcade cabinet in the Woodgrain palette: hexes sampled from Evan-Amos's public-domain Commons photo of the
   four-switch woodgrain Atari 2600. */
:root {
    --room: #141312;
    --bg: #2d2d2c;
    --panel: #42413f;
    --glass: #0c0c0b;
    --lcd: #121110;
    --edge: #2b2927;
    --text: #fffbf1;
    --muted: #a69c8b;
    --faint: #6e675d;
    --accent: #df7a40;
    --accent-deep: #9c4a1e;
    --glow: rgba(223, 122, 64, 0.55);
    --wood: #805c3e;
    --wood-dark: #5e432c;
    --wood-light: #93694a;
    --display: "Bungee", "Arial Black", Impact, sans-serif;
    --led: "VT323", ui-monospace, "SF Mono", Menlo, monospace;
    --font: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    padding: 28px 16px 48px;
    color: var(--text);
    font-family: var(--font);
    background: radial-gradient(ellipse 80% 60% at 50% 0%, #34302c 0%, var(--room) 70%) fixed, var(--room);
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- Cabinet ---------- */
.cabinet {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    border-radius: 16px 16px 8px 8px;
    /* side panels: vertical woodgrain, with orange T-molding on the outer edges */
    background:
        repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.09) 0 2px, transparent 2px 9px),
        repeating-linear-gradient(90deg, rgba(255, 240, 220, 0.05) 0 1px, transparent 1px 23px),
        linear-gradient(90deg, var(--wood-dark), var(--wood) 18%, var(--wood-light) 42%, var(--wood) 63%, var(--wood-light) 84%, var(--wood-dark));
    box-shadow:
        inset 3px 0 0 var(--accent), inset -3px 0 0 var(--accent),
        0 40px 80px -20px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(0, 0, 0, 0.6);
}

.marquee {
    margin: 0 -20px;
    padding: 22px 28px 18px;
    text-align: center;
    border-radius: 16px 16px 0 0;
    background:
        radial-gradient(ellipse 60% 90% at 50% 45%, rgba(223, 122, 64, 0.28), transparent 70%),
        linear-gradient(#251912, #120c09);
    border-bottom: 3px solid #050505;
    box-shadow: inset 0 0 0 3px var(--accent), inset 0 -18px 30px rgba(0, 0, 0, 0.5);
}
.marquee h1 {
    margin: 0;
    font-family: var(--display);
    font-weight: 400;
    font-size: clamp(28px, 5.4vw, 52px);
    line-height: 1;
    letter-spacing: 0.02em;
    color: #fff1df;
    text-shadow: 0 0 2px #fff, 0 0 12px var(--accent), 0 0 32px var(--glow), 0 3px 0 var(--accent-deep);
}
.marquee p { margin: 10px auto 0; max-width: 680px; color: var(--muted); font-size: 15px; line-height: 1.5; }

/* ---------- Bezel: screen + readouts ---------- */
.bezel {
    display: grid;
    grid-template-columns: minmax(0, 460px) minmax(0, 1fr);
    gap: 22px;
    margin-top: 18px;
    padding: 18px;
    border-radius: 12px;
    background: linear-gradient(160deg, #1b1a19, var(--glass) 55%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), inset 0 0 0 1px #000, 0 2px 0 rgba(255, 255, 255, 0.05);
}

.crt {
    position: relative;
    align-self: start;
    aspect-ratio: 480 / 420;
    border-radius: 22px / 26px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 0 0 10px #050505, 0 0 0 11px var(--edge), 0 0 40px rgba(223, 122, 64, 0.08);
    margin: 11px;
}
#screen { display: block; width: 100%; height: 100%; image-rendering: pixelated; filter: saturate(1.08) contrast(1.04); }
/* scanlines, vignette and a glass glare; none of them take pointer events */
.crt::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(130deg, rgba(255, 255, 255, 0.07), transparent 32%),
        radial-gradient(ellipse at center, transparent 58%, rgba(0, 0, 0, 0.55) 100%),
        repeating-linear-gradient(rgba(0, 0, 0, 0.2) 0 1px, transparent 1px 3px);
    border-radius: inherit;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.85);
}

.loading {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    text-align: center;
    background: rgba(0, 0, 0, 0.72);
    font-family: var(--led);
    font-size: 24px;
    color: var(--accent);
    text-shadow: 0 0 8px var(--glow);
}
.loading p { margin: 0; }
.loading[hidden] { display: none; }
.progress { width: 60%; height: 6px; background: #241a14; border-radius: 3px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); box-shadow: 0 0 10px var(--glow); transition: width 0.2s; }

.readouts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-content: start; min-width: 0; }
.readouts .lcd:last-child { grid-column: 1 / -1; }
.lcd {
    padding: 10px 14px 12px;
    border-radius: 8px;
    background: var(--lcd);
    border: 1px solid var(--edge);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6);
}
.label {
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}
.led {
    font-family: var(--led);
    font-size: 44px;
    line-height: 0.9;
    color: var(--accent);
    text-shadow: 0 0 10px var(--glow);
    font-variant-numeric: tabular-nums;
}
.led.small { font-size: 26px; line-height: 1; }
.scores { display: grid; gap: 10px; min-width: 128px; }
.scores > div { display: flex; flex-direction: column; }

/* learning curve: average score of each snapshot */
.curve { display: block; width: 100%; height: auto; overflow: visible; padding: 10px 12px 4px; border-radius: 8px; background: var(--lcd); border: 1px solid var(--edge); box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6); }
.curve text { font-family: var(--led); font-size: 15px; fill: var(--muted); }
.curve .axis { stroke: #34312e; }
.curve .human { stroke: var(--text); stroke-opacity: 0.6; stroke-dasharray: 3 4; }
.curve .line { fill: none; stroke: var(--accent); stroke-width: 2; filter: drop-shadow(0 0 4px var(--glow)); }
.curve .pt { fill: var(--wood-light); cursor: pointer; }
.curve .pt.on { fill: var(--text); filter: drop-shadow(0 0 6px var(--accent)); }

.frames { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.frames canvas { width: 100%; aspect-ratio: 1; image-rendering: pixelated; background: #000; border-radius: 3px; }

.qbars { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 4px 10px; align-items: center; }
.qbars .name { font-family: var(--led); font-size: 17px; line-height: 1; color: var(--muted); white-space: nowrap; }
.qbars .bar { position: relative; height: 9px; overflow: hidden; border-radius: 2px; background: #1e1c1a; }
.qbars .bar span { position: absolute; inset: 0 auto 0 0; background: var(--wood); }
.qbars .chosen.name { color: var(--text); }
.qbars .chosen.bar span { background: var(--accent); box-shadow: 0 0 8px var(--glow); }

/* ---------- Control deck ---------- */
.deck {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 32px;
    align-items: start;
    margin: 20px -6px 0;
    padding: 22px 28px 24px;
    border-radius: 12px 12px 4px 4px;
    background: linear-gradient(#34322f, #1f1e1c 70%);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.09), inset 0 -3px 0 rgba(0, 0, 0, 0.5), 0 10px 18px rgba(0, 0, 0, 0.45);
}
.deck-group { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.deck-label { font-family: var(--display); font-size: 12px; letter-spacing: 0.1em; color: var(--muted); }

.games { display: flex; flex-wrap: wrap; gap: 16px; }
.games button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 76px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    text-align: center;
}
.games .cap {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: radial-gradient(circle at 36% 30%, #fffaf0, #d9cfbd 40%, #8c8473 100%);
    box-shadow: 0 5px 0 #3b3833, 0 8px 12px rgba(0, 0, 0, 0.6), inset 0 -3px 6px rgba(0, 0, 0, 0.25), 0 0 0 4px #121110;
    transition: transform 0.08s, box-shadow 0.08s;
}
.games button:active .cap { transform: translateY(3px); box-shadow: 0 2px 0 #3b3833, 0 3px 6px rgba(0, 0, 0, 0.6), 0 0 0 4px #121110; }
.games button[aria-selected="true"] .cap {
    background: radial-gradient(circle at 36% 30%, #ffd2ae, var(--accent) 45%, var(--accent-deep) 100%);
    box-shadow: 0 5px 0 #5a2a10, 0 8px 12px rgba(0, 0, 0, 0.6), 0 0 0 4px #121110, 0 0 22px var(--glow);
}
.games .name { font-size: 12px; font-weight: 600; line-height: 1.25; color: var(--text); }
.games small { display: block; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.games button:disabled { cursor: default; }
.games button:disabled .cap { background: radial-gradient(circle at 36% 30%, #6d675e, #45413c 60%, #2c2a27); }
.games button:disabled .name { color: var(--faint); }

/* the practice lever: a recessed slot and a ball-top knob */
.lever { padding: 8px 4px 2px; }
.lever input { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 34px; margin: 0; background: none; cursor: pointer; }
.lever input::-webkit-slider-runnable-track {
    height: 12px;
    border-radius: 6px;
    background: #090908;
    box-shadow: inset 0 2px 4px #000, 0 1px 0 rgba(255, 255, 255, 0.07);
}
.lever input::-moz-range-track { height: 12px; border-radius: 6px; background: #090908; box-shadow: inset 0 2px 4px #000, 0 1px 0 rgba(255, 255, 255, 0.07); }
.lever input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 32px;
    height: 32px;
    margin-top: -10px;
    border: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 36% 30%, #ffd2ae, var(--accent) 45%, var(--accent-deep) 100%);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.7), 0 0 14px var(--glow);
}
.lever input::-moz-range-thumb {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 36% 30%, #ffd2ae, var(--accent) 45%, var(--accent-deep) 100%);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.7), 0 0 14px var(--glow);
}
.practice-read { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; }
.practice-read .note { flex: 1; min-width: 200px; }
.note { margin: 0; font-size: 13px; line-height: 1.45; color: var(--muted); }

.menu-group { align-items: stretch; }
.sound-button { font-size: 13px; padding: 10px 16px; }
.sound-button::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; vertical-align: 1px; background: #3a3632; }
.sound-button.live::before { background: var(--accent); box-shadow: 0 0 8px var(--glow); }
.menu-button {
    padding: 14px 22px;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    font-family: var(--display);
    font-size: 16px;
    letter-spacing: 0.06em;
    color: var(--text);
    background: linear-gradient(#4a4744, #2a2826);
    box-shadow: 0 5px 0 #121110, 0 8px 14px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transition: transform 0.08s, box-shadow 0.08s;
}
.menu-button:hover { color: var(--accent); text-shadow: 0 0 8px var(--glow); }
.menu-button:active { transform: translateY(3px); box-shadow: 0 2px 0 #121110, 0 3px 6px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.15); }

/* kick plate with a coin door */
.kick { display: flex; justify-content: center; padding: 22px 0 26px; }
.coin {
    display: flex;
    gap: 18px;
    padding: 12px 20px;
    border-radius: 6px;
    background: linear-gradient(#2a2826, #141312);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 6px rgba(0, 0, 0, 0.6);
}
.coin span {
    width: 26px;
    height: 34px;
    border-radius: 4px;
    background: linear-gradient(#e6a070, var(--accent) 50%, var(--accent-deep));
    box-shadow: 0 0 14px var(--glow), inset 0 0 0 2px rgba(0, 0, 0, 0.35);
    position: relative;
}
.coin span::after { content: ""; position: absolute; left: 11px; top: 7px; width: 4px; height: 20px; border-radius: 2px; background: #1b0f08; }

/* ---------- Operator menu ---------- */
.menu {
    width: min(960px, calc(100vw - 32px));
    height: min(640px, calc(100vh - 32px));
    max-width: none;
    max-height: none;
    padding: 0;
    border: 0;
    border-radius: 22px;
    background: #050505;
    color: var(--text);
    box-shadow: 0 0 0 1px var(--edge), 0 30px 80px rgba(0, 0, 0, 0.8);
    overflow: hidden;
}
.menu::backdrop { background: rgba(8, 7, 6, 0.8); backdrop-filter: blur(3px); }
.menu-screen {
    position: relative;
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    margin: 10px;
    height: calc(100% - 20px);
    border-radius: 16px;
    background: radial-gradient(ellipse at 30% 20%, #1d1713, #0b0a09 70%);
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.9), 0 0 0 1px var(--edge);
    overflow: hidden;
}
.menu-screen::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 3px);
}
.menu-list { display: flex; flex-direction: column; gap: 2px; padding: 28px 12px 28px 24px; border-right: 1px solid #241f1b; }
.menu-title { margin: 0 0 16px 22px; font-family: var(--display); font-size: 13px; letter-spacing: 0.1em; color: var(--accent); text-shadow: 0 0 8px var(--glow); }
.menu-list button {
    position: relative;
    padding: 6px 8px 6px 22px;
    border: 0;
    background: none;
    cursor: pointer;
    text-align: left;
    font-family: var(--led);
    font-size: 26px;
    line-height: 1.05;
    color: var(--muted);
}
.menu-list button:hover, .menu-list button[aria-current="true"] { color: var(--accent); text-shadow: 0 0 8px var(--glow); }
.menu-list button[aria-current="true"]::before { content: "▶"; position: absolute; left: 0; top: 7px; font-size: 18px; }
.menu-list button[data-close] { margin-top: auto; }
.menu-body { overflow-y: auto; padding: 30px 36px 36px; font-size: 16px; line-height: 1.65; scrollbar-color: #3a342f transparent; }
.menu-body section[hidden] { display: none; }
.menu-body h2 { margin: 0 0 14px; font-family: var(--led); font-weight: 400; font-size: 40px; line-height: 1; color: var(--accent); text-shadow: 0 0 10px var(--glow); }
.menu-body p { margin: 0 0 14px; max-width: 62ch; }
.menu-body ul { margin: 0; padding-left: 1.2em; max-width: 62ch; }
.menu-body li { margin: 8px 0; }
.menu-body li::marker { color: var(--accent); }

table.results { width: 100%; margin-bottom: 16px; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.results th, table.results td { padding: 8px 8px; text-align: right; border-bottom: 1px solid #2a2622; }
table.results th:first-child, table.results td:first-child { text-align: left; }
table.results th { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); vertical-align: bottom; }
table.results .dim { color: var(--faint); }
table.results .ours { color: var(--accent); font-weight: 600; }

/* ---------- Narrow screens ---------- */
@media (max-width: 860px) {
    .bezel { grid-template-columns: minmax(0, 1fr); padding: 14px; }
    .crt { max-width: 520px; width: calc(100% - 22px); justify-self: center; }
    .deck { grid-template-columns: minmax(0, 1fr); gap: 22px; }
}
@media (max-width: 600px) {
    body { padding: 12px 8px 32px; }
    .cabinet { padding: 0 10px; }
    .marquee { margin: 0 -10px; padding: 22px 16px 18px; }
    .marquee p { font-size: 14px; }
    .crt { margin: 8px; }
    .deck { margin: 16px 0 0; padding: 18px 16px; }
    .games { gap: 10px; justify-content: space-between; }
    .games button { width: 64px; }
    .games .cap { width: 46px; height: 46px; }
    .led { font-size: 36px; }
    .menu-screen { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
    .menu-list { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: 4px; padding: 14px 12px; border-right: 0; border-bottom: 1px solid #241f1b; }
    .menu-title { display: none; }
    .menu-list button { flex: none; font-size: 22px; padding: 4px 10px; }
    .menu-list button[aria-current="true"]::before { content: none; }
    .menu-list button[data-close] { margin-top: 0; }
    .menu-body { padding: 20px 18px 28px; font-size: 15px; }
    .menu-body h2 { font-size: 32px; }
}
