/* КвизЛиз — командный режим. Тёмная тема по макету; общий экран 16:9 (1280–1920), читается с 3–4 метров. */
:root {
  --bg: #0e1020;
  --card: #171a30;
  --card-2: #1d2140;
  --line: #2a2f52;
  --track: #20243f;
  --text: #f4f4fb;
  --muted: #8f94b8;
  --faint: #5d6288;
  --accent: #ffb547;
  --accent-ink: #1a1300;
  --accent-soft: #2e2510;
  --green: #7ddba0;
  --green-bg: #12261c;
  --green-line: #7ddba0;
  --red: #ff8f8f;
  --blue: #5ec2ff;
  --violet: #b7a1ff;
  --silver: #c8cbe2;
  --bronze: #d9a27a;
  --head: "Unbounded", "Manrope", system-ui, sans-serif;
  --body: "Manrope", system-ui, sans-serif;
  --mono: "JetBrainsMono", "JetBrains Mono", ui-monospace, monospace;
  --r: 22px;
  --r-sm: 14px;
  --s: clamp(14px, 1.1vw, 22px);           /* базовый шаг — растёт с экраном */
}
/* светлое оформление: выбрано в меню или «Авто» при светлой системе */
:root[data-theme="light"] { --bg: #f4f3ef; --card: #ffffff; --card-2: #eceaf4; --line: #dcd9e7; --track: #e5e2ee; --text: #15172b; --muted: #5d6185; --faint: #9699b4;
  --accent: #f2a12a; --accent-ink: #1a1300; --accent-soft: #fff0d4; --green: #4cc27f; --green-bg: #e2f6ea; --green-line: #4cc27f; --red: #d84a4a; --blue: #2f8fd8; --violet: #7d62e0; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --bg: #f4f3ef; --card: #ffffff; --card-2: #eceaf4; --line: #dcd9e7; --track: #e5e2ee; --text: #15172b; --muted: #5d6185; --faint: #9699b4;
    --accent: #f2a12a; --accent-ink: #1a1300; --accent-soft: #fff0d4; --green: #4cc27f; --green-bg: #e2f6ea; --green-line: #4cc27f; --red: #d84a4a; --blue: #2f8fd8; --violet: #7d62e0; }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--text); font-family: var(--body); min-height: 100%; overflow-x: hidden; }
body { font-size: clamp(15px, 1vw, 20px); line-height: 1.4; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { cursor: default; opacity: .45; }
input, textarea { font: inherit; color: inherit; }
.app { max-width: 1920px; margin: 0 auto; padding: calc(var(--s) * 1.6) calc(var(--s) * 2) calc(var(--s) * 2); min-height: 100vh; }
.boot { color: var(--muted); padding: 40px; text-align: center; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); }
.h1 { font-family: var(--head); font-weight: 800; font-size: clamp(30px, 2.6vw, 54px); line-height: 1.1; letter-spacing: -.01em; }
.h2 { font-family: var(--head); font-weight: 700; font-size: clamp(20px, 1.5vw, 30px); }
.caps { text-transform: uppercase; letter-spacing: .08em; font-size: .72em; font-weight: 700; color: var(--muted); }

/* ── шапка ── */
.top { display: flex; align-items: center; gap: var(--s); margin-bottom: calc(var(--s) * 1.4); flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 12px; font-family: var(--head); font-weight: 800; font-size: clamp(22px, 1.7vw, 32px); }
.logo-mark { width: 1.45em; height: 1.45em; border-radius: .38em; object-fit: cover; display: block; flex: none; box-shadow: 0 0 0 1px var(--line); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--line); color: var(--muted); font-size: .85em; white-space: nowrap; }
.spacer { flex: 1; }
.me { display: flex; align-items: center; gap: 12px; }
.me small { display: block; color: var(--muted); font-size: .78em; }
.link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* ── шаги ── */
.steps { display: flex; gap: 10px; margin-bottom: calc(var(--s) * 1.6); flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 10px; padding: 8px 18px 8px 8px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: .9em; }
.step b { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--card-2); font-size: .85em; }
.step.on { background: var(--card-2); color: var(--text); }
.step.on b { background: var(--accent); color: var(--accent-ink); }

/* ── сетка экрана ── */
.cols { display: grid; grid-template-columns: minmax(0, 1fr) clamp(320px, 26vw, 460px); gap: calc(var(--s) * 1.6); align-items: start; }
.cols-wide { grid-template-columns: minmax(0, 1fr) clamp(320px, 24vw, 420px); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: calc(var(--s) * 1.4); }
.card + .card { margin-top: var(--s); }
.cols > .card + .card { margin-top: 0; }
.side { position: sticky; top: var(--s); }

