/* Квиз-студия IJA — экраны эфира: пульт ведущего, экран для показа, участник. Тёмная тема в стиле Академии. */

.live {
  color-scheme: dark;
  --text: #f3f6fb;
  --text-2: #a9b4c7;
  --text-3: #6f7b91;
  --surface: rgba(255, 255, 255, 0.055);
  --surface-2: rgba(255, 255, 255, 0.09);
  --hairline: rgba(255, 255, 255, 0.1);
  --hairline-strong: rgba(255, 255, 255, 0.16);
  --fill: rgba(255, 255, 255, 0.06);
  --fill-2: rgba(255, 255, 255, 0.1);
  --action-tint: rgba(0, 127, 255, 0.16);
  --on-action-tint: #8cc4ff;
  --success: #34d17a;
  --success-text: #5fe39a;
  --success-tint: rgba(52, 209, 122, 0.14);
  --danger: #ff6b6b;
  --danger-text: #ff8f8f;
  --danger-tint: rgba(255, 107, 107, 0.14);
  --warning-text: #ffc861;
  --warning-tint: rgba(255, 181, 71, 0.14);
  --opt-1: #3987e5;
  --opt-2: #d95926;
  --opt-3: #199e70;
  --opt-4: #c98500;
  --opt-5: #d55181;
  --opt-6: #9085e9;
  --glow-a: rgba(123, 92, 255, 0.34);
  --glow-b: rgba(0, 127, 255, 0.3);
  background: var(--ink);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
}

.live.theme-light {
  color-scheme: light;
  --text: #000a17;
  --text-2: #5b6475;
  --text-3: #8a93a3;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --hairline: rgba(0, 10, 23, 0.08);
  --hairline-strong: rgba(0, 10, 23, 0.14);
  --fill: rgba(0, 10, 23, 0.045);
  --fill-2: rgba(0, 10, 23, 0.08);
  --success: #1a7f4b;
  --success-text: #146c3f;
  --success-tint: #e3f5ea;
  --opt-1: #2a78d6;
  --opt-2: #eb6834;
  --opt-3: #1baf7a;
  --opt-4: #eda100;
  --opt-5: #e87ba4;
  --opt-6: #6250d6;
  --glow-a: rgba(123, 92, 255, 0.14);
  --glow-b: rgba(0, 127, 255, 0.14);
  background: #f4f6f9;
}

/* Фоновое свечение — как на первом экране сайта Академии */
.glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(60vmax 50vmax at 88% -10%, var(--glow-b), transparent 60%),
    radial-gradient(55vmax 45vmax at -10% 110%, var(--glow-a), transparent 62%);
}

.live .btn-ghost {
  background: var(--fill-2);
  color: var(--text);
}

.live .btn-secondary {
  background: var(--action-tint);
  color: var(--on-action-tint);
}

.live .input {
  background: var(--fill);
  border-color: var(--hairline-strong);
  color: var(--text);
}

.live .input::placeholder {
  color: var(--text-3);
}

.live .seg {
  background: var(--fill-2);
}

.live .seg button[aria-pressed='true'] {
  background: rgba(255, 255, 255, 0.16);
  box-shadow: none;
}

.live .tag {
  background: var(--fill-2);
  color: var(--text-2);
}

.live dialog.sheet {
  background: #0c1730;
  color: var(--text);
  border: 1px solid var(--hairline);
}

.live .group {
  background: var(--surface);
  border-color: var(--hairline);
}

.live .row + .row::before {
  background: var(--hairline);
}

