:root {
  --bg: #14112b;
  --bg2: #1f1a45;
  --card: #2a2360;
  --card2: #342c75;
  --text: #f5f3ff;
  --muted: #b7b0e6;
  --accent: #ffd23f;
  --accent-ink: #2a1f00;
  --good: #6be38f;
  --bad: #ff5d73;
  --edge: #5ce1e6;
  --radius: 18px;
  font-family: 'Fredoka', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background: radial-gradient(ellipse at top, var(--bg2), var(--bg) 70%) fixed;
  color: var(--text);
  font-size: 18px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 { margin: 0 0 .4em; line-height: 1.1; font-weight: 700; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.center { text-align: center; }
.hidden { display: none !important; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }
.narrow { max-width: 480px; }

.logo { font-size: clamp(2.2rem, 6vw, 4rem); letter-spacing: -.02em; }
.logo span { color: var(--accent); }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 8px 0 rgba(0,0,0,.25);
}
.card + .card { margin-top: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  appearance: none; border: 0; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 1.1rem;
  padding: 14px 24px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 5px 0 #b38f00;
  text-decoration: none;
  transition: transform .06s ease, box-shadow .06s ease;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #b38f00; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.secondary { background: var(--card2); color: var(--text); box-shadow: 0 5px 0 #1b1640; }
.btn.secondary:active { box-shadow: 0 1px 0 #1b1640; }
.btn.small { font-size: .9rem; padding: 8px 14px; }
.btn.block { width: 100%; }

input[type=text], input[type=number] {
  width: 100%;
  font: inherit; font-size: 1.4rem; font-weight: 600;
  padding: 14px 16px; border-radius: 14px;
  border: 3px solid var(--card2); background: var(--bg); color: var(--text);
}
input:focus { outline: none; border-color: var(--accent); }
label { display: block; font-weight: 600; margin: 12px 0 6px; color: var(--muted); }

input[type=range] { width: 100%; height: 44px; accent-color: var(--accent); }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }

.error { color: var(--bad); font-weight: 600; min-height: 1.4em; }

/* ---- chips & lists ---- */
.dot { display: inline-block; width: 18px; height: 18px; border-radius: 50%; flex: none; vertical-align: middle; }
.standings .dot { width: 22px; height: 22px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--card2); border-radius: 999px; padding: 8px 16px 8px 8px;
  font-weight: 600;
}
.chip .dot { width: 26px; height: 26px; border-radius: 50%; flex: none; }
.chip.off { opacity: .45; }
.chip.done { outline: 3px solid var(--good); }
button.chip { border: 0; color: inherit; font: inherit; font-weight: 600; cursor: pointer; }

.edge-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--edge); color: #062a2b;
  font-weight: 700; font-size: .8em;
  padding: 2px 10px; border-radius: 999px;
}

.edge-banner {
  background: linear-gradient(90deg, #0f4b52, #1b6e78);
  border: 3px solid var(--edge);
  border-radius: var(--radius);
  padding: 14px 18px;
}
.edge-banner strong { color: var(--edge); }

.standings { list-style: none; padding: 0; margin: 0; }
.standings li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
}
.standings li:nth-child(odd) { background: rgba(255,255,255,.04); }
.standings .rank { width: 1.6em; font-weight: 700; color: var(--muted); }
.standings .name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.standings .score { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- host ---- */
.code {
  font-size: clamp(3rem, 12vw, 7rem); font-weight: 700; letter-spacing: .15em;
  color: var(--accent); line-height: 1;
}
.host-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 800px) { .host-grid { grid-template-columns: 1fr; } }

.big-emoji { font-size: clamp(3rem, 10vw, 6rem); line-height: 1; }
.round-tag { color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .1em; font-size: .85rem; }
.answer { font-size: clamp(3rem, 10vw, 6rem); font-weight: 700; color: var(--accent); line-height: 1; }
.timer { font-size: 2.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.timer.low { color: var(--bad); }

.results { width: 100%; border-collapse: collapse; }
.results th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px 8px; font-size: .9rem; }
.results td { padding: 10px 8px; border-top: 1px solid rgba(255,255,255,.08); }
.results td.num { text-align: right; font-variant-numeric: tabular-nums; }
.results tr.win td { background: rgba(255,210,63,.12); }
.tag { font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--card2); margin-left: 6px; white-space: nowrap; }
.tag.gold { background: var(--accent); color: var(--accent-ink); }

