/* v03 Arcade Cabinet: the cabinet, the CRT, the in-play HUD and the markers. Screens live in screens.css. */
/* if Google Fonts can't load, the stand-ins keep roughly the same size, so nothing wraps or clips */
/* our own 5x7 pixel font, drawn in font/build_font.py (no web fonts: they time out in the test Chrome) */
@font-face { font-family: 'IB Arcade'; src: url('font/arcade.ttf') format('truetype'); font-display: block; size-adjust: 108%; }
/* the body voice: a terminal mono, scaled so the sizes in these files read like a CRT readout */
@font-face { font-family: 'CRT Mono'; src: local('Menlo'), local('SF Mono'), local('Consolas'), local('Roboto Mono'), local('DejaVu Sans Mono'), local('Droid Sans Mono'), local('Courier New'); size-adjust: 66%; }
:root {
  --ink: #0a0614; --ink2: #150c2c; --ink3: #22154a;
  --cyan: #22e8ff; --pink: #ff2bd6; --yellow: #ffe600; --gold: #b39d00; --orange: #ff9f1a;
  --red: #ff3b5c; --green: #39ff6a; --white: #fff7ff; --mute: #a99bd6; --line: #3a2b6b;
  --px: 'IB Arcade', ui-monospace, monospace;
  --vt: 'CRT Mono', ui-monospace, monospace;
  --top: env(safe-area-inset-top, 0px); --bot: env(safe-area-inset-bottom, 0px);
  --glow-c: 0 0 6px rgba(34, 232, 255, .8), 0 0 18px rgba(34, 232, 255, .45);
  --glow-p: 0 0 6px rgba(255, 43, 214, .85), 0 0 20px rgba(255, 43, 214, .45);
  --glow-y: 0 0 6px rgba(255, 230, 0, .8), 0 0 22px rgba(255, 230, 0, .4);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--white); overflow: hidden; }