/* Логотип */
.logo-line {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.logo-line .brand-mark {
  color: var(--text);
}

.logo-line .product {
  padding-left: 12px;
  border-left: 1px solid var(--hairline-strong);
  color: var(--text-2);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Варианты ответа */
.opt {
  --c: var(--opt-1);
  --p: 0;
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.9em;
  padding: 0.8em 1em 0.8em 0.8em;
  border-radius: 0.75em;
  background: var(--surface);
  border: 1px solid var(--hairline);
  overflow: hidden;
  isolation: isolate;
  transition:
    opacity 500ms var(--ease-out),
    filter 500ms var(--ease-out),
    border-color 300ms ease,
    transform 500ms var(--spring),
    box-shadow 500ms var(--ease-out);
}

.opt-fill {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: color-mix(in srgb, var(--c) 30%, transparent);
  transform-origin: left center;
  transform: scaleX(var(--p));
  transition: transform 700ms var(--ease-out);
}

.theme-light .opt-fill {
  background: color-mix(in srgb, var(--c) 20%, transparent);
}

.opt .letter {
  --c: inherit;
  background: var(--c);
  width: 1.75em;
  height: 1.75em;
  border-radius: 0.5em;
  font-size: 1em;
}

.opt-text {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  line-height: 1.25;
}

.opt-stat {
  display: grid;
  justify-items: end;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  transition: opacity 300ms ease;
}

.opt-pct {
  font-weight: 700;
  font-size: 1.15em;
}

.opt-count {
  font-size: 0.7em;
  color: var(--text-2);
}

.hide-stats .opt-stat {
  opacity: 0;
}

.hide-stats .opt-fill {
  transform: scaleX(0);
}

/* Раскрытие верного ответа */
.revealed .opt:not(.correct) {
  opacity: 0.38;
  filter: saturate(0.5);
}

.revealed .opt.correct {
  border-color: var(--success);
  box-shadow:
    0 0 0 2px var(--success),
    0 0 40px -6px color-mix(in srgb, var(--success) 60%, transparent);
  transform: scale(1.02);
}

.correct-mark {
  display: none;
  align-items: center;
  gap: 0.35em;
  padding: 0.25em 0.6em;
  border-radius: 999px;
  background: var(--success);
  color: #001a0c;
  font-size: 0.68em;
  font-weight: 700;
  white-space: nowrap;
}

.theme-light .correct-mark {
  color: #fff;
}

.correct-mark .icon {
  width: 1.1em;
  height: 1.1em;
  stroke-width: 3;
}

.revealed .opt.correct .correct-mark,
.host-view .opt.correct .correct-mark {
  display: inline-flex;
}

/* Ведущий видит верный ответ всегда, но спокойнее */
.host-view:not(.revealed) .opt.correct .correct-mark {
  background: var(--success-tint);
  color: var(--success-text);
}

/* Счётчик и прогресс */
.progress {
  height: 6px;
  border-radius: 999px;
  background: var(--fill-2);
  overflow: hidden;
}

.progress > i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--violet));
  transform-origin: left;
  transform: scaleX(var(--p, 0));
  transition: transform 600ms var(--ease-out);
}

/* Таймер-кольцо */
.ring {
  position: relative;
  display: inline-block;
  vertical-align: middle;
  width: 3.2em;
  height: 3.2em;
  flex: none;
}

.ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring circle {
  fill: none;
  stroke-width: 3;
}

.ring .ring-track {
  stroke: var(--fill-2);
}

.ring .ring-value {
  stroke: var(--brand);
  stroke-linecap: round;
  stroke-dasharray: 100;
  transition:
    stroke-dashoffset 1s linear,
    stroke 300ms ease;
}

.ring.low .ring-value {
  stroke: var(--danger);
}

.ring-num {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Облако слов */
.cloud {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  align-content: center;
  gap: 0.2em 0.7em;
  line-height: 1.1;
}

.cloud span {
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text);
  transition:
    font-size 600ms var(--ease-out),
    opacity 400ms ease;
  animation: word-in 500ms var(--ease-out) both;
}

.cloud span.top {
  color: var(--on-action-tint);
}

.theme-light .cloud span.top,
.studio-cloud span.top {
  color: var(--action);
}

.cloud span.minor {
  color: var(--text-2);
}

@keyframes word-in {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
}

/* Рейтинг */
.board {
  display: grid;
  gap: 0.45em;
}

.board-row {
  display: grid;
  grid-template-columns: 2.2em auto 1fr auto;
  align-items: center;
  gap: 0.8em;
  padding: 0.55em 0.9em;
  border-radius: 0.7em;
  background: var(--surface);
  border: 1px solid var(--hairline);
  animation: row-in 420ms var(--ease-out) both;
}

.board-row:nth-child(1) {
  background: linear-gradient(90deg, rgba(0, 127, 255, 0.22), rgba(123, 92, 255, 0.16));
  border-color: rgba(140, 196, 255, 0.35);
}

.theme-light .board-row:nth-child(1) {
  background: linear-gradient(90deg, rgba(0, 127, 255, 0.12), rgba(123, 92, 255, 0.1));
}

