@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url('/assets/fonts/ibm-plex-sans-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url('/assets/fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('/assets/fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2'); }

/* Werkstatt-Seiten: 3D links, Erklärungen rechts, auf dem Handy untereinander. */
:root {
  --bg: #eef0f2;
  --panel: #ffffff;
  --ink: #1d232a;
  --muted: #5b6672;
  --line: #d3d8de;
  --accent: #c8641e;
  --good: #2f7d4f;
  --bad: #c0392b;
  --canvas: #e3e6ea;
  --font-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-num: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15191e; --panel: #1d232a; --ink: #e8ebee; --muted: #9aa5b1; --line: #2e3742;
    --accent: #e08a4a; --good: #5fbf86; --bad: #e86b5e; --canvas: #20262e; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15191e; --panel: #1d232a; --ink: #e8ebee; --muted: #9aa5b1; --line: #2e3742;
  --accent: #e08a4a; --good: #5fbf86; --bad: #e86b5e; --canvas: #20262e; color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--font-ui); font-size: 14px; line-height: 1.45;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 16px 24px;
}
header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin-bottom: 12px; }
h1 { font-size: 20px; font-weight: 600; margin: 0; text-wrap: balance; }
header p { margin: 0; color: var(--muted); }
.wrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .wrap { grid-template-columns: minmax(0, 1fr); } }
.stage { position: relative; background: var(--canvas); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; min-width: 0; }
#view, #fview, #tview { display: block; width: 100%; height: min(72vh, 680px); min-height: 340px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; border-top: 1px solid var(--line); background: var(--panel); align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { font: 500 13px var(--font-ui); background: transparent; color: var(--ink); border: 0; padding: 7px 11px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--panel); }
.seg button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.slider { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.slider input { width: 140px; accent-color: var(--accent); }
.hint { position: absolute; left: 10px; top: 10px; font-size: 12px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 3px 7px; }
aside { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; min-width: 0; }
aside h2 { font-size: 15px; margin: 0 0 2px; }
aside .lede { color: var(--muted); margin: 0 0 12px; }
dl { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0 0 12px; }
dt { color: var(--muted); }
dd { margin: 0; font-family: var(--font-num); font-variant-numeric: tabular-nums; text-align: right; }
.status { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid currentColor; }
.ok { color: var(--good); } .no { color: var(--bad); }
ul { margin: 0; padding-left: 18px; } li { margin: 3px 0; }
.legend { display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.sw { width: 14px; height: 10px; border-radius: 2px; margin-top: 3px; border: 1px solid var(--line); }
.tabs { display: flex; gap: 4px; margin: 0 0 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs a { font-weight: 500; color: var(--muted); text-decoration: none; padding: 7px 12px; border: 1px solid transparent; border-bottom: 0; border-radius: 6px 6px 0 0; }
.tabs a[aria-current="page"] { color: var(--ink); background: var(--panel); border-color: var(--line); margin-bottom: -1px; }
.tabs a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.callouts { position: absolute; inset: 0; pointer-events: none; }
.co { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; background: var(--accent); color: #fff; font: 600 12px var(--font-num); display: grid; place-items: center; box-shadow: 0 0 0 2px var(--panel); }
.step { padding: 9px 12px; border-top: 1px solid var(--line); background: var(--panel); font-weight: 500; min-height: calc(3 * 1.45em + 18px); }
.btn { font: 500 13px var(--font-ui); background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 7px 14px; cursor: pointer; }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
ol.parts { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
ol.parts li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: start; margin: 0; }
ol.parts .n { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font: 600 12px var(--font-num); display: grid; place-items: center; }
ol.parts b { display: block; }
ol.parts span.d { color: var(--muted); }
.svgwrap { background: var(--canvas); min-width: 0; overflow-x: auto; }
#lay { display: block; width: 100%; height: auto; max-height: 74vh; }
#lay text { font-family: var(--font-num); font-size: 13px; fill: var(--muted); }
#lay .t-strong { fill: var(--ink); font-weight: 500; }
.ptab { width: 100%; border-collapse: collapse; font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.ptab th, .ptab td { text-align: right; padding: 3px 4px; border-bottom: 1px solid var(--line); }
.ptab th:first-child, .ptab td:first-child { text-align: left; }
.ptab th { font-family: var(--font-ui); font-weight: 500; color: var(--muted); }
.ttab td:nth-child(3), .ttab td:nth-child(4) { white-space: normal; text-align: left; }
.ttab td:first-child { font-family: var(--font-ui); font-weight: 600; }
ol.check { margin: 0; padding-left: 18px; } ol.check li { margin: 4px 0; }
code.path { font-family: var(--font-num); font-size: 12px; overflow-wrap: anywhere; }
.player { display: inline-flex; align-items: center; gap: 6px; }
.seg[hidden] { display: none; }
#tPlay, #layPlay { min-width: 72px; }
ol.parts li { animation: partIn .45s ease; }
ol.parts li[hidden] { display: none; }
ol.parts li.now { background: var(--canvas); border-radius: 6px; padding: 4px 6px; margin: -4px -6px; }
ol.parts .n.tool { background: var(--ink); color: var(--panel); font-size: 10px; }
@keyframes partIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { ol.parts li { animation: none; } }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.count { font: 500 13px var(--font-num); color: var(--muted); min-width: 64px; }
.label { text-transform: uppercase; letter-spacing: .06em; font-size: 11px; color: var(--muted); margin: 12px 0 4px; }

html { -webkit-text-size-adjust: 100%; }
body { margin: 0; max-width: 1320px; margin-inline: auto; }
a { color: var(--accent); }
.intro { max-width: 70ch; color: var(--ink); margin: 0 0 14px; }
.crumbs { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.crumbs a { color: var(--muted); }
footer { margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.cards a { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; color: var(--ink); text-decoration: none; }
.cards a:hover, .cards a:focus-visible { border-color: var(--accent); }
.cards b { display: block; font-size: 15px; margin-bottom: 4px; }
.cards span { color: var(--muted); }
.cards small { display: block; margin-top: 8px; color: var(--muted); font-family: var(--font-num); }
#tview { touch-action: none; }
.noscript { padding: 12px; }

.files { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 6px; }
.files li { display: grid; gap: 1px; margin: 0; }
.files a { font-weight: 500; }
.files small { color: var(--muted); font-size: 12px; }

/* the intro runs the full width, and the 3D view takes what the window has left, so heading, intro,
   view, controls and step text fit on one screen; phones keep the 340 px minimum */
.intro { max-width: none; }
#tview { height: clamp(340px, calc(100vh - 330px), 680px); height: clamp(340px, calc(100svh - 330px), 680px); }
