/* G24 · Диктант-спринт — YAPOO Arcade */
:root {
  --bg: #F3F4F8;
  --card: #FFFFFF;
  --card-2: #ECEEF5;
  --text: #1B1E2B;
  --muted: #565C72;
  --line: #D9DCE8;
  --accent: #D9691F;
  --accent-strong: #B9500C;
  --accent-soft: #FCE9DA;
  --teal: #0F7E76;
  --teal-strong: #0B655E;
  --teal-soft: #D8F0ED;
  --danger: #C62E2E;
  --good: #1E8A4C;
  --on-accent: #FFFFFF;
  --shadow: 0 6px 24px rgba(27, 30, 43, .10);
  --ring-track: #E1E4EF;
  --font-head: "Unbounded", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
:root[data-theme="dark"] {
  --bg: #11131D;
  --card: #1B1E2C;
  --card-2: #252940;
  --text: #EEF0F8;
  --muted: #A8AEC4;
  --line: #333852;
  --accent: #F39A55;
  --accent-strong: #F39A55;
  --accent-soft: #3A2A1D;
  --teal: #45C3B5;
  --teal-strong: #45C3B5;
  --teal-soft: #17353A;
  --danger: #FF7B7B;
  --good: #5FD08A;
  --on-accent: #1A1208;
  --shadow: 0 6px 24px rgba(0, 0, 0, .45);
  --ring-track: #2A2F47;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #11131D; --card: #1B1E2C; --card-2: #252940; --text: #EEF0F8; --muted: #A8AEC4;
    --line: #333852; --accent: #F39A55; --accent-strong: #F39A55; --accent-soft: #3A2A1D;
    --teal: #45C3B5; --teal-strong: #45C3B5; --teal-soft: #17353A; --danger: #FF7B7B; --good: #5FD08A;
    --on-accent: #1A1208; --shadow: 0 6px 24px rgba(0, 0, 0, .45); --ring-track: #2A2F47;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; overscroll-behavior: none; }
body { font-family: var(--font-body); font-size: 16px; line-height: 1.4; -webkit-text-size-adjust: 100%; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }

/* Каркас: фіксований блок рівно у видимій області (visualViewport виставляє --vh / --vtop з JS) */
#app {
  position: fixed; left: 0; right: 0;
  top: var(--vtop, 0px);
  height: var(--vh, 100dvh);
  display: flex; flex-direction: column;
  max-width: 1280px; margin: 0 auto;
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
}
.topbar {
  flex: none; display: flex; align-items: center; gap: 8px;
  min-height: 52px; padding: 6px 12px;
}
.brand { font-family: var(--font-head); font-weight: 700; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-g { color: var(--accent); }
@media (max-width: 479px) { .brand-t { display: none; } }
.topbar-actions { margin-left: auto; display: flex; gap: 6px; }
.icon-btn {
  width: 44px; height: 44px; min-width: 44px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card); font-size: 18px; font-weight: 800; display: grid; place-items: center; padding: 0;
}
.icon-btn:active { transform: scale(.94); }
.icon-btn:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible, a:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

.screen { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 4px 16px calc(24px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
h1, h2, h3 { font-family: var(--font-head); margin: 0; letter-spacing: -.02em; }
h1 { font-size: clamp(26px, 7vw, 40px); line-height: 1.1; }
h2 { font-size: 22px; margin: 6px 0 14px; }
.lead { margin: 8px 0 0; color: var(--muted); font-size: 16px; }
.hint { color: var(--muted); font-size: 14px; margin: 10px 0 0; }
.center { text-align: center; }
.field-label { font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 8px; }
.field-label:first-child { margin-top: 0; }

/* Головна */
.home-hero { display: flex; gap: 14px; align-items: center; margin: 6px 0 18px; }
.loop-canvas { width: 88px; height: 88px; image-rendering: pixelated; flex: none; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.mode-grid { display: grid; gap: 12px; grid-template-columns: 1fr; margin-bottom: 16px; }
.mode-card {
  display: grid; grid-template-columns: 56px 1fr; grid-template-rows: auto auto; column-gap: 12px; row-gap: 2px;
  text-align: left; padding: 16px; border-radius: 20px; border: 2px solid var(--line); background: var(--card);
  box-shadow: var(--shadow); transition: transform .12s, border-color .12s;
}
.mode-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.mode-card:active { transform: scale(.98); }
.mode-ico { grid-row: 1 / 3; font-size: 38px; display: grid; place-items: center; }
.mode-title { font-family: var(--font-head); font-weight: 700; font-size: 17px; align-self: end; }
.mode-desc { color: var(--muted); font-size: 14px; }
.rules-inline summary { font-weight: 800; cursor: pointer; font-size: 17px; min-height: 28px; }
.rules-body { font-size: 15.5px; }
.rules-body ol { margin: 10px 0 0; padding-left: 22px; }
.rules-body li { margin-bottom: 8px; }
.rules-body b { color: var(--accent-strong); }
:root[data-theme="dark"] .rules-body b { color: var(--accent); }
.kbd { display: inline-block; padding: 0 7px; border-radius: 7px; background: var(--card-2); font-family: var(--font-mono); font-weight: 800; }

/* Налаштування */
.seg { display: flex; gap: 6px; background: var(--card-2); padding: 5px; border-radius: 16px; }
.seg button { flex: 1; min-height: 46px; border: 0; border-radius: 12px; background: transparent; font-weight: 800; font-size: 15px; padding: 6px 8px; }
.seg button[aria-pressed="true"] { background: var(--accent-strong); color: var(--on-accent); box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.names { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.names:has(> label:only-child) { grid-template-columns: 1fr; }
.names label { font-size: 13px; font-weight: 700; color: var(--muted); display: grid; gap: 4px; }
.names input, #word {
  height: 48px; border-radius: 14px; border: 2px solid var(--line); background: var(--bg); padding: 0 14px; font-size: 17px; font-weight: 700; width: 100%; min-width: 0;
}
.names input:focus, #word:focus { border-color: var(--teal); outline: none; }
.topic-chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-top: 12px; }
.topic-chip { min-height: 56px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); text-align: left; padding: 8px 12px; display: grid; grid-template-columns: 34px 1fr; align-items: center; column-gap: 8px; font-weight: 800; }
.topic-chip small { grid-column: 2; color: var(--muted); font-weight: 600; font-size: 12.5px; margin-top: -2px; }
.topic-chip .te { grid-row: 1 / 3; font-size: 26px; }
.topic-chip[aria-pressed="true"] { border-color: var(--teal); background: var(--teal-soft); }
.check { display: flex; gap: 10px; align-items: center; margin-top: 12px; font-weight: 600; min-height: 44px; }
.check input { width: 22px; height: 22px; accent-color: var(--teal); }
.stepper { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.step-btn { width: 52px; height: 52px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); font-size: 28px; font-weight: 800; line-height: 1; }
.step-val { font-family: var(--font-mono); font-weight: 800; font-size: 30px; min-width: 76px; text-align: center; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { min-width: 48px; min-height: 48px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); font-family: var(--font-mono); font-weight: 800; font-size: 17px; }
.chips button[aria-pressed="true"] { border-color: var(--teal); background: var(--teal-soft); color: var(--text); }
#timerChips { margin-left: auto; }

.btn-primary, .btn-cta {
  display: block; width: 100%; min-height: 58px; border: 0; border-radius: 18px; background: var(--accent-strong); color: var(--on-accent);
  font-family: var(--font-head); font-weight: 700; font-size: 18px; padding: 12px 18px; text-align: center; text-decoration: none;
  box-shadow: 0 8px 20px rgba(185, 80, 12, .28);
}
.btn-primary:active, .btn-cta:active { transform: translateY(1px) scale(.99); }
.btn-primary:disabled { opacity: .6; }
.btn-ghost { display: block; width: 100%; min-height: 50px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); font-weight: 800; font-size: 16px; padding: 10px 14px; }


/* ---- G24: додаткові кольори й компоненти ---- */
:root { --warn: #8A5700; --warn-soft: #FBEBC7; --ok-soft: #D5F0E0; --bad-soft: #FBDADA; }
:root[data-theme="dark"] { --warn: #F6C443; --warn-soft: #3A3017; --ok-soft: #15382A; --bad-soft: #432326; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] { --warn: #F6C443; --warn-soft: #3A3017; --ok-soft: #15382A; --bad-soft: #432326; }
}
.btn-link { display: block; margin: 6px auto 0; background: none; border: 0; color: var(--muted); font-weight: 700; font-size: 14px; min-height: 40px; text-decoration: underline; padding: 6px 12px; }
.chips-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chips-row button { min-height: 48px; min-width: 64px; padding: 0 16px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); font-weight: 800; font-size: 16px; }
.chips-row button[aria-pressed="true"], .topic-chip[aria-pressed="true"] { border-color: var(--teal); background: var(--teal-soft); }
.topic-chip { cursor: pointer; }
select { width: 100%; min-height: 48px; border-radius: 14px; border: 2px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-weight: 700; padding: 0 12px; }
.snd-warn { background: var(--warn-soft); border-color: var(--warn); }
.chip-btn { min-height: 46px; padding: 0 16px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); font-weight: 800; font-size: 15px; display: inline-flex; align-items: center; gap: 6px; }
.chip-btn small { font-family: var(--font-mono); background: var(--card-2); border-radius: 8px; padding: 1px 7px; font-size: 13px; }
.chip-btn:disabled { opacity: .45; cursor: default; }
.chip-btn:not(:disabled):active { transform: scale(.96); }

/* Гра */
.screen.game { display: flex; flex-direction: column; gap: 8px; padding-top: 0; }
.gtop { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex: none; }
.pips { display: flex; gap: 6px; flex-wrap: wrap; }
.pip { width: 18px; height: 18px; border-radius: 50%; background: var(--card-2); border: 2px solid var(--line); transition: background .2s, transform .2s; }
.pip.cur { border-color: var(--accent); transform: scale(1.2); }
.pip.g { background: var(--good); border-color: var(--good); }
.pip.m { background: var(--warn); border-color: var(--warn); }
.pip.b { background: var(--danger); border-color: var(--danger); }
.pips.small .pip { width: 12px; height: 12px; border-width: 2px; }
.gscore { font-family: var(--font-mono); font-weight: 800; display: flex; gap: 12px; align-items: baseline; color: var(--muted); }
.gscore b { font-size: 26px; color: var(--accent-strong); }
:root[data-theme="dark"] .gscore b { color: var(--accent); }
.opp { flex: none; display: flex; align-items: center; gap: 10px; background: var(--teal-soft); border-radius: 14px; padding: 6px 12px; min-height: 40px; }
.opp-name { font-family: var(--font-head); font-weight: 700; font-size: 14px; max-width: 34%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opp-score { font-family: var(--font-mono); font-size: 20px; margin-left: auto; color: var(--teal-strong); }
:root[data-theme="dark"] .opp-score { color: var(--teal); }
.opp-state { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.opp.off { opacity: .6; }

.stage { flex: none; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 4px 0; position: relative; }
.loopline { display: flex; align-items: flex-end; gap: 8px; min-height: 76px; justify-content: center; width: 100%; }
.loopline .loop-canvas { width: 76px; height: 76px; animation-duration: 1.3s; }
.bubble { max-width: 230px; background: var(--card); border: 2px solid var(--line); border-radius: 16px 16px 16px 4px; padding: 6px 12px; font-size: 14px; font-weight: 700; margin-bottom: 18px; transition: opacity .2s; }
.bubble:empty { opacity: 0; }
.play-btn {
  position: relative; width: 132px; height: 132px; border-radius: 50%; border: 0; background: var(--accent-strong); color: var(--on-accent);
  display: grid; place-items: center; box-shadow: 0 10px 28px rgba(185, 80, 12, .35); transition: transform .12s;
}
.play-btn:active { transform: scale(.95); }
.pb-ico { font-size: 52px; line-height: 1; padding-left: 6px; }
.waves { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; gap: 6px; }
.waves i { width: 8px; height: 22px; border-radius: 4px; background: var(--on-accent); animation: wave .7s ease-in-out infinite alternate; }
.waves i:nth-child(2) { animation-delay: .1s; } .waves i:nth-child(3) { animation-delay: .2s; } .waves i:nth-child(4) { animation-delay: .3s; } .waves i:nth-child(5) { animation-delay: .15s; }
@keyframes wave { from { height: 14px; } to { height: 58px; } }
.play-btn.playing .pb-ico { display: none; }
.play-btn.playing .waves { display: flex; }
.play-btn.playing::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 3px solid var(--accent); opacity: .6; animation: ping 1s ease-out infinite; }
@keyframes ping { from { transform: scale(.92); opacity: .7; } to { transform: scale(1.18); opacity: 0; } }
.status { font-weight: 800; min-height: 24px; text-align: center; color: var(--muted); }
.audio-tools { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.answer { flex: none; }
.speedbar { position: relative; height: 22px; border-radius: 11px; background: var(--card-2); overflow: hidden; margin-bottom: 8px; }
.sb-fill { position: absolute; inset: 0 auto 0 0; width: 100%; background: linear-gradient(90deg, var(--teal), var(--accent)); border-radius: 11px; transition: width .2s linear; }
.speedbar span { position: absolute; right: 10px; top: 0; line-height: 22px; font-family: var(--font-mono); font-weight: 800; font-size: 13px; color: var(--text); mix-blend-mode: normal; text-shadow: 0 0 4px var(--card); }
#answerForm { display: flex; gap: 8px; }
#answer { flex: 1; min-width: 0; height: 56px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); padding: 0 14px; font-size: 18px; font-weight: 700; }
#answer:focus { border-color: var(--teal); outline: none; }
#answer::placeholder { color: var(--muted); font-weight: 600; font-size: 16px; }
.btn-send { height: 56px; padding: 0 18px; border: 0; border-radius: 16px; background: var(--accent-strong); color: var(--on-accent); font-family: var(--font-head); font-weight: 700; font-size: 15px; flex: none; }
.btn-send:disabled { opacity: .5; }

/* Підсвітка по словах */
.feedback { margin: 0; animation: slideup .25s ease-out; }
@keyframes slideup { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.fb-head { display: flex; align-items: center; gap: 12px; }
.fb-emoji { font-size: 40px; line-height: 1; }
.fb-titles { flex: 1; min-width: 0; }
.fb-title { font-family: var(--font-head); font-weight: 800; font-size: 19px; line-height: 1.2; }
.fb-sub { color: var(--muted); font-size: 13px; font-weight: 700; margin-top: 2px; }
.fb-pts { font-family: var(--font-mono); font-weight: 800; font-size: 30px; color: var(--accent-strong); }
:root[data-theme="dark"] .fb-pts { color: var(--accent); }
.diff { margin-top: 12px; display: grid; gap: 4px; }
.diff-label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.diff-line { font-size: 19px; font-weight: 700; line-height: 1.7; word-break: break-word; }
.diff-line .empty { color: var(--muted); font-style: italic; font-weight: 600; }
.w { padding: 1px 5px; border-radius: 7px; margin: 0 1px; }
.w.ok { background: var(--ok-soft); }
.w.missed { background: var(--bad-soft); text-decoration: underline wavy var(--danger); text-underline-offset: 4px; }
.w.extra { background: var(--bad-soft); text-decoration: line-through; opacity: .85; }
.w.close { background: var(--warn-soft); text-decoration: underline dotted var(--warn); text-underline-offset: 4px; }
.fb-ua { margin-top: 10px; font-weight: 700; color: var(--teal-strong); font-size: 16px; }
:root[data-theme="dark"] .fb-ua { color: var(--teal); }
.fb-note { margin-top: 10px; background: var(--accent-soft); border-radius: 14px; padding: 10px 12px; display: grid; gap: 3px; font-size: 15px; }
.fb-note b { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-strong); }
:root[data-theme="dark"] .fb-note b { color: var(--accent); }
.fb-note small { color: var(--muted); font-size: 12px; }
.fb-actions { display: flex; gap: 10px; margin-top: 14px; align-items: center; }
.fb-actions .btn-primary { flex: 1; min-height: 52px; }

/* Лобі батлу */
.invite-url { display: block; font-family: var(--font-mono); font-size: 13px; background: var(--bg); padding: 10px 12px; border-radius: 12px; word-break: break-all; margin-bottom: 10px; user-select: all; }
.btn-primary.sm { width: auto; min-height: 46px; padding: 8px 18px; font-size: 15px; }
.name-field { display: grid; gap: 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.name-field input { height: 48px; border-radius: 14px; border: 2px solid var(--line); background: var(--bg); padding: 0 14px; font-size: 17px; font-weight: 700; width: 100%; }
.name-field input:focus { border-color: var(--teal); outline: none; }
.vs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; margin-top: 14px; }
.pl { border: 3px solid var(--line); border-radius: 18px; padding: 10px 12px; text-align: center; min-width: 0; background: var(--card); }
.pl.p0 { --pc: var(--accent); } .pl.p1 { --pc: var(--teal); }
.pl.ready { border-color: var(--pc); background: color-mix(in srgb, var(--pc) 14%, var(--card)); }
.pl-name { font-family: var(--font-head); font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-st { font-size: 13px; font-weight: 700; color: var(--muted); margin-top: 2px; }
.pl.ready .pl-st { color: var(--good); }
.vs-mid { font-family: var(--font-head); font-weight: 800; color: var(--muted); }
#onlineStatus.ok { color: var(--good); font-weight: 800; }
#onlineStatus.off { color: var(--warn); font-weight: 800; }
#lobbySummary { font-weight: 600; font-size: 15px; }
#lobbySummary b { color: var(--accent-strong); }
:root[data-theme="dark"] #lobbySummary b { color: var(--accent); }
.cd-overlay { position: fixed; inset: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 94%, transparent); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.cd-num { font-family: var(--font-head); font-weight: 800; font-size: clamp(120px, 38vw, 260px); line-height: 1; color: var(--accent); animation: pop .6s cubic-bezier(.2, 1.6, .4, 1); }
.cd-sub { font-family: var(--font-head); font-weight: 700; font-size: 20px; }
@keyframes pop { 0% { transform: scale(.3) rotate(-10deg); opacity: .2; } 100% { transform: scale(1) rotate(0); opacity: 1; } }

/* Підсумок */
.result-hero { text-align: center; margin: 0 0 12px; display: grid; justify-items: center; gap: 4px; }
.result-hero .loop-canvas { width: 96px; height: 96px; }
.rh-title { font-family: var(--font-head); font-weight: 800; font-size: clamp(24px, 6.5vw, 38px); line-height: 1.15; }
.rh-sub { color: var(--muted); font-weight: 600; }
.score-row { display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: center; margin-bottom: 14px; }
.ring-acc { position: relative; width: 150px; height: 150px; }
.ring-acc svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-acc circle { fill: none; stroke-width: 11; }
.ring-acc .rbg { stroke: var(--ring-track); }
.ring-acc .rfg { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset 1s ease-out; }
.ring-in { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-in b { font-family: var(--font-head); font-size: 28px; font-weight: 800; }
.ring-in small { color: var(--muted); font-weight: 700; font-size: 12px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; box-shadow: var(--shadow); }
.stat .sv { font-family: var(--font-mono); font-weight: 800; font-size: 24px; line-height: 1.1; }
.stat .sl { color: var(--muted); font-size: 12.5px; font-weight: 700; margin-top: 2px; }
.hard-text { font-family: var(--font-head); font-weight: 700; font-size: 18px; line-height: 1.35; }
.hard-ua { color: var(--teal-strong); font-weight: 700; margin: 6px 0; }
:root[data-theme="dark"] .hard-ua { color: var(--teal); }
.hard-note { background: var(--accent-soft); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; font-size: 15px; }
.res-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.res-list li { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: start; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 15px; }
.res-list li:last-child { border-bottom: 0; }
.res-list .rl-t { font-weight: 700; }
.res-list .rl-ua { color: var(--muted); font-size: 13.5px; font-weight: 600; }
.res-list .rl-p { font-family: var(--font-mono); font-weight: 800; text-align: right; }
.res-list .rl-p small { display: block; color: var(--muted); font-weight: 700; font-size: 12px; }
.board-row { display: grid; grid-template-columns: 28px 1fr auto auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.board-row:last-child { border-bottom: 0; }
.board-row .br-n { font-family: var(--font-head); font-weight: 700; }
.board-row .br-s { font-family: var(--font-mono); font-weight: 800; font-size: 22px; }
.board-row .br-a { color: var(--muted); font-weight: 700; font-size: 13px; }
.board-row.win .br-n { color: var(--accent-strong); }
:root[data-theme="dark"] .board-row.win .br-n { color: var(--accent); }
.board-row .pips { grid-column: 2 / 5; }

.result-actions { display: grid; gap: 10px; margin-bottom: 14px; }
.cta { text-align: center; background: linear-gradient(135deg, var(--accent-soft), var(--teal-soft)); }
.cta-text { font-family: var(--font-head); font-weight: 700; font-size: 17px; margin-bottom: 12px; line-height: 1.3; }
.btn-cta { display: block; background: var(--teal-strong); color: #fff; box-shadow: 0 8px 20px rgba(11, 101, 94, .28); text-decoration: none; min-height: 58px; border-radius: 18px; padding: 16px 18px; font-family: var(--font-head); font-weight: 700; font-size: 18px; }
:root[data-theme="dark"] .btn-cta { background: var(--teal); color: #08211E; }

/* Діалоги */
dialog { border: 0; border-radius: 22px; background: var(--card); color: var(--text); padding: 18px; width: min(560px, calc(100vw - 24px)); max-height: calc(var(--vh, 90vh) - 24px); box-shadow: 0 20px 60px rgba(0,0,0,.4); }
dialog::backdrop { background: rgba(10, 12, 20, .6); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dlg-text { font-family: var(--font-head); font-weight: 700; font-size: 19px; line-height: 1.35; margin: 4px 0 16px; text-align: center; }
.dlg-btns { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; }
.card-img { width: 100%; max-height: 62vh; object-fit: contain; border-radius: 14px; margin: 6px 0 12px; background: #0C0D15; }

/* Адаптив */
@media (min-width: 720px) {
  .mode-grid { grid-template-columns: repeat(2, 1fr); }
  .mode-card { grid-template-columns: 1fr; grid-template-rows: auto auto auto; text-align: center; }
  .mode-ico { grid-row: auto; font-size: 52px; }
  .screen { padding-left: 28px; padding-right: 28px; }
  #screen-setup, #screen-result, #screen-lobby, #screen-game, #screen-home { max-width: 760px; width: 100%; margin: 0 auto; }
  .play-btn { width: 150px; height: 150px; }
  .diff-line { font-size: 22px; }
  #answer { font-size: 20px; height: 62px; }
  .btn-send { height: 62px; font-size: 16px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 400px) { .score-row { grid-template-columns: 124px 1fr; } .ring-acc { width: 124px; height: 124px; } .ring-in b { font-size: 24px; } .stat .sv { font-size: 20px; } }
/* Низький екран (клавіатура): ховаємо Loop */
.compact .loopline, .compact .audio-tools .chip-btn small { display: none; }
.compact .play-btn { width: 88px; height: 88px; } .compact .pb-ico { font-size: 36px; }
.compact .topbar { min-height: 44px; padding-top: 2px; padding-bottom: 2px; }
.compact .icon-btn { height: 38px; width: 38px; min-width: 38px; }
.tiny .stage { flex-direction: row; justify-content: center; }
.tiny .status { display: none; }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
.topic-chip .te { grid-row: auto; }
