:root {
  --ink: #13121A;
  --ink2: #1B1A24;
  --glass: rgba(255,255,255,.045);
  --glass-hi: rgba(255,255,255,.07);
  --line: rgba(255,255,255,.09);
  --line-hi: rgba(255,255,255,.18);
  --text: #EDE7DC;
  --dim: #9A93A6;
  --faint: #635C70;
  --teal: #5BD1C4;
  --rose: #E86A6A;
  --s0: #7BA6E8;
  --s1: #F0871E;
  --s2: #EFA93B;
  --s3: #E3C75B;
  --s4: #B9CE7C;
  --s5: #7FC98F;
  --read: 20px;
  --tabbar-h: 56px;   /* Hoehe der Tab-Leiste am Handy; Player dockt daran an */

  --radius-sm: 10px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3), 0 1px 1px rgba(0,0,0,.18);
  --shadow-md: 0 14px 34px -14px rgba(0,0,0,.55);
  --ease: cubic-bezier(.2,.8,.3,1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--ink);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 15px;
}

body { background: var(--ink); }

.hidden { display: none !important; }
.muted { color: var(--dim); }
.small { font-size: 13px; }
.err { color: var(--rose); font-size: 13.5px; min-height: 18px; }
.spacer { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.wide > .btn { flex: 1; }

::selection { background: rgba(91,209,196,.28); }

/* ---------- Typo-Bausteine ---------- */

.wordmark {
  font-family: Fraunces, Georgia, serif;
  font-size: 26px; font-weight: 600; letter-spacing: -.02em;
}
.wordmark span { color: var(--teal); }
.wordmark.small { font-size: 21px; margin-bottom: 26px; }

.eyebrow {
  font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--faint); margin: 18px 0 8px;
}

h1 { font-family: Fraunces, serif; font-size: 30px; font-weight: 600; letter-spacing: -.02em; margin: 0; }
h2 { font-family: Fraunces, serif; font-size: 22px; font-weight: 600; margin: 0 0 10px; }

/* ---------- Steuerelemente ---------- */

.btn {
  padding: 9px 15px; border-radius: 9px; font: inherit; font-size: 14px;
  background: transparent; color: var(--text);
  border: 1px solid var(--line); cursor: pointer;
  transition: border-color .15s var(--ease), background .15s var(--ease),
              transform .08s var(--ease), box-shadow .15s var(--ease), color .15s var(--ease);
}
.btn:hover { border-color: var(--line-hi); background: rgba(255,255,255,.03); }
.btn:active { transform: scale(.96); }
.btn.solid {
  background: var(--teal); color: #0E1A19; border-color: transparent; font-weight: 600;
}
.btn.solid:hover { filter: brightness(1.07); background: var(--teal); }
.btn.ghost { color: var(--dim); }
.btn.ghost:hover { color: var(--text); }
.btn.tiny { padding: 5px 11px; font-size: 12.5px; }
.btn.known { border-color: rgba(127,201,143,.45); background: rgba(127,201,143,.12); color: var(--s5); font-weight: 600; }
.btn.danger { color: var(--rose); border-color: rgba(232,106,106,.3); }
.btn.danger:hover { background: rgba(232,106,106,.1); border-color: rgba(232,106,106,.55); }
.btn:disabled { opacity: .4; cursor: default; transform: none; }

/* Eigener Sprachwähler statt der nativen Browser-Liste. */
.lang-trigger {
  display: flex; align-items: center; gap: 8px; min-width: 190px;
  padding: 9px 13px; border-radius: 9px; font: inherit; font-size: 14px; color: var(--text);
  background: rgba(0,0,0,.26); border: 1px solid var(--line); cursor: pointer;
  transition: border-color .15s var(--ease);
}
.lang-trigger:hover { border-color: var(--line-hi); }
.lang-trigger span { flex: 1; text-align: left; }
.lang-trigger svg { width: 15px; height: 15px; color: var(--faint); flex-shrink: 0; }
.lang-list { max-height: 46vh; overflow-y: auto; margin: 4px -4px 0; padding: 0 4px; }
.lang-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 10px 10px; border-radius: 9px; border: 1px solid transparent;
  background: none; color: var(--text); font: inherit; font-size: 14px; text-align: left;
  cursor: pointer; transition: background .12s var(--ease);
}
.lang-row:hover { background: rgba(255,255,255,.04); }
.lang-row.on { border-color: var(--teal); background: rgba(91,209,196,.08); }
.lang-row .wb {
  flex-shrink: 0; font-size: 10.5px; padding: 3px 8px; border-radius: 999px;
  color: var(--faint); border: 1px solid var(--line);
}
.lang-row .wb.voll { color: var(--teal); border-color: rgba(91,209,196,.4); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .nav:focus-visible {
  outline: 2px solid var(--teal); outline-offset: 2px;
}
kbd {
  font: inherit; font-size: 10.5px; opacity: .55; margin-left: 6px;
  border: 1px solid currentColor; border-radius: 4px; padding: 0 4px;
}

input, select, textarea {
  width: 100%; background: rgba(0,0,0,.26); color: var(--text);
  border: 1px solid var(--line); border-radius: 11px;
  padding: 11px 13px; font: inherit; font-size: 15px;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: var(--line-hi); }
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { resize: vertical; line-height: 1.6; }
select { width: auto; padding: 6px 10px; border-radius: 8px; font-size: 13px; }

/* Ankreuzfelder dürfen nicht wie Textfelder aussehen: mit Polsterung, eigenem
   Hintergrund und Rahmen war der Haken praktisch unsichtbar — man sah dem
   Feld nicht an, ob es an oder aus ist. */
input[type="checkbox"], input[type="radio"] {
  width: auto; padding: 0; background: none; border: none; border-radius: 0;
  accent-color: var(--teal); cursor: pointer;
  width: 15px; height: 15px; flex-shrink: 0;
}
input[type="checkbox"]:hover, input[type="radio"]:hover { border: none; }

/* Jedes Eingabefeld bekommt Luft zum nächsten — ohne das kleben Zeilen
   aneinander, egal ob im Dialog, auf der Konto- oder der Verwaltungsseite. */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
label { display: block; margin-bottom: 6px; }

.link {
  background: none; border: none; color: var(--faint); font: inherit;
  font-size: 13px; cursor: pointer; padding: 4px 0; text-align: left; text-decoration: none;
  transition: color .15s var(--ease);
}
.link:hover { color: var(--teal); }

.chip {
  padding: 7px 14px; border-radius: 9px; font: inherit; font-size: 13.5px;
  background: transparent; color: var(--dim);
  border: 1px solid var(--line); cursor: pointer;
  transition: border-color .15s var(--ease), color .15s var(--ease), background .15s var(--ease);
}
.chip:hover { border-color: var(--line-hi); color: var(--text); }
.chip.on { color: var(--teal); border-color: var(--teal); background: rgba(91,209,196,.08); }

/* ---------- Login ---------- */

.gate { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.gate-card {
  width: 100%; max-width: 340px; padding: 34px 30px;
  background: var(--glass); border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  display: flex; flex-direction: column; gap: 14px;
  animation: rise .35s var(--ease);
}
.gate-card .wordmark { margin-bottom: 2px; }
.gate-card .muted { margin: -6px 0 4px; font-size: 13.5px; }
@keyframes rise { from { transform: translateY(10px); opacity: 0 } to { transform: none; opacity: 1 } }

/* ---------- Rahmen ---------- */

#app { display: flex; min-height: 100dvh; }

#sidebar {
  width: 210px; flex-shrink: 0; padding: 24px 20px;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100dvh;
}
#sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.nav {
  position: relative; text-align: left; background: none; border: none; color: var(--dim);
  font: inherit; font-size: 15px; padding: 9px 12px 9px 16px;
  border-radius: 10px; cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%) scaleY(0);
  width: 3px; height: 16px; border-radius: 2px; background: var(--teal);
  transition: transform .18s var(--ease);
}
.nav:hover { background: rgba(255,255,255,.04); color: var(--text); }
.nav.on { background: rgba(91,209,196,.1); color: var(--teal); }
.nav.on::before { transform: translateY(-50%) scaleY(1); }
.nav-badge {
  float: right; background: var(--teal); color: #0E1A19; font-size: 11px; font-weight: 700;
  padding: 1px 6px; border-radius: 999px; line-height: 1.5;
}
.side-foot { display: flex; flex-direction: column; gap: 2px; }

.tabbar { display: none; }        /* nur am Handy, siehe Mobil-Block */

#menuBtn {
  display: none; position: fixed; top: 14px; left: 14px; z-index: 40;
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--ink2); border: 1px solid var(--line);
  color: var(--text); font-size: 20px; cursor: pointer;
}

#main { flex: 1; min-width: 0; padding: 30px 34px 90px; }
.view { display: none; max-width: 760px; margin: 0 auto; }
.view.on { display: block; }
/* Grid-lastige Ansichten (Karten statt Fließtext) dürfen die Breite nutzen,
   sonst wirken sie auf großen Screens wie eine schmale, nach rechts
   verschobene Insel neben der Sidebar. */
#view-library, #view-admin { max-width: 1180px; }

.view-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 22px;
}
.filters { margin-bottom: 18px; }
.filters input { flex: 1; min-width: 150px; }

.grid { display: grid; gap: 10px; }
#library { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); align-items: start; }
#termList { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); align-items: start; }
/* Konten-Karten bleiben einspaltig: Avatar + Meta + vier Aktionsknöpfe
   brauchen die volle Zeilenbreite, sonst wickeln die Buttons hässlich um. */

.card {
  background: var(--glass); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
  transition: border-color .18s var(--ease), background .18s var(--ease),
              box-shadow .18s var(--ease), transform .18s var(--ease);
}

.empty { padding: 34px 4px; max-width: 480px; }
.empty p { color: var(--dim); line-height: 1.7; margin: 0 0 18px; }

/* ---------- Textkarten ---------- */

.text-card { display: flex; gap: 14px; align-items: flex-start; cursor: pointer; }
.text-card:hover {
  border-color: var(--line-hi); background: var(--glass-hi);
}
.text-card .t { flex: 1; min-width: 0; }
.text-card .title { font-family: Fraunces, serif; font-size: 20px; margin-bottom: 5px; }
.text-card .meta { color: var(--faint); font-size: 13px; }
.text-card .bar { height: 3px; background: rgba(255,255,255,.07); border-radius: 2px; margin-top: 13px; overflow: hidden; }
.text-card .bar i { display: block; height: 100%; background: var(--teal); border-radius: 2px; }
.card-actions { display: flex; gap: 2px; flex-shrink: 0; }
.icon-btn {
  background: none; border: none; color: var(--faint);
  font-size: 19px; cursor: pointer; padding: 4px 6px; line-height: 1;
  border-radius: 8px; transition: color .15s var(--ease), background .15s var(--ease);
}
.icon-btn:hover { color: var(--teal); background: rgba(91,209,196,.1); }
.icon-btn.danger:hover { color: var(--rose); background: rgba(232,106,106,.1); }

/* ---------- Leser ---------- */

.reader-head {
  display: flex; align-items: center; gap: 14px;
  justify-content: space-between; margin-bottom: 6px;
}
.reader-title {
  font-family: Fraunces, serif; font-size: 19px; flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center;
}

#ttsBtn { font-size: 15px; }
#ttsBtn.on {
  color: var(--teal); border-color: rgba(91,209,196,.4); background: rgba(91,209,196,.08);
  animation: pulse 1.6s ease-in-out infinite;
}
#ttsRate { font-size: 12px; padding: 5px 8px; }

.audio {
  margin: 14px 0 4px;
  background: var(--ink2); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 14px;
}
/* Bleibt beim Mitlesen sichtbar, sonst scrollt die Steuerung weg. */
#audioBar { position: sticky; top: 8px; z-index: 20; }
.audio audio { display: none; }
#ttsRender { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.ap-main { display: flex; align-items: center; gap: 2px; margin-top: 8px; }
/* Rahmenlos und ruhig — fünf umrandete Kästchen nebeneinander wirkten wie
   ein Werkzeugkasten, nicht wie eine Wiedergabe. */
.ap-btn {
  background: none; border: none; color: var(--dim);
  width: 34px; height: 34px; padding: 0; border-radius: 9px;
  display: grid; place-items: center; cursor: pointer; flex-shrink: 0;
  transition: color .15s var(--ease), background .15s var(--ease);
}
.ap-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round; }
.ap-btn svg .fill { fill: currentColor; stroke: none; }
.ap-btn:hover { color: var(--text); background: rgba(255,255,255,.06); }
.ap-btn:active { transform: scale(.94); }
/* Der einzige Knopf, der herausstechen soll. */
.ap-btn.play {
  background: var(--teal); color: #0E1A19; width: 38px; height: 38px; margin: 0 6px;
}
.ap-btn.play:hover { background: var(--teal); filter: brightness(1.07); }
.ap-more { margin-left: auto; }

