:root {
  --bg: #f4f6f6; --surface: #ffffff; --surface-2: #edf0f1; --text: #14202a; --muted: #5b6874;
  --line: #dae0e4; --accent: #0b6b6b; --accent-ink: #ffffff; --accent-soft: #dff0ee;
  --ok: #17784a; --ok-soft: #e1f4e9; --bad: #b3261b; --bad-soft: #fde8e5;
  --info: #1c5ea6; --info-soft: #e3edfa; --warn: #96560a; --warn-soft: #fcefd8;
  --d-anaesthesie: #0b8a8a; --d-intensiv: #5a55c9; --d-notfall: #c9412f;
  --d-schmerz: #b9790c; --d-grundlagen: #5f6f7d;
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1317; --surface: #171d23; --surface-2: #1f272e; --text: #e7ecf0; --muted: #9aa7b3;
    --line: #2a343d; --accent: #58c9c1; --accent-ink: #05201e; --accent-soft: #12312f;
    --ok: #64d59c; --ok-soft: #122f20; --bad: #ff8f80; --bad-soft: #3a1a16;
    --info: #84b7f6; --info-soft: #14273d; --warn: #efb458; --warn-soft: #32260f;
    --d-anaesthesie: #4fc9c9; --d-intensiv: #9a96f0; --d-notfall: #f08575;
    --d-schmerz: #e6b04e; --d-grundlagen: #9fb0be;
  }
}

* { box-sizing: border-box; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 1rem/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1 { font-size: 1.5rem; line-height: 1.2; margin: 0 0 4px; letter-spacing: -.015em; }
h2 { font-size: 1.05rem; margin: 0 0 10px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.app { max-width: 680px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
main { flex: 1; padding: calc(18px + env(safe-area-inset-top)) 16px 28px; outline: none; }

/* Navigation unten ---------------------------------------------------------- */
.tabs {
  position: sticky; bottom: 0; display: grid; grid-template-columns: repeat(3, 1fr);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 4px 8px;
  font-size: .72rem; font-weight: 600; color: var(--muted); text-decoration: none;
}
.tabs a.active { color: var(--accent); }
.tabs svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Bausteine ----------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-top: 14px; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--muted); font-size: .86rem; margin-bottom: 14px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; background: var(--muted); }
.dot.anaesthesie { background: var(--d-anaesthesie); } .dot.intensiv { background: var(--d-intensiv); }
.dot.notfall { background: var(--d-notfall); } .dot.schmerz { background: var(--d-schmerz); }
.dot.grundlagen { background: var(--d-grundlagen); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .74rem; font-weight: 650; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.info { background: var(--info-soft); color: var(--info); }
.notice { border-radius: 12px; padding: 11px 14px; margin-top: 14px; font-size: .93rem; }
.notice.info { background: var(--info-soft); color: var(--info); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.btn {
  font: inherit; font-weight: 650; border: 0; border-radius: 12px; padding: 14px 18px; width: 100%;
  background: var(--accent); color: var(--accent-ink); cursor: pointer; margin-top: 16px;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.quiet { background: var(--surface-2); color: var(--text); }
.linkrow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.pill { font-size: .84rem; font-weight: 600; text-decoration: none; padding: 5px 12px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }

/* Frage ---------------------------------------------------------------------- */
.stem { font-size: 1.12rem; line-height: 1.55; white-space: pre-wrap; margin: 0; }
.options { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.opt {
  font: inherit; text-align: left; color: var(--text); width: 100%; cursor: pointer;
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 13px 14px;
}
.opt .letter {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-weight: 700; font-size: .85rem; background: var(--surface-2); color: var(--muted);
}
.opt[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.opt[aria-checked="true"] .letter { background: var(--accent); color: var(--accent-ink); }
.opt.done { cursor: default; }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.right .letter { background: var(--ok); color: var(--surface); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .letter { background: var(--bad); color: var(--surface); }
.opt .why { display: block; font-size: .9rem; color: var(--muted); margin-top: 6px; }
.opt .tag { display: block; font-size: .78rem; font-weight: 700; margin-top: 6px; }
.opt.right .tag { color: var(--ok); } .opt.wrong .tag { color: var(--bad); }

.verdict { border-radius: var(--radius); padding: 14px 16px; margin-top: 18px; font-weight: 650; font-size: 1.05rem; }
.verdict.right { background: var(--ok-soft); color: var(--ok); }
.verdict.wrong { background: var(--bad-soft); color: var(--bad); }
.verdict small { display: block; font-weight: 500; font-size: .88rem; margin-top: 2px; opacity: .9; }
.prose { white-space: pre-wrap; }
.takehome { border-left: 4px solid var(--accent); padding: 4px 0 4px 14px; font-weight: 600; margin: 16px 0 0; }

.source { padding: 14px 0; border-top: 1px solid var(--line); }
.source:first-of-type { border-top: 0; padding-top: 0; }
.source .cite { font-size: .92rem; }
details.evidence { margin-top: 10px; font-size: .9rem; }
details.evidence summary { cursor: pointer; color: var(--accent); font-weight: 600; }
details.evidence ul { margin: 8px 0 0; padding-left: 18px; }
details.evidence li { margin-bottom: 8px; }
details.evidence q { display: block; color: var(--muted); font-style: italic; margin-top: 2px; }

/* Archiv ----------------------------------------------------------------------- */
.list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; text-decoration: none; color: var(--text); }
.item .when { text-align: center; min-width: 44px; }
.item .when b { display: block; font-size: 1.2rem; line-height: 1.1; }
.item .when span { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.item .txt { font-size: .93rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item .sub { font-size: .78rem; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.mark { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .9rem; background: var(--surface-2); color: var(--muted); }
.mark.right { background: var(--ok-soft); color: var(--ok); }
.mark.wrong { background: var(--bad-soft); color: var(--bad); }

/* Statistik ---------------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 10px; text-align: center; }
.stat b { display: block; font-size: 1.7rem; line-height: 1.1; letter-spacing: -.02em; }
.stat span { font-size: .76rem; color: var(--muted); }
.barrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; margin-top: 12px; font-size: .9rem; }
.barrow .bar { grid-column: 1 / -1; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.barrow .bar i { display: block; height: 100%; border-radius: 99px; }

.empty { text-align: center; padding: 56px 12px; color: var(--muted); }
.empty .big { font-size: 2.6rem; line-height: 1; margin-bottom: 10px; }
.foot { margin-top: 26px; font-size: .78rem; color: var(--muted); text-align: center; }
