/* Mr.Poll design system v2 (27 Oct 2026). Layout: light app shell, content on cards; projector and phone share the same tokens.
   Type: Archivo variable. Normal width for UI text; expanded width only for display numbers, join codes and the brand.
   Spacing: 4-point scale. Colour: one accent (signal blue) for actions; signal yellow only for brand, live and timers. */
@font-face { font-family: 'Archivo'; src: url('/fonts/archivo.woff2') format('woff2-variations'); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Archivo'; src: url('/fonts/archivo-ext.woff2') format('woff2-variations'); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  /* colour: neutrals carry a slight blue bias toward the accent */
  --bg: #f5f7fb; --surface: #ffffff; --surface-2: #eef1f7; --surface-3: #e4e8f1;
  --line: #e1e5ee; --line-strong: #c3c9d7;
  --ink: #111a2e; --ink-2: #3a4560; --muted: #59627a;
  --accent: #2b55e0; --accent-hover: #2147c4; --accent-ink: #ffffff; --accent-soft: #e9eefd; --accent-line: #b8c7f7;
  --brand: #f2b701; --on-brand: #111a2e;
  --ok: #0b7352; --ok-soft: #e3f4ec; --warn: #8a5600; --warn-soft: #fff3d6; --bad: #c0283a; --bad-soft: #fdeaec; --info-soft: #e9eefd;
  --live: #d42a3c;
  --focus: #2b55e0;
  --sidebar: #ffffff; --sidebar-ink: #3a4560; --overlay: rgba(17, 26, 46, .55);
  /* option colours: signal flags; text on them is white except yellow */
  --o0: #2b55e0; --o1: #d42a3c; --o2: #f2b701; --o3: #0b8a63; --o4: #7a4fd1; --o5: #d4661a; --o6: #0e8796; --o7: #b5357f; --o8: #6a7b13; --o9: #4e5d78;

  /* type */
  --f: 'Archivo', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --t-xs: .75rem;   /* 12  caption, kbd */
  --t-sm: .875rem;  /* 14  meta, hint, table */
  --t-md: 1rem;     /* 16  body, inputs, buttons */
  --t-lg: 1.125rem; /* 18  lead, list titles */
  --t-xl: 1.25rem;  /* 20  card titles (h3) */
  --t-2xl: 1.5rem;  /* 24  section titles (h2) */
  --t-3xl: 1.875rem;/* 30  page titles (h1) */
  --t-4xl: 2.5rem;  /* 40  timer, stats */
  --lh-tight: 1.2; --lh-snug: 1.35; --lh-body: 1.55;

  /* space (4-point) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px;

  /* shape and depth */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 20px; --r-pill: 999px;
  --e-1: 0 1px 2px rgba(17, 26, 46, .05), 0 1px 3px rgba(17, 26, 46, .06);
  --e-2: 0 4px 12px rgba(17, 26, 46, .08), 0 1px 3px rgba(17, 26, 46, .06);
  --e-3: 0 24px 64px rgba(17, 26, 46, .22);
  --control: 44px; --control-lg: 52px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1020; --surface: #121a2e; --surface-2: #19233b; --surface-3: #212d48;
    --line: #253150; --line-strong: #3a4769;
    --ink: #e8ecf6; --ink-2: #c3cbdd; --muted: #9ba5bd;
    --accent: #7d9bff; --accent-hover: #9cb3ff; --accent-ink: #0b1020; --accent-soft: #1b2850; --accent-line: #34478a;
    --ok: #3fcf9c; --ok-soft: #10302a; --warn: #f2c14e; --warn-soft: #36290c; --bad: #ff7a89; --bad-soft: #3a1520; --info-soft: #1b2850;
    --live: #c42a3b; --focus: #9cb3ff; --sidebar: #0e1528; --sidebar-ink: #c3cbdd; --overlay: rgba(0, 0, 0, .65);
    --o0: #6f8dff; --o1: #f0566c; --o2: #f2b701; --o3: #2fbf8f; --o4: #a48df0; --o5: #f08a4a; --o6: #45c0cc; --o7: #e07ab8; --o8: #b5c447; --o9: #8d9cba;
    --e-1: 0 1px 2px rgba(0, 0, 0, .35); --e-2: 0 6px 16px rgba(0, 0, 0, .4); --e-3: 0 24px 64px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1020; --surface: #121a2e; --surface-2: #19233b; --surface-3: #212d48;
  --line: #253150; --line-strong: #3a4769;
  --ink: #e8ecf6; --ink-2: #c3cbdd; --muted: #9ba5bd;
  --accent: #7d9bff; --accent-hover: #9cb3ff; --accent-ink: #0b1020; --accent-soft: #1b2850; --accent-line: #34478a;
  --ok: #3fcf9c; --ok-soft: #10302a; --warn: #f2c14e; --warn-soft: #36290c; --bad: #ff7a89; --bad-soft: #3a1520; --info-soft: #1b2850;
  --live: #c42a3b; --focus: #9cb3ff; --sidebar: #0e1528; --sidebar-ink: #c3cbdd; --overlay: rgba(0, 0, 0, .65);
  --o0: #6f8dff; --o1: #f0566c; --o2: #f2b701; --o3: #2fbf8f; --o4: #a48df0; --o5: #f08a4a; --o6: #45c0cc; --o7: #e07ab8; --o8: #b5c447; --o9: #8d9cba;
  --e-1: 0 1px 2px rgba(0, 0, 0, .35); --e-2: 0 6px 16px rgba(0, 0, 0, .4); --e-3: 0 24px 64px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 var(--t-md)/var(--lh-body) var(--f); font-stretch: 100%; overflow-wrap: anywhere; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: var(--lh-tight); letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: var(--t-3xl); }
