/* «Мынкины Голосовальщики» — участник (светлая/тёмная схема) и экран проектора (тёмный). */

:root {
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --signal: #ff5a2b;
  --signal-ink: #b93a12;
  --bg: #f4f1ea;
  --surface: #ffffff;
  --surface-2: #ebe6db;
  --text: #16181d;
  --muted: #585d66;
  --line: #d9d3c6;
  --ok: #16745f;
  --warn: #9b5a00;
  --danger: #b4231a;
  --focus: #1f5fff;
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --signal-ink: #ff8a5c;
    --bg: #111317;
    --surface: #1b1e24;
    --surface-2: #252932;
    --text: #f1ede5;
    --muted: #a6abb5;
    --line: #343944;
    --ok: #52c7a5;
    --warn: #f0b252;
    --danger: #ff7b6e;
    --focus: #8fb0ff;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, p { margin: 0; }

button, input, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.noscript { padding: 2rem; text-align: center; }

/* ---------- brand ---------- */
.brand {
  display: inline-flex; align-items: center; gap: .5em; min-width: 0;
  font-weight: 750; letter-spacing: -.01em;
}
.brand-name { min-width: 0; }
.brand-mark {
  width: 1.15em; height: 1.15em; flex: none; border-radius: 50%;
  background: radial-gradient(circle, var(--signal) 0 24%, transparent 26% 44%, var(--signal) 46% 56%, transparent 58% 74%, color-mix(in srgb, var(--signal) 45%, transparent) 76% 84%, transparent 86%);
}

.kicker {
  font-size: .8125rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--signal-ink);
}

/* ---------- boot / join ---------- */
.boot {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem;
  font-size: 1.25rem;
}
.boot-text { color: var(--muted); font-size: 1rem; text-align: center; max-width: 28rem; padding: 0 1rem; }

.join {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center; padding: 1.25rem;
}
.join-card {
  width: 100%; max-width: 26rem; padding: 2rem 1.5rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: 0 20px 50px -30px rgba(0, 0, 0, .35);
}
.join-card .brand { font-size: 1.1rem; }
.join-title { margin: 1.25rem 0 1.5rem; font-size: 1.6rem; line-height: 1.15; letter-spacing: -.02em; }
.join-form { display: grid; gap: .75rem; }
.join-label { font-weight: 650; }
#join-code {
  width: 100%; min-height: 3.5rem; padding: .5rem 1rem;
  font-size: 1.6rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  background: var(--bg); border: 2px solid var(--line); border-radius: 12px;
}
#join-code:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 30%, transparent); }
#join-code[aria-invalid="true"] { border-color: var(--danger); }
.join-help { color: var(--muted); font-size: .95rem; }
.join-error { color: var(--danger); font-weight: 600; min-height: 1.2em; }
.join-error:empty { min-height: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 3rem; padding: .6rem 1.25rem;
  border: 2px solid transparent; border-radius: 12px; cursor: pointer;
  font-weight: 700; touch-action: manipulation;
}
.btn-large { min-height: 3.5rem; font-size: 1.1rem; width: 100%; }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { background: color-mix(in srgb, var(--text) 85%, var(--signal)); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }

