/* Playbook „Dein persönliches KI-Betriebssystem“ and the setup page /setup (inhalte/playbook/bau.py).
   Display board of hyperpowered.ai: ground, ink, yellow; wide ink lines; Unbounded for titles, Newsreader for reading,
   IBM Plex Mono for labels and files. The Content Security Policy allows no inline styles, so every design rule
   stands here, including those of the diagrams. */

:root {
  color-scheme: light;
  --grund: #f3f2ee;
  --tinte: #121212;
  --gelb: #ffd83a;
  --fest-tinte: #121212;
  --papier: #fbfaf7;
  --text: #2b2b29;
  --leise: #5f5e58;
  --linie: #dddbd2;
  --haar: rgba(18, 18, 18, 0.16);
  --marker: var(--gelb);
  --video-grund: #1e1e1e;

  --marke: Unbounded, "Arial Black", system-ui, sans-serif;
  --antiqua: Newsreader, Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

  --rand-l: max(16px, env(safe-area-inset-left, 0px));
  --rand-r: max(16px, env(safe-area-inset-right, 0px));
  --breit: 74rem;
  --spalte: 40rem;
  --schnell: 140ms;
  --normal: 240ms;
  --kurve: cubic-bezier(0.4, 0, 0.2, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --grund: #121212;
    --tinte: #f3f2ee;
    --papier: #1c1c1a;
    --text: #dcdad2;
    --leise: #a9a79f;
    --linie: #2f2f2c;
    --haar: rgba(243, 242, 238, 0.2);
    /* Behind light type the yellow becomes a dark amber, so the type stays readable (tokens.css). */
    --marker: #7d6100;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 1rem; }
body {
  margin: 0;
  padding-left: var(--rand-l);
  padding-right: var(--rand-r);
  padding-block: 0 5rem;
  background: var(--grund);
  color: var(--text);
  font: 400 1.18rem/1.6 var(--antiqua);
  font-optical-sizing: auto;
  font-kerning: normal;
}
h1, h2, h3, h4, p, ol, ul, li, figure, dl, dd, blockquote { margin: 0; padding: 0; }
ol, ul { list-style: none; }
h1, h2, h3, h4 { color: var(--tinte); font-family: var(--marke); text-wrap: balance; overflow-wrap: break-word; }
p, li, dd, figcaption { text-wrap: pretty; hyphens: auto; -webkit-hyphens: auto; }
a { color: inherit; text-decoration-color: var(--gelb); text-decoration-thickness: 0.12em; text-underline-offset: 0.18em; }
a:hover { text-decoration-color: currentColor; }
code { font: 400 0.84em/1 var(--mono); padding: 0.05em 0.25em; background: var(--papier); border: 1px solid var(--haar); overflow-wrap: anywhere; }
strong {
  color: var(--tinte); font-weight: 600; margin: 0 -0.1em; padding: 0 0.1em;
  background: linear-gradient(var(--marker), var(--marker)) no-repeat 0 70% / 100% 52%;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
em { font-style: italic; }
button { font: inherit; color: inherit; cursor: pointer; }
img, video, svg, canvas { max-width: 100%; }
:focus-visible { outline: 3px solid var(--gelb); outline-offset: 3px; }
[hidden] { display: none !important; }
.sprung { position: absolute; left: -999px; top: 0; }
.sprung:focus { left: var(--rand-l); z-index: 50; padding: 0.6rem 0.9rem; background: var(--tinte); color: var(--grund); font: 600 0.9rem/1 var(--mono); }

/* ---------- Front matter and contents ---------- */
.titelei, .inhalt, main > section, .fuss { max-width: var(--breit); margin-inline: auto; }
.titelei { padding-block: clamp(2.5rem, 7vw, 6rem) clamp(2rem, 5vw, 4rem); display: grid; gap: clamp(1.2rem, 2.5vw, 2rem); }
.marke { display: flex; flex-wrap: wrap; gap: 0.4rem 1.6rem; font: 500 0.78rem/1.3 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--leise); }
.titelei h1 { font-weight: 800; font-size: clamp(1.9rem, 0.5rem + 6.6vw, 6.4rem); line-height: 0.96; letter-spacing: -0.045em; max-width: 12ch; }
.untertitel { max-width: 36ch; font-size: clamp(1.25rem, 1rem + 0.9vw, 1.7rem); line-height: 1.35; color: var(--tinte); }

.inhalt { border-top: 6px solid var(--tinte); padding-block: 1.6rem 2.6rem; display: grid; gap: 1rem; }
.inhalt h2 { font: 500 0.78rem/1.3 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--leise); }
.inhalt ol { columns: 19rem 3; column-gap: 2rem; }
.inhalt li { break-inside: avoid; }
.inhalt li { border-top: 1px solid var(--haar); }
.inhalt a { display: flex; gap: 0.9rem; align-items: baseline; padding: 0.6rem 0; text-decoration: none; color: var(--tinte); font: 600 1rem/1.3 var(--marke); letter-spacing: -0.01em; }
.inhalt a:hover { text-decoration: underline; text-decoration-color: var(--gelb); }
.nav-nr { flex: 0 0 1.8rem; font: 500 0.78rem/1 var(--mono); color: var(--leise); }

/* ---------- Chapters ---------- */
main > section { border-top: 6px solid var(--tinte); padding-block: clamp(2.4rem, 5vw, 4.5rem); }
.kapitel-kopf { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: end; gap: 0.4rem clamp(1rem, 3vw, 2.4rem); margin-bottom: clamp(1.6rem, 3.5vw, 3rem); }
.kapitel-nr { font: 900 clamp(3.2rem, 1.6rem + 7vw, 7.5rem)/0.82 var(--marke); letter-spacing: -0.07em; color: var(--tinte); }
main h2 { font-weight: 800; font-size: clamp(1.9rem, 1.1rem + 3.4vw, 4rem); line-height: 1; letter-spacing: -0.04em; }
.anhang > h2, .workshop > h2, .einleitung > h2, .begriffe > h2 { margin-bottom: clamp(1.4rem, 3vw, 2.4rem); }

.lesetext {
  display: grid;
  grid-template-columns: [voll-start] minmax(0, 1fr) [text-start] minmax(0, var(--spalte)) [text-end] minmax(0, 1fr) [voll-end];
}
.lesetext > * { grid-column: text; min-width: 0; }
.lesetext > * + * { margin-top: 1.1em; }
.lesetext > :is(.teil, .bild) { grid-column: voll; margin-block: clamp(1.8rem, 4vw, 3rem); }
.lesetext > p:first-child { font-size: 1.32rem; line-height: 1.5; color: var(--tinte); }
.lesetext h3 {
  margin-top: clamp(2.4rem, 5vw, 3.6rem); padding-top: 1rem; border-top: 3px solid var(--tinte);
  font-weight: 700; font-size: clamp(1.35rem, 1.1rem + 1vw, 1.9rem); line-height: 1.12; letter-spacing: -0.025em;
}
.lesetext h4 { margin-top: 1.8rem; font: 700 1.05rem/1.25 var(--marke); letter-spacing: -0.01em; }
.lesetext h3 + *, .lesetext h4 + * { margin-top: 0.8em; }
ul.liste > li { position: relative; padding: 0.55rem 0 0.6rem 1.6rem; border-top: 1px solid var(--haar); }
ul.liste > li::before { content: ""; position: absolute; left: 0; top: 1.05rem; width: 0.66rem; height: 0.66rem; background: var(--gelb); }
ol.liste { counter-reset: n; }
ol.liste > li { counter-increment: n; position: relative; padding: 0.7rem 0 0.75rem 2.8rem; border-top: 2px solid var(--tinte); }
ol.liste > li::before { content: counter(n); position: absolute; left: 0; top: 0.55rem; font: 800 1.5rem/1 var(--marke); letter-spacing: -0.04em; color: var(--tinte); }

.q {
  display: inline-block; min-width: 1.35em; margin-left: 0.15em; padding: 0.12em 0.25em; vertical-align: 0.35em;
  font: 500 0.6em/1 var(--mono); text-align: center; text-decoration: none; color: var(--fest-tinte); background: var(--gelb);
}
.q:hover { background: var(--tinte); color: var(--grund); }

figure.code { border: 3px solid var(--tinte); background: var(--papier); }
.code-name { display: block; padding: 0.45rem 0.9rem; border-bottom: 1px solid var(--haar); font: 500 0.72rem/1.3 var(--mono); letter-spacing: 0.08em; color: var(--leise); }
figure.code pre { margin: 0; padding: 1rem 1.1rem; overflow-x: auto; font: 400 0.82rem/1.6 var(--mono); color: var(--tinte); }
figure.code code { padding: 0; border: 0; background: none; font: inherit; }

figure.bild { display: grid; gap: 0.8rem; }
figure.bild img { display: block; width: 100%; height: auto; border: 3px solid var(--tinte); background: var(--papier); }
figure.bild figcaption, .unterschrift { max-width: 46rem; font: italic 400 1.05rem/1.45 var(--antiqua); color: var(--leise); }
.unterschrift { margin-top: 0.8rem; }

/* ---------- Parts: frame ---------- */
.teil > .tafel { border: 3px solid var(--tinte); background: var(--papier); color: var(--tinte); }
.etikett { font: 500 0.72rem/1.3 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--leise); }
.knopf {
  min-height: 44px; padding: 0.55rem 1rem; border: 3px solid var(--tinte); background: var(--grund); color: var(--tinte);
  font: 700 0.85rem/1.1 var(--marke); letter-spacing: -0.01em;
}
.knopf:hover { background: var(--gelb); border-color: var(--gelb); color: var(--fest-tinte); }
.knopf[aria-pressed="true"] { background: var(--tinte); color: var(--grund); }

