/* 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);
  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 { 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-text); color: var(--accent); }
.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; justify-content: center; gap: 8px; flex-wrap: wrap; }
.dock-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 44px;
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 0 18px 0 15px; font-size: 14.5px; font-weight: 600;
  box-shadow: 0 1px 2px rgba(20, 26, 50, .05);
  transition: border-color .15s, color .15s, transform .15s;
}
.dock-btn svg { width: 17px; height: 17px; }
.dock-btn:hover { border-color: var(--accent-text); color: var(--accent); }
.dock-btn.icon { width: 44px; 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); }
.kbd-hint { display: none; font-size: 13px; color: var(--muted); margin-left: 6px; }
@media (hover: hover) and (pointer: fine) { .kbd-hint { display: inline; } }
@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);
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.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; }
.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-text); color: var(--accent); }
.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: rise .2s var(--ease-out);
}
.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 { transform: translateX(24px); 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); }
.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-row { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; font-weight: 500; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.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);
}
.switch-row input:checked + .switch { background: var(--accent); }
.switch-row input:checked + .switch::after { transform: translateX(16px); }
.switch-row input:focus-visible + .switch { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.tag {
  display: inline-block; margin-left: 4px; font-size: 11px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--accent-text); background: var(--accent-soft); border-radius: 5px; padding: 1px 6px;
  vertical-align: 1px;
}
.picked { font-size: 13.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }

/* ---------- 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: rise .3s var(--ease-out);
}
.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: rise .25s var(--ease-out);
}
.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; }
.app.presenting ~ .about { display: 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: 6; 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: 6;
  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; }

@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 { transform: translateY(40px); opacity: 0; } }

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