/* OiynLab — живая викторина. Минимализм: светлый фон, один яркий синий,
   золотой акцент, четыре своих цвета ответов. Шрифт Nunito (есть ә ғ қ ң ө ұ ү һ і). */

@font-face { font-family: Nunito; font-weight: 600; font-display: swap; src: url(fonts/nunito-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Nunito; font-weight: 600; font-display: swap; src: url(fonts/nunito-cyrillic-600-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Nunito; font-weight: 600; font-display: swap; src: url(fonts/nunito-cyrillic-ext-600-normal.woff2) format("woff2"); unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: Nunito; font-weight: 800; font-display: swap; src: url(fonts/nunito-latin-800-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Nunito; font-weight: 800; font-display: swap; src: url(fonts/nunito-cyrillic-800-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Nunito; font-weight: 800; font-display: swap; src: url(fonts/nunito-cyrillic-ext-800-normal.woff2) format("woff2"); unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: Nunito; font-weight: 900; font-display: swap; src: url(fonts/nunito-latin-900-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Nunito; font-weight: 900; font-display: swap; src: url(fonts/nunito-cyrillic-900-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Nunito; font-weight: 900; font-display: swap; src: url(fonts/nunito-cyrillic-ext-900-normal.woff2) format("woff2"); unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }

:root {
  --bg: #F5F5FA;
  --surface: #FFFFFF;
  --ink: #16142E;
  --muted: #5F5C7E;
  --line: #E5E4EF;
  --brand: #2F45FF;
  --brand-deep: #2235D9;
  --on-brand: #FFFFFF;
  --gold: #FFB020;
  --on-gold: #16142E;
  --ok: #129A5B;
  --bad: #DC3E45;
  --none: #6B6889;
  /* ответы: коралл, фиалка, бирюза, янтарь */
  --a0: #E5484D; --a1: #6E56CF; --a2: #0E8F7E; --a3: #F2A516;
  --on-a3: #2A1B00;
  /* аватары */
  --c0: #E5484D; --c1: #6E56CF; --c2: #0E8F7E; --c3: #D97706;
  --c4: #2F45FF; --c5: #C2298A; --c6: #3E7B27; --c7: #0B7BB8;

  --r-sm: 10px; --r: 16px; --r-lg: 24px; --r-xl: 32px;
  --shadow: 0 1px 2px rgb(22 20 46 / .06), 0 6px 24px rgb(22 20 46 / .08);
  --shadow-lg: 0 2px 4px rgb(22 20 46 / .08), 0 18px 48px rgb(22 20 46 / .16);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --pop: cubic-bezier(.34, 1.56, .64, 1);
  --font: Nunito, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F0E1D;
    --surface: #1A1930;
    --ink: #F3F2FA;
    --muted: #A6A3C4;
    --line: #2C2A47;
    --brand: #3346F0;
    --brand-deep: #2636C4;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 6px 24px rgb(0 0 0 / .3);
    --shadow-lg: 0 2px 4px rgb(0 0 0 / .4), 0 18px 48px rgb(0 0 0 / .5);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  font-family: var(--font); font-weight: 600; font-size: 16px; line-height: 1.5;
  color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color .35s var(--ease), color .35s var(--ease);
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
code, pre { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .9em; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 6px; }
.ic { width: 1.2em; height: 1.2em; flex: none; vertical-align: -.22em; }

/* синие экраны: вход, лобби, таблица, итоги, сообщения */
body.b-join, body.b-message,
body[data-phase="lobby"], body[data-phase="board"], body[data-phase="final"],
body[data-phase="closed"], body[data-phase="kicked"] {
  --ink-on: var(--on-brand);
  background: var(--brand); color: var(--on-brand);
}
body[data-phase="reveal"].b-play:has(.res-ok) { background: var(--ok); color: #fff; }
body[data-phase="reveal"].b-play:has(.res-bad) { background: var(--bad); color: #fff; }
body[data-phase="reveal"].b-play:has(.res-none) { background: var(--none); color: #fff; }

/* ---------- логотип ---------- */
.logo { display: inline-flex; align-items: center; gap: .08em; font-weight: 900; font-size: 22px; letter-spacing: -.02em; line-height: 1; text-decoration: none; }
.logo-o { width: .78em; height: .78em; margin-right: .18em; border-radius: 50%; border: .2em solid var(--gold); }
.logo-lab { margin-left: .12em; padding: .14em .36em .18em; border-radius: .4em; background: var(--gold); color: var(--on-gold); font-size: .78em; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 48px; padding: 0 22px; border: 0; border-radius: var(--r);
  font-weight: 800; font-size: 17px; text-decoration: none; cursor: pointer;
  transition: transform .15s var(--ease), background-color .2s, box-shadow .2s, opacity .2s;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-xl { min-height: 60px; padding: 0 30px; font-size: 20px; border-radius: 18px; }
.btn-block { width: 100%; }
.btn-ink { background: var(--ink); color: var(--bg); }
.btn-brand { background: var(--brand); color: var(--on-brand); }
.btn-brand:hover:not(:disabled) { background: var(--brand-deep); }
.btn-gold { background: var(--gold); color: var(--on-gold); box-shadow: 0 6px 0 rgb(0 0 0 / .18); }
.btn-gold:active:not(:disabled) { box-shadow: 0 2px 0 rgb(0 0 0 / .18); transform: translateY(4px); }
.btn-white { background: #fff; color: #16142E; }
.btn-ghost { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 2px var(--line); }
.btn-ghost:hover { color: var(--ink); }
.btn-ghost-light { background: rgb(255 255 255 / .12); color: #fff; }
.btn-ghost-light:hover { background: rgb(255 255 255 / .2); }
.btn-danger { background: var(--bad); color: #fff; }
.btn.is-busy { pointer-events: none; opacity: .7; }
.icon-btn { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px; background: rgb(127 127 160 / .14); cursor: pointer; }
.icon-btn:hover { background: rgb(127 127 160 / .24); }

/* ---------- карточки и формы ---------- */
.card { background: var(--surface); color: var(--ink); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); }
.center-screen { flex: 1; display: grid; place-items: center; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); }
.join { width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: 24px; }
.join-logo .logo { font-size: 44px; }
.join-card { width: 100%; padding: 28px 24px 24px; display: flex; flex-direction: column; gap: 10px; animation: rise .45s var(--ease) both; }
.field-label { font-weight: 800; font-size: 15px; color: var(--muted); }
.code-input, .nick-input {
  width: 100%; border: 2px solid var(--line); border-radius: var(--r); background: var(--bg);
  text-align: center; transition: border-color .2s, box-shadow .2s;
}
.code-input { height: 84px; font-size: 48px; font-weight: 900; letter-spacing: .3em; padding-left: .3em; font-variant-numeric: tabular-nums; }
.nick-input { height: 64px; font-size: 24px; font-weight: 800; }
.code-input::placeholder, .nick-input::placeholder { color: var(--line); }
.nick-input::placeholder { color: var(--muted); opacity: .5; }
.code-input:focus, .nick-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgb(47 69 255 / .18); }
.field-help { font-size: 14px; color: var(--muted); text-align: center; margin-bottom: 6px; }
.field-err { font-size: 15px; font-weight: 800; color: var(--bad); text-align: center; }
.join-room { text-align: center; color: var(--muted); }
.join-room b { color: var(--ink); font-weight: 900; letter-spacing: .08em; }
.host-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; color: rgb(255 255 255 / .85); font-weight: 800; text-decoration: none; border-radius: 12px; }
.host-link:hover { color: #fff; background: rgb(255 255 255 / .1); }
.open-games { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.open-title { font-size: 14px; font-weight: 800; opacity: .75; text-align: center; }
.open-game {
  display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 0 18px;
  border-radius: var(--r); background: rgb(255 255 255 / .12); text-decoration: none; font-weight: 800;
  transition: background-color .2s;
}
.open-game:hover { background: rgb(255 255 255 / .2); }
.open-code { font-weight: 900; font-size: 22px; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.open-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .85; }
.msg-card { text-align: center; gap: 14px; }
.msg-title { font-size: 26px; font-weight: 900; line-height: 1.2; }
.msg-text { color: var(--muted); margin-bottom: 8px; }

/* ---------- верхняя полоса ---------- */
.bar { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); }
.bar-home { text-decoration: none; display: inline-flex; min-height: 44px; align-items: center; }
.bar-code { font-weight: 900; letter-spacing: .08em; opacity: .7; font-variant-numeric: tabular-nums; }
.bar-role { margin-left: auto; font-weight: 800; color: var(--muted); }
.bar-light { background: var(--surface); border-bottom: 1px solid var(--line); }
.conn { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 6px 0 12px; border-radius: 99px; background: rgb(127 127 160 / .14); font-size: 14px; font-weight: 800; }
.conn-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--gold); }
.conn[data-conn="ok"] .conn-dot { background: #22C55E; box-shadow: 0 0 0 3px rgb(34 197 94 / .25); }
.conn[data-conn="ok"] { padding-right: 12px; }
.conn[data-conn="ok"] .conn-retry, .conn[data-conn="wait"] .conn-retry { display: none; }
.conn[data-conn="lost"] .conn-dot { background: var(--bad); animation: blink 1s infinite; }
.conn-retry { min-height: 30px; padding: 0 12px; border: 0; border-radius: 99px; background: var(--gold); color: var(--on-gold); font-weight: 800; font-size: 13px; cursor: pointer; }

/* ---------- сцена ---------- */
.stage { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.st { flex: 1; display: flex; flex-direction: column; width: 100%; animation: fade .3s var(--ease) both; }
.st-center { justify-content: center; align-items: center; padding: 24px 16px calc(32px + env(safe-area-inset-bottom)); text-align: center; }
.loading { flex: 1; display: flex; gap: 12px; align-items: center; justify-content: center; font-weight: 800; opacity: .7; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }

.big-msg { display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 520px; }
.big-title { font-size: clamp(32px, 9vw, 56px); font-weight: 900; line-height: 1.1; letter-spacing: -.02em; }
.big-sub { font-size: 18px; opacity: .85; }
.me-nick { font-size: 22px; font-weight: 900; padding: 6px 18px; border-radius: 99px; background: rgb(255 255 255 / .15); }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 99px; background: rgb(255 255 255 / .16); font-weight: 800; }
.avatar { display: grid; place-items: center; width: 96px; height: 96px; border-radius: 50%; font-size: 44px; font-weight: 900; color: #fff; box-shadow: 0 0 0 6px rgb(255 255 255 / .25); animation: pop .5s var(--pop) both; }
.place-label { font-size: 18px; font-weight: 800; opacity: .8; }
.place { font-size: clamp(96px, 30vw, 160px); font-weight: 900; line-height: 1; letter-spacing: -.04em; animation: pop .5s var(--pop) both; }
.me-score { font-size: 24px; font-weight: 900; }
.dots { display: inline-flex; gap: 5px; margin-right: 10px; vertical-align: middle; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: bounce 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }

.c0 { background: var(--c0); } .c1 { background: var(--c1); } .c2 { background: var(--c2); } .c3 { background: var(--c3); }
.c4 { background: var(--c4); } .c5 { background: var(--c5); } .c6 { background: var(--c6); } .c7 { background: var(--c7); }

/* ---------- варианты ответа ---------- */
.opt {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 14px;
  min-height: 72px; padding: 14px 18px; border: 0; border-radius: var(--r-lg);
  color: #fff; font-weight: 800; text-align: left; line-height: 1.25;
  transition: transform .15s var(--ease), opacity .3s, filter .3s;
}
.a0 { background: var(--a0); } .a1 { background: var(--a1); } .a2 { background: var(--a2); }
.a3 { background: var(--a3); color: var(--on-a3); }
.opt-mark { display: grid; place-items: center; flex: none; width: 1.9em; height: 1.9em; border-radius: .55em; background: rgb(255 255 255 / .22); font-weight: 900; }
.a3 .opt-mark { background: rgb(0 0 0 / .1); }
.opt-text { flex: 1; min-width: 0; overflow-wrap: anywhere; position: relative; }
button.opt { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button.opt:active { transform: scale(.97); }
button.opt.is-chosen { transform: scale(.97); box-shadow: 0 0 0 4px var(--ink); }
.p-opts.is-locked button.opt:not(.is-chosen) { opacity: .35; }

/* ---------- ИГРОК: вопрос ---------- */
.p-q { padding: 4px 16px calc(16px + env(safe-area-inset-bottom)); gap: 14px; max-width: 720px; margin: 0 auto; }
.p-head { display: flex; align-items: center; justify-content: space-between; }
.q-num { font-weight: 800; color: var(--muted); }
.p-qtext { font-size: clamp(20px, 5.5vw, 28px); font-weight: 900; line-height: 1.25; text-align: center; padding: 6px 0; }
.p-opts { flex: 1; display: grid; gap: 12px; grid-template-columns: 1fr; grid-auto-rows: minmax(80px, 1fr); }
.p-opts .opt { font-size: 20px; }
@media (min-width: 560px) { .p-opts.opts-4, .p-opts.opts-2 { grid-template-columns: 1fr 1fr; } .p-opts .opt { min-height: 120px; } }
.p-wait { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 20px; }
.p-wait .opt { font-size: 22px; min-height: 96px; animation: pop .4s var(--pop) both; }
.p-wait-text { text-align: center; font-weight: 800; color: var(--muted); font-size: 18px; }

/* ---------- ИГРОК: результат ---------- */
.res-icon { display: grid; place-items: center; width: 112px; height: 112px; border-radius: 50%; background: rgb(255 255 255 / .2); font-size: 64px; animation: pop .5s var(--pop) both; }
.res-gain { font-size: 40px; font-weight: 900; padding: 4px 22px; border-radius: 99px; background: rgb(0 0 0 / .15); animation: rise .5s .15s var(--ease) both; }
.res-right { font-size: 18px; padding: 10px 16px; border-radius: var(--r); background: rgb(0 0 0 / .15); }

/* ---------- таймер ---------- */
.timer {
  --p: 1; position: relative; display: grid; place-items: center; flex: none;
  width: 84px; height: 84px; border-radius: 50%;
  background: conic-gradient(var(--brand) calc(var(--p) * 360deg), var(--line) 0);
}
.timer::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--surface); }
.timer-num { position: relative; font-size: 32px; font-weight: 900; font-variant-numeric: tabular-nums; }
.timer.is-low { background: conic-gradient(var(--bad) calc(var(--p) * 360deg), var(--line) 0); }
.timer.is-low .timer-num { color: var(--bad); }
.timer-sm { width: 52px; height: 52px; }
.timer-sm::before { inset: 5px; background: var(--bg); }
.timer-sm .timer-num { font-size: 20px; }

/* ---------- ВЕДУЩИЙ ---------- */
.stage-host { --hs: clamp(16px, 1.15vw, 26px); font-size: var(--hs); }
.stage-host .st { padding: 8px clamp(16px, 3vw, 64px) 0; gap: clamp(16px, 2.2vh, 32px); }
.bar-host { padding-left: clamp(16px, 3vw, 64px); padding-right: clamp(16px, 3vw, 64px); }
.host-foot {
  margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 18px 0 calc(22px + env(safe-area-inset-bottom)); border-top: 1px solid rgb(255 255 255 / .18);
}
.host-foot-light { border-top-color: var(--line); }
.foot-title { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.foot-title b { font-weight: 900; font-size: 1.1em; }
.foot-title span { opacity: .7; font-size: .9em; }
.foot-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.stage-host .host-foot .btn:not(.btn-xl) { min-height: clamp(60px, 6vh, 84px); font-size: clamp(17px, 1.05vw, 22px); }
.stage-host .host-foot .btn-xl, .stage-host .btn-xl { min-height: clamp(60px, 6vh, 84px); font-size: clamp(20px, 1.4vw, 30px); padding: 0 clamp(28px, 2vw, 44px); }

/* лобби */
.lobby-top { display: grid; grid-template-columns: 1fr auto; gap: clamp(16px, 2vw, 32px); }
.lobby-how { padding: clamp(20px, 2.4vw, 44px); display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 8px; }
.how-steps { list-style: none; margin: 0; padding: 0; display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 32px; font-size: 1.3em; font-weight: 800; color: var(--muted); }
.how-steps li { display: flex; align-items: center; gap: 12px; }
.how-n { display: grid; place-items: center; width: 1.7em; height: 1.7em; border-radius: 50%; background: var(--bg); color: var(--ink); font-weight: 900; font-size: .85em; }
.how-addr { color: var(--ink); font-weight: 900; }
.big-code { font-size: clamp(72px, 10vw, 200px); font-weight: 900; line-height: 1; letter-spacing: .06em; color: var(--ink); font-variant-numeric: tabular-nums; }
.lobby-qr { padding: clamp(14px, 1.4vw, 24px); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.qr { width: clamp(140px, 15vw, 300px); aspect-ratio: 1; }
.qr svg { width: 100%; height: 100%; display: block; }
.qr-cap { font-size: .85em; color: var(--muted); font-weight: 800; }
.lobby-players { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 16px; }
.lobby-count { display: inline-flex; align-items: center; gap: 10px; font-size: 1.3em; font-weight: 800; }
.lobby-count b { font-size: 1.3em; font-weight: 900; }
.lobby-wait { font-size: 1.3em; font-weight: 800; opacity: .8; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; align-content: flex-start; overflow: auto; }
.chip {
  min-height: 48px; padding: 0 20px; border: 0; border-radius: 99px; color: #fff;
  font-size: 1.15em; font-weight: 900; cursor: pointer; box-shadow: 0 4px 0 rgb(0 0 0 / .15);
  transition: transform .15s var(--ease), opacity .3s;
}
.chip:hover { transform: translateY(-2px); }
.chip.is-new { animation: pop .45s var(--pop) both; }
.chip-off { opacity: .45; }

/* вопрос на доске */
.h-q { background: transparent; }
.q-head { display: flex; align-items: center; gap: 24px; font-size: 1.1em; }
.h-q .q-num { font-size: 1.1em; }
.q-answered { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-weight: 800; color: var(--muted); }
.q-answered b { color: var(--ink); font-size: 1.3em; font-weight: 900; }
.stage-host .timer { width: clamp(84px, 7vw, 140px); height: clamp(84px, 7vw, 140px); }
.stage-host .timer::before { inset: clamp(8px, .6vw, 12px); }
.stage-host .timer-num { font-size: clamp(32px, 2.8vw, 56px); }
.q-text {
  flex: 1; display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: clamp(28px, 3.4vw, 72px); font-weight: 900; line-height: 1.2; letter-spacing: -.01em;
  padding: 2vh 4%; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow);
}
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(12px, 1.2vw, 20px); }
.opts .opt { min-height: clamp(88px, 11vh, 150px); font-size: clamp(20px, 1.7vw, 36px); padding: 0 clamp(18px, 1.6vw, 32px); }
.opt-count { position: relative; margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 1.1em; font-weight: 900; }
.opt-bar { position: absolute; left: 0; bottom: 0; height: 8px; width: var(--w); background: rgb(255 255 255 / .55); transition: width .8s var(--ease); }
.a3 .opt-bar { background: rgb(0 0 0 / .25); }
.is-reveal .opt:not(.opt-ok) { opacity: .28; filter: saturate(.5); }
.is-reveal .opt-ok { animation: pulse .6s var(--pop) both; }

/* таблица */
.board-title { font-size: clamp(32px, 3vw, 64px); font-weight: 900; text-align: center; letter-spacing: -.02em; padding-top: 1vh; }


/* ---------- таблица лидеров (доска и телефон) ----------
   В HTML — итоговое состояние. Движение (Anime.js, app.js): строки встают на старые места
   со старыми очками, затем очки набегают, шкалы растут, строки переезжают на новые места. */
.lb { list-style: none; margin: 0 auto; padding: 0; width: 100%; max-width: 1100px; display: flex; flex-direction: column; gap: 10px; }
.lb-row {
  position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: center; gap: 12px;
  min-height: 60px; padding: 8px 16px 8px 10px; border-radius: var(--r); background: var(--surface); color: var(--ink);
  font-weight: 800; box-shadow: 0 2px 0 rgb(0 0 0 / .1), 0 8px 22px rgb(10 14 60 / .16);
}
.lb-fill { position: absolute; inset: 0 auto 0 0; z-index: -1; width: var(--w, 0%);
  background: linear-gradient(90deg, rgb(47 69 255 / .04), rgb(47 69 255 / .15)); border-right: 3px solid rgb(47 69 255 / .32); }
.lb-row.is-lead .lb-fill { background: linear-gradient(90deg, rgb(255 176 32 / .08), rgb(255 176 32 / .32)); border-right-color: var(--gold); }
.lb-rank { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--bg); color: var(--muted);
  font-size: 17px; font-weight: 900; font-variant-numeric: tabular-nums; }
.lb-row.is-lead .lb-rank { background: var(--gold); color: var(--on-gold); }
.lb-av { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #fff; font-size: 16px; font-weight: 900; }
.lb-who { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; line-height: 1.15; }
.lb-nick { font-size: 17px; font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.lb-meta:empty { display: none; }
.lb-you { padding: 1px 8px; border-radius: 99px; background: var(--brand); color: #fff; font-weight: 900; }
.lb-streak { display: inline-flex; align-items: center; gap: 1px; color: #E8590C; font-weight: 900; }
.lb-up { display: inline-flex; align-items: center; gap: 1px; color: var(--ok); font-weight: 900; }
.lb-pts { flex: none; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.lb-score { font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; }
.lb-gain { display: inline-block; color: var(--ok); font-size: 13px; font-weight: 900; }
.lb-row.is-me { z-index: 2; box-shadow: 0 0 0 3px var(--gold), 0 10px 30px rgb(10 14 60 / .3); }
.lb-gap { display: flex; justify-content: center; gap: 6px; padding: 2px 0; }
.lb-gap i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .55; }
@media (prefers-color-scheme: dark) {
  .lb-gain { color: #3DD68C; } .lb-up { color: #3DD68C; }
}

/* доска: крупно, чтобы читалось с последней парты */
.stage-host .lb { gap: clamp(10px, 1.3vh, 16px); }
.stage-host .lb-row { min-height: clamp(64px, 8.5vh, 104px); gap: clamp(14px, 1.2vw, 24px); padding: 0 clamp(18px, 1.6vw, 32px) 0 clamp(12px, 1vw, 20px); border-radius: var(--r-lg); }
.stage-host .lb-rank, .stage-host .lb-av { width: clamp(44px, 3.4vw, 64px); height: clamp(44px, 3.4vw, 64px); font-size: clamp(20px, 1.5vw, 30px); }
.stage-host .lb-rank { border-radius: clamp(12px, .9vw, 18px); }
.stage-host .lb-nick { font-size: clamp(24px, 2vw, 40px); }
.stage-host .lb-meta { font-size: clamp(15px, 1vw, 20px); gap: 12px; }
.stage-host .lb-score { font-size: clamp(26px, 2.1vw, 42px); }
.stage-host .lb-gain { font-size: clamp(16px, 1.1vw, 22px); }

/* итоги: места ниже пьедестала — компактно, на синем фоне */
.lb-compact .lb { gap: 8px; }
.lb-compact .lb-row { min-height: 48px; background: rgb(255 255 255 / .12); color: inherit; box-shadow: none; }
.lb-compact .lb-fill { display: none; }
.lb-compact .lb-rank { background: rgb(255 255 255 / .16); color: inherit; }
.lb-compact .lb-av { box-shadow: 0 0 0 2px rgb(255 255 255 / .8); }
.lb-compact .lb-row.is-me { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 3px var(--gold); }
.lb-compact .lb-row.is-me .lb-rank { background: var(--bg); color: var(--muted); }
.lb-compact .lb-gain { display: none; }
.stage-host .lb-compact .lb { display: grid; grid-template-columns: 1fr 1fr; max-width: 1400px; }
.stage-host .lb-compact .lb-row { min-height: clamp(48px, 5.6vh, 72px); }
.stage-host .lb-compact :is(.lb-nick, .lb-score) { font-size: clamp(20px, 1.4vw, 30px); }
.stage-host .lb-compact :is(.lb-rank, .lb-av) { width: clamp(36px, 2.6vw, 50px); height: clamp(36px, 2.6vw, 50px); font-size: clamp(16px, 1.1vw, 22px); }

/* ---------- пьедестал ---------- */
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 10px; width: 100%; max-width: 1000px; margin: 0 auto; }
.pod { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.pod-0 { order: 2; } .pod-1 { order: 1; } .pod-2 { order: 3; }
.podium-1 .pod-0 { grid-column: 2; }
.pod-who { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; max-width: 100%; padding-bottom: 10px; }
.pod-crown { position: relative; z-index: 1; display: block; margin-bottom: -12px; color: var(--gold); font-size: 40px; line-height: 1; filter: drop-shadow(0 3px 0 rgb(0 0 0 / .18)); }
.pod-crown .ic { width: 1em; height: 1em; vertical-align: top; }
.pod-av { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; color: #fff; font-size: 24px; font-weight: 900;
  box-shadow: 0 0 0 4px rgb(255 255 255 / .85); }
.pod-0 .pod-av { width: 64px; height: 64px; font-size: 30px; box-shadow: 0 0 0 4px var(--gold); }
.pod-nick { max-width: 100%; padding: 1px 8px; font-size: 16px; font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod.is-me .pod-nick { border-radius: 99px; background: var(--surface); color: var(--ink); }
.pod-score { font-size: 14px; font-weight: 800; opacity: .85; font-variant-numeric: tabular-nums; }
.pod-step { position: relative; overflow: hidden; width: 100%; display: flex; justify-content: center; padding-top: 12px;
  border-radius: 14px 14px 0 0; background: linear-gradient(rgb(255 255 255 / .3), rgb(255 255 255 / .1)); transform-origin: 50% 100%; }
.pod-0 .pod-step { height: 150px; background: linear-gradient(#FFCB57, var(--gold)); color: var(--on-gold); }
.pod-1 .pod-step { height: 112px; }
.pod-2 .pod-step { height: 84px; }
.pod-place { font-size: 40px; font-weight: 900; line-height: 1; }
/* блик по ступеньке победителя */
.pod-0 .pod-step::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgb(255 255 255 / .55) 50%, transparent 70%);
  transform: translateX(-120%); }
.pod-0 .pod-step.is-shine::after { animation: shine 1.2s ease-in-out; }
@keyframes shine { to { transform: translateX(120%); } }

/* разбор на телефоне: кольцо от значка (рисует Anime.js) */
.res-icon { position: relative; }
.res-ring { position: absolute; inset: 0; border-radius: 50%; border: 4px solid rgb(255 255 255 / .85); pointer-events: none; opacity: 0; }
/* где движение ведёт Anime.js — CSS-анимации этих элементов выключены, чтобы не было двойных */
.stage.has-anime :is(.res-icon, .res-gain, .res-break, .p-res .pill-gold, .fin-stats) { animation: none; }

.stage-host .podium { flex: 1; min-height: 0; gap: clamp(12px, 1.4vw, 24px); }
.stage-host .pod-who { gap: 8px; padding-bottom: 14px; }
.stage-host .pod-crown { font-size: clamp(56px, 4.4vw, 104px); margin-bottom: clamp(-22px, -1.2vw, -14px); }
.stage-host .pod-av { width: clamp(64px, 5vw, 108px); height: clamp(64px, 5vw, 108px); font-size: clamp(28px, 2.2vw, 48px); box-shadow: 0 0 0 6px rgb(255 255 255 / .85); }
.stage-host .pod-0 .pod-av { width: clamp(84px, 6.4vw, 140px); height: clamp(84px, 6.4vw, 140px); font-size: clamp(36px, 2.8vw, 62px); box-shadow: 0 0 0 6px var(--gold); }
.stage-host .pod-nick { font-size: 1.6em; }
.stage-host .pod-score { font-size: 1.2em; }
.stage-host .pod-step { padding-top: 18px; border-radius: var(--r-lg) var(--r-lg) 0 0; }
.stage-host .pod-0 .pod-step { height: clamp(150px, 34vh, 400px); }
.stage-host .pod-1 .pod-step { height: clamp(110px, 25vh, 300px); }
.stage-host .pod-2 .pod-step { height: clamp(80px, 17vh, 210px); }
.stage-host .pod-place { font-size: clamp(44px, 4vw, 96px); }

/* ---------- телефон: таблица и итоги ---------- */
.p-lb { gap: 14px; width: 100%; max-width: 560px; margin: 0 auto; padding: 8px 16px calc(24px + env(safe-area-inset-bottom)); }
.p-lb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.p-lb-head h2 { font-size: 26px; font-weight: 900; letter-spacing: -.02em; }
.pill-sm { padding: 4px 12px; font-size: 14px; }
.p-fin-quiz { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.p-lb-foot { display: flex; align-items: center; justify-content: center; gap: 6px; text-align: center; font-size: 17px; font-weight: 800; }
.p-fin .podium { margin-top: 6px; }
.fin-me { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px; border-radius: var(--r-lg); background: rgb(255 255 255 / .12); text-align: center; }
.fin-place { display: inline-flex; align-items: center; gap: 8px; font-size: 24px; font-weight: 900; }
.fin-place .ic { color: var(--gold); }
.fin-score { font-size: 18px; font-weight: 800; }
.fin-score b { font-size: 30px; font-weight: 900; font-variant-numeric: tabular-nums; }
.p-fin .btn-xl { align-self: center; margin-top: 4px; }

/* ---------- ведущий: список викторин ---------- */
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 24px 16px 48px; display: flex; flex-direction: column; gap: 36px; }
.sec { display: flex; flex-direction: column; gap: 14px; }
.sec-title { font-size: 24px; font-weight: 900; letter-spacing: -.01em; }
.quizzes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.quiz { display: flex; flex-direction: column; gap: 8px; padding: 22px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); }
.quiz-title { font-size: 20px; font-weight: 900; line-height: 1.25; display: flex; gap: 8px; align-items: flex-start; }
.quiz-meta { color: var(--muted); margin-bottom: auto; padding-bottom: 12px; }
.quiz-bad { box-shadow: inset 0 0 0 2px var(--bad); }
.quiz-err { margin: 0; white-space: pre-wrap; font-size: 13px; color: var(--bad); }
.rooms { display: flex; flex-direction: column; gap: 10px; }
.room { display: flex; align-items: center; gap: 18px; min-height: 72px; padding: 12px 20px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); text-decoration: none; transition: transform .15s var(--ease); }
.room:hover { transform: translateY(-2px); }
.room-code { font-size: 26px; font-weight: 900; letter-spacing: .06em; color: var(--brand); font-variant-numeric: tabular-nums; }
.room-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.room-info span { color: var(--muted); font-size: 15px; }
.room-go { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; color: var(--brand); }
.howto { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 20px; align-items: start; }
.code-sample { margin: 0; padding: 18px 20px; border-radius: var(--r); background: var(--ink); color: var(--bg); font-size: 15px; line-height: 1.6; overflow-x: auto; }
.howto-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; color: var(--muted); }
.howto-list code { color: var(--ink); background: var(--line); padding: 1px 6px; border-radius: 6px; }
.note { padding: 14px 18px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); }
.note-bad { color: var(--bad); font-weight: 800; }

/* ---------- диалог ---------- */
.dlg { width: min(440px, calc(100% - 32px)); padding: 0; border: 0; border-radius: var(--r-lg); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
.dlg::backdrop { background: rgb(15 14 29 / .55); backdrop-filter: blur(2px); }
.dlg[open] { animation: pop .3s var(--pop) both; }
.dlg form { padding: 26px 24px 20px; display: flex; flex-direction: column; gap: 10px; }
.dlg-title { font-size: 22px; font-weight: 900; line-height: 1.25; }
.dlg-text { color: var(--muted); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

/* ---------- панель ведущего ---------- */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hbar { gap: 8px 16px; flex-wrap: wrap; position: sticky; top: 0; z-index: 10; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--bg); }
.tab { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 10px; font-weight: 800; color: var(--muted); text-decoration: none; transition: background-color .2s, color .2s; }
.tab:hover { color: var(--ink); }
.tab.is-on { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.hbar .bar-role { font-size: 15px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search { position: relative; display: flex; align-items: center; color: var(--muted); }
.search .ic { position: absolute; left: 14px; pointer-events: none; }
.search input { width: 240px; min-height: 48px; padding: 0 14px 0 42px; border: 2px solid var(--line); border-radius: var(--r); background: var(--surface); font-weight: 700; }
.search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgb(47 69 255 / .18); }
.link-more, .link-back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 800; color: var(--brand); text-decoration: none; }
.link-back { align-self: flex-start; color: var(--muted); }
.link-back:hover { color: var(--ink); }
.hint { color: var(--muted); font-size: 15px; }
.hint code, .f-help code { background: var(--line); color: var(--ink); padding: 1px 6px; border-radius: 6px; overflow-wrap: anywhere; }
.count { display: inline-grid; place-items: center; min-width: 1.7em; height: 1.7em; padding: 0 .45em; border-radius: 99px; background: var(--line); color: var(--ink); font-size: .7em; font-weight: 900; vertical-align: .2em; }

/* сводка */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 12px; align-items: stretch; }
.stat { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 14px 18px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); min-width: 0; }
.stat b { font-size: 30px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 14px; font-weight: 700; }
.stat-live { box-shadow: inset 0 0 0 2px var(--brand), var(--shadow); }
.stat-live b { color: var(--brand); }
.stat-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-refresh { align-self: center; }

/* комнаты и игры */
.room-pct { flex: none; display: grid; place-items: center; width: 64px; height: 48px; border-radius: 12px; background: rgb(18 154 91 / .12); color: var(--ok); font-weight: 900; font-size: 18px; font-variant-numeric: tabular-nums; }
.room-pct.is-low { background: rgb(220 62 69 / .12); color: var(--bad); }
.room .icon-btn { flex: none; }
.room-link { color: inherit; }

/* карточки викторин */
.quiz[hidden] { display: none; }
.quiz-desc { color: var(--muted); font-size: 15px; line-height: 1.4; }
.quiz-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 14px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; background: var(--bg); color: var(--ink); font-weight: 800; }
.quiz-date { color: var(--muted); }
.quiz-actions { display: flex; gap: 8px; align-items: center; }
.btn-grow { flex: 1; }
a.icon-btn { color: inherit; text-decoration: none; }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.icon-btn.is-busy { pointer-events: none; opacity: .5; }
.icon-danger:hover:not(:disabled) { color: var(--bad); background: rgb(220 62 69 / .12); }
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 20px; text-align: center; border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--shadow); }
.empty-title { font-size: 22px; font-weight: 900; }
.empty-text { color: var(--muted); max-width: 460px; margin-bottom: 8px; }

/* складные разделы */
.fold { gap: 0; }
.fold-sum { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 18px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); font-weight: 800; cursor: pointer; list-style: none; }
.fold-sum::-webkit-details-marker { display: none; }
.fold-sum::after { content: ""; margin-left: auto; width: 10px; height: 10px; border-right: 3px solid var(--muted); border-bottom: 3px solid var(--muted); transform: rotate(45deg) translateY(-3px); transition: transform .2s var(--ease); }
.fold[open] .fold-sum::after { transform: rotate(-135deg) translateY(-3px); }
.fold[open] > :not(summary) { margin-top: 14px; }
.trash { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.trash-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 18px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); }

/* окно запуска */
.dlg-wide { width: min(520px, calc(100% - 32px)); }
.opts-set { border: 0; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.opts-set legend { padding: 0; margin-bottom: 4px; }
.dlg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.select, .input {
  width: 100%; min-height: 48px; padding: 0 14px; border: 2px solid var(--line); border-radius: var(--r);
  background: var(--bg); color: var(--ink); font-weight: 700; transition: border-color .2s, box-shadow .2s;
}
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
.select:focus, .input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgb(47 69 255 / .18); }
.input[aria-invalid="true"], .eo-text[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 4px rgb(220 62 69 / .14); }
textarea.input { padding: 12px 14px; resize: vertical; line-height: 1.4; }
.input-lg { min-height: 56px; font-size: 20px; font-weight: 800; }
.switch { display: flex; align-items: center; gap: 12px; min-height: 48px; cursor: pointer; font-weight: 700; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { position: relative; flex: none; width: 48px; height: 28px; border-radius: 99px; background: var(--line); transition: background-color .2s; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform .2s var(--ease); }
.switch input:checked + .switch-ui { background: var(--brand); }
.switch input:checked + .switch-ui::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-ui { outline: 3px solid var(--gold); outline-offset: 2px; }

/* уведомление */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 100; transform: translateX(-50%);
  width: max-content; max-width: min(560px, calc(100% - 32px)); padding: 14px 20px; border-radius: var(--r); background: var(--ink); color: var(--bg);
  font-weight: 800; box-shadow: var(--shadow-lg); animation: toast-in .25s var(--ease) both;
}
.toast[hidden] { display: none; }
.toast[data-kind="bad"] { background: var(--bad); color: #fff; }
.toast.is-out { opacity: 0; transform: translate(-50%, 8px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 14px); } }

/* ---------- редактор ---------- */
.ebar { position: sticky; top: 0; z-index: 10; gap: 10px; }
.ebar-title { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; margin-right: auto; }
.ebar-title b { font-weight: 900; font-size: 17px; }
.ebar-title b, .e-status { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.e-status { font-size: 13px; font-weight: 800; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.e-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.e-status[data-state="dirty"]::before { background: var(--gold); }
.e-status[data-state="saving"]::before { background: var(--brand); animation: blink 1s infinite; }
.e-status[data-state="error"] { color: var(--bad); }
.e-status[data-state="error"]::before { background: var(--bad); }
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--bg); }
.seg-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 800; cursor: pointer; }
.seg-btn.is-on { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.ed { max-width: 900px; gap: 20px; }
.ecard { display: flex; flex-direction: column; gap: 16px; padding: 22px; border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--shadow); }
.ecard[hidden], [data-e-visual][hidden], .etext[hidden] { display: none; }
.req { color: var(--bad); }
.opt-l { font-weight: 700; color: var(--muted); opacity: .8; }
.f-err { color: var(--bad); font-weight: 800; font-size: 14px; }
.f-err:empty { display: none; }
.f-help { color: var(--muted); font-size: 14px; }
.sec-pick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip-btn { min-height: 44px; min-width: 60px; padding: 0 14px; border: 2px solid var(--line); border-radius: 99px; background: var(--bg); font-weight: 800; cursor: pointer; transition: background-color .2s, border-color .2s, color .2s; }
.chip-btn:hover { border-color: var(--brand); }
.chip-btn.is-on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.sec-own { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 800; }
.sec-own .input { width: 92px; text-align: center; }
.file-in { display: flex; align-items: center; }
.file-in .input { border-radius: var(--r) 0 0 var(--r); font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.file-ext { display: grid; place-items: center; min-height: 48px; padding: 0 14px; border: 2px solid var(--line); border-left: 0; border-radius: 0 var(--r) var(--r) 0; background: var(--line); color: var(--muted); font-family: ui-monospace, Consolas, monospace; font-weight: 700; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-radius: var(--r); background: rgb(255 176 32 / .18); box-shadow: inset 0 0 0 2px var(--gold); font-weight: 700; }
.banner[hidden] { display: none; }
.banner-actions { display: flex; gap: 8px; }
.errsum { padding: 16px 20px; border-radius: var(--r); background: rgb(220 62 69 / .08); box-shadow: inset 0 0 0 2px var(--bad); }
.errsum[hidden] { display: none; }
.errsum:focus { outline: none; }
.errsum-title { font-size: 18px; font-weight: 900; color: var(--bad); margin-bottom: 6px; }
.errsum-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.errsum-link { padding: 4px 0; border: 0; background: none; color: var(--ink); font-weight: 700; text-align: left; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.eq-top { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; margin-bottom: 12px; }
.ok-sample { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: var(--ok); color: #fff; vertical-align: -6px; }
.ok-sample .ic { width: 16px; height: 16px; }
.eqs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.eq { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px 18px; border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--shadow); }
.eq.is-bad { box-shadow: inset 0 0 0 2px var(--bad), var(--shadow); }
.eq-head { display: flex; align-items: center; gap: 10px; }
.eq-n { display: grid; place-items: center; min-width: 36px; height: 36px; padding: 0 8px; border-radius: 10px; background: var(--brand); color: var(--on-brand); font-weight: 900; font-variant-numeric: tabular-nums; }
.eq-label { font-weight: 900; color: var(--muted); }
.eq-tools { margin-left: auto; display: flex; gap: 4px; }
.eq-tools .icon-btn { background: transparent; color: var(--muted); }
.eq-tools .icon-btn:hover:not(:disabled) { background: rgb(127 127 160 / .14); color: var(--ink); }
.eq-text { font-size: 18px; font-weight: 800; min-height: 64px; }
.eo-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.eo { min-width: 0; display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: var(--r); background: var(--bg); box-shadow: inset 0 0 0 2px transparent; transition: box-shadow .2s, background-color .2s; }
.eo .opt-mark { width: 40px; height: 40px; border-radius: 10px; color: #fff; }
.eo.a0 .opt-mark { background: var(--a0); } .eo.a1 .opt-mark { background: var(--a1); }
.eo.a2 .opt-mark { background: var(--a2); } .eo.a3 .opt-mark { background: var(--a3); color: var(--on-a3); }
.eo.is-ok { box-shadow: inset 0 0 0 2px var(--ok); background: rgb(18 154 91 / .08); }
.eo-text { flex: 1; width: 100%; min-width: 0; min-height: 44px; padding: 0 10px; border: 2px solid transparent; border-radius: 10px; background: var(--surface); font-weight: 700; }
.eo-text:focus { outline: none; border-color: var(--brand); }
.eo-ok { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 10px 0 4px; border-radius: 10px; cursor: pointer; font-weight: 800; font-size: 14px; color: var(--muted); }
.eo-ok input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.eo-ok-ui { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; border: 2px solid var(--line); background: var(--surface); color: transparent; transition: background-color .15s, border-color .15s, color .15s; }
.eo-ok-ui .ic { width: 18px; height: 18px; }
.eo-ok input:checked + .eo-ok-ui { background: var(--ok); border-color: var(--ok); color: #fff; }
.eo-ok input:checked ~ .eo-ok-t { color: var(--ok); }
.eo-ok input:focus-visible + .eo-ok-ui { outline: 3px solid var(--gold); outline-offset: 2px; }
.eo-del { width: 36px; height: 44px; background: transparent; color: var(--muted); }
.add-opt { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border: 0; border-radius: 12px; background: transparent; color: var(--brand); font-weight: 800; cursor: pointer; }
.add-opt:hover { background: rgb(47 69 255 / .08); }
.add-opt[hidden] { display: none; }
.eq-note { display: flex; flex-direction: column; gap: 6px; }
.eq-note-l { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 14px; color: var(--muted); }
.add-q { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 72px; margin-top: 16px; border: 3px dashed var(--line); border-radius: var(--r-xl); background: transparent; color: var(--brand); font-weight: 900; font-size: 18px; cursor: pointer; transition: border-color .2s, background-color .2s; }
.add-q:hover { border-color: var(--brand); background: rgb(47 69 255 / .05); }
.etext-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.code-area { width: 100%; min-height: 480px; padding: 16px 18px; border: 2px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 15px; line-height: 1.6; resize: vertical; tab-size: 2; }
.code-area:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgb(47 69 255 / .18); }
.etext-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 84px; }
.check { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); font-weight: 900; }
.check::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.check[data-state="ok"] { color: var(--ok); } .check[data-state="ok"]::before { background: var(--ok); }
.check[data-state="bad"] { color: var(--bad); } .check[data-state="bad"]::before { background: var(--bad); }
.check-errs { margin: 0; padding-left: 20px; color: var(--bad); font-size: 14px; font-weight: 700; display: flex; flex-direction: column; gap: 4px; }
.check-errs:empty { display: none; }
.ed-foot { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding-bottom: 24px; }

/* ---------- итоги игры ---------- */
.page-title { font-size: clamp(26px, 4vw, 36px); font-weight: 900; line-height: 1.15; letter-spacing: -.01em; }
.page-sub { color: var(--muted); font-weight: 700; margin-top: 4px; }
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th { padding: 12px 16px; text-align: left; font-size: 13px; font-weight: 800; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 700; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table .rank { font-weight: 900; color: var(--muted); width: 3em; }
.table .rank-1 { color: var(--gold); }
.table .nick { font-weight: 900; }
.bar-col { width: 32%; min-width: 150px; }
.meter { display: inline-block; width: calc(100% - 4em); height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; vertical-align: middle; }
.meter span { display: block; height: 100%; width: var(--w); background: var(--ok); border-radius: 99px; }
.meter-n { display: inline-block; width: 3.5em; text-align: right; color: var(--muted); font-size: 14px; }
.qstats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.qstat { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); }
.qstat.is-hard { box-shadow: inset 4px 0 0 var(--bad), var(--shadow); }
.qstat-head { display: flex; align-items: flex-start; gap: 12px; }
.qstat-n { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--bg); font-weight: 900; }
.qstat-text { flex: 1; font-weight: 800; white-space: pre-line; }
.qstat-pct { font-size: 22px; font-weight: 900; color: var(--ok); font-variant-numeric: tabular-nums; }
.is-hard .qstat-pct { color: var(--bad); }
.qstat-ans { display: flex; align-items: center; gap: 6px; color: var(--ok); font-weight: 800; font-size: 15px; }
.split { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--line); gap: 2px; }
.split-ok { background: var(--ok); } .split-bad { background: var(--bad); } .split-none { background: var(--none); opacity: .5; }
.qstat-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; font-weight: 700; color: var(--muted); }
.lg::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.lg-ok::before { background: var(--ok); } .lg-bad::before { background: var(--bad); } .lg-none::before { background: var(--none); opacity: .5; }

/* пояснение после ответа */
.q-note { display: flex; align-items: flex-start; gap: 12px; padding: 14px 20px; border-radius: var(--r-lg); background: rgb(255 176 32 / .16); box-shadow: inset 0 0 0 2px var(--gold); font-size: 1.15em; font-weight: 800; line-height: 1.35; animation: rise .4s .2s var(--ease) both; }
.q-note .ic { color: #B87500; width: 1.4em; height: 1.4em; }
.res-note { max-width: 460px; font-size: 16px; line-height: 1.4; padding: 10px 16px; border-radius: var(--r); background: rgb(255 255 255 / .16); }

/* ---------- переключатель языка ---------- */
.langsw { display: inline-flex; flex: none; gap: 2px; padding: 3px; border-radius: 99px; background: rgb(127 127 160 / .14); }
.langsw-a { display: grid; place-items: center; min-width: 46px; min-height: 40px; padding: 0 10px; border-radius: 99px; font-weight: 800; font-size: 14px; text-decoration: none; opacity: .75; transition: background-color .2s, opacity .2s; }
.langsw-a:hover { opacity: 1; }
.langsw-a.is-on { opacity: 1; background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.b-join .langsw, .b-message .langsw, body[data-phase="lobby"] .bar-play .langsw, body[data-phase="board"] .bar-play .langsw,
body[data-phase="final"] .bar-play .langsw, body[data-phase="reveal"].b-play .langsw { background: rgb(255 255 255 / .16); }
.b-join .langsw-a.is-on, .b-message .langsw-a.is-on { background: #fff; color: #2F45FF; }
.join-top { width: 100%; display: flex; justify-content: flex-end; margin-bottom: -8px; }
.bar-host .langsw { margin-left: 4px; }

/* ---------- клавиши ведущего ---------- */
.kbd { display: inline-grid; place-items: center; min-width: 1.9em; height: 1.75em; padding: 0 .45em; margin-left: 10px;
  border: 1.5px solid currentColor; border-bottom-width: 3px; border-radius: 7px; font-family: inherit; font-size: .72em; font-weight: 800; line-height: 1; opacity: .7; vertical-align: middle; }
.keys .kbd, .keys-note .kbd { margin-left: 0; opacity: 1; color: var(--ink); background: var(--bg, transparent); }
.btn.is-pressed { transform: scale(.96); filter: brightness(1.12); }
.dlg-keys { width: min(560px, calc(100% - 32px)); }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 12px 18px; align-items: center; margin: 8px 0 4px; }
.keys dt { display: flex; gap: 6px; flex-wrap: wrap; }
.keys dd { margin: 0; color: var(--muted); line-height: 1.45; }
.keys-note { margin: 6px 0 0; font-size: 14px; color: var(--muted); line-height: 1.45; }
/* на телефонах и планшетах без мыши подсказки клавиш не нужны */
@media (any-hover: none) { .kbd, .only-kbd { display: none; } }

/* ---------- наблюдатель (/watch) ---------- */
.wbar { gap: 8px 12px; position: sticky; top: 0; z-index: 10; }
.w-role { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; color: var(--muted); }
.w-role b { color: var(--ink); font-variant-numeric: tabular-nums; }
.stage-watch { padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
.w-st { max-width: 1200px; margin: 0 auto; display: grid; gap: 16px; align-content: start; grid-template-columns: minmax(0, 1fr); animation: none; }
.w-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.w-title { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.w-title b { font-size: 20px; font-weight: 900; line-height: 1.2; }
.w-title > span { color: var(--muted); font-weight: 800; font-size: 14px; }
.w-phase { display: inline-block; padding: 2px 10px; border-radius: 99px; background: var(--bg); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.w-phase-question { background: var(--brand); color: var(--on-brand); box-shadow: none; }
.w-phase-reveal { background: rgb(18 154 91 / .14); color: var(--ok); box-shadow: none; }
.timer-w { width: 56px; height: 56px; }
.timer-w::before { inset: 6px; background: var(--bg); }
.timer-w .timer-num { font-size: 20px; }
.w-q, .w-players, .w-empty { padding: 18px; border-radius: var(--r-lg); box-shadow: var(--shadow); }
.w-qtext { font-size: 19px; font-weight: 900; line-height: 1.3; white-space: pre-line; margin-bottom: 12px; }
.w-opts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.w-opt { position: relative; overflow: hidden; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 12px; border-radius: var(--r); background: var(--bg); font-weight: 800; }
.w-opt > :not(.w-bar) { position: relative; }
.w-bar { position: absolute; inset: 0 auto 0 0; width: var(--w); background: rgb(127 127 160 / .16); transition: width .5s var(--ease); }
.w-opt.is-ok { box-shadow: inset 0 0 0 2px var(--ok); }
.w-opt.is-ok .w-bar { background: rgb(18 154 91 / .2); }
.w-mark { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; color: #fff; font-weight: 900; }
.w-mark.a3 { color: var(--on-a3); }
.w-otext { flex: 1; min-width: 0; overflow-wrap: anywhere; line-height: 1.25; }
.w-ok { color: var(--ok); display: inline-flex; }
.w-cnt { min-width: 1.6em; text-align: right; font-size: 18px; font-variant-numeric: tabular-nums; }
.w-note { display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; padding: 10px 12px; border-radius: var(--r); background: rgb(255 176 32 / .14); font-weight: 700; font-size: 14px; line-height: 1.4; }
.w-note .ic { color: #B87500; flex: none; }
.w-ph { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.w-ph h3 { font-size: 17px; font-weight: 900; }
.w-ph span { color: var(--muted); font-weight: 800; }
.w-ph b { color: var(--ink); font-size: 1.2em; }
.w-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.w-table th { text-align: left; font-size: 12px; font-weight: 800; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.w-table td { padding: 8px; border-bottom: 1px solid var(--line); font-weight: 700; vertical-align: middle; }
.w-table tr:last-child td { border-bottom: 0; }
.w-table .num { text-align: right; white-space: nowrap; }
.w-rank { width: 2em; color: var(--muted); font-weight: 900; }
.w-nick { max-width: 0; width: 45%; }
.w-nick { display: table-cell; }
.w-name { font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-dot { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--line); vertical-align: middle; }
.w-dot.is-on { background: #22C55E; }
.w-streak { display: inline-flex; align-items: center; gap: 1px; margin-left: 6px; color: #E8590C; font-size: 13px; font-weight: 900; vertical-align: middle; }
.w-streak .ic { width: 14px; height: 14px; }
.w-anscell { white-space: nowrap; }
.w-anscell small, .w-gain { margin-left: 6px; color: var(--muted); font-size: 12px; font-weight: 800; }
.w-gain { color: var(--ok); }
.w-ans { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; font-weight: 900; }
.w-ans.is-ok { background: rgb(18 154 91 / .16); color: var(--ok); }
.w-ans.is-bad { background: rgb(220 62 69 / .16); color: var(--bad); }
.w-wait { color: var(--muted); font-size: 13px; font-weight: 800; }
.w-none { color: var(--muted); font-size: 13px; opacity: .7; }
.w-empty { text-align: center; }
.w-empty-title { font-size: 22px; font-weight: 900; margin-bottom: 6px; }
.w-foot { color: var(--muted); font-size: 13px; text-align: center; }
@media (min-width: 900px) {
  .w-st:has(.w-q) { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
  .w-top, .w-foot { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .wbar { gap: 8px; padding-left: 12px; padding-right: 12px; }
  .wbar .logo { font-size: 19px; }
  .w-role-t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .wbar .conn[data-conn="ok"] { padding: 0 12px; }
  .wbar .conn[data-conn="ok"] .conn-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .wbar .langsw-a { min-width: 40px; padding: 0 8px; }
  .stage-watch { padding-left: 12px; padding-right: 12px; }
  .w-q, .w-players { padding: 14px; }
}
.dlg-qr { width: min(380px, calc(100% - 32px)); }
.wqr-code { width: min(260px, 100%); aspect-ratio: 1; margin: 4px auto; background: #fff; border-radius: var(--r); padding: 8px; }
.wqr-code svg { width: 100%; height: 100%; display: block; }
.wqr-warn { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r); background: rgb(220 62 69 / .1); color: var(--bad); font-weight: 800; font-size: 14px; line-height: 1.4; }
.wqr-warn .ic { flex: none; }

/* ---------- фильтр викторин по языку ---------- */
.lang-filter { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 16px; }
.lang-filter .chip-btn { display: inline-flex; align-items: center; gap: 8px; }
.lf-n { font-variant-numeric: tabular-nums; opacity: .75; }
.lang-badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 99px; font-weight: 900; font-size: 13px; letter-spacing: .02em; }
.lb-ru { background: rgb(47 69 255 / .12); color: #2235D9; }
.lb-kk { background: rgb(0 175 202 / .16); color: #007386; }
.lb-en { background: rgb(110 86 207 / .14); color: #5B43B8; }
.chip-btn.is-on .lang-badge { background: rgb(255 255 255 / .22); color: inherit; }
.quiz-meta .lang-badge { padding: 3px 10px; font-size: inherit; }
@media (prefers-color-scheme: dark) {
  .lb-ru { color: #9DA8FF; } .lb-kk { color: #5FD6E8; } .lb-en { color: #B9A8F5; }
}

/* ---------- живая игра: анимации ---------- */
/* тот же экран пришёл заново (кто-то ответил) — входные анимации не повторяем */
.stage.is-same :is(.st, .res-icon, .res-gain, .place, .avatar, .p-wait .opt,
  .opt-ok, .opt-bar, .q-note, .who-chip, .who-col, .fastest, .res-break, .pill-gold, .fin-stats) { animation: none !important; }

/* доска, вопрос: кто уже ответил */
.ans-strip { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; max-height: 6.2em; overflow: hidden; font-size: .8em; }
.ans-chip { padding: 6px 14px; border-radius: 99px; font-weight: 900; color: var(--muted);
  box-shadow: inset 0 0 0 2px var(--line); transition: background-color .3s, color .3s, box-shadow .3s; }
.ans-chip.is-in { color: #fff; box-shadow: 0 3px 0 rgb(0 0 0 / .15); }
.ans-chip.is-new { animation: chip-in .5s var(--pop) both; }
@keyframes chip-in { 0% { transform: scale(.4); } 60% { transform: scale(1.18); } 100% { transform: none; } }
[data-answered].bump { display: inline-block; animation: bump .4s var(--pop); }
@keyframes bump { 40% { transform: scale(1.5); color: var(--brand); } }

/* доска, разбор: верно / ошиблись / не ответили */
.fastest { display: inline-flex; align-items: center; gap: 8px; padding: 6px 16px 6px 10px; border-radius: 99px; background: var(--gold); color: var(--on-gold); font-weight: 800; animation: pop .5s .9s var(--pop) both; }
.fastest .ic { width: 1.2em; height: 1.2em; }
.opt-bar { animation: grow .9s .25s var(--ease) both; }
@keyframes grow { from { width: 0; } }
.who { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: clamp(10px, 1vw, 18px); font-size: .82em; }
.who-col { min-width: 0; padding: 12px 14px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); animation: rise .45s .35s var(--ease) both; }
.who-bad { animation-delay: .45s; } .who-none { animation-delay: .55s; }
.who-h { display: flex; align-items: center; gap: 8px; font-size: 1em; font-weight: 900; margin-bottom: 8px; }
.who-h b { margin-left: auto; font-size: 1.25em; }
.who-ok .who-h { color: var(--ok); } .who-bad .who-h { color: var(--bad); } .who-none .who-h { color: var(--muted); }
.who-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; max-height: 5.6em; overflow: hidden; }
.who-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 12px; border-radius: 99px; font-weight: 900;
  color: var(--ink); animation: pop .4s calc(.6s + var(--i, 0) * .05s) var(--pop) both; }
.who-bad .who-chip, .who-none .who-chip { background: var(--bg); }
.who-ok .who-chip { color: #fff; }
.who-chip b { font-weight: 900; opacity: .9; font-size: .9em; }
.who-chip i { font-style: normal; display: grid; place-items: center; width: 1.5em; height: 1.5em; border-radius: 6px; background: rgb(220 62 69 / .15); color: var(--bad); font-size: .85em; }
.who-nick { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-chip.is-fast { box-shadow: 0 0 0 3px var(--gold); }
.who-none .who-chip { opacity: .75; }


/* телефон: очки «тают», пока думаешь */
.pts { --k: 1; display: flex; flex-direction: column; gap: 6px; }
.pts-bar { height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; }
.pts-bar i { display: block; height: 100%; width: calc(50% + var(--k) * 50%); border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--ok)); transition: width .1s linear; }
.pts-text { font-size: 14px; font-weight: 800; color: var(--muted); text-align: center; }
.pts-n { color: var(--ink); font-size: 18px; font-variant-numeric: tabular-nums; }
.p-streak { display: inline-flex; align-items: center; gap: 3px; padding: 4px 10px; border-radius: 99px; background: rgb(232 89 12 / .12); color: #E8590C; font-weight: 900; }
.p-wait-time { text-align: center; font-weight: 900; font-size: 20px; animation: rise .4s .15s var(--ease) both; }

/* телефон: результат */
.res-break { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; font-weight: 800; opacity: .92; animation: rise .4s .5s var(--ease) both; }
.res-break span { display: inline-flex; align-items: center; gap: 5px; }
.res-bonus { padding: 2px 10px; border-radius: 99px; background: rgb(0 0 0 / .18); }
.pill-gold { background: var(--gold); color: var(--on-gold); animation: pop .5s .7s var(--pop) both; }
.pill-ok { background: rgb(18 154 91 / .9); }
.res-rank { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; font-size: 18px; font-weight: 800; }
.res-rank b { font-weight: 900; font-variant-numeric: tabular-nums; }
.rank-up, .rank-down { display: inline-flex; align-items: center; gap: 2px; padding: 2px 8px; border-radius: 99px; background: rgb(255 255 255 / .2); font-weight: 900; }
.fin-stats { display: flex; justify-content: center; gap: 12px; }
.fin-stats span { display: flex; flex-direction: column; align-items: center; min-width: 110px; padding: 10px 14px; border-radius: var(--r); background: rgb(255 255 255 / .14); }
.fin-stats b { font-size: 26px; font-weight: 900; }
.fin-stats small { font-size: 13px; font-weight: 800; opacity: .8; }
.rules { max-width: 340px; font-size: 14px; opacity: .75; line-height: 1.4; }
.vibe-note { max-width: 340px; font-size: 14px; line-height: 1.4; padding: 8px 14px; border-radius: var(--r); background: rgb(0 0 0 / .18); }

/* телефон: «вспышки» вместо (и вместе с) вибрацией */
.stage.fx-q .st { animation: fx-q .5s var(--pop); }
.stage.fx-ok::after, .stage.fx-win::after, .stage.fx-tick::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 50; }
.stage.fx-ok::after { background: radial-gradient(circle at 50% 40%, rgb(255 255 255 / .55), transparent 60%); animation: flash .7s ease-out both; }
.stage.fx-win::after { background: radial-gradient(circle at 50% 40%, rgb(255 176 32 / .7), transparent 65%); animation: flash 1.2s ease-out both; }
.stage.fx-tick::after { box-shadow: inset 0 0 0 10px var(--bad); animation: flash .45s ease-out both; }
.stage.fx-bad .st { animation: shake .45s ease-in-out; }
@keyframes fx-q { 0% { transform: scale(.94); } 100% { transform: none; } }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
@keyframes shake { 20%, 60% { transform: translateX(-12px); } 40%, 80% { transform: translateX(12px); } }

/* конфетти на итогах */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 60; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 2px; animation: fall 3s linear both; }
.confetti i:nth-child(3n) { width: 8px; height: 8px; border-radius: 50%; }
@keyframes fall { to { transform: translate(var(--x), 110vh) rotate(var(--r)); } }

/* итоги в истории: кто где ошибся */
.gt th, .gt td { padding: 8px 6px; text-align: center; }
.gt .gt-nick { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; padding-left: 16px; min-width: 140px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gt thead th { font-size: 13px; }
.gt .gq { min-width: 38px; cursor: help; }
.gc { font-weight: 900; font-size: 14px; }
.gc span { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; }
.gc-ok span { background: rgb(18 154 91 / .14); color: var(--ok); }
.gc-bad span { background: rgb(220 62 69 / .16); color: var(--bad); }
.gc-none span { color: var(--muted); opacity: .6; }
.gt tfoot td, .gt tfoot th { font-size: 13px; font-weight: 800; color: var(--muted); border-top: 1px solid var(--line); border-bottom: 0; }
.gt-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: 13px; font-weight: 700; color: var(--muted); }
.gt-legend .gc span { width: 24px; height: 24px; font-size: 12px; margin-right: 6px; }
.gt-legend > span { display: inline-flex; align-items: center; }
.qstat-who { display: flex; flex-wrap: wrap; gap: 6px; font-size: 14px; font-weight: 700; }
.qstat-who > b { color: var(--muted); font-weight: 800; margin-right: 2px; }
.qw { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; background: rgb(220 62 69 / .1); }
.qw i { font-style: normal; font-weight: 900; color: var(--bad); }
.qw-none { background: var(--bg); color: var(--muted); }

@media (max-width: 760px) {
  .who { grid-template-columns: 1fr; }
  .who-list { max-height: 3.2em; }
}

/* ---------- вибрация (лобби игрока) ---------- */
.pill-btn { border: 0; color: inherit; font: inherit; font-weight: 800; min-height: 44px; cursor: pointer; margin-top: 4px; }
.pill-btn:hover { background: rgb(255 255 255 / .24); }
.pill-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.pill-btn.is-off { opacity: .65; }
.pill-btn.is-off .ic { opacity: .5; }

/* ---------- узкие экраны ---------- */
@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 10px 12px; }
  .stat span { font-size: 12px; line-height: 1.3; }
  .stat-refresh { grid-column: 1 / -1; width: 100%; }
  .stat b { font-size: 24px; }
  .search, .search input { width: 100%; }
  .toolbar { width: 100%; }
  .toolbar .btn { flex: 1; }
  .eo-list { grid-template-columns: minmax(0, 1fr); }
  .etext-grid { grid-template-columns: 1fr; }
  .etext-side { position: static; }
  .code-area { min-height: 360px; font-size: 14px; }
  .dlg-grid { grid-template-columns: 1fr; }
  .seg-btn span, .ebar-save span, .eo-ok-t { display: none; }
  .seg-btn { padding: 0 12px; }
  .ebar-save { padding: 0 16px; }
  .tab { padding: 0 12px; }
  .hbar .bar-role { display: none; }
  .hbar .langsw { margin-left: auto; }
  .bar-play .langsw-a { min-width: 40px; padding: 0 8px; }
  .room { flex-wrap: wrap; gap: 10px 14px; }
  .room .room-info { flex-basis: calc(100% - 140px); }
  .room > .btn { flex: 1; }
  .ed-foot .btn { flex: 1; }
  .eq { padding: 14px 12px 16px; }
  .bar-col { min-width: 120px; }
  .lobby-top { grid-template-columns: 1fr; }
  .lobby-qr { display: none; }
  .opts { grid-template-columns: 1fr; }
  .howto { grid-template-columns: 1fr; }
  .q-head { gap: 12px; flex-wrap: wrap; }
  .foot-actions { width: 100%; }
  .foot-actions .btn { flex: 1; }
}
@media (max-width: 480px) {
  .bar-play { gap: 8px; padding-left: 12px; padding-right: 12px; }
  .bar-play .logo { font-size: 19px; }
  .bar-play .conn[data-conn="ok"] { padding: 0 12px; }
  .bar-play .conn[data-conn="ok"] .conn-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}
@media (max-width: 380px) {
  .bar-code { display: none; }
  .tab span { display: none; }
}

/* ---------- «у каждого свой порядок ответов» ----------
   На телефонах варианты стоят по-разному, поэтому на доске — без цветов и букв, только текст. */
.opts-mix .opt { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.opts-mix .opt-mark { display: none; }
.opts-mix .opt-bar { background: rgb(47 69 255 / .28); }
.is-reveal .opts-mix .opt-ok { background: var(--ok); color: #fff; }
.is-reveal .opts-mix .opt-ok .opt-bar { background: rgb(255 255 255 / .55); }
.q-mix { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 99px; background: rgb(47 69 255 / .1); color: var(--brand); font-size: .8em; font-weight: 800; }
.opts-hint { margin: 0 0 4px 52px; font-size: 13px; }
/* «ответ видно по длине»: карточка в панели и вопрос в редакторе */
.tag-warn { background: #FFF1D6; color: #8A4B00; }
.tag-warn .ic { width: 1em; height: 1em; }
.f-warn { display: flex; align-items: flex-start; gap: 6px; margin: 2px 0 0; padding: 8px 12px; border-radius: var(--r-sm); background: #FFF1D6; color: #8A4B00; font-size: 14px; font-weight: 700; line-height: 1.35; }
.f-warn[hidden] { display: none; }
@media (prefers-color-scheme: dark) {
  .tag-warn, .f-warn { background: rgb(255 176 32 / .16); color: #FFC861; }
  .q-mix { background: rgb(120 135 255 / .18); color: #AEB8FF; }
}

/* ---------- «Как создать викторину» ---------- */
.dlg-create { width: min(560px, calc(100% - 32px)); }
.create-in { padding: 22px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.create-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.create-opts { display: flex; flex-direction: column; gap: 10px; }
.create-opt { display: flex; align-items: center; gap: 16px; padding: 16px; border-radius: var(--r-lg); color: var(--ink); text-decoration: none;
  box-shadow: inset 0 0 0 2px var(--line); transition: box-shadow .15s, background-color .15s, transform .15s var(--ease); }
.create-opt:hover, .create-opt:focus-visible { box-shadow: inset 0 0 0 2px var(--brand); background: rgb(47 69 255 / .05); outline: none; }
.create-opt:active { transform: scale(.99); }
.create-ic { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; font-size: 26px; color: #fff; }
.create-ic .ic { width: 1em; height: 1em; }
.c-vis { background: var(--brand); } .c-txt { background: var(--a1); } .c-file { background: var(--a2); }
.create-t { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.create-t b { font-size: 18px; font-weight: 900; }
.create-t span { color: var(--muted); font-size: 15px; line-height: 1.35; }

/* ---------- викторина из файла ---------- */
.imp { max-width: 900px; gap: 24px; }
.imp .sec[hidden] { display: none; }
.drop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 20px; border-radius: var(--r-xl);
  border: 3px dashed rgb(47 69 255 / .35); background: var(--surface); text-align: center; cursor: pointer; transition: border-color .15s, background-color .15s; }
.drop:hover, .drop.is-over { border-color: var(--brand); background: rgb(47 69 255 / .05); }
.drop:focus-within { outline: 3px solid var(--gold); outline-offset: 3px; }
.drop.is-busy { opacity: .5; pointer-events: none; }
.drop-ic { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; background: rgb(47 69 255 / .1); color: var(--brand); font-size: 32px; }
.drop-ic .ic { width: 1em; height: 1em; }
.drop-title { font-size: 20px; font-weight: 900; }
.drop-or { color: var(--muted); font-weight: 700; }
.drop-sub { color: var(--muted); font-size: 14px; font-weight: 700; }
.drop-busy { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 800; color: var(--muted); }
.drop-busy[hidden] { display: none; }
.fmt-seg { align-self: flex-start; }
.fmt[hidden] { display: none; }
.fmt-lead { font-weight: 700; }
.fmt-table-wrap { overflow-x: auto; border-radius: var(--r); box-shadow: inset 0 0 0 1px var(--line); }
.fmt-table { border-collapse: collapse; font-size: 14px; min-width: 760px; width: 100%; }
.fmt-table th, .fmt-table td { padding: 7px 10px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.fmt-table th { width: 32px; color: var(--muted); font-weight: 700; background: var(--bg); text-align: center; }
.fmt-table tr.is-head td { background: #DDE2FF; color: #16142E; font-weight: 900; }
.fmt-table tr.is-set td:first-of-type { font-weight: 800; }
.fmt-table tr.is-set td { color: var(--muted); }
.fmt-table tr.is-gap td { height: 14px; padding: 0; }
.fmt-rules { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; line-height: 1.45; }
.fmt-rules code { background: var(--line); padding: 1px 6px; border-radius: 6px; }
.fmt-dl { display: flex; flex-wrap: wrap; gap: 10px; }

.imp-file { flex-direction: row; align-items: center; gap: 14px; padding: 14px 16px; }
.imp-file-ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: rgb(47 69 255 / .1); color: var(--brand); font-size: 22px; flex: none; }
.imp-file-name { display: flex; flex-direction: column; min-width: 0; margin-right: auto; }
.imp-file-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-file-name small { color: var(--muted); font-weight: 700; }
.imp-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.imp-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 16px 8px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); text-align: center; }
.imp-stat b { font-size: 34px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.imp-stat span { color: var(--muted); font-weight: 800; font-size: 14px; }
.imp-stat.is-ok b { color: var(--ok); }
.imp-stat.is-bad b { color: var(--bad); }
.imp-stat.is-bad.is-zero b { color: var(--muted); }
[data-i-filter-box][hidden] { display: none; }

.imp-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.iq { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); border-left: 6px solid var(--ok); scroll-margin: 90px; }
.iq.is-bad { border-left-color: var(--bad); box-shadow: var(--shadow), inset 0 0 0 2px rgb(220 62 69 / .35); }
.iq.is-warn { border-left-color: var(--gold); }
.iq.is-flash { animation: iq-flash 1.2s ease-out; }
@keyframes iq-flash { 0%, 40% { box-shadow: 0 0 0 4px var(--gold); } }
.iq-head { display: flex; align-items: center; gap: 10px; }
.iq-row { color: var(--muted); font-weight: 800; font-size: 14px; }
.iq-state { margin-left: auto; padding: 2px 10px; border-radius: 99px; font-size: 13px; font-weight: 900; background: rgb(18 154 91 / .12); color: var(--ok); }
.iq.is-bad .iq-state { background: rgb(220 62 69 / .12); color: var(--bad); }
.iq-text { font-weight: 800; font-size: 17px; white-space: pre-line; }
.iq-text.is-empty { color: var(--muted); }
.iq-opts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.iq-opt { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 6px 10px 6px 6px; border-radius: 12px; background: var(--bg); }
.iq-opt .opt-mark { width: 1.7em; height: 1.7em; font-size: 14px; background: var(--surface); color: var(--muted); box-shadow: inset 0 0 0 1.5px var(--line); }
.iq-opt.is-ok .opt-mark { background: var(--ok); color: #fff; box-shadow: none; }
.iq-opt-t { min-width: 0; overflow-wrap: anywhere; }
.iq-opt.is-ok { background: rgb(18 154 91 / .12); box-shadow: inset 0 0 0 2px var(--ok); font-weight: 800; }
.iq-ok { margin-left: auto; color: var(--ok); font-weight: 900; }
.iq-note { display: flex; gap: 6px; color: var(--muted); font-size: 14px; }
.iq-note[hidden] { display: none; }
.iq-errs, .iq-warns { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.iq-errs:empty, .iq-warns:empty { display: none; }
.iq-errs li { padding: 6px 10px; border-radius: 10px; background: rgb(220 62 69 / .1); color: var(--bad); font-weight: 800; font-size: 14px; }
.iq-warns li { padding: 6px 10px; border-radius: 10px; background: #FFF1D6; color: #8A4B00; font-weight: 700; font-size: 14px; }
.imp-foot { padding: 12px 0; background: var(--bg); }
@media (min-width: 601px) { .imp-foot { position: sticky; bottom: 0; } }
.imp-done { align-items: center; text-align: center; padding: 32px 22px; }
.imp-done-ic { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 32px; }
.imp-done-act { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
@media (max-width: 600px) {
  .iq-opts { grid-template-columns: 1fr; }
  .imp-stat b { font-size: 26px; }
  .imp-foot { flex-direction: column-reverse; align-items: stretch; }
  .create-opt { padding: 12px; gap: 12px; }
  .create-ic { width: 44px; height: 44px; font-size: 22px; }
}
@media (prefers-color-scheme: dark) {
  .fmt-table tr.is-head td { background: #2A3270; color: #fff; }
  .iq-warns li { background: rgb(255 176 32 / .16); color: #FFC861; }
}

/* ---------- нет связи: заметная плашка поверх экрана ---------- */
.netlost { position: fixed; z-index: 80; left: 12px; right: 12px; top: calc(12px + env(safe-area-inset-top));
  max-width: 560px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px;
  border-radius: var(--r-lg); background: var(--bad); color: #fff; box-shadow: var(--shadow-lg); animation: netlost-in .3s var(--ease) both; }
@keyframes netlost-in { from { opacity: 0; transform: translateY(-12px); } }
.netlost[hidden] { display: none; }
.netlost .spinner { flex: none; }
.netlost-t { flex: 1 1 0; display: flex; flex-direction: column; gap: 2px; min-width: 0; line-height: 1.3; overflow-wrap: anywhere; }
.netlost-t b { font-weight: 900; }
.netlost-t small { font-size: 13px; font-weight: 700; opacity: .9; }
.netlost-btn { flex: none; min-height: 40px; padding: 0 14px; font-size: 14px; }
.btn-white.netlost-btn { color: var(--bad); }
/* ответ отправляется повторно */
.p-opts.is-sending .opt.is-chosen { animation: blink 1s infinite; }
@media (max-width: 420px) {
  .netlost { flex-wrap: wrap; }
  .netlost-btn { width: 100%; }
}

/* ---------- разделы списка викторин: IT, потом общие ---------- */
#quizzes { display: flex; flex-direction: column; gap: 28px; }
.qgroup { display: flex; flex-direction: column; gap: 14px; }
.qgroup[hidden] { display: none; }
.qgroup-title { display: flex; align-items: center; gap: 8px; font-size: 19px; font-weight: 900; color: var(--ink); padding-bottom: 8px; border-bottom: 2px solid var(--line); }
.qgroup-title .ic { color: var(--brand); }
.qgroup-title .count { font-size: 13px; }

/* ---------- движение ---------- */
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes pop { from { opacity: 0; transform: scale(.6); } }
@keyframes pulse { 50% { transform: scale(1.03); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: .3; } }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- переключатель «Режим доски» ---------- */
.board-sw { display: inline-flex; align-items: center; gap: 8px; flex: none; min-height: 44px; padding: 0 14px; border-radius: 99px;
  background: rgb(127 127 160 / .14); font-size: 14px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.board-sw:hover { background: rgb(127 127 160 / .24); }
.board-sw-dot { width: 10px; height: 10px; border-radius: 50%; background: rgb(127 127 160 / .5); }
.board-sw.is-on .board-sw-dot { background: #22C55E; box-shadow: 0 0 0 3px rgb(34 197 94 / .25); }
.bar-host .board-sw-t { display: none; }            /* на экране игры — только значок */
@media (max-width: 760px) { .board-sw-t { display: none; } }
@media (max-width: 560px) { .board-sw { display: none; } }   /* на телефоне режим доски не нужен */

/* ---------- окно «Запустить»: как играем ---------- */
.mode-sw { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.mode-opt { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--r); cursor: pointer;
  box-shadow: inset 0 0 0 2px var(--line); transition: box-shadow .2s, background-color .2s; }
.mode-opt input { position: absolute; opacity: 0; pointer-events: none; }
.mode-opt:has(input:checked) { box-shadow: inset 0 0 0 3px var(--brand); background: rgb(47 69 255 / .06); }
.mode-opt:has(input:focus-visible) { outline: 3px solid var(--gold); outline-offset: 2px; }
.mode-ic { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: rgb(47 69 255 / .1); color: var(--brand); }
.mode-t { display: flex; flex-direction: column; gap: 2px; line-height: 1.3; }
.mode-t b { font-weight: 900; }
.mode-t span { font-size: 13px; color: var(--muted); font-weight: 700; }
#launch:not([data-mode="open"]) [data-open-only], #launch[data-mode="open"] [data-room-only] { display: none; }
@media (max-width: 480px) { .mode-sw { grid-template-columns: 1fr; } }

/* ---------- «Открытая викторина» ---------- */
.op-badge { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; margin-left: auto; border-radius: 99px;
  background: rgb(47 69 255 / .1); color: var(--brand); font-weight: 900; font-size: 15px; }
body[data-phase="lobby"] .op-badge, body[data-phase="final"] .op-badge { background: rgb(255 255 255 / .16); color: #fff; }
.op-card { width: min(980px, 100%); display: flex; flex-direction: column; align-items: center; gap: clamp(14px, 2vh, 26px); text-align: center;
  padding: clamp(24px, 3.4vw, 56px); border-radius: var(--r-xl); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); animation: rise .4s var(--ease) both; }
.op-kicker { display: inline-flex; align-items: center; gap: 10px; padding: 8px 18px; border-radius: 99px; background: rgb(47 69 255 / .1); color: var(--brand); font-weight: 900; }
.op-title { font-size: clamp(32px, 3.6vw, 76px); font-weight: 900; line-height: 1.1; letter-spacing: -.02em; }
.op-desc { font-size: 1.15em; color: var(--muted); font-weight: 700; max-width: 46ch; }
.op-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; font-weight: 800; }
.op-meta span { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 99px; background: var(--bg); }
.op-rules { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 100%; }
.op-rules li { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 12px; border-radius: var(--r-lg); background: var(--bg); font-weight: 800; line-height: 1.3; }
.op-rules b { display: grid; place-items: center; width: 1.9em; height: 1.9em; border-radius: 50%; background: var(--gold); color: var(--on-gold); font-weight: 900; }
.op-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.op-score { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.op-score b { font-size: clamp(44px, 4vw, 88px); font-weight: 900; line-height: 1; color: var(--ok); font-variant-numeric: tabular-nums; }
.op-score span { font-weight: 800; color: var(--muted); }
.op-dots { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; max-width: 50%; justify-content: flex-end; }
.op-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
.op-dots i.is-done { background: var(--brand); opacity: .45; }
.op-dots i.is-now { background: var(--brand); box-shadow: 0 0 0 4px rgb(47 69 255 / .22); }
.op-q .timer { flex: none; }
.op-timeup { font-weight: 900; color: var(--bad); font-size: 1.2em; animation: blink 1s 3; }
.op-q .opt { cursor: pointer; text-align: left; }
.op-q .opt:hover { filter: brightness(1.06); }
.op-q .opt.is-picked { box-shadow: 0 0 0 5px var(--surface), 0 0 0 10px var(--ink); }
.op-pick { position: absolute; top: 8px; right: 14px; padding: 2px 10px; border-radius: 99px; background: rgb(0 0 0 / .55); color: #fff; font-size: .5em; font-weight: 900; letter-spacing: .02em; text-transform: uppercase; }
.op-q.is-reveal .opt.is-picked:not(.opt-ok) { opacity: 1; filter: none; background: var(--bad); color: #fff; }
.op-hint { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-weight: 800; font-size: .95em; text-align: center; }
.op-verdict { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px 20px; border-radius: var(--r-lg); font-weight: 900; font-size: 1.3em; animation: pop .45s var(--pop) both; }
.op-verdict.is-ok { background: var(--ok); color: #fff; }
.op-verdict.is-bad { background: var(--bad); color: #fff; }
@media (max-width: 760px) {
  .op-rules { grid-template-columns: 1fr; }
  .op-dots { display: none; }
  .op-badge span { display: none; }
}

/* =====================================================================
   РЕЖИМ ДОСКИ (body.is-board): экран 1920×1080 в классе — читают с задних парт,
   нажимают пальцем. Тема всегда светлая: на панели и проекторе она контрастнее.
   ===================================================================== */
body.is-board {
  color-scheme: light;
  --bg: #F1F1F7; --surface: #FFFFFF; --ink: #121027; --muted: #4A4766; --line: #DCDBE8;
  --brand: #2F45FF; --brand-deep: #2235D9;
  --shadow: 0 1px 2px rgb(22 20 46 / .08), 0 8px 28px rgb(22 20 46 / .10);
  --shadow-lg: 0 2px 4px rgb(22 20 46 / .08), 0 18px 48px rgb(22 20 46 / .16);
}
/* шапка: всё под палец */
/* (панель ведущего и другие страницы увеличиваются целиком через zoom — см. ниже) */
.is-board .bar-host { min-height: 84px; }
.is-board .bar-host .icon-btn { width: 60px; height: 60px; border-radius: 16px; }
.is-board .bar-host .icon-btn .ic { width: 28px; height: 28px; }
.is-board .bar-host .langsw-a { min-width: 64px; min-height: 52px; font-size: 18px; }
.is-board .bar-host .conn { min-height: 48px; font-size: 18px; padding: 0 10px 0 16px; }
.is-board .bar-host .conn-retry { min-height: 40px; font-size: 16px; }
.is-board .bar-host .board-sw { min-height: 60px; padding: 0 20px; font-size: 18px; }
.is-board .bar-host .board-sw .ic { width: 26px; height: 26px; }
.is-board .bar-host .logo { font-size: 30px; }
.is-board .op-badge { min-height: 52px; font-size: 19px; padding: 0 20px; }

/* экран игры и открытой викторины: крупнее всё вокруг вопроса (сам вопрос и так крупный) */
.is-board .stage-host { --hs: clamp(20px, 1.5vw, 34px); }
.is-board .opts .opt { min-height: clamp(100px, 13vh, 170px); font-size: clamp(26px, 2.3vw, 48px); }
.is-board .q-note { font-size: 1.3em; padding: 18px 26px; }
.is-board .q-num, .is-board .q-answered { font-size: 1.2em; }
/* разбор: неверные варианты не «тают» до бледно-серого — текст остаётся тёмным */
.is-board .is-reveal .opt:not(.opt-ok):not(.is-picked) { opacity: 1; filter: none; background: #E4E3EE; color: #3D3A58; box-shadow: none; }
.is-board .is-reveal .opt:not(.opt-ok) .opt-mark { background: rgb(0 0 0 / .08); }
.is-board .is-reveal .opt:not(.opt-ok) .opt-bar { background: rgb(47 69 255 / .25); }
.is-board .is-reveal .opt-ok { box-shadow: 0 0 0 6px rgb(18 154 91 / .3); }
.is-board .who-h { font-size: 1.05em; }
.is-board .who-chip { font-size: 1em; padding: 8px 16px; }
.is-board .ans-chip { font-size: 1em; padding: 8px 18px; }
/* лобби: адрес и код видно из конца класса */
.is-board .how-steps { font-size: 2em; }
.is-board .lobby-count { font-size: 1.6em; }
.is-board .chip { min-height: 64px; font-size: 1.5em; padding: 0 28px; }
.is-board .qr { width: clamp(180px, 17vw, 340px); }
.is-board .qr-cap { font-size: 1em; }
/* таблица лидеров шире */
.is-board .stage-host .lb { max-width: 1500px; }
.is-board .stage-host .lb-row { min-height: clamp(72px, 9.5vh, 116px); }
.is-board .stage-host .lb-nick { font-size: clamp(28px, 2.3vw, 46px); }
.is-board .stage-host .lb-score { font-size: clamp(30px, 2.4vw, 48px); }
/* низ экрана */
.is-board .stage-host .host-foot .btn:not(.btn-xl) { min-height: 76px; font-size: 22px; }
.is-board .stage-host .host-foot .btn-xl, .is-board .stage-host .btn-xl { min-height: 84px; font-size: 30px; }
/* открытая викторина */
.is-board .op-rules li { font-size: 1.1em; padding: 22px 16px; }
.is-board .op-hint { font-size: 1.05em; }

/* панель ведущего, история, редактор: страница масштабируется целиком */
.is-board.b-hosthome, .is-board.b-history, .is-board.b-result, .is-board.b-editor, .is-board.b-import, .is-board.b-message { zoom: 1.3; }
.is-board.b-hosthome .wrap, .is-board.b-history .wrap { max-width: 1300px; }
/* открытая: верный вариант — всегда зелёный (цвет варианта не путает «верно») */
.op-q.is-reveal .opt-ok { background: var(--ok); color: #fff; }
.op-q.is-reveal .opt-ok .opt-mark { background: rgb(255 255 255 / .22); color: #fff; }
/* карточки викторин в режиме доски: 3 в ряд, кнопки не сжимаются */
.is-board.b-hosthome .quizzes { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.quiz-actions .icon-btn { flex: none; }
/* разбор на доске: вопрос уже прочитан — чуть меньше, чтобы влезли пояснение, варианты и «кто как ответил» */
.is-board .h-q.is-reveal .q-text { font-size: clamp(26px, 2.8vw, 56px); padding: 1.4vh 3%; }
.is-board .h-q.is-reveal .opts .opt { min-height: clamp(76px, 9.5vh, 120px); }
.is-board .h-q.is-reveal { gap: clamp(12px, 1.6vh, 22px); }
.is-board .who-col { padding: 12px 16px; }
/* открытая: ответ класса обязателен — подсказка мигает, если нажали «дальше» без отметки */
.op-hint.is-ready { color: var(--ok); }
.op-hint.is-warn { color: var(--bad); animation: shake .45s var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.op-q.is-reveal .opt { cursor: default; }
/* открытая без шапки: инструменты (режим доски, весь экран) — в строке вопроса или в углу заставки */
.stage-open { position: relative; }
.stage-open .st { padding-top: clamp(14px, 2vh, 28px); }
.op-tools { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.op-q .op-tools { margin-left: 8px; }
.op-top { position: absolute; top: clamp(14px, 2vh, 28px); right: clamp(16px, 3vw, 64px); z-index: 2; }
.op-top .board-sw, .op-top .icon-btn { background: rgb(255 255 255 / .16); color: #fff; }
.is-board .op-tools .icon-btn { width: 60px; height: 60px; border-radius: 16px; }
.is-board .op-tools .icon-btn .ic { width: 28px; height: 28px; }
.is-board .op-tools .board-sw { min-height: 60px; padding: 0 20px; font-size: 18px; }
.op-tools .board-sw-t { display: none; }
@media (max-width: 560px) { .op-top { position: static; align-self: flex-end; } }
/* заставка открытой: шире карточка — казахский текст длиннее и не должен вылезать за экран */
.op-intro .op-card, .op-end .op-card { width: min(1240px, 100%); }
.is-board .op-rules li { font-size: 1em; padding: 16px 14px; }
.is-board .op-intro .op-card { gap: clamp(12px, 1.6vh, 22px); }
/* вход из интернета: под главным адресом — местный адрес доски, мельче */
.how-alt { display: block; margin-top: 4px; font-size: .62em; font-weight: 700; color: var(--muted, #5b5f7a); line-height: 1.3; }
.how-alt b { color: var(--ink); font-weight: 800; }
.how-addr { overflow-wrap: anywhere; }