.board-rank {
  font-weight: 700;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.board-name {
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-score {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.board-move {
  font-size: 0.7em;
  color: var(--success-text);
  display: inline-flex;
  align-items: center;
  gap: 0.2em;
  margin-left: 0.5em;
  font-weight: 600;
}

.board .avatar {
  width: 1.9em;
  height: 1.9em;
  font-size: 0.7em;
}

@keyframes row-in {
  from {
    opacity: 0;
    transform: translateY(0.6em);
  }
}

/* ---------- Экран для показа ---------- */
.screen-body {
  display: grid;
  place-items: center;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

.stage {
  position: relative;
  width: min(100vw, calc(100dvh * 16 / 9));
  aspect-ratio: 16 / 9;
  container-type: size;
  overflow: hidden;
}

.stage-inner {
  position: absolute;
  inset: 0;
  padding: 3.6cqw 4.4cqw 3.4cqw;
  display: flex;
  flex-direction: column;
  font-size: 1.9cqw;
}

.stage-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2cqw;
  font-size: 1.35cqw;
  min-height: 3.4cqw;
}

.stage-top .brand-mark {
  font-size: 2.1cqw;
}

.stage-top-right {
  display: flex;
  align-items: center;
  gap: 1.6cqw;
  color: var(--text-2);
  font-weight: 600;
  white-space: nowrap;
}

.stage-top .ring {
  font-size: 1.5cqw;
}

.scene {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  animation: scene-in 520ms var(--ease-out) both;
}

@keyframes scene-in {
  from {
    opacity: 0;
    transform: translateY(1.2cqw);
    filter: blur(6px);
  }
}

/* Лобби */
.lobby {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  align-items: center;
  gap: 4cqw;
  flex: 1;
}

.lobby h1 {
  font-size: 4.1cqw;
}

.lobby-steps {
  display: grid;
  gap: 1.1cqw;
  margin-top: 2.6cqw;
  font-size: 1.75cqw;
  color: var(--text-2);
}

.lobby-steps b {
  color: var(--text);
  font-weight: 600;
}

/* Правила баллов: телефон и форма входа */
.score-rule {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--success) 14%, transparent);
  color: var(--text);
  font-size: var(--fs-footnote);
  font-weight: 600;
  text-align: left;
}

.score-rule .icon {
  color: var(--success-text);
}

/* На экране трансляции — крупнее */
.lobby .score-rule {
  margin-top: 2.2cqw;
  gap: 0.9cqw;
  padding: 0.8cqw 1.6cqw;
  font-size: 1.6cqw;
}

.lobby .score-rule .icon {
  width: 1.2em;
  height: 1.2em;
}

.room-code {
  margin-top: 2.6cqw;
  display: flex;
  align-items: baseline;
  gap: 1.4cqw;
}

.room-code span {
  font-size: 1.4cqw;
  font-weight: 600;
  color: var(--text-2);
}

.room-code strong {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 5cqw;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

.joined {
  margin-top: 2.8cqw;
  display: flex;
  align-items: center;
  gap: 1.6cqw;
  flex-wrap: wrap;
}

.joined-count {
  display: inline-flex;
  align-items: center;
  gap: 0.8cqw;
  padding: 0.7cqw 1.4cqw;
  border-radius: 999px;
  background: var(--surface-2);
  font-weight: 700;
  font-size: 1.7cqw;
  font-variant-numeric: tabular-nums;
}

.live-dot {
  width: 0.8em;
  height: 0.8em;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 60%, transparent);
  animation: live-pulse 1.8s ease-out infinite;
}

@keyframes live-pulse {
  70% {
    box-shadow: 0 0 0 0.6em transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

.joined-names {
  display: flex;
  gap: 0.8cqw;
  font-size: 1.3cqw;
  color: var(--text-2);
}

.joined-names span {
  padding: 0.45cqw 1cqw;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  animation: word-in 400ms var(--ease-out) both;
}

.qr-wrap {
  position: relative;
  justify-self: center;
  width: 86%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.qr-wrap .gem {
  position: absolute;
  inset: -6%;
  width: 112%;
  opacity: 0.9;
  filter: drop-shadow(0 0 1.4cqw rgba(0, 127, 255, 0.35));
}

.qr-card {
  position: relative;
  width: 58%;
  aspect-ratio: 1;
  padding: 5%;
  border-radius: 9%;
  background: #fff;
  box-shadow: 0 2cqw 6cqw -1cqw rgba(0, 10, 23, 0.6);
}

.qr-card svg {
  width: 100%;
  height: 100%;
}

.qr-link {
  position: absolute;
  bottom: -9%;
  left: -20%;
  right: -20%;
  text-align: center;
  white-space: nowrap;
  font-size: 1.45cqw;
  font-weight: 600;
  color: var(--text-2);
}

/* Вопрос */
.q-head {
  margin-top: 2.6cqw;
  display: flex;
  align-items: center;
  gap: 1.2cqw;
  font-size: 1.35cqw;
  color: var(--text-2);
  font-weight: 600;
}

.q-text {
  margin-top: 1.2cqw;
  font-size: 3.3cqw;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  max-width: 78cqw;
  text-wrap: balance;
}

.q-text.long {
  font-size: 2.7cqw;
}

.opts {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.3cqw;
  font-size: 1.9cqw;
}

.opts.n5,
.opts.n6 {
  grid-template-columns: 1fr 1fr 1fr;
  font-size: 1.6cqw;
}

.q-foot {
  margin-top: 2cqw;
  display: flex;
  align-items: center;
  gap: 2cqw;
  font-size: 1.4cqw;
  font-weight: 600;
  color: var(--text-2);
}

.q-foot .progress {
  flex: 1;
  height: 0.5cqw;
}

.q-foot strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.q-cloud {
  flex: 1;
  margin-top: 2cqw;
  font-size: 1.6cqw;
}

.reference {
  margin-top: 1.4cqw;
  padding: 1.2cqw 1.6cqw;
  border-radius: 1cqw;
  background: var(--success-tint);
  color: var(--text);
  font-size: 1.6cqw;
  display: flex;
  gap: 1cqw;
  align-items: center;
  animation: scene-in 520ms var(--ease-out) both;
}

.reference b {
  color: var(--success-text);
}

/* Рейтинг и итоги на экране */
.board-title {
  margin-top: 2.4cqw;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.board-title h1 {
  font-size: 3.6cqw;
}

.screen-board {
  margin-top: 2.2cqw;
  grid-template-columns: 1fr 1fr;
  grid-auto-flow: column;
  grid-template-rows: repeat(5, auto);
  column-gap: 1.6cqw;
  row-gap: 0.9cqw;
  font-size: 1.75cqw;
}

.podium {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  align-items: end;
  gap: 1.4cqw;
  font-size: 1.6cqw;
}

.podium-col {
  display: grid;
  justify-items: center;
  gap: 0.8cqw;
  text-align: center;
}

.podium-col .avatar {
  width: 4.4cqw;
  height: 4.4cqw;
  font-size: 1.5cqw;
}

.podium-name {
  font-weight: 700;
}

.podium-pts {
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.podium-step {
  width: 100%;
  border-radius: 1.2cqw 1.2cqw 0 0;
  display: grid;
  place-items: start center;
  padding-top: 1cqw;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 3cqw;
  background: linear-gradient(180deg, var(--surface-2), transparent);
  border: 1px solid var(--hairline);
  border-bottom: 0;
  transform-origin: bottom;
  animation: rise 900ms var(--spring) both;
}

.podium-col:nth-child(2) .podium-step {
  background: linear-gradient(180deg, rgba(0, 127, 255, 0.45), rgba(123, 92, 255, 0.12));
  border-color: rgba(140, 196, 255, 0.4);
  animation-delay: 300ms;
}

.podium-col:nth-child(1) .podium-step {
  animation-delay: 150ms;
}

@keyframes rise {
  from {
    transform: scaleY(0.2);
    opacity: 0;
  }
}

.final-wrap {
  flex: 1;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 4cqw;
  align-items: stretch;
  margin-top: 2cqw;
}

.final-side {
  display: grid;
  align-content: end;
  gap: 0.8cqw;
  font-size: 1.5cqw;
}

.final-side .board-row {
  padding: 0.6cqw 1cqw;
}

.big-stat {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 11cqw;
  line-height: 0.9;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, #fff 20%, #8cc4ff 60%, #b9a6ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.theme-light .big-stat {
  background: linear-gradient(120deg, var(--ink) 20%, var(--action) 65%, var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
}

/* Узкие портретные экраны: сцена превращается в обычную страницу */
@media (max-aspect-ratio: 1/1) {
  .screen-body {
    display: block;
    height: auto;
    overflow: auto;
  }
  .stage {
    width: 100vw;
    aspect-ratio: auto;
    min-height: 100dvh;
    container-type: inline-size;
  }
  .stage-inner {
    position: relative;
    min-height: 100dvh;
    font-size: max(15px, 1.9cqw);
    padding: 20px 16px 96px;
  }
  .stage-top {
    font-size: 13px;
  }
  .stage-top .brand-mark {
    font-size: 20px;
  }
  .stage-top .ring {
    font-size: 14px;
  }
  .lobby {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
  .lobby h1 {
    font-size: 30px;
  }
  .lobby-steps,
  .room-code span,
  .joined-names,
  .qr-link,
  .q-head,
  .q-foot {
    font-size: 14px;
  }
  .joined-count,
  .lobby .score-rule {
    font-size: 15px;
    padding: 6px 12px;
  }
  .room-code strong {
    font-size: 34px;
  }
  .qr-wrap {
    width: 78%;
    max-width: 340px;
    order: -1;
  }
  .qr-link {
    bottom: -8%;
  }
  .q-text,
  .q-text.long {
    font-size: 24px;
    max-width: none;
  }
  .opts,
  .opts.n5,
  .opts.n6 {
    grid-template-columns: 1fr;
    font-size: 16px;
    gap: 10px;
    margin-top: 24px;
  }
  .q-cloud,
  .reference {
    font-size: 16px;
  }
  .board-title h1 {
    font-size: 26px;
  }
  .screen-board {
    grid-template-columns: 1fr;
    grid-auto-flow: row;
    grid-template-rows: none;
    font-size: 15px;
  }
  .final-wrap {
    grid-template-columns: 1fr;
  }
  .podium {
    font-size: 14px;
    margin-top: 24px;
  }
  .podium-col .avatar {
    width: 40px;
    height: 40px;
    font-size: 14px;
  }
  .podium-step {
    font-size: 24px;
  }
  .final-side {
    font-size: 15px;
  }
  .big-stat {
    font-size: 72px;
  }
}

/* Панель управления прототипом */
.proto-bar {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(12, 23, 48, 0.78);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f3f6fb;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  font-size: 13px;
  font-weight: 600;
  transition:
    opacity 200ms ease,
    transform 300ms var(--ease-out);
}

.proto-bar.hidden {
  opacity: 0;
  transform: translate(-50%, 20px);
  pointer-events: none;
}

.proto-bar button,
.proto-bar a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 999px;
  color: inherit;
  transition:
    background-color 160ms ease,
    transform 160ms var(--ease-out);
}

.proto-bar button:active {
  transform: scale(0.95);
}

@media (hover: hover) and (pointer: fine) {
  .proto-bar button:hover,
  .proto-bar a:hover {
    background: rgba(255, 255, 255, 0.12);
  }
}

.proto-bar .proto-label {
  padding: 0 10px;
  min-width: 132px;
  text-align: center;
  white-space: nowrap;
  color: rgba(243, 246, 251, 0.85);
}

.proto-bar .proto-tag {
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255, 181, 71, 0.18);
  color: #ffc861;
  font-size: 11px;
  white-space: nowrap;
}

.proto-bar .sep {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.14);
  margin: 0 2px;
}

@media (max-width: 520px) {
  .proto-bar {
    max-width: calc(100vw - 16px);
  }
  .proto-bar .proto-tag {
    display: none;
  }
  .proto-bar .proto-label {
    min-width: 0;
    padding: 0 4px;
  }
  .proto-bar button,
  .proto-bar a {
    padding: 0 8px;
  }
}

/* ---------- Пульт ведущего ---------- */
.host-top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px clamp(16px, 3vw, 32px);
  background: rgba(0, 10, 23, 0.72);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--hairline);
  flex-wrap: wrap;
}

.host-title {
  display: grid;
  min-width: 0;
  flex: 1 1 260px;
}

.host-title .host-name {
  font-weight: 700;
  font-size: var(--fs-headline);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.host-title span {
  font-size: var(--fs-footnote);
  color: var(--text-2);
}

.onair {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--danger-tint);
  color: var(--danger-text);
  font-size: var(--fs-footnote);
  font-weight: 700;
  white-space: nowrap;
}

.onair .live-dot {
  background: var(--danger);
}

.host-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.host-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 20px;
  padding: 20px clamp(16px, 3vw, 32px) 40px;
  max-width: 1500px;
  margin: 0 auto;
}

.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-l);
}