.ap-track {
  flex: 1; height: 6px; min-width: 80px; border-radius: 3px;
  background: rgba(255,255,255,.09); cursor: pointer; position: relative;
  touch-action: none;        /* sonst scrollt das Handy beim Ziehen die Seite */
}
.ap-track::after {           /* größere Trefferfläche, ohne den Balken dick zu machen */
  content: ""; position: absolute; inset: -11px 0;
}
.ap-track i { display: block; height: 100%; border-radius: 3px; background: var(--teal); }
.ap-knob {
  position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%;
  background: var(--teal); border: 2px solid var(--ink2);
  transform: translate(-50%, -50%); pointer-events: none;
  transition: transform .1s var(--ease);
}
.ap-track:hover .ap-knob { transform: translate(-50%, -50%) scale(1.15); }
/* Das laufende Wort steht vorn, der Satzzähler dahinter als Beiwerk. */
.ap-pos {
  display: flex; align-items: baseline; gap: 8px; min-width: 0; flex: 1;
  margin-left: 10px; overflow: hidden;
}
.ap-pos b {
  font-family: Newsreader, serif; font-size: 15px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ap-pos span { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; flex-shrink: 0; }

.speed { font-size: 12px; color: var(--faint); display: flex; align-items: center; gap: 7px; }
.audio-opts { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 9px; }
.speed.follow { cursor: pointer; }
.speed.follow input { margin: 0; }
.ap-hint { font-size: 12px; color: var(--s1); }
.speed-hint {
  font-size: 11px; color: var(--faint); display: inline-flex; align-items: center; gap: 5px;
}
/* Drehender Ring -- nur dort, wo es keinen Fortschrittsbalken gibt.
   flex-shrink: 0, sonst quetscht der Flex-Container ihn zum Oval. */
.speed-hint.busy::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
  border: 1.5px solid var(--faint); border-top-color: var(--teal);
  animation: speedspin .7s linear infinite;
}
@keyframes speedspin { to { transform: rotate(360deg); } }
/* Ladebalken fuers Nachschlagen/Uebersetzen. Kein echter Fortschritt (ein
   API-Aufruf hat keine Zwischenschritte) -- die Breite laeuft stattdessen in
   der Zeit hoch, die der Server aus fruehreren Anfragen erwartet (siehe
   /api/eta), gedeckelt bei 92% bis die Antwort wirklich da ist. */
.spinner {
  display: none; align-items: center; gap: 7px; font-size: 11px; color: var(--faint);
  font-weight: 400; text-transform: none; letter-spacing: 0;
}
.spinner.on { display: inline-flex; }
/* Schmaler Ladebalken -- eigenstaendig nutzbar (Dateien-Verwalten-Fenster),
   nicht nur innerhalb von .spinner. */
.bar {
  width: 46px; height: 5px; background: rgba(255,255,255,.08); border-radius: 3px;
  overflow: hidden; flex-shrink: 0; display: inline-block;
}
.bar i {
  display: block; height: 100%; width: 0%; background: var(--teal);
  transition: width linear;
}

.render-body { flex: 1; min-width: 200px; }
.render-body .progress { margin-top: 8px; }

.fingerprint { display: flex; gap: 1.5px; height: 22px; align-items: flex-end; margin: 16px 0 6px; }
.fingerprint i { flex: 1; border-radius: 1px; }

.pageinfo { color: var(--faint); font-size: 12px; letter-spacing: .04em; margin-bottom: 20px; }

#reader {
  font-family: Newsreader, Georgia, serif;
  font-size: var(--read); line-height: 1.95;
  white-space: pre-wrap; word-break: break-word;
}
#reader w {
  cursor: pointer; border-radius: 3px; padding: 1px 0;
  transition: background .1s;
}
#reader w.sel { outline: 2px solid var(--teal); outline-offset: 1px; }
#reader w.s0 { background: rgba(123,166,232,.15); box-shadow: inset 0 -2px 0 var(--s0); }
#reader w.s1 { background: rgba(240,135,30,.15); box-shadow: inset 0 -2px 0 var(--s1); }
#reader w.s2 { background: rgba(239,169,59,.14); box-shadow: inset 0 -2px 0 var(--s2); }
#reader w.s3 { background: rgba(227,199,91,.13); box-shadow: inset 0 -2px 0 var(--s3); }
#reader w.s4 { background: rgba(185,206,124,.12); box-shadow: inset 0 -2px 0 var(--s4); }
#reader w.s5 { }
#reader w.s9 { color: var(--faint); }
#reader w.phrase { border-radius: 4px; padding: 1px 2px; }

/* MUSS nach den Status-Farben stehen: gleiche Spezifität, also gewinnt die
   spätere Regel. Andersherum überdeckt die Wortfarbe die Mitlauf-Markierung
   und man sieht beim Zuhören nicht, wo man ist. */

/* Der laufende Satz: ruhig, damit er den Blick führt ohne zu blenden. */
#reader w.spoken {
  background: rgba(91,209,196,.13);
  box-shadow: inset 0 -2px 0 rgba(91,209,196,.45);
  border-radius: 3px;
}
/* Das Wort, das gerade gesprochen wird. */
#reader w.now {
  background: rgba(91,209,196,.38);
  box-shadow: inset 0 -2px 0 var(--teal);
  border-radius: 3px;
}

.reader-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-top: 38px; flex-wrap: wrap;
}
.legend { display: flex; gap: 15px; flex-wrap: wrap; margin-top: 24px; font-size: 12px; color: var(--faint); }
.legend b { display: inline-block; width: 13px; height: 13px; border-radius: 3px; margin-right: 6px; vertical-align: -2px; }

/* ---------- Wortpanel ---------- */

