/* Shqip nga zero — стили (бирюзовый дашборд). Без внешних зависимостей. */
:root {
  --bg: #f3f7f8;
  --surface: #ffffff;
  --surface-2: #eaf0f2;
  --ink: #0f1f26;
  --ink-2: #455861;
  --ink-3: #62757d;
  --line: #dde6ea;
  --pri: #0cb6b6;
  --pri-d: #078088;
  --pri-2: #066a72;
  --pri-ink: #07727a;
  --pri-soft: #dff6f6;
  --btn-bg: #078088;
  --btn-ink: #ffffff;
  --btn-edge: #066a72;
  --gold: #f59e0b;
  --gold-soft: #fef3c7;
  --gold-ink: #8a5a06;
  --orange: #f97316;
  --orange-soft: #ffedd5;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --green-ink: #15803d;
  --bad: #dc2626;
  --bad-soft: #fee2e2;
  --blue: #2563eb;
  --blue-soft: #dbeafe;
  --hero-a: #078a90;
  --hero-b: #065f6b;
  --tile-s: 78%;
  --tile-l: 91%;
  --shadow: 0 1px 2px rgba(15, 40, 50, .06), 0 4px 14px rgba(15, 40, 50, .06);
  --radius: 18px;
  --radius-sm: 12px;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: var(--sans);
  --side: 248px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1316; --surface: #0f1d22; --surface-2: #162a31; --ink: #e8f2f3; --ink-2: #a9bec3; --ink-3: #86a0a6;
    --line: #20373e; --pri: #19c8c8; --pri-d: #19c8c8; --pri-2: #12a3a3; --pri-ink: #52dede; --pri-soft: #0f3338;
    --btn-bg: #19c8c8; --btn-ink: #04201f; --btn-edge: #108c8c;
    --gold: #fbbf24; --gold-soft: #35290b; --gold-ink: #fbbf24; --orange: #fb923c; --orange-soft: #3a2310;
    --green: #4ade80; --green-soft: #12301f; --green-ink: #4ade80; --bad: #f87171; --bad-soft: #3b1818;
    --blue: #7cabff; --blue-soft: #14264a; --hero-a: #0b7f86; --hero-b: #08444d; --tile-s: 40%; --tile-l: 22%;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a1316; --surface: #0f1d22; --surface-2: #162a31; --ink: #e8f2f3; --ink-2: #a9bec3; --ink-3: #86a0a6;
  --line: #20373e; --pri: #19c8c8; --pri-d: #19c8c8; --pri-2: #12a3a3; --pri-ink: #52dede; --pri-soft: #0f3338;
  --btn-bg: #19c8c8; --btn-ink: #04201f; --btn-edge: #108c8c;
  --gold: #fbbf24; --gold-soft: #35290b; --gold-ink: #fbbf24; --orange: #fb923c; --orange-soft: #3a2310;
  --green: #4ade80; --green-soft: #12301f; --green-ink: #4ade80; --bad: #f87171; --bad-soft: #3b1818;
  --blue: #7cabff; --blue-soft: #14264a; --hero-a: #0b7f86; --hero-b: #08444d; --tile-s: 40%; --tile-l: 22%;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.3);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans); background: var(--bg); color: var(--ink);
  line-height: 1.5; font-size: 16px; min-height: 100vh; min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--sans); line-height: 1.25; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
