/* ---------- Tokens ---------- */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f0f3f9;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #1d4ed8;
  --accent-soft: #e0e9ff;
  --accent-text: #ffffff;
  --st-new: #cbd5e1;
  --st-wrong: #dc2626;
  --st-learn: #f59e0b;
  --st-ok: #16a34a;
  --ok-soft: #dcfce7;
  --bad-soft: #fee2e2;
  --warn-soft: #fef3c7;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .05);
  --radius: 14px;
  --nav-w: 220px;
  --tab-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1220; --surface: #121a2b; --surface-2: #1a2438; --text: #e5e9f2; --muted: #94a3b8; --line: #243049;
    --accent: #6d9bff; --accent-soft: #1c2b4d; --accent-text: #0b1220;
    --st-new: #3b4660; --ok-soft: #12301f; --bad-soft: #3a1717; --warn-soft: #3a2c0c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1220; --surface: #121a2b; --surface-2: #1a2438; --text: #e5e9f2; --muted: #94a3b8; --line: #243049;
  --accent: #6d9bff; --accent-soft: #1c2b4d; --accent-text: #0b1220;
  --st-new: #3b4660; --ok-soft: #12301f; --bad-soft: #3a1717; --warn-soft: #3a2c0c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
}

/* ---------- Basis ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--font); -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; margin-top: 1rem; }
code, pre { font-family: var(--mono); font-size: .9em; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem; width: 100%; min-height: 42px;
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { resize: vertical; }
input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); flex: none; }
.boot, .loading { padding: 3rem; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.big { font-size: 1.5rem; font-weight: 700; }
.mono { font-family: var(--mono); }
.ok { color: var(--st-ok); } .warn { color: var(--st-learn); } .bad { color: var(--st-wrong); }

/* ---------- Layout ---------- */
.app { min-height: 100vh; }
.main { padding-bottom: calc(var(--tab-h) + var(--safe-b) + 1rem); }
.app.focus .main { padding-bottom: 0; }
.page { max-width: 1100px; margin: 0 auto; padding: calc(1rem + var(--safe-t)) 1rem 1rem; display: flex; flex-direction: column; gap: 1rem; }

.nav {
  position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.nav-brand, .nav-foot { display: none; }
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: .7rem; font-weight: 500; }
.nav-item.active { color: var(--accent); }

@media (min-width: 900px) {
  .main { margin-left: var(--nav-w); padding-bottom: 2rem; }
  .app.focus .main { margin-left: 0; }
  .nav {
    top: 0; right: auto; width: var(--nav-w); height: auto; flex-direction: column; gap: 2px; padding: 1rem .75rem;
    border-top: 0; border-right: 1px solid var(--line); background: var(--surface);
  }
  .nav-brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.1rem; padding: .25rem .5rem 1rem; }
  .nav-item { flex: none; flex-direction: row; justify-content: flex-start; gap: .75rem; padding: .6rem .75rem; border-radius: 10px; font-size: .95rem; }
  .nav-item:hover { background: var(--surface-2); }
  .nav-item.active { background: var(--accent-soft); }
  .nav-foot { display: flex; align-items: center; gap: .5rem; margin-top: auto; padding: .5rem .75rem; font-size: .8rem; color: var(--muted); }
  .page { padding: 2rem 2rem 2rem; }
}