/* Tabs: case note, abbreviations, files */
.reiter { display: flex; flex-wrap: wrap; border-bottom: 3px solid var(--tinte); }
.reiter [role="tab"] {
  flex: 1 1 auto; min-height: 48px; padding: 0.7rem 1rem; border: 0; border-right: 1px solid var(--haar);
  background: var(--papier); color: var(--tinte); font: 700 0.86rem/1.2 var(--marke); text-align: left;
}
.reiter [role="tab"]:last-child { border-right: 0; }
.reiter [role="tab"]:hover { background: color-mix(in srgb, var(--gelb) 40%, var(--papier)); }
.reiter [role="tab"][aria-selected="true"] { background: var(--tinte); color: var(--grund); }
.reiter-flaeche { padding: clamp(1.1rem, 3vw, 1.8rem); display: grid; gap: 0.8rem; align-content: start; }
.reiter-flaeche .gross { font: italic 500 clamp(1.35rem, 1.1rem + 1vw, 1.9rem)/1.3 var(--antiqua); color: var(--tinte); }
.reiter-flaeche .lehre { padding-top: 0.9rem; border-top: 3px solid var(--tinte); font-weight: 600; color: var(--tinte); }

/* Files of the workspace */
.dateien { display: grid; grid-template-columns: minmax(0, 17rem) minmax(0, 1fr); }
.dateien .baum { display: flex; flex-direction: column; padding-block: 0.5rem; border-right: 3px solid var(--tinte); }
.dateien .baum [role="tab"] {
  min-height: 42px; padding: 0.5rem 1rem; border: 0; background: none; text-align: left; color: var(--tinte);
  font: 400 0.88rem/1.3 var(--mono);
}
.dateien .baum [role="tab"].tief { padding-left: 2.1rem; }
.dateien .baum .ordner-name { padding: 0.55rem 1rem 0.2rem; font: 500 0.88rem/1.3 var(--mono); color: var(--leise); }
.dateien .baum [role="tab"]:hover { background: var(--haar); }
.dateien .baum [role="tab"][aria-selected="true"] { background: var(--gelb); color: var(--fest-tinte); }
.dateien .baum .ausserhalb { margin-top: 0.6rem; border-top: 1px dashed var(--haar); }
.dateien .vorschau { padding: clamp(1.1rem, 3vw, 1.7rem); display: grid; gap: 0.8rem; align-content: start; min-width: 0; }
.dateien .vorschau h4 { font: 500 1rem/1.3 var(--mono); }
.dateien .vorschau pre {
  margin: 0; padding: 1rem 1.1rem; border: 2px solid var(--tinte); background: var(--grund); color: var(--tinte);
  font: 400 0.8rem/1.6 var(--mono); white-space: pre-wrap; overflow-x: auto;
}
@media (max-width: 47rem) {
  .dateien { grid-template-columns: minmax(0, 1fr); }
  .dateien .baum { border-right: 0; border-bottom: 3px solid var(--tinte); }
}

