/* Layout: fixed left rail + scrolling workspace; exercises open as a focused full-screen sheet. */
:root {
  --bg: #0d1117;
  --rail: #0a0e14;
  --surface: #151b25;
  --surface-2: #1c2431;
  --surface-3: #242e3d;
  --line: #2a3445;
  --text: #e9edf4;
  --muted: #95a1b5;
  --faint: #66728a;
  --accent: #f6b73c; /* XP, streak, primary action */
  --accent-ink: #1b1405;
  --ok: #3fcf7c;
  --almost: #c8d94a;
  --close: #f29a48;
  --bad: #ff5d6c;
  --der: #5ab0ff;
  --die: #ff7eb0;
  --das: #4fd99a;
  --plu: #c4a1ff;
  --font-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --r: 14px;
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
button {
  font: inherit;
  color: inherit;
}
a {
  color: var(--der);
}
h1,
h2,
h3 {
  font-family: var(--font-display);
  text-wrap: balance;
  margin: 0;
  letter-spacing: -0.01em;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.tab {
  font-variant-numeric: tabular-nums;
}

/* ---------- shell ---------- */
.app {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100%;
}
.rail {
  background: var(--rail);
  border-right: 1px solid var(--line);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 20px;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font: 800 15px var(--font-display);
  color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), #ffd98a);
}
.brand b {
  font: 700 17px var(--font-display);
  display: block;
  line-height: 1.1;
}
.brand small {
  color: var(--muted);
  font-size: 12px;
}
.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  font-weight: 700;
  font-size: 15px;
}
.nav-btn:hover {
  background: var(--surface);
  color: var(--text);
}
.nav-btn.on {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: inset 3px 0 0 var(--accent);
}
.nav-btn svg {
  width: 20px;
  height: 20px;
  flex: none;
}
.rail-build {
  padding: 0 12px 10px 28px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--faint);
}
.rail-foot {
  margin-top: auto;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--faint);
  display: flex;
  align-items: center;
  gap: 8px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
  flex: none;
}
.dot.synced {
  background: var(--ok);
}
.dot.saving {
  background: var(--accent);
}
.dot.error {
  background: var(--bad);
}

.main {
  min-width: 0;
  padding-inline: clamp(16px, 4vw, 48px);
  padding-block: 22px 60px;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-bottom: 26px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 7px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
}
.chip svg {
  width: 18px;
  height: 18px;
}
.chip .k {
  color: var(--muted);
  font-weight: 400;
}
.wrap {
  max-width: 1060px;
  margin: 0 auto;
}
.page-h {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-h h1 {
  font-size: clamp(28px, 3.4vw, 40px);
}
.page-h p {
  margin: 6px 0 0;
  color: var(--muted);
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

/* ---------- buttons ---------- */
.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  background: var(--surface-3);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
.btn:hover {
  filter: brightness(1.12);
}
.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 4px 0 #b9821c;
}
.btn.primary:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #b9821c;
}
.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
}
.btn.small {
  padding: 7px 12px;
  font-size: 14px;
  border-radius: 10px;
}
.btn.big {
  padding: 16px 26px;
  font-size: 18px;
  border-radius: 14px;
}
.btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}
.btn:disabled {
  opacity: 0.45;
  cursor: default;
  filter: none;
}

/* ---------- today ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 18px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 22px;
  min-width: 0;
}
.start-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.start-card h2 {
  font-size: 30px;
}
.start-card .sub {
  color: var(--muted);
  margin: 0;
}
.agenda {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
/* v9.11: Today — a box for Vocabulary and one for Grammar */
.start-pair {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.start-boxes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.start-boxes .start-card h2 {
  font-size: 26px;
}
.start-boxes .btn {
  white-space: nowrap;
}
.hero:has(.start-pair) {
  grid-template-columns: 2.2fr 1fr;
}
.agenda.two {
  grid-template-columns: 1fr 1fr;
}
/* v9.12.2: the review state of the word(s) after the answer, under the title of the feedback */
.state-lines {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 15px;
}
.agenda div {
  background: var(--surface-2);
  border-radius: 12px;
  padding: 12px 14px;
}
.agenda b {
  display: block;
  font: 800 26px var(--font-display);
}
.agenda span {
  color: var(--muted);
  font-size: 13px;
}
.ring-box {
  display: flex;
  align-items: center;
  gap: 18px;
}
.ring {
  width: 118px;
  height: 118px;
  flex: none;
}
.ring text {
  fill: var(--text);
  font: 800 26px var(--font-display);
}
.ring .sub {
  fill: var(--muted);
  font: 600 12px var(--font-body);
}
.week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 14px;
}
.week div {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
.week i {
  display: block;
  height: 30px;
  border-radius: 8px;
  background: var(--surface-2);
  margin-bottom: 4px;
}
.week i.part {
  background: color-mix(in srgb, var(--accent) 35%, var(--surface-2));
}
.week i.full {
  background: var(--accent);
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}
.quick {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.next-lesson {
  display: flex;
  gap: 16px;
  align-items: center;
}
.unit-badge {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font: 800 18px var(--font-display);
  background: var(--surface-3);
  flex: none;
}

/* ---------- path ---------- */
.level-h {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 30px 0 14px;
}
.level-h h2 {
  font-size: 22px;
}
.path {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}
.unit {
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r);
  padding: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.unit:hover {
  border-color: var(--faint);
}
.unit.next {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.unit .num {
  font: 800 13px var(--font-mono);
  color: var(--muted);
}
.unit h3 {
  font-size: 19px;
}
.unit p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.crowns {
  display: flex;
  gap: 3px;
}
.crowns i {
  width: 16px;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-3);
}
.crowns i.on {
  background: var(--accent);
}
.bar {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-3);
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  background: var(--ok);
}
.unit-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  gap: 8px;
}
.tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
}
/* the level of a word in the dictionary (A1.1 … C2), v9.7 */
.tag.cefr {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}
.tag.done {
  background: color-mix(in srgb, var(--ok) 20%, transparent);
  color: var(--ok);
}
.tag.go {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--accent);
}
.tag.aux {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--faint);
} /* v8.2: auxiliary words */

