/* Data Science Coach — reading-first typeset.
   Centered single column, persistent slim top bar, paper aesthetic with a
   clinical blue accent, light/dark mode. No sidebar — navigation lives in the
   top bar, the contents page, the inline TOC and prev/next. */

:root {
  --body-font: "Inter", "Avenir Next", "Nunito Sans", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --line-height: 1.76;
  --measure: 46rem;
  --breakout: 58rem;

  --paper:#FFFFFF; --paper-2:#F5F7FA; --ink:#16181D; --ink-soft:#484E56;
  --muted:#656C76; --faint:#6B7280; --rule:#E6E9EE; --rule-soft:#F1F3F6;
  --accent:#2A5C8A; --accent-2:#1E456B; --accent-tint:#EBF1F7; --card:#FFFFFF;
  --warn:#9A5B12; --warn-tint:#FCF4E9; --warn-rule:#EEDAB8;
  --adv:#4F4488; --adv-tint:#F2EFF9; --adv-rule:#DBD3ED;
  --ok:#2C7A54; --ok-tint:#EBF5EF; --ok-rule:#C8E6D4;
  --shadow: 0 4px 12px rgba(20,24,30,.03), 0 1px 2px rgba(20,24,30,.02);
  --shadow-pop: 0 16px 40px -16px rgba(20,24,30,.12), 0 4px 16px rgba(20,24,30,.04);
  --radius: 16px;
  --radius-sm: 8px;
}
html[data-theme="dark"] {
  --paper:#0B0D11; --paper-2:#13161C; --ink:#ECEEF2; --ink-soft:#C2C7D0;
  --muted:#89919C; --faint:#7A828C; --rule:#22262F; --rule-soft:#181A22;
  --accent:#5C9BD8; --accent-2:#89BCEF; --accent-tint:#101D28; --card:#13161C;
  --warn:#E69D45; --warn-tint:#201910; --warn-rule:#3E2F1E;
  --adv:#A793E2; --adv-tint:#191626; --adv-rule:#302B48;
  --ok:#60B98A; --ok-tint:#0E1B14; --ok-rule:#1F3C2C;
  --shadow: 0 4px 20px rgba(0,0,0,.25), 0 1px 3px rgba(0,0,0,.15);
  --shadow-pop: 0 20px 50px -12px rgba(0,0,0,.5), 0 6px 20px rgba(0,0,0,.2);
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --paper:#0B0D11; --paper-2:#13161C; --ink:#ECEEF2; --ink-soft:#C2C7D0;
    --muted:#89919C; --faint:#7A828C; --rule:#22262F; --rule-soft:#181A22;
    --accent:#5C9BD8; --accent-2:#89BCEF; --accent-tint:#101D28; --card:#13161C;
    --warn:#E69D45; --warn-tint:#201910; --warn-rule:#3E2F1E;
    --adv:#A793E2; --adv-tint:#191626; --adv-rule:#302B48;
    --ok:#60B98A; --ok-tint:#0E1B14; --ok-rule:#1F3C2C;
    --shadow: 0 4px 20px rgba(0,0,0,.25), 0 1px 3px rgba(0,0,0,.15);
    --shadow-pop: 0 20px 50px -12px rgba(0,0,0,.5), 0 6px 20px rgba(0,0,0,.2);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
/* Sichtbarer Tastatur-Fokus überall — auch dort, wo einzelne Komponenten den
   nativen Fokusring per border/outline: none entfernt haben (Segmente,
   Pfad-Buttons, Karten, Ressourcen-Kacheln …). Maus-/Touch-Klicks bleiben ruhig. */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
:focus:not(:focus-visible) { outline: none; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--body-font); font-size: 18px; line-height: var(--line-height);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: background .4s ease, color .4s ease;
}

/* ---------- Top bar (persistent) ---------- */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 60; }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .1s linear; }
.topbar {
  position: sticky; top: 0; z-index: 50; height: 54px; display: flex; align-items: center;
  gap: 1rem; padding: 0 clamp(1rem, 5vw, 2rem);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: baseline; gap: .5rem; text-decoration: none; color: var(--ink); font-weight: 660; letter-spacing: -.01em; }
.brand .dot { color: var(--accent); }
.brand .sub { font-size: .76rem; color: var(--muted); font-weight: 500; }
.topnav { margin-left: auto; display: flex; align-items: center; gap: .2rem; }
.topnav > a { position: relative; font-size: .86rem; color: var(--muted); text-decoration: none; padding: .35rem .7rem; border-radius: 8px; transition: color .12s, background .12s; }
.topnav > a:hover { color: var(--accent); background: var(--accent-tint); }
.topnav > a.aktiv { color: var(--accent); font-weight: 600; }
.topnav > a.aktiv::after { content: ""; position: absolute; left: .7rem; right: .7rem; bottom: -2px; height: 2px; border-radius: 2px; background: var(--accent); }
.topbar-actions { display: flex; align-items: center; gap: .35rem; position: relative; }

/* ---------- Course-wide settings ---------- */
.settings { position: relative; display: flex; align-items: center; }
.settings.open .iconbtn { background: var(--paper-2); color: var(--ink); border-color: var(--rule); }
/* Dieselbe Breite und derselbe Rahmen wie das Modulmenü nebenan: zwei Panels
   aus derselben Leiste sollen wie Geschwister aussehen, nicht wie Zufall. */
.settings-panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 70;
  width: min(88vw, 340px); padding: .6rem .75rem .7rem;
  background: var(--paper); border: 1px solid var(--rule); border-radius: 12px;
  box-shadow: 0 12px 34px -18px rgba(20,24,30,.55);
  opacity: 0; transform: translateY(-4px) scale(.99); transform-origin: top right;
  visibility: hidden; pointer-events: none;
  transition: opacity .14s ease, transform .14s ease, visibility .14s;
}
.settings.open .settings-panel { opacity: 1; transform: none; visibility: visible; pointer-events: auto; }
/* Trennlinien zwischen den Zeilen wie zwischen den TEIL-Gruppen im Modulmenü. */
.settings-panel .studybar { display: grid; gap: 0; }
.settings-panel .seg { padding: .45rem .25rem; }
.settings-panel .seg + .seg { border-top: 1px solid var(--rule-soft); }
.settings-title { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin: .35rem .25rem .3rem; }
/* Das Einstellungs-Panel enthält nur noch Einstellungen: drei .seg-Leisten.
   Trennstrich und Aktionsknöpfe sind entfallen — „Material und Referenz" ist
   ein Sprungziel und steht im Modulmenü, das Farbschema ist eine Ansichtsoption
   und steht bei den anderen beiden. */

/* ---------- „Module ▾" – kursweites Sprungmenü ---------- */
.nav-modules { position: relative; display: flex; align-items: center; }
.nm-btn { display: inline-flex; align-items: center; gap: .25rem; font-size: .86rem; font-weight: 560;
  color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 8px;
  padding: .35rem .55rem .35rem .7rem; cursor: pointer; transition: color .12s, background .12s; }