/* ---------- toasts ---------- */
.toasts {
  position: fixed; z-index: 50; left: 50%; transform: translateX(-50%);
  top: max(.75rem, env(safe-area-inset-top));
  width: min(32rem, calc(100% - 1.5rem));
  display: grid; gap: .5rem; pointer-events: none;
}
.toast {
  padding: .8rem 1rem; border-radius: 12px; font-weight: 600;
  background: var(--danger); color: #fff;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .45);
  animation: toast-in .2s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- participant ---------- */
.surface-participant .app {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  max-width: 36rem; margin: 0 auto;
}
.p-head {
  position: sticky; top: 0; z-index: 5;
  display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; gap: .15rem .75rem;
  padding: max(.85rem, env(safe-area-inset-top)) 1.1rem .85rem;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.p-event {
  color: var(--muted); font-size: .9rem; text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.p-head .conn { grid-column: 1 / -1; }

.conn { font-size: .85rem; font-weight: 600; display: inline-flex; align-items: center; gap: .4rem; }
.conn::before {
  content: ""; width: .55rem; height: .55rem; border-radius: 50%; background: var(--warn); flex: none;
}
.conn[data-state="live"] { color: var(--muted); }
.conn[data-state="live"]::before { background: var(--ok); }
.conn[data-state="reconnecting"] { color: var(--warn); }
.surface-participant .conn[data-state="live"] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.surface-participant .conn[data-state="reconnecting"] {
  margin-top: .4rem; padding: .45rem .7rem; border-radius: 10px;
  background: color-mix(in srgb, var(--warn) 14%, transparent);
}

.p-main { flex: 1; min-width: 0; padding: 1.5rem 1.1rem 1rem; }
.p-stage { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.p-stage > * { min-width: 0; }
.p-title { font-size: clamp(1.5rem, 6.4vw, 2rem); line-height: 1.15; letter-spacing: -.02em; text-wrap: balance; overflow-wrap: anywhere; }
.lead { font-size: 1.1rem; color: var(--muted); }
.hint { color: var(--muted); }
.wait {
  display: flex; gap: .75rem; align-items: flex-start;
  margin-top: .5rem; padding: 1rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
}
.pulse {
  flex: none; width: .8rem; height: .8rem; margin-top: .35rem; border-radius: 50%;
  background: var(--signal); animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .35; transform: scale(.8); } }

.badge {
  justify-self: start;
  font-size: .85rem; font-weight: 650; padding: .3rem .65rem; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
}
.badge[data-open="true"] { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }

.meta { color: var(--muted); font-size: .95rem; }

.options { display: grid; gap: .65rem; }
.opt {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .85rem;
  width: 100%; min-height: 3.75rem; padding: .85rem 1rem;
  text-align: left; cursor: pointer; touch-action: manipulation;
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius);
  transition: border-color .15s, background-color .15s;
}
.opt:hover { border-color: color-mix(in srgb, var(--text) 35%, var(--line)); }
.opt-mark {
  width: 1.35rem; height: 1.35rem; border-radius: 50%;
  border: 2px solid var(--muted); position: relative; z-index: 1;
}
.opt-label { position: relative; z-index: 1; font-weight: 600; }
.opt-result { position: relative; z-index: 1; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); }
.opt-bar {
  position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--p, 0));
  background: color-mix(in srgb, var(--signal) 13%, transparent);
  transition: transform .5s ease;
}
.opt[aria-pressed="true"] { border-color: var(--signal); background: color-mix(in srgb, var(--signal) 6%, var(--surface)); }
.opt[aria-pressed="true"] .opt-mark { border-color: var(--signal); background: radial-gradient(circle, var(--signal) 0 45%, transparent 50%); }
.opt[aria-disabled="true"] { cursor: default; }
.opt[aria-disabled="true"]:not([aria-pressed="true"]) .opt-label { color: var(--muted); }

