:root {
  --bg: #f4f6f7; --card: #ffffff; --ink: #16242b; --muted: #5d6f78; --line: #d9e0e4;
  --accent: #0b7285; --accent-ink: #ffffff; --accent-soft: #e3f3f6;
  --good: #2b8a3e; --good-soft: #e6f4ea; --warn: #b3261e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10181c; --card: #1a252b; --ink: #e8eef1; --muted: #9bacb5; --line: #2e3d45;
    --accent: #3bc9db; --accent-ink: #06262c; --accent-soft: #14353c;
    --good: #69db7c; --good-soft: #173522; --warn: #ff8787;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
[hidden] { display: none !important; }
header.top { padding: 18px 16px 6px; max-width: 720px; margin: 0 auto; }
header.top h1 { font-size: 1.25rem; margin: 0; line-height: 1.25; }
header.top p { margin: 4px 0 0; color: var(--muted); font-size: .92rem; }
main { max-width: 720px; margin: 0 auto; padding: 10px 16px 32px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; margin-top: 14px;
}
.card h2 { margin: 0 0 12px; font-size: 1.15rem; line-height: 1.3; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.note { color: var(--muted); font-size: .92rem; margin: 10px 0 0; }
.error { color: var(--warn); }

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.btn {
  border: 1px solid var(--line); background: var(--card); border-radius: 10px;
  padding: 8px 14px; min-height: 40px;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* poll */
.options { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.option {
  position: relative; width: 100%; text-align: left; overflow: hidden;
  border: 2px solid var(--line); background: var(--card); border-radius: 12px;
  padding: 13px 14px; min-height: 52px; display: flex; gap: 10px; align-items: center;
}
.option .bar {
  position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent-soft);
  transition: width .5s ease; z-index: 0;
}
.option > span { position: relative; z-index: 1; }
.option .text { flex: 1; }
.option .pct { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.option.mine { border-color: var(--accent); }
.option.correct { border-color: var(--good); }
.option.correct .bar { background: var(--good-soft); }
.option .tag { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.option.correct .tag { color: var(--good); font-weight: 600; }
button.option:disabled { cursor: default; color: inherit; }

@media (prefers-reduced-motion: reduce) {
  .option .bar { transition: none; }
}

/* share card on the audience page */
.share { display: flex; gap: 18px; align-items: center; }
.share img { width: 150px; height: 150px; flex: none; background: #fff; border-radius: 10px; padding: 4px; }
.share h2 { margin-bottom: 4px; }
.share .url { font-weight: 700; margin: 0; word-break: break-all; }
.share .note { margin-top: 6px; }
footer { max-width: 720px; margin: 0 auto; padding: 0 16px 28px; color: var(--muted); font-size: .82rem; }

/* presenter */
body.presenter main { max-width: 1280px; }
.stage { display: grid; grid-template-columns: 1fr 260px; gap: 28px; align-items: start; padding: 28px; }
.stage h2 { font-size: clamp(1.5rem, 2.6vw, 2.6rem); }
.stage .option { font-size: clamp(1.05rem, 1.6vw, 1.6rem); min-height: 64px; }
.stage .status { font-size: 1.15rem; color: var(--muted); margin-top: 14px; }
.join { text-align: center; }
.join img { width: 100%; background: #fff; border-radius: 10px; padding: 6px; }
.join .url { font-weight: 700; font-size: 1.1rem; word-break: break-all; }
.controls { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.qlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.qlist li { display: flex; gap: 10px; align-items: center; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 10px; }
.row.reload { margin-top: 12px; }
.qlist li.active { border-color: var(--accent); background: var(--accent-soft); }
.qlist .qtext { flex: 1; }
.qlist .qlabel { display: block; font-size: .8rem; color: var(--muted); font-weight: 600; }
.field { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
  background: var(--card); margin-bottom: 8px; }
body.stage-only .controls, body.stage-only header.top { display: none; }
@media (max-width: 420px) {
  .share img { width: 110px; height: 110px; }
}
@media (max-width: 860px) {
  .stage, .controls { grid-template-columns: 1fr; }
  .join { max-width: 240px; margin: 0 auto; }
}