.podium { display: flex; justify-content: center; align-items: flex-end; gap: 12px; margin: 16px 0 24px; }
.podium .step { text-align: center; width: 30%; max-width: 180px; }
.podium .block { border-radius: 14px 14px 0 0; background: var(--card2); display: flex; align-items: flex-start; justify-content: center; padding-top: 10px; font-size: 2rem; font-weight: 700; }
.podium .p1 .block { height: 160px; background: var(--accent); color: var(--accent-ink); }
.podium .p2 .block { height: 110px; }
.podium .p3 .block { height: 80px; }
.podium .who { font-weight: 700; margin-bottom: 6px; overflow-wrap: anywhere; }

/* ---- player ---- */
.you-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.you-bar .dot { width: 32px; height: 32px; border-radius: 50%; }
.you-bar .name { font-weight: 700; flex: 1; }

.stage {
  background: #0b0920; border-radius: var(--radius);
  aspect-ratio: 1; width: 100%; display: grid; place-items: center; overflow: hidden;
  position: relative;
}
.stage svg { width: 100%; height: 100%; display: block; }
.stage .msg { font-size: 1.6rem; font-weight: 700; text-align: center; padding: 16px; }

.barbox { width: 80%; height: 60px; border: 4px solid var(--text); border-radius: 12px; overflow: hidden; }
.barfill { height: 100%; background: var(--accent); }

