/* Abi-Lernapp – Gestaltung (Version 4, Oktober 2026).
   Ruhig, offen, stark gerundet. Hell/dunkel automatisch. Signatur: Lernzettel als Papier. */
:root {
  --bg: #f4f7fc;
  --panel: #ffffff;
  --panel-2: #eef2fa;
  --line: #e2e8f3;
  --text: #0e1a2b;
  --muted: #62718a;
  --accent: #2f6bff;
  --accent-ink: #ffffff;
  --accent-soft: #e6eeff;
  --danger: #d9434d;
  --ok: #1f9d63;
  --warn: #d98a12;
  --none: #cdd5e3;
  --shadow: 0 1px 2px rgba(16, 32, 64, .05), 0 12px 32px -14px rgba(16, 32, 64, .22);
  --shadow-lift: 0 2px 4px rgba(16, 32, 64, .06), 0 22px 44px -16px rgba(16, 32, 64, .3);
  --radius: 22px;
  --radius-s: 14px;
  --topbar: 64px;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0f1e; --panel: #121a2d; --panel-2: #19233b; --line: #23304c;
    --text: #e8eefb; --muted: #94a2bf; --accent: #7098ff; --accent-ink: #0a1020; --accent-soft: #1a2a55;
    --none: #34415c; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 14px 34px -14px rgba(0,0,0,.6);
    --shadow-lift: 0 2px 4px rgba(0,0,0,.35), 0 24px 48px -16px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0f1e; --panel: #121a2d; --panel-2: #19233b; --line: #23304c;
  --text: #e8eefb; --muted: #94a2bf; --accent: #7098ff; --accent-ink: #0a1020; --accent-soft: #1a2a55;
  --none: #34415c; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 14px 34px -14px rgba(0,0,0,.6);
  --shadow-lift: 0 2px 4px rgba(0,0,0,.35), 0 24px 48px -16px rgba(0,0,0,.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--font); overflow-x: clip; } /* clip statt hidden: sonst klappt position: sticky (Kopfzeile/Menue) nicht */