.nm-btn:hover { color: var(--accent); background: var(--accent-tint); }
.nm-btn .chev { width: 15px; height: 15px; transition: transform .16s ease; }
.nav-modules.nm-open .nm-btn { color: var(--accent); background: var(--accent-tint); }
.nav-modules.nm-open .nm-btn .chev { transform: rotate(180deg); }
.nm-panel {
  display: none; position: absolute; top: calc(100% + 8px); right: 0; left: auto; z-index: 60;
  width: min(88vw, 340px); max-height: min(65vh, 460px); overflow-y: auto;
  padding: .5rem; background: var(--paper); border: 1px solid var(--rule); border-radius: 12px;
  box-shadow: 0 12px 34px -18px rgba(20,24,30,.55);
  opacity: 0; transform: translateY(-4px) scale(.99); transform-origin: top right;
  visibility: hidden; pointer-events: none;
  transition: opacity .14s ease, transform .14s ease, visibility .14s;
}
.nav-modules.nm-open .nm-panel { display: block; opacity: 1; transform: none; visibility: visible; pointer-events: auto; }
.nm-group { padding: .2rem 0; }
.nm-group + .nm-group { border-top: 1px solid var(--rule); margin-top: .2rem; }
.nm-teil { margin: .35rem .5rem .25rem; font-size: 10.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); }
.nm-teil { list-style: none; display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.nm-teil::-webkit-details-marker { display: none; }
.nm-teil::after { content: "▾"; font-size: 11px; color: var(--faint); transition: transform .14s ease; }
.nm-group:not([open]) .nm-teil::after { transform: rotate(-90deg); }
.nm-group:not([open]) > a { display: none; }
.nm-panel a { display: flex; align-items: center; gap: .55rem; padding: .4rem .5rem; border-radius: 8px;
  color: var(--ink); text-decoration: none; font-size: .88rem; line-height: 1.3; transition: background .12s, color .12s, opacity .12s; }
.nm-panel a:hover { background: var(--paper-2); color: var(--accent); }
/* Menükopf: die zwei Ziele, die kein Modul sind. Sie tragen ein Symbol statt
   einer Nummer, damit die Nummernspalte der Module unangetastet bleibt. */
.nm-head { padding-bottom: .3rem; margin-bottom: .1rem; border-bottom: 1px solid var(--rule); }
.nm-panel .nm-action {
  display: flex; align-items: center; gap: .55rem; width: 100%;
  padding: .45rem .5rem; border: none; border-radius: 8px; background: transparent;
  font: inherit; font-size: .88rem; line-height: 1.3; color: var(--ink);
  text-align: left; text-decoration: none; cursor: pointer; min-height: 24px;
  transition: background .12s, color .12s;
}
.nm-panel .nm-action:hover { background: var(--paper-2); color: var(--accent); }
.nm-panel .nm-action svg { width: 17px; height: 17px; flex: none; color: var(--muted); }
.nm-panel .nm-action:hover svg { color: var(--accent); }
.nm-panel a .nm-num { flex: none; font-size: .72rem; font-weight: 700; color: var(--muted);
  font-variant-numeric: tabular-nums; min-width: 1.4em; }
.nm-panel a.aktiv { background: var(--accent-tint); color: var(--accent); font-weight: 600; }
.nm-panel a.aktiv .nm-num { color: var(--accent); }
.nm-panel a.dim { opacity: .42; filter: saturate(.5); }
.nm-panel a .nm-status { margin-left: auto; flex-shrink: 0; width: 14px; height: 14px; color: var(--accent); opacity: 0; transition: opacity .15s; display: inline-flex; align-items: center; justify-content: center; }
.nm-panel a .nm-status.done { opacity: 1; }
.nm-panel a .nm-status svg { width: 12px; height: 12px; }
.nm-panel a.on-path { font-weight: 600; border-left: 2px solid var(--accent); border-radius: 0 8px 8px 0; padding-left: .4rem; }
.nm-panel a .nm-step { margin-left: auto; font-size: .62rem; font-weight: 700; color: #fff; background: var(--accent); border-radius: 99px; padding: .05rem .35rem; line-height: 1.3; }
html[data-theme="dark"] .nm-panel a .nm-step { color: #0d1117; }
.iconbtn { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 1px solid transparent;
  border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; transition: .15s; }
.iconbtn:hover { background: var(--paper-2); color: var(--ink); border-color: var(--rule); }
.iconbtn svg { width: 18px; height: 18px; }
/* Burger nur auf schmalen Viewports; Icon wechselt Hamburger↔X über .nav-open. */
.burger { display: none; }
.burger .i-close { display: none; }
.topbar.nav-open .burger .i-open { display: none; }
.topbar.nav-open .burger .i-close { display: block; }

@media (max-width: 860px) {
  .brand .sub { display: none; }
  .burger { display: inline-grid; }
  .settings-panel {
    position: fixed; top: 60px; right: clamp(1rem, 5vw, 2rem);
    width: min(calc(100vw - 2rem), 320px); transform-origin: top right;
  }
  /* Links werden zu einem einklappbaren Panel unter der Leiste. */
  .topnav {
    position: absolute; top: 100%; left: 0; right: 0; margin: 0;
    flex-direction: column; align-items: stretch; gap: .1rem;
    padding: .5rem clamp(1rem, 5vw, 2rem) .8rem;
    background: color-mix(in srgb, var(--paper) 96%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--rule);
    box-shadow: 0 10px 24px -18px rgba(20,24,30,.6);
    transform-origin: top; transform: scaleY(.98); opacity: 0;
    visibility: hidden; pointer-events: none;
    transition: opacity .14s ease, transform .14s ease, visibility .14s;
  }
  .topbar.nav-open .topnav { transform: none; opacity: 1; visibility: visible; pointer-events: auto; }
  .topnav > a { padding: .6rem .6rem; font-size: .95rem; border-radius: 10px; }
  .topnav > a.aktiv { background: var(--accent-tint); }
  .topnav > a.aktiv::after { display: none; }
  /* Modul-Menü in der Schublade: Button weg, Gruppen kompakt auffächern. */
  .nav-modules { display: block; width: 100%; order: -1; }
  .nm-btn { display: none; }
  .nm-panel {
    display: block; position: static; width: auto; max-height: 52vh; opacity: 1; transform: none;
    visibility: visible; pointer-events: auto; box-shadow: none; border: none;
    border-bottom: 1px solid var(--rule); border-radius: 0; padding: .2rem 0 .5rem; margin-bottom: .4rem;
  }
  .nm-group { padding: .1rem 0; }
  .nm-panel a { padding: .42rem .5rem .42rem 1.2rem; }
}
@media (prefers-reduced-motion: reduce) { .topnav, .nm-panel, .nm-btn .chev { transition: none; } }

/* ---------- Reading column ---------- */
.page { max-width: var(--measure); margin: 0 auto; padding: clamp(2.4rem, 6vh, 4.5rem) clamp(1.2rem, 5vw, 1.6rem) 7rem; }

/* ---------- Title block ---------- */
.titleblock { margin-bottom: 2.4rem; padding-bottom: 1.6rem; border-bottom: 1px solid var(--rule); }
.kicker { font-size: 11.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); margin: 0 0 .9rem; }
h1.title { font-size: clamp(2rem, 4.4vw, 2.7rem); line-height: 1.14; font-weight: 600; letter-spacing: -.015em; margin: 0 0 .55rem; color: var(--ink); text-wrap: balance; }
.subtitle { font-size: clamp(1rem, 2vw, 1.18rem); line-height: 1.42; color: var(--muted); margin: 0 0 1.4rem; text-wrap: balance; }
.meta-row { display: flex; flex-wrap: wrap; gap: .5rem 2rem; padding: .85rem 0 0; }
.meta { font-size: 12.5px; }
.meta .label { display: block; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: .12rem; }
.meta .value { color: var(--ink-soft); font-weight: 500; }
.controlbar { display: flex; flex-direction: column; gap: .8rem; margin: 1.5rem 0 0; }
.controlbar .sub-nav { margin: 0; }
.cb-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1.5rem; }
/* Ansicht: schlichte Textreiter statt Pillen */
.sub-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 1.05rem; }
.sub-nav a { font-size: .85rem; text-decoration: none; color: var(--muted); border: none; border-radius: 0; padding: .1rem 0; transition: color .12s; }
.sub-nav a:hover { color: var(--accent); border: none; }
.sub-nav a.aktiv { background: transparent; color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.sub-nav a.src { font-size: .8rem; color: var(--muted); }
.sub-nav a.src:hover { color: var(--accent); }
.sub-nav a.src.aktiv { color: var(--ink); }
.sub-nav .sub-sep { width: 1px; height: 13px; background: var(--rule); }

/* ---------- Abstract & TOC ---------- */
.abstract { border-left: 4px solid var(--accent); background: var(--paper-2); border-radius: var(--radius-sm); padding: 1.25rem 1.6rem; margin: 0 0 2rem; }
.abstract .block-title { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin: 0 0 .6rem; }
.abstract ul { margin: 0; padding-left: 1.1rem; }
.abstract li { margin: .3rem 0; font-size: 15.5px; color: var(--ink-soft); }
.toc-inline { border: 1px solid var(--rule); border-radius: var(--radius-sm); margin: 0 0 2.8rem; background: var(--paper-2); }
.toc-inline > summary.toc-title { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; padding: .85rem 1.45rem; font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.toc-inline > summary.toc-title::-webkit-details-marker { display: none; }
.toc-inline > summary.toc-title::after { content: "▾"; font-size: 12px; }
.toc-inline[open] > summary.toc-title::after { content: "▴"; }
.toc-inline > summary.toc-title:hover { color: var(--accent); }
.toc-inline ul { list-style: none; margin: 0; padding: .1rem 1.45rem 1.1rem; }
.toc-inline a { display: block; padding: .22rem 0; color: var(--ink-soft); font-size: 14px; text-decoration: none; transition: color .15s ease; }
.toc-inline .lvl-2 a { padding-left: 1.1rem; font-size: 13.5px; color: var(--muted); }
.toc-inline a:hover { color: var(--accent); }
.toc-inline a.active { color: var(--accent); font-weight: 600; }

/* ---------- Body text ---------- */
.body h2, .body h3 { letter-spacing: -.005em; line-height: 1.25; position: relative; scroll-margin-top: 72px; color: var(--ink); }
.body h2 { font-size: 1.34rem; font-weight: 600; margin: 3.4rem 0 1.2rem; padding-top: .2rem; }
.body h3 { font-size: 1.07rem; font-weight: 600; margin: 2.2rem 0 0.8rem; color: var(--ink-soft); }
.body p { margin: 0 0 1.36rem; } .body p, .body li { hyphens: auto; }
.body a { color: var(--accent); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 38%, transparent); transition: border-color .15s ease; }
.body a:hover { border-color: var(--accent); }
.body strong { font-weight: 700; } .body em { font-style: italic; }
.body ul, .body ol { margin: 0 0 1.36rem; padding-left: 1.35rem; } .body li { margin: .38rem 0; }
.body blockquote { margin: 2rem 0; padding: .2rem 0 .2rem 1.4rem; border-left: 3px solid var(--rule); color: var(--muted); }
.body hr { border: none; border-top: 1px solid var(--rule); margin: 3.4rem 0; }
.anchor-link { position: absolute; left: -1.25em; top: 0; width: 1.1em; opacity: 0; color: var(--faint); text-decoration: none; border: none; transition: opacity .15s ease, color .15s ease; }
.body h2:hover .anchor-link, .body h3:hover .anchor-link { opacity: 1; }
.anchor-link:hover { color: var(--accent); }

/* ---------- Code ---------- */
.code-wrap { position: relative; margin: 0 0 1.4rem; }
.code-kopf { display: flex; justify-content: space-between; align-items: center; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--paper-2); border: 1px solid var(--rule); border-bottom: none; border-radius: 10px 10px 0 0; padding: .4rem .9rem; }
/* Pygments umschließt <pre> mit <div class="codehilite">; Kopf und Code sollen
   ein nahtloser Block sein: Code erbt Rahmen unten, ohne Doppelkante/Fuge. */
