/* The room poll — Syncops' own theme (docs/showcase/slide-pack/brand/tokens.json, the Wheel template's
   tokens): light by default, dark from the phone's preference. Outfit, self-hosted (no font request leaves
   for a third party). Motion only when the phone allows it. */

@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/outfit-latin-wght-normal.woff2") format("woff2-variations"),
       url("/fonts/outfit-latin-wght-normal.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --bg: #F5F2FB; --card: #FFFFFF; --soft: #EFEBF8; --line: #E2DCF0; --line-strong: #8D86A8;
  --ink: #1F1B36; --ink2: #4F4A6C; --ink3: #635E80;
  --need: #9A4A00; --need-bg: #FFE6BF;
  --work: #0B67A0; --work-bg: #D5ECFF; --work-hi: #38A8F0;
  --block: #B3243D; --block-bg: #FFDCE3; --block-hi: #F2557A;
  --done: #04785A; --done-bg: #D2F4E4; --done-hi: #2CC68A;
  --ok: #0E766D; --ok-bg: #D0F2EE;
  --idle: #635E80; --idle-bg: #ECE8F5;
  --accent: #5B3BD9; --accent-on: #FFFFFF; --accent-fg: #5B3BD9; --accent-bg: #ECE6FF; --accent-hi: #6A4BE6;
  --grad: linear-gradient(135deg, #6642E6, #3D8CF0 55%, #00D4FF);
  --shadow: 0 4px 14px rgba(60, 40, 120, .06);
  --lift: 0 20px 50px rgba(60, 40, 120, .18);
  --accent-shadow: 0 6px 16px rgba(91, 59, 217, .32);
  --tile-shadow: 0 6px 16px rgba(60, 40, 120, .1);
  --edge: 0 0 0 0 transparent;
  --dlg: #FFFFFF; --scrim: rgba(31, 27, 54, .34);
  --focus: #1F82C4;
  --wash: radial-gradient(600px 420px at 8% 0%, #FFE9D6 0, transparent 70%),
          radial-gradient(640px 480px at 100% 100%, #D9F3EC 0, transparent 70%),
          radial-gradient(700px 520px at 50% 50%, #ECE6FF 0, transparent 70%);
  --font: Outfit, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-2xs: 12px; --fs-xs: 13px; --fs-sm: 14px; --fs-base: 16px; --fs-lg: 18px; --fs-xl: 20px; --fs-2xl: 22px;
  --r-sm: 12px; --r-tile: 14px; --r-md: 16px; --r-card: 22px; --r-pill: 99px; --r-dlg: 28px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0D0F1A; --card: #161927; --soft: #1F2333; --line: #2A2F44; --line-strong: #646B86;
    --ink: #F1F2F8; --ink2: #C5C9DA; --ink3: #9AA0B8;
    --need: #FFC857; --need-bg: rgba(255, 176, 32, .14);
    --work: #6CB8FF; --work-bg: rgba(56, 168, 240, .16); --work-hi: #38A8F0;
    --block: #FF7A90; --block-bg: rgba(242, 85, 122, .16); --block-hi: #F2557A;
    --done: #4ADE9B; --done-bg: rgba(44, 198, 138, .16); --done-hi: #2CC68A;
    --ok: #4FD1C5; --ok-bg: rgba(20, 184, 166, .14);
    --idle: #9AA0B8; --idle-bg: rgba(154, 160, 184, .12);
    --accent: #6A4BE6; --accent-on: #FFFFFF; --accent-fg: #B9A8FF; --accent-bg: rgba(106, 75, 230, .22); --accent-hi: #7A5CF0;
    --shadow: 0 4px 14px rgba(0, 0, 0, .28);
    --lift: 0 20px 50px rgba(0, 0, 0, .45);
    --accent-shadow: 0 6px 18px rgba(106, 75, 230, .36);
    --tile-shadow: 0 0 0 1px #2A2F44, 0 6px 16px rgba(0, 0, 0, .3);
    --edge: inset 0 0 0 1px #2A2F44;
    --dlg: #181B2A; --scrim: rgba(5, 6, 12, .62);
    --focus: #38A8F0;
    --wash: radial-gradient(600px 420px at 8% 0%, rgba(255, 170, 110, .07), transparent 70%),
            radial-gradient(640px 480px at 100% 100%, rgba(45, 200, 160, .06), transparent 70%),
            radial-gradient(700px 520px at 50% 50%, rgba(106, 75, 230, .10), transparent 70%);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg);
  background-image: var(--wash);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--ink);
  font: 400 var(--fs-base)/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
img { display: block; max-width: 100%; }
a { color: var(--accent-fg); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: 16px; top: -48px; padding: 8px 12px; background: var(--card); border-radius: var(--r-sm); }
.skip:focus { top: 12px; }

/* ── The phone pages ───────────────────────────────────────────────────── */
.phone {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}
.top { display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 4px; }
.spark { width: 88px; height: 88px; }
.brand {
  margin: 0; display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-xs); font-weight: 500; color: var(--ink3);
}
.brand img { width: 18px; height: 18px; }

.notice {
  margin: 14px 0 0;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--edge);
  font-size: var(--fs-sm);
  line-height: 1.45;
  color: var(--ink2);
}
.notice p { margin: 0; }
.notice strong { color: var(--ink); font-weight: 600; }

.view { margin-top: 22px; }
h1 {
  margin: 0 0 16px;
  font-size: var(--fs-2xl);
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-align: center;
  text-wrap: balance;
}
.lede { margin: -6px 0 16px; text-align: center; color: var(--ink2); font-size: var(--fs-sm); }

.choices { display: grid; gap: 12px; }
.choice {
  appearance: none;
  display: flex; align-items: center; gap: 14px;
  width: 100%;
  min-height: 84px;
  padding: 14px 18px;
  border: 2px solid var(--line);
  border-radius: var(--r-card);
  background: var(--card);
  box-shadow: var(--tile-shadow);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.choice .ic {
  flex: none; display: grid; place-items: center;
  width: 52px; height: 52px; border-radius: 16px;
  background: var(--accent-bg); color: var(--accent-fg);
}
.choice .ic svg { width: 28px; height: 28px; }
.choice .t { display: block; font-size: var(--fs-xl); font-weight: 600; line-height: 1.2; }
.choice .s { display: block; font-size: var(--fs-sm); color: var(--ink3); margin-top: 2px; }
.choice:hover { border-color: var(--line-strong); }
.choice:active { border-color: var(--accent); }
.choice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-bg); }
.choice:disabled { cursor: progress; opacity: .72; }
@media (prefers-reduced-motion: no-preference) {
  .choice { transition: border-color .15s ease, transform .12s ease, background-color .15s ease; }
  .choice:active { transform: scale(.985); }
}