body { min-height: 100dvh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 4.2vw, 2.2rem); font-weight: 800; }
h2 { font-size: 1.3rem; font-weight: 750; } h3 { font-size: 1.08rem; font-weight: 700; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg, canvas, video, table { max-width: 100%; }
/* KaTeX zeichnet Pfeile/Dächer (\vec, \overrightarrow, \widehat, \xrightarrow …) als SVG in Spans mit Breite 0 – mit max-width:100% wären sie unsichtbar */
.katex svg { max-width: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; min-width: 0; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.stack > * + * { margin-top: .85rem; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* ---------- Kopfleiste ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar); display: flex; align-items: center; gap: .6rem;
  padding: 0 max(.9rem, env(safe-area-inset-right)) 0 max(.9rem, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
}
.menu-btn {
  width: 46px; height: 46px; flex: none; border: 0; border-radius: 16px; cursor: pointer; background: var(--panel);
  box-shadow: var(--shadow); display: grid; place-items: center; color: var(--text); transition: transform .12s;
}
.menu-btn:active { transform: scale(.95); }
.menu-btn { position: relative; }
/* Burger aus drei Balken; offen = grosses X genau in der Mitte (erst zusammen, dann drehen; beim Schliessen umgekehrt) */
.burger { position: relative; width: 22px; height: 18px; display: block; }
.burger i { position: absolute; left: 0; top: 50%; width: 100%; height: 2.5px; margin-top: -1.25px; border-radius: 2px; background: currentColor;
  transition: translate .18s ease .16s, rotate .18s ease, opacity .12s ease .1s; }
.burger .l1 { translate: 0 -7px; }
.burger .l3 { translate: 0 7px; }
body.drawer-open .burger i { transition: translate .18s ease, rotate .22s cubic-bezier(.3, 1.4, .5, 1) .16s, opacity .12s ease; }
body.drawer-open .burger .l1 { translate: 0 0; rotate: 45deg; }
body.drawer-open .burger .l2 { opacity: 0; }
body.drawer-open .burger .l3 { translate: 0 0; rotate: -45deg; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 800; color: var(--text); letter-spacing: -.01em; min-width: 0; }
.brand img { width: 28px; height: 28px; }
.brand:hover { text-decoration: none; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer {
  display: flex; align-items: center; gap: .15rem; background: var(--panel); border-radius: 999px; padding: .2rem; box-shadow: var(--shadow); flex: none;
}
.timer-btn, .timer-stop { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); cursor: pointer; font-size: .85rem; display: grid; place-items: center; }
.timer-stop { background: var(--panel-2); color: var(--danger); }
.timer-time { font-variant-numeric: tabular-nums; font-weight: 700; padding: 0 .55rem 0 .4rem; font-size: .95rem; }
.timer.running .timer-time { color: var(--accent); }
.profile-chip { width: 46px; height: 46px; border-radius: 50%; background: var(--panel); box-shadow: var(--shadow); color: var(--text); display: grid; place-items: center; flex: none; transition: transform .12s, background .2s; }
.profile-chip svg { width: 23px; height: 23px; }
.profile-chip:hover { text-decoration: none; background: var(--panel-2); }
.profile-chip:active { transform: scale(.95); }
.profile-chip.anon { color: var(--muted); }

/* ---------- Seitenleiste (Menü + Themenbaum) ---------- */
.shell { display: block; }
/* Menue gleitet weich rein/raus (statt display:none an/aus). Uebergaenge erst nach dem Start (nav-ready), damit beim Laden nichts zuckt. */
.drawer { display: flex; flex-direction: column; background: var(--panel); min-height: 0; transform: translateX(-100%); visibility: hidden; }
body.drawer-open .drawer { transform: none; visibility: visible; }
body.nav-ready .drawer { transition: transform .38s cubic-bezier(.32, .72, 0, 1), visibility 0s linear .38s; }
body.nav-ready.drawer-open .drawer { transition: transform .38s cubic-bezier(.32, .72, 0, 1), visibility 0s; }
.drawer-scroll { overflow-y: auto; overflow-x: hidden; flex: 1; padding: .9rem .8rem 2rem; overscroll-behavior: contain; }
.scrim { display: none; position: fixed; inset: 0; background: rgba(8, 12, 24, .45); z-index: 35; opacity: 0; pointer-events: none; }
body.nav-ready .scrim { transition: opacity .3s ease; }
.nav-links { display: grid; gap: .45rem; margin-bottom: .6rem; }
.nav-links a { display: flex; align-items: center; gap: .65rem; padding: .7rem .85rem; border-radius: 14px; color: var(--text); font-weight: 650; }
.nav-links a:hover { background: var(--panel-2); text-decoration: none; }
.nav-links a.active { background: var(--accent-soft); color: var(--accent); }
.nav-links .ico { width: 1.4rem; display: grid; place-items: center; }
.nav-links .ico svg { width: 20px; height: 20px; }
.drawer-sep { height: 1px; background: var(--line); margin: .7rem .3rem; }
.drawer-project { display: flex; align-items: center; gap: .6rem; padding: .3rem .5rem .6rem; }
.drawer-project .dot { width: 14px; height: 14px; border-radius: 50%; flex: none; background: var(--c, var(--accent)); }
.drawer-project .t { font-weight: 800; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-project .o { color: var(--muted); font-size: .8rem; }

@media (min-width: 1000px) {
  /* Spalte waechst mit, dadurch rutscht der Inhalt weich zur Seite statt zu springen */
  .shell { display: grid; grid-template-columns: 0px minmax(0, 1fr); align-items: start; }
  body.drawer-open .shell { grid-template-columns: 340px minmax(0, 1fr); }
  body.nav-ready .shell { transition: grid-template-columns .38s cubic-bezier(.32, .72, 0, 1); }
  /* Menue zu: Inhalt etwas breiter */
  body:not(.drawer-open) .view { max-width: 1120px; }
  body.nav-ready .view { transition: max-width .38s cubic-bezier(.32, .72, 0, 1); }
  .drawer { width: 340px; position: sticky; top: var(--topbar); height: calc(100dvh - var(--topbar)); border-radius: 0 var(--radius) 0 0; box-shadow: var(--shadow); }
}
@media (max-width: 999px) {
  /* Menue beginnt unter der Kopfleiste, damit das X sichtbar und antippbar bleibt */
  .drawer { position: fixed; z-index: 40; top: var(--topbar); bottom: 0; left: 0; width: min(88vw, 360px); box-shadow: var(--shadow-lift); border-radius: 0 var(--radius) var(--radius) 0; }
  .scrim { display: block; top: var(--topbar); }
  body.drawer-open .scrim { opacity: 1; pointer-events: auto; }
  body.drawer-open { overflow: hidden; }
}
@keyframes slide { from { transform: translateX(-100%); } }
@keyframes fade { from { opacity: 0; } }

.view { width: 100%; max-width: 980px; margin: 0 auto; padding: .6rem max(1rem, env(safe-area-inset-left)) 6rem; outline: none; min-width: 0; }

/* ---------- Bausteine ---------- */
.card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.3rem; }
.card + .card { margin-top: 1rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; border: 0;
  background: var(--panel-2); color: var(--text); padding: .6rem 1.1rem; border-radius: 999px; cursor: pointer;
  font-weight: 700; font-size: .95rem; min-height: 44px; text-decoration: none; max-width: 100%;
  transition: transform .1s, background .15s, box-shadow .15s;
}
.btn:hover { background: color-mix(in srgb, var(--panel-2) 70%, var(--line)); text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn.primary:hover { filter: brightness(1.06); background: var(--accent); }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.small { min-height: 36px; padding: .3rem .85rem; font-size: .86rem; }
.btn.big { min-height: 52px; padding: .8rem 1.5rem; font-size: 1.02rem; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { border: 0; background: transparent; cursor: pointer; width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 50%; color: var(--muted); font-size: 1.05rem; flex: none; }
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.field { display: block; margin-top: .2rem; }
.field > span { display: block; font-size: .85rem; font-weight: 700; color: var(--muted); margin-bottom: .3rem; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: .65rem .95rem; border: 2px solid transparent; border-radius: var(--radius-s); background: var(--panel-2); min-height: 46px; transition: border-color .15s, background .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background: var(--panel); }
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
textarea.code { font-family: var(--mono); font-size: .9rem; }
.tag { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--panel-2); color: var(--muted); }
.tag.lock { background: var(--accent-soft); color: var(--accent); }
.empty { text-align: center; padding: 3rem 1.2rem; color: var(--muted); }
.empty h2, .empty h3 { color: var(--text); }
.divider { height: 1px; background: var(--line); margin: 1.1rem 0; }
.hint { background: var(--accent-soft); border-radius: var(--radius-s); padding: .8rem 1rem; font-size: .92rem; }
.hint.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); }
.pagehead { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin: .4rem 0 1.2rem; }
.pagehead h1 { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.switch { position: relative; width: 52px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; background: var(--none); border-radius: 999px; transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(22px); }
.switch input:focus-visible + i { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* ---------- Skala ---------- */
.bar { position: relative; height: 8px; border-radius: 999px; background: var(--panel-2); overflow: hidden; min-width: 50px; }
.bar > i { position: absolute; inset: 0 auto 0 0; border-radius: 999px; }
.pct { font-variant-numeric: tabular-nums; font-weight: 750; font-size: .85rem; min-width: 2.7em; text-align: right; }
.pct.none { color: var(--muted); font-weight: 500; }
.legend { display: flex; align-items: center; gap: .5rem; font-size: .8rem; color: var(--muted); }
.legend .scale { width: 120px; height: 8px; border-radius: 999px; background: linear-gradient(90deg, hsl(0 72% 52%), hsl(38 90% 50%), hsl(130 55% 42%)); }
.ring { --p: 0; --col: var(--none); width: 74px; height: 74px; border-radius: 50%; background: conic-gradient(var(--col) calc(var(--p) * 1%), var(--panel-2) 0); display: grid; place-items: center; flex: none; }
.ring > span { width: 60px; height: 60px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; font-weight: 800; font-size: 1.05rem; }
.ring.sm { width: 44px; height: 44px; } .ring.sm > span { width: 34px; height: 34px; font-size: .72rem; }

/* ---------- Startseite: Projekte ---------- */
/* Lernen-Startseite */
.card.today { border-left: 5px solid var(--accent); }
.card.today h2 { margin: 0 0 .35rem; }
.project-tile.learn-tile { gap: .4rem; cursor: default; justify-content: flex-start; }
.learn-tile h3, .learn-progress, .learn-tile .row { position: relative; }
.learn-tile h3 { margin: 0; } .learn-tile h3 a { color: inherit; }
.learn-progress { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .7rem; margin-top: .7rem; font-size: .9rem; }
.projects { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.project-tile {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 1.6rem; min-height: 190px; padding: 1.4rem;
  border-radius: 26px; color: var(--text); overflow: hidden; cursor: pointer; text-decoration: none;
  background: linear-gradient(150deg, color-mix(in srgb, var(--c) 20%, var(--panel)) 0%, var(--panel) 70%);
  box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s;
}
.project-tile::before { content: ""; position: absolute; width: 190px; height: 190px; border-radius: 50%; right: -60px; top: -70px; background: var(--c); opacity: .2; filter: blur(2px); }
.project-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); text-decoration: none; }
.project-tile h3 { position: relative; font-size: 1.55rem; font-weight: 800; margin: 0; overflow-wrap: anywhere; }
.project-tile .by { position: relative; color: var(--muted); font-size: .92rem; margin-top: .15rem; }
.project-tile .go { position: relative; align-self: flex-start; background: var(--c); color: #fff; border-radius: 999px; padding: .6rem 1.15rem; font-weight: 750; font-size: .95rem; }
.other-list { display: grid; gap: .5rem; }
.other-row { display: flex; align-items: center; gap: .7rem; padding: .85rem 1rem; background: var(--panel); border-radius: 18px; box-shadow: var(--shadow); flex-wrap: wrap; }
.other-row .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.other-row .nm { flex: 1; min-width: 140px; font-weight: 700; overflow-wrap: anywhere; }

/* ---------- Projekt: Inhalt ---------- */
.tree { list-style: none; margin: 0; padding: 0; }
.tree .tree { padding-left: .9rem; border-left: 2px solid var(--line); margin-left: 1.05rem; }
.tnode > .trow { display: grid; grid-template-columns: 26px 1fr 46px; align-items: center; gap: .3rem; padding: .35rem .4rem; border-radius: 14px; cursor: pointer; min-height: 44px; }
.tnode > .trow:hover { background: var(--panel-2); }
.tnode.selected > .trow { background: var(--accent-soft); }
.tnode .twisty { border: 0; background: none; width: 26px; height: 32px; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: .7rem; transition: transform .15s; padding: 0; }
.tnode .twisty.open { transform: rotate(90deg); }
.tnode .twisty.leaf { visibility: hidden; }
.tnode .ttitle { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; font-size: .96rem; overflow-wrap: anywhere; }
.tnode .tno { color: var(--muted); font-size: .76rem; font-weight: 700; margin-right: .35rem; font-variant-numeric: tabular-nums; }
.tnode.depth-0 > .trow .ttitle { font-weight: 750; }
.tnode.depth-1 > .trow .ttitle { font-weight: 650; }
.tree-tools { display: flex; align-items: center; gap: .3rem; padding: .2rem .3rem .6rem; }

.node-head { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin: .4rem 0 1rem; }
.node-head { margin-bottom: .6rem; }
.node-head h1 { margin: 0; flex: 1 1 100%; width: 100%; min-width: 0; overflow-wrap: anywhere; }
.node-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 0 0 1.1rem; }
.zrow { margin-top: 1rem; }
.stand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 750; font-size: .9rem; color: var(--muted); }
.children-list { list-style: none; padding: 0; margin: 0; }
.children-list li { display: grid; grid-template-columns: 1fr 80px 2.8em; gap: .7rem; align-items: center; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.children-list li:last-child { border-bottom: 0; }
.children-list .tno { color: var(--muted); font-size: .8rem; font-weight: 700; margin-right: .4rem; }
.selfrate input[type=range] { width: 100%; accent-color: var(--accent); }
.note-bar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: 1.2rem 0 .7rem; }
.note-bar h2 { margin: 0; }
.note-meta { font-size: .78rem; font-weight: 750; color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: .02em; }

/* ---------- Lernzettel (Markdown) ---------- */
.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md img, .md svg:not(.katex svg) { max-width: 100%; height: auto; border-radius: 10px; }
.md svg:not(.katex svg) { overflow: visible; } /* Beschriftungen am Rand nicht abschneiden */
.md pre { background: var(--panel-2); padding: .9rem; border-radius: 12px; overflow: auto; }
.md code { font-family: var(--mono); font-size: .9em; background: var(--panel-2); padding: .05em .35em; border-radius: 6px; }
.md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; width: 100%; margin: .8rem 0; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: .4rem .7rem; text-align: left; }
.md th { background: var(--panel-2); }
.md blockquote { margin: .9rem 0; padding: .6rem 1.1rem; border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 0 14px 14px 0; }
.md h1 { font-size: 1.45rem; } .md h2 { font-size: 1.22rem; margin-top: 1.2em; } .md h3 { font-size: 1.06rem; margin-top: 1em; }
.md .katex-display { overflow-x: auto; overflow-y: hidden; padding: .2rem 0; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }
.note-paper { position: relative; }
.note-paper .note-label { position: absolute; top: .6rem; left: 1rem; }