#panel {
  width: 340px; flex-shrink: 0; padding: 26px 22px 40px;
  border-left: 1px solid var(--line); background: rgba(0,0,0,.2);
  position: sticky; top: 0; height: 100dvh; overflow-y: auto;
}
.panel-head { padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.panel-word { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; padding-right: 26px; }
#pWord { font-family: Fraunces, serif; font-size: 27px; letter-spacing: -.02em; }
.lemma { color: var(--teal); font-size: 14px; }
.pos { color: var(--faint); font-size: 12.5px; }
.extend { margin-top: 10px; }

/* Jeder Abschnitt bekommt gleich viel Luft und eine leise Trennlinie —
   sonst verschwimmt alles zu einem einzigen ununterscheidbaren Block. */
.panel-section { padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.panel-section:last-of-type { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.panel-actions { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; }
.panel-section .eyebrow:first-child { margin-top: 0; }

/* Reservierte Mindesthöhe, damit das Panel nicht springt, sobald ein
   Hinweistext nachgeladen wird oder wieder leer ist. */
.panel-hint {
  min-height: 17px; margin-top: 6px; color: var(--dim); font-size: 12.5px; line-height: 1.5;
}
.panel-hint span:empty { display: none; }
.panel-hint span + span:not(:empty)::before { content: " · "; }

#pDe { resize: none; line-height: 1.4; }

/* Weitere Bedeutungen als antippbare Vorschläge. */
.meanings { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.meaning {
  background: rgba(255,255,255,.04); border: 1px solid var(--line); color: var(--dim);
  border-radius: 8px; padding: 6px 10px; font: inherit; font-size: 12.5px;
  cursor: pointer; text-align: left; max-width: 100%;
  transition: border-color .15s var(--ease), color .15s var(--ease);
}
.meaning:hover { border-color: var(--teal); color: var(--text); }
/* Die uebernommene Bedeutung bleibt sichtbar markiert -- Antippen ersetzt,
   deshalb ist immer hoechstens eine aktiv. */
.meaning.aktiv { border-color: var(--teal); background: rgba(91,209,196,.14); color: var(--text); }
/* Die vom Dienst empfohlene Hauptbedeutung -- immer die erste Kachel, fett,
   unabhaengig davon ob sie gerade aktiv (angetippt) ist oder eine andere. */
.meaning.primary { font-weight: 700; color: var(--text); }
.meaning.primary:not(.aktiv) { border-color: var(--line-hi); }
/* Grammatik-Hinweis (Femininum, Substantiv, ...) als eigenes kleines Badge --
   kommt seit der PONS-Geschlecht-Trennung viel haeufiger vor als frueher und
   sollte deshalb klar vom Wort selbst abgesetzt sein, nicht nur kursiv-klein
   danebenstehen. */
.meaning em {
  font-style: normal; display: inline-block; vertical-align: middle;
  color: var(--faint); font-size: 10px; line-height: 1.5; margin-left: 6px;
  padding: 1px 6px; border-radius: 999px; border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
}
.meaning.aktiv em { border-color: rgba(91,209,196,.35); color: var(--dim); }
/* Grammatisches Geschlecht auf einen Blick. */
.meaning em.mask { border-color: rgba(123,166,232,.4); background: rgba(123,166,232,.1); color: #9DBDEF; }
.meaning em.fem { border-color: rgba(232,106,106,.4); background: rgba(232,106,106,.1); color: #EC9494; }
.meaning em.neutr { border-color: var(--line-hi); background: rgba(255,255,255,.07); color: var(--dim); }
/* Wortart (Substantiv, Verb, ...) ist etwas anderes als das Geschlecht --
   bewusst schlicht gehalten, keine farbige Pille wie bei mask/fem/neutr. */
.meaning em.wortart { border-color: transparent; background: none; padding: 1px 2px; }
/* Woher die Hauptbedeutung kam -- neben "Bedeutung" in der Kopfzeile. */
.quelle {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 500; text-transform: none; letter-spacing: 0;
  color: var(--faint); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px;
}
.quelle i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
/* Ein Woerterbuch ist etwas anderes als eine Maschinenuebersetzung -- auf
   einen Blick unterscheidbar statt nur als Name. */
.quelle.q-dict  { color: var(--teal); border-color: rgba(91,209,196,.35); }
.quelle.q-mt    { color: var(--s0);   border-color: rgba(123,166,232,.35); }
.quelle.q-llm   { color: var(--s2);   border-color: rgba(239,169,59,.35); }
.quelle.q-cache { color: var(--faint); border-color: var(--line); }

/* Ergebnis in der Auswahl-Box */
.sel-toolbar #selResult { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.sel-de { font-size: 13.5px; color: var(--text); line-height: 1.4; }
.sel-de.muted, .sel-de.err { font-size: 12.5px; }
.sel-de.err { color: var(--rose); }
/* Trennt "gilt hier" von "kann sonst noch heissen" -- ohne das waehlt man
   leicht eine Bedeutung, die an dieser Stelle gar nicht passt. */
.meaning-trenner {
  width: 100%; font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--faint); margin: 8px 0 2px;
}

/* Kopfzeile der Bedeutung mit "neu nachschlagen" rechts */
.meaning-head { display: flex; align-items: center; gap: 8px; }
.meaning-head .link.mini {
  margin-left: auto; font-size: 11px; text-transform: none; letter-spacing: 0; padding: 0;
}

/* Quellenauswahl */
.sources {
  display: flex; flex-direction: column; gap: 4px; margin: 6px 0 10px;
  padding: 6px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: rgba(0,0,0,.2);
}
.source-row {
  display: flex; align-items: baseline; gap: 10px; width: 100%; text-align: left;
  padding: 7px 9px; border-radius: 7px; border: 1px solid transparent;
  background: none; color: var(--text); font: inherit; font-size: 13px; cursor: pointer;
}
.source-row:hover:not(:disabled) { background: rgba(255,255,255,.05); border-color: var(--line); }
.source-row .nm { flex-shrink: 0; font-weight: 500; }
.source-row .was {
  flex: 1; text-align: right; font-size: 11.5px; color: var(--faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.source-row.off { opacity: .45; cursor: default; }

/* Erklaerung statt Uebersetzung -- optisch bewusst kein Chip, nicht antippbar. */
.meaning-note {
  width: 100%; font-size: 12.5px; color: var(--faint); line-height: 1.4;
  padding: 6px 2px 0; border-top: 1px dashed var(--line); margin-top: 4px;
}

/* Karte, die in dieser Runde noch einmal drankommt. */
.review-progress b { color: var(--text); }
.review-progress .again { color: var(--s1); }

/* Einseitige Texte: nur der Fertig-Knopf, der braucht dann die volle Breite. */
.reader-foot.einseitig { grid-template-columns: 1fr; grid-template-areas: "done"; }

.sentence { font-family: Newsreader, serif; font-size: 16px; line-height: 1.6; color: var(--dim); }
.sentence.de { color: var(--teal); font-family: Inter, sans-serif; font-size: 14.5px; margin-top: 8px; }
#pTranslate { margin-top: 4px; }

.statusRow { display: flex; gap: 7px; margin-bottom: 10px; }
.statusRow button {
  flex: 1; padding: 13px 0; border-radius: 12px; font: inherit;
  font-size: 16px; font-weight: 600; cursor: pointer;
  transition: transform .1s var(--ease), box-shadow .15s var(--ease);
}
.statusRow button:hover { transform: translateY(-1px); }
.statusRow button:active { transform: scale(.95); }
.dicts { display: flex; gap: 12px; flex-wrap: wrap; }
.dicts a { color: var(--faint); font-size: 12.5px; text-decoration: none; border-bottom: 1px solid var(--line); transition: color .15s var(--ease); }
.dicts a:hover { color: var(--teal); }

.close {
  position: absolute; top: 16px; right: 16px;
  width: 30px; height: 30px; display: grid; place-items: center;
  background: none; border: none; color: var(--faint);
  font-size: 22px; line-height: 1; cursor: pointer; border-radius: 50%;
  transition: color .15s var(--ease), background .15s var(--ease);
}
.close:hover { color: var(--text); background: rgba(255,255,255,.06); }

/* ---------- Wortliste ---------- */

.term { display: flex; gap: 13px; align-items: stretch; padding: 13px 16px; }
.term:hover { border-color: var(--line-hi); background: var(--glass-hi); }
.term i.mark { width: 4px; border-radius: 2px; flex-shrink: 0; }
.term .body { flex: 1; min-width: 0; cursor: pointer; }
.term .t { font-family: Newsreader, serif; font-size: 18px; }
.term .de { color: var(--dim); font-size: 14px; margin-top: 2px; }
.term .mehr { color: var(--faint); font-size: 11.5px; margin-top: 2px; font-style: italic; }
.term .sent {
  color: var(--faint); font-size: 12.5px; margin-top: 5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Direkt in einer Tabellenzeile bearbeitbare Felder -- ohne eigenen Dialog
   fuer jede Kleinigkeit. Bewusst unauffaellig, bis man hineinklickt. */
.inline {
  width: 100%; padding: 5px 8px; font-size: 13.5px; border-radius: 7px;
  background: transparent; border: 1px solid transparent;
}
.inline:hover { border-color: var(--line); background: rgba(0,0,0,.2); }
.inline:focus { border-color: var(--teal); background: rgba(0,0,0,.26); }
.dash-table select { font-size: 12.5px; padding: 4px 8px; }
.dash-table .acts { white-space: nowrap; }
.btn.small { padding: 4px 9px; font-size: 12px; }

.course-block { margin-bottom: 8px; }
.course-texts { margin: 6px 0 4px 26px; display: flex; flex-direction: column; gap: 5px; }
.course-texts .order-row { padding: 6px 10px; }
.course-texts .rank { width: 18px; height: 18px; font-size: 10.5px; }
.course-texts .nm { font-size: 13px; }

/* ---------- Öffentliche Bibliothek ---------- */

.course { margin-bottom: 26px; }
.course-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.course-head h2 { margin: 0; font-size: 19px; }
.course-count { font-size: 12px; color: var(--faint); }
.course > .grid { margin-top: 12px; }
/* Schon gelesen -- zurueckgenommen, damit das Unerledigte hervorsticht. */
.text-card.done .title { color: var(--dim); }
.text-card.done .bar i { background: var(--s5); }

/* ---------- Statistik ---------- */

/* Schluessel-Wert-Zeilen, wie sie in mehreren Statistikkarten vorkommen. */
.kv { list-style: none; margin: 0; padding: 0; }
.kv li {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; color: var(--dim);
}
.kv li:last-child { border-bottom: none; }
.kv li b { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; }

/* Wortschatz-Verteilung: ein durchgehender Balken statt sechs Einzelzahlen. */
.split-bar {
  display: flex; height: 10px; border-radius: 999px; overflow: hidden;
  background: rgba(255,255,255,.06); margin-bottom: 14px;
}
.split-bar i { display: block; height: 100%; }
.split-legend { list-style: none; margin: 0; padding: 0; }
.split-legend li {
  display: flex; align-items: center; gap: 9px; padding: 4px 0; font-size: 13px; color: var(--dim);
}
.split-legend li i { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.split-legend .nm { flex: 1; }
.split-legend b { color: var(--text); font-variant-numeric: tabular-nums; }
.split-legend .pc { color: var(--faint); font-size: 11.5px; width: 34px; text-align: right; }

/* Was in den naechsten Tagen faellig wird. */
.due-bars { display: flex; align-items: flex-end; gap: 6px; height: 62px; }
.due { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; justify-content: flex-end; }
.due i { display: block; width: 100%; max-width: 22px; background: rgba(91,209,196,.45); border-radius: 3px; }
.due span { font-size: 10px; color: var(--faint); }

/* Aktivitaetskalender */
.heat { display: flex; gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.heat-col { display: flex; flex-direction: column; gap: 3px; }
.heat-cell {
  width: 11px; height: 11px; border-radius: 2.5px; display: block;
  background: rgba(255,255,255,.05);
}
.heat-cell.empty { background: none; }
.heat-cell.l1 { background: rgba(91,209,196,.22); }
.heat-cell.l2 { background: rgba(91,209,196,.42); }
.heat-cell.l3 { background: rgba(91,209,196,.66); }
.heat-cell.l4 { background: var(--teal); }
.heat-legend {
  display: flex; align-items: center; gap: 4px; margin-top: 10px;
  font-size: 11px; color: var(--faint);
}
.heat-legend span:first-child { margin-right: 3px; }
.heat-legend span:last-child { margin-left: 3px; }


/* ---------- Üben ---------- */

.review-progress { text-align: center; margin-bottom: 10px; }
.review-card { padding: 34px 28px; text-align: center; min-height: 220px; }
.review-card .pos { color: var(--faint); font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase; }
.review-word { font-family: Fraunces, serif; font-size: 34px; margin: 14px 0; }
.review-card .sentence { color: var(--dim); }
.review-translation { font-family: Newsreader, serif; font-size: 20px; color: var(--teal); margin-top: 4px; }
#reviewShowRow, #reviewGradeRow { margin-top: 18px; }
#reviewGradeRow .btn { flex: 1; }

.milestone-card { padding: 18px 20px; margin-bottom: 14px; }
.milestone-name { font-family: Fraunces, serif; font-size: 22px; margin-bottom: 4px; }
/* Die Stufenleiter traegt den Fortschritt selbst -- der Verbindungsstrich
   unter der aktuellen Stufe fuellt sich bis zur naechsten. */
.ladder { list-style: none; margin: 18px 0 0; padding: 0; }
.ladder li {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 0 0 0 24px; min-height: 34px;
  font-size: 13.5px; color: var(--faint);
}
.ladder li:last-child { min-height: 22px; }
.ladder .dot {
  position: absolute; left: 0; top: 11px;
  width: 11px; height: 11px; border-radius: 50%; box-sizing: border-box;
  border: 1.5px solid var(--line-hi); background: var(--ink2); z-index: 2;
}
/* Strich zur naechsten Stufe, mit Fuellstand */
.ladder .conn {
  position: absolute; left: 5px; top: 22px; bottom: -12px; width: 2px;
  background: var(--line); border-radius: 1px; overflow: hidden;
}
.ladder li:last-child .conn { display: none; }
.ladder .conn i { display: block; width: 100%; background: var(--teal); border-radius: 1px; }

.ladder li.done { color: var(--dim); }
.ladder li.done .dot { background: var(--teal); border-color: var(--teal); }
.ladder li.current { color: var(--text); }
.ladder li.current .nm { font-weight: 600; }
.ladder li.current .dot {
  background: var(--teal); border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(91,209,196,.16);
}
.ladder .nm { flex: 1; }
.ladder .at { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.ladder li.current .at { color: var(--dim); }

/* ---------- Verwaltung: Dashboard ---------- */

#dashSub.ok { color: var(--teal); }
#dashSub.warn { color: var(--amber, #d9a441); }

.dash-tabs {
  display: flex; gap: 4px; margin: 14px 0 18px; padding: 4px;
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius-sm);
  width: fit-content; max-width: 100%; overflow-x: auto;
}
.dash-tab {
  padding: 8px 16px; border: none; background: none; color: var(--faint);
  font-size: 13.5px; font-weight: 600; border-radius: 8px; cursor: pointer;
  white-space: nowrap; transition: background .15s var(--ease), color .15s var(--ease);
}
.dash-tab:hover { color: var(--text); }
.dash-tab.active { background: rgba(91,209,196,.14); color: var(--teal); }

.dash-panel.hidden { display: none; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }

.dash-card {
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 14px;
}
.dash-card.wide { grid-column: 1 / -1; }
.dash-card-head { margin-bottom: 14px; }
.dash-card-head h2 { font-family: Fraunces, serif; font-size: 17px; font-weight: 600; margin: 0 0 4px; }
.dash-card-head p { margin: 0; }

.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi {
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 16px 18px;
}
.kpi .n { font-family: Fraunces, serif; font-size: 30px; letter-spacing: -.02em; }
.kpi .l { color: var(--faint); font-size: 12.5px; margin-top: 3px; }

/* Dienste je Gruppe als Liste statt Kachelraster -- Name, Zweck und Status
   liegen so auf einer Zeile und sind leichter zu vergleichen. */
.svc-list { display: flex; flex-direction: column; gap: 2px; }
.svc-list li {
  display: flex; align-items: center; gap: 10px; padding: 9px 4px;
  border-bottom: 1px solid var(--line);
}
.svc-list li:last-child { border-bottom: none; }
.svc-list i {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  background: var(--faint); box-shadow: 0 0 0 3px transparent;
}
.svc-list li.on i { background: var(--teal); box-shadow: 0 0 0 3px rgba(91,209,196,.15); }
.svc-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.svc-txt b { font-size: 13.5px; font-weight: 600; }
.svc-state { font-size: 12px; color: var(--faint); flex-shrink: 0; }
.svc-list li.on .svc-state { color: var(--teal); }
.dash-card .hint { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.dash-card .hint code {
  background: rgba(255,255,255,.06); border-radius: 4px; padding: 1px 5px; font-size: 11.5px;
}

/* Wort- oder Satz-Kette, mit dem tatsaechlich aktiven Glied hervorgehoben. */
.key-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 18px; }
.chain-step {
  display: flex; align-items: center; gap: 6px; padding: 6px 12px;
  border: 1px solid var(--line); border-radius: 999px; font-size: 12.5px; color: var(--faint);
}
.chain-step i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.chain-step.ready { color: var(--dim); border-color: var(--line-hi); }
.chain-step.ready i { background: var(--dim); }
.chain-step.active { color: var(--teal); border-color: rgba(91,209,196,.4); background: rgba(91,209,196,.07); font-weight: 600; }
.chain-step.active i { background: var(--teal); box-shadow: 0 0 0 3px rgba(91,209,196,.18); }
/* Fester erster Schritt, kein umsortierbarer/abschaltbarer Dienst -- daher
   gestrichelt statt in der sonstigen bereit/aktiv-Farbgebung. */
.chain-step.fix { border-style: dashed; color: var(--faint); cursor: help; }
.chain-step.fix i { background: var(--faint); }
.chain-arrow { color: var(--faint); font-size: 12px; }

.order-list { display: flex; flex-direction: column; gap: 6px; }
.order-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--glass);
  transition: opacity .15s var(--ease);
}
.order-row.dragging { opacity: .4; }
.order-row .drag-handle {
  cursor: grab; color: var(--faint); font-size: 15px; line-height: 1;
  padding: 2px 1px; flex-shrink: 0; user-select: none;
}
.order-row .drag-handle:active { cursor: grabbing; }
.order-row .rank {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: 11px; font-weight: 600;
  background: rgba(255,255,255,.06); color: var(--faint);
}
.order-row.ready .rank { background: rgba(91,209,196,.15); color: var(--teal); }
.order-row.active .rank { background: var(--teal); color: #06231f; font-weight: 700; }
.order-row.off { opacity: .5; }
.order-row .nm small.jump { cursor: pointer; text-decoration: underline dotted; }
.order-row .nm small.jump:hover { color: var(--text); }

/* Kleiner Kippschalter zum An-/Ausschalten eines Diensts in der Kette. */
.onoff { position: relative; width: 30px; height: 18px; flex-shrink: 0; cursor: pointer; }
.onoff input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.onoff span {
  position: absolute; inset: 0; border-radius: 999px; background: rgba(255,255,255,.1);
  border: 1px solid var(--line); transition: background .15s var(--ease);
}
.onoff span::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--faint); transition: transform .15s var(--ease), background .15s var(--ease);
}
.onoff input:checked + span { background: rgba(91,209,196,.25); border-color: var(--teal); }
.onoff input:checked + span::after { transform: translateX(12px); background: var(--teal); }

.order-row .nm { flex: 1; font-size: 14px; }
.order-row .nm small { display: block; color: var(--faint); font-size: 11.5px; margin-top: 1px; }
.order-row .moves { display: flex; gap: 4px; }
.order-row .moves button {
  width: 26px; height: 26px; padding: 0; border-radius: 8px;
  background: none; border: 1px solid var(--line); color: var(--dim); cursor: pointer;
  font-size: 13px; line-height: 1; transition: border-color .15s var(--ease), color .15s var(--ease);
}
.order-row .moves button:hover:not(:disabled) { border-color: var(--line-hi); color: var(--text); }
.order-row .moves button:disabled { opacity: .3; cursor: default; }

/* PONS-Kontingent: schmaler Balken direkt am Eingabefeld, damit der Stand
   sichtbar ist bevor man ihn versehentlich aufbraucht. */
.quota { margin: 8px 0; }
.quota.hidden { display: none; }
.quota-bar { height: 4px; border-radius: 2px; background: rgba(255,255,255,.07); overflow: hidden; }
.quota-bar i { display: block; height: 100%; background: var(--teal); border-radius: 2px; transition: width .3s var(--ease); }
.quota.voll .quota-bar i { background: var(--rose); }
.quota-text { display: block; font-size: 11.5px; color: var(--faint); margin-top: 4px; }
.quota.voll .quota-text { color: var(--rose); }

/* Speicher: eigener Anteil vs. Rest des Servers, in einem Balken. */
.disk-bar {
  display: flex; height: 10px; border-radius: 5px; overflow: hidden;
  background: rgba(255,255,255,.06); margin-bottom: 12px;
}
.disk-bar i { display: block; height: 100%; }
.disk-bar i.eigen { background: var(--teal); }
.disk-bar i.fremd { background: rgba(255,255,255,.18); }
.disk-legend { display: flex; flex-wrap: wrap; gap: 16px; list-style: none; padding: 0; margin: 0; font-size: 12.5px; color: var(--faint); }
.disk-legend li { display: flex; align-items: center; gap: 6px; }
.disk-legend b { color: var(--text); font-weight: 600; }
.disk-legend i { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.disk-legend i.eigen { background: var(--teal); }
.disk-legend i.fremd { background: rgba(255,255,255,.18); }
.disk-legend i.frei { background: transparent; border: 1px solid var(--line); }

.cache-rows { display: flex; flex-direction: column; gap: 2px; }
.cache-row {
  display: flex; align-items: center; gap: 14px; padding: 11px 4px;
  border-bottom: 1px solid var(--line);
}
.cache-row:last-child { border-bottom: none; }
.cache-n {
  font-family: Fraunces, serif; font-size: 22px; width: 44px; text-align: right; flex-shrink: 0;
}
.cache-txt { flex: 1; display: flex; flex-direction: column; }
.cache-txt span { margin-top: 2px; }
.btn.small { padding: 6px 11px; font-size: 12.5px; }

/* ---------- Konten ---------- */

.table-wrap { overflow-x: auto; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.dash-table th {
  text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--faint); font-weight: 600; padding: 0 10px 10px; white-space: nowrap;
}
.dash-table th.num, .dash-table td.num { text-align: right; }
.dash-table td { padding: 11px 10px; border-top: 1px solid var(--line); vertical-align: middle; }
.dash-table tr.off { opacity: .55; }
.dash-table td.who { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.dash-table .avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-family: Fraunces, serif; font-size: 13px;
  background: rgba(91,209,196,.12); color: var(--teal); border: 1px solid rgba(91,209,196,.25);
}
.dash-table tr.off .avatar { background: rgba(255,255,255,.05); color: var(--faint); border-color: var(--line); }
.dash-table td.acts { white-space: nowrap; text-align: right; }
.dash-table td.acts .btn { margin-left: 5px; }
.badge { font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  border-radius: 999px; padding: 2px 8px; margin-left: 7px; vertical-align: 2px; }
.badge.admin { color: var(--teal); border: 1px solid rgba(91,209,196,.4); }
.badge.off { color: var(--rose); border: 1px solid rgba(232,106,106,.35); }
.badge.you { color: var(--dim); border: 1px solid var(--line); }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { padding: 18px; }
.stat .n { font-family: Fraunces, serif; font-size: 32px; letter-spacing: -.02em; }
.stat .l { color: var(--faint); font-size: 12.5px; margin-top: 3px; }
.chart-card { padding: 20px; }
#chart svg { width: 100%; height: 160px; display: block; }

/* ---------- Dialog & Toast ---------- */

.modal {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center;
  padding: 18px; background: rgba(8,7,12,.65); backdrop-filter: blur(3px);
  animation: fade .15s var(--ease);
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

/* Schwebende Box beim Markieren von Text mit der Maus -- eigene Uebersetzung
   fuer einen frei gewaehlten Ausschnitt, unabhaengig vom Wort-Panel. */
.sel-toolbar {
  position: fixed; z-index: 70; display: flex; align-items: center; gap: 8px;
  max-width: min(320px, 90vw); padding: 7px 8px 7px 10px;
  background: var(--ink2); border: 1px solid var(--line-hi); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md); animation: rise .15s var(--ease);
}
.sel-toolbar.hidden { display: none; }
.sel-close {
  background: none; border: none; color: var(--faint); cursor: pointer;
  font-size: 16px; line-height: 1; padding: 0 2px; margin-left: 2px;
}
.sel-close:hover { color: var(--text); }
.modal-card {
  position: relative; width: 100%; max-width: 560px;
  background: var(--ink2); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 26px 24px; max-height: 88dvh; overflow-y: auto;
  box-shadow: var(--shadow-md);
  animation: rise .2s var(--ease);
}
.checkline { display: flex; gap: 9px; align-items: flex-start; margin: -4px 0 16px;
  color: var(--dim); font-size: 13.5px; line-height: 1.45; cursor: pointer; }
.checkline input { width: auto; margin: 2px 0 0; flex-shrink: 0; }
.note { border-left: 2px solid var(--teal); padding-left: 11px; margin: 10px 0 14px; }
.checkline b { color: var(--text); font-weight: 600; }
.checkline.off { opacity: .5; }
.hintline { font-size: 12px; color: var(--faint); margin-top: 4px; }
.here-toggle {
  display: flex; gap: 7px; align-items: flex-start; margin: 8px 0 0;
  color: var(--faint); font-size: 12px; line-height: 1.4; cursor: pointer;
}
.here-toggle input { width: auto; margin: 2px 0 0; flex-shrink: 0; }
.here-toggle:has(input:checked) { color: var(--teal); }
#pAlle { margin-top: 8px; }
#pAlle .meaning { cursor: pointer; }
.progress { height: 6px; background: rgba(255,255,255,.08); border-radius: 3px;
  overflow: hidden; margin: 12px 0 10px; }
.progress i { display: block; height: 100%; background: var(--teal);
  transition: width .4s ease; }

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--ink2); border: 1px solid var(--line);
  padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 80;
  box-shadow: var(--shadow-md);
  animation: toast-in .2s var(--ease);
}
@keyframes toast-in { from { transform: translate(-50%, 8px); opacity: 0 } to { transform: translate(-50%, 0); opacity: 1 } }

/* ---------- Mobil ---------- */

/* Am Handy hat die Sanduhr andere Regeln: Finger statt Mauszeiger (also
   mindestens ~44px Trefferfläche), wenig Höhe (also keine Steuerung, die den
   halben Text verdeckt) und keine Tastatur (also Gesten). */
@media (max-width: 900px) {
  /* Oben bleibt frei — navigiert wird unten. Unten Platz für Tab-Leiste und,
     wenn eine Tonspur da ist, zusätzlich für den Player. */
  #main { padding: calc(18px + env(safe-area-inset-top)) 18px calc(var(--tabbar-h) + 26px + env(safe-area-inset-bottom)); }
  body.has-player #main { padding-bottom: calc(var(--tabbar-h) + 94px + env(safe-area-inset-bottom)); }

  #sidebar {
    position: fixed; z-index: 60; left: 0; top: 0;
    width: 264px; background: var(--ink2); transform: translateX(-100%);
    transition: transform .24s var(--ease);
    padding-top: calc(22px + env(safe-area-inset-top));
  }
  #sidebar.open { transform: none; }
  .drawer-back {
    position: fixed; inset: 0; z-index: 59;
    background: rgba(8,7,12,.55); animation: fade .18s var(--ease);
  }
  #menuBtn { display: none; }      /* ersetzt durch "Mehr" in der Tab-Leiste */
  /* Menüpunkte als richtige Zeilen, nicht als Textlinks. */
  #sidebar nav { gap: 4px; }
  .nav { padding: 13px 14px 13px 18px; font-size: 16px; }
  .side-foot .link { padding: 10px 0; font-size: 15px; }

  h1 { font-size: 25px; }
  .reader-title { display: none; }

  /* Kopfzeile im Reader lief sich vorher selbst um: "← Texte" brach in zwei
     Zeilen um, A−/A+ schoben sich darunter. */
  .reader-head { flex-wrap: nowrap; }
  .reader-head .btn { white-space: nowrap; padding: 9px 12px; flex-shrink: 0; }
  .reader-head .row { flex-wrap: nowrap; gap: 6px; }

  /* Wörter antippen ist die Hauptinteraktion beim Lesen — kurze Wörter wie
     "di" oder "e" wären sonst kaum zu treffen. */
  #reader { line-height: 2.35; }
  #reader w { padding: 5px 2px; margin: -5px -2px; }

  /* --- Tab-Leiste unten, Tonspur direkt darüber ---
     Oben lag der Player vorher unter dem Menüknopf und hat sich mit ihm
     überlagert. Unten ist ohnehin die Ecke, die der Daumen erreicht. */
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 58;
    background: var(--ink2); border-top: 1px solid var(--line);
    /* Feste Höhe, damit der Player exakt daran andocken kann. */
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tab {
    flex: 1; position: relative; background: none; border: none; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; padding: 0 2px; font: inherit; font-size: 10.5px; color: var(--faint);
    transition: color .15s var(--ease);
  }
  .tab .tab-ico { font-size: 16px; line-height: 1; }
  .tab.on { color: var(--teal); }
  .tab-badge {
    position: absolute; top: 6px; left: 50%; margin-left: 6px;
    width: 7px; height: 7px; border-radius: 50%; background: var(--teal);
  }

  #audioBar {
    position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    top: auto; margin: 0; z-index: 57;
    border: none; border-top: 1px solid var(--line);
    border-radius: 0; padding: 0 12px 8px;
    background: color-mix(in srgb, var(--ink2) 94%, transparent);
    backdrop-filter: blur(10px);
  }
  /* Der Fortschritt sitzt als feine Linie an der Oberkante der Leiste. */
  .ap-track { height: 4px; margin: 0 -12px 2px; border-radius: 0; }
  .ap-track i { border-radius: 0; }
  .ap-track::after { inset: -13px 0; }
  .ap-knob { width: 14px; height: 14px; border-width: 2px; }
  .ap-main { gap: 0; margin-top: 4px; }
  .ap-btn { width: 44px; height: 44px; }
  .ap-btn.play { width: 46px; height: 46px; margin: 0 4px; }
  .ap-btn svg { width: 22px; height: 22px; }
  .ap-pos { margin-left: 8px; }
  .ap-pos b { font-size: 14px; }
  /* Tempo, Mitlaufen & Co. verstecken sich hinter dem ⋯ — sie kosten sonst
     eine ganze Zeile, die beim Lesen fehlt. */
  .audio-opts { display: none; margin-top: 8px; padding-bottom: 4px; }
  .audio-opts.open { display: flex; }

  /* --- Wortpanel als Blatt von unten --- */
  #panel {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    width: auto; height: auto; max-height: 76dvh;
    display: flex; flex-direction: column;
    border-left: none; border-top: 1px solid var(--line);
    border-radius: 20px 20px 0 0; background: var(--ink2);
    animation: up .22s var(--ease); z-index: 65;
    padding: 14px 16px 0; overflow: hidden;
  }
  #panel::before {           /* Griff, damit es als Blatt erkennbar ist */
    content: ""; position: absolute; top: 7px; left: 50%; transform: translateX(-50%);
    width: 36px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.16);
  }
  .panel-head { padding: 8px 0 12px; margin-bottom: 0; }
  .panel-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-top: 12px; }
  .panel-section { padding-bottom: 12px; margin-bottom: 12px; }
  #pWord { font-size: 22px; }
  /* Das Einstufen bleibt immer sichtbar — dafür soll niemand scrollen. */
  .panel-actions {
    border-top: 1px solid var(--line); background: var(--ink2);
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  }
  .statusRow button { padding: 15px 0; }
  .panel-actions .btn { padding: 13px 15px; }
  .extend .btn { padding: 8px 12px; }

  /* --- Blättern --- */
  .reader-foot {
    display: grid; grid-template-columns: 1fr 1fr; grid-template-areas: "prev next" "done done";
  }
  #prevPage { grid-area: prev; }
  #nextPage { grid-area: next; }
  #pageDone { grid-area: done; }
  .reader-foot .btn { padding: 13px 15px; }

  /* --- Dialoge als Blatt, statt mittig zu schweben --- */
  .modal { padding: 0; align-items: flex-end; }
  .modal-card {
    max-height: 88dvh; width: 100%; border-radius: 20px 20px 0 0;
    padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
  }

  /* Karten und Listen: mehr Fläche zum Tippen. */
  .icon-btn { padding: 9px 10px; }
  .term { padding: 15px 16px; }
  .chip { padding: 9px 15px; }
}