.code-wrap .codehilite { margin: 0; }
.code-wrap .codehilite pre, .code-wrap > pre { margin: 0; border-top: none; border-radius: 0 0 10px 10px; }
.ck-actions { display: flex; align-items: center; gap: .4rem; }
/* Mindest-Trefferfläche 24x24 px (WCAG 2.2 SC 2.5.8). Vorher .1rem Höhe
   -> ~18 px: für motorisch eingeschränkte Nutzer:innen kaum treffbar. */
.kopieren { font: inherit; font-size: 11px; cursor: pointer; background: transparent; border: 1px solid var(--rule); color: var(--muted); border-radius: 6px; padding: .3rem .6rem; min-height: 24px; text-transform: none; letter-spacing: 0; transition: .12s; }
.kopieren:hover { color: var(--accent); border-color: var(--accent); }
.wo-btn { font: inherit; font-size: 11px; cursor: pointer; min-height: 24px; background: transparent; border: 1px solid var(--rule);
  color: var(--muted); border-radius: 6px; padding: .1rem .55rem; text-transform: none; letter-spacing: 0; transition: .12s; }
.wo-btn:hover { color: var(--accent); border-color: var(--accent); }
.wo-btn[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-tint); }
.wo-hint { display: flex; align-items: flex-start; gap: .5rem; font-size: .82rem; line-height: 1.5;
  color: var(--ink); background: var(--accent-tint); border: 1px solid var(--rule); border-bottom: none;
  padding: .6rem .9rem; text-transform: none; letter-spacing: 0; }
.wo-hint[hidden] { display: none; }
.wo-hint .wo-ico { flex: none; color: var(--accent); margin-top: .1rem; }
.wo-hint .wo-ico svg { width: 15px; height: 15px; }
.wo-hint b { font-weight: 640; }
.wo-hint code, .wo-hint kbd { font-size: .82em; }
.wo-hint kbd { padding: .05em .35em; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); }
code { font-family: var(--mono); font-size: .85em; background: var(--paper-2); border: 1px solid var(--rule-soft); padding: .12em .4em; border-radius: 6px; }
pre { font-family: var(--mono); background: var(--paper-2); border: 1px solid var(--rule); border-radius: 12px; padding: 1.25rem 1.45rem; overflow-x: auto; font-size: .84em; line-height: 1.65; margin: 0 0 1.8rem; }
pre code { background: none; border: none; padding: 0; font-size: 1em; }
/* Lange Blöcke: gekürzt mit Fade + Umschalter */
.code-wrap.clamped .codehilite { position: relative; max-height: 20em; overflow: hidden; }
.code-wrap.clamped.open .codehilite { max-height: none; }
.code-wrap.clamped .codehilite pre { border-radius: 0; }
.code-wrap.clamped:not(.open) .codehilite::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5em; background: linear-gradient(transparent, var(--paper-2)); pointer-events: none; }
.code-more { display: block; width: 100%; font: inherit; font-size: .78rem; font-weight: 600; cursor: pointer; color: var(--accent); background: var(--paper-2); border: 1px solid var(--rule); border-top: none; border-radius: 0 0 12px 12px; padding: .55rem; transition: background .12s; }
.code-more:hover { background: var(--accent-tint); }

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; scrollbar-width: thin; margin: 0 0 1.5rem; }
table { border-collapse: collapse; width: 100%; margin: 1.7rem 0 2.1rem; font-size: 14.5px; font-variant-numeric: tabular-nums; }
thead th { text-align: left; font-weight: 700; color: var(--ink); padding: .5rem .7rem; border-bottom: 2px solid var(--rule); white-space: nowrap; }
tbody td { padding: .48rem .7rem; border-bottom: 1px solid var(--rule-soft); color: var(--ink-soft); vertical-align: top; }
tbody tr:last-child td { border-bottom: 2px solid var(--rule); }

