:root {
  --bg: #f6f1e7;
  --surface: #fffdf8;
  --ink: #23201b;
  --muted: #6f675b;
  --line: #e2d9c8;
  --accent: #2f5d8a;
  --accent-ink: #ffffff;
  --accent-soft: #dfe9f3;
  --mark: #f3dc8f;
  --tr: #4b5d3a;
  --danger: #a33a2a;
  --ok: #3d7a3a;
  --cl-rel: #d4ebd6;
  --cl-sub: #f6dfbb;
  --cl-ins: #e7dcf3;
  --warn: #a8641a;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 4px 16px rgb(0 0 0 / .05);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "DejaVu Serif", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Noto Sans", sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1b19;
    --surface: #262421;
    --ink: #ece6da;
    --muted: #a39b8d;
    --line: #3a3732;
    --accent: #8db7e0;
    --accent-ink: #10202f;
    --accent-soft: #2a3846;
    --mark: #6b5a1f;
    --tr: #b6c99b;
    --danger: #e08a7a;
    --ok: #9ccf8f;
    --cl-rel: #22402a;
    --cl-sub: #4d391b;
    --cl-ins: #3b2f4a;
    --warn: #e2b071;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  padding-bottom: env(safe-area-inset-bottom);
}
[hidden] { display: none !important; }

