/* Lernpfad Funktionen – gemeinsames Stylesheet */
:root {
  color-scheme: light;
  --text: #1d1d1f; --muted: #5d6166; --line: #d9dbde; --bg: #f6f6f3; --panel: #ffffff;
  --akzent: #2f5d50; --akzent-dunkel: #244a40; --akzent-hell: #e8f0ed;
  --blau: #1f5fbf; --begriff: #fff1bf;
  --ok: #1d7036; --ok-bg: #e2f3e6; --teil: #8a5a00; --teil-bg: #fcefd2; --falsch: #b0261d; --falsch-bg: #fbe4e1;
  --serif: "Times New Roman", "STIX Two Text", Georgia, serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body { margin: 0; background: var(--bg); color: var(--text);
       font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
a { color: var(--akzent); }
h1 { font-size: 1.7rem; line-height: 1.2; margin: 0 0 .4rem; letter-spacing: -.015em; }
h2 { font-size: 1.3rem; margin: 0 0 1rem; display: flex; align-items: center; gap: .6rem; }
h3 { font-size: 1.06rem; margin: 1.6rem 0 .6rem; }
p { margin: 0 0 .85rem; }
ul, ol { margin: 0 0 .85rem; padding-left: 1.4rem; }
li { margin-bottom: .3rem; }
sub { font-size: .72em; }

/* Kopfzeile */
.kopf { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
        gap: 1rem; padding: .6rem 20px; background: rgba(255,255,255,.94); backdrop-filter: blur(6px);
        border-bottom: 1px solid var(--line); }
.marke { display: inline-flex; align-items: center; gap: .6rem; color: var(--text); text-decoration: none; font-weight: 650; }
.marke-zeichen { font: italic 600 .95rem var(--serif); color: #fff; background: var(--akzent); border-radius: 6px; padding: .12rem .45rem; }
.kopf-info { font-size: .85rem; color: var(--muted); }

/* Layout */
.layout { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.layout.mit-nav { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 36px; }
main { min-width: 0; max-width: 860px; padding: 32px 0 72px; }
.ohne-nav main { margin: 0 auto; }

.schritte { position: sticky; top: 76px; align-self: start; padding-top: 32px; }
.schritte ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.schritte li { margin: 0; }
.schritte a { display: flex; align-items: center; gap: .6rem; padding: .45rem .7rem; margin-left: -2px;
              border-left: 2px solid transparent; color: var(--muted); text-decoration: none; font-size: .93rem; }
.schritte a:hover { color: var(--text); }
.schritte a.aktiv { color: var(--akzent); border-left-color: var(--akzent); font-weight: 600; }
.snr { flex: none; display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%;
       font-size: .78rem; font-weight: 600; background: #eceeec; color: var(--muted); }
.schritte a.aktiv .snr { background: var(--akzent); color: #fff; }

/* Seitenkopf eines Themas */
.thema-kopf { margin-bottom: 2rem; }
.thema-kopf .ueber { font-size: .85rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--akzent); margin-bottom: .3rem; }
.thema-kopf .lead { font-size: 1.07rem; color: var(--muted); max-width: 44rem; }

/* Schritte (Abschnitte) */
.schritt { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 1.6rem 1.7rem 1.4rem; margin-bottom: 1.6rem; }
.schritt > h2 .snr { width: 1.9rem; height: 1.9rem; font-size: .95rem; background: var(--akzent); color: #fff; }
.schritt-intro { color: var(--muted); }

/* Kästen */
.definition, .merke, .achtung, .beispiel, .loesungsweg { border-radius: 8px; padding: 1rem 1.15rem .4rem; margin: 0 0 1.1rem; }
.definition { background: #f7faf8; border: 1px solid #cfdcd6; border-left: 5px solid var(--akzent); }
.kasten-titel { display: block; font-weight: 700; font-size: .82rem; letter-spacing: .05em; text-transform: uppercase; color: var(--akzent); margin-bottom: .45rem; }
.merke { background: var(--akzent-hell); }
.merke .kasten-titel { color: #2b4a40; }
.achtung { background: #fdf6e7; border-left: 5px solid #c48a1a; }
.achtung .kasten-titel { color: var(--teil); }
.beispiel { background: #fbfcfb; border: 1px dashed #9aa5a0; }
.begriff { background: var(--begriff); font-weight: 650; padding: 0 .18em; border-radius: 3px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }

/* Formeln */
.fi svg { font-size: 1.08em; overflow: visible; vertical-align: middle; max-width: 100%; height: auto; }
.fb { display: block; text-align: center; margin: .7rem 0 .9rem; overflow-x: auto; overflow-y: hidden; padding: .15rem 0; }
.fb svg { font-size: 1.12em; overflow: visible; }
.links .fb, .fb.links { text-align: left; }

/* Tabellen */
.tabelle-wrap { overflow-x: auto; margin: 0 0 1.1rem; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; vertical-align: top; padding: .55rem .7rem; border-bottom: 1px solid var(--line); }
th { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafaf8; }
td .fb { margin: .1rem 0; text-align: left; }
table.zentriert th, table.zentriert td { text-align: center; }
.mtab td, .mtab th { text-align: center; border: 1px solid var(--line); }
.mtab .pfeil-up { color: var(--ok); font-size: 1.3rem; } .mtab .pfeil-down { color: var(--falsch); font-size: 1.3rem; }

/* Graphen */
.graphen { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem 2rem; margin: .4rem 0 1.1rem; }
.graphen figure { margin: 0; flex: 0 1 auto; text-align: center; }
figure.einzel { margin: .4rem 0 1.1rem; text-align: center; }
figcaption { font-size: .86rem; color: var(--muted); margin-top: .2rem; }
.graph { width: 100%; height: auto; display: block; margin: 0 auto; }
.graph text { font: 12px system-ui, -apple-system, "Segoe UI", sans-serif; fill: var(--text); }
.graph .tick { font-size: 11px; fill: var(--muted); }
.graph .aname, .graph .fv, .graph .klabel { font-family: var(--serif); font-style: italic; font-size: 15px; }
.graph .plabel { font-family: var(--serif); font-size: 14px; }
.graph .sub { font-size: 11px; }
.graph .notiz { font-size: 12px; fill: var(--muted); }
.graph .notiz.fv { font-size: 14px; fill: var(--text); }
.graph .notiz.steig { fill: var(--ok); font-weight: 600; } .graph .notiz.fall { fill: var(--falsch); font-weight: 600; }
.graph .gitter { stroke: #e7e9eb; stroke-width: 1; }
.graph .achse { stroke: #5a5f64; stroke-width: 1.2; }
.graph .pfeil { fill: #5a5f64; }
.graph .kurve { fill: none; stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; }
.graph .kurve.k1 { stroke: var(--akzent); } .graph text.k1 { fill: var(--akzent); }
.graph .kurve.k2 { stroke: var(--blau); } .graph text.k2 { fill: var(--blau); }
.graph .kurve.k-steig { stroke: var(--ok); } .graph .kurve.k-fall { stroke: var(--falsch); }
.graph .gestrichelt { stroke-dasharray: 7 5; }
.graph .hilf { stroke: #8a8f94; stroke-width: 1.2; stroke-dasharray: 4 4; }
.graph .pkt { fill: var(--akzent); stroke: #fff; stroke-width: 1.5; }
.graph .pkt-o { fill: #fff; stroke: var(--text); stroke-width: 1.5; }

/* Aufgaben */
.aufgabe { border: 1px solid var(--line); border-radius: 10px; padding: 1.15rem 1.25rem 1.1rem; margin: 0 0 1.3rem; background: #fff; }
.aufgabe-kopf { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .7rem; margin-bottom: .55rem; }
.aufgabe-kopf h3 { margin: 0; font-size: 1.08rem; }
.aufgabe-kopf .nr { color: var(--akzent); }
.typ { font-size: .74rem; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; padding: .12rem .5rem; border-radius: 99px;
       background: #eceeec; color: var(--muted); }
.typ.text { background: #e5eefb; color: #24508f; } .typ.wf { background: #f3e8fb; color: #6b2f8f; }
.typ.stell { background: #fcefd2; color: var(--teil); } .typ.abstrakt { background: var(--akzent-hell); color: var(--akzent); }
.stufe { font-size: .78rem; color: var(--muted); }
.auftrag { margin-bottom: .6rem; }
.hinweis { margin: .2rem 0 .8rem; padding: .5rem .75rem; background: var(--akzent-hell); border-radius: 6px; font-size: .89rem; color: #2b3a35; }
kbd { font: .85rem ui-monospace, Consolas, monospace; background: #fff; border: 1px solid #c9cdd1; border-bottom-width: 2px; border-radius: 4px; padding: 0 .3rem; }
ol.teile { list-style: none; padding: 0; margin: 0; counter-reset: teil; }
.teil { position: relative; padding: .75rem 0 .75rem 2.1rem; border-bottom: 1px solid #eceded; margin: 0; }
.teil:last-child { border-bottom: none; }
.teil::before { counter-increment: teil; content: counter(teil, lower-alpha) ")"; position: absolute; left: 0; top: .78rem; font-weight: 650; }
.zeile { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .6rem; margin: .2rem 0; }
.zeile + .zeile { margin-top: .5rem; }
.teil p { margin-bottom: .45rem; }
.rueck { font-size: .86rem; margin-top: .35rem; }
.rueck:empty { display: none; }
.rueck.ok { color: var(--ok); } .rueck.teil { color: var(--teil); } .rueck.falsch { color: var(--falsch); }
.aussage { font-style: italic; }
.zitat { margin: .3rem 0 .6rem; padding: .45rem .8rem; border-left: 3px solid #c9cdd1; background: #fafaf8; font-style: italic; }

/* Eingabefelder */
.in { font: inherit; font-size: 16px; color: var(--text); background: #fff; border: 1px solid #a7abb1; border-radius: 5px;
      padding: .28rem .45rem; transition: border-color .15s, background .15s; }
.in:focus { outline: none; border-color: var(--akzent); box-shadow: 0 0 0 3px rgba(47,93,80,.18); }
.in.zahl { width: 5rem; text-align: center; }
.in.term { width: 13rem; font-family: ui-monospace, Consolas, "Courier New", monospace; font-size: 15px; }
select.in { max-width: 100%; padding-right: .3rem; }
.in.ok { border-color: var(--ok); background: var(--ok-bg); }
.in.teil { border-color: #c48a1a; background: var(--teil-bg); }
.in.falsch { border-color: var(--falsch); background: var(--falsch-bg); }
.termbox { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.werkzeug { display: inline-flex; gap: .25rem; }
.werkzeug button { font: 13px/1 system-ui, sans-serif; padding: .32rem .45rem; cursor: pointer; color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: 4px; }
.werkzeug button:hover { border-color: var(--akzent); color: var(--akzent); }
.werkzeug sup { font-size: .7em; }
.vorschau { display: inline-flex; align-items: center; min-height: 2.1rem; padding: .15rem .65rem; border-radius: 5px; background: var(--akzent-hell); font-family: var(--serif); font-size: 1.15rem; }
.vorschau:empty { display: none; }
.vorschau.fehler { background: #f1f1f1; color: var(--muted); font: italic .85rem system-ui, sans-serif; }
.vorschau sup { font-size: .68em; }
.vorschau i { font-family: var(--serif); }
.fr { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 .12em; line-height: 1.15; }
.fr > span { padding: 0 .2em; }
.fr > span:first-child { border-bottom: 1px solid currentColor; }

/* Aktionen */
.aktionen { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; margin-top: 1rem; }
.btn { font: inherit; font-size: .93rem; padding: .48rem .95rem; cursor: pointer; border-radius: 6px; border: 1px solid var(--akzent); background: #fff; color: var(--akzent); }
.btn:hover { background: var(--akzent-hell); }
.btn.primaer { background: var(--akzent); color: #fff; } .btn.primaer:hover { background: var(--akzent-dunkel); }
.btn.leise { border-color: var(--line); color: var(--muted); }
.btn.leise.warnen { border-color: var(--falsch); color: var(--falsch); background: var(--falsch-bg); }
.btn:focus-visible, .werkzeug button:focus-visible, .schritte a:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
.ergebnis { font-weight: 600; font-size: .93rem; }
.ergebnis.ok { color: var(--ok); }

/* Lösungs-Popup */
.pop-hinter { position: fixed; inset: 0; z-index: 40; background: rgba(20,24,22,.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.pop-hinter[hidden] { display: none; }
.pop { width: min(760px, 100%); max-height: min(86vh, 100%); display: flex; flex-direction: column; background: #fff; border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.3); overflow: hidden; }
.pop-kopf { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem .7rem .6rem 1.1rem; border-bottom: 1px solid var(--line); background: #fafaf8; }
.pop-titel { font-weight: 650; }
.pop-x, .cv-x { font: 1.6rem/1 system-ui, sans-serif; width: 36px; height: 36px; cursor: pointer; border: none; border-radius: 6px; background: none; color: var(--muted); }
.pop-x:hover, .cv-x:hover { background: #ececec; color: var(--text); }
.pop-x:focus-visible, .cv-x:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
.pop-inhalt { padding: 1rem 1.2rem 1.2rem; overflow: auto; }
.pop-inhalt ol.lsg { list-style: none; padding-left: 1.7rem; counter-reset: lsg; }
.pop-inhalt ol.lsg > li { position: relative; margin-bottom: .8rem; }
.pop-inhalt ol.lsg > li::before { counter-increment: lsg; content: counter(lsg, lower-alpha) ")"; position: absolute; left: -1.6rem; font-weight: 650; }

/* Canvas (Notizen) */
.cv-hinter { position: fixed; inset: 0; z-index: 50; background: rgba(20,24,22,.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.cv-hinter[hidden] { display: none; }
.cv-dlg { width: min(1000px, 100%); height: min(720px, 100%); display: flex; flex-direction: column; background: #fff; border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.3); overflow: hidden; }
.cv-kopf { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; padding: .55rem .7rem .55rem 1rem; border-bottom: 1px solid var(--line); background: #fafaf8; }
.cv-titel { font-weight: 600; margin-right: auto; }
.cv-werkzeuge { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.cv-werkzeuge button { font: 13px/1 system-ui, sans-serif; min-width: 34px; height: 34px; padding: 0 .55rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: .3rem; color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.cv-werkzeuge button:hover { border-color: var(--akzent); }
.cv-werkzeuge button[aria-pressed="true"] { border-color: var(--akzent); background: var(--akzent-hell); box-shadow: inset 0 0 0 1px var(--akzent); }
.cv-werkzeuge button.warnen { border-color: var(--falsch); color: var(--falsch); background: var(--falsch-bg); }
.cv-werkzeuge button:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
.cv-punkt { width: 16px; height: 16px; border-radius: 50%; display: inline-block; }
.cv-dicke { background: var(--text); border-radius: 50%; display: inline-block; }
.cv-trenn { width: 1px; height: 22px; background: var(--line); margin: 0 .2rem; }
.cv-flaeche { position: relative; flex: 1; min-height: 0; }
.cv-flaeche canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; display: block; }
.cv-flaeche.karo canvas { background-color: #fff; background-image: linear-gradient(#dfe5ea 1px, transparent 1px), linear-gradient(90deg, #dfe5ea 1px, transparent 1px); background-size: 20px 20px; }
.cv-flaeche.radieren canvas { cursor: cell; }

/* Weiter-Navigation, Startseite */
.weiter { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin-top: 1.5rem; }
.weiter a { display: inline-flex; flex-direction: column; padding: .8rem 1.1rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; text-decoration: none; color: var(--text); min-width: 14rem; }
.weiter a:hover { border-color: var(--akzent); }
.weiter small { color: var(--muted); }
.weiter .rechts { margin-left: auto; text-align: right; }
.pfad { list-style: none; padding: 0; margin: 1.5rem 0; display: grid; gap: 1.1rem; }
.pfad > li { margin: 0; }
.karte { display: grid; grid-template-columns: auto 1fr; gap: 1.1rem; padding: 1.3rem 1.4rem; background: #fff; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--text); }
.karte:hover { border-color: var(--akzent); box-shadow: 0 2px 10px rgba(47,93,80,.08); }
.karte-nr { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 50%; background: var(--akzent); color: #fff; font-weight: 700; font-size: 1.1rem; }
.karte h2 { margin: 0 0 .3rem; font-size: 1.2rem; }
.karte p { margin: 0 0 .5rem; color: var(--muted); }
.karte ol { display: flex; flex-wrap: wrap; gap: .3rem .5rem; list-style: none; padding: 0; margin: 0 0 .7rem; font-size: .84rem; }
.karte ol li { background: #f1f2f0; border-radius: 99px; padding: .1rem .6rem; margin: 0; }
ol.teile.raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); column-gap: 1.6rem; }
.raster .teil { border-bottom: 1px solid #eceded; }
.raster .teil figure { margin: 0 0 .4rem; }
.balken { display: block; height: 8px; background: #eceeec; border-radius: 99px; overflow: hidden; }
.balken span { display: block; height: 100%; width: 0; background: var(--ok); transition: width .4s; }
.fortschritt-text { display: block; font-size: .85rem; color: var(--muted); margin-top: .3rem; }
.speicher { font-size: .82rem; color: var(--muted); margin-top: 1.4rem; }

@media (max-width: 900px) {
  .layout.mit-nav { display: block; }
  .schritte { position: sticky; top: 53px; z-index: 15; padding: .4rem 0; margin: 0 -16px; background: rgba(246,246,243,.96); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
  .schritte ol { display: flex; overflow-x: auto; border-left: none; padding: 0 12px; scrollbar-width: none; }
  .schritte a { border-left: none; border-bottom: 2px solid transparent; margin: 0; padding: .35rem .6rem; white-space: nowrap; font-size: .87rem; }
  .schritte a.aktiv { border-bottom-color: var(--akzent); }
  html { scroll-padding-top: 108px; }
  main { padding-top: 22px; }
}
@media (max-width: 600px) {
  h1 { font-size: 1.42rem; }
  .kopf-info { display: none; }
  .schritt { padding: 1.15rem 1rem 1rem; border-radius: 10px; }
  .aufgabe { padding: 1rem .85rem; }
  .teil { padding-left: 1.6rem; }
  .definition, .merke, .achtung, .beispiel { padding: .85rem .85rem .3rem; }
  .karte { grid-template-columns: 1fr; gap: .6rem; }
  .cv-hinter { padding: 6px; }
  .cv-titel { flex: 1 1 calc(100% - 70px); margin-right: 0; }
  .cv-x { order: 1; } .cv-werkzeuge { order: 2; }
}
@media print {
  .kopf, .schritte, .aktionen, .weiter { display: none; }
  .layout.mit-nav { display: block; }
  .schritt, .aufgabe { break-inside: avoid-page; border-color: #999; }
}

/* Formeln in Tabellen nicht verkleinern (Tabellen scrollen waagerecht) */
td .fi svg, th .fi svg { max-width: none; }
.mtab th { white-space: nowrap; }
@media (max-width: 600px) {
  table.stapel thead { display: none; }
  table.stapel, table.stapel tbody, table.stapel tr, table.stapel td { display: block; width: 100%; }
  table.stapel tr { border-bottom: 1px solid var(--line); padding: .45rem 0; }
  table.stapel td { border: none; padding: .15rem .2rem; }
  table.stapel td:first-child { font-weight: 600; }
}
