/* ============ Charakterbogen (Druck & Vorschau) ============ */
.sheet {
  --ink: #26241f;
  --ink-2: #4a4640;
  --muted-ink: #7d776d;
  --rule: #8f897e;
  --rule-soft: #cfcac0;
  --paper: #ffffff;
  --tint: #f5f3ee;
  --red: #9b2d27;
  --s-serif: 'Cormorant Garamond', Georgia, serif;
  --s-sans: 'Inter', system-ui, sans-serif;
  font: 7.2pt/1.3 var(--s-sans);
  font-variant-numeric: lining-nums;
  color: var(--ink);
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.sheet-page {
  width: 210mm; height: 297mm; padding: 8mm; background: var(--paper); position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 2mm;
}
.sheet-page.appendix { padding: 10mm; display: flex; flex-direction: column; gap: 0; }
.sheet * { box-sizing: border-box; }

/* Grundbausteine */
.s-box { border: .3mm solid var(--rule); border-radius: 2.4mm; padding: 1.6mm 2.2mm 1.8mm; background: var(--paper); position: relative; min-width: 0; }
.s-box::before { content: ''; position: absolute; inset: .7mm; border: .15mm solid var(--rule-soft); border-radius: 1.8mm; pointer-events: none; }
.s-title { font-size: 6pt; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; text-align: center; color: var(--ink-2); padding-bottom: .8mm; margin-bottom: 1.2mm; border-bottom: .25mm solid var(--rule); position: relative; }
.s-lbl { font-size: 5.6pt; font-variant: small-caps; letter-spacing: .06em; color: var(--muted-ink); text-transform: lowercase; }
.s-lbl::first-letter { text-transform: uppercase; }
.s-center { text-align: center; }
.s-val { font-family: var(--s-serif); font-weight: 700; font-size: 10pt; line-height: 1.15; min-height: 4.2mm; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-field { border-bottom: .2mm solid var(--rule-soft); padding-bottom: .3mm; min-width: 0; }
.s-field .s-lbl { margin-top: .3mm; }
.s-big, .s-val, .s-ac, .s-level-val, .s-xp, .s-ab-mod, .s-ab-score, .s-caster-num, .s-coin-val, .s-charname { font-feature-settings: 'lnum' 1, 'pnum' 1; }
.s-big { font-family: var(--s-serif); font-weight: 700; font-size: 17pt; line-height: 1.05; text-align: center; }
.s-text { font-size: 7pt; white-space: pre-wrap; }
.s-small { font-size: 6.2pt; line-height: 1.3; }
.s-muted { color: var(--muted-ink); }
.s-clip { overflow: hidden; }
.s-page { display: inline-block; font-size: 5.4pt; font-weight: 600; color: var(--muted-ink); background: var(--tint); border-radius: .8mm; padding: 0 .8mm; margin-left: .6mm; vertical-align: .2mm; white-space: nowrap; }
.s-diamonds { display: inline-flex; gap: .8mm; vertical-align: middle; flex-wrap: wrap; }
.s-dia { display: inline-block; width: 2.3mm; height: 2.3mm; border: .28mm solid var(--ink-2); transform: rotate(45deg); margin: 0 .5mm; background: var(--paper); flex: none; }
.s-dia.on { background: var(--ink); }
.s-dia.big { width: 5mm; height: 5mm; border-width: .4mm; }
.s-dot { display: inline-block; width: 2.4mm; height: 2.4mm; border-radius: 50%; border: .28mm solid var(--ink-2); flex: none; }
.s-dot.on { background: var(--ink); }
.s-dot.exp { background: var(--ink); box-shadow: 0 0 0 .45mm var(--paper), 0 0 0 .7mm var(--ink); }

/* Kopfzeile Seite 1 */
.s-header { display: grid; grid-template-columns: 1fr 17mm 21mm 34mm 19mm 27mm; gap: 2mm; height: 30mm; }
.s-namebox { display: flex; flex-direction: column; justify-content: flex-end; }
.s-charname { font-family: var(--s-serif); font-weight: 700; font-size: 17pt; line-height: 1; border-bottom: .25mm solid var(--rule); padding-bottom: .6mm; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8mm 3mm; margin-top: 1.2mm; }
.s-level { border: .3mm solid var(--rule); border-radius: 50% / 40%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: var(--tint); }
.s-level-val { font-family: var(--s-serif); font-weight: 700; font-size: 18pt; line-height: 1; }
.s-xp { font-family: var(--s-serif); font-weight: 700; font-size: 8.5pt; margin-top: 1mm; border-top: .2mm solid var(--rule-soft); padding-top: .5mm; }
.s-shield { border: .35mm solid var(--rule); border-radius: 2mm 2mm 50% 50% / 2mm 2mm 45% 45%; display: flex; flex-direction: column; align-items: center; padding-top: 1.6mm; background: var(--paper); }
.s-shield .s-lbl { font-size: 5.3pt; line-height: 1.15; font-weight: 600; }
.s-ac { font-family: var(--s-serif); font-weight: 700; font-size: 22pt; line-height: 1.1; }
.s-shield-foot { display: flex; align-items: center; gap: 1mm; }
.s-hp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2mm; }
.s-hp-cur { border-right: .2mm solid var(--rule-soft); display: flex; flex-direction: column; justify-content: flex-end; min-height: 14mm; }
.s-hp-side { display: flex; flex-direction: column; gap: 1mm; }
.s-hd { display: flex; flex-direction: column; gap: 1mm; }
.s-hd .s-val { font-size: 8.5pt; }
.s-hd .s-title, .s-hp .s-title { letter-spacing: .04em; font-size: 5.6pt; }
.s-slot .s-diamonds { flex-wrap: nowrap; }
.s-death .s-title { font-size: 5.4pt; letter-spacing: .04em; }
.s-death-row { display: flex; align-items: center; justify-content: space-between; gap: 1mm; margin: 1.6mm 0; }
.s-death-row .s-diamonds { flex-wrap: nowrap; }
.s-death .s-diamonds { gap: .6mm; }

.s-banner { display: flex; align-items: center; gap: 3mm; height: 6mm; font-family: var(--s-serif); font-weight: 700; font-size: 13pt; color: var(--red); letter-spacing: .04em; }
.s-banner i { flex: 1; height: .5mm; background: linear-gradient(90deg, var(--red), var(--rule-soft)); border-radius: 1mm; }
.s-banner-sub { font-family: var(--s-sans); font-size: 6pt; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-ink); }

