/*
 * Gemeinsame Grundlage: Tokens, Shell (Seitenleiste, Kopfzeile), wiederverwendbare Bausteine.
 * Ansichten nutzen diese Tokens und Klassen und ergänzen nur, was ihnen fehlt (css/<ansicht>.css).
 */
:root {
  /* Flächen und Text */
  --bg: #faf9fc;
  --surface: #ffffff;
  --surface-2: #f6f4fb;
  --surface-3: #eeebf7;
  --ink: #22212e;
  --ink-2: #55546a;
  --muted: #8a889c;
  --faint: #b7b5c6;
  --line: #e9e7f0;
  --line-2: #dbd8e8;

  /* Akzent und Bedeutungsfarben. Amber ist für "Wiederholung fällig" reserviert, Grün für richtig und erledigt. */
  --violet: #7c62d6;
  --violet-ink: #5f45bd;
  --violet-soft: #f1edfc;
  --violet-line: #d8cff4;
  --amber: #d0851c;
  --amber-soft: #fdf3e1;
  --green: #2c9667;
  --green-soft: #e3f4eb;
  --red: #c94747;
  --red-soft: #fbe9e9;

  /* Themenfarbe. Wird pro Element inline gesetzt: style="--tc:#7c62d6" */
  --tc: var(--violet);

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --shadow-1: 0 1px 2px rgb(34 33 46 / .05), 0 4px 16px rgb(34 33 46 / .05);
  --shadow-2: 0 10px 36px rgb(34 33 46 / .14);

  --f-ui: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-head: 'Manrope', var(--f-ui);
  --f-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --sb-w: 248px;
  --hd-h: 48px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--f-ui);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