/* Ganz schmale Geräte: Beschriftungen dürfen weichen, Knöpfe nicht. */
@media (max-width: 380px) {
  #main { padding-left: 14px; padding-right: 14px; }
  .ap-btn { min-width: 40px; }
  .ap-btn.play { min-width: 50px; }
  .reader-head .btn { padding: 9px 10px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Konto & Verwaltung ---------- */

.whoami { font-size: 12.5px; color: var(--dim); margin-bottom: 8px; }
.whoami b { color: var(--text); font-weight: 600; }
.whoami .tag { font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--teal); border: 1px solid rgba(91,209,196,.35);
  border-radius: 999px; padding: 1px 7px; margin-left: 6px; }



/* ---------- Untertitel-Auswahl ---------- */

.tracks { display: grid; gap: 7px; margin: 4px 0 16px; }
.track { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.track:hover { border-color: rgba(255,255,255,.2); }
.track.on { border-color: var(--teal); background: rgba(91,209,196,.07); }
.track input { width: auto; margin: 3px 0 0; flex-shrink: 0; }
.track .lbl { font-size: 14px; }
.track .meta { color: var(--faint); font-size: 12.5px; margin-top: 2px; }
.track .best { color: var(--s5); }
.track.disabled { opacity: .45; cursor: default; }


/* ============================================================
   Gestaltungsebene
   ------------------------------------------------------------
   Alles hier ist Schmuck: Licht, Bewegung, Tiefe. Es sitzt am
   Dateiende, damit man es im Zweifel am Stueck herausnehmen kann,
   ohne dass die App ihr Verhalten aendert.

   Zwei Regeln, an die sich der ganze Block haelt:
   1. Der Lesetext bleibt still. Wer liest, will keine Bewegung
      unter den Woertern -- und beim Mitlaufen der Tonspur wuerde
      jede Transformation mit dem Scrollen kollidieren.
   2. Nichts hier darf Klicks abfangen. Jede dekorative Schicht
      traegt pointer-events: none.
   ============================================================ */

:root {
  --tief: 0 30px 60px -30px rgba(0,0,0,.75);
  --sheen: linear-gradient(120deg, transparent 20%, rgba(255,255,255,.14) 48%, transparent 72%);
}

/* ---------- Ambient: Nordlicht + Korn ----------
   Drei sehr weich gezeichnete Farbfelder, die langsam gegeneinander
   wandern. Kein Bild, keine Datei -- nur Verlaeufe, also 0 Byte
   Ladezeit und beliebig scharf auf jedem Bildschirm. */

#aurora {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  contain: strict;
}
#aurora i {
  position: absolute; display: block; border-radius: 50%;
  filter: blur(90px); opacity: .5;
  will-change: transform;
}
#aurora i:nth-child(1) {
  width: 46vw; height: 46vw; min-width: 380px; min-height: 380px;
  left: -10vw; top: -14vw;
  background: radial-gradient(circle, rgba(91,209,196,.34), transparent 68%);
  animation: drift-a 34s var(--ease) infinite alternate;
}
#aurora i:nth-child(2) {
  width: 40vw; height: 40vw; min-width: 320px; min-height: 320px;
  right: -12vw; top: 18vh;
  background: radial-gradient(circle, rgba(123,166,232,.26), transparent 68%);
  animation: drift-b 44s var(--ease) infinite alternate;
}
#aurora i:nth-child(3) {
  width: 38vw; height: 38vw; min-width: 300px; min-height: 300px;
  left: 28vw; bottom: -18vw;
  background: radial-gradient(circle, rgba(240,135,30,.15), transparent 68%);
  animation: drift-c 52s var(--ease) infinite alternate;
}
@keyframes drift-a { to { transform: translate3d(9vw, 7vh, 0) scale(1.18) } }
@keyframes drift-b { to { transform: translate3d(-8vw, -6vh, 0) scale(.86) } }
@keyframes drift-c { to { transform: translate3d(6vw, -9vh, 0) scale(1.12) } }