/* Abbreviations instead of names */
.kuerzel-text { margin: 0; padding: 1.1rem 1.3rem; border: 2px solid var(--tinte); background: var(--grund); font: 400 0.86rem/1.7 var(--mono); white-space: pre-wrap; color: var(--tinte); overflow-x: auto; }
.kuerzel-text mark { background: var(--gelb); color: var(--fest-tinte); padding: 0 0.15em; }

/* References: note and result side by side */
.fundstellen { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.fundstellen > div { padding: clamp(1.1rem, 3vw, 1.6rem); display: grid; gap: 0.7rem; align-content: start; min-width: 0; }
.fundstellen > div + div { border-left: 3px solid var(--tinte); }
.notiz { font: 400 0.84rem/1.65 var(--mono); color: var(--tinte); }
.notiz p { padding: 0.15rem 0.4rem 0.15rem 2.6rem; position: relative; transition: background var(--normal) var(--kurve); }
.notiz p::before { content: attr(data-zeile); position: absolute; left: 0; width: 2rem; text-align: right; color: var(--leise); }
.notiz p.ist-markiert { background: var(--gelb); color: var(--fest-tinte); }
.notiz p.ist-markiert::before { color: var(--fest-tinte); }
.ergebnis h4 { margin-top: 0.6rem; font: 700 0.95rem/1.2 var(--marke); }
.ergebnis h4:first-of-type { margin-top: 0; }
.ergebnis button {
  display: block; width: 100%; padding: 0.55rem 0.7rem; border: 0; border-top: 1px solid var(--haar); background: none;
  text-align: left; font: 400 1rem/1.45 var(--antiqua); color: var(--text);
}
.ergebnis button .fs { font: 500 0.72rem/1 var(--mono); color: var(--leise); margin-left: 0.4rem; white-space: nowrap; }
.ergebnis button:hover { background: color-mix(in srgb, var(--gelb) 30%, transparent); }
.ergebnis button[aria-pressed="true"] { background: var(--gelb); color: var(--fest-tinte); }
.ergebnis button[aria-pressed="true"] .fs { color: var(--fest-tinte); }
.ergebnis .offen { padding: 0.55rem 0.7rem; border-top: 1px solid var(--haar); font-style: italic; color: var(--leise); }
@media (max-width: 47rem) {
  .fundstellen { grid-template-columns: minmax(0, 1fr); }
  .fundstellen > div + div { border-left: 0; border-top: 3px solid var(--tinte); }
}

/* Knowledge net */
.netz canvas { display: block; width: 100%; height: clamp(320px, 52vw, 540px); }
.netz .leiste { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; padding: 0.9rem 1rem; border-top: 3px solid var(--tinte); }
.netz .schritte { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-left: auto; }
.netz .schritte button { width: 2rem; height: 2rem; padding: 0; border: 2px solid var(--tinte); background: transparent; color: var(--tinte); font: 500 0.75rem/1 var(--mono); }
.netz .schritte button[aria-current="true"] { background: var(--gelb); border-color: var(--gelb); color: var(--fest-tinte); }
.netz .text { padding: 1rem 1.2rem 1.2rem; border-top: 1px solid var(--haar); min-height: 6.5rem; display: grid; gap: 0.6rem; }
.netz .arten { display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem; }
.netz .arten span::before { content: ""; display: inline-block; width: 0.7rem; height: 0.7rem; margin-right: 0.4rem; vertical-align: -0.05rem; border: 2px solid var(--tinte); border-radius: 50%; }
.netz .arten .a-regel::before { background: var(--tinte); }
.netz .arten .a-wissen::before { background: var(--papier); }
.netz .arten .a-mensch::before { background: var(--papier); border-style: dashed; }
.netz .arten .a-skill::before { background: var(--gelb); border-color: var(--gelb); }
.netz .arten .a-beleg::before { background: var(--leise); border-color: var(--leise); border-radius: 0; }

/* Video of the real graph */
.film { border: 3px solid var(--tinte); background: var(--video-grund); }
.film video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; background: var(--video-grund); }

