@font-face { font-family: Poppins; font-weight: 400; font-display: swap; src: url(/fonts/poppins-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: Poppins; font-weight: 500; font-display: swap; src: url(/fonts/poppins-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: Poppins; font-weight: 600; font-display: swap; src: url(/fonts/poppins-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: Poppins; font-weight: 700; font-display: swap; src: url(/fonts/poppins-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: Poppins; font-weight: 800; font-display: swap; src: url(/fonts/poppins-latin-800-normal.woff2) format('woff2'); }

/* Themes. The host picks one per session; every screen sets <html data-theme>.
   "stage" (fun, dark) is the default; "paper" (corporate, light) overrides the same tokens. */
:root, [data-theme="stage"] {
  --bg: #07070B;
  --glow: radial-gradient(900px 500px at 85% -10%, rgba(139, 92, 255, .2), transparent 60%), radial-gradient(700px 420px at -10% 110%, rgba(255, 92, 122, .18), transparent 60%);
  --surface: #101018;
  --surface-2: #171722;
  --ink: #F7F7FB;
  --ink-soft: #9A9AB2;
  --line: #2A2A3A;
  --accent: #FF5C7A;
  --accent-deep: #E8435F;
  --on-accent: #fff;
  --accent-soft: rgba(255, 92, 122, .14);
  --hot: #FF5C7A;
  --pop: #8B5CFF;
  --pop-soft: rgba(139, 92, 255, .16);
  --on-pop: #fff;
  --good: #2EE6A6;
  --good-soft: rgba(46, 230, 166, .14);
  --on-good: #07070B;
  --bad-soft: rgba(255, 92, 122, .14);
  --bad-ink: #FF7A93;
  --warn: #FFB020;
  --radius: 18px;
  --radius-sm: 12px;
  --btn-radius: 999px;
  --shadow: 0 14px 40px -16px rgba(0, 0, 0, .6);
  --font: Poppins, "Segoe UI", system-ui, sans-serif;
  --font-display: var(--font);
  color-scheme: dark;
  font-family: var(--font);
  color: var(--ink);
  background: var(--glow), var(--bg);
  background-attachment: fixed;
  -webkit-text-size-adjust: 100%;
}
[data-theme="paper"] {
  --bg: #FAF7F2;
  --glow: none;
  --surface: #FFFDF9;
  --surface-2: #F1ECE2;
  --ink: #1B1A17;
  --ink-soft: #6B665C;
  --line: #E3DDD0;
  --accent: #1F5A3C;
  --accent-deep: #17452E;
  --accent-soft: #E4EEE7;
  --hot: #B3341F;
  --pop: #9A6B16;
  --pop-soft: #F5ECD9;
  --good: #1F5A3C;
  --good-soft: #E4EEE7;
  --on-good: #fff;
  --bad-soft: #F7E3DD;
  --bad-ink: #B3341F;
  --warn: #F2C14E;
  --radius: 10px;
  --radius-sm: 8px;
  --btn-radius: 8px;
  --shadow: 0 1px 0 rgba(0, 0, 0, .04), 0 10px 30px -16px rgba(27, 26, 23, .18);
  --font: ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-size: 16px; line-height: 1.45; padding-top: env(safe-area-inset-top, 0); padding-bottom: env(safe-area-inset-bottom, 0); }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.01em; }
h1, h2 { font-family: var(--font-display); }
h1 { font-size: clamp(28px, 6vw, 40px); font-weight: 800; }
h2 { font-size: 22px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 600; }
p { margin: 0 0 1em; }
a { color: var(--accent); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--ink-soft); }
.small { font-size: 14px; }
.hidden { display: none !important; }
.wrap { max-width: 560px; margin: 0 auto; padding: 20px 18px 40px; }
.wrap-wide { max-width: 1100px; margin: 0 auto; padding: 20px 18px 40px; }

/* Brand mark: the pulse dot */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; text-decoration: none; color: var(--ink); }
/* Brand mark: three poll bars rising like votes coming in. Size it with --s. */
.dot { --s: 16px; width: var(--s); height: var(--s); position: relative; display: inline-block; flex: none; }
.dot::before, .dot::after { content: ""; position: absolute; bottom: 0; width: calc(var(--s) / 4); height: 100%; border-radius: calc(var(--s) / 8); transform-origin: bottom; animation: bars 1.2s ease-in-out infinite; }
.dot::before { left: 0; background: var(--ink); box-shadow: calc(var(--s) * .75) 0 0 var(--ink); animation-delay: -.6s; }
.dot::after { left: calc(var(--s) * .375); background: var(--hot); }
@keyframes bars { 0%, 100% { transform: scaleY(.4); } 50% { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .dot::before, .dot::after { animation: none; } }

/* Controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 20px; border-radius: var(--btn-radius); border: 2px solid var(--ink); background: var(--ink); color: var(--bg); font-weight: 600; transition: transform .08s, background .15s; text-decoration: none; }
.btn:active { transform: scale(.97); }
.ico { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-lime { background: var(--pop); border-color: var(--pop); color: var(--on-pop); }
.btn-coral { background: var(--hot); border-color: var(--hot); color: #fff; }
.btn-sm { min-height: 38px; padding: 6px 14px; font-size: 14px; }
.btn-block { width: 100%; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.input { width: 100%; min-height: 48px; padding: 10px 14px; border-radius: var(--radius-sm); border: 2px solid var(--line); background: var(--surface); outline: none; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.pw { position: relative; display: block; }
.pw .input { padding-right: 52px; }
.pw .eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: var(--radius-sm); background: none; color: var(--ink-soft); }
.pw .eye:hover { color: var(--ink); }
.pw .eye:focus-visible { outline: 3px solid var(--warn); outline-offset: 1px; }
.pw:has(> .hidden) { display: none; }
textarea.input { min-height: 90px; resize: vertical; }
.code-input { font-size: 28px; font-weight: 700; letter-spacing: .3em; text-transform: uppercase; text-align: center; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.stack > * + * { margin-top: 12px; }

.card { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card-soft { background: var(--surface-2); border-color: transparent; }

/* Option buttons (participant answers) */
.opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 12px 16px; margin-bottom: 10px; border-radius: var(--radius-sm); border: 2px solid var(--line); background: var(--surface); text-align: left; font-weight: 500; transition: border-color .12s, transform .08s, background .12s; }
.opt .k { width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.opt:active { transform: scale(.98); }
.opt.on { border-color: var(--accent); background: var(--accent-soft); }
.opt.on .k { background: var(--accent); color: var(--on-accent); }
.opt.right { border-color: var(--good); background: var(--good-soft); }
.opt.wrong { border-color: var(--hot); background: var(--bad-soft); }
/* True / False: two big side-by-side buttons */
.tf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.opt-tf { flex-direction: column; justify-content: center; text-align: center; min-height: 120px; margin-bottom: 0; font-size: 20px; font-weight: 700; }
.opt-tf .tf-mark { font-size: 40px; line-height: 1; }
.opt-tf:first-child { border-color: var(--good); background: var(--good-soft); }
.opt-tf:last-child { border-color: var(--hot); background: var(--bad-soft); }
.opt-tf.on { outline: 4px solid var(--accent); outline-offset: 2px; }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.scale.ten { grid-template-columns: repeat(5, 1fr); }
.scale button { min-height: 54px; border-radius: var(--radius-sm); border: 2px solid var(--line); background: var(--surface); font-weight: 700; font-size: 18px; }
.scale button.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.scale.stars button { font-size: 28px; color: var(--ink-soft); }
.scale.stars button.on { background: transparent; color: var(--warn); border-color: var(--warn); }
.scale.emojis button { font-size: 26px; }

/* Status pill */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--surface-2); }
.pill.live { background: var(--good-soft); color: var(--good); }
.pill.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--good); animation: blink 1.2s infinite; }
.pill.closed { background: var(--bad-soft); color: var(--bad-ink); }
.pill.ended { background: var(--surface-2); color: var(--ink-soft); }
@keyframes blink { 50% { opacity: .3; } }