/* Feines Filmkorn darueber. Bricht die Verlaeufe auf, sodass keine
   Farbstreifen entstehen -- das Muster kommt aus einem SVG-Rauschen,
   ebenfalls ohne externe Datei. */
.grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: .028; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Inhalt liegt ueber dem Licht. */
#app, #login { position: relative; z-index: 1; }
#sidebar { background: rgba(19,18,26,.55); backdrop-filter: blur(14px); z-index: 2; }

body.liest #aurora { opacity: .3; }
body.liest #aurora i { animation-play-state: paused; }
#aurora { transition: opacity .6s var(--ease); }

/* ---------- Anmeldung ----------
   Die erste Sekunde der App. Karte kommt mit leichter Tiefe herein,
   die Felder gestaffelt hinterher. */

.gate-card {
  position: relative;
  background: linear-gradient(160deg, rgba(255,255,255,.07), rgba(255,255,255,.028));
  backdrop-filter: blur(20px);
  box-shadow: var(--tief), inset 0 1px 0 rgba(255,255,255,.09);
  animation: gate-in .6s var(--ease) both;
}
@keyframes gate-in {
  from { opacity: 0; transform: perspective(900px) rotateX(7deg) translateY(22px) scale(.97) }
  to   { opacity: 1; transform: none }
}
/* Leuchtender Rand, der einmal langsam herumwandert. */
.gate-card::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit;
  padding: 1px; pointer-events: none;
  background: conic-gradient(from var(--dreh, 0deg),
    transparent 0 62%, rgba(91,209,196,.55) 78%, transparent 92%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: kante 9s linear infinite;
}
@property --dreh { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
@keyframes kante { to { --dreh: 360deg } }

.gate-card > * { animation: auf .5s var(--ease) both; }
.gate-card > *:nth-child(1) { animation-delay: .06s }
.gate-card > *:nth-child(2) { animation-delay: .11s }
.gate-card > *:nth-child(3) { animation-delay: .16s }
.gate-card > *:nth-child(4) { animation-delay: .21s }
.gate-card > *:nth-child(5) { animation-delay: .26s }
.gate-card > *:nth-child(6) { animation-delay: .31s }
@keyframes auf { from { opacity: 0; transform: translateY(9px) } to { opacity: 1; transform: none } }

.gate .wordmark { font-size: 30px; }
.gate .wordmark span {
  display: inline-block;
  animation: punkt 2.6s var(--ease) infinite;
}
@keyframes punkt { 0%, 72%, 100% { transform: none } 80% { transform: translateY(-4px) } }

/* ---------- Ansichtswechsel ----------
   Kein Umblaettern, kein Wischen: nur ein kurzes Aufsteigen, damit
   der Wechsel spuerbar ist, ohne dass man darauf wartet. */

.view.on { animation: view-in .34s var(--ease) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }
/* Der Leser ist ausgenommen -- dort soll der Text sofort und ruhig stehen. */
#view-reader.on { animation: fade .18s var(--ease) both; }

/* ---------- Beim Scrollen einblenden ----------
   Wird von der Seitenlogik gesetzt (IntersectionObserver). Ohne
   Skript bleibt alles sichtbar: die Grundstellung ist "sichtbar",
   .reveal wird erst vom Skript vergeben. */

/* Derselbe Auftritt wie bei den scrollgekoppelten Szenen -- Tiefe, Neigung,
   Groesse, Unschaerfe --, nur zeitgesteuert. Damit sieht eine Seite, die zu
   kurz zum Scrollen ist, genauso aus; die Bewegung haengt dort eben an der
   Uhr statt am Scrollrad. */
.reveal {
  opacity: 0;
  transform: perspective(1200px) translateY(56px) translateZ(-170px) rotateX(10deg);
  scale: .9;
  filter: blur(11px);
}
.reveal.in {
  opacity: 1; transform: perspective(1200px); scale: 1; filter: blur(0);
  transition: opacity .6s var(--ease), transform .75s var(--ease),
              scale .75s var(--ease), filter .6s var(--ease);
  transition-delay: var(--verzug, 0s);
}
@media (max-width: 700px) {
  .reveal { transform: translateY(34px); scale: .94; filter: none; }
  .reveal.in { transform: none; }
}

/* ---------- Karten: Tiefe und Neigung ---------- */

.card {
  position: relative;
  background: linear-gradient(158deg, rgba(255,255,255,.055), rgba(255,255,255,.022));
}
.card:hover { box-shadow: var(--shadow-md); }

/* Die Neigung folgt dem Mauszeiger; die Werte setzt die Seitenlogik als
   Variablen. Nur mit echtem Zeiger -- am Handy waere das nur Ruckeln. */
@media (hover: hover) and (pointer: fine) {
  .text-card {
    transform-style: preserve-3d;
    transform: perspective(820px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
    transition: transform .25s var(--ease), border-color .18s var(--ease),
                background .18s var(--ease), box-shadow .25s var(--ease);
  }
  .text-card.neigt { transition-duration: .06s, .18s, .18s, .25s; }
  .text-card:hover {
    box-shadow: 0 26px 44px -26px rgba(0,0,0,.85), 0 0 0 1px rgba(255,255,255,.05);
  }
  /* Lichtschein, der dem Zeiger folgt. */
  .text-card::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit;
    pointer-events: none; opacity: 0; transition: opacity .3s var(--ease);
    background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 50%),
                                rgba(255,255,255,.10), transparent 62%);
  }
  .text-card:hover::after { opacity: 1; }
}

/* Inhalt der Karte hebt sich beim Neigen minimal ab -- das ist der
   Unterschied zwischen "gedrehtes Bild" und "echter Gegenstand". */
.text-card .t, .text-card .cover, .text-card .card-actions { transform: translateZ(18px); }

/* ---------- Titelbild ----------
   Jeder Text bekommt ein eigenes Deckblatt, berechnet aus seinem Titel.
   Derselbe Titel ergibt immer dieselbe Farbe, also erkennt man Texte
   in der Liste wieder. Keine Bilddatei, kein fremder Server. */

.cover {
  flex-shrink: 0; width: 56px; height: 56px; border-radius: 13px;
  position: relative; overflow: hidden; display: grid; place-items: center;
  background:
    radial-gradient(120% 120% at 18% 12%, hsl(var(--h) 64% 60% / .95), transparent 60%),
    radial-gradient(130% 130% at 88% 92%, hsl(calc(var(--h) + 46) 68% 52% / .9), transparent 58%),
    linear-gradient(152deg, hsl(var(--h) 32% 24%), hsl(calc(var(--h) + 40) 36% 13%));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12),
              0 8px 18px -10px hsl(var(--h) 60% 28% / .9);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
/* Diagonale Faserung, damit die Flaeche nicht flach wirkt. */
.cover::before {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(115deg,
    rgba(255,255,255,.07) 0 1px, transparent 1px 7px);
  mix-blend-mode: overlay;
}
/* Glanzstreifen, der beim Zeigen einmal darueberzieht. */
.cover::after {
  content: ""; position: absolute; inset: -40%;
  background: var(--sheen); transform: translateX(-120%);
}
.text-card:hover .cover::after { animation: glanz .85s var(--ease); }
@keyframes glanz { to { transform: translateX(120%) } }
.text-card:hover .cover { transform: translateZ(30px) scale(1.05); }

.cover b {
  position: relative; z-index: 1;
  font-family: Fraunces, Georgia, serif; font-size: 25px; font-weight: 600;
  color: rgba(255,255,255,.94); text-shadow: 0 2px 8px rgba(0,0,0,.45);
}
/* Gelesene Texte tragen einen Haken statt des Anfangsbuchstabens. */
.cover.fertig b { font-size: 0; }
.cover.fertig::before {
  background: rgba(12,14,13,.5);
}
.cover.fertig b::after {
  content: "✓"; font-size: 26px; font-family: Inter, system-ui, sans-serif;
  color: var(--s5); text-shadow: 0 2px 10px rgba(0,0,0,.6);
}

/* Fortschrittsbalken auf der Karte laeuft von null los, sobald die
   Karte sichtbar wird -- man sieht, wie weit man gekommen ist. */
.text-card .bar i { transition: width .9s var(--ease) .15s; }

/* ---------- Knoepfe: Licht beim Beruehren ---------- */

.btn { position: relative; overflow: hidden; }
.btn.solid::after {
  content: ""; position: absolute; inset: 0;
  background: var(--sheen); transform: translateX(-130%);
}
.btn.solid:hover::after { animation: glanz .7s var(--ease); }
.btn.solid {
  box-shadow: 0 6px 18px -8px rgba(91,209,196,.6);
}
.btn.solid:hover { box-shadow: 0 10px 24px -8px rgba(91,209,196,.75); }

.nav { overflow: hidden; }
.nav::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(90deg, rgba(91,209,196,.14), transparent 70%);
  opacity: 0; transition: opacity .2s var(--ease); pointer-events: none;
}
.nav.on::after { opacity: 1; }
/* Der Zaehler steht still. Er pocht nur, wenn ihm die Seitenlogik einmal
   .merk gibt -- kurz nach dem Laden, genau zweimal. Eine Endlosschleife im
   Blickfeld ist kein Hinweis mehr, sondern Druck: sie sagt bei jedem Blick
   dasselbe, und man gewoehnt sich an, sie zu uebersehen. */
.nav-badge.merk { animation: pochen .9s var(--ease) 2; }
@keyframes pochen {
  0%, 100% { transform: none; box-shadow: none }
  45% { transform: scale(1.2); box-shadow: 0 0 0 6px rgba(91,209,196,.18) }
}

/* Rueckmeldung mit Knopf. */
.toast.mit-aktion { display: flex; align-items: center; gap: 14px; padding-right: 6px; }
.toast-tun {
  background: var(--teal); color: #0E1A19; border: none; font: inherit;
  font-size: 13px; font-weight: 600; padding: 5px 13px; border-radius: 999px;
  cursor: pointer; flex-shrink: 0;
}
.toast-tun:hover { filter: brightness(1.08); }

/* ---------- Kennzahlen ---------- */

.kpi {
  position: relative; overflow: hidden;
  background: linear-gradient(158deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  transition: transform .25s var(--ease), border-color .25s var(--ease);
}
.kpi::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(91,209,196,.5), transparent);
  opacity: .7;
}
.kpi:hover { transform: translateY(-3px); border-color: var(--line-hi); }
.kpi .n {
  background: linear-gradient(150deg, var(--text), var(--teal));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-variant-numeric: tabular-nums;
}

/* ---------- Diagramm: Linie zeichnet sich ---------- */

#chart svg path[stroke] {
  stroke-dasharray: var(--laenge, 1200); stroke-dashoffset: var(--laenge, 1200);
  animation: zeichnen 1.5s var(--ease) .2s forwards;
  filter: drop-shadow(0 3px 8px rgba(91,209,196,.35));
}
@keyframes zeichnen { to { stroke-dashoffset: 0 } }
#chart svg path[fill]:not([stroke]) { animation: fade .9s var(--ease) .6s both; }