/* Körper Seite 1 */
.s-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 70mm 1fr; gap: 2mm; }
.s-left { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto 1fr; gap: 2mm; min-height: 0; }
.s-col { display: flex; flex-direction: column; gap: 2mm; min-height: 0; }
.s-training { grid-column: 1 / -1; }
.s-pb .s-big { font-size: 20pt; padding: 1mm 0; }
.s-insp { display: flex; flex-direction: column; align-items: center; padding-bottom: 3mm; }
.s-training { display: flex; flex-direction: column; }
.s-training .s-train-field.grow { flex: 1; }
.s-insp .s-dia { margin-top: 2.4mm; }
.s-ability { padding-bottom: 1.2mm; }
.s-ab-main { display: flex; align-items: center; justify-content: center; gap: 2.4mm; }
.s-ab-mod { width: 13mm; height: 11mm; border: .35mm solid var(--rule); border-radius: 50%; display: grid; place-items: center; font-family: var(--s-serif); font-weight: 700; font-size: 16pt; background: var(--tint); }
.s-ab-score { min-width: 9mm; height: 7mm; border: .3mm solid var(--rule); border-radius: 1.4mm; display: grid; place-items: center; font-family: var(--s-serif); font-weight: 700; font-size: 11pt; }
.s-ab-lbls { display: flex; justify-content: center; gap: 5mm; font-size: 5.2pt; font-variant: small-caps; color: var(--muted-ink); margin: .3mm 0 1mm; }
.s-skill { display: flex; align-items: center; gap: 1.2mm; font-size: 6.6pt; padding: .45mm 0; }
.s-save { border-top: .2mm solid var(--rule-soft); border-bottom: .2mm solid var(--rule-soft); font-weight: 600; margin-bottom: .6mm; }
.s-bonus { width: 5.4mm; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; border-bottom: .2mm solid var(--rule-soft); }
.s-armor-row { display: flex; align-items: center; gap: 1.6mm; flex-wrap: wrap; padding-bottom: 1mm; border-bottom: .2mm solid var(--rule-soft); }
.s-armor { display: inline-flex; align-items: center; font-size: 6.2pt; }
.s-train-field { padding: .8mm 0; border-bottom: .2mm solid var(--rule-soft); min-height: 9mm; }
.s-train-field:last-child { border-bottom: 0; }

