:root {
  --papier: #fdfefb; --band: #eaf4e7; --tisch: #d8d5ca; --tinte: #1c1f1b; --leise: #566053; --linie: #b4c3ae; --rot: #bf2f1b; --weiss: #fff;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", monospace;
  --lochrand: 40px; --blau: #2648a6;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--tisch); color: var(--tinte); font: 15.5px/1.6 var(--mono); }
a { color: inherit; text-decoration-color: var(--rot); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { color: var(--rot); }
:focus-visible { outline: 2px solid var(--rot); outline-offset: 2px; }
[hidden] { display: none !important; }

/* Endlospapier */
.blatt { position: relative; max-width: 880px; margin: 0 auto; padding: 40px calc(var(--lochrand) + 26px) 64px;
  background: repeating-linear-gradient(var(--papier) 0 7.2em, var(--band) 7.2em 14.4em); }
.blatt::before, .blatt::after { content: ""; position: absolute; top: 0; bottom: 0; width: var(--lochrand);
  background: radial-gradient(circle at 50% 15px, var(--tisch) 6.5px, transparent 7px) 0 0 / 100% 30px repeat-y; }
.blatt::before { left: 0; border-right: 1px dashed var(--linie); }
.blatt::after { right: 0; border-left: 1px dashed var(--linie); }

.manzeile { display: flex; justify-content: space-between; gap: 12px; margin: 0 0 40px; font-size: .78rem; color: var(--leise); }
h1 { font-size: clamp(2.3rem, 8vw, 4rem); line-height: 1.02; letter-spacing: -.03em; margin: 0 0 10px; }
.unter { font-size: 1.1rem; margin: 0 0 34px; max-width: 34em; }
h2 { font-size: clamp(1.25rem, 3.4vw, 1.65rem); line-height: 1.2; letter-spacing: -.01em; margin: 58px 0 10px; scroll-margin-top: 14px; }
h2 .n { color: var(--rot); }
h3 { font-size: 1rem; margin: 26px 0 4px; }
p { margin: 0 0 12px; max-width: 42em; }
pre { font: inherit; margin: 0 0 14px; white-space: pre-wrap; }
.formel { display: inline-block; background: var(--tinte); color: var(--papier); padding: 3px 12px; font-size: 1.15rem; font-weight: 700; margin-bottom: 14px; }
.kommentar { color: var(--leise); font-size: .84rem; margin: 2px 0; }
ol.saetze { list-style: none; margin: 0 0 8px; padding: 0; }
ol.saetze a { display: grid; grid-template-columns: 2ch 1fr; gap: 1ch; padding: 6px 0; font-size: 1.08rem; font-weight: 700; line-height: 1.3; text-decoration: none; border-top: 1px dotted var(--linie); }
ol.saetze a:hover span:last-child { text-decoration: underline; text-decoration-color: var(--rot); }
ol.saetze a span:first-child { color: var(--rot); }
table { border-collapse: collapse; font-size: .82rem; width: 100%; min-width: 600px; }
th { text-align: left; border-bottom: 2px solid var(--tinte); padding: 3px 12px 3px 0; white-space: nowrap; }
td { border-bottom: 1px dotted var(--linie); padding: 5px 12px 5px 0; vertical-align: top; }
.scroll { overflow-x: auto; margin: 10px 0 14px; }
dl.posten { margin: 8px 0; }
dl.posten dt { font-weight: 700; margin-top: 10px; }
dl.posten dd { margin: 0; max-width: 42em; }

/* Demos */
.demo { margin: 18px 0 10px; background: var(--weiss); border: 1.5px solid var(--tinte); min-width: 0; }
.cmd { background: var(--tinte); color: var(--papier); padding: 6px 10px; font-size: .84rem; overflow-wrap: anywhere; }
.cmd b { color: #8fd18a; font-weight: 400; }
.flags { display: flex; flex-wrap: wrap; gap: 5px; padding: 8px 10px 0; }
.flags button, .knopf { font: inherit; font-size: .8rem; color: var(--tinte); background: var(--weiss); border: 1px solid var(--tinte); padding: 5px 9px; cursor: pointer; }
.flags button[aria-pressed="true"], .knopf:hover { background: var(--tinte); color: var(--papier); }
.aus { font-size: .8rem; color: var(--leise); margin: 0; padding: 6px 10px 8px; max-width: none; }
.stage { position: relative; margin: 8px 10px 0; overflow: hidden; }

/* Posteingang */
#post-stage { height: 264px; }
.post { position: absolute; left: 0; top: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; font-size: .8rem; text-align: left; cursor: pointer;
  transition: transform .75s cubic-bezier(.3, .9, .25, 1), width .75s, height .75s, opacity .4s; }
.post > span { position: absolute; inset: 0; opacity: 0; pointer-events: none; transition: opacity .35s; display: flex; align-items: center; gap: 1ch; white-space: nowrap; overflow: hidden; }
[data-brille="text"] .l-text, [data-brille="balken"] .l-balken, [data-brille="spiel"] .l-spiel, [data-brille="json"] .l-json { opacity: 1; }
[data-brille="text"] .post:hover, [data-brille="balken"] .post:hover, [data-brille="json"] .post:hover { background: var(--band); }
.l-text { border-bottom: 1px dotted var(--linie); }
.l-text b, .l-balken b { flex: 0 0 13ch; font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.betreff { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.alter { flex: 0 0 5ch; text-align: right; color: var(--leise); }
.fertig .l-text b, .fertig .betreff { text-decoration: line-through; color: var(--leise); }
.balken { flex: 1; height: 13px; background: var(--band); }
.balken i { display: block; height: 100%; background: var(--rot); transition: width .6s; }
.l-json { color: #1e6b2e; font-size: .78rem; }
.l-spiel { flex-direction: column; justify-content: flex-end; gap: 0 !important; overflow: visible !important; }
.fig { width: 100%; height: auto; display: block; }
.m1 .fig { animation: wippe 1.5s steps(2) infinite; }
.m2 .fig { animation: wippe .7s steps(2) infinite; }
.m3 .fig { animation: hopp .34s steps(2) infinite; }
@keyframes wippe { 50% { transform: translateY(-2px); } }
@keyframes hopp { 50% { transform: translateY(-7px) rotate(-3deg); } }
.sagt { font-size: .74rem; font-weight: 700; color: var(--rot); line-height: 1.2; }
.fertig .sagt { visibility: hidden; }
[data-brille="spiel"] .post.fertig { opacity: 0; pointer-events: none; }
[data-brille="einfach"] .post { opacity: 0; pointer-events: none; }
.szene, .einfach { position: absolute; inset: 0; opacity: 0; transition: opacity .4s; pointer-events: none; }
.szene { background: linear-gradient(transparent calc(100% - 30px), #dfe9d6 0); }
.szene::after { content: "du"; position: absolute; right: 6px; bottom: 30px; width: 46px; height: 84px; border: 2px solid var(--tinte); border-bottom: 0; background: #f5efe0; font-size: .74rem; text-align: center; padding-top: 30px; }
[data-brille="spiel"] .szene { opacity: 1; }
.einfach { display: grid; place-items: center; text-align: center; font-size: clamp(1.4rem, 4.6vw, 2.1rem); font-weight: 700; line-height: 1.25; padding: 10px; }
[data-brille="einfach"] .einfach { opacity: 1; }

/* Sammeln */
#sammel-stage { height: 300px; }
.sq { position: absolute; left: 0; top: 0; transition: transform .85s cubic-bezier(.3, .9, .25, 1), opacity .4s; }
.qbox { position: absolute; border: 1px solid var(--linie); font-size: .72rem; padding: 2px 6px; transition: opacity .4s; }
.zk { position: absolute; font-size: .78rem; font-weight: 700; transition: opacity .4s; }
.zahl { position: absolute; left: 0; top: 0; font-size: .74rem; transition: transform .85s cubic-bezier(.3, .9, .25, 1), opacity .4s; }

/* Suche */
.such { display: flex; gap: 6px; padding: 8px 10px 0; }
.such input { flex: 1; min-width: 0; font: inherit; font-size: 1rem; padding: 6px 8px; border: 1px solid var(--tinte); background: var(--papier); color: var(--tinte); }
.vek { padding: 8px 10px 0; }
.vek canvas { display: block; width: 100%; height: 46px; background: var(--papier); border: 1px solid var(--linie); }
.vek .tag { font-size: .74rem; color: var(--leise); margin: 6px 0 2px; }
.nachbarn { list-style: none; margin: 8px 10px 0; padding: 0; font-size: .82rem; }
.nachbarn li { display: grid; grid-template-columns: minmax(0, 1fr) 4ch minmax(30px, 28%); gap: 1ch; align-items: center; }
.nachbarn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nachbarn i { display: block; height: 10px; background: var(--tinte); }
.videos { list-style: none; margin: 8px 10px 0; padding: 0; font-size: .8rem; }
.videos li { border-top: 1px dotted var(--linie); padding: 3px 0; }
.videos em { font-style: normal; color: var(--rot); }

/* Betrieb */
#bt-canvas { display: block; width: 100%; height: 260px; }

/* Bauanweisung */
.turtle { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; padding: 10px; }
.turtle canvas { display: block; width: 100%; aspect-ratio: 1; background: #f7f3e8; border: 1px solid var(--linie); }
.prog { font-size: .86rem; }
.prog label { display: block; margin-bottom: 8px; }
.prog .einzug { padding-left: 2ch; }
.prog input { display: block; width: 100%; accent-color: var(--rot); margin: 2px 0 0; }
.prog b { color: var(--rot); }

/* Gürtel */
.guert { position: relative; overflow: hidden; padding: 10px 10px 0; min-height: 300px; }
.guert ul { list-style: none; margin: 0; padding: 0; font-size: .86rem; }
.guert li { display: flex; justify-content: space-between; gap: 2ch; border-bottom: 1px dotted var(--linie); padding: 3px 0; transition: transform 1.1s cubic-bezier(.55, 0, .85, .4), opacity .45s .65s; }
.guert li span:last-child { color: var(--leise); }
.guert.gefallen li:not(.bleibt):not(.wackelt) { transform: translateY(300px) rotate(var(--r)); opacity: 0; transition-delay: var(--d), calc(var(--d) + .65s); }
.guert.gefallen .wackelt { animation: wackel .5s ease-in-out infinite; color: var(--leise); }
@keyframes wackel { 25% { transform: rotate(-1.4deg); } 75% { transform: rotate(1.4deg); } }
.guert .bleibt { font-weight: 700; }
.guert.gefallen .bleibt { color: var(--rot); }
.frage { position: absolute; left: 10px; right: 10px; top: 72px; margin: 0; max-width: none; font-size: 1.35rem; font-weight: 700; text-align: center; opacity: 0; transition: opacity .6s 1s; pointer-events: none; }
.guert.gefallen .frage { opacity: 1; }

.schluss { font-size: clamp(1.4rem, 4.6vw, 2rem); font-weight: 700; line-height: 1.2; margin: 8px 0 14px; }
.fuss { font-size: .8rem; color: var(--leise); margin-top: 56px; border-top: 1px solid var(--tinte); padding-top: 12px; }

@media (max-width: 640px) {
  :root { --lochrand: 14px; }
  body { font-size: 14.5px; }
  .blatt { padding: 22px 24px 48px; background: repeating-linear-gradient(var(--papier) 0 7.2em, var(--band) 7.2em 14.4em); }
  .blatt::before, .blatt::after { background: radial-gradient(circle at 50% 10px, var(--tisch) 3px, transparent 3.5px) 0 0 / 100% 20px repeat-y; }
  .turtle { grid-template-columns: minmax(0, 1fr); }
  .l-text b, .l-balken b { flex-basis: 10ch; }
  .demo { margin-left: -6px; margin-right: -6px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .fig, .guert.gefallen .wackelt { animation: none !important; }
  .post, .sq, .zahl, .guert li { transition-duration: .01s; transition-delay: 0s !important; }
}

/* Fassungen */
.navi { position: sticky; top: 0; z-index: 9; display: flex; flex-wrap: wrap; gap: 0 14px; background: var(--tinte); color: var(--papier); padding: 6px 12px; margin: 0 0 30px; font-size: .84rem; }
.navi span { color: #8fd18a; }
.navi a { color: var(--papier); text-decoration: none; padding: 2px 0; }
.navi a:hover { color: #8fd18a; }
.navi a[aria-current="page"] { text-decoration: underline; text-decoration-color: #8fd18a; text-decoration-thickness: 2px; }

/* MCP und Modellieren */
.log { min-height: 6.6em; margin: 8px 10px 0; font-size: .82rem; color: #1e6b2e; }
.zwei { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; padding: 10px; font-size: .82rem; }
.zwei h4 { margin: 0 0 4px; font-size: .8rem; }
.zwei pre { margin: 0; min-height: 8.4em; }
.zwei ul { margin: 0; padding-left: 2ch; color: var(--rot); }

/* Stränge */
ol.straenge { list-style: none; margin: 8px 0; padding: 0; }
ol.straenge a { display: grid; grid-template-columns: 17ch minmax(0, 1fr); gap: 1.5ch; padding: 5px 0; border-top: 1px dotted var(--linie); text-decoration: none; line-height: 1.35; }
ol.straenge a b { color: var(--rot); }
ol.straenge a:hover span { text-decoration: underline; text-decoration-color: var(--rot); }

/* Zettel */
.filter { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.filter button { font: inherit; font-size: .78rem; color: var(--tinte); background: var(--weiss); border: 1px solid var(--tinte); padding: 4px 8px; cursor: pointer; }
.filter button[aria-pressed="true"] { background: var(--tinte); color: var(--papier); }
.feld { width: 100%; font: inherit; padding: 7px 9px; border: 1.5px solid var(--tinte); background: var(--weiss); color: var(--tinte); }
.zettel { background: var(--weiss); border: 1px solid var(--linie); padding: 9px 12px; margin: 10px 0; scroll-margin-top: 44px; }
.zettel:target { border-color: var(--rot); box-shadow: 0 0 0 2px var(--rot); }
.zettel h3 { margin: 0 0 3px; font-size: .98rem; line-height: 1.3; }
.zettel h3 a { color: var(--rot); text-decoration: none; margin-right: 1ch; font-weight: 400; }
.zettel p { margin: 0 0 5px; font-size: .9rem; max-width: none; }
.zettel .zit { color: var(--leise); }
.zettel .meta { font-size: .74rem; color: var(--leise); }
.zettel .ref { font-size: .78rem; margin: 3px 0 0; }
.zettel .deut { font-size: .8rem; color: var(--blau, #2648a6); border-left: 2px solid #2648a6; padding-left: 8px; margin: 5px 0 0; }

/* Netz */
#netz { display: block; width: 100%; height: 620px; background: var(--weiss); border: 1.5px solid var(--tinte); touch-action: none; cursor: grab; }
.legende { display: flex; flex-wrap: wrap; gap: 3px 12px; font-size: .76rem; margin: 6px 0; }
.legende i { display: inline-block; width: 10px; height: 10px; margin-right: 4px; }
#netz-info { min-height: 5em; }
.matrix { border-collapse: collapse; font-size: .72rem; min-width: 560px; }
.matrix th, .matrix td { border: 1px solid var(--linie); padding: 3px 5px; text-align: center; white-space: nowrap; }
.matrix th:first-child { text-align: left; }

/* Philosophie */
.punkt { margin: 34px 0; scroll-margin-top: 44px; }
.punkt h2 { margin-top: 0; }
.von { font-size: .78rem; color: var(--leise); }

@media (max-width: 640px) {
  ol.straenge a { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .zwei { grid-template-columns: minmax(0, 1fr); }
  #netz { height: 460px; }
}