a { color: var(--violet-ink); text-underline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--f-head); letter-spacing: -.01em; line-height: 1.25; margin: 0; }
p { margin: 0; }
kbd {
  font: 500 11px var(--f-mono); color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px;
}
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; border-radius: 4px; }
.ic { flex: none; vertical-align: -3px; }
::selection { background: #dcd2f9; }

/* ------------------------------------------------------------------ Shell */
.app { display: flex; height: 100%; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.views { flex: 1; min-height: 0; position: relative; }
.view { display: none; position: absolute; inset: 0; overflow: auto; }
.view.active { display: block; }

.sidebar {
  flex: none; width: var(--sb-w); background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 10px 10px 12px; overflow: hidden auto;
  transition: width .18s ease;
}
.sb-top { display: flex; align-items: center; justify-content: space-between; height: 36px; padding: 0 4px 0 8px; margin-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; }
.brand-mark { color: var(--violet); }
.brand-name { font: 800 19px var(--f-head); letter-spacing: -.04em; }

.sb-nav { display: grid; gap: 2px; }
.sb-item {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 8px;
  color: var(--ink-2); text-decoration: none; font-weight: 500; white-space: nowrap;
}
.sb-item:hover { background: var(--surface-2); color: var(--ink); }
.sb-item.on { background: var(--violet-soft); color: var(--violet-ink); font-weight: 600; }
.sb-count {
  margin-left: auto; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px;
  background: var(--amber-soft); color: var(--amber); font: 700 11px/18px var(--f-ui); text-align: center;
}
.sb-label {
  display: flex; align-items: center; justify-content: space-between;
  margin: 22px 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint);
}
.sb-topics { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.sb-topic { border-radius: 8px; min-width: 0; }
.sb-topic.paused { opacity: .62; }
.sb-topic-main { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; min-width: 0; }
.sb-topic-main:hover { background: var(--surface-2); }
.sb-topic-main .sb-text { flex: 1; min-width: 0; }
.sb-topic-main b { display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 600; font-size: 13px; line-height: 1.25; }
.sb-topic-main b > span:first-child { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-topic-main small { display: block; font-size: 11.5px; color: var(--muted); }
.sb-pointer {
  display: flex; align-items: center; gap: 6px; margin: 0 6px 4px 36px; padding: 3px 8px; border-radius: 6px; max-width: calc(100% - 42px);
  font-size: 12px; color: var(--ink-2); text-decoration: none; white-space: nowrap; overflow: hidden;
}
.sb-pointer span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sb-pointer .ic { color: var(--tc); }
.sb-pointer:hover { background: var(--surface-2); color: var(--ink); }

/* Fortschrittsring in Themenfarbe: style="--p:42" */
.ring {
  flex: none; width: 16px; height: 16px; border-radius: 50%;
  background: conic-gradient(var(--tc) calc(var(--p, 0) * 1%), color-mix(in srgb, var(--tc) 18%, white) 0);
  -webkit-mask: radial-gradient(circle, transparent 4.5px, #000 5px); mask: radial-gradient(circle, transparent 4.5px, #000 5px);
}

.sb-bottom { margin-top: auto; padding-top: 16px; }
.sb-continue {
  display: grid; gap: 2px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r);
  background: linear-gradient(180deg, color-mix(in srgb, var(--tc) 7%, white), var(--surface));
}
.sb-continue small { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.sb-continue b { font: 700 14px var(--f-head); }
.sb-continue span { font-size: 12px; color: var(--muted); margin-bottom: 8px; }

/* Eingeklappte Seitenleiste */
body.rail .sidebar { width: 56px; padding-left: 8px; padding-right: 8px; }
body.rail .sb-text, body.rail .brand-name, body.rail .sb-label, body.rail .sb-count, body.rail .brand { display: none; }
body.rail .sb-top { justify-content: center; padding: 0; }
body.rail .sb-item, body.rail .sb-topic-main { justify-content: center; padding: 0; height: 34px; }
body.rail .sb-topics { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }

.topbar {
  flex: none; height: var(--hd-h); display: flex; align-items: center; gap: 12px; padding: 0 16px 0 20px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.spacer { flex: 1; }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; color: var(--muted); white-space: nowrap; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.crumbs i { font-style: normal; color: var(--line-2); }
.crumbs strong { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.search-btn {
  display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px 0 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: 13px;
}
.search-btn:hover { border-color: var(--line-2); color: var(--ink-2); }
.demo-badge {
  font-size: 11.5px; font-weight: 600; color: var(--muted); background: transparent; border: 1px dashed var(--line-2); border-radius: 999px; padding: 3px 10px;
}
.demo-badge:hover { color: var(--ink-2); border-color: var(--muted); }
.demo-badge.is-demo { color: var(--ink-2); background: var(--surface-2); border-color: var(--muted); }
.demo-tag {
  display: inline-flex; align-items: center; flex: none;
  font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: 999px;
  padding: 1px 6px; line-height: 1.35; vertical-align: middle;
}
.data-pop { position: fixed; z-index: 70; width: 300px; padding: 14px 16px; display: grid; gap: 10px; font-size: 13px; color: var(--ink-2); }
.data-pop b { color: var(--ink); }
.data-pop .btn { justify-self: start; }
.data-pop-toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--ink); }
.data-pop-toggle input { width: 15px; height: 15px; accent-color: var(--violet); margin: 0; }
.ts-demo-note {
  margin: 0 0 14px; padding: 8px 12px; border-radius: 8px;
  border: 1px dashed var(--line-2); background: var(--surface-2);
  font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px;
}
.setup-form { display: grid; gap: 18px; }
.setup-sec { display: grid; gap: 8px; }
.setup-sec h3 { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink); }
.setup-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.setup-card {
  display: grid; gap: 4px; text-align: left; padding: 12px 14px; border-radius: 10px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer;
}
.setup-card b { font-size: 13.5px; color: var(--ink); }
.setup-card span { font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.setup-card.on { border-color: var(--violet); background: var(--surface-2); }
.setup-token { width: 100%; }
.setup-err { margin: 0; font-size: 12.5px; color: var(--red, #c53030); }
.setup-foot { display: flex; justify-content: flex-end; }

/* ------------------------------------------------------------------ Bausteine */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 14px;
  border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 13px; text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--violet); border-color: var(--violet); color: #fff; }
.btn.primary:hover { background: var(--violet-ink); border-color: var(--violet-ink); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn.lg { height: 40px; padding: 0 18px; font-size: 14px; }
.btn.block { display: flex; width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border-radius: 7px;
  border: 0; background: transparent; color: var(--muted);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.on, .icon-btn[aria-pressed="true"] { color: var(--violet-ink); }

/* Segmentierte Auswahl */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--surface-3); }
.seg button {
  height: 28px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent;
  color: var(--ink-2); font-weight: 600; font-size: 12.5px; white-space: nowrap;
}
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--violet-ink); box-shadow: 0 1px 3px rgb(34 33 46 / .14); }
.seg.seg-sm button { height: 24px; padding: 0 9px; font-size: 12px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font-size: 12.5px; font-weight: 500; white-space: nowrap;
}
button.chip:hover, a.chip:hover { border-color: var(--violet-line); color: var(--violet-ink); background: var(--violet-soft); }
.chip.on { border-color: var(--violet); background: var(--violet-soft); color: var(--violet-ink); font-weight: 600; }

.dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--tc); }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }

