:root {
  --bg: #0b0e18; --surface: #131827; --surface-2: #1b2133; --line: #2a3250; --fg: #e8eaf4; --muted: #98a0bb;
  --c-grund: #4fd1b5; --c-plan: #f2b441; --c-org: #a994ff; --c-it: #ff8272; --c-prog: #f58ac4; --c-pruef: #62b6ff; --c-netz: #b8dc5a;
  --good: #4fd1b5; --warn: #f2b441; --bad: #ff8272;
  --font: system-ui, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; color: var(--fg); font: 16px/1.55 var(--font); background: radial-gradient(1000px 500px at 25% 0, #151b33 0, transparent 70%) no-repeat, var(--bg);
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); min-height: 100vh; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); } h2 { font-size: 1.35rem; } h3 { font-size: 1.05rem; }
.muted { color: var(--muted); } .small { font-size: 13px; } .mono { font-family: var(--mono); }
strong { color: #fff; font-weight: 600; }

/* Kopfzeile und Navigation */
.top { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; max-width: 1200px; margin: 0 auto; padding-top: max(12px, env(safe-area-inset-top)); }
.brand { text-decoration: none; font-weight: 700; font-size: 1.15rem; } .brand span { color: var(--muted); font-weight: 500; }
.top-right { display: flex; gap: 10px; align-items: center; }
.chip-stat, .sync { font-size: 13px; background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 5px 12px; text-decoration: none; white-space: nowrap; }
.sync::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; background: var(--muted); }
.sync.ok::before { background: var(--good); } .sync.syncing::before { background: var(--warn); } .sync.error::before, .sync.auth::before { background: var(--bad); }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { flex: 1; text-align: center; text-decoration: none; padding: 8px 2px 7px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 1px; }
.tabs i { font-style: normal; font-size: 20px; line-height: 1.2; } .tabs b { font-size: 11.5px; font-weight: 600; }
.tabs a.on { color: var(--fg); background: var(--surface-2); }
main { max-width: 1200px; margin: 0 auto; padding: 8px 18px 110px; outline: none; }
@media (min-width: 900px) {
  .tabs { position: static; max-width: 1200px; margin: 0 auto 8px; padding: 0 18px; background: none; border: 0; backdrop-filter: none; gap: 8px; }
  .tabs a { flex: 0 0 auto; flex-direction: row; gap: 8px; padding: 8px 16px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); }
  .tabs a.on { background: var(--surface-2); border-color: var(--fg); } .tabs b { font-size: 14px; } main { padding-bottom: 50px; }
}
body.focus .top, body.focus .tabs { display: none; } body.focus main { padding-top: 56px; max-width: 760px; }
.focus-exit { position: fixed; top: max(10px, env(safe-area-inset-top)); right: 12px; z-index: 40; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; padding: 6px 14px; font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; z-index: 50; transition: .25s; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Bausteine */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; margin-bottom: 14px; }
.grid { display: grid; gap: 14px; } .g2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); } .g3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; } .row.sb { justify-content: space-between; }
.btn { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 18px; font-weight: 600; min-height: 46px; }
.btn:hover { border-color: var(--fg); } .btn[disabled] { opacity: .45; cursor: default; }
.btn.primary { background: var(--c-grund); color: #06231d; border-color: var(--c-grund); }
.btn.big { padding: 18px 22px; font-size: 1.1rem; border-radius: 18px; width: 100%; }
.btn.ghost { background: transparent; }
.pill { display: inline-block; font-size: 12px; padding: 2px 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; } .bar i { display: block; height: 100%; background: var(--good); border-radius: 99px; transition: width .3s; }
.hero { background: linear-gradient(135deg, color-mix(in srgb, var(--c-grund) 18%, var(--surface)), var(--surface)); }
.ring { --p: 0; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--good) calc(var(--p) * 1%), var(--surface-2) 0); }
.ring span { width: 64px; height: 64px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-weight: 700; font-size: 1.05rem; }
.week { display: flex; gap: 6px; } .week div { width: 34px; text-align: center; font-size: 11px; color: var(--muted); }
.week i { display: block; height: 28px; border-radius: 8px; margin-bottom: 3px; background: var(--surface-2); border: 1px solid var(--line); }
.week .done i { background: var(--good); border-color: var(--good); } .week .today i { border-color: var(--fg); } .week .future i { opacity: .35; }
.list-item { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); } .list-item:first-child { border-top: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--muted)); display: inline-block; margin-right: 8px; }
input[type=text], input[type=password], input[type=number], input[type=url], textarea, select { width: 100%; background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; font: inherit; }
textarea { min-height: 80px; resize: vertical; } label.field { display: block; margin: 12px 0 4px; font-size: 13px; color: var(--muted); }
.switch { display: flex; gap: 10px; align-items: center; margin: 10px 0; cursor: pointer; } .switch input { width: 20px; height: 20px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; } .seg button { background: var(--surface); border: 0; padding: 8px 14px; font-size: 14px; } .seg button.on { background: var(--surface-2); font-weight: 700; box-shadow: inset 0 -2px 0 var(--fg); }