/* ---------- Kalender: Zellen kommen wellenfoermig ---------- */

.heat-cell { animation: zelle .3s var(--ease) both; animation-delay: var(--verzug, 0s); }
@keyframes zelle { from { opacity: 0; transform: scale(.4) } to { opacity: 1; transform: none } }
.heat-cell:not(.empty):hover { outline: 1px solid var(--teal); outline-offset: 1px; }

/* ---------- Stufenleiter ---------- */

.ladder li.current .dot {
  animation: puls 2.6s var(--ease) infinite;
}
@keyframes puls {
  0%, 70%, 100% { box-shadow: 0 0 0 0 rgba(91,209,196,.45) }
  85% { box-shadow: 0 0 0 7px rgba(91,209,196,0) }
}
.ladder .conn i { transition: height 1.1s var(--ease) .3s; }

/* ---------- Wortpanel gleitet herein ---------- */

#panel:not(.hidden) { animation: panel-in .28s var(--ease) both; }
@keyframes panel-in { from { opacity: 0; transform: translateX(16px) } to { opacity: 1; transform: none } }

/* ---------- Abschnitte in der Bibliothek ---------- */

.course-head h2 { position: relative; display: inline-block; }
.course-head h2::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -5px; height: 2px;
  border-radius: 2px; background: linear-gradient(90deg, var(--teal), transparent);
  transform: scaleX(0); transform-origin: left;
  transition: transform .6s var(--ease);
}
.course.sichtbar .course-head h2::after { transform: scaleX(1); }

/* ---------- Leerer Zustand bekommt ein Motiv ---------- */

.empty { position: relative; }
.empty::before {
  content: ""; position: absolute; right: 0; top: -20px; width: 190px; height: 190px;
  pointer-events: none; opacity: .5;
  background:
    radial-gradient(circle at 50% 50%, rgba(91,209,196,.16), transparent 62%),
    repeating-radial-gradient(circle at 50% 50%,
      transparent 0 15px, rgba(255,255,255,.045) 15px 16px);
  animation: atmen 11s var(--ease) infinite alternate;
}
@keyframes atmen { to { transform: scale(1.14) rotate(8deg); opacity: .28 } }

/* ---------- Dialoge mit Tiefe ---------- */

.modal-card {
  animation: modal-in .3s var(--ease) both;
  box-shadow: var(--tief), inset 0 1px 0 rgba(255,255,255,.07);
}
@keyframes modal-in {
  from { opacity: 0; transform: perspective(900px) rotateX(5deg) translateY(16px) scale(.97) }
  to   { opacity: 1; transform: none }
}
.toast { box-shadow: var(--tief); backdrop-filter: blur(10px); }

/* ============================================================
   Ruhige Darstellung
   ------------------------------------------------------------
   Greift, wenn im Betriebssystem "Bewegung reduzieren" gesetzt ist
   ODER man es im Konto selbst gewaehlt hat. Die Seitenlogik setzt
   dafuer .ruhig auf <html>.

   Farbwechsel bleiben -- die verwirren niemanden und man braucht
   sie, um zu sehen, worauf man gerade zeigt. Weg sind: alles, was
   sich dauerhaft bewegt, und alles, was den Blick verschiebt.
   ============================================================ */

html.ruhig *, html.ruhig *::before, html.ruhig *::after {
  animation: none !important;
  transition-duration: .12s !important;
  transition-delay: 0s !important;
}
html.ruhig #aurora, html.ruhig .grain, html.ruhig .empty::before { display: none; }
html.ruhig .reveal { opacity: 1 !important; transform: none !important; }
html.ruhig .text-card { transform: none !important; }
html.ruhig .text-card::after, html.ruhig .btn.solid::after { display: none; }
html.ruhig .text-card .t, html.ruhig .text-card .cover,
html.ruhig .text-card .card-actions { transform: none; }
html.ruhig #chart svg path[stroke] { stroke-dasharray: none; stroke-dashoffset: 0; }
html.ruhig .course-head h2::after { transform: scaleX(1); }
/* Der Wartekreis muss sich weiter drehen -- er sagt "es passiert etwas",
   das ist keine Zierde. */
html.ruhig .speed-hint.busy::before {
  animation: speedspin .7s linear infinite !important;
}

/* Am Handy faellt das Deckblatt kleiner aus: dort konkurriert es mit dem
   Titel um eine schmale Zeile, und ein umbrechender Titel kostet mehr
   Lesbarkeit als ein grosses Bildchen einbringt. */
@media (max-width: 560px) {
  .cover { width: 46px; height: 46px; border-radius: 11px; }
  .cover b { font-size: 21px; }
  .cover.fertig b::after { font-size: 22px; }
  /* Das Motiv im leeren Zustand wuerde sonst unter dem Knopf liegen. */
  .empty::before { width: 130px; height: 130px; opacity: .3; }
}


/* ============================================================
   Szenen -- scrollgekoppelte Inszenierung
   ------------------------------------------------------------
   Der Unterschied zur Ebene darueber: dort loest das Scrollen eine
   Animation aus, die dann von allein ablaeuft. Hier haengt jeder
   Zwischenschritt an der Scroll-Position. Man dreht am Rad und das
   Bild dreht sich mit, vorwaerts wie rueckwaerts. Das ist der
   Unterschied zwischen "es bewegt sich" und "es wirkt teuer".

   Technisch: animation-timeline. Der Browser rechnet das abseits des
   Hauptstrangs -- es ruckelt also auch dann nicht, wenn nebenher ein
   Text uebersetzt wird.

   Wichtig fuer alles hier: transform, translate und scale sind drei
   getrennte Eigenschaften. Das wird konsequent ausgenutzt, damit sich
   Drift, Zeigerbewegung, Parallaxe und Tiefe nicht gegenseitig
   ueberschreiben -- jede Bewegung bekommt ihre eigene Spur.
   ============================================================ */

/* ---------- Kopfbild der Fortschrittsseite ---------- */

.held {
  position: relative;
  /* Der Ueberhang ist der Scrollweg, auf dem das Kopfbild stehen bleibt,
     waehrend der Rest darunter durchzieht. */
  min-height: 74vh;
  view-timeline: --held block;
  margin-bottom: 6px;
}
.held-fest {
  position: sticky; top: 0;
  min-height: 48vh; display: flex; flex-direction: column;
  align-items: flex-start; justify-content: center; gap: 2px;
}
.held-zahl {
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(74px, 15vw, 172px); line-height: .9;
  letter-spacing: -.045em; font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(152deg, var(--text) 6%, var(--teal) 58%, var(--s0) 104%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 16px 44px rgba(91,209,196,.22));
}
.held-wort { font-size: 18px; color: var(--dim); }
.held-unter { font-size: 13.5px; color: var(--faint); margin-top: 10px; }
/* Lichtkegel hinter der Zahl. */
.held-fest::before {
  content: ""; position: absolute; left: -16%; top: 0;
  width: 66%; aspect-ratio: 1; pointer-events: none; z-index: -1;
  background: radial-gradient(circle, rgba(91,209,196,.17), transparent 66%);
  filter: blur(30px);
}
@media (max-width: 700px) {
  .held { min-height: 58vh; }
  .held-fest { min-height: 36vh; }
  .held-zahl { font-size: clamp(56px, 21vw, 104px); }
}

/* ---------- Fortschrittslinie am oberen Rand ---------- */

#scrollbalken {
  display: none;
  position: fixed; left: 0; top: 0; height: 2px; width: 100%; z-index: 90;
  transform-origin: 0 50%; pointer-events: none;
  background: linear-gradient(90deg, var(--teal), var(--s0));
}

/* ============================================================ */

@supports (animation-timeline: view()) {

  /* --- Grundfigur ---
     Vier Ebenen gleichzeitig: Tiefe, Neigung, Groesse, Unschaerfe.
     Die Unschaerfe ist das, was den Eindruck einer Linse erzeugt
     statt eines Bildschirms, auf dem etwas eingeblendet wird. */
  .szene {
    animation: szene-rein linear both;
    animation-timeline: view();
    animation-range: entry 2% cover 34%;
    transform-origin: 50% 100%;
  }
  @keyframes szene-rein {
    from {
      opacity: 0;
      transform: perspective(1400px) translateY(78px) translateZ(-200px) rotateX(10deg);
      scale: .89;
      filter: blur(13px);
    }
    to { opacity: 1; transform: perspective(1400px); scale: 1; filter: blur(0); }
  }

  /* --- Textkarten ---
     Staerker geneigt als eine Statistikkachel: eine Textkarte ist ein
     Gegenstand, den man aufhebt, keine Flaeche. */
  .text-card.szene {
    animation-name: karte-rein;
    animation-range: entry 0% cover 30%;
  }
  @keyframes karte-rein {
    from {
      opacity: 0;
      transform: perspective(1100px) translateY(66px) translateZ(-240px) rotateX(14deg) rotateZ(-1.5deg);
      scale: .87;
      filter: blur(11px);
    }
    to { opacity: 1; transform: perspective(1100px); scale: 1; filter: blur(0); }
  }

  /* --- Parallaxe auf dem Deckblatt ---
     Bewusst ueber translate statt transform: transform traegt schon die
     Tiefe (translateZ) aus der Ebene darueber, und die soll erhalten
     bleiben. Zwei Dinge, die sich verschieden schnell bewegen, liest
     das Auge als zwei verschiedene Entfernungen. */
  .text-card .cover {
    animation: cover-parallaxe linear both;
    animation-timeline: view();
    animation-range: cover 0% cover 100%;
  }
  @keyframes cover-parallaxe {
    from { translate: 0 10px; }
    to   { translate: 0 -10px; }
  }

  /* --- Ueberschriften setzen sich Wort fuer Wort zusammen ---
     --i ist die Wortnummer. Bei einer Zeitachse waere das eine
     Verzoegerung; hier verschiebt es den Abschnitt des Scrollwegs,
     auf dem das Wort auftaucht. */
  .wort-auf > i {
    display: inline-block; font-style: normal; white-space: pre;
    animation: wort-rein linear both;
    animation-timeline: view();
    animation-range:
      entry calc(3% + var(--i, 0) * 4%)
      entry calc(48% + var(--i, 0) * 4%);
  }
  @keyframes wort-rein {
    from { opacity: 0; transform: translateY(24px) rotateX(-52deg); filter: blur(6px); }
    to   { opacity: 1; transform: none; filter: blur(0); }
  }

  /* --- Das Kopfbild bleibt stehen und tritt zurueck ---
     Die Zeitachse haengt am Behaelter, nicht am festgehefteten Kind:
     ein festgeheftetes Element steht relativ zum Fenster still, seine
     eigene Zeitachse wuerde also stehenbleiben. */
  .held-fest {
    animation: held-weg linear both;
    animation-timeline: --held;
    animation-range: exit 0% exit 96%;
  }
  @keyframes held-weg {
    from { opacity: 1; scale: 1; filter: blur(0); }
    to   { opacity: 0; scale: .66; translate: 0 -26px; filter: blur(9px); }
  }

  /* --- Die Kurve zeichnet sich beim Scrollen ---
     Der staerkste Effekt der Seite: die Linie waechst genau so weit,
     wie man gescrollt hat. Anhalten heisst, sie bleibt stehen. */
  #chart svg path[stroke] {
    animation: zeichnen linear both;
    animation-timeline: view();
    animation-range: entry 15% cover 58%;
  }
  #chart svg path[fill]:not([stroke]) {
    animation: flaeche-auf linear both;
    animation-timeline: view();
    animation-range: entry 28% cover 64%;
  }
  @keyframes flaeche-auf { from { opacity: 0 } to { opacity: 1 } }

  /* --- Kalender: die Welle laeuft mit dem Scrollen ---
     --sp ist die Spaltennummer, gesetzt von der Seitenlogik. */
  .heat-cell {
    animation: zelle linear both;
    animation-timeline: view();
    animation-range:
      entry calc(5% + var(--sp, 0) * .5%)
      entry calc(54% + var(--sp, 0) * .5%);
  }

  /* --- Stufenleiter und Balken fuellen sich mit dem Scrollen --- */
  .ladder .conn i {
    animation: conn-auf linear both;
    animation-timeline: view();
    animation-range: entry 8% cover 44%;
    transition: none;
  }
  @keyframes conn-auf { from { height: 0 } }

  .text-card .bar i {
    animation: balken-auf linear both;
    animation-timeline: view();
    animation-range: entry 12% cover 40%;
    transition: none;
  }
  @keyframes balken-auf { from { width: 0 } }

  /* --- Kennzahlen kommen einzeln herein --- */
  .kpi {
    animation: kpi-rein linear both;
    animation-timeline: view();
    animation-range: entry 4% cover 30%;
  }
  @keyframes kpi-rein {
    from { opacity: 0; transform: translateY(30px); scale: .9; filter: blur(7px) }
    to   { opacity: 1; transform: none; scale: 1; filter: blur(0) }
  }
}

@supports (animation-timeline: scroll()) {
  #scrollbalken {
    display: block;
    animation: leiste linear both;
    animation-timeline: scroll(root block);
  }
  @keyframes leiste { from { transform: scaleX(0) } to { transform: scaleX(1) } }
}