.s-right { display: flex; flex-direction: column; gap: 2mm; min-height: 0; }
.s-mini-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2mm; }
.s-mini { padding-bottom: 1mm; }
.s-mini .s-title { font-size: 5.5pt; }
.s-mini .s-big { font-size: 15pt; }
.s-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.s-table th { font-size: 5.6pt; font-weight: 600; color: var(--muted-ink); text-align: left; padding: .4mm 1mm; border-bottom: .25mm solid var(--rule); }
.s-table td { padding: .7mm 1mm; border-bottom: .2mm solid var(--rule-soft); height: 5.2mm; vertical-align: middle; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 6.8pt; }
.s-table .c { text-align: center; }
.s-weapons th:nth-child(1) { width: 30%; } .s-weapons th:nth-child(2) { width: 15%; } .s-weapons th:nth-child(3) { width: 22%; }
.s-weapons td.s-small { white-space: normal; line-height: 1.15; font-size: 5.8pt; }
.s-classfeat { flex: 1; min-height: 0; overflow: hidden; }
.s-resources { display: grid; grid-template-columns: 1fr 1fr; gap: .6mm 3mm; margin-bottom: 1.4mm; padding-bottom: 1.2mm; border-bottom: .2mm solid var(--rule-soft); }
.s-res { display: flex; align-items: center; gap: 1.2mm; flex-wrap: wrap; font-size: 6.4pt; }
.s-res-name { font-weight: 600; }
.s-res-box { font-size: 6pt; }
.s-featlist { column-count: 2; column-gap: 4mm; column-rule: .2mm solid var(--rule-soft); }
.s-feat { break-inside: avoid; padding: .35mm 0; font-size: 6.6pt; }
.s-feat-name { font-weight: 600; }
.s-feat-desc { font-size: 5.9pt; color: var(--muted-ink); line-height: 1.25; margin-top: .2mm; }
.s-feat-lvl { color: var(--muted-ink); font-size: 5.6pt; }
.s-notes { margin-top: 1.2mm; padding-top: 1mm; border-top: .2mm solid var(--rule-soft); }
.s-two { display: grid; grid-template-columns: 1fr 1fr; gap: 2mm; height: 66mm; }
.s-species, .s-feats { overflow: hidden; }
.s-species .s-feat, .s-feats .s-feat { padding: .5mm 0; border-bottom: .2mm dotted var(--rule-soft); }

/* Seite 2 */
.s-p2 { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 62mm; gap: 2mm; }
.s-p2-left, .s-p2-right { display: flex; flex-direction: column; gap: 2mm; min-height: 0; }
.s-p2-top { display: grid; grid-template-columns: 48mm 1fr; gap: 2mm; }
.s-caster { padding: 0; overflow: hidden; }
.s-caster::before { display: none; }
.s-caster-attr { padding: 1.4mm 2mm; border-bottom: .25mm solid var(--rule); }
.s-caster-attr .s-val { font-size: 8.5pt; }
.s-caster-row { display: grid; grid-template-columns: 14mm 1fr; align-items: center; border-bottom: .2mm solid var(--rule-soft); }
.s-caster-row:last-child { border-bottom: 0; }
.s-caster-row .s-title { border: 0; margin: 0; padding: 0 1mm; text-align: left; font-size: 5.6pt; }
.s-caster-num { font-family: var(--s-serif); font-weight: 700; font-size: 11pt; text-align: center; border-right: .25mm solid var(--rule); padding: 1.1mm 0; }
.s-slot-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2mm; }
.s-slot { display: flex; align-items: center; gap: 1mm; white-space: nowrap; padding: .7mm 0; border-bottom: .2mm solid var(--rule-soft); font-size: 6.4pt; }
.s-slot-lbl { font-variant: small-caps; width: 10.5mm; flex: none; color: var(--ink-2); }
.s-slot-total { width: 3.5mm; font-weight: 700; text-align: center; }
.s-spells { flex: 1; min-height: 0; overflow: hidden; }
.s-spelltable th:nth-child(1) { width: 7%; } .s-spelltable th:nth-child(2) { width: 30%; } .s-spelltable th:nth-child(3) { width: 13%; }
.s-spelltable th:nth-child(4) { width: 14%; } .s-spelltable th:nth-child(5) { width: 13%; }
.s-spelltable td { height: 6.4mm; }
.s-spelltable td.c .s-dia { margin: 0 .9mm; width: 2mm; height: 2mm; }
.s-spelltable td.s-small { font-size: 5.8pt; white-space: normal; line-height: 1.1; }
.s-appearance { height: 46mm; overflow: hidden; }
.s-app-inner { display: flex; gap: 2mm; }
.s-portrait { width: 22mm; height: 29mm; object-fit: cover; border-radius: 1.4mm; border: .25mm solid var(--rule); flex: none; }
.s-appearance .s-clip { max-height: 26mm; }
.s-story { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.s-story .s-clip { flex: 1; min-height: 0; }
.s-story-foot { margin-top: 1mm; }
.s-langs { min-height: 17mm; }
.s-equip { height: 86mm; display: flex; flex-direction: column; }
.s-equip-list { flex: 1; min-height: 0; overflow: hidden; column-count: 2; column-gap: 2.5mm; font-size: 6.2pt; line-height: 1.35; }
.s-equip-list div { break-inside: avoid; border-bottom: .2mm dotted var(--rule-soft); }
.s-attune-row { display: flex; align-items: center; gap: 1.4mm; border-bottom: .2mm solid var(--rule-soft); padding: .6mm 0; min-height: 4.5mm; font-size: 6.4pt; }
.s-coin-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1.4mm; }
.s-coin-val { border: .25mm solid var(--rule); border-radius: 1.2mm; text-align: center; font-family: var(--s-serif); font-weight: 700; font-size: 10pt; padding: .8mm 0; }
.s-foot { font-size: 5.4pt; color: var(--muted-ink); text-align: right; }

