/* Eingebettete Schriften (SIL OFL 1.1, siehe app/fonts/) */
@font-face { font-family: "Cinzel"; src: url("fonts/cinzel.woff2") format("woff2"); font-weight: 400 900; font-style: normal; font-display: swap; }
@font-face { font-family: "IM Fell English"; src: url("fonts/imfell.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IM Fell English"; src: url("fonts/imfell-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Kalam"; src: url("fonts/kalam.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Covered By Your Grace"; src: url("fonts/covered.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Caveat"; src: url("fonts/caveat.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
/* Originalschriften der Formelsprachen (gekürzt, tools/subset-fonts.py); block, damit der Druck nie Kästchen zeigt */
@font-face { font-family: "Formel Keilschrift"; src: url("fonts/cuneiform.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "Formel Hieroglyphen"; src: url("fonts/hieroglyphs.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "Formel Ogham"; src: url("fonts/ogham.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "Formel Griechisch"; src: url("fonts/greek.woff2") format("woff2"); font-display: block; }

/* ---------------------------------------------------------------------------
   Farben: Oberfläche folgt Hell/Dunkel, die Buchseiten bleiben immer Pergament.
   --------------------------------------------------------------------------- */
:root {
  --ui-bg: #f4f1ea;
  --ui-panel: #fffdf8;
  --ui-line: #ddd3c0;
  --ui-text: #2b2118;
  --ui-muted: #7a6a58;
  --ui-accent: #8b1e1e;
  --ui-accent-text: #fff;
  --ui-hover: #efe6d4;

  --parch: #f3e9d2;
  --parch-edge: #e3d3ad;
  --ink: #3b2a1a;
  --ink-soft: #6b5640;
  --rubric: #8b1e1e;
  --gold: #a57a12;
  --note: #2d4a6b;

  --font-title: "Cinzel", "Trajan Pro", Georgia, serif;
  --font-body: "IM Fell English", "Garamond", Georgia, serif;
  --font-hand: "Caveat", "Segoe Script", cursive;
  /* drei Hände der Randnotizen: flowing (Caveat), angular, even */
  --font-hand-angular: "Covered By Your Grace", "Caveat", cursive;
  --font-hand-even: "Kalam", "Caveat", cursive;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ui-bg: #1c1915;
    --ui-panel: #25211c;
    --ui-line: #3d362d;
    --ui-text: #ece4d6;
    --ui-muted: #a8998a;
    --ui-accent: #c0504a;
    --ui-hover: #302a23;
  }
}
:root[data-theme="dark"] {
  --ui-bg: #1c1915;
  --ui-panel: #25211c;
  --ui-line: #3d362d;
  --ui-text: #ece4d6;
  --ui-muted: #a8998a;
  --ui-accent: #c0504a;
  --ui-hover: #302a23;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ui-bg);
  color: var(--ui-text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  display: flex;
  flex-direction: column;
}
button, select, input {
  font: inherit;
  color: inherit;
}
button {
  background: var(--ui-panel);
  border: 1px solid var(--ui-line);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
}
button:hover { background: var(--ui-hover); }
button.primary { background: var(--ui-accent); color: var(--ui-accent-text); border-color: var(--ui-accent); }
button.danger { color: var(--ui-accent); }
select, input[type="search"], input:not([type]), dialog input {
  background: var(--ui-panel);
  border: 1px solid var(--ui-line);
  border-radius: 6px;
  padding: 6px 8px;
  width: 100%;
}
.muted { color: var(--ui-muted); font-size: 0.9em; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; margin-top: 16px; }
.badge { background: var(--ui-accent); color: var(--ui-accent-text); border-radius: 4px; padding: 0 6px; font-size: 0.8em; }

/* --- Kopfzeile -------------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--ui-line);
  background: var(--ui-panel);
  flex-wrap: wrap;
}
#char-switch { width: auto; max-width: 200px; }
.char-admin { display: flex; flex-direction: column; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--ui-line); }
.brand { font-family: var(--font-title); font-weight: 600; font-size: 18px; }
.brand span { font-family: system-ui, sans-serif; font-weight: 400; font-size: 12px; color: var(--ui-muted); margin-left: 6px; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tabs button { border: none; background: none; border-bottom: 2px solid transparent; border-radius: 0; }
.tabs button.active { border-bottom-color: var(--ui-accent); font-weight: 600; }

main { flex: 1; min-height: 0; }
.view { display: none; height: 100%; }
.view.active { display: flex; }

/* --- Verzeichnis ------------------------------------------------------------ */
#view-browse { gap: 0; }
.filters {
  width: 360px;
  flex-shrink: 0;
  border-right: 1px solid var(--ui-line);
  display: flex;
  flex-direction: column;
  padding: 12px;
  gap: 8px;
  min-height: 0;
}
.frow { display: flex; gap: 6px; }
.spell-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.spell-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 6px;
  cursor: pointer;
}
.spell-list li:hover { background: var(--ui-hover); }
.spell-list li.sel { background: var(--ui-hover); outline: 1px solid var(--ui-line); }
.spell-list .lvl { width: 18px; text-align: center; font-weight: 600; color: var(--ui-muted); }
.spell-list .nm { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.spell-list .nm b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spell-list .nm i { font-size: 12px; color: var(--ui-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spell-list .ess svg { width: 20px; height: 20px; }
.spell-list .add { width: 28px; height: 28px; padding: 0; border-radius: 50%; }
.spell-list .add.on { background: var(--ui-accent); color: var(--ui-accent-text); border-color: var(--ui-accent); }

.detail { flex: 1; overflow-y: auto; padding: 16px 20px 16px 30px; min-width: 0; }
.detail .empty { color: var(--ui-muted); padding: 40px; }
.detail-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 12px; }
.detail-head h2 { margin: 0; font-family: var(--font-title); }
.detail-grid { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.detail-side { width: 340px; flex-shrink: 0; display: flex; flex-direction: column; gap: 12px; }
.facts { background: var(--ui-panel); border: 1px solid var(--ui-line); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.facts svg { width: 18px; height: 18px; }
.why { font-size: 13px; color: var(--ui-muted); }

.essrow { display: flex; align-items: center; gap: 6px; }
.essrow svg { width: 18px; height: 18px; flex-shrink: 0; }
.essname { width: 54px; }
.essbar { flex: 1; height: 6px; background: color-mix(in srgb, currentColor 12%, transparent); border-radius: 3px; overflow: hidden; }
.essbar i { display: block; height: 100%; background: var(--rubric); }
.esspct { width: 38px; text-align: right; font-variant-numeric: tabular-nums; }

.rules {
  background: var(--ui-panel);
  border: 1px solid var(--ui-line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
}
.rules-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.rules-source { margin-top: 0.5em; padding: 0.35em 0.6em; border: 1px dashed currentColor; border-radius: 4px; font-size: 0.85em; opacity: 0.9; overflow-wrap: anywhere; }
.rules-source a { color: inherit; }
.rules-title span { font-weight: 400; color: var(--ui-muted); font-size: 12px; margin-left: 4px; }
.rules .rr b, .facts b, .rules-p b { color: var(--ui-accent); font-weight: 800; }
.rules-desc p, .rules .rules-p { margin: 6px 0; }
.rules-page .rules-p, .scroll-back .rules-p { margin: 0.35em 0; text-align: justify; hyphens: auto; }

/* --- Buch ------------------------------------------------------------------- */
#view-theory { flex-direction: column; overflow-y: auto; padding: 16px 20px; }
#view-book { gap: 0; }
.book-main { flex: 1; min-width: 0; overflow-y: auto; padding: 16px 30px; }
.book-bar { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.seg-switch { display: inline-flex; margin-right: 8px; }
.seg-switch[hidden] { display: none; }
.seg-switch button { border-radius: 0; margin: 0; }
.seg-switch button:first-child { border-radius: 6px 0 0 6px; }
.seg-switch button + button { border-radius: 0 6px 6px 0; border-left: none; }
.seg-switch button.on { background: var(--ui-hover); outline: 1px solid var(--ui-line); outline-offset: -1px; font-weight: 600; }
.spell-list .pg { font-size: 12px; color: var(--ui-muted); white-space: nowrap; }

/* Blättern */
.pager { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; margin: 8px 0 14px; }
.pager button { min-width: 38px; }
.pager button:disabled { opacity: 0.4; cursor: default; }
.pager button.on { background: var(--ui-hover); outline: 1px solid var(--ui-line); }
.pager-pos { display: inline-flex; align-items: center; gap: 4px; margin: 0 6px; }
.pager-pos input { width: auto; min-width: 3.5em; font-variant-numeric: tabular-nums; background: var(--ui-panel); border: 1px solid var(--ui-line); border-radius: 6px; padding: 4px 6px; text-align: center; }
/* Bandwahl bei mehreren Bänden */
.vol-tabs { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin: 8px 0 0; }
.vol-tabs button { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.2; padding: 4px 12px; }
.vol-tabs button .muted { font-size: 0.75em; }
.vol-tabs button.on { background: var(--ui-hover); outline: 1px solid var(--ui-line); }
#book-stats .warn { color: var(--ui-accent); font-size: 0.9em; }
input.num { width: 6em; display: inline-block; }
.pages.spread { justify-content: safe center; flex-wrap: nowrap; overflow-x: auto; }
.pages.spread .page.offstage { display: none; }
.pages.spread.fitting { visibility: hidden; height: 210mm; overflow: hidden; }
/* Seitenzoom: nur die Seiten, gemessen wird bei 100 % */
.pages.spread > .page, .pages.spread > .page-ghost { zoom: var(--page-zoom, 1); }
.pages.spread.fitting > .page { zoom: 1; }
.pager-zoom { display: inline-flex; gap: 2px; margin-left: 10px; }
.pager-zoom .pager-zoom-val { min-width: 4.2em; font-variant-numeric: tabular-nums; }

/* Seitenleisten: links Filter, rechts Inhalt. Eine angedockte Lasche am Außenrand klappt sie ein und aus;
   eingeklappt bleibt nur die Lasche sichtbar, nichts verschiebt sich. */
.side { position: relative; }
.side-toggle {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
  width: 22px; height: 40px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--ui-panel); border: 1px solid var(--ui-line);
  font-size: 15px; line-height: 1; color: var(--ui-muted);
}
.side-toggle:hover { color: var(--ui-text); background: var(--ui-hover); }
.filters .side-toggle { left: 100%; border-left: none; border-radius: 0 6px 6px 0; }
.filters .side-toggle::before { content: "‹"; }
.filters.collapsed { width: 0; padding: 0; border-right: none; }
.filters.collapsed > :not(.side-toggle) { display: none; }
.filters.collapsed .side-toggle { border-left: 1px solid var(--ui-line); left: 0; border-radius: 0 6px 6px 0; }
.filters.collapsed .side-toggle::before { content: "›"; }
.toc-side { width: 300px; flex-shrink: 0; border-left: 1px solid var(--ui-line); padding: 12px 10px; display: flex; flex-direction: column; min-height: 0; }
.toc-side .side-toggle { right: 100%; border-right: none; border-radius: 6px 0 0 6px; }
.toc-side .side-toggle::before { content: "›"; }
.toc-side h3 { margin: 0 0 6px; font-family: var(--font-title); font-weight: 600; }
.toc-side.collapsed { width: 0; padding: 0; border-left: none; }
.toc-side.collapsed > :not(.side-toggle) { display: none; }
.toc-side.collapsed .side-toggle { right: 0; border-right: 1px solid var(--ui-line); }
.toc-side.collapsed .side-toggle::before { content: "‹"; }
.toc-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.toc-group { display: block !important; padding: 0 !important; cursor: default !important; }
.toc-group:hover { background: none !important; }
.toc-group > ul { list-style: none; margin: 0 0 6px; padding: 0; display: none; }
.toc-group.open > ul { display: block; }
.toc-grade { width: 100%; display: flex; justify-content: space-between; align-items: center; border: none; border-radius: 6px; background: none; padding: 6px 4px; font-family: var(--font-title); font-weight: 600; color: var(--ui-accent); text-align: left; }
.toc-grade::before { content: "▸"; margin-right: 6px; font-size: 0.8em; }
.toc-group.open > .toc-grade::before { content: "▾"; }
.toc-grade span:first-child { flex: 1; }
.toc-grade .muted { font-family: system-ui, sans-serif; font-weight: 400; }
.toc-list li { display: flex; align-items: center; gap: 8px; padding: 3px 4px; border-radius: 6px; cursor: pointer; }
.toc-list li:hover { background: var(--ui-hover); }
.toc-list li.toc-grade { font-family: var(--font-title); font-weight: 600; color: var(--ui-accent); cursor: default; margin-top: 8px; }
.toc-list li.toc-grade:hover { background: none; }
.toc-list .q svg { width: 18px; height: 18px; display: block; }
.toc-list .q { width: 18px; flex-shrink: 0; }
.toc-list .nm { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.toc-list .nm b { font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toc-list .nm i { font-size: 11px; color: var(--ui-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toc-list .pg { font-size: 12px; color: var(--ui-muted); }

dialog { border: 1px solid var(--ui-line); border-radius: 10px; background: var(--ui-panel); color: var(--ui-text); max-width: 520px; width: calc(100% - 32px); }
dialog form { display: flex; flex-direction: column; gap: 10px; }
dialog label { display: flex; flex-direction: column; gap: 4px; }
dialog label.check { flex-direction: row; align-items: center; gap: 8px; }
dialog label.inline { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 6px; }
/* Einstellungen: Abschnitte wie Buchkapitel, links die Liste, rechts der Abschnitt */
dialog#settings { max-width: 760px; height: min(640px, calc(100vh - 32px)); padding: 0; }
#settings form { display: grid; grid-template-columns: 180px 1fr; grid-template-rows: 1fr auto; height: 100%; gap: 0; }
.set-nav { grid-row: 1 / 3; display: flex; flex-direction: column; gap: 2px; padding: 12px 8px; border-right: 1px solid var(--ui-line); background: var(--ui-bg, transparent); }
.set-nav button { text-align: left; border: none; background: none; border-radius: 6px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; font-weight: 500; }
.set-nav button small { font-size: 11px; font-weight: 400; color: var(--ui-muted); }
.set-nav button.on { background: var(--ui-hover); box-shadow: inset 3px 0 0 var(--ui-accent); }
.set-body { overflow-y: auto; padding: 4px 18px 12px; min-height: 0; }
.set-sec { display: flex; flex-direction: column; gap: 10px; }
.set-sec[hidden] { display: none; }
.set-sec h3 { margin: 12px 0 0; }
.set-note { margin: 0; font-size: 0.9em; }
.set-foot { display: flex; justify-content: flex-end; padding: 10px 18px; border-top: 1px solid var(--ui-line); }
#settings .char-admin { border-bottom: none; }
#settings label.check { align-items: flex-start; }
#settings label.check input { width: auto; flex: none; margin-top: 3px; }
@media (max-width: 640px) {
  #settings form { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  .set-nav { grid-row: auto; flex-direction: row; overflow-x: auto; scrollbar-width: none; border-right: none; border-bottom: 1px solid var(--ui-line); padding: 6px; }
  .set-nav button { flex: 0 0 auto; padding: 6px 10px; }
  .set-nav button small { display: none; }
  .set-nav button.on { box-shadow: inset 0 -3px 0 var(--ui-accent); }
}
.filebtn { border: 1px solid var(--ui-line); border-radius: 6px; padding: 6px 12px; cursor: pointer; display: inline-block !important; }

/* ---------------------------------------------------------------------------
   BUCHSEITEN (A5)
   --------------------------------------------------------------------------- */
.pages { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.pages.preview { flex: 1; min-width: 0; }
.page {
  width: 148mm;
  height: 210mm;
  flex-shrink: 0;
  position: relative;
  background: var(--parch);
  background-image: radial-gradient(ellipse at center, transparent 60%, var(--parch-edge) 100%);
  color: var(--ink);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  padding: 11mm 12mm 13mm;
  font-family: var(--font-body);
  overflow: hidden;
}
.page-inner {
  --fit: 1;
  height: 100%;
  overflow: hidden;
  font-size: calc(10pt * var(--fit));
  line-height: 1.32;
}
.opt.off { display: none; }
.page-inner.overflow, .half.overflow { box-shadow: inset 0 -6px 0 -2px var(--rubric); }
.page-foot {
  position: absolute;
  left: 12mm;
  right: 12mm;
  bottom: 5mm;
  display: flex;
  justify-content: space-between;
  font-size: 8pt;
  color: var(--ink-soft);
  font-family: var(--font-title);
  letter-spacing: 0.04em;
}
.page.halves .page-inner { display: flex; flex-direction: column; }
.page .half { --fit: 1; height: 50%; overflow: hidden; font-size: calc(9.5pt * var(--fit)); padding-bottom: 3mm; }
.page .half + .half { border-top: 1px dashed var(--ink-soft); padding-top: 3mm; }

.page h3 { font-family: var(--font-title); font-weight: 600; font-size: 1.35em; margin: 0 0 0.5em; text-align: center; color: var(--rubric); }
.page h4 { font-family: var(--font-title); font-weight: 600; font-size: 0.95em; margin: 0.8em 0 0.25em; letter-spacing: 0.05em; color: var(--rubric); }
.page-inner > h4:first-child, .page-inner > .blk:first-child > h4:first-child, .half > .blk:first-child > h4:first-child { margin-top: 0; }
.page p { margin: 0 0 0.45em; text-align: justify; hyphens: auto; }
.page ol { margin: 0 0 0.4em; padding-left: 1.3em; }
.page .hint { font-style: italic; color: var(--ink-soft); }

.sp-head { text-align: center; margin-bottom: 0.3em; }
.sp-meta { font-family: var(--font-title); font-size: 0.75em; letter-spacing: 0.12em; color: var(--ink-soft); text-transform: uppercase; }
.sp-title { font-family: var(--font-title); font-weight: 600; font-size: 1.65em; margin: 0.1em 0 0; color: var(--rubric); line-height: 1.15; }
.sp-epithet { font-style: italic; font-size: 1.05em; }
.sp-rulename { font-size: 0.75em; color: var(--ink-soft); letter-spacing: 0.05em; }
.sp-head.small .sp-title { font-size: 1.3em; }

.circle-box { margin: 0 auto; display: block; }
.circle-box svg { width: 100%; height: auto; display: block; }
.circle-box.big { width: calc(105mm * var(--fit)); margin: 0.1em auto 0.2em; }
.circle-box.medium { width: 60mm; }
.circle-box.small { width: 44mm; }
.circle-box.detail { width: 78mm; margin-top: 0.6em; }
.circle-box.anatomy { width: 92mm; }
.circle-box.mini { width: 30mm; float: left; margin: 0 0.8em 0.2em 0; }
.circle-box.mirror svg { transform: scaleX(-1); }
.circle-box figcaption { text-align: center; font-style: italic; font-size: 0.85em; color: var(--ink-soft); }
.subm { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm; }
.circle-box.sub { width: 100%; }

.formula { text-align: center; margin: 0.2em 0 0.4em; }
.formula .fl { font-family: var(--font-title); font-size: 1em; letter-spacing: 0.06em; color: var(--ink); }
.formula .fl:first-child { color: var(--rubric); font-weight: 600; }
.formula .tone { font-style: italic; font-size: 0.85em; color: var(--ink-soft); margin-top: 0.15em; text-wrap: balance; }
.formula .tech { font-size: 0.78em; color: var(--ink-soft); margin-top: 0.1em; letter-spacing: 0.02em; }
.comp { font-size: 0.9em; border-top: 1px solid color-mix(in srgb, var(--ink) 30%, transparent); padding-top: 0.25em; }
.comp-tags { font-family: var(--font-title); font-weight: 600; letter-spacing: 0.1em; }
.comp-time { float: right; font-style: italic; }
.comp .orig { color: var(--ink-soft); }
.summary { font-style: italic; }

.half-grid { display: grid; grid-template-columns: 44mm 1fr; gap: 4mm; align-items: start; }
.l1-grid { display: grid; grid-template-columns: 60mm 1fr; gap: 4mm; align-items: center; }
.l1-grid .formula { text-align: left; }

.struct { display: grid; grid-template-columns: auto 1fr; gap: 0.15em 0.8em; margin: 0 0 0.4em; }
.struct dt { font-family: var(--font-title); font-size: 0.85em; font-weight: 600; padding-top: 0.1em; }
.struct dd { margin: 0; }

.steps { display: flex; flex-direction: column; gap: 0.3em; }
.steps .ph { font-family: var(--font-title); font-weight: 600; font-size: 0.9em; }
.steps.compact ol { margin-bottom: 0.15em; }

.note {
  font-family: var(--font-hand);
  color: var(--note);
  font-size: 1.25em;
  line-height: 1.1;
  margin: 0.6em 0 0 auto;
  max-width: 75%;
  transform: rotate(-1.2deg);
  border-left: 2px solid color-mix(in srgb, var(--note) 40%, transparent);
  padding-left: 0.5em;
}

table.calib, table.corr, table.toc, table.aff { border-collapse: collapse; width: 100%; font-size: 0.9em; margin-bottom: 0.5em; }
table.calib th, table.corr th { font-family: var(--font-title); font-weight: 600; text-align: left; font-size: 0.85em; }
table.calib th, table.calib td, table.corr th, table.corr td { border-bottom: 1px solid color-mix(in srgb, var(--ink) 25%, transparent); padding: 0.15em 0.4em; }
p.ink { font-size: 0.9em; margin: 0.2em 0 0.5em; }
p.ink b { font-family: var(--font-title); font-weight: 600; font-size: 0.85em; margin-right: 0.3em; }
table.toc td { padding: 0.12em 0.3em; border-bottom: 1px dotted color-mix(in srgb, var(--ink) 35%, transparent); }
table.toc .tg { font-family: var(--font-title); width: 2.5em; color: var(--rubric); }
table.toc .tn { display: block; font-size: 0.8em; color: var(--ink-soft); }
table.toc .tp { text-align: right; width: 3em; }
table.aff th { font-weight: 600; font-size: 0.8em; text-align: left; white-space: nowrap; }
table.aff th svg { width: 14px; height: 14px; display: block; margin: auto; }
table.aff td { text-align: center; font-size: 0.8em; background: color-mix(in srgb, var(--rubric) calc(var(--v) * 70%), transparent); color: var(--ink); }

.gloss { columns: 2; column-gap: 1.2em; font-size: 0.9em; }
.gloss b { font-family: var(--font-title); font-weight: 600; font-size: 0.9em; }
.sketches { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm; }
.circle-box.sketch { position: relative; width: 100%; }
.circle-box.sketch svg { opacity: 0.75; }
.circle-box.sketch::after { content: ""; position: absolute; left: 10%; right: 10%; top: 40%; height: 0; border-top: 2px solid var(--rubric); transform: rotate(-35deg); opacity: 0.7; }
.related { margin: 0 0 0.4em; padding-left: 1.1em; }
.related span { color: var(--ink-soft); font-size: 0.85em; }
.annotated-box { width: 92mm; }
.mythic-box { width: 62mm; }
.annot-list { font-size: 0.9em; padding-left: 1.6em; margin: 0.3em 0; }
.annot-list li { margin-bottom: 0.15em; }
.annot-list li::marker { color: var(--rubric); font-weight: 700; }
.quick-row { display: flex; gap: 0.8em; align-items: center; }
.quick-row svg { width: 18mm; height: 18mm; flex-shrink: 0; }
.legend-grid.quick-schools { grid-template-columns: repeat(3, 1fr); }
.legend-grid.quick-schools svg { width: 30px; height: 30px; }
.legend-tiles { display: grid; gap: 0.5em 0.6em; text-align: center; font-size: 0.8em; }
.legend-tiles.c4 { grid-template-columns: repeat(4, 1fr); } .legend-tiles.c5 { grid-template-columns: repeat(5, 1fr); }
.legend-tiles figure { margin: 0; }
.legend-tiles span { color: var(--ink-soft); font-style: italic; }
.legend-tiles.rings svg { width: 12mm; height: 12mm; }
.legend-tiles.shapes svg { width: 20mm; height: 9mm; }
.pr-grid.qparts svg { width: auto; max-width: 100%; height: 11mm; }
.quick-ex { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2mm; margin-top: 0.6em; }
.quick-ex figure { margin: 0; text-align: center; font-size: 0.8em; }
.quick-ex svg { width: 20mm; height: 20mm; }
.quick-ex span { color: var(--ink-soft); }
.scroll-front { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; text-align: center; }
.scroll-front .sp-title { font-size: 2em; }
.scroll-front .sp-epithet { font-size: 1.15em; margin-bottom: 0.6em; }
.scroll-front .sp-rulename { margin-top: 0.4em; font-size: 0.9em; }
.circle-box.scroll-circle { width: calc(122mm * var(--fit)); }
.scroll-back .page-inner { font-size: calc(9.5pt * var(--fit)); }
/* Schriftrollen-Rückseite in echtem A4: normale Schriftgröße, Regeltext zweispaltig */
.page.a4native { width: 210mm; height: 297mm; padding: 14mm 16mm 16mm; }
.page.a4native .page-foot { left: 16mm; right: 16mm; bottom: 7mm; }
.a4native .page-inner { font-size: 10.5pt; }
.a4native .rules { column-count: 2; column-gap: 7mm; column-rule: 1px solid color-mix(in srgb, var(--ink) 20%, transparent); }
.a4native .rules .rules-title, .a4native .rules .rules-source { column-span: all; }
.scroll-back .rules { background: none; border: none; border-top: 1px solid var(--ink-soft); border-radius: 0; color: var(--ink); padding: 0.4em 0 0; margin-top: 0.6em; font-family: Georgia, "Times New Roman", serif; font-size: 0.85em; }
.scroll-back .rules .rr b, .rules-page .rules .rr b, .page .rules-p b { color: var(--rubric); font-weight: 800; }
.page b, .page strong { font-weight: 800; color: var(--rubric); }
.page .rules-title { color: var(--rubric); }
.essbars .esstext { font-size: 0.85em; margin: 0 0 0.35em 1.7em; }
/* Anteil in Teilen („achteinhalb Teile“, „one and a half parts“): feste Spalte, damit die Balken gleich lang bleiben */
.essbars .esspct { width: 9.5em; white-space: nowrap; font-variant-numeric: normal; }
.counter::after { content: ""; display: block; clear: both; }
.longf .lf { font-family: var(--font-title); letter-spacing: 0.04em; margin-bottom: 0.15em; }
.longf .lf span { display: inline-block; width: 1.6em; color: var(--rubric); font-weight: 600; }
.longf .lf.R { padding-left: 1.6em; font-style: italic; font-family: var(--font-body); }
.rules-en { font-size: 0.85em; font-family: Georgia, serif; color: var(--ink-soft); }

.laws li { margin-bottom: 0.3em; }
ol.laws:has(+ ol.laws) { margin-bottom: 0; }
ol.laws + ol.laws { margin-top: 0; }
.legend-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35em 0.8em; font-size: 0.88em; }
.legend-grid.schools, .legend-grid.signs { grid-template-columns: 1fr; }
.legend-grid .lg { display: flex; gap: 0.5em; align-items: center; }
.legend-grid svg { width: 26px; height: 26px; flex-shrink: 0; }
.legend-grid.schools svg { width: 44px; height: 44px; }
.legend-grid span { color: var(--ink-soft); }
.combos { font-size: 0.85em; }

.title-page .page-inner { display: flex; align-items: center; justify-content: center; text-align: center; }
.tp h1 { font-family: var(--font-title); color: var(--rubric); font-size: 2.2em; margin: 0.4em 0 0.2em; }
.tp-owner { font-family: var(--font-title); font-size: 1.3em; letter-spacing: 0.15em; }
.tp-sub { font-style: italic; margin-top: 0.6em; }
.tp-vol { font-family: var(--font-title); color: var(--rubric); font-size: 1.15em; letter-spacing: 0.08em; margin-top: 0.8em; }
.tp-sigil { width: 90mm; margin: auto; }
.rules-page .rules { font-family: Georgia, "Times New Roman", serif; }
.rules-page .rules { background: none; border: none; border-bottom: 1px solid var(--ink-soft); border-radius: 0; color: var(--ink); padding: 0 0 0.5em; margin-bottom: 0.5em; font-size: 0.85em; }

/* --- Beschriftung und Schnellglyphen ------------------------------------------ */
svg.annotated > g:not(.layer-annot) { opacity: 0.55; }
svg .annot circle { fill: var(--rubric); stroke: var(--parch); stroke-width: 1.5; }
svg .annot text { fill: #fff !important; stroke: none !important; font-family: Arial, Helvetica, sans-serif; font-weight: 700; font-variant-numeric: lining-nums; }
svg.quick { color: var(--ink); overflow: visible; }
svg.quick * { fill: none; stroke: currentColor; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
svg.quick .fill { fill: currentColor; stroke: none; }
svg.quick .thin { stroke-width: 2.4; }
svg.quick .dash { stroke-dasharray: 9 7; }
svg.quick text.ql { fill: currentColor; stroke: none; font-family: Georgia, "Times New Roman", serif; font-weight: 700; }
svg.quick text.ql.script-greek, svg.quick text.ql.script-cuneiform, svg.quick text.ql.script-hieroglyphs, svg.quick text.ql.script-ogham { font-weight: 400; }
svg.quick path.ql-proto { stroke-width: 2.4; }
/* Hieroglyphen sind als Umrisszeichnung sehr fein: in der Schnellglyphe mit Strich verstärkt */
svg.quick text.ql.script-hieroglyphs { stroke: currentColor; stroke-width: 0.9; paint-order: stroke; }
svg.quick text.ql.script-cuneiform { stroke: currentColor; stroke-width: 0.3; }
svg.quick text.ql.script-greek { stroke: currentColor; stroke-width: 0.6; }
svg.quick .accent { color: var(--rubric); }
.sp-head { position: relative; }
.sp-quick { position: absolute; top: -0.2em; right: 0; width: 18mm; height: 18mm; }
.sp-head.small .sp-quick { width: 14mm; height: 14mm; }
.spell-list .quick { width: 22px; height: 22px; }
table.toc .tq svg { width: 7mm; height: 7mm; display: block; }

/* --- Kreis-Modal ------------------------------------------------------------ */
.page svg.circle { cursor: zoom-in; }
.circle-modal { max-width: min(1500px, 98vw); width: 98vw; max-height: 96vh; padding: 0; background: var(--parch); color: var(--ink); border: none; }
.circle-modal::backdrop { background: rgba(20, 14, 8, 0.7); }
.cm-body { display: flex; gap: 16px; align-items: stretch; max-height: 96vh; }
.cm-figure { flex: 1; display: flex; align-items: center; justify-content: center; padding: 12px; min-width: 0; }
.cm-figure svg { width: min(90vh, 100%); height: auto; max-height: 92vh; cursor: default; }
.cm-side { width: 340px; flex-shrink: 0; padding: 16px; overflow-y: auto; font-family: var(--font-body); border-left: 1px solid var(--parch-edge); display: flex; flex-direction: column; gap: 10px; }
.cm-side h3 { font-family: var(--font-title); color: var(--rubric); margin: 0; }
.cm-side .muted { color: var(--ink-soft); }
.cm-side .struct { font-size: 14px; }
.cm-side button { background: var(--parch); color: var(--ink); border-color: var(--parch-edge); }
.cm-side button.primary { background: var(--rubric); color: #fff; }
.cm-formula { font-family: var(--font-title); color: var(--rubric); font-size: 14px; letter-spacing: 0.04em; }
.cm-ess .essrow svg { width: 18px; height: 18px; }
@media (max-width: 900px) { .cm-body { flex-direction: column; } .cm-side { width: 100%; border-left: none; } }

/* --- SVG-Kreise ------------------------------------------------------------- */
svg.circle, svg.glyph { color: var(--ink); overflow: visible; }
svg.circle *, svg.glyph * { fill: none; stroke: currentColor; stroke-width: 1.1; stroke-linejoin: round; stroke-linecap: round; }
svg.glyph * { stroke-width: 1.4; vector-effect: non-scaling-stroke; }
svg .fill { fill: currentColor; }
svg .knock { fill: var(--parch); }
svg .thin { stroke-width: 0.55; }
svg .faint { opacity: 0.45; }
svg .dash { stroke-dasharray: 4 3; }
svg .thick { stroke-width: 3; }
svg .accent, svg.accent { color: var(--rubric); }
svg .layer-shape { opacity: 0.32; }
svg .ess-seg { stroke-width: 5; }
svg text { stroke: none; fill: currentColor; font-family: var(--font-title); }
svg textPath { stroke: none; fill: currentColor; }
svg .guide { stroke: none; fill: none; }
svg .band-text { letter-spacing: 0.5px; }
svg .script-cuneiform { font-family: "Formel Keilschrift"; letter-spacing: 0; }
svg .script-hieroglyphs { font-family: "Formel Hieroglyphen"; letter-spacing: 0; }
svg .script-ogham { font-family: "Formel Ogham"; letter-spacing: 0; }
svg .script-greek { font-family: "Formel Griechisch"; }
/* Das Band erbt Strich ohne Füllung (svg.circle *): bei der dünnen Cinzel wirkt das voll, bei der Noto Serif hohl */
svg.circle .band-text.script-greek, svg.circle .band-text.script-greek textPath { fill: currentColor; stroke: currentColor; stroke-width: 0.35; }
/* Absichtszeichen im Fließtext (Erklärsatz zur Schnellglyphe) */
.mark.script-cuneiform { font-family: "Formel Keilschrift"; font-weight: normal; }
.mark.script-hieroglyphs { font-family: "Formel Hieroglyphen"; font-weight: normal; font-size: 1.2em; line-height: 1; -webkit-text-stroke: 0.04em currentColor; }
.mark.script-ogham { font-family: "Formel Ogham"; font-weight: normal; }
.mark.script-greek { font-family: "Formel Griechisch"; }
.mark-proto { display: inline-block; width: 0.55em; height: 0.95em; vertical-align: -0.1em; }
.mark-proto path { fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
svg .order-num { font-size: 6px; }
svg .corner-label { font-family: var(--font-body); }
svg .gilded { color: var(--gold); }
.ui-glyph svg, .spell-list svg, .facts svg { color: var(--ui-text); }
.spell-list svg .knock, .facts svg .knock { fill: var(--ui-panel); }

/* --- Druck ------------------------------------------------------------------ */
/* --- Tagesvorbereitung -------------------------------------------------------- */
#view-prepare { overflow-y: auto; }
.prep { max-width: 900px; width: 100%; margin: 0 auto; padding: 16px 20px; }
.prep h2 { margin: 0; font-family: var(--font-title); font-weight: 600; }
.prep-bar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.prep-bar button.on { background: var(--ui-hover); outline: 1px solid var(--ui-line); }
.prep-presets { width: 100%; }
.prep-presets select { width: auto; flex: 1; min-width: 180px; }
.prep-editor { background: var(--ui-panel); border: 1px solid var(--ui-line); border-radius: 8px; padding: 12px; margin-bottom: 16px; }
.prep-editor table { border-collapse: collapse; width: 100%; margin-bottom: 8px; }
.prep-editor th { text-align: left; font-weight: 600; font-size: 0.85em; color: var(--ui-muted); padding: 2px 4px; }
.prep-editor td { padding: 2px 4px; }
.prep-editor td:first-child { width: 3em; font-weight: 600; text-align: center; }
.prep-editor input { background: var(--ui-panel); border: 1px solid var(--ui-line); border-radius: 6px; padding: 4px 6px; width: 100%; }
.prep-editor input[type="number"] { width: 5em; }
.prep-editor .row label { display: flex; align-items: center; gap: 6px; }
.prep-grade { margin-bottom: 14px; }
.prep-grade h3 { font-family: var(--font-title); font-weight: 600; font-size: 1.05em; margin: 0 0 4px; border-bottom: 1px solid var(--ui-line); padding-bottom: 2px; }
.prep-grade h3 .muted { font-family: system-ui, sans-serif; font-weight: 400; margin-left: 6px; }
.prep-grade .warn { font-family: system-ui, sans-serif; font-size: 0.8em; font-weight: 400; color: var(--ui-accent); margin-left: 6px; }
.prep-list { list-style: none; margin: 0; padding: 0; }
.prep-list li { display: flex; align-items: center; gap: 10px; padding: 4px 6px; border-radius: 6px; min-height: 40px; }
.prep-list li:hover { background: var(--ui-hover); }
.prep-list .nm { flex: 1; display: flex; flex-direction: column; min-width: 0; cursor: pointer; }
.prep-list .nm b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prep-list .nm i { font-size: 12px; color: var(--ui-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prep-list .q svg { width: 24px; height: 24px; display: block; }
.p-cast { width: 32px; height: 32px; padding: 0; flex-shrink: 0; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--ui-line); border-radius: 6px; }
.p-cast.on { background: var(--ui-accent); color: var(--ui-accent-text); border-color: var(--ui-accent); }
.p-cast0 { flex-shrink: 0; font-size: 0.85em; padding: 4px 8px; }
.p-rm, .p-unjoker { border: none; background: none; color: var(--ui-muted); font-size: 1.2em; padding: 0 8px; }
.prep-list li.used .nm b { text-decoration: line-through; color: var(--ui-muted); }
.prep-list li.used .q { opacity: 0.4; }
.prep-list li.empty button { width: 100%; text-align: left; border-style: dashed; color: var(--ui-muted); background: none; }
.prep-foot { margin-top: 24px; }
.prep-pick { width: min(520px, 94vw); max-height: 80vh; border: 1px solid var(--ui-line); border-radius: 10px; background: var(--ui-panel); color: var(--ui-text); padding: 14px; }
.prep-pick[open] { display: flex; flex-direction: column; gap: 8px; }
.prep-pick h3 { margin: 0; font-family: var(--font-title); font-weight: 600; }
.prep-pick .spell-list { max-height: 55vh; }
.prep-pick::backdrop { background: rgb(0 0 0 / 0.4); }
.page table.prep-sheet { table-layout: fixed; }
.page table.prep-sheet td { padding: 0.35em 0.3em; height: 2.2em; }
.page table.prep-sheet .tq { width: 2.6em; }
.page table.prep-sheet .cb { width: 1.6em; font-size: 1.3em; line-height: 1; }
.page table.prep-sheet .blank { color: var(--ink-soft); font-style: italic; }

#print-root { display: none; }
/* Während des Druckens messbar, aber außerhalb des Bildschirms – sonst kann autofit() nichts messen */
body.printing #print-root { display: block; position: absolute; left: -10000px; top: 0; }
@page { size: A5; margin: 0; }
label.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
@media print {
  body { background: none; display: block; }
  body > :not(#print-root) { display: none !important; }
  #print-root { display: block !important; position: static !important; }
  .page { box-shadow: none; margin: 0; page-break-after: always; break-after: page; background-image: none; }
  /* A4: A5-Seite um Faktor √2 vergrößern */
  .paper-a4 .page:not(.a4native) { zoom: 1.4142; }
  /* Ohne Hintergrund: kein Pergament; Aussparungen weiß = keine Tinte, das Papier scheint durch */
  .no-bg { --parch: #fff; --parch-edge: #fff; }
  .no-bg .page { background: none !important; }
  /* A4 quer: zwei A5-Seiten nebeneinander */
  .paper-a4-2up .sheet { display: flex; width: 297mm; height: 210mm; break-after: page; page-break-after: always; overflow: hidden; }
  .paper-a4-2up .sheet .page { break-after: auto; page-break-after: auto; }
  .page-inner.overflow, .half.overflow { box-shadow: none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (max-width: 900px) {
  #view-browse { flex-direction: column; overflow-y: auto; }
  .filters { width: 100%; border-right: none; border-bottom: 1px solid var(--ui-line); max-height: 45vh; }
  #view-book { flex-direction: column; overflow-y: auto; }
  .book-main { overflow: visible; }
  .filters.collapsed, .toc-side.collapsed { width: 100%; height: 0; padding: 0; border: none; }
  .toc-side { width: 100%; border-left: none; border-top: 1px solid var(--ui-line); max-height: 60vh; }
  .filters .side-toggle, .filters.collapsed .side-toggle { transform: none; top: 100%; left: auto; right: 16px; width: 40px; height: 22px; border: 1px solid var(--ui-line); border-top: none; border-radius: 0 0 6px 6px; }
  .filters .side-toggle::before { content: "▴"; }
  .filters.collapsed .side-toggle::before { content: "▾"; }
  .toc-side .side-toggle, .toc-side.collapsed .side-toggle { transform: none; top: auto; bottom: 100%; right: 16px; width: 40px; height: 22px; border: 1px solid var(--ui-line); border-bottom: none; border-radius: 6px 6px 0 0; }
  .toc-side .side-toggle::before { content: "▾"; }
  .toc-side.collapsed .side-toggle::before { content: "▴"; }
  .detail-side { width: 100%; }
  .prep { padding: 12px 16px; }
  .tabs { overflow-x: auto; flex-basis: 100%; order: 3; }
  .tabs button { white-space: nowrap; }
  .page { transform-origin: top left; }
}

/* --- Kreisfenster: Knöpfe untereinander ------------------------------------------ */
.cm-side .row { flex-direction: column; align-items: stretch; }

/* --- Doppelseiten wie im Buch, Notizseiten ------------------------------------------ */
.page-ghost { width: 148mm; height: 210mm; flex-shrink: 0; }
.filler { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4mm; opacity: 0.35; }
.filler-orn { width: 30mm; height: 30mm; fill: none; stroke: var(--ink); stroke-width: 1.2; }
.filler-orn .thin { stroke-width: 0.6; }
.filler-txt { font-family: var(--font-hand); font-size: 14pt; color: var(--ink-soft); }

/* --- Regelverweise im Zauberkopf --------------------------------------------------- */
.sp-ref { font-size: 0.7em; color: var(--ink-soft); letter-spacing: 0.04em; margin-top: 0.2em; }
.sp-qr { position: absolute; top: -0.2em; left: 0; width: 13mm; height: 13mm; color: var(--ink); }
.sp-qr svg { width: 100%; height: 100%; display: block; fill: currentColor; stroke: none; }
.rules-i {
  position: absolute; left: 1px; top: 1px; width: 26px; height: 26px; padding: 0; z-index: 2;
  border-radius: 50%; border: 1px solid var(--ink-soft); color: var(--ink); background: var(--parch); /* genaue Tönung: tintToPage() */
  font: italic 700 13px/1 Georgia, serif; cursor: pointer;
}
.rules-i.full-i { top: 31px; font: 700 16px/1 Georgia, serif; }
.full-modal { max-width: 98vw; width: 98vw; max-height: 94vh; overflow: hidden; flex-direction: column; }
.full-modal[open] { display: flex; }
.full-modal .fm-head h3 { margin: 0; }
.full-modal #full-pages { flex: 1; min-height: 0; overflow: auto; }
.full-modal form { flex-direction: row; gap: 8px; }
.rules-i:hover { background: var(--rubric); color: #fff; border-color: var(--rubric); }
.rb-no { color: var(--rubric); font-weight: 800; }
.rules-modal { max-width: 640px; max-height: 88vh; }
.rules-modal .rm-body { overflow-y: auto; max-height: calc(88vh - 90px); }
.rules-modal form { flex-direction: row; }
fieldset.refs { border: 1px solid var(--ui-line); border-radius: 6px; padding: 6px 10px; display: flex; flex-direction: column; gap: 4px; }
fieldset.refs legend { font-size: 0.9em; color: var(--ui-muted); }
fieldset.profiles { border: 1px solid var(--ui-line); border-radius: 6px; padding: 6px 10px; display: flex; flex-direction: column; gap: 6px; }
fieldset.profiles legend { font-size: 0.9em; color: var(--ui-muted); }
.prof-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.prof-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.prof-list .prof-name { font-weight: 600; }
.prof-list .prof-src { color: var(--ui-muted); font-size: 0.9em; flex: 1; }
.prof-list li.shadowed .prof-name { font-weight: normal; color: var(--ui-muted); }
fieldset.known-langs { border: 1px solid var(--ui-line); border-radius: 6px; padding: 6px 10px; display: flex; flex-direction: column; gap: 4px; }
fieldset.known-langs[hidden] { display: none; }
fieldset.known-langs legend { font-size: 0.9em; color: var(--ui-muted); }
.known-langs .kl-list { display: flex; flex-wrap: wrap; gap: 2px 14px; }
.formula-fact .decipher, #prep .decipher { color: var(--ui-muted); }

/* --- Fortschritt ---------------------------------------------------------------- */
.progress { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1000; background: var(--ui-panel); color: var(--ui-text); border: 1px solid var(--ui-line); border-radius: 10px; padding: 10px 16px; box-shadow: 0 4px 18px rgb(0 0 0 / 0.25); display: flex; align-items: center; gap: 10px; min-width: 260px; }
.progress[hidden] { display: none; }
.progress .pg-bar { flex: 1; min-width: 80px; height: 6px; background: var(--ui-line); border-radius: 3px; overflow: hidden; }
.progress .pg-bar i { display: block; height: 100%; background: var(--ui-accent); }
.progress .pg-count { font-variant-numeric: tabular-nums; }
@media print { .full-modal, .rules-i, .progress, .legal-bar { display: none !important; } }
.legal-bar { flex: none; padding: 3px 16px; font-size: 11px; color: var(--ui-muted); background: var(--ui-panel); border-top: 1px solid var(--ui-line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legal-bar .linkish { border: none; background: none; padding: 0; font: inherit; color: var(--ui-accent); text-decoration: underline; cursor: pointer; }
.legal-modal { max-width: 600px; max-height: 88vh; overflow-y: auto; }
.legal-modal p, .legal-modal li { font-size: 14px; line-height: 1.45; }
.legal-modal ul { padding-left: 18px; }
.legal-modal form { flex-direction: row; }
@media (max-width: 700px) { .legal-bar { white-space: normal; } }

/* --- Kapitel -------------------------------------------------------------------- */
.chapter { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 6mm; }
.ch-kicker { font-family: var(--font-title); font-size: 0.8em; letter-spacing: 0.15em; text-transform: uppercase; color: var(--ink-soft); }
.page h1.ch-title { font-family: var(--font-title); font-weight: 600; font-size: 2.1em; color: var(--rubric); margin: 0.3em 0 0.6em; line-height: 1.15; }
.ch-fig { width: 52mm; height: 52mm; fill: none; stroke: var(--ink); stroke-width: 1; margin-bottom: 6mm; }
.ch-fig .thin { stroke-width: 0.5; }
.ch-fig .dash { stroke-dasharray: 2 2; }
.ch-fig .node { fill: var(--parch); stroke: var(--rubric); stroke-width: 1.2; }
.ch-sub { font-family: var(--font-title); font-size: 1.15em; color: var(--rubric); margin-bottom: 0.6em; }
.chapter p { text-align: center; font-style: italic; max-width: 95mm; margin: 0 auto 0.6em; }
.ch-list { column-count: 2; column-gap: 5mm; font-size: 0.82em; }
.ch-row { display: flex; align-items: center; gap: 1.5mm; break-inside: avoid; padding: 0.4mm 0; border-bottom: 1px dotted color-mix(in srgb, var(--ink) 30%, transparent); }
.ch-row .tq svg { width: 4.5mm; height: 4.5mm; display: block; }
.ch-row .ch-nm { flex: 1; min-width: 0; line-height: 1.15; }
.ch-row .ch-nm i { display: block; font-size: 0.8em; color: var(--ink-soft); }
.ch-row .tp { font-variant-numeric: tabular-nums; }
.toc-list li.toc-chapter b { font-style: italic; font-weight: 400; }
/* Regelband-Inhalt */
.rb-index { column-count: 2; column-gap: 5mm; font-size: 0.78em; }
.rb-row { display: flex; gap: 1.5mm; break-inside: avoid; border-bottom: 1px dotted color-mix(in srgb, var(--ink) 30%, transparent); padding: 0.3mm 0; }
.rb-nr { width: 2.2em; text-align: right; color: var(--rubric); font-weight: 800; }
.rb-nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- Verlauf und Statistik --------------------------------------------------------- */
.prep-tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--ui-line); }
.prep-tabs button { border: none; background: none; border-bottom: 2px solid transparent; border-radius: 0; }
.prep-tabs button.active { border-bottom-color: var(--ui-accent); font-weight: 600; }
.ingame-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; font-size: 0.9em; color: var(--ui-muted); }
.ingame { display: inline-flex; gap: 4px; }
.ingame input, .ingame select { width: auto; padding: 2px 6px; background: var(--ui-panel); border: 1px solid var(--ui-line); border-radius: 6px; color: var(--ui-text); }
.ingame input[data-ig="d"] { width: 4em; }
.ingame input[data-ig="y"] { width: 8em; }
.st-day { background: var(--ui-panel); border: 1px solid var(--ui-line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.st-day.test { opacity: 0.6; border-style: dashed; }
.st-day header { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.st-day details { margin-top: 6px; }
.st-day summary { cursor: pointer; color: var(--ui-muted); font-size: 0.9em; }
.muted-badge { background: var(--ui-muted); }
.st-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.st-chip { font-size: 12px; border: 1px solid var(--ui-line); border-radius: 12px; padding: 1px 8px; }
.st-events { margin: 6px 0 0; padding-left: 1.2em; font-size: 0.9em; }
.st-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: 8px; }
.st-kpis div { background: var(--ui-panel); border: 1px solid var(--ui-line); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; }
.st-kpis b { font-size: 1.6em; font-family: var(--font-title); color: var(--ui-accent); }
.st-kpis span { color: var(--ui-muted); font-size: 0.85em; }
#stats-root h3 { font-family: var(--font-title); font-weight: 600; margin: 18px 0 6px; }
.st-top { list-style: none; margin: 0; padding: 0; }
.st-top li { display: flex; align-items: center; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--ui-line); }
.st-top .q svg { width: 22px; height: 22px; display: block; }
.st-top .nm { width: 230px; flex-shrink: 0; display: flex; flex-direction: column; cursor: pointer; min-width: 0; }
.st-top .nm i { font-size: 12px; color: var(--ui-muted); }
.st-track { flex: 1; height: 8px; background: var(--ui-line); border-radius: 4px; overflow: hidden; min-width: 40px; }
.st-track i { display: block; height: 100%; background: var(--ui-accent); }
.st-val { font-size: 0.85em; color: var(--ui-muted); white-space: nowrap; }
.st-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.st-bars { display: flex; flex-direction: column; gap: 4px; }
.st-bar { display: flex; align-items: center; gap: 8px; }
.st-lbl { width: 160px; flex-shrink: 0; font-size: 0.9em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 600px) { .st-top .nm { width: 140px; } .st-top .st-val { display: none; } }

/* --- Brevier (göttliche Klassen) ------------------------------------------------- */
body.divine .arcane-only { display: none !important; }
.deity-row { display: flex; flex-direction: column; gap: 6px; }
.deity-row[hidden] { display: none; }
.deity-row .divine-only[hidden] { display: none; }
.swatch { display: inline-block; width: 0.9em; height: 0.9em; border: 1px solid rgba(0, 0, 0, 0.35); border-radius: 2px; vertical-align: -0.1em; margin-right: 3px; }
.essrow .swatch { width: 14px; height: 14px; flex-shrink: 0; }
.own-edit { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; font-size: 14px; }
.own-edit textarea { width: 100%; font-family: var(--font-hand); font-size: 18px; line-height: 1.3; resize: vertical; }
svg.vitrail { display: block; width: 100%; height: auto; }
.page svg.vitrail { cursor: zoom-in; }
.cm-figure svg.vitrail { width: auto; height: 88vh; max-width: 100%; }
.pr-head { margin-bottom: 0.5em; }
.pr-grid { display: grid; grid-template-columns: calc(57mm * var(--fit)) 1fr; gap: 5mm; align-items: start; }
.vt-box { margin: 0; }
.pr-facts { font-size: 0.85em; display: grid; grid-template-columns: auto 1fr; column-gap: 2mm; margin-bottom: 0.6em; padding-bottom: 0.4em; border-bottom: 1px solid color-mix(in srgb, var(--ink) 25%, transparent); }
.pr-facts div { display: contents; }
.pr-facts b { font-family: var(--font-title); font-weight: 600; font-size: 0.85em; color: var(--rubric); }
.canon h4 { margin-top: 0; }
.canon h4 .muted { font-family: var(--font-body); font-weight: 400; letter-spacing: 0; color: var(--ink-soft); font-style: italic; }
.canon .cl { margin: 0 0 0.25em; line-height: 1.3; }
.canon .cl.refrain { color: var(--rubric); font-style: italic; padding-left: 0.6em; }
.canon .cl.refrain span { font-style: normal; }
.own { margin-top: 0.8em; }
.own .own-text { font-family: var(--font-hand); font-size: 1.35em; line-height: 1.25; color: var(--note); }
.own .own-text p { text-align: left; margin: 0 0 0.3em; }
.own-lines i { display: block; height: 7mm; border-bottom: 1px solid color-mix(in srgb, var(--ink) 35%, transparent); }
.dt-title { text-align: center; font-style: italic; margin: -0.3em 0 0.6em; }
.dt-symbol { width: 34mm; height: 34mm; margin: 0 auto 4mm; }
.dt-symbol svg { width: 100%; height: 100%; }
.dt-legal { font-size: 0.8em; margin-top: 1em; }
.tp-vitrail { width: 46mm; margin-bottom: 6mm; }
.vt-orn { width: 30mm; height: 70mm; color: var(--ink); margin-bottom: 6mm; }
.vt-legend { font-size: 0.85em; }
.legend-grid.vt-glass svg { width: 24px; height: 24px; }
.vt-row { display: flex; flex-wrap: wrap; gap: 2mm 3mm; justify-content: center; margin-bottom: 0.3em; }
.vt-row figure { margin: 0; text-align: center; font-size: 0.72em; line-height: 1.15; width: 18mm; }
.vt-row figcaption { color: var(--ink-soft); margin-top: 1mm; }
.vt-orn.small { width: 9mm; height: 20mm; margin: 0; }
.vt-mini { width: 11mm; height: 11mm; display: block; margin: 0 auto; }
.vt-mini.tall { width: 9mm; height: 14mm; }
.vt-mini.wide { width: 24mm; height: 7mm; margin: 0; }
.vt-socles { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5mm 4mm; font-size: 0.8em; }
.vt-socles div { display: flex; align-items: center; gap: 2mm; }
.legend-grid .vt-mini { margin: 0; }
.vt-row.med .vt-mini { width: 16mm; height: 16mm; }
.vt-row.med { margin-bottom: 0.8em; }

/* ---------------------------------------------------------------------------
   LEHRHEFT („Fibel der Kreise“)
   --------------------------------------------------------------------------- */
.primer-view { display: flex; gap: 16px; align-items: flex-start; min-height: 0; }
.primer-view[hidden] { display: none; }
#primer-side, #vm-side { position: sticky; top: 0; max-height: calc(100vh - 140px); width: 260px; }
#primer-side.collapsed, #vm-side.collapsed { width: 0; }
.primer-toc { flex: 1; min-height: 0; overflow-y: auto; font-size: 13px; }
.toc-list .no { color: var(--ui-muted); min-width: 1.6em; text-align: right; font-variant-numeric: tabular-nums; font-size: 12px; }
/* aktueller Abschnitt beim Blättern (Verzeichnis-Baustein) */
.toc-group.on > .toc-grade { background: var(--ui-hover); }
.primer-main { flex: 1; min-width: 0; }
@media (max-width: 900px) { .primer-view { flex-direction: column; } #primer-side, #vm-side { width: 100%; position: static; max-height: none; } }

/* Seiten: rechts eine Randspalte für Glossen und Stimmen */
.primer-page .page-inner { padding-right: 34mm; }
.primer-page h3 { margin-right: -34mm; }
.lesson { margin: 0 0 0.9em; }
.lesson[data-split-of] { margin-top: 0; }
/* Kopf auf die Folgeseite gewandert: steht dort direkt über seiner Fortsetzung */
.lesson:has(+ .lesson[data-split-of]) { margin-bottom: 0; }
.ls-head { border-top: 1px solid var(--ink-soft); padding-top: 0.25em; margin-bottom: 0.3em; }
.lesson[data-split-of] > .ls-head { display: none; }
.ls-k { font-family: var(--font-title); font-size: 0.72em; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); }
.page .ls-t { margin: 0 0 0.1em; font-size: 1.15em; letter-spacing: 0.02em; }
.ls-sub { font-size: 0.8em; color: var(--ink-soft); margin-bottom: 0.3em; }
.term { color: var(--rubric); font-variant: small-caps; font-weight: 600; letter-spacing: 0.03em; }
.par { margin: 0; }
.pr-note, .mnote { float: right; clear: right; width: 30mm; margin: 0 -34mm 0.4em 0; font-size: 0.74em; line-height: 1.25; }
.pr-note { border-left: 2px solid var(--rubric); padding-left: 2mm; color: var(--ink-soft); }
.pr-note b { display: block; color: var(--rubric); font-variant: small-caps; }
.mnote { font-family: var(--font-hand); font-size: 0.95em; line-height: 1.1; transform: rotate(-1.2deg); }
.mnote .who, .handover-text .who { display: block; text-align: right; font-size: 0.85em; opacity: 0.8; }
.handover-text { font-family: var(--font-hand); font-size: 1.35em; line-height: 1.25; }
.hand-angular { font-family: var(--font-hand-angular); transform: rotate(0.6deg); letter-spacing: 0.02em; }
.hand-even { font-family: var(--font-hand-even); transform: none; font-size: 0.82em; line-height: 1.2; }
.handover-text.hand-angular { transform: none; }
.handover-text.hand-even { font-size: 1.05em; }
/* loses Blatt: schräg eingelegt, eigenes Papier, Streichung einer zweiten Stimme darüber */
.loose-page .page-inner { display: flex; flex-direction: column; justify-content: center; }
.leaf { position: relative; margin: 4mm 6mm; padding: 6mm 7mm; background: #f4ecd6; border: 1px solid rgba(80, 60, 30, 0.25); box-shadow: 2px 3px 8px rgba(60, 40, 10, 0.25); transform: rotate(-2.4deg); font-size: 0.92em; line-height: 1.2; }
.leaf-body { position: relative; }
.leaf.hand-even { font-size: 0.95em; }
.leaf-t { font-size: 1.3em; margin-bottom: 0.3em; text-decoration: underline; }
.leaf p { margin: 0 0 0.4em; }
.leaf dl { margin: 0.4em 0 0; display: grid; grid-template-columns: 7.5em 1fr; column-gap: 0.8em; row-gap: 0.15em; }
.leaf dt { font-weight: 700; }
.leaf dd { margin: 0; }
.leaf .who { display: block; text-align: right; opacity: 0.8; }
.leaf-x { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.leaf-x path { fill: none; stroke-width: 0.6; stroke-linecap: round; vector-effect: non-scaling-stroke; stroke-width: 2.2px; opacity: 0.8; }
.leaf-strike { margin: 4mm 0 0 18%; transform: rotate(3deg); font-size: 1.25em; line-height: 1.15; }
.leaf-note { margin: 3mm 10mm 0; transform: rotate(1deg); font-size: 1em; }
.page .lesson p.sig { text-align: right; font-style: italic; }

.mview { margin: 0.3em auto 0.5em; text-align: center; }
.mview figcaption { font-size: 0.68em; font-style: italic; color: var(--ink-soft); }
.mview svg { width: 34mm; height: auto; display: block; margin: 0 auto; }
.mview.medium svg { width: 56mm; }
.mview.small svg, .mview.inline svg { width: 22mm; }
.mview.float { float: left; width: 26mm; margin: 0 0.8em 0.2em 0; }
.mview.float svg { width: 26mm; }
.pr-svg { fill: none; stroke: var(--ink); stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.pr-svg .thin { stroke-width: 0.6; }
.pr-svg .fill { fill: var(--ink); stroke: none; }
.pr-svg .node { fill: var(--parch); stroke: var(--rubric); }
.pr-svg.pounce .fill { fill: var(--ink); }
.task { margin: 0.4em 0; }
.task h4 { margin-top: 0.4em; }
.task ol { margin: 0; }
.check { border: 1px solid var(--ink-soft); border-radius: 2px; padding: 0.25em 0.4em; margin: 0.5em 0 0.2em; font-size: 0.72em; break-inside: avoid; }
.check table { width: 100%; border-collapse: collapse; }
.check th { font-weight: 400; text-align: center; color: var(--ink-soft); }
.check th.ck-h { text-align: left; color: var(--rubric); font-family: var(--font-title); font-weight: 600; width: 1%; padding-right: 0.6em; }
.ck-sc { text-align: center; white-space: nowrap; }
.ck-sc span { display: inline-block; width: 1.25em; height: 1.25em; line-height: 1.2em; border: 1px solid var(--ink-soft); border-radius: 50%; margin: 0 1px; font-size: 0.85em; }
.ck-foot { display: flex; justify-content: space-between; gap: 0.5em; flex-wrap: wrap; margin-top: 0.2em; color: var(--ink-soft); }
.pr-box { border: 1px double var(--ink-soft); border-width: 3px; padding: 0.35em 0.5em; margin: 0 0 0.8em; font-size: 0.8em; display: grid; gap: 0.15em; }
.pr-box b { font-family: var(--font-title); font-size: 0.85em; color: var(--rubric); display: block; }
.pr-table { display: grid; grid-template-columns: 1fr 1fr; gap: 0.3em 0.7em; font-size: 0.84em; margin: 0.4em 0; }
.pr-row { display: flex; gap: 0.45em; align-items: center; break-inside: avoid; }
.pr-row svg { width: 24px; height: 24px; flex: none; }
.pr-row .corr, .pr-row .opp { color: var(--ink-soft); font-size: 0.9em; }
.pr-grid { display: grid; gap: 0.4em; margin: 0.4em 0; text-align: center; font-size: 0.78em; }
.pr-grid.g2 { grid-template-columns: 1fr 1fr; } .pr-grid.g3 { grid-template-columns: repeat(3, 1fr); } .pr-grid.g4 { grid-template-columns: repeat(4, 1fr); } .pr-grid.g5 { grid-template-columns: repeat(5, 1fr); }
.pr-grid figure { margin: 0; break-inside: avoid; }
.pr-grid svg { width: 100%; height: auto; }
.pr-grid figcaption .rn, .rn { color: var(--ink-soft); font-size: 0.85em; font-style: italic; }
.pr-steps { display: flex; align-items: center; gap: 0.3em; font-size: 0.75em; text-align: center; }
.pr-steps figure { margin: 0; flex: 1; }
.pr-steps svg { width: 100%; height: auto; }
.pr-dl { font-size: 0.86em; margin: 0.3em 0; }
.pr-dl dt { font-weight: 600; margin-top: 0.3em; }
.pr-dl dd { margin: 0 0 0 0.8em; }
.ess-g svg { width: 12px; height: 12px; vertical-align: -2px; }
.pr-mat, .pr-grade { width: 100%; border-collapse: collapse; font-size: 0.82em; margin: 0.4em 0; }
.pr-mat th, .pr-mat td, .pr-grade th, .pr-grade td { border-bottom: 1px solid rgba(107, 86, 64, 0.4); padding: 0.2em 0.3em; text-align: left; vertical-align: middle; }
.pr-mat svg { width: 22px; height: 22px; }
.pr-grade td { height: 1.7em; }
.pr-grade th:not(:first-child) { text-align: center; width: 3em; }
.pr-form { display: grid; grid-template-columns: auto 1fr; gap: 0.5em 0.6em; font-size: 0.9em; }
.pr-form dd { margin: 0; border-bottom: 1px solid var(--ink-soft); min-height: 1.4em; }
.pr-gl { font-size: 0.82em; margin: 0 -34mm 0.3em 0; padding-left: 1em; text-indent: -1em; }
.pr-gl b { color: var(--rubric); }
.page p.left { text-align: left; }
.solution { transform: rotate(180deg); text-align: center; font-size: 0.75em; color: var(--ink-soft); margin: 0.4em 0; }
.cloze { margin: 0.2em 0 0.4em; font-style: italic; }
.cloze .gap { letter-spacing: 0.08em; color: var(--ink-soft); font-style: normal; }
.ladder { display: flex; flex-wrap: wrap; gap: 0.3em 1em; font-size: 0.82em; margin: 0.4em 0; clear: both; }
.ladder .thrice { margin-left: auto; }
.disc svg { width: 100mm; height: 100mm; display: block; margin: 0.5em auto; }
.disc .ring { stroke-width: 0.4; }
.disc .ring.eng { stroke: var(--rubric); }
.disc .target { stroke-width: 0.8; stroke-dasharray: 2 1.5; }
.primer-title .pr-sigil { width: 60mm; }
.blocks { width: 40mm !important; }
.hand-circle { stroke-width: 1.4; }
.lesson p > svg.glyph, .lesson dt > svg.glyph { width: 1.5em; height: 1.5em; vertical-align: -0.4em; }
#theory-pages[hidden] { display: none; }
.mview.wide { margin: 0.3em -34mm 0.5em 0; }
.mview.wide svg { width: 104mm; }
/* zwei Kreise je Seite (Kreise lesen) */
.mview.duo { margin: 0.3em -34mm 0.4em 0; }
.mview.duo svg { width: 78mm; }
/* kleine Formeln: eine Seite je Formel, der Kreis schrumpft mit der Schrift */
.mview.fit { margin: 0.2em -34mm 0.3em 0; }
.mview.fit svg { width: calc(84mm * var(--fit) * var(--fit)); }
.mview.fit { position: relative; }
.formula-page .qside { position: absolute; left: 0; bottom: 1.5em; width: 20mm; margin: 0; text-align: center; }
.formula-page .qside svg { width: 20mm; height: auto; display: block; }
.formula-page .qside figcaption { font-size: 0.68em; font-style: italic; color: var(--ink-soft); }
.primer-page.bind.verso .qside { left: auto; right: 0; }
.formula-page .cloze { margin: 0.1em 0 0.25em; }
/* Lochrand fürs Ringbuch: Bindungsseite breiter, Satzbreite bleibt gleich (Umbruch hängt nicht von der Seite ab) */
.page.bind { padding-left: 18mm; padding-right: 6mm; }
.page.bind.verso { padding-left: 6mm; padding-right: 18mm; }
.page.bind .page-foot { left: 18mm; right: 6mm; }
.page.bind.verso .page-foot { left: 6mm; right: 18mm; }
/* Randspalte immer außen, weg von den Löchern: auf geraden Seiten gespiegelt */
.primer-page.bind.verso .page-inner { padding-right: 0; padding-left: 34mm; }
.primer-page.bind.verso h3 { margin-right: 0; margin-left: -34mm; }
.primer-page.bind.verso .pr-note, .primer-page.bind.verso .mnote { float: left; clear: left; margin: 0 0 0.4em -34mm; text-align: right; }
.primer-page.bind.verso .pr-gl { margin: 0 0 0.3em -34mm; }
.primer-page.bind.verso .mview.wide, .primer-page.bind.verso .mview.duo, .primer-page.bind.verso .mview.fit { margin-right: 0; margin-left: -34mm; }
.primer-page.bind.verso .pr-note { border-left: none; padding-left: 0; border-right: 2px solid var(--rubric); padding-right: 2mm; }
.page.blank .page-foot span:last-child { visibility: hidden; }
.primer-view:has(#primer-side.collapsed) .primer-main, .primer-view:has(#vm-side.collapsed) .primer-main { padding-right: 28px; }
.qkey { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; justify-items: center; gap: 1mm; margin: 0; }
.qkey svg { width: 11mm; height: 11mm; }
.qkey figcaption { grid-column: 1 / -1; font-size: 0.75em; }
/* Prüfbogen (eigener Handzettel) */
.pb-page .page-inner { font-size: calc(9pt * var(--fit)); }
.pb-key { font-size: 0.85em; color: var(--ink-soft); margin: 0 0 0.6em; }
.pb-row { border-top: 1px solid var(--ink-soft); padding: 0.25em 0 0.35em; break-inside: avoid; display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 0 1em; }
.pb-l { grid-column: 1 / -1; }
.pb-l { font-family: var(--font-title); font-weight: 600; color: var(--rubric); }
.pb-l .rn { color: var(--ink-soft); font-weight: 400; }
.pb-c { display: flex; flex-wrap: wrap; gap: 0.1em 1.2em; font-size: 0.9em; }
.pb-c i { font-style: normal; letter-spacing: 0.35em; color: var(--ink-soft); }
.pb-u { font-size: 0.82em; color: var(--ink-soft); text-align: right; }
.pb-part { margin: 0.9em 0 0.2em; }
.pb-pg { float: right; font-family: var(--font-body); font-weight: 400; color: var(--ink-soft); font-size: 0.85em; }
.offscreen-set { position: absolute; left: -10000px; top: 0; }
/* Lehrheft: Weltinfo-Kasten, Formulare, Spalten */
.pr-world { border: 1px solid var(--ink-soft); border-left: 3px solid var(--rubric); padding: 0.3em 0.6em; margin: 0.5em 0; font-size: 0.86em; break-inside: avoid; }
.pr-world > b { font-family: var(--font-title); color: var(--rubric); letter-spacing: 0.04em; }
.pr-world p { margin: 0.2em 0; }
.pr-svg.seal { width: 24mm; }
.sigil-row { break-inside: avoid; margin: 0.4em 0; }
.sigil-row h4 { margin: 0.2em 0; }
.sigil-steps { font-family: var(--font-title); letter-spacing: 0.12em; margin: 0.2em 0; }
.sigil-steps s { color: var(--rubric); }
.mview.inline svg.sigil { width: 34mm; }
.sigil-g path { fill: none; stroke: currentColor; stroke-width: 0.18; stroke-linecap: round; stroke-linejoin: round; }
.sigil-blank { height: 28mm; border: 1px dotted var(--ink-soft); }
.pr-inks td.gift { color: var(--rubric); font-size: 0.9em; }
.pr-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0.3em 1em; font-size: 0.88em; margin: 0.4em 0; }
.pr-cols.three { grid-template-columns: 1fr 1fr 1fr; }
.pr-cols ol { margin: 0; padding-left: 1.2em; }
.pr-checklist { list-style: none; margin: 0; padding: 0; }
.pr-checklist li { margin: 0.1em 0; }
.pr-form.sign { margin-top: 0.8em; }
.pr-form.sign dd { min-height: 2em; }
.pr-sched { width: 100%; border-collapse: collapse; font-size: 0.86em; margin: 0.4em 0; }
.pr-sched th { text-align: left; font-family: var(--font-title); color: var(--rubric); font-weight: 600; white-space: nowrap; padding: 0.2em 0.6em 0.2em 0; vertical-align: top; }
.pr-sched td { padding: 0.2em 0; border-bottom: 1px solid rgba(107, 86, 64, 0.3); }
.pr-svg .lbl { fill: var(--ink-soft); stroke: none; font-family: var(--font-body); text-anchor: middle; }
.pr-svg .bg { fill: var(--parch); stroke: none; }
.pr-svg .faint { stroke-width: 0.5; opacity: 0.45; }
.pr-gap { display: inline-block; width: 3em; }
.pr-checklist { display: grid; grid-template-columns: 1fr 1fr; column-gap: 1.2em; font-size: 0.9em; }
.pr-checklist ul { list-style: none; margin: 0; padding: 0; }
.pr-checklist li { padding-left: 1.1em; text-indent: -1.1em; }
.ticks { white-space: nowrap; letter-spacing: 0.15em; }
.alias { font-weight: normal; font-style: italic; }

/* ---------------------------------------------------------------------------
   ANDACHT (devotion.js): Zeilen im Reiter „Heute“, Unterreiter „Andacht“, Andachtsblatt und Andachtsbuch
   --------------------------------------------------------------------------- */
.seal-btn { font-size: 1.1em; color: var(--rubric); }
.dv-today { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 12px; padding: 8px 10px; border: 1px solid var(--ui-line); border-radius: 6px; }
.dv-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dv-row > b { min-width: 9em; }
.dv-row button.on, .dv-panel button.on { background: var(--ui-hover); box-shadow: inset 0 0 0 1px var(--ui-accent); }
/* Unterreiter „Andacht“: Vorbereitung als einklappbare Seitenleiste links, Betrachter füllt den Rest */
.prep-side { display: contents; }
.prep-side > .side-toggle { display: none; }
#view-prepare.dv-mode { overflow: hidden; }
#view-prepare.dv-mode .prep-side { display: block; width: 340px; flex-shrink: 0; border-right: 1px solid var(--ui-line); }
#view-prepare.dv-mode .prep-side > .side-toggle { display: flex; left: 100%; border-left: none; border-radius: 0 6px 6px 0; }
#view-prepare.dv-mode .prep-side > .side-toggle::before { content: "‹"; }
#view-prepare.dv-mode #prep { height: 100%; overflow-y: auto; padding: 12px; box-sizing: border-box; }
#view-prepare.dv-mode .prep-side.collapsed { width: 0; border-right: none; }
#view-prepare.dv-mode .prep-side.collapsed > #prep { display: none; }
#view-prepare.dv-mode .prep-side.collapsed > .side-toggle { left: 0; border-left: 1px solid var(--ui-line); }
#view-prepare.dv-mode .prep-side.collapsed > .side-toggle::before { content: "›"; }
.dv-panel { display: flex; flex-direction: column; gap: 14px; margin: 4px 0 8px; }
.dv-panel h4 { margin: 0 0 5px; font-size: 0.8em; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ui-muted); }
.dv-panel h4 .muted { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 4px; }
.dv-panel select { width: 100%; }
.dv-panel .muted:is(p) { margin: 6px 0 0; font-size: 0.85em; }
.dv-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.dv-col { display: flex; flex-direction: column; gap: 6px; }
.dv-col > *, .dv-edit > button { width: 100%; text-align: center; }
.dv-col > .filebtn { background: var(--ui-panel); }
.dv-col > .filebtn:hover { background: var(--ui-hover); }
.dv-code { display: flex; gap: 6px; margin-bottom: 6px; }
.dv-code input { flex: 1; min-width: 0; }
.dv-edit summary { cursor: pointer; }
.dv-edit label { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.dv-edit textarea { width: 100%; font: inherit; }
.devotion-view { flex: 1; min-width: 0; overflow-y: auto; padding: 16px 30px; }
.devotion-view[hidden] { display: none; }
@media (max-width: 900px) {
  #view-prepare.dv-mode { flex-direction: column; overflow-y: auto; }
  #view-prepare.dv-mode .prep-side { width: 100%; border-right: none; border-bottom: 1px solid var(--ui-line); }
  #view-prepare.dv-mode .prep-side.collapsed { width: 100%; border: none; }
  #view-prepare.dv-mode #prep { height: auto; padding: 12px 16px; }
  #view-prepare.dv-mode .prep-side > .side-toggle, #view-prepare.dv-mode .prep-side.collapsed > .side-toggle { transform: none; top: 100%; left: auto; right: 16px; width: 40px; height: 22px; border: 1px solid var(--ui-line); border-top: none; border-radius: 0 0 6px 6px; }
  #view-prepare.dv-mode .prep-side > .side-toggle::before { content: "▴"; }
  #view-prepare.dv-mode .prep-side.collapsed > .side-toggle::before { content: "▾"; }
  .devotion-view { flex: none; overflow: visible; padding: 16px; }
}
.dv-dialog { max-width: min(96vw, 360mm); max-height: 92vh; overflow: auto; }
.dv-dialog .dv-pages { display: flex; gap: 18px; justify-content: center; }
.devotion-page .page-inner { font-size: 0.98em; }
.devotion-page .page-foot span:last-child { visibility: hidden; }
.dv-head { text-align: center; margin-bottom: 0.4em; }
.dv-date { font-family: var(--font-title); font-size: 0.8em; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); }
.dv-feast { font-style: italic; color: var(--rubric); }
.dv-head h3 { margin: 0.15em 0 0.2em; }
.dv-step h4 { margin: 0.55em 0 0.1em; }
.dv-step p { margin: 0; line-height: 1.35; }
.dv-opt { font-family: var(--font-body); font-weight: normal; letter-spacing: 0; font-style: italic; color: var(--ink-soft); }
.dv-frag { display: grid; grid-template-columns: 32mm 1fr; gap: 4mm; align-items: center; margin: 0.3em 0; }
.dv-frag figure { margin: 0; }
.dv-frag svg { width: 32mm; height: 32mm; }
.dv-frag-k { font-family: var(--font-title); font-size: 0.72em; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); }
.dv-formula { font-family: var(--font-title); letter-spacing: 0.05em; margin: 0.2em 0 0; }
.dv-stub { stroke-dasharray: 6 4; }
.dv-fields { margin-top: 0.7em; font-size: 0.9em; }
.page p.dv-invoke { margin: 0.2em 0 0.5em; font-style: italic; text-align: center; line-height: 1.35; }
/* großes Bruchstück: der Kreis füllt die Satzbreite, damit man die Glyphen ohne Lupe erkennt */
.dv-frag-big { text-align: center; margin: 0.6em 0 0.3em; }
.dv-frag-big figure { margin: 0.4em auto; width: 100%; max-width: 100mm; }
.dv-frag-big svg { width: 100%; height: auto; display: block; }
.dv-frag-big .dv-formula { font-size: 1.05em; text-align: center; }
.dv-log { border-collapse: collapse; width: 100%; font-size: 0.85em; font-variant-numeric: tabular-nums; }
.dv-log th { text-align: left; font-weight: normal; font-variant: small-caps; color: var(--ink-soft); padding: 0.1em 0.8em 0.1em 0; width: 6.5em; vertical-align: top; white-space: nowrap; }
.dv-log td { padding: 0.1em 0; border-bottom: 1px solid color-mix(in srgb, var(--ink) 15%, transparent); }
.dv-line { display: block; min-height: 1.3em; border-bottom: 1px solid var(--ink-soft); padding: 0 0.3em; }
.dv-lines i { display: block; height: 1.55em; border-bottom: 1px solid color-mix(in srgb, var(--ink) 30%, transparent); }
.dv-facts { margin: 0; padding-left: 1.1em; font-size: 0.9em; }
.dv-diary p { margin: 0 0 0.4em; }
.dv-gm { margin-top: 0.8em; padding: 0.4em 0.6em; border-left: 2px solid var(--rubric); }
.dv-gm h4, .dv-gm h3 { margin-top: 0; }
.dv-own p { margin: 0 0 0.3em; }

/* Tafel der Zeit: Jahresring und Sternkarte */
.pr-svg .dash { stroke-dasharray: 2 2; stroke-width: 0.5; opacity: 0.6; }
.pr-svg .dim { opacity: 0.5; }
.pr-svg .ecl { stroke: var(--rubric); stroke-width: 0.9; }
.pr-svg .rub { fill: var(--rubric); stroke: none; }
.pr-svg .hair { stroke: var(--ink); stroke-width: 0.35; }
.pr-svg .hand-dot { stroke: none; }
.pr-svg .fig { stroke-width: 0.6; }
.pr-svg .lbl.faint-l { opacity: 0.75; }
.tt-entry { margin: 0.35em 0 0.5em; break-inside: avoid; }
.tt-entry .tt-head { border-bottom: 0.5px solid var(--parch-edge); padding-bottom: 0.1em; }
.tt-entry .tt-head svg { width: 5mm; height: auto; vertical-align: middle; }
.tt-entry .tt-head .ess-g svg { width: 3.6mm; }
.tt-entry p { margin: 0.2em 0 0; font-size: 0.92em; text-align: left; }
.tt-entry .tt-aff { font-size: 0.92em; color: var(--ink-soft); font-style: italic; }
.tt-sw { display: inline-block; width: 0.8em; height: 0.8em; border: 0.5px solid var(--ink-soft); vertical-align: -0.05em; margin-right: 0.2em; }
.mview.ring svg { width: 100mm; max-width: 100%; }

/* --- Vademecum ------------------------------------------------------------------- */
/* Tempelfarben (--vm-primary/-secondary/-accent) setzt die Ansicht am Behälter der Seiten */
.vm-page, .vm-title { --rubric: var(--vm-primary, #8b1e1e); }
.vm-title .tp h1 { color: var(--vm-primary, var(--rubric)); }
.vm-title .tp-vol { color: var(--vm-secondary, var(--rubric)); }
.vm-mark { font-size: 1.2em; }
.vm-orn { width: 40mm; height: 40mm; margin: 0 auto 4mm; border-radius: 50%; border: 3px double var(--vm-accent, var(--ink-soft)); box-shadow: inset 0 0 0 5mm color-mix(in srgb, var(--vm-primary, var(--ink)) 12%, transparent); }
.vm-author { font-size: 0.9em; }
.vm-ch { text-align: center; margin: 2mm 0 5mm; padding-bottom: 3mm; border-bottom: 2px solid var(--vm-accent, var(--ink-soft)); }
.primer-page.vm-page .vm-ch { margin-right: -34mm; }
.primer-page.vm-page.bind.verso .vm-ch { margin-right: 0; margin-left: -34mm; }
.primer-page.vm-page .vm-ch h3 { margin: 0.1em 0 0; color: var(--vm-primary, var(--rubric)); font-size: 1.6em; }
.vm-ch .ch-kicker { color: var(--vm-secondary, var(--ink-soft)); }
.vm-ow { font-style: italic; font-size: 0.85em; color: var(--ink-soft); margin: 0.3em 0 0; }
.vm-otherworldly { background-image: repeating-linear-gradient(-45deg, transparent 0 6mm, color-mix(in srgb, var(--ink) 3%, transparent) 6mm 7mm); }
/* Initiale am ersten Absatz eines Abschnitts */
/* initial-letter statt float: ein Float dürfte nicht höher stehen als die Randnotizen davor und rutschte nach unten */
.vm-page .lesson:not([data-split-of]) > .par:first-of-type > p::first-letter { font-family: var(--font-title); color: var(--vm-primary, var(--rubric)); initial-letter: 2; margin-right: 0.1em; }
.vm-page .vm-prayer .par > p::first-letter, .vm-page .vm-hymn .par > p::first-letter { initial-letter: normal; margin: 0; color: inherit; font-family: inherit; }
.vm-epigraph { margin: 0 8mm 0.8em; text-align: center; font-style: italic; font-size: 0.92em; }
.vm-epigraph p { margin: 0; }
.vm-src { font-size: 0.85em; color: var(--ink-soft); margin-top: 0.2em; }
.vm-src::before { content: "– "; }
.vm-aside { float: right; clear: right; width: 30mm; margin: 0 -34mm 0.4em 0; font-size: 0.78em; font-style: italic; color: var(--vm-secondary, var(--ink-soft)); border-top: 1px solid var(--vm-accent, var(--ink-soft)); padding-top: 0.2em; }
.primer-page.bind.verso .vm-aside { float: left; clear: left; margin: 0 0 0.4em -34mm; }
.vm-use { font-style: italic; font-size: 0.9em; color: var(--ink-soft); margin: 0 0 0.4em; }
.vm-verse { text-align: center; margin: 0.3em 0 0.6em; }
.vm-line { line-height: 1.45; }
.vm-hymn-k { font-family: var(--font-title); font-size: 0.72em; letter-spacing: 0.12em; text-transform: uppercase; color: var(--vm-secondary, var(--ink-soft)); margin-bottom: 0.2em; }
.vm-hymn .vm-verse { font-family: var(--font-title); letter-spacing: 0.04em; }
/* Lücke einer gestrichenen Silbe: feste Breite, damit niemand die Silbe aus der Länge errät */
.vm-gap { display: inline-block; width: 1.6em; border-bottom: 1px solid var(--vm-primary, var(--rubric)); margin: 0 0.08em; vertical-align: 0.1em; }
.vm-feast { margin: 0 0 0.5em; break-inside: avoid; }
.vm-feast b { color: var(--vm-primary, var(--rubric)); font-family: var(--font-title); font-weight: 600; }
.vm-feast-t { font-style: italic; font-size: 0.9em; margin-left: 1em; }
.vm-toc { font-size: 0.95em; margin-right: -34mm; }
.primer-page.bind.verso .vm-toc { margin-right: 0; margin-left: -34mm; }
.vm-toc-row { display: flex; gap: 2mm; align-items: baseline; padding: 0.35em 0; border-bottom: 1px dotted color-mix(in srgb, var(--ink) 35%, transparent); }
.vm-toc-row .no { width: 3em; font-family: var(--font-title); color: var(--vm-primary, var(--rubric)); }
.vm-toc-row .nm { flex: 1; }
/* Verweis: der Platzhalter „☐ 000“ ist breiter als jede echte Angabe, das Einsetzen macht Zeilen nur kürzer */
.vref { font-variant-numeric: tabular-nums; white-space: nowrap; }
.vm-toc-row .vref { display: inline-block; min-width: 3em; text-align: right; }
.vm-middle .page-inner { display: flex; flex-direction: column; justify-content: center; text-align: center; }
.vm-middle h3 { color: var(--vm-primary, var(--rubric)); }
/* kopfüber: die ganze Seite dreht sich, damit auch der Lochrand auf die andere Kante wandert */
.page.upside-down { transform: rotate(180deg); transform-origin: 50% 50%; } /* Drehpunkt fest: schmale Ansicht und Druck setzen sonst top left */
.lehre-switch { display: flex; gap: 0; margin: 0 0 10px; }
.lehre-switch[hidden] { display: none; }
.lehre-switch button { border-radius: 0; }
.lehre-switch button:first-child { border-radius: 6px 0 0 6px; }
.lehre-switch button:last-child { border-radius: 0 6px 6px 0; border-left: none; }
.lehre-switch button.on { background: var(--ui-accent); color: var(--ui-accent-text); border-color: var(--ui-accent); }
.vm-half[hidden] { display: none; }
.vm-stanza { height: 0.7em; }
.vm-response { text-align: center; font-style: italic; font-size: 0.92em; margin: 0.2em 0 0.6em; }
.vm-response b { font-style: normal; font-family: var(--font-title); font-weight: 600; font-size: 0.85em; color: var(--vm-secondary, var(--rubric)); }
.vm-motto { margin-top: 1.4em; font-style: italic; font-size: 0.95em; }
.vm-motto p { margin: 0; }
.vm-list { margin: 0.3em 0 0.6em; padding-left: 1.2em; }
.vm-list li { margin-bottom: 0.25em; }
.vm-table { width: 100%; border-collapse: collapse; font-size: 0.82em; margin: 0.4em 0 0.7em; }
.vm-table th, .vm-table td { border-bottom: 1px solid color-mix(in srgb, var(--ink) 30%, transparent); padding: 0.2em 0.3em; text-align: left; vertical-align: top; }
.vm-table th { font-family: var(--font-title); font-weight: 600; color: var(--vm-primary, var(--rubric)); }
.mnote-desc { display: block; font-family: var(--font-body, inherit); font-style: italic; font-size: 0.78em; opacity: 0.85; margin-bottom: 0.15em; }
.vm-anchor { display: inline; }
.vm-hooks { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; white-space: nowrap; }