/* ---------- Dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .9rem; margin-bottom: 1rem; }
.kpi { padding: 1.1rem 1.2rem; }
.kpi .v { font-size: 1.7rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: .85rem; }
.chart { width: 100%; height: 150px; display: block; }
.weak-list { list-style: none; margin: 0; padding: 0; }
.weak-list li { display: grid; grid-template-columns: 1fr 70px 2.8em; gap: .5rem; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.weak-list li:last-child { border-bottom: 0; }
.weak-list li a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Ueben ---------- */
.practice { max-width: 820px; margin: 0 auto; }
.practice-head { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin: .3rem 0 1rem; }
.practice-head h1 { margin: 0; font-size: clamp(1.3rem, 4vw, 1.8rem); min-width: 0; overflow-wrap: anywhere; }
.q-bar { display: flex; align-items: center; gap: .5rem; flex-wrap: nowrap; }
.q-bar .where { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .85rem; }
.q-timer { font-variant-numeric: tabular-nums; font-weight: 750; padding: .35rem .85rem; border-radius: 999px; background: var(--panel-2); white-space: nowrap; font-size: .92rem; }
.q-timer.over { color: var(--danger); }
.question { font-size: 1.1rem; }
.mc-options { display: grid; gap: .6rem; }
.mc-option { display: flex; gap: .8rem; align-items: flex-start; padding: .9rem 1.1rem; border: 2px solid transparent; border-radius: var(--radius-s); cursor: pointer; background: var(--panel-2); min-height: 52px; }
.mc-option:hover { border-color: var(--line); }
.mc-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.mc-option input { margin-top: .35rem; accent-color: var(--accent); }
.mc-option.right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.mc-option.wrong { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.answer-tabs { display: flex; gap: .35rem; margin-bottom: .6rem; flex-wrap: wrap; }
.answer-tabs button { border: 0; background: var(--panel-2); padding: .5rem 1rem; border-radius: 999px; cursor: pointer; font-weight: 700; font-size: .9rem; min-height: 40px; }
.answer-tabs button.on { background: var(--accent); color: var(--accent-ink); }
.verdict { display: flex; gap: .5rem; flex-wrap: wrap; }
.verdict .btn { flex: 1; min-width: 110px; }
.result-banner { padding: 1rem 1.2rem; border-radius: var(--radius-s); font-weight: 750; }
.result-banner.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.result-banner.bad { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); }
.practice .row.end { margin-top: .9rem; }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; padding: .7rem 0 calc(.7rem + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, transparent); }
.summary { text-align: center; padding: 2rem 1.2rem; }
.summary .big { font-size: 3rem; line-height: 1; }
.chat { display: flex; flex-direction: column; gap: .7rem; }
.msg { padding: .85rem 1.1rem; border-radius: 18px; max-width: 100%; }
.msg.user { background: var(--accent-soft); align-self: flex-end; max-width: 88%; }
.msg.assistant { background: var(--panel-2); }
.msg img { max-width: 240px; border-radius: 10px; display: block; margin-top: .4rem; }
.typing { color: var(--muted); font-style: italic; }