/* ---------- Figures + lightbox ---------- */
figure { margin: 2.2rem 0; text-align: center; width: min(var(--breakout), 100%); margin-inline: calc((100% - min(var(--breakout), 100%)) / 2); }
figure img { max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--rule); background: var(--card); cursor: zoom-in; }
figcaption { font-size: 13px; line-height: 1.5; color: var(--muted); margin-top: .7rem; text-align: left; max-width: 40rem; margin-inline: auto; }
figcaption .fig-num { color: var(--accent); font-weight: 700; }
figcaption .fig-code { color: var(--accent); text-decoration: none; white-space: nowrap;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
figcaption .fig-code:hover { border-color: var(--accent); }
.lb-code { margin-top: .9rem; display: inline-flex; align-items: center; gap: .4rem; font-size: 13px;
  color: #fff; text-decoration: none; border: 1px solid rgba(255,255,255,.45); border-radius: 8px;
  padding: .35rem .8rem; transition: background .15s; }
.lb-code span { font-family: var(--mono); opacity: .85; }
.lb-code:hover { background: rgba(255,255,255,.14); }
.lightbox { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: clamp(1rem, 4vw, 3rem); background: rgba(10,11,13,.82); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); opacity: 0; pointer-events: none; transition: opacity .22s ease; cursor: zoom-out; }
.lightbox.show { opacity: 1; pointer-events: auto; }
.lightbox[hidden] { display: none; }
.lightbox .lb-stage { position: relative; display: grid; gap: .9rem; justify-items: center; max-width: 100%; cursor: default; }
/* Schließen-Button: sichtbarer, fokussierbarer Ausstieg aus dem Overlay. */
.lb-close { position: absolute; top: -.5rem; right: -.5rem; z-index: 2;
  width: 40px; height: 40px; display: grid; place-items: center;
  font-size: 22px; line-height: 1; cursor: pointer;
  color: #fff; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28);
  border-radius: 999px; transition: background .12s; }
.lb-close:hover { background: rgba(255,255,255,.26); }
.lb-close:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
/* Abbildungen sind jetzt Buttons — der Fokus muss sichtbar sein. */
figure img[role="button"] { cursor: zoom-in; }
figure img[role="button"]:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ---------- Skip-Link (WCAG 2.4.1) ---------- */
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 200;
  padding: .7rem 1.1rem; background: var(--accent); color: #fff; font-weight: 600;
  border-radius: 0 0 var(--radius-sm) 0; text-decoration: none; }
.skip-link:focus { left: 0; }
.lightbox img { max-width: min(92vw, 1400px); max-height: 84vh; width: auto; height: auto; border-radius: 10px; box-shadow: 0 30px 90px -20px rgba(0,0,0,.7); transform: scale(.965); transition: transform .22s cubic-bezier(.2,.7,.2,1); }
.lightbox.show img { transform: none; }
.lightbox .lb-caption { font-size: 13.5px; line-height: 1.5; color: rgba(255,255,255,.8); text-align: center; max-width: 64ch; }

/* ---------- Prev/next + footer ---------- */
.lesson-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem;
  margin: 2.5rem 0 0; padding-top: 1.2rem; border-top: 1px solid var(--rule); }
.lesson-actions a { font-size: .88rem; font-weight: 600; text-decoration: none; border: 1px solid var(--rule);
  border-radius: 8px; padding: .42rem .75rem; color: var(--accent); background: transparent; transition: .12s; }
