:root {
  --bg: #070d2b;
  --bg2: #0c1645;
  --panel: #111c52;
  --panel2: #172463;
  --line: #26357e;
  --text: #eef2ff;
  --muted: #95a1d6;
  --gold: #ffc93c;
  --gold2: #ffdf7e;
  --blue: #1d3fc4;
  --blue2: #0f247c;
  --ok: #2fd27a;
  --bad: #ff5a5f;
  --warn: #ff9f43;
  --r: 12px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--gold2); }
.grow { flex: 1; }
.muted { color: var(--muted); }
.sm { font-size: 0.85em; }
.nowrap { white-space: nowrap; }
.pos { color: var(--ok); }
.neg { color: var(--bad); }

/* ---------- Кнопки и поля ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--text); cursor: pointer; text-decoration: none;
  font-weight: 600; font-size: 14px; line-height: 1.2; white-space: nowrap; user-select: none;
  transition: background .15s, transform .05s, border-color .15s;
}
.btn:hover { background: #20307a; border-color: #3a4ea8; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.primary { background: linear-gradient(#ffd45c, #f5b416); color: #1b1300; border-color: #f5b416; }
.btn.primary:hover { background: linear-gradient(#ffdf7e, #ffc23a); }
.btn.ok { background: #188a4f; border-color: #22a861; }
.btn.ok:hover { background: #1fa45f; }
.btn.bad { background: #a82c33; border-color: #c93a42; }
.btn.bad:hover { background: #c3343c; }
.btn.danger { color: #ff8a8e; }
.btn.danger:not(.ghost) { background: #5a1a22; color: #ffd0d2; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(255,255,255,.06); border-color: var(--line); }
.btn.big { padding: 12px 22px; font-size: 17px; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.xs { padding: 3px 7px; font-size: 13px; border-radius: 7px; min-width: 26px; }
.btn.icon { padding: 6px 10px; font-size: 16px; }
.btn.star { color: var(--gold); }
.inp {
  background: #0a1340; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px;
  color: var(--text); outline: none; min-width: 0;
}
.inp:focus { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(255,201,60,.18); }
.inp.sm { padding: 5px 8px; font-size: 13px; }
.inp.xs { padding: 4px 6px; width: 70px; font-size: 13px; }
textarea.inp { resize: vertical; width: 100%; line-height: 1.4; }
select.inp { cursor: pointer; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line); font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.dim { color: var(--muted); }
.pill.special { background: #4b2a7a; border-color: #7a4bc0; }
.pill.st-armed { background: #7a5a00; border-color: var(--gold); color: var(--gold2); }
.pill.st-answering { background: #145a35; border-color: var(--ok); }
.pill.st-revealed { color: var(--muted); }

.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; }
.toast { background: #1a2870; border: 1px solid #34479e; padding: 10px 14px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.4); max-width: 380px; transition: opacity .4s, transform .4s; }
.toast.ok { border-color: var(--ok); }
.toast.bad { border-color: var(--bad); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- Ведущий: общее ---------- */
.admin-body { background: radial-gradient(1200px 600px at 20% -10%, #15237a 0%, var(--bg) 60%); min-height: 100%; }
.bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: rgba(7,13,43,.75); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }
.bar-title { font-weight: 700; font-size: 17px; max-width: 32vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo { font-weight: 900; font-size: 22px; letter-spacing: .02em; color: var(--gold); text-transform: uppercase; }
.panel { background: rgba(17,28,82,.85); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.panel h2 { margin: 0 0 12px; font-size: 20px; }
.panel h3 { margin: 18px 0 8px; font-size: 15px; color: var(--muted); }
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.empty-note { padding: 40px; text-align: center; color: var(--muted); }
.warn { background: #5a3a00; border-bottom: 1px solid var(--warn); padding: 8px 16px; }
.err { color: var(--bad); min-height: 1.2em; font-size: 14px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 12px; text-align: center; }

.home { max-width: 1200px; margin: 0 auto; padding-bottom: 60px; }
.home section { padding: 0 16px; }
.home h2 { font-size: 18px; margin: 24px 0 12px; }
.sec-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sec-head h2 { margin: 24px 0 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.card { background: rgba(17,28,82,.85); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.card.live { border-color: #8a6a10; box-shadow: inset 0 0 0 1px rgba(255,201,60,.15); }
.card-title { font-weight: 700; font-size: 16px; }
.card-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 4px; }

/* ---------- Панель ведущего ---------- */
.host.offline::before { content: 'Нет связи с сервером…'; position: fixed; top: 0; left: 0; right: 0; background: var(--bad); color: #fff; text-align: center; padding: 4px; z-index: 100; }
.host-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; padding: 14px 16px; align-items: start; }
.host-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow: auto; }
.side-block { background: rgba(17,28,82,.85); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.side-title { font-weight: 700; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; cursor: default; }
details.side-block > summary { cursor: pointer; list-style: none; }
details.side-block > summary::before { content: '▸ '; }
details[open].side-block > summary::before { content: '▾ '; }
.side-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.prow { display: flex; align-items: center; gap: 4px; padding: 4px 6px 4px 8px; border-radius: 9px; border-left: 4px solid var(--c, var(--line)); background: rgba(255,255,255,.03); }
.prow.chooser { background: rgba(255,201,60,.1); }
.prow.pending { border-left-color: var(--warn); }
.prow .pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; font-weight: 600; }
.prow .pscore { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 54px; text-align: right; }
.link { background: none; border: none; padding: 2px 4px; cursor: pointer; border-radius: 6px; }
.link:hover { background: rgba(255,255,255,.08); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.on { background: var(--ok); }
.dot.off { background: #555c80; }
.toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 3px 0; }
.toggle input { width: 18px; height: 18px; accent-color: var(--gold); }
.numrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.log { display: flex; flex-direction: column; gap: 3px; font-size: 13px; max-height: 260px; overflow: auto; }
.log-row { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; }
.log-row .sm { grid-column: 1 / -1; }

.lobby-host { display: grid; grid-template-columns: 300px 1fr; gap: 24px; align-items: center; }
.lh-qr .qr { width: 100%; border-radius: 12px; display: block; }
.closed { aspect-ratio: 1; display: grid; place-items: center; background: #2a1030; border: 2px dashed var(--bad); border-radius: 12px; font-size: 22px; font-weight: 800; color: #ffb3b6; }
.steps { padding-left: 20px; line-height: 1.55; color: var(--muted); }
.linkrow { display: flex; gap: 8px; align-items: center; margin: 10px 0 16px; flex-wrap: wrap; }
.linkrow code { background: #0a1340; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 13px; word-break: break-all; }
.intro-list { font-size: 18px; line-height: 1.7; }

.hboard { display: grid; grid-template-columns: minmax(140px, 1.5fr) repeat(var(--cols), minmax(56px, 1fr)); gap: 6px; }
.hb-theme { display: flex; align-items: center; padding: 8px 10px; background: var(--blue2); border-radius: 8px; font-weight: 700; font-size: 14px; }
.hb-cell { position: relative; padding: 14px 4px; border-radius: 8px; border: 1px solid #2c4bd0; background: linear-gradient(#2346d6, #14309e); color: var(--gold); font-weight: 900; font-size: 20px; cursor: pointer; }
.hb-cell:hover { background: linear-gradient(#2f55f0, #1a3bbe); }
.hb-cell.played { background: #0b1440; border-color: #1a2662; color: #3a4785; font-weight: 600; font-size: 14px; }
.hb-cell.empty { visibility: hidden; }
.hb-type { position: absolute; top: 2px; right: 4px; font-size: 13px; }

.qhost .qh-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.qh-theme { font-weight: 800; font-size: 18px; }
.qh-price { font-weight: 900; font-size: 22px; color: var(--gold); }
.qh-body { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; }
.qh-q, .qh-a { background: #0a1340; border: 1px solid var(--line); border-radius: 10px; padding: 12px; min-width: 0; }
.qh-a { border-color: #1f7a4a; background: #0a2a24; }
.lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; display: block; font-weight: 700; }
.qh-q .content, .qh-a .content { align-items: flex-start; text-align: left; animation: none; gap: 6px; }
.qh-q .content .ctext, .qh-a .content .ctext { font-size: 18px; line-height: 1.4; white-space: pre-wrap; max-width: none; }
.qh-a .ctext { color: #9ff5c4; font-weight: 700; }
.qh-q .cmedia, .qh-a .cmedia { max-width: 100%; max-height: 220px; border-radius: 8px; display: block; margin-top: 8px; }
.qh-q audio, .qh-a audio { width: 100%; margin-top: 6px; }
.qh-q .eq, .qh-a .eq { display: none; }
.note { margin-top: 10px; padding-top: 8px; border-top: 1px dashed #2d6a52; color: #c8d6ff; font-size: 14px; white-space: pre-wrap; }
.controls { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.ctl-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ctl-title { font-weight: 700; }
.ans-box { font-size: 22px; padding: 10px 14px; border-radius: 10px; background: color-mix(in srgb, var(--c) 18%, #0a1340); border-left: 6px solid var(--c); }
.ans-box small { font-size: 14px; color: var(--muted); }
.other-score { gap: 6px; }
.other-score .sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.btn.ok-ghost { background: transparent; border-color: #22a861; color: #9ff5c4; }
.btn.ok-ghost:hover { background: rgba(47,210,122,.12); }
.btn.ok-ghost small { color: var(--muted); font-weight: 500; }
.sum-inp { width: 110px; }
.armed-ind { font-weight: 800; color: var(--gold); animation: blink 1s infinite; }
.buzz-order { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.htimer { flex: 1; min-width: 160px; height: 8px; border-radius: 6px; background: #0a1340; overflow: hidden; }
.htimer.on { margin: 4px 0 12px; }
.htimer .fill { height: 100%; width: 100%; background: linear-gradient(90deg, var(--bad), var(--gold)); }
.owner-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.chipbtn { display: inline-flex; gap: 8px; align-items: baseline; padding: 8px 12px; border-radius: 10px; border: 2px solid transparent; background: var(--panel2); border-left: 5px solid var(--c); cursor: pointer; font-weight: 700; }
.chipbtn small { color: var(--muted); font-weight: 500; }
.chipbtn.on { border-color: var(--gold); background: #3b3210; }
.ftheme-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.ftheme { padding: 12px 18px; border-radius: 10px; border: 1px solid #2c4bd0; background: linear-gradient(#2346d6, #14309e); font-weight: 700; cursor: pointer; }
.ftheme.removed { background: #0b1440; color: #4a578f; text-decoration: line-through; border-color: #1a2662; }
.tbl { width: 100%; border-collapse: collapse; margin: 10px 0; }
.tbl td, .tbl th { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.tbl th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.tbl tr.shown { background: rgba(255,201,60,.08); }
.tbl tr.ok td:first-child { color: var(--ok); }
.tbl tr.bad td:first-child { color: var(--bad); }
.tbl td .btn { margin-right: 4px; }

/* ---------- Конструктор ---------- */
.title-inp { font-weight: 700; font-size: 16px; flex: 1 1 200px; max-width: 420px; }
.save-status { font-size: 13px; color: var(--muted); }
.save-status.dirty { color: var(--gold2); }
.save-status.bad { color: var(--bad); }
.tabs { display: flex; gap: 6px; padding: 12px 16px 0; flex-wrap: wrap; align-items: flex-end; }
.tab { height: 38px; padding: 0 14px; display: inline-flex; align-items: center; border-radius: 10px 10px 0 0; border: 1px solid var(--line); border-bottom: none; background: rgba(17,28,82,.5); cursor: pointer; font-weight: 600; color: var(--muted); }
.tab.on { background: var(--panel); color: var(--text); }
.tab.tab-final { color: var(--gold2); }
.tab.add { border: 1px dashed var(--line); border-radius: 10px; height: 32px; margin-bottom: 4px; background: transparent; }
.ed-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 0 16px 40px; align-items: start; }
.ed-grid:has(.ed-side) { grid-template-columns: minmax(0, 1fr) 440px; }
.ed-main { min-width: 0; container-type: inline-size; }
.ed-side { position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.eboard { display: grid; grid-template-columns: minmax(150px, 1.4fr) repeat(var(--cols), minmax(0, 1fr)) 34px; gap: 6px; }
.eb-cell, .eb-theme { min-width: 0; }
.eboard.eb-final { grid-template-columns: minmax(200px, 1fr) 2fr; }
.eb-theme { display: flex; align-items: center; gap: 2px; background: var(--blue2); border-radius: 8px; padding: 4px; }
textarea.theme-inp, .theme-inp { flex: 1; background: transparent; border-color: transparent; font-weight: 700; resize: none; overflow: hidden; line-height: 1.3; min-height: 36px; white-space: pre-wrap; overflow-wrap: anywhere; }
.eb-theme { position: relative; }
.eb-tools { display: none; position: absolute; right: 3px; top: 50%; transform: translateY(-50%); background: var(--blue2); border-radius: 7px; box-shadow: -8px 0 10px var(--blue2); }
.eb-theme:hover .eb-tools, .eb-theme:focus-within .eb-tools { display: flex; }
.eb-cell { text-align: left; padding: 6px 8px; border-radius: 8px; border: 1px solid #2c4bd0; background: linear-gradient(#1f3fc4, #132c90); cursor: pointer; min-height: 64px; display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.eb-cell:hover { border-color: var(--gold); }
.eb-cell.on { outline: 2px solid var(--gold); outline-offset: 1px; }
.eb-cell.blank { background: #0e1a55; border-style: dashed; }
.eb-cell.noanswer:not(.blank) .eb-price::after { content: ' · нет ответа'; color: #ffb3b6; font-weight: 500; font-size: 11px; }
.eb-cell.add { align-items: center; justify-content: center; background: transparent; border: 1px dashed var(--line); color: var(--muted); font-size: 20px; }
.eb-cell.add.slim { padding: 0; }
.eb-cell.none { visibility: hidden; }
.eb-price { color: var(--gold); font-weight: 900; font-size: 15px; }
.eb-snip { font-size: 12px; color: #c9d2ff; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.eb-cell.blank .eb-snip { color: #5b6aa8; }
.eb-media { font-size: 12px; color: var(--muted); }
.qp-head { display: flex; align-items: center; gap: 4px; }
.qp-title { font-weight: 800; }
.field { display: flex; flex-direction: column; gap: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.media-box { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px; border: 1px dashed var(--line); border-radius: 10px; margin-top: -4px; }
.media-box.drag { border-color: var(--gold); background: rgba(255,201,60,.06); }
.media-box.paste-target { border-color: rgba(255,201,60,.5); }
.qp-sec { display: flex; flex-direction: column; gap: 10px; }
.media-item { position: relative; display: flex; align-items: flex-start; gap: 4px; width: 100%; }
.media-item img, .media-item video { max-width: 100%; max-height: 160px; border-radius: 8px; }
.media-item audio { flex: 1; min-width: 0; }
.preview-ov { position: fixed; inset: 0; background: rgba(0,0,0,.75); z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 20px; }
.preview-screen { width: min(1100px, 95vw); aspect-ratio: 16 / 9; overflow: auto; border-radius: 14px; font-size: min(1.1vw, 1.95vh); display: grid; grid-template-rows: 1fr auto; gap: 1em; padding: 1.5em; }

/* Узкое табло конструктора: тема — строкой над своими вопросами. */
@container (max-width: 760px) {
  .eboard { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)) 34px; }
  .eboard.eb-final { grid-template-columns: minmax(0, 1fr); }
  .eb-theme { grid-column: 1 / -1; margin-top: 6px; }
  .eb-theme:first-child { margin-top: 0; }
  .eb-cell { min-height: 56px; padding: 5px 6px; }
  .eb-snip { font-size: 11px; }
}

@media (max-width: 1000px) {
  .host-grid, .ed-grid:has(.ed-side) { grid-template-columns: minmax(0, 1fr); }
  .host-side { position: static; max-height: none; }
  /* Редактор вопроса — выезжающая панель поверх табло. */
  .ed-side { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100%); max-height: none; z-index: 60; border-radius: 0; background: #0f1a4d; border-width: 0 0 0 1px; box-shadow: -20px 0 60px rgba(0,0,0,.55); overflow: auto; animation: slidein .2s ease-out; }
  .bar { gap: 8px; padding: 8px 12px; }
  .ed-grid { padding: 0 12px 40px; }
  .tabs { padding: 10px 12px 0; }
  .qh-body { grid-template-columns: 1fr; }
  .lobby-host { grid-template-columns: 1fr; }
  .lh-qr { max-width: 280px; }
}

/* ---------- Экран (ТВ) ---------- */
.screen-body { overflow: hidden; background: radial-gradient(ellipse at 50% 0%, #1a2f9e 0%, #0a1550 45%, #050a24 100%); }
.screen, .screen-like {
  font-size: min(1.6vw, 2.85vh);
  background: radial-gradient(ellipse at 50% 0%, #1a2f9e 0%, #0a1550 45%, #050a24 100%);
}
.screen { height: 100vh; display: grid; grid-template-rows: auto 1fr auto auto; padding: 1.2em 1.6em 1em; gap: .6em; position: relative; }
.screen.offline::after { content: 'Нет связи…'; position: absolute; top: .5em; right: .5em; background: var(--bad); padding: .2em .8em; border-radius: 99px; font-size: .8em; }
.scr-top { display: flex; justify-content: space-between; align-items: baseline; color: var(--muted); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-size: .9em; min-height: 1.2em; }
.scr-round { color: var(--gold2); }
.scr-main { min-height: 0; display: grid; position: relative; }
.scr-main > * { min-height: 0; }
.scr-banner { position: absolute; left: 0; right: 0; bottom: 7.8em; display: flex; justify-content: center; pointer-events: none; z-index: 5; }
.bn { background: rgba(5,10,36,.92); border: .12em solid var(--c, var(--gold)); padding: .35em 1.2em; border-radius: 99px; font-size: 1.3em; box-shadow: 0 .4em 1.4em rgba(0,0,0,.5); animation: pop .35s ease-out; }
.bn b { color: var(--c, var(--gold)); }
.bn.big { font-size: 2em; }
.bn.armed { border-color: var(--gold); color: var(--gold); font-weight: 900; text-transform: uppercase; letter-spacing: .06em; animation: pop .3s ease-out, glow 1s infinite alternate; }
.bn.answering { animation: pop .3s ease-out, ringc 1s infinite alternate; }
.bn.ok { border-color: var(--ok); }
.timerbar { height: .5em; border-radius: 1em; background: rgba(255,255,255,.08); overflow: hidden; opacity: 0; transition: opacity .3s; position: relative; }
.timerbar.on { opacity: 1; }
.timerbar .fill { height: 100%; width: calc(var(--p, 1) * 100%); background: linear-gradient(90deg, var(--bad), var(--gold)); }
.timerbar .sec { display: none; }
.scr-players { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: .6em; }
.pl { background: linear-gradient(#16258a, #0d1860); border-radius: .6em; padding: .45em .7em; border-top: .3em solid var(--c); text-align: center; min-width: 0; transition: transform .25s, box-shadow .25s, opacity .25s; }
.pl-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 1em; }
.pl-score { font-weight: 900; font-size: 1.6em; font-variant-numeric: tabular-nums; color: var(--gold); }
.pl-score.neg { color: var(--bad); }
.pl.offline { opacity: .45; }
.pl.tried { opacity: .4; }
.pl.chooser { box-shadow: 0 0 0 .15em var(--gold); }
.pl.answering { transform: translateY(-.4em); box-shadow: 0 0 0 .18em var(--c), 0 0 1.6em color-mix(in srgb, var(--c) 60%, transparent); }
.pl.correct { box-shadow: 0 0 0 .18em var(--ok); }
.qr-corner { position: absolute; right: 1.2em; top: 2.6em; background: #fff; color: #0b1240; border-radius: .6em; padding: .4em; text-align: center; font-size: .7em; font-weight: 700; width: 9em; z-index: 6; }
.qr-corner:empty { display: none; }
.qr-corner .qr { width: 100%; display: block; }

.lobby { display: grid; grid-template-columns: auto 1fr; gap: 3em; align-items: center; padding: 0 2em; }
.lobby-qr { height: min(68vh, 36em); aspect-ratio: 1; }
.lobby-qr .qr { width: 100%; height: 100%; border-radius: 1em; box-shadow: 0 1em 3em rgba(0,0,0,.5); }
.lobby-qr .closed { height: 100%; font-size: 2em; }
.lobby-title { font-size: 3.4em; font-weight: 900; line-height: 1.05; color: var(--gold); text-shadow: 0 .08em 0 #7a5600; }
.lobby-hint { font-size: 1.5em; margin: .8em 0 1.2em; color: #d9e0ff; }
.lobby-chips { display: flex; flex-wrap: wrap; gap: .5em; }
.chip { padding: .35em .9em; border-radius: 99px; background: rgba(255,255,255,.08); border: .1em solid var(--c, var(--line)); font-weight: 700; font-size: 1.2em; animation: pop .4s ease-out; }
.chip.done { background: color-mix(in srgb, var(--c) 25%, transparent); }
.lobby-count { margin-top: 1em; color: var(--muted); }

.intro { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.2em; }
.intro-name { font-size: 4.5em; font-weight: 900; color: var(--gold); text-transform: uppercase; letter-spacing: .04em; animation: zoomin .7s ease-out; text-shadow: 0 .06em 0 #7a5600; }
.intro-themes { display: flex; flex-direction: column; gap: .4em; align-items: center; }
.intro-theme { font-size: 1.7em; font-weight: 700; opacity: 0; animation: rise .5s ease-out forwards; }

.board { display: grid; grid-template-columns: minmax(0, 1.7fr) repeat(var(--cols), minmax(0, 1fr)); grid-auto-rows: 1fr; gap: .4em; height: 100%; padding-bottom: 3.4em; }
.theme-cell, .price-cell { border-radius: .4em; display: flex; align-items: center; animation: fadein .4s ease-out both; }
.theme-cell { background: linear-gradient(#1a33a8, #0e2072); padding: .2em .8em; font-weight: 800; font-size: 1.25em; line-height: 1.1; border: .06em solid #3352d6; text-transform: uppercase; letter-spacing: .01em; overflow: hidden; overflow-wrap: anywhere; }
.theme-cell.long { font-size: 1em; }
.theme-cell.long2 { font-size: .8em; text-transform: none; }
.price-cell { justify-content: center; background: linear-gradient(#2650f0, #1534b4); border: .06em solid #4a6af0; color: var(--gold); font-weight: 900; font-size: 2.3em; text-shadow: 0 .05em 0 #6b4a00; font-variant-numeric: tabular-nums; }
.price-cell.played { background: rgba(10,20,70,.6); border-color: rgba(60,80,170,.3); }
.price-cell.empty { visibility: hidden; }

.qview { display: flex; flex-direction: column; gap: .8em; height: 100%; min-height: 0; padding-bottom: 3.4em; }
.q-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1em; font-weight: 800; text-transform: uppercase; font-size: 1.15em; }
.q-theme { color: #c9d4ff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-price { color: var(--gold); font-size: 1.4em; flex: none; }
.content { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .8em; text-align: center; animation: fadein .4s ease-out; }
.ctext { font-weight: 700; line-height: 1.25; max-width: 92%; white-space: pre-wrap; text-wrap: balance; }
.ctext.t-xl { font-size: 3.6em; }
.ctext.t-l { font-size: 2.8em; }
.ctext.t-m { font-size: 2.1em; }
.ctext.t-s { font-size: 1.6em; }
.content.has-media .cmedia { flex: 1; min-height: 0; max-width: 100%; object-fit: contain; border-radius: .5em; box-shadow: 0 .6em 2em rgba(0,0,0,.5); }
.content img.cmedia, .content video.cmedia { max-height: 100%; }
.caudio audio { display: none; }
.preview-screen .caudio audio { display: block; margin: .5em auto 0; }
.eq { display: flex; gap: .4em; align-items: flex-end; height: 6em; }
.eq i { width: 1.2em; background: linear-gradient(var(--gold), #ff8a3c); border-radius: .3em; animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: .15s; } .eq i:nth-child(3) { animation-delay: .3s; } .eq i:nth-child(4) { animation-delay: .45s; } .eq i:nth-child(5) { animation-delay: .6s; }
.answer-view .ctext { color: #a8ffcf; }
.answer-label { text-align: center; text-transform: uppercase; letter-spacing: .1em; color: var(--ok); font-weight: 800; font-size: 1.1em; }

.splash { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4em; padding-bottom: 4em; }
.splash-icon { font-size: 8em; animation: zoomin .6s cubic-bezier(.2, 1.6, .4, 1); }
.splash-title { font-size: 4.4em; font-weight: 900; color: var(--gold); text-transform: uppercase; text-align: center; animation: zoomin .6s ease-out; text-shadow: 0 .06em 0 #7a5600; }
.splash-sub { font-size: 1.5em; color: #d9e0ff; }

.final { display: flex; flex-direction: column; align-items: center; gap: 1.2em; padding-bottom: 3.4em; min-height: 0; }
.final-title { font-size: 2.4em; font-weight: 900; color: var(--gold); text-align: center; }
.final-themes { display: flex; flex-wrap: wrap; justify-content: center; gap: .7em; max-width: 90%; }
.final-theme { padding: .6em 1.2em; border-radius: .5em; background: linear-gradient(#2650f0, #1534b4); font-size: 1.6em; font-weight: 800; transition: all .4s; }
.final-theme.removed { opacity: .2; text-decoration: line-through; transform: scale(.92); }
.final-hint { font-size: 1.5em; text-align: center; margin-bottom: .8em; }
.final-who { display: flex; flex-wrap: wrap; gap: .6em; justify-content: center; }
.final-answer { width: 100%; max-height: 35%; display: flex; flex-direction: column; }
.fcards { display: flex; flex-wrap: wrap; gap: .8em; justify-content: center; }
.fcard { min-width: 12em; max-width: 22em; background: linear-gradient(#16258a, #0d1860); border-radius: .7em; border-top: .3em solid var(--c); padding: .7em 1em; text-align: center; transition: transform .3s, box-shadow .3s; }
.fcard.shown { transform: scale(1.08); box-shadow: 0 0 0 .15em var(--gold); }
.fcard.ok { box-shadow: 0 0 0 .15em var(--ok); }
.fcard.bad { box-shadow: 0 0 0 .15em var(--bad); opacity: .85; }
.fcard-name { font-weight: 700; color: var(--muted); }
.fcard-answer { font-size: 1.6em; font-weight: 800; margin: .3em 0; word-break: break-word; }
.fcard-bet { font-size: 1.3em; font-weight: 900; color: var(--gold); min-height: 1.2em; }
.fcard.ok .fcard-bet { color: var(--ok); }
.fcard.bad .fcard-bet { color: var(--bad); }

.results { display: flex; flex-direction: column; align-items: center; gap: 1em; padding-bottom: 1em; }
.results-title { font-size: 3.4em; font-weight: 900; color: var(--gold); }
.podium { display: flex; flex-direction: column; gap: .5em; width: min(46em, 90%); }
.results .prow { display: grid; grid-template-columns: 3em 1fr auto; align-items: center; gap: 1em; padding: .5em 1em; border-radius: .6em; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 30%, #0d1860), #0d1860); border-left: .35em solid var(--c); font-size: 1.5em; opacity: 0; animation: rise .6s ease-out forwards; }
.results .prow.winner { font-size: 2.1em; box-shadow: 0 0 2em rgba(255,201,60,.35); }
.pplace { font-weight: 900; text-align: center; }
.results .pname { font-weight: 800; }
.pscore { font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }

.start-gate { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(3,6,24,.8); cursor: pointer; }
.gate-card { background: var(--panel); border: 1px solid var(--line); padding: 2em 3em; border-radius: 1em; text-align: center; font-size: 1.4vw; }
.gate-title { font-size: 2em; font-weight: 900; color: var(--gold); margin-bottom: .4em; }
.fatal { display: grid; place-items: center; height: 100vh; font-size: 2em; text-align: center; padding: 1em; grid-row: 1 / -1; }

/* ---------- Телефон ---------- */
.play-body { background: radial-gradient(ellipse at 50% 0%, #1a2f9e 0%, #0a1550 50%, #050a24 100%); min-height: 100%; overscroll-behavior: none; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.play-body #app { min-height: 100vh; min-height: 100dvh; }
.ph-join { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); max-width: 480px; margin: 0 auto; }
.ph-logo { font-size: 34px; font-weight: 900; color: var(--gold); text-transform: uppercase; text-align: center; }
.ph-game { text-align: center; color: var(--muted); margin-bottom: 10px; }
.ph-input { width: 100%; font-size: 20px; padding: 14px 16px; border-radius: 14px; background: #0a1340; border: 2px solid var(--line); color: var(--text); outline: none; -webkit-user-select: text; user-select: text; }
.ph-input:focus { border-color: var(--gold); }
.ph-area { resize: none; }
.ph-go { width: 100%; font-size: 20px; font-weight: 800; padding: 15px; border-radius: 14px; border: none; background: linear-gradient(#ffd45c, #f5b416); color: #1b1300; cursor: pointer; }
.ph-go:disabled { opacity: .5; }
.ph-ghost { flex: none; font-size: 17px; font-weight: 700; padding: 15px 18px; border-radius: 14px; border: 2px solid var(--line); background: transparent; cursor: pointer; }
.ph-err { color: #ff9aa0; text-align: center; min-height: 1.3em; }
.ph-ok { color: #9ff5c4; text-align: center; min-height: 1.3em; }
.ph-hint, .ph-left { text-align: center; color: var(--muted); }
.ph-left { font-size: 20px; font-weight: 800; color: var(--gold); }
.ph-row { display: flex; gap: 10px; }
.ph-stop { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 24px; font-size: 20px; }
.ph-conn { position: fixed; left: 0; right: 0; top: 0; background: var(--bad); color: #fff; text-align: center; padding: 6px; font-size: 14px; transform: translateY(-100%); transition: transform .3s; z-index: 10; }
.ph-conn.on { transform: none; }

.phone { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-rows: auto auto 1fr; padding: calc(14px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom)); max-width: 520px; margin: 0 auto; }
.ph-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ph-me { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-me i { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.ph-score { font-size: 34px; font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
.ph-score.neg { color: var(--bad); }
.ph-msg { text-align: center; font-size: 19px; font-weight: 700; min-height: 2.6em; display: flex; align-items: center; justify-content: center; margin: 10px 0; color: #dfe5ff; }
.ph-body { display: flex; align-items: center; justify-content: center; }
.ph-idle { font-size: 64px; opacity: .5; }
.ph-form { width: 100%; display: flex; flex-direction: column; gap: 12px; align-self: start; margin-top: 8px; }

.buzzer {
  width: min(78vw, 56vh, 400px); aspect-ratio: 1; border-radius: 50%; border: none; cursor: pointer;
  font-size: min(11vw, 46px); font-weight: 900; color: #fff; letter-spacing: .03em;
  background: radial-gradient(circle at 35% 30%, #59628f, #2b315a 70%); box-shadow: 0 10px 0 #151a38, 0 18px 40px rgba(0,0,0,.5);
  transition: background .2s, box-shadow .1s, transform .08s; touch-action: none; -webkit-tap-highlight-color: transparent;
}
.buzzer:active, .buzzer.hit { transform: translateY(6px); box-shadow: 0 4px 0 #151a38, 0 8px 20px rgba(0,0,0,.5); }
.buzzer.st-wait { background: radial-gradient(circle at 35% 30%, #3b5bdb, #1a2c8a 70%); box-shadow: 0 10px 0 #0e1856, 0 18px 40px rgba(0,0,0,.5); }
.buzzer.st-armed { background: radial-gradient(circle at 35% 30%, #ff7b7b, #e01f2d 65%); box-shadow: 0 10px 0 #8a0f18, 0 0 60px rgba(255,60,70,.6); animation: pulse 0.8s infinite; }
.buzzer.st-me { background: radial-gradient(circle at 35% 30%, #6ff0a8, #18a957 65%); box-shadow: 0 10px 0 #0c6232, 0 0 60px rgba(47,210,122,.6); }
.buzzer.st-fs { background: radial-gradient(circle at 35% 30%, #ffbf6b, #e07a12 65%); box-shadow: 0 10px 0 #8a4a08; animation: shake .4s; font-size: min(8vw, 34px); }
.buzzer.st-other, .buzzer.st-tried, .buzzer.st-off { opacity: .55; }

/* ---------- Анимации ---------- */
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes zoomin { from { transform: scale(.5); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes rise { from { transform: translateY(1em); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes blink { 50% { opacity: .5; } }
@keyframes glow { from { box-shadow: 0 0 .4em rgba(255,201,60,.3); } to { box-shadow: 0 0 1.6em rgba(255,201,60,.8); } }
@keyframes ringc { from { box-shadow: 0 0 .3em var(--c); } to { box-shadow: 0 0 1.6em var(--c); } }
@keyframes eq { 0%, 100% { height: 20%; } 50% { height: 100%; } }
@keyframes pulse { 50% { transform: scale(1.03); } }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; } }

/* ---------- Окна ---------- */
.modal-ov { position: fixed; inset: 0; z-index: 500; background: rgba(2,5,20,.7); display: grid; place-items: center; padding: 16px; animation: fadein .15s ease-out; }
.modal { width: min(440px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.5); animation: pop .18s ease-out; }
.modal-title { font-weight: 800; font-size: 17px; }
.modal-text { line-height: 1.45; }
.modal .inp { font-size: 16px; padding: 10px 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
