/* Spandan v0.1 "First Pulse" · design system
   Spacing 4/8/12/16/24/32/48/64 · type 12/13/15/18/24/32 + stage scale · radii 8/14/22/pill · Lucide icons */
@font-face { font-family: 'Jakarta'; font-style: normal; font-display: swap; font-weight: 200 800; src: url(../fonts/plus-jakarta-sans-latin-wght-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Jakarta'; font-style: normal; font-display: swap; font-weight: 200 800; src: url(../fonts/plus-jakarta-sans-latin-ext-wght-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --r-sm: 8px; --r: 14px; --r-lg: 22px; --pill: 999px;
  --t-xs: 12px; --t-sm: 13px; --t-md: 15px; --t-lg: 18px; --t-xl: 24px; --t-2xl: 32px;
  --font: 'Jakarta', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', 'Noto Sans', 'Noto Sans Devanagari', sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1); --fast: 160ms; --med: 320ms; --slow: 700ms;
  color-scheme: light;
  --bg: #F7F6F2; --surface: #FFFFFF; --surface-2: #F0EEE8; --surface-3: #E7E4DC;
  --ink: #17161E; --ink-2: #47455A; --ink-3: #66647A; --line: #E2DFD6; --line-2: #D2CEC2;
  --accent: #C23F28; --accent-ink: #FFFFFF; --accent-soft: #FBE8E3; --accent-line: #F1C3B8;
  --good: #137A55; --good-soft: #E1F4EC; --warn: #9A5B00; --warn-soft: #FDF0D9; --bad: #B42318; --bad-soft: #FDE7E5;
  --focus: #3446C9;
  --shadow-1: 0 1px 2px rgba(23, 22, 30, .06), 0 1px 1px rgba(23, 22, 30, .04);
  --shadow-2: 0 10px 30px -12px rgba(23, 22, 30, .22), 0 2px 6px rgba(23, 22, 30, .06);
  --shadow-3: 0 30px 80px -24px rgba(23, 22, 30, .35);
  --c1: #C23F28; --c2: #3949AB; --c3: #0B7F73; --c4: #A86A12; --c5: #7A3BDB; --c6: #0E6F8A; --c7: #B3195A; --c8: #4A7A0E;
  --track: #ECE9E1;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0D0E15; --surface: #161824; --surface-2: #1D2030; --surface-3: #262A3C;
  --ink: #F4F3F8; --ink-2: #C9C7D6; --ink-3: #A2A0B5; --line: #282B3C; --line-2: #34384C;
  --accent: #FF7559; --accent-ink: #1C0904; --accent-soft: #3A1C17; --accent-line: #6B3127;
  --good: #4FD39E; --good-soft: #10291F; --warn: #F2B544; --warn-soft: #2D2412; --bad: #FF8A7F; --bad-soft: #341716;
  --focus: #9AA6FF;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .5); --shadow-2: 0 14px 40px -16px rgba(0, 0, 0, .7); --shadow-3: 0 40px 100px -30px rgba(0, 0, 0, .8);
  --c1: #FF7A5C; --c2: #8C9EFF; --c3: #3CC6B4; --c4: #F2B544; --c5: #B794F6; --c6: #4FC3E0; --c7: #F472B6; --c8: #9BD15B;
  --track: #232637;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 var(--t-md)/1.55 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; min-height: 100vh; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -0.018em; font-weight: 750; }
p { margin: 0; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
img, svg { display: block; }
.ic { width: 18px; height: 18px; flex: none; }
.ic.lg { width: 22px; height: 22px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- buttons, fields, chips */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 42px; padding: 0 var(--s4); border-radius: var(--pill); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 650; font-size: var(--t-md); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background var(--fast), border-color var(--fast), transform var(--fast), box-shadow var(--fast); }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.btn.quiet { background: transparent; border-color: transparent; }
.btn.quiet:hover { background: var(--surface-2); }
.btn.danger { color: var(--bad); }
.btn.sm { min-height: 34px; padding: 0 var(--s3); font-size: var(--t-sm); }
.btn.lg { min-height: 52px; padding: 0 var(--s5); font-size: var(--t-lg); }
.btn.icon { width: 42px; padding: 0; }
.btn.icon.sm { width: 34px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.field { display: grid; gap: var(--s2); }
.field > span { font-size: var(--t-sm); font-weight: 650; color: var(--ink-2); }
.input, textarea.input, select.input { width: 100%; min-height: 46px; padding: 10px 14px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); transition: border-color var(--fast), box-shadow var(--fast); }
textarea.input { resize: vertical; min-height: 92px; line-height: 1.45; }
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.input::placeholder { color: var(--ink-3); }
.hint { font-size: var(--t-sm); color: var(--ink-3); }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: var(--pill); background: var(--surface-2); color: var(--ink-2); font-size: var(--t-xs); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.good { background: var(--good-soft); color: var(--good); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 60%, transparent); animation: pulse 2.2s infinite; }
.dot.off { background: var(--ink-3); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 55%, transparent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }

/* ---------------------------------------------------------------- top bar */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--s4); height: 64px; padding: 0 var(--s5); background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; font-size: var(--t-lg); letter-spacing: -0.02em; }
.brand small { font-weight: 600; font-size: var(--t-sm); color: var(--ink-3); letter-spacing: 0; }
.mark { width: 32px; height: 32px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.mark svg { width: 20px; height: 20px; }
.topbar .grow { flex: 1; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-weight: 750; font-size: var(--t-sm); overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.footer { padding: var(--s6) var(--s5) var(--s7); color: var(--ink-3); font-size: var(--t-sm); display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); justify-content: center; align-items: center; }
.footer a { color: var(--ink-2); }
.stroban { display: inline-flex; align-items: center; gap: 6px; }
.stroban i { width: 16px; height: 16px; border-radius: 4px; background: #4338CA; display: inline-block; }

/* ---------------------------------------------------------------- home */
.home { max-width: 1120px; margin: 0 auto; padding: var(--s8) var(--s5) var(--s6); display: grid; grid-template-columns: 1.15fr .85fr; gap: var(--s7); align-items: center; }
.eyebrow { font-size: var(--t-sm); font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: var(--s4); }
.home h1 { font-size: clamp(36px, 5.2vw, 60px); letter-spacing: -0.035em; line-height: 1.04; }
.home h1 em { font-style: normal; color: var(--accent); }
.home .lede { margin-top: var(--s5); font-size: var(--t-lg); color: var(--ink-2); max-width: 34em; }
.home .cta { margin-top: var(--s6); display: flex; gap: var(--s3); flex-wrap: wrap; }
.kinds { margin-top: var(--s6); display: flex; flex-wrap: wrap; gap: var(--s2); }
.kinds span { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--pill); font-size: var(--t-sm); font-weight: 600; color: var(--ink-2); background: var(--surface); }
.joincard { padding: var(--s6); display: grid; gap: var(--s4); }
.joincard h2 { font-size: var(--t-xl); }
.code-input { width: 100%; height: 72px; text-align: center; font-size: 36px; font-weight: 750; letter-spacing: .22em; border-radius: var(--r); border: 2px solid var(--line-2); background: var(--surface-2); font-variant-numeric: tabular-nums; }
.code-input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); }
.err { color: var(--bad); font-size: var(--t-sm); font-weight: 600; min-height: 1.4em; }