.lamp { width: 55%; aspect-ratio: 1; border-radius: 50%; background: #2a2450; transition: background .03s; }
.lamp.on { background: #fff6a8; box-shadow: 0 0 60px 20px rgba(255,240,140,.6); }

.stopwatch-face { font-size: 4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.target { font-size: 1.3rem; }
.target strong { color: var(--accent); font-size: 1.6rem; }

.slider-value { font-size: 3rem; font-weight: 700; text-align: center; color: var(--accent); }

.locked { font-size: 1.3rem; }
.locked strong { color: var(--accent); font-size: 2rem; display: block; }

.question { font-size: 1.4rem; font-weight: 600; }
.clue { background: var(--card2); border-radius: 12px; padding: 12px 14px; font-weight: 600; }
.clue.edge { background: #0f4b52; border: 2px solid var(--edge); }

.mini-timer { height: 8px; border-radius: 99px; background: var(--card2); overflow: hidden; margin-top: 12px; }
.mini-timer > div { height: 100%; background: var(--accent); transition: width .25s linear; }

.result-big { font-size: 3rem; font-weight: 700; }
.pop { animation: pop .35s ease-out; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.how { padding-left: 1.2em; margin: 0; }
.how li + li { margin-top: 6px; }

/* ======================= big-screen scenes ======================= */
.stage16 {
  position: relative; width: min(100%, calc((100vh - 190px) * 16 / 9)); margin: 0 auto; aspect-ratio: 16 / 9;
  border-radius: var(--radius); overflow: hidden;
  container-type: size; background: #000;
  box-shadow: 0 8px 0 rgba(0,0,0,.3);
  font-family: 'Fredoka', system-ui, sans-serif;
}
.s-item { position: absolute; transform: translate(-50%, -50%); line-height: 1; white-space: nowrap; user-select: none; }
.s-box { position: absolute; }
.s-row { position: absolute; left: 0; white-space: nowrap; line-height: 1; }
.s-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.s-card { background: rgba(255,255,255,.92); color: #222; font-weight: 800; padding: .25em .6em; border-radius: .4em; box-shadow: 0 .1em 0 rgba(0,0,0,.2); }
.s-cover {
  position: absolute; inset: 0; z-index: 50;
  display: grid; place-content: center; text-align: center;
  background: rgba(15, 12, 40, .94); color: #fff;
}
.s-cover-big { font-size: 30cqh; line-height: 1; }
.s-cover-sub { font-size: 7cqh; font-weight: 700; margin-top: 2cqh; }
.s-title {
  position: absolute; inset: 0; z-index: 60; display: grid; place-content: center; text-align: center;
  background: radial-gradient(circle, #3a2f86, #14112b); color: #fff; padding: 4cqh 6cqw;
}
.s-title .e { font-size: 24cqh; line-height: 1; }
.s-title .t { font-size: 11cqh; font-weight: 700; margin: 2cqh 0 1cqh; }
.s-title .p { font-size: 5.5cqh; color: #d8d2ff; max-width: 80cqw; }

.bob { animation: bob 2.4s ease-in-out infinite alternate; }
@keyframes bob { from { margin-top: -1cqh; } to { margin-top: 1cqh; } }
.twinkle { animation: twinkle 1.6s ease-in-out infinite alternate; }
@keyframes twinkle { from { opacity: .2; } to { opacity: 1; } }
.waddle { animation: waddle .35s ease-in-out infinite alternate; }
@keyframes waddle { from { rotate: -8deg; } to { rotate: 8deg; } }

.fence { display: flex; justify-content: space-between; border-top: 1.4cqh solid #8b5a2b; border-bottom: 1.4cqh solid #8b5a2b; }
.fence i { width: 1.4cqh; background: #8b5a2b; }
.jar { background: linear-gradient(90deg, rgba(160,210,255,.85), rgba(220,240,255,.95) 40%, rgba(160,210,255,.85)); border: .8cqh solid #7fb6e8; border-top-width: 2cqh; border-radius: 2cqh 2cqh 5cqh 5cqh; display: grid; place-items: center; }
.jar span { background: #ff5d9e; color: #fff; font-weight: 800; font-size: 5cqh; padding: .5cqh 2cqh; border-radius: 1cqh; }
.domino { width: 2.2cqw; height: 13cqh; background: #fff; border: .4cqh solid #222; border-radius: .6cqh; transform-origin: 50% 100%; box-shadow: inset 0 -6.5cqh 0 -6.1cqh #222; }
.s-die { display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 2cqh; gap: 1cqh; background: #fff; border-radius: 3cqh; box-shadow: 0 1.2cqh 0 #bbb; }
.s-die i { border-radius: 50%; }
.s-die i.on { background: #222; }
.cup { clip-path: polygon(8% 0, 92% 0, 78% 100%, 22% 100%); box-shadow: inset 0 1.4cqh 0 rgba(255,255,255,.4); }
.beam { background: linear-gradient(rgba(255,255,140,.85), rgba(255,255,140,.15)); clip-path: polygon(35% 0, 65% 0, 100% 100%, 0 100%); }
.s-ant { display: flex; flex-direction: column; align-items: center; line-height: .8; }
.s-ant .crumb { font-size: .6em; }
.win.lit { background: #ffe680 !important; box-shadow: 0 0 2cqh #ffe680; }
.tile { box-shadow: 0 .8cqh 0 rgba(0,0,0,.12); }
.tile b { position: absolute; left: 1.2cqh; top: .8cqh; font-size: 4cqh; color: #5b5b7a; }
.card { perspective: 600px; }
.card .front, .card .back { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 2cqh; backface-visibility: hidden; transition: transform .5s; font-size: 18cqh; }
.card .front { background: #fff; }
.card .back { background: repeating-linear-gradient(45deg, #ff5d73 0 2cqh, #ff8a9a 2cqh 4cqh); color: #fff; font-weight: 800; transform: rotateY(180deg); }
.card.flipped .front { transform: rotateY(180deg); }
.card.flipped .back { transform: rotateY(360deg); }
.card b { position: absolute; bottom: -6.5cqh; left: 0; right: 0; text-align: center; color: #fff; font-size: 5cqh; }
.shape { width: 9cqh; height: 9cqh; }
.shape.circle { border-radius: 50%; }
.shape.triangle { clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.shape.star { clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); width: 11cqh; height: 11cqh; }
.shape.diamond { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.ball { width: 8cqh; height: 8cqh; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff, #ff2e2e 40%, #a00); }
.shell { width: 18cqh; height: 22cqh; background: linear-gradient(90deg, #c0392b, #ff6b5b 45%, #c0392b); clip-path: polygon(25% 0, 75% 0, 100% 100%, 0 100%); border-radius: 1cqh; }
.finish { background: repeating-linear-gradient(#000 0 2cqh, #fff 2cqh 4cqh); }
.silhouette { filter: brightness(0); }
.curtain { background: repeating-linear-gradient(90deg, #a4161a 0 4cqw, #c9182b 4cqw 8cqw); }
.s-lid { position: absolute; inset: 0; display: grid; place-items: center; font-size: 10cqh; font-weight: 800; color: #7a5228; }
.ladybug, .cookie { transform-origin: 50% 50%; }
.s-tally { width: 100%; height: 100%; }

/* ======================= host game screens ======================= */
.game-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.game-top .q-prompt { flex: 1; font-size: clamp(1.1rem, 2.4vw, 1.8rem); font-weight: 700; min-width: 240px; }
.ring { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 1.5rem; background: conic-gradient(var(--accent) var(--p, 100%), var(--card2) 0); position: relative; }
.ring::before { content: ''; position: absolute; inset: 6px; border-radius: 50%; background: var(--bg); }
.ring span { position: relative; }
.ring.low { --accent: var(--bad); }
.answered { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.answered .chip { padding: 6px 12px 6px 6px; font-size: .95rem; }
.qr { background: #fff; border-radius: 16px; padding: 10px; width: min(260px, 60vw); aspect-ratio: 1; }
.qr img { width: 100%; height: 100%; display: block; }
.join-url { font-weight: 700; font-size: 1.3rem; word-break: break-all; }
.settings-row { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }
.vs { display: flex; gap: 16px; align-items: stretch; justify-content: center; flex-wrap: wrap; }
.actor-card { flex: 1; min-width: 200px; max-width: 360px; border-radius: var(--radius); padding: 20px; text-align: center; background: var(--card2); border: 4px solid var(--c, #fff); }
.actor-card .nm { font-size: 2rem; font-weight: 700; }
.actor-card .votes { font-size: 3rem; font-weight: 700; color: var(--accent); }
.vs-word { align-self: center; font-size: 2rem; font-weight: 700; color: var(--muted); }
.act-prompt { font-size: clamp(1.6rem, 4vw, 2.8rem); font-weight: 700; color: var(--accent); text-align: center; margin: 10px 0; }
.winner { outline: 6px solid var(--accent); }
.option-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.option-pill { background: var(--card2); border-radius: 14px; padding: 10px 16px; font-weight: 700; font-size: 1.2rem; display: inline-flex; align-items: center; gap: 8px; }
.option-pill.right { background: var(--good); color: #062a10; }
.swatch-lg { width: 26px; height: 26px; border-radius: 8px; border: 2px solid rgba(255,255,255,.6); display: inline-block; }

/* ======================= phone ======================= */
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keypad button { font: inherit; font-size: 1.8rem; font-weight: 700; padding: 14px 0; border: 0; border-radius: 16px; background: var(--card2); color: var(--text); box-shadow: 0 4px 0 #1b1640; }
.keypad button:active { transform: translateY(3px); box-shadow: 0 1px 0 #1b1640; }
.keypad-display { font-size: 3rem; font-weight: 700; text-align: center; background: var(--bg); border-radius: 16px; padding: 8px; min-height: 1.6em; letter-spacing: .05em; border: 3px solid var(--card2); }
.choices { display: grid; gap: 10px; }
.choice-btn { display: flex; align-items: center; gap: 12px; font: inherit; font-size: 1.3rem; font-weight: 700; text-align: left; padding: 16px; border: 3px solid transparent; border-radius: 16px; background: var(--card2); color: var(--text); box-shadow: 0 4px 0 #1b1640; }
.choice-btn .em { font-size: 2rem; line-height: 1; }
.choice-btn.sel { border-color: var(--accent); }
.choice-btn.crossed { opacity: .35; text-decoration: line-through; }
.watch { font-size: 1rem; color: var(--muted); font-weight: 600; }
.verdict { font-size: 4rem; line-height: 1; }
.vote-btn { width: 100%; font: inherit; font-size: 1.6rem; font-weight: 700; padding: 22px; border-radius: 18px; border: 4px solid var(--c); background: var(--card2); color: var(--text); }
.vote-btn.sel { background: var(--c); color: #111; }

.host-controls { margin-top: 18px; border: 3px solid var(--accent); text-align: center; }
.choices.grid2 { grid-template-columns: 1fr 1fr; }
.choices.grid2 .choice-btn { justify-content: center; font-size: 2.2rem; padding: 22px 8px; }