h2 { font-size: var(--t-2xl); }
h3 { font-size: var(--t-xl); font-weight: 650; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--s-2); top: -64px; background: var(--accent); color: var(--accent-ink); padding: var(--s-3) var(--s-4); z-index: 1000; border-radius: var(--r-sm); font-weight: 600; }
.skip:focus { top: var(--s-2); }
.muted { color: var(--muted); }
.small { font-size: var(--t-sm); }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spread { display: flex; gap: var(--s-3); align-items: center; justify-content: space-between; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: var(--s-4); }
.stack.tight { gap: var(--s-1); }
.stack.loose { gap: var(--s-6); }
.grow { flex: 1 1 auto; min-width: 0; }
.mt { margin-top: var(--s-4); }
.bare { padding: 0; margin: 0; list-style: none; }
[hidden] { display: none !important; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: var(--control); padding: 0 var(--s-4); border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: 600 var(--t-md)/1.2 var(--f); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s; }
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary, .btn.go { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: var(--e-1); }
.btn.primary:hover, .btn.go:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn.danger { color: var(--bad); border-color: var(--line-strong); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.big { min-height: var(--control-lg); padding: 0 var(--s-6); font-size: var(--t-lg); border-radius: var(--r-md); }
.btn.icon { padding: 0; width: var(--control); }
.btn svg { width: 20px; height: 20px; flex: none; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; font-weight: 600; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.field > label, .legend { font-weight: 600; font-size: var(--t-sm); color: var(--ink-2); }
.hint { font-size: var(--t-sm); color: var(--muted); line-height: var(--lh-snug); }
.err { font-size: var(--t-sm); color: var(--bad); font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; min-height: var(--control); padding: 0 var(--s-3); border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: 400 var(--t-md)/1.4 var(--f); transition: border-color .15s, box-shadow .15s;
}
textarea { padding: var(--s-3); min-height: 96px; resize: vertical; }
select { padding-right: var(--s-8); appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--ink-2); cursor: default; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.check { display: flex; gap: var(--s-3); align-items: center; min-height: var(--control); cursor: pointer; font-size: var(--t-md); }
.check input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.grid2, .grid3 { display: grid; gap: var(--s-4); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset > legend.legend { padding: 0; margin-bottom: var(--s-3); font-size: var(--t-md); color: var(--ink); }
details > summary { list-style: none; display: inline-flex; min-height: var(--control); align-items: center; gap: var(--s-2); }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: '+'; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: var(--t-sm); }
details[open] > summary::before { content: '–'; }

/* segmented control (tabs) */
.seg { display: inline-flex; gap: var(--s-1); padding: var(--s-1); background: var(--surface-2); border-radius: var(--r-md); flex-wrap: wrap; }
.seg button { min-height: 36px; padding: 0 var(--s-4); border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink-2); font: 600 var(--t-sm) var(--f); cursor: pointer; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--e-1); }
@media (pointer: coarse) { .seg button { min-height: var(--control); } }

