:root {
  --bg: #f6f1e7;
  --surface: #fffdf8;
  --ink: #23201b;
  --muted: #6f675b;
  --line: #e2d9c8;
  --accent: #2f5d8a;
  --accent-ink: #ffffff;
  --accent-soft: #dfe9f3;
  --mark: #f3dc8f;
  --danger: #a33a2a;
  --ok: #3d7a3a;
  --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;
    --danger: #e08a7a;
    --ok: #9ccf8f;
    --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: 860px; padding: 8px 16px;
  font-size: .9rem; color: var(--muted);
}
.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: 860px; 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: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: repeat(4, 1fr); gap: 10px; }
.lib-actions .primary { grid-column: span 2; }
@media (max-width: 560px) {
  .lib-actions { grid-template-columns: repeat(2, 1fr); }
  .lib-actions .primary { grid-column: span 1; }
}
.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; }
.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; }
.inline-form { display: flex; gap: 8px; font-weight: 400; }
.inline-form input { flex: 1; min-width: 0; }


/* ---------- Dialog ---------- */
dialog {
  border: none; border-radius: var(--radius); padding: 20px; width: min(560px, 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; }
a { color: var(--accent); }
.app-info { display: flex; flex-direction: column; gap: 8px; }
.app-info p { margin: 0; }

.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;
}

/* Umschalter mit zwei Möglichkeiten (wie die Modus-Tabs im Französischtrainer) */
.segmented {
  flex: none; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px;
  background: var(--line); border-radius: 10px;
}
.segmented button {
  border: none; background: transparent; border-radius: 8px; padding: 5px 14px; font-weight: 600; color: var(--muted);
  font-size: .92rem; min-height: 34px;
}
.segmented button[aria-selected=true] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- Kurrent-Text ---------- */
/* --kf (Schriftfamilie) und --ks (Ausgleich der Größe) setzt die App je Absatz bzw. Element */
.kurrent { font-family: var(--kf), var(--serif); font-size: calc(var(--k-size, 30px) * var(--ks, 1)); font-weight: 400; }

.chapter-select { margin-bottom: 12px; }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 4px; }
.toolbar select { width: auto; flex: 1; min-width: 160px; padding: 6px 10px; }
.tap-hint { margin: 4px 0 10px; }
.k-text { display: flex; flex-direction: column; }
.kp {
  margin: 0; padding: 14px 0 6px; line-height: 2.25; overflow-wrap: anywhere;
  border-bottom: 1px dashed transparent;
}
.kp.read { color: color-mix(in srgb, var(--ink) 82%, var(--bg)); }
.kp + .kp { border-top: 1px solid color-mix(in srgb, var(--line) 50%, transparent); }
.kp-title { display: block; line-height: 1.4; font-family: var(--sans); font-size: .8rem; color: var(--muted); font-weight: 600; letter-spacing: .02em; }

