:root {
  --bg: #f6f7fa; --card: #ffffff; --text: #1b2230; --muted: #596579; --line: #dce1ea;
  --accent: #2d5be3; --accent-soft: #e8eefd; --warn: #fff6dc; --warn-line: #efd07a;
  --code-bg: #f0f3f8; --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e131b; --card: #161d28; --text: #e5eaf2; --muted: #9aa6b8; --line: #283243;
    --accent: #7fa4ff; --accent-soft: #1b2947; --warn: #2a2410; --warn-line: #6b5a1f; --code-bg: #0b1017;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: var(--card); padding: 8px 12px; z-index: 10; }

header.site { background: var(--card); border-bottom: 1px solid var(--line); }
header.site .in { max-width: 1360px; margin: 0 auto; padding: 14px 16px; display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
header.site a.brand { font-weight: 800; font-size: 1.25rem; text-decoration: none; color: var(--text); letter-spacing: -.01em; }
header.site a.brand span { color: var(--accent); }
header.site .claim { color: var(--muted); font-size: .95rem; }

.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr) 300px; gap: 24px; max-width: 1360px; margin: 0 auto; padding: 24px 16px 40px; align-items: start; }
.layout.two { grid-template-columns: 240px minmax(0, 1fr); }
.layout > * { min-width: 0; }

.menu, .aff { position: sticky; top: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; max-height: calc(100vh - 32px); overflow: auto; }
.menu summary { font-weight: 700; cursor: pointer; list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu h2 { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 16px 0 6px; }
.menu ul { list-style: none; margin: 0; padding: 0; }
.menu a { display: block; padding: 7px 10px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: .95rem; }
.menu a:hover { background: var(--accent-soft); }
.menu a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }

main article { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px clamp(16px, 4vw, 40px) 32px; min-width: 0; }
h1 { font-size: clamp(1.7rem, 3.4vw, 2.3rem); line-height: 1.2; margin: 0 0 8px; letter-spacing: -.02em; }
h2 { font-size: 1.4rem; margin: 2.1rem 0 .6rem; line-height: 1.3; scroll-margin-top: 16px; }
h3 { font-size: 1.1rem; margin: 1.4rem 0 .4rem; }
p.lead { font-size: 1.12rem; color: var(--muted); margin: .4rem 0 1rem; }
.adnote { font-size: .85rem; color: var(--muted); border-left: 3px solid var(--warn-line); padding: 2px 0 2px 10px; margin: 0 0 1.2rem; }
.toc { background: var(--accent-soft); border-radius: var(--radius); padding: 12px 18px; margin: 1.2rem 0; }
.toc strong { display: block; margin-bottom: 4px; }
.toc ol { margin: 0; padding-left: 20px; columns: 2; column-gap: 28px; }
.toc li { break-inside: avoid; }
.box { border: 1px solid var(--line); border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 12px 16px; margin: 1.2rem 0; }
.box.warn { border-left-color: var(--warn-line); background: var(--warn); }
.box p { margin: .3rem 0; } .box strong:first-child { display: block; }
figure { margin: 1.6rem 0; text-align: center; }
figure svg { width: 100%; height: auto; max-width: 720px; }
figcaption { color: var(--muted); font-size: .88rem; margin-top: 6px; }
table { border-collapse: collapse; width: 100%; margin: 1.2rem 0; font-size: .95rem; display: block; overflow-x: auto; }
th, td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; vertical-align: top; }
th { background: var(--accent-soft); }
pre, code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
code { background: var(--code-bg); padding: 1px 6px; border-radius: 5px; font-size: .9em; }
pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; overflow-x: auto; line-height: 1.5; font-size: .88rem; }
pre code { background: none; padding: 0; }
dl dt { font-weight: 700; margin-top: 1rem; scroll-margin-top: 16px; } dl dd { margin: .15rem 0 0 0; color: var(--text); }
.steps { counter-reset: s; list-style: none; padding: 0; }
.steps > li { counter-increment: s; position: relative; padding: 2px 0 12px 46px; }
.steps > li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; display: grid; place-items: center; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 2.4rem; padding-top: 1rem; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pager a { text-decoration: none; font-weight: 600; }

.aff h2 { font-size: 1.05rem; margin: 0; }
.aff .sub { font-size: .78rem; color: var(--muted); margin: 2px 0 10px; }
.aff ol { list-style: none; margin: 0; padding: 0; counter-reset: a; }
.aff li { counter-increment: a; margin-bottom: 6px; }
.aff li a { display: block; text-decoration: none; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px 8px 38px; position: relative; background: var(--bg); }
.aff li a::before { content: counter(a); position: absolute; left: 10px; top: 8px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: .75rem; font-weight: 700; display: grid; place-items: center; }
.aff li a:hover, .aff li a:focus-visible { border-color: var(--accent); }
.aff .a-label { display: block; font-weight: 600; font-size: .92rem; line-height: 1.3; }
.aff .a-note { display: block; font-size: .76rem; color: var(--muted); }
.aff .legal { font-size: .74rem; color: var(--muted); margin: 10px 0 0; }

footer.site { max-width: 1360px; margin: 0 auto; padding: 0 16px 40px; color: var(--muted); font-size: .88rem; }
footer.site a { color: var(--muted); }
footer.site .in { border-top: 1px solid var(--line); padding-top: 16px; display: flex; gap: 8px 18px; flex-wrap: wrap; }

/* SVG-Bausteine */
.s-box { fill: var(--card); stroke: var(--line); stroke-width: 1.5; }
.s-acc { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
.s-warn { fill: var(--warn); stroke: var(--warn-line); stroke-width: 1.5; }
.s-t { fill: var(--text); font: 600 14px system-ui, sans-serif; }
.s-m { fill: var(--muted); font: 12.5px system-ui, sans-serif; }
.s-line { stroke: var(--muted); stroke-width: 1.5; fill: none; }
.s-thin { stroke: var(--line); stroke-width: 1; fill: none; }
.s-dot { fill: var(--accent); }
.s-ah { fill: var(--muted); }
.s-bar { fill: var(--accent); }
.s-node { fill: var(--card); stroke: var(--accent); stroke-width: 2; }
.s-node-in { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2; }
.s-node-out { fill: var(--accent); stroke: var(--accent); stroke-width: 2; }

@media (max-width: 1100px) {
  .layout, .layout.two { grid-template-columns: 220px minmax(0, 1fr); }
  .aff { position: static; grid-column: 1 / -1; max-height: none; }
  .aff ol { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; }
  .aff li { margin: 0; }
}
@media (max-width: 760px) {
  .layout, .layout.two { grid-template-columns: minmax(0, 1fr); padding-top: 14px; }
  .menu { position: static; max-height: none; }
  .toc ol { columns: 1; }
  header.site .claim { display: none; }
}
@media print { .menu, .aff, header.site, footer.site .in a { display: none; } .layout { display: block; } }
