/* Layout: one screen. The wheel owns the middle; a slim dock (or the winner reveal) sits under it.
   The list editor is a side drawer on desktop and a bottom sheet on phones, and the wheel
   keeps resizing beside it, so edits show up live. Light theme only, by design. */
:root {
  --bg: #FBF6EF; /* warm cream */
  --surface: #FFFFFF;
  --sunk: #F5EEE4;
  --ink: #1B2033;
  --muted: #636B80;
  --line: #EADFD1;
  --accent: #3C4FE0;
  --accent-ink: #FFFFFF;
  --accent-soft: #E9ECFD;
  --accent-text: #3C4FE0; /* the accent as text: stays readable on the page in every theme */
  --warn: #8A5300;
  --f-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --f-body: "Figtree", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --shadow-lg: 0 24px 60px rgba(20, 26, 50, 0.18), 0 2px 6px rgba(20, 26, 50, 0.06);
  --ease-out: cubic-bezier(.2, .9, .3, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1); /* overshoots a little, then settles */
  color-scheme: light;
}

/* Colour themes (⋯ menu). Each sets the button colour, the text on it, a soft tint for selections,
   and a darker shade for accent-coloured text. Gold and orange are too light for white text. */
:root[data-theme="pink"] { --accent: #E3467D; --accent-ink: #FFFFFF; --accent-soft: #FCE4EE; --accent-text: #C2185B; }
:root[data-theme="orange"] { --accent: #FB8C3C; --accent-ink: #1B2033; --accent-soft: #FFEBDC; --accent-text: #C2410C; }
:root[data-theme="gold"] { --accent: #F5B82E; --accent-ink: #1B2033; --accent-soft: #FDF1D2; --accent-text: #8A5A00; }
:root[data-theme="black"] { --accent: #1B2033; --accent-ink: #FFFFFF; --accent-soft: #ECE6DD; --accent-text: #1B2033; }

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* component display rules must not beat the hidden attribute */
html { height: 100%; }
body {
  min-height: 100%; margin: 0; overflow-x: hidden;
  background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--f-body);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }
svg { display: block; }
kbd {
  font: 600 11px var(--f-body); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 5px; background: var(--surface); color: var(--muted);
}

/* ---------- Shell ---------- */
.app {
  height: 100vh; height: 100dvh; min-height: 520px; /* the app fills the first screen; the about text follows */
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(0, 1fr);
}
.bar {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px 0;
}
.brand { display: flex; align-items: center; gap: 8px; font: 800 21px/1 var(--f-display); letter-spacing: -.02em; }
.brand { position: relative; min-width: 0; }
.brand > svg, .brand-link > svg { width: 26px; height: 26px; flex: none; }
.class-btn {
  display: inline-flex; align-items: center; gap: 4px; min-width: 0; margin-left: 6px;
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 6px 10px 6px 14px; font: 600 14px var(--f-body); letter-spacing: 0;
}
.class-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 34vw; }
.class-btn svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.class-btn:hover { border-color: var(--accent); }
.menu.class-menu {
  position: absolute; top: calc(100% + 8px); left: 0; bottom: auto; transform: none; z-index: 12;
  min-width: 250px; max-height: 60vh; overflow: auto; font: 500 14.5px var(--f-body); letter-spacing: 0;
}
.class-menu [role="menuitemradio"] { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.class-menu [aria-checked="true"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 700; }
.class-menu .class-count { color: var(--muted); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.menu button.danger { color: #B42318; }
.sheet-form { display: grid; gap: 8px; }
.field-label { font-size: 13.5px; font-weight: 600; color: var(--muted); margin-top: 4px; }
.field {
  width: 100%; border: 1px solid var(--line); background: var(--sunk); border-radius: 12px;
  padding: 10px 12px; font-size: 15px;
}
.field:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.field.roster { resize: vertical; min-height: 120px; line-height: 1.55; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 7px 14px 7px 12px; font-size: 14px; font-weight: 600;
  transition: border-color .15s, color .15s;
}
.pill svg { width: 15px; height: 15px; }
.pill:hover { border-color: var(--accent); color: var(--accent-text); }
.bar-actions { display: flex; align-items: center; gap: 8px; position: relative; }
.menu.sound-menu {
  position: absolute; top: calc(100% + 8px); right: 0; left: auto; bottom: auto; transform: none; z-index: 12;
  width: min(300px, calc(100vw - 32px)); font: 500 14.5px var(--f-body); letter-spacing: 0;
}
.sound-menu .menu-label { margin: 4px 12px 2px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.sound-toggle { display: flex; align-items: center; justify-content: space-between; font-weight: 700 !important; }
.sound-toggle[aria-checked="true"] .switch { background: var(--accent); }
.sound-toggle[aria-checked="true"] .switch::after { transform: translateX(16px); }
.sound-choice { display: grid; gap: 1px; }
.sound-choice strong { font-weight: 700; }
.sound-choice span { color: var(--muted); font-size: 13px; }
.sound-choice[aria-checked="true"] { background: var(--accent-soft); }
.sound-choice[aria-checked="true"] strong { color: var(--accent-text); }
.sound-choice[aria-checked="true"] strong::after { content: " ✓"; }
.icon-pill { padding: 8px; }
.icon-pill svg { width: 18px; height: 18px; }
#soundBtn .off, #soundBtn[aria-pressed="false"] .on { display: none; }
#soundBtn[aria-pressed="false"] .off { display: block; }
#soundBtn[aria-pressed="false"] { color: var(--muted); }

/* ---------- Stage ---------- */
.stage {
  grid-column: 1; grid-row: 2;
  position: relative; min-height: 0;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 4px 16px 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}
.stage::before {
  /* a faint pool of light behind the wheel */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(closest-side at 50% 48%, rgba(255,252,246,.95), rgba(255,252,246,0) 72%);
}
.stage > * { position: relative; }
.stage-top { display: grid; justify-items: center; gap: 6px; padding-top: 4px; }
.question {
  width: min(100%, 620px); text-align: center; border: 0; background: transparent;
  font: 800 clamp(24px, 3.6vw, 38px)/1.1 var(--f-display); letter-spacing: -.025em;
  padding: 4px 10px; border-radius: 12px; text-overflow: ellipsis;
}
.question::placeholder { color: var(--ink); opacity: 1; }
.question:hover { background: rgba(27, 32, 51, .04); }
.question:focus { outline: none; background: var(--surface); box-shadow: 0 0 0 2px var(--accent); }
.example-pill {
  border: 0; background: var(--accent-soft); color: var(--ink); border-radius: 999px;
  padding: 5px 13px; font-size: 13.5px;
}
.example-pill b { color: var(--accent-text); font-weight: 700; margin-left: 2px; }
.example-pill:hover b { text-decoration: underline; }

.wheel-zone { container-type: size; display: grid; place-items: center; min-height: 0; padding-block: 10px; }
/* The pointer rises above the wheel's edge (up to ~25px on a big wheel), so keep that room clear
   of the question and the example pill. The reel and elimination boards have no pointer. */
.wheel-zone:has(.wheel-wrap[data-format="wheel"]) { padding-top: 46px; }
.wheel-wrap {
  position: relative; aspect-ratio: 1;
  width: min(100cqw, 100cqh, 700px); max-width: 100%;
}
#wheel { width: 100%; height: 100%; display: block; cursor: pointer; touch-action: manipulation; border-radius: 50%; }
.wheel-wrap::after {
  /* ground shadow */
  content: ""; position: absolute; left: 12%; right: 12%; bottom: -4%; height: 8%;
  background: radial-gradient(closest-side, rgba(20, 26, 50, .18), transparent); z-index: -1;
}
.pointer {
  position: absolute; top: -3.5%; left: 50%; width: 9%; min-width: 30px; max-width: 48px;
  transform: translateX(-50%); transform-origin: 50% 30%;
  filter: drop-shadow(0 3px 4px rgba(20, 26, 50, .3)); pointer-events: none;
}
.pointer.tick { animation: tick .13s ease-out; }
@keyframes tick { 40% { transform: translateX(-50%) rotate(-16deg); } }
.hub {
  position: absolute; inset: 0; margin: auto; width: 21%; height: 21%; border-radius: 50%;
  border: 0; background: var(--surface); color: var(--ink);
  font: 800 clamp(14px, 3.4cqmin, 24px)/1 var(--f-display); letter-spacing: .05em;
  box-shadow: 0 0 0 5px var(--ink), 0 6px 18px rgba(20, 26, 50, .35);
  transition: transform .18s var(--ease-out);
}
.hub:hover:not(:disabled) { transform: scale(1.06); }
.hub:active:not(:disabled) { transform: scale(.97); }
.hub:disabled { cursor: default; color: var(--muted); }
/* Reel and elimination: a 4:3 board with SPIN on its base strip instead of the wheel's hub. */
.wheel-wrap:not([data-format="wheel"]) { aspect-ratio: 4 / 3; width: min(100cqw, calc(100cqh * 4 / 3), 640px); }
.wheel-wrap:not([data-format="wheel"]) #wheel { border-radius: 24px; }
.wheel-wrap:not([data-format="wheel"]) .pointer { display: none; }
.wheel-wrap:not([data-format="wheel"]) .hub {
  inset: auto 0 9px; width: max-content; height: 42px; padding: 0 34px; border-radius: 999px;
  font-size: 17px; box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
}
.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }

/* ---------- Slot: dock, starters or reveal ---------- */
.slot { min-height: 136px; display: grid; place-items: center; }
.dock {
  display: flex; align-items: center; gap: 2px; padding: 5px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(27, 32, 51, .08), 0 1px 2px rgba(27, 32, 51, .05);
}
.dock-btn {
  position: relative; display: inline-flex; align-items: center; gap: 8px; height: 42px;
  border: 0; background: transparent; border-radius: 999px; color: var(--ink);
  padding: 0 18px 0 15px; font-size: 14.5px; font-weight: 600; white-space: nowrap;
  transition: background .15s, color .15s;
}
.dock-btn:not(:first-child)::before { /* hairline between buttons */
  content: ""; position: absolute; left: -1px; top: 11px; bottom: 11px; width: 1px; background: var(--line);
}
.dock-btn:hover::before, .dock-btn:hover + .dock-btn::before { opacity: 0; }
.dock-btn svg { width: 17px; height: 17px; flex: none; }
/* Longer labels (Spanish, or a long count) shrink with an ellipsis rather than widen the page. */
.slot, .dock { min-width: 0; max-width: 100%; }
.dock-btn { min-width: 0; }
.dock-btn > span { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 380px) { .dock-btn { gap: 6px; padding: 0 11px 0 10px; } }
.dock-btn:hover { background: var(--accent-soft); color: var(--accent-text); }
.dock-btn.icon { width: 42px; padding: 0; justify-content: center; }
.dock-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.dock-btn.primary:hover { color: var(--accent-ink); filter: brightness(1.08); }
@media (hover: none) { .btn kbd { display: none; } }
.app.spinning .dock { opacity: .45; pointer-events: none; transition: opacity .2s; }

.starters { display: grid; gap: 10px; justify-items: center; }
.starters p { margin: 0; color: var(--muted); font-size: 14px; }
.starters div { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

.reveal {
  width: min(100%, 560px); display: grid; justify-items: center; gap: 4px; text-align: center;
  animation: rise .45s var(--ease-out);
}
/* translate/scale, not transform, so these compose with elements centred by transform. */
@keyframes rise { from { opacity: 0; translate: 0 14px; } }
@keyframes pop-in { from { opacity: 0; translate: 0 10px; scale: .94; } }
.reveal.landing { animation: none; }
.reveal.landing > :not(.reveal-name) { animation: rise .4s .38s var(--ease-out) backwards; }
.reveal-name.fly { position: fixed; z-index: 7; margin: 0; pointer-events: none; text-align: center; color: var(--ink); }
.reveal-name {
  font: 800 clamp(30px, 6vw, 52px)/1.05 var(--f-display); letter-spacing: -.03em;
  overflow-wrap: anywhere; text-wrap: balance; max-width: 100%;
  background: linear-gradient(transparent 68%, var(--win, var(--accent-soft)) 68%, var(--win, var(--accent-soft)) 92%, transparent 92%);
  padding: 0 .12em;
}
.reveal-meta { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.reveal-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 42px;
  border: 1px solid var(--line); background: var(--surface); border-radius: 12px;
  padding: 0 16px; font-weight: 600; font-size: 14.5px; white-space: nowrap;
}
.btn:hover { border-color: #D9C9B5; background: #FFFCF8; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn.quiet:hover { color: var(--ink); background: var(--sunk); }
.btn.small { height: 34px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.btn kbd { background: transparent; border-color: currentColor; color: inherit; opacity: .75; }
.btn.icon-only { width: 42px; padding: 0; justify-content: center; }
.btn-icon { display: inline-flex; }
/* Everything you can press gives a little under your finger. */
.btn, .chip, .dock-btn, .seg button, .turn-chip.done, .att, .choice { transition: transform .14s var(--ease-out), background .15s, color .15s, border-color .15s; }
.btn:active, .chip:active, .dock-btn:active, .seg button:active, .turn-chip.done:active, .att:active, .choice:active { transform: scale(.95); }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 6px 13px; font-size: 13.5px; font-weight: 600;
}
.chip:hover { border-color: var(--accent); color: var(--accent-text); }
.link { border: 0; background: none; padding: 0; color: var(--accent-text); font-weight: 600; font-size: inherit; }
.link:hover { text-decoration: underline; }

/* ---------- More menu ---------- */
.menu {
  position: absolute; z-index: 6; bottom: 128px; left: 50%; transform: translateX(-50%);
  min-width: 210px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 6px; display: grid;
  animation: pop-in .32s var(--spring); transform-origin: 50% 100%;
}
.menu button {
  border: 0; background: none; text-align: left; padding: 10px 12px; border-radius: 9px;
  font-size: 14.5px; font-weight: 500;
}
.menu button:hover, .menu button:focus-visible { background: var(--sunk); outline: none; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }
.theme-row { display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: 14.5px; font-weight: 500; }
.theme-row > span { margin-right: auto; }
.menu .swatch {
  width: 24px; height: 24px; padding: 0; border-radius: 50%; background: var(--sw);
  border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line);
}
.menu .swatch:hover { background: var(--sw); transform: scale(1.12); }
.menu .swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ink); }

/* ---------- Editor: drawer (desktop) / sheet (phone) ---------- */
.editor {
  grid-column: 2; grid-row: 2;
  width: 380px; background: var(--surface); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 12px; padding: 16px; min-height: 0;
  animation: slide-in .3s var(--ease-out);
}
@keyframes slide-in { from { translate: 24px 0; opacity: 0; } }
.grabber { display: none; }
.editor-head { display: flex; align-items: center; gap: 10px; }
.editor-head h2 { margin: 0; font: 800 19px var(--f-display); letter-spacing: -.01em; }
.editor-head .count { color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; margin-right: auto; }
#entries {
  flex: 1; min-height: 120px; width: 100%; resize: none;
  border: 1px solid var(--line); border-radius: 14px; background: var(--sunk);
  padding: 12px 14px; line-height: 1.6; font-size: 15px;
}
#entries:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.editor-tools { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-top: -4px; font-size: 13.5px; }
.editor-tools span { color: var(--muted); }
.drop-zone {
  position: fixed; inset: 12px; z-index: 40; display: grid; place-items: center; pointer-events: none;
  border: 3px dashed var(--accent); border-radius: 28px; background: color-mix(in srgb, var(--accent-soft) 88%, transparent);
  animation: fade .15s;
}
.drop-zone div { display: grid; gap: 6px; text-align: center; padding: 28px 36px; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-lg); animation: pop-in .3s var(--spring); }
.drop-zone strong { font: 800 28px var(--f-display); }
.drop-zone span { color: var(--muted); }
.notes { display: flex; flex-wrap: wrap; gap: 6px; }
.notes:empty { display: none; }
.note {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted); background: var(--sunk); border-radius: 8px; padding: 4px 10px;
}
.quick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.quick > span { font-size: 13px; color: var(--muted); margin-right: 2px; }

.switch {
  flex: none; width: 38px; height: 22px; border-radius: 999px; background: #DCCBB6; position: relative;
  transition: background .2s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .2s var(--ease-out);
}
/* Turns: how repeats work, and who has had a turn this round. */
.turns {
  flex: none; display: grid; gap: 10px; padding: 14px; border-radius: 16px;
  background: var(--sunk); border: 1px solid var(--line);
}
.turns-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.turns-head h3 { margin: 0 auto 0 0; font: 800 16px var(--f-display); }
.seg {
  --i: 0; position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 3px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
}
.seg::before { /* the sliding thumb */
  content: ""; position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px);
  border-radius: 999px; background: var(--accent); box-shadow: 0 2px 6px color-mix(in srgb, var(--accent) 35%, transparent);
  transform: translateX(calc(var(--i) * 100%)); transition: transform .38s var(--spring);
}
.seg button {
  position: relative; border: 0; background: none; border-radius: 999px; padding: 6px 13px;
  font-size: 13.5px; font-weight: 700; color: var(--muted); white-space: nowrap; transition: color .2s;
}
.seg button[aria-checked="true"] { color: var(--accent-ink); }
.seg button:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.turns-about { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.turns-round { display: grid; gap: 8px; padding-top: 10px; border-top: 1px dashed var(--line); }
.turns-line { display: flex; align-items: center; gap: 10px; min-height: 34px; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.turns-line span { margin-right: auto; }
.turns-line .btn { background: var(--surface); }
.meter { height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, var(--surface)); overflow: hidden; }
.meter span {
  display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent);
  transition: width .6s var(--spring);
}
.turns-sub { margin: -2px 0 0; font-size: 12.5px; color: var(--muted); }
.turn-chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 136px; overflow: auto; padding: 2px; }
.turn-chips:empty { display: none; }
.turn-chip {
  display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 3px 10px; font-size: 13px; font-weight: 600; line-height: 1.5;
}
.turn-chip.away { color: var(--muted); text-decoration: line-through; background: transparent; }
.turn-chip.done {
  cursor: pointer; color: var(--muted); background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
}
.turn-chip.done::before { content: "✓"; color: var(--accent-text); font-weight: 800; }
.turn-chip.done:hover, .turn-chip.done:focus-visible { color: var(--ink); border-color: var(--accent); }
.turn-chip.done:hover::before, .turn-chip.done:focus-visible::before { content: "↩"; }
.turn-chip.just { animation: chip-pop .5s var(--spring); }
@keyframes chip-pop { 0% { transform: scale(.6); } 60% { transform: scale(1.12); } }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; }
.scrim { position: absolute; inset: 0; background: rgba(27, 32, 51, .32); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: relative; width: min(100%, 460px); max-height: min(86%, 720px); overflow: auto;
  background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-lg);
  padding: 22px; display: grid; gap: 14px;
  animation: pop-in .4s var(--spring);
}
.sheet h3 { margin: 0; font: 800 24px/1.15 var(--f-display); letter-spacing: -.02em; text-wrap: balance; }
.sheet p { margin: 0; color: var(--muted); font-size: 14px; }
.sheet .warn { color: var(--warn); }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.share-link {
  width: 100%; border: 1px solid var(--line); background: var(--sunk); border-radius: 12px;
  padding: 11px 12px; font-size: 13px; color: var(--ink); text-overflow: ellipsis;
}
.backup-code {
  width: 100%; resize: none; border: 1px solid var(--line); background: var(--sunk); border-radius: 12px;
  padding: 10px 12px; font: 500 12.5px/1.45 ui-monospace, "SF Mono", Menlo, monospace; color: var(--ink);
  word-break: break-all;
}
.backup-code:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.sheet .backup-meta { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.sheet-sub { margin: 6px 0 0; padding-top: 14px; border-top: 1px solid var(--line); font: 800 17px var(--f-display); }
.attendance { display: flex; flex-wrap: wrap; gap: 8px; }
.att {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 8px 14px; font-size: 14.5px; font-weight: 600;
}
.att[aria-pressed="true"] { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--accent-soft); color: var(--ink); }
.att[aria-pressed="false"] { color: var(--muted); text-decoration: line-through; background: var(--sunk); }
.sheet .attendance-summary { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; margin-inline: -4px; }
table.participation { width: 100%; border-collapse: collapse; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.participation th { text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.participation td { padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.participation td:first-child { font-weight: 600; white-space: normal; }
.participation td:nth-child(2), .participation td:nth-child(3), .participation th:nth-child(2), .participation th:nth-child(3) { text-align: right; }
.participation tr.behind td:first-child { color: var(--accent-text); }
.sheet .participation-summary { color: var(--ink); font-weight: 600; }
.role-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.role-list li { display: flex; align-items: center; justify-content: space-between; padding: 2px 2px 2px 12px; border-radius: 10px; background: var(--sunk); font-weight: 600; }
.role-list .btn.icon-only { height: 34px; width: 34px; }
.role-add { display: flex; gap: 8px; }
.role-add .field { flex: 1; min-width: 0; }
.role-results { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.role-results li {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 14px;
  border-radius: 14px; background: var(--sunk); animation: rise .4s var(--ease-out) both;
}
.role-results .role-name { color: var(--muted); font-weight: 600; font-size: 14px; }
.role-results strong { font: 800 22px/1.1 var(--f-display); letter-spacing: -.01em; text-align: right; overflow-wrap: anywhere; }
.notice { background: #FFF6E5; border: 1px solid #F2D49B; border-radius: 14px; padding: 12px 14px; display: grid; gap: 10px; }
.sheet .notice p { color: var(--ink); }
.notice-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.keep-apart { border-top: 1px solid var(--line); padding-top: 12px; }
.keep-apart summary { cursor: pointer; font: 800 16px var(--f-display); list-style-position: outside; }
.keep-apart[open] summary { margin-bottom: 8px; }
.keep-apart > * + * { margin-top: 8px; }
.apart-add { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
@media (max-width: 420px) { .apart-add { grid-template-columns: 1fr 1fr; } .apart-add .btn { grid-column: 1 / -1; justify-content: center; } }
select.field { appearance: auto; min-width: 0; }
ol.order { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; counter-reset: o; }
ol.order li {
  counter-increment: o; display: flex; align-items: baseline; gap: 12px;
  padding: 8px 12px; border-radius: 10px; background: var(--sunk); font-weight: 500;
}
ol.order li::before { content: counter(o); min-width: 1.5em; text-align: right; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.choices { display: grid; gap: 8px; margin-top: 4px; }
.choice {
  display: grid; gap: 2px; text-align: left; padding: 11px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 14px;
}
.choice strong { font: 800 15.5px var(--f-display); }
.choice span { color: var(--muted); }
.choice:hover { border-color: var(--accent); }
.choice[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.teams { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.team { background: var(--sunk); border-radius: 12px; padding: 10px 12px; border-top: 4px solid var(--c); }
.team h4 { margin: 0 0 4px; font: 800 15px var(--f-display); }
.team ul { margin: 0; padding: 0; list-style: none; font-size: 14px; }
.stepper { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; }
.stepper button { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 18px; line-height: 1; }
.history { margin: 0; padding: 0; list-style: none; display: grid; }
.history li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 2px; border-bottom: 1px solid var(--line); font-weight: 500; }
.history li:last-child { border-bottom: 0; }
.history time { color: var(--muted); font-size: 13px; white-space: nowrap; font-weight: 400; }

.toast {
  position: fixed; z-index: 30; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); /* above the dock */
  display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px);
  background: var(--ink); color: #fff; border-radius: 999px; padding: 10px 18px;
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg);
  animation: pop-in .36s var(--spring);
}
.modal:not([hidden]) ~ .toast { bottom: auto; top: calc(16px + env(safe-area-inset-top, 0px)); } /* keep clear of open sheets */
.toast button { border: 0; background: none; padding: 0; color: #FFD27A; font-weight: 700; white-space: nowrap; }

/* ---------- Phones ---------- */
/* ---------- About: plain text below the app, for teachers who scroll and for search engines ---------- */
.about { border-top: 1px solid var(--line); background: var(--surface); padding: 48px 16px 64px; }
.about-inner { max-width: 720px; margin: 0 auto; }
.about h1 { font: 800 clamp(26px, 4vw, 36px)/1.15 var(--f-display); letter-spacing: -.02em; margin: 0 0 12px; }
.about h2 { font: 800 21px/1.2 var(--f-display); margin: 36px 0 8px; }
.about-lead { font-size: 17px; color: #3D4256; margin: 0 0 20px; }
.about-features { padding-left: 20px; display: grid; gap: 10px; margin: 0; }
.about-features a, .about-links a { color: var(--accent-text); font-weight: 600; }
.about-features a { display: inline-block; margin-left: 4px; }
.about-steps { padding-left: 22px; display: grid; gap: 6px; margin: 0 0 8px; }
.about details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.about summary { cursor: pointer; font-weight: 700; }
.about details p { margin: 8px 0 0; color: #3D4256; }
.about-links { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 32px; }
.about code { font-size: .92em; background: var(--sunk); padding: 1px 5px; border-radius: 5px; }
.community { margin-top: 36px; padding: 18px 20px; border-radius: 16px; background: #FDEAF1; border: 1px solid #F6C3D6; }
.community h2 { margin-top: 0; }
.community p { margin: 8px 0 0; }
.community a { color: #A3174E; font-weight: 700; }
.community-cta { display: inline-block; margin-right: 16px; padding: 9px 16px; border-radius: 999px; background: #E3467D; color: #fff !important; text-decoration: none; }
.app.presenting ~ .about { display: none; }

/* ---------- Blog and other plain pages ---------- */
body.page { background: var(--bg); }
.page-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1120px; margin: 0 auto; padding: 16px; }
.page-brand { display: inline-flex; align-items: center; gap: 8px; font: 800 20px var(--f-display); color: var(--ink); text-decoration: none; }
.page-nav { display: flex; align-items: center; gap: 18px; }
.page-nav > a:not(.page-open) { color: var(--ink); font-weight: 600; text-decoration: none; }
.page-nav > a:not(.page-open):hover { color: var(--accent-text); }
.page-open {
  display: inline-block; padding: 9px 18px; border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-weight: 700; text-decoration: none; white-space: nowrap; transition: transform .14s var(--ease-out), filter .15s;
}
.page-open:hover { filter: brightness(1.08); }
.page-open:active { transform: scale(.96); }
.post-tag {
  display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text);
  font-size: 12.5px; font-weight: 700; letter-spacing: .02em;
}

/* Index */
.blog { max-width: 1120px; margin: 0 auto; padding: 8px 16px 48px; display: grid; gap: 28px; }
.blog-hero { max-width: 760px; padding: 24px 0 4px; }
.blog-hero h1 { font: 800 clamp(36px, 6vw, 60px)/1.02 var(--f-display); letter-spacing: -.035em; margin: 12px 0; }
.blog-hero p:last-child { font-size: 19px; color: #3D4256; margin: 0; }
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 22px; }
.post-card {
  display: grid; grid-template-rows: auto 1fr; overflow: hidden; border-radius: 20px; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(27, 32, 51, .04);
  transition: transform .25s var(--spring), box-shadow .25s;
}
.post-card:hover { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(27, 32, 51, .12); }
.post-card-cover { display: block; aspect-ratio: 40 / 21; overflow: hidden; }
.post-card-cover svg { width: 100%; height: 100%; transition: transform .5s var(--ease-out); }
.post-card:hover .post-card-cover svg { transform: scale(1.04); }
.post-card-text { display: grid; align-content: start; gap: 8px; padding: 18px 20px 20px; }
.post-card-text .post-tag { justify-self: start; }
.post-card-title { font: 800 21px/1.2 var(--f-display); letter-spacing: -.015em; text-wrap: balance; }
.post-card-sum { color: var(--muted); font-size: 15px; }
.post-card-meta { color: var(--muted); font-size: 13px; font-weight: 600; margin-top: 2px; }
.post-card.big { grid-template-columns: 1.15fr 1fr; grid-template-rows: none; }
.post-card.big .post-card-cover { aspect-ratio: auto; min-height: 100%; }
.post-card.big .post-card-text { align-content: center; padding: 28px 32px; gap: 12px; }
.post-card.big .post-card-title { font-size: clamp(26px, 3.2vw, 36px); }
.post-card.big .post-card-sum { font-size: 17px; }

/* Article */
.post { max-width: 1120px; margin: 0 auto; padding: 8px 16px 48px; }
.post-hero { max-width: 820px; margin: 0 auto; text-align: center; display: grid; justify-items: center; gap: 4px; }
.post-meta { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 12px; margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.post-meta a { color: var(--accent-text); font-weight: 700; text-decoration: none; }
.post-hero h1 { font: 800 clamp(32px, 5.4vw, 54px)/1.06 var(--f-display); letter-spacing: -.03em; margin: 10px 0 8px; text-wrap: balance; }
.post-lead { font-size: clamp(18px, 2.2vw, 21px); color: #3D4256; margin: 0 0 18px; text-wrap: pretty; max-width: 680px; }
.post-cover { margin: 8px 0 0; width: 100%; aspect-ratio: 5 / 2; border-radius: 24px; overflow: hidden; box-shadow: 0 20px 50px rgba(27, 32, 51, .12); }
.post-cover svg { width: 100%; height: 100%; }
.post-layout { display: grid; grid-template-columns: 230px minmax(0, 720px); justify-content: center; gap: 56px; margin-top: 40px; }
.toc { position: sticky; top: 20px; align-self: start; font-size: 14px; }
.toc p { margin: 0 0 8px; font-weight: 800; font-family: var(--f-display); font-size: 15px; }
.toc ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; border-left: 2px solid var(--line); }
.toc a { display: block; padding: 5px 0 5px 14px; margin-left: -2px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; line-height: 1.35; }
.toc a:hover { color: var(--accent-text); border-left-color: var(--accent); }
.post-main { display: grid; gap: 32px; min-width: 0; }
.prose { font-size: 17.5px; line-height: 1.7; }
.prose > :first-child { margin-top: 0; }
.prose h2 { font: 800 27px/1.2 var(--f-display); letter-spacing: -.015em; margin: 40px 0 8px; scroll-margin-top: 16px; }
.prose h3 { font: 800 19px/1.3 var(--f-display); margin: 26px 0 4px; }
.prose p { margin: 10px 0; }
.prose a { color: var(--accent-text); font-weight: 600; }
.prose li { margin: 6px 0; }
.prose li::marker { color: var(--accent-text); font-weight: 700; }
.prose code { font: 600 .9em ui-monospace, "SF Mono", Menlo, monospace; background: var(--sunk); border-radius: 6px; padding: 1px 6px; }
.prose pre.paste {
  position: relative; margin: 14px 0; padding: 30px 18px 14px; border-radius: 14px; background: var(--surface); border: 1px dashed #D9C9B5;
  font: 500 15px/1.6 var(--f-body); white-space: pre-wrap;
}
.prose pre.paste::before { content: "Paste into WhirlPicker"; position: absolute; top: 9px; left: 18px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-text); }
.try-it {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; padding: 20px 22px; border-radius: 20px;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line));
}
.try-it p { margin: 0; color: #3D4256; }
.try-it .try-it-title { font: 800 19px var(--f-display); color: var(--ink); margin-bottom: 2px; }
.try-it-wheel {
  width: 56px; height: 56px; border-radius: 50%; border: 5px solid var(--ink);
  background: conic-gradient(#E3467D 0 45deg, #B9A6FF 0 90deg, #FF8A80 0 135deg, #FFE07A 0 180deg, #7FD0F0 0 225deg, #FFB38A 0 270deg, #8EDBB0 0 315deg, #FFC46B 0);
  animation: try-spin 9s linear infinite;
}
@keyframes try-spin { to { rotate: 1turn; } }
.related h2 { font: 800 24px var(--f-display); margin: 0 0 14px; }
.related .post-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.related .post-card-sum { display: none; }
.post-main .community, .blog .community { margin-top: 0; }
.page-foot a { color: #A3174E; }
.page-foot { max-width: 1120px; margin: 0 auto; padding: 24px 16px 40px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); text-align: center; }
@media (max-width: 960px) {
  .post-layout { grid-template-columns: minmax(0, 720px); gap: 28px; margin-top: 28px; }
  .toc { position: static; padding: 16px 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
  .post-card.big { grid-template-columns: 1fr; }
  .post-card.big .post-card-cover { aspect-ratio: 40 / 21; }
  .post-card.big .post-card-text { padding: 20px 22px 24px; }
}
@media (max-width: 560px) {
  .try-it { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .page-nav > a:not(.page-open) { display: none; }
}
.invite {
  position: fixed; z-index: 15; left: 0; right: 0; margin: 0 auto; bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  width: min(440px, calc(100vw - 32px)); /* centred without transform, which the rise animation uses */ background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow-lg); padding: 16px 18px; animation: rise .35s var(--ease-out);
}
.invite p { margin: 0 0 8px; font-size: 14.5px; color: #3D4256; }
.invite .invite-title { font: 800 17px var(--f-display); color: var(--ink); margin-bottom: 4px; }
.invite-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-top: 12px; }
.invite-actions a.btn { text-decoration: none; }

/* Team scores: a strip under the question; tap a team for a point */
.score-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: min(100%, 900px); }
.score {
  position: relative; display: inline-flex; align-items: center; gap: 10px; padding: 5px 6px 5px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); box-shadow: 0 2px 8px rgba(27, 32, 51, .06); font-weight: 700;
  transition: transform .14s var(--ease-out);
}
.score::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--team); margin-left: -4px; }
.score:active { transform: scale(.95); }
.score-name { font-size: 14px; max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-points {
  min-width: 34px; padding: 2px 10px; border-radius: 999px; background: var(--team); color: #1B2033;
  font: 800 16px var(--f-display); font-variant-numeric: tabular-nums; text-align: center;
}
.score.lead .score-name::after { content: " 👑"; }
.score.bump .score-points { animation: chip-pop .5s var(--spring); }
.score-float {
  position: absolute; right: 8px; top: -6px; font: 800 18px var(--f-display); color: var(--accent-text); pointer-events: none;
  animation: score-float .9s var(--ease-out) forwards;
}
@keyframes score-float { to { translate: 0 -34px; opacity: 0; } }
.score-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.score-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto 3ch auto auto; align-items: center; gap: 6px; }
.score-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--team); }
.score-field { min-width: 0; }
.score-value { text-align: center; font: 800 18px var(--f-display); font-variant-numeric: tabular-nums; }
.score-row .btn.icon-only { width: 36px; height: 36px; font-size: 18px; }
@media (max-width: 760px) {
  .score-strip { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; max-width: 100%; padding: 3px 2px; scrollbar-width: none; }
  .score-strip::-webkit-scrollbar { display: none; }
  .score { flex: none; gap: 7px; padding: 3px 4px 3px 11px; }
  .score-name { font-size: 13px; max-width: 10ch; }
  .score-points { font-size: 14px; min-width: 28px; padding: 1px 8px; }
}
.app.presenting .score { padding: .4vh .5vh .4vh 1.6vh; }
.app.presenting .score-name { font-size: clamp(14px, 2vh, 24px); max-width: 18ch; }
.app.presenting .score-points { font-size: clamp(16px, 2.6vh, 30px); min-width: 2.2em; }
.app.presenting .score-strip { pointer-events: auto; }

/* Embedded on someone's website: just the picker */
html[data-embed] .about, html[data-embed] #classBtn, html[data-embed] #shareBtn,
html[data-embed] [data-action="backup"], html[data-embed] .invite { display: none !important; }
.brand-link { display: inline-flex; align-items: center; gap: inherit; color: inherit; text-decoration: none; }
html[data-embed] .app { min-height: 480px; }

/* First-run tips */
.hint {
  position: fixed; z-index: 18; width: min(290px, calc(100vw - 24px)); padding: 12px 14px 10px; border-radius: 14px;
  background: var(--ink); color: #fff; box-shadow: var(--shadow-lg); font-size: 14.5px; line-height: 1.45;
  animation: pop-in .34s var(--spring);
}
.hint::after { /* the arrow, pointing at the control */
  content: ""; position: absolute; left: calc(var(--arrow, 50%) - 7px); bottom: -6px; width: 14px; height: 14px;
  background: var(--ink); transform: rotate(45deg); border-radius: 3px;
}
.hint.below::after { bottom: auto; top: -6px; }
.hint p { margin: 0; }
.hint-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 10px; }
.hint .link { color: #FFD27A; font-size: 13.5px; }
.hint .btn.primary { box-shadow: none; }

/* ---------- Presentation mode: the stage fills the screen, editing goes away, type gets big ---------- */
.present-exit, .present-hint { display: none; }
.app.presenting { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.app.presenting .editor, .app.presenting .dock, .app.presenting .starters,
.app.presenting .example-pill, .app.presenting .menu { display: none !important; }
/* While presenting, only the sound button stays from the top bar, beside Exit. */
.app.presenting .brand, .app.presenting #shareBtn { display: none; }
.app.presenting .bar { position: fixed; top: 14px; right: 116px; z-index: 10; padding: 0; opacity: .55; transition: opacity .2s; }
.app.presenting .bar:hover, .app.presenting .bar:focus-within { opacity: 1; }
.app.presenting.idle .bar { opacity: 0; }
.app.presenting .bar .sound-menu:not([hidden]) { display: grid !important; } /* the one menu kept while presenting */
.app.presenting .stage { grid-row: 1; padding: 2vh 3vw 3vh; }
.app.presenting .question { width: min(100%, 1400px); font-size: clamp(32px, 6vh, 76px); pointer-events: none; }
.app.presenting .wheel-wrap { width: min(100cqw, 100cqh); }
.app.presenting .wheel-wrap:not([data-format="wheel"]) { width: min(100cqw, calc(100cqh * 4 / 3), 1400px); }
.app.presenting .hub { font-size: clamp(18px, 3.4cqmin, 34px); }
.app.presenting .slot { min-height: clamp(136px, 26vh, 320px); }
.app.presenting .reveal { width: min(100%, 1400px); gap: 1vh; }
.app.presenting .reveal-name { font-size: clamp(48px, 12vh, 150px); }
.app.presenting .reveal-meta { font-size: clamp(16px, 2.4vh, 28px); }
.app.presenting .reveal-actions .btn { height: clamp(42px, 5.6vh, 60px); font-size: clamp(14.5px, 2vh, 20px); padding: 0 1.2em; }
.app.presenting .reveal[hidden] ~ .present-hint { display: block; margin: 0; color: var(--muted); font-size: clamp(15px, 2.2vh, 24px); }
.app.presenting .present-exit {
  display: inline-flex; align-items: center; gap: 8px; position: fixed; top: 14px; right: 14px; z-index: 10;
  height: 38px; padding: 0 12px 0 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); font-weight: 600; opacity: .55; transition: opacity .2s;
}
.app.presenting .present-exit:hover, .app.presenting .present-exit:focus-visible { opacity: 1; color: var(--ink); }
.app.presenting.idle { cursor: none; }
.app.presenting.idle .present-exit { opacity: 0; }

/* ---------- The show: presentation mode as a dark spotlight stage ---------- */
html:has(.app.presenting) body { background: #0E1024; }
.app.presenting {
  --ink: #FFF7EC; --muted: #B9B4CC; --surface: #23274A; --sunk: #1A1D38; --line: #3A3F66;
  position: relative; overflow: hidden; color: var(--ink);
  background: radial-gradient(120% 90% at 50% 38%, #2B2F5C 0%, #171A36 48%, #0B0C1C 100%);
}
.app.presenting .stage::before { /* the spotlight on the board */
  background:
    radial-gradient(closest-side at 50% 52%, rgba(255, 236, 200, .20), rgba(255, 236, 200, 0) 70%),
    conic-gradient(from 160deg at 50% -10%, transparent 0deg, rgba(255, 240, 210, .07) 12deg, rgba(255, 240, 210, .07) 28deg, transparent 40deg);
}
.app.presenting .wheel-wrap { filter: drop-shadow(0 0 40px rgba(255, 220, 160, .22)); }
.app.presenting .wheel-wrap::after { background: radial-gradient(closest-side, rgba(0, 0, 0, .45), transparent); }
.app.presenting .hub { background: #FFFFFF; color: #1B2033; box-shadow: 0 0 0 5px #1B2033, 0 6px 22px rgba(0, 0, 0, .5); }
.app.presenting .hub:disabled { color: #8A90A6; }
.app.presenting .question::placeholder { color: var(--ink); }
.app.presenting .reveal-name { text-shadow: 0 4px 30px rgba(0, 0, 0, .35); }
.app.presenting .btn:not(.primary):hover { background: #2C3158; border-color: #4A5080; }
.app.presenting kbd { background: transparent; border-color: #4A5080; color: var(--muted); }

/* Confetti dots drifting behind everything: faint on the light screen, brighter on the stage. */
.app { position: relative; }
.app > .bar { position: relative; z-index: 3; }
.app > .stage { z-index: 1; }
.app > .editor { position: relative; z-index: 2; }
.stage-fx { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; opacity: .55; }
.app.presenting .stage-fx { opacity: 1; }
.stage-fx span { position: absolute; bottom: -20px; border-radius: 50%; animation: drift linear infinite; }
@keyframes drift {
  0% { transform: translate(0, 0); }
  50% { transform: translate(24px, -55vh); }
  100% { transform: translate(-12px, -112vh); }
}

/* Title card: the class and the question, before the first pick */
.title-card {
  position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; align-content: center; gap: 4vh;
  padding: 4vh 4vw; text-align: center;
  background: radial-gradient(80% 70% at 50% 45%, rgba(23, 26, 54, .78), rgba(11, 12, 28, .94));
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fade .35s;
}
.title-card.leaving { animation: title-out .38s var(--ease-out) forwards; }
@keyframes title-out { to { opacity: 0; scale: 1.06; } }
.title-main { display: grid; gap: 1.6vh; cursor: pointer; }
.title-main > * { margin: 0; animation: rise .6s var(--ease-out) backwards; }
.title-main > :nth-child(2) { animation-delay: .08s; }
.title-main > :nth-child(3) { animation-delay: .16s; }
.title-main > :nth-child(4) { animation-delay: .5s; }
.title-class { font: 700 clamp(14px, 2.2vh, 22px) var(--f-body); letter-spacing: .14em; text-transform: uppercase; color: var(--accent-soft); }
.title-q { font: 800 clamp(40px, 10vh, 128px)/1.02 var(--f-display); letter-spacing: -.035em; text-wrap: balance; max-width: 18ch; }
.title-meta { font-size: clamp(16px, 2.6vh, 28px); color: var(--muted); font-variant-numeric: tabular-nums; }
.title-go { font-size: clamp(15px, 2.2vh, 22px); color: var(--ink); }
.title-go kbd { font-size: .8em; padding: 2px 8px; }
.show-options { display: grid; gap: 14px; }
.show-option { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; font-size: 14.5px; font-weight: 600; }
.title-card .show-options { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 28px; animation: fade .6s .6s backwards; }
.title-card .show-option { display: grid; gap: 6px; justify-items: center; font-size: 13.5px; color: var(--muted); }
.opt-group { display: flex; padding: 3px; border-radius: 999px; background: var(--sunk); border: 1px solid var(--line); }
.app.presenting .opt-group { background: rgba(255, 255, 255, .06); }
.opt-group button {
  border: 0; background: none; color: var(--muted); border-radius: 999px; padding: 6px 14px;
  font-size: 13.5px; font-weight: 700; transition: background .2s, color .2s;
}
.opt-group button:hover { color: var(--ink); }
.opt-group button[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); }

/* 3, 2, 1 */
.countdown { position: fixed; inset: 0; z-index: 25; display: grid; place-items: center; pointer-events: none; }
.countdown span {
  font: 800 clamp(120px, 34vh, 380px)/1 var(--f-display); color: #FFF7EC;
  text-shadow: 0 0 60px color-mix(in srgb, var(--accent) 70%, transparent), 0 4px 30px rgba(16, 20, 40, .35);
  -webkit-text-stroke: 3px var(--ink);
  animation: count-pop .72s var(--ease-out) both;
}
@keyframes count-pop { 0% { opacity: 0; scale: 1.8; } 25% { opacity: 1; scale: 1; } 80% { opacity: 1; } 100% { opacity: 0; scale: .8; } }

/* The winner moment: the stage dims and the name takes the whole screen for a beat */
.moment {
  position: fixed; inset: 0; z-index: 26; display: grid; place-items: center; pointer-events: none;
  background: rgba(8, 9, 20, .72); animation: fade .25s;
}
.moment.settling { background: transparent; transition: background .5s; }
.moment-confetti { position: absolute; inset: 0; width: 100%; height: 100%; }
.moment-name {
  position: relative; max-width: 92vw; text-align: center; overflow-wrap: normal; text-wrap: balance;
  font: 800 120px/1.05 var(--f-display); letter-spacing: -.04em; color: #FFF7EC;
  text-shadow: 0 6px 40px rgba(0, 0, 0, .4);
  animation: moment-in .6s var(--spring) both;
}
.moment-name span {
  padding: 0 .12em; -webkit-box-decoration-break: clone; box-decoration-break: clone;
  background: linear-gradient(transparent 68%, color-mix(in srgb, var(--win) 75%, transparent) 68%, color-mix(in srgb, var(--win) 75%, transparent) 90%, transparent 90%);
}
@keyframes moment-in { from { opacity: 0; scale: .35; } }

/* Think time */
.think { display: inline-flex; align-items: center; gap: 12px; margin-top: .6vh; color: var(--muted); animation: rise .4s var(--ease-out); }
.think-dial { position: relative; display: grid; place-items: center; width: clamp(54px, 8vh, 84px); aspect-ratio: 1; }
.think-dial svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.think-dial circle { fill: none; stroke-width: 4; }
.think-track { stroke: var(--line); }
.think-ring { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 100; animation: think-empty var(--secs) linear forwards; }
@keyframes think-empty { to { stroke-dashoffset: 100; } }
.think-dial > span { font: 800 clamp(20px, 3.2vh, 32px) var(--f-display); color: var(--ink); font-variant-numeric: tabular-nums; }
.think small { font-size: clamp(13px, 1.8vh, 18px); }
.think.done .think-dial > span { color: var(--accent-text); animation: chip-pop .5s var(--spring); }
.app.presenting .think.done .think-dial > span { color: #8EDBB0; }

/* Classroom timer: the sheet's time tiles, then the clock (big, or small in a corner) */
.timer-presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.timer-preset {
  display: grid; justify-items: center; gap: 2px; padding: 16px 6px 14px; border: 0; border-radius: 18px;
  background: color-mix(in srgb, var(--tile) 30%, #FFFFFF); color: var(--ink); cursor: pointer;
  box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--tile) 55%, transparent);
  transition: transform .14s var(--ease-out), background .15s;
}
.timer-preset:hover { background: color-mix(in srgb, var(--tile) 48%, #FFFFFF); }
.timer-preset:active { transform: scale(.95); }
.timer-preset strong { font: 800 34px/1 var(--f-display); letter-spacing: -.03em; }
.timer-preset span { font-size: 13px; font-weight: 600; color: #3D4256; }
.timer-own { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 10px 12px 10px 16px; border-radius: 16px; background: var(--sunk); font-weight: 600; font-size: 14.5px; }
.timer-stepper { display: flex; align-items: center; gap: 4px; }
.timer-stepper .btn { font-size: 22px; }
.timer-own-value { min-width: 3.4em; text-align: center; font: 800 24px var(--f-display); font-variant-numeric: tabular-nums; }
.sheet .timer-keys { margin-right: auto; align-self: center; font-size: 13px; }
@media (hover: none) { .sheet .timer-keys { visibility: hidden; } } /* no keyboard on a phone */

.timer {
  position: fixed; inset: 0; z-index: 19; display: grid; place-items: center; align-content: center; gap: 2.4vh;
  padding: 3vh 4vw calc(3vh + env(safe-area-inset-bottom, 0px)); text-align: center; outline: none;
  background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: fade .25s;
}
.timer-face { position: relative; display: grid; place-items: center; width: min(68vmin, 620px); aspect-ratio: 1; container-type: inline-size; }
.timer-ring, .timer-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.timer-ring svg { transform: rotate(-90deg); }
.timer-ring circle { fill: none; stroke-width: 6; }
.timer-track { stroke: var(--line); }
.timer-arc {
  stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 100;
  stroke-dashoffset: calc(100 - var(--left, 1) * 100); transition: stroke-dashoffset .25s linear, stroke .3s;
}
.timer-digits { position: relative; font: 800 27cqw/1 var(--f-display); letter-spacing: -.04em; font-variant-numeric: tabular-nums; color: var(--ink); }
.timer-label { margin: 0; font: 700 clamp(16px, 2.6vh, 26px) var(--f-body); color: var(--muted); }
.timer-controls, .timer-controls > div { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.timer-controls .btn { height: clamp(42px, 5.6vh, 60px); font-size: clamp(14.5px, 2vh, 20px); padding: 0 1.1em; }
.timer-controls .btn-icon svg { width: 1.1em; height: 1.1em; fill: currentColor; }
.timer-mini-controls { display: none; }
.timer.ending .timer-arc { stroke: #FF8A80; }
.timer.done .timer-arc { opacity: 0; } /* a round cap would leave a dot at the top */
.timer.done .timer-restart { display: none; } /* "Again" does the same */
.timer-confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.timer.mini .timer-confetti { display: none; }
.timer.paused .timer-digits { opacity: .45; }
.timer.done .timer-digits { color: var(--accent-text); animation: timer-up 1.2s var(--ease-out) 3; }
.timer.done .timer-label { color: var(--ink); font: 800 clamp(28px, 5vh, 56px) var(--f-display); letter-spacing: -.02em; }
@keyframes timer-up { 0%, 100% { scale: 1; } 30% { scale: 1.08; } }

/* Small: a chip under the question that keeps counting; tap the clock to bring it back */
.timer.mini {
  position: relative; inset: auto; z-index: auto;
  display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  backdrop-filter: none; -webkit-backdrop-filter: none; animation: pop-in .3s var(--spring);
}
.timer.mini .timer-face { width: auto; aspect-ratio: auto; container-type: normal; display: flex; align-items: center; gap: 8px; padding: 0 6px 0 0; cursor: pointer; }
.timer.mini .timer-ring { position: relative; display: block; width: 34px; height: 34px; }
.timer.mini .timer-ring circle { stroke-width: 12; }
.timer.mini .timer-digits { font-size: 22px; letter-spacing: -.02em; }
.timer.mini .timer-label, .timer.mini .timer-controls { display: none; }
.timer.mini .timer-mini-controls { display: flex; gap: 2px; }
.timer.mini.done .timer-digits { animation: none; }
.timer-mini-btn {
  display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: var(--sunk); color: var(--ink); font-size: 14px; cursor: pointer;
}
.timer-mini-btn:hover { background: var(--accent-soft); }
.timer-mini-btn svg { width: 16px; height: 16px; fill: currentColor; }

/* Spin several lists: choose lists (numbered in order), then one card per list */
.combo-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.combo-chip {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 6px 14px 6px 6px; border-radius: 999px;
  border: 0; background: var(--sunk); color: var(--ink); font-weight: 600; font-size: 14.5px; cursor: pointer;
  transition: transform .14s var(--ease-out), background .15s;
}
.combo-chip:active { transform: scale(.95); }
.combo-chip[aria-pressed="true"] { background: color-mix(in srgb, var(--tile) 34%, #FFFFFF); }
.combo-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-order {
  display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface); color: var(--muted); font: 800 14px var(--f-display);
}
.combo-chip[aria-pressed="true"] .combo-order { background: var(--tile); color: var(--ink); }
.combo-results { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 10px; }
.combo-card {
  display: grid; align-content: start; gap: 4px; padding: 14px 16px 16px; border-radius: 18px; min-height: 104px;
  background: color-mix(in srgb, var(--tile) 26%, #FFFFFF); box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--tile) 55%, transparent);
}
.combo-list { font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #3D4256; }
.combo-pick { font: 800 20px/1.15 var(--f-display); letter-spacing: -.02em; color: var(--ink); overflow-wrap: anywhere; text-wrap: balance; }
.combo-card.spinning .combo-pick { opacity: .55; }
.combo-card.landed .combo-pick { animation: chip-pop .5s var(--spring); }
.combo-card.empty .combo-pick { font: 600 15px var(--f-body); color: var(--muted); }

/* Seating chart: desks in rows under the front of the room; tap two to swap */
.sheet.wide { width: min(100%, 880px); }
.seat-room { display: grid; gap: 10px; }
.seat-front {
  justify-self: center; padding: 6px 28px; border-radius: 999px; background: var(--ink); color: #FFFFFF;
  font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.seat-scroll { overflow-x: auto; padding: 4px 2px 6px; }
.seat-grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(78px, 1fr)); gap: 8px; }
.desk {
  position: relative; display: grid; place-items: center; align-content: center; gap: 2px; min-height: 58px; padding: 8px 6px;
  border: 0; border-radius: 12px; cursor: pointer; text-align: center; color: var(--ink);
  background: color-mix(in srgb, var(--row) 26%, #FFFFFF); box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--row) 50%, transparent);
  transition: transform .14s var(--ease-out), box-shadow .15s;
}
.desk:hover { transform: translateY(-2px); }
.desk-name { font-weight: 700; font-size: 14px; line-height: 1.2; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.desk small { font-size: 11.5px; color: var(--muted); }
.desk.empty { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.desk.away .desk-name { opacity: .45; }
.desk.picked { box-shadow: 0 0 0 3px var(--accent), 0 8px 18px rgba(20, 26, 50, .16); transform: translateY(-3px); }
.desk.clash { box-shadow: inset 0 0 0 2px #E2574C; }
@media print {
  body.print-seating > :not(.modal), body.print-seating .scrim, body.print-seating .no-print { display: none !important; }
  body.print-seating { background: #FFFFFF; }
  body.print-seating .modal { position: static; display: block; padding: 0; }
  body.print-seating .sheet { width: 100%; max-height: none; overflow: visible; box-shadow: none; padding: 0; animation: none; }
  body.print-seating .seat-scroll { overflow: visible; }
  body.print-seating .desk { box-shadow: inset 0 0 0 1.5px #1B2033; background: #FFFFFF; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  body.print-seating .seat-front { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* On the full screen stage: dark, and the small chip is bigger and sits in the top left corner */
html:has(.app.presenting) .timer { background: radial-gradient(80% 70% at 50% 45%, rgba(23, 26, 54, .9), rgba(11, 12, 28, .97)); }
html:has(.app.presenting) .timer-digits { color: #FFF7EC; }
html:has(.app.presenting) .timer-track { stroke: rgba(255, 255, 255, .1); }
html:has(.app.presenting) .timer.done .timer-digits, html:has(.app.presenting) .timer.done .timer-label { color: #FFE07A; }
html:has(.app.presenting) .timer .btn:not(.primary) { background: transparent; border-color: #4A5080; color: #E8E9F3; }
html:has(.app.presenting) .timer .btn:not(.primary):hover { background: #2C3158; }
html:has(.app.presenting) .timer.mini { position: fixed; z-index: 10; inset: 14px auto auto 14px; background: #1B1F3B; border-color: #2C3158; }
html:has(.app.presenting) .timer.mini .timer-ring { width: clamp(40px, 6vh, 64px); height: clamp(40px, 6vh, 64px); }
html:has(.app.presenting) .timer.mini .timer-digits { font-size: clamp(26px, 5vh, 54px); }
html:has(.app.presenting) .timer-mini-btn { background: #2C3158; color: #E8E9F3; }
@media (max-width: 760px) {
  .timer-presets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .timer-own > span { flex-basis: 100%; }
  .combo-results { grid-template-columns: minmax(0, 1fr); }
  .combo-card { min-height: 0; padding: 10px 14px 12px; }
}

@media (max-width: 359px) { .brand-name { display: none; } } /* the logo alone on the narrowest phones */
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
  .bar { padding-top: 10px; }
  .pill span { display: none; }
  .pill { padding: 9px; }
  .editor {
    grid-column: 1; grid-row: 3; width: auto; overflow: auto;
    height: min(58vh, 500px); height: min(58dvh, 500px); /* % would not resolve in an auto grid row */
    border-left: 0; border-radius: 22px 22px 0 0; box-shadow: 0 -10px 40px rgba(20, 26, 50, .14);
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    animation: sheet-up .32s var(--ease-out);
  }
  .app.editing .slot, .app.editing .example-pill { display: none; }
  .app.editing .stage { padding-bottom: 8px; }
  .app.editing .question { font-size: 22px; }
  .grabber { display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: -6px auto 0; }
  .menu { bottom: 120px; }
  .modal { place-items: end center; padding: 0; }
  .sheet {
    width: 100%; max-height: 88%; border-radius: 22px 22px 0 0;
    padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
    animation: sheet-up .32s var(--ease-out);
  }
  .sheet-actions { justify-content: stretch; }
  .sheet-actions .btn { flex: 1; justify-content: center; }
}
@keyframes sheet-up { from { translate: 0 40px; opacity: 0; } }

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