/* Results bars */
.bars { display: grid; gap: 10px; }
.bar { position: relative; min-height: 50px; border-radius: var(--radius-sm); background: var(--surface-2); overflow: hidden; }
.bar .fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent); transition: width .6s cubic-bezier(.2, .8, .2, 1); border-radius: var(--radius-sm); }
.bar.right .fill { background: var(--good); }
.bar .lbl { position: relative; display: flex; justify-content: space-between; gap: 10px; align-items: center; min-height: 50px; padding: 8px 14px; font-weight: 600; }
.bar .lbl b { font-size: 18px; }
.bar .fill.on + .lbl { color: var(--on-accent); }
.bar.right .fill.on + .lbl { color: var(--on-good); }

/* Toast + banners */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 999px; font-weight: 600; opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { background: var(--good); color: var(--on-good); }
.toast.bad { background: var(--hot); color: #fff; }
.banner { position: fixed; top: 0; left: 0; right: 0; padding: 8px 14px; text-align: center; font-weight: 600; font-size: 14px; background: var(--warn); color: #1B1A17; z-index: 40; transform: translateY(-100%); transition: .3s; }
.banner.show { transform: none; }

/* Q&A list */
.qa { display: grid; gap: 10px; }
.qa-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius-sm); }
.qa-item.live { border-color: var(--pop); background: var(--pop-soft); }
.qa-item.answered { opacity: .6; }
.qa-item .txt { flex: 1; font-weight: 500; }
.qa-by { display: block; font-size: .75em; font-weight: 600; color: var(--ink-soft); }
.vote { flex: none; display: grid; place-items: center; min-width: 54px; min-height: 54px; border-radius: var(--radius-sm); border: 2px solid var(--line); background: var(--surface); font-weight: 700; line-height: 1; gap: 2px; }
.vote.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.vote small { font-size: 11px; font-weight: 600; }