a { color: var(--pri-ink); }
.sq { font-weight: 650; }
.muted { color: var(--ink-2); } .faint { color: var(--ink-3); }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- каркас ---------- */
#app { max-width: 760px; margin: 0 auto; padding: 0 16px 96px; }
#app.wide { max-width: 1180px; }
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); margin: 0 -16px 14px; padding: 12px 16px; display: flex; align-items: center; gap: 12px; }
.brand { margin: 0; font-weight: 800; font-size: 1.2rem; flex: 1; display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.brand b { color: var(--pri-ink); }
.brand .on-d { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: .9rem; font-weight: 700; white-space: nowrap; }
.chip svg { width: 16px; height: 16px; }
.chip.fire { color: var(--orange); } .chip.xp { color: var(--gold-ink); }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); }
.tabbar-inner { display: flex; width: 100%; max-width: 760px; }
.side-brand, .side-foot { display: none; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 7px; background: none; border: 0; color: var(--ink-3); font-size: .72rem; position: relative; }
.tab svg { width: 24px; height: 24px; }
.tab.on { color: var(--pri-ink); font-weight: 700; }
.tab .badge { position: absolute; top: 3px; left: calc(50% + 6px); background: var(--orange); color: #fff; border-radius: 999px; font-size: .68rem; min-width: 18px; height: 18px; line-height: 18px; text-align: center; padding: 0 5px; font-weight: 700; }
:root[data-theme="dark"] .tab .badge { color: #1d0d00; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tab .badge { color: #1d0d00; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.stack > .card + .card { margin-top: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.spacer { height: 16px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 12px 20px; font-weight: 700; background: var(--btn-bg); color: var(--btn-ink); box-shadow: 0 2px 0 var(--btn-edge); transition: transform .06s, box-shadow .06s, filter .12s; text-decoration: none; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(2px); box-shadow: 0 0 0 var(--btn-edge); }
.btn.sec { background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 2px 0 var(--line); }
.btn.sec:active { box-shadow: none; }
.btn.ghost { background: transparent; color: var(--pri-ink); box-shadow: none; border: 1px solid var(--line); }
.btn.good { background: var(--green); color: #fff; box-shadow: 0 2px 0 color-mix(in srgb, var(--green) 65%, #000); }
.btn.bad { background: var(--bad); color: #fff; box-shadow: 0 2px 0 color-mix(in srgb, var(--bad) 65%, #000); }
:root[data-theme="dark"] .btn.good, :root[data-theme="dark"] .btn.bad { color: #07150c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.good, :root:not([data-theme="light"]) .btn.bad { color: #07150c; } }
.btn.block { display: flex; width: 100%; }
.btn.sm { padding: 8px 14px; font-size: .9rem; border-radius: 10px; min-height: 44px; }
.btn.light { background: #fff; color: #065f6b; box-shadow: 0 2px 0 rgba(0,0,0,.18); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.iconbtn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; color: var(--pri-ink); flex: none; padding: 0; }
.iconbtn svg { width: 20px; height: 20px; }
.iconbtn.big { width: 56px; height: 56px; } .iconbtn.big svg { width: 26px; height: 26px; }
.iconbtn.on { background: var(--gold-soft); color: var(--gold-ink); border-color: var(--gold); }
.iconbtn.playing { background: var(--btn-bg); color: var(--btn-ink); border-color: transparent; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--surface-2); color: var(--ink-2); }
.pill.a1 { background: var(--green-soft); color: var(--green-ink); } .pill.a2 { background: var(--blue-soft); color: var(--blue); }

.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--pri); border-radius: 99px; transition: width .4s; }
.bar.green > i { background: var(--green); }
.bar.thin { height: 6px; }

/* ---------- главная (дашборд) ---------- */
.dash { display: grid; gap: 14px; margin-bottom: 14px; }
.dash-top { grid-template-columns: 1fr; }
.dash-stats { grid-template-columns: 1fr 1fr; }
.dash-mid { grid-template-columns: 1fr; }
.dash .card { margin: 0; }
.hero { position: relative; overflow: hidden; background: linear-gradient(135deg, var(--hero-a), var(--hero-b)); color: #fff; border: 0; padding: 22px; display: flex; flex-direction: column; gap: 6px; min-height: 180px; }
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .09); pointer-events: none; }
.hero::before { width: 240px; height: 240px; right: -60px; top: -90px; }
.hero::after { width: 150px; height: 150px; right: 60px; bottom: -80px; }
.hero > * { position: relative; z-index: 1; }
.hero .eyebrow { font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .85; }
.hero h2 { font-size: clamp(1.4rem, 3.2vw, 1.9rem); margin: 0; color: #fff; }
.hero p { margin: 0; opacity: .92; max-width: 46ch; font-size: .95rem; }
.hero .hero-foot { margin-top: auto; padding-top: 14px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.hero .prog { flex: 1; min-width: 160px; }
.hero .prog small { display: block; font-size: .8rem; opacity: .9; margin-bottom: 5px; }
.hero .bar { background: rgba(255, 255, 255, .25); }
.hero .bar > i { background: #fff; }
.hero-ico { position: absolute !important; right: 18px; top: 16px; font-size: 3.6rem; line-height: 1; opacity: .95; filter: drop-shadow(0 4px 8px rgba(0,0,0,.2)); }
.m-only { display: none; }
.goal { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; }
.ring { width: 84px; height: 84px; flex: none; position: relative; }
.ring.lg { width: 124px; height: 124px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .t { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 800; line-height: 1.05; font-size: 1.1rem; }
.ring.lg .t { font-size: 1.9rem; }
.ring .t small { font-weight: 500; color: var(--ink-3); font-size: .7rem; }
.w-title { font-size: .82rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px; }
.kpi { display: flex; align-items: center; gap: 14px; }
.kpi .ico { width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center; flex: none; }
.kpi .ico svg { width: 24px; height: 24px; }
.kpi b { display: block; font-size: 1.55rem; line-height: 1.1; font-weight: 800; }
.kpi span.l { font-size: .82rem; color: var(--ink-2); }
.ico.c-orange { background: var(--orange-soft); color: var(--orange); }
.ico.c-gold { background: var(--gold-soft); color: var(--gold-ink); }
.ico.c-blue { background: var(--blue-soft); color: var(--blue); }
.ico.c-green { background: var(--green-soft); color: var(--green-ink); }
.ico.c-pri { background: var(--pri-soft); color: var(--pri-ink); }
.big-n { font-size: 2.6rem; font-weight: 800; line-height: 1; }
.lvl + .lvl { margin-top: 12px; }
.lvl .row { justify-content: space-between; margin-bottom: 5px; font-size: .92rem; }
a.card, button.card { text-decoration: none; color: inherit; }
button.card { text-align: left; width: 100%; cursor: pointer; font: inherit; }
button.card:hover, a.card:hover { border-color: var(--pri); }
.sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 22px 0 12px; }
.sec-h h2 { margin: 0; }
.sec-h span { color: var(--ink-3); font-size: .9rem; }

.units { display: grid; gap: 14px; grid-template-columns: 1fr; }
.unit { padding: 0; overflow: hidden; margin: 0 !important; transition: border-color .15s, box-shadow .15s; }
.unit:hover { border-color: color-mix(in srgb, var(--pri) 55%, var(--line)); }
.unit-head { display: flex; align-items: center; gap: 14px; width: 100%; background: none; border: 0; text-align: left; padding: 16px; }
.unit-ico { width: 52px; height: 52px; flex: none; border-radius: 16px; background: var(--pri-soft); display: flex; align-items: center; justify-content: center; font-size: 1.6rem; }
.unit .unit-ico { background: hsl(var(--hue, 180) var(--tile-s) var(--tile-l)); }
.unit-head > svg { width: 20px; height: 20px; color: var(--ink-3); flex: none; }
.unit-title { font-weight: 750; font-size: 1.02rem; line-height: 1.25; }
.unit-sub { font-size: .85rem; color: var(--ink-2); }
.unit-meta { font-size: .78rem; color: var(--ink-3); margin-top: 4px; }
.unit-body { padding: 4px 16px 18px; border-top: 1px solid var(--line); }
.unit-desc { font-size: .92rem; color: var(--ink-2); margin: 12px 0 6px; }
.lessons { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 4px; }
.node { min-width: 52px; height: 52px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); font-weight: 800; font-size: 1.05rem; display: flex; align-items: center; justify-content: center; padding: 0; gap: 6px; color: var(--ink-2); transition: transform .08s; }
.node:hover { border-color: var(--pri); }
.node.done { background: var(--pri); border-color: var(--pri); color: #04201f; }
.node.next { border-color: var(--pri); color: var(--pri-ink); box-shadow: 0 0 0 5px var(--pri-soft); }
.node.extra { border-radius: 16px; padding: 0 14px; font-size: .85rem; font-weight: 700; }
.node.extra.done { background: var(--green); border-color: var(--green); color: #fff; }
:root[data-theme="dark"] .node.extra.done { color: #07150c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .node.extra.done { color: #07150c; } }
.node svg { width: 18px; height: 18px; }
.unit.open { border-color: var(--pri); box-shadow: 0 0 0 1px var(--pri), var(--shadow); }

/* ---------- запуск занятия (оверлей) ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.ov-top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; max-width: 760px; width: 100%; margin: 0 auto; }
.ov-top .bar { flex: 1; height: 12px; }
.ov-main { flex: 1; overflow-y: auto; padding: 8px 16px 24px; max-width: 760px; width: 100%; margin: 0 auto; }
.ov-foot { border-top: 1px solid var(--line); background: var(--surface); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
.ov-foot-in { max-width: 760px; margin: 0 auto; display: flex; gap: 12px; align-items: center; }
.ov-foot.good { background: var(--green-soft); border-color: var(--green); }
.ov-foot.bad { background: var(--bad-soft); border-color: var(--bad); }
.fb { flex: 1; min-width: 0; }
.fb b { display: block; font-size: 1.05rem; }
.ov-foot.good .fb b { color: var(--green-ink); } .ov-foot.bad .fb b { color: var(--bad); }
.fb .ans { font-size: 1.1rem; font-weight: 650; word-break: break-word; }
.fb .why { font-size: .88rem; color: var(--ink-2); margin-top: 2px; }

.q-title { font-size: .95rem; color: var(--ink-2); font-weight: 600; margin: 8px 0 14px; }
.q-big { font-size: clamp(1.8rem, 6.5vw, 2.6rem); font-weight: 800; line-height: 1.15; text-align: center; margin: 22px 0 8px; word-break: break-word; letter-spacing: -.02em; }
.q-big.ru { font-size: clamp(1.5rem, 5.5vw, 2.1rem); font-weight: 750; }
.q-sub { text-align: center; color: var(--ink-2); margin-bottom: 8px; }
.tr { color: var(--ink-3); font-size: .92rem; font-style: italic; }
.q-audio { display: flex; justify-content: center; margin: 12px 0; }
.sentence { font-size: clamp(1.25rem, 4.6vw, 1.7rem); font-weight: 650; text-align: center; line-height: 1.4; margin: 18px 0 8px; }
.blank { display: inline-block; min-width: 3.2em; border-bottom: 3px solid var(--pri); margin: 0 2px; color: var(--pri-ink); }
.blank.filled { color: var(--green-ink); border-color: var(--green); }
.blank.wrong { color: var(--bad); border-color: var(--bad); }

.opts { display: grid; gap: 10px; margin-top: 16px; }
@media (min-width: 560px) { .opts.two { grid-template-columns: 1fr 1fr; } }
.opt { text-align: left; background: var(--surface); border: 2px solid var(--line); border-radius: 14px; padding: 14px 16px; font-size: 1.05rem; display: flex; align-items: center; gap: 12px; transition: border-color .1s, background .1s; box-shadow: 0 2px 0 var(--line); }
.opt .k { width: 26px; height: 26px; border-radius: 8px; border: 1.5px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; color: var(--ink-3); flex: none; }
.opt:hover { border-color: var(--pri); }
.opt.sel { border-color: var(--pri); background: var(--pri-soft); }
.opt.right { border-color: var(--green); background: var(--green-soft); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.dim { opacity: .55; }
.opt .sq { font-size: 1.12rem; }

.inp { width: 100%; padding: 14px 16px; font-size: 1.25rem; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); font-weight: 650; text-align: center; outline: none; }
.inp:focus { border-color: var(--pri); }
.inp.right { border-color: var(--green); background: var(--green-soft); }
.inp.wrong { border-color: var(--bad); background: var(--bad-soft); }
.keys { display: flex; justify-content: center; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.key { min-width: 48px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 1.25rem; font-weight: 650; }
.hint { text-align: center; color: var(--ink-3); font-size: .9rem; margin-top: 4px; min-height: 1.3em; }

.tiles-box { min-height: 64px; border-bottom: 2px solid var(--line); padding: 8px 0; display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 12px; align-content: flex-start; }
.tiles-bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; min-height: 56px; }
.tile { padding: 9px 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); font-size: 1.15rem; font-weight: 650; box-shadow: 0 2px 0 var(--line); }
.tile:hover { border-color: var(--pri); }
.tile.used { visibility: hidden; }
.tile.ph { visibility: hidden; }
.tile.right { border-color: var(--green); background: var(--green-soft); }
.tile.wrong { border-color: var(--bad); background: var(--bad-soft); }

.match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.match .opt { justify-content: center; text-align: center; min-height: 56px; padding: 10px; font-size: 1rem; }
.match .opt.done { visibility: hidden; }
.match .opt.shake { animation: shake .3s; }
@keyframes shake { 20% { transform: translateX(-5px); } 60% { transform: translateX(5px); } }

.intro { text-align: center; }
.intro .q-big { margin-top: 10px; }
.badges { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin: 6px 0 14px; }
.forms { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: .92rem; text-align: left; background: var(--surface-2); padding: 12px 14px; border-radius: 12px; margin: 12px auto; max-width: 440px; }
.forms dt { color: var(--ink-3); } .forms dd { margin: 0; font-weight: 650; }
.example { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin: 12px auto; max-width: 440px; text-align: left; display: flex; gap: 10px; align-items: center; }
.example .sq { font-size: 1.1rem; display: block; }
.note { background: var(--gold-soft); border-radius: 12px; padding: 10px 12px; font-size: .9rem; margin: 10px auto; max-width: 440px; text-align: left; }

/* ---------- словарь, статистика, настройки ---------- */
.search { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 1rem; }
.search:focus { outline: none; border-color: var(--pri); box-shadow: 0 0 0 3px var(--pri-soft); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.fbtn { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: .85rem; font-weight: 600; }
.fbtn.on { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-ink); }
.wl { display: flex; flex-direction: column; }
.wi { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line); background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; width: 100%; }
.wi:hover { background: color-mix(in srgb, var(--pri-soft) 55%, transparent); }
.wi .sq { font-size: 1.05rem; }
.dots { display: inline-flex; gap: 2px; margin-left: auto; flex: none; }
.dots i { width: 6px; height: 14px; border-radius: 3px; background: var(--line); }
.dots i.on { background: var(--pri); }
.stage-0 { color: var(--ink-3); }
#app.wide .dict-list, .dictwrap .wl { }

.sheet-bg { position: fixed; inset: 0; background: rgba(5, 20, 25, .5); z-index: 120; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 640px; border-radius: 24px 24px 0 0; padding: 18px 18px calc(22px + env(safe-area-inset-bottom)); max-height: 88vh; overflow-y: auto; animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: 24px; } }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 8px; text-align: center; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 1.6rem; font-weight: 800; }
.stat span { font-size: .78rem; color: var(--ink-2); }
.hist { display: flex; align-items: flex-end; gap: 4px; height: 90px; }
.hist div { flex: 1; background: var(--surface-2); border-radius: 6px 6px 0 0; position: relative; min-height: 4px; }
.hist div.on { background: var(--pri); }
.hist div.met { background: var(--green); }
.hist-l { display: flex; gap: 4px; font-size: .65rem; color: var(--ink-3); margin-top: 3px; }
.hist-l span { flex: 1; text-align: center; }
.stages { display: flex; flex-direction: column; gap: 8px; }
.stg { display: grid; grid-template-columns: 150px 1fr 44px; gap: 8px; align-items: center; font-size: .88rem; }

.set { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.set:last-child { border-bottom: 0; }
.set small { display: block; color: var(--ink-3); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 7px 12px; font-weight: 600; font-size: .88rem; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--btn-bg); color: var(--btn-ink); }
.switch { position: relative; width: 48px; height: 28px; border-radius: 99px; background: var(--line); border: 0; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch.on { background: var(--pri-d); } .switch.on::after { left: 23px; }

/* ---------- алфавит ---------- */
.letters { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 10px; }
.letter { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 4px; text-align: center; box-shadow: 0 2px 0 var(--line); }
.letter:hover { border-color: var(--pri); }
.letter b { display: block; font-size: 1.6rem; line-height: 1.1; font-weight: 800; }
.letter small { color: var(--ink-3); font-size: .72rem; }
.letter.dg { background: var(--gold-soft); border-color: transparent; }
.letter.vw { background: var(--pri-soft); border-color: transparent; }
.big-letter { font-size: 4rem; font-weight: 800; text-align: center; line-height: 1; margin: 6px 0; }

/* ---------- грамматика ---------- */
.prose h3 { margin-top: 1.2em; }
.prose table { width: 100%; border-collapse: collapse; margin: 10px 0 14px; font-size: .95rem; }
.prose th, .prose td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { color: var(--ink-3); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.prose code { font-weight: 750; font-size: 1.02em; background: var(--pri-soft); color: var(--pri-ink); padding: 0 6px; border-radius: 6px; cursor: pointer; white-space: nowrap; font-family: inherit; }
.prose blockquote { margin: 12px 0; padding: 10px 14px; background: var(--gold-soft); border-radius: 12px; border: 0; }
.prose ul { padding-left: 1.2em; margin: .4em 0 .8em; } .prose li { margin: .25em 0; }
.table-wrap { overflow-x: auto; }

.dlg { display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 88%; padding: 10px 12px; border-radius: 18px 18px 18px 6px; background: var(--surface); border: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; }
.bubble.me { align-self: flex-end; background: var(--pri-soft); border-color: transparent; border-radius: 18px 18px 6px 18px; }
.bubble .who { font-size: .72rem; color: var(--ink-3); font-weight: 700; }
.bubble .sq { font-size: 1.08rem; display: block; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; z-index: 200; font-size: .92rem; max-width: 90vw; box-shadow: var(--shadow); animation: up .2s; }
.confetti { font-size: 4rem; text-align: center; margin-top: 12px; }
.empty { text-align: center; padding: 28px 12px; color: var(--ink-2); }
.pulse { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.03); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.sentence.ru { font-weight: 600; }
.opt:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.inp:focus-visible, .search:focus-visible { outline: none; }
.overlay:focus, .sheet:focus { outline: none; }
select.fbtn { appearance: auto; }
.hist-l span { white-space: pre; line-height: 1.1; }
.row > svg, .btn svg, .wi > svg, .node svg, .fbtn svg { width: 20px; height: 20px; flex: none; }
.btn svg { width: 18px; height: 18px; }
.card.row { align-items: center; }
.sheet { position: relative; }
.sheet-x { position: absolute; top: 10px; right: 10px; z-index: 2; }
.fbtn, .seg button { min-height: 40px; }
.set { flex-wrap: wrap; }
.opt.right::after { content: "\2713"; margin-left: auto; font-weight: 800; color: var(--green-ink); }
.opt.wrong::after { content: "\2715"; margin-left: auto; font-weight: 800; color: var(--bad); }
.match .opt.right::after, .match .opt.wrong::after { content: none; }
.table-wrap { background: linear-gradient(to right, var(--surface), var(--surface)), linear-gradient(to left, rgba(0,0,0,.12), transparent 14px); background-attachment: local, scroll; background-repeat: no-repeat; background-position: 0 0, right 0; background-size: 100% 100%, 14px 100%; }
.prose code[tabindex] { cursor: pointer; }

@media (max-width: 639px) {
  .hero-ico { font-size: 2.4rem; right: 16px; top: 14px; }
  .hero h2 { padding-right: 56px; }
  .goal { flex-direction: row; text-align: left; gap: 16px; }
  .goal .w-title { display: none; }
  .goal .ring.lg { width: 96px; height: 96px; }
  .goal .ring.lg .t { font-size: 1.5rem; }
  .goal .goal-txt { flex: 1; }
  .m-only { display: block; }
}
/* ---------- планшет и ПК ---------- */
@media (min-width: 640px) {
  .dash-stats { grid-template-columns: repeat(4, 1fr); }
  .dash-mid { grid-template-columns: 1fr 1fr; }
  .units { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 960px) {
  body { padding-left: var(--side); }
  .tabbar { top: 0; right: auto; width: var(--side); flex-direction: column; justify-content: flex-start; border-top: 0; border-right: 1px solid var(--line); padding: 22px 14px 18px; }
  .tabbar-inner { flex-direction: column; gap: 4px; max-width: none; height: 100%; }
  .side-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; font-weight: 800; font-size: 1.15rem; }
  .side-brand i { width: 38px; height: 38px; border-radius: 12px; background: var(--pri); color: #04201f; display: flex; align-items: center; justify-content: center; font-style: normal; font-weight: 800; font-size: 1.3rem; }
  .side-brand small { display: block; font-size: .72rem; font-weight: 600; color: var(--ink-3); letter-spacing: .02em; }
  .tab { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 11px 14px; border-radius: 12px; font-size: .98rem; font-weight: 600; }
  .tab:hover { background: var(--surface-2); }
  .tab.on { background: var(--pri-soft); color: var(--pri-ink); }
  .tab .badge { position: static; margin-left: auto; }
  .side-foot { display: block; margin-top: auto; padding: 12px; border-radius: 14px; background: var(--surface-2); font-size: .82rem; color: var(--ink-2); }
  .side-foot b { color: var(--ink); }
  #app { max-width: 880px; padding: 0 32px 56px; }
  #app.wide { max-width: 1240px; }
  .topbar { margin: 0 -32px 18px; padding: 20px 32px 10px; }
  .brand .on-m { display: none; } .brand .on-d { display: inline; }
  .brand { font-size: 1.6rem; }
  .dash-top { grid-template-columns: 2fr 1fr; }
  .dash-mid { grid-template-columns: repeat(3, 1fr); }
  .units { grid-template-columns: repeat(3, 1fr); }
  .unit.open { grid-column: 1 / -1; }
  .toast { bottom: 28px; }
}
@media (min-width: 1500px) { .units { grid-template-columns: repeat(4, 1fr); } }
