@font-face { font-family: "Oswald"; font-weight: 600; font-display: swap; src: url("../fonts/oswald-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Oswald"; font-weight: 700; font-display: swap; src: url("../fonts/oswald-latin-700-normal.woff2") format("woff2"); }

:root {
  --bg: #f6f7f4; --surface: #ffffff; --surface2: #eef1ec; --ink: #1d2420; --ink2: #4a554e; --muted: #5c675f;
  --line: #dde3dc; --accent: #1f8a8a; --accent-ink: #ffffff; --ok: #177848; --ok-bg: #e3f5ea; --bad: #c2412d; --bad-bg: #fbe9e5;
  --warn-bg: #fff6dc; --warn-line: #e6c55a; --gold: #e0b400; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 14px rgba(0,0,0,.05);
  --r: 16px; --display: "Oswald", "Arial Narrow", "Roboto Condensed", Impact, sans-serif;
  --c-anat: #d0574a; --c-phys: #7b5cc4; --c-skl: #d9822b; --c-pt: #2e9e6a;
  --t-anat: #fbe7e3; --t-phys: #ece6fa; --t-skl: #fcebd8; --t-pt: #e0f3e8;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121614; --surface: #1b211e; --surface2: #242c28; --ink: #e8ede9; --ink2: #bcc6bf; --muted: #8e9a93;
    --line: #2f3833; --accent: #3cbcbc; --accent-ink: #0d1410; --ok: #5fd197; --ok-bg: #173527; --bad: #f08470; --bad-bg: #3a1f1a;
    --warn-bg: #362d12; --warn-line: #8a7426; --shadow: none; color-scheme: dark;
    --t-anat: #3a2320; --t-phys: #2b2540; --t-skl: #3b2a18; --t-pt: #1b3528;
  }
}
:root[data-theme="dark"] {
  --bg: #121614; --surface: #1b211e; --surface2: #242c28; --ink: #e8ede9; --ink2: #bcc6bf; --muted: #8e9a93;
  --line: #2f3833; --accent: #3cbcbc; --accent-ink: #0d1410; --ok: #5fd197; --ok-bg: #173527; --bad: #f08470; --bad-bg: #3a1f1a;
  --warn-bg: #362d12; --warn-line: #8a7426; --shadow: none; color-scheme: dark;
  --t-anat: #3a2320; --t-phys: #2b2540; --t-skl: #3b2a18; --t-pt: #1b3528;
}
:root[data-size="gross"] { font-size: 112%; }
:root[data-size="maximal"] { font-size: 125%; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 1rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
a { color: inherit; text-decoration: none; }
h1, h2, h3, .logo b, .eyebrow, .hdr-stats, .res-grid b, .stat b, .ring-txt b, .no { font-family: var(--display); text-transform: uppercase; letter-spacing: .01em; }
h1 { font-size: 1.7rem; margin: .4rem 0 1rem; line-height: 1.15; }
h2 { font-size: 1.25rem; margin: 1.6rem 0 .6rem; line-height: 1.2; }
h3 { font-size: 1.05rem; margin: 0 0 .4rem; line-height: 1.25; }
h1, h2, h3 { overflow-wrap: anywhere; hyphens: auto; }
p { margin: .5rem 0; }
.wrap { max-width: 860px; margin: 0 auto; padding-block: 12px 24px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.muted { color: var(--muted); } .small { font-size: .875rem; } .center { text-align: center; }
.skip { position: absolute; left: -999px; top: 0; } .skip:focus { left: 8px; z-index: 50; background: var(--surface); padding: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Kopf & Navigation */
.top { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 8px; font-size: 1.15rem; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--surface2); color: var(--ink2); white-space: nowrap; }
.chip:empty { display: none; }
.hdr-stats { display: flex; gap: 12px; font-weight: 700; font-size: 1rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hdr-stats span { display: inline-flex; align-items: center; gap: 3px; }
.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex; justify-content: space-around; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 2px calc(6px + env(safe-area-inset-bottom)); }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; color: var(--muted); padding: 5px 4px; border-radius: 10px; min-width: 50px; }
.nav a.active { color: var(--ink); background: var(--surface2); font-weight: 700; }
.ic { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
body.focus .nav { display: none; } body.focus { padding-bottom: 24px; }

/* Karten & Raster */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); margin-bottom: 12px; }
.card.tint { background: var(--t, var(--surface2)); border-color: transparent; }
.grid2, .grid3 { display: grid; gap: 12px; margin-bottom: 12px; }
.grid2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid3 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.grid2 > .card, .grid3 > .card { margin: 0; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.eyebrow { font-size: .8rem; color: var(--muted); margin: 0 0 4px; font-weight: 600; letter-spacing: .05em; }
.back { display: inline-flex; gap: 6px; color: var(--muted); margin: 4px 0 8px; font-weight: 600; background: none; border: 0; font: inherit; cursor: pointer; padding: 0; }
.list-item { display: flex; gap: 14px; align-items: center; transition: transform .12s; }
a.card:hover, a.list-item:hover { transform: translateY(-2px); }
.no { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 1.05rem; background: var(--t, var(--surface2)); color: var(--c, var(--ink)); }
.no.done { background: var(--c, var(--accent)); color: #fff; }
.grow { flex: 1; min-width: 0; }
.sub { color: var(--muted); font-size: .88rem; margin: 2px 0 0; }

/* Knöpfe */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; background: var(--ink); color: var(--bg); font: inherit; font-weight: 700; padding: 11px 18px; border-radius: 99px; cursor: pointer; transition: transform .08s; text-align: center; }
.btn:active { transform: translateY(2px); }
.btn.accent { background: var(--accent); color: var(--accent-ink); }
.btn.big { padding: 14px 22px; font-size: 1.05rem; }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1.5px solid var(--line); }
.btn.soft { background: var(--warn-bg); color: var(--ink); border: 1.5px solid var(--warn-line); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.small { padding: 7px 13px; font-size: .88rem; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font: inherit; font-size: .9rem; padding: 0; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button { border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); padding: 8px 16px; border-radius: 99px; font: inherit; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
input[type=text], input[type=search], input[type=date], input[type=number], textarea, select { font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; width: 100%; }
label.check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; cursor: pointer; }
label.check input { width: 20px; height: 20px; accent-color: var(--accent); margin-top: 2px; flex: none; }

/* Balken & Ringe */
.bar { height: 10px; background: var(--surface2); border-radius: 99px; overflow: hidden; flex: 1; }
.bar span { display: block; height: 100%; background: var(--c, var(--accent)); border-radius: 99px; transition: width .4s; }
.bar.thin { height: 6px; margin: 8px 0 0; }
.hero { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.hero > div:first-child { flex: 1; min-width: 220px; }
.rings { display: flex; gap: 12px; }
.ring { position: relative; width: 92px; height: 92px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 8; }
.ring .bg { stroke: var(--surface2); } .ring .fg { stroke-linecap: round; transition: stroke-dashoffset .6s; }
.ring-txt { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ring-txt b { font-size: 1rem; } .ring-txt small { font-size: .62rem; color: var(--muted); line-height: 1.1; max-width: 70px; }
.stat { background: var(--surface2); border-radius: 12px; padding: 10px 12px; }
.stat b { display: block; font-size: 1.4rem; } .stat small { color: var(--muted); }
.stats4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }

/* Fach-Kacheln */
.fach { display: flex; gap: 14px; align-items: center; background: var(--t); border: 0; }
.fach-ic { flex: none; width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center; font-size: 1.8rem; background: var(--surface); }
.tag { display: inline-block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 99px; background: var(--surface); color: var(--ink2); margin-right: 4px; }
.stars { color: var(--gold); letter-spacing: 1px; white-space: nowrap; } .stars .off { color: var(--line); }

/* Lernkarten & Wissen */
.dots { display: flex; gap: 6px; margin-bottom: 10px; }
.dots i { flex: 1; height: 6px; border-radius: 6px; background: var(--surface2); }
.dots i.on { background: var(--c, var(--accent)); }
.learn { border-top: 5px solid var(--c, var(--accent)); }
.learn h2 { margin-top: 0; }
.txt { font-size: 1.02rem; line-height: 1.65; }
.txt ul { padding-left: 1.25rem; margin: .4rem 0; } .txt li { margin: .2rem 0; }
.txt b { background: color-mix(in srgb, var(--c, var(--accent)) 15%, transparent); padding: 0 3px; border-radius: 4px; }
.merke { background: var(--warn-bg); border-left: 4px solid var(--warn-line); border-radius: 10px; padding: 10px 12px; margin: .7rem 0; }
.merke::before { content: "MERKE"; display: block; font: 700 .72rem var(--display); letter-spacing: .08em; color: var(--muted); margin-bottom: 2px; }
.txt table { border-collapse: collapse; width: 100%; margin: .6rem 0; font-size: .93rem; }
.txt td, .txt th { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: left; vertical-align: top; }
.txt tr:first-child td { background: var(--surface2); font-weight: 700; }
.sec { scroll-margin-top: 80px; }
.sec + .sec { margin-top: 12px; }
.read-btn.on { background: var(--ok-bg); border-color: var(--ok); }
mark { background: #ffe58a; color: inherit; border-radius: 3px; }

/* Quiz */
.quiz-top { display: flex; align-items: center; gap: 12px; margin: 4px 0 12px; }
.quiz-top .bar { height: 12px; }
.x { background: none; border: 0; font-size: 1.4rem; color: var(--muted); cursor: pointer; padding: 0 4px; line-height: 1; }
.hearts { white-space: nowrap; color: var(--bad); font-size: 1.05rem; }
.clock { font-variant-numeric: tabular-nums; font-weight: 700; background: var(--surface2); padding: 3px 10px; border-radius: 99px; }
.clock.low { background: var(--bad-bg); color: var(--bad); }
.combo { background: #ffe9cc; color: #8a4b00; padding: 1px 8px; border-radius: 99px; text-transform: none; margin-left: 6px; font-size: .78rem; }
.q { font-size: 1.12rem; margin: 0 0 14px; line-height: 1.45; font-weight: 650; }
.opts { display: grid; gap: 10px; }
.opt { display: flex; gap: 12px; align-items: center; text-align: left; width: 100%; padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; box-shadow: 0 2px 0 var(--line); transition: border-color .1s, background .1s; }
.opt:hover:not([disabled]) { border-color: var(--accent); }
.opt .key { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface2); font-weight: 700; font-size: .85rem; }
.opt.right { border-color: var(--ok); background: var(--ok-bg); } .opt.right .key { background: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); animation: shake .3s; } .opt.wrong .key { background: var(--bad); color: #fff; }
.opt.picked { border-color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); } .opt.picked .key { background: var(--ink); color: var(--bg); }
.opt.struck { opacity: .35; text-decoration: line-through; }
.opt[disabled] { cursor: default; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.feedback { border-width: 2px; animation: pop .2s ease-out; }
.feedback.ok { border-color: var(--ok); background: var(--ok-bg); }
.feedback.bad { border-color: var(--bad); background: var(--bad-bg); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
.tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.star-btn { background: none; border: 0; font-size: 1.3rem; cursor: pointer; color: var(--muted); padding: 0 4px; }
.star-btn.on { color: var(--gold); }
.qnav { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.qnav button { width: 36px; height: 36px; border-radius: 9px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; font-size: .85rem; cursor: pointer; }
.qnav button.ans { background: var(--surface2); }
.qnav button.cur { border-color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.qnav button.flag { border-color: var(--gold); }
.qnav button.ok { background: var(--ok-bg); border-color: var(--ok); } .qnav button.bad { background: var(--bad-bg); border-color: var(--bad); }

/* Karteikarten (mündlich) */
.flash { min-height: 220px; display: flex; flex-direction: column; justify-content: center; }
.flash .q { font-size: 1.2rem; }
.answer { border-top: 1.5px dashed var(--line); margin-top: 14px; padding-top: 14px; animation: pop .2s ease-out; }
.rate { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.rate button { border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); padding: 10px 4px; font: inherit; font-weight: 700; cursor: pointer; color: var(--ink); }
.rate button small { display: block; font-weight: 400; color: var(--muted); font-size: .72rem; }
.rate .r0 { border-color: var(--bad); } .rate .r3 { border-color: var(--ok); }

/* Ergebnis */
.result { text-align: center; }
.big-stars { font-size: 2.6rem; }
.res-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.res-grid div { background: var(--surface2); border-radius: 12px; padding: 10px; }
.res-grid b { display: block; font-size: 1.3rem; } .res-grid small { color: var(--muted); }

/* Kalender */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal i { aspect-ratio: 1; border-radius: 5px; background: var(--surface2); }
.cal i.l1 { background: color-mix(in srgb, var(--accent) 35%, var(--surface2)); }
.cal i.l2 { background: color-mix(in srgb, var(--accent) 65%, var(--surface2)); }
.cal i.l3 { background: var(--accent); }
.cal i.today { outline: 2px solid var(--ink); }

/* Blatt (Nachlesen) & Toast */
.sheet { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet-in { background: var(--bg); width: 100%; max-width: 760px; max-height: 88vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-weight: 600; z-index: 40; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; }

/* Tablet */
@media (min-width: 1000px) {
  body { padding-bottom: 24px; padding-left: 96px; }
  .nav { top: 0; right: auto; width: 88px; flex-direction: column; justify-content: flex-start; gap: 6px; padding-top: 80px; border-top: 0; border-right: 1px solid var(--line); }
  .top { padding-left: 112px; }
  .logo { position: fixed; left: 22px; top: 18px; }
  .toast { bottom: 24px; }
  body.focus { padding-left: 0; } body.focus .top { padding-left: 16px; } body.focus .logo { position: static; }
}
@media print { .nav, .top, .btns, .tools { display: none !important; } body { padding: 0; } }
