/* Interview-Coach – Stylesheet
   Tokens oben, dann Basis, Layout, Komponenten. Keine externen Schriften (offline-sicher). */

:root {
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #f4f5fb;
  --bg-glow: #e6e8ff;
  --surface: #ffffff;
  --surface-2: #f0f2fa;
  --surface-3: #e7eaf6;
  --border: #dfe2f0;
  --border-strong: #c9cee6;
  --text: #14172b;
  --text-2: #4a5170;
  --text-3: #6a7190;
  --accent: #4b47e5;
  --accent-2: #7b3fe4;
  --accent-ink: #ffffff;
  --accent-soft: #e9e8ff;
  --accent-text: #3d39c9;
  --ok: #157a3d;
  --ok-soft: #dff5e7;
  --warn: #93510a;
  --warn-soft: #fdf0d6;
  --danger: #b42318;
  --danger-soft: #fde7e4;
  --focus: #1f6feb;
  --hl: #ffe98a;
  --hl-ink: #2a2200;
  --shadow: 0 1px 2px rgb(20 23 60 / 0.06), 0 8px 24px rgb(20 23 60 / 0.07);
  --shadow-lg: 0 20px 60px rgb(20 23 60 / 0.22);

  --radius: 16px;
  --radius-sm: 10px;
  --text-size: 1.125rem;
  color-scheme: light;
}

/* Dunkles Schema: explizit per data-theme oder automatisch per System-Einstellung */
:root[data-theme="dark"] {
  --bg: #0b0d17; --bg-glow: #1a1c45; --surface: #131627; --surface-2: #1a1e33; --surface-3: #232843;
  --border: #262b45; --border-strong: #363c5e; --text: #eceffc; --text-2: #b4bad8; --text-3: #8d94b8;
  --accent: #8b8fff; --accent-2: #b48bff; --accent-ink: #0b0d17; --accent-soft: #24274d; --accent-text: #b0b4ff;
  --ok: #5fd08a; --ok-soft: #17301f; --warn: #f0b95c; --warn-soft: #33270e; --danger: #ff8f84; --danger-soft: #3a1714;
  --focus: #79aaff; --hl: #5a4d10; --hl-ink: #fff3c2;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 10px 30px rgb(0 0 0 / 0.35); --shadow-lg: 0 24px 70px rgb(0 0 0 / 0.6);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0d17; --bg-glow: #1a1c45; --surface: #131627; --surface-2: #1a1e33; --surface-3: #232843;
    --border: #262b45; --border-strong: #363c5e; --text: #eceffc; --text-2: #b4bad8; --text-3: #8d94b8;
    --accent: #8b8fff; --accent-2: #b48bff; --accent-ink: #0b0d17; --accent-soft: #24274d; --accent-text: #b0b4ff;
    --ok: #5fd08a; --ok-soft: #17301f; --warn: #f0b95c; --warn-soft: #33270e; --danger: #ff8f84; --danger-soft: #3a1714;
    --focus: #79aaff; --hl: #5a4d10; --hl-ink: #fff3c2;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 10px 30px rgb(0 0 0 / 0.35); --shadow-lg: 0 24px 70px rgb(0 0 0 / 0.6);
    color-scheme: dark;
  }
}
:root[data-size="s"] { --text-size: 1rem; }
:root[data-size="l"] { --text-size: 1.3rem; }