/* ---------------------------------------------------------------- dialogs, toasts */
dialog { border: none; padding: 0; border-radius: var(--r-lg); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-3); width: min(440px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(10, 10, 18, .48); backdrop-filter: blur(4px); }
dialog[open] { animation: rise var(--med) var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.dlg { padding: var(--s6); display: grid; gap: var(--s4); }
.dlg header { display: flex; align-items: start; justify-content: space-between; gap: var(--s3); }
.dlg h2 { font-size: var(--t-xl); }
.or { display: flex; align-items: center; gap: var(--s3); color: var(--ink-3); font-size: var(--t-sm); }
.or::before, .or::after { content: ''; height: 1px; flex: 1; background: var(--line); }
.gbtn { min-height: 44px; display: grid; place-items: center; }
.toasts { position: fixed; z-index: 60; left: 50%; bottom: var(--s5); transform: translateX(-50%); display: grid; gap: var(--s2); width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; padding: 12px 16px; border-radius: var(--r); background: var(--ink); color: var(--bg); font-weight: 600; font-size: var(--t-sm); box-shadow: var(--shadow-2); animation: rise var(--med) var(--ease); display: flex; gap: var(--s2); align-items: center; }
.toast.bad { background: var(--bad); color: #fff; }

/* ---------------------------------------------------------------- studio: deck list */
.page { max-width: 1120px; margin: 0 auto; padding: var(--s6) var(--s5); }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s5); }
.page-head h1 { font-size: var(--t-2xl); }
.decks { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--s4); }
.deck { position: relative; display: grid; gap: var(--s3); padding: var(--s5); text-decoration: none; transition: transform var(--fast), box-shadow var(--fast), border-color var(--fast); cursor: pointer; }
.deck:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--line-2); }
.deck h3 { font-size: var(--t-lg); }
.deck .meta { display: flex; gap: var(--s3); color: var(--ink-3); font-size: var(--t-sm); }
.thumbs { display: flex; gap: 6px; }
.thumbs i { width: 30px; height: 22px; border-radius: 5px; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-3); }
.thumbs i svg { width: 13px; height: 13px; }
.newdeck { display: grid; place-items: center; gap: var(--s2); min-height: 170px; border: 2px dashed var(--line-2); border-radius: var(--r-lg); color: var(--ink-2); font-weight: 700; background: transparent; cursor: pointer; transition: border-color var(--fast), color var(--fast), background var(--fast); }
.newdeck:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.empty { text-align: center; padding: var(--s8) var(--s5); color: var(--ink-3); }
.plan-note { margin-top: var(--s5); font-size: var(--t-sm); color: var(--ink-3); }

