:root {
  --bg: #120d2b;
  --bg2: #241a55;
  --text: #f4f1ff;
  --muted: #a99fd6;
  --gold: #ffc93c;
  --good: #2bd67b;
  --bad: #ff5470;
  --c0: #e8455e; --c1: #2e86ff; --c2: #f5a524; --c3: #22b573;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(120% 80% at 50% 0%, var(--bg2), var(--bg) 70%) fixed;
  color: var(--text);
  font: 17px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
#app { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); min-height: 100%; }
.screen { display: none; flex-direction: column; gap: 14px; min-height: calc(100dvh - 32px); }
.screen.on { display: flex; }
h1, h2 { margin: 0; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-top: 8px; }

.logo { font-size: 46px; text-align: center; margin: 9vh 0 4vh; letter-spacing: -.02em; }
.logo span { color: var(--gold); }

input {
  width: 100%; font: inherit; font-size: 20px; padding: 14px; border-radius: var(--radius);
  border: 2px solid #4b3f8f; background: #1b1440; color: var(--text); outline: none;
}
input:focus { border-color: var(--gold); }
.field { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 14px; }

button { font: inherit; color: inherit; border: none; cursor: pointer; }
.big { font-size: 20px; font-weight: 700; padding: 16px; border-radius: var(--radius); background: #3a2f7a; }
.big.primary { background: var(--gold); color: #2a1b00; }
.big:disabled { opacity: .5; }
.small { align-self: center; background: #2d2466; padding: 8px 14px; border-radius: 99px; font-size: 14px; }
.or { text-align: center; color: var(--muted); font-size: 14px; }
.join-row { display: flex; gap: 10px; }
.join-row input { text-transform: uppercase; letter-spacing: .3em; text-align: center; font-weight: 700; }
.join-row button { flex: 0 0 auto; padding-inline: 26px; }
.error { color: var(--bad); min-height: 1.3em; margin: 0; text-align: center; }
.wait { color: var(--muted); text-align: center; }

.room-code { text-align: center; color: var(--muted); margin-top: 8px; }
.room-code strong { display: block; font-size: 52px; letter-spacing: .18em; color: var(--gold); }

.players { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.players li { background: #2a2163; padding: 8px 12px; border-radius: 99px; }
.players li.off { opacity: .45; }
.players li .host { color: var(--gold); font-size: 12px; margin-left: 4px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { background: #2a2163; padding: 9px 13px; border-radius: 99px; font-size: 15px; }
.chips button.on { background: var(--gold); color: #2a1b00; font-weight: 700; }
.chips button small { opacity: .7; font-size: 12px; }
.chips.readonly button { pointer-events: none; }

.q-top { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; margin-top: 4px; }
.timer { height: 10px; background: #2a2163; border-radius: 99px; overflow: hidden; }
.bar, #timer-bar { height: 100%; width: 100%; background: var(--gold); border-radius: 99px; transform-origin: left; }
.q-text {
  font-size: clamp(21px, 5.8vw, 28px); line-height: 1.25; margin: 6px 0; white-space: pre-line;
  text-transform: none; letter-spacing: normal; color: var(--text);
}

.choices { display: grid; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 12px; text-align: left; font-size: 18px; font-weight: 600;
  padding: 16px; border-radius: var(--radius); min-height: 64px; color: #fff;
  transition: transform .12s, opacity .25s, filter .25s;
}
.choice:active { transform: scale(.98); }
.choice .letter { flex: 0 0 34px; height: 34px; border-radius: 9px; background: rgba(0,0,0,.25); display: grid; place-items: center; font-weight: 800; }
.choice.c0 { background: var(--c0); } .choice.c1 { background: var(--c1); }
.choice.c2 { background: var(--c2); } .choice.c3 { background: var(--c3); }
.choices.locked .choice { pointer-events: none; }
.choices.locked .choice:not(.picked) { opacity: .45; }
.choice.picked { outline: 4px solid #fff; outline-offset: 2px; }
.reveal .choice:not(.right) { opacity: .3; filter: grayscale(.7); }
.reveal .choice.right { opacity: 1; animation: pop .5s; box-shadow: 0 0 0 4px var(--good), 0 0 30px var(--good); }
.choice .who { margin-left: auto; font-size: 13px; font-weight: 500; opacity: .9; text-align: right; }
@keyframes pop { 50% { transform: scale(1.04); } }

.q-status { text-align: center; color: var(--muted); min-height: 3em; }
.q-status .gain { display: block; font-size: 30px; font-weight: 800; color: var(--good); }
.q-status .miss { display: block; font-size: 24px; font-weight: 800; color: var(--bad); }
.scores { list-style: none; padding: 0; margin: 4px 0 0; display: grid; gap: 6px; }
.scores li { display: flex; justify-content: space-between; background: #221a52; padding: 8px 12px; border-radius: 10px; }
.scores li.me { outline: 2px solid var(--gold); }
.scores .plus { color: var(--good); font-size: 13px; margin-left: 6px; }

.final-title { text-align: center; margin-top: 6vh; color: var(--gold); }
.podium { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; counter-reset: p; }
.podium li { counter-increment: p; display: flex; align-items: center; gap: 12px; background: #221a52; padding: 14px; border-radius: var(--radius); font-size: 19px; }
.podium li::before { content: counter(p); font-weight: 800; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #3a2f7a; }
.podium li:nth-child(1) { background: linear-gradient(90deg, #6b4f00, #221a52); font-size: 23px; }
.podium li:nth-child(1)::before { background: var(--gold); color: #2a1b00; }
.podium li span { margin-left: auto; font-weight: 800; }

.banner {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); background: #3a2f7a; padding: 10px 16px;
  border-radius: 99px; font-size: 14px; display: none; max-width: calc(100% - 32px);
}
.banner.on { display: block; }

.hint { color: var(--muted); text-align: center; margin: 0; font-size: 15px; }
.hint:empty { display: none; }
.row-buttons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.tv-box { display: none; flex-direction: column; gap: 10px; background: #1b1440; border-radius: var(--radius); padding: 14px; }
.tv-box.on { display: flex; }
.tv-box p { margin: 0; color: var(--muted); font-size: 15px; }
.tv-box strong { color: var(--text); word-break: break-all; }
.house-box { display: flex; flex-direction: column; gap: 10px; border-radius: var(--radius); }
.house-box.ask { background: #2a1f5f; padding: 12px; outline: 2px solid var(--gold); }
.house-box .join-row input { letter-spacing: normal; text-transform: none; text-align: left; font-weight: 400; font-size: 17px; }
.house-box .join-row button { font-size: 17px; }
.players li .house { color: var(--muted); font-size: 12px; margin-left: 4px; }
.houses-podium:empty { display: none; }
.houses-podium li { background: #2d2466; }
#host-settings { display: flex; flex-direction: column; gap: 10px; }
#host-settings .big { margin-top: 8px; }

/* round intro */
.intro-card { margin-top: 12vh; text-align: center; display: flex; flex-direction: column; gap: 12px; animation: pop .5s; }
.intro-round { margin: 0; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-size: 15px; }
.intro-name { font-size: 46px; color: var(--gold); }
.intro-blurb { margin: 0; font-size: 19px; }

/* speed run */
.done-box { display: none; text-align: center; font-size: 22px; margin-top: 10vh; }
.done-box.on { display: block; }
.done-box small { display: block; color: var(--muted); font-size: 15px; margin-top: 10px; }
.choices.review .choice { pointer-events: none; opacity: .3; filter: grayscale(.7); }
.choices.review .choice.right { opacity: 1; filter: none; box-shadow: 0 0 0 4px var(--good), 0 0 30px var(--good); }
.choices.review .choice.wrong { opacity: .8; filter: none; outline: 4px solid var(--bad); outline-offset: 2px; }
.flash { position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%) scale(.6); font-size: 110px; font-weight: 900;
  opacity: 0; pointer-events: none; text-shadow: 0 4px 30px rgba(0,0,0,.5); }
.flash.go { animation: flash .7s ease-out; }
.flash.good { color: var(--good); } .flash.bad { color: var(--bad); }
@keyframes flash { 20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1); } }

/* quick draw pad: the whole middle of the screen is the button */
.pad { flex: 1; min-height: 52vh; border-radius: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; background: #2a2163; user-select: none; -webkit-user-select: none; touch-action: manipulation; transition: background .05s; }
.pad span { font-size: 64px; font-weight: 900; }
.pad small { color: rgba(255,255,255,.8); font-size: 17px; }
.pad.wait { background: #4a1f3a; }
.pad.fake { background: var(--gold); color: #2a1b00; }
.pad.go { background: var(--good); color: #062b16; }
.pad.early { background: var(--bad); }
.pad.count span { font-size: 96px; color: var(--gold); }
.tries { list-style: none; padding: 0; margin: 0; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.tries li { background: #221a52; border-radius: 10px; padding: 6px 10px; font-size: 15px; min-width: 64px; text-align: center; }
.tries li.bad { color: var(--bad); }
.scores .detail { color: var(--muted); font-size: 13px; margin-left: 6px; }
.h-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; }
.h-row h2 { margin-top: 0; }
.small:disabled { opacity: .4; }

/* topic picker */
#pick .intro-card { margin-top: 6vh; }
.pick-title { font-size: 34px; }
.pick-options { display: grid; gap: 10px; }
.pick-options .choice { justify-content: center; font-size: 22px; min-height: 70px; }
.pick-options.watching .choice { opacity: .55; pointer-events: none; }
.pick-options .choice:disabled { cursor: default; }
.pick-options .choice.picked { outline: 4px solid #fff; outline-offset: 2px; opacity: 1; }
.choices.shut .choice { opacity: .2; filter: grayscale(1); }
.pick-options .choice small { margin-left: 10px; opacity: .75; font-size: 15px; }

/* board challenges */
.bc-time { font-variant-numeric: tabular-nums; color: var(--gold); font-weight: 700; }
.bc-hint { margin: 0; text-align: center; font-size: 18px; min-height: 1.4em; }
.bc-hint svg { width: 22px; height: 22px; vertical-align: -4px; }
.board-wrap { position: relative; align-self: center; width: min(100%, calc(100dvh - 230px)); }
.board { position: relative; width: 100%; aspect-ratio: 1; background: #1b1440; border-radius: 16px; overflow: hidden;
  touch-action: none; user-select: none; -webkit-user-select: none; }
.board.oops { animation: oops .35s; }
@keyframes oops { 30% { box-shadow: inset 0 0 0 6px var(--bad); background: #3a1530; } }
.penalty { position: absolute; transform: translate(-50%, -100%); color: var(--bad); font-weight: 900; font-size: 22px;
  pointer-events: none; animation: rise .9s ease-out forwards; text-shadow: 0 2px 8px #000; }
@keyframes rise { to { transform: translate(-50%, -220%); opacity: 0; } }
.bc-count { position: absolute; inset: 0; display: none; place-items: center; font-size: 110px; font-weight: 900; color: var(--gold);
  background: rgba(18, 13, 43, .85); border-radius: 16px; }
.bc-count.on { display: grid; }
.bc-status { text-align: center; margin: 0; font-size: 20px; }
.bc-status small { display: block; color: var(--muted); font-size: 14px; margin-top: 4px; }
.bc-status .gain { color: var(--good); font-weight: 800; }
.bc-status .miss { color: var(--bad); font-weight: 800; display: block; }

.board.grid5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; padding: 5px; }
.board.grid5 .cell { background: #3a2f7a; border-radius: 10px; font-size: clamp(18px, 6vw, 30px); font-weight: 800; color: var(--text); }
.board.grid5 .cell.gone { background: transparent; color: #3a2f7a; }

.board.float span { position: absolute; left: 0; top: 0; width: 13%; height: 13%; border-radius: 50%; display: grid; place-items: center; }
.board.float .bubble { background: radial-gradient(circle at 32% 30%, #fff8, hsl(var(--h) 80% 60% / .85) 45%, hsl(var(--h) 70% 40% / .9)); }
.board.float .bomb { background: #2a0d1a; font-size: 26px; box-shadow: 0 0 0 3px var(--bad); }
.board.float .pop { animation: popOut .2s forwards; pointer-events: none; }
@keyframes popOut { to { transform: scale(1.6); opacity: 0; } }

.board.holes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 8px; }
.hole { position: relative; border-radius: 50%; background: radial-gradient(#0b0820 55%, #2a2163 56%); overflow: hidden; }
.critter { position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(40px, 14vw, 64px); transform: translateY(100%); transition: transform .12s; }
.hole.up .critter { transform: translateY(5%); }
.hole.bonk { background: radial-gradient(#2bd67b55 55%, #2a2163 56%); }

.board.shapes .shape { position: absolute; width: 14%; height: 14%; transform: translate(-50%, -50%); background: none; padding: 0; }
.board.shapes .shape svg { width: 100%; height: 100%; display: block; }
.board.shapes .shape.gone { opacity: 0; pointer-events: none; transition: opacity .15s; }
.rule-flash { position: absolute; inset: 0; background: rgba(18, 13, 43, .93); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px; font-size: 30px; text-align: center; animation: pop .5s; z-index: 2; }
.rule-flash svg { width: 90px; height: 90px; }
.rule-flash b { color: var(--gold); font-size: 38px; }

.board.simon { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px; }
.pad4 { border-radius: 18px; background: var(--c); opacity: .35; transition: opacity .08s, transform .08s; display: grid; place-items: center; }
.pad4 span { font-size: 48px; color: rgba(0,0,0,.45); }
.pad4.lit { opacity: 1; transform: scale(1.03); box-shadow: 0 0 30px var(--c); }

.board.maze canvas { display: block; width: 100%; height: 100%; }
.board.swipe { display: grid; place-items: center; }
/* the svg is rotated to point; the box around it does the pop-in (an animated transform would override the rotation) */
.board.swipe .arrow { width: 62%; display: grid; place-items: center; animation: pop .25s; }
.board.swipe .arrow svg { width: 100%; height: auto; transform: rotate(var(--r)); }
.board.swipe .opp { position: absolute; font-weight: 900; font-size: 18px; color: #fff;
  background: #000a; padding: 2px 8px; border-radius: 6px; letter-spacing: .05em; }
.board.oddgrid { display: grid; grid-template-columns: repeat(6, 1fr); grid-template-rows: repeat(5, 1fr); padding: 6px; gap: 2px; }
.board.oddgrid button { background: none; display: grid; place-items: center; font-size: clamp(24px, 8vw, 40px); padding: 0; }
.board.oddgrid button span { display: inline-block; }
.board.oddgrid button.found { background: #2bd67b55; border-radius: 10px; }
.board.crowd button { position: absolute; transform: translate(-50%, -50%); background: none; padding: 0; width: 11%; height: 11%;
  font-size: clamp(20px, 6.6vw, 32px); display: grid; place-items: center; }
.find-target { font-size: 30px; vertical-align: -5px; }

/* reaction photos */
.shots-box { display: flex; gap: 12px; align-items: center; background: #1b1440; border-radius: var(--radius); padding: 12px; }
.shots-box small { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
.shots-box button { flex: 0 0 auto; }
.shots-box button.on { background: var(--good); color: #062b16; }
.cam-badge { position: fixed; top: 8px; left: 50%; transform: translateX(-50%); background: #000a; padding: 3px 10px; border-radius: 99px;
  font-size: 13px; display: none; z-index: 5; }
.cam-badge.on { display: block; }

/* final wager */
.wager-head { margin-top: 2vh; }
.bet-amount { text-align: center; font-size: 56px; font-weight: 900; color: var(--gold); line-height: 1; }
#wg-range { width: 100%; accent-color: var(--gold); padding: 0; border: none; background: none; height: 36px; }
.chips.quick { justify-content: center; }
.center { text-align: center; }
.wheel-wrap { position: relative; width: min(86vw, 420px); align-self: center; margin-top: 10px; }
.wheel { position: relative; width: 100%; aspect-ratio: 1; border-radius: 50%; box-shadow: 0 0 0 6px #fff2, 0 10px 40px #0008; }
.wheel-label { position: absolute; left: 50%; top: 0; width: 0; height: 50%; transform-origin: 50% 100%; }
.wheel-label b { position: absolute; top: 9%; left: 0; transform: translateX(-50%); white-space: nowrap; font-size: 16px; text-shadow: 0 1px 3px #000a; }
.wheel-label b.small { font-size: 12px; }
.wheel-pointer { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 34px; color: #fff; text-shadow: 0 2px 6px #000; }
.wh-result { text-align: center; font-size: 22px; margin: 0; }
.wh-result b { color: var(--gold); }

/* pairs */
.board.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; padding: 7px; }
.card { border-radius: 12px; background: repeating-linear-gradient(45deg, #3a2f7a 0 8px, #2d2466 8px 16px); font-size: clamp(30px, 10vw, 46px); }
.card span { visibility: hidden; }
.card.up { background: #f4f1ff; }
.card.up span { visibility: visible; }
.card.done { background: #2bd67b44; }
/* smallest one */
.board.circles button { position: absolute; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; padding: 0;
  background: hsl(var(--h) 75% 60%); }
.bc-hint .sz { display: inline-block; color: var(--gold); }
.bc-hint .sz.s { font-size: 12px; } .bc-hint .sz.b { font-size: 28px; line-height: 0; }
/* count fast */
.board.scene .thing { position: absolute; width: 13%; transform: translate(-50%, -50%); }
.board.scene .thing svg { width: 100%; display: block; }
.count-q { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 26px; font-weight: 800; height: 45%; }
.count-q svg { width: 44px; }
.count-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 16px; }
.count-opts button { background: #3a2f7a; border-radius: 14px; font-size: 40px; font-weight: 900; padding: 14px 0; color: var(--text); }
.count-opts button.good { background: var(--good); color: #062b16; }
.count-opts button.bad { background: var(--bad); }
/* connect the dots */
.dot-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.dot-lines polyline { fill: none; stroke: var(--gold); stroke-width: 1.2; stroke-linejoin: round; stroke-linecap: round; }
.board.dots .dot { position: absolute; width: 11%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: #3a2f7a;
  display: grid; place-items: center; font-weight: 900; font-size: clamp(14px, 4.4vw, 20px); border: 2px solid #8f83d8; }
.board.dots .dot.on { background: var(--gold); color: #2a1b00; border-color: var(--gold); }
/* traffic light */
.board.traffic { display: flex; align-items: center; justify-content: center; gap: 8%; }
.tl { background: #0b0820; border-radius: 26px; padding: 14px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 0 0 4px #3a2f7a; }
.tl i { display: block; width: clamp(64px, 20vw, 96px); aspect-ratio: 1; border-radius: 50%; opacity: .18; }
.tl .r { background: #ff3b3b; } .tl .a { background: #ffb020; } .tl .g { background: #2bd67b; }
.tl i.lit { opacity: 1; box-shadow: 0 0 40px currentColor; }
.tl .r.lit { color: #ff3b3b; } .tl .a.lit { color: #ffb020; } .tl .g.lit { color: #2bd67b; }
.tl-score { font-size: 64px; font-weight: 900; color: var(--gold); min-width: 2ch; text-align: center; }
/* stop the clock */
.board.clock { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.clk-target { font-size: 24px; } .clk-target b { color: var(--gold); font-size: 32px; }
.clk-face { font-size: 84px; font-weight: 900; font-variant-numeric: tabular-nums; }
.clk-btn { font-size: 20px; padding: 14px 26px; border-radius: 99px; background: #3a2f7a; }
.board.clock.running .clk-btn { background: var(--bad); font-weight: 900; }

/* Game menu: one small button in the corner of every in-game screen, a sheet of actions when tapped. */
.menu-btn { position: fixed; top: 6px; right: 6px; z-index: 30; display: none; width: 38px; height: 38px; border-radius: 50%;
  background: #0007; font-size: 18px; line-height: 38px; padding: 0; }
.menu-btn.on { display: block; }
.sheet-back { position: fixed; inset: 0; z-index: 40; background: #000a; display: none; align-items: flex-end; justify-content: center; }
.sheet-back.on { display: flex; }
.sheet { width: 100%; max-width: 560px; max-height: 85dvh; overflow-y: auto; background: var(--bg2); border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.sheet h2 { margin: 0; }
.sheet p { margin: 0; color: var(--muted); font-size: 14px; }
.sheet .big { font-size: 17px; padding: 13px; }
.sheet .big.danger { background: #5a1f33; }
.sheet .who { display: flex; flex-wrap: wrap; gap: 8px; }
.sheet .who button { background: #3a2f7a; padding: 10px 14px; border-radius: 99px; font-size: 15px; }
.sheet .who button.off { opacity: .55; }
.claim { position: fixed; left: 12px; right: 12px; top: 52px; z-index: 35; display: none; background: #3a2f7a; border: 2px solid var(--gold);
  border-radius: var(--radius); padding: 12px 14px; max-width: 536px; margin: 0 auto; }
.claim.on { display: block; }
.claim p { margin: 0 0 8px; }
.claim .row { display: flex; gap: 8px; }
.claim .row button { flex: 1; }
.q-top { padding-right: 40px; }   /* room for the menu button */
.claim .row button:not(.primary) { background: #1b1440; }

/* TVs on the same home connection: one tap to start, join or show a game on them. */
.nearby { display: flex; flex-direction: column; gap: 8px; }
.nearby:empty { display: none; }
.tv-near { display: flex; align-items: center; gap: 10px; background: #2d2466; border: 2px solid var(--gold); border-radius: var(--radius); padding: 10px 12px; }
.tv-near .what { flex: 1; font-size: 15px; }
.tv-near .what b { display: block; font-size: 17px; }
.tv-near button { background: var(--gold); color: #2a1b00; font-weight: 700; padding: 10px 14px; border-radius: 99px; font-size: 15px; white-space: nowrap; }
.tv-near .tv-ic { font-size: 28px; }
