/* DeutschLeicht — стили. Mobile-first. */
:root {
  --bg: #fbf8f3;
  --card: #ffffff;
  --ink: #1c2733;
  --muted: #6b7684;
  --line: #e8e2d8;
  --soft: #f3eee6;
  --primary: #16324f;
  --primary-2: #24507d;
  --accent: #f5b82e;
  --accent-soft: #fff3d6;
  --ok: #1f9d64;
  --ok-soft: #e3f6ec;
  --bad: #d6453a;
  --bad-soft: #fde8e6;
  --m: #2f6fd6; --m-soft: #e6efff;
  --f: #d23f6b; --f-soft: #fde7ee;
  --n: #1f9a68; --n-soft: #e2f5ec;
  --pl: #d9801a; --pl-soft: #fdf0de;
  --v: #7b4bd1; --v-soft: #efe8fc;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(22, 50, 79, .06), 0 4px 16px rgba(22, 50, 79, .06);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161c; --card: #19212a; --ink: #e8edf2; --muted: #93a0ae; --line: #2a3440; --soft: #212b36;
    --primary: #8cb8e8; --primary-2: #a9cbf0; --accent: #f5b82e; --accent-soft: #3a3020;
    --ok: #3ccf8e; --ok-soft: #173327; --bad: #ff7468; --bad-soft: #3a1e1c;
    --m: #7aa8ff; --m-soft: #1d2c47; --f: #ff7fa3; --f-soft: #42202c; --n: #4fd39b; --n-soft: #173728;
    --pl: #ffb05a; --pl-soft: #3d2c17; --v: #b896ff; --v-soft: #2c2342;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--primary-2); }
h1 { font-size: 1.6rem; line-height: 1.2; margin: .2em 0 .4em; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; margin: 1.6em 0 .6em; letter-spacing: -.01em; }
h3 { font-size: 1.05rem; margin: 1.2em 0 .5em; }
code { font: .85em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--soft); padding: .1em .35em; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
[hidden] { display: none !important; }

/* ---------- Каркас ---------- */
.header {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.logo { font-weight: 800; font-size: 1.35rem; text-decoration: none; letter-spacing: -.02em; }
.logo-k { color: var(--primary); }
.logo-x { color: var(--accent); }
.hdr-stats { display: flex; gap: 6px; }
.hdr-stat { display: flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); text-decoration: none; color: var(--ink); font-size: .85rem; }
.goal-ring { --p: 0; width: 16px; height: 16px; border-radius: 50%; background: conic-gradient(var(--ok) calc(var(--p) * 360deg), var(--line) 0); display: inline-block; mask: radial-gradient(circle, transparent 4px, #000 5px); -webkit-mask: radial-gradient(circle, transparent 4px, #000 5px); }
.main { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.page { padding: 16px 0 32px; animation: fade .25s ease; }
.page.loading { color: var(--muted); text-align: center; padding-top: 30vh; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex; justify-content: center; gap: 4px;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--line);
}
.nav-item { flex: 1; max-width: 160px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-decoration: none; color: var(--muted); font-size: .75rem; gap: 2px; }
.nav-item.active { color: var(--primary); font-weight: 600; }
.nav-icon { font-size: 1.35rem; position: relative; filter: grayscale(.6); }
.nav-item.active .nav-icon { filter: none; }
.nav-badge { position: absolute; top: -4px; right: -14px; background: var(--bad); color: #fff; font-size: .65rem; font-weight: 700; border-radius: 999px; padding: 0 5px; line-height: 16px; }
body[data-route="lesson"] .nav, body[data-route="test"] .nav, body[data-route="placement"] .nav { display: none; }
body[data-route="lesson"], body[data-route="test"], body[data-route="placement"] { padding-bottom: 0; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; cursor: pointer; text-decoration: none;
  background: var(--primary); color: #fff; font: 600 .95rem var(--font); padding: 10px 16px; border-radius: 12px;
  transition: transform .08s, background .2s, opacity .2s; min-height: 44px;
}
@media (prefers-color-scheme: dark) { .btn { color: #0f1720; } }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.big { padding: 14px 22px; font-size: 1.02rem; border-radius: 14px; min-height: 52px; }
.btn.small { padding: 6px 12px; font-size: .85rem; min-height: 34px; border-radius: 10px; }
.btn.ghost { background: var(--card); color: var(--primary); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.done { background: var(--ok-soft); color: var(--ok); }
.btn.pulse { animation: pulse 1.6s ease 2; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--primary) 18%, transparent); } }
.icon-btn { border: 0; background: transparent; cursor: pointer; font-size: 1.05rem; padding: 6px; border-radius: 10px; line-height: 1; color: var(--ink); min-width: 36px; min-height: 36px; }
.icon-btn:hover { background: var(--soft); }
.icon-btn.done { color: var(--ok); font-weight: 700; }
.back { display: inline-block; color: var(--muted); text-decoration: none; font-size: .9rem; margin-bottom: 6px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.next-row { display: flex; justify-content: flex-end; margin: 20px 0; }
.next-row.sticky { position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); margin: 0; background: linear-gradient(transparent, var(--bg) 35%); }
.next-row.sticky .btn { width: 100%; }

/* ---------- Разметка в тексте ---------- */
.mk { font-weight: 600; border-radius: 5px; padding: 0 .18em; }
.mk-m { color: var(--m); background: var(--m-soft); }
.mk-f { color: var(--f); background: var(--f-soft); }
.mk-n { color: var(--n); background: var(--n-soft); }
.mk-pl { color: var(--pl); background: var(--pl-soft); }
.mk-v { color: var(--v); background: var(--v-soft); }
.mk-e { color: var(--bad); background: none; padding: 0; text-decoration: underline 2px; text-underline-offset: 3px; }
.mk-de { color: var(--primary-2); background: var(--soft); font-weight: 600; }
.mk-x { color: var(--bad); text-decoration: line-through; font-weight: 400; background: none; }
.mk-hl, mark { background: var(--accent-soft); color: inherit; border-radius: 4px; padding: 0 .15em; }
.mk-s { color: var(--muted); font-weight: 400; background: none; font-size: .9em; }
.mk-b { font-weight: 700; }
.g-m { color: var(--m); } .g-f { color: var(--f); } .g-n { color: var(--n); }

/* кликабельные слова */
.de .w { cursor: pointer; border-radius: 4px; transition: background .15s; }
.de .w:hover { background: var(--accent-soft); }
.de .w.w-active { background: var(--accent); color: #1c2733; }
.de .w.w-cons { background: var(--accent-soft); box-shadow: inset 0 -2px var(--accent); }

/* ---------- Приветствие ---------- */
.welcome { text-align: center; padding-top: 8vh; }
.welcome-logo { font-size: clamp(2.2rem, 11vw, 3.2rem); font-weight: 800; letter-spacing: -.03em; }
.welcome-lead { font-size: 1.15rem; max-width: 420px; margin: 8px auto 24px; }
.welcome-list { list-style: none; padding: 0; margin: 0 auto 28px; max-width: 420px; text-align: left; display: grid; gap: 10px; }
.welcome-list li { background: var(--card); border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow); }
.welcome-btns { display: grid; gap: 10px; max-width: 420px; margin: 0 auto; }

/* ---------- Карта курса ---------- */
.continue-card {
  display: block; position: relative; text-decoration: none; color: #fff; padding: 18px 56px 18px 18px; border-radius: 20px;
  background: linear-gradient(135deg, #16324f, #2c5d8f); box-shadow: 0 8px 24px rgba(22, 50, 79, .25); margin-bottom: 14px;
}
.continue-card.soon { background: linear-gradient(135deg, #5b6b7c, #7d8c9c); padding-right: 18px; }
.cc-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; opacity: .75; }
.cc-title { font-size: 1.2rem; font-weight: 700; margin: 2px 0; }
.cc-sub { font-size: .85rem; opacity: .8; }
.cc-go { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #16324f; display: grid; place-items: center; font-weight: 800; }
.placement-cta { display: block; padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); color: var(--ink); text-decoration: none; margin-bottom: 14px; font-size: .92rem; }
.level-tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 12px; }
.lt { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; font: inherit; min-width: 0; }
.lt:hover { border-color: var(--primary-2); }
.lt.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--accent-soft); }
.lt-code { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; color: #fff; font-size: .9rem; }
.lt:not(.active) .lt-code { opacity: .55; }
.lt-prog { font-size: .68rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.level-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 12px; }
.level-card .level-head { cursor: default; }
.course-page > .block { padding: 4px 0 6px; }
.welcome-h { font-size: 1.15rem; margin: 0 auto 12px; }
.welcome-levels { display: grid; gap: 8px; max-width: 420px; margin: 0 auto 12px; }
.wl { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); text-align: left; cursor: pointer; font: inherit; box-shadow: var(--shadow); }
.wl:hover { border-color: var(--primary-2); }
.welcome-test { max-width: 420px; width: 100%; margin: 0 auto 8px; }
.level { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 12px; overflow: hidden; }
.level-head { display: flex; align-items: center; gap: 12px; padding: 14px; cursor: pointer; list-style: none; }
.level-head::-webkit-details-marker { display: none; }
.level-code { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-weight: 800; color: #fff; }
.lv-a1 { background: #3aa76d; } .lv-a2 { background: #2f9bb8; } .lv-b1 { background: #3b6fd1; } .lv-b2 { background: #7a52cc; } .lv-c1 { background: #c2456e; }
.level-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.level-info .muted { font-size: .8rem; line-height: 1.35; }
.level-prog { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: .8rem; color: var(--muted); width: 70px; }
.soon-note { font-size: .7rem; }
.mbar { height: 6px; width: 100%; background: var(--soft); border-radius: 99px; overflow: hidden; }
.mbar > div { height: 100%; background: var(--ok); border-radius: 99px; }
.mbar.big { height: 10px; flex: 1; }
.block { padding: 4px 14px 14px; }
.block-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 8px 0; font-weight: 600; }
.path { display: grid; gap: 8px; }
.node { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; border: 1.5px solid var(--line); text-decoration: none; color: var(--ink); background: var(--card); }
.node-icon { flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--soft); font-size: 1.1rem; }
.node-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.node-title { font-weight: 600; line-height: 1.3; }
.node-sub { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node-stars { color: var(--accent); font-size: .85rem; letter-spacing: 1px; flex: none; }
.node.st-done .node-icon { background: var(--ok); color: #fff; font-weight: 800; }
.node.st-open { border-color: var(--primary-2); }
.node.next { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.node.st-locked, .node.st-soon { opacity: .55; }
.node.st-soon { border-style: dashed; }
.node-test .node-icon { background: var(--accent-soft); }
a.node:hover { border-color: var(--primary-2); }

/* ---------- Урок ---------- */
.lesson-hero { padding: 4px 0 8px; }
.lesson-meta { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.lesson-de { color: var(--primary-2); font-weight: 600; margin-top: -4px; }
.lesson-goal { margin-top: 10px; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); font-size: .93rem; }
.tabs { position: sticky; top: 57px; z-index: 10; display: flex; gap: 4px; background: var(--soft); padding: 4px; border-radius: 14px; margin: 10px 0 16px; }
.tab { flex: 1; text-align: center; padding: 8px 4px; border-radius: 10px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .92rem; }
.tab.active { background: var(--card); color: var(--primary); box-shadow: var(--shadow); }

.theory > p { margin: .6em 0; }
.theory h2 { margin-top: 1.8em; padding-top: .2em; }
.theory h2:first-child { margin-top: .4em; }
.rule { border-radius: var(--radius); padding: 14px 16px; margin: 14px 0; background: var(--card); box-shadow: var(--shadow); border-left: 5px solid var(--primary-2); }
.rule-title { font-weight: 700; margin-bottom: 4px; color: var(--primary); }
.tip { border-radius: var(--radius); padding: 12px 16px; margin: 14px 0; }
.tip-title { font-weight: 700; margin-bottom: 2px; }
.tip-info { background: var(--m-soft); }
.tip-warn { background: var(--bad-soft); }
.tip-warn .tip-title { color: var(--bad); }
.tip-ru { background: var(--accent-soft); }
.tip-ok { background: var(--ok-soft); }
.list { padding-left: 1.2em; }
.list li { margin: .3em 0; }
.examples { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px 14px; margin: 14px 0; }
.ex-title { font-weight: 700; padding: 8px 0 2px; }
.example { padding: 8px 0; border-bottom: 1px solid var(--line); }
.example:last-child { border-bottom: 0; }
.ex-de { font-size: 1.08rem; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ex-ru { color: var(--muted); font-size: .92rem; }
.ex-note { font-size: .85rem; margin-top: 2px; }
.speak { flex: none; opacity: .65; }
.table-wrap { overflow-x: auto; margin: 14px 0; -webkit-overflow-scrolling: touch; }
.table-title { font-weight: 700; margin-bottom: 6px; }
.table-cap { font-size: .85rem; color: var(--muted); margin-top: 6px; }
table { border-collapse: separate; border-spacing: 0; width: 100%; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; font-size: .95rem; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--primary); color: #fff; font-weight: 600; font-size: .85rem; }
@media (prefers-color-scheme: dark) { th { color: #0f1720; } }
tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--soft) 50%, transparent); }
.table-wrap.compact td, .table-wrap.compact th { padding: 6px 10px; }
.scheme { margin: 14px 0; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; overflow-x: auto; }
.scheme-title { font-weight: 700; margin-bottom: 8px; }
.scheme-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(72px, 1fr); gap: 6px; margin-bottom: 6px; }
.scheme-head { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); text-align: center; }
.sc { border-radius: 10px; padding: 8px 6px; text-align: center; background: var(--soft); }
.sc.empty { background: transparent; border: 1.5px dashed var(--line); }
.sc-w { font-weight: 700; }
.sc-l { font-size: .68rem; color: var(--muted); margin-top: 2px; }
.sc-v, .sc-v2 { background: var(--v-soft); } .sc-v .sc-w, .sc-v2 .sc-w { color: var(--v); }
.sc-s { background: var(--m-soft); } .sc-s .sc-w { color: var(--m); }
.sc-w { } .sc-w.sc-w { }
.sc-q { background: var(--accent-soft); }
.sc-o { background: var(--n-soft); } .sc-o .sc-w { color: var(--n); }
.sc-t, .sc-p { background: var(--pl-soft); } .sc-t .sc-w, .sc-p .sc-w { color: var(--pl); }
.scheme-cap { font-size: .85rem; color: var(--muted); }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 14px 0; }
.mini-card { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 12px; }
.mc-icon { font-size: 1.6rem; }
.mc-de { font-weight: 700; display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.mc-ru { font-size: .85rem; color: var(--muted); }
.mini-card.tone-formal { border-top: 4px solid var(--primary-2); }
.mini-card.tone-informal { border-top: 4px solid var(--accent); }
.mini-card.tone-neutral { border-top: 4px solid var(--n); }

/* медиа */
.media-img { margin: 14px 0; }
.media-img img { width: 100%; height: auto; border-radius: var(--radius); display: block; box-shadow: var(--shadow); }
.media-img.small .img-ph { aspect-ratio: 16 / 9; }
.media-img.small img { max-height: 320px; object-fit: contain; background: var(--soft); }
.media-img figcaption { font-size: .85rem; color: var(--muted); margin-top: 6px; text-align: center; }
.img-ph {
  aspect-ratio: 4 / 3; border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 16px; text-align: center;
  background: repeating-linear-gradient(45deg, var(--soft), var(--soft) 12px, color-mix(in srgb, var(--soft) 60%, var(--card)) 12px, color-mix(in srgb, var(--soft) 60%, var(--card)) 24px);
  border: 1.5px dashed var(--line); color: var(--muted);
}
.img-ph-icon { font-size: 1.8rem; opacity: .6; }
.img-ph-alt { font-size: .9rem; color: var(--ink); max-width: 420px; }
.img-ph-id { font: .7rem ui-monospace, Menlo, monospace; opacity: .6; }
.audio-box { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; margin: 14px 0; }
.audio-title { font-weight: 600; font-size: .9rem; margin-bottom: 8px; }
.audio-ph { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); }
.audio-ph code { font-size: .7rem; }
.audio-player { display: flex; align-items: center; gap: 10px; }
.play { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--primary); color: #fff; font-size: 1rem; cursor: pointer; flex: none; }
.audio-bar { flex: 1; height: 8px; background: var(--soft); border-radius: 99px; cursor: pointer; overflow: hidden; }
.audio-fill { height: 100%; width: 0; background: var(--accent); }
.audio-time { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* диалоги */
.dialog-block { margin: 16px 0; }
.dialog-title { font-weight: 700; margin-bottom: 6px; }
.dialog-lines { display: grid; gap: 8px; }
.dl { display: flex; flex-direction: column; max-width: 88%; }
.dl.right { margin-left: auto; align-items: flex-end; }
.dl-who { font-size: .75rem; color: var(--muted); margin: 0 10px 2px; font-weight: 600; }
.dl-bubble { background: var(--card); border-radius: 16px 16px 16px 4px; padding: 9px 13px; box-shadow: var(--shadow); font-size: 1.02rem; }
.dl.right .dl-bubble { background: var(--m-soft); border-radius: 16px 16px 4px 16px; }
.dl-ru { color: var(--muted); font-size: .85rem; margin-top: 3px; }
.dialog-tools { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: .8rem; flex-wrap: wrap; }

/* слова урока */
.vocab-top { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.vocab-group { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.vcard { display: flex; gap: 8px; padding: 12px 14px; background: var(--card); border-radius: 14px; box-shadow: var(--shadow); margin-bottom: 8px; }
.vc-main { flex: 1; min-width: 0; }
.vc-de { font-weight: 700; font-size: 1.08rem; }
.vc-pl { font-weight: 400; color: var(--muted); font-size: .9rem; }
.vc-ru { color: var(--ink); }
.vc-ex { font-size: .9rem; color: var(--muted); margin-top: 2px; }
.vc-note { font-size: .82rem; margin-top: 3px; }
.vc-tools { display: flex; flex-direction: column; }

/* ---------- Задания ---------- */
.practice-top { position: sticky; top: 57px; z-index: 10; display: flex; align-items: center; gap: 10px; padding: 8px 0; background: var(--bg); }
.progress { flex: 1; height: 10px; background: var(--soft); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--ok), #46c98c); border-radius: 99px; transition: width .4s ease; }
.practice-count { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ex-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin: 8px 0 4px; }
.ex-num { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.ex-title { font-weight: 700; color: var(--primary); }
.ex-task { font-size: 1.05rem; font-weight: 600; margin: 2px 0 12px; }
.stimulus:empty { display: none; }
.reading { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 16px; margin: 10px 0; font-size: 1.04rem; }
.reading p { margin: .35em 0; }
.reading .who { font-weight: 700; color: var(--primary-2); margin-right: 6px; }
.reading .who::after { content: ":"; }
.transcript-toggle { margin: -4px 0 8px; }
.word-bank { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; padding: 10px; background: var(--soft); border-radius: 12px; }
.bank-w { background: var(--card); padding: 3px 10px; border-radius: 8px; font-weight: 600; font-size: .92rem; box-shadow: var(--shadow); }
.item { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; border: 2px solid transparent; transition: border-color .2s; }
.item.is-ok { border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.item.is-bad { border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.item-row { display: flex; gap: 10px; }
.item-num { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--soft); color: var(--muted); font-size: .75rem; font-weight: 700; display: grid; place-items: center; margin-top: 3px; }
.item-body { flex: 1; min-width: 0; }
.q { font-size: 1.06rem; margin-bottom: 10px; }
.q.ru { color: var(--muted); font-size: .95rem; }
.blank { display: inline-block; min-width: 3em; border-bottom: 2px solid var(--primary-2); color: transparent; }
.hint { font-size: .82rem; color: var(--muted); margin: 4px 0 8px; }
.gap-line { font-size: 1.1rem; line-height: 2.3; }
.gap-line.center { text-align: center; }
input.gap, input.write {
  font: inherit; font-size: 1.05rem; padding: 4px 6px; border: 0; border-bottom: 2px solid var(--primary-2); background: var(--soft); border-radius: 6px 6px 0 0;
  color: var(--ink); outline: none; text-align: center; min-width: 2.2em; transition: background .2s;
}
input.gap:focus, input.write:focus { background: var(--accent-soft); border-color: var(--accent); }
input.write { width: 100%; text-align: left; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line); margin-bottom: 10px; }
input.write.center { text-align: center; font-size: 1.2rem; }
input.ok { background: var(--ok-soft) !important; border-color: var(--ok) !important; color: var(--ok); font-weight: 600; }
input.bad { background: var(--bad-soft) !important; border-color: var(--bad) !important; color: var(--bad); text-decoration: line-through; }
.gap-fix { color: var(--ok); font-weight: 700; margin-left: 4px; }
.btn.check { margin-top: 8px; }
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.options.long { grid-template-columns: 1fr; }
.options.tf { grid-template-columns: 1fr 1fr; }
.opt {
  font: inherit; font-size: 1rem; padding: 12px 14px; min-height: 48px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  cursor: pointer; text-align: center; transition: border-color .15s, background .15s, transform .08s;
}
.opt:hover { border-color: var(--primary-2); }
.opt:active { transform: scale(.98); }
.opt.ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); font-weight: 700; }
.opt.bad { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.options.locked .opt { cursor: default; }
.options.locked .opt:not(.ok):not(.bad) { opacity: .5; }
.order-answer { min-height: 54px; border-bottom: 2px solid var(--line); display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 0 10px; margin-bottom: 10px; }
.order-answer.ok { border-color: var(--ok); } .order-answer.bad { border-color: var(--bad); }
.order-bank { display: flex; flex-wrap: wrap; gap: 6px; min-height: 44px; }
.chip { font: inherit; font-size: 1.02rem; padding: 8px 12px; border-radius: 10px; border: 1.5px solid var(--line); border-bottom-width: 3px; background: var(--card); color: var(--ink); cursor: pointer; }
.locked .chip { cursor: default; }
.fix-line { font-size: 1.1rem; line-height: 2.2; }
.fix-w { font: inherit; border: 0; background: transparent; padding: 1px 3px; border-radius: 6px; cursor: pointer; color: var(--ink); border-bottom: 1.5px dotted var(--muted); }
.fix-w.sel { background: var(--accent-soft); border-bottom-color: var(--accent); }
.fix-w.target { background: var(--bad-soft); color: var(--bad); border-bottom: 2px solid var(--bad); }
.fix-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.fix-edit input.write { flex: 1; min-width: 140px; margin: 0; }
.fix-edit .btn.check { margin: 0; }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match-col { display: grid; gap: 8px; align-content: start; }
.mchip { font: inherit; padding: 10px; min-height: 48px; border-radius: 12px; border: 1.5px solid var(--line); border-bottom-width: 3px; background: var(--card); color: var(--ink); cursor: pointer; font-weight: 600; }
.mchip.ru { font-weight: 400; }
.mchip.sel { border-color: var(--primary-2); background: var(--m-soft); }
.mchip.ok { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); opacity: .7; cursor: default; }
.shake { animation: shake .4s; border-color: var(--bad) !important; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.feedback { margin-top: 12px; padding: 10px 12px; border-radius: 12px; font-size: .94rem; animation: fade .2s ease; }
.feedback.ok { background: var(--ok-soft); }
.feedback.bad { background: var(--bad-soft); }
.fb-head { font-weight: 700; }
.feedback.ok .fb-head { color: var(--ok); } .feedback.bad .fb-head { color: var(--bad); }
.fb-correct { margin-top: 2px; }
.fb-note { font-size: .85rem; margin-top: 2px; }
.fb-sentence { margin-top: 6px; font-size: 1.02rem; display: flex; align-items: center; gap: 6px; }
.fb-why { margin-top: 6px; color: var(--ink); }
.fb-why-label { font-weight: 700; }

/* итоги */
.result { text-align: center; padding: 28px 8px; }
.result h2 { margin: 8px 0; font-size: 1.6rem; }
.result-stars { font-size: 2.6rem; letter-spacing: 6px; color: var(--line); }
.result-stars .on { color: var(--accent); }
.result-score { font-size: 1.1rem; font-weight: 600; }
.result-xp { display: inline-block; margin-top: 8px; padding: 4px 12px; background: var(--accent-soft); border-radius: 999px; font-weight: 700; }
.result-btns { display: grid; gap: 10px; max-width: 380px; margin: 24px auto 0; }
.test-intro { padding: 8px 0; }
.test-badge { font-size: 3rem; }
.test-review { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; }
.chip-link { padding: 4px 10px; border-radius: 99px; background: var(--soft); text-decoration: none; font-size: .85rem; }
.placement-bars { display: grid; gap: 6px; max-width: 360px; margin: 16px auto; }
.pb { display: grid; grid-template-columns: 34px 1fr 44px; gap: 8px; align-items: center; font-size: .85rem; }
.pb-bar { height: 10px; background: var(--soft); border-radius: 99px; overflow: hidden; }
.pb-bar > div { height: 100%; background: var(--primary-2); }

/* ---------- Всплывашка слова ---------- */
.sheet-back { position: fixed; inset: 0; z-index: 50; background: rgba(15, 23, 32, 0); transition: background .25s; display: flex; align-items: flex-end; justify-content: center; }
.sheet-back.show { background: rgba(15, 23, 32, .35); }
.sheet {
  width: 100%; max-width: 560px; max-height: 80vh; overflow-y: auto; background: var(--card); border-radius: 22px 22px 0 0; padding: 8px 18px calc(18px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .25s ease; box-shadow: 0 -8px 30px rgba(0,0,0,.15);
}
.sheet-back.show .sheet { transform: none; }
.sheet-grip { width: 40px; height: 5px; border-radius: 99px; background: var(--line); margin: 0 auto 10px; }
@media (min-width: 700px) {
  .sheet-back { align-items: center; }
  .sheet { border-radius: 22px; transform: translateY(20px); opacity: 0; transition: transform .2s, opacity .2s; }
  .sheet-back.show .sheet { opacity: 1; }
}
.word-pop { display: grid; gap: 10px; }
.wp-head { display: flex; align-items: center; justify-content: space-between; }
.wp-word { font-size: 1.6rem; font-weight: 800; }
.wp-lemma { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.wp-dict { font-weight: 600; color: var(--primary-2); }
.wp-dict::after { content: " —"; color: var(--muted); font-weight: 400; }
.wp-tr { font-size: 1.15rem; }
.wp-none { color: var(--muted); font-size: .9rem; }
.wp-cons { background: var(--accent-soft); border-radius: 12px; padding: 10px 12px; }
.wp-cons-kind { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.wp-cons-l { font-weight: 800; font-size: 1.1rem; }
.wp-cons-w { font-size: .82rem; color: var(--muted); }
.wp-sent { background: var(--soft); border-radius: 12px; padding: 10px 12px; display: grid; gap: 4px; justify-items: start; }
.wp-sent-de { font-size: 1.02rem; }
.wp-sent-ru { color: var(--muted); font-size: .92rem; }
.hl-main { background: var(--accent); border-radius: 4px; padding: 0 2px; color: #1c2733; }
.hl-cons { background: var(--accent-soft); box-shadow: inset 0 -2px var(--accent); border-radius: 3px; }

/* ---------- Словарь ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 8px 0 12px; }
.stat { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 12px; display: flex; flex-direction: column; }
.stat b { font-size: 1.4rem; }
.stat span { font-size: .8rem; color: var(--muted); }
.stat.accent b { color: var(--pl); } .stat.ok b { color: var(--ok); }
.stage-bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--soft); }
.sb-known { background: var(--ok); } .sb-familiar { background: #7fcfa6; } .sb-learning { background: var(--accent); } .sb-new { background: var(--line); }
.mode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.mode { font: inherit; text-align: left; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); border-radius: 14px; padding: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.mode span { font-size: .8rem; color: var(--muted); }
.mode.main { background: var(--primary); color: #fff; border-color: var(--primary); grid-column: 1 / -1; }
.mode.main span { color: rgba(255,255,255,.75); }
@media (prefers-color-scheme: dark) { .mode.main { color: #0f1720; } .mode.main span { color: rgba(0,0,0,.6); } }
.mode:disabled { opacity: .45; cursor: default; }
.search { width: 100%; font: inherit; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); margin-bottom: 10px; }
.wrow { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--card); border-radius: 12px; margin-bottom: 6px; box-shadow: var(--shadow); }
.wrow-main { flex: 1; min-width: 0; }
.wrow-de { font-weight: 700; }
.wrow-ru { font-size: .88rem; color: var(--muted); }
.wrow-side { display: flex; align-items: center; gap: 4px; }
.wrow-side .mbar { width: 40px; }
.badge { font-size: .7rem; padding: 2px 8px; border-radius: 99px; background: var(--soft); white-space: nowrap; }
.st-new { color: var(--muted); } .st-learning { background: var(--accent-soft); } .st-familiar { background: var(--n-soft); color: var(--n); } .st-known { background: var(--ok-soft); color: var(--ok); }
.st-missing { background: var(--bad-soft); color: var(--bad); }
.empty { text-align: center; padding: 40px 0; }
.empty-icon { font-size: 3rem; }
.trainer .practice-top .back { margin: 0; font-size: 1.2rem; }
.train-card { background: var(--card); border-radius: 22px; box-shadow: var(--shadow); padding: 22px 18px; margin-top: 12px; text-align: center; display: grid; gap: 12px; }
.tc-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.tc-de { font-size: 1.9rem; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.tc-ru { font-size: 1.1rem; }
.tc-ru.big { font-size: 1.5rem; font-weight: 700; }
.tc-hint, .tc-exru { font-size: .88rem; color: var(--muted); }
.tc-back { display: grid; gap: 8px; }
.tc-ex { background: var(--soft); border-radius: 12px; padding: 10px; }
.grade-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.gbtn { font: inherit; border: 0; border-radius: 12px; padding: 10px 4px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; font-size: .85rem; }
.gbtn span { font-size: .72rem; opacity: .75; }
.gbtn.again { background: var(--bad-soft); color: var(--bad); } .gbtn.hard { background: var(--pl-soft); color: var(--pl); }
.gbtn.good { background: var(--ok-soft); color: var(--ok); } .gbtn.easy { background: var(--m-soft); color: var(--m); }
.train-card .feedback { text-align: left; }
.train-card .next-row { justify-content: stretch; margin: 0; } .train-card .next-row .btn { width: 100%; }

/* ---------- Прогресс ---------- */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.day { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.day-bar { height: 90px; width: 100%; max-width: 28px; background: var(--soft); border-radius: 8px; display: flex; align-items: flex-end; overflow: hidden; }
.day-bar > div { width: 100%; background: var(--accent); border-radius: 8px; }
.day-bar > div.goal { background: var(--ok); }
.day-v { font-size: .72rem; color: var(--muted); min-height: 1em; }
.day-l { font-size: .75rem; }
.lvl-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.lvl-row .level-code { width: 38px; height: 38px; border-radius: 11px; font-size: .85rem; }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.ach { background: var(--card); border-radius: 14px; padding: 12px; box-shadow: var(--shadow); opacity: .45; filter: grayscale(1); }
.ach.got { opacity: 1; filter: none; }
.ach-icon { font-size: 1.6rem; }
.ach-title { font-weight: 700; font-size: .9rem; }
.ach-desc { font-size: .78rem; color: var(--muted); }
.settings { display: grid; gap: 12px; }
.settings .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.settings select { font: inherit; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.switch { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { width: 20px; height: 20px; accent-color: var(--primary-2); }

/* ---------- Админка ---------- */
.admin-settings { display: grid; gap: 12px; }
.admin-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.media-summary { font-weight: 600; margin: 8px 0; }
.media-lesson h3 { margin-top: 1.4em; }
.media-row { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 12px; margin-bottom: 8px; }
.only-missing .media-row.have { display: none; }
.mr-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .9rem; }
.mr-meta { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.mr-text { white-space: pre-wrap; font: .8rem/1.45 ui-monospace, Menlo, monospace; background: var(--soft); padding: 8px 10px; border-radius: 8px; margin: 6px 0; max-height: 220px; overflow: auto; }
.mr-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .78rem; }
.admin-table { font-size: .85rem; }
.admin-table tr.ready td { background: var(--ok-soft); }
.admin-table td.count { text-align: right; }
.warn { color: var(--bad); }

/* ---------- Тосты и умлауты ---------- */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: 90vw; }
.toast { transform: translateY(20px); opacity: 0; transition: all .3s; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: .92rem; box-shadow: var(--shadow); max-width: 90vw; text-align: center; }
.toast.show { transform: none; opacity: 1; }
.toast.ok { background: var(--ok); color: #fff; }
.toast.ach { background: linear-gradient(135deg, #f5b82e, #f39c34); color: #1c2733; font-weight: 700; }
.umlaut-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: none; justify-content: center; gap: 6px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -4px 12px rgba(0,0,0,.06); }
body.typing .umlaut-bar { display: flex; }
.umlaut-bar button { font: 600 1.05rem var(--font); min-width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--soft); color: var(--ink); cursor: pointer; }
body.typing .next-row.sticky { padding-bottom: 64px; }

@media (min-width: 760px) {
  .main { padding: 0 24px; }
  h1 { font-size: 2rem; }
  .theory { font-size: 1.02rem; }
}