.card-pad {
  padding: 24px;
}

.host-stage {
  padding: 28px;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  font-size: 17px;
}

.host-stage .q-head {
  margin-top: 0;
  font-size: 14px;
}

.host-stage .q-text {
  font-size: clamp(22px, 2.3vw, 30px);
  max-width: none;
}

.host-stage .opts {
  font-size: 17px;
  gap: 12px;
  margin-top: 28px;
}

.host-stage .q-foot {
  font-size: 14px;
  margin-top: 24px;
}

.host-stage .q-foot .progress {
  height: 6px;
}

.host-stage .ring {
  font-size: 15px;
}

.host-stage .q-cloud {
  font-size: 15px;
  min-height: 220px;
}

.host-stage .board {
  font-size: 16px;
  margin-top: 16px;
}

.host-side {
  display: grid;
  gap: 16px;
  align-content: start;
}

.control-card {
  padding: 20px;
  display: grid;
  gap: 14px;
}

.control-status {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: var(--fs-subhead);
  color: var(--text-2);
  line-height: 1.4;
}

.control-status .icon {
  margin-top: 1px;
  color: var(--on-action-tint);
}

.kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.kpi {
  padding: 14px 16px;
  border-radius: var(--r-m);
  background: var(--fill);
}

.kpi-val {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.kpi-label {
  font-size: var(--fs-footnote);
  color: var(--text-2);
}

.next-q {
  padding: 16px 20px;
  display: grid;
  gap: 6px;
}

.next-q p {
  font-weight: 600;
  line-height: 1.35;
}

.people {
  padding: 16px 8px 8px;
}

.people-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 12px;
}