.words-form { display: grid; gap: .6rem; }
.words-label { font-weight: 700; }
.words-help { color: var(--muted); font-size: .95rem; }
.words-input {
  width: 100%; min-height: 7.5rem; padding: .85rem 1rem; resize: vertical;
  font-size: 1.15rem; line-height: 1.5;
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius);
}
.words-input:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 30%, transparent); }
.words-input[readonly] { background: var(--surface-2); color: var(--muted); }
.privacy {
  font-size: .9rem; padding: .65rem .8rem; border-radius: 10px;
  border-left: 4px solid var(--signal); background: color-mix(in srgb, var(--signal) 8%, transparent);
}
.words-count { font-size: .9rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.words-count[data-bad="true"] { color: var(--danger); font-weight: 650; }

.mine-label { font-size: .9rem; color: var(--muted); margin-bottom: .4rem; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .45rem; }
.chip {
  padding: .35rem .75rem; border-radius: 999px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.chip-top { display: inline-flex; gap: .5rem; align-items: baseline; }
.chip-n { color: var(--signal-ink); font-variant-numeric: tabular-nums; font-size: .9em; }
.sub { font-size: 1rem; margin-bottom: .5rem; }
.empty { color: var(--muted); font-style: italic; }

.p-foot {
  position: sticky; bottom: 0; z-index: 5;
  padding: .75rem 1.1rem max(.75rem, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}
.react-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.react-btn {
  display: grid; justify-items: center; gap: .1rem;
  min-height: 4.25rem; padding: .45rem .25rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  cursor: pointer; touch-action: manipulation;
  transition: transform .12s, opacity .2s;
}
.react-btn:active { transform: scale(.95); }
.react-btn[aria-disabled="true"] { opacity: .5; cursor: default; }
.react-btn[aria-disabled="true"]:active { transform: none; }
.react-emoji { font-size: 1.6rem; line-height: 1.1; }
.react-label { font-size: .72rem; color: var(--muted); font-weight: 600; }
.react-count { font-size: .8rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.react-btn.sent { animation: sent .6s ease-out; }
@keyframes sent { 30% { transform: scale(1.08); border-color: var(--signal); } }
.react-note { margin-top: .45rem; font-size: .78rem; color: var(--muted); text-align: center; }

/* ---------- content stages: slide & links (both surfaces) ---------- */
.p-content { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; padding-top: .25rem; }
.slide { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.4rem; }
.slide-col { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 1.4rem; min-width: 0; }
.blk { display: grid; grid-template-columns: minmax(0, 1fr); gap: .55rem; min-width: 0; }
.blk-label {
  font-size: .8125rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--signal-ink); overflow-wrap: anywhere;
}
.blk-p { font-size: 1.125rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.blk-list { margin: 0; padding-left: 1.35em; display: grid; gap: .45rem; font-size: 1.125rem; line-height: 1.5; }
.blk-list li { white-space: pre-wrap; overflow-wrap: anywhere; padding-left: .2em; }
.blk-list li::marker { color: var(--signal); }
.blk-quote {
  margin: 0; padding: .35rem 0 .35rem 1.1rem; display: grid; gap: .6rem;
  border-left: 4px solid var(--signal);
  font-family: Georgia, "Iowan Old Style", "Times New Roman", serif; font-style: italic;
}
.blk-quote .blk-p { font-size: 1.25rem; line-height: 1.5; }
.blk-code {
  min-width: 0; overflow: hidden; border-radius: 12px;
  background: #1b1d22; color: #ece7dd; border: 1px solid #2c313b;
}
.blk-lang {
  display: block; padding: .5rem .95rem 0;
  font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #a3a8b2;
}
.code-scroll {
  margin: 0; padding: .6rem .95rem .9rem; max-width: 100%;
  overflow-x: auto; overflow-y: hidden; white-space: pre; tab-size: 4; -moz-tab-size: 4;
  font: .9rem/1.55 ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
  scrollbar-width: thin; scrollbar-color: #4a505c transparent;
  -webkit-overflow-scrolling: touch;
}
.code-scroll:focus-visible { outline-offset: -3px; }
.code-scroll code { font: inherit; }

.slide-links { display: grid; gap: .6rem; }
.links-title { font-size: 1rem; font-weight: 700; }
.links { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: .65rem; }
.link-card {
  position: relative; min-width: 0; display: grid; gap: .25rem;
  padding: .9rem 2.75rem .95rem 1rem;
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius);
  transition: border-color .15s;
}
.link-card:hover { border-color: color-mix(in srgb, var(--signal) 55%, var(--line)); }
.link-a { display: grid; gap: .2rem; color: inherit; text-decoration: none; min-width: 0; touch-action: manipulation; }
/* The whole card is the link target; the description stays readable text. */
.link-a::after { content: ""; position: absolute; inset: -2px; border-radius: var(--radius); }
.link-a:focus-visible { outline: none; }
.link-a:focus-visible::after { outline: 3px solid var(--focus); outline-offset: 2px; }
.link-label {
  font-size: 1.1rem; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em;
  text-decoration-color: color-mix(in srgb, var(--signal) 60%, transparent);
}
.link-host { font-size: .875rem; font-weight: 600; color: var(--signal-ink); overflow-wrap: anywhere; }
.link-ext { position: absolute; top: .85rem; right: 1rem; font-size: 1.15rem; line-height: 1; color: var(--signal-ink); }
.link-desc { color: var(--muted); font-size: .95rem; overflow-wrap: anywhere; }
.link-card-bad { border-style: dashed; padding-right: 1rem; }
.link-card-bad .link-label { text-decoration: none; color: var(--muted); }
.link-card-bad .link-host { color: var(--muted); font-style: italic; }

/* ---------- screen (projector) ---------- */
.surface-screen {
  --bg: #0f1115;
  --surface: #181b21;
  --surface-2: #232730;
  --text: #f3efe7;
  --muted: #a3a8b2;
  --line: #2c313b;
  --signal-ink: #ff7f50;
  --ok: #4fcaa6;
  --warn: #f1b450;
  --focus: #8fb0ff;
  color-scheme: dark;
  background:
    radial-gradient(120vmax 80vmax at 110% -20%, rgba(255, 90, 43, .12), transparent 60%),
    var(--bg);
  overflow: hidden;
}
.surface-screen .join-card { background: var(--surface); }

.s-shell {
  height: 100vh; height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(16rem, 25vw, 26rem);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0 clamp(1.5rem, 3vw, 3.5rem);
  padding: clamp(1.25rem, 2.6vw, 2.75rem) clamp(1.5rem, 3.4vw, 4rem);
}
.s-shell.has-controls { padding-bottom: 4.25rem; }
.s-head {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 1.25rem;
  padding-bottom: clamp(1rem, 2vw, 2rem);
  font-size: clamp(1rem, 1.25vw, 1.4rem);
}
.s-head .brand { font-size: 1.15em; }
.s-event { display: flex; gap: .75rem; align-items: baseline; min-width: 0; padding-left: 1.25rem; border-left: 1px solid var(--line); }
.s-event-title { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-event-sub { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-head .conn { margin-left: auto; font-size: .8em; }
.s-head .conn[data-state="live"] { opacity: .55; }

.s-main { min-height: 0; display: flex; }
.s-stage { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: clamp(1rem, 2.2vh, 2rem); }
.s-stage .kicker { font-size: clamp(.85rem, 1.05vw, 1.2rem); display: flex; align-items: center; gap: .9rem; }
.s-stage .badge { font-size: .85em; letter-spacing: .04em; }

.s-hero { margin: auto 0; display: grid; gap: clamp(.75rem, 2vh, 1.5rem); max-width: 60rem; }
.s-hero-title { font-size: clamp(2.6rem, 5.6vw, 6.5rem); line-height: 1.02; letter-spacing: -.035em; text-wrap: balance; }
.s-hero-sub { font-size: clamp(1.25rem, 2vw, 2.25rem); color: var(--muted); }
.s-hero-cta { font-size: clamp(1.1rem, 1.5vw, 1.7rem); max-width: 40rem; padding-top: 1rem; border-top: 2px solid var(--signal); }

.s-q-head { display: grid; gap: clamp(.5rem, 1.2vh, 1rem); }
.s-q-title { font-size: clamp(2rem, 3.7vw, 4.4rem); line-height: 1.08; letter-spacing: -.03em; text-wrap: balance; }
.s-q-hint { font-size: clamp(1rem, 1.35vw, 1.6rem); color: var(--muted); }
.s-q-body { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; }
.s-meta { font-size: clamp(1rem, 1.3vw, 1.5rem); color: var(--muted); font-variant-numeric: tabular-nums; }

.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: clamp(.7rem, 2vh, 1.6rem); }
.bar {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .45rem 1.5rem; align-items: baseline;
  font-size: clamp(1.15rem, 1.75vw, 2.1rem);
}
.bar-label { font-weight: 650; }
.bar-count { font-weight: 750; font-variant-numeric: tabular-nums; }
.bar-track {
  grid-column: 1 / -1; height: clamp(.9rem, 2vh, 1.6rem); border-radius: 999px;
  background: var(--surface-2); overflow: hidden;
}
.bar-fill {
  display: block; height: 100%; width: 100%; border-radius: inherit;
  transform-origin: left; transform: scaleX(var(--p, 0));
  background: color-mix(in srgb, var(--text) 55%, var(--surface-2));
  transition: transform .7s cubic-bezier(.2, .8, .2, 1);
}
.bar.top .bar-fill { background: var(--signal); }
.bar.top .bar-count { color: var(--signal-ink); }
.bar.concealed .bar-track { background: repeating-linear-gradient(90deg, var(--surface-2) 0 14px, transparent 14px 20px); opacity: .55; }
.s-hidden-note { margin-top: clamp(1rem, 2.4vh, 2rem); font-size: clamp(1rem, 1.3vw, 1.5rem); color: var(--muted); }
.s-hidden-note:empty { display: none; }

.cloud {
  flex: 1; min-height: 0; overflow: hidden;
  display: flex; flex-wrap: wrap; align-content: center; justify-content: center; align-items: center;
  gap: .2em .85em; padding: 1rem 0; text-align: center;
  font-size: clamp(.75rem, 1.05vw, 1.25rem);
}
.cw { font-weight: 700; line-height: 1.05; letter-spacing: -.015em; overflow-wrap: anywhere; max-width: 100%; }
.cw-0 { color: var(--text); }
.cw-1 { color: var(--signal); }
.cw-2 { color: #ffb48f; }
.cw-3 { color: #8fd3c4; }
.empty-big { font-size: clamp(1.25rem, 2vw, 2.2rem); }

/* projector: slide & links */
.s-stage-content { gap: clamp(.9rem, 2vh, 1.6rem); }
.s-stage-content .s-q-title { font-size: clamp(1.8rem, 3.1vw, 3.7rem); overflow-wrap: anywhere; }
.s-kind {
  font-size: .85em; letter-spacing: .04em; padding: .3rem .65rem; border-radius: 999px;
  background: var(--surface-2); color: var(--text);
}
.s-content {
  flex: 1; min-height: 0; min-width: 0;
  display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: clamp(1.1rem, 2.6vh, 2.2rem);
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  padding: .25rem .75rem .5rem 0; margin-right: -.75rem;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.s-content:focus-visible { outline-offset: 2px; border-radius: 6px; }
.surface-screen .slide, .surface-screen .slide-col { gap: clamp(1.1rem, 2.6vh, 2.2rem); }
.surface-screen .slide-stack .slide-col { max-width: 64rem; }
.surface-screen .slide-split { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(1.5rem, 3vw, 3.5rem); }
.surface-screen .blk { gap: clamp(.45rem, 1vh, .8rem); }
.surface-screen .blk-label { font-size: clamp(.85rem, 1.05vw, 1.2rem); }
.surface-screen .blk-p,
.surface-screen .blk-list { font-size: clamp(1.15rem, 1.65vw, 2.05rem); line-height: 1.42; }
.surface-screen .blk-list { gap: clamp(.35rem, 1vh, .75rem); }
.surface-screen .blk-quote { padding-left: clamp(1rem, 1.6vw, 1.75rem); border-left-width: 5px; }
.surface-screen .blk-quote .blk-p { font-size: clamp(1.35rem, 2.1vw, 2.6rem); line-height: 1.35; color: color-mix(in srgb, var(--text) 92%, var(--signal)); }
.surface-screen .blk-code { background: #090b0e; border-color: var(--line); border-radius: 14px; }
.surface-screen .blk-lang { font-size: clamp(.7rem, .85vw, 1rem); padding: .65rem 1.2rem 0; }
.surface-screen .code-scroll { font-size: clamp(.85rem, 1.12vw, 1.4rem); line-height: 1.5; padding: .7rem 1.2rem 1.1rem; }
.surface-screen .links-title { font-size: clamp(.85rem, 1.05vw, 1.2rem); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.surface-screen .links { grid-template-columns: repeat(auto-fill, minmax(min(100%, 24rem), 1fr)); gap: clamp(.7rem, 1.6vh, 1.25rem); }
.surface-screen .link-card { padding: clamp(.8rem, 1.8vh, 1.3rem) clamp(3rem, 3.6vw, 4rem) clamp(.8rem, 1.8vh, 1.3rem) clamp(1rem, 1.4vw, 1.6rem); border-width: 1px; }
.surface-screen .link-label { font-size: clamp(1.15rem, 1.6vw, 1.95rem); }
.surface-screen .link-host { font-size: clamp(.95rem, 1.2vw, 1.45rem); }
.surface-screen .link-desc { font-size: clamp(.95rem, 1.15vw, 1.4rem); }
.surface-screen .link-ext { font-size: clamp(1.2rem, 1.6vw, 2rem); top: clamp(.8rem, 1.8vh, 1.3rem); right: clamp(1rem, 1.4vw, 1.6rem); }
.surface-screen .s-stage-content .s-meta { font-size: clamp(.9rem, 1.1vw, 1.3rem); }

.s-side {
  min-height: 0; display: flex; flex-direction: column; align-items: stretch; gap: .6rem;
  padding-left: clamp(1.5rem, 3vw, 3.5rem); border-left: 1px solid var(--line);
}
.qr-card { background: #fff; border-radius: 18px; padding: clamp(.6rem, 1vw, 1rem); }
.qr-link { display: block; }
.qr-img { display: block; width: 100%; height: auto; aspect-ratio: 1; image-rendering: pixelated; }
.qr-missing { color: #333; padding: 2rem 1rem; text-align: center; }
.s-join-label { margin-top: .6rem; color: var(--muted); font-size: clamp(.85rem, 1vw, 1.15rem); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.s-code {
  font-size: clamp(1.4rem, 2.3vw, 3.2rem); font-weight: 800; letter-spacing: .04em; line-height: 1;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.s-host { font-size: clamp(.95rem, 1.2vw, 1.4rem); color: var(--muted); overflow-wrap: anywhere; }
.s-tally {
  list-style: none; margin: auto 0 0; padding: 1rem 0 0; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem;
}
.tally-item { display: grid; justify-items: center; gap: .1rem; font-size: clamp(1rem, 1.3vw, 1.5rem); }
.tally-emoji { font-size: 1.5em; }
.tally-n { font-weight: 750; font-variant-numeric: tabular-nums; color: var(--muted); }
.tally-item.bump .tally-emoji { animation: bump .5s ease-out; }
@keyframes bump { 40% { transform: scale(1.3); } }

.s-fly { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 20; }
.flyer {
  position: absolute; bottom: -3rem; left: calc(6% + var(--x) * .55);
  font-size: clamp(2rem, 3.4vw, 4rem);
  animation: fly var(--dur, 3s) cubic-bezier(.25, .6, .35, 1) forwards;
  will-change: transform, opacity;
}
@keyframes fly {
  0% { transform: translate(0, 0) scale(.7); opacity: 0; }
  12% { opacity: .95; }
  70% { opacity: .85; }
  100% { transform: translate(var(--drift, 0), -70vh) scale(1.1); opacity: 0; }
}

.s-controls {
  position: fixed; left: 50%; bottom: .75rem; transform: translateX(-50%); z-index: 30;
  display: flex; gap: .35rem; padding: .35rem;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--line); border-radius: 14px;
  opacity: .35; transition: opacity .2s;
}
.s-controls:hover, .s-controls:focus-within { opacity: 1; }
.s-controls[hidden] { display: none; }
.ctl {
  display: inline-flex; align-items: center; gap: .45rem;
  min-height: 2.25rem; padding: .3rem .7rem; white-space: nowrap;
  font-size: .85rem; font-weight: 650;
  background: var(--surface-2); border: 1px solid transparent; border-radius: 10px; cursor: pointer;
}
.ctl[hidden] { display: none; }
.ctl:hover { border-color: var(--line); }
.ctl[aria-pressed="true"] { border-color: color-mix(in srgb, var(--signal) 60%, transparent); }
.ctl[aria-disabled="true"] { opacity: .4; cursor: default; }
.ctl kbd {
  font-family: inherit; font-size: .72rem; padding: .05rem .35rem; border-radius: 5px;
  border: 1px solid var(--line); color: var(--muted);
}

@media (max-width: 760px), (max-aspect-ratio: 1/1) {
  .surface-screen { overflow: auto; }
  .s-shell { height: auto; min-height: 100vh; grid-template-columns: 1fr; grid-template-rows: auto auto auto; gap: 1.5rem; padding-bottom: 5rem; }
  .s-side { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); padding-top: 1.5rem; }
  .qr-card { max-width: 18rem; }
  .s-event-sub { display: none; }
  .s-content { overflow: visible; margin-right: 0; padding-right: 0; }
  .surface-screen .slide-split { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- motion & contrast preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
  .s-fly { display: none; }
}

@media (forced-colors: active) {
  .opt[aria-pressed="true"], .ctl[aria-pressed="true"] { outline: 3px solid Highlight; }
  .link-card { border-color: LinkText; }
  .link-a:focus-visible::after { outline-color: Highlight; }
  .bar-fill { background: Highlight; forced-color-adjust: none; }
}

/* Opening illustration and the live audience roster. */
.intro-art { display: block; width: 100%; height: auto; border-radius: var(--radius); }
.surface-screen .intro-art { max-height: 48vh; object-fit: contain; }
.participants { width: 100%; min-width: 0; padding: .65rem 0; border-top: 1px solid var(--line); }
.participants summary { cursor: pointer; font-weight: 700; }
.participant-list { max-height: 8rem; overflow-y: auto; padding-left: 1.2rem; margin: .5rem 0 0; font-size: 1rem; overflow-wrap: anywhere; }
#join-name { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: .8rem; background: var(--surface); }
.screenshot-art { display: block; width: 100%; height: auto; object-fit: contain; }
.image-expand { display: block; width: 100%; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: zoom-in; background: var(--surface); }
.image-dialog { width: min(96vw, 1600px); max-width: 96vw; max-height: 96dvh; padding: .75rem; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text); overflow: auto; }
.image-dialog::backdrop { background: rgba(0, 0, 0, .85); }
.image-dialog .btn { margin-bottom: .5rem; }
.image-dialog img { width: 100%; height: auto; }