/* Diagrams */
.diagramm { padding: clamp(0.8rem, 2.5vw, 1.6rem); overflow-x: auto; }
.diagramm svg { display: block; width: 100%; height: auto; min-width: 34rem; }
.d-linie { fill: none; stroke: var(--tinte); stroke-width: 2.5; }
.d-duenn { fill: none; stroke: var(--tinte); stroke-width: 1.5; }
.d-strich { fill: none; stroke: var(--tinte); stroke-width: 1.5; stroke-dasharray: 5 5; }
.d-pfeil { fill: var(--tinte); }
.d-feld { fill: var(--papier); stroke: var(--tinte); stroke-width: 2.5; }
.d-feld-leise { fill: var(--grund); stroke: var(--tinte); stroke-width: 1.5; stroke-dasharray: 6 5; }
.d-tinte { fill: var(--tinte); }
.d-gelb { fill: var(--gelb); stroke: var(--gelb); stroke-width: 2.5; }
.d-text { fill: var(--tinte); font: 500 15px var(--mono); }
.d-klein { fill: var(--leise); font: 400 13px var(--mono); }
.d-titel { fill: var(--tinte); font: 700 17px var(--marke); letter-spacing: -0.01em; }
.d-auf-tinte { fill: var(--grund); font: 500 15px var(--mono); }
.d-auf-gelb { fill: var(--fest-tinte); font: 500 15px var(--mono); }
.d-auf-gelb-titel { fill: var(--fest-tinte); font: 700 17px var(--marke); }