/* ───────── Basis ───────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }
body {
  margin: 0;
  font: 16px/1.5 var(--font);
  color: var(--text);
  background: var(--bg);
  background-image: radial-gradient(1100px 420px at 50% -120px, var(--bg-glow), transparent 70%);
  background-repeat: no-repeat;
  min-height: 100dvh;
}
h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); }
code { font-family: var(--mono); font-size: 0.92em; background: var(--surface-3); padding: 0.1em 0.35em; border-radius: 6px; }
kbd { font: 0.78rem var(--mono); background: var(--surface); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; color: var(--text-2); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 10px 16px; border-radius: 10px; text-decoration: none; font-weight: 600; }
.skip-link:focus { top: 12px; }
.icon { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.noscript { padding: 24px; text-align: center; }

/* ───────── Kopfzeile ───────── */
.topbar { position: sticky; top: 0; z-index: 30; backdrop-filter: saturate(1.4) blur(14px); background: color-mix(in srgb, var(--bg) 82%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent); }
.topbar__inner { max-width: 1240px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); min-width: 0; }
.brand__mark { width: 38px; height: 38px; flex: none; }
.brand__bg { fill: var(--accent); }
.brand__text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand__text strong { font-size: 1.05rem; letter-spacing: -0.01em; white-space: nowrap; }
.brand__text span { font-size: 0.8rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__actions { display: flex; align-items: center; gap: 6px; }

/* ───────── Buttons ───────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid transparent; background: transparent; font-weight: 600; font-size: 0.95rem; line-height: 1; transition: background-color .15s, border-color .15s, transform .05s, box-shadow .15s; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn--primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn--primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn--soft { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn--soft:hover:not(:disabled) { background: var(--surface-3); }
.btn--soft[aria-pressed="true"] { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 45%, transparent); color: var(--ok); }
.btn--ghost { color: var(--text-2); }
.btn--ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn--danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn--icon { width: 44px; padding: 0; }
.btn--tiny { min-height: 34px; padding: 0 12px; font-size: 0.85rem; }
.link { background: none; border: 0; padding: 0; color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.only-narrow { display: none; }

/* ───────── Layout ───────── */
.layout { max-width: 1240px; margin: 0 auto; padding: 24px 20px 40px; display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; }
.main { min-width: 0; outline: none; }

/* ───────── Frage-Bereich ───────── */
.ask { background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 28px; box-shadow: var(--shadow); }
.ask__title { font-size: clamp(1.6rem, 3vw, 2.1rem); letter-spacing: -0.02em; line-height: 1.15; }
.ask__lead { color: var(--text-2); margin-top: 6px; }
.ask__form { margin-top: 20px; position: relative; }
.ask__field { position: relative; }
#ask-input { width: 100%; min-height: 64px; max-height: 180px; resize: none; padding: 18px 68px 18px 20px; font-size: 1.2rem; line-height: 1.4; background: var(--surface-2); border: 2px solid var(--border); border-radius: 18px; transition: border-color .15s, box-shadow .15s, background-color .15s; overflow-y: hidden; }
#ask-input::placeholder { color: var(--text-3); }
#ask-input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
.mic { position: absolute; right: 12px; top: 12px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); display: grid; place-items: center; transition: background-color .15s, color .15s, border-color .15s; }
.mic:hover { color: var(--accent-text); border-color: var(--accent); }
.mic.is-unsupported { opacity: 0.55; }
.mic.is-listening { background: var(--danger); border-color: var(--danger); color: #fff; animation: pulse 1.4s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 55%, transparent); } 100% { box-shadow: 0 0 0 16px transparent; } }
.ask__row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.hint { min-height: 1.4em; margin-top: 8px; color: var(--text-3); font-size: 0.9rem; }
.suggest { position: absolute; left: 0; right: 0; top: 68px; z-index: 20; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; }
.suggest li + li { border-top: 1px solid var(--border); }
.suggest__item { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left; background: none; border: 0; padding: 12px 18px; min-height: 48px; }
.suggest__item:hover, .suggest__item:focus-visible { background: var(--accent-soft); outline-offset: -3px; }
.suggest__q { font-weight: 600; }
.suggest__cat { flex: none; font-size: 0.78rem; color: var(--text-3); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; }
.chips__label { color: var(--text-3); font-size: 0.9rem; margin-right: 2px; }
.chip { border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); border-radius: 999px; padding: 8px 14px; min-height: 40px; font-size: 0.9rem; text-align: left; transition: background-color .15s, color .15s, border-color .15s; }
.chip:hover { background: var(--accent-soft); color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }

/* Segment-Schalter */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; border-radius: 9px; min-height: 38px; padding: 0 12px; font-weight: 600; font-size: 0.88rem; color: var(--text-2); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--accent-text); box-shadow: 0 1px 3px rgb(20 23 60 / 0.14); }
.seg button:not([aria-pressed="true"]):hover { color: var(--text); }
.seg--small button { min-height: 38px; padding: 0 12px; }

