/* =========================================================
   NottSan · Lernplattform — Stylesheet
   Modern Medical UI · Light + Dark · Mobile-first
   ========================================================= */

/* ---------- Design Tokens (Military / Tactical) ----------
   --red  = Primärfarbe (Feldgrün/Oliv) – Name beibehalten, damit
            bestehende Regeln weiter greifen.
   --crit = Kritisch/Blut (Rot) – nur für Notfall/Blutung.
   --tan  = Coyote/Sand – sekundärer Akzent.
*/
:root {
  --red: #4f5d2f;          /* Oliv-Grün (Primär) */
  --red-dark: #3c4824;
  --red-soft: #eceee0;     /* blasses Oliv */
  --crit: #c0282d;         /* Blutrot – kritisch */
  --crit-soft: #fbe9e9;
  --tan: #8a7a4e;          /* Coyote/Sand */
  --tan-soft: #efe9d9;
  --white: #ffffff;
  --grey: #eceadf;

  --bg: #e6e5da;           /* Sand/Khaki Hintergrund */
  --bg-elev: #f4f3ec;
  --surface: #f7f6ef;
  --surface-2: #edece1;
  --border: #d3d1c0;
  --border-strong: #b9b6a1;

  --text: #20231a;
  --text-soft: #4c5040;
  --text-mut: #7c8068;

  --shadow-sm: 0 1px 2px rgba(30, 32, 20, .10);
  --shadow: 0 3px 10px rgba(30, 32, 20, .12);
  --shadow-md: 0 8px 22px rgba(30, 32, 20, .16);
  --shadow-lg: 0 16px 40px rgba(30, 32, 20, .24);

  --radius-sm: 3px;
  --radius: 5px;
  --radius-lg: 7px;
  --radius-xl: 9px;

  --sidebar-w: 268px;
  --topbar-h: 66px;

  --ease: cubic-bezier(.22, .61, .36, 1);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-head: 'Oswald', 'Inter', sans-serif;
  --font-stencil: 'Black Ops One', 'Oswald', sans-serif;

  /* highlights */
  --hl-yellow: #ffe680;
  --hl-red: #ffb3b3;
  --hl-blue: #acd5ff;
  --hl-green: #b6f0c4;
}

[data-theme="dark"] {
  --red: #6f8043;          /* helleres Oliv für Dunkelmodus */
  --red-dark: #4d5a2e;
  --red-soft: #23271a;
  --crit: #e3494e;
  --crit-soft: #2c1414;
  --tan: #b6a572;
  --tan-soft: #2a2719;

  --bg: #14160f;           /* sehr dunkles Feldgrün/Schwarz */
  --bg-elev: #1b1e14;
  --surface: #1e2117;
  --surface-2: #262a1b;
  --border: #343a26;
  --border-strong: #444b33;

  --text: #e9ead9;
  --text-soft: #b7bba2;
  --text-mut: #868a6e;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow: 0 6px 18px rgba(0, 0, 0, .5);
  --shadow-md: 0 12px 34px rgba(0, 0, 0, .55);
  --shadow-lg: 0 22px 55px rgba(0, 0, 0, .65);

  --hl-yellow: #6b5d12;
  --hl-red: #6e2626;
  --hl-blue: #1e4a73;
  --hl-green: #1f5230;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background-color: var(--bg);
  background-image: repeating-linear-gradient(135deg, rgba(40,45,25,.022) 0 1px, transparent 1px 10px);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
  transition: background .3s var(--ease), color .3s var(--ease);
}
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.15; margin: 0; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img, svg { max-width: 100%; display: block; }
::selection { background: var(--red); color: #fff; }
input, button { font-size: 1rem; }

/* scrollbar */
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 20px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-mut); background-clip: content-box; }

/* ---------- Icons ---------- */
[data-icon] { display: inline-flex; width: 1.25em; height: 1.25em; vertical-align: -.18em; }
[data-icon] svg { width: 100%; height: 100%; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }

.main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  z-index: 60;
  transition: transform .35s var(--ease);
}
.sidebar__brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; }
.brand__logo { display: grid; place-items: center; filter: drop-shadow(0 6px 12px rgba(214,40,40,.3)); }
.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand__name { font-family: var(--font-stencil); font-weight: 400; font-size: 1.2rem; letter-spacing: .03em; text-transform: uppercase; }
.brand__sub { font-size: .72rem; color: var(--text-mut); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }

.sidebar__nav { display: flex; flex-direction: column; gap: 4px; }
.navlink {
  display: flex; align-items: center; gap: 13px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-weight: 600; font-size: .94rem;
  position: relative;
  transition: background .2s var(--ease), color .2s var(--ease), transform .15s var(--ease);
}
.navlink__icon { width: 1.3em; height: 1.3em; display: inline-flex; color: var(--text-mut); transition: color .2s; }
.navlink:hover { background: var(--surface-2); color: var(--text); transform: translateX(2px); }
.navlink:hover .navlink__icon { color: var(--red); }
.navlink.is-active { background: var(--red-soft); color: var(--red); }
.navlink.is-active .navlink__icon { color: var(--red); }
.navlink.is-active::before {
  content: ""; position: absolute; left: -16px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 22px; background: var(--red); border-radius: 0 4px 4px 0;
}
.navlink__badge {
  margin-left: auto; background: var(--red); color: #fff;
  font-size: .72rem; font-weight: 700; min-width: 20px; height: 20px;
  display: grid; place-items: center; border-radius: 20px; padding: 0 6px;
}
.navlink__badge[hidden] { display: none; }

.sidebar__footer { margin-top: auto; padding-top: 16px; }
.disclaimer {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  font-size: .76rem; color: var(--text-mut);
}
.disclaimer [data-icon] { color: var(--red); flex: 0 0 auto; margin-top: 1px; }
.disclaimer p { margin: 0; }

.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(10,12,18,.5);
  backdrop-filter: blur(2px); z-index: 55; opacity: 0; pointer-events: none;
  transition: opacity .3s var(--ease);
}
.sidebar-overlay.is-open { opacity: 1; pointer-events: auto; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 clamp(16px, 3vw, 32px);
  background: color-mix(in srgb, var(--bg-elev) 86%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar__menu { display: none; }

.topbar__search { position: relative; flex: 1; max-width: 640px; }
.topbar__search-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-mut); pointer-events: none; }
.topbar__search-input {
  width: 100%; height: 46px;
  padding: 0 46px 0 46px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.topbar__search-input::placeholder { color: var(--text-mut); }
.topbar__search-input:focus {
  border-color: var(--red);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--red-soft);
}
.topbar__kbd {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  font-family: var(--font); font-size: .75rem; color: var(--text-mut);
  border: 1px solid var(--border-strong); border-radius: 6px; padding: 1px 7px; background: var(--surface);
}
.topbar__actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.iconbtn {
  width: 44px; height: 44px; border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  display: grid; place-items: center; font-size: 1.15rem;
  transition: background .2s, color .2s, transform .15s, border-color .2s;
}
.iconbtn:hover { background: var(--surface-2); color: var(--red); transform: translateY(-1px); border-color: var(--border-strong); }
.iconbtn:active { transform: translateY(0) scale(.96); }
#emergencyBtn { color: var(--crit); }
#emergencyBtn:hover { color: var(--crit); border-color: var(--crit); }

.theme-toggle { position: relative; overflow: hidden; }
.theme-toggle__sun, .theme-toggle__moon { position: absolute; transition: transform .4s var(--ease), opacity .3s; }
[data-theme="light"] .theme-toggle__moon { transform: translateY(140%); opacity: 0; }
[data-theme="light"] .theme-toggle__sun { transform: translateY(0); opacity: 1; }
[data-theme="dark"] .theme-toggle__sun { transform: translateY(-140%); opacity: 0; }
[data-theme="dark"] .theme-toggle__moon { transform: translateY(0); opacity: 1; }