/* Checklist */
.checkliste { counter-reset: c; border-top: 3px solid var(--tinte); }
.checkliste li { counter-increment: c; border-bottom: 1px solid var(--haar); }
.checkliste label { display: grid; grid-template-columns: 2.2rem 1.8rem minmax(0, 1fr); gap: 0.6rem; align-items: start; padding: 0.75rem 0; cursor: pointer; }
.checkliste label::before { content: counter(c); font: 800 1.3rem/1.2 var(--marke); color: var(--tinte); }
.checkliste input { width: 1.4rem; height: 1.4rem; margin: 0.15rem 0 0; accent-color: var(--tinte); }
.checkliste input:checked + span { color: var(--leise); text-decoration: line-through; text-decoration-color: var(--gelb); text-decoration-thickness: 0.18em; }

/* ---------- Workshop, terms, sources, foot ---------- */
main > section.workshop { background: var(--tinte); color: var(--grund); padding-inline: clamp(1.2rem, 4vw, 3.5rem); border-top-color: var(--tinte); }
.workshop h2 { color: var(--grund); }
.workshop .lesetext > p:first-child, .workshop strong { color: var(--grund); }
.workshop strong { background-image: linear-gradient(#7d6100, #7d6100); }
.workshop a { color: var(--gelb); }
.workshop .knopf-link {
  display: inline-block; justify-self: start; margin-top: 1.6rem; padding: 1rem 1.4rem; background: var(--gelb); color: var(--fest-tinte);
  font: 800 1.1rem/1.1 var(--marke); letter-spacing: -0.02em; text-decoration: none;
}
.workshop .knopf-link:hover { background: var(--grund); }

.begriffe dl { display: grid; grid-template-columns: minmax(0, 14rem) minmax(0, 1fr); border-top: 3px solid var(--tinte); }
.begriffe dt, .begriffe dd { padding: 0.75rem 0; border-bottom: 1px solid var(--haar); }
.begriffe dt { padding-right: 1.2rem; font: 600 0.98rem/1.35 var(--marke); color: var(--tinte); }
@media (max-width: 40rem) { .begriffe dl { grid-template-columns: minmax(0, 1fr); } .begriffe dt { border-bottom: 0; padding-bottom: 0.1rem; } }

.quellenliste li { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr); padding: 0.55rem 0; border-top: 1px solid var(--haar); font-size: 1rem; scroll-margin-top: 1rem; }
.quellenliste li:target { background: color-mix(in srgb, var(--gelb) 35%, transparent); }
.q-nr { font: 500 0.8rem/1.6 var(--mono); color: var(--leise); }
.quellenliste a { overflow-wrap: anywhere; }

.fuss { border-top: 6px solid var(--tinte); padding-top: 1.4rem; display: flex; flex-wrap: wrap; gap: 0.6rem 2rem; justify-content: space-between; font: 400 0.82rem/1.5 var(--mono); color: var(--leise); }

/* Setup page */
.setup .setup-text { max-width: var(--breit); margin-inline: auto; border-top: 6px solid var(--tinte); padding-block: 2.4rem 3rem; }
.setup .setup-text > h2 { grid-column: text; margin-top: 2.6rem; font-size: clamp(1.5rem, 1.1rem + 1.8vw, 2.4rem); }
.setup .setup-text > h2:first-child { margin-top: 0; }

/* Back to top, as on hyperpowered.ai (public/nach-oben.css) */
.nach-oben {
  position: fixed; z-index: 30; right: calc(24px + env(safe-area-inset-right, 0px)); bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  display: grid; place-items: center; width: 56px; height: 56px; padding: 0; border: 0; border-radius: 50%;
  background: var(--tinte); color: var(--grund); opacity: 0; visibility: hidden; translate: 0 18px;
  transition: opacity var(--normal) var(--kurve), translate var(--normal) var(--kurve), visibility 0s linear var(--normal);
}
.nach-oben.ist-da { opacity: 1; visibility: visible; translate: 0 0; transition-delay: 0s; }
.nach-oben svg { display: block; overflow: visible; }
/* max-width: none, otherwise the rule for img and svg above caps the ring at the width of the button and it sits off-centre. */
.nach-oben__ring { position: absolute; inset: -6px; max-width: none; rotate: -90deg; }
.nach-oben__ring circle { fill: none; stroke: var(--gelb); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: calc(1 - var(--gelesen, 0)); }
.nach-oben__pfeil { position: relative; width: 22px; height: 22px; }
@media (max-width: 599px) {
  .nach-oben { width: 48px; height: 48px; right: calc(14px + env(safe-area-inset-right, 0px)); bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  .nach-oben__ring { inset: -5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .nach-oben, .netz .leiste { display: none !important; }
  body { background: #fff; }
}

/* The scene from the preface (inhalte/playbook/teile.py, szene): the same answer without and with a rule, the folder yellow. */
.szene { display: grid; gap: 0.9rem; padding: clamp(1rem, 3vw, 1.8rem); }
.szene .zug { max-width: 36rem; padding: 0.8rem 1rem; border: 2px solid var(--tinte); background: var(--grund); }
.szene .zug p + p { margin-top: 0.3rem; overflow-wrap: anywhere; hyphens: manual; }
.szene mark { background: var(--gelb); color: var(--fest-tinte); padding: 0 0.1em; }