/* Lernkarte (Karteikarte) */
.flash { max-width: 720px; margin: 0 auto; }
.flash .face { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 22px; min-height: 160px; font-size: 1.12rem; }
.flash .face.back { margin-top: 12px; border-color: color-mix(in srgb, var(--good) 50%, var(--line)); font-size: 1.02rem; }
.flash table, .face table, .panel table { border-collapse: collapse; margin: 8px 0; width: 100%; font-size: .95em; } .face th, .face td, .panel th, .panel td { border: 1px solid var(--line); padding: 6px 9px; text-align: left; vertical-align: top; } .face th, .panel th { background: var(--surface-2); }
.face ul, .face ol { margin: 6px 0; padding-left: 22px; } .face .note { margin-top: 10px; padding: 9px 12px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: .92em; }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.grades button { border-radius: 14px; padding: 10px 4px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; display: flex; flex-direction: column; gap: 2px; }
.grades button small { font-weight: 400; color: var(--muted); font-size: 12px; }
.grades .g0 { border-color: var(--bad); } .grades .g1 { border-color: var(--warn); } .grades .g2 { border-color: var(--good); } .grades .g3 { border-color: var(--c-pruef); }
.grades button:hover { background: var(--surface-2); }
.progress-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; } .progress-top .bar { flex: 1; }

/* Quiz */
.opts { display: grid; gap: 10px; margin: 14px 0; } .opt { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; min-height: 52px; }
.opt:hover { border-color: var(--fg); } .opt.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 18%, var(--surface)); } .opt.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 16%, var(--surface)); }
.opt.picked { border-color: var(--fg); background: var(--surface-2); }
.feedback { padding: 12px 14px; border-radius: 12px; margin: 10px 0; background: var(--surface-2); } .feedback.ok { border-left: 4px solid var(--good); } .feedback.no { border-left: 4px solid var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; } .chipbtn { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; } .chipbtn[disabled] { opacity: .35; }
.slots { display: grid; gap: 6px; margin: 10px 0; } .slot { display: flex; gap: 10px; align-items: center; padding: 9px 14px; border: 1px dashed var(--line); border-radius: 12px; min-height: 44px; } .slot b { color: var(--muted); width: 22px; font-family: var(--mono); }
.slot.filled { border-style: solid; background: var(--surface-2); } .slot.ok { border-color: var(--good); } .slot.no { border-color: var(--bad); }
.timer { font-family: var(--mono); font-weight: 700; }

/* Vergleich */
.cmp { width: 100%; border-collapse: collapse; } .cmp th, .cmp td { border-bottom: 1px solid var(--line); padding: 9px 10px; text-align: left; vertical-align: top; } .cmp th { color: var(--muted); font-weight: 600; font-size: 13px; }
.cmp td:first-child { color: var(--muted); width: 28%; } .cmp th.a, .cmp td.a { background: color-mix(in srgb, var(--c-pruef) 9%, transparent); } .cmp th.b, .cmp td.b { background: color-mix(in srgb, var(--c-plan) 9%, transparent); }
.cmp thead th { color: var(--fg); font-size: 1rem; }

/* Reise */
.stack { display: grid; gap: 6px; margin: 14px 0; } .hdr { border-radius: 12px; padding: 10px 14px; border: 1px solid var(--line); animation: pop .35s both; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.hdr b { font-weight: 700; } .hdr small { color: var(--muted); }
.hdr.data { background: color-mix(in srgb, var(--c-org) 18%, var(--surface)); border-color: var(--c-org); } .hdr.l4 { background: color-mix(in srgb, var(--c-pruef) 18%, var(--surface)); border-color: var(--c-pruef); }
.hdr.l3 { background: color-mix(in srgb, var(--c-grund) 18%, var(--surface)); border-color: var(--c-grund); } .hdr.l2 { background: color-mix(in srgb, var(--c-it) 18%, var(--surface)); border-color: var(--c-it); }
.hdr.l1 { background: color-mix(in srgb, var(--c-plan) 18%, var(--surface)); border-color: var(--c-plan); }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }
.dots { display: flex; gap: 6px; flex-wrap: wrap; } .dots button { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); padding: 0; } .dots button.on { background: var(--fg); } .dots button.past { background: var(--good); border-color: var(--good); }
.layerbar { display: flex; gap: 4px; margin: 8px 0; } .layerbar span { flex: 1; text-align: center; font-size: 12px; padding: 5px 0; border-radius: 8px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); } .layerbar span.on { background: var(--fg); color: var(--bg); font-weight: 700; }