/* Anhang */
.s-ap-title { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--s-serif); font-weight: 700; font-size: 16pt; color: var(--red); border-bottom: .5mm solid var(--red); padding-bottom: 1mm; margin-bottom: 3mm; }
.s-ap-title .s-muted { font-size: 10pt; color: var(--muted-ink); }
.s-ap-cols { flex: 1; min-height: 0; column-count: 2; column-gap: 7mm; column-rule: .2mm solid var(--rule-soft); column-fill: auto; overflow: hidden; }
.s-ap-group { column-span: all; font-family: var(--s-serif); font-size: 12pt; margin: 3mm 0 1.5mm; color: var(--ink); border-bottom: .25mm solid var(--rule); padding-bottom: .5mm; }
.s-ap-group:first-child { margin-top: 0; }
.s-ap-entry { margin-bottom: 2.4mm; break-inside: avoid-column; }
.s-ap-entry.nested { padding-left: 2.5mm; border-left: .4mm solid var(--rule-soft); }
.s-ap-entry.s-spell, .s-ap-entry { break-inside: auto; }
.s-ap-head { display: flex; justify-content: space-between; gap: 2mm; font-size: 8pt; break-after: avoid; }
.s-ap-sub { font-size: 6.2pt; color: var(--muted-ink); font-style: italic; margin-bottom: .6mm; break-after: avoid; }
.s-ap-meta { display: flex; flex-wrap: wrap; gap: .4mm 2.6mm; font-size: 6.2pt; margin-bottom: .6mm; }
.s-ap-text { font-size: 6.9pt; line-height: 1.38; color: var(--ink); }
.s-ap-text p { margin: 0 0 .9mm; }
.s-ap-text ul { margin: .4mm 0 .9mm; padding-left: 3.5mm; }
.s-ap-text table { font-size: 6.2pt; border-collapse: collapse; }
.s-ap-text th, .s-ap-text td { border-bottom: .2mm solid var(--rule-soft); padding: .3mm 1.4mm .3mm 0; text-align: left; }
.s-ap-text h5 { font-size: 7pt; margin: 1mm 0 .4mm; }
.s-inv td { white-space: normal; height: auto; font-size: 6.8pt; }
.s-inv th:nth-child(1) { width: 34%; } .s-inv th:nth-child(2) { width: 7%; } .s-inv th:nth-child(3) { width: 11%; } .s-inv th:nth-child(5) { width: 6%; }

/* Vorschau im Browser */
.sheet-preview { background: #e9e6e0; border-radius: var(--radius, 10px); padding: 16px; overflow: hidden; }
.sheet-preview .sheet-scale { transform-origin: top left; }
.sheet-preview .sheet-page { box-shadow: 0 4px 18px rgba(0, 0, 0, .12); margin-bottom: 16px; }

/* Druck */
#print-root { position: absolute; left: -10000px; top: 0; width: 210mm; pointer-events: none; }
@media print {
  @page { size: A4 portrait; margin: 0; }
  html, body { background: #fff !important; }
  #print-root { position: static; width: auto; }
  #print-root .sheet-page { page-break-after: always; break-after: page; box-shadow: none; margin: 0; }
  #print-root .sheet-page:last-child { page-break-after: auto; break-after: auto; }
  dialog, .toast { display: none !important; }
}