/* ---------------------------------------------------------------- studio: editor */
.editor { display: grid; grid-template-columns: 260px minmax(0, 1fr) minmax(0, 420px); gap: 0; min-height: calc(100vh - 64px); }
.ed-rail { border-right: 1px solid var(--line); padding: var(--s4); display: flex; flex-direction: column; gap: var(--s2); background: var(--surface); }
.ed-rail h2 { font-size: var(--t-sm); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); padding: var(--s2) var(--s2) 0; }
.slide-item { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: var(--s2); padding: 10px 10px; border-radius: var(--r); border: 1px solid transparent; cursor: pointer; text-align: left; background: transparent; width: 100%; transition: background var(--fast), border-color var(--fast); }
.slide-item:hover { background: var(--surface-2); }
.slide-item.on { background: var(--accent-soft); border-color: var(--accent-line); }
.slide-item .n { font-size: var(--t-xs); font-weight: 750; color: var(--ink-3); text-align: center; }
.slide-item .t { font-size: var(--t-sm); font-weight: 650; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.slide-item .k { color: var(--ink-3); }
.slide-item.drag { opacity: .4; }
.slide-item.over { border-color: var(--accent); border-style: dashed; }
.ed-main { padding: var(--s6); display: grid; gap: var(--s5); align-content: start; max-width: 720px; width: 100%; margin: 0 auto; }
.ed-title { font-size: var(--t-2xl); font-weight: 780; letter-spacing: -0.025em; border: none; background: transparent; width: 100%; padding: 4px 0; border-bottom: 2px solid transparent; }
.ed-title:focus { outline: none; border-bottom-color: var(--accent); }
.types { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s2); }
.type { display: grid; gap: 6px; justify-items: start; padding: var(--s3); border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); text-align: left; cursor: pointer; font-weight: 650; font-size: var(--t-sm); transition: border-color var(--fast), background var(--fast); }
.type:hover { border-color: var(--line-2); }
.type.on { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); box-shadow: inset 0 0 0 1px var(--accent); }
.type .ic { color: var(--accent); }
.opts { display: grid; gap: var(--s2); }
.opt { display: grid; grid-template-columns: 30px 1fr auto; gap: var(--s2); align-items: center; }
.letter { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: var(--t-sm); color: #fff; background: var(--c1); }
.ed-actions { display: flex; gap: var(--s2); flex-wrap: wrap; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: var(--s4); }
.ed-preview { border-left: 1px solid var(--line); padding: var(--s5); background: var(--surface-2); display: grid; gap: var(--s3); align-content: start; position: sticky; top: 64px; height: calc(100vh - 64px); overflow: auto; }
.ed-preview h2 { font-size: var(--t-sm); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
/* the preview is a real 1280 × 800 stage, scaled to fit */
.mini-stage { position: relative; aspect-ratio: 16 / 10; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); background: var(--bg); box-shadow: var(--shadow-2); }
.mini-inner { position: absolute; left: 0; top: 0; width: 1280px; height: 800px; transform: scale(var(--k, .3)); transform-origin: 0 0; pointer-events: none; }
.mini-inner .stage-body { padding: 44px 64px; gap: 28px; }
.mini-inner .stage-q { font-size: 46px; }
.save-state { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-sm); color: var(--ink-3); }