/* Reactions */
.react-bar { display: flex; gap: 8px; justify-content: space-between; margin-top: 12px; }
.react-bar button { flex: 1; min-height: 48px; border-radius: var(--radius-sm); border: 2px solid var(--line); background: var(--surface); font-size: 22px; }
.react-bar button:active { transform: scale(1.15); border-color: var(--hot); }
.react-bar button.sent { animation: pop .35s; }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.3); } 100% { transform: scale(1); } }

/* Live screen (projector): same theme, bigger type */
.bigscreen { min-height: 100vh; min-height: 100dvh; }
.bigscreen .wrap-wide { padding: 28px 40px; }
.bigscreen h1 { font-size: clamp(32px, 4.5vw, 64px); }
.bigscreen .bar { min-height: 72px; }
.bigscreen .bar .lbl { min-height: 72px; font-size: clamp(18px, 2.2vw, 30px); padding: 12px 22px; }
.bigscreen .bar .lbl b { font-size: clamp(22px, 2.6vw, 36px); }
.bigscreen .qa-item { font-size: clamp(16px, 1.8vw, 24px); }
.float { position: fixed; bottom: -60px; font-size: 44px; pointer-events: none; animation: rise 3s ease-out forwards; z-index: 30; }
@keyframes rise { 0% { transform: translateY(0) scale(.7); opacity: 0; } 10% { opacity: 1; } 100% { transform: translateY(-90vh) translateX(var(--drift, 0)) scale(1.25); opacity: 0; } }
.cloud { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: baseline; justify-content: center; padding: 16px 0; }
.cloud span { font-weight: 700; line-height: 1; color: var(--accent); }
.big-num { font-size: clamp(60px, 10vw, 140px); font-weight: 800; line-height: 1; letter-spacing: -.03em; }

/* Countdown bar for timed questions */
.timer { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 6px 0 14px; }
.timer i { display: block; height: 100%; background: var(--accent); transform-origin: left; }
.timer.low i { background: var(--hot); }
.bigscreen .timer { height: 16px; }