/* ---------- Suggestions ---------- */
.suggestions {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 6px; z-index: 50; max-height: 64vh; overflow: auto;
  animation: pop .18s var(--ease);
}
.suggestion {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px; cursor: pointer;
  transition: background .15s;
}
.suggestion:hover, .suggestion.is-active { background: var(--surface-2); }
.suggestion__icon {
  width: 36px; height: 36px; border-radius: 10px; flex: 0 0 auto;
  display: grid; place-items: center; background: var(--red-soft); color: var(--red);
}
.suggestion__txt { min-width: 0; }
.suggestion__title { font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggestion__meta { font-size: .76rem; color: var(--text-mut); }
.suggestion__cat { margin-left: auto; font-size: .72rem; color: var(--text-mut); white-space: nowrap; }
.suggestion__empty { padding: 18px; text-align: center; color: var(--text-mut); font-size: .9rem; }
.suggestion mark { background: transparent; color: var(--red); font-weight: 700; }

/* ---------- View ---------- */
.view {
  flex: 1;
  padding: clamp(20px, 3vw, 38px) clamp(16px, 3vw, 40px);
  max-width: 1180px; width: 100%; margin: 0 auto;
  animation: fadeUp .4s var(--ease);
  outline: none;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }

.section { margin-bottom: 40px; }
.section__head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.section__head h2 { font-size: 1.3rem; position: relative; padding-left: 14px; }
.section__head h2::before { content: ""; position: absolute; left: 0; top: .12em; bottom: .12em; width: 5px; background: var(--red); }
.section__head .muted { color: var(--text-mut); font-size: .88rem; }
.section__link { margin-left: auto; color: var(--red); font-weight: 600; font-size: .88rem; }
.section__link:hover { text-decoration: underline; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(0,0,0,.25);
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(255,255,255,.12), transparent 55%),
    linear-gradient(135deg, #2f3a1c 0%, #4f5d2f 55%, #6b7a3f 100%);
  color: #f3f4e7; padding: clamp(28px, 5vw, 54px);
  margin-bottom: 34px; box-shadow: var(--shadow-md);
}
/* Warn-/Gefahrenstreifen oben (taktischer Look) */
.hero::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; z-index: 2;
  background: repeating-linear-gradient(45deg, var(--crit) 0 14px, #1b1f12 14px 28px);
  opacity: .9;
}
.hero::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(255,255,255,.16), transparent 70%);
  border-radius: 50%;
}
.hero__pulse { position: absolute; right: clamp(10px, 6vw, 60px); bottom: -10px; width: 260px; opacity: .25; pointer-events: none; }
.hero__eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: rgba(255,255,255,.18); padding: 6px 13px; border-radius: 999px; }
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.7rem); margin: 16px 0 10px; max-width: 18ch; }
.hero p { max-width: 52ch; opacity: .95; font-size: clamp(.95rem, 2vw, 1.08rem); }

.hero__search { position: relative; max-width: 580px; margin-top: 24px; }
.hero__search input {
  width: 100%; height: 58px; border: none; border-radius: var(--radius);
  padding: 0 130px 0 56px; font-size: 1.02rem; color: var(--text); background: #fff;
  box-shadow: var(--shadow-md); outline: none;
}
.hero__search .topbar__search-icon { color: var(--red); left: 20px; font-size: 1.2rem; }
.hero__search button {
  position: absolute; right: 7px; top: 7px; height: 44px; padding: 0 22px;
  border: none; border-radius: var(--radius-sm); background: var(--red); color: #fff;
  font-family: var(--font-head); font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  transition: background .2s, transform .15s;
}
.hero__search button:hover { background: var(--red-dark); transform: translateX(2px); }

.hero__chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.hero__chip { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.25); color: #fff; padding: 6px 13px; border-radius: 999px; font-size: .82rem; font-weight: 600; transition: background .2s, transform .15s; }
.hero__chip:hover { background: rgba(255,255,255,.3); transform: translateY(-1px); }

/* ---------- Quick access ---------- */
.quickgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.quick {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease), box-shadow .2s, border-color .2s;
}
.quick:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--red); }
.quick__icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; color: #fff; font-size: 1.3rem; flex: 0 0 auto; }
.quick__t { font-weight: 700; font-size: .98rem; }
.quick__s { font-size: .8rem; color: var(--text-mut); }

