:root {
  color-scheme: dark;
  --bg: #090a0b;
  --panel: #121417;
  --panel-2: #181b1f;
  --line: #343941;
  --text: #f5f5f3;
  --muted: #a9adb4;
  --yellow: #ffd400;
  --orange: #ff8a34;
  --green: #42c98b;
  --blue: #69a7ff;
  --red: #ef6262;
  --purple: #b48cff;
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; color: var(--text); background: radial-gradient(circle at 70% -10%, rgba(255,212,0,.09), transparent 32rem), var(--bg); line-height: 1.5; }
button, select, textarea { font: inherit; }
button:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex="0"]:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 20; padding: .7rem 1rem; background: var(--yellow); color: #000; border-radius: 8px; }
.skip-link:focus { top: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 2rem; padding: 1.1rem clamp(1rem, 3vw, 3rem); border-bottom: 1px solid rgba(255,212,0,.18); background: rgba(9,10,11,.92); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: .8rem; }
.brand img { filter: drop-shadow(0 0 9px rgba(255,212,0,.4)); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.3rem, 2vw, 1.85rem); line-height: 1.05; letter-spacing: -.02em; }
h2 { margin-bottom: .45rem; font-size: clamp(1.15rem, 1.8vw, 1.55rem); }
.eyebrow { margin-bottom: .25rem; color: var(--yellow); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.topbar__claim { max-width: 34rem; color: var(--muted); font-size: .86rem; text-align: right; }
.topbar__actions { display: flex; align-items: center; gap: 1rem; }
.topbar__actions .button { white-space: nowrap; }
.muted { color: var(--muted); }

main { width: min(1540px, 96vw); margin: 0 auto; padding: 1.4rem 0 4rem; }
.presenter-stage { display: grid; grid-template-columns: minmax(360px, 1.2fr) minmax(300px, .8fr) auto; align-items: center; gap: 1.4rem; padding: 1rem 1.2rem; background: linear-gradient(120deg, rgba(255,212,0,.13), rgba(105,167,255,.08)); border: 1px solid rgba(255,212,0,.34); border-radius: var(--radius); }
.presenter-stage[hidden] { display: none; }
.presenter-stage h2 { margin-bottom: .25rem; font-size: clamp(1.35rem, 2.3vw, 2.1rem); }
.presenter-stage p { margin-bottom: 0; }
.presenter-narration { max-width: 58rem; color: var(--text); font-size: clamp(.92rem, 1.2vw, 1.08rem); }
.presenter-stage__state { display: grid; gap: .32rem; }
.presenter-impact { color: var(--blue); font-size: .78rem; font-weight: 850; }
.presenter-status { min-height: 1.5rem; color: var(--yellow); font-weight: 800; }
.presenter-progress { height: 7px; overflow: hidden; background: #252a31; border-radius: 999px; }
.presenter-progress span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--yellow), var(--orange)); border-radius: inherit; transition: width .35s ease; }
.presenter-stage__controls { display: grid; min-width: 350px; gap: .5rem; justify-items: stretch; }
.presenter-transport { display: grid; grid-template-columns: repeat(3, 1fr); gap: .45rem; }
.presenter-zoom-controls { display: flex; align-items: center; justify-content: center; gap: .4rem; padding: .42rem .5rem; background: rgba(9,10,11,.72); border: 1px solid #3b414a; border-radius: 10px; }
.presenter-zoom-controls > span { margin-right: .15rem; color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.presenter-zoom-controls output { min-width: 3.3rem; color: var(--text); font-size: .78rem; font-weight: 800; text-align: center; }
.presenter-zoom-controls .zoom-button { width: 30px; height: 30px; }
.presenter-stage__controls small { color: var(--muted); text-align: center; white-space: nowrap; }
.orientation-panel { display: grid; grid-template-columns: minmax(320px, 1.05fr) minmax(420px, .95fr); gap: 1rem; padding: 1.25rem; background: linear-gradient(135deg, rgba(255,212,0,.1), rgba(105,167,255,.06)); border: 1px solid rgba(255,212,0,.3); border-radius: var(--radius); }
.orientation-panel h2 { max-width: 48rem; margin-bottom: .55rem; font-size: clamp(1.35rem, 2.1vw, 2rem); }
.orientation-panel__intro > p:not(.eyebrow, .safety-note) { max-width: 58rem; color: var(--muted); }
.safety-note { margin-bottom: .8rem; padding: .55rem .7rem; color: #d9f6e8; background: rgba(66,201,139,.08); border-left: 3px solid var(--green); border-radius: 6px; font-size: .82rem; }
.orientation-panel__actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.orientation-concepts { display: grid; grid-template-columns: repeat(3, 1fr); gap: .55rem; }
.orientation-concepts article { padding: .8rem; background: rgba(9,10,11,.68); border: 1px solid #303640; border-radius: 10px; }
.orientation-concepts span { display: block; margin-bottom: .25rem; color: var(--yellow); font-size: .68rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.orientation-concepts strong { display: block; line-height: 1.25; }
.orientation-concepts p { margin: .4rem 0 0; color: var(--muted); font-size: .76rem; }
.story-panel { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(230px, .6fr) auto; align-items: end; gap: 1rem; margin-top: .8rem; padding: 1.1rem 1.25rem; background: linear-gradient(120deg, rgba(255,212,0,.09), rgba(255,138,52,.035)); border: 1px solid rgba(255,212,0,.28); border-radius: var(--radius); }
.story-panel p { margin-bottom: 0; }
.coverage { margin-top: .55rem; color: var(--yellow); font-size: .76rem; font-weight: 800; }
.signal-diagnosis { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(220px, .7fr) minmax(260px, 1fr) minmax(260px, 1fr); align-items: end; gap: 1rem; padding: .8rem; background: rgba(105,167,255,.08); border: 1px solid rgba(105,167,255,.28); border-radius: 10px; }
.signal-diagnosis[hidden] { display: none; }
.signal-diagnosis strong { color: var(--blue); }
#hypothesis-field[hidden] { display: none; }
.custom-change { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(220px, .7fr) minmax(260px, 1fr) minmax(300px, 1.2fr); align-items: end; gap: 1rem; padding: .8rem; background: rgba(255,212,0,.07); border: 1px solid rgba(255,212,0,.28); border-radius: 10px; }
.custom-change[hidden] { display: none; }
.custom-change > p { grid-column: 2 / -1; }
.custom-change strong { color: var(--yellow); }
.field { display: grid; gap: .35rem; color: var(--muted); font-size: .78rem; font-weight: 700; }
select { width: 100%; color: var(--text); background: #0d0f11; border: 1px solid var(--line); border-radius: 10px; padding: .72rem .8rem; }
textarea { width: 100%; resize: vertical; color: var(--text); background: #0d0f11; border: 1px solid var(--line); border-radius: 10px; padding: .62rem .75rem; }
.button { min-height: 42px; padding: .65rem .95rem; color: var(--text); background: #20242a; border: 1px solid #404650; border-radius: 999px; cursor: pointer; font-weight: 750; }
.button:hover:not(:disabled) { border-color: var(--yellow); transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .38; }
.button--primary { color: #0b0b0b; background: var(--yellow); border-color: var(--yellow); }
.button--success { color: #07150f; background: var(--green); border-color: var(--green); }
.button--danger { color: #fff; background: #8c3030; border-color: var(--red); }
.button--quiet { background: transparent; }

.storyboard { margin-top: .8rem; padding: 1rem 1.25rem; background: linear-gradient(120deg, rgba(105,167,255,.08), rgba(180,140,255,.05)); border: 1px solid rgba(105,167,255,.28); border-radius: var(--radius); }
.storyboard__heading { display: flex; justify-content: space-between; align-items: end; gap: 2rem; }
.storyboard__heading p { margin-bottom: 0; }
.storyboard-progress { max-width: 32rem; color: var(--blue); font-weight: 800; text-align: right; }
.storyboard__builder { display: grid; grid-template-columns: minmax(260px, 1fr) repeat(4, auto); align-items: end; gap: .55rem; margin-top: .9rem; padding-top: .9rem; border-top: 1px solid rgba(105,167,255,.22); }
.storyboard-scenes { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .55rem; margin: .8rem 0 0; padding: 0; list-style: none; counter-reset: scene; }
.storyboard-scenes li { min-width: 0; padding: .7rem .8rem; color: var(--muted); background: #0d1014; border: 1px solid #2d3540; border-radius: 10px; }
.storyboard-scenes li::before { counter-increment: scene; content: "Szene " counter(scene); display: block; margin-bottom: .2rem; color: var(--blue); font-size: .68rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.storyboard-scenes li.is-current { color: var(--text); border-color: var(--yellow); box-shadow: 0 0 0 1px rgba(255,212,0,.2); }
.storyboard-scenes li.is-complete { border-color: rgba(66,201,139,.55); }
.storyboard-scenes strong { display: block; overflow: hidden; color: var(--text); text-overflow: ellipsis; white-space: nowrap; }
.storyboard-scenes p { margin: .3rem 0 0; font-size: .78rem; }
.scene-actions { display: flex; gap: .35rem; margin-top: .55rem; }
.scene-action { padding: .18rem .4rem; color: var(--muted); background: transparent; border: 1px solid #3a414a; border-radius: 6px; cursor: pointer; font-size: .72rem; }
.scene-action:hover:not(:disabled) { color: var(--yellow); border-color: var(--yellow); }
.scene-action:disabled { opacity: .3; cursor: not-allowed; }

.metrics { display: grid; grid-template-columns: repeat(5, 1fr); gap: .7rem; margin: .8rem 0; }
.metrics article { padding: .8rem 1rem; background: var(--panel); border: 1px solid #262a30; border-radius: 12px; }
.metrics span { display: block; overflow: hidden; color: var(--text); font-size: 1.15rem; font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }
.metrics small { color: var(--muted); }

.workspace { display: grid; grid-template-columns: 285px minmax(0, 1fr); gap: .8rem; }
.explain-panel, .network-panel, .runner { background: var(--panel); border: 1px solid #272b31; border-radius: var(--radius); }
.explain-panel { padding: 1rem; }
.detail-content { min-height: 21rem; color: var(--muted); font-size: .88rem; }
.detail-content dl { margin: 0; }
.detail-content dt { margin-top: .7rem; color: var(--text); font-weight: 800; }
.detail-content dd { margin-left: 0; }
.detail-content ul { padding-left: 1.1rem; }
.document-link { color: var(--yellow); }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; padding-top: .8rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .75rem; }
.status-dot { display: inline-block; width: 10px; height: 10px; margin-right: .25rem; border-radius: 50%; }
.status-current { background: var(--green); }
.status-changed { background: var(--yellow); }
.status-stale { background: var(--orange); }
.status-updating { background: #fff; box-shadow: 0 0 8px #fff; }
.status-review { background: var(--purple); }
.status-blocked { background: var(--red); }

.network-panel { min-width: 0; padding: .9rem; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 2rem; padding: 0 .2rem .6rem; }
.section-heading p { max-width: 36rem; margin-bottom: 0; font-size: .8rem; }
.network-tools { display: grid; justify-items: end; gap: .5rem; }
.zoom-controls { display: flex; align-items: center; gap: .4rem; }
.zoom-controls output { min-width: 3.5rem; color: var(--text); font-size: .78rem; font-weight: 800; text-align: center; }
.zoom-button { width: 34px; height: 34px; color: var(--text); background: #20242a; border: 1px solid #404650; border-radius: 50%; cursor: pointer; font-size: 1.2rem; line-height: 1; }
.zoom-button:hover:not(:disabled) { color: var(--yellow); border-color: var(--yellow); }
.zoom-button:disabled { opacity: .3; cursor: not-allowed; }
.line-key, .focus-count { font-weight: 800; }
.line-key--incoming, .focus-count--incoming { color: var(--blue); }
.line-key--outgoing, .focus-count--outgoing { color: var(--yellow); }
.network-scroll { overflow: auto; max-height: 670px; border-radius: 12px; background: #0c0e10; border: 1px solid #20242a; }
#network-svg { display: block; width: 1700px; min-height: 0; }
.layer-label { fill: #737982; font-size: 12px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.dependency-edge { fill: none; stroke: #3e444d; stroke-width: .85; marker-end: url(#arrow); transition: opacity .2s, stroke .2s, stroke-width .2s; }
.dependency-edge.is-affected { stroke: var(--orange); stroke-width: 1.35; opacity: .85; }
.dependency-edge.is-incoming { stroke: var(--blue); stroke-width: 2.15; opacity: 1; }
.dependency-edge.is-outgoing { stroke: var(--yellow); stroke-width: 2.15; opacity: 1; }
.dependency-edge.is-dimmed { opacity: .08; }
.document-node { cursor: pointer; }
.document-node rect { fill: #181c20; stroke: #4a5059; stroke-width: 1.2; rx: 10px; transition: fill .2s, stroke .2s, opacity .2s, transform .2s; }
.document-node.is-neighbor rect { stroke: #8c929b; stroke-width: 1.8; }
.document-node:hover rect, .document-node:focus rect, .document-node.is-selected rect { stroke: var(--yellow); stroke-width: 2.4; }
.document-node.is-dimmed { opacity: .22; }
.document-node .node-title { fill: #f5f5f3; font-size: 12px; font-weight: 850; }
.document-node .node-agent { fill: #a9adb4; font-size: 9.5px; }
.document-node .node-status { fill: #d7d9dc; font-size: 8px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.document-node .node-version { fill: #0b0b0b; font-size: 9px; font-weight: 900; text-anchor: middle; }
.document-node .version-pill { fill: var(--green); }
.document-node[data-status="changed"] rect { fill: #332e0a; stroke: var(--yellow); }
.document-node[data-status="changed"] .version-pill { fill: var(--yellow); }
.document-node[data-status="stale"] rect { fill: #352012; stroke: var(--orange); stroke-dasharray: 5 3; }
.document-node[data-status="stale"] .version-pill { fill: var(--orange); }
.document-node[data-status="updating"] rect { fill: #32353a; stroke: #fff; animation: pulse 1s infinite; }
.document-node[data-status="review"] rect { fill: #241a34; stroke: var(--purple); }
.document-node[data-status="review"] .version-pill { fill: var(--purple); }
.document-node[data-status="blocked"] rect { fill: #361718; stroke: var(--red); }
.document-node[data-status="blocked"] .version-pill { fill: var(--red); }
@keyframes pulse { 50% { filter: drop-shadow(0 0 7px rgba(255,255,255,.8)); } }
.error-box { padding: .8rem; margin-bottom: .8rem; color: #ffdede; background: #451e20; border: 1px solid var(--red); border-radius: 10px; }

.runner { margin-top: .8rem; padding: 1rem; }
.runner__heading { display: flex; justify-content: space-between; align-items: end; gap: 2rem; }
.live-status { max-width: 48rem; margin-bottom: .45rem; color: var(--yellow); font-weight: 750; text-align: right; }
.controls { display: flex; flex-wrap: wrap; gap: .5rem; padding: .7rem 0; border-top: 1px solid #272b31; border-bottom: 1px solid #272b31; }
.field--inline { min-width: 220px; margin-left: auto; }
.field--inline select { padding-block: .52rem; }
.runner-grid { display: grid; grid-template-columns: minmax(250px, .7fr) minmax(0, 1.3fr); gap: .8rem; padding-top: .8rem; }
.wave-list, .event-log { margin: 0; padding: 0; list-style: none; }
.wave-list { display: grid; gap: .45rem; }
.wave-list li { padding: .65rem .75rem; color: var(--muted); background: #0e1012; border-left: 4px solid #3b4149; border-radius: 7px; font-size: .82rem; }
.wave-list li.is-current { color: var(--text); border-color: var(--yellow); background: rgba(255,212,0,.07); }
.wave-list strong { color: var(--text); }
.log-panel { min-width: 0; background: #0d0f11; border: 1px solid #23272d; border-radius: 10px; }
.log-panel__heading { display: flex; justify-content: space-between; gap: 1rem; padding: .65rem .8rem; border-bottom: 1px solid #23272d; }
.text-button { color: var(--yellow); background: transparent; border: 0; cursor: pointer; font-size: .76rem; }
.text-button:disabled { color: #555b64; cursor: not-allowed; }
.event-log { max-height: 230px; overflow: auto; padding: .7rem .85rem; counter-reset: event; color: var(--muted); font: .78rem/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; }
.event-log li::before { counter-increment: event; content: counter(event, decimal-leading-zero) " "; color: var(--yellow); }

footer { padding: 1.5rem; color: #6f747c; border-top: 1px solid #20242a; text-align: center; font-size: .75rem; }

.guide-card { position: fixed; right: clamp(.7rem, 2vw, 1.5rem); bottom: clamp(.7rem, 2vw, 1.5rem); z-index: 50; width: min(430px, calc(100vw - 1.4rem)); padding: 1.05rem; color: var(--text); background: rgba(18,20,23,.98); border: 1px solid var(--yellow); border-radius: 14px; box-shadow: 0 18px 60px rgba(0,0,0,.55), 0 0 0 1px rgba(255,212,0,.12); }
.guide-card[hidden] { display: none; }
.guide-card h2 { padding-right: 2rem; }
.guide-card > p:not(.eyebrow) { color: var(--muted); }
.guide-card__close { position: absolute; top: .55rem; right: .65rem; width: 32px; height: 32px; color: var(--muted); background: transparent; border: 0; cursor: pointer; font-size: 1.4rem; }
.guide-card__close:hover { color: var(--yellow); }
.guide-card__controls { display: flex; justify-content: space-between; gap: .5rem; margin-top: .9rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.guide-target { position: relative; z-index: 12; outline: 4px solid var(--yellow); outline-offset: 5px; box-shadow: 0 0 0 9999px rgba(0,0,0,.38); transition: outline-color .2s; }

body.is-presenting { height: 100vh; overflow: hidden; background: #090a0b; }
body.is-presenting .topbar { height: 72px; padding-block: .7rem; }
body.is-presenting .topbar__claim,
body.is-presenting #presenter-start-button,
body.is-presenting #guide-start-nav-button,
body.is-presenting .orientation-panel,
body.is-presenting .story-panel,
body.is-presenting .storyboard,
body.is-presenting .metrics,
body.is-presenting .explain-panel,
body.is-presenting .runner,
body.is-presenting footer { display: none; }
body.is-presenting main { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: .7rem; width: 100vw; height: calc(100vh - 72px); padding: .7rem; }
body.is-presenting .presenter-stage { display: grid; }
body.is-presenting .workspace { display: block; min-height: 0; }
body.is-presenting .network-panel { display: grid; grid-template-rows: minmax(0, 1fr); height: 100%; padding: 0; overflow: hidden; border-color: rgba(255,212,0,.25); }
body.is-presenting .network-panel .section-heading { display: none; }
body.is-presenting .network-scroll { height: 100%; max-height: none; border: 0; border-radius: var(--radius); }

@media (max-width: 1050px) {
  .topbar__claim { display: none; }
  .orientation-panel { grid-template-columns: 1fr; }
  .presenter-stage { grid-template-columns: 1fr auto; }
  .presenter-stage__copy { grid-column: 1 / -1; }
  .story-panel { grid-template-columns: 1fr 1fr; }
  .story-panel .button { grid-column: 2; }
  .storyboard__builder { grid-template-columns: 1fr 1fr; }
  .storyboard__builder .field { grid-column: 1 / -1; }
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .workspace { grid-template-columns: 1fr; }
  .detail-content { min-height: 0; }
  .legend { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
  .topbar__actions .button { padding-inline: .7rem; font-size: .76rem; }
  .orientation-concepts { grid-template-columns: 1fr; }
  .presenter-stage { grid-template-columns: 1fr; gap: .7rem; }
  .presenter-stage__copy { grid-column: auto; }
  .presenter-stage__controls { min-width: 0; }
  .presenter-stage__controls small { display: none; }
  body.is-presenting .topbar { height: 64px; }
  body.is-presenting main { height: calc(100vh - 64px); }
}

@media (max-width: 700px) {
  .topbar { position: static; flex-direction: column; align-items: stretch; gap: .8rem; }
  .topbar__actions { width: 100%; flex-wrap: wrap; gap: .5rem; }
  .topbar__actions .button { flex: 1 1 150px; }
  body.is-presenting .topbar { flex-direction: row; align-items: center; gap: 0; }
  body.is-presenting .topbar__actions { display: none; }
  .story-panel, .runner-grid, .signal-diagnosis, .custom-change, .storyboard__builder { grid-template-columns: 1fr; }
  .custom-change > p { grid-column: auto; }
  .story-panel .button, .storyboard__builder .field { grid-column: auto; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .section-heading, .runner__heading, .storyboard__heading { display: block; }
  .network-tools { justify-items: start; }
  .live-status, .storyboard-progress { text-align: left; }
  .field--inline { width: 100%; margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