.w { cursor: pointer; border-radius: 6px; }
.plain { font-family: var(--serif); font-size: .6em; }
.k-text { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.l { position: relative; }
.w.on, .l.on { position: relative; }
.l.on { color: var(--accent); }
.w.on { background: var(--accent-soft); }
/* Aufgedeckt: moderner Buchstabe bzw. Wort klein über der Kurrent-Schrift */
[data-show]::before {
  content: attr(data-show);
  position: absolute; left: 50%; bottom: calc(100% - .35em); transform: translateX(-50%);
  font: 600 15px/1.2 var(--sans); color: var(--accent); white-space: nowrap; pointer-events: none;
  background: var(--surface); border: 1px solid var(--accent-soft); border-radius: 6px; padding: 1px 5px;
  z-index: 1;
}
.w[data-show]::before { font-size: 16px; background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

#read-earlier { margin-bottom: 8px; }
#read-later, #read-finish { margin-top: 18px; }

.infobar {
  position: sticky; bottom: 0; z-index: 9;
  display: flex; align-items: center; gap: 14px;
  max-width: 860px; margin: 0 auto; padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}
.info-k { --k-size: 34px; line-height: 1.2; min-width: 1.4em; text-align: center; }
.info-m { font-size: 1.4rem; font-weight: 700; color: var(--accent); white-space: nowrap; }
.info-hint { font-size: .88rem; color: var(--muted); line-height: 1.35; }

/* ---------- Statistik: oft nachgeschaut ---------- */
.often-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.often-list li {
  display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
}
.often-list .kurrent { --k-size: 26px; line-height: 1.3; }
.often-list b { font-size: 1.05rem; }
.often-list small { color: var(--muted); }

/* ---------- Alphabet ---------- */
#alpha-fonts { margin-bottom: 12px; mask-image: none; flex-wrap: wrap; }
.alpha-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.a-cell {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px;
  padding: 6px 4px 8px; min-height: 104px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
}
.a-cell .kurrent { --k-size: 40px; line-height: 1.5; }
.a-lat { font-weight: 650; font-size: 1.05rem; color: var(--accent); }
.a-lat small { font-weight: 400; color: var(--muted); }
.alpha-grid.hide .a-cell:not(.open) .a-lat { visibility: hidden; }
.alpha-grid.hide .a-cell { cursor: pointer; }

/* ---------- Üben ---------- */
#practice-mode { margin-bottom: 8px; }
.practice-card { align-items: stretch; margin-top: 8px; }
.pr-prompt {
  --k-size: 64px; text-align: center; line-height: 1.6; min-height: 1.6em; overflow-wrap: anywhere;
}
.pr-prompt.word { --k-size: 46px; }
.pr-prompt.phrase { --k-size: 38px; line-height: 1.8; }
.pr-choices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.pr-choices button {
  min-height: 56px; font-size: 1.5rem; font-weight: 600; border-radius: 12px;
  background: var(--surface); border: 2px solid var(--line); border-bottom-width: 4px;
}
.pr-choices button.ok { border-color: var(--ok); color: var(--ok); }
.pr-choices button.wrong { border-color: var(--danger); color: var(--danger); }
.pr-choices button:disabled { cursor: default; }
.pr-choices button small { display: none; }
.pr-choices.words { grid-template-columns: repeat(2, 1fr); }
.pr-choices.words button { font-size: 1.2rem; }
.pr-choices.long { grid-template-columns: 1fr; }
.pr-choices.long button { font-size: 1rem; font-weight: 550; text-align: left; padding: 8px 14px; min-height: 48px; }
@media (hover: hover) {
  .pr-choices button small { display: inline; float: left; font-size: .7rem; color: var(--muted); font-weight: 400; margin-right: -1em; }
  .pr-choices.long button small { float: none; margin-right: .7em; }
}
.pr-feedback { border-radius: 10px; padding: 10px 14px; }
.pr-feedback.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); }
.pr-feedback.wrong { background: color-mix(in srgb, var(--danger) 13%, transparent); }
.pr-feedback .diff-wrong { color: var(--danger); font-weight: 700; text-decoration: underline; }
.pr-actions { justify-content: space-between; align-items: center; }
#pr-case-row { margin-top: 12px; }
#pr-case-row select { width: auto; }

/* ---------- Originale ---------- */
.o-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.o-meta { display: flex; flex-direction: column; line-height: 1.35; }
.o-meta span { font-size: .85rem; color: var(--muted); }
.o-nav { display: flex; align-items: center; gap: 2px; }
.o-nav button:disabled { opacity: .3; cursor: default; }
.o-scroll {
  overflow: auto; max-height: 78vh; border: 1px solid var(--line); border-radius: var(--radius);
  background: #d9d2c3; -webkit-overflow-scrolling: touch;
}
.o-page { position: relative; min-width: 100%; }
.o-page img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; -webkit-user-select: none; user-select: none; }
.o-page svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.o-page polygon { fill: transparent; stroke: transparent; cursor: pointer; transition: fill .15s; }
.o-page polygon.on { fill: rgb(47 93 138 / .14); stroke: rgb(47 93 138 / .6); stroke-width: 2; vector-effect: non-scaling-stroke; }
.o-page polygon.last { fill: rgb(47 93 138 / .2); stroke: rgb(47 93 138 / .9); stroke-width: 3; }
@media (hover: hover) { .o-page polygon:hover { fill: rgb(47 93 138 / .08); } }
.o-bar {
  position: sticky; bottom: 0; z-index: 9; display: flex; align-items: baseline; gap: 10px;
  margin: 8px -16px 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}
