@font-face { font-family: 'Inter'; src: url('../fonts/inter-latin-wght-normal.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url('../fonts/fraunces-latin-wght-normal.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #FBF8F3;
  --surface: #FFFFFF;
  --ink: #1F2421;
  --muted: #5B635E;
  --line: #E4DED3;
  --accent: #1E6B4F;
  --accent-soft: #E3F0EA;
  --accent-ink: #FFFFFF;
  --danger: #B4413C;
  --danger-soft: #F7E5E3;
  --band: #1F2421;
  --paid: #3B5B92;
  --radius: 14px;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151916; --surface: #1D2320; --ink: #ECEAE4; --muted: #A3ABA6; --line: #2E3631;
    --accent: #5FBF94; --accent-soft: #1F3A2F; --accent-ink: #0E1311;
    --danger: #E3807A; --danger-soft: #3A2423; --band: #ECEAE4; --paid: #7F9FD9;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 1.0625rem/1.65 var(--sans);
  hyphens: auto; overflow-wrap: break-word;
}
h1, h2, h3 { font-family: var(--serif); line-height: 1.15; font-weight: 600; letter-spacing: -0.01em; hyphens: manual; }
h1 { font-size: clamp(2.2rem, 9vw, 3.6rem); margin: .2em 0 .4em; }
h1 em { color: var(--accent); font-style: italic; }
h2 { font-size: clamp(1.8rem, 7vw, 2.6rem); margin: .2em 0 .3em; }
h3 { font-size: 1.3rem; margin: 0 0 .5em; }
a { color: var(--accent); text-underline-offset: 3px; }
strong { font-weight: 650; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; z-index: 20; background: var(--surface); padding: 8px 12px; }

/* Kopfzeile */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 10px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.logo { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
.logo span { color: var(--accent); }
.progress { min-width: 0; height: 28px; display: flex; align-items: center; gap: 10px; justify-self: center; width: min(100%, 190px); }
.progress svg { flex: 1; min-width: 0; width: 100%; height: 100%; overflow: visible; }
.progress-count { font: 600 .8rem var(--sans); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress-line { fill: none; stroke: var(--accent); stroke-width: 2.2; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; transition: all .5s ease; }
.menu-btn { white-space: nowrap; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; font: 600 .9rem var(--sans); cursor: pointer; }

.toc {
  position: fixed; inset: 57px 0 auto auto; z-index: 9; width: min(360px, 100%);
  max-height: calc(100dvh - 57px); overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 0 0 0 var(--radius);
  padding: 8px 16px 16px; box-shadow: 0 12px 32px rgb(0 0 0 / .12);
}
.toc ol { list-style: none; margin: 0 0 12px; padding: 0; }
.toc a { display: flex; gap: 10px; align-items: center; min-height: 44px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.toc a[aria-current] { color: var(--accent); font-weight: 650; }
.toc .tick { width: 1.4em; text-align: center; color: var(--accent); }
.toc .opt { margin-left: auto; font-size: .75rem; color: var(--muted); }

/* Kapitel */
main { max-width: 680px; margin: 0 auto; padding: 24px 16px 32px; }
.js .chapter:not(.active) { display: none; }
.chapter { padding-bottom: 24px; }
.no-js-hide { display: none; }
html:not(.js) .chapter { border-bottom: 1px solid var(--line); margin-bottom: 32px; }
.eyebrow { font-size: .85rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lead { font-size: 1.2rem; color: var(--muted); margin-top: 0; }
.badge { text-transform: none; letter-spacing: 0; font-weight: 600; font-size: .75rem; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.aha { padding: 14px 18px; background: var(--accent-soft); border-radius: var(--radius); margin: 28px 0 0; }
.personal { background: var(--surface); border: 1px dashed var(--accent); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 20px; }
.personal p { margin: 0 0 6px; } .personal p:last-child { margin: 0; }
.optional-note { font-size: .9rem; color: var(--muted); }
.fineprint { font-size: .82rem; color: var(--muted); line-height: 1.5; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px;
  padding: 10px 20px; border-radius: 999px; border: 1.5px solid var(--ink); background: transparent;
  color: var(--ink); font: 600 1rem/1.25 var(--sans); text-decoration: none; cursor: pointer; text-align: center;
  transition: transform .15s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.btn-row .btn { flex: 1 1 220px; }
.link-btn { background: none; border: 0; padding: 8px 0; color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer; min-height: 44px; }

/* Check-in */
.checkin fieldset { border: 0; padding: 0; margin: 0 0 24px; }
.checkin legend { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; margin-bottom: 10px; }
.opt-hint { font: 500 .85rem var(--sans); color: var(--muted); }
.choice { display: block; margin-bottom: 8px; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice span { display: block; padding: 14px 16px; min-height: 48px; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: border-color .15s, background .15s; }
.choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.choice input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; min-height: 44px; padding: 6px 0; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.disclaimer-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 20px; }
.disclaimer-box h2 { font-size: 1.2rem; }
.disclaimer-box p { font-size: .95rem; }
.checkin .btn-primary { width: 100%; }

/* Widgets */
.widget, .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 16px; margin: 24px 0; }
.widget-title { font-size: 1.15rem; }
.widget-result { font-weight: 600; min-height: 1.6em; }
.slider { display: block; margin: 14px 0; }
.slider span { display: block; font-weight: 500; margin-bottom: 4px; }
.slider output { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; height: 44px; accent-color: var(--accent); margin: 0; }
.chart { width: 100%; height: auto; display: block; margin: 8px 0; overflow: visible; }
.chart text { font: 500 9px var(--sans); fill: var(--muted); }

.bars { display: grid; gap: 10px; margin: 8px 0; }
.bar-label { display: flex; justify-content: space-between; font-size: .95rem; margin-bottom: 4px; }
.bar-label strong { font-variant-numeric: tabular-nums; }
.bar-track { height: 14px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--muted); transition: width .35s ease; }
.bar-fill.good { background: var(--accent); }
.bar-fill.bad { background: var(--danger); }

.basket-grid { display: grid; grid-template-columns: 1fr 1.6fr; gap: 16px; align-items: start; margin-bottom: 12px; }
.basket-label { font-size: .9rem; margin: 0 0 8px; }
.basket-value { font-weight: 700; font-variant-numeric: tabular-nums; margin: 8px 0 0; }
.single { font-size: 3.2rem; line-height: 1; transition: transform .6s ease, opacity .6s ease, filter .6s; }
.single.gone { transform: translateY(16px) rotate(40deg); opacity: .25; filter: grayscale(1); }
.dots { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.dots i { aspect-ratio: 1; border-radius: 50%; background: var(--accent); opacity: .85; transition: opacity .6s, transform .6s, background .6s; }
.dots i.gone { background: var(--danger); transform: translateY(6px); opacity: .5; }

.crash-step p { margin-top: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .82rem; color: var(--muted); align-items: center; }
.legend span { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.key-paid { background: var(--paid); }
.key-gain { background: var(--accent); }
.key-band { background: var(--band); height: 3px; opacity: .6; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 8px; }
.stats div { background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.stats dt { font-size: .75rem; color: var(--muted); }
.stats dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 1.02rem; }

/* Kriterien, ETF-Tabelle */
.criteria details, .risks details { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); margin-bottom: 8px; }
.criteria summary, .risks summary { cursor: pointer; padding: 14px 16px; font-weight: 650; min-height: 48px; display: flex; align-items: center; gap: 12px; list-style: none; }
.risks summary::-webkit-details-marker, .criteria summary::-webkit-details-marker { display: none; }
.criteria summary::after, .risks summary::after { content: '+'; margin-left: auto; font-size: 1.3rem; color: var(--muted); }
.risks details[open] summary::after, .criteria details[open] summary::after { content: '–'; }
.criteria details p, .risks details p { padding: 0 16px 14px; margin: 0; }
.num { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: .9rem; flex: none; }
.mine { border-color: var(--accent); }
.etf-row { padding: 12px 0; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.mono { font: 500 .8rem ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); }
.pill { display: inline-block; font-size: .78rem; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); margin: 2px 2px 2px 0; font-weight: 600; }

/* Flip-Karten */
.flips { display: grid; gap: 12px; }
.flip { position: relative; display: grid; min-height: 120px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; perspective: 900px; }
.flip-front, .flip-back { grid-area: 1 / 1; padding: 18px; border-radius: var(--radius); backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform .5s ease; display: flex; flex-direction: column; justify-content: center; }
.flip-front { background: var(--surface); border: 1.5px solid var(--line); font-family: var(--serif); font-size: 1.15rem; font-weight: 600; }
.flip-back { background: var(--accent); color: var(--accent-ink); transform: rotateY(180deg); font-size: .98rem; }
.flip[aria-pressed=true] .flip-front { transform: rotateY(-180deg); }
.flip[aria-pressed=true] .flip-back { transform: rotateY(0); }
.flip-icon { font-size: 1.6rem; margin-bottom: 6px; }

/* Listen, Tabs, Vergleich */
.facts { padding-left: 1.1em; } .facts li { margin-bottom: 12px; }
.tablist { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--bg); padding: 4px; border-radius: 999px; margin-bottom: 14px; }
.tablist button { min-height: 44px; border: 0; border-radius: 999px; background: none; color: var(--ink); font: 600 .95rem var(--sans); cursor: pointer; }
.tablist button[aria-selected=true] { background: var(--accent); color: var(--accent-ink); }
.pros-cons { list-style: none; padding: 0; }
.pros-cons li { padding: 8px 0 8px 30px; position: relative; border-top: 1px solid var(--line); }
.pros-cons li::before { position: absolute; left: 4px; top: 8px; font-weight: 700; }
.pro::before { content: '✓'; color: var(--accent); }
.con::before { content: '!'; color: var(--danger); }
.note { border-style: dashed; }
.compare { display: grid; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); font-size: .9rem; margin: 12px 0 20px; }
.compare > div { display: grid; grid-template-columns: 1.1fr 1fr 1fr; border-top: 1px solid var(--line); }
.compare > div:first-child { border-top: 0; }
.compare span { padding: 10px; }
.compare-head span { font-weight: 700; background: var(--bg); }
.compare [role=rowheader] { font-weight: 600; }
.compare .good { color: var(--accent); }
.compare .bad { color: var(--danger); }

/* Schritte, Broker, Zusammenfassung */
.steps { padding-left: 0; list-style: none; counter-reset: s; }
.steps li { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 8px 14px; margin-bottom: 8px; }
.steps input:checked + span { color: var(--muted); }
.brokers { display: grid; gap: 10px; margin: 12px 0 24px; }
.broker { display: block; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-decoration: none; }
.broker strong { color: var(--accent); }
.broker small { display: block; color: var(--muted); margin-top: 4px; }
.summary-text { hyphens: manual; white-space: pre-wrap; font: .88rem/1.55 var(--sans); background: var(--bg); padding: 14px; border-radius: 10px; margin: 0 0 8px; max-height: 320px; overflow: auto; }
.kofi { text-align: center; }
.finale { hyphens: manual; text-wrap: balance; font-family: var(--serif); font-size: clamp(1.4rem, 5.5vw, 1.85rem); line-height: 1.25; text-align: center; margin: 48px 0 16px; }
.finale span { display: block; text-wrap: balance; }
.finale em { color: var(--accent); }

/* Blättern & Footer */
.pager { display: flex; gap: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.pager .btn { flex: 1; }
.pager .skip-link { flex-basis: 100%; }
.footer { max-width: 680px; margin: 0 auto; padding: 16px 16px 40px; font-size: .85rem; color: var(--muted); border-top: 1px solid var(--line); }
.footer p { margin: 4px 0; }

/* Rechtstexte */
.legal h1 { font-size: clamp(2rem, 8vw, 2.8rem); }
.legal h2 { font-size: 1.35rem; margin-top: 1.6em; }

@media (min-width: 720px) {
  main { padding-top: 48px; }
  .flips { grid-template-columns: 1fr 1fr; }
  .etf-row { grid-template-columns: 1fr 1fr; align-items: center; }
  .widget, .card { padding: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media print {
  .topbar, .toc, .pager, .footer, .no-print, .chapter > :not(#zusammenfassung) { display: none !important; }
  .js .chapter:not(.active) { display: none; }
  body { background: #fff; color: #000; }
  .summary { border: 0; padding: 0; }
  .summary-text { max-height: none; overflow: visible; background: none; font-size: 11pt; }
}
