:root {
  --bg: #07080c;
  --bg2: #0e1118;
  --card: #0f1219;
  --card2: #151a24;
  --line: #232a37;
  --line2: #2e3747;
  --text: #eef1f6;
  --muted: #8b95a7;
  --accent: #4f8cff;
  --accent2: #7c5cff;
  --ok: #22c55e;
  --ok-bg: rgba(34, 197, 94, .12);
  --bad: #f43f5e;
  --bad-bg: rgba(244, 63, 94, .12);
  --miss: #64748b;
  --gold: #fbbf24;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 40px rgba(0, 0, 0, .45);
  --text-2: #c3cad6;          /* вторичный текст */
  --accent-text: #a9c6ff;     /* акцентный текст на тёмном */
  --ok-text: #86efac;
  --bad-text: #fda4af;
  --warn-text: #fcd34d;
  --tg-text: #9fd8f5;
  --shimmer: #24304a;
  --topbar: rgba(7, 8, 12, .8);
  --card-end: #0c0f15;
  --avatar-mix: #1b2030;
  --glow: .12;                /* сила цветных пятен фона */
  color-scheme: dark;
}

/* ===== светлая тема: явно выбрана или «как в системе» при светлой системе ===== */
:root[data-theme="light"] {
  --bg: #f3f6fd; --bg2: #ffffff; --card: #ffffff; --card2: #eef2fb; --card-end: #f8faff;
  --line: #e1e7f3; --line2: #cbd5e6;
  --text: #0f172a; --text-2: #334155; --muted: #5b6577;
  --accent: #2563eb; --accent2: #7c3aed; --accent-text: #1d4ed8;
  --ok: #16a34a; --ok-bg: rgba(22, 163, 74, .1); --ok-text: #15803d;
  --bad: #dc2626; --bad-bg: rgba(220, 38, 38, .08); --bad-text: #b91c1c;
  --warn-text: #b45309; --miss: #94a3b8; --gold: #d97706; --tg-text: #0369a1;
  --shimmer: #dfe6f5; --topbar: rgba(255, 255, 255, .86); --avatar-mix: #e8ecf8;
  --shadow: 0 10px 30px rgba(15, 23, 42, .08); --glow: .08;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #f3f6fd; --bg2: #ffffff; --card: #ffffff; --card2: #eef2fb; --card-end: #f8faff;
    --line: #e1e7f3; --line2: #cbd5e6;
    --text: #0f172a; --text-2: #334155; --muted: #5b6577;
    --accent: #2563eb; --accent2: #7c3aed; --accent-text: #1d4ed8;
    --ok: #16a34a; --ok-bg: rgba(22, 163, 74, .1); --ok-text: #15803d;
    --bad: #dc2626; --bad-bg: rgba(220, 38, 38, .08); --bad-text: #b91c1c;
    --warn-text: #b45309; --miss: #94a3b8; --gold: #d97706; --tg-text: #0369a1;
    --shimmer: #dfe6f5; --topbar: rgba(255, 255, 255, .86); --avatar-mix: #e8ecf8;
    --shadow: 0 10px 30px rgba(15, 23, 42, .08); --glow: .08;
    color-scheme: light;
  }
}
/* плавная смена темы */
body, .card, .topbar, .btn, .seg button, .opt, .room-card, .players li, .table td { transition: background-color .25s, border-color .25s, color .25s; }

* { box-sizing: border-box; }
/* hidden должен скрывать и элементы с display:flex/inline-flex (кнопки, блоки) */
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, rgba(79, 140, 255, var(--glow)), transparent 60%),
              radial-gradient(900px 500px at -10% 10%, rgba(124, 92, 255, var(--glow)), transparent 60%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 500 16px/1.5 Nunito, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  overflow-x: clip; /* страховка от горизонтальной прокрутки на телефоне */
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; font-weight: 800; }
h1 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
h2 { font-size: 1.2rem; }
small { font-size: .82em; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.block { display: block; }
.big-emoji { font-size: 3rem; line-height: 1; margin-bottom: .3em; }

/* ---------- layout ---------- */
.container { max-width: 1180px; margin: 0 auto; padding: 16px 16px 60px; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top, 0px));
  background: var(--topbar); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 1.15rem; }
.brand b { font-weight: 900; background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; font-weight: 900; font-size: .9rem;
}
#meButton {
  display: flex; align-items: center; gap: 8px; max-width: 55vw;
  background: var(--card2); color: var(--text); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 14px 4px 4px; font: inherit; cursor: pointer;
}
#meButton span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#meButton:hover { border-color: var(--line2); }

.card {
  background: linear-gradient(180deg, var(--card), var(--card-end));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.pad-xl { padding: 48px 20px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm); padding: 10px 18px;
  font: 700 1rem Nunito, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; cursor: pointer; color: var(--text); background: var(--card2);
  transition: transform .08s, background .2s, border-color .2s, opacity .2s;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; box-shadow: 0 6px 20px rgba(79, 140, 255, .3); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: var(--line2); }
.btn.ghost:hover { background: var(--card2); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.danger:hover { filter: brightness(1.1); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.btn.sm { padding: 7px 12px; font-size: .9rem; }
.btn.lg { padding: 14px 24px; font-size: 1.08rem; }
.btn.block { width: 100%; }
.btn.icon { padding: 10px 12px; }
.link-btn { background: none; border: 1px solid var(--line2); color: var(--muted); border-radius: 8px; padding: 2px 9px; cursor: pointer; font: inherit; }
.link-btn:hover { color: var(--bad); border-color: var(--bad); }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 800; background: rgba(79, 140, 255, .15); color: var(--accent-text); }
.badge { white-space: nowrap; }
.badge.live { flex: none; background: rgba(34, 197, 94, .15); color: var(--ok-text); margin-left: auto; padding: 1px 8px; font-size: .72rem; line-height: 1.5; }
.badge.gold { background: rgba(251, 191, 36, .16); color: var(--gold); }
.tag { display: inline-flex; gap: 6px; align-items: center; padding: 4px 12px; border-radius: 999px; background: rgba(79, 140, 255, .14); color: var(--accent-text); font-weight: 800; font-size: .9rem; }

/* ---------- avatars ---------- */
.avatar {
  --c: #5c7cfa;
  display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--c) 70%, #fff), var(--c));
  color: #fff; font-weight: 900; font-size: .85rem; letter-spacing: -.02em;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .2);
}
.avatar.emoji {
  background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--c) 35%, #fff), color-mix(in srgb, var(--c) 55%, var(--avatar-mix)));
  font-size: 1.25rem; line-height: 1; letter-spacing: 0;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}
.avatar.sm { width: 28px; height: 28px; font-size: .7rem; }
.avatar.emoji.sm { font-size: 1rem; }
.avatar.emoji.xs { font-size: .8rem; }
.icon-label { margin: -4px 0 6px; font-weight: 700; }
.icon-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; margin-bottom: 16px; }
.icon-grid button {
  aspect-ratio: 1; display: grid; place-items: center; padding: 0;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card2);
  font-size: 1.3rem; line-height: 1; cursor: pointer; transition: transform .08s, border-color .15s, background .15s;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}
.icon-grid button:hover { border-color: var(--line2); transform: scale(1.08); }
.icon-grid button.on { border-color: var(--accent); background: rgba(79, 140, 255, .2); box-shadow: inset 0 0 0 1px var(--accent); }
@media (max-width: 420px) { .icon-grid { grid-template-columns: repeat(5, 1fr); } }
.avatar.xs { width: 22px; height: 22px; font-size: .58rem; margin-left: -6px; border: 2px solid var(--card); }
.avatar.xs:first-child { margin-left: 0; }