.people .search {
  margin: 0 12px 8px;
}

.people-list {
  max-height: 340px;
  overflow: auto;
  padding: 0 4px;
}

.person {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 12px;
  font-size: var(--fs-subhead);
  animation: row-in 300ms var(--ease-out) both;
}

.person .avatar {
  width: 30px;
  height: 30px;
  font-size: 11px;
}

.person-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-state {
  font-size: var(--fs-caption);
  color: var(--text-3);
  white-space: nowrap;
}

.person-state.done {
  color: var(--success-text);
}

.person .kick {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text-3);
  opacity: 0;
  transition:
    opacity 160ms ease,
    background-color 160ms ease;
}

.person:hover .kick,
.person:focus-within .kick {
  opacity: 1;
}

@media (hover: none) {
  .person .kick {
    opacity: 1;
  }
}

.person .kick:hover {
  background: var(--danger-tint);
  color: var(--danger-text);
}

.host-empty {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: center;
}

.host-empty .qr-card {
  width: 200px;
  border-radius: 22px;
  padding: 14px;
}

.lobby-count {
  font-family: var(--font-display);
  font-size: 72px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.range {
  width: 100%;
  accent-color: var(--brand);
}

@media (max-width: 1100px) {
  .host-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .host-stage {
    padding: 20px;
    min-height: 0;
  }
  .host-stage .opts {
    grid-template-columns: 1fr;
    font-size: 16px;
  }
  .host-empty {
    grid-template-columns: 1fr;
  }
  .host-empty .qr-card {
    width: 160px;
  }
  .lobby-count {
    font-size: 56px;
  }
  .host-actions .btn-label {
    display: none;
  }
}

/* ---------- Участник ---------- */
.p-wrap {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 16px 20px calc(96px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.p-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
}

.p-top .brand-mark {
  font-size: 20px;
  color: var(--text);
}

.me-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  background: var(--fill-2);
  font-size: var(--fs-footnote);
  font-weight: 600;
}

.me-chip .avatar {
  width: 26px;
  height: 26px;
  font-size: 10px;
}

.p-center {
  flex: 1;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 14px;
  padding: 24px 0;
  animation: scene-in 420ms var(--ease-out) both;
}

.p-center .gem {
  width: 120px;
}

.p-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.p-sub {
  color: var(--text-2);
  max-width: 32ch;
}

.p-q {
  padding: 20px 0 8px;
  animation: scene-in 420ms var(--ease-out) both;
}

.p-q-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: var(--fs-footnote);
  color: var(--text-2);
  font-weight: 600;
}