.lesson-actions a:hover { border-color: var(--accent); background: var(--accent-tint); }
.lesson-actions .la-primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.lesson-actions .done-toggle { margin-left: auto; }
html[data-theme="dark"] .lesson-actions .la-primary { color: #0d1117; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .lesson-actions .la-primary { color: #0d1117; }
}
.weiter-nav { display: flex; gap: 1rem; margin-top: 3.2rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.weiter-nav a { flex: 1; text-decoration: none; border: 1px solid var(--rule); border-radius: 10px; padding: .85rem 1.1rem; color: var(--ink); transition: border-color .12s, background .12s; }
.weiter-nav a:hover { border-color: var(--accent); background: var(--paper-2); }
.weiter-nav .richtung { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.weiter-nav .ziel { font-weight: 600; color: var(--accent); margin-top: .15rem; }
.weiter-nav .weiter-rechts { text-align: right; }
footer.seitenfuss { font-size: 12.5px; color: var(--muted); margin-top: 3rem; padding-top: 1.2rem; border-top: 1px solid var(--rule); display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
footer.seitenfuss a { color: var(--muted); text-decoration: none; } footer.seitenfuss a:hover { color: var(--accent); }

/* ---------- FAB ---------- */
.fab { position: fixed; right: clamp(1rem, 3vw, 2rem); bottom: 1.4rem; z-index: 55; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--card); color: var(--ink); border: 1px solid var(--rule); box-shadow: var(--shadow); cursor: pointer; opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .3s ease, transform .3s ease, background .15s ease; }
.fab.show { opacity: 1; transform: none; pointer-events: auto; } .fab:hover { background: var(--paper-2); } .fab svg { width: 19px; height: 19px; }

/* ---------- Contents page ---------- */
.teil-head { margin: 3rem 0 .4rem; }
.teil-head .teil-num { font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.teil-head h2 { font-size: 1.25rem; font-weight: 600; margin: .2rem 0 0; border: none; }
.karten { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 1.1rem; margin: 1.2rem 0 2.2rem; }
.karte { border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.3rem 1.45rem; text-decoration: none; color: var(--ink); background: var(--card); box-shadow: var(--shadow); transition: border-color .22s ease, box-shadow .22s ease, transform .22s cubic-bezier(.16, 1, .3, 1); display: block; }
.karte:hover { border-color: var(--accent); box-shadow: var(--shadow-pop); transform: translateY(-4px); }
.karte .k-num { font-size: .72rem; font-weight: 700; color: var(--accent); letter-spacing: .04em; }
.karte .k-titel { font-weight: 640; margin: .25rem 0 .2rem; font-size: 1.05rem; letter-spacing: -.005em; color: var(--ink); }
.karte .k-text { font-size: .86rem; color: var(--muted); line-height: 1.48; }
.karte .k-meta { display: flex; flex-wrap: wrap; gap: .25rem .7rem; margin-top: .9rem; padding-top: .75rem;
  border-top: 1px solid var(--rule-soft); font-size: .72rem; line-height: 1.35; color: var(--muted); }
.karte .k-meta span:first-child { font-variant-numeric: tabular-nums; color: var(--muted); }
.karte .k-meta span:empty { display: none; }

/* ============================================================= *
 *  Erweiterungen: Interaktion, Zwei-Spuren-Didaktik, Fortschritt *
 * ============================================================= */

/* ---------- Topbar: Schatten beim Scrollen + Fortschritts-Pille ---------- */
.topbar.scrolled { box-shadow: 0 1px 0 var(--rule), 0 6px 20px -16px rgba(20,24,30,.5); }
.nm-btn-progress { font-size: .7rem; font-weight: 700; color: var(--accent);
  background: var(--accent-tint); border-radius: 99px; padding: .1rem .45rem;
  font-variant-numeric: tabular-nums; letter-spacing: .02em; margin-left: .3rem;
  display: inline-block; vertical-align: middle; }

/* ---------- Studybar (Tiefe / Codesprache) ---------- */
.studybar { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; margin: 0; align-items: baseline; }
/* Zwei Spalten: Beschriftung, Optionen. Die feste Breite der ersten Spalte ist
   der ganze Punkt — sonst beginnt „Grundlagen" hinter LERNTIEFE an einer
   anderen Kante als „Python" hinter CODEANSICHT, und die Liste franst aus. */
.seg { display: grid; grid-template-columns: 6rem 1fr; align-items: center; column-gap: .75rem;
  border: none; background: transparent; padding: 0; }
.seg-label { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); }
/* Der negative Rand hebt das Innenpolster des ersten Knopfes auf, damit sein
   Text exakt auf der Spaltenkante sitzt und nicht .4rem daneben. */
.seg-opts { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem; row-gap: .1rem;
  margin-left: -.4rem; }
/* Mindest-Trefferfläche 24×24 px (WCAG 2.2 §2.5.8). Vorher `padding: 0` —
   auf dem Tablet praktisch nicht treffbar. */
.seg button { font: inherit; font-size: .82rem; cursor: pointer; border: none; background: none;
  padding: .3rem .4rem; min-height: 24px; min-width: 24px; border-radius: var(--radius-sm);
  color: var(--muted); transition: color .12s; }
.seg button:hover { color: var(--accent); }
.seg button.on { color: var(--accent); font-weight: 600; background: none; }
.seg button:not(:last-of-type)::after { content: "·"; color: var(--faint); font-weight: 400; margin-left: .5rem; }

/* ---------- Sprachfilter: einzelne Codeblöcke + ganze Abschnitte ---------- */
html[data-lang="py"] .code-wrap[data-lang="r"],
html[data-lang="r"]  .code-wrap[data-lang="py"],
html[data-lang="py"] .lang-section[data-lang="r"],
html[data-lang="r"]  .lang-section[data-lang="py"],
html[data-lang="py"] .lang-lead[data-lang="r"],
html[data-lang="r"]  .lang-lead[data-lang="py"],
/* Die Erklärung folgt ihrem Codeblock — sie verschwindet mit ihm. Sonst stünde
   in der R-Ansicht eine Verbalisierung von Python-Code ohne den Code dazu. */
html[data-lang="py"] .code-verbalization[data-lang="r"],
html[data-lang="r"]  .code-verbalization[data-lang="py"] { display: none; }
.lang-section { display: block; }
/* Quelltext-Seiten zeigen immer ihre eine Datei — Sprachfilter gilt hier nicht. */
.page.codepage .code-wrap { display: block !important; }

/* ---------- Didaktische Callouts: ruhige Rand-Notizen ---------- */
/* Voraussetzungs-Hinweis über Code-Lektionen: ruhig, dezent, ausblendbar. */
.prereq { display: flex; align-items: flex-start; gap: .7rem; margin: 0 0 2rem;
  padding: .85rem 1rem; border: 1px solid var(--rule); border-left: 3px solid var(--accent);
  border-radius: 10px; background: var(--accent-tint); }
.prereq[hidden] { display: none; }
.prereq .pq-ico { flex: none; color: var(--accent); margin-top: .05rem; }
.prereq .pq-ico svg { width: 18px; height: 18px; }
.prereq .pq-text { font-size: .88rem; line-height: 1.5; color: var(--ink); }
.prereq .pq-text strong { font-weight: 640; }
.prereq .pq-text a { color: var(--accent); font-weight: 560; text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.prereq .pq-text a:hover { border-bottom-color: var(--accent); }
.prereq .pq-text code { font-size: .84em; }
.prereq .pq-close { flex: none; margin-left: auto; width: 26px; height: 26px; border: none; border-radius: 7px;
  background: transparent; color: var(--muted); font-size: 1.15rem; line-height: 1; cursor: pointer; transition: .12s; }
.prereq .pq-close:hover { background: var(--paper-2); color: var(--ink); }

/* Kurzorientierung pro Lektion: Frage, Werkzeug, Ergebnis. */
.lesson-brief { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0;
  margin: 0 0 1.7rem; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.brief-cell { padding: .82rem 1rem .9rem; border-right: 1px solid var(--rule-soft); }
.brief-cell:last-child { border-right: none; }
.brief-label { display: block; margin-bottom: .22rem; font-size: 10px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.brief-cell span:last-child { display: block; font-size: .86rem; line-height: 1.46; color: var(--ink-soft); }

/* Übungsseiten: Erwartung rahmen, ohne Aufgaben zu überformen. */
.practice-brief { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0;
  margin: 0 0 1.7rem; border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; background: var(--card); }
.practice-step { display: flex; align-items: flex-start; gap: .6rem; padding: .82rem .95rem; border-right: 1px solid var(--rule-soft);
  font-size: .84rem; line-height: 1.45; color: var(--ink-soft); }
.practice-step:last-child { border-right: none; }
.practice-step b { color: var(--ink); font-weight: 640; }
.practice-num { flex: none; display: grid; place-items: center; width: 1.35rem; height: 1.35rem;
  border-radius: 50%; background: var(--accent-tint); color: var(--accent); font-size: .72rem; font-weight: 700; }

/* Didaktische Callouts – elegante Blöcke mit weichem Hintergrund */
.callout { margin: 1.6rem 0; border: none; border-left: 4px solid var(--rule); border-radius: 0 12px 12px 0;
  padding: 1.1rem 1.4rem; background: var(--paper-2); transition: background .12s ease; }
.callout .c-tag { display: inline-flex; align-items: center; gap: .38rem; font-size: 10.5px; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase; margin-bottom: .4rem; }
.callout .c-tag svg { width: 13px; height: 13px; }
.callout .callout-body > :first-child { margin-top: 0; }
.callout .callout-body > :last-child { margin-bottom: 0; }
.callout .callout-body p { font-size: 15.5px; color: var(--ink-soft); line-height: 1.6; }
.callout.fallstrick { background: var(--warn-tint); border-left-color: var(--warn); }
.callout.fallstrick .c-tag { color: var(--warn); }
.callout.praxis { background: var(--accent-tint); border-left-color: var(--accent); }
.callout.praxis .c-tag { color: var(--accent); }
.callout.merksatz { background: var(--ok-tint); border-left-color: var(--ok); }
.callout.merksatz .c-tag { color: var(--ok); }
.callout.merksatz .callout-body p { color: var(--ink); }

/* Einklappbare Spuren (natives <details>) */
details.callout.adv { background: var(--adv-tint); border-left-color: var(--adv); border-radius: 12px; }
details.callout.basis { background: var(--ok-tint); border-left-color: var(--ok); border-radius: 12px; }
details.callout.adv summary, details.callout.basis summary { list-style: none; cursor: pointer; display: flex;
  align-items: center; justify-content: space-between; gap: .8rem; padding: .1rem 0; }
details.callout.adv summary::-webkit-details-marker,
details.callout.basis summary::-webkit-details-marker { display: none; }
details.callout.adv summary .c-tag { margin: 0; color: var(--adv); }
details.callout.basis summary .c-tag { margin: 0; color: var(--ok); }
details.callout .c-hint { font-size: 10.5px; font-weight: 600; color: var(--muted); }
details.callout .c-hint::after { content: " ▾"; }
details.callout[open] .c-hint::after { content: " ▴"; }
details.callout .callout-body { padding: .7rem 0 0; }
details.callout summary:hover .c-tag { filter: brightness(1.08); }

/* ---------- Selbstcheck als Erinnerungskarten ---------- */
.quiz { display: grid; gap: .6rem; margin: 1rem 0 1.4rem; }
.quiz-card { border: 1px solid var(--rule); border-radius: 11px; background: var(--card); overflow: hidden; }
.quiz-q { display: flex; align-items: flex-start; gap: .7rem; width: 100%; text-align: left; font: inherit;
  cursor: pointer; background: transparent; border: none; color: var(--ink); padding: .85rem 1rem; }
.quiz-q:hover { background: var(--paper-2); }
.quiz-num { flex: none; display: grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%;
  background: var(--accent-tint); color: var(--accent); font-size: .78rem; font-weight: 700; margin-top: .05rem; }
.quiz-text { flex: 1; font-weight: 500; }
.quiz-toggle { flex: none; font-size: .72rem; font-weight: 600; color: var(--accent); white-space: nowrap;
  padding-top: .15rem; }
.quiz-a { max-height: 0; overflow: hidden; padding: 0 1rem 0 3.2rem; font-size: 15px; color: var(--ink-soft);
  border-top: 1px solid transparent; transition: max-height .28s ease, padding .28s ease; }
.quiz-card.show .quiz-a { max-height: 40rem; padding: .8rem 1rem .95rem 3.2rem; border-top-color: var(--rule-soft); }

/* ---------- Quelltext-Seiten: Einordnung vor dem Code -------------------- */
/* Ohne diesen Kasten begann eine Code-Seite mit Zeile 1 eines Skripts — der
   Reiter „Python" führte in eine Datei ohne Anlass. */
.code-intro {
  border: 1px solid var(--rule); border-left: 3px solid var(--accent);
  border-radius: 10px; background: var(--paper-2);
  padding: .95rem 1.1rem; margin: 0 0 1.4rem;
}
.code-intro .ci-lead { margin: 0 0 .8rem; font-size: .95rem; line-height: 1.55; color: var(--ink); }
.code-intro .ci-row {
  display: grid; grid-template-columns: 6.5rem 1fr; column-gap: .75rem;
  padding: .38rem 0; border-top: 1px solid var(--rule-soft); align-items: baseline;
}
.code-intro .ci-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted);
}
.code-intro .ci-val { font-size: .88rem; line-height: 1.5; color: var(--ink-soft); }
.code-intro .ci-back {
  margin: .85rem 0 0; padding-top: .7rem; border-top: 1px solid var(--rule-soft);
  font-size: .85rem; color: var(--muted);
}
@media (max-width: 640px) {
  .code-intro .ci-row { grid-template-columns: 1fr; row-gap: .1rem; }
}

/* ---------- Dateiverweise, die ins Repository zeigen --------------------- */
/* Der Pfad bleibt Code und liest sich wie Code; nur die feine Unterstreichung
   verrät, dass er anklickbar ist. */
a.dateilink { text-decoration: none; border: none; }
a.dateilink > code {
  border-bottom: 1px solid var(--rule);
  transition: border-color .15s ease, color .15s ease;
}
a.dateilink:hover > code { border-bottom-color: var(--accent); color: var(--accent); }
a.dateilink:focus-visible > code { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Abbildungs-Seite: Bild oben, sein Code darunter -------------- */
.fig-solo { margin: 0 0 1.2rem; }
.fig-solo img { width: 100%; height: auto; border: 1px solid var(--rule); border-radius: 8px; }
.fig-src { font-size: .92rem; color: var(--muted); margin: 0 0 .3rem; }
.fig-hint { font-size: .88rem; color: var(--muted); margin: 0 0 1rem; font-style: italic; }
.fig-back { margin-top: 1.4rem; font-size: .92rem; }

/* ---------- Ohne JavaScript --------------------------------------------- *
 * Das Inline-Skript im <head> setzt data-js="1", bevor irgendetwas gezeichnet
 * wird. Fehlt das Attribut, läuft kein JS: dann klappt kein Klick eine Antwort
 * auf, und `.quiz-a { max-height: 0 }` hätte JEDE Selbstcheck-Antwort dauerhaft
 * unlesbar gemacht. Also alles zeigen — und die Bedienelemente ausblenden, die
 * ohne ihre Handler nur tote Knöpfe wären.
 * ------------------------------------------------------------------------- */
html:not([data-js]) .quiz-a {
  max-height: none; overflow: visible; transition: none;
  padding: .8rem 1rem .95rem 3.2rem; border-top-color: var(--rule-soft);
}
html:not([data-js]) .quiz-toggle,
html:not([data-js]) .studybar,
html:not([data-js]) .settings-panel,
html:not([data-js]) .done-toggle,
html:not([data-js]) .pfad-picker,
html:not([data-js]) .ring,
html:not([data-js]) .fab { display: none !important; }

/* ---------- Modul abschließen (ruhiger Umschalter, oben rechts) ---------- */
.done-toggle { display: inline-flex; align-items: center; gap: .42rem; font: inherit; font-size: .8rem;
  line-height: 1; white-space: nowrap; cursor: pointer; border: none; background: none; padding: 0;
  color: var(--muted); transition: color .12s; }
.done-toggle:hover { color: var(--ok); }
.done-toggle .dt-ico { flex: none; display: inline-grid; place-items: center; width: 17px; height: 17px;
  border: 1.5px solid var(--rule); border-radius: 50%; color: transparent; transition: .15s; }
.done-toggle .dt-ico svg { width: 12px; height: 12px; display: block; }
.done-toggle:hover .dt-ico { border-color: var(--ok); color: var(--ok); }
.done-toggle.on { color: var(--ok); font-weight: 600; }
.done-toggle.on .dt-ico { background: var(--ok); border-color: var(--ok); color: #fff; }

/* ---------- Übersicht: Fortsetzen + Fokusfilter ---------- */
.uebersicht-kopf { display: grid; grid-template-columns: 1fr; align-items: start;
  gap: 1rem; margin: .5rem 0 1.5rem; padding: 1rem 0; border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule); }
.course-resume { min-width: 0; display: flex; align-items: center; gap: .85rem; }
.course-resume .resume-text { min-width: 0; }
.resume-label { display: block; margin-bottom: .18rem; font-size: 10px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.course-resume a { display: inline-flex; align-items: center; color: #fff; background: var(--accent);
  font-size: .95rem; font-weight: 650; text-decoration: none; border: 1px solid var(--accent);
  border-radius: 8px; padding: .55rem .85rem; line-height: 1.35; }
.course-resume a:hover { background: var(--accent-2); border-color: var(--accent-2); }
/* Pfad-Filter: kompakter, sekundärer Ausklapper neben dem immer sichtbaren
   Weiterlernen-Link — bewusst zugeklappt, damit die Übersicht ruhig bleibt,
   aber ein Klick entfernt und klar beschriftet. */
.pfad-details { justify-self: start; }
.pfad-summary { display: inline-flex; align-items: center; gap: .4rem; cursor: pointer; list-style: none;
  user-select: none; font-size: .84rem; font-weight: 600; color: var(--muted);
  padding: .5rem .9rem; border: 1px solid var(--rule); border-radius: 99px; background: var(--card);
  transition: color .12s, border-color .12s, background .12s; }
.pfad-summary::-webkit-details-marker { display: none; }
.pfad-summary::after { content: "▾"; font-size: .68rem; transition: transform .14s ease; }
.pfad-details[open] .pfad-summary::after { transform: rotate(180deg); }
.pfad-summary:hover { color: var(--accent); border-color: var(--accent); }
.pfad-details[open] .pfad-summary { color: var(--accent); border-color: var(--accent); background: var(--accent-tint); }
.pfad-details .overview-tools { margin-top: .8rem; }
.overview-tools { display: flex; flex-wrap: wrap; justify-content: flex-start; align-items: center; gap: .55rem .9rem; }
.overview-secondary-box { display: flex; flex-direction: column; align-items: flex-start; gap: .18rem; }
.overview-secondary { font-size: .92rem; font-weight: 600; color: var(--accent);
  text-decoration: none; border-bottom: 1px solid var(--rule); padding: .55rem 0 .4rem; line-height: 1.35; transition: .12s; }
.overview-secondary:hover { color: var(--accent-2); border-bottom-color: var(--accent-2); }
.pfad-picker { display: flex; flex-direction: column; align-items: flex-start; gap: .18rem; }
.pfad-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.pfad-buttons button { font: inherit; font-size: .8rem; cursor: pointer; border: 1px solid var(--rule);
  background: var(--card); color: var(--muted); border-radius: 99px; padding: .3rem .72rem; transition: .12s; }
.pfad-buttons button:hover { color: var(--accent); border-color: var(--accent); }
.pfad-buttons button.on { background: var(--accent-tint); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 42%, transparent); font-weight: 600; }
.ring { position: relative; width: 60px; height: 60px; flex: none; display: grid; place-items: center; }
.ring svg { width: 60px; height: 60px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 5; }
.ring .ring-bg { stroke: var(--rule); }
.ring .ring-fill { stroke: var(--ok); stroke-linecap: round; transition: stroke-dashoffset .7s cubic-bezier(.3,.7,.2,1); }
.ring .ring-label { position: absolute; font-size: 12.5px; font-weight: 700; color: var(--ink-soft);
  font-variant-numeric: tabular-nums; }

/* ---------- Karten: Nummer, Schrittabzeichen, erledigt, Pfad-Hervorhebung ---------- */
.karte .k-top { display: flex; align-items: center; gap: .5rem; }
.karte .k-num { font-size: .72rem; font-weight: 700; color: var(--accent); letter-spacing: .04em; }
.karte .k-step { font-size: .66rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: #fff; background: var(--accent); border-radius: 99px; padding: 0 .5rem; line-height: 1.5; }
.karte .k-step:empty { display: none; }
html[data-theme="dark"] .karte .k-step { color: #0d1117; }
.karte .k-done { margin-left: auto; display: inline-flex; color: var(--ok); opacity: 0; transition: opacity .18s; }
.karte .k-done svg { width: 16px; height: 16px; }
.karte.done .k-done { opacity: 1; }
.karte.done .k-num { color: var(--ok); }
.karte.dim { opacity: .38; filter: saturate(.6); }
.karte.on-path { border-color: var(--accent); box-shadow: var(--shadow); }

@media (max-width: 760px) {
  .lesson-brief { grid-template-columns: 1fr; }
  .brief-cell { border-right: none; border-bottom: 1px solid var(--rule-soft); padding-inline: 0; }
  .brief-cell:last-child { border-bottom: none; }
  .practice-brief { grid-template-columns: 1fr; }
  .practice-step { border-right: none; border-bottom: 1px solid var(--rule-soft); }
  .practice-step:last-child { border-bottom: none; }
  .uebersicht-kopf { grid-template-columns: 1fr; justify-items: stretch; }
  .overview-tools { justify-content: flex-start; }
  .ring { justify-self: start; }
}
@media (max-width: 640px) { body { font-size: 16.5px; } h1.title { font-size: 1.85rem; } figcaption { max-width: none; }
  .quiz-toggle { display: none; } }
@media print {
  .topbar, .progress, .fab, .anchor-link, .toc-inline, .lightbox, .sub-nav, .weiter-nav,
  .studybar, .pfad-picker, .ring, .done-toggle, .quiz-toggle, .settings-panel { display: none !important; }
  /* Bildschirm-Bedienelemente, die auf Papier nur Platz kosten. */
  .kopieren, .wo-btn, .skip-link, .lb-close { display: none !important; }
  .page { max-width: none; } body { font-size: 11pt; } a { color: inherit; border: none; }
  figure { width: auto; margin-inline: 0; }
  .callout, .quiz-card { break-inside: avoid; }
  .quiz-a { max-height: none !important; padding: .5rem 1rem .5rem 3.2rem !important; }

  /* Auf Papier gibt es kein Aufklappen. Jede eingeklappte Spur muss gedruckt
     werden — sonst verliert ein Ausdruck von Modul 14 stillschweigend die
     Vertiefung (§7–§11), also den größeren Teil des Moduls. */
  details.callout.adv .callout-body,
  details.callout.basis .callout-body,
  details.vertiefung .vertiefung-body { display: block !important; }
  details.vertiefung > summary { list-style: none; font-weight: 650; }
  details.vertiefung > summary::-webkit-details-marker { display: none; }

  /* Ein gedruckter Link ohne Adresse ist kein Link. */
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .82em; word-break: break-all; }
  h1 a[href]::after, h2 a[href]::after, h3 a[href]::after, pre a[href]::after { content: ""; }
  /* Dateiverweise nicht: `lib/helpers.py` sagt auf Papier schon alles, und die
     Repo-Adresse dahinter stünde zweihundertmal im Fließtext. */
  a.dateilink[href]::after { content: ""; }
  a.dateilink > code { border-bottom: none; }

  pre, code { white-space: pre-wrap; word-break: break-word; }
  pre, figure, table { break-inside: avoid; }
}

/* ============================================================= *
 *  Startseite: klare Abschnitte, ruhige Hierarchie              *
 * ============================================================= */
.page.landing { max-width: 66rem; }
.landing .body > .ls { padding-top: 2.6rem; }
.landing .body > .ls + .ls { margin-top: 2.6rem; border-top: 1px solid var(--rule); }
.landing .ls > h2 {
  font-size: 1.4rem; font-weight: 640; letter-spacing: -.01em; line-height: 1.2;
  margin: 0 0 1rem; padding: 0; border: none; color: var(--ink);
}
.landing .ls p { line-height: 1.6; }
.ls-intro { padding-top: .4rem !important; }
.ls-intro > p:first-child { font-size: 1.08rem; color: var(--muted); margin-top: 0; }
.ls-lede { color: var(--muted); font-size: .95rem; margin: -.5rem 0 1.4rem; }

/* Einstieg – ruhige Auswahl, keine Card-Fläche */
.ls-start { border-top: 1px solid var(--rule) !important; margin-top: 2.2rem;
  padding: 1.8rem 0 .25rem !important; background: transparent;
  border-right: 0; border-bottom: 0; border-left: 0; border-radius: 0; }
.ls-start > h2 { font-size: 1.16rem; margin-bottom: .35rem; }
.ls-start > p { max-width: 42rem; margin: .35rem 0 1rem; color: var(--muted); font-size: .98rem; }
.ls-start ul { counter-reset: start-step; list-style: none; max-width: 48rem;
  margin: 1.05rem 0 .9rem; padding: 0;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.ls-start li { counter-increment: start-step; position: relative; margin: 0;
  padding: .8rem 0 .82rem 2.75rem; background: transparent;
  border-top: 1px solid var(--rule-soft); border-radius: 0;
  font-size: .9rem; line-height: 1.5; color: var(--ink-soft); }
.ls-start li:first-child { border-top: 0; }
.ls-start li::before { content: counter(start-step); position: absolute; left: 0; top: .86rem;
  display: grid; place-items: center; width: 1.35rem; height: 1.35rem;
  border-radius: 50%; background: var(--accent-tint); color: var(--accent);
  font-size: .72rem; font-weight: 700; line-height: 1; }
.ls-start li strong { color: var(--ink); font-weight: 650; }
.ls-start > p:last-child { margin-bottom: 0; font-size: .9rem; color: var(--muted); }

/* „Was du danach kannst" – zweispaltige Häkchenliste */
.ls-ergebnis ul { list-style: none; padding: 0; margin: 0; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); gap: .5rem 1.6rem; }
.ls-ergebnis li { position: relative; padding-left: 1.5rem; font-size: .92rem; line-height: 1.5; }
.ls-ergebnis li::before { content: ""; position: absolute; left: 0; top: .34em;
  width: .7rem; height: .38rem; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg); }

/* Modulübersicht – Grid sitzt direkt im Abschnitt */
.ls-module .uebersicht-kopf { margin-top: .2rem; }
.ls-module .teil-head:first-of-type { margin-top: 1.4rem; }

/* ---------- Checkboxen in Listen (Checklisten) ---------- */
.task-list-item { list-style: none !important; padding-left: 0 !important; margin-left: 0 !important; }
.task-list-item-checkbox { margin-right: 0.55rem; cursor: pointer; width: 14.5px; height: 14.5px;
  accent-color: var(--accent); vertical-align: middle; transform: translateY(-1px); }

/* ---------- Centered Resources Modal Overlay ---------- */
.resources-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 1.5rem; visibility: hidden; pointer-events: none; }
.resources-overlay.open { visibility: visible; pointer-events: auto; }

.ro-backdrop { position: absolute; inset: 0; background: rgba(10, 12, 16, 0.45); opacity: 0; transition: opacity .2s ease; }
html[data-theme="dark"] .ro-backdrop { background: rgba(5, 7, 10, 0.65); }
.resources-overlay.open .ro-backdrop { opacity: 1; }

.ro-sheet { position: relative; z-index: 101; width: min(96vw, 900px); height: min(88vh, 680px);
  background: var(--paper); border: 1px solid var(--rule); border-radius: 16px; display: flex; flex-direction: column;
  transform: scale(.95); opacity: 0; transition: transform .2s cubic-bezier(0.16, 1, 0.3, 1), opacity .2s ease;
  box-shadow: 0 20px 50px rgba(0,0,0,.22); overflow: hidden; }
.resources-overlay.open .ro-sheet { transform: scale(1); opacity: 1; }

.ro-header { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--rule); }
.ro-header h2 { font-size: 1.15rem; font-weight: 700; color: var(--ink); margin: 0; text-align: center; grid-column: 2; }
.ro-back { grid-column: 1; justify-self: start; background: transparent; border: none; cursor: pointer; color: var(--muted); padding: .4rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; transition: background .12s; }
.ro-back:hover { color: var(--accent); background: var(--paper-2); }
.ro-back svg { width: 18px; height: 18px; }
.ro-close { grid-column: 3; justify-self: end; background: transparent; border: none; font-size: 1.8rem; color: var(--muted); cursor: pointer; line-height: 1; padding: .1rem .4rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; transition: background .12s, color .1s; }
.ro-close:hover { color: var(--accent); background: var(--paper-2); }

.ro-body { flex: 1; overflow-y: auto; padding: 2.2rem 2.5rem; display: flex; flex-direction: column; gap: 2rem; }
.ro-section h3 { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 1rem; }

/* Grid-Layout für breite Menükarten */
.ro-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.2rem; }

.ro-link-btn { display: flex; align-items: flex-start; gap: 1rem; text-decoration: none;
  background: var(--card); border: 1px solid var(--rule); font: inherit; text-align: left; cursor: pointer;
  padding: 1.15rem 1.35rem; border-radius: 12px; transition: border-color .15s, box-shadow .15s, background .15s; }
.ro-link-btn:hover { border-color: var(--accent); background: var(--paper-2); box-shadow: 0 4px 12px rgba(0,0,0,.04); }

.ro-icon { flex: none; display: flex; align-items: center; justify-content: center; width: 42px; height: 42px;
  background: var(--paper); color: var(--muted); border-radius: 10px; border: 1px solid var(--rule); transition: .15s; }
.ro-link-btn:hover .ro-icon { background: var(--accent-tint); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.ro-link-btn:hover .ro-icon svg { color: var(--accent); }
.ro-icon svg { width: 20px; height: 20px; transition: color .15s; }

.ro-text { display: flex; flex-direction: column; gap: .25rem; }
.ro-text strong { font-size: .92rem; font-weight: 650; color: var(--ink); }
.ro-text span { font-size: .78rem; color: var(--muted); line-height: 1.45; }

.ro-content { flex: 1; overflow-y: auto; padding: 2rem 2.8rem; background: var(--paper); }
.ro-detail { font-size: .94rem; color: var(--ink-soft); line-height: 1.6; }
.ro-loading { color: var(--muted); font-size: .9rem; padding: 2rem 0; text-align: center; }
.ro-detail > :first-child { margin-top: 0; }
.ro-detail h2 { color: var(--ink); font-size: 1.3rem; margin-top: 1.8rem; margin-bottom: .8rem; }
.ro-detail h3 { color: var(--ink); font-size: 1.1rem; margin-top: 1.5rem; margin-bottom: .6rem; }
.ro-detail pre { padding: 1.25rem; border-radius: 10px; margin-bottom: 1.4rem; }
.ro-detail table { margin-bottom: 1.8rem; font-size: 13.8px; width: 100%; border-collapse: collapse; }
.ro-detail table th, .ro-detail table td { padding: .6rem .8rem; border-bottom: 1px solid var(--rule-soft); text-align: left; }
.ro-detail table th { border-bottom: 2px solid var(--rule); font-weight: 700; color: var(--ink); }

/* ---------- Daten-Downloads (Datensätze-Seite + Ressourcen-Overlay) ---------- */
.data-downloads { display: flex; flex-direction: column; gap: 0; margin: 0 0 2.2rem;
  border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; background: var(--card); }
.dl-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .5rem 1rem; padding: .75rem 1.1rem; border-bottom: 1px solid var(--rule-soft); }
.dl-row:last-of-type { border-bottom: none; }
.dl-info { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.dl-name { font-size: .92rem; font-weight: 640; color: var(--ink); }
.dl-meta { font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.dl-actions { display: flex; align-items: center; gap: .5rem; flex: none; }
/* Höher gescoped als „.body a" (Fließtext-Linkstil), damit Farbe/Rahmen der
   Download-Aktionen nicht vom allgemeinen Link-Unterstrich überschrieben werden. */
.data-downloads a { border-bottom: none; }
.data-downloads .dl-btn { font-size: .82rem; font-weight: 600; text-decoration: none; color: #fff;
  background: var(--accent); border: 1px solid var(--accent); border-radius: 7px; padding: .38rem .75rem;
  transition: background .12s; }
.data-downloads .dl-btn:hover { background: var(--accent-2); border-color: var(--accent-2); }
html[data-theme="dark"] .data-downloads .dl-btn { color: #0d1117; }
@media (prefers-color-scheme: dark) { html:not([data-theme="light"]) .data-downloads .dl-btn { color: #0d1117; } }
.dl-copy { font: inherit; font-size: .78rem; cursor: pointer; background: transparent; border: 1px solid var(--rule);
  color: var(--muted); border-radius: 7px; padding: .37rem .65rem; transition: .12s; }
.dl-copy:hover { color: var(--accent); border-color: var(--accent); }
.data-downloads .dl-colab { display: block; text-align: center; font-size: .84rem; font-weight: 600;
  text-decoration: none; color: var(--accent); background: var(--accent-tint); padding: .7rem 1rem;
  transition: background .12s; }
.data-downloads .dl-colab:hover { background: color-mix(in srgb, var(--accent-tint) 60%, var(--accent) 12%); }
@media (max-width: 560px) {
  .dl-row { flex-direction: column; align-items: stretch; }
  .dl-actions { justify-content: flex-end; }
}

/* ---------- Code Verbalization Hint ---------- */
.code-verbalization { font-size: .82rem; color: var(--muted); margin-top: -.65rem; margin-bottom: 1.25rem;
  padding: .5rem .75rem; border-left: 2px solid var(--rule); background: var(--paper-2); border-radius: 0 8px 8px 0; }
.code-verbalization strong { color: var(--ink-soft); font-weight: 650; }

/* ---------- Meta Segments ---------- */
.meta-accordion {
  margin-top: 3.5rem;
  border-top: 1px solid var(--rule);
  padding-top: 2rem;
}
.meta-accordion h2 {
  font-size: 1.4rem;
  color: var(--ink);
  margin-bottom: 1.2rem;
}
.meta-details {
  border: 1px solid var(--rule-soft);
  border-radius: 10px;
  background: var(--card);
  margin-bottom: 1rem;
  overflow: hidden;
}
.meta-details[open] {
  border-color: var(--rule);
}
.meta-details summary {
  padding: 0.9rem 1.2rem;
  font-size: 0.98rem;
  font-weight: 650;
  cursor: pointer;
  user-select: none;
  color: var(--ink);
}
.meta-details-content {
  padding: 1.2rem 1.5rem;
  border-top: 1px solid var(--rule-soft);
  background: var(--paper-2);
  font-size: 0.92rem;
  line-height: 1.6;
}
.meta-details-content > :first-child {
  margin-top: 0;
}
.meta-details-content > :last-child {
  margin-bottom: 0;
}



/* ---------- Abschnittsweise Vertiefungsspur (z. B. Modul 14, §7–§11) ------- */
details.vertiefung { margin: 2rem 0; border: 1px solid var(--adv-rule); border-radius: var(--radius);
  background: var(--adv-tint); overflow: hidden; }
details.vertiefung > summary { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem;
  padding: .9rem 1.1rem; cursor: pointer; font-weight: 600; color: var(--adv); list-style: none; }
details.vertiefung > summary::-webkit-details-marker { display: none; }
details.vertiefung > summary:focus-visible { outline: 3px solid var(--adv); outline-offset: -3px; }
details.vertiefung > summary .c-hint { font-weight: 400; font-size: 12.5px; color: var(--muted); }
details.vertiefung > summary::after { content: "▾"; margin-left: auto; transition: transform .15s ease; }
details.vertiefung[open] > summary::after { transform: rotate(180deg); }
details.vertiefung .vertiefung-body { padding: 0 1.1rem 1.1rem; background: var(--paper); }
details.vertiefung .vertiefung-body > h2:first-child { margin-top: 1.2rem; }
