:root {
  --bg: #fffaf0;
  --fg: #1d1b16;
  --muted: #5a5346;
  --card: #ffffff;
  --line: #d8cfbd;
  --accent: #8a4b00;
  --accent-fg: #ffffff;
  --focus: #0050b3;
  --good-bg: #e3f4e3;
  --good-fg: #134d13;
  --bad-bg: #fbe6e3;
  --bad-fg: #7a1a10;
  --badge: #2b2a6b;
  --badge-fg: #ffffff;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17161c;
    --fg: #f2efe8;
    --muted: #bdb6a6;
    --card: #222129;
    --line: #45424f;
    --accent: #ffb55c;
    --accent-fg: #1a1200;
    --focus: #7cb7ff;
    --good-bg: #173a1d;
    --good-fg: #c9f2cc;
    --bad-bg: #45201c;
    --bad-fg: #ffd2cb;
    --badge: #c9c7ff;
    --badge-fg: #15143a;
  }
}

* { box-sizing: border-box; }
html { font-size: 112.5%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.45;
}
main { max-width: 46rem; margin: 0 auto; padding: 1rem 1rem 4rem; }
h1 { font-size: 1.7rem; line-height: 1.25; margin: 0.6rem 0 1rem; }
h2 { font-size: 1.3rem; margin: 1.4rem 0 0.6rem; }
h1:focus, h2:focus { outline: none; }
h1:focus-visible { outline: 3px dashed var(--focus); outline-offset: 4px; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.lead { font-size: 1.1rem; }
.hint { color: var(--muted); font-size: 0.95rem; margin: 0.3rem 0 0; }

.field { margin: 1rem 0; }
.field label { display: block; font-weight: 650; margin-bottom: 0.3rem; }
.field.check { display: flex; gap: 0.6rem; align-items: center; }
.field.check label { margin: 0; font-weight: 500; }
input[type=text], input[type=number], select {
  font: inherit; width: 100%; padding: 0.7rem 0.8rem; min-height: 3rem;
  border: 2px solid var(--line); border-radius: 0.6rem; background: var(--card); color: var(--fg);
}
input[type=checkbox] { width: 1.6rem; height: 1.6rem; flex: none; accent-color: var(--accent); }
input[type=range] { width: 100%; min-height: 2.5rem; accent-color: var(--accent); }
#code { text-transform: uppercase; letter-spacing: 0.3em; font-size: 1.4rem; font-weight: 700; }
input[aria-invalid=true] { border-color: var(--bad-fg); border-width: 3px; }

button {
  font: inherit; font-weight: 650; cursor: pointer;
  min-height: 3rem; padding: 0.6rem 1.1rem; border-radius: 0.7rem;
  border: 2px solid var(--line); background: var(--card); color: var(--fg);
}
button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
button.big { width: 100%; font-size: 1.2rem; min-height: 3.6rem; }
button.small { min-height: 2.6rem; font-size: 0.95rem; }
button[aria-disabled=true] { cursor: default; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.error:not(:empty) {
  margin-top: 1rem; padding: 0.8rem 1rem; border-radius: 0.6rem;
  background: var(--bad-bg); color: var(--bad-fg); font-weight: 600;
  border-left: 6px solid var(--bad-fg);
}
.error:not(:empty)::before { content: "⚠ "; }
.status { margin: 1rem 0; min-height: 1.5em; color: var(--muted); font-weight: 600; }

/* player */
.me { color: var(--muted); margin: 0; font-size: 0.95rem; }
.timer { font-size: 1.1rem; font-weight: 700; color: var(--accent); min-height: 1.5em; }
.choices { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.8rem; }
.choice {
  width: 100%; min-height: 4.2rem; text-align: left; display: flex; align-items: center; gap: 0.9rem;
  font-size: 1.2rem; padding: 0.8rem 1rem;
}
.badge {
  flex: none; width: 2.6rem; height: 2.6rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--badge); color: var(--badge-fg); font-weight: 800; font-size: 1.2rem;
}
.ctext { flex: 1; }
.mark { font-weight: 800; }
.choice[aria-disabled=true] { opacity: 0.75; }
.choice.mine { border-width: 4px; border-style: double; border-color: var(--accent); opacity: 1; }
.choice.right { background: var(--good-bg); color: var(--good-fg); border: 4px solid var(--good-fg); opacity: 1; }
.choice.wrong { background: var(--bad-bg); color: var(--bad-fg); border: 4px dashed var(--bad-fg); opacity: 1; }
.result { margin: 1.2rem 0; padding: 1rem 1.2rem; border-radius: 0.8rem; background: var(--card); border: 2px solid var(--line); }
.result.good { background: var(--good-bg); color: var(--good-fg); border-color: var(--good-fg); }
.result .hs-count { margin: 0.5rem 0.5rem 0 0; }
.result.bad { background: var(--bad-bg); color: var(--bad-fg); border-color: var(--bad-fg); }
.result p { margin: 0.3rem 0; }
.big-line { font-size: 1.3rem; font-weight: 750; }
.board ol { padding-left: 0; list-style: none; }
.board li { padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--line); font-size: 1.1rem; }
.board li.me-row { font-weight: 800; }
.options { margin-top: 2rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.options summary { cursor: pointer; font-weight: 650; min-height: 2.5rem; }

/* host: bigger, built to be read on a shared Zoom screen */
body.host main { max-width: 78rem; }
body.host h1 { font-size: 2.2rem; }
.gate { text-align: center; padding: 3rem 1rem; }
.gate p { font-size: 1.25rem; }
.gate button { max-width: 28rem; }
.controls {
  position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 0.5rem;
  padding: 0.6rem 0; background: var(--bg); border-bottom: 2px solid var(--line);
}
.controls button { font-size: 1rem; }
kbd {
  font-family: inherit; font-size: 0.85em; padding: 0.05rem 0.4rem; margin-left: 0.3rem;
  border: 1px solid currentColor; border-radius: 0.3rem; opacity: 0.85;
}
.joinbox { display: grid; gap: 1rem; grid-template-columns: 1fr; margin: 1rem 0; }
@media (min-width: 900px) { .joinbox { grid-template-columns: 3fr 2fr; } }
.card { background: var(--card); border: 2px solid var(--line); border-radius: 1rem; padding: 1rem 1.4rem; }
.join-url { font-size: 1.6rem; font-weight: 700; word-break: break-all; margin: 0.2rem 0 0.8rem; }
.join-code { font-size: 4.5rem; font-weight: 900; letter-spacing: 0.25em; margin: 0; color: var(--accent); line-height: 1.1; }
.row { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.players { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.players li {
  display: flex; align-items: center; gap: 0.4rem; background: var(--card); border: 2px solid var(--line);
  border-radius: 2rem; padding: 0.2rem 0.3rem 0.2rem 0.9rem; font-size: 1.15rem; font-weight: 600;
}
.players li.offline { border-style: dashed; opacity: 0.7; }
.players button { min-height: 2.2rem; padding: 0.1rem 0.6rem; font-size: 0.85rem; border-radius: 2rem; }
.settings { display: grid; gap: 0 1.4rem; grid-template-columns: 1fr; }
@media (min-width: 700px) { .settings { grid-template-columns: 1fr 1fr; } }
.settings fieldset { border: 2px solid var(--line); border-radius: 0.8rem; padding: 0.4rem 1rem 0.6rem; margin: 0 0 1rem; }
.settings legend { font-weight: 750; padding: 0 0.4rem; }

.qnum { font-size: 1.3rem; font-weight: 700; color: var(--muted); margin: 1rem 0 0; }
.qtext { font-size: 2.6rem; line-height: 1.2; margin: 0.4rem 0 1.4rem; }
.host-choices { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .host-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.host-choices li {
  display: flex; align-items: center; gap: 1rem; font-size: 1.8rem; font-weight: 650;
  background: var(--card); border: 3px solid var(--line); border-radius: 1rem; padding: 0.8rem 1.2rem;
}
.host-choices .badge { width: 3.4rem; height: 3.4rem; font-size: 1.7rem; }
.host-choices li.right { background: var(--good-bg); color: var(--good-fg); border: 5px solid var(--good-fg); }
.host-choices li.dim { opacity: 0.55; }
.host-choices .count { margin-left: auto; font-size: 1.3rem; white-space: nowrap; }
.waiting-choices { font-size: 1.5rem; color: var(--muted); font-style: italic; }
.clock { display: flex; align-items: baseline; gap: 1.2rem; flex-wrap: wrap; margin: 1.2rem 0; font-size: 1.4rem; }
.clock .secs { font-size: 3.6rem; font-weight: 900; color: var(--accent); min-width: 4ch; }
.bar { height: 0.9rem; background: var(--line); border-radius: 1rem; overflow: hidden; margin: 0.5rem 0 1rem; }
.bar > div { height: 100%; background: var(--accent); width: 100%; transition: width 0.25s linear; }
.summary { font-size: 1.6rem; font-weight: 700; }
.top5 { font-size: 1.5rem; padding-left: 0; list-style: none; }
.top5 li { padding: 0.4rem 0; border-bottom: 1px solid var(--line); }
.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; align-items: end; margin: 1.5rem 0; list-style: none; padding: 0; }
.podium li { background: var(--card); border: 3px solid var(--line); border-radius: 1rem 1rem 0 0; text-align: center; padding: 1rem 0.5rem; }
.podium .p1 { order: 2; min-height: 15rem; border-color: var(--accent); }
.podium .p2 { order: 1; min-height: 11rem; }
.podium .p3 { order: 3; min-height: 8rem; }
.podium .place { font-size: 2rem; font-weight: 900; display: block; }
.podium .who { font-size: 1.6rem; font-weight: 750; display: block; word-break: break-word; }
.podium .pts { font-size: 1.2rem; display: block; }
.results { font-size: 1.2rem; columns: 2 18rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Kahoot-colour letter tiles. Contrast (WCAG): white on red 5.9:1, on blue 5.9:1,
   on green 5.5:1; dark text on yellow 10.5:1. Same colours in light and dark mode. */
.tile {
  flex: none; width: 3rem; height: 3rem; border-radius: 0.5rem; display: grid; place-items: center;
  font-weight: 900; font-size: 1.7rem; color: #ffffff; background: #555555;
  border: 2px solid rgba(0, 0, 0, 0.25);
}
.tile-red { background: #c8102e; }
.tile-blue { background: #1660c8; }
.tile-yellow { background: #f5c400; color: #1d1b16; }
.tile-green { background: #1f7a0f; }
.host-choices .tile { width: 4.2rem; height: 4.2rem; font-size: 2.6rem; }
.streak:not(:empty) { font-weight: 750; color: var(--accent); }
.ready { font-size: 3rem; font-weight: 900; text-align: center; margin: 3rem 0; }
.ready .count { display: block; font-size: 7rem; color: var(--accent); }

/* ---- round 2: player display ---- */
.display-bar { display: flex; justify-content: flex-end; gap: 0.5rem; flex-wrap: wrap; }
.phase-line {
  font-weight: 700; margin: 0.6rem 0 0; padding: 0.4rem 0.7rem; border-left: 6px solid var(--accent);
  background: var(--card); border-radius: 0.3rem;
}
.typed-form { display: grid; gap: 0.6rem; margin: 0.5rem 0 1rem; }
.typed-form label { font-weight: 700; font-size: 1.15rem; }
.typed-form input { font-size: 1.3rem; }
.typed-form input[readonly] { border-style: dashed; }
#repeat-q { margin: 1rem 0 0; }
.footer {
  background: var(--bg); border-top: 3px solid var(--line); padding: 0.4rem 1rem 0.6rem;
}
.footer[hidden] { display: none; }
.footer-row { display: flex; align-items: baseline; gap: 1rem; max-width: 46rem; margin: 0 auto; }
.big-time { font-size: 2.2rem; font-weight: 900; color: var(--accent); min-width: 4ch; white-space: nowrap; }
.footer-msg { font-weight: 650; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.footer .bar { max-width: 46rem; margin: 0.3rem auto 0; height: 0.7rem; }
/* fixed only when the window is tall enough; at high zoom it sits in the page instead */
@media (min-height: 520px) {
  .footer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 3; }
  body.player { padding-bottom: 7.5rem; }
}

/* high contrast: black, white and yellow, thick borders */
body.hc {
  --bg: #000000; --fg: #ffffff; --muted: #ffffff; --card: #000000; --line: #ffffff;
  --accent: #ffff00; --accent-fg: #000000; --focus: #00ffff;
  --good-bg: #000000; --good-fg: #7dff7d; --bad-bg: #000000; --bad-fg: #ff9a9a;
}
body.hc button, body.hc input, body.hc select, body.hc .result, body.hc .phase-line { border-width: 3px; }
body.hc .tile { border: 3px solid #ffffff; }
body.hc :focus-visible { outline-width: 4px; }

/* ---- round 2: host extras ---- */
.q-badges { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 0.4rem 0 0; }
.q-badge { font-weight: 800; padding: 0.2rem 0.7rem; border: 2px solid var(--accent); border-radius: 2rem; color: var(--accent); }
.typed-top { font-size: 1.4rem; }

/* ---- round 2: editor and shared fixes ---- */
[hidden] { display: none !important; }
textarea {
  font: inherit; width: 100%; padding: 0.7rem 0.8rem; border: 2px solid var(--line);
  border-radius: 0.6rem; background: var(--card); color: var(--fg);
}
body.editor fieldset { border: 2px solid var(--line); border-radius: 0.8rem; padding: 0.4rem 1rem; margin: 1rem 0; }
body.editor legend { font-weight: 750; padding: 0 0.4rem; }
.q-list { padding-left: 0; list-style: none; }
.q-list li { border: 2px solid var(--line); border-radius: 0.8rem; padding: 0.4rem 1rem 0.8rem; margin: 0 0 0.8rem; background: var(--card); }
.q-list p { margin: 0.4rem 0 0.6rem; }
.small-link { align-self: center; font-weight: 650; color: var(--accent); }
.ctext-mark { font-weight: 800; white-space: nowrap; }
code { font-size: 0.95em; }

/* ---- round 2: captions, party mode, phone widths ---- */
.caption:not(:empty) {
  font-size: 1.3rem; font-weight: 650; margin: 0.4rem 0; padding: 0.5rem 0.8rem;
  border-left: 6px solid var(--accent); background: var(--card);
}
body.party h1, body.party .join-code { color: #c8102e; }
body.party .card, body.party .host-choices li { border-color: #1660c8; }
@media (prefers-reduced-motion: no-preference) {
  body.party .join-code, body.party .qtext { animation: party-hue 3s linear infinite; }
  @keyframes party-hue { from { filter: hue-rotate(0deg); } to { filter: hue-rotate(360deg); } }
}
.join-code { font-size: clamp(2.6rem, 13vw, 4.5rem); letter-spacing: 0.15em; }
.join-url { font-size: clamp(1.1rem, 5vw, 1.6rem); }
@media (max-width: 600px) {
  body.host h1 { font-size: 1.6rem; }
  .qtext { font-size: 1.7rem; }
  .host-choices li { font-size: 1.3rem; }
  .host-choices .tile { width: 3rem; height: 3rem; font-size: 1.8rem; }
  .clock .secs { font-size: 2.6rem; }
  .podium .who { font-size: 1.1rem; }
  .podium .place { font-size: 1.4rem; }
  .podium .p1 { min-height: 10rem; } .podium .p2 { min-height: 8rem; } .podium .p3 { min-height: 6rem; }
  .controls { position: static; }
  .controls button { flex: 1 1 9rem; }
  .results { columns: 1; }
  .summary, .top5 { font-size: 1.2rem; }
}

/* ---- round 3 ---- */
.link-box { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.95rem; }
.quiz-link-form { max-width: 40rem; margin: 1rem 0; }
.make-own { margin-top: 2rem; font-weight: 650; }
.make-own a, .small-link { color: var(--accent); }
input[type=search], input[type=url] {
  font: inherit; width: 100%; padding: 0.7rem 0.8rem; min-height: 3rem;
  border: 2px solid var(--line); border-radius: 0.6rem; background: var(--card); color: var(--fg);
}

/* ---- round 4: big answer tiles with the text inside, like classic Kahoot ----
   The whole button is the coloured block. Contrast: white on red 5.9:1, blue 5.9:1, green 5.5:1,
   dark on yellow 10.5:1; after the answer, the other tiles turn charcoal (white 9.7:1).
   Shape, colour and the big letter are decoration (aria-hidden); the button's name is "A: text". */
.choices.grid2, .host-choices.grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile-block {
  display: flex; align-items: center; gap: 0.7rem; text-align: left;
  min-height: 5rem; padding: 0.9rem 1rem; border-radius: 0.8rem;
  border: 3px solid rgba(0, 0, 0, 0.3); color: #ffffff; background: #555555;
  overflow-wrap: anywhere; hyphens: auto;
}
.choice.tile-block { width: 100%; height: 100%; font-size: 1.25rem; font-weight: 750; }
.tile-block .ctext { flex: 1; min-width: 0; }
.tile-deco { flex: none; font-size: 1.5rem; font-weight: 900; white-space: nowrap; line-height: 1; }
.tile-block.tile-red { background: #c8102e; }
.tile-block.tile-blue { background: #1660c8; }
.tile-block.tile-yellow { background: #f5c400; color: #1d1b16; }
.tile-block.tile-green { background: #1f7a0f; }
.choice.tile-block[aria-disabled=true] { opacity: 1; }
.choice.tile-block.mine { outline: 5px solid var(--fg); outline-offset: 3px; border: 3px solid #ffffff; }
.tile-block.right { border: 6px solid var(--fg); box-shadow: 0 0 0 4px var(--bg) inset; }
.tile-block.right { color: #ffffff; } .tile-block.tile-yellow.right { color: #1d1b16; }
.tile-block.dim, .tile-block.wrong { background: #3a3a3a; color: #ffffff; }
.choice.tile-block.wrong { border: 4px dashed #ffffff; }
.choice.tile-block .mark { font-weight: 800; }
.host-choices li.tile-block { font-size: 1.8rem; min-height: 6rem; }
.host-choices li.tile-block .tile-deco { font-size: 2.2rem; }
.host-choices li.tile-block.dim { opacity: 1; }
.host-choices li.tile-block .count { margin-left: auto; font-size: 1.3rem; white-space: nowrap; }
/* round 19: a tile never pushes past the screen: its count and mark wrap under the answer instead */
.host-choices li.tile-block { flex-wrap: wrap; min-width: 0; }
/* phones: two columns only when the answers are short (set by the page); smaller text in them */
@media (max-width: 600px) {
  .choices.grid2 .choice.tile-block { font-size: 1.1rem; min-height: 6rem; flex-direction: column; align-items: flex-start; }
  .host-choices li.tile-block { font-size: 1.3rem; }
  .host-choices.grid2 { grid-template-columns: minmax(0, 1fr); }
}
/* high contrast: black tiles, white text, a thick coloured border keeps the colour as a hint */
body.hc .tile-block { background: #000000 !important; color: #ffffff !important; border: 5px solid #ffffff; }
body.hc .tile-block.tile-red { border-color: #ff6b6b; }
body.hc .tile-block.tile-blue { border-color: #7cb7ff; }
body.hc .tile-block.tile-yellow { border-color: #ffff00; }
body.hc .tile-block.tile-green { border-color: #7dff7d; }
body.hc .tile-block.right { border: 8px double #7dff7d; }
body.hc .tile-block.dim { border-style: dotted; }

/* ---- round 4: quick buttons, shortcuts, device settings ---- */
.quick { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.2rem 0 0; }
.quick button { flex: 1 1 11rem; }
.keys-help { margin: 1rem 0; }
.keys-help ul { padding-left: 1.2rem; }
.device, .you-card { margin-top: 1.5rem; }
.device .row button, .you-card .row button { flex: 1 1 12rem; }
.rename-form { display: grid; gap: 0.5rem; margin-top: 1rem; }
.rename-form label { font-weight: 700; }
.solo { margin-top: 2rem; }
.solo h2 { margin-top: 0.4rem; }
#self-go, #self-show { margin: 1rem 0; }
.controls kbd, .quick kbd, button kbd { pointer-events: none; }
.settings fieldset.wide { grid-column: 1 / -1; }
.join-url-inline { font-weight: 700; word-break: break-all; }
#auto-next:not([hidden]) { font-weight: 700; color: var(--fg); }

/* ---- round 5: bets, put in order, reactions, last game ---- */
.bet-box { margin: 0.5rem 0 1rem; padding: 0.6rem 0.8rem; border: 2px solid var(--line); border-radius: 0.8rem; background: var(--card); }
.bet-title { font-weight: 800; margin: 0 0 0.5rem; }
.bet-box .row button { flex: 1 1 12rem; text-align: left; }
.bet-box button[aria-pressed=true] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.order-box { margin: 1rem 0; padding: 0.6rem 0.9rem; border: 2px dashed var(--accent); border-radius: 0.8rem; }
.order-now { font-weight: 750; margin: 0 0 0.4rem; }
.order-list { margin: 0 0 0.8rem; padding-left: 1.6rem; font-size: 1.1rem; }
.order-list li { padding: 0.15rem 0; }
.react-box { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0 0; }
.react-box button { flex: 1 1 7rem; }
.react-line, .ghost-line { font-weight: 650; color: var(--muted); margin: 0.6rem 0; }
.open-list { margin: 0.4rem 0; padding-left: 1.4rem; }
body.hc .bet-box, body.hc .order-box { border-width: 3px; }
.share-tips { margin: 0.6rem 0; } .share-tips h4 { margin: 0.2rem 0 0.4rem; font-size: 1.15rem; } .share-tips ul { padding-left: 1.2rem; }

/* ---- round 6: welcome pages and tablets ---- */
.tagline { font-size: 1.15rem; font-style: italic; color: var(--accent); margin: -0.4rem 0 0.8rem; font-weight: 650; }
.players button { min-height: 2.75rem; padding: 0.2rem 0.8rem; }
/* tablets: roomier tiles, and two columns of host answers in portrait too */
@media (min-width: 700px) {
  .choice.tile-block { min-height: 6rem; font-size: 1.35rem; }
  .host-choices.grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick button, .device .row button, .you-card .row button { flex: 1 1 14rem; }
}
@media (min-width: 700px) and (max-width: 1366px) and (orientation: landscape) {
  /* landscape tablets: the player page uses the width, without stretching one long column */
  body.player main { max-width: 56rem; }
}

/* ---- round 7: the welcome hub and the editor ---- */
.hub-join, .hub-host, .hub-make, .solo { margin-top: 1.6rem; }
.hub-join h2, .hub-host h2, .hub-make h2, .solo h2 { margin-top: 0.4rem; }
.button-link {
  display: inline-flex; align-items: center; min-height: 3rem; padding: 0.6rem 1.1rem; border-radius: 0.7rem;
  border: 2px solid var(--line); background: var(--card); color: var(--fg); font-weight: 650; text-decoration: none;
}
.button-link.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.button-link:hover { text-decoration: underline; }
.my-quizzes { list-style: none; padding: 0; display: grid; gap: 0.6rem; }
.my-quizzes li { border: 2px solid var(--line); border-radius: 0.7rem; padding: 0.5rem 0.8rem; display: grid; gap: 0.4rem; }
.my-quizzes .my-title { font-weight: 750; }
.my-quizzes a { display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 0.6rem; font-weight: 650; color: var(--accent); }
.hub-back { margin: -0.4rem 0 1rem; }
.undo-bar { margin: 0.6rem 0; padding: 0.5rem 0.8rem; border-left: 6px solid var(--accent); background: var(--card); }
.save-state:not(:empty) { font-weight: 700; color: var(--muted); }
.preview { margin-top: 1.2rem; }
.preview h3 { margin-top: 0.3rem; }
.q-list .row button { flex: 0 1 auto; }
@media (min-width: 1000px) {
  /* computers: the form and its preview side by side */
  body.editor main { max-width: 64rem; }
  #qedit:not([hidden]) { display: grid; grid-template-columns: 3fr 2fr; gap: 1.4rem; align-items: start; }
  #qedit h2 { grid-column: 1 / -1; }
  #qedit .preview { position: sticky; top: 1rem; margin-top: 0; }
}

/* ---- round 8: media in questions ---- */
.q-media { margin: 0.6rem 0 1rem; }
.q-image { display: block; max-width: 100%; max-height: 60vh; height: auto; border-radius: 0.8rem; border: 3px solid var(--line); background: var(--card); }
body.host .q-image { max-height: 50vh; margin: 0 auto; }
.q-video { display: block; width: 100%; max-height: 60vh; border-radius: 0.8rem; background: #000; }
.q-yt-frame { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 0.8rem; background: #000; }
.q-media-note { font-weight: 650; color: var(--muted); }
.media-controls { margin: 0.4rem 0 0.8rem; }
.media-controls button { flex: 1 1 10rem; }
.transcript-box { white-space: pre-wrap; padding: 0.7rem 0.9rem; border: 2px solid var(--line); border-radius: 0.7rem; background: var(--card); margin: 0 0 1rem; }
details.transcript { margin-top: 0.6rem; font-size: 1.1rem; }
.look-box, #g-media { border: 2px solid var(--line); border-radius: 0.8rem; padding: 0.4rem 1rem; margin: 1rem 0; }

/* ---- round 8: colourful themes, each checked for contrast (text 7:1 or better on the page,
   white on the accent 4.5:1 or better). Dark mode keeps its own colours unless a theme is on. ---- */
body.theme-festive { --bg: #fff6f0; --card: #ffffff; --fg: #1b1a17; --muted: #5a4038; --line: #e2c3b4; --accent: #b3122e; --accent-fg: #ffffff; --focus: #0b6b2a; }
body.theme-ocean { --bg: #eef7fb; --card: #ffffff; --fg: #0f2330; --muted: #2f4c5c; --line: #b7d6e6; --accent: #0b5f8a; --accent-fg: #ffffff; --focus: #6a2bb3; }
body.theme-sunset { --bg: #fff4ea; --card: #ffffff; --fg: #2a1a10; --muted: #63401f; --line: #f0c9a8; --accent: #a3410d; --accent-fg: #ffffff; --focus: #1b4fb3; }
body.theme-forest { --bg: #f1f7ef; --card: #ffffff; --fg: #142312; --muted: #375131; --line: #bcd6b3; --accent: #2e6b1f; --accent-fg: #ffffff; --focus: #8a2bb3; }
body.theme-candy { --bg: #fdf1fb; --card: #ffffff; --fg: #2a1030; --muted: #5a3561; --line: #e6c3e3; --accent: #8e1f8a; --accent-fg: #ffffff; --focus: #0b5f8a; }
body[class*="theme-"] { color-scheme: light; }
body.theme-festive { background-image: repeating-linear-gradient(135deg, rgba(179, 18, 46, 0.05) 0 14px, rgba(11, 107, 42, 0.05) 14px 28px); }
body.theme-festive h1 { color: #b3122e; }
body.theme-festive .card, body.theme-festive .phase-line { border-color: #0b6b2a; }
body.theme-ocean h1 { color: #0b5f8a; }
body.theme-candy h1 { color: #8e1f8a; }
/* a background picture always sits under a veil of the page colour, so text keeps its contrast */
body.has-bg {
  background-image: linear-gradient(rgba(255, 250, 240, 0.9), rgba(255, 250, 240, 0.9)), var(--bgimg);
  background-size: cover; background-position: center; background-attachment: fixed;
}
@media (prefers-color-scheme: dark) {
  body.has-bg:not([class*="theme-"]) { background-image: linear-gradient(rgba(23, 22, 28, 0.9), rgba(23, 22, 28, 0.9)), var(--bgimg); }
}
/* high contrast beats every theme and picture */
body.hc, body.hc[class*="theme-"] { background: #000000 !important; color-scheme: dark; }
body.hc[class*="theme-"] { --bg: #000000; --fg: #ffffff; --muted: #ffffff; --card: #000000; --line: #ffffff; --accent: #ffff00; --accent-fg: #000000; --focus: #00ffff; }
body.hc h1 { color: inherit; }

/* ---- round 7: welcome questions ---- */
.welcome-q { margin-top: 1.6rem; border-color: var(--accent); }
.welcome-q h2 { margin-top: 0.4rem; }
.welcome-q .row button { flex: 1 1 12rem; }
.gate-welcome { text-align: left; max-width: 34rem; margin: 1rem auto; border: 2px solid var(--line); border-radius: 0.8rem; padding: 0.4rem 1rem; }
.gate-welcome legend { font-weight: 750; padding: 0 0.4rem; }
.tour { margin: 1rem 0; border-color: var(--accent); }
body.big-tiles .choice.tile-block { min-height: 7rem; font-size: 1.6rem; }
body.host.big-text main { font-size: 1.25rem; }

/* ---- round 9: cute background patterns, decoration only (a pseudo-element: nothing to read) ----
   Faint, behind a veil that keeps the page's own colour under every word. Slow drift, stopped for
   reduced motion or "Moving backgrounds: off". High contrast removes them. */
body.has-pattern::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.22;
  background-size: 160px 160px; animation: pattern-drift 90s linear infinite;
}
body.has-pattern { position: relative; isolation: isolate; }
body.has-pattern main { background: color-mix(in srgb, var(--bg) 88%, transparent); border-radius: 1rem; }
body.pattern-snow::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='%23ffffff' stroke='%237fb1d8' stroke-width='1.2'%3E%3Ccircle cx='20' cy='24' r='4'/%3E%3Ccircle cx='96' cy='60' r='3'/%3E%3Ccircle cx='140' cy='120' r='5'/%3E%3Ccircle cx='50' cy='130' r='3'/%3E%3C/g%3E%3Cg stroke='%237fb1d8' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M120 18v20M110 28h20M113 21l14 14M127 21l-14 14'/%3E%3Cpath d='M60 78v16M52 86h16M54 80l12 12M66 80l-12 12'/%3E%3C/g%3E%3C/svg%3E"); animation-duration: 60s; }
body.pattern-stars::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='%23f5c400' stroke='%23c99a00' stroke-width='1'%3E%3Cpath d='M30 14l4 9 10 1-8 6 3 10-9-6-9 6 3-10-8-6 10-1z'/%3E%3Cpath d='M120 70l3 7 8 1-6 5 2 8-7-4-7 4 2-8-6-5 8-1z'/%3E%3Cpath d='M60 112l2 5 6 1-5 3 2 6-5-3-5 3 2-6-5-3 6-1z'/%3E%3C/g%3E%3Cg fill='%23ffe680'%3E%3Ccircle cx='140' cy='22' r='2.5'/%3E%3Ccircle cx='90' cy='40' r='2'/%3E%3Ccircle cx='20' cy='80' r='2'/%3E%3C/g%3E%3C/svg%3E"); animation-name: pattern-twinkle; animation-duration: 6s; animation-direction: alternate; animation-timing-function: ease-in-out; }
body.pattern-notes::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='%236a3fa0'%3E%3Cellipse cx='30' cy='60' rx='9' ry='7' transform='rotate(-20 30 60)'/%3E%3Crect x='37' y='18' width='3' height='42'/%3E%3Cpath d='M40 18c10 4 14 10 12 20-3-8-7-10-12-11z'/%3E%3Cellipse cx='110' cy='130' rx='8' ry='6' transform='rotate(-20 110 130)'/%3E%3Cellipse cx='136' cy='122' rx='8' ry='6' transform='rotate(-20 136 122)'/%3E%3Crect x='116' y='92' width='3' height='37'/%3E%3Crect x='142' y='84' width='3' height='37'/%3E%3Cpath d='M116 92l29-8v6l-29 8z'/%3E%3C/g%3E%3C/svg%3E"); }
body.pattern-confetti::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg%3E%3Crect x='20' y='20' width='10' height='5' fill='%23e4572e' transform='rotate(30 25 22)'/%3E%3Crect x='110' y='40' width='10' height='5' fill='%231660c8' transform='rotate(-25 115 42)'/%3E%3Crect x='60' y='100' width='10' height='5' fill='%231f7a0f' transform='rotate(60 65 102)'/%3E%3Crect x='130' y='130' width='10' height='5' fill='%23f5c400' transform='rotate(15 135 132)'/%3E%3Ccircle cx='80' cy='30' r='3' fill='%23b3122e'/%3E%3Ccircle cx='30' cy='120' r='3' fill='%238e1f8a'/%3E%3Ccircle cx='140' cy='90' r='3' fill='%230b5f8a'/%3E%3C/g%3E%3C/svg%3E"); }
body.pattern-hearts::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='%23e0457b'%3E%3Cpath d='M30 40c-8-10-24-2-16 12l16 14 16-14c8-14-8-22-16-12z'/%3E%3Cpath d='M120 110c-6-8-18-1-12 9l12 10 12-10c6-10-6-17-12-9z'/%3E%3Cpath d='M100 30c-4-5-12-1-8 6l8 7 8-7c4-7-4-11-8-6z'/%3E%3C/g%3E%3C/svg%3E"); }
body.pattern-doodles::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='none' stroke='%238a4b00' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M20 40h30v26a10 10 0 0 1-10 10h-10a10 10 0 0 1-10-10z'/%3E%3Cpath d='M50 48h6a6 6 0 0 1 0 12h-6'/%3E%3Cpath d='M28 32c0-5 4-5 4-10M38 32c0-5 4-5 4-10'/%3E%3Ccircle cx='118' cy='112' r='16'/%3E%3Cpath d='M112 96h12v-5h-12z'/%3E%3Cpath d='M104 110c8 4 20 4 28 0'/%3E%3C/g%3E%3Cg fill='%23b3122e'%3E%3Ccircle cx='118' cy='90' r='2'/%3E%3C/g%3E%3C/svg%3E"); animation: none; }
@keyframes pattern-drift { from { background-position: 0 0; } to { background-position: 160px 640px; } }
@keyframes pattern-twinkle { from { opacity: 0.12; } to { opacity: 0.28; } }
body.no-motion::before { animation: none !important; }
@media (prefers-reduced-motion: reduce) { body.has-pattern::before { animation: none !important; } }
body.hc::before { display: none !important; }
body.hc main { background: transparent !important; }

/* the announcer is a log: each message its own line; only the newest shows, older ones stay
   readable by a screen reader until they quietly leave */
.status-log p { margin: 0; }
.status-log p:not(:last-child) { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- round 9: layout pass ---- */
/* the host's button bar sticks only when there's room; zoomed in or on a short screen it scrolls
   with the page, so it never covers what you're reading */
@media (max-height: 640px) { .controls { position: static; } }
.game-settings { margin: 1rem 0; border-color: var(--accent); }
.game-settings .settings { grid-template-columns: 1fr; }
@media (min-width: 900px) { .game-settings .settings { grid-template-columns: 1fr 1fr; } }
select:disabled, input:disabled { opacity: 0.75; cursor: not-allowed; }
/* long words and links never push the page sideways */
main { overflow-wrap: anywhere; }
@media (max-width: 360px) {
  main { padding-left: 0.6rem; padding-right: 0.6rem; }
  .row > button, .row > a { flex: 1 1 100%; }
  .join-code { letter-spacing: 0.08em; }
}

/* ---- round 10: setup, then a clean lobby ---- */
.summary-line:not(:empty) { font-size: 1.25rem; font-weight: 700; margin: 0.4rem 0 0.6rem; }
.pin-corner { align-self: center; margin-left: auto; font-weight: 800; font-size: 1.1rem; color: var(--accent); white-space: nowrap; }
#setup .settings fieldset.wide { grid-column: 1 / -1; }

/* ---- round 12: captions of the host's voice, and visual cues for sounds ---- */
.cue:not([hidden]) { max-width: 46rem; margin: 0 auto 0.3rem; font-size: 1.6rem; font-weight: 900; color: var(--accent); }
.host-caption:not([hidden]) { max-width: 46rem; margin: 0 auto 0.3rem; font-size: 1.15rem; font-weight: 650; padding: 0.3rem 0.6rem; background: var(--card); border-left: 6px solid var(--accent); border-radius: 0.3rem; }
@media (min-height: 520px) { body.player { padding-bottom: 11rem; } }

.pin-corner { margin-left: 0.4rem; }
/* the host's screen reader log: read, not shown (the caption shows the same line) */
.sr-log { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- round 13: the last five seconds, seen as well as heard (no motion) ---- */
.big-time.urgent { color: var(--fg); background: var(--card); outline: 4px solid var(--accent); outline-offset: 2px; border-radius: 0.3rem; padding: 0 0.3rem; }
.big-time.urgent::after { content: ' !'; }

/* ---- round 13: the welcome page ----
   The title and the Game PIN box come first; the four ways to play follow, each wearing one of
   the game's tile colours and shapes (decoration: aria-hidden, never spoken). On a wide screen
   the title sits beside the join card and the four cards make two columns, in reading order. */
.hub-top { display: grid; gap: 1.2rem; align-items: start; }
/* grid items may shrink below their content, so big text wraps instead of pushing sideways */
.hub-top > *, .hub-grid > * { min-width: 0; }
.hub-hero h1 { font-size: clamp(2rem, 11vw, 2.6rem); font-weight: 900; letter-spacing: -0.01em; margin: 0.2rem 0 0.6rem; }
.hub-hero .tagline { margin: 0 0 0.8rem; font-size: 1.2rem; }
.hub-hero .lead { margin: 0; font-size: 1.15rem; }
.hub-tiles { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.8rem 0 0; }
/* the welcome page's coloured squares (scoped: an answer tile's "Your answer" is a .mark too) */
.hub-tiles .mark, .hub-head .mark {
  display: inline-grid; place-items: center; flex: none; width: 2.1rem; height: 2.1rem; border-radius: 0.5rem;
  font-size: 1.05rem; line-height: 1; color: #ffffff; font-weight: 900;
}
.mark.mark-red { background: #c8102e; } .mark.mark-blue { background: #1660c8; }
.mark.mark-yellow { background: #f5c400; color: #1d1b16; } .mark.mark-green { background: #1f7a0f; }
.card.hub-join { margin-top: 0; border: 3px solid var(--accent); box-shadow: 0 0.4rem 1.4rem color-mix(in srgb, var(--accent) 18%, transparent); }
.hub-join h2 { margin-top: 0.2rem; font-size: 1.5rem; }
.hub-join #code { text-align: center; font-size: 1.9rem; letter-spacing: 0.35em; padding: 0.5rem 0.6rem; }
.hub-join .field { margin: 0.8rem 0; }
.hub-join #nick-btn { margin: 0.6rem 0 0.4rem; }
.hub-join #join-btn { margin: 0.2rem 0 0; }
/* round 18: Host a game sits under Join, in the same column */
.hub-side { display: grid; gap: 1.2rem; }
.hub-side > .hub-host { margin-top: 0; }
.hub-grid { display: grid; gap: 1.2rem; margin-top: 1.4rem; }
.hub-make .button-link { gap: 0.35rem; }
.hub-grid > .card, .hub-grid > .solo { margin-top: 0; }
.hub-card { border-top-width: 6px; }
.hub-red { border-top-color: #c8102e; } .hub-blue { border-top-color: #1660c8; }
.hub-yellow { border-top-color: #d9ad00; } .hub-green { border-top-color: #1f7a0f; }
.hub-head { display: flex; align-items: center; gap: 0.7rem; margin: 0.2rem 0 0.3rem; }
.hub-head h2 { margin: 0; }
.hub-card > .hint:first-of-type { margin-top: 0.2rem; }
.welcome-q { margin-top: 1.4rem; }
/* solo's shuffling, folded under one line that says its value */
details.more { margin: 0.8rem 0; border: 2px solid var(--line); border-radius: 0.7rem; padding: 0 0.9rem; }
details.more > summary { cursor: pointer; font-weight: 650; min-height: 2.75rem; display: flex; align-items: center; }
details.more[open] { padding-bottom: 0.2rem; }
.end-actions { margin: 1rem 0 1.4rem; }
.gate-back { margin-top: 1.4rem; }
.daily-row { margin: 1rem 0 0; padding-top: 1rem; border-top: 2px dashed var(--line); }
@media (min-width: 1000px) {
  body.player main:has(> #join-view:not([hidden])) { max-width: 70rem; }
  .hub-top { grid-template-columns: 1fr 1.15fr; gap: 2rem; align-items: start; margin-top: 1rem; }
  .hub-hero h1 { font-size: 3.4rem; }
  .hub-grid { grid-template-columns: 1fr 1fr; align-items: start; }
  /* Play solo and Hot seat side by side, then Make or edit a quiz across the width */
  .hub-grid > .hub-make { grid-column: 1 / -1; }
}
body.hc .card.hub-join { box-shadow: none; }
body.hc .hub-card { border-top-width: 6px; }

/* ---- round 14: very big text (iOS Larger Text at accessibility sizes, big zoom) ----
   The person's text size is kept for reading. What stops growing is the display type that was
   already big (titles, the question on the host's screen, the countdown, the timer, the PIN), so
   it never pushes the question and the answers off the screen; answers go one to a row; long
   words wrap instead of pushing the page sideways. */
h1, h2, h3, .qtext, .q-text, .ctext, .big-line, .summary, .top5, .board li, .phase-line, .results, .podium .who, .join-url, .summary-line { overflow-wrap: anywhere; }
html.huge-text h1, html.huge-text body.host h1, html.huge-text .hub-hero h1 { font-size: calc(1rem + 2vw); line-height: 1.2; }
html.huge-text h2, html.huge-text .hub-join h2 { font-size: calc(1rem + 1vw); }
html.huge-text .qtext { font-size: calc(1rem + 3vw); }
html.huge-text .ready { font-size: calc(1rem + 3vw); margin: 1rem 0; }
html.huge-text .ready .count { font-size: calc(1.5rem + 6vw); }
html.huge-text .big-time, html.huge-text .clock .secs { font-size: calc(1rem + 3vw); min-width: 0; }
html.huge-text .cue:not([hidden]) { font-size: calc(1rem + 1vw); }
html.huge-text .join-code { font-size: min(12vw, 3rem); letter-spacing: 0.1em; }
html.huge-text .hub-join #code { font-size: min(1.6rem, 9vw); letter-spacing: 0.1em; }
/* the biggest text: a fixed footer (timer, captions, message) could cover half a phone's screen and
   the tiles under it, so it sits at the end of the page instead */
html.huge-text .footer { position: static; }
html.huge-text body.player { padding-bottom: 0; }
html.huge-text .choices.grid2, html.huge-text .host-choices.grid2 { grid-template-columns: minmax(0, 1fr); }
html.huge-text .choice.tile-block, html.huge-text body.big-tiles .choice.tile-block { font-size: 1rem; min-height: 0; }
html.huge-text .tile-deco, html.huge-text .host-choices li.tile-block .tile-deco { font-size: 1.1rem; }
html.huge-text .host-choices li.tile-block { font-size: 1.1rem; min-height: 0; }
html.huge-text .hub-tiles .mark, html.huge-text .hub-head .mark { width: 1.6rem; height: 1.6rem; font-size: 0.9rem; }
html.huge-text .pin-corner { white-space: normal; }
/* round 18: a folded group inside a card loses its own side padding, so its buttons keep the card's width */
html.huge-text details.more { padding: 0; border-width: 0; }
html.huge-text .controls { flex-wrap: wrap; }
.read-offer { margin: 0.8rem 0; border: 3px solid var(--accent); }
.q-text { font-size: 1.25rem; font-weight: 650; margin: 0.2rem 0 1rem; }
.read-on:not([hidden]) { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin: 0.6rem 0; padding: 0.5rem 0.8rem; font-weight: 700; border: 3px solid var(--accent); border-radius: 0.7rem; background: var(--card); }

/* ---- round 15: Round Table and Suspense ---- */
/* whose turn it is: for the eye (screen readers get it from the heading and one announcement) */
.turn-line {
  font-size: 1.25rem; font-weight: 750; margin: 0.6rem 0 0; padding: 0.5rem 0.8rem;
  border: 3px dashed var(--line); border-radius: 0.5rem; background: var(--card); overflow-wrap: anywhere;
}
/* your turn: solid, bigger and in the accent colour, so it can't be missed at a glance */
.turn-line.mine { font-size: 1.6rem; border-style: solid; border-color: var(--accent); background: var(--accent); color: var(--accent-fg); }
#question .turn-line { font-size: clamp(1.3rem, 3vw, 2.2rem); }
/* Suspense: answers are locked, the answer is a moment away */
.hush-line { font-size: clamp(1.5rem, 4vw, 3rem); font-weight: 900; color: var(--accent); margin: 1rem 0; }
.rt-fields { border-left: 6px solid var(--accent); padding-left: 0.8rem; }
body.hc .turn-line { border-width: 4px; }
body.hc .turn-line.mine { background: #000000; color: #ffff00; border-color: #ffff00; }
@media (prefers-reduced-motion: no-preference) {
  .turn-line.mine { animation: turn-pop 0.4s ease-out 1; }
  @keyframes turn-pop { from { transform: scale(0.96); } to { transform: none; } }
}
/* very big text (Liz's iPhone and iPad): the banner and the hush keep the reader's size, no bigger */
html.huge-text .turn-line, html.huge-text .turn-line.mine, html.huge-text #question .turn-line { font-size: 1em; }
html.huge-text .hush-line { font-size: calc(1rem + 2vw); }
/* found in round 15, at 320 points wide with the biggest text: an answer's words couldn't wrap
   (a flex item won't shrink below its longest word unless told to), and a fieldset is as wide as
   its widest content by default. Both pushed the page sideways. */
html.huge-text .choices > li { min-width: 0; }
html.huge-text .choice.tile-block { flex-wrap: wrap; gap: 0.3rem 0.5rem; padding: 0.6rem 0.7rem; }
html.huge-text fieldset { min-width: 0; }
html.huge-text .cue:not([hidden]) { overflow-wrap: anywhere; min-width: 0; }

/* ---- round 22: first-game hints, and the tutorial pages ---- */
.first-hint { margin: 0.8rem 0; border-color: var(--accent); padding: 0.6rem 1rem; }
.first-hint p { margin: 0.2rem 0 0.6rem; }
.first-hint .row button { flex: 0 1 auto; }
.tutorial-listen { margin: 1rem 0 1.4rem; }
.tutorial-listen audio { width: 100%; margin: 0.4rem 0; }
.tutorial-nav { margin-top: 2rem; border-top: 2px solid var(--line); padding-top: 1rem; }
.tutorial-nav a { display: block; margin: 0.5rem 0; }
.tutorial-list li { margin: 0.4rem 0; }
.hub-help { margin-top: 1.4rem; }
/* ---- round 23: the tutorial's captioned video ---- */
.tutorial-watch { margin: 1rem 0 1.4rem; }
.tutorial-watch video { display: block; width: 100%; height: auto; margin: 0.4rem 0; background: #000; }
/* setup sections are headings too (2026-11-24), so screen readers can jump by heading */
.settings legend h3 { font-size: 1.15rem; font-weight: 750; margin: 0; display: inline; }
.settings .sub-h { font-size: 1.05rem; margin: 0.8rem 0 0.2rem; }

/* Very big text: the Display buttons stack full width and break only between words
   (Liz, 2026-11-29: "High contrast: off" was breaking as "contr / ast"). */
html.huge-text .display-bar { flex-direction: column; align-items: stretch; }
html.huge-text .display-bar button { width: 100%; font-size: 1rem; overflow-wrap: break-word; word-break: normal; hyphens: manual; }
/* round 26: listed Live Shows on the welcome page, watching, and Minute to Win It */
.show-list { list-style: none; margin: 0.4rem 0 1rem; padding: 0; display: grid; gap: 0.6rem; }
.show-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.8rem; padding: 0.5rem 0; border-bottom: 1px solid var(--muted); }
.show-list .show-name { font-weight: 800; font-size: 1.1rem; }
.show-list .show-status, .show-list .show-when, .show-status { color: var(--muted); font-weight: 600; }
.watch-note { font-weight: 700; font-size: 1.15rem; margin: 0.4rem 0; }
.minute-box { margin: 0.8rem 0; }
.minute-box .min-score { font-weight: 700; font-size: 1.2rem; margin: 0.2rem 0 0.6rem; }
.minute-box #min-q { font-size: 1.5rem; margin: 0.4rem 0 0.8rem; }
.minute-box #min-choices button { width: 100%; text-align: left; min-height: 3rem; }
.minute-box #min-skip { margin-top: 0.8rem; min-height: 2.75rem; }

/* ---- Suspense: the choices look like doors (the look only; nothing here is read out) ----
   Each door is wood with the choice's colour as its frame and on the letter's plaque, so colour,
   shape and letter still tell them apart. Panels and the brass knob are pseudo-elements with empty
   content: nothing for a screen reader. White text on the wood is 5.9:1 at its lightest. */
.tile-red { --door-accent: #c8102e; --door-accent-fg: #ffffff; }
.tile-blue { --door-accent: #1660c8; --door-accent-fg: #ffffff; }
.tile-yellow { --door-accent: #f5c400; --door-accent-fg: #1d1b16; }
.tile-green { --door-accent: #1f7a0f; --door-accent-fg: #ffffff; }
.tile-plain { --door-accent: #8a8a8a; --door-accent-fg: #1d1b16; }
/* The doors stand side by side in one row, like a hallway (Liz, 2026-11-30), each one tall and
   door-shaped. Up to four in a row; five or six go three to a row, seven or eight four to a row.
   With bigger text (the list isn't two-up then) they wrap at whatever width keeps the words whole. */
#choices:has(> li > .door-tile) {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 9rem), 1fr)); gap: 0.8rem;
}
#choices.grid2:has(> li > .door-tile) {
  grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 9.5rem); justify-content: center;
}
#choices.grid2:has(> li > .door-tile):has(> li:nth-child(5)) { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 9.5rem)); }
#choices.grid2:has(> li > .door-tile):has(> li:nth-child(7)) { grid-template-columns: repeat(4, minmax(0, 9.5rem)); }
#choices > li:has(> .door-tile) { min-width: 0; }
.choice.tile-block.door-tile, .choice.tile-block.door-tile.tile-yellow {
  position: relative; color: #ffffff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 2px, rgba(0, 0, 0, 0.06) 2px 5px, transparent 5px 13px),
    linear-gradient(90deg, #5b3418, #7b4a24 35%, #6a3e1c 65%, #4f2c13);
  border: 5px solid var(--door-accent, #8a8a8a);
  border-radius: 1.6rem 1.6rem 0.35rem 0.35rem;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.35), inset 0 2px 0 3px rgba(255, 220, 170, 0.12);
  transform-origin: left center;
  /* tall: the name and plaque in the upper panel, "Your answer" in the lower one */
  flex-direction: column; align-items: center; justify-content: flex-start; text-align: center;
  gap: 0.5rem; height: auto; min-height: auto; aspect-ratio: 3 / 5; padding: 1rem 0.6rem 0.9rem;
}
/* the panels: an inset frame, with a rail across it a little above the middle */
.choice.tile-block.door-tile::before {
  content: ''; position: absolute; inset: 0.45rem; pointer-events: none;
  border: 2px solid rgba(0, 0, 0, 0.38); border-radius: 1.1rem 1.1rem 0.2rem 0.2rem;
  box-shadow: inset 0 0 0 1px rgba(255, 220, 170, 0.16), 0 0 0 1px rgba(255, 220, 170, 0.12);
  background: linear-gradient(to bottom, transparent calc(46% - 2px), rgba(0, 0, 0, 0.32) calc(46% - 2px) calc(46% + 1px), rgba(255, 220, 170, 0.14) calc(46% + 1px) calc(46% + 2px), transparent calc(46% + 2px));
}
/* the brass knob, on the latch side just below the rail */
.choice.tile-block.door-tile::after {
  content: ''; position: absolute; right: 0.7rem; top: 55%; width: 1rem; height: 1rem;
  margin-top: -0.5rem; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 35% 32%, #fff4bf 0, #e6b84a 38%, #a37714 72%, #6b4c0a 100%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.7), 0 0 0 2px rgba(0, 0, 0, 0.25); z-index: 1;
}
.choice.tile-block.door-tile > span { position: relative; z-index: 1; max-width: 100%; }
/* words break only between words: "Door A" may go on two lines, never a letter to a line */
.choice.tile-block.door-tile .ctext { flex: none; overflow-wrap: normal; hyphens: manual; }
.choice.tile-block.door-tile .mark { margin-top: auto; font-size: 0.85em; overflow-wrap: normal; }
.choice.tile-block.door-tile .tile-deco {
  background: var(--door-accent, #8a8a8a); color: var(--door-accent-fg, #ffffff); text-shadow: none;
  padding: 0.3rem 0.55rem; border-radius: 0.45rem; border: 2px solid rgba(0, 0, 0, 0.35);
}
/* the door you picked stands a little open, light from behind it; the outline still says it's yours */
.choice.tile-block.door-tile.mine {
  border: 5px solid var(--door-accent, #8a8a8a);
  transform: perspective(700px) rotateY(-14deg);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.35), 0.6rem 0 1rem -0.2rem rgba(255, 196, 90, 0.8);
}
/* bigger text: the doors are a column of wide ones, so only a hint of open (and nothing past the screen's edge) */
#choices:not(.grid2) .choice.tile-block.door-tile.mine { transform: perspective(2400px) rotateY(-4deg); }
/* phones: four doors still fit in one row; the plaque, the name and the knob get smaller */
@media (max-width: 600px) {
  #choices.grid2:has(> li > .door-tile) { gap: 0.5rem; }
  .choices.grid2 .choice.tile-block.door-tile { aspect-ratio: 1 / 2; font-size: 0.8rem; min-height: auto; flex-direction: column; align-items: center; padding: 0.7rem 0.25rem 0.6rem; gap: 0.35rem; }
  .choice.tile-block.door-tile .tile-deco { font-size: 0.95rem; padding: 0.15rem 0.3rem; }
  .choice.tile-block.door-tile .mark { font-size: 0.9em; }
  .choice.tile-block.door-tile::before { inset: 0.3rem; border-radius: 0.9rem 0.9rem 0.15rem 0.15rem; }
  .choice.tile-block.door-tile::after { right: 0.3rem; top: 58%; width: 0.6rem; height: 0.6rem; margin-top: -0.3rem; }
  .choice.tile-block.door-tile.mine { transform: perspective(360px) rotateY(-12deg); }
}
@media (prefers-reduced-motion: no-preference) {
  .choice.tile-block.door-tile { transition: transform 0.35s ease-out, box-shadow 0.35s ease-out; }
}
body.hc .choice.tile-block.door-tile { border-radius: 1.6rem 1.6rem 0.35rem 0.35rem; text-shadow: none; box-shadow: none; }
body.hc .choice.tile-block.door-tile::before { border-color: rgba(255, 255, 255, 0.45); box-shadow: none; background: none; }
body.hc .choice.tile-block.door-tile::after { background: #ffffff; box-shadow: none; }
body.hc .choice.tile-block.door-tile .tile-deco { background: #000000; color: #ffffff; border-color: currentColor; }
html.huge-text .choice.tile-block.door-tile { aspect-ratio: auto; min-height: 8rem; padding: 0.8rem 0.6rem; }

/* the big reveal: the same hallway, one row of tall doorways (two to a row on a phone, where the
   words behind them need the room; three or four to a row past four doors). Laid out top to
   bottom inside, the answer gets the door's full width, so "✓ Right" no longer squeezes it. */
#unveil-doors { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
#unveil-doors:has(> li:nth-child(5)) { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); }
#unveil-doors:has(> li:nth-child(7)) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#unveil-doors > li.tile-block {
  position: relative; perspective: 1100px;
  flex-direction: column; flex-wrap: nowrap; align-items: center; justify-content: flex-start; text-align: center;
  gap: 0.5rem; min-height: 17rem; padding: 1.2rem 0.8rem 1rem;
  border-radius: 1.6rem 1.6rem 0.35rem 0.35rem;
}
#unveil-doors > li.tile-block .ctext { flex: none; max-width: 100%; overflow-wrap: break-word; hyphens: manual; }
#unveil-doors > li.tile-block .count { margin: auto 0 0; white-space: normal; }
@media (max-width: 600px) {
  #unveil-doors, #unveil-doors:has(> li:nth-child(5)), #unveil-doors:has(> li:nth-child(7)) { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
  #unveil-doors > li.tile-block { min-height: 12rem; padding: 1rem 0.5rem 0.8rem; font-size: 1.15rem; }
  #unveil-doors > li.tile-block .tile-deco { font-size: 1.6rem; }
  #unveil-doors > li.tile-block .count { font-size: 1rem; }
}
html.huge-text #unveil-doors, html.huge-text #unveil-doors:has(> li:nth-child(5)), html.huge-text #unveil-doors:has(> li:nth-child(7)) { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 1fr)); }
html.huge-text #unveil-doors > li.tile-block { min-height: 0; }

/* the big reveal: a door over each choice swings open on its hinge, one after another, and the
   choice is behind it. Only when motion is welcome; asking for less motion shows them open. */
@media (prefers-reduced-motion: no-preference) {
  #unveil-doors > li::before, #unveil-doors > li::after {
    content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none;
    border-radius: 1.6rem 1.6rem 0.35rem 0.35rem; transform-origin: left center;
    backface-visibility: hidden;
    animation: door-swing 0.6s cubic-bezier(0.55, 0.05, 0.35, 1) both;
    animation-delay: calc(0.35s + var(--door-i, 0) * 0.6s - var(--door-elapsed, 0s));
  }
  #unveil-doors > li::before {
    background:
      linear-gradient(to bottom, transparent calc(50% - 2px), rgba(0, 0, 0, 0.32) calc(50% - 2px) calc(50% + 1px), rgba(255, 220, 170, 0.14) calc(50% + 1px) calc(50% + 2px), transparent calc(50% + 2px)),
      repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 2px, rgba(0, 0, 0, 0.06) 2px 5px, transparent 5px 13px),
      linear-gradient(90deg, #5b3418, #7b4a24 35%, #6a3e1c 65%, #4f2c13);
    border: 5px solid var(--door-accent, #8a8a8a);
    outline: 2px solid rgba(0, 0, 0, 0.38); outline-offset: -0.9rem;
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.35), 0 0.3rem 0.8rem rgba(0, 0, 0, 0.35);
  }
  #unveil-doors > li::after {
    background: radial-gradient(circle at calc(100% - 1.3rem) 55%, #fff4bf 0, #e6b84a 0.24rem, #a37714 0.42rem, #6b4c0a 0.52rem, transparent 0.57rem);
  }
  body.hc #unveil-doors > li::before { background: #000000; border-color: #ffffff; outline-color: rgba(255, 255, 255, 0.5); box-shadow: none; }
  body.hc #unveil-doors > li::after { background: radial-gradient(circle at calc(100% - 1.3rem) 55%, #ffffff 0.5rem, transparent 0.55rem); }
  @keyframes door-swing {
    from { transform: rotateY(0deg); opacity: 1; }
    85% { opacity: 1; }
    to { transform: rotateY(-105deg); opacity: 0; visibility: hidden; }
  }
}