.p-q-text {
  margin-top: 10px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.p-timer {
  margin-top: 14px;
}

.p-opts {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.p-opt {
  --c: var(--opt-1);
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 12px 16px 12px 12px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  text-align: left;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  transition:
    transform 160ms var(--ease-out),
    background-color 200ms ease,
    border-color 200ms ease,
    box-shadow 200ms ease;
}

.p-opt:active {
  transform: scale(0.98);
}

.p-opt .letter {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  font-size: 16px;
  background: var(--c);
}

.p-opt[aria-pressed='true'] {
  border-color: var(--c);
  background: color-mix(in srgb, var(--c) 22%, transparent);
  box-shadow: 0 0 0 1px var(--c);
}

.p-opt .tick {
  margin-left: auto;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  border: 2px solid var(--hairline-strong);
  display: grid;
  place-items: center;
  flex: none;
}

.p-opt[aria-pressed='true'] .tick {
  background: var(--c);
  border-color: var(--c);
}

.p-opt .tick .icon {
  width: 16px;
  height: 16px;
  stroke-width: 3;
  color: #fff;
  opacity: 0;
}

.p-opt[aria-pressed='true'] .tick .icon {
  opacity: 1;
}

.p-send {
  margin-top: 16px;
}

/* Галочка, которая «рисуется» */
.badge-check {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--success-tint);
  color: var(--success);
  box-shadow: 0 0 60px -10px color-mix(in srgb, var(--success) 60%, transparent);
  animation: pop 520ms var(--spring) both;
}

.badge-check.wrong {
  background: var(--danger-tint);
  color: var(--danger);
  box-shadow: 0 0 60px -10px color-mix(in srgb, var(--danger) 50%, transparent);
}

.badge-check.neutral {
  background: var(--action-tint);
  color: var(--on-action-tint);
  box-shadow: 0 0 60px -10px rgba(0, 127, 255, 0.5);
}

.badge-check svg {
  width: 48px;
  height: 48px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.badge-check path {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: draw 420ms 180ms var(--ease-out) forwards;
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes pop {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
}

.answer-card {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  display: flex;
  gap: 12px;
  align-items: center;
  text-align: left;
  font-weight: 600;
}

.answer-card .letter {
  width: 32px;
  height: 32px;
}

.points {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 600;
  color: var(--success-text);
  font-variant-numeric: tabular-nums;
}

.result-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 6px;
}

.result-grid .kpi {
  text-align: center;
  padding: 14px 8px;
}

.result-grid .kpi-val {
  font-size: 24px;
}

.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--warning-tint);
  color: var(--warning-text);
  font-size: var(--fs-subhead);
  font-weight: 600;
  margin-top: 12px;
  animation: scene-in 300ms var(--ease-out) both;
}