/* ── кнопки ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 22px; border-radius: 14px; background: var(--card-2); border: 1px solid var(--line); font-weight: 700; transition: background .15s, transform .1s; }
.btn:hover:not(:disabled) { background: color-mix(in srgb, var(--card-2) 80%, var(--text) 8%); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-main { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-family: var(--head); font-weight: 800; }
.btn-main:hover:not(:disabled) { background: #ffc36a; }
.btn-big { padding: 18px 28px; font-size: 1.05em; width: 100%; }
.btn-icon { padding: 10px 14px; }
.btn-sm { padding: 6px 12px; font-size: .85em; border-radius: 10px; gap: 6px; flex: none; }
.btn-danger { color: var(--red); }
.btns { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* ── вкладки и выбор ── */
.tabs { display: inline-flex; padding: 5px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); margin: var(--s) 0; }
.tab { padding: 10px 20px; border-radius: 11px; color: var(--muted); font-weight: 700; }
.tab.on { background: var(--text); color: var(--bg); }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1; min-width: 60px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--muted); font-weight: 700; }
.seg button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }

/* ── темы ── */
.app-topics { display: flex; flex-direction: column; }
.topics-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s); flex-wrap: wrap; margin-bottom: var(--s); }
.topics-head .tabs { margin: 0; }
.topics-body { flex: 1; padding-bottom: var(--s); }
.topics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(10px, 1vw, 18px); }
.topic { --h: 40; position: relative; overflow: hidden; text-align: left; padding: clamp(16px, 1.3vw, 24px); border-radius: 22px; min-height: clamp(150px, 11vw, 210px);
  border: 1.5px solid hsl(var(--h) 45% 50% / .28); display: flex; flex-direction: column; justify-content: space-between; gap: 14px;
  background: linear-gradient(150deg, hsl(var(--h) 70% 55% / .16), hsl(var(--h) 70% 55% / .03) 60%), var(--card);
  transition: transform .15s ease, border-color .15s, box-shadow .15s; }
.topic:hover { transform: translateY(-3px); border-color: hsl(var(--h) 60% 60% / .6); box-shadow: 0 12px 28px hsl(var(--h) 60% 30% / .25); }
.topic .e { width: clamp(52px, 3.8vw, 72px); height: clamp(52px, 3.8vw, 72px); border-radius: 18px; display: grid; place-items: center;
  font-size: clamp(28px, 2.1vw, 40px); line-height: 1; background: hsl(var(--h) 70% 60% / .2); position: relative; }
.topic .bg-e { position: absolute; right: -12px; bottom: -18px; font-size: clamp(80px, 6.5vw, 120px); opacity: .1; transform: rotate(-14deg); pointer-events: none; }
.topic .tx { position: relative; display: grid; gap: 4px; }
.topic .n { font-family: var(--head); font-weight: 700; font-size: clamp(17px, 1.25vw, 24px); }
.topic .d { color: var(--muted); font-size: .85em; }
.topic.on { border-color: var(--accent); background: linear-gradient(150deg, var(--accent-soft), hsl(var(--h) 70% 55% / .06) 70%), var(--card); box-shadow: 0 0 0 1px var(--accent); }
.topic .tick { position: absolute; top: 14px; right: 14px; width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center;
  font-size: 15px; font-weight: 900; color: transparent; background: var(--bg); }