/* ---------- surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s-6); box-shadow: var(--e-1); }
.panel h2 { font-size: var(--t-xl); }
.panel h2 + *, .panel h3 + * { margin-top: var(--s-3); }
@media (max-width: 599px) { .panel { padding: var(--s-4); border-radius: var(--r-md); } }
.note { padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--info-soft); color: var(--ink); font-size: var(--t-sm); line-height: var(--lh-body); border: 1px solid var(--accent-line); }
.note.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.note.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.note.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.pill { display: inline-flex; align-items: center; gap: var(--s-1); min-height: 24px; padding: 0 var(--s-3); border-radius: var(--r-pill); font-size: var(--t-xs); font-weight: 600; letter-spacing: .01em; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.pill.live { background: var(--live); color: #fff; }
.pill.lobby { background: var(--warn-soft); color: var(--warn); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.live.dot::before { animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .35; } }
.empty { padding: var(--s-10) var(--s-6); border: 1px dashed var(--line-strong); border-radius: var(--r-lg); background: var(--surface); display: flex; flex-direction: column; gap: var(--s-3); align-items: flex-start; }
.empty h2 { font-size: var(--t-xl); }
table { border-collapse: collapse; width: 100%; font-size: var(--t-sm); }
th, td { text-align: left; padding: var(--s-3); border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: var(--t-xs); letter-spacing: .02em; }
tbody tr:hover { background: var(--surface-2); }
.tscroll { overflow-x: auto; }

/* ---------- trainer shell ---------- */
.shell { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }
.topbar { background: var(--surface); color: var(--ink); display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-3); position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: var(--s-3); color: var(--ink); text-decoration: none; font-weight: 800; font-stretch: 115%; font-size: var(--t-xl); letter-spacing: -.02em; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 32px; height: 32px; flex: none; border-radius: var(--r-sm); }
.brand.on-paper { color: var(--ink); }
.nav { display: flex; }
.nav a { display: flex; align-items: center; gap: var(--s-3); color: var(--sidebar-ink); text-decoration: none; padding: 0 var(--s-3); border-radius: var(--r-md); font-weight: 600; font-size: var(--t-md); min-height: var(--control); }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav svg { width: 20px; height: 20px; }
.bottomnav { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); z-index: 20; padding: var(--s-1) var(--s-2) calc(var(--s-1) + env(safe-area-inset-bottom)); gap: var(--s-1); }
.bottomnav a { flex-direction: column; gap: 2px; font-size: var(--t-xs); justify-content: center; padding: var(--s-1); min-height: 56px; }
.sidenav { display: none; }
.whoami { padding: 0 var(--s-3); color: var(--muted); font-size: var(--t-sm); }
main.page { padding: var(--s-6) var(--s-4) var(--s-10); max-width: 1200px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: var(--s-6); min-width: 0; }
main.page.wide { max-width: 1440px; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s-4); flex-wrap: wrap; }
.pagehead p.muted { font-size: var(--t-md); }
@media (min-width: 960px) {
  .shell { grid-template-columns: 248px minmax(0, 1fr); grid-template-rows: 1fr; }
  .topbar.mobile, .bottomnav { display: none; }
  .sidenav { display: flex; flex-direction: column; gap: var(--s-1); background: var(--sidebar); border-right: 1px solid var(--line); padding: var(--s-5) var(--s-3); position: sticky; top: 0; height: 100vh; }
  .sidenav .brand { padding: 0 var(--s-3) var(--s-6); }
  .sidenav .nav { flex-direction: column; gap: var(--s-1); }
  .sidenav .foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--s-1); border-top: 1px solid var(--line); padding-top: var(--s-3); }
  .sidenav .foot .whoami { padding: var(--s-2) var(--s-3); font-weight: 600; color: var(--ink-2); }
  .sidenav .btn.ghost { justify-content: flex-start; padding: 0 var(--s-3); font-size: var(--t-sm); color: var(--sidebar-ink); }
  main.page { padding: var(--s-8) var(--s-10) var(--s-12); }
}

