/* Layout: a night opener, then one comfortable reading column (~40rem). Interactive pieces and the board band step out wider. Chapter rail on wide screens, chapter pill on phones. */
:root {
  --bg: #f6f5fc; --surface: #ffffff; --fg: #17183a; --muted: #57597a; --line: #dfdef1;
  --accent: #5546d6; --accent-ink: #ffffff; --accent-soft: #ebe8ff;
  --hot: #be332c; --hot-soft: #ffe1dd; --hot-ink: #3d0a07;
  --ok: #17734b; --ok-soft: #dcf3e8;
  --night: #0c0e2c; --night-fg: #f0efff; --night-muted: #b7b5e0; --violet: #8a7cff;
  --wood: #e9c891; --wood-line: #8a5a1f;
  --font-display: "Bricolage", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --measure: 40rem;
  --radius: 14px;
  interpolate-size: allow-keywords;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0f26; --surface: #15183b; --fg: #ecebff; --muted: #a6a5cd; --line: #272b54;
    --accent: #a99dff; --accent-ink: #120f33; --accent-soft: #1f2050;
    --hot: #ff8a7d; --hot-soft: #4a1f27; --hot-ink: #ffe8e4;
    --ok: #6fd3a2; --ok-soft: #133528;
    --wood: #6b5232; --wood-line: #2b1d0c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d0f26; --surface: #15183b; --fg: #ecebff; --muted: #a6a5cd; --line: #272b54;
  --accent: #a99dff; --accent-ink: #120f33; --accent-soft: #1f2050;
  --hot: #ff8a7d; --hot-soft: #4a1f27; --hot-ink: #ffe8e4;
  --ok: #6fd3a2; --ok-soft: #133528;
  --wood: #6b5232; --wood-line: #2b1d0c;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg); color: var(--fg);
  font-family: var(--font-body); font-size: 1.125rem; line-height: 1.7;
  -webkit-text-size-adjust: 100%; overflow-x: clip;
  padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
}
.col, .wide {
  margin-inline: auto;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}
.col { max-width: calc(var(--measure) + 40px); }
.wide { max-width: calc(58rem + 40px); }
h1, h2, h3 { font-family: var(--font-display); margin: 0; line-height: 1.08; text-wrap: balance; font-optical-sizing: auto; }
h2 { font-size: clamp(1.8rem, 6vw, 2.5rem); font-weight: 780; font-stretch: 88%; letter-spacing: -0.01em; }
h3 { font-size: 1.25rem; font-weight: 680; line-height: 1.25; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 0.2em; }
button { font: inherit; }
:where(a, button, input, summary):focus-visible { outline: 3px solid var(--hot); outline-offset: 3px; border-radius: 6px; }
.muted { color: var(--muted); }
.label {
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
}

/* progress */
.progress { position: fixed; inset: 0 0 auto; height: calc(3px + env(safe-area-inset-top, 0px)); z-index: 40; pointer-events: none; }
.progress::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, var(--violet), var(--hot)); transform-origin: 0 50%; transform: scaleX(0); }
@supports (animation-timeline: scroll()) { @media (prefers-reduced-motion: no-preference) { .progress::after { animation: grow linear both; animation-timeline: scroll(root); } } }
@supports not (animation-timeline: scroll()) { .progress { display: none; } }
@keyframes grow { to { transform: scaleX(1); } }

