/*
 * LernTool – Gestaltung
 * Leitidee: ein aufgeräumtes Rechenheft. Die Arbeitsfläche einer Aufgabe ist
 * Häuschenpapier mit Korrekturrand; alles andere bleibt ruhig.
 */

@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("../fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("../fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("../fonts/source-serif-4-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("../fonts/source-serif-4-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("../fonts/source-serif-4-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  --paper: #f5f7fb;
  --sheet: #ffffff;
  --grid: #d6e0ee;
  --line: #c9d3e2;
  --ink: #17223a;
  --ink-soft: #505c76;
  --blue: #1f45c4;
  --blue-soft: #e8edfb;
  --green: #17784b;
  --green-soft: #e3f3ea;
  --red: #b4281e;
  --red-soft: #fbe9e7;
  --amber: #8a5a06;
  --amber-soft: #fbf1d9;
  --margin: #e0584c;
  --font-ui: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --font-math: "Source Serif 4", "Cambria Math", Georgia, "Times New Roman", serif;
  --radius: 6px;
  --cell: 1.25rem;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { font-size: 106.25%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--blue); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 3px; }
main:focus { outline: none; }

.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: 0.5rem 1rem; z-index: 10; }
.skip:focus { left: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Kopf und Fuss ---------- */
.top { background: var(--sheet); border-bottom: 1px solid var(--line); }
.top-in { max-width: 54rem; margin: 0 auto; padding: 0.6rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 0.55rem; }
.brand-mark {
  width: 1.5rem; height: 1.5rem; border: 1.5px solid var(--ink); border-radius: 3px;
  background:
    linear-gradient(var(--margin), var(--margin)) 0.36rem 0 / 1.5px 100% no-repeat,
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 100% 0.36rem,
    var(--sheet);
}
.top nav { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.top nav a { color: var(--ink-soft); text-decoration: none; padding: 0.35rem 0.7rem; border-radius: var(--radius); }
.top nav a:hover { color: var(--ink); background: var(--paper); }
.top nav a[aria-current="page"] { color: var(--ink); font-weight: 700; box-shadow: inset 0 -2px 0 var(--blue); border-radius: 0; }

main { flex: 1; width: 100%; max-width: 54rem; margin: 0 auto; padding: 1.75rem 1.25rem 3rem; }
.foot { border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 0.82rem; padding: 0.9rem 1.25rem; display: flex; gap: 0.5rem 2rem; flex-wrap: wrap; justify-content: center; text-align: center; }

/* ---------- Typografie ---------- */
h1 { font-size: 1.9rem; line-height: 1.2; margin: 0 0 0.5rem; letter-spacing: -0.01em; }
h2 { font-size: 1.3rem; line-height: 1.3; margin: 2.2rem 0 0.6rem; }
h3 { font-size: 1.05rem; margin: 1.5rem 0 0.4rem; }
p { margin: 0 0 0.9rem; max-width: 42rem; }
.lead { font-size: 1.08rem; color: var(--ink-soft); max-width: 40rem; }
.meta { color: var(--ink-soft); font-size: 0.88rem; }
.crumbs { font-size: 0.88rem; color: var(--ink-soft); margin-bottom: 0.8rem; }
.crumbs a { color: var(--ink-soft); }
.crumbs span[aria-hidden] { margin: 0 0.35rem; }

/* ---------- Schaltflächen ---------- */
.btn {
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.55rem 1.05rem; border-radius: var(--radius); border: 1.5px solid var(--ink); background: var(--sheet); color: var(--ink);
}
.btn:hover { background: var(--paper); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: #17369c; border-color: #17369c; }
.btn.quiet { border-color: var(--line); font-weight: 400; }
.btn.small { padding: 0.3rem 0.7rem; font-size: 0.9rem; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin: 1rem 0; }
.linkbtn { font: inherit; background: none; border: 0; padding: 0; color: var(--blue); text-decoration: underline; cursor: pointer; text-underline-offset: 0.15em; }

/* ---------- Hinweiskästen ---------- */
.notice { border-left: 4px solid var(--line); background: var(--sheet); padding: 0.75rem 1rem; margin: 1rem 0; border-radius: 0 var(--radius) var(--radius) 0; max-width: 44rem; }
.notice.err { border-color: var(--red); background: var(--red-soft); }
.notice.ok { border-color: var(--green); background: var(--green-soft); }
.notice.warn { border-color: var(--amber); background: var(--amber-soft); }
.notice p:last-child { margin-bottom: 0; }
.loading { color: var(--ink-soft); padding: 2rem 0; }

/* ---------- Mathematik ---------- */
.mx { font-family: var(--font-math); font-size: 1.12em; line-height: 1.3; font-weight: 400; }
.mx var { font-style: italic; }
.mx .op { margin: 0 0.3em; }
.mx .op.un { margin: 0 0.04em 0 0; }
.mx .op.eq { margin: 0 0.5em; }
.mx .br { margin: 0 0.04em; }
.mx sup { font-size: 0.68em; line-height: 0; vertical-align: 0.55em; margin-left: 0.04em; }
.mx .frac { display: inline-flex; flex-direction: column; text-align: center; vertical-align: middle; margin: 0.12em 0.2em; white-space: nowrap; }
.mx .frac > .num { padding: 0 0.3em 0.12em; border-bottom: 1.5px solid currentColor; }
.mx .frac > .den { padding: 0.12em 0.3em 0; }
.mx .frac .frac, .mx .frac.small { font-size: 0.86em; }
.mx-raw { font-family: ui-monospace, Consolas, monospace; font-size: 0.95em; }

/* ---------- Startseite ---------- */
.start { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem 1.5rem; margin: 1.25rem 0 0.5rem; }
.start h2 { margin-top: 0; }
.start-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; margin-top: 1rem; }
.choice-card { border: 1.5px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.choice-card h3 { margin: 0; }
.choice-card p { margin: 0; color: var(--ink-soft); font-size: 0.95rem; flex: 1; }

.topic { margin-top: 2.2rem; }
.topic-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; border-bottom: 2px solid var(--ink); padding-bottom: 0.35rem; }
.topic-head h2 { margin: 0; }
.topic > p { margin-top: 0.7rem; color: var(--ink-soft); }
details.goals { margin: 0.4rem 0 0.8rem; font-size: 0.95rem; }
details.goals summary { cursor: pointer; color: var(--blue); }
details.goals ul { margin: 0.5rem 0 0; padding-left: 1.2rem; }

.units { list-style: none; margin: 0.6rem 0 0; padding: 0; counter-reset: unit; }
.unit { counter-increment: unit; display: grid; grid-template-columns: 2.2rem 1fr auto; gap: 0.2rem 0.9rem; align-items: start; padding: 0.95rem 0; border-bottom: 1px solid var(--line); }
.unit::before { content: counter(unit); font-family: var(--font-math); font-weight: 600; font-size: 1.35rem; line-height: 1.2; color: var(--ink-soft); text-align: right; }
.unit.done::before { content: "✓"; color: var(--green); }
.unit h3 { margin: 0; font-size: 1.08rem; }
.unit h3 a { color: var(--ink); text-decoration: none; }
.unit h3 a:hover { text-decoration: underline; }
.unit p { margin: 0.15rem 0 0.4rem; color: var(--ink-soft); font-size: 0.95rem; }
.unit-actions { display: flex; gap: 0.5rem; align-items: center; }
.bar { height: 6px; background: var(--grid); border-radius: 3px; overflow: hidden; width: 9rem; max-width: 100%; display: inline-block; vertical-align: middle; margin-right: 0.5rem; }
.bar > span { display: block; height: 100%; background: var(--green); width: 0; }

/* ---------- Lerneinheit ---------- */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--ink); margin: 1.2rem 0 1.5rem; }
.tabs a { padding: 0.5rem 1.1rem; text-decoration: none; color: var(--ink-soft); font-weight: 700; border: 2px solid transparent; border-bottom: 0; margin-bottom: -2px; border-radius: var(--radius) var(--radius) 0 0; }
.tabs a[aria-current="page"] { color: var(--ink); border-color: var(--ink); background: var(--paper); }

.lesson > p, .lesson > ul { max-width: 42rem; }
.lesson ul { padding-left: 1.3rem; }
.lesson li { margin-bottom: 0.3rem; }
.rule { border: 1.5px solid var(--ink); border-radius: var(--radius); background: var(--sheet); padding: 0.85rem 1.1rem; margin: 1.2rem 0; max-width: 44rem; }
.rule strong.rule-title { display: block; margin-bottom: 0.2rem; }
.mistake { border-left: 4px solid var(--red); background: var(--sheet); padding: 0.8rem 1.1rem; margin: 1.2rem 0; max-width: 44rem; border-radius: 0 var(--radius) var(--radius) 0; }
.mistake-pair { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 0.8rem; align-items: center; margin: 0.5rem 0; }
.tag { font-size: 0.8rem; font-weight: 700; padding: 0.1rem 0.5rem; border-radius: 3px; }
.tag.bad { background: var(--red-soft); color: var(--red); }
.tag.good { background: var(--green-soft); color: var(--green); }
.wrong-expr { color: var(--red); }

.example { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); margin: 1.2rem 0; max-width: 46rem; }
.example > .intro { padding: 0.7rem 1.1rem 0; margin: 0; }
.steps { list-style: none; margin: 0; padding: 0.4rem 1.1rem 0.6rem; }
.steps li { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.1rem; padding: 0.55rem 0; border-bottom: 1px dashed var(--line); }
.steps li:last-child { border-bottom: 0; }
.steps .step-expr { font-size: 1.05rem; overflow-x: auto; padding: 0.15rem 0; }
.steps .step-text { color: var(--ink-soft); font-size: 0.93rem; }
.steps li.final .step-expr .mx { font-weight: 600; }
.example .btn-row { margin: 0; padding: 0 1.1rem 0.9rem; }

