/* Live Quiz — light pages (front page, quiz page, editor, phones). Same tokens and components as the Live Q&A and Highlights apps. */
:root {
  --title-line: 34px;
  --paper: #f6f4ef;
  --card: #ffffff;
  --ink: #1b1a17;
  --ink-2: #5d5a52;
  --ink-3: #8f8b81;
  --line: #e4e0d6;
  --accent: #e8502b;
  --accent-ink: #ffffff;
  --accent-soft: #fde9e2;
  --good: #1f8a5b;
  --good-soft: #e1f3ea;
  --warn: #a86400;
  --warn-soft: #fff1d6;
  --bad: #c0362c;
  --bad-soft: #fbe4e1;
  --official: #2c55c9;
  --official-soft: #e7edfc;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(27, 26, 23, .06), 0 4px 16px rgba(27, 26, 23, .05);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #151412; --card: #1f1e1b; --ink: #f1eee7; --ink-2: #b7b2a7; --ink-3: #85817a; --line: #34322d;
    --accent: #ff6a42; --accent-soft: #3a211a; --good: #4cc38a; --good-soft: #17301f; --warn: #f0b04a; --warn-soft: #33270f;
    --bad: #ff7b6e; --bad-soft: #3a1c19; --official: #7ea0ff; --official-soft: #1c2440;
    --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.45 var(--font); }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px 64px; }
.wrap.wide { max-width: 1180px; }

/* header: session/app logo + title top-left, as in the Q&A app */
.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: flex-start; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
.brand { height: var(--title-line); width: var(--title-line); border-radius: calc(var(--title-line) * .26); background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 800; font-size: calc(var(--title-line) * .36); letter-spacing: -.02em; flex: none; }
.brand-slot { display: flex; flex: none; height: var(--title-line); }
.brand.logo { background: none; width: auto; min-width: 0; border-radius: 0; }
.brand.logo img { display: block; height: var(--title-line); width: auto; max-width: 180px; object-fit: contain; object-position: left center; }
.head { --title-size: 19px; --title-line: calc(var(--title-size) * 1.25);
  flex: 1; min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; align-items: start; }
.head .brand-slot { grid-column: 1; grid-row: 1; }
.head h1 { grid-column: 2; grid-row: 1; margin: 0; font-size: var(--title-size); line-height: 1.25; overflow-wrap: anywhere; }
.head .sub { grid-column: 2; font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.top .actions { display: flex; gap: 8px; align-items: center; flex: none; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--good); margin-right: 5px; vertical-align: 1px; }
.dot.off { background: var(--warn); }