/* ---------- Category grid ---------- */
.catgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.catcard {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow-sm);
  transition: transform .25s var(--ease), box-shadow .25s, border-color .25s;
}
.catcard:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: transparent; }
.catcard__icon { width: 54px; height: 54px; border-radius: 15px; display: grid; place-items: center; color: #fff; font-size: 1.6rem; margin-bottom: 14px; transition: transform .25s var(--ease); }
.catcard:hover .catcard__icon { transform: scale(1.08) rotate(-4deg); }
.catcard h3 { font-size: 1.1rem; }
.catcard p { color: var(--text-mut); font-size: .85rem; margin: 6px 0 0; }
.catcard__count { position: absolute; top: 18px; right: 18px; font-size: .76rem; font-weight: 700; color: var(--text-mut); background: var(--surface-2); border: 1px solid var(--border); padding: 3px 10px; border-radius: 999px; }
.catcard__bar { height: 4px; border-radius: 4px; margin-top: 16px; background: var(--surface-2); overflow: hidden; }
.catcard__bar > i { display: block; height: 100%; border-radius: 4px; transform-origin: left; transition: width .6s var(--ease); }

/* ---------- Article cards (lists) ---------- */
.cardgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.acard {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
  transition: transform .22s var(--ease), box-shadow .22s, border-color .22s;
}
.acard:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--red); }
.acard__top { display: flex; align-items: center; gap: 12px; padding: 16px 16px 0; }
.acard__icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-size: 1.25rem; flex: 0 0 auto; }
.acard__cat { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-mut); }
.acard__body { padding: 12px 16px 16px; flex: 1; display: flex; flex-direction: column; }
.acard__title { font-size: 1.05rem; font-weight: 700; }
.acard__desc { font-size: .85rem; color: var(--text-soft); margin: 6px 0 12px; flex: 1; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.acard__foot { display: flex; align-items: center; gap: 10px; }
.acard__tag { font-size: .72rem; color: var(--text-mut); background: var(--surface-2); border: 1px solid var(--border); padding: 3px 9px; border-radius: 999px; }
.acard__fav { margin-left: auto; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text-mut); display: grid; place-items: center; transition: all .18s; }
.acard__fav:hover { color: #f5a623; border-color: #f5a623; }
.acard__fav.is-fav { color: #f5a623; background: #fff7e6; border-color: #f5d089; }
[data-theme="dark"] .acard__fav.is-fav { background: #3a2f12; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 20px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-family: var(--font-head); font-weight: 600; font-size: .92rem;
  text-transform: uppercase; letter-spacing: .04em;
  transition: transform .15s, background .2s, box-shadow .2s, border-color .2s;
}
.btn:active { transform: scale(.97); }
.btn--primary { background: var(--red); color: #fff; box-shadow: 0 5px 14px rgba(79,93,47,.32); }
.btn--primary:hover { background: var(--red-dark); transform: translateY(-2px); box-shadow: 0 9px 20px rgba(79,93,47,.4); }
.btn--ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn--ghost:hover { border-color: var(--red); color: var(--red); }
.btn--block { width: 100%; justify-content: center; }
.btn--sm { padding: 8px 14px; font-size: .85rem; }

/* ---------- Article view ---------- */
.article { display: grid; grid-template-columns: 1fr 250px; gap: 34px; align-items: start; }
.article__main { min-width: 0; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--text-mut); margin-bottom: 16px; flex-wrap: wrap; }
.crumbs a:hover { color: var(--red); }
.crumbs span[data-icon] { font-size: .8rem; }

.article__header { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 8px; }
.article__badge { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; color: #fff; font-size: 1.9rem; flex: 0 0 auto; box-shadow: var(--shadow); }
.article__title { font-size: clamp(1.5rem, 4vw, 2.1rem); }
.article__sub { color: var(--text-soft); margin-top: 6px; font-size: 1rem; }
.article__actions { display: flex; gap: 10px; margin: 20px 0 28px; flex-wrap: wrap; }

.abox {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: clamp(18px, 3vw, 26px);
  margin-bottom: 18px; box-shadow: var(--shadow-sm);
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}
.abox__head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.abox__ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: 0 0 auto; background: var(--red-soft); color: var(--red); font-size: 1.05rem; }
.abox__head h3 { font-size: 1.15rem; }
.abox__content { color: var(--text); }
.abox__content p { margin: 0 0 12px; }
.abox__content p:last-child { margin-bottom: 0; }
.abox__content ul { margin: 0 0 12px; padding-left: 6px; list-style: none; }
.abox__content ul li { position: relative; padding-left: 26px; margin-bottom: 9px; }
.abox__content ul li::before {
  content: ""; position: absolute; left: 6px; top: .62em; width: 7px; height: 7px;
  background: var(--red); border-radius: 50%;
}
.abox__content ol { margin: 0 0 12px; padding-left: 22px; }
.abox__content ol li { margin-bottom: 9px; }
.abox__content strong { color: var(--text); font-weight: 700; }
.abox__content em { color: var(--text-soft); }
.xref { color: var(--red); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1.5px; }
.xref:hover { color: var(--red-dark); }

/* color-accented boxes */
.abox--firstaid { border-color: color-mix(in srgb, var(--crit) 40%, var(--border)); background: linear-gradient(180deg, var(--crit-soft), var(--surface) 60%); border-left: 4px solid var(--crit); }
.abox--firstaid .abox__ic { background: var(--crit); color: #fff; }
.abox--merke { border-left: 4px solid #2bb673; }
.abox--merke .abox__ic { background: #e2f7ec; color: #1e9e63; }
[data-theme="dark"] .abox--merke .abox__ic { background: #173a28; color: #45d18c; }
.abox--summary { background: var(--surface-2); }

/* "why" callouts inside content */
.why {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--surface-2); border-left: 3px solid var(--red);
  border-radius: 10px; padding: 12px 14px; margin: 4px 0 14px; font-size: .92rem;
}
.why [data-icon] { color: var(--red); margin-top: 2px; flex: 0 0 auto; }
.why b { color: var(--red); }

/* medication table */
.medtable { display: flex; flex-direction: column; gap: 10px; }
.med {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; background: var(--surface-2);
}
.med__name { font-weight: 700; color: var(--red); display: flex; align-items: center; gap: 8px; }
.med__name .pill { margin-left: auto; }
.med__why { font-size: .9rem; color: var(--text-soft); margin-top: 4px; }

.pill { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 3px 9px; border-radius: 999px; background: var(--red-soft); color: var(--red); }

/* tags / chips list */
.taglist { display: flex; flex-wrap: wrap; gap: 8px; }
.tagpill { font-size: .82rem; background: var(--surface-2); border: 1px solid var(--border); padding: 6px 12px; border-radius: 999px; color: var(--text-soft); }

/* TOC / aside */
.article__aside { position: sticky; top: calc(var(--topbar-h) + 20px); }
.toc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); }
.toc h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-mut); margin-bottom: 10px; }
.toc a { display: block; padding: 7px 10px; border-radius: 8px; font-size: .85rem; color: var(--text-soft); transition: background .15s, color .15s; }
.toc a:hover, .toc a.is-active { background: var(--red-soft); color: var(--red); }

.hint-hl {
  margin-top: 14px; background: var(--surface); border: 1px dashed var(--border-strong);
  border-radius: var(--radius); padding: 14px; font-size: .82rem; color: var(--text-mut);
}
.hint-hl b { color: var(--text); }
.hl-legend { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.hl-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: .76rem; }
.hl-dot { width: 13px; height: 13px; border-radius: 4px; }

/* ---------- Highlight marks ---------- */
.uhl { border-radius: 3px; padding: 0 1px; box-decoration-break: clone; -webkit-box-decoration-break: clone; cursor: pointer; }
.uhl-yellow { background: var(--hl-yellow); }
.uhl-red { background: var(--hl-red); }
.uhl-blue { background: var(--hl-blue); }
.uhl-green { background: var(--hl-green); }

/* ---------- Highlight toolbar ---------- */
.hl-toolbar {
  position: absolute; z-index: 80;
  display: flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 8px; box-shadow: var(--shadow-lg);
  animation: pop .15s var(--ease);
}
.hl-toolbar[hidden] { display: none; }
.hl-swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(0,0,0,.08); display: grid; place-items: center; transition: transform .15s; }
.hl-swatch:hover { transform: scale(1.18); }
.hl-yellow { background: var(--hl-yellow); }
.hl-red { background: var(--hl-red); }
.hl-blue { background: var(--hl-blue); }
.hl-green { background: var(--hl-green); }
.hl-clear { background: var(--surface-2); color: var(--text-mut); border-color: var(--border); }
.hl-sep { width: 1px; height: 20px; background: var(--border); }