/* ───────── Antwort-Karte ───────── */
.answer-area { margin-top: 20px; outline: none; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow); }
.answer { padding: 28px; animation: rise .28s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.answer__meta { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 0.8rem; font-weight: 600; color: var(--text-2); }
.pill .icon { width: 1em; height: 1em; }
.pill--kb, .pill--custom { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.pill--ai { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 18%, var(--surface)), color-mix(in srgb, var(--accent-2) 22%, var(--surface))); color: var(--accent-text); border-color: transparent; }
.pill--warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.answer__q { margin-top: 14px; font-size: clamp(1.35rem, 2.6vw, 1.75rem); line-height: 1.25; letter-spacing: -0.015em; }
.answer__asked { margin-top: 6px; color: var(--text-3); font-size: 0.92rem; }
.inline-notice { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding: 10px 14px; background: var(--warn-soft); color: var(--warn); border-radius: 12px; font-size: 0.92rem; }

/* Player */
.player { margin: 22px 0 8px; padding: 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 20px; }
.player__controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.play { display: inline-flex; align-items: center; gap: 12px; height: 56px; padding: 0 26px 0 20px; border: 0; border-radius: 999px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); font-weight: 700; font-size: 1.05rem; box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 38%, transparent); transition: filter .15s, transform .05s; }
.play .icon { width: 1.6em; height: 1.6em; }
.play:hover:not(:disabled) { filter: brightness(1.07); }
.play:active:not(:disabled) { transform: scale(.98); }
.play:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.player__nav { display: flex; gap: 4px; }
.player__nav .btn--icon { border-color: var(--border); background: var(--surface); }
.player__options { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 14px; }
.mini { display: inline-flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text-3); font-weight: 600; }
.mini--grow { flex: 1 1 200px; min-width: 0; }
.mini select, .field select, .field input, .field textarea { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; min-height: 40px; padding: 6px 10px; color: var(--text); }
.mini select { max-width: 100%; }
.voice-select { width: 100%; min-width: 0; }
.progress { height: 5px; border-radius: 99px; background: var(--surface-3); margin-top: 14px; overflow: hidden; }
.progress__bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 99px; transition: width .3s ease; }
.player__status { margin-top: 8px; min-height: 1.3em; font-size: 0.85rem; color: var(--text-3); }
.wait { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--ok-soft); color: var(--ok); }
.wait__text { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.wait__text .link { margin-left: auto; color: inherit; }
.wait__track { height: 6px; border-radius: 99px; background: color-mix(in srgb, var(--ok) 22%, transparent); margin-top: 10px; overflow: hidden; }
.wait__fill { height: 100%; width: 100%; background: var(--ok); transform-origin: left; transform: scaleX(0); }
.wait__fill.run { animation: countdown var(--wait-ms, 3s) linear forwards; }
@keyframes countdown { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* Schwebende Kurzsteuerung */
.mini-player { position: fixed; z-index: 35; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: 6px; padding: 8px 12px 8px 8px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(14px) saturate(1.4); border: 1px solid var(--border-strong); border-radius: 999px; box-shadow: var(--shadow-lg); animation: rise .2s ease-out; }
.mini-player__play { width: 48px; height: 48px; border-radius: 50%; border: 0; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); }
.mini-player__play .icon { width: 1.4em; height: 1.4em; }
.mini-player .btn--icon { width: 44px; min-height: 44px; border-radius: 50%; color: var(--text-2); }
.mini-player .btn--icon:hover { background: var(--surface-2); }
.mini-player__status { padding: 0 8px; min-width: 64px; text-align: center; font-size: 0.85rem; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* Text */
.answer__body { position: relative; margin-top: 18px; }
.part { margin-top: 26px; }
.part:first-child { margin-top: 8px; }
.part h3 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: .09em; color: var(--accent-text); font-weight: 800; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; }
.part h3::after { content: ""; height: 1px; flex: 1; background: var(--border); }
.part--muted { opacity: .55; }
.text { font-size: var(--text-size); line-height: 1.8; max-width: 70ch; }
.text p + p { margin-top: .9em; }
.text strong { font-weight: 700; }
.s { border-radius: 6px; cursor: pointer; padding: 1px 2px; margin: -1px -2px; box-decoration-break: clone; -webkit-box-decoration-break: clone; transition: background-color .15s; }
.s.s--off { cursor: default; }
.s:not(.s--off):hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.s.is-active { background: var(--hl); color: var(--hl-ink); }
.caret { display: inline-block; width: 2px; height: 1.1em; margin-left: 2px; vertical-align: text-bottom; background: var(--accent); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.part--code pre { margin: 0; padding: 16px 18px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; overflow-x: auto; font: 0.9rem/1.6 var(--mono); }
.part--code code { background: none; padding: 0; font-size: inherit; }
.part__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.part__bar h3 { flex: 1; margin: 0; }
.callout { display: flex; gap: 12px; margin-top: 22px; padding: 14px 16px; border-radius: 14px; font-size: 0.95rem; }
.callout p { margin-top: 4px; }
.callout--tip { background: var(--accent-soft); color: var(--text); }
.callout--tip .icon { color: var(--accent-text); margin-top: 2px; }
.callout--warn { background: var(--warn-soft); color: var(--warn); }
.callout--warn p { color: inherit; }

/* Abfragemodus */
.answer__body.is-covered { min-height: 230px; }
.is-covered .part, .is-covered .callout { filter: blur(9px); user-select: none; pointer-events: none; }
.cover { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 16px; }
.cover p { font-weight: 700; font-size: 1.05rem; }
.cover__actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

.answer__foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border); }
.related { margin-top: 22px; }
.related h3 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: .09em; color: var(--text-3); margin-bottom: 8px; }
.related__list { display: grid; gap: 6px; }
.related__item { width: 100%; text-align: left; padding: 10px 14px; min-height: 44px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 12px; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.related__item::after { content: "→"; color: var(--text-3); }
.related__item:hover { background: var(--accent-soft); border-color: transparent; }

/* Leer-/Hinweiszustände */
.empty { display: grid; gap: 22px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.step { display: flex; gap: 14px; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; }
.step__n { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); font-weight: 800; }
.step p { color: var(--text-2); font-size: 0.92rem; margin-top: 4px; }
.empty__stats { color: var(--text-3); text-align: center; font-size: 0.92rem; }
.recent h3 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: .09em; color: var(--text-3); }
.notice-card { padding: 28px; display: grid; gap: 12px; justify-items: start; }
.notice-card__icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.notice-card--error .notice-card__icon { background: var(--danger-soft); color: var(--danger); }
.notice-card h2 { font-size: 1.35rem; letter-spacing: -0.01em; }
.notice-card__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.notice-card .related { width: 100%; }
.note { color: var(--text-3); font-size: 0.9rem; }

