/* Party Quiz — one stylesheet for every page.
   Look: a board-game box. Cobalt table, paper tokens with hard offset shadows you can "press",
   four answer colors that always come with a shape so color is never the only cue. */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("../fonts/bricolage-grotesque.woff2") format("woff2-variations"), url("../fonts/bricolage-grotesque.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}

:root {
  --cobalt: #1d33b8;
  --night: #111c6b;
  --deep: #0b1450;
  --paper: #fff6e5;
  --paper-dim: #d9d3ff;
  --ink: #14183a;
  --tangerine: #ff7a1a;
  --lemon: #ffd23f;
  --mint: #22c997;
  --bubblegum: #ff5c9e;
  --good: #22c997;
  --bad: #ff6b6b;
  --muted: #aab4f2;
  --accent: #ffd23f;
  --glow: rgba(255, 255, 255, 0.07);
  --font: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --radius-token: 14px;
  --press: 0 6px 0 var(--deep);
  --press-small: 0 4px 0 var(--deep);
  color-scheme: dark;
}


/* ---------- Party color schemes (picked on the home page or the host's setup screen) ----------
   Only the table colors and the accent change; the four answer colors stay, so every game reads the same. */
:root[data-theme="birthday"] { --cobalt: #a2198f; --night: #74106a; --deep: #400838; --accent: #ffd23f; --paper-dim: #ffd6f3; --muted: #f0a6df; --glow: rgba(255, 210, 63, 0.16); }
:root[data-theme="halloween"] { --cobalt: #33184f; --night: #22103a; --deep: #0f0619; --accent: #ff8a1f; --paper-dim: #e6d5ff; --muted: #b69ad8; --glow: rgba(255, 138, 31, 0.16); }
:root[data-theme="christmas"] { --cobalt: #12683a; --night: #0b4a28; --deep: #042414; --accent: #ffd23f; --paper-dim: #d6f5df; --muted: #9bd8ae; --glow: rgba(255, 92, 92, 0.16); }
:root[data-theme="spring"] { --cobalt: #6c4fc9; --night: #4f37a3; --deep: #2b1d66; --accent: #ffe680; --paper-dim: #efe6ff; --muted: #c7b8f5; --glow: rgba(141, 240, 196, 0.2); }
:root[data-theme="stars"] { --cobalt: #1a2a6c; --night: #111c4f; --deep: #070d2c; --accent: #ff5468; --paper-dim: #dfe5ff; --muted: #a9b5ea; --glow: rgba(255, 84, 104, 0.15); }
:root[data-theme="ocean"] { --cobalt: #0b7480; --night: #075560; --deep: #022c33; --accent: #ffd23f; --paper-dim: #d3f6f8; --muted: #8ed3da; --glow: rgba(125, 249, 255, 0.15); }
:root[data-theme="galaxy"] { --cobalt: #2a1158; --night: #1c0b3d; --deep: #0b031d; --accent: #7df9ff; --paper-dim: #e3d9ff; --muted: #a996e0; --glow: rgba(255, 92, 158, 0.17); }
:root[data-theme="neon"] { --cobalt: #15151c; --night: #22222c; --deep: #000000; --accent: #3dff7a; --paper-dim: #dcdce6; --muted: #9c9cae; --glow: rgba(61, 255, 122, 0.12); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(ellipse 120% 70% at 50% -10%, var(--glow), transparent 70%) fixed, var(--cobalt);
  color: var(--paper);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.45;
  font-variation-settings: "opsz" 24;
}
a { color: var(--accent); }
a:hover { color: var(--paper); }
:focus-visible { outline: 4px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

h1, h2, h3, .display {
  font-weight: 800;
  font-stretch: 80%;
  line-height: 1.02;
  letter-spacing: -0.01em;
  margin: 0;
  font-variation-settings: "opsz" 96;
}
p { margin: 0 0 0.8em; }

/* ---------- Buttons: paper tokens that press down ---------- */
.btn {
  appearance: none;
  border: 3px solid var(--deep);
  border-radius: var(--radius-token);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 750;
  font-stretch: 85%;
  font-size: 1.05em;
  padding: 0.6em 1.15em;
  box-shadow: var(--press);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  transition: transform 0.06s ease, box-shadow 0.06s ease;
  touch-action: manipulation;
}
.btn:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 1px 0 var(--deep); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.go { background: var(--accent); }
.btn.big { font-size: 1.35em; padding: 0.7em 1.4em; }
.btn.quiet { background: transparent; color: var(--paper); border-color: var(--paper-dim); box-shadow: none; }
.btn.quiet:active { transform: none; }
.btn.wide { width: 100%; }
.btn.small { font-size: 0.9em; padding: 0.4em 0.8em; box-shadow: var(--press-small); }

/* ---------- Forms ---------- */
label { font-weight: 650; }
input[type="text"], input[type="number"], input[type="password"], input[type="search"], input[type="email"], select {
  font: inherit;
  font-size: 1.1em;
  color: var(--ink);
  background: var(--paper);
  border: 3px solid var(--deep);
  border-radius: 12px;
  padding: 0.55em 0.7em;
  width: 100%;
  min-width: 0;
}
input::placeholder { color: #8a8aa8; }
.error { color: #ffc9c9; font-weight: 650; min-height: 1.4em; margin: 0.4em 0 0; }

/* ---------- The room code: four letter tiles (the one loud thing) ---------- */
.code-tiles { display: inline-flex; gap: 0.18em; }
.code-tiles span {
  display: inline-grid;
  place-items: center;
  width: 1.15em;
  height: 1.3em;
  background: var(--paper);
  color: var(--ink);
  border: 0.06em solid var(--deep);
  border-radius: 0.14em;
  box-shadow: 0 0.09em 0 var(--deep);
  font-weight: 800;
  font-stretch: 75%;
  line-height: 1;
}
.code-tiles span:nth-child(odd) { transform: rotate(-3deg); }
.code-tiles span:nth-child(even) { transform: rotate(2.5deg) translateY(0.04em); }

/* ---------- Answer colors + shapes ---------- */
.shape { display: inline-block; width: 1em; height: 1em; flex: 0 0 auto; background: var(--ink); }
.shape.s0 { clip-path: polygon(50% 6%, 96% 92%, 4% 92%); }
.shape.s1 { border-radius: 50%; }
.shape.s2 { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.shape.s3 { border-radius: 3px; transform: scale(0.86); }
.c0 { --tile: var(--tangerine); }
.c1 { --tile: var(--lemon); }
.c2 { --tile: var(--mint); }
.c3 { --tile: var(--bubblegum); }

/* ---------- Landing page ---------- */
.landing { max-width: 1080px; margin: 0 auto; padding: 28px 20px 48px; }
.landing-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 36px; }
.wordmark { font-size: 1.6rem; color: var(--paper); text-decoration: none; }
.wordmark .dot { color: var(--accent); }
.landing-top nav { display: flex; gap: 18px; font-weight: 650; }
.landing-top nav a { color: var(--paper); text-decoration: none; }
.landing-top nav a:hover { color: var(--accent); }
.hero { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(2.6rem, 6.4vw, 5.2rem); }
.hero .lede { font-size: 1.2rem; max-width: 34em; margin-top: 18px; color: var(--paper-dim); }
.join-card {
  background: var(--paper);
  color: var(--ink);
  border: 4px solid var(--deep);
  border-radius: 22px;
  box-shadow: 0 10px 0 var(--deep);
  padding: 24px;
}
.join-card h2 { font-size: 1.9rem; margin-bottom: 6px; }
.join-card p { color: #3c4170; }
.code-entry { display: flex; gap: 8px; margin: 14px 0 12px; }
.code-entry input {
  width: 100%;
  font-size: 2.2rem;
  font-weight: 800;
  font-stretch: 75%;
  text-align: center;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  padding: 0.25em 0 0.25em 0.35em;
}
.join-card .error { color: #b3261e; }
.host-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 26px; }
.host-row span { color: var(--paper-dim); }
.games-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 64px; }
.game-card { border-top: 4px solid var(--tile); padding-top: 14px; }
.game-card h3 { font-size: 1.5rem; display: flex; align-items: center; gap: 0.4em; }
.game-card h3 .shape { background: var(--tile); width: 0.8em; height: 0.8em; }
.game-card p { color: var(--paper-dim); margin-top: 8px; font-size: 0.98rem; }
.how { margin-top: 56px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: step; }
.how li { list-style: none; counter-increment: step; color: var(--paper-dim); }
.how li::before { content: counter(step); display: block; font-weight: 800; font-stretch: 75%; font-size: 2.4rem; color: var(--accent); line-height: 1; margin-bottom: 4px; }
.how { padding: 0; }
.site-foot { margin-top: 64px; padding-top: 18px; border-top: 2px solid rgba(255, 246, 229, 0.18); display: flex; gap: 20px; flex-wrap: wrap; color: var(--muted); font-size: 0.95rem; }
.site-foot a { color: var(--paper-dim); }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 28px; }
  .hero .join-card { order: -1; } /* on a phone you're most likely here to join */
  .games-strip { grid-template-columns: 1fr 1fr; }
  .how { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .games-strip { grid-template-columns: 1fr; }
  .landing-top nav { gap: 12px; font-size: 0.95rem; }
}

/* ---------- Plain content pages (scores, about, admin) ---------- */
.page { max-width: 900px; margin: 0 auto; padding: 24px 18px 56px; }
.page h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); margin: 18px 0 12px; }
.page h2 { font-size: 1.7rem; margin: 28px 0 10px; }
.panel { background: var(--night); border-radius: 18px; padding: 18px; border: 2px solid rgba(255, 246, 229, 0.12); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin: 12px 0 18px; }
.toolbar label { display: grid; gap: 4px; font-size: 0.9rem; }
.toolbar select { width: auto; font-size: 1rem; }
.seg { display: inline-flex; border: 3px solid var(--deep); border-radius: 14px; overflow: hidden; box-shadow: var(--press-small); flex-wrap: wrap; }
.seg button { font: inherit; font-weight: 700; background: var(--paper); color: var(--ink); border: 0; padding: 0.5em 0.9em; cursor: pointer; }
.seg button + button { border-left: 2px solid var(--deep); }
.seg button[aria-pressed="true"] { background: var(--accent); }
table.board { width: 100%; border-collapse: collapse; font-size: 1.05rem; }
table.board th { text-align: left; color: var(--muted); font-weight: 600; font-size: 0.85rem; padding: 6px 8px; }
table.board td { padding: 9px 8px; border-top: 1px solid rgba(255, 246, 229, 0.12); }
table.board td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 750; }
table.board tr:first-child td { border-top: 0; }
.empty { color: var(--muted); padding: 20px 4px; }

/* ---------- TV / host screen ---------- */
body.tv { font-size: clamp(16px, 1.25vw, 30px); overflow-x: hidden; }
.stage { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding: 1.4em 2em 1.2em; gap: 1em; }
.stage-top { display: flex; align-items: center; gap: 1.2em; }
.stage-top .meta { color: var(--paper-dim); font-weight: 600; }
.stage-top .spacer { flex: 1; }
.stage-top .join-hint { display: flex; align-items: center; gap: 0.6em; font-weight: 650; }
.stage-top .join-hint .code-tiles { font-size: 1.5em; }
.host-controls { display: flex; gap: 0.6em; }
.host-controls .btn { font-size: 0.8em; }
.stage-main { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 1.1em; min-height: 0; }
.stage-foot { display: flex; align-items: center; gap: 1em; min-height: 2.6em; }

.timer { height: 0.7em; border-radius: 99px; background: var(--deep); overflow: hidden; flex: 1; }
.timer i { display: block; height: 100%; width: 100%; background: var(--accent); border-radius: 99px; transform-origin: left center; }
.timer.low i { background: var(--tangerine); }

.chips { display: flex; flex-wrap: wrap; gap: 0.45em; }
.chip {
  display: inline-flex; align-items: center; gap: 0.35em;
  background: var(--night); color: var(--paper); border: 2px solid rgba(255, 246, 229, 0.25);
  border-radius: 99px; padding: 0.25em 0.8em; font-weight: 650;
}
.chip.done { background: var(--paper); color: var(--ink); border-color: var(--deep); }
.chip.away { opacity: 0.5; }
.chip button { all: unset; cursor: pointer; font-weight: 800; padding: 0 0.15em; color: var(--muted); }
.chip button:hover, .chip button:focus-visible { color: var(--bad); }

/* Setup */
.setup { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 2em; align-items: start; }
.setup h2 { font-size: 1.6em; margin-bottom: 0.5em; }
.game-pick { display: grid; gap: 0.7em; }
.game-pick label {
  display: grid; grid-template-columns: auto 1fr; gap: 0.2em 0.7em; align-items: start;
  background: var(--night); border: 3px solid transparent; border-radius: 16px; padding: 0.8em 1em; cursor: pointer;
}
.game-pick label:has(input:checked) { border-color: var(--accent); background: var(--deep); }
.game-pick input { position: absolute; opacity: 0; }
.game-pick .shape { grid-row: span 2; width: 1.4em; height: 1.4em; background: var(--tile); margin-top: 0.15em; }
.game-pick strong { font-size: 1.25em; font-stretch: 85%; }
.game-pick small { color: var(--paper-dim); font-size: 0.85em; }
.game-pick label:has(input:focus-visible) { outline: 4px solid var(--accent); outline-offset: 2px; }
.options { display: flex; flex-wrap: wrap; gap: 1em 1.4em; margin-top: 1.2em; }
.options fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 0.35em; }
.options legend { font-weight: 650; margin-bottom: 0.35em; padding: 0; }
.cat-groups { display: grid; gap: 1em; max-height: 62vh; overflow: auto; padding-right: 0.4em; }
.cat-group h3 { font-size: 1.1em; font-stretch: 90%; display: flex; align-items: center; gap: 0.6em; margin-bottom: 0.45em; }
.cat-group h3 button { all: unset; cursor: pointer; font-size: 0.75em; font-weight: 600; color: var(--accent); text-decoration: underline; }
.cat-list { display: flex; flex-wrap: wrap; gap: 0.45em; }
.cat-toggle {
  font: inherit; font-size: 0.92em; font-weight: 650; cursor: pointer;
  background: transparent; color: var(--paper); border: 2px solid rgba(255, 246, 229, 0.35); border-radius: 99px; padding: 0.3em 0.85em;
}
.cat-toggle[aria-pressed="true"] { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.cat-toggle:disabled { opacity: 0.35; cursor: default; }
.setup-foot { display: flex; align-items: center; gap: 1em; flex-wrap: wrap; margin-top: 1.4em; }
.setup-foot .note { color: var(--paper-dim); margin: 0; flex-basis: 100%; }

.mode-box { margin-bottom: 1em; display: grid; gap: 0.7em; }
.mode-box fieldset { border: 0; padding: 0; margin: 0; }
.mode-box legend { font-weight: 650; margin-bottom: 0.35em; padding: 0; }
.mode-box .field { display: grid; gap: 0.3em; max-width: 22em; }
.mode-box .note { color: var(--paper-dim); margin: 0; }

/* Lobby */
.lobby { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 2em; align-items: center; }
.lobby .code-tiles { font-size: 7.5em; }
.lobby .how-join { font-size: 1.5em; font-weight: 650; margin: 0.4em 0 0.2em; }
.lobby .how-join b { color: var(--accent); }
.lobby .qr { background: var(--paper); border: 4px solid var(--deep); border-radius: 20px; box-shadow: var(--press); padding: 0.8em; width: min(22em, 100%); justify-self: center; }
.lobby .qr canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.lobby .qr p { color: var(--ink); text-align: center; margin: 0.4em 0 0; font-weight: 650; }
.lobby-players { margin-top: 1.6em; }
.lobby-players h2 { font-size: 1.4em; margin-bottom: 0.4em; }
.lobby-players .chips { font-size: 1.15em; }
.lobby-actions { display: flex; gap: 0.8em; align-items: center; flex-wrap: wrap; margin-top: 1.4em; }

/* Question screens */
.cat-tag { font-weight: 700; color: var(--accent); font-size: 1.1em; }
.question { font-size: 3.1em; font-weight: 750; font-stretch: 88%; line-height: 1.08; max-width: 26em; text-wrap: balance; }
.question .blank { display: inline-block; min-width: 3.5em; border-bottom: 0.1em solid var(--accent); margin: 0 0.1em; }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8em; }
.answer {
  background: var(--tile); color: var(--ink); border: 3px solid var(--deep); border-radius: 18px; box-shadow: var(--press);
  display: flex; align-items: center; gap: 0.6em; padding: 0.7em 1em; font-size: 1.8em; font-weight: 750; font-stretch: 90%; line-height: 1.1;
}
.answer .shape { width: 0.9em; height: 0.9em; }
.answer .count { margin-left: auto; font-size: 0.75em; background: var(--paper); border-radius: 99px; padding: 0.05em 0.6em; font-variant-numeric: tabular-nums; }
.answers.revealed .answer:not(.right) { opacity: 0.32; box-shadow: none; }
button.answer { font-family: inherit; text-align: left; width: 100%; cursor: pointer; }
button.answer:not(.c0):not(.c1):not(.c2):not(.c3) { background: var(--paper); }
button.answer:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 1px 0 var(--deep); }
button.answer:disabled { opacity: 0.32; box-shadow: none; cursor: default; }
button.answer.picked { outline: 0.18em solid var(--paper); outline-offset: 0.12em; }
.tv-number-form { display: flex; align-items: center; gap: 0.8em; flex-wrap: wrap; }
input.tv-number { font-size: 2.4em; font-weight: 800; width: 7em; text-align: center; }
.answers.revealed .answer.right { outline: 0.18em solid var(--paper); outline-offset: 0.12em; }
.answers.many { grid-template-columns: repeat(auto-fit, minmax(14em, 1fr)); }
.answers.many .answer { font-size: 1.4em; background: var(--paper); }
.clues { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.4em; }
.clues li { font-size: 1.7em; font-weight: 650; display: flex; gap: 0.6em; align-items: baseline; }
.clues li::before { content: ""; width: 0.5em; height: 0.5em; background: var(--accent); border-radius: 50%; flex: 0 0 auto; transform: translateY(-0.1em); }
.clues li.later { color: rgba(255, 246, 229, 0.25); }
.clues li.later::before { background: rgba(255, 246, 229, 0.25); }
.worth { font-weight: 800; font-stretch: 80%; font-size: 1.3em; color: var(--accent); }
.big-hint { font-size: 1.6em; color: var(--paper-dim); font-weight: 600; }
.answered-line { color: var(--paper-dim); font-weight: 650; white-space: nowrap; }

/* Reveal */
.reveal-grid .question { font-size: 2.1em; }
.reveal-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 2em; align-items: start; }
.reveal-grid > div { display: grid; gap: 0.7em; align-content: start; }
.reveal-grid > div > .cat-tag { margin-bottom: -0.4em; }
.fact { font-size: 1.35em; color: var(--paper); background: var(--night); border-radius: 16px; padding: 0.8em 1em; max-width: 34em; }
.truth { font-size: 4em; font-weight: 800; font-stretch: 80%; line-height: 1; color: var(--accent); }
.scorelist { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35em; font-size: 1.3em; }
.scorelist li { display: grid; grid-template-columns: 1.6em 1fr auto auto; gap: 0.5em; align-items: baseline; background: var(--night); border-radius: 12px; padding: 0.35em 0.7em; }
.scorelist .rank { color: var(--muted); font-weight: 700; }
.scorelist .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scorelist .gain { color: var(--good); font-weight: 750; font-size: 0.85em; }
.scorelist .pts { font-weight: 800; font-variant-numeric: tabular-nums; }
.bluff-results { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5em; }
.bluff-results li { background: var(--night); border-radius: 14px; padding: 0.55em 0.9em; font-size: 1.25em; }
.bluff-results li.truth-row { background: var(--paper); color: var(--ink); }
.bluff-results .text { font-weight: 750; font-size: 1.15em; }
.bluff-results .who { color: var(--paper-dim); font-size: 0.85em; }
.bluff-results li.truth-row .who { color: #3c4170; }
.guess-board { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.35em; font-size: 1.3em; }
.guess-board li { display: grid; grid-template-columns: 1.6em 1fr auto auto; gap: 0.6em; background: var(--night); border-radius: 12px; padding: 0.35em 0.7em; align-items: baseline; }
.guess-board .gain { color: var(--good); font-weight: 750; }

/* Intro + final */
.intro { max-width: 40em; }
.intro h1 { font-size: 5em; }
.intro p { font-size: 1.6em; color: var(--paper-dim); margin-top: 0.6em; }
.podium { display: flex; align-items: end; justify-content: center; gap: 1em; margin: 0.5em 0 1em; }
.podium .step { background: var(--paper); color: var(--ink); border: 4px solid var(--deep); border-radius: 16px 16px 6px 6px; box-shadow: var(--press); width: 11em; text-align: center; padding: 0.8em 0.6em; }
.podium .step .place { font-size: 2.6em; font-weight: 800; font-stretch: 75%; line-height: 1; }
.podium .step .who { font-size: 1.4em; font-weight: 750; overflow-wrap: anywhere; }
.podium .step .pts { font-variant-numeric: tabular-nums; font-weight: 650; }
.podium .first { min-height: 15em; background: var(--accent); }
.podium .second { min-height: 11.5em; }
.podium .third { min-height: 9em; }
.final-actions { display: flex; gap: 0.8em; justify-content: center; flex-wrap: wrap; }
.final-note { text-align: center; color: var(--paper-dim); }

@media (max-width: 900px) {
  body.tv { font-size: 15px; }
  .setup, .lobby, .reveal-grid { grid-template-columns: 1fr; }
  .lobby .code-tiles { font-size: 4.5em; }
  .question { font-size: 2em; }
  .answer { font-size: 1.3em; }
  .answers { grid-template-columns: 1fr; }
  .intro h1 { font-size: 3em; }
  .stage { padding: 1em; }
  .stage-top { flex-wrap: wrap; }
}

/* ---------- Phone ---------- */
body.phone { font-size: 18px; }
.phone-wrap { max-width: 520px; margin: 0 auto; padding: 14px 16px 28px; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; gap: 14px; }
.phone-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 700; }
.phone-top .me { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phone-top .score { font-variant-numeric: tabular-nums; color: var(--accent); }
.phone-main { flex: 1; display: flex; flex-direction: column; gap: 14px; }
.phone-card { background: var(--paper); color: var(--ink); border: 3px solid var(--deep); border-radius: 20px; box-shadow: var(--press); padding: 18px; }
.phone-card h1 { font-size: 2rem; margin-bottom: 8px; }
.phone-card p { color: #3c4170; }
.phone-card .error { color: #b3261e; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field .code-input { font-size: 2rem; font-weight: 800; font-stretch: 75%; text-align: center; letter-spacing: 0.35em; text-transform: uppercase; padding-left: 0.35em; }
.phone-q { font-size: 1.25rem; font-weight: 700; line-height: 1.25; }
.phone-sub { color: var(--paper-dim); }
.phone-timer { height: 10px; border-radius: 99px; background: var(--deep); overflow: hidden; }
.phone-timer i { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left center; }
.pad { display: grid; gap: 12px; }
.pad button {
  appearance: none; font: inherit; font-size: 1.15rem; font-weight: 750; line-height: 1.2; text-align: left; cursor: pointer;
  background: var(--tile, var(--paper)); color: var(--ink); border: 3px solid var(--deep); border-radius: 16px; box-shadow: var(--press);
  padding: 16px; display: flex; align-items: center; gap: 12px; min-height: 64px; touch-action: manipulation;
}
.pad button:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 1px 0 var(--deep); }
.pad button:disabled { opacity: 0.35; }
.pad button.mine { opacity: 1; outline: 4px solid var(--paper); outline-offset: 3px; }
.pad .shape { width: 26px; height: 26px; }
.pad.choices { grid-template-columns: 1fr 1fr; }
.pad.choices button { flex-direction: column; align-items: flex-start; min-height: 120px; }
.phone-clues { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; color: var(--paper); font-weight: 600; }
.phone-clues li::before { content: "• "; color: var(--accent); }
.result-big { text-align: center; padding: 26px 10px; }
.result-big .headline { font-size: 2.8rem; font-weight: 800; font-stretch: 80%; line-height: 1; }
.result-big .points { font-size: 2rem; font-weight: 800; color: var(--good); margin-top: 8px; }
.result-big.miss .points { color: var(--paper-dim); }
.result-big p { color: var(--paper-dim); margin-top: 10px; }
.waiting { text-align: center; color: var(--paper-dim); padding: 40px 10px; font-size: 1.2rem; }
.waiting strong { display: block; color: var(--paper); font-size: 1.8rem; font-stretch: 85%; margin-bottom: 6px; }
.rank-line { text-align: center; color: var(--paper-dim); }
.locked-in { text-align: center; font-weight: 750; font-size: 1.3rem; padding: 10px; }
@media (max-width: 360px) { .pad.choices { grid-template-columns: 1fr; } .pad.choices button { min-height: 72px; flex-direction: row; } }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--paper); color: var(--ink); border: 3px solid var(--deep); border-radius: 14px; padding: 10px 16px; font-weight: 700; box-shadow: var(--press-small); z-index: 50; max-width: calc(100% - 32px); }


/* ---------- Theme picker ---------- */
.theme-picker { display: flex; flex-wrap: wrap; gap: 0.5em; }
.theme-picker button {
  font: inherit; font-size: 0.9em; font-weight: 650; cursor: pointer; color: var(--paper);
  background: transparent; border: 2px solid rgba(255, 246, 229, 0.3); border-radius: 99px;
  padding: 0.25em 0.8em 0.25em 0.3em; display: inline-flex; align-items: center; gap: 0.45em;
}
.theme-picker button[aria-pressed="true"] { border-color: var(--accent); background: var(--deep); }
.theme-picker .swatch { width: 1.5em; height: 1.5em; border-radius: 50%; border: 2px solid var(--paper); flex: 0 0 auto; }
.theme-row { margin-top: 22px; display: grid; gap: 8px; }
.theme-row > span { font-weight: 650; color: var(--paper-dim); }
.options fieldset.wide { flex-basis: 100%; }

/* ---------- Sound toggle ---------- */
.sound-btn { font-size: 0.8em; min-width: 2.6em; }
.phone-top .sound-btn { font-size: 0.85rem; padding: 0.3em 0.6em; }
.phone-top .right-side { display: flex; align-items: center; gap: 10px; }

/* ---------- Right / wrong effects ---------- */
@keyframes pop-in { 0% { transform: scale(0.4); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
@keyframes pulse-right { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 15%, 55% { transform: translateX(-0.35em); } 35%, 75% { transform: translateX(0.35em); } }
@keyframes rise { from { transform: translateY(0.8em); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes glow-good { 0% { box-shadow: 0 0 0 0 rgba(34, 201, 151, 0.9); } 100% { box-shadow: 0 0 0 1.2em rgba(34, 201, 151, 0); } }
@keyframes burst { 0% { transform: translate(-50%, -50%) scale(0.3) rotate(-6deg); opacity: 0; } 18% { transform: translate(-50%, -50%) scale(1.12) rotate(2deg); opacity: 1; }
  30% { transform: translate(-50%, -50%) scale(1) rotate(0); } 80% { opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1.04); opacity: 0; } }
@keyframes flash { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }

.fx .answers.revealed .answer.right { animation: pulse-right 0.7s ease-in-out 3, glow-good 1.2s ease-out 1; }
.answer.wrong-pick { position: relative; opacity: 1 !important; outline: 0.18em solid var(--bad); outline-offset: 0.12em; }
.answer.wrong-pick::after { content: "\2715"; position: absolute; right: 0.5em; top: 50%; transform: translateY(-50%); font-size: 1.3em; color: var(--bad); font-weight: 900; text-shadow: 0 2px 0 var(--deep); }
.fx .answer.wrong-pick { animation: shake 0.5s ease-in-out 2; }

/* Who got it (TV, phones mode) */
.verdict { display: flex; align-items: baseline; gap: 0.6em; flex-wrap: wrap; }
.verdict strong { font-size: 2.2em; font-weight: 800; font-stretch: 80%; line-height: 1; }
.verdict.good strong { color: var(--good); }
.verdict.bad strong { color: var(--bad); }
.verdict span { color: var(--paper-dim); font-weight: 650; font-size: 1.1em; }
.fx .verdict { animation: pop-in 0.5s ease-out both; }
.who-got { display: flex; flex-wrap: wrap; gap: 0.45em; }
.who-got .tag {
  display: inline-flex; align-items: center; gap: 0.35em; border-radius: 99px; padding: 0.25em 0.8em 0.25em 0.35em; font-weight: 750;
  background: var(--night); color: var(--paper); border: 2px solid rgba(255, 246, 229, 0.2); font-size: 1.05em;
}
.who-got .tag i { font-style: normal; display: inline-grid; place-items: center; width: 1.35em; height: 1.35em; border-radius: 50%; font-size: 0.85em; font-weight: 900; background: var(--muted); color: var(--ink); }
.who-got .tag.right { background: var(--good); color: var(--ink); border-color: var(--deep); }
.who-got .tag.right i { background: var(--paper); color: #0d7a59; }
.who-got .tag.close { background: var(--lemon); color: var(--ink); border-color: var(--deep); }
.who-got .tag.close i { background: var(--paper); color: var(--ink); }
.who-got .tag.wrong { border-color: var(--bad); }
.who-got .tag.wrong i { background: var(--bad); color: var(--paper); }
.who-got .tag.none { opacity: 0.55; }
.fx .who-got .tag { animation: pop-in 0.45s ease-out both; }
.scorelist li.right { box-shadow: inset 0.3em 0 0 var(--good); }
.scorelist li.close { box-shadow: inset 0.3em 0 0 var(--lemon); }
.scorelist li.wrong { box-shadow: inset 0.3em 0 0 var(--bad); }
.scorelist .mark { font-weight: 900; }
.scorelist li.right .mark { color: var(--good); }
.scorelist li.wrong .mark { color: var(--bad); }
.fx .scorelist li { animation: rise 0.4s ease-out both; }

/* Big center message (playing together, and phones) */
.burst {
  position: fixed; left: 50%; top: 46%; z-index: 70; pointer-events: none; text-align: center;
  background: var(--paper); color: var(--ink); border: 0.12em solid var(--deep); border-radius: 0.4em; box-shadow: 0 0.12em 0 var(--deep);
  padding: 0.25em 0.6em 0.3em; font-weight: 800; font-stretch: 78%; line-height: 1; white-space: nowrap;
  font-size: clamp(3rem, 9vw, 9rem); animation: burst 2.3s ease-out both;
}
.burst small { display: block; font-size: 0.42em; font-stretch: 90%; margin-top: 0.15em; }
.burst.right { background: var(--good); }
.burst.close { background: var(--lemon); }
.burst.wrong { background: var(--bad); color: var(--paper); }
.burst.none { background: var(--paper); }
.burst.record { background: var(--accent); white-space: normal; max-width: 92vw; animation-duration: 3.6s; font-size: clamp(2.4rem, 6vw, 6rem); }
.screen-flash { position: fixed; inset: 0; pointer-events: none; z-index: 65; animation: flash 0.9s ease-out both; }
.screen-flash.right { background: radial-gradient(circle at 50% 45%, rgba(34, 201, 151, 0.55), transparent 65%); }
.screen-flash.close { background: radial-gradient(circle at 50% 45%, rgba(255, 210, 63, 0.5), transparent 65%); }
.screen-flash.wrong { background: radial-gradient(circle at 50% 45%, rgba(255, 107, 107, 0.55), transparent 65%); }
.fx-shake { animation: shake 0.45s ease-in-out 1; }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 68; }

/* Phone results */
.result-big { border-radius: 22px; }
.result-big.right { background: rgba(34, 201, 151, 0.18); }
.result-big.close { background: rgba(255, 210, 63, 0.16); }
.result-big.wrong { background: rgba(255, 107, 107, 0.16); }
.result-big .badge { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; font-size: 38px; font-weight: 900; margin-bottom: 10px; border: 3px solid var(--deep); box-shadow: var(--press-small); }
.result-big.right .badge { background: var(--good); color: var(--ink); }
.result-big.close .badge { background: var(--lemon); color: var(--ink); }
.result-big.wrong .badge { background: var(--bad); color: var(--paper); }
.result-big.none .badge { background: var(--night); color: var(--paper-dim); }
.result-big.wrong .headline { color: #ffd0d0; }
.fx .result-big .badge { animation: pop-in 0.55s ease-out both; }
.fx .result-big.right .headline, .fx .result-big.close .headline { animation: pop-in 0.6s 0.1s ease-out both; }
.fx .result-big.wrong .headline { animation: shake 0.5s 0.15s ease-in-out 2; }
.fx .result-big .points { animation: rise 0.5s 0.35s ease-out both; }
.result-big.record { background: rgba(255, 210, 63, 0.18); }
.record-line { font-weight: 800; color: var(--accent); font-size: 1.3rem; margin-top: 8px; }
.fx .record-line { animation: pop-in 0.6s 0.3s ease-out both; }

/* Rate the question: deliberately small and quiet */
.rate { display: flex; align-items: center; justify-content: center; gap: 0.5em; color: var(--muted); font-size: 0.85rem; margin-top: auto; padding-top: 8px; }
.rate button { all: unset; cursor: pointer; font-size: 1.05rem; line-height: 1; padding: 0.3em 0.45em; border-radius: 99px; border: 1px solid transparent; filter: grayscale(1); opacity: 0.7; }
.rate button:hover, .rate button:focus-visible { opacity: 1; border-color: var(--muted); }
.rate button[aria-pressed="true"] { filter: none; opacity: 1; border-color: var(--paper-dim); background: var(--night); }
.rate .thanks { min-width: 4.5em; }
body.tv .rate { justify-content: flex-end; font-size: 0.8em; padding-top: 0; }

/* Paused */
.paused-bar {
  display: flex; align-items: center; gap: 0.8em; flex-wrap: wrap; background: var(--deep); border: 3px solid var(--accent);
  border-radius: 18px; padding: 0.6em 1em; font-weight: 700;
}
.paused-bar .label { font-size: 1.4em; font-weight: 800; font-stretch: 85%; margin-right: auto; display: inline-flex; align-items: center; gap: 0.45em; }
.paused-bar .label::before { content: ""; width: 0.75em; height: 0.9em; border-left: 0.25em solid var(--accent); border-right: 0.25em solid var(--accent); }
.phone-paused { text-align: center; color: var(--accent); font-weight: 750; }
.host-controls .btn.paused { background: var(--accent); }

/* High-score celebration on the final screen */
.records { display: grid; gap: 0.4em; justify-items: center; }
.records .new-high { font-size: 3em; font-weight: 800; font-stretch: 75%; color: var(--accent); line-height: 1; text-align: center; }
.fx .records .new-high { animation: pop-in 0.7s ease-out both, pulse-right 0.9s 0.7s ease-in-out 4; }
.records ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5em; justify-content: center; }
.records li { background: var(--night); border: 2px solid var(--accent); border-radius: 99px; padding: 0.25em 0.9em; font-weight: 700; }
.podium .step .badge { display: inline-block; margin-top: 0.3em; background: var(--ink); color: var(--accent); border-radius: 99px; padding: 0.1em 0.6em; font-size: 0.85em; font-weight: 800; }
.fx .podium .step { animation: rise 0.6s ease-out both; }
.fx .podium .second { animation-delay: 0.5s; }
.fx .podium .third { animation-delay: 0.25s; }
.fx .podium .first { animation-delay: 0.85s; }

/* Admin extras */
.danger-zone { border-color: rgba(255, 107, 107, 0.5); }
.danger-zone .btn { background: var(--bad); color: var(--ink); }
.q-row td { vertical-align: top; }
.q-row .q-text { font-weight: 650; }
.q-row .q-meta { color: var(--muted); font-size: 0.85rem; }
.q-row.retired .q-text { text-decoration: line-through; opacity: 0.7; }
.votes { white-space: nowrap; font-variant-numeric: tabular-nums; }
.votes .down { color: var(--bad); font-weight: 800; }

/* ---------- Ad spaces (hidden unless config.php turns them on, or ?adpreview=1) ---------- */
.ad-slot { display: grid; gap: 6px; justify-items: center; margin: 28px auto; width: 100%; }
.ad-slot.wide { max-width: 728px; }
.ad-slot.box { max-width: 300px; }
.ad-slot.tv { max-width: 728px; margin: 0.8em auto 0; }
.ad-slot.preview { border: 2px dashed var(--muted); border-radius: 12px; color: var(--muted); padding: 12px; place-content: center; text-align: center; }
.ad-slot.preview.wide, .ad-slot.preview.tv { min-height: 90px; }
.ad-slot.preview.box { min-height: 250px; }
.ad-slot .ad-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.ad-slot .ad-size { font-size: 0.85rem; }
.ad-slot .ad-note { font-size: 0.75rem; color: var(--muted); }
.house-ad {
  display: grid; gap: 4px; width: 100%; text-decoration: none; color: var(--ink); background: var(--paper);
  border: 3px solid var(--deep); border-radius: 14px; box-shadow: var(--press-small); padding: 12px 16px; text-align: left;
}
.house-ad strong { font-size: 1.1rem; }
.house-ad span { color: #3c4170; font-size: 0.95rem; }
.house-ad .cta { color: var(--ink); font-weight: 750; }
.house-ad:hover { color: var(--ink); transform: translateY(-1px); }
body.tv .ad-slot .house-ad strong { font-size: 1em; }
.lobby-side { display: grid; gap: 1em; justify-items: center; }
.lobby-side .ad-slot { margin: 0; }
.phone-main .ad-slot { margin: 18px auto 0; }

/* ---------- Terms, feedback, small print ---------- */
.legal main { max-width: 46em; }
.legal h2 { font-size: 1.35rem; margin: 26px 0 8px; }
.legal li { margin-bottom: 6px; }
.legal .effective { color: var(--muted); }
.legal .summary { background: var(--night); border-left: 4px solid var(--accent); border-radius: 12px; padding: 14px 16px; }
.copyright { color: var(--muted); margin-top: 32px; }
.small-print { font-size: 0.85em; color: var(--muted); }
.phone-card .small-print { color: #5a5f86; }
.phone-card .small-print a, .phone-card .hint a { color: #1d33b8; }
.feedback-form { max-width: 40em; display: grid; gap: 4px; }
.feedback-form .kind-pick { border: 0; padding: 0; margin: 0 0 14px; }
.feedback-form legend { font-weight: 650; margin-bottom: 6px; padding: 0; }
.feedback-form textarea {
  font: inherit; font-size: 1.05em; color: var(--ink); background: #fffdf8; border: 3px solid var(--deep); border-radius: 12px;
  padding: 0.55em 0.7em; width: 100%; resize: vertical; min-height: 8em;
}
.feedback-form .count { justify-self: end; font-size: 0.8rem; color: #5a5f86; }
.feedback-form .optional { font-weight: 500; color: #5a5f86; }
.feedback-form .hint { font-size: 0.85rem; }
.feedback-form .btn { justify-self: start; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.thanks-card { max-width: 40em; }
.thanks-card h2 { margin-bottom: 8px; }
.feedback-list { display: grid; gap: 10px; }
.feedback-item { background: var(--night); border-radius: 12px; padding: 12px 14px; border-left: 4px solid var(--accent); }
.feedback-item.read { border-left-color: transparent; opacity: 0.75; }
.feedback-item .meta { color: var(--muted); font-size: 0.85rem; }
.feedback-item .msg { white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0 8px; }
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .burst { animation: flash 2.2s ease-out both !important; transform: translate(-50%, -50%); }
}
