/* Sauti Live — one stylesheet for audience, presenter dashboard and big screen. */
:root {
  --paper: #f6f3ee;
  --card: #ffffff;
  --ink: #17171f;
  --ink-2: #4a4a57;
  --muted: #74737f;
  --line: #e4dfd6;
  /* Brand tokens — overridden per session by /theme/<code>.css */
  --accent: #e8471f;
  --accent-ink: #111111;
  --teal: #0d877b;      /* "second" brand colour: correct answers, live states */
  --teal-ink: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 14%, var(--paper));
  --teal-soft: color-mix(in srgb, var(--teal) 16%, var(--paper));
  --gold: #f2a900;
  --danger: #d6342b;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(23, 23, 31, .06), 0 8px 24px rgba(23, 23, 31, .06);
  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --body: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not(.force-light) {
    --paper: #121218;
    --card: #1c1c25;
    --ink: #f3f1ec;
    --ink-2: #c9c7d1;
    --muted: #9a98a6;
    --line: #2d2d3a;
    --accent-soft: color-mix(in srgb, var(--accent) 22%, var(--paper));
    --teal-soft: color-mix(in srgb, var(--teal) 22%, var(--paper));
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: var(--paper); color: var(--ink);
  font: 16px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: inherit; }
button { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); letter-spacing: .06em; }
.muted { color: var(--muted); margin: .25rem 0 0; }
.hint { color: var(--muted); font-size: .875rem; margin: .5rem 0 0; }
.error { color: var(--danger); font-weight: 500; margin: .5rem 0 0; }
.notice { background: var(--accent-soft); border-radius: var(--radius-sm); padding: .6rem .8rem; margin: .75rem 0; font-size: .95rem; }
.empty { color: var(--muted); list-style: none; padding: 1rem 0; }
.h1, .h2, .h3 { font-family: var(--display); line-height: 1.15; margin: 0; letter-spacing: -.01em; }
.h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; }
.h2 { font-size: 1.4rem; font-weight: 700; }
.h3 { font-size: 1.15rem; font-weight: 700; }
.h3 a { text-decoration: none; }
.h3 a:hover { text-decoration: underline; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 700; color: var(--accent); margin: 0 0 .35rem; }
.label { display: block; font-weight: 700; font-size: .875rem; margin: 1rem 0 .4rem; color: var(--ink-2); }
.label .hint { display: inline; font-weight: 400; }

/* Brand */
.brand { display: inline-flex; align-items: center; gap: .55rem; font-family: var(--display); font-weight: 800; font-size: 1.05rem; text-decoration: none; min-width: 0; }
.brand > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand__mark { display: inline-flex; align-items: flex-end; gap: 3px; width: 28px; height: 28px; padding: 6px; border-radius: 8px; background: var(--accent); flex: none; }
.brand__mark i { flex: 1; background: #fff; border-radius: 2px; }
.brand__mark i:nth-child(1) { height: 55%; } .brand__mark i:nth-child(2) { height: 100%; } .brand__mark i:nth-child(3) { height: 75%; }
.brand--lg { font-size: 1.4rem; }
.brand--lg .brand__mark { width: 36px; height: 36px; padding: 8px; }

/* Controls */
.input {
  width: 100%; padding: .7rem .85rem; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card); color: var(--ink); font: inherit; transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
textarea.input { resize: vertical; min-height: 3.2rem; }
.input--lg { font-size: 1.1rem; padding: .85rem 1rem; }
.input--code { font-family: var(--mono); font-size: 1.6rem; letter-spacing: .25em; text-align: center; text-transform: uppercase; }
.input--title { font-family: var(--display); font-size: 1.5rem; font-weight: 800; border-color: transparent; background: transparent; padding: .2rem .4rem; margin-left: -.4rem; }
.input--title:hover { border-color: var(--line); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem 1rem; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card);
  font-weight: 700; font-size: .95rem; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .08s, background .15s, border-color .15s;
}
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { border-color: var(--accent); filter: brightness(1.05); }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); border-color: transparent; }
.btn--danger { color: var(--danger); }
.btn.btn--danger:not(.btn--ghost) { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--sm { padding: .4rem .75rem; font-size: .85rem; }
.btn--lg { padding: .85rem 1.4rem; font-size: 1.05rem; }
.btn--block { width: 100%; margin-top: 1rem; }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; cursor: pointer; color: var(--muted); }
.icon-btn:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); }
.icon-btn:disabled { opacity: .3; cursor: default; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }

