@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); }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--hot); position: relative; }
.dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--hot); animation: pulse 1.6s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(1.8); opacity: 0; } }

/* 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); }
.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); }
.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; }
.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; }
.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; }
}