.topic.on .tick { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
@media (max-width: 1150px) { .topics { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.utopics { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(240px, 17vw, 320px), 1fr)); gap: 10px; }
.utopic { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); text-align: left; }
.utopic .num { font-family: var(--mono); color: var(--faint); font-size: .85em; }
.utopic .e { font-size: 1.3em; }
.utopic .n { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.utopic .g { color: var(--muted); font-size: .8em; }
.utopic .box { width: 24px; height: 24px; border-radius: 7px; border: 1.5px solid var(--line); display: grid; place-items: center; font-size: 14px; }
.utopic.on { border-color: var(--accent); background: var(--accent-soft); }
.utopic.on .box { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 900; }
.star { color: var(--accent); margin-left: 6px; }
.filters { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.filters .search { width: min(340px, 100%); }
.field { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); outline: none; }
.field:focus { border-color: var(--accent); }
textarea.field { resize: vertical; min-height: 64px; }
.pager { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.newtopic { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 12px; border-radius: 14px; border: 1.5px dashed var(--blue); background: color-mix(in srgb, var(--blue) 6%, var(--card)); flex-wrap: wrap; }
.newtopic .field { flex: 1 1 280px; width: auto; max-width: 520px; }
.newtopic .nt-plus { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--blue); color: var(--bg); font-weight: 900; font-size: 1.2em; flex: none; }
.newtopic .nt-note { margin: 0; }
.newtopic.review { display: grid; grid-template-columns: minmax(200px, auto) minmax(0, 1fr) auto; align-items: center; border-style: solid; }
.newtopic.review .field { max-width: none; width: 100%; min-height: 0; resize: none; overflow: hidden; line-height: 1.45; }
.nt-title { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; }
.nt-title .e { font-size: 1.6em; grid-row: span 2; }
.nt-title .caps { font-size: .62em; }

/* ── экран тем: снизу — выбранное и «Создать комнату» ── */
.tbar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: calc(var(--s) * 1.2);
  margin: 0 calc(var(--s) * -2) calc(var(--s) * -2); padding: 14px calc(var(--s) * 2);
  background: color-mix(in srgb, var(--card) 94%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
.tbar-text { display: flex; align-items: baseline; gap: 12px; min-width: 0; flex: 1; }
.tbar-text .chosen { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tbar-text .link { font-size: .85em; flex: none; }
.tbar-hint { color: var(--faint); font-size: .82em; max-width: 36ch; text-align: right; }
.btn-create { padding: 16px 30px; font-size: 1.05em; white-space: nowrap; flex: none; }

/* ── параметры в лобби ── */
.params .prm { margin-bottom: 16px; }
.params .prm > .caps { display: block; margin-bottom: 8px; }
.params .stepper { grid-template-columns: 44px 1fr 44px; }
.params .stepper button, .params .stepper input { height: 44px; }
.params .stepper input { font-size: 1.15em; padding: 6px; }
.seg-sm button { padding: 7px 4px; min-width: 0; font-size: .9em; }
.topics-line { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; }
.topics-line span { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.topics-line .link { flex: none; font-size: .85em; }
.switch { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; margin-top: 10px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { flex: none; width: 38px; height: 22px; border-radius: 11px; background: var(--line); position: relative; transition: background .15s; margin-top: 1px; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch.on i { background: var(--accent); }
.switch.on i::after { transform: translateX(16px); background: var(--accent-ink); }
.switch:focus-within i { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch span { font-weight: 700; }
.switch small { display: block; color: var(--muted); font-weight: 400; font-size: .82em; }

/* ── меню аккаунта ── */
.acct-wrap { position: relative; }
.acct { display: flex; align-items: center; gap: 10px; padding: 5px 12px 5px 5px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); }
.acct:hover, .acct.open { border-color: var(--accent); }
.acct-name { font-weight: 700; max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { color: var(--muted); font-size: .8em; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 280px; padding: 14px; border-radius: 18px; background: var(--card);
  border: 1px solid var(--line); box-shadow: 0 18px 50px rgba(0, 0, 0, .35); display: grid; gap: 10px; animation: slide .15s ease; }
.menu-head { display: flex; gap: 12px; align-items: center; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.menu-head small { display: block; color: var(--muted); font-size: .8em; }
.menu .seg button { padding: 8px 6px; min-width: 0; font-size: .9em; }
.menu-item { text-align: left; padding: 10px 12px; border-radius: 12px; font-weight: 700; }
.menu-item:hover { background: var(--card-2); }

.stepper { display: grid; grid-template-columns: 52px 1fr 52px; gap: 10px; }
.stepper button { border-radius: 12px; border: 1px solid var(--line); background: var(--card-2); font-size: 1.3em; font-weight: 800; }
.stepper input { text-align: center; font-family: var(--mono); font-size: 1.4em; font-weight: 700; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); width: 100%; }
.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; margin: 6px 0 10px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); margin-top: 2px; flex: none; }
.check small { display: block; color: var(--muted); }
.note { color: var(--muted); font-size: .82em; margin-top: 10px; }
.info { display: flex; gap: 12px; padding: 14px 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); color: var(--muted); margin-top: var(--s); }

/* ── аватарки ── */
.ava { width: 2.4em; height: 2.4em; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 800; color: #14162a; overflow: hidden; position: relative; }
.ava img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.ava.sm { width: 1.7em; height: 1.7em; font-size: .9em; }
.ava.lg { width: 4.2em; height: 4.2em; font-size: 1.5em; }

/* ── лобби ── */
.code { display: flex; gap: clamp(8px, .8vw, 16px); margin: 12px 0 calc(var(--s) * 1.2); }
.code span { width: clamp(64px, 5.4vw, 112px); height: clamp(84px, 7vw, 140px); border-radius: 18px; border: 2px solid var(--accent); background: var(--accent-soft); display: grid; place-items: center; font-family: var(--head); font-weight: 800; font-size: clamp(42px, 4vw, 84px); color: var(--accent); }
.howto { margin: 0 0 var(--s) 1.2em; display: grid; gap: 6px; font-size: 1.05em; }
.howto b { color: var(--accent); }
.qr { display: flex; gap: var(--s); align-items: flex-end; flex-wrap: wrap; }
.qr img { width: clamp(150px, 11vw, 220px); height: auto; background: #fff; border-radius: 16px; padding: 10px; }
.qr small { color: var(--muted); font-size: .8em; word-break: break-all; }
.players { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(200px, 13vw, 260px), 1fr)); gap: 10px; }
.player { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 16px; background: var(--bg); border: 1px solid var(--line); min-width: 0; position: relative; }
.player b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player small { font-size: .78em; color: var(--green); }
.player small.warn { color: var(--accent); }
.player small.gone { color: var(--faint); }
.player.left { opacity: .5; }
.player .kick { position: absolute; right: 8px; top: 8px; color: var(--faint); font-size: .8em; padding: 4px 8px; display: none; }
.player:hover .kick { display: block; }
.player.wait { border-style: dashed; color: var(--muted); }
.player.wait .ava { border: 1.5px dashed var(--line); color: var(--muted); }
.count { color: var(--blue); font-family: var(--mono); font-weight: 700; }
.bottom-bar { display: flex; gap: 12px; align-items: center; margin-top: calc(var(--s) * 1.4); }
.btn-start { padding: 16px 34px; font-size: 1.1em; }
.lobby { display: grid; grid-template-columns: minmax(0, 1fr); gap: calc(var(--s) * 1.2); align-items: start; }
.lobby.with-params { grid-template-columns: minmax(0, 1fr) clamp(320px, 27vw, 460px); }
.lobby-main { display: grid; gap: calc(var(--s) * 1.2); min-width: 0; }
.lobby .card + .card { margin-top: 0; }
.join { display: flex; align-items: center; gap: calc(var(--s) * 2); }
.join-text { flex: 1; min-width: 0; }
.join .code { margin: 14px 0 0; }
.join .code span { width: clamp(56px, 4.6vw, 104px); height: clamp(72px, 5.8vw, 128px); font-size: clamp(40px, 3.6vw, 80px); }
.join .qr img { width: clamp(170px, 13vw, 260px); }
.join .howto { margin: var(--s) 0 0 1.2em; font-size: .95em; }

/* ── игра: вопрос и слово — по центру экрана, счёт — полосой внизу ── */
.game { display: flex; flex-direction: column; min-height: calc(100vh - var(--s) * 3.6); }
.round-top { display: flex; align-items: center; gap: var(--s); flex-wrap: wrap; }
.rnum { font-family: var(--head); font-weight: 700; font-size: clamp(18px, 1.3vw, 26px); color: var(--muted); }
.rnum b { color: var(--text); }
.roomcode { color: var(--muted); font-size: .95em; }
.roomcode b { color: var(--text); }
.roomcode b.c { color: var(--accent); font-family: var(--mono); font-size: 1.25em; letter-spacing: .06em; }
.ctrl { gap: 8px; }
.stage-center { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  width: 100%; max-width: 1700px; margin: 0 auto; padding: calc(var(--s) * 1.5) 0; }
.pts-badge { display: inline-flex; padding: 8px 18px; border-radius: 999px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent); font-weight: 800; font-size: 1.05em; margin-bottom: calc(var(--s) * 1.4); }
.question { font-family: var(--head); font-weight: 700; font-size: clamp(30px, 3.1vw, 68px); line-height: 1.16; max-width: 26ch; text-wrap: balance; margin-bottom: calc(var(--s) * 2); }
.tiles { display: flex; flex-wrap: wrap; justify-content: center; column-gap: clamp(16px, 1.6vw, 36px); row-gap: clamp(6px, .6vw, 14px); }
.word { display: flex; gap: clamp(6px, .6vw, 14px); }
.tile { width: clamp(48px, 4.4vw, 104px); height: clamp(60px, 5.4vw, 128px); border-radius: clamp(10px, .9vw, 18px); border: 2px solid var(--line); background: var(--card);
  display: grid; place-items: center; font-family: var(--mono); font-weight: 700; font-size: clamp(30px, 3.2vw, 72px); }
.tile.open { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tile.pop { animation: pop .45s cubic-bezier(.3, 1.6, .5, 1); }
/* общий экран: слово в одну строку, размер плиток считает fitTiles() */
.tiles.fit { flex-wrap: nowrap; column-gap: calc(var(--t) * .35); }
.tiles.fit .word { gap: calc(var(--t) * .12); }
.tiles.fit .tile { flex: none; width: var(--t); height: calc(var(--t) * 1.23); font-size: calc(var(--t) * .68); border-radius: calc(var(--t) * .17); border-width: max(1px, min(2px, calc(var(--t) * .03))); }
.tiles.fitw { column-gap: calc(var(--t) * .4); row-gap: calc(var(--t) * .18); width: 100%; }
.tiles.fitw .word { gap: calc(var(--t) * .1); flex-wrap: wrap; justify-content: center; }
.game, .scorebar { min-width: 0; max-width: 100%; }
.scores { min-width: 0; }
.tiles.fitw .tile { flex: none; width: var(--t); height: calc(var(--t) * 1.2); font-size: calc(var(--t) * .58); border-radius: calc(var(--t) * .2); }
.tile.win { background: var(--green); border-color: var(--green); color: #06200f; }
.tile.shown { background: var(--card-2); border-color: var(--line); color: var(--text); }
.tile.flip { animation: flip .5s ease both; }
@keyframes pop { 0% { transform: scale(.4) rotate(-8deg); } 100% { transform: none; } }
@keyframes flip { 0% { transform: rotateX(90deg); opacity: .2; } 100% { transform: none; opacity: 1; } }
.timeline { display: flex; align-items: center; gap: var(--s); width: min(100%, 1100px); margin-top: calc(var(--s) * 2.2); }
.bars { display: flex; gap: 6px; flex: 1; }
.bar { height: 12px; border-radius: 6px; background: var(--track); position: relative; overflow: hidden; }
.bar i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent); border-radius: 6px; }
.bar.done i { width: 100%; background: color-mix(in srgb, var(--muted) 70%, var(--track)); }
.timer { font-family: var(--mono); font-weight: 700; font-size: clamp(30px, 2.6vw, 58px); color: var(--accent); line-height: 1; min-width: 3.2ch; text-align: right; }
.timer.low { color: var(--red); animation: beat 1s ease infinite; }
@keyframes beat { 50% { transform: scale(1.08); } }
.bar-labels { display: flex; gap: 6px; width: min(100%, 1100px); margin-top: 8px; color: var(--faint); font-size: .8em; text-align: left; }
.bar-labels .timer-gap { flex: none; width: calc(clamp(30px, 2.6vw, 58px) * 2.2 + var(--s) - 6px); }
.bar-labels span.on { color: var(--accent); font-weight: 700; }
.feed { margin-top: calc(var(--s) * 1.8); display: flex; flex-direction: column; align-items: center; gap: 12px; min-height: 5.5em; }
.feed-title { font-weight: 700; color: var(--muted); }
.feed-title b { color: var(--text); font-family: var(--mono); font-size: 1.2em; }
.feed-title.ok { color: var(--green); }
.feed-note { color: var(--faint); font-size: .82em; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 1100px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); }
.chip.new { animation: slide .3s ease; }
.chip s { font-weight: 800; color: var(--text); text-decoration-thickness: 2px; }
.chip .nm { color: var(--muted); }
.chip.hit { background: var(--green-bg); border-color: var(--green-line); animation: slide .3s ease; }
.chip.hit b { color: var(--green); font-family: var(--mono); }
.chip.wait { opacity: .4; }
.chip.done { border-color: var(--blue); background: color-mix(in srgb, var(--blue) 12%, var(--card)); }
@keyframes slide { from { opacity: 0; transform: translateY(-8px) scale(.95); } to { opacity: 1; transform: none; } }
.stage-center.paused > :not(.pause-veil) { opacity: .25; filter: blur(2px); }
.pause-veil { position: absolute; inset: 0; display: grid; place-items: center; }
.pause-veil span { font-family: var(--head); font-weight: 800; font-size: clamp(36px, 4vw, 80px); color: var(--accent); }

/* ── счёт: полоса внизу ── */
.scorebar { display: flex; align-items: center; gap: var(--s); padding: 12px 16px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); }
.scorebar > .caps { flex: none; }
.scores { display: flex; flex-wrap: wrap; gap: 8px; }
.sc { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 6px; border-radius: 999px; background: var(--bg); border: 1px solid transparent; }
.sc .pl { font-family: var(--mono); color: var(--faint); font-size: .85em; min-width: 1.4em; text-align: center; }
.sc .nm { font-weight: 700; max-width: 14ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc .pts { font-family: var(--mono); font-weight: 700; font-size: 1.1em; margin-left: 4px; padding-left: 10px; border-left: 1px solid var(--line); }
.sc .delta { color: var(--green); font-family: var(--mono); font-weight: 800; font-size: .9em; animation: slide .4s ease; }
.sc.lead { border-color: var(--accent); background: var(--accent-soft); }
.sc.lead .pl { color: var(--accent); }
.sc.answered { border-color: var(--blue); }
.score-row { display: grid; grid-template-columns: 1.6em auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--bg); margin-bottom: 8px; }
.score-row .pl { color: var(--faint); font-family: var(--mono); }
.score-row .nm { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score-row .pts { font-family: var(--mono); font-weight: 700; font-size: 1.15em; }

/* ── итог раунда ── */
.verdict { display: inline-flex; align-items: center; gap: 14px; font-family: var(--head); font-weight: 800; font-size: clamp(26px, 2.4vw, 50px); margin-bottom: calc(var(--s) * 1.6); }
.verdict i { width: 1.3em; height: 1.3em; border-radius: 50%; background: var(--green); color: #06200f; display: grid; place-items: center; font-style: normal; font-size: .75em; }
.result.won .verdict { color: var(--green); }
.verdict.timeout i, .verdict.skip i, .verdict.stop i { background: var(--card-2); color: var(--muted); }
.hint { color: var(--muted); margin-top: calc(var(--s) * 1.4); font-size: clamp(16px, 1.25vw, 26px); max-width: 60ch; text-wrap: balance; }
.nobody { color: var(--faint); margin-top: calc(var(--s) * 1.6); font-weight: 700; }
.winners { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: calc(var(--s) * 1.8); }
.winner { display: flex; align-items: center; gap: 12px; padding: 12px 18px 12px 12px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); text-align: left; animation: slide .4s ease both; }
.winner:nth-child(2) { animation-delay: .1s; } .winner:nth-child(3) { animation-delay: .2s; } .winner:nth-child(n+4) { animation-delay: .3s; }
.winner.first { border-color: var(--green-line); background: var(--green-bg); }
.winner b { display: block; }
.winner small { color: var(--muted); }
.winner .plus { font-family: var(--mono); font-weight: 800; color: var(--green); font-size: 1.5em; margin-left: 8px; }
.after { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: calc(var(--s) * 2); }
.next-auto { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--muted); font-weight: 700; }
.next-track { width: 260px; height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.next-track i { display: block; height: 100%; width: 0; background: var(--accent); }
.btn-next { padding: 16px 30px; font-size: 1.05em; }
.votes { color: var(--faint); display: flex; gap: 12px; align-items: center; font-size: .85em; }
.votes b { color: var(--text); }

/* ── итог игры ── */
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: var(--s); max-width: 780px; margin: calc(var(--s) * 2) auto 0; }
.pod { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; min-width: 0; }
.pod .nm { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pod .pts { font-family: var(--mono); font-weight: 700; font-size: 1.3em; }
.pod .step-block { width: 100%; border-radius: 16px 16px 0 0; display: flex; justify-content: center; padding-top: 14px; font-family: var(--head); font-weight: 800; font-size: 2em; color: #14162a; }
.pod.p1 .step-block { height: clamp(150px, 15vw, 260px); background: var(--accent); }
.pod.p2 .step-block { height: clamp(100px, 10vw, 180px); background: var(--silver); }
.pod.p3 .step-block { height: clamp(70px, 7vw, 130px); background: var(--bronze); }
.winner-line { text-align: center; font-family: var(--head); font-weight: 700; font-size: clamp(22px, 1.8vw, 36px); }
.winner-line span { color: var(--accent); }
.nom { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; color: var(--muted); font-size: .9em; border-bottom: 1px solid var(--line); }
.nom:last-child { border: 0; }
.nom b { color: var(--text); text-align: right; }
.final-btns { display: flex; justify-content: center; gap: 12px; margin-top: calc(var(--s) * 1.6); flex-wrap: wrap; }

/* ── полноэкранные состояния ── */
.overlay { min-height: 70vh; display: grid; place-items: center; text-align: center; gap: var(--s); }
.big-num { font-family: var(--head); font-weight: 800; font-size: clamp(120px, 14vw, 280px); color: var(--accent); line-height: 1; animation: pop .5s ease; }
.spinner { width: 64px; height: 64px; border-radius: 50%; border: 6px solid var(--track); border-top-color: var(--accent); animation: spin 1s linear infinite; margin: 0 auto var(--s); }
@keyframes spin { to { transform: rotate(360deg); } }
.login { max-width: 560px; margin: 10vh auto 0; text-align: center; }
.login .card { margin-top: calc(var(--s) * 1.5); display: grid; gap: var(--s); justify-items: center; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #2a1215; color: var(--red); border: 1px solid #5c2b2e; padding: 12px 18px; border-radius: 12px; z-index: 50; max-width: 90vw; }
.toast.ok { background: var(--green-bg); color: var(--green); border-color: var(--green-line); }
.conn { position: fixed; top: 10px; right: 10px; padding: 6px 12px; border-radius: 999px; background: #2a1215; color: var(--red); font-size: .8em; z-index: 40; }
.sound { opacity: .75; }

/* ── игрок на сайте (телефон в первую очередь) ── */
.app.play { max-width: 560px; padding: 14px 16px calc(96px + env(safe-area-inset-bottom)); }
.ptop { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.ptop .logo { font-size: 20px; }
.pme { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pme b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pscore { text-align: right; line-height: 1.1; }
.pscore b { font-family: var(--mono); font-size: 1.3em; color: var(--accent); }
.pscore small { display: block; color: var(--muted); font-size: .75em; }
.ptitle { font-size: 30px; margin-top: 6px; }
.psub { margin: 8px 0 16px; }
.pcard { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 20px; display: grid; gap: 12px; margin-bottom: 14px; }
.pcard.center { justify-items: center; text-align: center; }
.code.small { margin: 0; justify-content: flex-start; }
.code.small span { width: 52px; height: 64px; font-size: 36px; border-radius: 14px; }
.btn-wide { width: 100%; padding: 16px; font-size: 1.05em; }
.or { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: .85em; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.tg-holder { min-height: 44px; display: flex; justify-content: center; }
.tg-link { color: var(--muted); font-size: .88em; text-align: center; text-decoration: underline; text-underline-offset: 3px; }
.row { display: flex; gap: 10px; width: 100%; }
.code-input { text-align: center; font-family: var(--mono); font-size: 1.4em; letter-spacing: .3em; }
.ok-mark { width: 64px; height: 64px; border-radius: 50%; background: var(--green); color: #06200f; display: grid; place-items: center; font-size: 32px; font-weight: 900; animation: pop .5s ease; }
.small { font-size: .85em; }
.center-text { text-align: center; }
.pround { display: flex; flex-direction: column; gap: 14px; }
.pq { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 18px 16px; display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; }
.play .pts-badge { margin-bottom: 12px; font-size: .9em; padding: 6px 14px; }
.play .question { font-size: clamp(20px, 6vw, 28px); margin-bottom: 16px; max-width: none; }
.ptiles { width: 100%; }

.play .timeline { margin-top: 18px; gap: 12px; }
.play .timer { font-size: 26px; }
.play .bar { height: 8px; }
.pround.paused .pq { opacity: .4; }
.pstatus { text-align: center; color: var(--muted); padding: 12px 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.pstatus.ok { color: var(--green); background: var(--green-bg); border-color: var(--green-line); font-size: 1.1em; animation: pop .35s ease; }
.pstatus.bad { color: var(--red); border-color: color-mix(in srgb, var(--red) 50%, transparent); }
.pstatus.bad s { color: var(--text); font-weight: 800; }
.pstatus.mine-ans { color: var(--text); border-color: var(--blue); }
.pfeed { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; font-size: .85em; }
.pfeed .chip { padding: 4px 10px; }
.answer-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
.answer-bar .field { flex: 1; font-size: 18px; padding: 14px 16px; border-radius: 16px; background: var(--card); }
.answer-bar .btn { width: 56px; padding: 0; font-size: 22px; border-radius: 16px; }
@media (min-width: 600px) { .answer-bar { left: 50%; transform: translateX(-50%); width: 560px; border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0; } }
.shake { animation: shake .35s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@media (min-width: 600px) { .answer-bar.shake { animation: shake-c .35s ease; } }
@keyframes shake-c { 20%, 60% { transform: translateX(calc(-50% - 8px)); } 40%, 80% { transform: translateX(calc(-50% + 8px)); } }
.verdict.small { font-size: 22px; margin-bottom: 4px; }
.presult .hint { font-size: 15px; margin-top: 4px; }
.mine { font-weight: 800; font-size: 1.1em; color: var(--muted); padding: 10px 18px; border-radius: 999px; background: var(--card-2); }
.mine.ok { color: var(--green); background: var(--green-bg); }
.mine b { font-family: var(--mono); font-size: 1.3em; }
.pvote { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.pvote .btn { padding: 8px 16px; font-size: 1.2em; }
.big-place { font-family: var(--head); font-weight: 800; font-size: 96px; color: var(--accent); line-height: 1; display: flex; align-items: baseline; gap: 8px; }
.big-place small { font-size: 22px; color: var(--muted); }
.score-row.me { outline: 2px solid var(--accent); }
.play .overlay { min-height: 60vh; }
.play .big-num { font-size: 140px; }

/* ── телефон ── */
@media (max-width: 960px) {
  .app { padding: 16px; }
  .cols, .cols-wide { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; }
  .podium { gap: 8px; }
  .round-top .btns { width: 100%; }
  .tbar { flex-wrap: wrap; margin: var(--s) -16px -16px; padding: 12px 16px; }
  .tbar-hint { display: none; }
  .btn-create { width: 100%; }
  .lobby, .lobby.with-params { grid-template-columns: minmax(0, 1fr); }
  .join { flex-direction: column; align-items: flex-start; }
  .acct-name { display: none; }
  .newtopic.review { grid-template-columns: minmax(0, 1fr); }

  .bar-labels { display: none; }
  .scorebar { flex-direction: column; align-items: flex-start; }
}
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input { -moz-appearance: textfield; }

/* ── ведущий с телефона (в том числе мини-приложение Telegram) ── */
@media (max-width: 700px) {
  .top { flex-wrap: nowrap; }
  .top > .pill, .top > .btns, .steps, .tbar-hint, .rc-pre, .sound, .full { display: none; }
  .logo { font-size: 22px; }
  .h1 { font-size: 28px; }
  .topics-head { margin-bottom: 12px; }
  .topics-head .tabs { width: 100%; }
  .topics-head .tab { flex: 1; padding: 10px 8px; font-size: .9em; }
  .topics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .topic { min-height: 118px; padding: 14px; border-radius: 18px; gap: 10px; }
  .topic .e { width: 44px; height: 44px; font-size: 24px; border-radius: 13px; }
  .topic .n { font-size: 16px; }
  .topic .d { font-size: .78em; }
  .topic .tick { width: 24px; height: 24px; top: 10px; right: 10px; }
  .utopics { grid-template-columns: minmax(0, 1fr); }
  .filters .search { width: 100%; }
  .newtopic .nt-note { display: none; }
  .tbar { position: sticky; flex-wrap: nowrap; gap: 10px; }
  .tbar-text { flex-direction: column; align-items: flex-start; gap: 2px; }
  .tbar-text .chosen { max-width: 46vw; }
  .btn-create { width: auto; padding: 14px 18px; font-size: .95em; }
  .players { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .player { padding: 10px; gap: 8px; }
  .player .ava { width: 2em; height: 2em; }
  .join { gap: 14px; }
  .join .code span { width: 54px; height: 66px; font-size: 38px; border-radius: 14px; }
  .join .qr img { width: 150px; }
  .bottom-bar { position: sticky; bottom: 0; z-index: 5; margin: var(--s) -16px -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--card) 94%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
  .bottom-bar .spacer { display: none; }
  .bottom-bar .btn { padding: 12px 14px; font-size: .9em; }
  .btn-start { flex: 1; }
  .game { min-height: calc(100vh - 32px); }
  .round-top { gap: 8px 10px; }
  .rnum { font-size: 18px; }
  .roomcode { font-size: .85em; }
  .round-top .spacer { flex-basis: 100%; height: 0; }
  .round-top .roomcode { margin-right: auto; }
  .ctrl .btn-icon { padding: 8px 12px; }
  .stage-center { padding: 18px 0; }
  .pts-badge { margin-bottom: 14px; font-size: .9em; }
  .question { margin-bottom: 18px; }
  .timeline { margin-top: 20px; }
  .timer { font-size: 30px; }
  .scorebar { flex-direction: row; align-items: center; overflow-x: auto; padding: 10px 12px; gap: 10px; }
  .scores { flex-wrap: nowrap; }
  .sc { flex: none; }
  .verdict { font-size: 24px; }
  .winners .winner { padding: 8px 12px 8px 8px; }
  .podium .ava.lg { font-size: 1.1em; }
  .final-btns { flex-direction: column; }
  .final-btns .btn { width: 100%; }
}