.status { min-height: 1.5em; margin: 12px 0 0; text-align: center; font-size: var(--fs-sm); color: var(--ink2); }
.status.err { color: var(--block); }
.status:empty { min-height: 0; margin: 0; }

.panel {
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--tile-shadow);
}
.panel h1 { margin-bottom: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 600;
}
.pill.done { background: var(--done-bg); color: var(--done); }
.pill.idle { background: var(--idle-bg); color: var(--idle); }
.center { text-align: center; }
.stack { display: grid; gap: 10px; margin-top: 16px; }

.btn {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px;
  padding: 10px 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--ink);
  font: 600 var(--fs-base)/1.2 var(--font);
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}
.btn:hover { background: var(--soft); }
.btn.primary {
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-on);
  box-shadow: var(--accent-shadow);
}
.btn.primary:hover { background: var(--accent-hi); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent-fg); }
.btn.ghost:hover { background: var(--accent-bg); }
.btn.danger { border-color: var(--block); color: var(--block); }
.btn.danger:hover { background: var(--block-bg); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.wide { width: 100%; }
.btn svg { width: 18px; height: 18px; }
@media (prefers-reduced-motion: no-preference) {
  .btn { transition: background-color .15s ease; }
}

.meta { font-size: var(--fs-xs); color: var(--ink3); }
.foot { margin-top: 20px; text-align: center; font-size: var(--fs-xs); color: var(--ink3); }
.foot a { color: var(--ink2); }

/* The reveal: what this phone shared */
.shared { margin: 0; padding: 0; display: grid; gap: 0; }
.shared div {
  display: grid; grid-template-columns: 7.5em 1fr; gap: 12px;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.shared div:first-child { border-top: 0; padding-top: 0; }
.shared div:last-child { padding-bottom: 0; }
.shared dt { margin: 0; font-size: var(--fs-sm); color: var(--ink3); }
.shared dd { margin: 0; font-size: var(--fs-base); font-weight: 500; overflow-wrap: anywhere; }
.shared dd .meta { display: block; font-weight: 400; margin-top: 2px; }
.not { margin: 14px 0 0; font-size: var(--fs-sm); color: var(--ink2); }
.route { margin-top: 16px; }
.route .meta { margin-top: 6px; text-align: center; }

/* ── The presenter page ────────────────────────────────────────────────── */
.deck { max-width: 1440px; margin: 0 auto; padding: 16px; }
.deck-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.deck-head .title { display: flex; align-items: center; gap: 10px; }
.deck-head .title img { width: 32px; height: 32px; }
.deck-head h1 { margin: 0; font-size: var(--fs-xl); text-align: left; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--idle-hi, #B9B3D0); display: inline-block; }
.dot.on { background: var(--done-hi); }
.dot.off { background: var(--need); }

.deck-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .deck-grid { grid-template-columns: minmax(300px, 420px) 1fr; align-items: start; } }

.qr-card {
  background: #FFFFFF; color: #1F1B36;
  border-radius: var(--r-card); padding: 20px; text-align: center; box-shadow: var(--tile-shadow);
}
.qr-card img { width: 100%; max-width: 360px; margin: 0 auto; image-rendering: pixelated; }
.qr-card .link { margin-top: 8px; font-size: 30px; font-weight: 700; letter-spacing: -0.01em; }
.qr-card .meta { color: #635E80; }

.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.tile {
  min-height: 128px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-tile);
  box-shadow: var(--edge);
  display: flex; flex-direction: column; gap: 4px;
}
.tile h2 { margin: 0; font-size: var(--fs-sm); font-weight: 600; color: var(--ink2); }
.tile .big { font-size: 40px; font-weight: 700; line-height: 1.1; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.tile .mid { font-size: var(--fs-xl); font-weight: 600; font-variant-numeric: tabular-nums; }
.tile .wait { font-size: var(--fs-base); color: var(--ink3); margin-top: auto; margin-bottom: auto; }
.tile.red { background: var(--block-bg); border-color: var(--block); color: var(--block); }
.tile.red h2 { color: var(--block); }
.bar { display: flex; height: 10px; border-radius: var(--r-pill); overflow: hidden; background: var(--soft); margin-top: 6px; }
.bar span { display: block; height: 100%; }
.bar .b { background: var(--work-hi); }
.bar .v { background: var(--accent); }
.legend { display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-sm); }
.legend b { font-weight: 600; font-variant-numeric: tabular-nums; }

.controls { display: grid; gap: 12px; margin-top: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .controls { grid-template-columns: repeat(3, 1fr); } }
.control h2 { margin: 0 0 8px; font-size: var(--fs-base); font-weight: 600; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
input[type="number"], input[type="password"], input[type="text"] {
  min-height: 48px; padding: 10px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--card); color: var(--ink);
  font: 500 var(--fs-base)/1.2 var(--font);
}
input[type="number"] { width: 8em; }
.gate { max-width: 420px; margin: 12vh auto 0; }
.gate label { display: block; font-size: var(--fs-sm); font-weight: 600; margin-bottom: 6px; }
.gate .row input { flex: 1 1 200px; }
.counter-video { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

dialog {
  border: 0; border-radius: var(--r-dlg); padding: 22px; max-width: min(440px, calc(100vw - 32px));
  background: var(--dlg); color: var(--ink); box-shadow: var(--lift);
}
dialog::backdrop { background: var(--scrim); }
dialog h2 { margin: 0 0 8px; font-size: var(--fs-lg); }
dialog p { margin: 0 0 16px; color: var(--ink2); font-size: var(--fs-sm); }
dialog .row { justify-content: flex-end; }
.spark.centred { margin: 0 auto 6px; }
