:root {
  --bg: #0b0806; --ink: #fff8ec; --dim: rgba(255, 248, 236, 0.66); --gold: #f2c230; --red: #d8262f; --pink: #ff3d6e; --cyan: #2ad3ff; --hot: #ff3ea5;
  --pad: max(16px, env(safe-area-inset-left)); --top: max(14px, env(safe-area-inset-top)); --bot: max(16px, env(safe-area-inset-bottom));
  --heavy: "Arial Black", "Helvetica Neue", "Hiragino Sans", "Apple SD Gothic Neo", Thonburi, system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); overflow: hidden; font: 16px/1.35 system-ui, -apple-system, "Hiragino Sans", "Apple SD Gothic Neo", Thonburi, sans-serif; }
canvas#c { position: fixed; inset: 0; width: 100vw; height: 100dvh; display: block; touch-action: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; border: 0; cursor: pointer; }

/* letterbox */
.lb i { position: fixed; left: 0; right: 0; height: 0; background: #000; z-index: 5; transition: height 0.9s cubic-bezier(.6,0,.2,1); pointer-events: none; }
.lb i:first-child { top: 0; } .lb i:last-child { bottom: 0; }
.lb.on i { height: 11dvh; }

/* title */
.title { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; justify-content: space-between; padding: var(--top) var(--pad) var(--bot); background: linear-gradient(180deg, rgba(11,8,6,.88) 0%, rgba(11,8,6,0) 34%, rgba(11,8,6,0) 58%, rgba(11,8,6,.92) 100%); }
.title__top { text-align: center; padding-top: 4dvh; }
.kicker { margin: 0 0 10px; font: 900 11px/1 var(--heavy); letter-spacing: .32em; color: var(--gold); opacity: .85; }
.title h1 { margin: 0; font: 900 clamp(34px, 11vw, 64px)/.92 var(--heavy); letter-spacing: -.02em; text-transform: uppercase; }
.title h1 span { display: block; }
.title h1 span:first-child { color: var(--gold); text-shadow: 0 0 22px rgba(242,194,48,.45), 3px 3px 0 #000; }
.title h1 span:last-child { color: var(--ink); text-shadow: 3px 3px 0 var(--red); }
.tag { margin: 14px auto 0; max-width: 22em; font-weight: 700; font-size: 16px; color: var(--ink); text-shadow: 0 1px 6px #000; }
.title__bottom { text-align: center; }
.friend { margin: 0 auto 12px; max-width: 24em; padding: 10px 14px; border-radius: 12px; background: rgba(255,62,165,.16); border: 1px solid rgba(255,62,165,.5); font-weight: 700; }
/* creator night: "Beat @code's 3★" — a gold premiere-marquee plate with the slate's red drop shadow */
.friend.creator { display: inline-block; max-width: min(360px, 92vw); margin-bottom: 16px; padding: 12px 20px 13px; border: 0; border-radius: 8px; background: var(--gold); color: #141418; font: 900 clamp(21px, 6.2vw, 29px)/1.1 var(--heavy); letter-spacing: -.01em; overflow-wrap: anywhere; box-shadow: 4px 4px 0 var(--red), 0 0 34px rgba(242,194,48,.45); transform: rotate(-1.5deg); }
.clap { position: relative; width: min(100%, 360px); height: 74px; border-radius: 10px; background: #141418; overflow: hidden; font: 900 28px/1 var(--heavy); letter-spacing: .04em; color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.6), inset 0 0 0 2px #2b2b33; }
.clap__stripes { position: absolute; left: 0; right: 0; top: 0; height: 18px; background: repeating-linear-gradient(-45deg, #fff 0 16px, #111 16px 32px); }
.clap span:last-child { position: relative; top: 9px; }
.clap:active { transform: translateY(2px) scale(.99); }
.hint { margin: 12px 0 0; font-size: 13px; color: var(--dim); }

/* HUD */
.hud { position: fixed; left: 0; right: 0; top: 0; z-index: 6; padding: var(--top) var(--pad) 0; pointer-events: none; text-shadow: 0 1px 6px rgba(0,0,0,.9); }
.hud__row { display: flex; align-items: baseline; gap: 10px; padding-right: 112px; }
.hud__row b { font: 900 13px/1 var(--heavy); letter-spacing: .12em; color: #111; background: var(--gold); padding: 5px 7px 4px; border-radius: 4px; text-shadow: none; }
.hud__row span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font: 900 18px/1 var(--heavy); letter-spacing: .02em; }
.hud__beat { margin: 6px 0 0; font-size: 14px; font-weight: 600; color: var(--dim); }
.reel { position: absolute; right: var(--pad); top: calc(var(--top) + 2px); display: flex; gap: 5px; }
.reel i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.45); }
.reel i.now { border-color: var(--gold); box-shadow: 0 0 10px var(--gold); }
.reel i.on { background: #fff; border-color: #fff; }
.reel i.on.chaos { background: var(--pink); border-color: var(--pink); box-shadow: 0 0 10px var(--pink); }

/* the pitch */
.pitch { position: fixed; left: 0; right: 0; bottom: 0; z-index: 7; padding: 0 var(--pad) var(--bot); display: grid; grid-template-columns: 1fr; gap: 10px; animation: up .35s cubic-bezier(.2,.9,.3,1.2) both; }
.pitch.out { animation: down .25s ease-in both; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes down { to { transform: translateY(40px); opacity: 0; } }
.bubble { position: relative; background: #0d1230; border: 2px solid #7ff7ff; border-radius: 18px; padding: 12px 14px 14px; box-shadow: 0 0 24px rgba(127,247,255,.35), 0 12px 30px rgba(0,0,0,.6); }
.bubble::after { content: ""; position: absolute; right: 28px; top: -12px; width: 20px; height: 20px; background: #0d1230; border-left: 2px solid #7ff7ff; border-top: 2px solid #7ff7ff; transform: rotate(45deg); }
.who { display: flex; gap: 8px; align-items: baseline; }
.who b { font: 900 13px/1 var(--heavy); letter-spacing: .1em; color: #7ff7ff; }
.who span { font-size: 12px; color: rgba(127,247,255,.65); }
.bubble p { margin: 6px 0 10px; font: 800 19px/1.25 system-ui, -apple-system, "Hiragino Sans", "Apple SD Gothic Neo", Thonburi, sans-serif; }
.timer { height: 5px; border-radius: 3px; background: rgba(127,247,255,.18); overflow: hidden; }
.timer i { display: block; height: 100%; background: linear-gradient(90deg, var(--pink), #7ff7ff); transform-origin: left; }
.yes, .no { display: flex; align-items: center; justify-content: center; gap: 10px; border-radius: 14px; font-weight: 900; }
.yes { height: 64px; font: 900 20px/1 var(--heavy); color: #1a0010; background: repeating-linear-gradient(-45deg, #ffe14a 0 18px, #ffd000 18px 36px); box-shadow: 0 0 0 3px #000, 0 0 28px rgba(255,225,74,.55); animation: beg 1.1s ease-in-out infinite; }
.yes .ico { font-size: 26px; }
@keyframes beg { 50% { transform: scale(1.035) rotate(-.6deg); } }
.no { height: 46px; font-size: 15px; color: var(--ink); background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.22); }
.no .ico { color: var(--pink); }

/* reactions + stamps */
.react { position: fixed; left: var(--pad); right: var(--pad); top: 30dvh; z-index: 8; text-align: center; font: 900 22px/1.2 var(--heavy); pointer-events: none; text-shadow: 0 2px 0 #000, 0 0 18px rgba(0,0,0,.8); opacity: 0; transform: scale(.7); }
.react.on { animation: react 2.2s cubic-bezier(.2,1.4,.4,1) both; }
.react.yes { color: #ffe14a; } .react.no { color: #8fb8ff; }
@keyframes react { 0% { opacity: 0; transform: scale(.6) rotate(-4deg); } 12% { opacity: 1; transform: scale(1.08) rotate(2deg); } 22%, 85% { opacity: 1; transform: scale(1) rotate(0); } 100% { opacity: 0; transform: translateY(-14px); } }
.stamp { position: fixed; left: 50%; top: 44dvh; z-index: 9; padding: 10px 18px 8px; font: 900 44px/1 var(--heavy); letter-spacing: .02em; border: 5px solid currentColor; border-radius: 10px; pointer-events: none; transform: translate(-50%, -50%) rotate(-8deg); opacity: 0; white-space: nowrap; }
.stamp.act { color: #fff; background: rgba(216,38,47,.9); }
.stamp.cut { color: #111; background: var(--gold); }
.stamp.wrap { color: #fff; background: var(--hot); font-size: 34px; }
.stamp.on { animation: stamp .9s cubic-bezier(.2,1.6,.4,1) both; }
.stamp.wrap.on { animation-duration: 1.5s; }
@keyframes stamp { 0% { opacity: 0; transform: translate(-50%, -50%) rotate(-8deg) scale(2.2); } 18% { opacity: 1; transform: translate(-50%, -50%) rotate(-8deg) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) rotate(-8deg) scale(.96); } }

/* premiere cards */
.tcard { position: fixed; inset: 0; z-index: 8; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 var(--pad); background: rgba(0,0,0,.82); transition: opacity .5s; }
.tcard.out { opacity: 0; }
.tcard__k { margin: 0 0 14px; font: 900 12px/1 var(--heavy); letter-spacing: .36em; color: var(--gold); }
.tcard h2 { margin: 0; font: 900 clamp(30px, 10vw, 56px)/.98 var(--heavy); color: #fff6c8; text-shadow: 0 0 30px rgba(242,194,48,.5); }
.tcard__by { margin: 16px 0 0; font: 700 13px/1 var(--heavy); letter-spacing: .3em; color: var(--dim); }
.tbc { position: fixed; left: 50%; bottom: 16dvh; z-index: 8; transform: translateX(-50%) rotate(-3deg); padding: 10px 16px; font: 900 26px/1 var(--heavy); color: #ffe9b0; background: #3a2412; border: 3px solid #ffe9b0; white-space: nowrap; animation: tbc .4s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes tbc { from { transform: translateX(-50%) rotate(-3deg) scale(1.8); opacity: 0; } }
.credits { position: fixed; inset: 11dvh 0; z-index: 8; overflow: hidden; pointer-events: none; }
.credits__roll { position: absolute; left: 0; right: 0; top: 100%; text-align: center; }
.credits__roll.roll { animation: roll 7.5s linear both; }
@keyframes roll { to { transform: translateY(calc(-100% - 78dvh)); } }
.credits h3 { margin: 26px 0 4px; font: 700 12px/1 var(--heavy); letter-spacing: .3em; text-transform: uppercase; color: var(--gold); }
.credits p { margin: 4px 0; font-weight: 700; font-size: 17px; }
.credits p span { display: inline-block; min-width: 7em; text-align: right; margin-right: .6em; }
.credits p em { font-style: normal; color: var(--pink); }
.credits .big { font: 900 36px/1 var(--heavy); }
.credits .small { margin-top: 36px; font-size: 13px; color: var(--dim); padding: 0 var(--pad); }

/* score */
.score { position: fixed; inset: 0; z-index: 11; overflow-y: auto; padding: var(--top) var(--pad) var(--bot); background: rgba(11,8,6,.86); display: flex; flex-direction: column; align-items: center; gap: 8px; animation: fade .5s both; }
.score > * { flex-shrink: 0; }
.score .rx { margin-top: 2px; padding: 10px 12px; } /* the real exit (shared/stage/exit.js): the whole card + the exit fit a 390x844 phone */
@keyframes fade { from { opacity: 0; } }
.poster { height: 34dvh; max-width: 100%; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 8px; box-shadow: 0 14px 40px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.12); transform: rotate(-1.2deg); }
.axes { width: 100%; max-width: 420px; display: grid; gap: 8px; margin-top: 6px; }
.axis { display: grid; grid-template-columns: 64px 1fr 36px; align-items: center; gap: 10px; font: 900 14px/1 var(--heavy); }
.axis .bar { height: 12px; border-radius: 6px; background: rgba(255,255,255,.12); overflow: hidden; }
.axis .bar i { display: block; height: 100%; width: 0; transition: width 1.2s cubic-bezier(.2,.8,.2,1); }
.axis--chaos span, .axis--chaos b { color: var(--pink); } .axis--chaos .bar i { background: var(--pink); box-shadow: 0 0 12px var(--pink); }
.axis--story span, .axis--story b { color: var(--cyan); } .axis--story .bar i { background: var(--cyan); box-shadow: 0 0 12px var(--cyan); }
.axis b { text-align: right; color: #fff; font-size: 18px; }
.verdict { margin: 4px 0 0; text-align: center; font: 900 18px/1.2 var(--heavy); max-width: 22em; }
.vs { margin: 0; font-size: 14px; color: var(--hot); font-weight: 800; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 420px; }
.chip { font-size: 12px; font-weight: 700; padding: 5px 9px; border-radius: 99px; background: rgba(255,255,255,.07); color: var(--dim); border: 1px solid rgba(255,255,255,.14); }
.chip.on { background: rgba(255,61,110,.18); color: #fff; border-color: var(--pink); }
.btn { width: 100%; max-width: 420px; min-height: 48px; padding: 0 12px; border-radius: 12px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); font-weight: 800; font-size: 15px; }
.btn--main { min-height: 58px; color: #111; background: var(--gold); border: 0; font: 900 17px/1.1 var(--heavy); box-shadow: 0 0 24px rgba(242,194,48,.4); }
.btn--clip { border-color: rgba(242,194,48,.6); color: var(--gold); } /* the 12 s clip of your premiere */
.btn--ghost { background: transparent; border: 0; color: var(--dim); min-height: 34px; }
.row2 { width: 100%; max-width: 420px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.score.full { background: #000; justify-content: center; padding: 0; }
.score.full > :not(.poster) { display: none; }
.score.full .poster { height: 100dvh; max-height: 100dvh; width: auto; object-fit: contain; transform: none; border-radius: 0; }

.skip { position: fixed; right: var(--pad); bottom: calc(11dvh + 10px); z-index: 9; padding: 8px 14px; border-radius: 99px; background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.3); font-size: 13px; font-weight: 700; color: var(--dim); }
.mute { position: fixed; right: var(--pad); top: calc(var(--top) + 28px); z-index: 12; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.45); color: var(--ink); }
.score > .mute { position: absolute; top: var(--top); right: var(--pad); } /* in the score sheet: scrolls with it, never over the poster */
.toast { position: fixed; left: 50%; bottom: 90px; z-index: 20; transform: translateX(-50%); padding: 10px 16px; border-radius: 99px; background: #fff; color: #111; font-weight: 800; }
.bootfail { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 24px; text-align: center; background: var(--bg); font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .yes { animation: none; } }

/* premiere closed captions: deadpan [brackets] just above the lower letterbox bar */
.cc { position: fixed; left: 50%; bottom: calc(11dvh + 14px); z-index: 7; transform: translateX(-50%); max-width: min(88vw, 520px); width: max-content; padding: 5px 10px 6px; background: rgba(0,0,0,0.62); color: #fff7d6; font: 700 15px/1.3 var(--body, system-ui), system-ui, sans-serif; text-align: center; letter-spacing: 0.01em; border-radius: 3px; pointer-events: none; text-shadow: 0 1px 0 #000; }

/* ── STREAMER MODE (?stream=<channel>): chat's ballot is a clapperboard, CHAOS pink vs STORY cyan, a gold countdown ── */
.sv { position: fixed; z-index: 8; left: var(--pad); right: var(--pad); top: calc(var(--top) + 96px); max-width: 460px; margin: 0 auto; overflow: hidden; padding: 20px 12px 10px; border-radius: 12px; background: #141418; box-shadow: 0 0 0 2px #2b2b33, 0 14px 34px rgba(0,0,0,.65); }
.sv::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 10px; background: repeating-linear-gradient(-45deg, #fff 0 12px, #111 12px 24px); }
.sv.on { animation: svIn .35s cubic-bezier(.2,.9,.3,1.2) both; }
@keyframes svIn { from { transform: translateY(-18px) rotate(-1.5deg); opacity: 0; } }
.sv__head { display: flex; align-items: center; gap: 10px; margin: 0 2px 8px; }
.sv__k { font: 900 15px/1 var(--heavy); letter-spacing: .14em; color: var(--gold); white-space: nowrap; }
.sv__hint { flex: 1; min-width: 0; font-size: 13px; font-weight: 700; color: var(--dim); }
.sv__n { flex: none; width: 48px; height: 48px; margin: -6px 0 -4px; border-radius: 50%; display: grid; place-items: center; font: 900 27px/1 var(--heavy); color: #111; background: var(--gold); box-shadow: 0 0 18px rgba(242,194,48,.5); }
.sv.urgent .sv__n { background: var(--red); color: #fff; box-shadow: 0 0 22px rgba(216,38,47,.8); animation: svTick 1s ease-in-out infinite; }
.sv.done .sv__n { visibility: hidden; animation: none; }
@keyframes svTick { 50% { transform: scale(1.12); } }
.sv__opts { display: grid; gap: 6px; }
.sv__opt { position: relative; display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 10px; width: 100%; min-height: 56px; padding: 6px 12px 6px 7px; border-radius: 9px; background: rgba(255,255,255,.06); overflow: hidden; text-align: left; transition: opacity .3s; }
.sv__opt > :not(.sv__bar) { position: relative; z-index: 1; }
.sv__bar { position: absolute; inset: 0; z-index: 0; transform-origin: left; transition: transform .35s cubic-bezier(.2,.8,.2,1); opacity: .3; }
.sv__key { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 7px; font: 900 26px/1 var(--heavy); color: #111; }
.sv__lab { display: grid; gap: 3px; min-width: 0; }
.sv__lab small { font: 900 11px/1 var(--heavy); letter-spacing: .16em; }
.sv__lab em { font-style: normal; font-weight: 800; font-size: 17px; line-height: 1.15; color: var(--ink); }
.sv__pct { font: 900 24px/1 var(--heavy); min-width: 2.6em; text-align: right; }
.sv__opt--a .sv__key, .sv__opt--a .sv__bar { background: var(--pink); } .sv__opt--a small, .sv__opt--a .sv__pct { color: var(--pink); }
.sv__opt--b .sv__key, .sv__opt--b .sv__bar { background: var(--cyan); } .sv__opt--b small, .sv__opt--b .sv__pct { color: var(--cyan); }
.sv__opt--a.lead { box-shadow: inset 0 0 0 2px var(--pink), 0 0 16px rgba(255,61,110,.35); } .sv__opt--b.lead { box-shadow: inset 0 0 0 2px var(--cyan), 0 0 16px rgba(42,211,255,.35); }
.sv.done .sv__opt:not(.win) { opacity: .35; }
.sv__votes { margin: 6px 4px 0; font-size: 12px; font-weight: 700; color: var(--dim); }
.sv__res { margin: 8px 0 2px; text-align: center; font: 900 19px/1.15 var(--heavy); color: var(--gold); animation: tbc .4s cubic-bezier(.2,1.6,.4,1) both; transform: none; }
.svtag { position: fixed; z-index: 6; left: var(--pad); top: calc(var(--top) + 64px); display: flex; align-items: center; gap: 7px; padding: 5px 11px 5px 9px; border-radius: 99px; background: rgba(0,0,0,.6); border: 1px solid rgba(255,255,255,.16); font-size: 12px; font-weight: 800; color: var(--ink); pointer-events: none; white-space: nowrap; }
.svtag__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 8px var(--red); animation: svTick 1.4s ease-in-out infinite; }
.stream .react { top: 56dvh; } /* the ballot owns the top third on a phone */
.chatline { color: var(--gold); font: 900 15px/1.2 var(--heavy); text-align: center; }
/* a captured desktop window (OBS): the ballot docks right, the pitch sits centred, the tag bottom-left */
@media (orientation: landscape) and (min-width: 820px) {
  .stream .sv { left: auto; right: var(--pad); top: calc(var(--top) + 76px); width: min(440px, 36vw); max-width: none; }
  .stream .svtag { top: auto; bottom: var(--bot); }
  .stream .pitch { left: 0; right: 0; margin: 0 auto; max-width: 620px; }
  .stream .react { top: 30dvh; }
}
/* 1080p capture: everything the audience reads scales up */
@media (orientation: landscape) and (min-height: 900px) { .stream .sv, .stream .pitch, .stream .hud, .stream .svtag, .stream .mute { zoom: 1.35; } }
/* group-chat line (11-09): the quip under the verdict + "Send to the group chat" with explicit LINE / WhatsApp links.
   The poster gives up the room so the whole card + the real exit still fit a 390x844 phone. */
.tsQuip { margin: 0; max-width: 420px; text-align: center; font-size: 14px; line-height: 1.3; font-weight: 700; font-style: italic; color: var(--gold); }
.tsRow { width: 100%; max-width: 420px; display: flex; gap: 6px; }
.tsRow .btn { flex: 1; min-width: 0; min-height: 44px; border-color: rgba(242,194,48,.55); }
.tsLink { flex: 0 0 auto; display: flex; align-items: center; padding: 0 10px; border-radius: 12px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.06); color: var(--dim); font-size: 12px; font-weight: 800; text-decoration: none; }
.score:has(#tsRow:not([hidden])) .poster { height: 24dvh; }
.score:has(#tsRow:not([hidden])) .row2 .btn, .score:has(#tsRow:not([hidden])) .btn--main { min-height: 48px; }