/* ---------- Zeigerabhaengiges Licht ----------
   Die Farbfelder folgen dem Zeiger, jedes mit eigener Tiefe und damit
   eigenem Weg. Ueber translate, damit die Drift auf transform
   unangetastet weiterlaeuft -- sonst wuerde eines das andere
   ausknipsen. Die lange Nachlaufzeit laesst es nach Masse aussehen
   statt nach etwas, das am Zeiger klebt. */

#aurora i {
  translate: calc(var(--zx, 0) * var(--tiefe, 1) * 1px)
             calc(var(--zy, 0) * var(--tiefe, 1) * 1px);
  transition: translate 1.4s cubic-bezier(.16,.7,.2,1);
}
#aurora i:nth-child(1) { --tiefe: .55 }
#aurora i:nth-child(2) { --tiefe: -.9 }
#aurora i:nth-child(3) { --tiefe: 1.3 }

/* ---------- Magnetische Hauptknoepfe ----------
   Sehr wenig Weg (gut 6 px), aber man spuert, dass der Knopf reagiert,
   bevor man ihn getroffen hat. Auch hier translate statt transform,
   damit :active weiter unabhaengig skalieren kann. */

.btn.solid {
  translate: var(--kx, 0px) var(--ky, 0px);
  transition: translate .4s cubic-bezier(.16,.7,.2,1),
              box-shadow .25s var(--ease), filter .2s var(--ease);
}
.btn.solid:active { scale: .96; }

/* ---------- Ruhige Darstellung ----------
   Setzt alle drei Bewegungsspuren zurueck, nicht nur transform --
   sonst bliebe eine halbe Verschiebung stehen. */

html.ruhig .szene, html.ruhig .kpi, html.ruhig .heat-cell,
html.ruhig .wort-auf > i, html.ruhig .held-fest,
html.ruhig .text-card .cover, html.ruhig #chart svg path,
html.ruhig .ladder .conn i, html.ruhig .text-card .bar i,
html.ruhig #scrollbalken, html.ruhig #aurora i, html.ruhig .btn.solid {
  animation: none !important;
  transition: none !important;
  opacity: 1 !important;
  transform: none !important;
  translate: none !important;
  scale: none !important;
  filter: none !important;
}
html.ruhig .held { min-height: 0; }
html.ruhig .held-fest { position: static; min-height: 0; padding: 6px 0 20px; }
html.ruhig #scrollbalken { display: none !important; }
/* Die Kurve muss trotzdem gezeichnet dastehen. */
html.ruhig #chart svg path[stroke] { stroke-dasharray: none; stroke-dashoffset: 0; }

/* ---------- Weniger Rechenlast auf kleinen Geraeten ----------
   Unschaerfe ueber grosse Flaechen ist der teuerste Teil. Am Handy
   bleibt die Bewegung, die Weichzeichnung faellt weg. */
@media (max-width: 700px) {
  @supports (animation-timeline: view()) {
    @keyframes szene-rein {
      from { opacity: 0; transform: translateY(44px); scale: .94; }
      to   { opacity: 1; transform: none; scale: 1; }
    }
    @keyframes karte-rein {
      from { opacity: 0; transform: translateY(40px); scale: .93; }
      to   { opacity: 1; transform: none; scale: 1; }
    }
    @keyframes kpi-rein {
      from { opacity: 0; transform: translateY(22px); scale: .93 }
      to   { opacity: 1; transform: none; scale: 1 }
    }
    @keyframes wort-rein {
      from { opacity: 0; transform: translateY(16px); }
      to   { opacity: 1; transform: none; }
    }
  }
}

/* Wenn die Wache in app.js feststellt, dass die Zeitachsen ins Leere laufen
   (die Seite scrollt nicht), verschwinden alle Auftritte. Der Inhalt steht
   dann einfach da -- unspektakulaer, aber sichtbar. */
html.keine-szenen .szene.reveal { opacity: 0; }
html.keine-szenen .szene.reveal.in { opacity: 1; }
html.keine-szenen .szene:not(.reveal), html.keine-szenen .kpi, html.keine-szenen .heat-cell,
html.keine-szenen .wort-auf > i, html.keine-szenen .held-fest,
html.keine-szenen .text-card .cover, html.keine-szenen #chart svg path,
html.keine-szenen .ladder .conn i, html.keine-szenen .text-card .bar i {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
  translate: none !important;
  scale: none !important;
  filter: none !important;
}
html.keine-szenen #chart svg path[stroke] { stroke-dasharray: none; stroke-dashoffset: 0; }
/* Die Fuellstaende stehen als Stil am Element selbst (Leiter: height,
   Balken: width) -- ohne Animation gilt einfach wieder dieser Wert. */

/* ============================================================
   Formwechsel beim Öffnen eines Textes
   ------------------------------------------------------------
   Die Karte wird der Leser. Der Browser hat vorher und nachher eine
   Aufnahme gemacht und rechnet dazwischen -- hier steht nur, wie
   schnell und mit welcher Kurve.
   ============================================================ */

::view-transition-group(textblatt),
::view-transition-group(texttitel),
::view-transition-group(textdeckblatt) {
  animation-duration: .58s;
  animation-timing-function: cubic-bezier(.22,.9,.24,1);
}

/* Die alte Karte tritt schnell zurueck, die neue Seite kommt langsamer
   nach. Diese Ungleichheit ist der Trick: waeren beide gleich lang,
   saehe man eine Ueberblendung statt einer Verwandlung. */
::view-transition-old(textblatt) {
  animation: vt-alt .26s cubic-bezier(.4,0,1,1) both;
}
::view-transition-new(textblatt) {
  animation: vt-neu .5s cubic-bezier(0,0,.3,1) .08s both;
}
@keyframes vt-alt { to { opacity: 0 } }
@keyframes vt-neu { from { opacity: 0 } to { opacity: 1 } }

/* Der Titel wandert als Ganzes und wird dabei nicht ueberblendet --
   es ist derselbe Text, er steht nur woanders und ist groesser. */
::view-transition-old(texttitel),
::view-transition-new(texttitel) {
  animation-duration: .58s;
  animation-timing-function: cubic-bezier(.22,.9,.24,1);
  mix-blend-mode: normal;
}
::view-transition-old(texttitel) { animation-name: vt-alt; animation-duration: .3s; }
::view-transition-new(texttitel) { animation-name: vt-neu; animation-duration: .45s; }

/* Das Deckblatt hat drueben kein Gegenstueck: es tritt ab, indem es
   naeher kommt und sich aufloest. */
::view-transition-old(textdeckblatt) {
  animation: deck-ab .42s cubic-bezier(.4,0,1,1) both;
}
@keyframes deck-ab { to { opacity: 0; transform: scale(1.9); filter: blur(9px) } }

/* Der Rest der Seite blendet nur kurz -- die Aufmerksamkeit soll auf der
   Verwandlung liegen, nicht auf der Seitenleiste. */
::view-transition-old(root) { animation: vt-alt .2s ease both; }
::view-transition-new(root) { animation: vt-neu .32s ease .06s both; }

/* ---------- Kopfzeile des Lesers ----------
   Der Text selbst bleibt still -- das drumherum darf sich setzen. */

#view-reader.on .reader-head > *:not(.reader-title) {
  animation: kopf-rein .5s var(--ease) both;
}
#view-reader.on .reader-head > *:nth-child(1) { animation-delay: .1s }
#view-reader.on .reader-head > *:nth-child(3) { animation-delay: .16s }
@keyframes kopf-rein { from { opacity: 0; transform: translateY(-10px) } to { opacity: 1; transform: none } }

/* Beim Ruhemodus faellt der Formwechsel ganz weg -- die Seitenlogik
   startet ihn dann gar nicht erst, das hier ist nur die Absicherung. */
html.ruhig::view-transition-group(*),
html.ruhig::view-transition-old(*),
html.ruhig::view-transition-new(*) { animation: none !important; }
html.ruhig #view-reader.on .reader-head > * { animation: none !important; }

/* ---------- Rückfragen ----------
   Liegt ueber dem normalen Dialog, damit "wirklich verwerfen?" auch ueber
   einem offenen Import-Fenster gestellt werden kann. */

.frage-modal { z-index: 75; }
.frage-card { max-width: 400px; padding: 24px 22px 20px; }
.frage-card h2 { font-size: 19px; margin: 0 0 8px; line-height: 1.3; }
.frage-card > p { margin: 0 0 16px; font-size: 13.5px; line-height: 1.55; }
.frage-card > p.hidden { display: none; }
.frage-card .field { margin-bottom: 12px; }
.frage-card .err:empty { min-height: 0; margin: 0; }
.frage-knoepfe { justify-content: flex-end; gap: 8px; margin-top: 4px; }
.frage-knoepfe .btn { min-width: 96px; justify-content: center; }
/* Der zerstoerende Knopf ist rot und traegt drauf, was er tut -- nicht "OK". */
.btn.gefahr {
  background: var(--rose); color: #1A0E0E; border-color: transparent; font-weight: 600;
  box-shadow: 0 6px 18px -8px rgba(232,106,106,.6);
}
.btn.gefahr:hover { filter: brightness(1.08); box-shadow: 0 10px 24px -8px rgba(232,106,106,.75); }

/* ---------- Formulare in der Verwaltung ----------
   Jede Angabe bekommt ihre eigene Zeile mit Beschriftung. Vorher standen
   Titel und Knopf nebeneinander in einer Reihe -- auf schmalen Karten
   quetschte das die Beschriftungen zu "Reih…" und "Lösc…" zusammen. */

.neu-form {
  margin-top: 16px; padding-top: 16px;
  border-top: 1px dashed var(--line);
}
.neu-zeilen { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.neu-zeilen > .feld { flex: 1; min-width: 190px; }
.neu-zeilen > .feld.schmal { flex: 0 0 190px; }

.feld { display: block; margin-bottom: 12px; }
.feld > span {
  display: block; margin-bottom: 6px;
  font-size: 12px; letter-spacing: .04em; color: var(--dim);
}
.feld > span > i { font-style: normal; color: var(--faint); }
.feld input, .feld select, .feld textarea { width: 100%; }
.feld textarea { resize: vertical; min-height: 120px; font-family: inherit; }

/* ---------- Kurszeile ----------
   Eigenes Raster statt der allgemeinen Sortierzeile: die Knoepfe brauchen
   ihre volle Beschriftung und duerfen nicht schrumpfen. */

.kurs-zeile {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 11px 12px; margin-bottom: 8px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(255,255,255,.025);
  transition: border-color .18s var(--ease), background .18s var(--ease);
}
.kurs-zeile:hover { border-color: var(--line-hi); background: rgba(255,255,255,.045); }
.kurs-zahl {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center; font-size: 13px; font-weight: 600;
  color: var(--teal); background: rgba(91,209,196,.11);
  border: 1px solid rgba(91,209,196,.25);
}
.kurs-titel { flex: 1 1 180px; min-width: 140px; }
.kurs-sprache { flex: 0 0 150px; font-size: 13px; padding: 6px 9px; }
/* Der wichtigste Teil: die Knöpfe schrumpfen nicht mehr und brechen als
   Ganzes um, statt ihre Beschriftung abzuschneiden. */
.kurs-knoepfe { display: flex; gap: 6px; flex-shrink: 0; margin-left: auto; }
.kurs-knoepfe .btn { white-space: nowrap; }

@media (max-width: 620px) {
  .kurs-titel { flex-basis: 100%; order: 1; }
  .kurs-sprache { flex: 1 1 auto; order: 2; }
  .kurs-knoepfe { order: 3; margin-left: 0; }
  .neu-zeilen > .feld.schmal { flex: 1 1 100%; }
}

/* Kopfzeile einer Karte mit Knopf rechts. */
.dash-card-head.karte-kopf {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
}
.dash-card-head.karte-kopf > div { flex: 1; min-width: 220px; }

/* ---------- Sprachknopf in der Leiste ----------
   Sitzt ueber der Navigation, weil alles darunter an der Lernsprache haengt:
   Texte, Wortschatz, Ueben, Statistik. Das Kuerzel traegt eine eigene Farbe
   je Sprache, damit man beim Wechseln sofort sieht, wo man gelandet ist. */

.sprachknopf {
  display: flex; align-items: center; gap: 9px; width: 100%;
  margin: 0 0 18px; padding: 7px 9px 7px 7px;
  background: rgba(255,255,255,.035); border: 1px solid var(--line);
  border-radius: 11px; color: var(--text); font: inherit; font-size: 13.5px;
  cursor: pointer; text-align: left;
  transition: border-color .18s var(--ease), background .18s var(--ease);
}
.sprachknopf:hover { border-color: var(--line-hi); background: rgba(255,255,255,.06); }
.sk-flagge {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 7px;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase;
  color: #0E1A19; background: linear-gradient(150deg, var(--teal), var(--s0));
}
.sk-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sprachknopf svg { width: 14px; height: 14px; color: var(--faint); flex-shrink: 0; }

/* ---------- Sprachwarnung beim Einfügen ----------
   Ein Hinweis, keine Sperre: die Erkennung liegt bei gemischten Texten und
   Zitaten oft daneben, und ein Werkzeug, das einem den eigenen Text
   verweigert, ist schlimmer als eines, das gelegentlich unnötig nachfragt. */

.sprachwarnung {
  display: flex; align-items: flex-start; gap: 11px;
  margin: -6px 0 14px; padding: 12px 13px;
  border: 1px solid rgba(240,135,30,.32); border-radius: var(--radius);
  background: rgba(240,135,30,.07);
  font-size: 13.5px; line-height: 1.45;
  animation: rise .22s var(--ease);
}
.sw-zeichen {
  flex-shrink: 0; width: 19px; height: 19px; border-radius: 50%;
  display: grid; place-items: center; margin-top: 1px;
  background: var(--s1); color: #1B1004; font-size: 12px; font-weight: 700;
}
.sw-text { flex: 1; min-width: 0; }
.sw-text b { color: var(--s2); font-weight: 600; }
.sprachwarnung .btn { flex-shrink: 0; align-self: center; }
@media (max-width: 560px) {
  .sprachwarnung { flex-wrap: wrap; }
  .sprachwarnung .btn { margin-left: 30px; }
}

/* ---------- Dateiablage ----------
   Ersetzt das native <input type="file">, das sich nicht gestalten lässt
   und in jedem Browser anders aussieht. Das echte Feld liegt unsichtbar
   darunter und trägt weiterhin die Datei. */

.ablage {
  position: relative; cursor: pointer;
  border: 1.5px dashed var(--line-hi); border-radius: var(--radius);
  background: rgba(255,255,255,.02);
  transition: border-color .18s var(--ease), background .18s var(--ease);
}
.ablage:hover { border-color: rgba(91,209,196,.5); background: rgba(91,209,196,.04); }
/* Während eine Datei darüber schwebt. */
.ablage.drueber {
  border-color: var(--teal); border-style: solid;
  background: rgba(91,209,196,.09);
}
.ablage-echt {
  position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%;
  /* Nicht display:none -- das Feld muss anklickbar bleiben, wenn jemand
     per Tastatur navigiert. Es liegt nur unsichtbar darüber. */
  cursor: pointer;
}
.ablage-leer, .ablage-voll {
  display: flex; align-items: center; gap: 13px; padding: 15px 16px;
  pointer-events: none;   /* Klicks gehen an die Fläche, nicht an den Inhalt */
}
.ablage-leer svg { width: 24px; height: 24px; color: var(--faint); flex-shrink: 0; }
.ablage:hover .ablage-leer svg, .ablage.drueber .ablage-leer svg { color: var(--teal); }
.ablage-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ablage-text b { font-weight: 600; font-size: 14px; }
.ablage-text span { color: var(--faint); font-size: 12.5px; }
.ablage-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Mit Datei: gefüllt statt gestrichelt, damit der Unterschied auf einen
   Blick sichtbar ist und nicht erst beim Lesen. */
.ablage:has(.ablage-voll:not(.hidden)) {
  border-style: solid; border-color: rgba(91,209,196,.4);
  background: rgba(91,209,196,.06);
}
.ablage-art {
  flex-shrink: 0; min-width: 42px; height: 42px; padding: 0 7px;
  border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(150deg, var(--teal), var(--s0));
  color: #0E1A19; font-size: 11px; font-weight: 700; letter-spacing: .02em;
}
.ablage-weg {
  pointer-events: auto; margin-left: auto; flex-shrink: 0;
  background: none; border: none; color: var(--faint);
  font-size: 20px; line-height: 1; cursor: pointer; padding: 4px 7px;
  border-radius: 8px; transition: color .15s var(--ease), background .15s var(--ease);
}
.ablage-weg:hover { color: var(--rose); background: rgba(232,106,106,.12); }

/* ---------- Sprachprüfung läuft ---------- */

.sprachpruefung {
  display: flex; align-items: center; gap: 9px;
  margin: -6px 0 14px; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--dim); font-size: 13.5px;
}
.sprachpruefung i {
  width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
  border: 1.5px solid var(--faint); border-top-color: var(--teal);
  animation: speedspin .7s linear infinite;
}
/* Gemischter Text ist ein schwächerer Befund als ganz falscher -- das darf
   man sehen, sonst wirken beide gleich dringend. */