/* ---------- unit page / rules ---------- */
.rules h3 {
  font-size: 18px;
  margin: 22px 0 10px;
}
.rules h3:first-child {
  margin-top: 0;
}
.rules p {
  margin: 10px 0;
  max-width: 70ch;
}
.tbl {
  overflow-x: auto;
  margin: 10px 0;
}
table.rt {
  border-collapse: collapse;
  width: 100%;
  font-size: 15px;
}
.rt th,
.rt td {
  border: 1px solid var(--line);
  padding: 7px 10px;
  text-align: left;
  vertical-align: top;
}
.rt th {
  background: var(--surface-2);
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
}
.rt td:first-child {
  color: var(--muted);
}
.rt b {
  color: var(--accent);
}
.ausn {
  margin-top: 16px;
  border: 1px solid var(--close);
  border-radius: 12px;
  padding: 4px 16px 8px;
  background: var(--surface-2);
}
.ausn h3 {
  margin: 10px 0 6px;
  color: var(--close);
}
.ausn ul {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
}
.tip {
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  border-radius: 0 10px 10px 0;
  color: var(--text);
}
.ex {
  font-style: italic;
  color: #cfd7e4;
}
.x {
  color: var(--close);
}
s {
  color: var(--bad);
}
.m,
th.m,
td.m {
  color: var(--der);
}
.f,
th.f,
td.f {
  color: var(--die);
}
.n,
th.n,
td.n {
  color: var(--das);
}
.pl,
th.pl,
td.pl {
  color: var(--plu);
}
.skill-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.skill-row:last-child {
  border-bottom: 0;
}
.skill-row .nm {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: 15px;
}
.skill-row .acc {
  font-size: 12px;
  color: var(--muted);
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ---------- vocab list ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}
.input,
select.input {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 12px;
  font: inherit;
}
.seg {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.seg button {
  border: 0;
  background: none;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
}
.seg button.on {
  background: var(--surface-3);
  color: var(--text);
}
.vlist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}
.vcard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-width: 0;
}
.vcard .w {
  font-weight: 700;
}
.vcard .t {
  color: var(--muted);
  font-size: 13px;
}
.vcard .st {
  margin-left: auto;
  flex: none;
}
.art-der {
  color: var(--der);
}
.art-die {
  color: var(--die);
}
.art-das {
  color: var(--das);
}
.art-pl {
  color: var(--plu);
}
.icon-btn {
  border: 0;
  background: var(--surface-2);
  width: 32px;
  height: 32px;
  border-radius: 9px;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex: none;
}
.icon-btn svg {
  width: 16px;
  height: 16px;
}

/* ---------- stats ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
}
.kpi b {
  font: 800 30px var(--font-display);
  display: block;
}
.kpi span {
  color: var(--muted);
  font-size: 13px;
}
.chart {
  width: 100%;
  height: auto;
  display: block;
}
.chart text {
  fill: var(--muted);
  font: 11px var(--font-body);
}
.heat rect {
  rx: 3;
}
.err-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.err {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
}
.err .q {
  color: var(--muted);
}

/* ---------- settings ---------- */
.form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