.chip { display: inline-block; padding: .25rem .7rem; border-radius: 999px; background: var(--accent-soft); color: var(--ink); font-weight: 700; font-size: .85rem; max-width: 45vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; background: var(--line); color: var(--ink-2); }
.pill--live { background: var(--teal); color: var(--teal-ink); }
.pill--ended { background: var(--ink); color: var(--paper); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card--pad { padding: 1.25rem; }

.tabs { display: flex; gap: .25rem; padding: .25rem; background: color-mix(in srgb, var(--ink) 6%, transparent); border-radius: 999px; margin: 0 0 1rem; }
.tab { flex: 1; border: 0; background: transparent; padding: .55rem 1rem; border-radius: 999px; font-weight: 700; cursor: pointer; color: var(--ink-2); }
.tab.is-active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.tab__count { display: inline-block; min-width: 1.4em; padding: 0 .35em; margin-left: .25rem; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .75rem; line-height: 1.4em; }

.toast { position: fixed; left: 50%; bottom: calc(1.25rem + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: .65rem 1.1rem; border-radius: 999px; font-weight: 500; z-index: 50; box-shadow: var(--shadow); max-width: calc(100vw - 2rem); }
.conn { position: fixed; top: .75rem; left: 50%; transform: translateX(-50%); background: var(--gold); color: #1d1600; font-weight: 700; padding: .35rem .9rem; border-radius: 999px; font-size: .85rem; z-index: 40; }

/* ================= Home ================= */
.home { max-width: 440px; margin: 0 auto; padding: 12vh 1.25rem 2rem; text-align: center; }
.home__title { font-family: var(--display); font-size: 2.2rem; font-weight: 800; margin: 2rem 0 .25rem; letter-spacing: -.02em; }
.code-form { display: flex; flex-direction: column; gap: .75rem; margin-top: 1.75rem; }
.home__host { margin-top: 2.5rem; font-size: .9rem; color: var(--muted); }

/* ================= Audience (phone first) ================= */
.aud { max-width: 560px; margin: 0 auto; padding: 0 1rem calc(2rem + env(safe-area-inset-bottom)); }
.aud__bar { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .85rem 0; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px); }
.aud__panel { padding: .25rem 0 1rem; }
.aud__center { text-align: center; padding-top: 18vh; }
.aud__title { font-family: var(--display); font-size: 2rem; font-weight: 800; margin: 0 0 1rem; letter-spacing: -.02em; line-height: 1.1; }
.aud__q { font-family: var(--display); font-size: 1.55rem; font-weight: 700; line-height: 1.2; margin: 0 0 1.1rem; letter-spacing: -.01em; overflow-wrap: anywhere; }
.aud__results { margin-top: .25rem; }
.options { display: grid; gap: .6rem; }
.option {
  display: flex; align-items: center; gap: .8rem; width: 100%; text-align: left;
  padding: .95rem 1rem; border: 2px solid var(--line); border-radius: var(--radius); background: var(--card);
  font-size: 1.05rem; font-weight: 500; cursor: pointer; transition: border-color .15s, background .15s, transform .08s;
  overflow-wrap: anywhere;
}
.option:active:not(:disabled) { transform: scale(.985); }
.option__key { flex: none; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 8px; background: color-mix(in srgb, var(--ink) 7%, transparent); font-weight: 800; font-family: var(--display); }
.option.is-chosen { border-color: var(--accent); background: var(--accent-soft); }
.option.is-chosen .option__key { background: var(--accent); color: var(--accent-ink); }
.option.is-correct { border-color: var(--teal); background: var(--teal-soft); }
.option.is-correct .option__key { background: var(--teal); color: var(--teal-ink); }
.option.is-wrong { border-color: var(--danger); }
.option:disabled { cursor: default; }
.verdict { font-family: var(--display); font-weight: 800; font-size: 1.3rem; margin: 1rem 0 0; }
.verdict.is-right { color: var(--teal); } .verdict.is-wrong { color: var(--danger); }
.rating { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; }
.rating__btn { aspect-ratio: 1; border: 2px solid var(--line); border-radius: var(--radius); background: var(--card); font-family: var(--display); font-size: 1.6rem; font-weight: 800; cursor: pointer; }
.rating__btn.is-chosen { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.rating__ends { display: flex; justify-content: space-between; color: var(--muted); font-size: .85rem; margin-top: .35rem; }
.open .input { font-size: 1.05rem; }
.ask__row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-top: .5rem; }
.ask__row .hint { margin: 0; }
.mine { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.mine li { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: .3rem .75rem; font-size: .9rem; overflow-wrap: anywhere; }
.waiting { text-align: center; padding: 14vh 0 2rem; }
.pulse { display: inline-flex; gap: 6px; align-items: flex-end; height: 40px; margin-bottom: 1rem; }
.pulse i { width: 9px; border-radius: 5px; background: var(--accent); animation: pulse 1.1s ease-in-out infinite; }
.pulse i:nth-child(2) { animation-delay: .15s; } .pulse i:nth-child(3) { animation-delay: .3s; }
@keyframes pulse { 0%, 100% { height: 12px; opacity: .5; } 50% { height: 40px; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pulse i { animation: none; height: 24px; } }
.board-card { background: var(--ink); color: var(--paper); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1.25rem; }
.board-card .hint { color: color-mix(in srgb, var(--paper) 70%, transparent); }
.board-mini { list-style: none; padding: 0; margin: .6rem 0 0; display: grid; gap: .3rem; }
.board-mini li { display: grid; grid-template-columns: 2.5rem 1fr auto; gap: .5rem; padding: .3rem .5rem; border-radius: 8px; }
.board-mini li.is-me { background: color-mix(in srgb, var(--accent) 35%, transparent); }
.board-mini .rank { color: var(--gold); font-weight: 800; }

/* Q&A (shared) */
.ask { margin-bottom: 1.25rem; }
.ask .label { margin-top: 0; }
.qa-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.qa { display: flex; gap: .75rem; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem .9rem; }
.qa.is-answered { opacity: .6; }
.qa.is-hidden { opacity: .45; border-style: dashed; }
.qa__body { flex: 1; min-width: 0; }
.qa__text { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.qa__meta { margin: .2rem 0 0; color: var(--muted); font-size: .85rem; }
.qa__actions { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }
.vote { flex: none; display: flex; flex-direction: column; align-items: center; min-width: 3rem; padding: .35rem .5rem; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--card); cursor: pointer; line-height: 1.1; }
.vote span { font-size: .8rem; color: var(--muted); }
.vote.is-voted { border-color: var(--accent); background: var(--accent-soft); }
.vote.is-voted span { color: var(--accent); }
.vote:disabled { cursor: default; opacity: .7; }

/* Results (shared) */
.bars { list-style: none; padding: 0; margin: 0; display: grid; gap: .55rem; }
.bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label num" "track track"; gap: .2rem .75rem; }
.bar__label { grid-area: label; font-weight: 500; overflow-wrap: anywhere; }
.bar__num { grid-area: num; font-variant-numeric: tabular-nums; }
.bar__num small { color: var(--muted); }
.bar__track { grid-area: track; height: 12px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 7%, transparent); overflow: hidden; }
.bar__fill { display: block; height: 100%; width: var(--w); background: var(--accent); border-radius: 999px; transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.bar.is-correct .bar__fill { background: var(--teal); }
.bar.is-correct .bar__label { font-weight: 800; color: var(--teal); }
.bar.is-dim { opacity: .55; }
.bar.is-dim .bar__fill { background: var(--muted); }
.bars--rating .bar { grid-template-columns: 1.5rem minmax(0, 1fr) auto; grid-template-areas: "label track num"; align-items: center; }
.avg { font-size: 1.05rem; margin: .9rem 0 0; }
.avg b { font-family: var(--display); font-size: 1.6em; }
.cloud { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: .1em .55em; padding: .5rem 0 1rem; font-family: var(--display); font-weight: 700; line-height: 1.1; }
.cloud__w { overflow-wrap: anywhere; }
.cloud__w.c0 { color: var(--accent); } .cloud__w.c1 { color: var(--teal); } .cloud__w.c2 { color: var(--ink); } .cloud__w.c3 { color: #7a5af8; } .cloud__w.c4 { color: var(--gold); }
.wall { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: .5rem; }
.wall__item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .6rem .75rem; overflow-wrap: anywhere; }
.wall__item small { display: block; color: var(--muted); margin-top: .2rem; }

/* ================= Presenter dashboard ================= */
.host-bar { display: flex; align-items: center; gap: 1rem; padding: .85rem 1.25rem; border-bottom: 1px solid var(--line); background: var(--card); position: sticky; top: 0; z-index: 20; }
.host-bar__extra { flex: 1; }
.host-login { min-height: 70vh; display: grid; place-items: center; padding: 1rem; }
.host-login .card { width: min(380px, 100%); }
.host-wrap { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.host-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.host-head__title { flex: 1 1 360px; min-width: 0; }
.host-head__actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.host-meta { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: .9rem; }
.host-meta b { color: var(--ink); font-size: 1.05rem; }
.inline-form { display: flex; gap: .5rem; flex: 1 1 380px; max-width: 520px; }
.event-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 1rem; }
.event-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; display: flex; flex-direction: column; gap: .4rem; box-shadow: var(--shadow); }
.event-card__top { display: flex; justify-content: space-between; align-items: center; }
.event-card__code { color: var(--muted); font-weight: 700; }
.event-card__actions { display: flex; gap: .4rem; margin-top: auto; padding-top: .6rem; flex-wrap: wrap; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state .h2, .empty-state .h3 { color: var(--ink); }
.tabs--host { max-width: 540px; }

.build { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 1.25rem; align-items: start; }
.build__list { position: sticky; top: 5rem; min-width: 0; }
.build__editor, .run__preview, .run__controls { min-width: 0; }
.slide-list { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: .4rem; }
.slide-item { min-width: 0; display: flex; align-items: center; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius-sm); }
.slide-item.is-selected { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.slide-item.is-live { background: linear-gradient(90deg, var(--teal-soft), var(--card) 40%); }
.slide-item__main { flex: 1; min-width: 0; display: flex; gap: .65rem; align-items: center; padding: .6rem .7rem; border: 0; background: transparent; text-align: left; cursor: pointer; }
.slide-item__n { flex: none; display: grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 7px; background: color-mix(in srgb, var(--ink) 7%, transparent); font-weight: 800; font-size: .85rem; }
.slide-item.is-live .slide-item__n { background: var(--teal); color: var(--teal-ink); }
.slide-item__text { min-width: 0; display: flex; flex-direction: column; }
.slide-item__text small { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.slide-item__text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slide-item__move { display: flex; flex-direction: column; padding-right: .25rem; }
.slide-item__move .icon-btn { height: 22px; }
.add-slide { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.add-slide .label { margin: 0 .25rem 0 0; }
.editor .label:first-child { margin-top: 0; }
.seg { display: inline-flex; flex-wrap: wrap; gap: .25rem; padding: .25rem; border-radius: 999px; background: color-mix(in srgb, var(--ink) 6%, transparent); }
.seg__btn { border: 0; background: transparent; padding: .45rem .9rem; border-radius: 999px; font-weight: 700; font-size: .9rem; cursor: pointer; color: var(--ink-2); }
.seg__btn.is-on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.opt-row { display: grid; grid-template-columns: 2rem 1fr auto auto; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.opt-row__key { font-family: var(--display); font-weight: 800; color: var(--muted); text-align: center; }
.tick { width: 2.3rem; height: 2.3rem; border-radius: 50%; border: 1.5px solid var(--line); background: var(--card); color: var(--muted); cursor: pointer; font-weight: 800; }
.tick.is-on { background: var(--teal); border-color: var(--teal); color: var(--teal-ink); }
.editor__actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }

.run { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 1.25rem; align-items: start; }
.run__controls { position: sticky; top: 5rem; }
.run__nav { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .4rem; }
.run__nav .btn { padding-inline: .5rem; }
.run__toggles { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1rem; }
.toggle { border: 1.5px solid var(--line); background: var(--card); border-radius: 999px; padding: .4rem .8rem; font-weight: 700; font-size: .85rem; cursor: pointer; }
.toggle::before { content: ""; display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: var(--line); margin-right: .45rem; vertical-align: middle; }
.toggle.is-on { border-color: var(--teal); }
.toggle.is-on::before { background: var(--teal); }
.toggle:disabled { opacity: .4; cursor: not-allowed; }
.run__preview { min-height: 320px; }
.run__preview .h2 { margin-bottom: .25rem; overflow-wrap: anywhere; }
.run__preview .muted { margin-bottom: 1rem; }
.run__slides { grid-column: 1 / -1; list-style: none; padding: 0; margin: 0; display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .5rem; }
.run-slide { flex: 0 0 200px; display: flex; gap: .5rem; align-items: flex-start; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: .6rem; cursor: pointer; font-size: .9rem; }
.run-slide span:last-child { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.run-slide.is-live { border-color: var(--teal); }
.run-slide.is-live .slide-item__n { background: var(--teal); color: var(--teal-ink); }
.qa-list--host .qa { align-items: center; }

@media (max-width: 820px) {
  .build, .run { grid-template-columns: 1fr; }
  .build__list, .run__controls { position: static; }
  .host-head__actions { width: 100%; }
}
@media (max-width: 520px) {
  .host-bar { padding: .7rem 1rem; }
  .host-wrap { padding: 1rem 1rem 3rem; }
  .inline-form { flex-direction: column; }
  .qa-list--host .qa { flex-direction: column; align-items: stretch; }
}

/* ================= Big screen ================= */
.page-present {
  --paper: #101016; --card: #1b1b24; --ink: #f5f3ee; --ink-2: #d1cfd8; --muted: #9b99a8; --line: #2c2c39;
  --accent-soft: color-mix(in srgb, var(--accent) 22%, var(--paper));
  --teal-soft: color-mix(in srgb, var(--teal) 22%, var(--paper));
  color-scheme: dark;
  overflow: hidden;
}
/* Light projector style — better in bright rooms and for brands built on white */
.page-present.present-light {
  --paper: #f7f5f0; --card: #ffffff; --ink: #16161d; --ink-2: #3d3d48; --muted: #6c6b78; --line: #e2ddd3;
  --shadow: 0 1px 2px rgba(23, 23, 31, .06), 0 8px 24px rgba(23, 23, 31, .08);
  color-scheme: light;
}
.present-light .board__row, .present-light .wall__item, .present-light .qa { box-shadow: var(--shadow); }
.stage { height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding: clamp(1rem, 2.2vw, 2.25rem) clamp(1.25rem, 3.5vw, 3.5rem); }
.stage__bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-size: clamp(.9rem, 1.4vw, 1.35rem); color: var(--muted); }
.stage__bar b { color: var(--ink); }
.stage__left { display: flex; align-items: center; gap: 1.5rem; min-width: 0; }
.stage__join { display: flex; align-items: center; gap: .9rem; }
.stage__logo img { display: block; height: clamp(32px, 4.5vh, 56px); width: auto; max-width: 22vw; object-fit: contain; }
.lobby__logo:empty, .stage__logo:empty, .join-logo:empty { display: none; }
.lobby__logo { margin-bottom: clamp(1rem, 3vh, 2rem); }
.lobby__logo img { display: block; height: clamp(56px, 11vh, 130px); width: auto; max-width: 50vw; object-fit: contain; }
.stage__qr-mini { width: clamp(56px, 6vw, 96px); height: auto; border-radius: 8px; background: #fff; }
.stage__stats { font-variant-numeric: tabular-nums; }
.stage__main { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr; gap: 2.5rem; padding-top: clamp(1rem, 3vh, 2.5rem); }
.stage__main.with-qa { grid-template-columns: 1fr minmax(300px, 30%); }
.stage__keys { position: fixed; bottom: .8rem; left: 50%; transform: translateX(-50%); color: var(--muted); font-size: .8rem; opacity: .7; transition: opacity .4s; white-space: nowrap; }
.stage__keys.is-flash { opacity: 1; color: var(--gold); font-weight: 700; }
.is-idle .stage__keys:not(.is-flash) { opacity: 0; }
.is-idle { cursor: none; }
.conn--stage { top: auto; bottom: 2.5rem; }

.lobby { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 0; }
.lobby__title { font-family: var(--display); font-weight: 800; font-size: clamp(2rem, 4.5vw, 4.5rem); letter-spacing: -.02em; line-height: 1.05; margin: 0 0 clamp(1rem, 4vh, 3rem); max-width: 22ch; }
.lobby__join { display: flex; align-items: center; gap: clamp(2rem, 5vw, 5rem); }
.lobby__qr { width: clamp(200px, 32vh, 420px); height: auto; background: #fff; border-radius: 22px; padding: 14px; }
.lobby__how { text-align: left; }
.lobby__step { font-size: clamp(1.1rem, 2vw, 1.8rem); margin: 0; font-weight: 500; }
.lobby__or { color: var(--muted); margin: .6rem 0 .1rem; font-size: clamp(.9rem, 1.4vw, 1.2rem); }
.lobby__url { font-family: var(--display); font-weight: 700; font-size: clamp(1.4rem, 2.6vw, 2.6rem); margin: 0; }
.lobby__code { font-weight: 800; font-size: clamp(2.6rem, 6vw, 6rem); margin: 0; color: var(--accent); letter-spacing: .12em; line-height: 1; }
.lobby__people { margin-top: clamp(1rem, 4vh, 3rem); font-size: clamp(1rem, 1.8vw, 1.6rem); color: var(--muted); }
.lobby__people span { color: var(--ink); font-weight: 800; font-family: var(--display); font-size: 1.4em; }

.slide { display: flex; flex-direction: column; min-height: 0; }
.slide__eyebrow { text-transform: uppercase; letter-spacing: .14em; color: var(--accent); font-weight: 800; margin: 0 0 .5rem; font-size: clamp(.8rem, 1.2vw, 1.1rem); }
.slide__prompt { font-family: var(--display); font-weight: 800; font-size: clamp(1.8rem, 4vw, 4rem); line-height: 1.08; letter-spacing: -.02em; margin: 0 0 clamp(1rem, 4vh, 2.5rem); max-width: 30ch; overflow-wrap: anywhere; }
.slide__body { flex: 1; min-height: 0; overflow: hidden; }
.slide__status { color: var(--muted); font-size: clamp(.9rem, 1.3vw, 1.2rem); margin: 1rem 0 0; }
.bars--big { gap: clamp(.6rem, 2vh, 1.4rem); font-size: clamp(1.1rem, 2vw, 2rem); }
.bars--big .bar__track { height: clamp(16px, 3vh, 34px); }
.bars--big .bar__num b { font-family: var(--display); font-size: 1.2em; }
.bars--big.bars--rating .bar { grid-template-columns: 2.5rem minmax(0, 1fr) auto; }
.slide .avg { font-size: clamp(1.2rem, 2.2vw, 2.2rem); }
.cloud--big { font-size: clamp(1rem, 2vw, 1.9rem); padding-bottom: 1.5rem; }
.wall--big { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); font-size: clamp(1rem, 1.5vw, 1.4rem); }
.hidden-results { text-align: center; padding-top: 6vh; color: var(--muted); font-size: clamp(1.1rem, 2vw, 1.8rem); }
.big-count { font-family: var(--display); font-weight: 800; font-size: clamp(5rem, 14vw, 12rem); color: var(--ink); line-height: 1; }

.board__list { list-style: none; padding: 0; margin: 0; display: grid; gap: clamp(.4rem, 1.5vh, 1rem); max-width: 900px; }
.board__row { display: grid; grid-template-columns: 4rem 1fr auto; align-items: center; gap: 1rem; background: var(--card); border-radius: var(--radius); padding: clamp(.6rem, 1.6vh, 1.1rem) 1.25rem; font-size: clamp(1.1rem, 2vw, 2rem); }
.board__rank { font-family: var(--display); font-weight: 800; color: var(--muted); }
.board__name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board__score { font-family: var(--display); font-weight: 800; font-variant-numeric: tabular-nums; }
.rank-1 { background: linear-gradient(90deg, color-mix(in srgb, var(--gold) 35%, var(--card)), var(--card)); }
.rank-1 .board__rank { color: var(--gold); }
.rank-2 .board__rank { color: #c7ccd6; } .rank-3 .board__rank { color: #d08a4e; }

.qa-panel { border-left: 1px solid var(--line); padding-left: 2rem; overflow: hidden; }
.qa-panel__title { font-family: var(--display); font-size: clamp(1.1rem, 1.8vw, 1.6rem); margin: 0 0 1rem; }
.qa-list--stage .qa { font-size: clamp(.95rem, 1.3vw, 1.25rem); }
.vote--static { cursor: default; }

@media (max-aspect-ratio: 1/1) {
  .lobby__join { flex-direction: column; }
  .lobby__how { text-align: center; }
  .stage__main.with-qa { grid-template-columns: 1fr; }
  .qa-panel { border-left: 0; padding-left: 0; }
}

/* ================= Client logos & credit ================= */
.logo { display: inline-flex; align-items: center; }
.logo img { display: block; }
/* A logo shown on the "wrong" background sits on a tile so it stays legible */
.logo--tile-light { background: #fff; padding: .35em .6em; border-radius: 10px; }
.logo--tile-dark { background: #16161d; padding: .35em .6em; border-radius: 10px; }
/* Phones follow the OS theme; a tile appears only when the one uploaded logo is on the wrong background */
@media (prefers-color-scheme: dark) { :root:not(.force-light) .logo--auto.logo--only-light { background: #fff; padding: .3em .55em; border-radius: 10px; } }
@media not (prefers-color-scheme: dark) { .logo--auto.logo--only-dark { background: #16161d; padding: .3em .55em; border-radius: 10px; } }
.aud__bar .logo img { height: 32px; width: auto; max-width: 46vw; object-fit: contain; }
.join-logo { margin: .5rem 0 1.25rem; }
.is-joining .aud__bar .logo { visibility: hidden; }
.join-logo .logo img { height: 56px; width: auto; max-width: 70vw; object-fit: contain; }

.credit { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .35rem; margin: 2.5rem 0 0; color: var(--muted); font-size: .78rem; }
.credit a { color: inherit; font-weight: 700; }
.credit__mark { display: inline-flex; align-items: flex-end; gap: 2px; width: 13px; height: 12px; }
.credit__mark i { flex: 1; background: currentColor; border-radius: 1px; }
.credit__mark i:nth-child(1) { height: 55%; } .credit__mark i:nth-child(2) { height: 100%; } .credit__mark i:nth-child(3) { height: 75%; }
.credit--stage { position: fixed; right: clamp(1.25rem, 3.5vw, 3.5rem); bottom: .8rem; margin: 0; font-size: clamp(.7rem, .9vw, .9rem); opacity: .8; }

/* ================= Brand editor (presenter dashboard) ================= */
.brand-ed { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 440px); gap: 1.25rem; align-items: start; }
.brand-ed__form .label:first-child { margin-top: 0; }
.brand-ed__section { padding-bottom: 1.1rem; margin-bottom: 1.1rem; border-bottom: 1px solid var(--line); }
.brand-ed__section:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.brand-ed__section h3 { margin: 0 0 .25rem; }
.logo-slots { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.logo-slot { border: 1.5px dashed var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.logo-slot__view { height: 110px; display: grid; place-items: center; padding: .75rem; }
.logo-slot__view img { max-height: 70px; max-width: 100%; object-fit: contain; }
.logo-slot__view--light { background: #ffffff; color: #6c6b78; }
.logo-slot__view--dark { background: #16161d; color: #9b99a8; }
.logo-slot__bar { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; justify-content: space-between; padding: .5rem .6rem; background: var(--card); border-top: 1px solid var(--line); font-size: .82rem; }
.logo-slot__bar b { font-size: .82rem; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.swatches { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.swatch { display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .3rem .25rem .25rem; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: .8rem; }
.swatch__dot { width: 1.4rem; height: 1.4rem; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .1); }
.swatch button { border: 0; background: transparent; font-weight: 700; font-size: .75rem; cursor: pointer; padding: .2rem .35rem; border-radius: 999px; color: var(--ink-2); }
.swatch button:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.colour-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.colour-field { display: flex; gap: .5rem; align-items: center; }
.colour-field input[type="color"] { width: 3rem; height: 2.75rem; padding: .2rem; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--card); cursor: pointer; flex: none; }
.colour-field .input { font-family: var(--mono); text-transform: lowercase; }
.warn { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .6rem 0 0; padding: .55rem .75rem; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--gold) 18%, var(--card)); font-size: .88rem; }
.warn .swatch__dot { width: 1rem; height: 1rem; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2.2rem; }
.font-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.switch { display: flex; align-items: center; gap: .6rem; cursor: pointer; font-weight: 500; }
.switch input { width: 2.6rem; height: 1.5rem; appearance: none; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background .15s; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 1.1rem; height: 1.1rem; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--teal); }
.switch input:checked::after { transform: translateX(1.1rem); }
.switch input:disabled { opacity: .45; cursor: not-allowed; }
.inline-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.save-state { color: var(--muted); font-size: .82rem; min-height: 1.2em; }

/* Live preview: scoped tokens are set on .pv by JS (CSSOM — CSP-safe) */
.brand-ed__preview { position: sticky; top: 5rem; display: grid; gap: 1rem; }
.pv { --pv-paper: #f6f3ee; --pv-card: #fff; --pv-ink: #17171f; --pv-muted: #74737f; --pv-line: #e4dfd6;
  font-family: var(--pv-body); color: var(--pv-ink); }
.pv-stage { aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; padding: 4.5% 5%; display: flex; flex-direction: column; gap: 4%;
  background: var(--pv-stage-bg); color: var(--pv-stage-ink); box-shadow: var(--shadow); container-type: inline-size; }
.pv-stage__bar { display: flex; justify-content: space-between; align-items: center; font-size: 2.6cqi; color: var(--pv-stage-muted); }
.pv-stage__bar img { height: 6cqi; width: auto; max-width: 30cqi; object-fit: contain; }
.pv-stage__bar .logo--tile-light, .pv-stage__bar .logo--tile-dark { padding: .6cqi 1.2cqi; border-radius: 1.2cqi; }
.pv-eyebrow { font-size: 2.2cqi; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--pv-accent); margin: 0; }
.pv-title { font-family: var(--pv-display); font-weight: 800; font-size: 5.4cqi; line-height: 1.08; margin: 0; letter-spacing: -.02em; }
.pv-bars { display: grid; gap: 2.6cqi; font-size: 2.6cqi; }
.pv-bar { display: grid; grid-template-columns: 1fr auto; gap: .6cqi; }
.pv-bar__track { grid-column: 1 / -1; height: 2.2cqi; border-radius: 999px; background: color-mix(in srgb, var(--pv-stage-ink) 10%, transparent); overflow: hidden; }
.pv-bar__fill { display: block; height: 100%; border-radius: 999px; background: var(--pv-accent); }
.pv-bar.is-correct .pv-bar__fill { background: var(--pv-second); }
.pv-bar.is-correct span:first-child { color: var(--pv-second); font-weight: 800; }
.pv-phone { width: 210px; justify-self: center; border-radius: 28px; padding: 10px; background: #0d0d12; box-shadow: var(--shadow); }
.pv-phone__screen { border-radius: 20px; background: var(--pv-paper); padding: 14px 12px 12px; min-height: 360px; display: flex; flex-direction: column; gap: 8px; font-size: 11px; }
.pv-phone__bar { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.pv-phone__bar img { height: 20px; width: auto; max-width: 110px; object-fit: contain; }
.pv-phone__bar .logo--tile-light, .pv-phone__bar .logo--tile-dark { padding: 3px 6px; border-radius: 6px; }
.pv-chip { background: color-mix(in srgb, var(--pv-accent) 16%, var(--pv-paper)); border-radius: 999px; padding: 2px 8px; font-weight: 700; font-size: 10px; }
.pv-q { font-family: var(--pv-display); font-weight: 700; font-size: 15px; line-height: 1.2; margin: 4px 0; }
.pv-opt { display: flex; align-items: center; gap: 8px; padding: 8px; border: 1.5px solid var(--pv-line); border-radius: 10px; background: var(--pv-card); }
.pv-opt b { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: #eeebe5; font-size: 10px; }
.pv-opt.is-chosen { border-color: var(--pv-accent); background: color-mix(in srgb, var(--pv-accent) 12%, var(--pv-card)); }
.pv-opt.is-chosen b { background: var(--pv-accent); color: var(--pv-accent-ink); }
.pv-opt.is-correct { border-color: var(--pv-second); background: color-mix(in srgb, var(--pv-second) 14%, var(--pv-card)); }
.pv-opt.is-correct b { background: var(--pv-second); color: var(--pv-second-ink); }
.pv-btn { margin-top: auto; text-align: center; padding: 9px; border-radius: 999px; background: var(--pv-accent); color: var(--pv-accent-ink); font-weight: 700; }
.pv-credit { text-align: center; color: var(--pv-muted); font-size: 8.5px; }
.pv-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 .4rem; }

@media (max-width: 980px) {
  .brand-ed { grid-template-columns: 1fr; }
  .brand-ed__preview { position: static; }
}
@media (max-width: 560px) {
  .logo-slots, .colour-row, .font-row { grid-template-columns: 1fr; }
}