.sprachwarnung.misch {
  border-color: rgba(123,166,232,.32); background: rgba(123,166,232,.07);
}
.sprachwarnung.misch .sw-zeichen { background: var(--s0); color: #0B1220; }
.sprachwarnung.misch .sw-text b { color: var(--s0); }
/* Knopf, der auf ein Ergebnis wartet. */
.btn.wartet { opacity: .5; cursor: progress; }

/* ---------- Datenleichen ---------- */

.waisen-sauber {
  display: flex; align-items: center; gap: 10px; margin-top: 14px;
  padding: 13px 15px; border-radius: var(--radius);
  border: 1px solid rgba(127,201,143,.32); background: rgba(127,201,143,.08);
  color: var(--s5); font-size: 14px;
}
.waisen-sauber span { font-size: 16px; }
.waisen-liste { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.waisen-zeile {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  cursor: pointer; transition: border-color .15s var(--ease), background .15s var(--ease);
}
.waisen-zeile:hover { border-color: var(--line-hi); background: rgba(255,255,255,.025); }
.waisen-zeile input { width: auto; margin: 3px 0 0; flex-shrink: 0; }
.waisen-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.waisen-text b { font-size: 14px; font-weight: 600; }
.waisen-text .hintline { margin: 0; }
.waisen-zahl {
  flex-shrink: 0; align-self: center; white-space: nowrap;
  font-size: 12.5px; font-weight: 600; color: var(--s1);
  border: 1px solid rgba(240,135,30,.3); background: rgba(240,135,30,.1);
  border-radius: 999px; padding: 3px 10px;
}

/* ---------- Tonspuren vorbereiten ---------- */

.tempo-liste { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 8px; }
.tempo {
  display: flex; align-items: center; gap: 13px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .25s var(--ease), background .25s var(--ease);
}
.tempo.laeuft { border-color: rgba(91,209,196,.35); background: rgba(91,209,196,.05); }
.tempo.fertig { border-color: rgba(127,201,143,.35); background: rgba(127,201,143,.06); }
.tempo.schief { border-color: rgba(232,106,106,.35); background: rgba(232,106,106,.06); }
.tempo-marke {
  flex-shrink: 0; min-width: 46px; height: 34px; border-radius: 9px;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  color: var(--faint); border: 1px solid var(--line);
  transition: color .25s var(--ease), border-color .25s var(--ease), background .25s var(--ease);
}
.tempo.laeuft .tempo-marke { color: var(--teal); border-color: rgba(91,209,196,.4); }
.tempo.fertig .tempo-marke {
  color: #0E1A19; background: var(--s5); border-color: transparent;
}
.tempo.schief .tempo-marke { color: var(--rose); border-color: rgba(232,106,106,.4); }
.tempo-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tempo-text b { font-size: 14px; font-weight: 600; }
.tempo-text .hintline { margin: 0; }
.tempo-bar {
  flex-shrink: 0; width: 90px; height: 4px; border-radius: 2px;
  background: rgba(255,255,255,.08); overflow: hidden;
}
.tempo-bar i {
  display: block; height: 100%; width: 0; border-radius: 2px;
  background: var(--teal); transition: width .5s var(--ease);
}
.tempo.fertig .tempo-bar i { background: var(--s5); }

/* ---------- Markierungen im Eingabefeld ----------
   Eine deckungsgleiche Ebene hinter dem Textfeld: das Feld selbst kann
   keine Hervorhebungen. Damit nichts verrutscht, müssen beide Ebenen in
   Schrift, Maßen und Umbruchverhalten übereinstimmen — die Werte werden
   deshalb in app.js aus dem Feld ausgelesen statt hier doppelt gepflegt. */

.markier-huelle { position: relative; }
.markier-ebene {
  position: absolute; inset: 0; overflow: hidden;
  pointer-events: none; color: transparent;
  white-space: pre-wrap; word-wrap: break-word;
  border-style: solid; border-color: transparent;
}
.markier-huelle textarea {
  position: relative; background: transparent !important;
}
.mk {
  color: transparent; background: rgba(240,135,30,.22);
  border-radius: 3px; box-shadow: 0 0 0 1px rgba(240,135,30,.3);
}
/* Fremdsprachiges ist der schwerwiegendste Fund und bekommt die kräftigste
   Farbe; mechanische Schäden sind ruhiger markiert. */
.mk-fremdsprache { background: rgba(232,106,106,.24); box-shadow: 0 0 0 1px rgba(232,106,106,.38); }
.mk-mojibake, .mk-unsichtbar, .mk-trennung, .mk-kein_leerzeichen {
  background: rgba(240,135,30,.24); box-shadow: 0 0 0 1px rgba(240,135,30,.36);
}
.mk-fussnoten, .mk-doppelwort, .mk-umbruch, .mk-grossbuchstaben, .mk-leerraum {
  background: rgba(123,166,232,.18); box-shadow: 0 0 0 1px rgba(123,166,232,.28);
}

/* ---------- Befundliste ---------- */

.pruef-sauber {
  display: flex; align-items: center; gap: 9px; margin: -6px 0 14px;
  padding: 11px 13px; border-radius: var(--radius);
  border: 1px solid rgba(127,201,143,.3); background: rgba(127,201,143,.07);
  color: var(--s5); font-size: 13.5px;
  animation: rise .22s var(--ease);
}
.pruef-block {
  margin: -6px 0 14px; padding: 13px 14px;
  border: 1px solid rgba(123,166,232,.3); background: rgba(123,166,232,.06);
  border-radius: var(--radius);
  animation: rise .22s var(--ease);
}
.pruef-block.hart { border-color: rgba(232,106,106,.32); background: rgba(232,106,106,.06); }
.pruef-block.abgenickt { border-color: var(--line); background: rgba(255,255,255,.025); }
.pruef-kopf { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.pruef-kopf b { font-size: 14px; }
.pruef-kopf .hintline { margin: 0; }
.pruef-zeichen {
  flex-shrink: 0; width: 19px; height: 19px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--s0); color: #0B1220; font-size: 12px; font-weight: 700;
}
.pruef-block.hart .pruef-zeichen { background: var(--rose); color: #1B0A0A; }
.pruef-liste { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.pruef-fund {
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: rgba(0,0,0,.2); border: 1px solid var(--line);
}
.pruef-fund.hart { border-left: 2px solid var(--rose); }
.pruef-fund.weich { border-left: 2px solid var(--s0); }
.pruef-fund-kopf { display: flex; align-items: center; gap: 9px; }
.pruef-fund-kopf b { font-size: 13.5px; flex: 1; }
.pruef-zahl {
  flex-shrink: 0; font-size: 11.5px; font-weight: 700; color: var(--faint);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px;
}
.pruef-fund .hintline { margin: 4px 0 0; }
.pruef-tun { display: flex; gap: 7px; margin-top: 9px; flex-wrap: wrap; }
.pruef-fuss { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.pruef-ok { margin: 12px 0 0; padding-top: 12px; border-top: 1px dashed var(--line); }

/* Laufende Sprachprüfung: die Entwarnung ist bewusst leise — sie ist der
   Normalfall und soll nicht so aussehen wie ein Fund. */
.sprach-ok {
  display: flex; align-items: center; gap: 8px; margin: -6px 0 14px;
  padding: 9px 12px; border-radius: var(--radius);
  border: 1px solid var(--line); color: var(--faint); font-size: 13px;
}
.sprach-ok span { color: var(--s5); }
/* Geprüft-Zustand am Überprüfen-Knopf. */
.btn.known { pointer-events: none; }

/* ---------- Einzelne Fundstellen mit Vorschlägen ---------- */

.stellen-liste { list-style: none; margin: 9px 0 0; padding: 0; display: grid; gap: 5px; }
.stelle {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  font-size: 13px; line-height: 1.5;
}
.stelle-wort {
  background: rgba(232,106,106,.14); border: 1px solid rgba(232,106,106,.3);
  color: var(--text); font: inherit; font-size: 12.5px;
  padding: 2px 8px; border-radius: 7px; cursor: pointer;
  text-decoration: line-through; text-decoration-color: rgba(232,106,106,.6);
}
.stelle-wort:hover { background: rgba(232,106,106,.22); }
.stelle-pfeil { color: var(--faint); }
.stelle-vor { display: flex; gap: 5px; flex-wrap: wrap; }
.vor-knopf {
  background: rgba(127,201,143,.12); border: 1px solid rgba(127,201,143,.3);
  color: var(--s5); font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 2px 9px; border-radius: 7px; cursor: pointer;
  transition: background .15s var(--ease), transform .08s var(--ease);
}
.vor-knopf:hover { background: rgba(127,201,143,.24); }
.vor-knopf:active { transform: scale(.94); }
.pruef-dienst {
  margin: 10px 0 0; padding-top: 10px; border-top: 1px dashed var(--line);
}
.pruef-dienst code {
  background: rgba(0,0,0,.3); padding: 1px 6px; border-radius: 5px;
  font-size: 11.5px;
}
/* Markierungen für Rechtschreibung: gewellt statt flächig, wie man es von
   Textverarbeitungen kennt — flächig sähe aus wie ein fremder Absatz. */
.mk-lt_tippfehler, .mk-lt_grammatik, .mk-lt_zeichensetzung, .mk-lt_stil {
  background: none; box-shadow: none;
  text-decoration: underline wavy rgba(232,106,106,.75);
  text-underline-offset: 3px;
}
.mk-lt_grammatik { text-decoration-color: rgba(240,135,30,.75); }
.mk-lt_zeichensetzung, .mk-lt_stil { text-decoration-color: rgba(123,166,232,.7); }