/* Karte (Mindmap) */
.mapwrap { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 18px; align-items: start; }
.mapbox { background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px solid var(--line); border-radius: 18px; padding: 8px; }
svg.map { display: block; width: 100%; height: auto; }
.panel { position: sticky; top: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px; max-height: calc(100vh - 30px); overflow: auto; }
.panel h2 { font-size: 1.5rem; } .panel h4 { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 16px 0 8px; }
.panel ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 7px; } .panel li { position: relative; padding-left: 16px; } .panel li::before { content: ""; position: absolute; left: 0; top: .66em; width: 6px; height: 2px; background: var(--c, var(--muted)); }
.chip { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--c); font-weight: 600; } .chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.formula { font-family: var(--mono); font-size: 12.5px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; margin: 0 0 8px; overflow-x: auto; white-space: pre; }
.tip { background: color-mix(in srgb, var(--c, var(--c-plan)) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c, var(--c-plan)) 45%, transparent); border-radius: 12px; padding: 12px 14px; margin-top: 14px; }
.tip b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--c, var(--c-plan)); margin-bottom: 3px; }
.link { fill: none; stroke: var(--c); stroke-opacity: .32; stroke-width: 1.6; } .link.on { stroke-opacity: .95; stroke-width: 2.6; }
.node { cursor: pointer; outline: none; } .node rect.bg { fill: var(--surface-2); stroke: var(--c); stroke-opacity: .55; stroke-width: 1.3; }
.node text { fill: var(--fg); font-size: 14.5px; font-weight: 500; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.node:hover rect.bg, .node:focus-visible rect.bg { stroke-opacity: 1; } .node.sel rect.bg { fill: var(--c); stroke-opacity: 1; } .node.sel text { fill: #0b0e18; font-weight: 700; }
.node .done { fill: var(--c); display: none; } .node.learned .done { display: block; } .node.sel .done { fill: #0b0e18; }
.node .duering { fill: none; stroke: var(--warn); stroke-width: 2.4; stroke-dasharray: 5 3; display: none; } .node.due .duering { display: block; }
.node.branch rect.bg { fill: color-mix(in srgb, var(--c) 22%, var(--bg)); stroke-opacity: 1; stroke-width: 1.8; } .node.branch text { font-weight: 700; font-size: 17px; }
.heat .node:not(.branch) rect.bg { fill: var(--heat, var(--surface-2)); stroke-opacity: .9; } .heat .node:not(.branch) text { fill: var(--heattext, var(--fg)); }
.root circle { fill: var(--bg); stroke: var(--fg); stroke-opacity: .85; stroke-width: 1.6; } .root text { fill: var(--fg); text-anchor: middle; dominant-baseline: central; }
.tree { display: none; } .tree details { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; }
.tree summary { cursor: pointer; list-style: none; padding: 13px 16px; font-weight: 700; display: flex; gap: 10px; align-items: center; } .tree summary::-webkit-details-marker { display: none; }
.tree summary::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--c); } .tree summary span { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 400; }
.tree .items { display: grid; gap: 6px; padding: 0 12px 12px; } .tree .item { text-align: left; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; justify-content: space-between; gap: 8px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--muted); margin: 8px 0 12px; } .legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; }
.backdrop { display: none; }
@media (max-width: 899px) {
  .mapwrap { display: block; } .mapbox, .maplegend { display: none; } .tree { display: block; }
  .panel { position: fixed; left: 0; right: 0; bottom: 56px; top: auto; z-index: 35; border-radius: 20px 20px 0 0; max-height: 76vh; transform: translateY(110%); transition: transform .25s; }
  .panel.open { transform: none; box-shadow: 0 -20px 60px rgba(0,0,0,.6); } .backdrop.open { display: block; position: fixed; inset: 0; z-index: 34; background: rgba(5,7,14,.6); }
  .grades button { padding: 12px 2px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