/* ---------- Tests / Quiz ---------- */
.quizhero {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: clamp(20px, 4vw, 32px); margin-bottom: 28px; box-shadow: var(--shadow-sm);
  display: flex; gap: 24px; align-items: center; flex-wrap: wrap;
}
.quizhero__txt { flex: 1; min-width: 240px; }
.quizhero h1 { font-size: clamp(1.4rem, 3vw, 2rem); margin-bottom: 8px; }
.quizhero p { color: var(--text-soft); }
.quizstats { display: flex; gap: 14px; flex-wrap: wrap; }
.qstat { text-align: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; min-width: 92px; }
.qstat__num { font-family: var(--font-head); font-size: 1.6rem; font-weight: 800; color: var(--red); }
.qstat__lbl { font-size: .74rem; color: var(--text-mut); text-transform: uppercase; letter-spacing: .04em; }

.testgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.testcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 22px; box-shadow: var(--shadow-sm); cursor: pointer;
  transition: transform .22s var(--ease), box-shadow .22s, border-color .22s;
}
.testcard:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--red); }
.testcard__ic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; color: #fff; font-size: 1.5rem; margin-bottom: 14px; }
.testcard h3 { font-size: 1.12rem; }
.testcard p { color: var(--text-mut); font-size: .84rem; margin: 6px 0 14px; }
.testcard__meta { display: flex; align-items: center; justify-content: space-between; font-size: .8rem; color: var(--text-soft); }
.testcard__best { font-weight: 700; color: var(--red); }