/* ---------- hero ---------- */
.hero {
  background:
    radial-gradient(34rem 22rem at 100% 0%, rgba(138,124,255,0.45), transparent 70%),
    radial-gradient(26rem 18rem at 0% 100%, rgba(233,75,69,0.25), transparent 70%),
    var(--night);
  color: var(--night-fg);
  position: relative; overflow: hidden;
}
.hero::before {
  /* scattered game pieces */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.5;
  background:
    radial-gradient(circle at 82% 22%, #ffffff 0 7px, transparent 8px),
    radial-gradient(circle at 90% 34%, #0c0e2c 0 7px, transparent 8px),
    radial-gradient(circle at 74% 30%, #ff7a6e 0 6px, transparent 7px),
    conic-gradient(from 0deg at 86% 12%, transparent 0 0);
}
.topbar { display: flex; justify-content: space-between; align-items: center; padding-block: 1rem; }
.mark { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; font-stretch: 80%; color: var(--night-fg); text-decoration: none; line-height: 1; }
.mark span { color: var(--hot); }
.crumb { font-size: 0.9rem; color: var(--night-muted); text-decoration: none; margin-right: 3.4rem; }
.crumb:hover { color: #fff; }
.hero-in { display: grid; gap: 1.1rem; padding-block: 3.5rem 2.5rem; }
.kicker { color: #cfc9ff; }
.hero h1 { font-size: clamp(2.5rem, 11vw, 5.2rem); font-weight: 800; font-stretch: 82%; letter-spacing: -0.025em; line-height: 0.98; color: #fff; }
.hero h1 em { font-style: normal; color: #ff8a7d; }
.dek { font-size: 1.25rem; line-height: 1.5; color: var(--night-muted); max-width: 34rem; }
.meta { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; font-size: 0.9rem; color: var(--night-muted); }
.meta b { color: var(--night-fg); font-weight: 600; }
.controls { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin-top: 0.5rem; }
.seg { display: inline-flex; padding: 4px; border-radius: 999px; background: rgba(255,255,255,0.09); border: 1px solid rgba(255,255,255,0.15); }
.seg button {
  border: 0; cursor: pointer; border-radius: 999px; padding: 0.55rem 1rem;
  background: transparent; color: var(--night-muted); font-weight: 600; font-size: 0.95rem;
  transition: background 0.2s, color 0.2s;
}
.seg button[aria-pressed="true"] { background: #fff; color: var(--night); }
.listen {
  display: inline-flex; align-items: center; gap: 0.5rem;
  border: 1px dashed rgba(255,255,255,0.3); border-radius: 999px; padding: 0.55rem 1rem;
  color: var(--night-muted); font-size: 0.95rem; background: none;
}
.listen::before { content: ""; width: 0; height: 0; border-left: 8px solid currentColor; border-block: 5px solid transparent; }
.demo-note { font-size: 0.8rem; color: #e2bb6c; border-top: 1px solid rgba(255,255,255,0.1); padding-block: 0.7rem; }

/* ---------- core message ---------- */
.core { margin-top: -1px; padding-block: 2.5rem 1rem; }
.core p {
  font-family: var(--font-display); font-weight: 650; font-stretch: 92%;
  font-size: clamp(1.35rem, 4.8vw, 1.75rem); line-height: 1.32;
  padding-left: 1.1rem; border-left: 4px solid var(--hot);
}
.core .label { color: var(--hot); display: block; margin-bottom: 0.6rem; }

/* ---------- sections ---------- */
.sec { padding-block: 2.5rem; scroll-margin-top: 1rem; }
.sec-head { display: grid; gap: 0.4rem; margin-bottom: 1.1rem; }
.sec-head .label { color: var(--accent); }
.body { display: grid; gap: 1.15rem; }
.body > ul, .body > ol { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.5rem; }
.kurz {
  border-radius: 12px; padding: 0.85rem 1rem; margin-bottom: 1.2rem;
  background: var(--accent-soft); display: grid; gap: 0.2rem;
}
.kurz .label { color: var(--accent); }
.kurz p { font-weight: 600; line-height: 1.5; }
.more {
  display: none; margin-top: 0.4rem; justify-self: start;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--fg);
  border-radius: 999px; padding: 0.5rem 1rem; cursor: pointer; font-size: 0.95rem; font-weight: 600;
}
.more::after { content: " ↓"; color: var(--accent); }

/* short mode: only the takeaways, each section can be opened */
[data-mode="short"] .sec .body { display: none; }
[data-mode="short"] .sec.open .body { display: grid; }
[data-mode="short"] .sec:not(.open) .more { display: inline-block; }
[data-mode="short"] .kurz { background: var(--surface); border: 1.5px solid var(--accent); padding: 1.1rem 1.2rem; }
[data-mode="short"] .kurz p { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; line-height: 1.3; }
[data-mode="short"] .board-band, [data-mode="short"] .pull-wrap { display: none; }
[data-mode="short"] .sec { padding-block: 1.5rem; }

/* people cards */
.people { display: grid; gap: 0.7rem; }
.person {
  display: grid; grid-template-columns: 2.6rem 1fr; gap: 0.85rem; align-items: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem;
}
.avatar {
  width: 2.6rem; height: 2.6rem; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; color: #fff;
}
.person:nth-child(1) .avatar { background: #17734b; }
.person:nth-child(2) .avatar { background: #5546d6; }
.person:nth-child(3) .avatar { background: #a85b1c; }
.person p { line-height: 1.5; }
.person .game { display: block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-top: 0.25rem; }

/* definition list */
.ingredients { margin: 0; display: grid; gap: 0.6rem; }
.ingredients div { display: grid; grid-template-columns: 7.5rem 1fr; gap: 0.75rem; padding-bottom: 0.6rem; border-bottom: 1px solid var(--line); }
.ingredients dt { font-family: var(--font-display); font-weight: 750; }
.ingredients dd { margin: 0; color: var(--muted); }
.ingredients div:last-child dt { color: var(--hot); }

/* ---------- board band ---------- */
.board-band { padding-block: 1rem 2.5rem; }
.boards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.board { margin: 0; display: grid; gap: 0.5rem; min-width: 0; }
.tile { aspect-ratio: 1; max-width: 100%; border-radius: 12px; position: relative; overflow: hidden; box-shadow: 0 14px 30px -18px rgba(12,14,44,0.6); }
.chess { background: conic-gradient(#f0e7d8 25%, #3b3f73 0 50%, #f0e7d8 0 75%, #3b3f73 0) 0 0 / 25% 25%; }
.chess::after { content: "♚"; position: absolute; left: 38%; top: 30%; font-size: clamp(1.4rem, 7vw, 3rem); color: var(--hot); text-shadow: 0 2px 0 rgba(0,0,0,0.25); line-height: 1; }
.go {
  background:
    radial-gradient(circle at 37.5% 37.5%, #111 0 7%, transparent 7.5%),
    radial-gradient(circle at 62.5% 37.5%, #fafafa 0 7%, transparent 7.5%),
    radial-gradient(circle at 62.5% 62.5%, #111 0 7%, transparent 7.5%),
    radial-gradient(circle at 37.5% 62.5%, #fafafa 0 7%, transparent 7.5%),
    radial-gradient(circle at 12.5% 87.5%, #111 0 7%, transparent 7.5%),
    repeating-linear-gradient(90deg, transparent 0 calc(12.5% - 1px), var(--wood-line) calc(12.5% - 1px) 12.5%),
    repeating-linear-gradient(0deg, transparent 0 calc(12.5% - 1px), var(--wood-line) calc(12.5% - 1px) 12.5%),
    var(--wood);
}
.track {
  background:
    radial-gradient(circle at 70% 26%, var(--hot) 0 5%, transparent 5.5%),
    radial-gradient(circle at 30% 74%, var(--violet) 0 5%, transparent 5.5%),
    repeating-radial-gradient(ellipse at 50% 50%, #2c2f63 0 7%, #3b3f80 7% 8%, #2c2f63 8% 15%, #f0efff 15% 15.6%),
    #2c2f63;
}
.board figcaption { font-size: 0.85rem; line-height: 1.35; }
.board figcaption b { font-family: var(--font-display); display: block; font-size: 1rem; }
.band-caption { margin-top: 1rem; color: var(--muted); max-width: var(--measure); }

/* ---------- widget shell ---------- */
.widget {
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  padding: 1.25rem; display: grid; gap: 1rem;
  box-shadow: 0 20px 50px -34px rgba(12,14,44,0.55);
}
.widget-head { display: grid; gap: 0.25rem; }
.widget-head .label { color: var(--hot); }
.widget-head h3 { font-size: 1.35rem; }
.fine { font-size: 0.85rem; color: var(--muted); }

/* profile widget */
.tabs { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--accent-soft); justify-self: start; }
.tabs button { border: 0; cursor: pointer; border-radius: 999px; padding: 0.45rem 0.95rem; background: transparent; color: var(--muted); font-weight: 650; font-size: 0.95rem; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 2px 8px -3px rgba(0,0,0,0.25); }
.tabs button[data-who="b"][aria-selected="true"] { color: var(--hot); }
.tabs button[data-who="a"][aria-selected="true"] { color: var(--accent); }
.sliders { display: grid; gap: 0.55rem; border: 0; padding: 0; margin: 0; }
.sliders[hidden] { display: none; }
.sl { display: grid; grid-template-columns: 6.5rem 1fr 1.6rem; gap: 0.6rem; align-items: center; font-size: 0.95rem; }
.sl output { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
input[type="range"] { width: 100%; min-height: 1.75rem; accent-color: var(--accent); }
.sliders[data-who="b"] input[type="range"] { accent-color: var(--hot); }
.mirror { display: grid; gap: 0.35rem; padding-top: 0.5rem; border-top: 1px solid var(--line); }
.mirror-head { display: grid; grid-template-columns: 1fr 5.5rem 1fr; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.mirror-head span:first-child { text-align: right; color: var(--accent); }
.mirror-head span:last-child { color: var(--hot); }
.mrow { display: grid; grid-template-columns: 1fr 5.5rem 1fr; align-items: center; gap: 0; }
.mrow .name { text-align: center; font-size: 0.85rem; font-weight: 600; }
.mrow .bar { height: 0.8rem; border-radius: 999px; transition: width 0.35s ease; max-width: 100%; }
.mrow .a { justify-self: end; background: var(--accent); }
.mrow .b { justify-self: start; background: var(--hot); }
.mrow.gap .name { color: var(--hot); }
.verdict { display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: center; background: var(--bg); border-radius: 14px; padding: 0.9rem 1rem; }
.score-ring {
  --p: 50;
  width: 4.4rem; height: 4.4rem; border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--line) 0);
  display: grid; place-items: center; transition: --p 0.4s;
}
.score-ring span {
  width: 3.5rem; height: 3.5rem; border-radius: 50%; background: var(--bg);
  display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; font-variant-numeric: tabular-nums;
}
.verdict p { font-size: 0.98rem; line-height: 1.5; }

/* dilemma game */
.matrix-wrap { overflow-x: auto; }
.matrix { border-collapse: separate; border-spacing: 4px; width: 100%; font-size: 0.9rem; }
.matrix th { font-weight: 650; font-size: 0.8rem; color: var(--muted); padding: 0.3rem; }
.matrix td { background: var(--bg); border-radius: 8px; padding: 0.55rem; text-align: center; font-variant-numeric: tabular-nums; }
.matrix td b { color: var(--accent); }
.matrix td i { font-style: normal; color: var(--hot); font-weight: 700; }
.moves { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.move {
  border-radius: 14px; padding: 0.85rem 0.75rem; cursor: pointer; font-weight: 700; line-height: 1.25;
  border: 2px solid transparent; transition: transform 0.15s ease;
}
.move small { display: block; font-weight: 500; font-size: 0.8rem; margin-top: 0.15rem; }
.move:active { transform: scale(0.97); }
.move.coop { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.move.self { background: var(--hot-soft); color: var(--hot-ink); border-color: color-mix(in srgb, var(--hot) 40%, transparent); }
.move:disabled { opacity: 0.4; cursor: default; }
.scoreline { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; font-variant-numeric: tabular-nums; }
.scoreline .big { font-family: var(--font-display); font-size: 1.9rem; font-weight: 800; line-height: 1; }
.scoreline .you { color: var(--accent); }
.scoreline .them { color: var(--hot); text-align: right; }
.history { display: flex; gap: 0.35rem; flex-wrap: wrap; min-height: 3.1rem; align-content: flex-start; }
.round {
  width: 1.75rem; display: grid; gap: 2px; text-align: center; font-size: 0.7rem; font-weight: 700; line-height: 1;
}
.round i { font-style: normal; height: 1.2rem; border-radius: 5px; display: grid; place-items: center; color: #fff; }
.round .c { background: var(--ok); }
.round .s { background: var(--hot); }
@media (prefers-reduced-motion: no-preference) { .round { animation: pop 0.3s ease both; } }
@keyframes pop { from { transform: scale(0.6); opacity: 0.2; } }
.result { border-radius: 14px; padding: 1rem; background: var(--accent-soft); display: grid; gap: 0.5rem; }
.result[hidden] { display: none; }
.result h4 { margin: 0; font-family: var(--font-display); font-size: 1.15rem; }
.result p { font-size: 0.98rem; line-height: 1.5; }
.again { justify-self: start; border: 0; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0.5rem 1rem; font-weight: 650; cursor: pointer; }

/* number block */
.zahl { display: grid; gap: 0.3rem; padding: 1.4rem 1.25rem; border-radius: 18px; background: var(--night); color: var(--night-fg); position: relative; overflow: hidden; }
.zahl::after { content: ""; position: absolute; width: 14rem; height: 14rem; right: -4rem; top: -6rem; border-radius: 50%; background: radial-gradient(circle, rgba(138,124,255,0.45), transparent 70%); }
.zahl .num { font-family: var(--font-display); font-weight: 800; font-stretch: 80%; font-size: clamp(4rem, 20vw, 6.5rem); line-height: 0.9; color: #ff8a7d; font-variant-numeric: tabular-nums; position: relative; }
.zahl p { color: var(--night-muted); position: relative; max-width: 30rem; line-height: 1.5; }
.zahl p b, .zahl p strong { color: var(--night-fg); }

/* pull quote */
.pull-wrap { padding-block: 0.5rem; }
.pull {
  margin: 0; font-family: var(--font-display); font-weight: 780; font-stretch: 85%;
  font-size: clamp(1.75rem, 7vw, 2.9rem); line-height: 1.08; letter-spacing: -0.01em; text-wrap: balance;
  background: linear-gradient(100deg, var(--accent), var(--hot));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  padding-block: 0.2rem;
}
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .pull { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% cover 40%; transform-origin: 0 50%; }
  }
}
@keyframes rise { from { transform: scale(0.88); letter-spacing: 0.02em; } to { transform: scale(1); letter-spacing: -0.01em; } }

/* reflection + today */
.frage { border-radius: 18px; padding: 1.25rem; background: var(--hot-soft); color: var(--hot-ink); display: grid; gap: 0.4rem; }
.frage .label { color: inherit; opacity: 0.8; }
.frage p { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; line-height: 1.3; }
.frage .pause { font-size: 0.85rem; opacity: 0.75; font-family: var(--font-body); font-weight: 500; }
.principles { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; counter-reset: p; }
.principles li { counter-increment: p; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; display: grid; gap: 0.3rem; }
.principles h3::before { content: counter(p) " "; color: var(--hot); }
.principles p { color: var(--muted); line-height: 1.55; }
.heute {
  border-radius: 20px; padding: 1.4rem 1.3rem; display: grid; gap: 0.5rem;
  background:
    radial-gradient(18rem 12rem at 100% 0%, rgba(138,124,255,0.5), transparent 70%),
    var(--night);
  color: var(--night-fg);
}
.heute .label { color: #ff8a7d; }
.heute p { font-size: 1.15rem; line-height: 1.5; }
.heute strong { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; display: block; margin-block: 0.2rem; line-height: 1.3; }

/* end */
.end { padding-block: 2rem 3rem; display: grid; gap: 1.25rem; }
.author { display: grid; grid-template-columns: 4rem 1fr; gap: 1rem; align-items: center; padding-block: 1.25rem; border-block: 1px solid var(--line); }
.author img { width: 4rem; height: 4rem; border-radius: 50%; object-fit: cover; object-position: 40% 25%; max-width: 100%; }
.author p { font-size: 0.98rem; line-height: 1.5; }
.source { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.source summary { cursor: pointer; font-weight: 650; }
.source pre { margin: 0.8rem 0 0; overflow-x: auto; font-size: 0.82rem; line-height: 1.5; background: var(--bg); padding: 0.9rem; border-radius: 10px; white-space: pre; }
.source p { margin-top: 0.7rem; font-size: 0.95rem; color: var(--muted); }

/* ---------- chapter navigation ---------- */
.chap-pill {
  position: fixed; z-index: 35;
  left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 0.85rem);
  max-width: calc(100% - 2 * max(16px, env(safe-area-inset-left, 0px)));
  display: flex; align-items: center; gap: 0.6rem;
  border: 1px solid rgba(255,255,255,0.15); cursor: pointer;
  background: rgba(12,14,44,0.82); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  color: var(--night-fg); border-radius: 999px; padding: 0.55rem 1rem 0.55rem 0.6rem;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5); font-size: 0.9rem;
}
.chap-pill .count { background: #ff7a6e; color: #2a0705; border-radius: 999px; padding: 0.1rem 0.5rem; font-weight: 800; font-variant-numeric: tabular-nums; font-size: 0.8rem; }
.chap-pill .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.chap-pill .t::after { content: " ▴"; color: var(--night-muted); }
#chapters {
  margin: 0; border: 0; inset: auto 0 0 0; width: 100%; max-height: 80dvh;
  border-radius: 22px 22px 0 0;
  padding: 1.25rem max(20px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 1.25rem) max(20px, env(safe-area-inset-left, 0px));
  background: var(--night); color: var(--night-fg);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(.2,.8,.2,1), overlay 0.3s allow-discrete, display 0.3s allow-discrete;
}
#chapters:popover-open { transform: translateY(0); }
@starting-style { #chapters:popover-open { transform: translateY(100%); } }
#chapters::backdrop { background: rgba(8,9,30,0.45); }
.chap-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.1rem; counter-reset: c; }
.chap-list a { display: flex; gap: 0.8rem; align-items: baseline; padding: 0.5rem 0; color: var(--night-fg); text-decoration: none; font-family: var(--font-display); font-size: 1.2rem; font-weight: 650; counter-increment: c; }
.chap-list a::before { content: counter(c); color: var(--night-muted); font-size: 0.9rem; width: 1rem; }
.chap-list a[aria-current="true"] { color: #ff8a7d; }
.chap-list a[aria-current="true"]::before { color: #ff8a7d; }
.sheet-title { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--night-muted); margin-bottom: 0.5rem; }

.rail { display: none; }
@media (min-width: 1180px) {
  body { padding-bottom: 0; }
  .chap-pill { display: none; }
  .rail {
    display: block; position: fixed; left: max(24px, env(safe-area-inset-left, 0px)); top: 50%; transform: translateY(-50%);
    width: 12rem; z-index: 20;
  }
  .rail ol { list-style: none; margin: 0; padding: 0 0 0 1rem; display: grid; gap: 0.15rem; border-left: 2px solid var(--line); }
  .rail a { display: block; padding: 0.3rem 0; font-size: 0.85rem; line-height: 1.3; color: var(--muted); text-decoration: none; position: relative; }
  .rail a::before { content: ""; position: absolute; left: calc(-1rem - 6px); top: 0.6rem; width: 10px; height: 10px; border-radius: 50%; background: var(--bg); border: 2px solid var(--line); }
  .rail a[aria-current="true"] { color: var(--fg); font-weight: 650; }
  .rail a[aria-current="true"]::before { background: var(--hot); border-color: var(--hot); }
  /* Hidden rail must also leave the Tab order, not just fade out */
  .rail-hidden .rail { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.3s, visibility 0s 0.3s; }
  .rail { transition: opacity 0.3s; }
}


@media (min-width: 780px) {
  .people { grid-template-columns: repeat(3, 1fr); }
  .person { grid-template-columns: 1fr; }
  .widget { padding: 1.75rem; }
  .moves { max-width: 28rem; }
  .principles { grid-template-columns: repeat(3, 1fr); }
  .zahl { grid-template-columns: auto 1fr; align-items: center; gap: 1.5rem; padding: 1.75rem 2rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
@media (min-width: 780px) { .crumb { margin-right: 0; margin-left: 1.6rem; } }
/* Footer: legal links, as on every page */
footer { border-top: 1px solid var(--line); padding-block: 2rem calc(env(safe-area-inset-bottom, 0px) + 5rem); font-size: 0.88rem; color: var(--muted); }
footer .col { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1.25rem; }
footer a { color: var(--muted); display: inline-block; padding-block: 0.25rem; }
/* Untitled sub-section (--- in Markdown) sits closer to the chapter before it */
.sec.sub { padding-top: 1rem; }
