/* Palla house style (palla.com): navy + cyan, Rubik display, Work Sans body, IBM Plex Mono. Light-only on purpose. */
@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Rubik:wght@500;600&family=Work+Sans:wght@400;500;600&display=swap");

:root {
  color-scheme: light;
  --bg: #FFFFFF; --surface: #F5F6FA; --ink: #071336; --muted: #4A4D5E; --rule: #E4E6EE;
  --accent: #0D158B; --accent-2: #3037AA; --accent-soft: #E1F8FB; --cyan: #00FDEE; --cyan-soft: #CAFFFC;
  --hero-bg: #0D158B; --hero-ink: #FFFFFF; --hero-muted: #CAD6FF;
  --ok-bg: #CAFFFC; --ok-ink: #0D158B;
  --warn: #8A5A00; --warn-soft: #FFF4DB;
  --bad: #B42318; --bad-soft: #FDECEC; --code-bg: #F1F2F6;
  --current: #8C91A6; --target: var(--accent-2);
  --display: "Rubik", -apple-system, "Segoe UI", Roboto, sans-serif;
  --sans: "Work Sans", -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 var(--sans); }
h1, h2, h3 { font-family: var(--display); text-wrap: balance; }
a { color: var(--accent-2); font-weight: 500; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* hero */
header.hero { background: var(--hero-bg); color: var(--hero-ink); padding: 28px 16px; }
header.hero > * { max-width: 900px; margin-left: auto; margin-right: auto; }
header.hero h1 { margin-top: 0; margin-bottom: 0; font-size: clamp(26px, 5vw, 40px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
header.hero p { margin-top: 10px; margin-bottom: 0; color: var(--hero-muted); font-size: 17px; line-height: 28px; }
header.hero p:empty { display: none; }
header.hero a { color: var(--cyan); }

main { max-width: 900px; margin: 0 auto; padding: 16px 16px 80px; }
.card { background: var(--surface); border-radius: 12px; padding: 18px; margin: 12px 0; }
.muted { color: var(--muted); }
p { max-width: 68ch; }

/* Type hierarchy: category (L1) > question (L2) > prompt (L3) > mark labels (L4) > end labels / meta (L5) */
.eyebrow { font: 500 12px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent-2); }
.cat-head { margin: 40px 0 8px; }
.cat-title { margin: 4px 0 0; font-size: 28px; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 12px; padding-bottom: 8px; border-bottom: 2px solid var(--accent-soft); }
.cat-emoji { font-size: 30px; line-height: 1; }
h3, .q-title { margin: 0 0 4px; font-size: 19px; font-weight: 500; line-height: 1.3; }
.q-title .vs { color: var(--muted); font-weight: 400; padding: 0 6px; }
.prompt { margin: 0 0 14px; color: var(--muted); font-size: 14px; line-height: 22px; }

/* controls */
button, .btn { font: 500 15px/1.2 var(--sans); border: 1px solid var(--rule); background: var(--bg); color: var(--ink);
  border-radius: 999px; padding: 10px 18px; cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { border-color: var(--accent-2); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover, .btn.primary:hover { background: var(--accent-2); }
button.danger { background: var(--bad); border-color: var(--bad); color: #fff; font-weight: 600; }
button:disabled { opacity: .45; cursor: not-allowed; }
textarea, input[type=text], input[type=password], select { font: 15px/1.4 var(--sans); width: 100%; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--rule); background: var(--bg); color: var(--ink); }
textarea { font: 13px/1.55 var(--mono); background: var(--code-bg); min-height: 320px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pill { font: 500 11px/1 var(--mono); letter-spacing: .04em; text-transform: uppercase; padding: 5px 9px; border-radius: 999px; white-space: nowrap; }
.pill.open { background: var(--ok-bg); color: var(--ok-ink); }
.pill.closed { background: var(--bad-soft); color: var(--bad); }
.banner { border-radius: 12px; padding: 12px 16px; margin: 12px 0; background: var(--warn-soft); color: var(--warn); }
.error { color: var(--bad); white-space: pre-wrap; }
code.link { display: block; font: 13px/1.5 var(--mono); overflow-wrap: anywhere; background: var(--code-bg); padding: 8px 10px; border-radius: 8px; margin: 4px 0; }

/* avatar (colors are per-respondent identity, not brand accents) */
/* pale tint of the avatar's color behind the emoji, full-strength stroke around it, so the emoji stays legible */
.avatar { --c: #888; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: color-mix(in srgb, var(--c) 14%, #fff); border: 2px solid var(--c);
  font-size: 16px; line-height: 1; flex: none; box-shadow: 0 0 0 2px var(--bg); }
.avatar.big { width: 46px; height: 46px; font-size: 26px; border-width: 3px; }
/* "Currently" = solid stroke, "Should be" = dotted stroke (an aspiration, not yet real) */
.avatar.me { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); z-index: 2; }

/* respond: one row per mark */
.mark { display: grid; grid-template-columns: 96px 1fr; gap: 8px; align-items: center; margin: 8px 0; }
.mark .lbl { display: flex; flex-direction: column; align-items: flex-start; font: 500 13px/1.3 var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
.mark .lbl.current { color: var(--muted); }
.mark .clear { border: 0; background: none; padding: 2px 0 0; font: 400 12px/1.2 var(--sans); text-transform: none; letter-spacing: 0;
  color: var(--muted); text-decoration: underline; border-radius: 0; }
.ends { display: grid; grid-template-columns: 96px 1fr; gap: 8px; font-size: 13px; color: var(--muted); }
.ends div { display: flex; justify-content: space-between; gap: 8px; }
.ends div span:last-child { text-align: right; }
.sticky { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 10px 0; border-bottom: 1px solid var(--rule); }

/* respond: click-or-drag slider */
.slider { position: relative; height: 46px; padding: 0 18px; cursor: pointer; touch-action: pan-y; user-select: none;
  -webkit-user-select: none; border-radius: 12px; outline: none; background: var(--bg); }
.slider:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.slider[aria-disabled] { cursor: default; opacity: .6; }
.slider .inner { position: relative; height: 100%; }
.slider .rail { position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px; background: var(--rule); }
.slider.target .rail { background: var(--accent-soft); }
.slider .tick { position: absolute; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--rule);
  box-shadow: 0 0 0 2px var(--bg); }
.slider.target .tick { background: var(--cyan-soft); box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--accent-soft); }
.slider .thumb { position: absolute; top: 50%; width: 36px; height: 36px; font-size: 20px; transform: translate(-50%, -50%);
  transition: left .12s ease-out; cursor: grab; }
.slider.target .thumb { border-style: dotted; border-width: 3px; }
.slider.drag .thumb { transition: none; cursor: grabbing; transform: translate(-50%, -50%) scale(1.15); }
.slider:not([aria-disabled]):hover .rail { background: var(--accent-2); }
.slider .hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 12px; color: var(--muted);
  background: var(--bg); padding: 0 8px; pointer-events: none; white-space: nowrap; }
.slider.empty .thumb, .slider:not(.empty) .hint { display: none; }

/* respond: one question at a time */
.step-card { margin-top: 12px; padding: 22px; }
.step-card .cat-head { margin: 0 0 18px; }
.step-card .q-title { font-size: 22px; margin-top: 6px; }
.stepnav { display: flex; justify-content: space-between; gap: 8px; margin: 14px 0 28px; }
.stepnav button { min-width: 120px; }
.stepnav button.ready { box-shadow: 0 0 0 3px var(--cyan); }
.finish ul { padding-left: 20px; }
.finish li button { border: 0; background: none; padding: 2px 0; color: var(--accent-2); text-decoration: underline; border-radius: 0; }

/* results */
.lane { display: grid; grid-template-columns: 96px 1fr; gap: 8px; align-items: end; margin: 6px 0; }
.lane > .lbl { font: 500 13px/1.3 var(--mono) !important; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
.lane.current > .lbl { color: var(--muted); }
.lane .track { position: relative; border-bottom: 2px solid var(--rule); min-height: 34px; }
.lane.target .track { border-bottom-color: var(--accent-soft); }
.lane .track .tick { position: absolute; bottom: -6px; width: 2px; height: 10px; background: var(--rule); transform: translateX(-1px); }
.lane .track .avatar { position: absolute; transform: translateX(-50%); box-shadow: 0 0 0 2px var(--surface); }
.lane .track .avatar.me { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.lane.target .avatar { border-style: dotted; border-width: 3px; }
.lane .track .meanline { position: absolute; top: 0; bottom: -6px; width: 0; border-left: 2px solid var(--current); }
.lane.target .meanline { border-left: 2px dashed var(--target); }
.shift { display: grid; grid-template-columns: 96px 1fr; gap: 8px; align-items: center; }
.shift > span { font: 500 11px/1.2 var(--mono); letter-spacing: .04em; text-transform: uppercase; }
.shift svg { width: 100%; height: 16px; overflow: visible; }
.statline { display: flex; gap: 6px 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--rule); }
.statline b { color: var(--ink); font-weight: 600; }
.legend { display: flex; gap: 8px 16px; flex-wrap: wrap; font-size: 13px; align-items: center; color: var(--muted); }
.grid-avatars { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.grid-avatars .who { display: flex; gap: 6px; align-items: center; font: 400 13px/1 var(--mono); }

@media (max-width: 560px) {
  .mark, .ends, .lane, .shift { grid-template-columns: 1fr; gap: 2px; }
  .ends > span, .shift > span { display: none; }
  .cat-title { font-size: 24px; }
  .step-card { padding: 16px; }
  .step-card .q-title { font-size: 20px; }
}

/* who's here: position of each avatar in the flow */
.flow-title { font-size: 17px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.flow-title .muted { font: 400 13px/1 var(--sans); }
.flow-track { position: relative; margin: 8px 14px 18px; }
.flow-rail { position: absolute; left: 0; right: 0; bottom: 8px; height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-soft), var(--cyan-soft)); }
.flow-cat { position: absolute; bottom: -12px; transform: translateX(-50%); font-size: 14px; line-height: 1; }
.flow-av { position: absolute; transform: translateX(-50%); width: 26px; height: 26px; font-size: 14px; transition: left .4s ease, bottom .4s ease; }
.flow-av.away { opacity: .35; }
.flow-done { height: 100%; border-radius: 2px; background: var(--accent); transition: width .3s ease; }
.flow-more { position: absolute; transform: translateX(-50%); font: 500 11px/1 var(--mono); color: var(--muted); }
.flow-track.compact { margin: 6px 14px 16px; }
.flow-track.compact .flow-av { width: 22px; height: 22px; font-size: 12px; border-width: 2px; }
.flow-track.compact .flow-av.me { width: 26px; height: 26px; font-size: 14px; z-index: 3; }
.flow-track.compact .flow-cat { font-size: 13px; }
.flow-track.jump { cursor: pointer; }
.flow-track.jump:hover .flow-rail { outline: 2px solid var(--accent-soft); outline-offset: 2px; }

/* respondent intro: dismissable (button shown on phones only) */
header.hero { position: relative; }
.hero-close { display: none; position: absolute; top: 10px; right: 10px; border: 0; padding: 6px 10px; border-radius: 999px;
  background: rgba(255,255,255,.14); color: var(--hero-ink); font: 500 13px/1 var(--sans); }
.hero-close:hover { background: rgba(255,255,255,.24); }

/* countdown (respondent sticky bar + presenter) */
.countdown { display: grid; grid-template-columns: auto auto 1fr; gap: 10px; align-items: center; margin: 8px 0 0;
  font: 600 15px/1 var(--display); color: var(--accent); font-variant-numeric: tabular-nums; }
.countdown[hidden] { display: none; }
.cd-bar { height: 6px; border-radius: 3px; background: var(--accent-soft); overflow: hidden; }
.cd-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width .2s linear; }
.countdown.paused { color: var(--muted); } .countdown.paused .cd-fill { background: var(--muted); }
.countdown.warn { color: var(--warn); } .countdown.warn .cd-fill { background: #E0A21B; }
.countdown.urgent { color: var(--bad); } .countdown.urgent .cd-fill { background: var(--bad); }
.countdown.urgent .cd-time { animation: pulse 1s ease-in-out infinite; }
.countdown.done { color: var(--bad); }
@keyframes pulse { 50% { opacity: .45; } }

@media (max-width: 640px) {
  .hero-close { display: block; }
  header.hero { padding: 16px 16px 14px; }
  header.hero h1 { font-size: 24px; padding-right: 44px; }
  header.hero p { font-size: 14px; line-height: 21px; }
  header.hero.collapsed { padding: 10px 16px; }
  header.hero.collapsed h1 { font-size: 17px; }
  header.hero.collapsed p { display: none; }
  header.hero.collapsed .hero-close { top: 6px; }
  #me .muted { display: none; }
  #me .avatar.big { width: 36px; height: 36px; font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) { .countdown.urgent .cd-time { animation: none; } }

/* presenter view */
main.wide { max-width: 1200px; }
body.present header.hero > * { max-width: 1200px; }
.present-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.present-grid .card { display: flex; flex-direction: column; gap: 14px; margin: 12px 0 0; }
.timer-setup { display: flex; flex-direction: column; gap: 10px; }
#setup[hidden], #running[hidden] { display: none; }
#running .primary { font-size: 18px; padding: 12px 20px; }
#score { gap: 8px; }
.score-head { position: absolute; top: 12px; right: 12px; }
#score { position: relative; }
.score-head h3 { margin: 0; }
.score-line { display: flex; align-items: center; gap: 16px; }
.score-body { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
#score .big-pct { font-size: clamp(36px, 4.5vw, 56px); }
#score .score-stats b { font-size: 20px; }
.countdown.big { grid-template-columns: auto 1fr; grid-template-rows: auto auto; font-size: clamp(56px, 9vw, 112px); line-height: 1; }
.countdown.big .cd-icon { font-size: .45em; }
.countdown.big .cd-bar { grid-column: 1 / -1; height: 14px; border-radius: 7px; }
.big-pct { font: 600 clamp(56px, 9vw, 112px)/1 var(--display); color: var(--accent); font-variant-numeric: tabular-nums; }
.score-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.score-stats div { display: flex; flex-direction: column; }
.score-stats b { font: 600 28px/1.1 var(--display); }
.score-stats span { font-size: 13px; color: var(--muted); }
.music input[type=range] { width: 120px; }


/* moderator: "Discuss first" */
.focus { display: flex; flex-direction: column; gap: 10px; }
.focus h3 { margin: 0; }
.focus h4 { margin: 0 0 4px; font-size: .95rem; }
.focus-start { background: color-mix(in srgb, var(--accent) 8%, transparent); border-radius: 10px; padding: 10px 14px; }
.focus-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.focus-sub { font-size: .8rem; margin: 0 0 4px; }
.focus-list { margin: 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 4px; }
.focus-list li { line-height: 1.4; }
.focus-q { font-weight: 600; text-decoration: none; color: inherit; border-bottom: 1px dotted currentColor; }
.focus-q .vs { margin: 0 .3em; opacity: .6; font-weight: 400; }
.focus-detail { margin-left: .5em; font-size: .8rem; color: var(--muted); }
.focus-tag { display: inline-block; margin-left: .45em; padding: 1px 7px; border-radius: 999px; font-size: .72rem; font-weight: 600; vertical-align: 1px; }
.focus-tag.divided { background: color-mix(in srgb, var(--target) 18%, transparent); }
.focus-tag.gap { background: color-mix(in srgb, var(--current) 18%, transparent); }
[id^="q-"] { scroll-margin-top: 72px; }

/* moderator: smoothed spread per question (current solid, should-be dotted) */
.density-row { display: grid; grid-template-columns: 96px 1fr; gap: 8px; align-items: end; margin: 4px 0 10px; }
.density { display: block; width: 100%; height: 72px; overflow: visible; }
.density .d-fill { stroke: none; }
.density .d-fill.current { fill: color-mix(in srgb, var(--current) 16%, transparent); }
.density .d-fill.target { fill: color-mix(in srgb, var(--target) 12%, transparent); }
.density .d-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.density .d-line.current { stroke: var(--current); }
.density .d-line.target { stroke: var(--target); stroke-dasharray: 0.5 5; }
.density .d-base { stroke: var(--rule); stroke-width: 2; }
.density .d-tick { stroke: var(--rule); stroke-width: 2; }
.density-key { display: flex; flex-direction: column; gap: 4px; font: 500 11px/1.2 var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding-bottom: 2px; }
.density-key span { display: flex; align-items: center; gap: 6px; }
.density-key .k { display: inline-block; width: 18px; height: 0; border-top: 2.5px solid var(--current); }
.density-key .k.target { border-top: 3px dotted var(--target); }
@media (max-width: 560px) { .density-row { grid-template-columns: 1fr; gap: 2px; } .density-key { flex-direction: row; gap: 12px; } }

/* respondent start screen: choose your avatar */
.start h4 { margin: 14px 0 6px; font-size: .9rem; }
.start-preview { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); }
.start-preview .avatar.big { width: 56px; height: 56px; font-size: 32px; }
.pick-grid { display: grid; gap: 6px; }
.pick-grid.animals { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
.pick-grid.colors { grid-template-columns: repeat(auto-fill, minmax(36px, 44px)); }
.pick-animal { font-size: 24px; padding: 6px 0; line-height: 1; }
.pick-color { --c: #888; width: 36px; height: 36px; padding: 0; border-radius: 50%; background: var(--c); border: 3px solid transparent; }
.pick-animal[aria-pressed="true"] { outline: 3px solid var(--accent); outline-offset: 1px; }
.pick-color[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--bg, #fff), 0 0 0 5px var(--accent); }
.pick-animal:disabled, .pick-color:disabled { opacity: .25; cursor: not-allowed; }

/* halo when an avatar logs an answer: two rings in the avatar's color radiate out and fade */
.avatar.pulse:not(.flow-av):not(.thumb) { position: relative; }
.avatar.pulse::before, .avatar.pulse::after {
  content: ""; position: absolute; inset: -2px; border-radius: 50%; pointer-events: none;
  border: 2px solid var(--c); box-shadow: 0 0 10px 2px var(--c); opacity: 0;
  animation: halo 1.4s cubic-bezier(.2, .7, .3, 1) both; animation-delay: calc(var(--pd, 0ms) * -1);
}
.avatar.pulse::after { animation-delay: calc(350ms - var(--pd, 0ms)); }
@keyframes halo {
  0% { transform: scale(1); opacity: .85; }
  100% { transform: scale(2.6); opacity: 0; }
}
.flow-av.pulse.away { opacity: 1; } /* someone who just answered is clearly active */
@media (prefers-reduced-motion: reduce) { .avatar.pulse::before, .avatar.pulse::after { animation: none; } }

/* presenter: compact timer card with pop-out controls */
.present-grid { grid-template-columns: 1fr 1fr; align-items: stretch; } /* timer and completeness: same size */
@media (max-width: 760px) { .present-grid { grid-template-columns: 1fr; } }
#timerCard { position: relative; gap: 8px; }
.timer-head { position: absolute; top: 12px; right: 12px; z-index: 2; }
#timerCard { justify-content: center; }
.timer-head button { padding: 6px 12px; font-size: 13px; }
#timerCard .countdown.big { font-size: clamp(36px, 4.5vw, 56px); gap: 6px 10px; }
#timerCard .countdown.big .cd-bar { height: 8px; border-radius: 4px; }
.ctl-panel { position: absolute; top: calc(100% + 8px); left: 0; z-index: 30; width: min(440px, calc(100vw - 32px));
  background: var(--bg); border: 1px solid var(--rule); border-radius: 12px; padding: 16px;
  box-shadow: 0 16px 40px rgba(7, 19, 54, .18), 0 2px 6px rgba(7, 19, 54, .08);
  display: flex; flex-direction: column; gap: 12px; animation: pop .14s ease-out; }
.ctl-panel[hidden] { display: none; }
.ctl-panel .timer-setup { display: flex; flex-direction: column; gap: 10px; }
.ctl-panel .timer-setup[hidden], .ctl-panel #running[hidden] { display: none; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .ctl-panel { animation: none; } }

#score { justify-content: center; }
.present-grid > .card { margin-top: 12px; min-height: 150px; }

#score { padding-top: 34px; } /* room for the status pill */

/* presenter: double-size avatars on the flow track */
.flow-track.big { margin-top: 12px; }
.flow-track.big .flow-av { width: 52px; height: 52px; font-size: 28px; border-width: 3px; }
.flow-track.big .flow-cat { font-size: 20px; bottom: -18px; }
.flow-track.big .flow-rail { height: 6px; }

/* respondent score + Kahoot-style points pop */
#top { position: sticky; }
.my-score { font: 600 18px/1.1 var(--display); color: var(--accent); font-variant-numeric: tabular-nums; display: inline-block; }
.my-score.bump { animation: bump .5s ease-out; }
@keyframes bump { 30% { transform: scale(1.25); color: var(--accent-2); } }
.points-pop { position: absolute; right: 8px; top: 8px; pointer-events: none; z-index: 10;
  font: 700 22px/1 var(--display); color: var(--accent); background: var(--cyan-soft); padding: 6px 12px; border-radius: 999px;
  box-shadow: 0 6px 18px rgba(7, 19, 54, .18); animation: popup 1.5s cubic-bezier(.2, .8, .3, 1) forwards; }
.points-pop.fast { background: var(--cyan); }
@keyframes popup { 0% { opacity: 0; transform: translateY(10px) scale(.7); } 15% { opacity: 1; transform: translateY(0) scale(1.1); }
  30% { transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-34px); } }
@media (prefers-reduced-motion: reduce) { .points-pop { animation: none; } .my-score.bump { animation: none; } }

/* ---------- presenter leaderboard (Kahoot-style podium) ---------- */
.lb { position: fixed; inset: 0; z-index: 100; overflow: hidden; color: #fff;
  background: radial-gradient(ellipse at 50% 110%, #3037AA 0%, #0D158B 45%, #071336 100%);
  display: flex; flex-direction: column; align-items: center; padding: 28px 16px; }
.lb[hidden] { display: none; }
.lb-close { position: absolute; top: 16px; right: 16px; background: rgba(255,255,255,.12); color: #fff; border-color: transparent; z-index: 5; }
.lb-title { font: 600 clamp(24px, 3.4vw, 40px)/1.2 var(--display); margin: 0 0 8px; text-align: center; animation: fadein .6s ease-out; }
.podium { flex: 1; width: min(1000px, 100%); display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 18px; align-items: end; }
.slot { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.pedestal { width: 100%; border-radius: 14px 14px 0 0; display: grid; place-items: start center; padding-top: 14px;
  font: 700 clamp(28px, 4vw, 52px)/1 var(--display); color: var(--hero-bg); transform: scaleY(0); transform-origin: bottom;
  transition: transform .7s cubic-bezier(.2, 1.3, .4, 1); }
.s1 .pedestal { height: 38vh; background: linear-gradient(#FFE58A, #F5B700); }
.s2 .pedestal { height: 27vh; background: linear-gradient(#F1F3F8, #B9C0CF); }
.s3 .pedestal { height: 20vh; background: linear-gradient(#F6C9A0, #C98446); }
.slot.in .pedestal { transform: scaleY(1); }
.slot.rolling::after { content: "🥁"; font-size: 48px; margin-bottom: 20px; animation: shake .12s linear infinite; }
.lb-who { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 14px;
  opacity: 0; transform: translateY(30px) scale(.6); }
.slot.in .lb-who { animation: popin .8s .35s cubic-bezier(.2, 1.4, .4, 1) forwards; }
.lb-av { width: 110px !important; height: 110px !important; font-size: 64px !important; border-width: 4px !important; z-index: 2;
  box-shadow: 0 0 0 4px rgba(255,255,255,.9), 0 10px 30px rgba(0,0,0,.35) !important; }
.s1 .lb-av { width: 140px !important; height: 140px !important; font-size: 82px !important; }
.lb-name { font: 600 clamp(16px, 2vw, 24px)/1.2 var(--display); text-align: center; z-index: 2; }
.lb-score { font: 600 clamp(18px, 2.2vw, 28px)/1 var(--display); color: var(--cyan); font-variant-numeric: tabular-nums; z-index: 2; }
.burst { position: absolute; top: 55px; left: 50%; width: 360px; height: 360px; margin: -180px 0 0 -180px; z-index: 1; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, rgba(0,253,238,.30) 0deg 9deg, transparent 9deg 22.5deg);
  -webkit-mask: radial-gradient(circle, #000 15%, transparent 68%); mask: radial-gradient(circle, #000 15%, transparent 68%);
  animation: spin 9s linear infinite, burstin .9s ease-out; }
.s1 .burst { top: 70px; width: 520px; height: 520px; margin: -260px 0 0 -260px;
  background: repeating-conic-gradient(from 0deg, rgba(255,229,138,.45) 0deg 9deg, transparent 9deg 22.5deg); }
.lb-rest { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 22px; justify-content: center;
  opacity: 0; transition: opacity .6s; max-width: 1000px; }
.lb.done .lb-rest { opacity: 1; }
.lb-rest li { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.lb-rank { font: 600 14px/1 var(--mono); color: var(--hero-muted); }
.lb-rest-score { font: 500 13px/1 var(--mono); color: var(--cyan); }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 4; }
.confetti i { position: absolute; top: -20px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate(var(--dx), 110vh) rotate(var(--r)); } }
@keyframes popin { to { opacity: 1; transform: none; } }
@keyframes spin { to { rotate: 360deg; } }
@keyframes burstin { from { scale: .2; opacity: 0; } }
@keyframes shake { 50% { transform: translate(2px, -2px) rotate(4deg); } }
@keyframes fadein { from { opacity: 0; transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) {
  .burst, .confetti i, .slot.rolling::after { animation: none; }
  .slot.in .lb-who { animation: none; opacity: 1; transform: none; }
  .pedestal { transition: none; }
}

/* respondent: forward-only flow hint */
.advance-hint { margin: 12px 0 28px; text-align: center; font-size: 14px; color: var(--muted); }
.advance-hint.ready { color: var(--accent); font-weight: 600; animation: fadein .3s ease-out; }

/* "Should be" visual language, everywhere: one stroke (3px, dotted, --target), matching the dotted
   "Should be" avatars and the density key. "Currently" stays solid. */
:root { --target-stroke: 3px dotted var(--target); }
.slider.target .rail { background: transparent; height: 0; margin-top: -1.5px; border-top: var(--target-stroke); border-radius: 0; }
.slider.target:not([aria-disabled]):hover .rail { background: transparent; border-top-color: var(--accent); }
.slider.target .tick { background: var(--rule); box-shadow: 0 0 0 2px var(--bg); }
.lane.target .track { border-bottom: var(--target-stroke); }
.lane.target .meanline { border-left: var(--target-stroke); }
.density .d-line.target { stroke-width: 3; stroke-dasharray: 0.01 6; stroke-linecap: round; }

/* ---------- join codes + QR ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.card.join { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 22px; }
.code-input { flex: 1 1 220px; font: 600 clamp(28px, 8vw, 40px)/1.2 var(--mono); letter-spacing: .3em; text-transform: uppercase;
  text-align: center; padding: 10px 12px; min-width: 0; }
.code-input::placeholder { color: var(--rule); }
.card.join button { font-size: 18px; padding: 14px 26px; }
.card.join .error { flex-basis: 100%; margin: 0; }
.card.join .error:empty { display: none; }
details.create summary { cursor: pointer; }
details.create[open] summary { margin-bottom: 8px; }
.join-share { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.join-share img { background: #fff; border-radius: 8px; padding: 6px; flex: none; }
.code-big { font: 600 40px/1.1 var(--mono); letter-spacing: .2em; color: var(--accent); }

/* presenter: chip in the hero, full-screen join card */
.hero-row { display: flex; align-items: center; gap: 16px; }
.hero-row h1 { flex: 1; min-width: 0; }
.join-chip { display: flex; align-items: center; gap: 12px; background: #fff; color: var(--ink); border: 0; border-radius: 12px;
  padding: 6px 14px 6px 6px; cursor: pointer; text-align: left; flex: none; }
.join-chip img { display: block; }
.join-chip > span { display: flex; flex-direction: column; }
.join-host { font: 500 13px/1.3 var(--mono); color: var(--muted); }
.join-code { font: 600 30px/1.1 var(--mono); letter-spacing: .14em; color: var(--accent); }
.join-ov { position: fixed; inset: 0; z-index: 60; background: var(--hero-bg); color: var(--hero-ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3vh; padding: 24px; }
.join-ov[hidden] { display: none; }
.join-ov-title { margin: 0; font-size: clamp(24px, 3.6vw, 44px); text-align: center; }
.join-ov-body { display: flex; align-items: center; gap: 5vw; flex-wrap: wrap; justify-content: center; }
.join-ov-body img { width: min(52vh, 80vw); height: auto; background: #fff; border-radius: 16px; padding: 12px; }
.join-ov-text p { margin: 0; }
.join-step { font-size: clamp(18px, 2.2vw, 28px); color: var(--hero-muted); }
.join-url { font: 600 clamp(24px, 3.4vw, 48px)/1.3 var(--mono); color: var(--cyan); margin: 4px 0 18px !important; }
.join-code-xl { font: 600 clamp(56px, 9vw, 128px)/1.1 var(--mono); letter-spacing: .16em; color: #fff; }
@media (max-width: 640px) { .join-chip img { width: 56px; height: 56px; } .join-code { font-size: 22px; } }