.banner .spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 700ms linear infinite;
  flex: none;
}

/* Вход участника */
.join-hero {
  margin-top: 8vh;
  display: grid;
  gap: 12px;
}

.join-hero h1 {
  font-size: clamp(30px, 8vw, 40px);
}

.join-form {
  margin-top: 32px;
  display: grid;
  gap: 18px;
}

.code-input {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.code-input input {
  width: 100%;
  height: 60px;
  padding: 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  border-radius: 14px;
  border: 1px solid var(--hairline-strong);
  background: var(--fill);
  color: var(--text);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.code-input input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--focus);
}

.code-input input:nth-child(3) {
  margin-right: 8px;
}

.join-product {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 8px;
  border-radius: 999px;
  background: var(--fill-2);
  font-weight: 600;
  font-size: var(--fs-subhead);
  justify-self: start;
}

.join-product .icon {
  color: var(--on-action-tint);
}

.privacy {
  display: flex;
  gap: 10px;
  font-size: var(--fs-footnote);
  color: var(--text-2);
  line-height: 1.45;
}

.privacy .icon {
  color: var(--text-3);
}

/* ---------- Фото-вопросы на телефоне участника ---------- */
.p-q .q-photos {
  margin-top: 14px;
}

.p-q .q-photo {
  width: 100%;
}

.p-photo-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.p-photo {
  --c: var(--opt-1);
  position: relative;
  min-width: 0;
}

.p-opt.p-photo-btn {
  width: 100%;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 6px;
  padding: 6px;
}

.p-photo-img {
  position: relative;
  display: block;
  aspect-ratio: 1;
  border-radius: 13px;
  overflow: hidden;
  background: var(--fill);
}

.p-photo-img .letter {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: 14px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.p-photo-img .tick {
  position: absolute;
  top: 6px;
  right: 6px;
  margin: 0;
  background: rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.7);
}

.p-photo-cap {
  padding: 0 4px 2px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.p-zoom,
.q-photo .photo-zoom {
  position: absolute;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
}

/* Правый нижний угол квадратного фото: фото занимает ширину плитки без отступов по 6px */
.p-photo {
  container-type: inline-size;
}

.p-zoom {
  right: 12px;
  top: calc(100cqw - 44px);
}

.p-zoom .icon {
  width: 16px;
  height: 16px;
}

/* Зона нажатия лупы — не меньше 44px */
.p-zoom::before {
  content: '';
  position: absolute;
  inset: -6px;
}

.q-photo {
  cursor: zoom-in;
}

/* ---------- Фото на весь экран ---------- */
.photo-viewer {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: max(12px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom));
  border: 0;
  background: #000;
  color: #fff;
  display: none;
  flex-direction: column;
  gap: 12px;
}

.photo-viewer[open] {
  display: flex;
  animation: viewer-in 200ms var(--ease-out) both;
}

.photo-viewer::backdrop {
  background: #000;
}

@keyframes viewer-in {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
}

@media (prefers-reduced-motion: reduce) {
  .photo-viewer[open] {
    animation: none;
  }
}

.phv-close {
  align-self: flex-end;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.phv-stage {
  flex: 1;
  min-height: 0;
  touch-action: pan-y pinch-zoom;
}

.phv-stage .photo {
  border-radius: 12px;
}

.phv-caption {
  text-align: center;
  font-size: 16px;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.85);
}

.phv-caption b {
  color: #fff;
}

.phv-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.phv-nav button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 26px;
  line-height: 1;
}

.phv-dots {
  display: flex;
  gap: 6px;
}

.phv-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
}

.phv-dots i.on {
  background: #fff;
}

.phv-action {
  flex: none;
}