/* ---------- Zeichenfeld ---------- */
.draw { border-radius: var(--radius-s); overflow: hidden; background: #fff; box-shadow: inset 0 0 0 2px var(--line); }
.draw-tools { display: flex; gap: .3rem; flex-wrap: wrap; align-items: center; padding: .5rem; background: var(--panel-2); }
.draw-tools button { border: 0; background: var(--panel); border-radius: 12px; min-width: 40px; height: 38px; cursor: pointer; color: var(--text); }
.draw-tools button.on { outline: 3px solid var(--accent); }
.draw-tools .sw { width: 22px; height: 22px; border-radius: 50%; display: inline-block; vertical-align: middle; }
.draw canvas { display: block; width: 100%; touch-action: none; cursor: crosshair; }

/* ---------- Dialoge ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(8, 12, 24, .5); display: grid; place-items: center; z-index: 50; padding: 1rem; animation: fade .15s; }
.modal { background: var(--panel); border-radius: 28px; box-shadow: var(--shadow-lift); width: min(560px, 100%); max-height: calc(100dvh - 2rem); overflow: auto; padding: 1.5rem; animation: pop .18s ease-out; }
.modal.wide { width: min(980px, 100%); }
.modal h2 { margin: 0; font-size: 1.3rem; }
.modal > .row:first-child { margin-bottom: 1rem; flex-wrap: nowrap; }
@keyframes pop { from { transform: translateY(14px) scale(.98); opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: calc(1.2rem + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(150%); background: var(--text); color: var(--bg); padding: .75rem 1.2rem; border-radius: 999px; font-weight: 700; transition: transform .2s; z-index: 60; max-width: calc(100% - 2rem); text-align: center; }
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); color: #fff; }
.toast { visibility: hidden; }
.toast.show { visibility: visible; }
.steps { display: flex; gap: .4rem; margin-bottom: 1rem; }
.steps span { flex: 1; height: 5px; border-radius: 999px; background: var(--panel-2); }
.steps span.on { background: var(--accent); }
.choice { display: grid; gap: .55rem; }
.choice label { display: flex; gap: .8rem; padding: .9rem 1.1rem; background: var(--panel-2); border: 2px solid transparent; border-radius: var(--radius-s); cursor: pointer; align-items: flex-start; }
.choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { margin-top: .3rem; accent-color: var(--accent); }
.options-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.options-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
.big-option { display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; text-align: left; padding: 1.2rem; border: 0; border-radius: 22px; background: var(--panel-2); cursor: pointer; min-height: 130px; transition: transform .12s, background .15s; }
.big-option:hover { background: var(--accent-soft); }
.big-option:active { transform: scale(.98); }
.big-option .ic { font-size: 1.7rem; line-height: 1; }
.big-option strong { font-size: 1.05rem; }
.big-option span.s { color: var(--muted); font-size: .86rem; }
.editor-split { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.editor-split textarea { min-height: 440px; }
.editor-split .preview { background: var(--panel-2); border-radius: var(--radius-s); padding: .9rem; max-height: 560px; overflow: auto; }
.color-dots { display: flex; gap: .55rem; flex-wrap: wrap; }
.color-dots button { width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; padding: 0; }
.color-dots button.on { border-color: var(--text); }
.menu-list { display: grid; gap: .3rem; }
.menu-list .btn { justify-content: flex-start; background: transparent; border-radius: 14px; }
.menu-list .btn:hover { background: var(--panel-2); }
.menu-list .btn.danger { color: var(--danger); }

.badge { display: inline-block; min-width: 1.35em; padding: 0 .4em; border-radius: 999px; background: var(--danger); color: #fff; font-size: .72rem; line-height: 1.4em; text-align: center; margin-left: .2rem; }
details > summary { cursor: pointer; font-weight: 650; }
.kpis > .card, .grid > .card { margin-top: 0; }
.mc-option .md p, .msg .md p:first-child { margin-top: 0; }
.mc-option .md p:last-child { margin-bottom: 0; }
.question .md p:first-child { margin-top: 0; }

/* ---------- Handy ---------- */
@media (max-width: 700px) {
  .brand span { display: none; }
  .view { padding-bottom: 7rem; }
  .editor-split { grid-template-columns: 1fr; }
  .editor-split textarea { min-height: 260px; }
  .options-2, .options-3 { grid-template-columns: 1fr; }
  .big-option { min-height: 0; flex-direction: row; align-items: center; gap: .9rem; }
  .big-option .ic { flex: none; }
  .modal-back { place-items: end center; padding: 0; }
  .modal { width: 100%; max-height: 92dvh; border-radius: 28px 28px 0 0; padding: 1.2rem 1.1rem calc(1.2rem + env(safe-area-inset-bottom)); animation: sheet .22s ease-out; }
  .modal.wide { width: 100%; }
  .projects { grid-template-columns: 1fr; }
  .project-tile { min-height: 150px; }
  .children-list li { grid-template-columns: 1fr 56px 2.8em; }
  .topbar { gap: .45rem; }
  .timer-time { padding: 0 .4rem 0 .25rem; font-size: .9rem; }
}
@keyframes sheet { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.big-option .s { display: block; margin-top: .15rem; }
.big-option > div { min-width: 0; }
.modal .foot { position: sticky; bottom: -1.5rem; background: var(--panel); padding: .8rem 0 .2rem; margin-top: .6rem; z-index: 2; }
@media (max-width: 700px) { .modal .foot { bottom: calc(-1.2rem - env(safe-area-inset-bottom)); } }

/* ---- Aufgabenliste (Antippen = Lösung), Schwierigkeit, Üben-Auswahl ---- */
.task-row { border-top: 1px solid var(--line); padding: .8rem .6rem; margin-top: .7rem; cursor: pointer; border-radius: 14px; transition: background .15s; }
.task-row:hover, .task-row.open { background: var(--panel-2); }
.task-row.open { cursor: default; }
.task-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.task-hint { margin-top: .4rem; }
.task-row.open .task-hint { display: none; }
.task-open { margin-top: .8rem; display: grid; gap: .8rem; }
.task-open[hidden] { display: none; }
.task-opts { margin: .4rem 0 0; padding-left: 1.2rem; color: var(--muted); }
.task-sol .md > :first-child { margin-top: 0; }
.tag.diff .dots { margin-left: .45rem; letter-spacing: 1px; font-size: .62em; opacity: .75; vertical-align: middle; }
.card.inset { background: var(--panel); border: 1px solid var(--line); box-shadow: none; }
.md.inline p { display: inline; margin: 0; }
.ratebar .verdict { gap: .45rem; }
.ratebar .btn.pct { flex: 1; min-width: 58px; border-radius: 999px; font-weight: 700; }
.ratebar .btn.pct.good { background: var(--accent-soft); }
.levels { gap: .4rem; }
.big-option.sel { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.big-option:disabled { opacity: .5; cursor: not-allowed; }
.btn.big { padding: .75rem 1.5rem; font-size: 1rem; }
.ratebar .btn.pct { background: var(--panel); }

/* ---- Stammbaum-Seite (Projekt öffnen) ---- */
.bigtree { padding: 1.1rem 1.2rem 1.3rem; }
.bt-head { gap: .6rem; flex-wrap: wrap; margin-bottom: .8rem; }
.btree { list-style: none; margin: 0; padding: 0; }
.btree .btree { margin: .1rem 0 .2rem 1.35rem; padding-left: .9rem; border-left: 2px solid var(--line); }
.brow { display: grid; grid-template-columns: 30px minmax(0, 1fr) 140px 3.2em 40px; align-items: center; gap: .6rem; padding: .45rem .6rem; border-radius: 16px; cursor: pointer; min-height: 52px; transition: background .12s; }
.brow:hover, .brow:focus-visible { background: var(--panel-2); outline: none; }
.brow .twisty { border: 0; background: none; width: 30px; height: 36px; border-radius: 10px; cursor: pointer; color: var(--muted); font-size: .75rem; transition: transform .15s; padding: 0; }
.brow .twisty:hover { background: var(--accent-soft); color: var(--accent); }
.brow .twisty.open { transform: rotate(90deg); }
.brow .twisty.leaf { visibility: hidden; }
.btitle { min-width: 0; overflow-wrap: anywhere; line-height: 1.3; font-size: 1rem; }
.bnode.depth-0 > .brow .btitle { font-weight: 750; font-size: 1.08rem; }
.bnode.depth-1 > .brow .btitle { font-weight: 650; }
.btitle .tno { color: var(--muted); font-size: .78rem; font-weight: 700; margin-right: .45rem; font-variant-numeric: tabular-nums; }
.bcount { margin-left: .6rem; color: var(--muted); font-size: .76rem; font-weight: 500; white-space: nowrap; }
.brow .pct { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.brow .badd { justify-self: end; opacity: .45; font-size: 1.15rem; transition: opacity .12s, background .12s; }
.brow:hover .badd, .brow:focus-within .badd, .brow .badd:focus-visible { opacity: 1; background: var(--accent-soft); color: var(--accent); }
.backrow { margin: .2rem 0 -.2rem; }
.btn.ghost { background: transparent; box-shadow: none; padding-left: .2rem; color: var(--muted); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
@media (hover: none) { .brow .badd { opacity: 1; } }
@media (max-width: 700px) {
  .bigtree { padding: .8rem .5rem 1rem; }
  .brow { grid-template-columns: 28px minmax(0, 1fr) 3em 40px; gap: .35rem; padding: .35rem .3rem; }
  .brow .bar { display: none; }
  .btree .btree { margin-left: .9rem; padding-left: .5rem; }
  .bcount { display: block; margin: .1rem 0 0; }
}

/* Prozent-Auswahl: Prozentzeichen nie in eine zweite Zeile */
.ratebar .verdict { flex-wrap: nowrap; gap: .35rem; }
.ratebar .btn.pct { flex: 1 1 0; min-width: 0; white-space: nowrap; padding: .6rem .15rem; font-size: .92rem; }
.ratebar .row.small { flex-wrap: wrap; row-gap: .4rem; }
.ratebar .row.small > div { flex: 1 1 140px; min-width: 120px; }
.ratebar strong { white-space: nowrap; }
.levels button { white-space: nowrap; }

/* ---- Handy: breite Inhalte (Formeln, Tabellen, Code) seitlich wischbar statt abgeschnitten ---- */
.task-row, .task-open, .task-open > *, .task-sol { min-width: 0; max-width: 100%; }
.task-open { grid-template-columns: minmax(0, 1fr); }
.task-row .md, .task-sol, .node .md { max-width: 100%; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
.md .katex { max-width: none; }
.md p:has(.katex), .md li:has(.katex) { overflow-x: auto; overflow-y: hidden; }
.md img { height: auto; }

/* ---- Mehrere Lernzettel als PDF ---- */
.multi-pdf { max-height: 55vh; overflow: auto; margin: .6rem 0; }
.mp-row { display: flex; gap: .55rem; align-items: center; padding: .4rem .3rem; border-radius: 8px; cursor: pointer; }
.mp-row:hover { background: var(--accent-soft); }
.mp-row input { width: 1.2rem; height: 1.2rem; flex: none; }

/* ---- Aufgaben-Notiz ---- */
.task-note { margin-top: .4rem; display: grid; gap: .4rem; }

/* ---------- Bewertungs-Knoepfe ---------- */
.btn.good { background: color-mix(in srgb, var(--ok) 16%, var(--panel)); }
.btn.bad { background: color-mix(in srgb, var(--danger) 13%, var(--panel)); }