/* Lernstand. Form trägt die Bedeutung, Farbe das Thema. */
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.state i { flex: none; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--tc); background: transparent; }
.state-gelernt i { background: var(--tc); }
.state-durchdrungen i { background: var(--tc); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--tc); margin: 0 3px; }
.state-aktiv i { background: color-mix(in srgb, var(--tc) 45%, white); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tc) 22%, transparent); }
.state-verfuegbar i { border-style: solid; background: var(--surface); }
.state-gesperrt { color: var(--muted); }
.state-gesperrt i, .state-offen i { border-color: var(--faint); border-style: dashed; }
.state.is-due { color: var(--amber); }

.pips { display: inline-flex; gap: 3px; vertical-align: middle; }
.pips i { width: 14px; height: 4px; border-radius: 2px; background: var(--line-2); }
.pips i.on { background: var(--tc); }

/* Schwebende Fläche (Seitenpanel, Popover) */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.panel-float { box-shadow: var(--shadow-2); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 13px; color: var(--muted); }
.kv b { color: var(--ink); font-weight: 600; text-align: right; }
.sec-title { font: 600 11px var(--f-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.rule { height: 1px; background: var(--line); border: 0; margin: 14px 0; }

.field {
  width: 100%; min-height: 36px; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 8px;
  background: var(--surface); outline: none;
}
.field:focus { border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-soft); }
textarea.field { resize: vertical; line-height: 1.55; }

input[type="range"] { accent-color: var(--violet); height: 20px; margin: 0; }

.callout { padding: 12px 14px; border-radius: var(--r); background: var(--violet-soft); color: var(--ink-2); font-size: 13.5px; }
.callout.ok { background: var(--green-soft); }
.callout.warn { background: var(--amber-soft); }
.callout.bad { background: var(--red-soft); }
.callout b { color: var(--ink); }

.empty { max-width: 460px; margin: 18vh auto 0; padding: 0 24px; text-align: center; color: var(--muted); }
.empty h2 { color: var(--ink); font-size: 20px; margin-bottom: 8px; }

/*
 * Interaktive Abbildung. Lektionen und Übungen nutzen denselben Rahmen.
 *   <figure class="lab">
 *     <figcaption class="lab-head"><b>Titel</b><span>Was man tun kann</span></figcaption>
 *     <div class="lab-stage"><canvas></canvas></div>
 *     <div class="lab-controls"><label class="ctl"><span>t</span><input type="range"><output>0,50</output></label></div>
 *     <div class="lab-readout">Text mit <b>Werten</b></div>
 *   </figure>
 */
.lab { margin: 22px 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.lab-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 12px 16px 0; }
.lab-head b { font: 700 14px var(--f-head); }
.lab-head span { font-size: 12.5px; color: var(--muted); }
.lab-stage { position: relative; margin: 10px 0 0; background: var(--surface-2); border-block: 1px solid var(--line); }
.lab-stage canvas, .lab-stage svg { display: block; width: 100%; }
.lab-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; padding: 10px 16px; }
.ctl { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-2); }
.ctl > span { font-weight: 600; }
.ctl input[type="range"] { width: 170px; }
.ctl output { min-width: 3.4em; font: 500 12.5px var(--f-mono); color: var(--ink); }
.lab-readout { padding: 0 16px 12px; font-size: 13px; color: var(--ink-2); }
.lab-readout b { font-family: var(--f-mono); font-weight: 600; color: var(--ink); }