.quiz { background: var(--blue-soft); border-radius: var(--radius); padding: 0.9rem 1.1rem 1rem; margin: 1.3rem 0; max-width: 44rem; }
.quiz-q { font-weight: 700; margin-bottom: 0.6rem; }
.quiz-options { display: flex; flex-direction: column; gap: 0.45rem; }
.quiz-options button { font: inherit; text-align: left; background: var(--sheet); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 0.5rem 0.8rem; cursor: pointer; color: var(--ink); }
.quiz-options button:hover { border-color: var(--blue); }
.quiz-options button.right { border-color: var(--green); background: var(--green-soft); }
.quiz-options button.false { border-color: var(--red); background: var(--red-soft); }
.quiz-fb { margin: 0.6rem 0 0; }

.ex-group h3 { display: flex; align-items: baseline; gap: 0.6rem; }
.ex-list { list-style: none; margin: 0.3rem 0 1.2rem; padding: 0; border-top: 1px solid var(--line); }
.ex-list a { display: grid; grid-template-columns: 1.6rem 2.2rem minmax(0, 1fr) auto; gap: 0.6rem; align-items: center; padding: 0.55rem 0.3rem; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.ex-list a:hover { background: var(--sheet); }
.ex-list .n { color: var(--ink-soft); font-size: 0.9rem; text-align: right; }
.ex-list .pv { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-list .pv .mx { font-size: 1em; }
.ex-list .src { color: var(--ink-soft); font-size: 0.8rem; white-space: nowrap; }
.state { width: 1.3rem; height: 1.3rem; border-radius: 50%; border: 1.5px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 700; }
.state.solved { background: var(--green); border-color: var(--green); color: #fff; }
.state.solved_help { border-color: var(--green); color: var(--green); }
.state.reviewed { border-color: var(--amber); color: var(--amber); }
.state.tried { border-color: var(--red); color: var(--red); }
.legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; font-size: 0.85rem; color: var(--ink-soft); margin: 0.5rem 0 1.5rem; }
.legend span { display: inline-flex; align-items: center; gap: 0.35rem; }

/* ---------- Aufgabe ---------- */
.ex-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.ex-head h1 { font-size: 1.45rem; margin: 0; }
.prompt { font-size: 1.05rem; margin: 0.8rem 0 0.4rem; }
.task { font-size: 1.45rem; padding: 0.6rem 0 1rem; overflow-x: auto; }
.task .mx { font-size: 1em; }

.work {
  position: relative; border: 1px solid var(--line); border-radius: var(--radius); padding: var(--cell) 1rem var(--cell) 3.6rem;
  background:
    linear-gradient(var(--grid) 1px, transparent 1px) 0 -1px / var(--cell) var(--cell),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) -1px 0 / var(--cell) var(--cell),
    var(--sheet);
}
.work::before { content: ""; position: absolute; top: 0; bottom: 0; left: 2.75rem; border-left: 1.5px solid var(--margin); }
.row { position: relative; margin-bottom: 0.9rem; }
.row:last-of-type { margin-bottom: 0.3rem; }
.row .mark { position: absolute; left: -3.1rem; top: 0.4rem; width: 2rem; text-align: center; font-weight: 700; font-size: 1.2rem; line-height: 1.6rem; }
.row .mark.ok { color: var(--green); }
.row .mark.bad { color: var(--red); }
.row .mark.warn { color: var(--amber); }
.row .mark.num { color: var(--ink-soft); font-size: 0.8rem; font-weight: 400; }
.row-main { display: flex; gap: 0.5rem; align-items: center; }
.row-main label.pre { font-family: var(--font-math); font-size: 1.1rem; white-space: nowrap; }
.row input[type="text"] {
  flex: 1; min-width: 0; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 1.05rem; color: var(--blue);
  padding: 0.5rem 0.7rem; border: 1.5px solid var(--ink-soft); border-radius: var(--radius); background: rgba(255, 255, 255, 0.92);
}
.row input[type="text"]:focus { border-color: var(--blue); outline: 3px solid var(--blue-soft); outline-offset: 0; }
.row.is-bad input { border-color: var(--red); }
.row.is-ok input { border-color: var(--green); }
.row-del { font: inherit; border: 0; background: none; color: var(--ink-soft); cursor: pointer; padding: 0.2rem 0.5rem; font-size: 1.2rem; line-height: 1; border-radius: 3px; }
.row-del:hover { color: var(--red); background: var(--red-soft); }
.preview { min-height: 1.9rem; padding: 0.3rem 0.1rem 0; color: var(--blue); overflow-x: auto; }
.preview.err { color: var(--red); font-size: 0.9rem; }
.preview .hint { color: var(--ink-soft); font-size: 0.85rem; }
.work-note { font-size: 0.85rem; color: var(--ink-soft); background: rgba(255, 255, 255, 0.85); display: inline-block; padding: 0 0.3rem; margin: 0.2rem 0 0; }

.keys { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.7rem 0 0; }
.keys button { font-family: var(--font-math); font-size: 1rem; min-width: 2.3rem; padding: 0.25rem 0.5rem; border: 1px solid var(--line); border-radius: 4px; background: var(--sheet); cursor: pointer; color: var(--ink); }
.keys button:hover { border-color: var(--blue); color: var(--blue); }

.options { border: 0; margin: 0.5rem 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.options label { display: flex; gap: 0.6rem; align-items: baseline; background: var(--sheet); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 0.55rem 0.8rem; cursor: pointer; }
.options label:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }

.result { margin: 1.1rem 0; padding: 0.9rem 1.1rem; border-radius: var(--radius); border: 1.5px solid var(--line); background: var(--sheet); max-width: 46rem; }
.result h2 { margin: 0 0 0.3rem; font-size: 1.1rem; display: flex; align-items: center; gap: 0.5rem; }
.result.correct { border-color: var(--green); background: var(--green-soft); }
.result.correct h2 { color: var(--green); }
.result.wrong { border-color: var(--red); }
.result.wrong h2 { color: var(--red); }
.result.almost { border-color: var(--amber); background: var(--amber-soft); }
.result.almost h2 { color: var(--amber); }
.result ul { margin: 0.3rem 0; padding-left: 1.2rem; }
.result li { margin-bottom: 0.25rem; }
.result p { margin-bottom: 0.5rem; }
.read-lines { list-style: none; padding: 0; margin: 0.6rem 0; border-top: 1px dashed var(--line); }
.read-lines li { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr); gap: 0.5rem; padding: 0.35rem 0; border-bottom: 1px dashed var(--line); align-items: center; overflow-x: auto; }
.read-lines .ok { color: var(--green); font-weight: 700; }
.read-lines .bad { color: var(--red); font-weight: 700; }
.read-lines .warn { color: var(--amber); font-weight: 700; }
.read-lines .none { color: var(--ink-soft); }
.concept { border-top: 1px solid var(--line); margin-top: 0.7rem; padding-top: 0.7rem; }
.concept h3 { margin: 0 0 0.25rem; font-size: 1rem; }
.concept .tag { margin-right: 0.4rem; }