/* ---------------------------------------------------------------- stage (presenter screen) */
.stage { position: fixed; inset: 0; display: grid; grid-template-rows: auto 1fr auto; background: var(--bg); overflow: hidden; }
.stage::before { content: ''; position: absolute; inset: -20% -10% auto auto; width: 60vw; height: 60vw; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 12%, transparent), transparent); pointer-events: none; }
.stage-top { position: relative; display: flex; align-items: center; gap: var(--s5); padding: var(--s4) var(--s6); }
.joinstrip { display: flex; align-items: center; gap: var(--s4); padding: 10px 12px 10px 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); cursor: pointer; }
.joinstrip .how { font-size: clamp(14px, 1.15vw, 20px); color: var(--ink-2); font-weight: 600; }
.joinstrip .how b { color: var(--ink); font-weight: 750; }
.joinstrip .code { font-size: clamp(22px, 2.1vw, 38px); font-weight: 800; letter-spacing: .08em; font-variant-numeric: tabular-nums; color: var(--accent); }
.joinstrip .qr { width: clamp(52px, 4.6vw, 84px); height: clamp(52px, 4.6vw, 84px); background: #fff; border-radius: 10px; padding: 4px; }
.joinstrip .qr svg { width: 100%; height: 100%; }
.stage-top .grow { flex: 1; }
.people { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; font-size: clamp(15px, 1.25vw, 22px); color: var(--ink-2); }
.stage-body { position: relative; display: grid; grid-template-rows: auto 1fr; gap: clamp(16px, 2.6vh, 40px); padding: clamp(12px, 2vh, 32px) clamp(24px, 6vw, 120px) clamp(16px, 3vh, 48px); min-height: 0; }
.stage-q { font-size: clamp(28px, 3.5vw, 66px); line-height: 1.08; letter-spacing: -0.03em; font-weight: 780; max-width: 26ch; text-wrap: balance; }
.stage-kind { display: flex; gap: var(--s3); align-items: center; margin-bottom: clamp(10px, 1.5vh, 20px); }
.stage-viz { min-height: 0; position: relative; }
.stage-dock { position: relative; display: flex; align-items: center; justify-content: center; gap: var(--s2); padding: var(--s3) var(--s5) var(--s4); transition: opacity var(--med) var(--ease), transform var(--med) var(--ease); }
.stage.idle .stage-dock { opacity: 0; transform: translateY(14px); pointer-events: none; }
.stage.idle { cursor: none; }
.dock { display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: var(--pill); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2); }
.dock .sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.dock .count { min-width: 64px; text-align: center; font-weight: 750; font-size: var(--t-sm); color: var(--ink-2); }
.hidden-note { display: grid; place-items: center; height: 100%; text-align: center; color: var(--ink-3); gap: var(--s3); font-size: clamp(16px, 1.4vw, 24px); font-weight: 650; }
.hidden-note .big { font-size: clamp(40px, 5vw, 90px); font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.qr-big { display: grid; justify-items: center; gap: var(--s4); padding: var(--s6); text-align: center; }
.qr-big .box { background: #fff; padding: 16px; border-radius: var(--r-lg); width: min(70vh, 420px); }
.qr-big .code { font-size: 44px; font-weight: 800; letter-spacing: .12em; color: var(--accent); }
.ended { display: grid; place-items: center; height: 100%; text-align: center; gap: var(--s4); }

/* bars */
.bars { display: grid; gap: clamp(10px, 2vh, 26px); align-content: center; height: 100%; max-width: 1400px; }
.bar { display: grid; gap: 8px; }
.bar-head { display: flex; align-items: baseline; gap: var(--s3); font-size: clamp(16px, 1.55vw, 30px); font-weight: 650; }
.bar-head .lbl { flex: 1; min-width: 0; }
.bar-head .pct { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 3.2em; text-align: right; }
.bar-head .cnt { font-size: .7em; color: var(--ink-3); font-weight: 650; font-variant-numeric: tabular-nums; }
.bar-track { height: clamp(14px, 2.4vh, 34px); border-radius: var(--pill); background: var(--track); overflow: hidden; }
.bar-fill { height: 100%; width: 0; border-radius: var(--pill); background: var(--c); transition: width var(--slow) var(--ease); }
.bar.lead .bar-head .pct { color: var(--c); }
.letter-sm { display: inline-grid; place-items: center; width: 1.5em; height: 1.5em; border-radius: .4em; font-size: .78em; font-weight: 800; color: #fff; background: var(--c); margin-right: .4em; vertical-align: .08em; }
:root[data-theme="dark"] .letter-sm, :root[data-theme="dark"] .letter { color: #0D0E15; }

/* word cloud */
.cloud { position: absolute; inset: 0; }
.cloud span { position: absolute; left: 50%; top: 50%; white-space: nowrap; font-weight: 780; letter-spacing: -0.02em; line-height: 1; color: var(--c); transition: transform var(--slow) var(--ease), font-size var(--slow) var(--ease), opacity var(--med); will-change: transform; }
.cloud span.new { opacity: 0; }
.cloud-empty, .viz-empty { display: grid; place-items: center; height: 100%; color: var(--ink-3); font-size: clamp(16px, 1.4vw, 24px); font-weight: 600; text-align: center; }

/* rating */
.rates { display: grid; gap: clamp(14px, 3vh, 36px); align-content: center; height: 100%; max-width: 1300px; }
.rate { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px var(--s5); align-items: center; }
.rate .lbl { font-size: clamp(16px, 1.6vw, 30px); font-weight: 650; }
.rate .avg { grid-row: span 2; font-size: clamp(32px, 3.6vw, 68px); font-weight: 800; font-variant-numeric: tabular-nums; color: var(--c); letter-spacing: -0.03em; line-height: 1; text-align: right; }
.rate .avg small { font-size: .35em; color: var(--ink-3); font-weight: 700; letter-spacing: 0; }
.scale { position: relative; height: clamp(12px, 2vh, 26px); border-radius: var(--pill); background: var(--track); }
.scale .fill { position: absolute; inset: 0 auto 0 0; border-radius: var(--pill); background: linear-gradient(90deg, color-mix(in srgb, var(--c) 35%, transparent), var(--c)); width: 0; transition: width var(--slow) var(--ease); }
.scale .ticks { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(4, 1fr); pointer-events: none; }
.scale .ticks i { border-right: 2px solid var(--bg); }
.scale .ticks i:last-child { border: none; }
.rate .dist { grid-column: 1; display: flex; gap: 4px; font-size: var(--t-xs); color: var(--ink-3); font-weight: 650; }

/* Q&A */
.qa { display: grid; gap: clamp(8px, 1.4vh, 16px); align-content: start; height: 100%; overflow: auto; padding-right: 4px; max-width: 1400px; }
.q { display: grid; grid-template-columns: auto 1fr auto; gap: var(--s4); align-items: center; padding: clamp(12px, 1.8vh, 22px) clamp(14px, 1.6vw, 26px); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); transition: transform var(--med) var(--ease), opacity var(--med); }
.q.top { border-color: var(--accent-line); box-shadow: var(--shadow-2); }
.q.top .qt { font-size: clamp(20px, 2vw, 38px); }
.q .votes { display: grid; justify-items: center; min-width: 56px; font-weight: 800; font-size: clamp(18px, 1.6vw, 30px); color: var(--accent); font-variant-numeric: tabular-nums; line-height: 1.1; }
.q .votes small { font-size: var(--t-xs); color: var(--ink-3); font-weight: 650; }
.q .qt { font-size: clamp(16px, 1.45vw, 26px); font-weight: 650; line-height: 1.3; }
.q .by { font-size: clamp(12px, .95vw, 16px); color: var(--ink-3); font-weight: 600; margin-top: 4px; }
.q.done { opacity: .55; }
.q.done .qt { text-decoration: line-through; text-decoration-thickness: 1px; }
.q .acts { display: flex; gap: 4px; }

/* ---------------------------------------------------------------- join (audience phone) */
.join { max-width: 520px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; padding: 0 var(--s4) var(--s6); }
.join-top { display: flex; align-items: center; gap: var(--s3); padding: var(--s4) 0; }
.join-top .t { flex: 1; min-width: 0; }
.join-top .t b { display: block; font-size: var(--t-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.join-top .t span { font-size: var(--t-xs); color: var(--ink-3); font-weight: 650; letter-spacing: .06em; }
.banner { display: flex; align-items: center; gap: var(--s2); padding: 10px 14px; border-radius: var(--r); background: var(--warn-soft); color: var(--warn); font-size: var(--t-sm); font-weight: 650; margin-bottom: var(--s3); }
.jcard { padding: var(--s5); display: grid; gap: var(--s4); animation: rise var(--med) var(--ease); }
.jcard h2 { font-size: 22px; line-height: 1.25; text-wrap: pretty; }
.choices { display: grid; gap: var(--s2); }
.choice { display: grid; grid-template-columns: 34px 1fr 24px; gap: var(--s3); align-items: center; min-height: 60px; padding: 10px 14px; border-radius: var(--r); border: 2px solid var(--line); background: var(--surface); text-align: left; cursor: pointer; font-weight: 650; font-size: 16px; line-height: 1.3; transition: border-color var(--fast), background var(--fast), transform var(--fast); }
.choice:active { transform: scale(.99); }
.choice .letter { background: var(--c); }
.choice.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, var(--surface)); }
.choice .tick { opacity: 0; color: var(--c); transition: opacity var(--fast); }
.choice.on .tick { opacity: 1; }
.sent { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--r); background: var(--good-soft); color: var(--good); font-weight: 700; font-size: var(--t-sm); }
.wait { display: grid; justify-items: center; text-align: center; gap: var(--s3); padding: var(--s7) var(--s4); color: var(--ink-2); }
.wait .ring { width: 54px; height: 54px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.stars { display: grid; gap: var(--s4); }
.star-row { display: grid; gap: var(--s2); }
.star-row .lbl { font-weight: 650; }
.seg5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.seg5 button { height: 50px; border-radius: var(--r-sm); border: 2px solid var(--line); background: var(--surface); font-weight: 800; font-size: var(--t-lg); cursor: pointer; transition: all var(--fast); }
.seg5 button.on { background: var(--c); border-color: var(--c); color: #fff; }
:root[data-theme="dark"] .seg5 button.on { color: #0D0E15; }
.seg5-legend { display: flex; justify-content: space-between; font-size: var(--t-xs); color: var(--ink-3); font-weight: 650; }
.my-words { display: flex; flex-wrap: wrap; gap: 6px; }
.my-words span { padding: 6px 12px; border-radius: var(--pill); background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: var(--t-sm); }
.jq { display: grid; grid-template-columns: 1fr auto; gap: var(--s3); align-items: center; padding: var(--s3) var(--s4); border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
.jq .qt { font-weight: 600; font-size: var(--t-md); line-height: 1.35; }
.jq .by { font-size: var(--t-xs); color: var(--ink-3); font-weight: 650; }
.up { display: grid; justify-items: center; min-width: 52px; min-height: 52px; align-content: center; gap: 2px; border-radius: var(--r-sm); border: 2px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 800; font-size: var(--t-sm); transition: all var(--fast); }
.up.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.jq.done { opacity: .6; }
.row { display: flex; gap: var(--s2); align-items: center; }
.between { display: flex; gap: var(--s3); align-items: center; justify-content: space-between; }
.count-left { font-size: var(--t-xs); color: var(--ink-3); font-weight: 650; text-align: right; }
.join-foot { margin-top: auto; padding-top: var(--s6); text-align: center; font-size: var(--t-xs); color: var(--ink-3); }

/* ---------------------------------------------------------------- responsive, motion */
@media (max-width: 1180px) {
  .editor { grid-template-columns: 220px minmax(0, 1fr); }
  .ed-preview { display: none; }
}
@media (max-width: 860px) {
  .home { grid-template-columns: 1fr; padding-top: var(--s6); gap: var(--s6); }
  .editor { grid-template-columns: 1fr; }
  .ed-rail { border-right: none; border-bottom: 1px solid var(--line); flex-direction: row; overflow-x: auto; padding: var(--s3); }
  .ed-rail h2 { display: none; }
  .slide-item { min-width: 200px; }
  .ed-main { padding: var(--s5) var(--s4); }
  .types { grid-template-columns: repeat(2, 1fr); }
  .stage-top { flex-wrap: wrap; padding: var(--s3) var(--s4); gap: var(--s3); }
  .stage-body { padding: var(--s3) var(--s4) var(--s4); }
  .topbar { padding: 0 var(--s4); }
  .topbar .hide-sm { display: none; }
  .dock { flex-wrap: wrap; justify-content: center; border-radius: var(--r-lg); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}
@media print { .topbar, .footer, .stage-dock { display: none; } }