/* ───────── Bibliothek ───────── */
.library { position: sticky; top: 84px; max-height: calc(100dvh - 108px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow); overflow: hidden; }
.library__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 8px 22px; }
.library__head h2 { font-size: 1.05rem; }
.library__count { color: var(--text-3); font-weight: 500; }
.library__tools { display: flex; gap: 8px; padding: 6px 18px 10px; }
.search { position: relative; flex: 1; min-width: 0; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search input { width: 100%; min-height: 44px; padding: 0 12px 0 38px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface-2); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.library__tools .btn { padding: 0 12px; }
.library__tools .btn span { display: none; }
.cats { display: flex; gap: 6px; padding: 0 18px 12px; overflow-x: auto; scrollbar-width: thin; }
.cat { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); padding: 0 12px; min-height: 36px; border-radius: 999px; font-size: 0.85rem; font-weight: 600; white-space: nowrap; }
.cat[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.cat__n { font-size: 0.75rem; opacity: .75; }
.lib-list { flex: 1; overflow-y: auto; padding: 4px 10px 10px; border-top: 1px solid var(--border); }
.lib-item { width: 100%; display: flex; gap: 10px; align-items: flex-start; text-align: left; border: 0; background: transparent; padding: 10px; border-radius: 12px; min-height: 48px; }
.lib-item:hover { background: var(--surface-2); }
.lib-item[aria-current="true"] { background: var(--accent-soft); }
.lib-item__check { flex: none; width: 22px; height: 22px; margin-top: 1px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; }
.lib-item__check.is-on { background: var(--ok); border-color: var(--ok); color: #fff; }
.lib-item__check .icon { width: 13px; height: 13px; stroke-width: 3; }
.lib-item__text { display: flex; flex-direction: column; min-width: 0; }
.lib-item__q { font-size: 0.95rem; font-weight: 600; line-height: 1.3; }
.lib-item__cat { font-size: 0.75rem; color: var(--text-3); margin-top: 2px; }
.lib-empty { padding: 24px; text-align: center; color: var(--text-3); }
.library__foot { padding: 12px 22px 16px; border-top: 1px solid var(--border); font-size: 0.85rem; color: var(--text-3); }
.meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-bottom: 8px; }
.meter__bar { height: 100%; width: 0; background: var(--ok); border-radius: 99px; transition: width .4s ease; }
.backdrop { position: fixed; inset: 0; z-index: 39; background: rgb(8 10 24 / 0.55); }

/* ───────── Fußzeile, Toasts ───────── */
.footer { max-width: 1240px; margin: 0 auto; padding: 0 20px 40px; color: var(--text-3); font-size: 0.85rem; display: grid; gap: 6px; }
.toasts { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 80; display: grid; gap: 8px; width: min(92vw, 460px); pointer-events: none; }
.toast { pointer-events: auto; padding: 12px 16px; border-radius: 14px; background: var(--text); color: var(--bg); font-size: 0.93rem; font-weight: 600; box-shadow: var(--shadow-lg); animation: rise .2s ease-out; }
.toast--error { background: var(--danger); color: #fff; }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity .4s, transform .4s; }

/* ───────── Dialoge ───────── */
.dialog { width: min(640px, 94vw); max-height: min(88dvh, 860px); padding: 0; border: 1px solid var(--border-strong); border-radius: 24px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); overflow: hidden; }
.dialog[open] { display: flex; flex-direction: column; animation: rise .2s ease-out; }
.dialog::backdrop { background: rgb(8 10 24 / 0.6); backdrop-filter: blur(3px); }
.dialog__form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.dialog__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 12px 26px; border-bottom: 1px solid var(--border); margin: 0; }
.dialog__head h2 { font-size: 1.2rem; }
.dialog__body { padding: 8px 26px 22px; overflow-y: auto; flex: 1; }
.dialog__foot { display: flex; align-items: center; gap: 10px; padding: 14px 26px; border-top: 1px solid var(--border); background: var(--surface-2); }
.spacer { flex: 1; }
.group { padding: 18px 0; border-bottom: 1px solid var(--border); display: grid; gap: 14px; }
.group:last-child { border-bottom: 0; }
.group h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: .09em; color: var(--accent-text); }
.field { display: grid; gap: 6px; font-size: 0.92rem; font-weight: 600; }
.field em { font-weight: 400; color: var(--text-3); font-style: normal; }
.field output { color: var(--accent-text); margin-left: 6px; }
.field textarea { padding: 10px 12px; resize: vertical; line-height: 1.5; }
.field input[type="range"] { padding: 0; min-height: 32px; accent-color: var(--accent); }
.field__row { display: flex; gap: 8px; align-items: center; }
.field__row input { flex: 1; min-width: 0; }
.field__row--wrap { flex-wrap: wrap; }
.field small { font-weight: 400; }
.group--inner { padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); gap: 12px; }
.check { display: flex; align-items: center; gap: 12px; font-weight: 600; min-height: 36px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

/* ───────── Responsiv ───────── */
@media (max-width: 1020px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding-top: 16px; }
  .only-narrow { display: inline-flex; }
  .library { position: fixed; z-index: 40; top: 0; right: 0; bottom: 0; width: min(420px, 92vw); max-height: none; border-radius: 24px 0 0 24px; transform: translateX(105%); transition: transform .25s ease; visibility: hidden; }
  .library.is-open { transform: none; visibility: visible; }
  .library__tools .btn span { display: inline; }
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .topbar__inner { padding: 8px 14px; }
  .brand__text span { display: none; }
  .layout { padding: 12px 12px 32px; }
  .ask, .answer, .notice-card { padding: 18px; border-radius: 20px; }
  .btn--primary { flex: 1; }
  #ask-input { font-size: 1.05rem; padding: 16px 64px 16px 16px; }
  .player { padding: 12px; }
  .play { height: 52px; flex: 1; justify-content: center; }
  .player__nav { flex: 1; justify-content: flex-end; }
  .mini--grow { flex-basis: 100%; }
  .seg button { padding: 0 10px; }
  .footer { padding: 0 14px 32px; }
  .btn--ghost span { display: none; }
  #btn-random span { display: inline; }
}
@media (max-width: 430px) {
  #btn-library span { display: none; }
  #btn-library { width: 44px; padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

@media print {
  .topbar, .library, .ask, .player, .answer__foot, .footer, .toasts, .related, .backdrop { display: none !important; }
  body { background: #fff; color: #000; }
  .layout { display: block; padding: 0; }
  .card { box-shadow: none; border: 0; }
  .s.is-active { background: none; }
}