/* Podium: 3rd, then 2nd, then 1st rise in. With reduced motion the global rule removes the animation and they simply show. */
.podium { display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: end; gap: 18px; margin: 28px auto; max-width: 900px; text-align: center; }
.podium .place { animation: rise-in .7s cubic-bezier(.2, .8, .2, 1) both; }
.podium .place .name { font-weight: 700; font-size: clamp(18px, 2.4vw, 32px); }
.podium .place .score { color: var(--ink-soft); font-weight: 600; }
.podium .step { margin-top: 10px; border-radius: var(--radius) var(--radius) 0 0; background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: clamp(36px, 5vw, 72px); display: grid; place-items: center; }
.podium .p1 { order: 2; animation-delay: 1.8s; } .podium .p1 .step { height: 260px; }
.podium .p2 { order: 1; animation-delay: .9s; }  .podium .p2 .step { height: 190px; }
.podium .p3 { order: 3; animation-delay: 0s; }   .podium .p3 .step { height: 140px; }
@keyframes rise-in { from { transform: translateY(60px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-width: 640px) { .bigscreen .wrap-wide { padding: 18px; } .scale.ten { grid-template-columns: repeat(5, 1fr); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
:focus-visible { outline: 3px solid var(--warn); outline-offset: 2px; }

/* Big screen: left rail (QR + join info) and one big card */
.bigscreen .wrap-wide { max-width: none; padding: 0; }
.stage { display: grid; grid-template-columns: minmax(220px, 22vw) 1fr; gap: 28px; min-height: 100dvh; padding: 28px; }
.stage.idle { grid-template-columns: 1fr; }
.stage.idle .rail { display: none; }
.rail { background: var(--surface); border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 18px; padding: 24px; }
.rail p { margin: 0; }
.rail-qr { width: 100%; max-width: 260px; background: #fff; padding: 12px; border-radius: var(--radius-sm); }
.rail-join { font-size: clamp(18px, 1.8vw, 26px); text-align: center; }
.rail-code { font-family: var(--font-display); font-size: clamp(36px, 4vw, 64px); font-weight: 800; letter-spacing: .08em; color: var(--accent); }
.rail-count { color: var(--ink-soft); }
.stage-main { min-width: 0; }
.stage-main #main { background: var(--surface); border-radius: var(--radius); padding: clamp(20px, 3vw, 44px); box-shadow: var(--shadow); }
@media (max-width: 999px) {
  .stage { grid-template-columns: 1fr; padding: 16px; }
  .rail { flex-direction: row; justify-content: flex-start; flex-wrap: wrap; text-align: left; }
  .rail-qr { width: 96px; }
}

/* Presenter bar: only the host sees it */
.presenter { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; gap: 6px; align-items: center; background: var(--surface); border: 2px solid var(--line); border-radius: 999px; padding: 6px; box-shadow: var(--shadow); z-index: 40; opacity: .35; transition: opacity .2s; }
.presenter:hover, .presenter:focus-within { opacity: 1; }
.presenter button { min-height: 42px; padding: 6px 14px; border-radius: 999px; border: 0; background: transparent; color: var(--ink); font-weight: 600; }
.presenter button:hover:not(:disabled) { background: var(--surface-2); }
.presenter button:disabled { opacity: .4; }
.presenter select { min-height: 42px; max-width: 220px; border-radius: 999px; border: 0; background: var(--surface-2); color: var(--ink); padding: 6px 12px; }
#pStop { color: var(--hot); }

/* Host app shell: shared by dashboard, settings and analytics */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { display: flex; flex-direction: column; gap: 6px; padding: 20px 16px; border-right: 2px solid var(--line); background: var(--surface); }
.side .grow { flex: 1; }
.side .nav { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-radius: var(--radius-sm); font-weight: 600; text-decoration: none; color: var(--ink); background: transparent; }
.side .nav:hover { background: var(--surface-2); }
.side .nav.on { background: var(--accent-soft); }
.side .nav:disabled { color: var(--ink-soft); cursor: not-allowed; }
.side .who { padding-top: 14px; border-top: 2px solid var(--line); overflow-wrap: anywhere; }
.side a.who { display: block; text-decoration: none; color: inherit; }
.side a.who:hover { background: var(--surface-2); }
.acct { display: grid; gap: 18px; max-width: 640px; }
.acct-looks { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.acct-look { display: flex; align-items: center; gap: 12px; padding: 14px; border: 2px solid var(--line); border-radius: var(--radius); background: var(--surface); font-weight: 600; }
.acct-look:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.acct-look input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.main { padding: 32px clamp(20px, 4vw, 48px) 56px; width: 100%; min-width: 0; }
.main > .inner { max-width: 1120px; margin: 0 auto; }
.main > .inner.narrow { max-width: 760px; }
@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .side { flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 2px solid var(--line); }
  .side .grow { display: none; }
  .side .nav { width: auto; }
  .side .who { border-top: 0; padding-top: 0; flex-basis: 100%; }
}

/* Two-column sign-in */
.auth { display: grid; min-height: 100vh; }
.auth-brand { display: none; }
.auth-form { display: flex; flex-direction: column; justify-content: center; padding: 20px 18px 40px; width: 100%; max-width: 560px; margin: 0 auto; }
@media (min-width: 900px) {
  .auth { grid-template-columns: 1fr 1fr; }
  .auth-brand { display: flex; flex-direction: column; justify-content: center; gap: 20px; padding: 48px clamp(32px, 5vw, 80px); background: var(--surface); border-right: 2px solid var(--line); }
  .auth-brand h2 { font-size: clamp(28px, 3vw, 40px); max-width: 16ch; }
  .auth-brand ul { margin: 0; padding-left: 20px; display: grid; gap: 10px; color: var(--ink-soft); }
  .auth-form { max-width: 480px; }
}

/* ---------- Dashboard: sessions table (plan 010) ---------- */
.dt-head { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.dt-head h1 { margin: 0; }
.dt-head .dt-new { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; flex: 1 1 340px; justify-content: flex-end; }
.dt-head form { display: flex; flex-wrap: wrap; gap: 10px; flex: 1 1 280px; max-width: 460px; }
.dt-head form .input { flex: 1 1 180px; }
.dt-now { background: var(--ink); color: var(--bg); border-radius: var(--radius); padding: 22px 26px; margin-bottom: 24px; display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between; }
.dt-now .kick { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; opacity: .75; }
.dt-now h2 { margin: 4px 0; font-family: var(--font-display); overflow-wrap: anywhere; }
.dt-now .sub { opacity: .85; overflow-wrap: anywhere; }
.dt-now .acts { display: flex; flex-wrap: wrap; gap: 10px; }
.dt-now .btn-ghost { color: var(--bg); border-color: var(--bg); } /* the banner inverts the theme, so its ghost button must too */
.dt-tabs { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 14px; }
.dt-tab { appearance: none; border: 0; background: none; font: inherit; font-weight: 600; color: var(--ink-soft); padding: 8px 14px; border-radius: 999px; cursor: pointer; }
.dt-tab[aria-pressed="true"] { background: var(--accent-soft); color: var(--ink); }
.dt-tabs .input { margin-left: auto; max-width: 280px; min-height: 40px; }
.dt-table { padding: 0; overflow: visible; }
.dt-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px 90px minmax(230px, auto); gap: 12px 16px; align-items: center; padding: 14px 20px; border-top: 2px solid var(--line); }
.dt-row:first-child { border-top: 0; }
.dt-row.dt-th { font-size: 13px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; }
.dt-title { font-weight: 700; overflow-wrap: anywhere; }
.dt-title small { font-weight: 500; color: var(--ink-soft); margin-left: 6px; }
.dt-acts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center; }
.dt-menu { position: relative; }
.dt-menu > summary { list-style: none; cursor: pointer; }
.dt-menu > summary::-webkit-details-marker { display: none; }
.dt-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 190px; display: grid; gap: 2px; padding: 8px; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.dt-pop a, .dt-pop button { display: block; text-align: left; padding: 8px 12px; border: 0; background: none; font: inherit; color: var(--ink); border-radius: 8px; cursor: pointer; text-decoration: none; }
.dt-pop a:hover, .dt-pop button:hover { background: var(--surface-2); }
.dt-pop .danger { color: var(--bad-ink); }
.dt-sec { margin-top: 36px; }
@media (max-width: 800px) {
  .dt-row { grid-template-columns: 1fr auto; }
  .dt-row.dt-th { display: none; }
  .dt-row > :first-child { grid-column: 1 / -1; }
  .dt-acts { grid-column: 1 / -1; justify-content: flex-start; }
  .dt-tabs .input { margin-left: 0; max-width: none; flex: 1 1 100%; }
  .dt-head .dt-new { justify-content: flex-start; }
}

/* ---------- Host workspace (plan 010) ---------- */
.ws { display: grid; grid-template-rows: 60px minmax(0, 1fr); height: 100vh; height: 100dvh; background: var(--bg); }
.ws-top { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 2px solid var(--line); min-width: 0; }
.ws-top .ws-title { margin: 0; font-size: 18px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; }
.ws-top .spacer { flex: 1; }
.ws-code { font-weight: 700; color: var(--ink-soft); letter-spacing: .08em; }
.ws-body { display: grid; grid-template-columns: 300px minmax(0, 1fr) 340px; min-height: 0; }
.ws-rail, .ws-room { overflow: auto; padding: 14px; min-height: 0; }
.ws-rail { border-right: 2px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.ws-room { border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.ws-centre { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; min-width: 0; }
.ws-panel { overflow: auto; padding: 20px 24px; min-height: 0; }
.ws-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.ws-cards, .ws-special { display: grid; gap: 8px; }
.ws-card { position: relative; border: 2px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.ws-card.live { border-color: var(--accent); }
.ws-card.sel { background: var(--accent-soft); }
.ws-card-main { display: block; width: 100%; text-align: left; border: 0; background: none; font: inherit; color: var(--ink); padding: 10px 52px 10px 12px; cursor: pointer; border-radius: var(--radius-sm); }
.ws-card-kind { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.ws-card-kind b { color: var(--accent); }
.ws-card-text { font-weight: 700; overflow-wrap: anywhere; }
.ws-card-meta { font-size: 13px; color: var(--ink-soft); }
.ws-go { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; min-height: 0; padding: 0; border-radius: 50%; }
.ws-card-acts { display: flex; gap: 4px; padding: 0 8px 8px; opacity: 0; transition: opacity .12s; }
.ws-card:hover .ws-card-acts, .ws-card:focus-within .ws-card-acts { opacity: 1; }
@media (hover: none) { .ws-card-acts { opacity: 1; } }
.ws-set { margin: 0 8px 8px; padding: 12px; border: 2px dashed var(--line); border-radius: var(--radius-sm); }
.ws-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 24px; border-top: 2px solid var(--line); background: var(--surface); }
.ws-bar .ws-ctl { display: flex; flex-wrap: wrap; gap: 8px; }
.ws-bar .spacer { flex: 1; }
.ws-next { display: flex; gap: 12px; align-items: center; }
.ws-next .btn { min-height: 56px; padding: 10px 28px; font-size: 18px; }
.ws-label { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
.ws-screen { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border: 2px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.ws-screen iframe { position: absolute; top: 0; left: 0; width: 1280px; height: 720px; border: 0; transform-origin: 0 0; transform: scale(var(--k, .25)); pointer-events: none; }
.ws-phone { width: min(300px, 100%); margin: 0 auto; border: 10px solid var(--ink); border-radius: 36px; overflow: hidden; background: var(--surface-2); }
.ws-phone-in { position: relative; aspect-ratio: 390 / 844; overflow: hidden; }
.ws-phone-in iframe { position: absolute; top: 0; left: 0; width: 390px; height: 844px; border: 0; transform-origin: 0 0; transform: scale(var(--k, .7)); }
.ws-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ws-stat { padding: 10px; text-align: center; border: 2px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.ws-stat b { display: block; font-size: 24px; }
.ws-stat span { font-size: 12px; color: var(--ink-soft); }
.ws-stat.hot b { color: var(--bad-ink); }
.ws-rq { display: block; width: 100%; text-align: left; font: inherit; color: var(--ink); background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; cursor: pointer; overflow-wrap: anywhere; }
.ws-pop { position: relative; }
.ws-pop > summary { list-style: none; cursor: pointer; }
.ws-pop > summary::-webkit-details-marker { display: none; }
.ws-popbody { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 220px; display: grid; gap: 8px; padding: 12px; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.ws-popbody .btn { justify-content: flex-start; }
.ws-share .ws-popbody img { width: 160px; height: 160px; border-radius: 12px; }
dialog.ws-dlg { width: min(640px, 94vw); }
.ws-opts { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 4px; }
@media (max-width: 1199px) { .ws-body { grid-template-columns: 300px minmax(0, 1fr); } .ws-room { display: none; } }
@media (max-width: 799px) {
  .ws { display: block; height: auto; min-height: 100dvh; }
  .ws-top { flex-wrap: wrap; height: auto; padding: 10px 16px; }
  .ws-top .spacer { display: none; }
  .ws-body { display: flex; flex-direction: column; }
  .ws-rail { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 2px solid var(--line); }
  .ws-rail .ws-tools, .ws-rail .ws-cards, .ws-rail .ws-special { display: flex; flex: none; }
  .ws-rail .ws-card { min-width: 220px; }
  .ws-rail #qCountBox { display: none; }
  .ws-panel { padding: 16px; }
  .ws-bar { position: sticky; bottom: 0; padding: 10px 16px; }
  .ws-popbody { right: auto; left: 0; max-width: calc(100vw - 32px); }
}

/* ---- Plan 011: leaderboard and awards steps ---- */
.gb { padding: 2vh 0; }
.gb h1 { margin: 0 0 4vh; }
.gb h1 small { color: var(--ink-soft); font-size: .5em; font-weight: 600; margin-left: 12px; }
.gb-rows { display: grid; gap: 14px; }
.gb-row { display: grid; grid-template-columns: 2ch minmax(0, 1fr) auto 7ch; align-items: center; gap: 18px; font-size: clamp(18px, 2.2vw, 34px); }
.gb-rank { font-weight: 800; color: var(--ink-soft); }
.gb-row.first .gb-rank { color: var(--warn); }
.gb-bar { position: relative; height: clamp(44px, 6vh, 70px); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.gb-fill { position: absolute; inset: 0 auto 0 0; background: var(--c, var(--accent)); transform-origin: left; animation: gb-grow .9s ease-out both; }
.gb-name { position: relative; display: flex; align-items: center; gap: 12px; height: 100%; padding: 0 20px; font-weight: 800; color: var(--ink); }
.gb-name .pill { font-size: .55em; background: var(--surface-2); color: var(--ink); }
.gb-score { font-weight: 800; text-align: right; }
.gb-delta { font-weight: 700; color: var(--ink-soft); }
.gb-delta.up { color: var(--good); }
.gb-delta.down { color: var(--hot); }
.gb-pills { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 4vh; font-size: clamp(16px, 1.6vw, 24px); }
.gb-pill { padding: 8px 16px; border-radius: 999px; background: var(--surface-2); color: var(--ink); font-weight: 700; }
.gb-pill.good { background: var(--good-soft); color: var(--good); }
.gb-pill.warn { background: var(--surface-2); color: var(--warn); }
.aw-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 899px) { .aw-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.aw-card { display: flex; align-items: center; gap: 18px; padding: 24px; background: var(--surface); border: 1px solid var(--c, var(--accent)); border-radius: var(--radius); }
.aw-ring { flex: none; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; font-size: 40px; border: 3px solid var(--c, var(--accent)); background: var(--surface-2); }
.aw-card .aw-title { color: var(--c, var(--accent)); font-weight: 700; }
.aw-card .aw-name { font-size: clamp(22px, 2.4vw, 34px); font-weight: 800; overflow-wrap: anywhere; }
.aw-card .aw-detail { color: var(--ink-soft); }
@keyframes gb-grow { from { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .gb-fill { animation: none; } }

/* phone cards for the same two steps */
.me-card { display: grid; gap: 14px; text-align: center; }
.me-card .big { font-size: 64px; font-weight: 800; line-height: 1; }
.me-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.me-tile { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px; }
.me-tile b { display: block; font-size: 26px; }
.me-tile span { color: var(--ink-soft); font-size: 13px; }
.me-won { font-size: 56px; line-height: 1.1; }
.badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; }
.badge { opacity: .35; }
.badge.on { opacity: 1; }
.badge i { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto; border-radius: 50%; font-style: normal; font-size: 24px; border: 2px dashed var(--line); }
.badge.on i { border-style: solid; background: var(--surface-2); }
.badge span { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 4px; }

/* analytics scores */
.sc-table { width: 100%; border-collapse: collapse; }
.sc-table th, .sc-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.sc-table td.num, .sc-table th.num { text-align: right; }
.sc-qs { display: grid; gap: 10px; margin-top: 10px; }
.sc-q .sc-track { height: 10px; border-radius: 5px; background: var(--surface-2); margin-top: 4px; overflow: hidden; }
.sc-q .sc-track i { display: block; height: 100%; background: var(--good); }
.sc-awards { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.sc-awards .aw-card { padding: 10px 14px; gap: 10px; }
.sc-awards .aw-ring { width: 40px; height: 40px; font-size: 20px; border-width: 2px; }
.sc-awards .aw-name { font-size: 16px; }

/* Danger dialog (P.confirmDanger) */
dialog.danger-dialog { width: min(440px, 94vw); padding: 24px; background: var(--surface); color: var(--ink); border: 2px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
dialog.danger-dialog::backdrop { background: rgba(0, 0, 0, .5); }
.danger-dialog h2 { margin: 0 0 8px; }
.danger-dialog p { margin: 0 0 16px; color: var(--ink-soft); }
.danger-ack { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 20px; color: var(--bad-ink); font-weight: 600; cursor: pointer; }
.danger-ack input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; }
.danger-row { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

/* Share links (P.linkPanel) */
.link-panel { display: grid; gap: 10px; }
.link-row { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.link-row input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.link-row small { display: block; color: var(--ink-soft); }
.link-out { display: grid; gap: 8px; justify-items: start; }
.link-out .row { width: 100%; }
.link-out .input { min-width: 0; }

/* My templates: one saved template is a header row plus its questions */
.tpl-group { display: grid; gap: 8px; }
.tpl-ghead .t { flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; }
.tpl-card .t { min-width: 0; overflow-wrap: anywhere; }

/* Music volume slider (workspace top bar and presenter bar) */
.vol-range { width: 90px; accent-color: var(--accent); }
.vol-range:disabled { opacity: .4; }
.ws-top button:disabled { opacity: .4; }
@media (max-width: 800px) { .vol-range { display: none; } }

/* Plan 022: question images, slider, put-in-order */
.q-img-big { display: block; max-height: 40vh; max-width: 100%; object-fit: contain; border-radius: var(--radius-sm); margin: 0 0 12px; }
.q-img-phone { display: block; width: 100%; max-height: 30vh; object-fit: contain; border-radius: var(--radius-sm); margin: 0 0 12px; }
.q-thumb { display: block; width: 56px; height: 40px; object-fit: cover; border-radius: 6px; margin-bottom: 6px; }
.q-thumb-lg { width: 160px; height: 100px; object-fit: contain; }
.slide-host { display: block; width: 100%; max-height: 50vh; object-fit: contain; border-radius: var(--radius-sm); }
.slider-num { font-size: 44px; font-weight: 800; text-align: center; line-height: 1.1; margin: 4px 0 10px; }
.slider { width: 100%; height: 44px; accent-color: var(--accent); margin: 0; }
.slider::-webkit-slider-thumb { width: 32px; height: 32px; }
.slider::-moz-range-thumb { width: 32px; height: 32px; }
.order-pick, .order-list { list-style: none; margin: 0 0 10px; padding: 0; }
.order-pick li, .order-list li { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 10px; margin-bottom: 8px; border: 2px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.order-pick .k { width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.order-pick .txt, .order-list li span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.order-pick button { min-width: 44px; min-height: 44px; }
.order-list li b { flex: none; }