/* ---------- home ---------- */
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px; align-items: center; padding: 28px 0 36px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 900; letter-spacing: -.02em; }
.grad { background: linear-gradient(90deg, var(--accent), var(--accent2), #f472b6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: 1.1rem; color: var(--text-2); max-width: 60ch; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.stat { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 16px; }
.stat .flag { font-size: 1.8rem; }
.stat small { display: block; color: var(--muted); }
.hero-card { display: flex; justify-content: center; }
.demo-q { width: min(360px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 18px; box-shadow: var(--shadow); transform: rotate(2deg); }
.demo-top { display: flex; justify-content: space-between; align-items: center; }
.ring { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 4px solid var(--ok); color: var(--ok); font-weight: 900; }
.demo-word { font-size: 2rem; font-weight: 900; text-align: center; margin: 12px 0 14px; }
.demo-opt { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; margin-top: 8px; }
.demo-opt i, .opt i { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--card2); font-style: normal; font-weight: 900; font-size: .8rem; }
.demo-opt span { margin-left: auto; font-weight: 900; }
.demo-opt.ok { border-color: var(--ok); background: var(--ok-bg); }
.demo-opt.ok span { color: var(--ok); }
.demo-opt.bad { border-color: var(--bad); background: var(--bad-bg); }
.demo-opt.bad span { color: var(--bad); }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.group-title { margin: 22px 0 10px; font-size: 1.05rem; }
.group-title:first-child { margin-top: 4px; }
.group-title small { font-weight: 600; }
.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.room-card {
  display: flex; align-items: center; gap: 14px; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  transition: transform .15s, border-color .15s, background .15s;
}
.room-card:hover { transform: translateY(-2px); border-color: var(--accent); background: var(--card2); }
.room-emoji { display: grid; place-items: center; flex: none; width: 54px; height: 54px; border-radius: 16px; background: var(--card2); font-size: 1.8rem; }
.room-emoji.sm { width: 46px; height: 46px; font-size: 1.5rem; }
.room-body { flex: 1; min-width: 0; }
.room-name { font-weight: 900; font-size: 1.1rem; }
.room-label { color: var(--muted); font-size: .9rem; }
.room-meta { display: flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--muted); margin-top: 4px; min-width: 0; }
.room-online { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-go { color: var(--muted); font-size: 1.3rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--miss); flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.how { margin-top: 40px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; position: relative; outline: none; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 14px 14px 52px; position: relative; color: var(--text-2); height: 100%; }
.step::before { content: counter(s); position: absolute; left: 14px; top: 14px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 900; font-size: .85rem; }
.steps b { color: var(--text); }
/* компьютер: все шаги в одну линию, текст обрезан; при наведении карточка раскрывается поверх соседей */
@media (hover: hover) and (min-width: 960px) {
  .steps { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .steps li { height: 164px; z-index: 1; }
  .step { position: absolute; inset: 0 0 auto 0; height: auto; max-height: 164px; overflow: hidden; padding: 50px 14px 16px;
    transition: max-height .3s ease, box-shadow .2s, border-color .2s, transform .2s; }
  /* текст плавно гаснет у нижнего края, рамка карточки остаётся целой */
  .step::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 46px; border-radius: 0 0 13px 13px;
    background: linear-gradient(transparent, var(--card) 70%); pointer-events: none; transition: opacity .2s; }
  .steps li:hover, .steps li:focus-visible { z-index: 5; }
  .steps li:hover .step, .steps li:focus-visible .step { max-height: 420px; border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-4px); }
  .steps li:hover .step::after, .steps li:focus-visible .step::after { opacity: 0; }
}

/* ---------- room ---------- */
.room-head { display: flex; align-items: center; gap: 14px; margin: 6px 0 18px; flex-wrap: wrap; }
.back { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line2); color: var(--text); font-size: 1.2rem; }
.back:hover { background: var(--card2); }
.room-title { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.room-title h1 { margin: 0; }
.room-actions { display: flex; gap: 8px; }

.lobby, .play { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.side { position: sticky; top: 80px; }
.field { margin-bottom: 16px; }
.field > label { display: block; font-weight: 800; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button {
  flex: 1 1 auto; min-width: 56px; padding: 9px 12px;
  background: var(--card2); color: var(--text); border: 1px solid var(--line); border-radius: 12px;
  font: 700 .95rem Nunito, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; cursor: pointer; transition: border-color .15s, background .15s;
}
.seg button small { display: block; font-size: .7rem; color: var(--muted); font-weight: 600; }
.seg button:hover:not(:disabled) { border-color: var(--line2); }
.seg button.on { border-color: var(--accent); background: rgba(79, 140, 255, .14); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent); }
.seg button.on small { color: var(--accent-text); }
.seg.disabled button { cursor: default; }
.seg button.off { opacity: .3; cursor: not-allowed; text-decoration: line-through; }
.seg.disabled button:not(.on) { opacity: .55; }
.note { padding: 10px 14px; border-radius: 12px; background: rgba(251, 191, 36, .1); color: var(--warn-text); border: 1px solid rgba(251, 191, 36, .25); font-size: .92rem; }
.note.ok { background: var(--ok-bg); color: var(--ok-text); border-color: rgba(34, 197, 94, .25); }
.note.bad { background: var(--bad-bg); color: var(--bad-text); border-color: rgba(244, 63, 94, .3); }

.players { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.players li { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 12px; background: var(--card2); border: 1px solid transparent; }
.players li.me { border-color: rgba(79, 140, 255, .4); }
.players li.off { opacity: .5; }
.pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.pname small { color: var(--muted); font-weight: 600; }
.pscore { font-weight: 900; color: var(--accent-text); }
.pmark { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: .75rem; font-weight: 900; }
.pmark.ok { background: var(--ok-bg); color: var(--ok); }
.pmark.wait { color: var(--muted); }
.side-foot { margin-top: 16px; }
.waiting { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 10px; border-radius: 12px; background: var(--card2); }

/* ---------- question ---------- */
.q-top { display: flex; align-items: center; gap: 10px; }
.q-count { margin-left: auto; color: var(--text-2); }
.q-progress { height: 4px; border-radius: 4px; background: var(--card2); margin: 12px 0 0; overflow: hidden; }
.q-progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .4s; }
.q-main { text-align: center; padding: 18px 0 18px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.q-main.compact { padding-bottom: 12px; margin-bottom: 12px; }
.q-word { font-size: clamp(2rem, 6vw, 3rem); font-weight: 900; letter-spacing: -.01em; line-height: 1.15; word-break: break-word; }
.q-word.long { font-size: clamp(1.4rem, 4vw, 2rem); }
.q-sub { color: var(--muted); margin-top: 4px; }
.say {
  display: inline-grid; place-items: center; vertical-align: middle; flex: none;
  width: 34px; height: 34px; margin: 0 8px; padding: 0; border-radius: 50%;
  border: 1px solid var(--line2); background: var(--card2); color: var(--text);
  font-size: 1rem; line-height: 1; cursor: pointer; transition: background .15s, border-color .15s, transform .08s;
}
.say:hover { border-color: var(--accent); background: rgba(79, 140, 255, .15); }
.say:active { transform: scale(.92); }
.q-word .say { width: 40px; height: 40px; font-size: 1.15rem; margin-left: 12px; position: relative; top: -4px; }
.qitem-head .say { width: 26px; height: 26px; font-size: .8rem; margin: 0; }
.note.muted-note { margin-top: 8px; background: var(--card2); color: var(--muted); border-color: var(--line); }
.btn.muted-btn { color: var(--muted); }
.timer-ring { --p: 1; position: relative; width: 74px; height: 74px; margin: 14px auto 2px; }
.timer-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-ring circle { fill: none; stroke: var(--card2); stroke-width: 4; }
.timer-ring circle.fg { stroke: var(--ok); stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: calc(1 - var(--p)); transition: stroke .3s; }
.timer-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.6rem; font-weight: 900; color: var(--ok); }
.timer-ring.warn circle.fg { stroke: var(--bad); }
.timer-ring.warn b { color: var(--bad); animation: pulse .5s infinite alternate; }
@keyframes pulse { to { transform: scale(1.12); } }
.q-instr { font-size: 1.1rem; }
.options { display: grid; gap: 10px; }
.opt {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 16px 18px; border-radius: 14px; border: 1px solid var(--line2); background: transparent; color: var(--text);
  font: 700 1.12rem Nunito, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; cursor: pointer; transition: border-color .15s, background .15s, transform .08s;
}
.opt span { flex: 1; min-width: 0; word-break: break-word; }
button.opt:hover:not(:disabled) { border-color: var(--accent); background: rgba(79, 140, 255, .07); }
button.opt:active:not(:disabled) { transform: scale(.99); }
.opt.picked { border-color: var(--accent); background: rgba(79, 140, 255, .16); box-shadow: inset 0 0 0 1px var(--accent); }
.opt.picked i { background: var(--accent); color: #fff; }
.options.locked .opt:not(.picked) { opacity: .45; cursor: default; }
.opt:disabled { cursor: default; }
.q-status { margin-top: 14px; text-align: center; font-weight: 700; color: var(--ok-text); min-height: 1.5em; }

.options.revealed .opt { cursor: default; padding: 12px 16px; }
.opt.correct { border-color: var(--ok); background: var(--ok-bg); }
.opt.correct i { background: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.opt.wrong i { background: var(--bad); color: #fff; }
.opt .who { flex: none; display: flex; }
.opt .mark { flex: none; font-weight: 900; font-size: 1.2rem; }
.opt.correct .mark { color: var(--ok); }
.opt.wrong .mark { color: var(--bad); }
.verdict { display: inline-block; margin-top: 10px; padding: 6px 16px; border-radius: 999px; font-weight: 900; }
.verdict.ok { background: var(--ok-bg); color: var(--ok); }
.verdict.bad { background: var(--bad-bg); color: var(--bad); }
.verdict.miss { background: rgba(100, 116, 139, .18); color: var(--text-2); }
.pair { text-align: center; margin: 0 0 12px; font-size: 1.05rem; }

.table-wrap { overflow-x: auto; margin-top: 16px; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { text-align: left; color: var(--muted); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table tr.me td { background: rgba(79, 140, 255, .07); }
.pcell { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.ans { font-weight: 700; }
.ans.ok { color: var(--ok); }
.ans.bad { color: var(--bad); }
.ans.miss { color: var(--muted); }
td.plus { color: var(--ok); font-weight: 900; }

.next-row { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 18px; }
.auto-bar { width: 100%; height: 4px; background: var(--card2); border-radius: 4px; overflow: hidden; }
.auto-bar i { display: block; height: 100%; width: 100%; background: var(--accent); }
.next-row .btn { min-width: 220px; }

.mini-rank { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.mini-rank li { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 12px; background: var(--card2); }
.mini-rank li.me { box-shadow: inset 0 0 0 1px rgba(79, 140, 255, .5); }
.mini-rank .pl { width: 20px; color: var(--muted); font-weight: 900; }
.mini-rank .avatar.xs { margin-left: 0; }

.countdown-card { max-width: 560px; margin: 30px auto; }
.start-count { text-align: center; padding: 6px 0 12px; }
.start-now { margin-top: 10px; }
.btn.success { background: linear-gradient(135deg, #22c55e, #16a34a); color: #fff; border-color: transparent; }
.btn.success:hover:not(:disabled) { filter: brightness(1.08); }
.watch-note { color: var(--muted, #94a3b8); font-weight: 600; }
.pmark.watch { font-size: .95rem; }

/* ---------- режим просмотра: вопрос «в телевизоре» ---------- */
.qcard.tv {
  position: relative;
  border: 14px solid #11151d;
  border-radius: 26px;
  box-shadow: 0 0 0 2px #2a3142, inset 0 0 40px rgba(79, 140, 255, .12), 0 18px 40px rgba(0, 0, 0, .45);
  margin-bottom: 34px;
  background-image: repeating-linear-gradient(0deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 3px);
}
.qcard.tv::after {             /* подставка */
  content: ''; position: absolute; left: 50%; bottom: -36px; transform: translateX(-50%);
  width: 34%; height: 10px; border-radius: 0 0 12px 12px; background: #11151d; box-shadow: 0 0 0 2px #2a3142;
}
.tv-badge {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 12px;
  padding: 5px 12px; border-radius: 999px; font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  background: rgba(239, 68, 68, .14); color: #f87171; border: 1px solid rgba(239, 68, 68, .35);
}
.tv-dot { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; animation: tv-blink 1.4s ease-in-out infinite; }
@keyframes tv-blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .tv-dot { animation: none; } }
@media (max-width: 640px) { .qcard.tv { border-width: 8px; border-radius: 18px; } }
:root[data-theme="light"] .qcard.tv { border-color: #1f2533; }
.start-count .countdown b { font-size: 4.5rem; }
.start-count .lead { font-size: 1rem; margin: 0 0 10px; }
.busy-card { max-width: 560px; margin: 20px auto; }
.busy-card .spinner { margin: 18px auto; }
.countdown b { display: block; font-size: 7rem; font-weight: 900; line-height: 1.1; background: linear-gradient(135deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; animation: pop 1s infinite; }
@keyframes pop { 0% { transform: scale(.6); opacity: .2; } 30% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }

/* ---------- final ---------- */
.final { max-width: 980px; margin: 0 auto; }
.summary { display: flex; align-items: center; gap: 0; background: #fff; border-radius: 12px; padding: 6px; margin-bottom: 24px; position: relative; }
.sum-bar { flex: 1; min-width: 0; display: flex; align-items: center; height: 40px; border-radius: 8px; overflow: hidden; }
.sum-bar i { display: block; height: 100%; flex: 1; }
.sum-bar span { padding: 4px 10px; margin: 0 6px; border-radius: 6px; font-weight: 900; color: #fff; }
.sum-bar.ok i { background: linear-gradient(90deg, #34d399, #6ee7b7); }
.sum-bar.ok span { background: rgba(0, 0, 0, .2); position: absolute; left: 14px; }
.sum-bar.bad { justify-content: flex-end; }
.sum-bar.bad i { background: #f43f5e; }
.sum-bar.bad span { background: rgba(0, 0, 0, .2); position: absolute; right: 14px; }
.acc-circle {
  --p: .5; flex: none; width: 92px; height: 92px; margin: -16px 10px; border-radius: 50%;
  display: grid; place-content: center; text-align: center; color: #111; z-index: 1;
  background: radial-gradient(closest-side, #fff 80%, transparent 81% 100%), conic-gradient(#22c55e calc(var(--p) * 100%), #f43f5e 0);
  box-shadow: 0 0 0 8px rgba(34, 197, 94, .15);
}
.acc-circle b { font-size: 1.5rem; font-weight: 900; line-height: 1; }
.acc-circle small { font-size: .7rem; color: #555; }
.final-head { text-align: center; margin-bottom: 18px; }
.tabs { display: flex; justify-content: center; gap: 4px; margin-bottom: 14px; }
.tabs button { background: transparent; border: 0; color: var(--muted); font: 800 1rem Nunito, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; padding: 10px 18px; border-bottom: 3px solid transparent; cursor: pointer; }
.tabs button.on { color: var(--text); border-bottom-color: var(--gold); }
.lb { display: flex; flex-direction: column; gap: 6px; }
.lb-row { display: grid; grid-template-columns: 36px 36px minmax(0, 1.2fr) minmax(80px, 1fr) 46px 64px; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: var(--card2); }
.lb-row.first { background: linear-gradient(90deg, rgba(251, 191, 36, .14), var(--card2)); }
.lb-row.me { box-shadow: inset 0 0 0 1px var(--ok); background: rgba(34, 197, 94, .1); }
.lb-row .pl { font-weight: 900; font-size: 1.1rem; text-align: center; }
.lb-name { min-width: 0; }
.lb-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-name small { display: block; }
.stack { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: #e5e7eb33; }
.stack i { display: block; height: 100%; }
.stack .ok { background: #34d399; }
.stack .bad { background: #f43f5e; }
.stack .miss { background: #e5e7eb; }
.lb-acc { color: var(--muted); text-align: right; font-weight: 700; }
.lb-score { text-align: right; font-size: 1.15rem; }
.qlist { display: flex; flex-direction: column; gap: 8px; }
.qitem { background: var(--card2); border-radius: 12px; padding: 10px 14px; }
.qitem-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.qn { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--line); font-size: .78rem; font-weight: 900; }
.arrow { color: var(--muted); }
.ok-text { color: var(--ok); font-weight: 800; }
.qitem-res { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { padding: 2px 10px; border-radius: 999px; font-size: .85rem; font-weight: 700; border: 1px solid var(--line2); }
.chip.ok { color: var(--ok-text); border-color: rgba(34, 197, 94, .4); background: var(--ok-bg); }
.chip.bad { color: var(--bad-text); border-color: rgba(244, 63, 94, .4); background: var(--bad-bg); }
.chip.miss { color: var(--muted); }
.chip small { opacity: .75; }
.final-actions { display: flex; justify-content: center; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 22px; }

/* ---------- records ---------- */
.records-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.records-grid .span-2 { grid-column: span 2; }
.records-grid .card { overflow-x: auto; }
.r-icon { margin-right: 6px; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }

/* ---------- misc ---------- */
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line2); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 0 auto 10px; }
.spinner.sm { width: 18px; height: 18px; border-width: 2px; margin: 0; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 50;
  background: var(--card2); border: 1px solid var(--line2); padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); max-width: calc(100% - 32px);
}
.toast.error { border-color: var(--bad); color: var(--bad-text); }
body.offline::after {
  content: 'Нет соединения… переподключаемся'; position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 40;
  background: var(--bad); color: #fff; padding: 6px 14px; border-radius: 999px; font-weight: 800; font-size: .9rem;
}

.dialog { border: 1px solid var(--line2); border-radius: var(--radius); background: var(--card); color: var(--text); padding: 24px; width: min(420px, calc(100% - 32px)); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(0, 0, 0, .65); backdrop-filter: blur(4px); }
.name-row { display: flex; gap: 8px; margin: 14px 0; }
.name-row input { flex: 1; min-width: 0; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line2); background: var(--bg2); color: var(--text); font: 700 1.05rem Nunito, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.name-row input:focus { outline: 2px solid var(--accent); border-color: transparent; }

/* ================= шапка: язык, рекорды, вход ================= */
.top-actions { display: flex; align-items: center; gap: 8px; min-width: 0; }
.top-link { color: var(--text); padding: 6px 10px; border-radius: 10px; white-space: nowrap; }
.top-link:hover { background: var(--card2); }
.lang-switch { display: flex; background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 2px; }
.lang-switch a { color: var(--muted); font-weight: 800; font-size: .78rem; text-transform: uppercase; padding: 4px 7px; border-radius: 8px; }
.lang-switch a.on { background: var(--accent); color: #fff; }
#meButton { max-width: 40vw; }

/* логотип, иконки шапки, переключатель темы, бейдж друзей */
.brand-logo { width: 34px; height: 34px; border-radius: 10px; display: block; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.top-link { display: inline-flex; align-items: center; gap: 6px; position: relative; font: 700 .95rem Nunito, system-ui, sans-serif; }
.theme-btn { background: none; border: 0; cursor: pointer; color: var(--text); }
.theme-btn .ico { display: none; }
:root:not([data-theme]) .theme-btn .ico-system,
:root[data-theme="light"] .theme-btn .ico-light,
:root[data-theme="dark"] .theme-btn .ico-dark { display: block; }
.top-link:focus-visible, .btn:focus-visible, .seg button:focus-visible, .opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.count-badge {
  position: absolute; top: -2px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: .7rem; font-weight: 900; display: grid; place-items: center;
  box-shadow: 0 0 0 2px var(--bg); animation: popIn .3s ease-out;
}

/* кнопка «В друзья» рядом с игроком */
.friend-slot { display: inline-flex; flex: none; }
.fbtn {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line2); background: transparent; color: var(--accent-text);
  font: 800 .75rem Nunito, system-ui, sans-serif; white-space: nowrap; cursor: pointer; transition: background .2s, border-color .2s, transform .1s;
}
button.fbtn:hover { border-color: var(--accent); background: rgba(79, 140, 255, .12); }
button.fbtn:active { transform: scale(.95); }
.fbtn.sent { color: var(--muted); cursor: default; }
.fbtn.is { color: var(--gold); border-color: transparent; cursor: default; }
.fbtn.accept { color: #fff; background: var(--ok); border-color: var(--ok); }
.lb-name .friend-slot { margin-left: 6px; vertical-align: middle; }
@media (max-width: 600px) { .players .fbtn span, .lb-row .fbtn span { display: none; } }
/* Telegram Mini App: экран «Входим через Telegram…» и без лишнего в шапке */
.tg-veil { position: fixed; inset: 0; z-index: 80; display: grid; place-content: center; text-align: center; gap: 10px; background: var(--bg); color: var(--muted); font-weight: 700; animation: rise .2s ease-out; }
.in-tg #loginButton { display: none; }
.in-tg .topbar { padding-top: 8px; }

/* таблица открытых кабинетов на телефоне — строки-карточки */
@media (max-width: 600px) {
  .rooms-table thead { display: none; }
  .rooms-table tr.room-row {
    display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 6px 12px;
    grid-template-areas: "room room room join" "mode mode mode mode" "cond players status status";
    padding: 12px 4px; border-bottom: 1px solid var(--line);
  }
  .rooms-table tr.room-row:last-child { border-bottom: 0; }
  .rooms-table tr.room-row td { padding: 0; border: 0; background: none !important; }
  .rooms-table tr.room-row td:nth-child(1) { grid-area: room; }
  .rooms-table tr.room-row td:nth-child(2) { grid-area: mode; color: var(--muted); font-size: .88rem; }
  .rooms-table tr.room-row td:nth-child(3) { grid-area: cond; text-align: left; }
  .rooms-table tr.room-row td:nth-child(4) { grid-area: players; }
  .rooms-table tr.room-row td:nth-child(5) { grid-area: status; text-align: right; }
  .rooms-table tr.room-row td:nth-child(6) { grid-area: join; }
  .rooms-table-card .table-wrap { overflow: visible; }
}
/* узкая шапка: только иконки, компактный переключатель языка */
@media (max-width: 480px) {
  .topbar { padding-left: 10px; padding-right: 10px; gap: 6px; }
  .top-actions { gap: 2px; min-width: 0; }
  .top-link { padding: 6px 5px; }
  .brand-logo { width: 30px; height: 30px; }
  .count-badge { right: -2px; }
}

/* страница «Друзья» */
.friends-hint { margin-top: 14px; }
.friends-guest .btn { margin-top: 8px; }
#friendsApp .card { margin-bottom: 16px; }
.req-list { display: flex; flex-direction: column; gap: 8px; }
.req { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--card2); animation: slideIn .3s ease-out backwards; }
.req-actions { margin-left: auto; display: flex; gap: 6px; }
.friends-table tbody tr { animation: slideIn .3s ease-out backwards; animation-delay: calc(var(--i, 0) * 40ms); }
.friends-table tr.me td { background: rgba(79, 140, 255, .07); }
.friends-table .where { white-space: nowrap; }
.friends-table .where .btn { margin-left: 6px; padding: 3px 10px; }
.online-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); margin-right: 6px; vertical-align: middle; }

/* аватар-фото (под фото — иконка на случай, если картинка не загрузится) */
.avatar { position: relative; }
.avatar.photo { overflow: hidden; }
.avatar.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; background: var(--card2); }

/* открытые кабинеты игроков — таблица */
.rooms-table-card { padding: 6px 10px; margin-bottom: 8px; }
.rooms-table { font-size: .93rem; }
.rooms-table td { padding: 8px 10px; }
.rooms-table .room-row { cursor: pointer; transition: background .15s; }
.rooms-table .room-row:hover td { background: var(--card2); }
.room-link { display: flex; align-items: center; gap: 10px; color: var(--text); }
.room-emoji.xs { width: 34px; height: 34px; border-radius: 10px; font-size: 1.1rem; flex: none; }
.nowrap { white-space: nowrap; }
.closing { color: var(--gold); font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rooms-table .badge { white-space: nowrap; }

/* кнопка Google */
.btn.google { background: #fff; color: #1f1f1f; border: 1px solid #dadce0; font-weight: 800; }
.btn.google:hover { background: #f8f9fa; }
.g-logo { width: 18px; height: 18px; vertical-align: -3px; }

/* кнопка Telegram */
.btn.tg { background: #229ed9; color: #fff; margin-bottom: 6px; }
.btn.tg:hover { filter: brightness(1.08); }
#widgetLabel { margin: 10px 0 6px; }
.btn.tg.loading { cursor: progress; opacity: 1; }
.spinner.light { border-color: rgba(255, 255, 255, .35); border-top-color: #fff; display: inline-block; vertical-align: -3px; margin-right: 6px; }

/* ждём «Старт» в Telegram: летящий самолётик и бегущие точки */
.bot-wait {
  display: flex; align-items: center; gap: 12px; margin: 8px 0 4px; padding: 12px 14px;
  border-radius: 12px; background: rgba(34, 158, 217, .12); border: 1px solid rgba(34, 158, 217, .35);
  animation: rise .3s ease-out;
}
.bot-wait .plane { font-size: 1.4rem; display: inline-block; animation: fly 1.6s ease-in-out infinite; }
.bot-wait-text { font-weight: 700; color: var(--tg-text); }
.dots { display: inline-flex; gap: 3px; margin-left: 4px; vertical-align: middle; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: dot 1.2s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
.bot-wait.done { background: var(--ok-bg); border-color: rgba(34, 197, 94, .4); }
.bot-wait.done .bot-wait-text { color: var(--ok-text); }
.bot-wait.done .plane { animation: checkPop .4s ease-out; }
.bot-wait.done .dots { display: none; }
@keyframes fly { 0%, 100% { transform: translate(0, 0) rotate(0deg); } 50% { transform: translate(5px, -5px) rotate(-8deg); } }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* виджет Telegram грузится — мерцающая заглушка */
.tg-widget.loading { min-height: 46px; max-width: 240px; border-radius: 12px;
  background: linear-gradient(90deg, var(--card2) 0%, var(--shimmer) 50%, var(--card2) 100%); background-size: 200% 100%; animation: shine 1.2s linear infinite; }
.tg-widget.loading iframe { opacity: 0; }
.btn:disabled.ghost { opacity: .5; }

/* ================= главная: создать / код / список ================= */
.join-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 16px; margin-bottom: 8px; }
.code-form { display: flex; gap: 8px; }
.code-form input, .text-input {
  padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line2); background: var(--bg2); color: var(--text);
  font: 800 1.05rem Nunito, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.code-form input { width: 150px; letter-spacing: .12em; text-align: center; }
.text-input { width: 100%; font-weight: 700; }
.code-form input:focus, .text-input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.room-code { color: var(--muted); font-weight: 700; font-size: .8rem; letter-spacing: .04em; }
.room-cond { color: var(--accent-text); font-size: .82rem; font-weight: 700; }
.faces { display: inline-flex; margin-right: 4px; }
.faces .avatar.xs { border-color: var(--card); }
.empty-rooms { grid-column: 1 / -1; padding: 14px 4px; }

/* диалоги: создание кабинета, профиль, вход */
.dialog.wide { width: min(620px, calc(100% - 24px)); max-height: calc(100vh - 32px); overflow: auto; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; margin-top: 4px; }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--accent); }
.photo-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.photo-upload { cursor: pointer; }
.icon-grid button.photo-cell { padding: 0; overflow: hidden; }
.icon-grid button.photo-cell img { width: 100%; height: 100%; object-fit: cover; }
#useTgProfile { margin: -6px 0 12px; }
.auth-line { margin: 12px 0 0; }
.auth-box h3 { font-size: 1rem; margin: 0 0 8px; }
.auth-method { padding: 14px 0; border-top: 1px solid var(--line); }
.tg-widget { min-height: 10px; }
.soon { margin: 0; color: var(--gold); font-weight: 800; }
.email-form .name-row { margin: 6px 0; }

/* шапка кабинета: код */
.code-chip b { letter-spacing: .1em; color: var(--accent-text); }
.lock { font-size: .8em; }

/* ================= рекорды: фильтры ================= */
.filters { padding: 14px 16px; margin-bottom: 18px; display: flex; flex-direction: column; gap: 10px; }
.filter-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter-title { min-width: 90px; color: var(--muted); font-weight: 800; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-link { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line2); color: var(--text); font-weight: 700; font-size: .88rem; }
.chip-link:hover { border-color: var(--accent); }
.chip-link.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.records-grid .pcell { align-items: center; }

@media (max-width: 600px) {
  .top-actions { gap: 5px; }
  .top-link { padding: 6px; }
  .lang-switch a { padding: 3px 5px; font-size: .7rem; }
  #meButton { padding-right: 4px; max-width: 34vw; }
  #meButton #meName { display: none; }
  #loginButton { padding: 6px 8px; font-size: .8rem; }
  .join-bar { gap: 8px; }
  .join-bar #createBtn { width: 100%; }
  .code-form { flex: 1; }
  .code-form input { flex: 1; width: auto; min-width: 0; }
  .filter-title { min-width: 0; width: 100%; }
  .room-actions { flex-wrap: wrap; }
}

/* ================= анимации ================= */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
@keyframes popIn { 0% { opacity: 0; transform: scale(.6); } 60% { opacity: 1; transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes wordIn { 0% { opacity: 0; transform: translateY(10px) scale(.92); filter: blur(4px); } 100% { opacity: 1; transform: none; filter: none; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
@keyframes correctPulse { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); } 100% { box-shadow: 0 0 0 14px rgba(34, 197, 94, 0); } }
@keyframes growX { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes tickPop { 0% { transform: scale(1.5); opacity: .2; } 45% { transform: scale(.94); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes breathe { 0%, 100% { box-shadow: 0 6px 20px rgba(79, 140, 255, .3); } 50% { box-shadow: 0 6px 34px rgba(124, 92, 255, .65); } }
@keyframes checkPop { 0% { transform: scale(0) rotate(-30deg); } 70% { transform: scale(1.3) rotate(8deg); } 100% { transform: scale(1); } }
@keyframes shine { from { background-position: -200% 0; } to { background-position: 200% 0; } }

/* появление экрана целиком */
#app > * { animation: rise .3s ease-out; }

/* вопрос: слово «проявляется», варианты выезжают по очереди */
.q-word { animation: wordIn .45s cubic-bezier(.2, .8, .2, 1) backwards; }
.options .opt { animation: slideUp .38s cubic-bezier(.2, .8, .2, 1) backwards; animation-delay: calc(var(--i, 0) * 70ms + 120ms); }
.timer-ring { animation: popIn .4s ease-out backwards; }
button.opt.picked { animation: popIn .3s ease-out; }

/* разбор: правильный ответ пульсирует, мой неверный трясётся */
.options.revealed .opt { animation: slideUp .3s ease-out backwards; animation-delay: calc(var(--i, 0) * 50ms); }
.options.revealed .opt.correct { animation: slideUp .3s ease-out backwards, correctPulse 1s ease-out .35s 2; }
.options.revealed .opt.wrong { animation: shake .45s ease-in-out .25s backwards; }
.opt .who .avatar { animation: popIn .35s ease-out backwards; animation-delay: .35s; }
.verdict { animation: popIn .5s cubic-bezier(.2, .8, .2, 1) backwards; }
.results tbody tr { animation: slideIn .35s ease-out backwards; animation-delay: calc(var(--i, 0) * 60ms + 200ms); }
.pair { animation: rise .4s ease-out .15s backwards; }

/* лобби и участники */
.players li, .mini-rank li { animation: slideIn .3s ease-out backwards; animation-delay: calc(var(--i, 0) * 40ms); }
.pmark.ok { animation: checkPop .35s ease-out; }
.btn.glow:not(:disabled) { animation: breathe 2.2s ease-in-out infinite; }
.countdown b { animation: tickPop .6s cubic-bezier(.2, .8, .2, 1) backwards; }
.auto-bar i { transition: width .1s linear; }

/* итоги: строки выезжают, полосы растут, победитель сияет */
.lb-row { animation: slideUp .4s cubic-bezier(.2, .8, .2, 1) backwards; animation-delay: calc(var(--i, 0) * 90ms + 250ms); }
.lb-row .stack { transform-origin: left; animation: growX .8s cubic-bezier(.2, .8, .2, 1) backwards; animation-delay: calc(var(--i, 0) * 90ms + 450ms); }
.lb-row.first { background: linear-gradient(90deg, rgba(251, 191, 36, .22), rgba(251, 191, 36, .05) 40%, var(--card2)); background-size: 200% 100%; }
.lb-row.first .pl { display: inline-block; animation: popIn .6s ease-out .5s backwards; }
.final-head .big-emoji { display: inline-block; animation: popIn .7s cubic-bezier(.2, .8, .2, 1) backwards; }
.summary { animation: rise .5s ease-out backwards; }
.sum-bar i { transform-origin: left; animation: growX 1s cubic-bezier(.2, .8, .2, 1) .2s backwards; }
.sum-bar.bad i { transform-origin: right; }
.acc-circle { animation: popIn .6s ease-out .3s backwards; }
.qitem { animation: rise .3s ease-out backwards; animation-delay: calc(var(--i, 0) * 30ms); }
.badge.gold { background: linear-gradient(90deg, rgba(251, 191, 36, .16), rgba(251, 191, 36, .45), rgba(251, 191, 36, .16)); background-size: 200% 100%; animation: shine 2.5s linear infinite; }

/* главная: меняющаяся фраза в заголовке */
/* фраза всегда на своей строке, место зарезервировано под самую длинную — заголовок не прыгает */
.rotator { display: grid; justify-items: start; align-items: start; }
.rot-sizer { grid-area: 1 / 1; visibility: hidden; pointer-events: none; padding-bottom: .08em; }
.rot-word {
  grid-area: 1 / 1; padding-bottom: .08em;
  background: linear-gradient(90deg, var(--accent), var(--accent2), #f472b6, var(--accent));
  background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shine 6s linear infinite;
  transition: transform .55s cubic-bezier(.2, .8, .2, 1), opacity .55s, filter .55s;
}
.hero-title { display: grid; gap: 0; }
/* вторая строка заголовка: стрелка ↳ + меняющаяся фраза */
.hero-line2 { display: flex; align-items: flex-start; gap: .12em; }
.hero-arrow { width: .95em; height: .95em; flex: none; margin: .02em 0 0 .08em; overflow: visible; }
.hero-arrow path { fill: none; stroke: url(#heroArrowGrad); stroke-width: 5.5; stroke-linecap: round; stroke-linejoin: round; }
.hero-arrow.draw .shaft { stroke-dasharray: 1; animation: arrowDraw .55s cubic-bezier(.6, 0, .3, 1) both; }
.hero-arrow.draw .head { stroke-dasharray: 1; animation: arrowDraw .25s ease-out .45s both; }
@keyframes arrowDraw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.rot-word.plain { background: none; color: var(--text); -webkit-text-fill-color: currentColor; animation: none; }
.rot-word.in {transform: translateY(55%) scale(.96); opacity: 0; filter: blur(8px); }
.rot-word.out { transform: translateY(-55%) scale(.96); opacity: 0; filter: blur(8px); }

/* главная: демо-карточка меняет вопросы */
.demo-q { transform-origin: 50% 60%; }
.demo-sub { text-align: center; color: var(--muted); margin: -10px 0 8px; min-height: 1.2em; font-size: .9rem; }
.demo-opt b { font-weight: 700; }
.demo-opt .m { margin-left: auto; font-weight: 900; }
.demo-opt { transition: border-color .3s, background .3s; }
.demo-q.swap-out { animation: demoOut .38s ease-in forwards; }
.demo-q.swap-in { animation: demoIn .5s cubic-bezier(.2, .8, .2, 1); }
.demo-q.swap-in .demo-word { animation: wordIn .45s ease-out both; }
.demo-q.swap-in .demo-opt { animation: slideUp .35s ease-out backwards; animation-delay: calc(var(--i, 0) * 80ms + 80ms); }
.demo-q .demo-opt.ok { animation: correctPulse 1s ease-out; }
.demo-q .demo-opt.bad { animation: shake .45s ease-in-out; }
.demo-opt.ok .m { color: var(--ok); animation: checkPop .35s ease-out; }
.demo-opt.bad .m { color: var(--bad); }
@keyframes demoOut { to { opacity: 0; transform: rotate(2deg) translateY(-14px) rotateX(18deg) scale(.96); } }
@keyframes demoIn { from { opacity: 0; transform: rotate(2deg) translateY(18px) rotateX(-18deg) scale(.96); } to { opacity: 1; transform: rotate(2deg); } }

/* главная: карточки кабинетов появляются по очереди */
.room-card { animation: slideUp .4s ease-out backwards; animation-delay: calc(var(--i, 0) * 35ms); }
.badge.starting { flex: none; margin-left: auto; padding: 1px 8px; font-size: .72rem; line-height: 1.5; background: rgba(251, 191, 36, .16); color: var(--gold); animation: breathe 1.6s ease-in-out infinite; }

/* конфетти */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; }

/* при перерисовке того же экрана (кто-то ответил и т.п.) анимации не повторяем */
#app.no-anim *:not(.anim-always):not(.spinner):not(.glow) { animation: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 10px; }
  .hero-card { display: none; }
  /* minmax(0,1fr): колонка не растягивается шире экрана из-за таблиц/длинных слов */
  .lobby, .play { grid-template-columns: minmax(0, 1fr); }
  .card, .side, .qcard { min-width: 0; }
  .side { position: static; }
  .play .side { order: 2; }
  .records-grid { grid-template-columns: 1fr; }
  .records-grid .span-2 { grid-column: auto; }
}
@media (max-width: 600px) {
  .container { padding: 12px 12px 40px; }
  .card { padding: 16px; border-radius: 16px; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .seg button { padding: 8px 10px; font-size: .9rem; min-width: 44px; }
  .opt { padding: 14px; font-size: 1.02rem; }
  .room-actions { width: 100%; }
  .room-actions .btn { flex: 1; }
  .lb-row { grid-template-columns: 28px 30px minmax(0, 1fr) 56px; gap: 8px; padding: 10px; }
  .lb-row .avatar { width: 30px; height: 30px; }
  .lb-row .stack { grid-column: 3 / 5; grid-row: 2; }
  .lb-acc { display: none; }
  .table { font-size: .88rem; }
  .table td, .table th { padding: 7px 6px; }
  .hide-sm { display: none; }

  /* шапка кабинета */
  .room-head { gap: 10px; margin-bottom: 12px; }
  .room-title h1 { font-size: 1.3rem; }
  .room-actions { gap: 6px; }
  .room-actions .btn { padding: 7px 8px; font-size: .82rem; }

  /* вопрос */
  .q-top { flex-wrap: wrap; gap: 6px; }
  .q-top .tag { font-size: .78rem; padding: 3px 10px; max-width: 100%; }
  .q-count { font-size: .9rem; }
  .q-main { padding: 12px 0; margin-bottom: 12px; }
  .q-word { font-size: clamp(1.7rem, 9vw, 2.4rem); }
  .q-word .say { width: 34px; height: 34px; font-size: 1rem; margin-left: 8px; }
  .timer-ring { width: 62px; height: 62px; margin-top: 10px; }
  .timer-ring b { font-size: 1.35rem; }
  .q-instr { font-size: 1rem; margin-bottom: 10px; }
  .options { gap: 8px; }
  .opt { padding: 12px; gap: 10px; }
  .options.revealed .opt { padding: 10px 12px; }
  .verdict { margin-top: 8px; padding: 4px 14px; }
  .pair { font-size: .98rem; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px; }
  .pair .say { margin: 0 6px 0 0; }

  /* результаты вопроса — компактные строки вместо широкой таблицы */
  .results thead { display: none; }
  .results tr { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "p t pts" "a a tot"; align-items: center; column-gap: 10px; row-gap: 2px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
  .results tr:last-child { border-bottom: 0; }
  .results td { border: 0; padding: 0; }
  .results td:nth-child(1) { grid-area: p; min-width: 0; }
  .results td:nth-child(2) { grid-area: a; padding-left: 36px; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .results td:nth-child(3) { grid-area: t; color: var(--muted); font-size: .85rem; }
  .results td:nth-child(4) { grid-area: pts; }
  .results td:nth-child(5) { grid-area: tot; font-size: .85rem; color: var(--muted); }
  .results td:nth-child(5)::before { content: attr(data-label) ' '; }
  .results tr.me { background: rgba(79, 140, 255, .07); border-radius: 10px; }
  .results tr.me td { background: none; }
  .pcell span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .table-wrap { margin-top: 10px; }

  .next-row { margin-top: 12px; }
  .next-row .btn { width: 100%; min-width: 0; }

  /* лобби */
  .card-head { flex-wrap: wrap; }
  .seg { gap: 6px; }
  .seg button small { font-size: .62rem; }
  .players li, .mini-rank li { padding: 6px 8px; }

  /* итоги */
  .summary { margin-bottom: 16px; }
  .sum-bar { height: 32px; }
  .final-head h2 { font-size: 1.15rem; }
  .final-head .lead { font-size: .95rem; }
  .tabs button { padding: 8px 12px; }
  .final-actions .btn { width: 100%; }
  .qitem { padding: 8px 10px; }
  .acc-circle { width: 76px; height: 76px; }
  .acc-circle b { font-size: 1.2rem; }
  .brand > span:last-child { display: none; }
}

/* ===== подвал и юридические страницы ===== */
.site-footer { max-width: 1180px; margin: 0 auto; padding: 8px 16px calc(28px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); text-align: center; }
.page-room .site-footer { display: none; }   /* на экране игры не мешаем */
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; padding: 14px 0 6px; font-size: .88rem; }
.footer-links a, .footer-btn { color: var(--muted); text-decoration: none; }
.footer-links a:hover, .footer-btn:hover { color: var(--text); text-decoration: underline; }
.footer-btn { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }

.cookie-bar { position: fixed; z-index: 60; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto;
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line2);
  border-radius: var(--radius); box-shadow: var(--shadow); }
.cookie-bar[hidden] { display: none; }
.cookie-bar p { flex: 1 1 260px; margin: 0; font-size: .9rem; color: var(--text-2); }
.cookie-bar a { color: var(--accent-text); }
.cookie-actions { display: flex; gap: 8px; margin-left: auto; }
.auth-legal { margin-top: -4px; }
.auth-legal a { color: var(--accent-text); }

.legal { max-width: 820px; margin: 0 auto; }
.legal-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.legal-nav a { padding: 6px 12px; border: 1px solid var(--line2); border-radius: 999px; color: var(--muted); text-decoration: none; font-size: .9rem; }
.legal-nav a.on, .legal-nav a:hover { color: var(--text); border-color: var(--accent); }
.legal-doc { padding: 24px; line-height: 1.6; color: var(--text-2); overflow-wrap: anywhere; }
.legal-doc h1 { color: var(--text); font-size: 1.6rem; margin: 4px 0 16px; line-height: 1.25; }
.legal-doc h2 { color: var(--text); font-size: 1.1rem; margin: 26px 0 8px; }
.legal-doc h3 { color: var(--text); font-size: .98rem; margin: 16px 0 4px; }
.legal-doc p { margin: 8px 0; }
.legal-doc ul { margin: 6px 0; padding-left: 22px; }
.legal-doc a { color: var(--accent-text); }
.legal-note { padding: 10px 12px; border: 1px solid var(--line2); border-radius: var(--radius-sm); background: var(--card2); }
.legal-op { list-style: none; padding: 10px 14px !important; border-left: 3px solid var(--accent); background: var(--card2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.legal-doc .table-wrap { overflow-x: auto; margin: 8px 0; }
.legal-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.legal-table th, .legal-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.legal-table th { color: var(--text); font-weight: 700; }
.legal-table code { font-size: .85em; white-space: nowrap; }
@media (max-width: 560px) { .legal-doc { padding: 18px 16px; } .legal-doc h1 { font-size: 1.35rem; } .cookie-actions { width: 100%; } .cookie-actions .btn { flex: 1; } }
.legal-table td:nth-child(2) { white-space: nowrap; }

/* ================= кабинет профиля ================= */
.avatar.xl { width: 84px; height: 84px; font-size: 2.6rem; }
.profile-head { display: flex; align-items: center; gap: 20px; margin-bottom: 16px; }
.profile-ava .avatar { box-shadow: 0 0 0 4px var(--card2), 0 10px 30px rgba(79, 140, 255, .25); }
.profile-who { min-width: 0; }
.profile-who h1 { margin: 0 0 2px; word-break: break-word; }
.profile-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 2px; animation: rise .3s ease-out backwards; }
.tile b { font-size: 1.45rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.tile span { color: var(--muted); font-size: .82rem; font-weight: 700; }
.tile.warn b { color: var(--warn-text); }
.tile.ok b { color: var(--ok-text); }
.tabs.mini { margin: 0; }
.tabs.mini button { padding: 6px 10px; font-size: .9rem; }
.tabs.mini small { color: var(--muted); font-weight: 800; margin-left: 2px; }
.m-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 12px; }
.m-filters .text-input { width: auto; font-size: .92rem; padding: 8px 12px; }
.m-filters .grow { flex: 1 1 180px; }
.m-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px;
  padding: 12px; border-radius: 12px; background: var(--card2); margin-bottom: 8px;
  animation: slideIn .3s ease-out backwards; animation-delay: calc(var(--i, 0) * 25ms);
  transition: opacity .28s, transform .28s;
}
.m-item.leaving { opacity: 0; transform: translateX(24px); }
.m-item.is-learned { opacity: .75; }
.m-word { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.m-word .say { margin: 0; flex: none; }
.m-word b { font-size: 1.08rem; }
.m-tr { font-weight: 700; color: var(--accent-text); }
.m-stat { display: flex; gap: 8px; font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bad-n { color: var(--bad); } .ok-n { color: var(--ok); }
#mPager { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.acc-bar { position: relative; width: 90px; height: 18px; border-radius: 9px; background: var(--card2); overflow: hidden; margin-left: auto; }
.acc-bar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--ok), #6ee7b7); opacity: .55; }
.acc-bar span { position: relative; font-size: .78rem; font-weight: 900; padding: 0 8px; line-height: 18px; }
.recent-list { display: flex; flex-direction: column; gap: 6px; }
.recent-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--card2); }
.recent-item .pl { width: 32px; text-align: center; font-weight: 900; }
.recent-item .grow { flex: 1; min-width: 0; }
.recent-item .num { text-align: right; }
@media (max-width: 900px) { .profile-grid { grid-template-columns: 1fr; } }
@media (max-width: 600px) {
  .profile-head { flex-direction: column; text-align: center; }
  .profile-actions { justify-content: center; }
  .avatar.xl { width: 72px; height: 72px; font-size: 2.2rem; }
  .m-item { grid-template-columns: minmax(0, 1fr) auto; }
  .m-item .m-btn { grid-column: 1 / -1; width: 100%; }
}

/* ссылки «искать в сети»: Google Переводчик и поиск значения */
.web-links { display: inline-flex; gap: 4px; margin-left: 8px; vertical-align: middle; }
.web-links a {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px;
  border: 1px solid var(--line2); color: var(--muted); transition: color .15s, border-color .15s, background .15s;
}
.web-links a:hover { color: var(--accent-text); border-color: var(--accent); background: rgba(79, 140, 255, .1); }
.web-links .ico { width: 16px; height: 16px; }
.qitem-head .web-links { margin-left: auto; }

/* «＋ В мой словарь» на экране ответа и в итогах */
.study-slot { display: inline-flex; margin-left: 8px; vertical-align: middle; }
.sbtn {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--accent); background: rgba(79, 140, 255, .1); color: var(--accent-text);
  font: 800 .78rem Nunito, system-ui, sans-serif; cursor: pointer; transition: background .2s, transform .1s;
}
button.sbtn:hover { background: rgba(79, 140, 255, .2); }
button.sbtn:active { transform: scale(.95); }
.sbtn.in { border-color: transparent; background: var(--ok-bg); color: var(--ok-text); cursor: default; animation: popIn .3s ease-out; }
.pair { flex-wrap: wrap; }

/* ================= поддержка проекта и место для рекламы ================= */
.promo-rail { max-width: 1180px; margin: 28px auto 8px; padding: 0 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.page-room .promo-rail { display: none; }                 /* во время игры не отвлекаем */
.promo-card { position: relative; border-radius: 16px; padding: 18px 16px 16px; border: 1px solid var(--line); background: var(--card); text-align: center; animation: rise .4s ease-out backwards; }
.promo-card.support { background: linear-gradient(160deg, rgba(251, 191, 36, .16), rgba(244, 114, 182, .10)), var(--card); border-color: rgba(251, 191, 36, .35); }
.promo-card.ad { border-style: dashed; border-color: var(--line2); animation-delay: .1s; }
.promo-emoji { font-size: 2rem; line-height: 1; display: inline-block; animation: promoFloat 3s ease-in-out infinite; }
.promo-card.ad .promo-emoji { animation-delay: 1.5s; }
.promo-card h3 { font-size: 1rem; margin: .45em 0 .3em; }
.promo-card p { font-size: .86rem; color: var(--muted); margin: 0 0 12px; }
.promo-btn { background: #ffdd00; color: #1f1f1f; font-weight: 900; white-space: nowrap; box-shadow: 0 6px 18px rgba(255, 221, 0, .25); }
.promo-btn:hover { filter: brightness(1.05); }
.promo-close { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: .85rem; }
.promo-close:hover { background: var(--card2); color: var(--text); }
@keyframes promoFloat { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-4px) rotate(-6deg); } }
/* широкий экран: «липкая» колонка слева, в свободном поле рядом с контентом */
@media (min-width: 1600px) {
  .promo-rail { position: fixed; left: 20px; top: 96px; width: 190px; margin: 0; padding: 0; grid-template-columns: 1fr; z-index: 5; }
}
@media (max-width: 600px) { .promo-rail { grid-template-columns: 1fr; } }

/* ================= окно «Поддержать»: криптокошельки ================= */
.donate-dialog { width: min(480px, calc(100% - 24px)); max-height: calc(100vh - 24px); overflow: auto; padding: 0; }
.donate-box { position: relative; padding: 26px 24px 20px; }
.donate-x { top: 12px; right: 12px; }
#nameDialog { position: fixed; }
#nameDialog h2 { padding-right: 32px; }
.donate-head { text-align: center; margin-bottom: 14px; }
.promo-emoji.big { font-size: 2.8rem; }
.donate-head h2 { margin: .3em 0 .2em; }
.donate-tabs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 14px; }
.donate-tabs button { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line2); background: transparent; color: var(--text); font: 800 .88rem Nunito, system-ui, sans-serif; cursor: pointer; }
.donate-tabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.wallet { text-align: center; animation: rise .25s ease-out; }
.wallet-qr { width: min(240px, 70vw); aspect-ratio: 1; margin: 0 auto; background: #fff; border-radius: 16px; padding: 10px; box-shadow: var(--shadow); }
.wallet-qr svg { width: 100%; height: 100%; display: block; }
.wallet-qr.placeholder { display: grid; place-items: center; background: repeating-linear-gradient(45deg, var(--card2) 0 12px, var(--bg2) 12px 24px); border: 2px dashed var(--line2); box-shadow: none; }
.wallet-qr.placeholder span { font-weight: 900; font-size: 1.6rem; color: var(--muted); letter-spacing: .1em; }
.wallet-net { margin-top: 12px; font-weight: 900; }
.wallet-addr { display: flex; gap: 8px; align-items: center; margin: 8px 0 10px; padding: 8px 8px 8px 12px; border-radius: 12px; background: var(--card2); border: 1px solid var(--line); }
.wallet-addr code { flex: 1; min-width: 0; overflow-wrap: anywhere; text-align: left; font-size: .85rem; background: none; padding: 0; }
.donate-warn { font-size: .82rem; text-align: left; }
.wallet.demo { text-align: center; }
.demo-badge { display: inline-block; margin: 0 auto 10px; padding: 4px 10px; border-radius: 999px; background: rgba(245,158,11,.15); color: #d97706; font-weight: 800; font-size: .8rem; }
.wallet.demo .wallet-qr { opacity: .55; }
.wallet.demo .wallet-addr code { color: var(--muted); font-style: italic; }
.donate-soon { text-align: center; }
.donate-soon p { margin: 10px 0 0; }
.donate-or { display: flex; align-items: center; gap: 10px; margin: 18px 0 12px; color: var(--muted); font-size: .85rem; }
.donate-or::before, .donate-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.donate-thanks { margin: 14px 0 0; }

/* ===== серия дней 🔥 ===== */
.streak-pill {
  display: inline-flex; align-items: center; gap: 2px; padding: 2px 8px; border-radius: 999px;
  font-size: .8rem; font-weight: 800; color: #fb923c; background: rgba(251, 146, 60, .14); border: 1px solid rgba(251, 146, 60, .35);
  white-space: nowrap;
}
.me .streak-pill { margin-left: 6px; }
.ava-wrap { position: relative; display: inline-flex; flex: none; }
.ava-streak {
  position: absolute; right: -8px; bottom: -6px; font-style: normal; font-size: .62rem; font-weight: 900; line-height: 1;
  padding: 2px 4px; border-radius: 999px; background: var(--card); color: #fb923c; border: 1px solid rgba(251, 146, 60, .5);
  pointer-events: auto;
}
.ava-wrap.xl .ava-streak { font-size: .9rem; right: -4px; bottom: -2px; }
.tile.fire b { color: #fb923c; }

/* ===== задание дня ===== */
.daily-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin-bottom: 18px; padding: 14px 18px;
  background: linear-gradient(135deg, rgba(79, 140, 255, .14), rgba(124, 92, 255, .1)), var(--card);
}
.daily-banner-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.daily-banner-text b { font-size: 1.05rem; }
.daily-banner-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.daily-hero { display: grid; grid-template-columns: 1fr auto; gap: 20px; margin-bottom: 18px; }
.daily-mix { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 6px; }
.daily-mix li { padding: 4px 10px; border-radius: 999px; background: var(--card2); border: 1px solid var(--line); font-size: .85rem; font-weight: 600; }
.daily-mine { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--card2); border: 1px solid var(--line); margin-bottom: 12px; }
.daily-mine .big { font-size: 1.8rem; font-weight: 900; margin-right: 4px; }
.daily-side { display: flex; flex-direction: column; gap: 10px; min-width: 160px; }
.daily-stat { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--card2); border: 1px solid var(--line); display: flex; flex-direction: column; }
.daily-stat b { font-size: 1.3rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.daily-stat span { color: var(--muted); font-size: .8rem; font-weight: 700; }
.table tr.me td { background: rgba(79, 140, 255, .08); }
@media (max-width: 640px) {
  .daily-hero { grid-template-columns: 1fr; }
  .daily-side { flex-direction: row; flex-wrap: wrap; min-width: 0; }
  .daily-stat { flex: 1 1 120px; }
  .daily-banner-actions { width: 100%; }
  .daily-banner-actions .btn { flex: 1; justify-content: center; }
}

/* ===== одиночная игра: лобби ===== */
.solo-intro { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.solo-intro .big-emoji { margin: 0; font-size: 2.6rem; }
.solo-intro h3 { margin: 0 0 4px; }
.solo-intro p { margin: 0; }
.notify-check { margin-top: 10px; padding: 8px 12px; font-size: .9rem; }
.card-head:has([data-solo]) { flex-wrap: wrap; }