/* lists */
.list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--e-1); overflow: hidden; }
.item { display: flex; gap: var(--s-4); padding: var(--s-4) var(--s-5); align-items: center; flex-wrap: wrap; transition: background-color .15s; }
.item:hover { background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
.item + .item { border-top: 1px solid var(--line); }
.item .title { font-weight: 650; font-size: var(--t-lg); color: var(--ink); text-decoration: none; line-height: var(--lh-snug); }
a.title:hover { color: var(--accent); text-decoration: underline; }
.item .meta { color: var(--muted); font-size: var(--t-sm); display: flex; gap: var(--s-1) var(--s-4); flex-wrap: wrap; align-items: center; margin-top: var(--s-1); }

/* option chips */
.chip { --c: var(--o0); width: 32px; height: 32px; border-radius: var(--r-sm); display: inline-grid; place-items: center; flex: none; background: var(--c); color: #fff; font-weight: 700; font-size: var(--t-sm); }
.c0 { --c: var(--o0); } .c1 { --c: var(--o1); } .c2 { --c: var(--o2); } .c3 { --c: var(--o3); } .c4 { --c: var(--o4); }
.c5 { --c: var(--o5); } .c6 { --c: var(--o6); } .c7 { --c: var(--o7); } .c8 { --c: var(--o8); } .c9 { --c: var(--o9); }
.c2.chip, .c2 .chip { color: var(--on-brand); }

/* ---------- editor ---------- */
.toolbar { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); padding: var(--s-3) 0; display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-top: calc(-1 * var(--s-3)); }
@media (max-width: 959px) { .toolbar { position: static; } }
.savestate { font-size: var(--t-sm); color: var(--muted); display: inline-flex; align-items: center; gap: var(--s-2); }
.savestate::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.savestate.bad { color: var(--bad); font-weight: 600; }
.savestate.bad::before { background: var(--bad); }
.formfs { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: var(--s-6); }
.formfs.ro .qcard header .btn.icon { display: none; }
.qcard { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--e-1); transition: border-color .15s, box-shadow .15s; }
.qcard:focus-within { border-color: var(--accent-line); }
.qcard > header { display: flex; gap: var(--s-2); align-items: center; padding: var(--s-2) var(--s-3) var(--s-2) var(--s-4); flex-wrap: wrap; }
.qcard:not(.collapsed) > header { border-bottom: 1px solid var(--line); }
.qcard .qnum { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-sm); background: var(--surface-2); font-weight: 700; font-size: var(--t-sm); color: var(--ink-2); flex: none; }
.qcard header .btn.grow { justify-content: flex-start; gap: var(--s-3); font-weight: 600; color: var(--ink); padding: 0 var(--s-2); }
.qtitle { text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qcard .qbody { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-5); }
.qcard.collapsed .qbody { display: none; }
.qcard.has-issue { border-color: color-mix(in srgb, var(--bad) 60%, var(--line)); }
.qcard.has-issue .qnum { background: var(--bad-soft); color: var(--bad); }
.optrow { display: flex; gap: var(--s-2); align-items: center; }
.optrow input[type=text] { flex: 1; }
.preview-phone { min-height: auto; border: 1px solid var(--line); border-radius: var(--r-xl); overflow: hidden; max-width: 390px; margin: 0 auto; box-shadow: var(--e-2); }