.help { margin-top: 1.6rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.help h2 { margin: 0 0 0.3rem; font-size: 1.05rem; }
.help-list { list-style: none; margin: 0.6rem 0; padding: 0; max-width: 46rem; }
.help-list li { background: var(--sheet); border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 0 var(--radius) var(--radius) 0; padding: 0.6rem 0.9rem; margin-bottom: 0.5rem; }
.help-list.sol li { border-left-color: var(--ink); }
.help-list .step-expr { font-size: 1.1rem; overflow-x: auto; padding: 0.1rem 0 0.2rem; }
.help-list .step-text { color: var(--ink-soft); font-size: 0.93rem; }
.help-list .k { font-size: 0.8rem; color: var(--ink-soft); display: block; }

.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2rem; border-top: 1px solid var(--line); padding-top: 1rem; }

/* ---------- Standortbestimmung, Lernstand ---------- */
.progress-dots { display: flex; gap: 0.35rem; margin: 0.6rem 0 1.2rem; }
.progress-dots span { width: 1.6rem; height: 6px; border-radius: 3px; background: var(--grid); }
.progress-dots span.pass { background: var(--green); }
.progress-dots span.fail { background: var(--red); }
.progress-dots span.now { background: var(--blue); }
.table { width: 100%; border-collapse: collapse; margin: 1rem 0; max-width: 46rem; }
.table th, .table td { text-align: left; padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 0.85rem; color: var(--ink-soft); font-weight: 400; }
.figures { display: flex; flex-wrap: wrap; gap: 0.8rem 2.5rem; margin: 1rem 0 1.5rem; }
.figures div { display: flex; flex-direction: column; }
.figures b { font-family: var(--font-math); font-size: 1.8rem; font-weight: 600; line-height: 1.1; }
.figures span { color: var(--ink-soft); font-size: 0.88rem; }
.mc-item { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.8rem 1.1rem; margin-bottom: 0.7rem; max-width: 46rem; }
.mc-item h3 { margin: 0 0 0.2rem; display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.mc-item h3 small { font-weight: 400; color: var(--ink-soft); white-space: nowrap; }
.syntax { border-collapse: collapse; margin: 0.6rem 0 1.2rem; }
.syntax td { padding: 0.35rem 1.2rem 0.35rem 0; border-bottom: 1px solid var(--line); }
.syntax code { font-family: ui-monospace, Consolas, monospace; color: var(--blue); background: var(--sheet); padding: 0.1rem 0.35rem; border: 1px solid var(--line); border-radius: 3px; }

/* ---------- Version 1.1: Textmarker ---------- */
.marks .tm { border-radius: 3px; padding: 0.1em 0.12em; margin: 0 0.04em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.marks .tm0 { background: #fff2a0; }
.marks .tm1 { background: #bfe6ff; }
.marks .tm2 { background: #c8f0c5; }
.marks .tm3 { background: #ffd0e2; }
.marks .tm4 { background: #ffdbae; }
.marks .tm5 { background: #dccfff; }
.marks .tm6 { background: #b8eee2; }
.marks .tm7 { background: #e4e4e4; }
.marks .tm .op:first-child { margin-left: 0.1em; }
.marks-btn[aria-pressed="true"] { border-color: var(--ink); background: #fff2a0; }
.keys .marks-btn { font-family: var(--font-ui); font-size: 0.85rem; margin-left: auto; }

/* ---------- Lektion: Überblick, Abschnitte, Mitschreiben, Notizen ---------- */
.expect { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem 1.1rem; margin-bottom: 1.5rem; max-width: 46rem; font-size: 0.95rem; }
.toc { margin: 0.6rem 0 0; padding-left: 1.4rem; columns: 2; column-gap: 2rem; }
.toc li { margin-bottom: 0.2rem; break-inside: avoid; }
.lesson-section > h2:first-child { margin-top: 0.5rem; }
.stepper { border-top: 2px solid var(--ink); margin-top: 1.5rem; padding-top: 0.8rem; }
.stepper .bar { width: 14rem; }
.stepper .bar > span { background: var(--blue); }
.example-head { display: flex; justify-content: space-between; align-items: center; gap: 0.8rem; padding: 0.5rem 1.1rem; border-bottom: 1px solid var(--line); }
.example-head h4 { margin: 0; font-size: 0.98rem; }
.try { padding: 0.2rem 1.1rem 0.8rem; }
.try label { display: block; font-size: 0.9rem; color: var(--ink-soft); margin-bottom: 0.3rem; }
.try-row { display: flex; gap: 0.5rem; }
.try-row input { flex: 1; min-width: 0; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 1rem; color: var(--blue); padding: 0.4rem 0.6rem; border: 1.5px solid var(--ink-soft); border-radius: var(--radius); }
.try-fb .notice { margin: 0.6rem 0 0; }
.try-fb .own, .result .own { display: inline-block; padding: 0.1rem 0; }
.try-fb ul { margin: 0.3rem 0; padding-left: 1.2rem; }
.notes { margin: 2rem 0 0; border-top: 1px solid var(--line); padding-top: 0.8rem; max-width: 46rem; }
.notes summary { cursor: pointer; font-weight: 700; }
.notes textarea { width: 100%; margin-top: 0.6rem; font: inherit; padding: 0.6rem 0.7rem; border: 1.5px solid var(--ink-soft); border-radius: var(--radius); resize: vertical; background: var(--sheet); color: var(--ink); }
.probe { background: var(--paper); border-left: 4px solid var(--ink); padding: 0.5rem 0.8rem; margin: 0.6rem 0; border-radius: 0 var(--radius) var(--radius) 0; }
.concept details { margin: 0.3rem 0 0.6rem; }
.concept summary { cursor: pointer; color: var(--blue); }
.mc-item .concept { border-top: 0; margin-top: 0; padding-top: 0; }

/* ---------- Aufgaben: Erwartung, Zahlenfelder, Fehlersuche ---------- */
.expects { font-size: 0.92rem; color: var(--ink-soft); margin: -0.4rem 0 0.9rem; }
.fields .row-main { flex-wrap: wrap; }
.fields label.fl { flex: 1 1 14rem; background: rgba(255, 255, 255, 0.85); padding: 0 0.3rem; }
.fields input[type="text"] { flex: 0 1 11rem; }
.fields .unit { min-width: 3.2rem; background: rgba(255, 255, 255, 0.85); padding: 0 0.3rem; }
.hunt { border: 0; margin: 0.6rem 0; padding: 0; max-width: 48rem; }
.hunt-line { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 0.8rem; align-items: center; padding: 0.6rem 0.8rem; border: 1.5px solid var(--line); border-top-width: 0; background: var(--sheet); overflow-x: auto; }
.hunt-line:first-child { border-top-width: 1.5px; border-radius: var(--radius) var(--radius) 0 0; }
.hunt-line:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.hunt-line.given { background: var(--paper); }
label.hunt-line { cursor: pointer; }
label.hunt-line:has(input:checked) { background: var(--blue-soft); box-shadow: inset 4px 0 0 var(--blue); }
.hunt-n { font-size: 0.85rem; color: var(--ink-soft); white-space: nowrap; }

/* ---------- Einstellungen, Glossar, Pause ---------- */
.presets { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; margin: 0.8rem 0; }
.presets .choice-card { background: var(--sheet); }
fieldset.set { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 0.9rem 0; display: grid; grid-template-columns: 12rem 1fr; gap: 0.4rem 1rem; max-width: 46rem; }
fieldset.set legend { float: left; font-weight: 700; padding: 0; grid-row: 1 / span 4; }
.opt { display: flex; gap: 0.6rem; align-items: baseline; grid-column: 2; cursor: pointer; }
.search { font: inherit; width: 100%; max-width: 24rem; padding: 0.5rem 0.7rem; border: 1.5px solid var(--ink-soft); border-radius: var(--radius); margin: 0.4rem 0 1rem; }
.glossary { margin: 0; max-width: 46rem; }
.gl-item { padding: 0.65rem 0; border-bottom: 1px solid var(--line); }
.gl-item dt { font-weight: 700; }
.gl-item dd { margin: 0.15rem 0 0; }
.pause { background: var(--amber-soft); border-bottom: 1px solid var(--amber); padding: 0.6rem 1.25rem; display: flex; gap: 1rem; align-items: center; justify-content: center; flex-wrap: wrap; }

/* ---------- Version 1.2: Anmeldung, Konto, Module ---------- */
.auth { max-width: 27rem; margin: 1.5rem auto 0; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem 1.7rem 1.2rem; }
.auth h1 { font-size: 1.55rem; }
.ff { margin: 0 0 0.85rem; display: flex; flex-direction: column; gap: 0.25rem; max-width: 30rem; }
.ff label { font-size: 0.92rem; font-weight: 700; }
.ff input, .ff select, .toolbar select { font: inherit; padding: 0.5rem 0.65rem; border: 1.5px solid var(--ink-soft); border-radius: var(--radius); background: var(--sheet); color: var(--ink); width: 100%; }
.ff input:focus, .ff select:focus { border-color: var(--blue); outline: 3px solid var(--blue-soft); outline-offset: 0; }
.check { display: flex; gap: 0.55rem; align-items: baseline; margin: 0.35rem 0; cursor: pointer; max-width: 42rem; }
.panel { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.3rem; margin: 1.1rem 0; max-width: 50rem; }
.panel h2 { margin: 0 0 0.6rem; font-size: 1.15rem; }
.panel .table { max-width: none; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.tag { background: var(--paper); border: 1px solid var(--line); }
.tag.bad, .tag.good { border-color: transparent; }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: 1.05rem; background: var(--sheet); border: 1px solid var(--line); padding: 0.15rem 0.45rem; border-radius: 3px; user-select: all; word-break: break-all; }
.qr { margin: 0.6rem 0; }
.qr img { border: 6px solid #fff; display: block; image-rendering: pixelated; }
.tf-steps { padding-left: 1.3rem; }
.tf-steps li { margin-bottom: 0.9rem; }
.modules { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: 1.1rem; margin-top: 0.6rem; }
.module-card { background: var(--sheet); border: 1.5px solid var(--ink); border-radius: var(--radius); padding: 1.1rem 1.3rem; display: flex; flex-direction: column; gap: 0.5rem; }
.module-card h3 { margin: 0; font-size: 1.2rem; }
.module-card h3 a { color: var(--ink); text-decoration: none; }
.module-card h3 a:hover { text-decoration: underline; }
.module-card p { margin: 0; color: var(--ink-soft); flex: 1; }
.module-card .bar { width: 100%; display: block; margin: 0.2rem 0 0.3rem; }
.module-card .btn-row { margin: 0.4rem 0 0; }
.top nav { align-items: center; }
.top nav .nav-admin { border: 1.5px solid var(--ink); color: var(--ink); font-weight: 700; margin-left: 0.4rem; }
.top nav .nav-out { color: var(--ink-soft); margin-left: 0.5rem; font-size: 0.92rem; }
.table td.num, .table th.num { text-align: right; white-space: nowrap; }

/* ---------- Version 1.3: Wurzeln, Hochzahlen, Abbildungen ---------- */
.mx .root { display: inline-flex; align-items: stretch; vertical-align: middle; margin: 0 0.1em; white-space: nowrap; }
.mx .root .rsym { font-size: 1.15em; line-height: 1.15; margin-right: -0.04em; }
.mx .root .rad { border-top: 1.5px solid currentColor; padding: 0.08em 0.2em 0 0.15em; margin-top: 0.14em; display: inline-flex; align-items: center; }
.mx .root .ridx { font-size: 0.62em; align-self: flex-start; margin-right: -0.25em; vertical-align: 0; line-height: 1; }
.mx sup.ex { font-size: 0.72em; font-style: italic; }
.op.eq { margin: 0 0.5em; }
.fig { margin: 0.8rem 0 1rem; max-width: 46rem; }
.fig img { max-width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.fig figcaption { font-size: 0.88rem; color: var(--ink-soft); margin-top: 0.3rem; }

/* ---------- Schriftgrösse und reizarme Darstellung ---------- */
html.size-large { font-size: 121%; }
html.calm * { animation: none !important; transition: none !important; }
html.calm .extra, html.calm .foot span + span { display: none; }
html.calm .quiz, html.calm .result.correct, html.calm .result.almost, html.calm .notice.ok, html.calm .notice.err, html.calm .notice.warn { background: var(--sheet); }
html.calm .work { background: var(--sheet); }
html.calm .work::before { border-left-color: var(--line); }
html.calm .quiz { border: 1.5px solid var(--line); }
html.calm .brand-mark { background: var(--sheet); }

@media (max-width: 40rem) {
  .top nav a { padding: 0.3rem 0.5rem; font-size: 0.92rem; }
  .keys .marks-btn { margin-left: 0; }
  .example-head { flex-wrap: wrap; }
  fieldset.set { grid-template-columns: 1fr; }
  fieldset.set legend { float: none; margin-bottom: 0.4rem; }
  .opt { grid-column: 1; }
  .toc { columns: 1; }
  .hunt-line { grid-template-columns: 1fr; gap: 0.2rem; }
  html { font-size: 100%; }
  main { padding: 1.25rem 0.9rem 2.5rem; }
  h1 { font-size: 1.55rem; }
  .unit { grid-template-columns: 1.6rem 1fr; }
  .unit-actions { grid-column: 2; }
  .work { padding-left: 2.5rem; padding-right: 0.6rem; }
  .work::before { left: 1.9rem; }
  .row .mark { left: -2.3rem; width: 1.6rem; }
  .task { font-size: 1.2rem; }
  .ex-list a { grid-template-columns: 1.5rem 1.6rem minmax(0, 1fr); }
  .ex-list .src { display: none; }
}

@media (prefers-reduced-motion: no-preference) {
  .bar > span { transition: width 0.4s ease; }
  .result { animation: appear 0.18s ease-out; }
  @keyframes appear { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
}

@media print {
  .top, .foot, .keys, .btn-row, .pager, .help, .pause, .crumbs, .marks-btn { display: none; }
  .steps li[hidden] { display: grid !important; }
  body { background: #fff; }
}