/* ---------- runner (exercise sheet) ---------- */
.runner {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 50;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding-top: env(safe-area-inset-top, 0px);
}
.r-top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 40px);
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
}
.r-close {
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
}
.r-close svg {
  width: 22px;
  height: 22px;
}
.r-prog {
  flex: 1;
  height: 14px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.r-prog i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--ok), #8be6a9);
  border-radius: 999px;
  transition: width 0.35s ease;
}
.r-xp {
  font: 800 15px var(--font-display);
  color: var(--accent);
  min-width: 64px;
  text-align: right;
}
.r-body {
  overflow-y: auto;
  padding: 10px clamp(16px, 4vw, 40px) 24px;
}
.r-card {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-top: 3vh;
}
.r-skill {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.r-instr {
  font: 700 22px var(--font-display);
}
.r-prompt {
  font-size: 26px;
  line-height: 1.6;
  font-weight: 700;
}
.r-prompt.small {
  font-size: 20px;
}
.r-sub {
  color: var(--muted);
}
.r-hint {
  color: var(--muted);
  font-size: 18px;
  font-weight: 400;
}
.sent {
  font-size: 25px;
  line-height: 2.1;
  font-weight: 600;
}
.gap-in {
  font: 700 23px var(--font-body);
  color: var(--text);
  background: var(--surface);
  border: 0;
  border-bottom: 3px solid var(--faint);
  border-radius: 8px 8px 2px 2px;
  padding: 2px 8px;
  margin: 0 2px;
  min-width: 3ch;
  text-align: center;
}
.gap-in:focus {
  outline: none;
  border-bottom-color: var(--accent);
  background: var(--surface-2);
}
.gap-in.ok {
  border-bottom-color: var(--ok);
  color: var(--ok);
}
.gap-in.almost {
  border-bottom-color: var(--almost);
  color: var(--almost);
}
.gap-in.close {
  border-bottom-color: var(--close);
  color: var(--close);
}
.gap-in.wrong {
  border-bottom-color: var(--bad);
  color: var(--bad);
}
.big-in {
  width: 100%;
  font: 600 22px var(--font-body);
  background: var(--surface);
  border: 2px solid var(--line);
  color: var(--text);
  border-radius: 14px;
  padding: 14px 16px;
  resize: vertical;
}
.big-in:focus {
  outline: none;
  border-color: var(--accent);
}
.big-in.ok {
  border-color: var(--ok);
}
.big-in.almost {
  border-color: var(--almost);
}
.big-in.close {
  border-color: var(--close);
}
.big-in.wrong {
  border-color: var(--bad);
}
.fields {
  display: grid;
  gap: 12px;
}
.fields label {
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
}
.uml {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.uml button {
  width: 40px;
  height: 38px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  font-weight: 700;
  font-size: 17px;
}
.uml button:hover {
  background: var(--surface-2);
}
.audio-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.play {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  border: 0;
  background: var(--der);
  color: #04121f;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 0 #2f7dc3;
}
.play.slow {
  width: 48px;
  height: 48px;
  background: var(--surface-3);
  color: var(--text);
  box-shadow: none;
  border-radius: 14px;
}
.play svg {
  width: 28px;
  height: 28px;
}
.word-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.word-card .de {
  font: 800 40px var(--font-display);
}
.word-card .tr {
  color: var(--muted);
  font-size: 18px;
}
.word-card .info {
  font-size: 15px;
  color: #cfd7e4;
}
.new-badge {
  align-self: flex-start;
  background: color-mix(in srgb, var(--plu) 22%, transparent);
  color: var(--plu);
}

.r-foot {
  border-top: 1px solid var(--line);
  background: var(--rail);
  padding: 16px clamp(16px, 4vw, 40px) calc(16px + env(safe-area-inset-bottom, 0px));
}
.r-foot.ok {
  background: color-mix(in srgb, var(--ok) 13%, var(--rail));
  border-top-color: color-mix(in srgb, var(--ok) 45%, transparent);
}
.r-foot.almost {
  background: color-mix(in srgb, var(--almost) 12%, var(--rail));
  border-top-color: color-mix(in srgb, var(--almost) 45%, transparent);
}
.r-foot.close {
  background: color-mix(in srgb, var(--close) 12%, var(--rail));
  border-top-color: color-mix(in srgb, var(--close) 45%, transparent);
}
.r-foot.wrong {
  background: color-mix(in srgb, var(--bad) 12%, var(--rail));
  border-top-color: color-mix(in srgb, var(--bad) 45%, transparent);
}
.r-foot-in {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
}
.fb {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fb h3 {
  font-size: 22px;
}
.fb.ok h3 {
  color: var(--ok);
}
.fb.almost h3 {
  color: var(--almost);
}
.fb.close h3 {
  color: var(--close);
}
.fb.wrong h3 {
  color: var(--bad);
}
.fb .line {
  font-size: 16px;
}
.fb .lbl {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin-right: 6px;
}
.fb .ans {
  font-family: var(--font-mono);
  font-size: 16px;
}
.fb del {
  color: var(--bad);
  text-decoration: line-through;
  background: color-mix(in srgb, var(--bad) 18%, transparent);
  border-radius: 3px;
}
.fb ins {
  color: var(--ok);
  text-decoration: none;
  background: color-mix(in srgb, var(--ok) 18%, transparent);
  border-radius: 3px;
}
.fb mark {
  background: color-mix(in srgb, var(--close) 30%, transparent);
  color: var(--text);
  border-radius: 3px;
}
.fb .note {
  color: #d8dfeb;
}
.fb .explain {
  color: var(--muted);
  font-size: 15px;
  border-left: 3px solid var(--line);
  padding-left: 10px;
}
.fb-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.report {
  display: flex;
  gap: 8px;
  width: 100%;
}
.report input {
  flex: 1;
}
.kbd {
  font: 600 11px var(--font-mono);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
  margin-left: 6px;
}

.summary {
  max-width: 700px;
  margin: 6vh auto 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  text-align: center;
  align-items: center;
}
.summary h2 {
  font-size: 36px;
}
.sum-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
}
.sum-kpis div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}
.sum-kpis b {
  font: 800 30px var(--font-display);
  display: block;
}
.sum-kpis span {
  color: var(--muted);
  font-size: 13px;
}
.mistakes {
  width: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-3);
  border: 1px solid var(--line);
  padding: 10px 16px;
  border-radius: 12px;
  z-index: 80;
  font-weight: 700;
}
.banner {
  background: color-mix(in srgb, var(--close) 16%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--close) 40%, transparent);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 14px;
}
.empty {
  color: var(--muted);
  padding: 24px;
  text-align: center;
}