.o-bar-n { flex: none; font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.o-bar-t { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; color: var(--accent); }
#o-read { margin-top: 14px; }
#o-done { margin: 6px 0 0; }
.o-transcript { margin-top: 18px; }
.o-transcript summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.o-lines { font-family: var(--serif); line-height: 1.5; padding-left: 2.2em; }
.o-lines li { cursor: pointer; color: transparent; text-shadow: 0 0 8px color-mix(in srgb, var(--ink) 55%, transparent); }
.o-lines li.on { color: var(--ink); text-shadow: none; }
.o-lines li::marker { color: var(--muted); text-shadow: none; }

/* Ganze Briefe: kompakte Liste je Mappe */
.o-group {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px;
}
.o-group p { margin: 0 0 4px; }
.o-group .n-title { font-family: var(--serif); font-size: 1.12rem; font-weight: 600; }
.o-group .n-summary { font-family: var(--serif); color: var(--muted); }
.o-group .n-meta { font-size: .85rem; color: var(--muted); }
.o-folder { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.o-folder summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.o-letters { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; }
.o-letter {
  display: flex; align-items: baseline; gap: 10px; width: 100%; text-align: left;
  background: none; border: none; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); padding: 8px 2px;
}
.o-letter b { flex: none; min-width: 1.8em; color: var(--muted); font-variant-numeric: tabular-nums; }
.o-letter span { flex: 1; min-width: 0; font-family: var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.o-letter small { flex: none; color: var(--muted); }
.o-letter.started b { color: var(--accent); }
.o-letter.done span { color: var(--muted); }
.o-letter.done b::after { content: " ✓"; color: var(--ok); }

/* Übung: eine Zeile aus der Handschrift */
.pr-prompt.original { text-align: left; min-height: 0; }
.o-crop-scroll { overflow-x: auto; border-radius: 8px; background: #d9d2c3; }
.o-crop {
  position: relative; overflow: hidden;
  width: max(100%, calc(var(--ar) * 76px)); aspect-ratio: var(--ar);
}
.o-crop img { position: absolute; max-width: none; height: auto; display: block; -webkit-user-select: none; user-select: none; }
.o-crop img.dim { opacity: .45; }
.o-solution { font-family: var(--serif); font-size: 1.1rem; margin: 4px 0; overflow-wrap: anywhere; }
.pr-feedback .diff-wrong.missing { text-decoration-style: wavy; }
#pr-level-row { margin-top: 12px; }
#pr-level-row select { width: auto; }

/* ---------- Üben: Modi und Lernkarten ---------- */
.practice-modes { flex-wrap: wrap; mask-image: none; margin-bottom: 10px; }
.review-decks { margin-bottom: 8px; }
.review-decks small { display: block; font-weight: 500; font-size: .8rem; }
.glyph-families { margin-bottom: 8px; }
.glyph-families small { font-weight: 500; font-size: .8rem; margin-left: 4px; }
.glyph-families [aria-selected=true] small span { color: inherit; }
#alpha-quiz { margin: 4px 0 8px; }
.pr-ratings.three { grid-template-columns: repeat(3, 1fr); }
.c-new { color: var(--accent); }
.c-learn { color: var(--danger); }
.c-review { color: var(--ok); }
.pr-answer { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.pr-big { font-size: 1.6rem; color: var(--accent); }
.pr-context { color: var(--muted); font-family: var(--serif); }
.pr-context b { color: var(--ink); }
.pr-ratings { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pr-ratings button {
  min-height: 52px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 600;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.2;
}
.pr-ratings small { font-weight: 400; color: var(--muted); font-size: .78rem; }
.pr-ratings .rate-1 { color: var(--danger); }
.pr-ratings .rate-3 { color: var(--ok); }

/* ---------- Stufe (Bibliothek) ---------- */
.stage {
  display: flex; flex-direction: column; gap: 6px; margin-top: 12px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); font-size: .92rem;
}
.stage:empty { display: none; }
.stage-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stage-head .kurrent { --k-size: 26px; line-height: 1.3; }
.stage p { margin: 0; }
.stage button { align-self: flex-start; }
.primary.small { min-height: 34px; padding: 5px 14px; font-size: .92rem; }

/* ---------- Alphabet: Schwierigkeit ---------- */
.a-cell.heat { background: color-mix(in srgb, var(--warn) var(--heat), var(--surface)); }
.alpha-legend { display: flex; align-items: center; gap: 8px; margin: 4px 0 0; }
.a-swatch {
  width: 40px; height: 14px; border-radius: 4px; flex: none;
  background: linear-gradient(to right, var(--surface), color-mix(in srgb, var(--warn) 65%, var(--surface)));
  border: 1px solid var(--line);
}

/* ---------- Handschrift-Effekt ---------- */
/* Fremdwörter und Latein in lateinischer Schreibschrift, wie in Kurrent-Texten üblich */
.w.latin { font-family: "K-Latein", var(--serif); font-size: .78em; }
.hand-1 .w, .hand-2 .w, .hand-3 .w { white-space: nowrap; }
.hand-1 .l, .hand-2 .l, .hand-3 .l {
  display: inline-block; opacity: var(--o, 1);
  transform: translateY(var(--y, 0)) rotate(var(--r, 0deg)) scale(var(--sc, 1));
}
.hand-2 .w, .hand-3 .w { display: inline-block; transform: rotate(var(--wr, 0deg)); }
/* Kirchenbuch: vergilbtes Papier, braune, leicht verlaufene Tinte – auch im Dunkelmodus wie ein echtes Blatt */
.k-text.hand-3, .pr-prompt.hand-3 {
  --paper-ink: #4a3418;
  color: var(--paper-ink);
  background-color: #eadbb8;
  background-image:
    radial-gradient(ellipse at 15% 20%, rgb(130 90 30 / .14), transparent 55%),
    radial-gradient(ellipse at 85% 75%, rgb(130 90 30 / .16), transparent 50%),
    radial-gradient(circle at 60% 40%, rgb(255 255 255 / .25), transparent 40%),
    repeating-linear-gradient(0deg, rgb(90 60 20 / .025) 0 1px, transparent 1px 4px);
  box-shadow: inset 0 0 50px rgb(110 75 25 / .3);
  border-radius: 6px; padding: 8px 18px;
}
.hand-3 .l { text-shadow: 0 0 .6px rgb(74 52 24 / .7); }
.hand-3 .kp.read { color: #6e5733; }
.hand-3 .kp + .kp { border-top-color: rgb(110 75 25 / .2); }
.hand-3 .kp-title { color: #6e5733; }
.pr-prompt.hand-3 { padding: 12px; }

/* ---------- Einstellungen: Schriftauswahl ---------- */
.font-option { flex-direction: row; align-items: center; gap: 12px; font-weight: 400; }
.font-option input { accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
.font-option .kurrent { --k-size: 28px; line-height: 1.5; display: block; }
.font-option small { display: block; color: var(--muted); }

@media (hover: hover) {
  .icon-btn:hover { background: var(--accent-soft); }
  .w:hover { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
  .pr-choices button:not(:disabled):hover { border-color: var(--accent); }
}

@media (max-width: 600px) {
  .topbar { backdrop-filter: none; background: var(--bg); }
  .pr-choices { grid-template-columns: repeat(2, 1fr); }
  .tap-hint { display: none; }
}

@media (max-width: 480px) {
  main { padding-left: 12px; padding-right: 12px; }
  .card { padding: 18px 16px; }
}

/* ---------- Synchronisierung ---------- */
.sync-box legend { margin-bottom: 0; }
.sync-box p { margin: 0; }
.sync-actions { justify-content: flex-start; }

/* Schriftauswahl im Alphabet: Gruppen (Kurrent, Fraktur, andere Alphabete) etwas abgesetzt */
.chips button.chip-group { margin-left: 12px; }
#alpha-subfonts { margin: -4px 0 12px; mask-image: none; flex-wrap: wrap; align-items: center; }
#alpha-subfonts::before { content: "Schrift:"; font-size: .8rem; color: var(--muted); }
#alpha-subfonts button { font-size: .8rem; padding: 4px 10px; }