/* ---------- Bausteine ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; border: 1px solid var(--line); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.card-head h2 { margin: 0; }
.link { font-size: .9rem; font-weight: 500; }
.section-title { margin: .5rem 0; font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 760px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.col { display: flex; flex-direction: column; gap: 1rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .55rem 1rem; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer; text-align: center; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--st-wrong); }
.btn.small { min-height: 36px; padding: .35rem .75rem; font-size: .88rem; }
.btn.active { background: var(--accent-soft); border-color: var(--accent); }
.btn:disabled, .btn.disabled { opacity: .45; pointer-events: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .5rem; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; color: var(--text); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--surface-2); }

.page-header { display: flex; align-items: center; gap: .5rem; }
.page-header .page-title { flex: 1; min-width: 0; }
.page-header h1 { margin: 0; overflow-wrap: anywhere; }
.page-header[style] h1 { border-left: 4px solid var(--accent-local); padding-left: .6rem; }
.page-sub { color: var(--muted); font-size: .9rem; }
.page-actions { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }

.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .7rem; border-radius: 999px; background: var(--warn-soft); color: #b45309; font-weight: 600; font-size: .9rem; }
.badge { background: var(--st-wrong); color: #fff; border-radius: 999px; padding: .05rem .5rem; font-size: .75rem; font-weight: 700; }
.tag { display: inline-flex; align-items: center; padding: .15rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--accent-soft); color: var(--accent); border-left: 3px solid var(--sc, var(--accent)); }
.tag.ghost { background: var(--surface-2); color: var(--muted); border-left: 0; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .75rem; }
.chip { padding: .3rem .7rem; border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: .85rem; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.banner { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .75rem 1rem; border-radius: 12px; background: var(--accent-soft); color: var(--text); }
.banner.ok { background: var(--ok-soft); }
.banner.warn { background: var(--warn-soft); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + var(--safe-b) + 1rem); background: var(--text); color: var(--bg); padding: .6rem 1rem; border-radius: 10px; z-index: 50; max-width: 90vw; }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .4rem; padding: 2rem 1rem; color: var(--muted); }
.empty-title { font-weight: 700; color: var(--text); }
.empty-text { max-width: 440px; }
.empty .btn-row { justify-content: center; }

.status-wrap { display: flex; flex-direction: column; gap: .4rem; }
.status-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--st-new); gap: 2px; }
.status-bar .seg.empty { background: var(--surface-2); }
.legend { display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .8rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; }
.ring-text { font-size: 13px; font-weight: 700; fill: var(--text); }

.tabs { display: flex; gap: .25rem; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tab { border: 0; background: none; padding: .6rem .8rem; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.seg-control { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg-control button { border: 0; background: none; padding: .4rem .7rem; border-radius: 8px; font-weight: 600; color: var(--muted); cursor: pointer; min-height: 36px; }
.seg-control button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg-control button.suggested { outline: 1px dashed var(--accent); outline-offset: -3px; }
.seg-control.small button { padding: .25rem .55rem; font-size: .8rem; min-height: 30px; }

.field { display: flex; flex-direction: column; gap: .25rem; font-size: .88rem; color: var(--muted); }
.field > span { font-weight: 600; }
.field input, .field select, .field textarea { color: var(--text); font-size: 1rem; }
.field.inline { flex-direction: row; align-items: center; gap: .5rem; }
.field.inline input { width: auto; }
.field-row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; }
.field-row > .field { flex: 1 1 140px; }
.form { display: flex; flex-direction: column; gap: .8rem; }
.check { display: flex; align-items: center; gap: .55rem; padding: .3rem 0; cursor: pointer; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .1rem .75rem; color: var(--text); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: .8rem; padding: .4rem .5rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: .5rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td a { color: var(--text); display: inline-flex; align-items: center; gap: .4rem; }
.table tr.past { opacity: .5; }
.table select { min-height: 32px; padding: .2rem .4rem; width: auto; }
.list { display: flex; flex-direction: column; gap: .4rem; }
.list-row { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); text-align: left; cursor: pointer; width: 100%; }
.list-row:hover { border-color: var(--accent); }
.row-title { font-weight: 600; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(2, 6, 23, .5); display: grid; place-items: end center; }
.modal { background: var(--surface); width: 100%; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0; padding-bottom: var(--safe-b); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1rem .25rem; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h2 { margin: 0; }
.modal-body { padding: .5rem 1rem 1rem; }
@media (min-width: 700px) {
  .modal-backdrop { place-items: center; }
  .modal { width: 560px; border-radius: 18px; }
  .modal.wide { width: 820px; }
}

/* ---------- Start ---------- */
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; }
.hero h1 { margin: 0; }
.hero-date { color: var(--muted); font-weight: 500; }
.today-top { display: flex; align-items: center; gap: 1rem; margin-bottom: .75rem; }
.today-list { display: flex; flex-direction: column; gap: .4rem; }
.today-row { display: flex; align-items: center; gap: .75rem; padding: .65rem .75rem; border-radius: 12px; background: var(--surface-2); color: var(--text); }
.today-row:hover { outline: 1px solid var(--accent); }
.row-min { font-variant-numeric: tabular-nums; font-weight: 600; font-size: .9rem; white-space: nowrap; }
.event-list, .exam-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.event-list li, .exam-list li { display: flex; align-items: center; gap: .6rem; }
.ev-time { font-variant-numeric: tabular-nums; font-size: .85rem; color: var(--muted); min-width: 92px; }
.ev-room { font-size: .8rem; background: var(--surface-2); padding: .1rem .45rem; border-radius: 6px; }
.countdown { font-size: .85rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.countdown.hot { color: var(--st-wrong); }
.countdown.past { text-decoration: line-through; }
.subject-progress { display: flex; flex-direction: column; gap: .6rem; }
.sp-row { display: grid; grid-template-columns: minmax(120px, 220px) 1fr 48px; gap: .75rem; align-items: center; color: var(--text); }
.sp-name { display: flex; align-items: center; gap: .5rem; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sp-pct { text-align: right; font-variant-numeric: tabular-nums; font-size: .9rem; color: var(--muted); }
@media (max-width: 520px) { .sp-row { grid-template-columns: 1fr 44px; } .sp-row .status-wrap { grid-column: 1 / -1; grid-row: 2; } }

/* ---------- Fächer & Themen ---------- */
.subject-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.subject-card { display: flex; flex-direction: column; gap: .6rem; color: var(--text); border-top: 4px solid var(--sc); }
.subject-card:hover { border-color: var(--sc); }
.subject-card h2 { margin: 0; }
.sc-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.sc-short { font-size: .75rem; font-weight: 700; color: var(--sc); letter-spacing: .05em; }
.sc-foot { display: flex; justify-content: space-between; align-items: center; font-size: .85rem; }
.sc-foot span { display: inline-flex; align-items: center; gap: .3rem; }
.action-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .5rem; margin-top: 1rem; }
.action { display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .8rem .5rem; border-radius: 12px; background: var(--surface-2); color: var(--text); font-weight: 600; text-align: center; }
.action small { color: var(--muted); font-weight: 500; font-size: .75rem; }
.action.primary { background: var(--sc, var(--accent)); color: #fff; }
.action.primary small { color: rgba(255, 255, 255, .85); }
.action:hover { filter: brightness(1.04); outline: 1px solid var(--line); }
.topic-list { display: flex; flex-direction: column; gap: .6rem; }
.topic-row { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.topic-main { flex: 1 1 260px; color: var(--text); display: flex; flex-direction: column; gap: .35rem; }
.topic-title { display: flex; align-items: center; gap: .5rem; font-weight: 600; }
.week-badge { font-size: .72rem; font-weight: 700; background: var(--surface-2); color: var(--muted); padding: .1rem .4rem; border-radius: 6px; }
.read-mark { color: var(--st-ok); display: inline-flex; }
.topic-actions { display: flex; gap: .4rem; }
.topic-page .explanation { font-size: 1.02rem; line-height: 1.65; }
.summary { background: var(--accent-soft); border-color: transparent; }
.prereq ul { margin: 0; padding-left: 1.2rem; }
.sticky-actions { position: sticky; bottom: calc(var(--tab-h) + var(--safe-b) + .5rem); display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; padding: .5rem; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(8px); border-radius: 14px; z-index: 5; }
@media (min-width: 900px) { .sticky-actions { bottom: 1rem; } }
.prev-next { display: flex; justify-content: space-between; gap: 1rem; font-size: .9rem; }

/* ---------- Markdown ---------- */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: .5rem 0; }
.md h1, .md h2, .md h3 { margin: 1.2rem 0 .5rem; }
.md ul, .md ol { padding-left: 1.3rem; }
.md table { border-collapse: collapse; margin: .5rem 0; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: .3rem .6rem; }
.md blockquote { margin: .5rem 0; padding: .5rem .9rem; border-left: 4px solid var(--accent); background: var(--surface-2); border-radius: 0 10px 10px 0; }
.md pre { background: var(--surface-2); padding: .75rem; border-radius: 10px; overflow-x: auto; }
.md :not(pre) > code { background: var(--surface-2); padding: .05rem .35rem; border-radius: 5px; }
.md img { max-width: 100%; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: .2rem 0; }
.tex-display { display: block; }

/* ---------- Übung / Fokus ---------- */
.focus-page { min-height: 100vh; display: flex; flex-direction: column; }
.focus-head { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: .5rem; padding: calc(.5rem + var(--safe-t)) .75rem .5rem; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.focus-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.counter { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--muted); }
.focus-progress { flex-basis: 100%; height: 4px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.focus-progress span { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.focus-body { flex: 1; width: 100%; max-width: 820px; margin: 0 auto; padding: 1rem; display: flex; flex-direction: column; gap: .9rem; }
.focus-body.narrow { max-width: 560px; }
.focus-foot { position: sticky; bottom: 0; display: flex; gap: .5rem; align-items: center; padding: .75rem 1rem calc(.75rem + var(--safe-b)); background: var(--surface); border-top: 1px solid var(--line); z-index: 10; }
.focus-foot .btn.primary { min-width: 140px; }
.item-meta { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.item-card { display: flex; flex-direction: column; gap: 1rem; }
.question { font-size: 1.08rem; }
.options { display: flex; flex-direction: column; gap: .5rem; }
.option { display: flex; align-items: flex-start; gap: .75rem; text-align: left; padding: .8rem .9rem; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; width: 100%; }
.option:hover { border-color: var(--accent); }
.option.selected { border-color: var(--accent); background: var(--accent-soft); }
.option.correct { border-color: var(--st-ok); background: var(--ok-soft); }
.option.wrong { border-color: var(--st-wrong); background: var(--bad-soft); }
.option-key { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--surface-2); font-weight: 700; font-size: .9rem; }
.option.selected .option-key { background: var(--accent); color: var(--accent-text); }
.option-body { flex: 1; min-width: 0; padding-top: 2px; }
.option-why { margin-top: .35rem; font-size: .88rem; color: var(--muted); }
.num-parts { display: flex; flex-direction: column; gap: .7rem; }
.num-part { display: flex; flex-direction: column; gap: .3rem; }
.num-label { font-weight: 600; }
.num-field { display: flex; align-items: center; gap: .5rem; }
.num-field input { max-width: 240px; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.num-part.correct input { border-color: var(--st-ok); background: var(--ok-soft); }
.num-part.wrong input { border-color: var(--st-wrong); background: var(--bad-soft); }
.num-solution { font-size: .9rem; color: var(--st-ok); }
.unit { font-weight: 600; color: var(--muted); }
pre.code { background: #0f172a; color: #e2e8f0; padding: .9rem 1rem; border-radius: 12px; overflow-x: auto; font-size: .88rem; line-height: 1.55; margin: 0; }
pre.code.cloze { white-space: pre; }
.blank-wrap { display: inline-flex; flex-direction: column; vertical-align: middle; }
.blank { display: inline-block; min-height: 0; padding: 0 .3rem; height: 1.5em; border-radius: 5px; background: #1e293b; color: #fde68a; border: 1px solid #475569; font-family: var(--mono); font-size: inherit; }
.blank.correct { border-color: var(--st-ok); color: #86efac; }
.blank.wrong { border-color: var(--st-wrong); color: #fca5a5; }
.blank-sol { font-size: .75em; color: #86efac; }
.card-front { font-size: 1.15rem; font-weight: 600; text-align: center; padding: 1.5rem .5rem; }
.card-back { font-size: 1.05rem; padding: .5rem; border-top: 1px dashed var(--line); }
.hint { display: flex; gap: .5rem; align-items: flex-start; padding: .6rem .8rem; border-radius: 10px; background: var(--warn-soft); }
.verdict { font-weight: 700; font-size: 1.1rem; padding: .7rem 1rem; border-radius: 12px; }
.verdict.right { background: var(--ok-soft); color: var(--st-ok); }
.verdict.partial { background: var(--warn-soft); color: #b45309; }
.verdict.wrong { background: var(--bad-soft); color: var(--st-wrong); }
.solution-card { display: flex; flex-direction: column; gap: .75rem; }
.item-solution { display: flex; flex-direction: column; gap: .9rem; }
.sol-title { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .3rem; }
.sol-block.explain { background: var(--accent-soft); padding: .8rem 1rem; border-radius: 12px; }
.steps { padding-left: 1.3rem; margin: 0; display: flex; flex-direction: column; gap: .4rem; }
.self-grade { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; width: 100%; }
.self-grade .btn { white-space: normal; }
.grade-wrong { border-color: var(--st-wrong) !important; color: var(--st-wrong); }
.grade-partial { border-color: var(--st-learn) !important; color: #b45309; }
.grade-right { border-color: var(--st-ok) !important; color: var(--st-ok); }
.self-grade .active.grade-wrong { background: var(--bad-soft); }
.self-grade .active.grade-partial { background: var(--warn-soft); }
.self-grade .active.grade-right { background: var(--ok-soft); }
.rubric { display: flex; flex-direction: column; gap: .3rem; }
.result-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: .6rem; padding: 1.5rem; }
.result-card .btn-row { justify-content: center; }
.result-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; width: 100%; max-width: 420px; }
.result-stats div { display: flex; flex-direction: column; }
.result-stats b { font-size: 1.5rem; }
.result-stats span { font-size: .8rem; color: var(--muted); }

/* ---------- Prüfung ---------- */
.timer { display: inline-flex; align-items: center; gap: .3rem; font-weight: 700; font-variant-numeric: tabular-nums; padding: .3rem .6rem; border-radius: 8px; background: var(--surface-2); }
.timer.hot { background: var(--bad-soft); color: var(--st-wrong); }
.exam-nav { display: flex; gap: .3rem; padding: .5rem .75rem; overflow-x: auto; background: var(--surface); border-bottom: 1px solid var(--line); }
.exam-dot { flex: none; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer; font-size: .85rem; }
.exam-dot.done { background: var(--accent-soft); border-color: var(--accent); }
.exam-dot.flag { box-shadow: inset 0 -3px 0 var(--st-learn); }
.exam-dot.current { outline: 2px solid var(--accent); }
.grade { font-size: 3rem; font-weight: 800; line-height: 1; }
.grade.pass { color: var(--st-ok); }
.grade.fail { color: var(--st-wrong); }
.topic-scores { display: flex; flex-direction: column; gap: .5rem; }
.ts-row { display: flex; align-items: center; gap: .75rem; font-size: .92rem; }
.ts-bar { width: 35%; height: 8px; background: var(--surface-2); border-radius: 8px; overflow: hidden; }
.ts-bar span { display: block; height: 100%; }
.ts-num { width: 52px; text-align: right; font-variant-numeric: tabular-nums; }
.review summary { display: flex; align-items: center; gap: .6rem; cursor: pointer; list-style: none; }
.review summary::-webkit-details-marker { display: none; }
.review[open] summary { margin-bottom: .8rem; }
.review[open] { display: flex; flex-direction: column; gap: .8rem; }
.review-mark { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.review-mark.right { background: var(--st-ok); } .review-mark.partial { background: var(--st-learn); } .review-mark.wrong { background: var(--st-wrong); }

/* ---------- Lernplan ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
@media (min-width: 900px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat { display: flex; flex-direction: column; gap: .15rem; }
.stat.warn { background: var(--warn-soft); }
.stat-label { font-size: .8rem; font-weight: 600; color: var(--muted); }
.stat-value { font-size: 1.35rem; font-weight: 800; }
.weekday-inputs { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .4rem; margin-bottom: .75rem; }
.weekday-inputs input { padding: .4rem; text-align: center; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid-line { stroke: var(--line); }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .avail-line { stroke: var(--text); stroke-width: 2; stroke-dasharray: 3 2; opacity: .55; }
.avail-key { border-top: 2px dashed var(--text); height: 0 !important; opacity: .55; border-radius: 0 !important; }
.history { display: flex; gap: 4px; align-items: flex-end; height: 110px; margin-bottom: .4rem; }
.h-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.h-bar { flex: 1; width: 100%; display: flex; align-items: flex-end; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.h-bar span { width: 100%; background: var(--accent); border-radius: 6px 6px 0 0; }
.h-lab { font-size: .7rem; color: var(--muted); }

/* ---------- Termine ---------- */
.week-nav { display: flex; align-items: center; gap: .5rem; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .5rem; }
.week.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.week-day { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .5rem; display: flex; flex-direction: column; gap: .4rem; min-height: 120px; }
.week-day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.wd-head { display: flex; justify-content: space-between; font-size: .85rem; color: var(--muted); }
.wd-head b { color: var(--text); }
.wd-empty { color: var(--line); text-align: center; }
.ev { text-align: left; border: 0; border-left: 4px solid var(--sc); background: color-mix(in srgb, var(--sc) 12%, var(--surface)); border-radius: 8px; padding: .35rem .5rem; cursor: pointer; font-size: .8rem; display: flex; flex-direction: column; gap: 1px; }
.ev.exam { background: var(--bad-soft); border-left-color: var(--st-wrong); font-weight: 700; }
.ev-t { font-variant-numeric: tabular-nums; color: var(--muted); }
.ev-n { font-weight: 600; overflow-wrap: anywhere; }
.ev-r { color: var(--muted); }
@media (max-width: 760px) {
  .week, .week.five { grid-template-columns: 1fr; }
  .week-day { min-height: 0; flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .wd-head { width: 64px; flex-direction: column; justify-content: flex-start; }
  .week-day .ev { flex: 1 1 180px; }
  .wd-empty { flex: 1; text-align: left; padding-top: .2rem; }
}

/* ---------- Formeln ---------- */
.f-counts { display: flex; flex-wrap: wrap; gap: .5rem 1rem; font-size: .9rem; margin: .5rem 0; }
.f-counts .warn { color: #b45309; }
.formula-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.formula-card { display: flex; flex-direction: column; gap: .5rem; border-left: 4px solid var(--line); }
.formula-card.st-sheet { border-left-color: var(--accent); }
.formula-card.st-memorized { border-left-color: var(--st-ok); }
.formula-card.st-skip { opacity: .6; }
.fc-head, .fc-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.formula-title { font-weight: 700; }
.stars { color: var(--st-learn); letter-spacing: 1px; font-size: .85rem; }
.vars { font-size: .85rem; border-collapse: collapse; }
.vars td { padding: .1rem .5rem .1rem 0; vertical-align: top; }
.formula-list { display: flex; flex-direction: column; gap: .75rem; }
.formula { padding: .6rem .8rem; background: var(--surface-2); border-radius: 10px; }
.tex-preview { min-height: 56px; padding: .5rem; background: var(--surface-2); border-radius: 10px; display: grid; place-items: center; }
.flash { text-align: center; display: flex; flex-direction: column; gap: 1rem; padding: 2rem 1rem; }
.flash-q { font-size: 1.3rem; font-weight: 700; }
.flash-a { font-size: 1.2rem; }

/* Druckansicht */
.print-page { background: #fff; color: #000; min-height: 100vh; }
.print-toolbar { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; padding: .75rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line); color: var(--text); position: sticky; top: 0; }
.sheet { max-width: 210mm; margin: 1rem auto; padding: 8mm; background: #fff; color: #000; column-gap: 6mm; font-size: 9pt; line-height: 1.3; box-shadow: 0 0 0 1px #ddd; }
.sheet-title { column-span: all; font-weight: 800; font-size: 11pt; border-bottom: 1.5px solid #000; margin-bottom: 2mm; }
.sheet-group { break-inside: avoid-column; margin-bottom: 2mm; }
.sheet-h { font-weight: 800; background: #eee; padding: .5mm 1.5mm; margin: 1.5mm 0 1mm; }
.sheet-f { break-inside: avoid; padding: .5mm 0 1mm; border-bottom: .5px solid #ccc; }
.sheet-ft { font-weight: 700; font-size: 8pt; }
.sheet-fd { font-size: 7.5pt; color: #333; }
.sheet .katex-display { margin: .5mm 0; }
.sheet .katex { font-size: 1em; }
@media print {
  @page { size: A4; margin: 8mm; }
  body { background: #fff; }
  .no-print, .nav { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; }
  .sheet { box-shadow: none; margin: 0; padding: 0; max-width: none; }
}

/* ---------- Sync ---------- */
.sync-status { display: flex; align-items: center; gap: .5rem; font-weight: 600; flex-wrap: wrap; }
.sync-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--st-new); display: inline-block; }
.sync-dot.ok { background: var(--st-ok); }
.sync-dot.syncing { background: var(--accent); animation: pulse 1s infinite; }
.sync-dot.offline, .sync-dot.error { background: var(--st-learn); }
.sync-dot.auth { background: var(--st-wrong); }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.review-q { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.stars-off { color: var(--line); letter-spacing: 1px; font-size: .85rem; }