/* cards & forms */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel { padding: 16px; margin-top: 14px; }
.panel h2 { font-size: 17px; margin: 0 0 4px; }
.panel h3 { font-size: 15px; margin: 16px 0 4px; }
.btn { appearance: none; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 14px;
  font-weight: 600; font-size: 15px; cursor: pointer; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.danger { color: var(--bad); }
.btn.good { color: var(--good); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.block { width: 100%; justify-content: center; padding: 12px; }
.field { width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 10px 12px; font-size: 15px; }
textarea.field { resize: vertical; min-height: 90px; line-height: 1.4; }
select.field { appearance: auto; }
.field:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
label.lbl { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 12px 0 5px; }
label.lbl .opt { font-weight: 400; color: var(--ink-3); }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0 4px; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.count { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; text-align: right; margin-top: 3px; }
.count.over { color: var(--bad); }
.muted { color: var(--ink-3); font-size: 13.5px; }
.small { font-size: 13px; }
.k { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; overflow-wrap: anywhere; }

.notice { margin-top: 12px; padding: 10px 14px; border-radius: 12px; font-size: 14px; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice.info { background: var(--official-soft); color: var(--official); }
.notice.ok { background: var(--good-soft); color: var(--good); }

/* tabs */
.tabs { display: flex; gap: 4px; margin: 18px 0 10px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { appearance: none; background: none; border: 0; padding: 9px 12px; font-weight: 600; color: var(--ink-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; font-size: 15px; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--accent); }
.tabs .n { font-weight: 700; font-size: 11px; color: var(--accent-ink); background: var(--accent); border-radius: 99px; padding: 1px 6px; margin-left: 5px; vertical-align: 1px; }

.tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
.tag.pin, .tag.live { background: var(--accent-soft); color: var(--accent); }
.tag.ok { background: var(--good-soft); color: var(--good); }
.tag.off { background: var(--official-soft); color: var(--official); }
.tag.wait { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.linkbtn { appearance: none; border: 0; background: none; padding: 0; color: var(--ink-2); font-weight: 600; font-size: 13px; cursor: pointer; text-decoration: none; }
.linkbtn:hover { color: var(--accent); }
.linkbtn.danger:hover { color: var(--bad); }

.empty { text-align: center; color: var(--ink-3); padding: 40px 10px; }
.foot { text-align: center; color: var(--ink-3); font-size: 12px; margin-top: 30px; }

#toasts { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); }
.toast { background: var(--ink); color: var(--paper); padding: 11px 15px; border-radius: 12px; font-size: 14.5px; box-shadow: 0 6px 24px rgba(0,0,0,.2); transition: opacity .4s, transform .4s; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tblwrap { overflow-x: auto; }

/* image picker */
.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 14px; display: flex; gap: 14px; align-items: center; cursor: pointer; background: var(--paper); }
.drop:hover, .drop.over { border-color: var(--accent); }
.drop img, .drop video { width: 96px; height: 72px; object-fit: cover; border-radius: 8px; flex: none; background: var(--line); }
.drop .ph { width: 96px; height: 72px; border-radius: 8px; flex: none; background: var(--line); display: grid; place-items: center; color: var(--ink-3); font-size: 26px; }

/* ================================================================ Live Quiz additions */
:root { --c0: #e2453c; --c1: #2f6fde; --c2: #e3a41a; --c3: #1f9d5b; --c4: #8e44c9; --c5: #e0662a; }
.brandmark { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 800; font-size: 19px; letter-spacing: -.02em; flex: none; }
.brandmark img { height: 30px; width: auto; display: block; }
.brandmark b { color: var(--accent); font-weight: 800; }
.top .wrap { align-items: center; }
.top .nav { display: flex; gap: 6px; align-items: center; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.powered { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-3); font-size: 12.5px; text-decoration: none; }
.powered img { width: 22px; height: 19px; display: block; }
.powered b { color: var(--ink-2); font-weight: 700; }
.powered:hover b { color: var(--accent); }
.foot { display: flex; justify-content: center; padding: 26px 0 8px; margin-top: 10px; }

/* front page */
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 18px; margin-top: 22px; }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; } }
.hero .pitch { padding: 26px 24px; position: relative; overflow: hidden; }
.hero .pitch h1 { font-size: clamp(26px, 4vw, 38px); line-height: 1.1; margin: 0 0 10px; letter-spacing: -.03em; }
.hero .pitch h1 em { font-style: normal; color: var(--accent); }
.hero .pitch p { color: var(--ink-2); margin: 0 0 18px; max-width: 46ch; }
.hero .pitch .shapes { position: absolute; right: -10px; bottom: -18px; font-size: 64px; line-height: 1; opacity: .13; letter-spacing: -.05em; pointer-events: none; }
.joinbox { padding: 24px; text-align: center; display: flex; flex-direction: column; justify-content: center; }
.joinbox h2 { margin: 0 0 4px; font-size: 20px; }
.joinbox p { margin: 0 0 14px; color: var(--ink-2); font-size: 14px; }
.codein { text-align: center; font-size: 30px !important; letter-spacing: .3em; font-weight: 800; font-variant-numeric: tabular-nums; padding: 12px !important; }
.section-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 30px 0 10px; }
.section-h h2 { margin: 0; font-size: 20px; letter-spacing: -.01em; }
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.qcard { overflow: hidden; display: flex; flex-direction: column; text-decoration: none; transition: transform .15s, box-shadow .15s; }
.qcard:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(0,0,0,.06), 0 10px 28px rgba(0,0,0,.09); }
.qcard .cover { aspect-ratio: 16/9; background: linear-gradient(135deg, var(--accent), #e3a41a); position: relative; overflow: hidden; display: grid; place-items: center; }
.qcard .cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.qcard .cover .ph { color: #fff; font-size: 34px; letter-spacing: .1em; opacity: .85; }
.qcard .cover .badge { position: absolute; left: 8px; top: 8px; background: rgba(0,0,0,.62); color: #fff; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 99px; }
.qcard .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.qcard h3 { margin: 0; font-size: 16px; line-height: 1.25; overflow-wrap: anywhere; }
.qcard .meta { color: var(--ink-3); font-size: 12.5px; }
.qcard .row { margin-top: auto; padding-top: 8px; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--paper); border: 1px solid var(--line); border-radius: 99px; padding: 2px 8px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.seg button { appearance: none; border: 0; background: none; padding: 7px 12px; font-weight: 600; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* quiz page */
.qhead { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 20px; padding: 20px; margin-top: 18px; }
@media (max-width: 640px) { .qhead { grid-template-columns: 1fr; } }
.qhead .qr { background: #fff; border-radius: 12px; padding: 10px; border: 1px solid var(--line); }
.qhead .qr img { width: 100%; display: block; }

/* editor */
.editor { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; margin-top: 14px; }
@media (max-width: 820px) { .editor { grid-template-columns: 1fr; } }
.qlist { padding: 8px; position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow: auto; }
.qitem { display: flex; gap: 8px; align-items: flex-start; padding: 8px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.qitem:hover { background: var(--paper); }
.qitem[aria-current="true"] { border-color: var(--accent); background: var(--accent-soft); }
.qitem .n { font-weight: 800; font-size: 13px; color: var(--ink-3); width: 20px; flex: none; text-align: right; }
.qitem .t { flex: 1; min-width: 0; font-size: 14px; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.qitem .t small { display: block; color: var(--ink-3); font-size: 11.5px; }
.qitem .warn { color: var(--warn); font-weight: 800; }
.optgrid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 8px; }
@media (max-width: 560px) { .optgrid { grid-template-columns: 1fr; } }
.ansopt { display: flex; align-items: center; gap: 8px; border-radius: 12px; padding: 6px 8px 6px 6px; color: #fff; }
.ansopt .sh { width: 34px; height: 34px; display: grid; place-items: center; font-size: 18px; flex: none; }
.ansopt input[type=text] { flex: 1; min-width: 0; border: 0; border-radius: 8px; padding: 8px 10px; background: rgba(255,255,255,.95); color: #1b1a17; font-size: 15px; }
.ansopt label { display: flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.ansopt label input { width: 20px; height: 20px; accent-color: #fff; margin: 0; }
.ansopt .x { appearance: none; border: 0; background: rgba(0,0,0,.18); color: #fff; width: 26px; height: 26px; border-radius: 8px; cursor: pointer; flex: none; }
.blkedit { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-top: 8px; background: var(--paper); }
.blkedit .bh { display: flex; gap: 8px; align-items: center; font-weight: 700; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.blkedit .bh .grow { flex: 1; }
.blkedit img, .blkedit video { max-width: 100%; max-height: 220px; border-radius: 8px; display: block; background: #000; }
.blkedit audio { width: 100%; }
.blkedit iframe { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: 8px; background: #000; }
.addbar { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.saving { font-size: 12.5px; color: var(--ink-3); }
.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }

/* phones: answering */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 40; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { top: 105vh; transform: rotate(720deg) translateX(40px); } }
canvas.fireworks { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 40; }

.authorlink { appearance: none; border: 0; background: none; padding: 0; font: inherit; color: var(--ink-2); font-weight: 600; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 2px; }
.authorlink:hover { color: var(--accent); text-decoration-color: var(--accent); }