/* Dialog */
.modal-back {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px;
  background: rgb(34 33 46 / .28); backdrop-filter: blur(2px);
}
.modal { width: min(520px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-2); }
.modal.modal-wide { width: min(760px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 12px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 18px 22px 22px; overflow: auto; }

/* Schnellsuche */
.palette-back { place-items: start center; padding-top: 10vh; }
.palette { width: min(640px, calc(100vw - 24px)); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-2); overflow: hidden; display: flex; flex-direction: column; max-height: 78vh; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 14px 0 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.palette-input input { flex: 1; min-width: 0; height: 48px; border: 0; outline: 0; background: transparent; font-size: 15px; color: var(--ink); }
.palette-clear { width: 28px; height: 28px; flex: 0 0 auto; }
.palette-chips { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-bottom: 1px solid var(--line); overflow-x: auto; flex: 0 0 auto; background: var(--bg); }
.palette-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.palette-chip-n { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.palette-chip.on .palette-chip-n { color: var(--violet-ink); font-weight: 700; }
.palette-list { padding: 6px; flex: 1 1 auto; max-height: 440px; overflow: auto; }
.palette-row { display: flex; flex-direction: column; gap: 4px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.palette-row.on { background: var(--violet-soft); }
.palette-row-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.palette-kind { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: 11px; font-weight: 600; flex: 0 0 auto; }
.palette-kind .ic { color: var(--tc); }
.palette-row.on .palette-kind { background: var(--surface); }
.palette-row b { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.palette-sub { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; flex: 0 1 auto; }
.palette-snippet { font-size: 12.5px; line-height: 1.45; color: var(--ink-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; padding-left: 2px; }
.palette-row mark { background: var(--violet-line); color: var(--ink); border-radius: 3px; padding: 0 2px; font-weight: 600; }
.palette-empty { padding: 22px 18px; text-align: center; color: var(--muted); font-size: 13.5px; }
.palette-foot { display: flex; gap: 16px; padding: 8px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); flex: 0 0 auto; }

/* Meldung */
.toast {
  position: fixed; left: 50%; bottom: 22px; z-index: 90; transform: translate(-50%, 12px);
  display: flex; align-items: center; gap: 14px; max-width: min(560px, calc(100vw - 32px)); padding: 10px 14px;
  background: var(--ink); color: #fff; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow-2);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { border: 0; background: transparent; color: #cdbfff; font-weight: 700; padding: 0; white-space: nowrap; }

/* Tooltip: jedes Element mit data-tip="…" */
.tip {
  position: fixed; z-index: 100; max-width: 280px; padding: 6px 9px; border-radius: 7px;
  background: var(--ink); color: #fff; font-size: 12px; line-height: 1.4; box-shadow: var(--shadow-2);
  opacity: 0; pointer-events: none; transition: opacity .12s;
}
.tip.show { opacity: 1; }

/* Tiefe: Auswahl mit Rücksetzknopf, wenn ein Konzept von der Tiefe des Themas abweicht */
.depth-ctl { display: inline-flex; align-items: center; gap: 4px; }
.depth-ctl.is-own .seg button.on { color: var(--ink); box-shadow: 0 0 0 1.5px var(--violet), 0 1px 3px rgb(34 33 46 / .14); }
.depth-reset { width: 24px; height: 24px; }
.depth-reset[hidden] { display: none; }

/*
 * Konzept-Panel (KA.ui.conceptPanel). Graph und Skill Tree setzen es in ihren eigenen Rahmen:
 * der Rahmen gibt Breite und Höhe vor, .cp füllt ihn und hält die Quelle am unteren Rand.
 */
.cp { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.cp-head { position: relative; padding: 16px 44px 0 18px; }
.cp-topic { display: flex; align-items: center; flex-wrap: nowrap; gap: 7px; min-width: 0; font-size: 12px; font-weight: 600; color: var(--muted); }
.cp-topic > span:first-of-type { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-pin { display: inline-flex; color: var(--tc); }
.cp-close { position: absolute; top: 10px; right: 10px; }
.cp-head h2 { font-size: 18px; margin: 6px 0 8px; }
.cp-state { display: flex; align-items: center; gap: 10px; }
.cp-sum { padding: 10px 18px 0; font-size: 13.5px; line-height: 1.55; color: var(--ink-2); }
.cp-actions { display: grid; gap: 8px; padding: 14px 18px 4px; }
.cp-stand { margin: 12px 18px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 8px; }
.cp-stand h3 { margin: 0; font-size: 13px; }
.cp-stand-goal { margin: 0; font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.cp-stand-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.cp-stand-hint { margin: 0; font-size: 12px; color: var(--muted, var(--ink-2)); }
.cp-actions-row { display: flex; flex-wrap: wrap; gap: 6px; }
.cp-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 18px 12px; }
.cp-sec { padding-top: 14px; }
.cp-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.cp-sec-head h3 { font: 700 13px var(--f-head); }
.cp-sec-head span { font-size: 12px; color: var(--muted); }
.cp-list { display: grid; gap: 2px; margin: 0 -8px; }
.cp-row {
  display: flex; align-items: flex-start; gap: 9px; width: 100%; padding: 6px 8px; border: 0; border-radius: 8px;
  background: transparent; text-align: left;
}
.cp-row:hover { background: var(--surface-2); }
.cp-row-state { padding-top: 3px; }
.cp-row-main { min-width: 0; }
.cp-row-main b { display: block; font-weight: 600; font-size: 13px; line-height: 1.3; }
.cp-row-main small { display: block; font-size: 11.5px; color: var(--muted); }
.cp-foot {
  flex: none; display: flex; align-items: flex-start; gap: 8px; padding: 10px 18px 12px; border-top: 1px solid var(--line);
  font-size: 12px; line-height: 1.4; color: var(--muted);
}
.cp-foot .ic { margin-top: 1px; }

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

/* Knowledge Drop v2 Topbar & Facts */
.drop-runs-btn { background: var(--violet-soft); border-color: var(--violet-line); color: var(--violet-ink); }
.debug-btn.is-on { background: var(--ink); border-color: var(--ink); color: #fff; }
.drop-runs-pop { position: fixed; z-index: 75; width: min(340px, calc(100vw - 24px)); padding: 14px; display: grid; gap: 10px; }
.dl-pop-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); }
.dl-pop-info { display: grid; gap: 2px; min-width: 0; }
.dl-pop-info b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-build-wrap { display: grid; gap: 6px; }
.cp-build-choices { display: flex; gap: 6px; }
.cp-build-choices[hidden] { display: none; }
.cp-build-choices .btn { flex: 1; }
.ts-ex-adds { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ts-facts-sec { display: grid; gap: 10px; }
.ts-fact-add, .ts-fact-row { display: flex; align-items: center; gap: 8px; }
.ts-fact-kind { width: auto; min-width: 120px; }
.ts-fact-input { flex: 1; min-height: 32px; padding: 4px 10px; }
.ts-facts-list { display: grid; gap: 6px; }
.ts-fact-badge { font-size: 11px; flex: none; }
.ts-facts-modal { display: grid; gap: 12px; }

/* Neu in Orbit */
.modal.cl-modal { width: min(620px, 100%); }
.cl-wrap { display: grid; gap: 18px; max-height: min(62vh, 560px); overflow: auto; padding-right: 4px; }
.cl-entry { display: grid; gap: 8px; }
.cl-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.cl-head h3 { margin: 0; font: 700 15px var(--f-head); color: var(--ink); }
.cl-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.cl-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* Schwebendes Konzept-Feld (Skill Tree, Karte im Drop): alles scrollt gemeinsam, damit nichts abgeschnitten wird */
.cp-float > .cp { overflow-y: auto; overscroll-behavior: contain; }
.cp-float > .cp > * { flex: none; }
.cp-float .cp-scroll { overflow: visible; padding-bottom: 8px; }
/* Die Lern-Knöpfe bleiben unten sichtbar, solange man darüber liest. Der Verlauf darüber liegt im freien Abstand
   vor den Knöpfen: Er blendet nur Text aus, der gerade unter die Knöpfe scrollt, nie die letzte Zeile davor. */
.cp-float .cp-actions { position: sticky; bottom: 0; z-index: 1; margin-top: 14px; padding-top: 0; padding-bottom: 12px; background: var(--surface); }
.cp-float .cp-actions::before { content: ''; position: absolute; left: 0; right: 0; top: -14px; height: 14px; background: linear-gradient(to bottom, transparent, var(--surface)); pointer-events: none; }

/* Sprachschalter (Deutsch/Englisch) in der Kopfzeile, sieht aus wie die übrigen Kopfzeilen-Knöpfe. */
.lang-switch { cursor: pointer; white-space: nowrap; }
.lang-switch:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