/* dialog */
dialog { border: 1px solid var(--line); border-radius: var(--r-xl); padding: 0; background: var(--surface); color: var(--ink); width: min(600px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: var(--e-3); }
dialog::backdrop { background: var(--overlay); backdrop-filter: blur(2px); }
dialog[open] { animation: pop .18s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
dialog .dhead { padding: var(--s-6) var(--s-6) 0; display: flex; justify-content: space-between; gap: var(--s-3); align-items: flex-start; }
dialog .dhead h2 { font-size: var(--t-xl); }
dialog .dbody { padding: var(--s-4) var(--s-6); display: flex; flex-direction: column; gap: var(--s-4); overflow: auto; font-size: var(--t-md); }
dialog .dfoot { padding: var(--s-2) var(--s-6) var(--s-6); display: flex; gap: var(--s-2); justify-content: flex-end; flex-wrap: wrap; }
dialog.wide { width: min(960px, calc(100vw - 24px)); }
dialog .list { box-shadow: none; }

/* toasts */
.toasts { position: fixed; z-index: 2000; left: 50%; transform: translateX(-50%); bottom: 84px; display: flex; flex-direction: column; gap: var(--s-2); width: min(480px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: var(--ink); color: var(--surface); padding: var(--s-3) var(--s-4); border-radius: var(--r-md); box-shadow: var(--e-2); pointer-events: auto; font-size: var(--t-sm); font-weight: 500; animation: pop .2s var(--ease); }
.toast.bad { background: var(--bad); color: #fff; }
@media (min-width: 960px) { .toasts { bottom: var(--s-6); } }

/* ---------- host control ---------- */
.host { display: grid; gap: var(--s-5); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .host { grid-template-columns: 280px minmax(0, 1fr) 280px; align-items: start; } .host .col-side { position: sticky; top: var(--s-5); } }
.host > .panel { padding: var(--s-5); }
.joinbox { display: flex; gap: var(--s-6); align-items: center; flex-wrap: wrap; }
.joincode { font-size: var(--t-3xl); font-weight: 800; font-stretch: 120%; letter-spacing: .1em; line-height: 1; }
.stage { display: flex; flex-direction: column; gap: var(--s-5); }
.stage .prompt { font-size: var(--t-2xl); font-weight: 700; line-height: var(--lh-tight); letter-spacing: -.01em; }
.controls { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.agenda { display: flex; flex-direction: column; gap: 2px; padding: 0; margin: 0; }
.agenda li { list-style: none; }
.agenda .aq { width: 100%; display: flex; gap: var(--s-3); align-items: flex-start; text-align: left; padding: var(--s-3); min-height: var(--control); border: 0; border-radius: var(--r-md); background: transparent; color: var(--ink); font: 500 var(--t-sm)/var(--lh-snug) var(--f); cursor: pointer; }
.agenda .aq:hover { background: var(--surface-2); }
.agenda .aq[aria-current="true"] { background: var(--accent-soft); color: var(--ink); }
.agenda .aq[aria-current="true"] .n { background: var(--accent); color: var(--accent-ink); }
.agenda .aq .n { display: inline-grid; place-items: center; min-width: 24px; height: 24px; border-radius: var(--r-pill); background: var(--surface-2); font-weight: 700; font-size: var(--t-xs); flex: none; }
.agenda .aq .grow .small { font-size: var(--t-xs); }
.agenda .aq .done { margin-left: auto; color: var(--ok); font-weight: 600; font-size: var(--t-xs); white-space: nowrap; }
.people { display: flex; flex-direction: column; max-height: 60vh; overflow: auto; }
.person { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) 0; min-height: var(--control); border-bottom: 1px solid var(--line); }
.person:last-child { border-bottom: 0; }
.person .nm { flex: 1; min-width: 0; font-weight: 500; line-height: var(--lh-snug); }
.person .nm .small { font-weight: 400; }
.state-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--line-strong); }
.state-dot.yes { background: var(--ok); }
.state-dot.away { background: transparent; border: 2px dashed var(--line-strong); }
.state-dot.waiting { background: var(--brand); animation: nudge 1.8s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { box-shadow: 0 0 0 0 rgba(242, 183, 1, .55); } 50% { box-shadow: 0 0 0 6px rgba(242, 183, 1, 0); } }
.progress { height: 8px; background: var(--surface-2); border-radius: var(--r-pill); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--ok); border-radius: inherit; transition: width .4s var(--ease); }
.bigtime { font-size: var(--t-4xl); font-weight: 800; font-stretch: 115%; line-height: 1; font-variant-numeric: tabular-nums; }
.bigtime.low { color: var(--live); }
.kbd { font-size: var(--t-xs); color: var(--muted); line-height: 2; }
kbd { font: 600 var(--t-xs) var(--f); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; padding: 0 6px; background: var(--surface); color: var(--ink-2); }
.slidestrip { display: flex; gap: var(--s-2); overflow-x: auto; padding: var(--s-1) var(--s-1) var(--s-2); }
.slidestrip button { flex: none; width: 120px; border: 2px solid var(--line); border-radius: var(--r-md); padding: 0; background: var(--surface-2); cursor: pointer; position: relative; color: var(--ink); overflow: hidden; }
.slidestrip button[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.slidestrip img { width: 100%; aspect-ratio: 16/9; object-fit: contain; background: #fff; }
.slidestrip span { display: block; font-size: var(--t-xs); padding: var(--s-1) var(--s-2); font-weight: 600; text-align: left; }
.slidestrip .linked { position: absolute; top: var(--s-1); right: var(--s-1); background: var(--brand); color: var(--on-brand); font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: var(--r-pill); }

/* ---------- results (host, projector, phone) ---------- */
.results { display: flex; flex-direction: column; gap: var(--s-3); }
.results > p.muted { font-size: var(--t-sm); }
.bar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s-3); align-items: center; padding: var(--s-1) 0; }
.bar .lbl { display: flex; flex-direction: column; gap: var(--s-1); min-width: 0; }
.bar .lbltext { font-weight: 600; line-height: var(--lh-snug); }
.bar .track { height: 10px; background: var(--surface-2); border-radius: var(--r-pill); overflow: hidden; }
.bar .fill { display: block; height: 100%; background: var(--c); border-radius: inherit; transition: width .7s var(--ease); }
.bar .val { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; min-width: 4.5em; }
.bar .val .small { font-weight: 500; }
.bar.correct .lbltext::after { content: '  ✓ correct'; color: var(--ok); font-weight: 700; font-size: .85em; }
.bar.mine { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: var(--r-sm); }
.bar.dim .fill { opacity: .35; }
.bar.dim .lbltext { font-weight: 500; color: var(--muted); }
.bar.dim .chip { opacity: .55; }
.names { font-size: var(--t-sm); color: var(--muted); }
.texts { columns: 1; column-gap: var(--s-3); }
@media (min-width: 720px) { .texts { columns: 2; } }
.texts.capped { max-height: 420px; overflow: auto; }
.textcard { break-inside: avoid; margin: 0 0 var(--s-3); padding: var(--s-3) var(--s-4); background: var(--surface-2); border-radius: var(--r-md); line-height: var(--lh-body); }
.textcard .by { font-size: var(--t-sm); color: var(--muted); margin-top: var(--s-2); font-weight: 600; }
.ratingbars { display: flex; gap: var(--s-2); align-items: flex-end; height: 160px; }
.ratingbars .rb { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: var(--s-1); height: 100%; font-size: var(--t-sm); }
.ratingbars .rb i { display: block; width: 100%; background: var(--accent); border-radius: var(--r-sm) var(--r-sm) 2px 2px; min-height: 3px; transition: height .7s var(--ease); }
.ratingbars .rb b { font-variant-numeric: tabular-nums; }
.ratingbars .rb span { font-weight: 700; }
.statline { display: flex; gap: var(--s-8); flex-wrap: wrap; align-items: flex-end; }
.stat b { font-size: var(--t-3xl); font-weight: 800; font-stretch: 112%; font-variant-numeric: tabular-nums; display: block; line-height: 1.05; }
.stat span { color: var(--muted); font-size: var(--t-sm); }

/* ---------- participant phone ---------- */
.phone { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.phone header.p-head { background: var(--surface); color: var(--ink); padding: var(--s-3) var(--s-4); display: flex; align-items: center; gap: var(--s-3); border-bottom: 1px solid var(--line); }
.phone header.p-head .brand { font-size: var(--t-lg); }
.phone header.p-head .brand-mark { width: 28px; height: 28px; }
.phone header .who { margin-left: auto; font-size: var(--t-sm); text-align: right; font-weight: 600; line-height: var(--lh-snug); }
.phone header .who .muted { color: var(--muted); font-weight: 400; font-size: var(--t-xs); }
.phone main { flex: 1; padding: var(--s-5) var(--s-4) var(--s-6); display: flex; flex-direction: column; gap: var(--s-5); max-width: 600px; width: 100%; margin: 0 auto; }
.phone main h1 { font-size: var(--t-2xl); }
.fuse { height: 4px; background: var(--surface-3); position: relative; overflow: hidden; }
.fuse > i { position: absolute; inset: 0 auto 0 0; background: var(--brand); border-radius: 0 var(--r-pill) var(--r-pill) 0; transition: width .25s linear; }
.fuse.low > i { background: var(--live); }
.fuse.paused > i { background: var(--line-strong); }
.p-timer { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: var(--t-sm); color: var(--muted); }
.p-timer .t { display: inline-flex; align-items: center; min-height: 32px; padding: 0 var(--s-3); border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-size: var(--t-lg); font-weight: 700; font-stretch: 110%; font-variant-numeric: tabular-nums; }
.p-prompt { font-size: var(--t-2xl); font-weight: 700; line-height: var(--lh-tight); letter-spacing: -.01em; }
.optlist { display: flex; flex-direction: column; gap: var(--s-3); }
.opt { display: flex; align-items: center; gap: var(--s-3); width: 100%; min-height: 60px; padding: var(--s-3) var(--s-4) var(--s-3) var(--s-3); border: 1.5px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--ink); font: 500 var(--t-md)/var(--lh-snug) var(--f); text-align: left; cursor: pointer; box-shadow: var(--e-1); transition: border-color .15s, background-color .15s, box-shadow .15s; }
.opt:hover { border-color: var(--line-strong); }
.opt[aria-checked="true"], .opt[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.opt .tick { margin-left: auto; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-strong); flex: none; display: grid; place-items: center; transition: background-color .15s, border-color .15s; }
.opt[aria-pressed] .tick { border-radius: 7px; }
.opt[aria-checked="true"] .tick, .opt[aria-pressed="true"] .tick { background: var(--accent); border-color: var(--accent); }
.opt[aria-checked="true"] .tick::after, .opt[aria-pressed="true"] .tick::after { content: ''; width: 10px; height: 6px; border: 2.5px solid var(--accent-ink); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.opt:disabled { cursor: default; box-shadow: none; }
.opt:disabled:not([aria-checked="true"]):not([aria-pressed="true"]) { opacity: .6; }
.scale { display: grid; grid-template-columns: repeat(auto-fit, minmax(48px, 1fr)); gap: var(--s-2); }
.scale .opt { justify-content: center; font-size: var(--t-xl); font-weight: 700; min-height: 56px; padding: var(--s-2); border-radius: var(--r-md); }
.submitbar { position: sticky; bottom: 0; padding: var(--s-3) var(--s-4) calc(var(--s-3) + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: var(--s-2); }
.submitbar .btn { width: 100%; max-width: 568px; align-self: center; }
.sent { display: flex; gap: var(--s-3); align-items: center; padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--ok-soft); color: var(--ink); font-weight: 600; font-size: var(--t-sm); max-width: 568px; width: 100%; align-self: center; }
.sent svg { color: var(--ok); width: 22px; height: 22px; flex: none; }
.privacy { display: flex; gap: var(--s-2); align-items: flex-start; font-size: var(--t-sm); color: var(--ink-2); background: var(--surface-2); padding: var(--s-3); border-radius: var(--r-md); line-height: var(--lh-snug); }
.privacy svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--muted); }
.banner { padding: var(--s-2) var(--s-4); background: var(--warn-soft); color: var(--ink); font-weight: 600; font-size: var(--t-sm); text-align: center; }
.waiting-art { display: grid; place-items: center; padding: var(--s-8) 0 var(--s-2); }
.flags { display: flex; gap: var(--s-2); }
.flags i { width: 20px; height: 28px; border-radius: 4px; background: var(--c); animation: wave 2.4s ease-in-out infinite; transform-origin: left center; }
.flags i:nth-child(2) { animation-delay: .2s; } .flags i:nth-child(3) { animation-delay: .4s; } .flags i:nth-child(4) { animation-delay: .6s; }
@keyframes wave { 0%, 100% { transform: scaleX(1); } 50% { transform: scaleX(.72); } }
.slideview { background: #000; border-radius: var(--r-lg); overflow: auto; touch-action: pan-x pan-y pinch-zoom; max-height: 70vh; box-shadow: var(--e-2); }
.slideview img { width: 100%; height: auto; margin: 0 auto; }
.slideview.zoom img { width: 200%; max-width: none; }
.center-page { min-height: 100vh; display: grid; place-items: center; padding: var(--s-4); background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.narrow { max-width: 440px; width: 100%; }
.center-page .panel { box-shadow: var(--e-2); padding: var(--s-8); }
@media (max-width: 599px) { .center-page .panel { padding: var(--s-6) var(--s-5); } }

/* ---------- projector ---------- */
.present { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); font-size: clamp(16px, 1.4vw, 30px); }
.present .fuse { height: max(6px, .6vh); }
.present .pbar { display: flex; justify-content: space-between; align-items: center; padding: 1.6vh 3vw; gap: 2vw; }
.present .pbar .brand { font-size: 1.15em; }
.present .pbar .brand-mark { width: 1.6em; height: 1.6em; }
.present .pbar .joinhint { font-size: 1em; color: var(--ink-2); padding: .35em .9em; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line); }
.present .pbar .joinhint b { color: var(--ink); font-stretch: 118%; letter-spacing: .08em; }
.present .pbar .btn { font-size: var(--t-sm); }
.present .pmain { flex: 1; display: flex; flex-direction: column; gap: 3.2vh; padding: 2vh 5vw 5vh; min-height: 0; }
.present .ptitle { font-size: 2.5em; font-weight: 750; line-height: 1.12; letter-spacing: -.015em; max-width: 42ch; }
.present .note { font-size: .85em; padding: .7em 1em; }
.present .pdesc { font-size: 1.1em; color: var(--ink-2); max-width: 60ch; }
.present .popts { display: grid; gap: 1.4vh 1.6vw; grid-template-columns: 1fr; }
@media (min-aspect-ratio: 4/3) { .present .popts.two { grid-template-columns: 1fr 1fr; } }
.present .popt { display: flex; gap: .8em; align-items: center; padding: .65em .9em; background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--line); box-shadow: var(--e-1); font-size: 1.3em; font-weight: 600; }
.present .chip { width: 1.8em; height: 1.8em; font-size: .9em; border-radius: .4em; }
.present .pcount { display: flex; align-items: baseline; gap: .4em; font-size: 1.1em; color: var(--ink-2); }
.present .pcount b { font-size: 2em; font-weight: 800; font-stretch: 115%; font-variant-numeric: tabular-nums; color: var(--ink); }
.present .ptime { font-size: 3.6em; font-weight: 800; font-stretch: 118%; font-variant-numeric: tabular-nums; line-height: 1; }
.present .ptime.low { color: var(--live); }
.present .results { gap: 1.6vh; font-size: 1.2em; }
.present .bar { gap: .7em; }
.present .bar .track { height: max(12px, 1.4vh); }
.present .chip + .lbl .lbltext { font-weight: 600; }
.present .stat b { font-size: 2.2em; }
.present .stat span { font-size: .7em; }
.present .bar .val .small, .present .bar .names { font-size: .7em; }
.present .results > p.muted { font-size: .8em; }
.present .lobby { display: grid; gap: 5vw; grid-template-columns: 1fr; align-items: center; flex: 1; }
@media (min-aspect-ratio: 4/3) { .present .lobby { grid-template-columns: auto 1fr; } }
.present .qr { background: #fff; padding: 1.4vw; border-radius: var(--r-xl); width: min(38vh, 40vw); aspect-ratio: 1; box-shadow: var(--e-2); }
.present .qr img { width: 100%; height: 100%; }
.present .joinurl { font-size: 1.5em; font-weight: 600; color: var(--ink-2); }
.present .bigcode { font-size: 5.5em; font-weight: 800; font-stretch: 125%; letter-spacing: .08em; line-height: 1; }
.present .slidefull { flex: 1; display: grid; place-items: center; min-height: 0; padding: 0 2vw 2vh; }
.present .slidefull img { max-height: 84vh; max-width: 100%; object-fit: contain; background: #fff; border-radius: var(--r-md); box-shadow: var(--e-2); }
.present .overlay-paused { font-size: 1.1em; font-weight: 700; background: var(--warn-soft); color: var(--warn); padding: .35em .9em; border-radius: var(--r-pill); align-self: flex-start; }

/* misc */
.deckthumb { width: 120px; aspect-ratio: 16/9; object-fit: contain; background: #fff; border-radius: var(--r-sm); border: 1px solid var(--line); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print { .sidenav, .topbar, .bottomnav, .toolbar, .btn { display: none !important; } }
.formh1 { font-size: var(--t-3xl); }
@media (max-width: 599px) { .formh1 { font-size: var(--t-2xl); } h1 { font-size: var(--t-2xl); } }