/* quiz runner */
.quizrun { max-width: 720px; margin: 0 auto; }
.quizbar { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.quizbar__progress { flex: 1; height: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.quizbar__progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--red), #ff6b4a); border-radius: 999px; transition: width .4s var(--ease); }
.quizbar__count { font-weight: 700; font-size: .9rem; color: var(--text-soft); white-space: nowrap; }
.quizbar__streak { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; color: #f5a623; font-size: .9rem; }

.qcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: clamp(20px, 4vw, 30px); box-shadow: var(--shadow); animation: fadeUp .3s var(--ease); }
.qcard__cat { display: inline-block; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--red); background: var(--red-soft); padding: 4px 11px; border-radius: 999px; margin-bottom: 14px; }
.qcard__q { font-size: clamp(1.15rem, 3vw, 1.45rem); font-family: var(--font-head); font-weight: 700; margin-bottom: 20px; line-height: 1.35; }
.answers { display: flex; flex-direction: column; gap: 11px; }
.answer {
  display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 15px 18px; border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-weight: 500; font-size: .98rem;
  transition: border-color .18s, background .18s, transform .12s;
}
.answer:hover:not(:disabled) { border-color: var(--red); transform: translateX(3px); }
.answer:disabled { cursor: default; }
.answer__key { width: 32px; height: 32px; flex: 0 0 auto; border-radius: 9px; display: grid; place-items: center; font-weight: 800; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-soft); transition: all .18s; }
.answer.correct { border-color: #1e9e63; background: #e7f8ef; color: #0d6b41; }
.answer.correct .answer__key { background: #1e9e63; color: #fff; border-color: #1e9e63; }
.answer.wrong { border-color: var(--crit); background: var(--crit-soft); color: var(--crit); }
.answer.wrong .answer__key { background: var(--crit); color: #fff; border-color: var(--crit); }
[data-theme="dark"] .answer.correct { background: #12321f; color: #6ee0a3; }
[data-theme="dark"] .answer.wrong { background: #321416; }

.qexplain {
  margin-top: 18px; border-radius: var(--radius); padding: 16px 18px;
  background: var(--surface-2); border: 1px solid var(--border);
  animation: fadeUp .3s var(--ease); font-size: .92rem;
}
.qexplain__head { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 6px; }
.qexplain.ok .qexplain__head { color: #1e9e63; }
.qexplain.no .qexplain__head { color: var(--crit); }
.qfooter { display: flex; justify-content: flex-end; margin-top: 18px; }

/* quiz result */
.qresult { max-width: 560px; margin: 0 auto; text-align: center; }
.qresult__ring { position: relative; width: 200px; height: 200px; margin: 0 auto 22px; }
.qresult__ring svg { transform: rotate(-90deg); }
.qresult__ring .ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 16; }
.qresult__ring .ring-fg { fill: none; stroke: var(--red); stroke-width: 16; stroke-linecap: round; transition: stroke-dashoffset 1s var(--ease); }
.qresult__pct { position: absolute; inset: 0; display: grid; place-items: center; flex-direction: column; }
.qresult__pct b { font-family: var(--font-head); font-size: 2.6rem; font-weight: 800; }
.qresult__pct span { font-size: .8rem; color: var(--text-mut); }
.qresult__msg { font-size: 1.2rem; font-weight: 700; margin-bottom: 6px; }
.qresult__grid { display: flex; gap: 12px; justify-content: center; margin: 22px 0; flex-wrap: wrap; }
.qresult__actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- Dashboard ---------- */
.dashgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow-sm); }
.panel__head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.panel__head h3 { font-size: 1.08rem; }
.panel__head [data-icon] { color: var(--red); }
.panel__head .section__link { margin-left: auto; }

.statbig { display: flex; align-items: baseline; gap: 8px; }
.statbig b { font-family: var(--font-head); font-size: 2.2rem; font-weight: 800; color: var(--red); }
.statbig span { color: var(--text-mut); font-size: .85rem; }

.progress-row { margin-bottom: 14px; }
.progress-row:last-child { margin-bottom: 0; }
.progress-row__top { display: flex; justify-content: space-between; font-size: .85rem; margin-bottom: 6px; }
.progress-row__top b { font-weight: 600; }
.progress-row__top span { color: var(--text-mut); }
.bar { height: 9px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--red), #ff6b4a); transition: width .8s var(--ease); }

.minilist { display: flex; flex-direction: column; gap: 4px; }
.minirow { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; transition: background .15s; }
.minirow:hover { background: var(--surface-2); }
.minirow__ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; flex: 0 0 auto; font-size: 1.05rem; }
.minirow__t { font-weight: 600; font-size: .9rem; }
.minirow__s { font-size: .76rem; color: var(--text-mut); }
.minirow__act { margin-left: auto; color: var(--text-mut); }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: clamp(34px, 6vw, 64px) 20px; color: var(--text-mut); }
.empty__ic { width: 80px; height: 80px; border-radius: 24px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; margin: 0 auto 18px; font-size: 2rem; color: var(--text-mut); }
.empty h3 { color: var(--text); margin-bottom: 8px; }
.empty p { max-width: 38ch; margin: 0 auto 18px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg-elev);
  padding: 13px 20px; border-radius: 999px; font-weight: 600; font-size: .9rem;
  box-shadow: var(--shadow-lg); z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s var(--ease);
  display: flex; align-items: center; gap: 9px; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast [data-icon] { color: var(--red); }
[data-theme="dark"] .toast { background: var(--surface); color: var(--text); border: 1px solid var(--border); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(8,10,16,.55); backdrop-filter: blur(3px); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal__card {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: clamp(22px, 4vw, 32px); max-width: 560px; width: 100%;
  box-shadow: var(--shadow-lg); max-height: 86vh; overflow: auto; animation: pop .25s var(--ease);
}
.modal__close { position: absolute; top: 16px; right: 16px; }
.modal__title { display: flex; align-items: center; gap: 10px; font-size: 1.35rem; margin-bottom: 18px; }
.modal__title [data-icon] { color: var(--red); }
.modal__body .step { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.modal__body .step:last-child { border-bottom: none; }
.modal__body .step b { display: block; }
.modal__body .step__k { width: 36px; height: 36px; flex: 0 0 auto; border-radius: var(--radius-sm); background: var(--crit); color: #fff; font-weight: 600; display: grid; place-items: center; font-family: var(--font-stencil); font-size: 1.05rem; }
.modal__body .step__d { font-size: .9rem; color: var(--text-soft); }

/* ---------- Footer ---------- */
.appfooter {
  margin-top: auto; padding: 20px clamp(16px, 3vw, 40px);
  border-top: 1px solid var(--border); color: var(--text-mut); font-size: .82rem;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}

/* ---------- Search results page ---------- */
.searchhead { margin-bottom: 22px; }
.searchhead h1 { font-size: clamp(1.3rem, 3vw, 1.8rem); }
.searchhead p { color: var(--text-mut); }
.searchhead .pillrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ---------- Figuren / Diagramme ---------- */
.figure {
  margin: 4px 0 16px; padding: 16px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
}
.figure svg { width: 100%; height: auto; max-width: 460px; margin: 0 auto; display: block; }
.figure figcaption { margin-top: 10px; font-size: .82rem; color: var(--text-mut); text-align: center; line-height: 1.45; }
.figure figcaption strong { color: var(--text); }

/* ---------- Szenario-Simulator ---------- */
.scenario-brief {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--surface-2); border: 1px solid var(--border); border-left: 4px solid var(--red);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px; font-size: .92rem; color: var(--text-soft);
}
.scenario-brief [data-icon] { color: var(--red); flex: 0 0 auto; margin-top: 2px; }
.answer.is-selected { border-color: var(--red); background: var(--red-soft); }
.answer.is-selected .answer__key { background: var(--red); color: #fff; border-color: var(--red); }

/* ---------- Klausur ---------- */
.exam-rules { margin: 0 0 18px; padding-left: 6px; list-style: none; }
.exam-rules li { position: relative; padding-left: 24px; margin-bottom: 8px; color: var(--text-soft); }
.exam-rules li::before { content: ""; position: absolute; left: 4px; top: .55em; width: 7px; height: 7px; background: var(--red); border-radius: 50%; }
.exam-clock {
  font-family: var(--font-head); font-weight: 600; font-size: 1.05rem;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 4px 12px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
}
.exam-clock.is-low { color: #fff; background: var(--crit); border-color: var(--crit); animation: pulseClock 1s steps(2) infinite; }
@keyframes pulseClock { 50% { opacity: .55; } }

.exam-result { max-width: 800px; margin: 0 auto; }
.exam-verdict { display: flex; align-items: center; gap: 18px; padding: 22px; border-radius: var(--radius-lg); color: #fff; }
.exam-verdict.pass { background: linear-gradient(135deg, #1e7e4f, #2bb673); }
.exam-verdict.fail { background: linear-gradient(135deg, #8e1f23, var(--crit)); }
.exam-verdict__badge { width: 64px; height: 64px; flex: 0 0 auto; border-radius: 50%; background: rgba(255,255,255,.18); display: grid; place-items: center; font-size: 1.9rem; }
.exam-verdict h1 { font-size: clamp(1.5rem, 4vw, 2.1rem); }
.exam-verdict p { opacity: .95; margin-top: 4px; }

.reviewlist { display: flex; flex-direction: column; gap: 12px; }
.reviewq { border: 1px solid var(--border); border-left: 4px solid var(--border-strong); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); }
.reviewq.ok { border-left-color: #1e9e63; }
.reviewq.no { border-left-color: var(--crit); }
.reviewq__head { font-weight: 600; margin-bottom: 8px; }
.reviewq.ok .reviewq__head [data-icon] { color: #1e9e63; }
.reviewq.no .reviewq__head [data-icon] { color: var(--crit); }
.reviewq__row { font-size: .9rem; color: var(--text-soft); margin-bottom: 3px; }
.reviewq__expl { font-size: .86rem; color: var(--text-mut); margin-top: 6px; background: var(--surface-2); border-radius: 8px; padding: 8px 10px; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .article { grid-template-columns: 1fr; }
  .article__aside { position: static; }
  .toc { display: none; }
}
@media (max-width: 880px) {
  :root { --sidebar-w: 256px; }
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); padding-top: max(20px, env(safe-area-inset-top)); }
  .sidebar.is-open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  .topbar__menu { display: grid; }
  .topbar__kbd { display: none; }
  .topbar__search-input { height: 44px; }
  .quizhero { gap: 16px; }
}

/* Touch-Geräte: keine Hover-Verschiebungen, größere Tap-Ziele */
@media (hover: none) {
  .navlink:hover, .acard:hover, .catcard:hover, .testcard:hover, .quick:hover, .answer:hover:not(:disabled) { transform: none; }
  .answer { padding: 16px 16px; }
  .navlink { padding: 13px 14px; }
}

@media (max-width: 620px) {
  .view { padding: 18px 14px calc(18px + env(safe-area-inset-bottom)); }
  .topbar { gap: 8px; padding: 0 12px; height: 60px; }
  :root { --topbar-h: 60px; }
  .iconbtn { width: 42px; height: 42px; }
  .hero { padding: 24px 18px; }
  .hero h1 { font-size: 1.6rem; }
  .hero__search input { height: 52px; padding-right: 56px; }
  .hero__search button { padding: 0 14px; font-size: 0; }
  .hero__search button::before { content: "›"; font-size: 1.4rem; }
  .cardgrid, .catgrid, .testgrid { grid-template-columns: 1fr; }
  .quickgrid { grid-template-columns: 1fr 1fr; }
  .article__header { gap: 12px; }
  .article__badge { width: 52px; height: 52px; font-size: 1.5rem; }
  .article__actions { gap: 8px; }
  .article__actions .btn span:not([data-icon]) { display: none; }
  .article__actions .btn { padding: 11px 14px; }
  .quizbar { flex-wrap: wrap; }
  .exam-verdict { flex-direction: column; text-align: center; }
  .appfooter { flex-direction: column; gap: 4px; text-align: center; }
  .qresult__grid .qstat { min-width: 76px; padding: 10px 12px; }
  .modal { padding: 12px; }
  .suggestions { max-height: 56vh; }
}

@media (max-width: 380px) {
  .quickgrid { grid-template-columns: 1fr; }
  .quizstats, .qresult__grid { width: 100%; }
}

/* ---------- Druck (Klausur-Ergebnis) ---------- */
@media print {
  .sidebar, .sidebar-overlay, .topbar, .appfooter, .hl-toolbar, .toast,
  .qresult__actions, #examPrint, #examRetry, .exam-result .qresult__actions { display: none !important; }
  .main { margin-left: 0 !important; }
  body { background: #fff !important; color: #000 !important; }
  .view { max-width: 100%; padding: 0; }
  .reviewq, .exam-verdict, .panel { break-inside: avoid; box-shadow: none; }
  .exam-verdict { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a[href]::after { content: ""; }
}

/* reduce motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto; }
}