/* ---------- Kopfzeile ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 {
  flex: 1; margin: 0; font-size: 1.1rem; font-weight: 650;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.status {
  display: flex; align-items: center; gap: 10px;
  margin: 0 auto; max-width: 720px; padding: 8px 16px;
  font-size: .9rem; color: var(--muted);
}
.status progress { flex: 1; max-width: 200px; accent-color: var(--accent); }
.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(1turn); } }

main { max-width: 720px; margin: 0 auto; padding: 16px 16px 48px; }
h2 { font-size: 1rem; margin: 28px 0 10px; color: var(--muted); font-weight: 600; }

/* ---------- Buttons & Formulare ---------- */
button { font: inherit; color: inherit; cursor: pointer; }
/* Touch: kein grauer Tipp-Blitz, kein Zoom bei schnellem Doppeltippen, kein Markieren bei langem Drücken */
button, label, summary, .w, .sent { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { -webkit-user-select: none; user-select: none; }
.primary, .ghost {
  border-radius: 10px; padding: 10px 16px; border: 1px solid transparent;
  min-height: 44px;
}
.primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.ghost { background: transparent; border-color: var(--line); color: var(--accent); }
.ghost.small { min-height: 32px; padding: 4px 10px; font-size: .9rem; }
.wide { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%;
  border: none; background: transparent; color: var(--ink);
}
.icon-btn svg, .play-btn svg {
  width: 24px; height: 24px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.icon-btn.labeled { width: auto; height: auto; padding: 6px 8px; border-radius: 10px; gap: 2px; }
.icon-btn.labeled span { font-size: .72rem; color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 550; }
input[type=text], input[type=search], input:not([type]), textarea, select {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%;
}
textarea { font-family: var(--serif); resize: vertical; }
.file-label input { font-weight: 400; }
.hint { color: var(--muted); font-weight: 400; }
.small { font-size: .85rem; }
.switch { flex-direction: row; align-items: center; gap: 10px; font-weight: 450; }
.switch input { width: 20px; height: 20px; accent-color: var(--accent); }
fieldset { border: none; margin: 0; padding: 0; }
legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.radio { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; }
.radio input { margin-top: 4px; accent-color: var(--accent); }

/* ---------- Bibliothek ---------- */
.lib-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lib-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.lib-actions svg, .primary svg {
  width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.t-badge {
  display: inline-block; font-size: .72rem; font-weight: 600; padding: 1px 7px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); margin-right: 4px; vertical-align: 1px;
}
.text-list { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-direction: column; gap: 10px; }
.text-item {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.text-item .open {
  flex: 1; min-width: 0; text-align: left; background: none; border: none; padding: 14px 4px 14px 16px;
}
.text-item .t-title { font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.text-item .t-meta { font-size: .85rem; color: var(--muted); }
.bar { height: 4px; background: var(--line); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.text-item .delete { color: var(--muted); margin-right: 6px; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
}
.stat b { display: block; font-size: 1.5rem; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat span { font-size: .85rem; color: var(--muted); }
.stat small { display: block; font-size: .8rem; color: var(--muted); }

/* ---------- Nachrichten ---------- */
.news-bar { display: flex; align-items: center; gap: 4px; margin-bottom: 12px; }
.chips {
  flex: 1; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px;
  mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
}
.chips::-webkit-scrollbar { display: none; }
@media (hover: hover) and (pointer: fine) {
  .chips { scrollbar-width: thin; padding-bottom: 6px; }
  .chips::-webkit-scrollbar { display: block; height: 6px; }
  .chips::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
}
.chips button {
  flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-size: .9rem; white-space: nowrap;
}
.chips button[aria-selected=true] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.news-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.news-item {
  display: block; width: 100%; text-align: left; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.news-item .n-meta { font-size: .8rem; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; }
.news-item .n-title { font-family: var(--serif); font-size: 1.12rem; line-height: 1.4; font-weight: 600; margin: 4px 0; display: block; }
.news-item .n-summary {
  font-family: var(--serif); color: var(--muted); font-size: .95rem; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.news-item.saved { border-color: var(--accent); }
.news-item.loading { opacity: .6; pointer-events: none; }
.n-saved { color: var(--accent); font-weight: 600; }
.feed-options { gap: 8px; }
.feed-option { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; }
.feed-option input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--accent); }
.feed-option small { display: block; color: var(--muted); }
.feed-option .remove { margin-left: auto; }
/* Podcasts */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 24px 0 8px; }
.section-head h2 { margin: 0; }
.podcast { margin-bottom: 20px; }
.podcast h3 { margin: 0 0 2px; font-size: 1.05rem; }
.podcast .more { margin-top: 8px; }
/* nur die Ergebnisliste scrollt – Suche, Kategorien und „Fertig" bleiben sichtbar */
#podcasts-dialog { max-height: calc(100dvh - 32px); }
#podcasts-dialog[open] { display: flex; flex-direction: column; overflow: hidden; }
#podcasts-dialog form { min-height: 0; flex: 1 1 auto; }
#podcasts-dialog form > * { flex: none; }
#podcasts-dialog .podcast-results { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
#podcast-chips { flex: none; }
.podcast-results { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.podcast-results li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.podcast-results li > span { flex: 1; min-width: 0; }
.podcast-results small { display: block; color: var(--muted); }
.podcast-results button { flex: none; }
.podcast-results button[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.inline-form { display: flex; gap: 8px; font-weight: 400; }
.inline-form input { flex: 1; min-width: 0; }

/* ---------- Leser ---------- */
.chapter-select { margin-bottom: 12px; }
.tabs {
  flex: none; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px;
  background: var(--line); border-radius: 10px;
}
.tabs button {
  border: none; background: transparent; border-radius: 8px; padding: 5px 14px; font-weight: 600; color: var(--muted);
  font-size: .92rem;
}
.tabs button[aria-selected=true] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.toolbar { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 4px 18px; margin-bottom: 8px; }

/* Satzbau */
.cl { border-radius: 4px; padding: 2px 1px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.cl-rel { background: var(--cl-rel); }
.cl-sub { background: var(--cl-sub); }
.cl-ins { background: var(--cl-ins); }
.cl-mark { font-weight: 650; }
.concealed .cl { background: none; }
.concealed .cl-mark { font-weight: inherit; }
.clause-legend { display: flex; flex-wrap: wrap; gap: 6px 10px; justify-content: flex-end; font-size: .85rem; margin-bottom: 8px; }
.clause-legend .cl { padding: 2px 8px; }
.options .clause-legend { justify-content: flex-start; }

/* Aussprache: Bogen unter Bindung/Verkettung, Laut darüber; gesprochene Form klein dahinter */
.lk { position: relative; }
.lk::before {
  content: ''; position: absolute; left: -.45em; right: -.45em; bottom: -.1em; height: .36em;
  border: 1.5px solid var(--muted); border-top: none; border-radius: 0 0 50% 50% / 0 0 100% 100%; opacity: .6;
}
.lk[data-s]::before { border-color: var(--accent); border-width: 2px; opacity: 1; }
.lk[data-s]::after {
  content: attr(data-s); position: absolute; left: 50%; top: -.55em; transform: translateX(-50%);
  font-family: var(--sans); font-size: .6em; font-weight: 700; color: var(--accent); line-height: 1;
}
.w.rd { text-decoration: underline dotted var(--accent); text-underline-offset: .2em; }
.say {
  font-family: var(--sans); font-size: .62em; color: var(--accent); background: var(--accent-soft);
  border-radius: 999px; padding: 1px 6px; margin-left: 3px; vertical-align: .25em; cursor: pointer; white-space: nowrap;
}
.concealed .lk::before, .concealed .lk::after, .concealed .say { visibility: hidden; }
.concealed .w.rd { text-decoration: none; }
.speech-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: flex-end; align-items: baseline; font-size: .85rem; line-height: 2.2; margin-bottom: 8px; color: var(--muted); }
.speech-legend .fr { font-size: 1.05rem; color: var(--ink); margin-right: 3px; }
.options .speech-legend { justify-content: flex-start; }

/* Redewendungen (Unterstrich) und Grammatik-Erklärung */
.idm { box-shadow: inset 0 -.14em 0 color-mix(in srgb, var(--accent) 45%, transparent); -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.concealed .idm { box-shadow: none; }
.w.gr-hl { background: var(--mark); }
.grammar {
  font-size: .95rem; line-height: 1.45; cursor: auto;
  border-left: 3px solid var(--line); padding: 2px 0 2px 12px; margin: 6px 0 4px;
}
.sent .grammar { grid-column: 1 / -1; }
.card .grammar { align-self: stretch; margin: 0; }
.grammar h4 { margin: 12px 0 2px; font-size: .78rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.grammar h4:first-child { margin-top: 2px; }
.grammar ul { list-style: none; margin: 0; padding: 0; }
.grammar li { padding: 5px 8px; margin: 0 -8px; border-radius: 8px; }
.grammar li.active { background: var(--accent-soft); }
.gr-fr { font-weight: 650; }
.gr-title { color: var(--accent); font-weight: 600; }
.gr-note { margin: 10px 0 0; }
.gi-de { color: var(--tr); }
.gi-fr { color: var(--muted); font-size: .92em; margin-top: 2px; }
.gi-ex { color: var(--muted); font-style: italic; font-size: .92em; margin-top: 2px; }
.gloss-gram { color: var(--muted); font-size: .85rem; margin: -4px 0 8px; }
.gloss-idiom { border-top: 1px solid var(--line); padding-top: 8px; margin: 0 0 8px; font-size: .92rem; }
.gloss-idiom .gi-head { margin-bottom: 2px; }
.fr { font-family: var(--serif); }
a { color: var(--accent); }
.read-text { display: flex; flex-direction: column; }
.sent {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: start;
  padding: 8px 10px; margin: 0 -10px; border-radius: 10px; cursor: pointer;
}
.sent { scroll-margin-top: 72px; }
.sent.para-start { margin-top: 14px; }
.sent.current { background: var(--accent-soft); }
.sent .fr { font-size: 1.15rem; line-height: 1.6; }
.sent .translation { grid-column: 1 / -1; }
.sent-actions { display: flex; gap: 0; opacity: .55; }
.sent.current .sent-actions { opacity: 1; }
.sent-actions .icon-btn { width: 36px; height: 36px; }
.sent-actions .icon-btn svg { width: 18px; height: 18px; }

.w { border-radius: 4px; cursor: pointer; }
.w.speaking { background: var(--mark); }
.translation { color: var(--tr); font-size: 1rem; line-height: 1.5; }
.translation.loading { color: var(--muted); font-style: italic; }

/* ---------- Hören ---------- */
.position { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .9rem; margin-bottom: 10px; }
.position input { flex: 1; accent-color: var(--accent); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 20px; min-height: 180px;
  display: flex; flex-direction: column; gap: 14px; align-items: flex-start;
}
.listen-sentence { font-size: 1.45rem; line-height: 1.65; min-height: 2.4em; }
.listen-sentence .hidden-word { visibility: hidden; }
.listen-sentence.blurred { filter: blur(7px); user-select: none; pointer-events: none; }
.listen-sentence ruby { ruby-position: under; }
.listen-sentence rt { font-family: var(--sans); font-size: .55em; color: var(--tr); visibility: hidden; padding-top: 2px; }
.listen-sentence rt.shown { visibility: visible; }
.card .translation { font-size: 1.1rem; }

.player {
  display: flex; align-items: center; justify-content: center; gap: 6px; margin: 18px 0 8px;
}
.play-btn {
  width: 68px; height: 68px; border-radius: 50%; border: none;
  background: var(--accent); color: var(--accent-ink); display: grid; place-items: center;
  margin: 0 6px;
}
.play-btn svg { width: 30px; height: 30px; fill: currentColor; stroke: none; }
.play-btn .i-pause, .play-btn.playing .i-play { display: none; }
.play-btn.playing .i-pause { display: block; }
.speed { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .9rem; margin: 6px 0 16px; }
.speed input { flex: 1; accent-color: var(--accent); }
.speed output { min-width: 3.5em; text-align: right; font-variant-numeric: tabular-nums; }

.options {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 16px;
}
.options summary { padding: 10px 0; font-weight: 600; cursor: pointer; }
.options[open] { padding-bottom: 16px; }
.options > * + * { margin-top: 14px; }
.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.segmented legend { width: 100%; font-size: .9rem; color: var(--muted); font-weight: 550; }
.segmented label { flex-direction: row; font-weight: 450; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: .92rem; cursor: pointer;
}
.segmented input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Diktat ---------- */
.dict-input { font-size: 1.25rem; line-height: 1.5; resize: none; }
.dict-input[readonly] { color: var(--muted); }
.dict-result { font-size: 1.3rem; line-height: 1.9; }
.dict-result .d-ok { color: var(--ok); }
.dict-result .d-close { color: var(--warn); text-decoration: underline wavy; text-underline-offset: 4px; }
.dict-result .d-wrong, .dict-result .d-missed { color: var(--danger); font-weight: 600; }
.dict-result .d-missed { text-decoration: underline; text-underline-offset: 4px; }
.dict-result s { color: var(--muted); font-weight: 400; font-size: .8em; }
.dict-result .d-typed { margin-right: .25em; }
.dict-score { color: var(--muted); }
.dict-score b { color: var(--ink); }
#dict-check { margin-top: 4px; }
.dict-help { text-align: center; margin: 8px 0 16px; }
.missed-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.missed-list li {
  display: flex; align-items: baseline; gap: 6px; padding: 4px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
}
.missed-list .fr { font-size: 1.05rem; }
.missed-list small { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Dialog & Popover ---------- */
dialog {
  border: none; border-radius: var(--radius); padding: 20px; width: min(520px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink);
}
dialog::backdrop { background: rgb(0 0 0 / .35); }
dialog h2 { margin: 0; color: var(--ink); font-size: 1.15rem; }

.gloss {
  margin: 0; inset: auto; position: fixed;
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  background: var(--surface); color: var(--ink); box-shadow: 0 8px 30px rgb(0 0 0 / .18);
  max-width: min(320px, calc(100vw - 32px));
}
.gloss-word { font-size: 1.15rem; font-weight: 600; }
.gloss-tr { color: var(--tr); margin: 2px 0 8px; }
.gloss-alone { color: var(--muted); font-size: .85rem; margin: -4px 0 8px; }

@media (hover: hover) {
  .icon-btn:hover { background: var(--accent-soft); }
  .sent:hover .sent-actions { opacity: 1; }
  .w:hover { background: var(--accent-soft); }
  .pz-tile:not(:disabled):hover { border-color: var(--accent); }
}
/* Touch-Geräte: Tastenkürzel helfen nicht, Satz-Knöpfe immer gut sichtbar */
@media (hover: none) and (pointer: coarse) {
  .kbd-hint { display: none; }
  .sent-actions { opacity: .8; }
}

/* Handy: Modus-Tabs als Leiste unten (mit dem Daumen erreichbar), oben bleibt Platz für den Titel */
@media (max-width: 600px) {
  .topbar { backdrop-filter: none; background: var(--bg); } /* backdrop-filter würde position: fixed einfangen */
  .topbar .tabs {
    position: fixed; z-index: 10; left: 0; right: 0; bottom: 0;
    border-radius: 0; gap: 4px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(8px);
    border-top: 1px solid var(--line);
  }
  .topbar .tabs button { min-height: 44px; padding: 6px 4px; font-size: .95rem; border-radius: 10px; }
  .topbar .tabs button[aria-selected=true] { background: var(--accent-soft); color: var(--accent); box-shadow: none; }
  body:has(.tabs:not([hidden])) main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  /* Bildschirmtastatur offen: Leiste weg, sonst schwebt sie über der Tastatur */
  body:has(textarea:focus, input:focus) .topbar .tabs { display: none; }
  .sent { scroll-margin-bottom: 80px; }
}

@media (max-width: 480px) {
  main { padding-left: 12px; padding-right: 12px; }
  .listen-sentence { font-size: 1.3rem; }
  .card { padding: 18px 16px; }
}

/* ---------- Zahlen-Training ---------- */
.span-2 { grid-column: 1 / -1; }
#num-mode, #num-cats { margin-bottom: 14px; }
.num-steps { margin-bottom: 14px; }
.num-progress { display: flex; align-items: center; gap: 4px; margin-top: 8px; font-size: .9rem; color: var(--muted); }
.num-progress i { width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--line); }
.num-progress i.ok { background: var(--ok); border-color: var(--ok); }
.num-progress i.wrong { background: var(--danger); border-color: var(--danger); }
.num-progress span { margin-left: 6px; }
.num-levelup { color: var(--ok); font-weight: 600; margin-top: 6px; }
.num-card { min-height: 0; }
.num-input { font-size: 1.8rem; font-variant-numeric: tabular-nums; text-align: center; padding: 12px; }
.num-input.ok { border-color: var(--ok); color: var(--ok); }
.num-input.wrong { border-color: var(--danger); color: var(--danger); text-decoration: line-through; }
.num-result { font-size: 1.15rem; }
.num-result .d-ok { color: var(--ok); }
.num-result .d-wrong { color: var(--danger); }
.num-words { font-size: 1.15rem; line-height: 1.5; color: var(--muted); }
.num-session { text-align: center; margin: 0 0 8px; }

/* ---------- Echte Aufnahmen ---------- */
.audio-job { min-height: 0; margin: 16px 0 0; gap: 8px; }
.audio-job progress { width: 100%; accent-color: var(--accent); }
.rec-status {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
  font-size: .85rem; color: var(--muted); margin-bottom: 12px;
}
.rec-status progress { flex: 1; min-width: 120px; accent-color: var(--accent); }

/* ---------- Vokabeln ---------- */
#open-vocab .t-badge { margin: 0 0 0 2px; }
.decks { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 16px; }
.deck { min-height: 0; gap: 8px; align-items: stretch; }
.deck h3 { margin: 0; font-size: 1.1rem; }
.deck p { margin: 0; }
.deck-progress { font-size: .85rem; color: var(--muted); }
.deck-counts, .rv-counts { display: flex; gap: 14px; font-size: .92rem; color: var(--muted); }
.deck-counts b, .rv-counts b { font-variant-numeric: tabular-nums; }
.c-new b { color: var(--accent); }
.c-learn b { color: var(--danger); }
.c-due b { color: var(--ok); }
.rv-counts { justify-content: center; margin-bottom: 10px; }
.rv-counts .now { text-decoration: underline; text-underline-offset: 4px; }
#vocab-options { margin-bottom: 8px; }
#vocab-options input[type=number] { max-width: 8em; }
.mine-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.mine-list li {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 6px 8px 14px;
}
.mine-list li > :nth-child(2) { grid-column: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine-list li .delete { grid-column: 2; grid-row: 1 / span 2; color: var(--muted); }
.mine-list .m-word { font-size: 1.05rem; font-weight: 600; }
.mine-list .tr { color: var(--tr); margin-right: 6px; }

.rv-card { align-items: center; text-align: center; justify-content: center; min-height: 220px; cursor: pointer; }
.rv-front, .rv-back { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.rv-back { border-top: 1px solid var(--line); padding-top: 14px; }
.rv-word { font-size: 2rem; line-height: 1.25; font-weight: 600; overflow-wrap: anywhere; }
.rv-sentence { font-size: 1.15rem; line-height: 1.55; color: var(--muted); }
.rv-sentence mark { background: var(--mark); color: var(--ink); border-radius: 3px; padding: 0 2px; }
.rv-tr { font-size: 1.35rem; color: var(--tr); font-weight: 600; }
.rv-sentence-tr { font-size: 1rem; }
.rv-done { min-height: 0; align-items: center; text-align: center; }
.rv-done p { margin: 0; }
#rv-show { margin-top: 14px; }
.rv-rate { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 14px; }
.rv-rate button {
  min-height: 56px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  font-weight: 600; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.rv-rate small { font-weight: 400; font-size: .78rem; color: var(--muted); }
.rv-rate .rate-1 { color: var(--danger); }
.rv-rate .rate-2 { color: var(--warn); }
.rv-rate .rate-3 { color: var(--ok); }
.rv-rate .rate-4 { color: var(--accent); }
.rv-tools { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.rv-tools .icon-btn:disabled { opacity: .35; cursor: default; }
.gloss-actions { justify-content: flex-start; gap: 6px; }
#gloss-save.saved { color: var(--ok); }

/* ---------- Satzpuzzle ---------- */
.pz-options { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
#pz-mode { margin-bottom: 10px; }
.pz-pos { margin: 0 0 10px; }
.pz-card { align-items: stretch; gap: 16px; }
.pz-prompt { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.pz-fr { font-size: 1.3rem; line-height: 1.55; }
/* Antwortzeilen wie liniertes Papier */
.pz-answer {
  display: flex; flex-wrap: wrap; align-content: flex-start; gap: 8px; min-height: 108px; padding: 4px 0;
  background: repeating-linear-gradient(to bottom, transparent 0 49px, var(--line) 49px 50px);
}
.pz-bank { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; min-height: 46px; }
.pz-tile {
  min-height: 42px; padding: 6px 14px; border-radius: 12px; font-size: 1.1rem;
  background: var(--surface); color: var(--ink);
  border: 2px solid var(--line); border-bottom-width: 4px;
}
.pz-tile.fr { font-family: var(--serif); }
.pz-tile:not(:disabled):active { transform: translateY(2px); border-bottom-width: 2px; margin-bottom: 2px; }
.pz-tile:disabled { cursor: default; }
.pz-tile.used { color: transparent; background: var(--line); border-color: transparent; user-select: none; }
.pz-tile.ok { border-color: var(--ok); color: var(--ok); }
.pz-tile.wrong { border-color: var(--danger); color: var(--danger); }
.pz-feedback { display: flex; flex-direction: column; gap: 6px; border-radius: 10px; padding: 12px 14px; }
.pz-feedback.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); }
.pz-feedback.ok > b { color: var(--ok); }
.pz-feedback.wrong { background: color-mix(in srgb, var(--danger) 13%, transparent); }
.pz-feedback.wrong > b { color: var(--danger); }
.pz-solution { font-weight: 600; }
#pz-check { margin-top: 4px; }

/* ---------- App & Speicher (Einstellungen) ---------- */
.app-info { display: flex; flex-direction: column; gap: 8px; }
.app-info p { margin: 0; }

/* ---------- Synchronisierung ---------- */
.sync-box legend { margin-bottom: 0; }
.sync-box p { margin: 0; }
.sync-actions { justify-content: flex-start; }
.prepare-row { display: flex; justify-content: flex-end; margin-bottom: 6px; }