@media (max-width: 900px) {
  .hero,
  .hero:has(.start-pair),
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .kpis {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 720px) {
  .app {
    grid-template-columns: 1fr;
  }
  .rail {
    position: fixed;
    bottom: 0;
    top: auto;
    height: auto;
    width: 100%;
    flex-direction: row;
    z-index: 40;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    border-right: 0;
    border-top: 1px solid var(--line);
    justify-content: space-around;
  }
  .brand,
  .rail-foot,
  .nav-btn span {
    display: none;
  }
  .nav-btn {
    padding: 10px;
  }
  .main {
    padding-bottom: 90px;
  }
  .agenda {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .sent {
    font-size: 21px;
  }
  .r-prompt {
    font-size: 21px;
  }
  .sum-kpis {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .r-foot-in {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .r-foot .btn.big {
    width: 100%;
  }
  .r-foot .kbd {
    display: none;
  }
  .word-card .de {
    font-size: 32px;
  }
  .page-h h1 {
    font-size: 28px;
  }
  .topbar {
    justify-content: flex-start;
    gap: 8px;
  }
  .chip {
    padding: 6px 10px;
    font-size: 13px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* ---------- v2: glossary, why-lines, rules sheet, table drills ---------- */
.gl .w {
  cursor: help;
  border-radius: 4px;
}
.gl .w:hover {
  background: color-mix(in srgb, var(--der) 16%, transparent);
  box-shadow: 0 2px 0 color-mix(in srgb, var(--der) 55%, transparent);
}
.gloss-pop {
  position: fixed;
  z-index: 90;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  max-width: 300px;
  font-size: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.gloss-pop .t {
  color: var(--muted);
}
.gloss-pop .hint {
  font-size: 11px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
mark.hl {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
  color: var(--text);
  border-radius: 6px;
  padding: 0 4px;
  box-shadow: 0 2px 0 var(--accent);
}
.fb .why {
  font-size: 17px;
  line-height: 1.45;
  color: var(--text);
  background: color-mix(in srgb, var(--surface-3) 70%, transparent);
  border-radius: 10px;
  padding: 8px 12px;
}
.fb .why b {
  color: var(--accent);
}
.fb .why.sub {
  font-size: 15px;
}
.why-more {
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.45;
}
.why-more b {
  color: var(--text);
}
.err .why-more {
  margin-top: 6px;
}
.explain-d summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
}
.explain-d[open] summary {
  margin-bottom: 4px;
}
.tag.warn {
  background: color-mix(in srgb, var(--close) 22%, transparent);
  color: var(--close);
}
.tag-btn {
  border: 1px solid var(--line);
  cursor: pointer;
  background: transparent;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.tag-btn:hover {
  color: var(--text);
  border-color: var(--faint);
}
.sheet {
  position: fixed;
  inset: 0;
  z-index: 85;
  background: rgba(5, 8, 12, 0.72);
  display: grid;
  place-items: center;
  padding: 16px;
}
.sheet-in {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  max-width: 860px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 22px;
}
.sheet-h {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.drill {
  margin: 0;
}
.drill-t {
  width: auto;
  min-width: 60%;
}
.drill-t th:first-child {
  color: var(--accent);
  text-transform: none;
}
.drill-t td {
  vertical-align: middle;
  font-size: 18px;
  font-weight: 600;
  color: var(--text) !important;
}
.drill-t td.rl {
  color: var(--muted) !important;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}
.drill-t .gap-in {
  font-size: 18px;
  margin: 0;
  min-width: 6ch;
}
/* the country table (Land · Sprachen · Nationalität ♂ ♀): many columns, smaller boxes (v9.5.2) */
/* … and it may use more than the exercise column: up to the screen width (the boxes show the whole word) */
.drill-wide {
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: min(1200px, calc(100vw - 32px));
}
.drill-wide table {
  width: auto;
  margin: 0 auto;
}
.drill-c th,
.drill-c td {
  padding: 6px 4px;
}
.drill-c .gap-in {
  font-size: 15px;
  padding: 2px 4px;
  min-width: 4ch;
}
.cat-h {
  font: 700 12px var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 14px 0 2px;
}
.tabs {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}
.tabs button {
  border: 0;
  background: none;
  padding: 10px 16px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 700;
}
.tabs button.on {
  background: var(--surface-3);
  color: var(--text);
}
.mt h3 {
  font-size: 20px;
  margin-bottom: 4px;
}
.mt .r-sub {
  font-size: 14px;
  margin: 0 0 10px;
}
.rt td.gen,
.rt th.gen {
  opacity: 0.38;
}
.rt .end {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
}
.rt td.st {
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}
@media (max-width: 720px) {
  .drill-t td {
    font-size: 16px;
  }
  .drill-t .gap-in {
    font-size: 16px;
    min-width: 5ch;
  }
}
.fb > .btn {
  align-self: flex-start;
}
.rt .sub2 {
  font-size: 13px;
  color: var(--muted);
  font-weight: 400;
  margin-top: 2px;
}
.cell-fix {
  display: inline-block;
  margin-left: 6px;
  color: var(--ok);
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 16px;
}

/* ---------- v3: meaning, notes, resume, gender hints ---------- */
.pt {
  color: var(--faint);
  font-size: 0.82em;
  font-weight: 400;
}
.hint.g,
.info.g {
  color: #cfd7e4;
  font-size: 14px;
  text-transform: none;
  letter-spacing: 0;
}
.gloss-pop .hint.g {
  font-size: 13px;
  color: var(--muted);
}
.info.g::before,
.hint.g::before {
  content: "◆ ";
  color: var(--accent);
  font-size: 0.8em;
}
.ex-line {
  color: var(--text);
}
.ex-line .t,
.ex-line span:last-child {
  color: var(--muted);
}
.r-note {
  margin-left: auto;
}
.remind {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}
.remind .r-prompt {
  font-size: 26px;
}
.r-sub.ex-line b {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text);
}
.meaning {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 15px;
  color: #d8dfeb;
  border-top: 1px dashed var(--line);
  padding-top: 8px;
  margin-top: 2px;
}
.meaning .lbl {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin-right: 6px;
}
.tr-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.tr-out {
  color: var(--text);
  font-style: italic;
  min-width: 0;
}
.empty-hint {
  color: var(--close);
  font-size: 14px;
}
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}
.shake {
  animation: shake 0.3s ease;
  border-color: var(--close) !important;
}
.note-ta {
  width: 100%;
  resize: vertical;
  min-height: 90px;
  font: 15px/1.5 var(--font-body);
}
.sheet-in.small {
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.resume {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  margin-bottom: 18px;
}
.et-row {
  display: grid;
  grid-template-columns: minmax(110px, 180px) 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 5px 0;
  font-size: 15px;
}
.et-row .nm {
  font-weight: 700;
  min-width: 0;
}
.bar.et i {
  background: var(--close);
}
@media (max-width: 560px) {
  .et-row {
    grid-template-columns: 1fr auto;
  }
  .et-row .bar,
  .et-row .r-sub {
    grid-column: 1 / -1;
  }
}

/* ---------- v4: Reading (Lesen) ---------- */
.rd-next {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}
.rd-next h2 {
  font-size: 26px;
  margin: 4px 0 2px;
}
.rd-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.rd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.rd-card {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  color: var(--text);
  font: inherit;
}
.rd-card:hover {
  border-color: var(--faint);
  background: var(--surface-2);
}
.rd-card b {
  font: 700 18px var(--font-display);
}
.rd-card .r-sub {
  font-size: 14px;
}
.rd-card.later {
  opacity: 0.7;
}
.rd-card-h,
.rd-card-f {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: space-between;
}
.rd-card-f {
  justify-content: flex-start;
  margin-top: 6px;
  font-size: 14px;
  /* v9.12.3: the topic stays next to the status (wraps inside its own box, never drops to a line of its own) */
  flex-wrap: nowrap;
  align-items: baseline;
}
.rd-card-f .rd-st {
  flex: none;
}
.rd-card-f .r-sub {
  flex: 1;
  min-width: 0;
}
.rd-st {
  font-weight: 700;
  font-size: 14px;
}
.rd-st.new {
  color: var(--accent);
}
.rd-st.cur {
  color: var(--der);
}
.rd-st.good {
  color: var(--ok);
}
.rd-st.ok {
  color: var(--almost);
}
.rd-st.bad {
  color: var(--close);
}
.rd-today {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.rd-today h3 {
  font-size: 20px;
  margin: 4px 0 2px;
}

.reader .r-top.rd-top {
  max-width: 1240px;
  flex-wrap: wrap;
  row-gap: 8px;
}
.rd-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  line-height: 1.25;
}
.rd-title b {
  font: 700 17px var(--font-display);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rd-title .r-sub {
  font-size: 13px;
}
.rd-steps {
  display: flex;
  gap: 6px;
}
.rd-steps span {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--faint);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.rd-steps span.on {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--accent);
  border-color: transparent;
}
.rd-steps span.done {
  color: var(--ok);
}
.reader .r-foot-in {
  max-width: 1240px;
  align-items: center;
}
.rd-foot-l {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1;
}
.rd-foot-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.rd-wrap {
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.rd-text {
  position: sticky;
  top: 0;
  max-height: calc(100vh - 190px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rd-sit {
  color: var(--muted);
  font-size: 14px;
  font-style: italic;
}
.rd-sit .tag {
  font-style: normal;
  margin-right: 4px;
}
.rd-text .play {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  box-shadow: 0 3px 0 #2f7dc3;
}
.rd-text .play.slow {
  width: 40px;
  height: 40px;
  box-shadow: none;
}
.rd-text .play svg {
  width: 22px;
  height: 22px;
}
.rd-doc {
  font-size: 18px;
  line-height: 1.75;
  color: var(--text);
  background: color-mix(in srgb, var(--bg) 55%, var(--surface));
  border-radius: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line);
}
.rd-doc p {
  margin: 0 0 12px;
}
.rd-doc p:last-child {
  margin: 0;
}
.rd-doc.rd-notice,
.rd-doc.rd-schedule,
.rd-doc.rd-ad,
.rd-doc.rd-web {
  border-left: 4px solid var(--accent);
}
.rd-doc.rd-chat p {
  background: var(--surface-2);
  border-radius: 12px 12px 12px 4px;
  padding: 8px 12px;
  width: fit-content;
  max-width: 100%;
}
.rd-doc .w {
  cursor: pointer;
  border-bottom: 1px dotted color-mix(in srgb, var(--faint) 70%, transparent);
}
.rd-doc .w:hover {
  background: var(--surface-3);
  border-radius: 3px;
}
mark.rd-where {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
  color: var(--text);
  border-radius: 4px;
  padding: 1px 2px;
}
.rd-en summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
}
.rd-en p {
  color: var(--muted);
  font-size: 15px;
  margin: 8px 0 0;
}
.rd-task {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding-bottom: 20px;
}
.rd-h {
  font-size: 24px;
}
.rd-instr {
  margin: 4px 0 8px;
  color: #d8dfeb;
  font-size: 16px;
}
.rd-q {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.rd-q.ok {
  border-color: color-mix(in srgb, var(--ok) 50%, var(--line));
}
.rd-q.bad {
  border-color: color-mix(in srgb, var(--bad) 50%, var(--line));
}
.rd-q-h {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 18px;
  font-weight: 700;
}
.rd-n {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-3);
  display: inline-grid;
  place-items: center;
  font-size: 13px;
  flex: none;
}
.rd-qt {
  min-width: 0;
}
.rd-qt .w {
  cursor: pointer;
}
.rd-en-btn {
  border: 1px solid var(--line);
  background: none;
  color: var(--faint);
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  padding: 1px 6px;
  cursor: pointer;
}
.rd-qen {
  font-size: 14px;
  font-weight: 400;
}
.rd-in {
  width: 100%;
  font: 600 18px var(--font-body);
  background: var(--bg);
  border: 2px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 12px;
}
.rd-in:focus {
  outline: none;
  border-color: var(--accent);
}
.rd-in.ok {
  border-color: var(--ok);
}
.rd-in.wrong {
  border-color: var(--bad);
}
.rd-res {
  font-size: 15px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rd-res .lbl {
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}
.rd-res-a {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.okc {
  color: var(--ok);
}
.badc {
  color: var(--bad);
}
.rd-cloze {
  font-size: 18px;
  line-height: 2.5;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 18px;
}
.rd-cloze .gap-in {
  font-size: 17px;
  padding: 1px 6px;
}
.rd-gap {
  white-space: nowrap;
}
.rd-gap sup {
  color: var(--faint);
  font-size: 11px;
  margin-right: 1px;
}
.rd-hint {
  font-size: 14px;
}
.rd-cloze .cell-fix {
  font-size: 15px;
}
.rd-why-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rd-why-list .why {
  font-size: 16px;
  line-height: 1.45;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 8px 12px;
}
.rd-why-list .lbl {
  color: var(--muted);
  font-weight: 700;
}
.rd-you {
  color: var(--bad);
  text-decoration: line-through;
}
.why-sub {
  color: var(--muted);
  font-size: 14px;
  margin-top: 3px;
}
.why-sub b {
  color: var(--accent);
}
.rd-pts {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rd-pts li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 15px;
}
.rd-pts li.ok {
  border-color: color-mix(in srgb, var(--ok) 50%, var(--line));
}
.rd-pts li.bad {
  border-color: color-mix(in srgb, var(--bad) 50%, var(--line));
}
.rd-pt-m {
  font-weight: 800;
  width: 14px;
  flex: none;
  color: var(--muted);
}
.rd-pts li.ok .rd-pt-m {
  color: var(--ok);
}
.rd-pts li.bad .rd-pt-m {
  color: var(--bad);
}
.rd-ta {
  font-size: 18px;
  min-height: 150px;
  line-height: 1.5;
}
.rd-ta-f {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.rd-msg {
  font-size: 14px;
  color: var(--muted);
}
.rd-msg.err {
  color: var(--close);
}
.rd-msg.wait {
  color: var(--der);
}
.rd-fb {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rd-mytext,
.rd-model,
.rd-corr {
  font-size: 17px;
  line-height: 1.7;
  margin: 0;
}
.rd-model {
  color: #d8dfeb;
}
.rd-corr ins {
  color: var(--ok);
  text-decoration: none;
  background: color-mix(in srgb, var(--ok) 16%, transparent);
  border-radius: 3px;
  padding: 0 2px;
}
mark.rd-err {
  background: color-mix(in srgb, var(--bad) 20%, transparent);
  color: var(--text);
  border-bottom: 2px solid var(--bad);
  border-radius: 3px;
  padding: 0 2px;
}
mark.rd-err::after {
  content: attr(data-n);
  font-size: 10px;
  font-weight: 800;
  color: var(--bad);
  vertical-align: super;
  margin-left: 2px;
}
.rd-errs {
  margin: 0;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 15px;
}
.rd-errs .tag {
  margin-right: 2px;
}
.rd-sum {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.rd-sum h2 {
  font-size: 56px;
}
.rd-sum .sum-kpis {
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 900px) {
  .rd-wrap {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }
  .rd-text {
    position: static;
    max-height: none;
  }
  .rd-steps {
    order: 5;
    width: 100%;
  }
  .rd-sum .sum-kpis {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---------- v5 ---------- */
.grid-2.eq {
  align-items: stretch;
}
.panel.full {
  margin-top: 18px;
}
.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  column-gap: 32px;
  row-gap: 8px;
  margin-top: 8px;
}
.two-col > .skill-row {
  border-bottom: 1px solid var(--line);
}
.et-cols .et-row.t2 {
  grid-template-columns: minmax(110px, 1fr) auto;
}
.fc {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  align-items: end;
  height: 120px;
  margin-top: 12px;
}
.fc > div {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
.fc .n {
  color: var(--text);
  font-weight: 700;
}
.fc .b {
  background: var(--der);
  border-radius: 6px;
  margin: 4px 0;
}
.big-n {
  font: 800 34px var(--font-display);
  margin-top: 8px;
}
.lp-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}
.lp-row {
  display: grid;
  grid-template-columns: minmax(120px, 160px) 1fr auto;
  gap: 12px;
  align-items: center;
  font-size: 14px;
}
.lp-row .nm {
  color: var(--muted);
}
.lvsegs,
.mchip .segs {
  display: inline-flex;
  gap: 2px;
}
.lvsegs i,
.mchip .segs i {
  width: 7px; /* v9.3: 9 segments (levels 0–9) in about the width of the old 4 */
  height: 6px;
  border-radius: 3px;
  background: var(--surface-3);
  display: block;
}
.lvsegs i.on,
.mchip .segs i.on {
  background: var(--ok);
}
.wr-lv {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.acc-item > summary {
  cursor: pointer;
  list-style: none;
}
.acc-item > summary::-webkit-details-marker {
  display: none;
}
.acc-sum {
  display: flex;
  gap: 12px;
  align-items: baseline;
  flex-wrap: wrap;
}
.acc-sum .num {
  font: 800 13px var(--font-mono);
  color: var(--muted);
}
.acc-sum h3 {
  font-size: 20px;
  flex: 1;
  min-width: 0;
}
.acc-sum .r-sub {
  font-size: 14px;
}
.acc-sum::after {
  content: "▸";
  color: var(--faint);
  margin-left: 4px;
  transition: transform 0.15s;
}
.acc-item[open] > .acc-sum::after {
  transform: rotate(90deg);
}
.err.done {
  opacity: 0.75;
}
.err .reply {
  margin-top: 6px;
  color: #cfd7e4;
  border-left: 3px solid var(--ok);
  padding-left: 8px;
}
.r-count {
  color: var(--text);
  font-weight: 800;
  margin-right: 4px;
}
.r-mute {
  white-space: nowrap;
}
.r-mute.on {
  border-color: var(--close);
  color: var(--close);
}
.r-mastery-row {
  max-width: 820px;
  margin: 0 auto 6px;
  display: flex;
  justify-content: flex-end;
  min-height: 28px;
}
.mchip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
}
.mchip .lbl {
  color: var(--muted);
  font-weight: 700;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* v9.12.1: the buttons of a question on one line, as high as Check (left: I don't know, Skip · right: Check) */
.r-foot-in.ask {
  align-items: center;
}
.fb-row {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.hint-box {
  margin-top: 14px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 15px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
@media (max-width: 700px) {
  .r-mute {
    font-size: 12px;
    padding: 6px 8px;
  }
  .lp-row {
    grid-template-columns: 1fr auto;
  }
  .lp-row .bar {
    grid-column: 1 / -1;
  }
}
@media (max-width: 560px) {
  .r-top {
    gap: 8px;
  }
  .r-top .btn.small {
    font-size: 12px;
    padding: 6px 8px;
  }
  .r-top .r-xp {
    font-size: 13px;
    text-align: right;
  }
}

/* ---------- v6 ---------- */
.vlist.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 1000px) {
  .vlist.three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 620px) {
  .vlist.three {
    grid-template-columns: minmax(0, 1fr);
  }
}
.btn.primary.alt {
  background: var(--der);
  color: #04121f;
  box-shadow: 0 4px 0 #2f7dc3;
}
.btn.primary.alt:active {
  box-shadow: 0 2px 0 #2f7dc3;
}
.lesson-start {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.lesson-start .lp-rows {
  margin-top: 10px;
  max-width: 520px;
}

/* ---------- words: compact box + dictionary popup ---------- */
.vcard.compact {
  align-items: center;
  cursor: pointer;
}
.vcard.compact .w {
  font-size: 17px;
  overflow-wrap: anywhere;
}
.vcard.compact:hover,
.vcard.clickable:hover {
  border-color: var(--faint);
  background: var(--surface-2);
}
.vcard.clickable {
  cursor: pointer;
}
.vcard.compact .wr-lv {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.sheet-in.wp {
  max-width: 620px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.wp-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  position: relative;
  padding-right: 48px;
}
.wp-head .play {
  width: 52px;
  height: 52px;
  border-radius: 15px;
}
.wp-head .play.slow {
  width: 42px;
  height: 42px;
}
.wp-word {
  font: 800 30px var(--font-display);
  flex: 1 0 auto;
  max-width: 100%;
  min-width: 0;
} /* v8.2: a long word (der · die · das) goes to its own line instead of one word per line */
.wp-x {
  position: absolute;
  top: 0;
  right: 0;
} /* v8.2: always top right, also when the word wraps */
.wp-sec {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.wp-def {
  margin: 0;
  font-size: 18px;
  line-height: 1.6;
}
.wp-def .w,
.wp-ex .w {
  cursor: pointer;
  border-bottom: 1px dotted color-mix(in srgb, var(--faint) 70%, transparent);
}
.wp-forms {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  font-size: 17px;
}
.wp-forms .lbl {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
  font-weight: 700;
}
.wp-ex {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 17px;
}
.wp-trbtn {
  align-self: flex-start;
  border: 1px dashed var(--line);
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 10px;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
}
.wp-trbtn::before {
  content: "▸ ";
}
.wp-trbtn.on::before {
  content: "▾ ";
}
.wp-trbtn.on {
  color: var(--text);
  border-style: solid;
}
.wp-tr {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 16px;
}
.wp-tr .lbl {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

/* ---- v6.3: clickable lesson rows on Today, grammar daily max ---- */
button.lp-row.link {
  width: 100%;
  background: none;
  border: 0;
  padding: 4px 6px;
  margin: -4px -6px;
  border-radius: 8px;
  color: inherit;
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  box-sizing: content-box;
}
button.lp-row.link:hover,
button.lp-row.link:focus-visible {
  background: var(--surface-2);
}
button.lp-row.link .nm {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-underline-offset: 3px;
}
.mchip .cap {
  color: var(--accent);
}
.wp-note {
  margin: -6px 0 0;
  font-size: 14px;
}
.wp-alts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: -6px;
}

/* ---- v7.0: two paths on Today ---- */
.tracks {
  display: grid;
  gap: 16px;
  margin-top: 12px;
}
.track {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.track + .track {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.track .next-lesson h3 {
  margin: 2px 0;
}
.unit-badge.v {
  background: color-mix(in srgb, var(--accent) 22%, var(--surface-2));
  color: var(--text);
}
.unit-badge.g {
  background: color-mix(in srgb, var(--der) 22%, var(--surface-2));
  color: var(--text);
}

/* v9.0: dictionary popup — level per use ("Grammatik") */
.wp-gram {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px 18px;
}
/* v9.12.3: the name of the use is never covered by the dots */
.wp-gram-row .lvsegs {
  flex: none;
}
.wp-gram-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.wp-gram-row .lbl {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 14px;
}
.wp-gram-row b {
  font-size: 13px;
}

/* ================================================================================================================
   v9.13: phone (S23: 360 px wide; also lying down, ~780 px). Only below 800 px — the computer stays as it is.
   ================================================================================================================ */
.phone-only {
  display: none;
}
@media (max-width: 800px) {
  /* 1 · the bottom bar: low, all 10 buttons on the screen; save status and version are at the end of Settings */
  .app {
    grid-template-columns: 1fr;
  }
  .rail {
    position: fixed;
    inset: auto 0 0 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    width: 100%;
    flex-direction: row;
    align-items: stretch;
    gap: 0;
    z-index: 40;
    padding: 0 2px env(safe-area-inset-bottom, 0px);
    border-right: 0;
    border-top: 1px solid var(--line);
  }
  .brand,
  .rail-foot,
  .rail-build,
  .nav-btn span {
    display: none;
  }
  .nav-btn {
    flex: 1;
    min-width: 0;
    justify-content: center;
    padding: 0;
    border-radius: 0;
  }
  .nav-btn.on {
    box-shadow: inset 0 -3px 0 var(--accent);
  }
  /* typing (the keyboard is open): the bar stays down, behind the keyboard — it does not come up over it */
  body:has(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus, textarea:focus, select:focus)
    .rail {
    display: none;
  }
  .phone-only {
    display: block;
  }
  .rail-build-m {
    margin: 22px 4px 0;
    font-size: 12px;
    line-height: 1.6;
    color: var(--faint);
  }
  .rail-build-m .rail-foot {
    display: flex;
    margin: 0;
    padding: 0;
  }
  .main {
    padding: 14px 14px 76px;
  }
  .topbar {
    justify-content: flex-start;
    gap: 8px;
    margin-bottom: 16px;
  }
  .chip {
    padding: 5px 10px;
    font-size: 13px;
  }

  /* 2 · sizes for a phone */
  .btn.big {
    padding: 11px 18px;
    font-size: 16px;
    border-radius: 12px;
  }
  .page-h {
    margin-bottom: 16px;
  }
  .page-h h1 {
    font-size: 26px;
  }
  .panel {
    padding: 16px;
  }

  /* 3 · Today: the two boxes one under the other; "Where you are" compact */
  .hero,
  .hero:has(.start-pair),
  .start-boxes {
    grid-template-columns: 1fr;
  }
  .start-boxes .btn {
    width: 100%;
  }
  .next-lesson {
    gap: 10px;
  }
  .unit-badge {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 15px;
  }
  .track .next-lesson h3 {
    font-size: 17px;
  }
  .lp-row {
    grid-template-columns: 1fr auto;
    gap: 6px 10px;
  }
  .lp-row .nm {
    grid-row: 1;
    grid-column: 1;
  }
  .lp-row .tab {
    grid-row: 1;
    grid-column: 2;
  }
  .lp-row .bar {
    grid-row: 2;
    grid-column: 1 / -1;
  }

  /* 4 · exercise */
  .r-top {
    gap: 8px;
    padding: 10px 12px;
  }
  .r-top .lbl-l {
    display: none;
  }
  .r-top .btn.small {
    padding: 6px 10px;
    font-size: 15px;
  }
  .r-prog {
    min-width: 60px;
    height: 10px;
  }
  .r-xp {
    white-space: nowrap;
    min-width: 0;
    font-size: 14px;
  }
  .r-mastery-row {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px;
    min-height: 0;
  }
  .r-body {
    padding: 6px 14px 16px;
  }
  .r-card {
    gap: 12px;
    padding-top: 6px;
  }
  .r-instr {
    font-size: 19px;
  }
  .r-foot {
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    max-height: 62vh;
    display: flex;
    flex-direction: column;
  }
  /* the question: I don't know · Skip on the left, Check on the right, on one line */
  .r-foot-in.ask:not(.fbk) {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
  }
  .r-foot-in.ask:not(.fbk) .fb-row {
    flex-wrap: nowrap;
    gap: 6px;
  }
  .r-foot-in.ask:not(.fbk) .btn.big {
    width: auto;
    padding: 10px 12px;
    font-size: 15px;
    white-space: nowrap;
  }
  .r-foot-in.ask:not(.fbk) > .btn.primary {
    margin-left: auto;
    padding-inline: 18px;
  }
  /* the feedback: at most ~60% of the screen, scrolls inside; Continue always visible at the bottom */
  .r-foot-in.fbk {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 10px;
    min-height: 0;
    width: 100%;
  }
  .r-foot-in.fbk > .fb {
    overflow-y: auto;
    min-height: 0;
  }
  .r-foot-in.fbk > .btn.big {
    width: 100%;
    flex: none;
  }
  .fb h3 {
    font-size: 20px;
  }
  .fb-actions .btn {
    padding: 6px 10px;
    font-size: 14px;
  }

  /* 5 · Reading: the buttons at the bottom on one line too */
  .reader .r-foot-in {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .rd-foot-actions {
    flex-wrap: nowrap;
    gap: 6px;
  }
  .reader .r-foot .rd-foot-actions .btn.big,
  .reader .r-foot .rd-foot-l > .btn.big {
    width: auto;
    flex: 1;
    padding: 8px 10px;
    font-size: 14px;
  }

  /* 6 · theme and chapter pages: the bars the whole width, the button under them */
  .lesson-start {
    flex-direction: column;
    align-items: stretch;
  }
  .lesson-start .lp-rows {
    max-width: none;
  }
  .lesson-start .quick .btn {
    width: 100%;
  }

  /* 7 · Master tables: the subtitle under the title */
  .acc-sum {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 2px 10px;
  }
  .acc-sum .num {
    grid-row: 1;
  }
  .acc-sum h3 {
    grid-row: 1;
    grid-column: 2;
    font-size: 18px;
  }
  .acc-sum .r-sub {
    grid-row: 2;
    grid-column: 2;
  }
  .acc-sum::after {
    grid-row: 1;
    grid-column: 3;
  }

  /* 8 · Words: filters wrap (nothing cut); the two buttons side by side, smaller */
  .seg {
    flex-wrap: wrap;
  }
  .page-h .quick {
    flex-wrap: nowrap;
  }
  .page-h .quick .btn.primary {
    padding: 9px 12px;
    font-size: 14px;
  }
}

/* ---------- v10.0: sign-in and first start ---------- */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-card h2 {
  margin: 0;
}
.auth-card .btn {
  justify-content: center;
}
.auth-msg {
  min-height: 1.4em;
  color: var(--muted);
}