body { font: 22px/1.15 var(--vt); -webkit-font-smoothing: none; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- the cabinet (laptop) / the bare screen (phone) ---------- */
.room { position: fixed; inset: 0; background:
  radial-gradient(60% 50% at 50% 0%, rgba(255, 43, 214, .22), transparent 70%),
  radial-gradient(50% 60% at 50% 100%, rgba(34, 232, 255, .12), transparent 70%), var(--ink); }
.cab { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; }
.marquee, .deck { display: none; }
.bezel { position: relative; flex: 1; width: 100%; display: grid; place-items: center; }
.crt { position: absolute; inset: 0; overflow: hidden; background: var(--ink); isolation: isolate; }

@media (min-width: 960px) and (min-height: 660px) {
  .cab { --mq: 84px; --dk: 118px; --scr-h: calc(100vh - var(--mq) - var(--dk) - 44px);
    width: min(calc(var(--scr-h) * 4 / 3 + 120px), 100vw - 40px); left: 50%; transform: translateX(-50%);
    background: linear-gradient(90deg, #160b2e, #2a1656 8%, #1c0f3c 50%, #2a1656 92%, #160b2e);
    border-left: 6px solid #0c0620; border-right: 6px solid #0c0620;
    box-shadow: 0 0 0 2px var(--pink), 0 0 60px rgba(255, 43, 214, .35); }
  .cab::before, .cab::after { content: ''; position: absolute; top: 0; bottom: 0; width: 10px; pointer-events: none;
    background: repeating-linear-gradient(180deg, var(--cyan) 0 14px, transparent 14px 28px); opacity: .55; filter: blur(.5px); }
  .cab::before { left: 14px; } .cab::after { right: 14px; }
  .marquee { display: flex; position: relative; width: 100%; height: var(--mq); align-items: center; justify-content: center; gap: 22px;
    background: linear-gradient(180deg, #2b0a3a, #120624); border-bottom: 4px solid #0c0620; overflow: hidden; }
  .marquee__glow { position: absolute; inset: 0; background: radial-gradient(50% 120% at 50% 50%, rgba(255, 43, 214, .35), transparent 70%); animation: hum 3s ease-in-out infinite; }
  .marquee__logo { position: relative; font: 34px/1 var(--px); color: var(--yellow); text-shadow: 4px 4px 0 var(--pink), var(--glow-y); letter-spacing: 2px; }
  .marquee__logo i { font-style: normal; color: var(--cyan); text-shadow: 4px 4px 0 #6a1fb0, var(--glow-c); margin-left: 14px; }
  .marquee__sub { position: relative; font: 10px/1 var(--px); color: var(--mute); letter-spacing: 1px; }
  .bezel { flex: none; height: calc(var(--scr-h) + 44px); padding: 22px; }
  .crt { position: relative; inset: auto; width: calc(var(--scr-h) * 4 / 3); max-width: calc(100vw - 180px); height: var(--scr-h);
    border-radius: 22px; box-shadow: 0 0 0 10px #05030c, 0 0 0 13px #3a2b6b, 0 0 40px rgba(34, 232, 255, .25); }
  .deck { display: flex; width: 100%; height: var(--dk); align-items: center; justify-content: center; gap: 46px;
    background: linear-gradient(180deg, #3b1f74, #1a0d36); border-top: 4px solid #0c0620; transform-origin: top; }
  .stick { width: 70px; height: 70px; border-radius: 50%; background: radial-gradient(circle at 50% 40%, #222, #000); display: grid; place-items: center; box-shadow: 0 6px 0 #05030c; }
  .stick i { width: 16px; height: 46px; margin-top: -40px; background: linear-gradient(90deg, #555, #ccc, #555); border-radius: 8px; position: relative; transition: transform .12s; transform-origin: 50% 100%; }
  .stick i::before { content: ''; position: absolute; left: 50%; top: -24px; width: 40px; height: 40px; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ff8de9, var(--pink) 55%, #8a0f73); box-shadow: 0 0 14px rgba(255, 43, 214, .7); }
  .deck__btns { display: flex; gap: 14px; }
  .pad { width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer; font: 16px/1 var(--px); color: var(--ink);
    box-shadow: 0 7px 0 rgba(0, 0, 0, .55), inset 0 -6px 0 rgba(0, 0, 0, .25); transition: transform .08s, box-shadow .08s, filter .2s; filter: saturate(.55) brightness(.7); }
  .pad:active, .pad.is-hit { transform: translateY(5px); box-shadow: 0 2px 0 rgba(0, 0, 0, .55), inset 0 -3px 0 rgba(0, 0, 0, .25); }
  .pad--a { background: var(--yellow); } .pad--b { background: var(--cyan); } .pad--c { background: var(--pink); } .pad--d { background: var(--green); }
  .pad--start { width: 74px; height: 48px; border-radius: 10px; font-size: 10px; line-height: 1.4; background: #fff; }
  .pad.is-live { filter: none; box-shadow: 0 7px 0 rgba(0, 0, 0, .55), 0 0 18px currentColor, inset 0 -6px 0 rgba(0, 0, 0, .25); animation: padpulse .9s steps(2) infinite; }
  .slot { display: grid; justify-items: center; gap: 8px; font: 9px/1 var(--px); color: var(--orange); }
  .slot i { width: 14px; height: 40px; border-radius: 4px; background: #000; box-shadow: 0 0 0 4px #5a3d10, 0 0 12px var(--orange); }
}
@keyframes padpulse { 50% { filter: brightness(1.25); } }
@keyframes hum { 50% { opacity: .55; } }

/* ---------- the CRT glass ---------- */
.crt__fx { position: absolute; inset: 0; z-index: 40; pointer-events: none; border-radius: inherit;
  background:
    repeating-linear-gradient(180deg, rgba(0, 0, 0, .22) 0 1px, transparent 1px 3px),
    radial-gradient(130% 100% at 50% 50%, transparent 62%, rgba(0, 0, 0, .55) 100%);
  animation: flicker 4s steps(1) infinite; }
.crt__fx::after { content: ''; position: absolute; left: 0; right: 0; height: 18%; top: -20%;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, .045), transparent); animation: roll 7s linear infinite; }
@keyframes flicker { 0%, 100% { opacity: 1; } 47% { opacity: .9; } 48% { opacity: 1; } 81% { opacity: .94; } }
@keyframes roll { to { top: 110%; } }
.crt.is-glitch { animation: glitch .28s steps(3) 1; }
@keyframes glitch { 33% { filter: hue-rotate(60deg) saturate(2); transform: translateX(3px); } 66% { filter: hue-rotate(-40deg); transform: translateX(-2px); } }

.stage { position: absolute; inset: 0; z-index: 1; transition: filter .4s, opacity .4s; }
body[data-phase=landing] .stage { filter: saturate(1.2) brightness(.55); }
body[data-phase=intro] .stage, body[data-phase=between] .stage { filter: saturate(.7) brightness(.4); }
body[data-phase=boot] .stage, body[data-phase=gate] .stage, body[data-phase=results] .stage { visibility: hidden; }

/* synthwave floor for the screens with no pitch behind them */
.grid-bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; perspective: 320px; opacity: 0; transition: opacity .5s;
  background: linear-gradient(180deg, #0a0614 0%, #1d0838 45%, #3a0c4f 58%, #0a0614 58.2%); }
body[data-phase=boot] .grid-bg, body[data-phase=gate] .grid-bg, body[data-phase=results] .grid-bg { opacity: 1; }
.grid-bg::before { content: ''; position: absolute; left: 50%; top: 30%; width: 180px; height: 180px; transform: translateX(-50%); border-radius: 50%;
  background: repeating-linear-gradient(180deg, var(--yellow) 0 12px, var(--pink) 12px 13px, var(--yellow) 13px 18px, transparent 18px 22px), linear-gradient(var(--yellow), var(--pink));
  background-blend-mode: normal; opacity: .28; filter: blur(.5px); -webkit-mask: linear-gradient(180deg, #000 55%, transparent 100%); mask: linear-gradient(180deg, #000 55%, transparent 100%); }
.grid-bg::after { content: ''; position: absolute; left: -50%; right: -50%; top: 58%; height: 90%; transform-origin: top; transform: rotateX(62deg);
  background-image: linear-gradient(var(--pink) 2px, transparent 2px), linear-gradient(90deg, var(--pink) 2px, transparent 2px);
  background-size: 60px 60px; opacity: .55; animation: floor 1.6s linear infinite; }
@keyframes floor { to { background-position: 0 60px; } }

/* ---------- HUD ---------- */
.hud { position: absolute; left: 0; right: 0; top: 0; z-index: 10; pointer-events: none; padding: calc(var(--top) + 10px) 12px 0; display: grid; gap: 8px; }
.hud__bar { display: flex; align-items: center; gap: 10px; height: 40px; padding-right: 78px; }
.hud__stage { font: 11px/1 var(--px); color: var(--ink); background: var(--cyan); padding: 7px 8px; box-shadow: 3px 3px 0 #000; }
.hud__score { margin-left: auto; display: grid; justify-items: end; gap: 3px; text-shadow: 2px 2px 0 #000; }
.hud__score small { font: 8px/1 var(--px); color: var(--pink); }
.hud__score b { font: 14px/1 var(--px); color: var(--yellow); }
.hud__score b.is-bump { animation: bump .4s steps(4); }
@keyframes bump { 50% { transform: scale(1.35); color: #fff; } }
.hud__q { font: 14px/1.5 var(--px); background: rgba(10, 6, 20, .86); padding: 10px 12px; color: #fff;
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--ink), 6px 6px 0 6px rgba(0, 0, 0, .5); margin: 0 3px; min-height: 48px;
  opacity: 0; transform: translateY(-8px); transition: opacity .15s, transform .15s steps(3); }
.hud.is-q .hud__q { opacity: 1; transform: none; }
.hud__time { display: flex; align-items: center; gap: 10px; margin: 2px 3px 0; opacity: 0; transition: opacity .2s; }
.hud.is-q .hud__time { opacity: 1; }
.hud__cells { flex: 1; display: grid; grid-template-columns: repeat(20, 1fr); gap: 2px; height: 14px; padding: 2px; background: #000; box-shadow: 0 0 0 2px #fff; }
.hud__cells i { background: var(--cyan); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .25); }
.hud__cells i.off { background: #1b1233; box-shadow: none; }
.hud.is-mid .hud__cells i:not(.off) { background: var(--yellow); }
.hud.is-low .hud__cells i:not(.off) { background: var(--red); animation: blink .3s steps(1) infinite; }
.hud__time b { font: 12px/1 var(--px); color: #fff; text-shadow: 2px 2px 0 #000; min-width: 4.5ch; text-align: right; }
.hud__who { justify-self: center; font: 10px/1.6 var(--px); text-align: center; color: var(--yellow); background: rgba(10, 6, 20, .75); padding: 8px 10px; box-shadow: 0 0 0 2px var(--yellow); opacity: 0; transition: opacity .2s; }
.hud.is-who .hud__who { opacity: 1; }
.hud.is-q .hud__who { display: none; }
.hud__who em { font-style: normal; color: var(--cyan); }
.crt.is-press .hud__q { box-shadow: 0 0 0 3px var(--red), 0 0 0 6px var(--ink), 0 0 calc(30px * var(--pu, 0)) var(--red); }
.crt.is-press .hud__q::after { content: ' DANGER!'; color: var(--red); animation: danger .4s steps(1) infinite; }   /* flashes red/white: never gone */
@keyframes danger { 50% { color: #fff; text-shadow: 0 0 10px var(--red); } }
@keyframes blink { 50% { opacity: 0; } }

/* the presser, when he is off screen */
.threat { position: absolute; z-index: 9; pointer-events: none; opacity: 0; transition: opacity .15s; font: 12px/1 var(--px); color: #fff; }
.threat.is-on { opacity: 1; }
.threat[data-side=left], .threat[data-side=right] { top: 32%; bottom: 32%; width: 34px; display: grid; place-items: center; background: linear-gradient(90deg, rgba(255, 59, 92, .85), transparent); writing-mode: vertical-rl; }
.threat[data-side=left] { left: 0; }
.threat[data-side=right] { right: 0; transform: scaleX(-1); }
.threat[data-side=right] span { transform: scaleX(-1); display: block; }
.threat[data-side=behind] { left: 0; right: 0; bottom: 0; height: 56px; display: grid; place-items: center; background: linear-gradient(0deg, rgba(255, 59, 92, .85), transparent); padding-bottom: var(--bot); }
.threat span { animation: blink .35s steps(1) infinite; text-shadow: 2px 2px 0 #000; }

/* ---------- the markers (inner HTML; the engine moves .pt-mk) ---------- */
.pt-mk { min-width: 64px; min-height: 64px; }
.mk { position: relative; width: 58px; height: 58px; display: grid; place-items: center; animation: bob 1s steps(2) infinite; animation-delay: calc(var(--i) * -.33s); }
.mk b { position: relative; z-index: 1; width: 50px; height: 50px; display: grid; place-items: center; font: 20px/1 var(--px); color: var(--ink); background: var(--yellow);
  box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px #fff, 5px 5px 0 6px rgba(0, 0, 0, .45), 0 0 26px 6px rgba(255, 230, 0, .55);
  clip-path: none; transition: background .15s; padding-top: 3px; }
.mk__ring { position: absolute; inset: -6px; box-shadow: 0 0 0 3px var(--yellow); animation: ring 1s steps(4) infinite; animation-delay: calc(var(--i) * -.25s); }
.pt-mk:hover .mk b, .pt-mk:focus-visible .mk b { background: #fff; }
.pt-mk:active .mk { transform: scale(.88); }
@keyframes bob { 50% { transform: translateY(-4px); } }
@keyframes ring { 0% { transform: scale(.85); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
.pt-answered .mk, .pt-answered .mk__ring { animation: none; }
.pt-answered .mk__ring { opacity: 0; }
.pt-mk.is-pro .mk b { background: var(--green); box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px #fff, 0 0 34px 10px rgba(57, 255, 106, .7); animation: win .5s steps(4) 2; }
.pt-mk.is-mine .mk b { background: var(--red); color: #fff; }
.pt-mk.is-pro .mk::after { content: 'PRO'; position: absolute; top: -28px; left: 50%; transform: translateX(-50%); font: 10px/1 var(--px); color: var(--ink); background: var(--green); padding: 4px 5px; }
.pt-mk.is-mine .mk::after { content: 'YOU'; position: absolute; top: -28px; left: 50%; transform: translateX(-50%); font: 10px/1 var(--px); color: #fff; background: var(--red); padding: 4px 5px; }
.pt-mk.is-dim { opacity: .25; }
@keyframes win { 50% { transform: scale(1.18); } }
.pt-mk[data-edge=l]::before { border-right-color: var(--yellow); left: -20px; border-width: 11px; }
.pt-mk[data-edge=r]::before { border-left-color: var(--yellow); right: -20px; border-width: 11px; }
.pt-paths path { stroke: rgba(255, 230, 0, .9); stroke-dasharray: 4 10; stroke-linecap: square; }

/* ---------- splash words (READY? GO! PERFECT!) ---------- */
.splash { position: absolute; inset: 0; z-index: 30; pointer-events: none; display: grid; place-items: center; text-align: center; }
.splash > div { display: grid; gap: 14px; justify-items: center; }
.splash .word { font: clamp(30px, 9vw, 54px)/1.1 var(--px); color: var(--yellow); text-shadow: 4px 4px 0 var(--pink), 8px 8px 0 #000, var(--glow-y); animation: pop .45s steps(5) both; padding: 0 10px; }
.splash .word.is-go { color: var(--green); text-shadow: 4px 4px 0 #0a6b2a, 8px 8px 0 #000, 0 0 22px rgba(57, 255, 106, .6); }
.splash .word.is-almost { color: var(--orange); text-shadow: 4px 4px 0 #7a2c00, 8px 8px 0 #000; }
.splash .word.is-cyan { color: var(--cyan); text-shadow: 4px 4px 0 #0b4a63, 8px 8px 0 #000, var(--glow-c); }
.splash .pts { font: 18px/1 var(--px); color: #fff; text-shadow: 3px 3px 0 #000; animation: rise 1s steps(8) both .15s; }
.splash .sub { font: 12px/1.5 var(--px); color: #fff; background: rgba(10, 6, 20, .8); padding: 8px 10px; animation: pop .3s steps(3) both .1s; }
@keyframes pop { 0% { transform: scale(2.4); opacity: 0; } 60% { transform: scale(.9); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes rise { 0% { transform: translateY(10px); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(-34px); opacity: 0; } }

/* ---------- mute ---------- */
.mute { position: absolute; z-index: 35; top: calc(var(--top) + 10px); right: 10px; height: 40px; min-width: 64px; padding: 0 10px; border: 0; cursor: pointer;
  font: 10px/1 var(--px); color: var(--cyan); background: rgba(10, 6, 20, .8); box-shadow: 0 0 0 2px var(--cyan); }
.mute.is-off { color: var(--mute); box-shadow: 0 0 0 2px var(--mute); }

/* pixel confetti */
.px-bit { position: fixed; z-index: 100; width: 8px; height: 8px; pointer-events: none; }

/* keyboard focus: a dashed cyan box on everything you can press */
button:focus-visible, .pt-mk:focus-visible { outline: 3px dashed var(--cyan); outline-offset: 4px; }
.field input:focus-visible { outline: 0; }

/* reduced motion: no shakes, flashes, blinking or scrolling; the words still appear, just without the jump */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
  .mk, .mk__ring, .crt__fx, .crt__fx::after, .grid-bg::after, .logo, .btn .arr, .btn--coin .txt, .rainbow,
  .threat span, .replay::before, .blink, .crt.is-glitch, .crt.is-bad, .crt.is-good::before { animation: none !important; }
  .ticker__in { animation: none !important; padding-left: 12px; }
  .ticker { overflow-x: auto; }
  .board__row.is-you, .splash .pts { animation: none !important; }
}

/* the real clip sits high on the CRT, the replay card below it */
.crt .pt-stage > .pt-clip { top: calc(var(--top) + 100px); bottom: auto; height: calc(100% - var(--top) - var(--bot) - 390px); background: transparent; }
.crt .pt-stage.pt-is-clip { background: #000; }
@media (min-width: 960px) and (min-height: 660px) {
  .crt .pt-stage > .pt-clip { top: 56px; height: calc(100% - 330px); }
}
.crt .pt-stage.pt-is-clip > .pt-canvas { opacity: .12; transition: opacity .3s; }
body[data-phase=results] .mute { display: none; }

/* the tap lands: a white flash for a pro pick, a jolt for an almost */
.crt::before { content: ''; position: absolute; inset: 0; z-index: 38; pointer-events: none; background: #fff; opacity: 0; }
.crt.is-good::before { animation: flashw .3s steps(3) 1; }
.crt.is-bad { animation: jolt .32s steps(4) 1; }
@keyframes flashw { 0% { opacity: .75; } 100% { opacity: 0; } }
@keyframes jolt { 25% { transform: translate(-7px, 3px); } 50% { transform: translate(6px, -3px); } 75% { transform: translate(-3px, 2px); } }

/* while the 3D runs, the decorative layers stop moving (software GL is slow; the pitch gets every frame) */
body:not([data-phase=boot]):not([data-phase=gate]):not([data-phase=results]) .grid-bg { display: none; }
body[data-phase=play] .crt__fx, body[data-phase=play] .crt__fx::after,
body[data-phase=reveal] .crt__fx::after, body[data-phase=landing] .crt__fx::after { animation: none; }
body[data-phase=play] .crt__fx::after, body[data-phase=reveal] .crt__fx::after { display: none; }