/* ---------- Фото-варианты на экране эфира и пульте ---------- */
.photo-opts {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.opt.opt-photo {
  flex-direction: column;
  align-items: stretch;
  gap: 0.4em;
  padding: 0.4em;
}

.opt-photo-img {
  position: relative;
  aspect-ratio: 1;
  border-radius: 0.55em;
  overflow: hidden;
  background: var(--fill);
}

.opt-photo-img .letter {
  position: absolute;
  top: 0.35em;
  left: 0.35em;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.opt-photo-img .correct-mark {
  position: absolute;
  top: 0.4em;
  right: 0.4em;
}

/* Полоса ответов под фото: у фото-варианта заливка не на всю плитку, а отдельной линией */
.opt-bar {
  position: relative;
  height: 0.32em;
  border-radius: 999px;
  background: var(--fill-2);
  overflow: hidden;
  isolation: isolate;
}

.opt-bar .opt-fill {
  z-index: 0;
  background: var(--c);
}

.opt-photo-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5em;
  font-size: 0.8em;
}

.opt-photo-foot .opt-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.opt-photo-foot .opt-stat {
  display: flex;
  align-items: baseline;
  gap: 0.35em;
}

/* Пульт ведущего: фото вопроса компактно над вариантами */
.host-view .q-photos {
  max-width: 320px;
  margin-top: 12px;
}

.host-view .photo-opts {
  margin-top: 16px;
}

/* Экран эфира: фото вопроса слева, варианты справа; всё помещается в 16:9 */
.stage .q-split {
  flex: 1;
  min-height: 0;
  margin-top: 2cqw;
  display: grid;
  grid-template-columns: 24cqw minmax(0, 1fr);
  gap: 2.4cqw;
}

.stage .q-side {
  min-height: 0;
}

.stage .q-side .q-photos {
  height: 100%;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: minmax(0, 1fr);
  gap: 1.2cqw;
}

.stage .q-side .q-photo {
  aspect-ratio: auto;
  height: 100%;
  border-radius: 1.2cqw;
}

.stage .q-main {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.stage .q-main .q-cloud {
  margin-top: 0;
}

/* До четырёх вариантов — один ряд квадратных плиток по центру */
.stage .photo-opts {
  display: flex;
  justify-content: center;
  gap: 1.3cqw;
  font-size: 1.6cqw;
}

.stage .photo-opts .opt-photo {
  flex: 1 1 0;
  min-width: 0;
  max-width: 22cqw;
}

/* Ряд занимает свободную высоту: при длинном вопросе фото уменьшается, а не выталкивает подвал за край экрана */
.stage .photo-opts:not(.n5):not(.n6) {
  flex: 1;
  min-height: 0;
  align-items: flex-end;
}

.stage .photo-opts:not(.n5):not(.n6) .opt-photo {
  height: 100%;
  max-height: calc(22cqw + 3em);
}

.stage .photo-opts:not(.n5):not(.n6) .opt-photo-img {
  flex: 1;
  min-height: 0;
  aspect-ratio: auto;
}

/* 5–6 вариантов — два ряда по три, плитки делят свободную высоту */
.stage .photo-opts.n5,
.stage .photo-opts.n6 {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  margin-top: 1.4cqw;
}

/* Плитка широкая и невысокая: квадратное фото слева на всю высоту, подпись и полоса справа */
.stage .photo-opts.n5 .opt-photo,
.stage .photo-opts.n6 .opt-photo {
  max-width: none;
  min-height: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto auto;
  column-gap: 0.8em;
  row-gap: 0.4em;
}

.stage .photo-opts.n5 .opt-photo-img,
.stage .photo-opts.n6 .opt-photo-img {
  grid-row: 1 / -1;
  height: 100%;
  width: auto;
  aspect-ratio: 1;
}

.stage .photo-opts.n5 .opt-photo-foot,
.stage .photo-opts.n6 .opt-photo-foot {
  grid-column: 2;
  grid-row: 2;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15em;
  font-size: 0.95em;
}

.stage .photo-opts.n5 .opt-bar,
.stage .photo-opts.n6 .opt-bar {
  grid-column: 2;
  grid-row: 3;
}

/* Узкий портретный экран: обычная страница, фото по два в ряд */
@media (max-aspect-ratio: 1/1) {
  .stage .q-split {
    flex: none;
    grid-template-columns: minmax(0, 1fr);
  }
  .stage .q-side .q-photos {
    height: auto;
    grid-auto-rows: auto;
  }
  .stage .q-side .q-photos.n2 {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .stage .q-side .q-photo {
    aspect-ratio: 4 / 3;
  }
  .stage .photo-opts,
  .stage .photo-opts.n5,
  .stage .photo-opts.n6 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: none;
    font-size: 15px;
  }
  .stage .photo-opts .opt-photo,
  .stage .photo-opts.n5 .opt-photo,
  .stage .photo-opts.n6 .opt-photo {
    max-width: none;
    display: flex;
  }
  .stage .photo-opts.n5 .opt-photo-img,
  .stage .photo-opts.n6 .opt-photo-img {
    height: auto;
    aspect-ratio: 1;
  }
  .stage .photo-opts.n5 .opt-photo-foot,
  .stage .photo-opts.n6 .opt-photo-foot {
    flex-direction: row;
    align-items: baseline;
  }
}

/* Приближение фото в просмотре: картинка в 2,5 раза больше, двигается прокруткой */
.phv-stage {
  position: relative;
  overflow: hidden;
}

.phv-stage .photo {
  cursor: zoom-in;
}

.phv-stage.zoomed {
  overflow: auto;
  touch-action: pan-x pan-y pinch-zoom;
  overscroll-behavior: contain;
}

.phv-stage.zoomed .photo {
  width: 250%;
  height: 250%;
  max-width: none;
  border-radius: 0;
  cursor: zoom-out;
}

.phv-hint {
  margin-top: -6px;
  text-align: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
}
