/* ==========================================================================
   EKG lernen — Designsystem
   ========================================================================== */

:root {
  --bg:        #eef3fa;
  --bg-deep:   #dde6f3;
  --card:      #ffffff;
  --ink:       #14243f;
  --muted:     #64769a;
  --line:      #dfe7f3;
  --line-soft: #edf2f9;

  --brand:     #12b3a6;
  --brand-dk:  #0a8d83;
  --brand-lt:  #e2f7f5;
  --heart:     #ff4d6d;
  --heart-dk:  #d92e50;
  --heart-lt:  #ffe8ec;
  --gold:      #ffb703;
  --gold-dk:   #d99400;
  --violet:    #7c5cff;
  --violet-dk: #5c3fd4;
  --violet-lt: #eee9ff;
  --ok:        #35c759;
  --ok-dk:     #23a344;
  --ok-lt:     #e4f9e9;
  --bad:       #ff4b4b;
  --bad-dk:    #d63333;
  --bad-lt:    #ffe9e9;
  --blue:      #2f8fff;
  --blue-dk:   #1c6fd4;

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 30px;

  --shadow-sm: 0 2px 8px rgba(20,36,63,.06);
  --shadow-md: 0 6px 22px rgba(20,36,63,.09);
  --shadow-lg: 0 18px 48px rgba(20,36,63,.16);

  --font: 'Nunito', ui-rounded, 'SF Pro Rounded', system-ui, -apple-system,
          'Segoe UI', Roboto, sans-serif;

  --top-h: 62px;
  --nav-h: 68px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

body {
  min-height: 100dvh;
  background-image:
    radial-gradient(1100px 520px at 12% -8%, #ffffff 0%, rgba(255,255,255,0) 62%),
    radial-gradient(900px 460px at 96% 4%, #e6fbf8 0%, rgba(230,251,248,0) 60%);
  background-attachment: fixed;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.18; font-weight: 800; letter-spacing: -.015em; }
p { margin: 0; line-height: 1.62; }
button { font-family: inherit; }
a { color: var(--brand-dk); }

::selection { background: var(--violet); color: #fff; }

/* --------------------------------------------------------------- Buttons */

.btn {
  --b: var(--brand);
  --bd: var(--brand-dk);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 14px 24px 15px;
  border: 0; border-radius: var(--r-md);
  background: var(--b);
  box-shadow: 0 4px 0 var(--bd);
  color: #fff;
  font-size: 15px; font-weight: 800;
  letter-spacing: .035em; text-transform: uppercase;
  cursor: pointer;
  transition: transform .07s ease, box-shadow .07s ease, filter .15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover:not(:disabled) { filter: brightness(1.05); }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 0 0 var(--bd); }
.btn:disabled { background: #d3dcea; box-shadow: 0 4px 0 #bfcadd; color: #8b9ab4; cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; }

.btn.gray  { --b: #e7edf6; --bd: #cdd8e8; color: var(--muted); }
.btn.ok    { --b: var(--ok);    --bd: var(--ok-dk); }
.btn.bad   { --b: var(--bad);   --bd: var(--bad-dk); }
.btn.violet{ --b: var(--violet);--bd: var(--violet-dk); }
.btn.heart { --b: var(--heart); --bd: var(--heart-dk); }
.btn.gold  { --b: var(--gold);  --bd: var(--gold-dk); }
.btn.wide  { width: 100%; }
.btn.sm    { padding: 9px 16px 10px; font-size: 12.5px; border-radius: 12px; box-shadow: 0 3px 0 var(--bd); }
.btn.sm:active:not(:disabled) { transform: translateY(3px); }

.btn-ghost {
  border: 2px solid var(--line); background: var(--card); color: var(--muted);
  border-radius: 12px; padding: 8px 14px; font-weight: 800; font-size: 13px; cursor: pointer;
  transition: .15s;
}
.btn-ghost:hover { border-color: var(--brand); color: var(--brand-dk); }

/* ----------------------------------------------------------- App-Gerüst */

.app { max-width: 980px; margin: 0 auto; padding: 0 16px; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--top-h);
  display: flex; align-items: center; gap: 14px;
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(14px) saturate(1.5);
  border-bottom: 2px solid var(--line);
}
.topbar-in { max-width: 980px; margin: 0 auto; padding: 0 16px; width: 100%;
             display: flex; align-items: center; gap: 12px; }

.brand { display: flex; align-items: center; gap: 9px; font-weight: 900; font-size: 17px;
         letter-spacing: -.02em; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px; flex: 0 0 34px;
  background: linear-gradient(150deg, var(--heart), #ff7d94);
  display: grid; place-items: center; box-shadow: 0 3px 0 var(--heart-dk);
}
.brand-mark svg { width: 21px; height: 21px; }

.stat {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 900; font-size: 14.5px; color: var(--ink);
  padding: 6px 11px; border-radius: 999px; background: var(--line-soft);
}
.stat .ic { font-size: 15px; line-height: 1; }
.stat.gold { color: var(--gold-dk); background: #fff4d9; }
.stat.fire { color: #e8590c; background: #ffeadb; }
.stat.hearts { color: var(--heart-dk); background: var(--heart-lt); }

.iconbtn {
  width: 36px; height: 36px; border-radius: 11px; border: 2px solid var(--line);
  background: var(--card); cursor: pointer; display: grid; place-items: center;
  font-size: 16px; transition: .15s; padding: 0; color: var(--muted);
}
.iconbtn:hover { border-color: var(--brand); }

/* Untere Navigation */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  height: var(--nav-h);
  background: rgba(255,255,255,.93);
  backdrop-filter: blur(14px) saturate(1.5);
  border-top: 2px solid var(--line);
  display: flex; align-items: stretch; justify-content: center;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-in { max-width: 560px; width: 100%; display: flex; }
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; text-decoration: none; color: var(--muted); font-size: 10.5px; font-weight: 800;
  letter-spacing: .03em; text-transform: uppercase; border-top: 3px solid transparent;
  transition: .15s; -webkit-tap-highlight-color: transparent;
}
.nav a .ni { font-size: 21px; line-height: 1; }
.nav a.on { color: var(--brand-dk); border-top-color: var(--brand); background: var(--brand-lt); }

main { padding: 22px 0 calc(var(--nav-h) + 34px); }

/* ------------------------------------------------------------- Bausteine */

.card {
  background: var(--card); border: 2px solid var(--line);
  border-radius: var(--r-lg); padding: 20px;
  box-shadow: var(--shadow-sm);
}

.hero {
  background: linear-gradient(140deg, #0f2338 0%, #16324e 55%, #123a44 100%);
  border-radius: var(--r-xl); padding: 26px 24px; color: #fff;
  position: relative; overflow: hidden; margin-bottom: 22px;
  box-shadow: var(--shadow-md);
}
.hero::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(600px 280px at 88% -20%, rgba(62,245,143,.22), transparent 65%);
  pointer-events: none;
}
.hero h1 { font-size: clamp(23px, 5.2vw, 33px); margin-bottom: 8px; }
.hero p { color: #b7cbdd; font-size: 15px; max-width: 54ch; }
.hero-strip { height: 76px; margin-top: 18px; border-radius: 14px; overflow: hidden;
              border: 1px solid rgba(120,180,210,.22); position: relative; z-index: 1; }
.hero-strip canvas { display: block; width: 100%; height: 100%; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; position: relative; z-index: 1; }

.sec-head { display: flex; align-items: baseline; gap: 12px; margin: 30px 4px 14px; }
.sec-head h2 { font-size: 20px; }
.sec-head span { font-size: 13px; color: var(--muted); font-weight: 700; }

/* --------------------------------------------------------- Lernpfad ----- */

.unit {
  border-radius: var(--r-xl); padding: 18px 18px 8px; margin-bottom: 26px;
  background: var(--card); border: 2px solid var(--line); box-shadow: var(--shadow-sm);
}
.unit-head {
  display: flex; align-items: center; gap: 13px; padding: 4px 2px 16px;
}
.unit-badge {
  width: 46px; height: 46px; flex: 0 0 46px; border-radius: 15px;
  display: grid; place-items: center; font-size: 23px;
  background: var(--u-lt, var(--brand-lt)); box-shadow: 0 3px 0 var(--u-dk, var(--brand-dk));
}
.unit-head h3 { font-size: 17px; margin-bottom: 3px; }
.unit-head p { font-size: 13px; color: var(--muted); font-weight: 600; }
.unit-prog { margin-left: auto; text-align: right; font-size: 12px; font-weight: 900; color: var(--muted); }

.path { display: flex; flex-direction: column; align-items: center; gap: 6px; padding-bottom: 26px; }
.path-row { display: flex; align-items: center; gap: 16px; width: 100%; justify-content: center;
            position: relative; }
.path-row[data-side="l"] { transform: translateX(-58px); }
.path-row[data-side="r"] { transform: translateX(58px); }
.path-row[data-side="fl"] { transform: translateX(-30px); }
.path-row[data-side="fr"] { transform: translateX(30px); }

@media (max-width: 460px) {
  .path-row[data-side="l"] { transform: translateX(-40px); }
  .path-row[data-side="r"] { transform: translateX(40px); }
  .path-row[data-side="fl"] { transform: translateX(-20px); }
  .path-row[data-side="fr"] { transform: translateX(20px); }
}

.node {
  position: relative; width: 74px; height: 68px; flex: 0 0 74px;
  border: 0; border-radius: 50% / 46%;
  background: var(--u, var(--brand));
  box-shadow: 0 7px 0 var(--u-dk, var(--brand-dk));
  cursor: pointer; display: grid; place-items: center;
  font-size: 28px; color: #fff;
  transition: transform .08s ease, box-shadow .08s ease;
  -webkit-tap-highlight-color: transparent;
}
.node:hover:not(.locked) { filter: brightness(1.06); }
.node:active:not(.locked) { transform: translateY(6px); box-shadow: 0 1px 0 var(--u-dk, var(--brand-dk)); }
.node.locked { background: #d7e0ee; box-shadow: 0 7px 0 #bfcbdd; color: #97a6bf; cursor: not-allowed; }
.node.done { background: var(--gold); box-shadow: 0 7px 0 var(--gold-dk); }
.node.current::before {
  content: ''; position: absolute; inset: -9px; border-radius: 50% / 46%;
  border: 4px solid var(--u, var(--brand)); opacity: .32;
  animation: pulseRing 1.8s ease-out infinite;
}
@keyframes pulseRing {
  0% { transform: scale(.94); opacity: .45; }
  70% { transform: scale(1.14); opacity: 0; }
  100% { opacity: 0; }
}
.node-label {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  margin-top: 11px; font-size: 11.5px; font-weight: 800; color: var(--muted);
  white-space: nowrap; max-width: 150px; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none;
}
.path-row { margin-bottom: 30px; }
.node-crowns { position: absolute; top: -8px; right: -6px; background: #fff; border-radius: 999px;
               padding: 2px 7px; font-size: 11px; font-weight: 900; color: var(--gold-dk);
               box-shadow: var(--shadow-sm); }

/* --------------------------------------------------------- Lektion ------ */

.lesson-top {
  position: sticky; top: 0; z-index: 40; background: var(--bg);
  padding: 14px 0 12px; display: flex; align-items: center; gap: 13px;
}
.pbar { flex: 1; height: 15px; background: var(--bg-deep); border-radius: 999px; overflow: hidden; }
.pbar i { display: block; height: 100%; width: 0%; border-radius: 999px;
          background: linear-gradient(90deg, var(--ok), #6ee38a);
          transition: width .35s cubic-bezier(.3,1.4,.5,1); position: relative; }
.pbar i::after { content: ''; position: absolute; inset: 3px 6px auto 6px; height: 4px;
                 border-radius: 999px; background: rgba(255,255,255,.38); }
.hearts { display: flex; gap: 3px; font-size: 17px; }
.hearts b { transition: .3s; }
.hearts b.gone { filter: grayscale(1); opacity: .3; transform: scale(.85); }

.q-wrap { padding: 6px 0 130px; animation: slideIn .3s ease both; }
@keyframes slideIn { from { opacity: 0; transform: translateY(14px); } }
.q-kicker { font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .1em;
            color: var(--violet); margin-bottom: 8px; }
.q-title { font-size: clamp(19px, 4.4vw, 25px); margin-bottom: 18px; }
.q-sub { color: var(--muted); font-size: 14.5px; margin: -10px 0 18px; font-weight: 600; }

.opts { display: grid; gap: 11px; }
.opt {
  display: flex; align-items: center; gap: 13px; text-align: left;
  padding: 15px 17px; border-radius: var(--r-md);
  border: 2px solid var(--line); border-bottom-width: 4px;
  background: var(--card); cursor: pointer; font-size: 15.5px; font-weight: 700;
  color: var(--ink); transition: .12s; -webkit-tap-highlight-color: transparent;
}
.opt:hover:not(.locked) { background: #f6f9fd; border-color: #cfdcee; }
.opt .key {
  width: 27px; height: 27px; flex: 0 0 27px; border-radius: 8px; display: grid; place-items: center;
  border: 2px solid var(--line); font-size: 12px; font-weight: 900; color: var(--muted);
}
.opt.sel { border-color: var(--blue); background: #eaf4ff; color: var(--blue-dk); }
.opt.sel .key { border-color: var(--blue); color: var(--blue-dk); }
.opt.right { border-color: var(--ok); background: var(--ok-lt); color: var(--ok-dk); }
.opt.right .key { border-color: var(--ok); color: var(--ok-dk); }
.opt.wrong { border-color: var(--bad); background: var(--bad-lt); color: var(--bad-dk); }
.opt.wrong .key { border-color: var(--bad); color: var(--bad-dk); }
.opt.locked { cursor: default; }

.opts.two { grid-template-columns: 1fr 1fr; }
.opts.two .opt { justify-content: center; text-align: center; font-size: 17px; padding: 22px 14px; }
@media (max-width: 420px) { .opts.two { grid-template-columns: 1fr; } }

/* Zuordnungs-Aufgabe */
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.match .col { display: grid; gap: 9px; align-content: start; }
.mitem {
  padding: 13px 14px; border-radius: 13px; border: 2px solid var(--line); border-bottom-width: 4px;
  background: var(--card); cursor: pointer; font-size: 13.5px; font-weight: 700; text-align: left;
  transition: .12s; color: var(--ink);
}
.mitem.sel { border-color: var(--blue); background: #eaf4ff; }
.mitem.paired { border-color: var(--ok); background: var(--ok-lt); color: var(--ok-dk); opacity: .62; cursor: default; }
.mitem.err { animation: shake .35s; border-color: var(--bad); background: var(--bad-lt); }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }

/* Reihenfolge-Aufgabe */
.bank { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 16px;
        min-height: 56px; padding: 12px; border-radius: var(--r-md);
        border: 2px dashed var(--line); background: #f8fafd; }
.slotline { display: flex; flex-wrap: wrap; gap: 9px; min-height: 56px; padding: 12px;
            border-radius: var(--r-md); background: var(--card); border: 2px solid var(--line); }
.chip {
  padding: 10px 15px; border-radius: 12px; border: 2px solid var(--line); border-bottom-width: 4px;
  background: var(--card); font-size: 14px; font-weight: 800; cursor: pointer; transition: .12s;
  color: var(--ink); -webkit-tap-highlight-color: transparent;
}
.chip:hover { border-color: #cfdcee; }
.chip.num::before { content: attr(data-n) '.'; color: var(--violet); margin-right: 7px; font-weight: 900; }
.chip.right { border-color: var(--ok); background: var(--ok-lt); color: var(--ok-dk); }
.chip.wrong { border-color: var(--bad); background: var(--bad-lt); color: var(--bad-dk); }

/* Zahleneingabe */
.numrow { display: flex; align-items: center; gap: 12px; }
.numrow input {
  width: 150px; padding: 15px 16px; font-size: 25px; font-weight: 900; font-family: inherit;
  border-radius: var(--r-md); border: 2px solid var(--line); border-bottom-width: 4px;
  background: var(--card); color: var(--ink); text-align: center; outline: none;
}
.numrow input:focus { border-color: var(--blue); }
.numrow .unit { font-size: 19px; font-weight: 900; color: var(--muted); }

/* Beschriftungs-Aufgabe */
.labelwrap { position: relative; border-radius: var(--r-md); overflow: hidden;
             border: 2px solid #f0cdd2; background: #fff6f6;
             max-width: 560px; margin: 0 auto; }
.labelwrap canvas { display: block; width: 100%; height: 330px; cursor: crosshair; }

/* Brustwandableitungen V1–V6 im Vergleich */
.leadgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.leadcell { border: 2px solid #f0cdd2; border-radius: 12px; overflow: hidden; background: #fff6f6; }
.leadcell canvas { display: block; width: 100%; height: 132px; }
@media (max-width: 560px) {
  .leadgrid { grid-template-columns: repeat(2, 1fr); gap: 7px; }
  .leadcell canvas { height: 112px; }
}

/* Detailansicht eines einzelnen Herzschlags */
.beatbox { max-width: 560px; margin: 0 auto; }
.beatbox canvas { height: 330px; }
@media (max-width: 480px) {
  .labelwrap canvas, .beatbox canvas { height: 270px; }
}

/* EKG-Anzeigen */
.scope {
  border-radius: var(--r-md); overflow: hidden; border: 2px solid #0d2033;
  background: #08131f; box-shadow: var(--shadow-sm); position: relative;
}
.scope canvas { display: block; width: 100%; height: 100%; }
.scope.h-sm canvas { height: 110px; }
.scope.h-md canvas { height: 165px; }
.scope.h-lg canvas { height: 215px; }
.scope .tag {
  position: absolute; top: 9px; right: 10px; font-size: 10.5px; font-weight: 900;
  letter-spacing: .09em; text-transform: uppercase; color: #7fe9b6;
  background: rgba(8,19,31,.75); padding: 4px 9px; border-radius: 999px;
  border: 1px solid rgba(62,245,143,.3);
}
.scope.paper { border-color: #f0cdd2; background: #fff6f6; }

.q-media { margin-bottom: 18px; }

/* Feedback-Leiste */
.feedback {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  border-top: 2px solid var(--line);
  background: var(--card);
  transform: translateY(101%); transition: transform .28s cubic-bezier(.2,1,.4,1);
}
.feedback.show { transform: none; }
.feedback.good { background: var(--ok-lt); border-top-color: #b6ebc4; }
.feedback.bad  { background: var(--bad-lt); border-top-color: #ffc3c3; }
.fb-in { max-width: 980px; margin: 0 auto; display: flex; align-items: center; gap: 15px; flex-wrap: wrap; }
.fb-icon { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 50%; display: grid; place-items: center;
           font-size: 23px; background: #fff; }
.fb-txt { flex: 1; min-width: 200px; }
.fb-txt h4 { font-size: 18px; margin-bottom: 3px; }
.feedback.good .fb-txt h4 { color: var(--ok-dk); }
.feedback.bad  .fb-txt h4 { color: var(--bad-dk); }
.fb-txt p { font-size: 13.5px; color: var(--ink); opacity: .82; font-weight: 600; }
.fb-in .btn { margin-left: auto; }

.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  border-top: 2px solid var(--line); background: rgba(255,255,255,.94);
  backdrop-filter: blur(10px);
}
.ab-in { max-width: 980px; margin: 0 auto; display: flex; gap: 12px; align-items: center; }
.ab-in .btn { margin-left: auto; min-width: 160px; }

/* Lehrfolie */
.teach h2 { font-size: clamp(21px, 4.8vw, 28px); margin-bottom: 12px; }
.teach .lead { font-size: 16px; color: var(--ink); opacity: .88; margin-bottom: 16px; line-height: 1.65; }
.bullets { display: grid; gap: 10px; margin-top: 16px; }
.bullets li {
  list-style: none; display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 15px; border-radius: 14px; background: var(--card);
  border: 2px solid var(--line); font-size: 14.5px; line-height: 1.5; font-weight: 600;
}
.bullets li b { color: var(--brand-dk); font-weight: 900; }
.bullets .bi { flex: 0 0 22px; font-size: 17px; line-height: 1.3; }
.bullets ul { margin: 0; padding: 0; }

.keybox {
  margin-top: 16px; padding: 15px 17px; border-radius: var(--r-md);
  background: var(--violet-lt); border: 2px solid #ddd4ff;
}
.keybox h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em;
             color: var(--violet-dk); margin-bottom: 6px; }
.keybox p { font-size: 14.5px; font-weight: 700; line-height: 1.55; }

.normtab { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 14px; }
.normtab th, .normtab td { padding: 10px 12px; text-align: left; border-bottom: 2px solid var(--line-soft); }
.normtab th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.normtab td:first-child { font-weight: 900; }
.normtab td b { color: var(--brand-dk); }

/* Abschluss-Bildschirm */
.done-wrap { text-align: center; padding: 34px 10px 120px; animation: slideIn .35s ease both; }
.done-emoji { font-size: 74px; animation: pop .5s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
.done-wrap h1 { font-size: 29px; margin: 12px 0 8px; }
.done-wrap > p { color: var(--muted); font-weight: 700; margin-bottom: 26px; }
.done-stats { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.dstat { flex: 1 1 130px; max-width: 190px; border-radius: var(--r-md); padding: 3px;
         background: var(--c, var(--gold)); }
.dstat .in { background: var(--card); border-radius: 13px; padding: 12px 10px; }
.dstat .t { font-size: 10.5px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em;
            color: var(--c, var(--gold)); }
.dstat .v { font-size: 25px; font-weight: 900; margin-top: 2px; }

/* ------------------------------------------------------- Herz-Diagramm -- */

.heart-svg { width: 100%; max-width: 380px; height: auto; display: block; margin: 0 auto; }
.heart-svg .hlabels text { font: 700 12px var(--font); fill: #6c7d9c; }
.heart-svg .hchambers text { font: 900 15px var(--font); fill: rgba(120,40,60,.42); }
.heart-svg .hp { transition: fill .12s linear; }
.heart-svg .cond-path { transition: opacity .2s; }
.heart-svg .hnode { transition: r .1s linear; }

.heart-caption { margin-top: 12px; padding: 14px 16px; border-radius: var(--r-md);
                 background: var(--card); border: 2px solid var(--line); }
.hc-row { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; flex-wrap: wrap; }
.hc-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--gold); flex: 0 0 11px;
          box-shadow: 0 0 0 4px #fff3d4; }
.hc-title { font-size: 15.5px; }
.hc-tag { margin-left: auto; font-size: 11px; font-weight: 900; text-transform: uppercase;
          letter-spacing: .07em; color: var(--violet-dk); background: var(--violet-lt);
          padding: 4px 10px; border-radius: 999px; }
.hc-text { font-size: 14px; color: var(--muted); font-weight: 600; line-height: 1.55; }

/* ------------------------------------------------------ Bibliothek ------ */

.libgrid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.libcard { background: var(--card); border: 2px solid var(--line); border-radius: var(--r-lg);
           overflow: hidden; box-shadow: var(--shadow-sm); transition: .18s; }
.libcard:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: #cfdcee; }
.libcard .scope { border-radius: 0; border-width: 0 0 2px 0; border-color: var(--line); }
.libcard .body { padding: 15px 17px 17px; }
.libcard h3 { font-size: 16px; margin-bottom: 4px; }
.libcard .cat { font-size: 10.5px; font-weight: 900; letter-spacing: .09em; text-transform: uppercase;
                color: var(--muted); margin-bottom: 7px; }
.libcard p { font-size: 13.5px; color: var(--muted); font-weight: 600; line-height: 1.55; }
.taglist { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.tag2 { font-size: 11px; font-weight: 800; padding: 4px 9px; border-radius: 999px;
        background: var(--line-soft); color: var(--muted); }
.tag2.crit { background: var(--bad-lt); color: var(--bad-dk); }
.tag2.warn { background: #fff2d6; color: #b57500; }
.tag2.ok   { background: var(--ok-lt); color: var(--ok-dk); }

/* Download-Karte für das Begleitskript */
.pdfcard {
  display: grid; grid-template-columns: 190px 1fr; gap: 20px;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--r-lg);
  padding: 20px; box-shadow: var(--shadow-sm); align-items: center;
}
.pdfcover {
  position: relative; border-radius: 12px; overflow: hidden; aspect-ratio: 1 / 1.414;
  background: linear-gradient(150deg, #0f2338, #16324e);
  box-shadow: var(--shadow-md); padding: 16px 14px;
  display: flex; flex-direction: column; justify-content: flex-start;
}
.pdfcover .pc-kicker { font-size: 8.5px; font-weight: 900; letter-spacing: .14em;
  color: #fff; background: var(--heart); padding: 3px 8px; border-radius: 999px;
  align-self: flex-start; }
.pdfcover .pc-title { font-size: 30px; font-weight: 900; color: #fff; margin-top: 10px;
  letter-spacing: -.02em; }
.pdfcover canvas { position: absolute; left: 14px; right: 14px; bottom: 16px;
  width: calc(100% - 28px); height: 58px; border-radius: 7px; }
.pdfbody h3 { font-size: 18px; margin-bottom: 7px; }
.pdfbody p { font-size: 14px; color: var(--muted); font-weight: 600; line-height: 1.6; }
@media (max-width: 560px) {
  .pdfcard { grid-template-columns: 1fr; }
  .pdfcover { max-width: 190px; margin: 0 auto; }
}

.filterbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.fchip { padding: 8px 15px; border-radius: 999px; border: 2px solid var(--line); background: var(--card);
         font-size: 13px; font-weight: 800; cursor: pointer; color: var(--muted); transition: .15s; }
.fchip:hover { border-color: #cfdcee; }
.fchip.on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ----------------------------------------------------------- Labor ------ */

.lab-grid { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 780px) { .lab-grid { grid-template-columns: 1fr 300px; } }

.slider { margin-bottom: 17px; }
.slider label { display: flex; justify-content: space-between; align-items: baseline;
                font-size: 13px; font-weight: 800; margin-bottom: 7px; color: var(--ink); }
.slider label span { font-weight: 900; color: var(--violet-dk); font-variant-numeric: tabular-nums; }
.slider input[type=range] { width: 100%; -webkit-appearance: none; appearance: none;
                            height: 8px; border-radius: 999px; background: var(--bg-deep); outline: none; }
.slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%;
  background: var(--violet); border: 4px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.22); cursor: pointer;
}
.slider input[type=range]::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%; background: var(--violet);
  border: 4px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.22); cursor: pointer; }
.slider .hint { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-top: 5px; }

.readout { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px,1fr)); gap: 9px; margin-top: 14px; }
.ro { padding: 10px 11px; border-radius: 12px; background: var(--line-soft); }
.ro .t { font-size: 10px; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.ro .v { font-size: 17px; font-weight: 900; margin-top: 2px; font-variant-numeric: tabular-nums; }
.ro.warn { background: #fff2d6; } .ro.warn .v { color: #b57500; }
.ro.bad { background: var(--bad-lt); } .ro.bad .v { color: var(--bad-dk); }
.ro.ok { background: var(--ok-lt); } .ro.ok .v { color: var(--ok-dk); }

/* ------------------------------------------------------ Ableitungen ----- */

.leads-wrap { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 800px) { .leads-wrap { grid-template-columns: 380px 1fr; } }
.cabrera { width: 100%; max-width: 380px; height: auto; margin: 0 auto; display: block; }
.cabrera .axis { stroke: #cbd7e8; stroke-width: 2; }
.cabrera .lead-line { stroke-width: 4; stroke-linecap: round; cursor: pointer; transition: .15s; }
.cabrera text { font: 900 13px var(--font); }
.leadbtns { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.leadbtn { padding: 8px 13px; border-radius: 11px; border: 2px solid var(--line); border-bottom-width: 4px;
           background: var(--card); font-weight: 900; font-size: 13px; cursor: pointer; color: var(--ink); }
.leadbtn.on { background: var(--violet); border-color: var(--violet-dk); color: #fff; }

/* ---------------------------------------------------------- Verschiedenes */

.pill-note { display: flex; gap: 10px; align-items: flex-start; padding: 13px 15px;
             border-radius: 14px; background: #fff8e6; border: 2px solid #ffe4a3;
             font-size: 13.5px; font-weight: 600; line-height: 1.55; color: #7a5600; }
.pill-note .bi { font-size: 17px; }

.footer { text-align: center; padding: 30px 16px 12px; color: var(--muted);
          font-size: 12px; font-weight: 600; line-height: 1.7; }

.modal-bg { position: fixed; inset: 0; background: rgba(15,25,45,.55); backdrop-filter: blur(3px);
            z-index: 90; display: grid; place-items: center; padding: 20px;
            animation: fadeIn .2s ease both; }
@keyframes fadeIn { from { opacity: 0; } }
.modal { background: var(--card); border-radius: var(--r-xl); padding: 26px; max-width: 420px; width: 100%;
         box-shadow: var(--shadow-lg); animation: pop .3s cubic-bezier(.2,1.5,.4,1) both; text-align: center; }
.modal h3 { font-size: 21px; margin-bottom: 9px; }
.modal p { color: var(--muted); font-size: 14.5px; font-weight: 600; margin-bottom: 20px; }
.modal .row { display: flex; gap: 10px; }
.modal .row .btn { flex: 1; }

.xp-fly { position: fixed; z-index: 99; font-weight: 900; font-size: 20px; color: var(--gold-dk);
          pointer-events: none; animation: fly 1s ease-out forwards; }
@keyframes fly { 0% { opacity: 0; transform: translateY(0) scale(.6); }
                 25% { opacity: 1; transform: translateY(-14px) scale(1.1); }
                 100% { opacity: 0; transform: translateY(-70px) scale(.9); } }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
