:root {
  --bg: oklch(0.155 0.012 300);
  --card: oklch(0.175 0.013 300);
  --line: oklch(0.24 0.014 300);
  --line2: oklch(0.26 0.014 300);
  --text: oklch(0.94 0.006 300);
  --muted: oklch(0.56 0.012 300);
  --dim: oklch(0.45 0.012 300);
  --acc: oklch(0.74 0.155 300);
  --ok: oklch(0.74 0.13 155);
  --rework: oklch(0.78 0.13 75);
  --mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: 'IBM Plex Sans', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
::selection { background: oklch(0.74 0.155 300 / 0.3); }
button { font: inherit; }
[hidden] { display: none !important; }

.wrap { max-width: 1440px; margin: 0 auto; padding: 34px 40px 64px; min-height: 100vh; }

/* Header */
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px 40px; flex-wrap: wrap; padding-bottom: 22px; border-bottom: 1px solid var(--line2); }
.brand { display: flex; align-items: baseline; gap: 16px; }
.logo { font-size: 22px; line-height: 1; color: var(--acc); }
h1 { margin: 0 0 6px; font-size: 23px; font-weight: 500; letter-spacing: -0.015em; color: oklch(0.95 0.006 300); }
.tagline { margin: 0; font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn { display: flex; align-items: center; height: 36px; padding: 0 16px; border: 1px solid oklch(0.3 0.014 300); border-radius: 2px; background: transparent; color: oklch(0.72 0.01 300); font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; cursor: pointer; transition: background 220ms ease, border-color 220ms ease, color 220ms ease; }
.btn:hover { border-color: oklch(0.44 0.014 300); color: oklch(0.9 0.006 300); }
.btn-primary { padding: 0 18px; border-color: oklch(0.74 0.155 300 / 0.45); background: oklch(0.74 0.155 300 / 0.1); color: oklch(0.82 0.12 300); }
.btn-primary:hover { background: oklch(0.74 0.155 300 / 0.2); border-color: oklch(0.74 0.155 300 / 0.45); color: oklch(0.84 0.12 300); }
.btn-quiet { padding: 0 14px; border-color: var(--line2); color: var(--muted); }
.btn-plan { font-family: 'IBM Plex Sans', system-ui, sans-serif; font-size: 12.5px; letter-spacing: 0; border-color: var(--line2); margin-left: 6px; }
.speed { display: flex; align-items: center; gap: 2px; height: 36px; padding: 0 4px; border: 1px solid var(--line2); border-radius: 2px; }
.speed > span:first-child { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; color: oklch(0.48 0.012 300); padding: 0 8px 0 6px; }
.speed button { height: 26px; padding: 0 9px; border: none; border-radius: 2px; background: transparent; color: oklch(0.5 0.012 300); font-family: var(--mono); font-size: 11px; cursor: pointer; transition: color 200ms ease, background 200ms ease; }
.speed button.on { background: oklch(0.74 0.155 300 / 0.16); color: oklch(0.84 0.12 300); }

/* Karten */
.card { border: 1px solid var(--line); border-radius: 3px; background: var(--card); }
.eyebrow { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: oklch(0.5 0.012 300); }

/* Buehne */
.stage { position: relative; margin-top: 26px; overflow: hidden; }
.glow { position: absolute; top: 0; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, oklch(0.74 0.155 300 / 0.35), transparent); }
.stage-scroll { overflow-x: auto; }
#tree { display: block; width: 100%; min-width: 760px; height: auto; }
#tree path { fill: none; stroke-linecap: round; transition: opacity 900ms ease, stroke 900ms ease, stroke-width 900ms ease; }
#tree circle { transition: opacity 900ms ease, fill 900ms ease; }
#gate { transition: opacity 700ms ease; }
#gate circle { fill: none; stroke-width: 1; opacity: 0.9; transition: stroke 500ms ease; }
#gCols line { stroke: oklch(0.24 0.014 300); stroke-width: 1; stroke-dasharray: 1 7; }
.legend { position: absolute; left: 24px; bottom: 18px; display: flex; flex-wrap: wrap; gap: 8px 22px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.06em; color: var(--muted); pointer-events: none; }
.legend div { display: flex; align-items: center; gap: 8px; }
.legend i { display: block; width: 16px; height: 2px; }

/* Playbook */
.playbook { margin-top: 22px; padding: 20px 24px 22px; }
.row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.caption { font-family: var(--mono); font-size: 11px; color: oklch(0.62 0.012 300); }
.track-scroll { overflow-x: auto; }
.track { position: relative; height: 70px; min-width: 640px; }
.rail { position: absolute; top: 9px; left: 0; right: 0; height: 1px; background: oklch(0.27 0.014 300); }
.rail-on { right: auto; background: var(--acc); transition: width 900ms ease; }
.phases { position: relative; display: flex; justify-content: space-between; }
.phase { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 120px; }
.phase .dot { width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: oklch(0.3 0.014 300); box-shadow: 0 0 0 4px var(--card); transition: background 700ms ease; }
.phase .name { font-size: 12.5px; color: var(--dim); transition: color 700ms ease; margin-top: -6px; }
.phase .ms { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; color: oklch(0.35 0.012 300); transition: color 700ms ease; margin-top: -6px; }
.phase.reached .dot { background: var(--acc); }
.phase.active .name { color: oklch(0.88 0.006 300); }
.phase.reached .ms { color: oklch(0.68 0.1 300); }

/* Konsole */
.console { margin-top: 14px; overflow: hidden; }
.console-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; min-height: 46px; padding: 6px 16px 6px 20px; cursor: pointer; }
.console-title { display: flex; align-items: center; gap: 18px; }
.status { font-family: var(--mono); font-size: 12px; color: oklch(0.7 0.01 300); }
.tabs { display: flex; align-items: center; gap: 8px; }
.tabs button { height: 26px; padding: 0 12px; margin-left: 8px; border: 1px solid transparent; border-radius: 2px; background: transparent; color: oklch(0.5 0.012 300); font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; cursor: pointer; transition: color 200ms ease, border-color 200ms ease; }
.tabs button:first-child { margin-left: 0; }
.tabs button.on { border-color: oklch(0.36 0.014 300); color: oklch(0.9 0.006 300); }
.chevron { margin-left: 8px; font-family: var(--mono); font-size: 11px; color: var(--dim); width: 14px; text-align: center; }
.console-body { height: 0; overflow: hidden; transition: height 520ms cubic-bezier(0.4, 0, 0.2, 1); }
.console-body.open { height: 216px; }
.console-lines { border-top: 1px solid var(--line); padding: 16px 20px; height: 216px; overflow: auto; }
.console-lines div { font-family: var(--mono); font-size: 12px; line-height: 1.85; white-space: pre; color: oklch(0.6 0.012 300); }
.console-lines .cmd { color: oklch(0.88 0.006 300); }
.console-lines .add { color: var(--ok); }
.console-lines .del { color: oklch(0.68 0.11 25); }
.console-lines .none { color: var(--dim); }

/* Overlays */
.overlay { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; background: oklch(0.13 0.012 300 / 0.82); backdrop-filter: blur(3px); }
.overlay-done { z-index: 50; background: oklch(0.13 0.012 300 / 0.88); backdrop-filter: blur(4px); }
.plan { width: 720px; max-width: 100%; max-height: 76vh; overflow: auto; background: oklch(0.185 0.013 300); border: 1px solid oklch(0.3 0.014 300); border-radius: 3px; padding: 34px 38px 38px; }
.plan-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.plan-eyebrow { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--acc); margin-bottom: 10px; }
.plan-sub { font-size: 13px; color: oklch(0.6 0.012 300); }
.close { border: none; background: transparent; color: oklch(0.5 0.012 300); font-size: 18px; line-height: 1; cursor: pointer; padding: 4px; }
.plan-grid { display: grid; grid-template-columns: 120px 1fr; gap: 22px 28px; font-size: 14px; line-height: 1.65; color: oklch(0.88 0.006 300); }
.plan-grid .k { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: oklch(0.5 0.012 300); padding-top: 3px; }
.plan-ms { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 10px; margin-top: 32px; padding-top: 26px; border-top: 1px solid var(--line2); }
.plan-ms div { padding: 14px 12px; border: 1px solid oklch(0.27 0.014 300); border-radius: 2px; font-size: 12px; color: oklch(0.62 0.012 300); line-height: 1.4; }
.plan-ms b { display: block; font-family: var(--mono); font-weight: 400; color: var(--acc); margin-bottom: 8px; }
.done { text-align: center; max-width: 520px; }
.check { font-size: 30px; color: var(--ok); margin-bottom: 22px; }
.done h2 { margin: 0 0 14px; font-size: 26px; font-weight: 400; letter-spacing: -0.01em; color: oklch(0.95 0.006 300); }
.done p { margin: 0 0 30px; font-size: 15px; line-height: 1.6; color: oklch(0.66 0.012 300); }
.done .btn { display: inline-flex; height: 38px; padding: 0 22px; }

/* Review-Gate: der Mensch nimmt ab */
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
#gate .human { stroke: var(--acc); stroke-width: 1.2; stroke-dasharray: 3 7; opacity: 0; transform-box: fill-box; transform-origin: center; transition: opacity 500ms ease; }
#gate.review .human { opacity: 1; animation: spin 9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#gLoops path { fill: none; stroke: var(--rework); stroke-width: 1.3; stroke-linecap: round; opacity: 0.85; }
.review { margin-top: 14px; border-color: oklch(0.74 0.155 300 / 0.45); animation: rvIn 420ms cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes rvIn { from { opacity: 0; transform: translateY(-6px); } }
.review-head { padding: 20px 24px 0; }
.review-head h2 { margin: 0 0 4px; font-size: 18px; font-weight: 500; color: oklch(0.95 0.006 300); }
.review-head p { margin: 0; font-size: 13px; color: oklch(0.62 0.012 300); }
.review-body { display: grid; grid-template-columns: 1fr 1.2fr; gap: 28px; padding: 18px 24px 22px; }
.review h3 { margin: 0 0 8px; font-size: 13px; font-weight: 500; color: oklch(0.72 0.01 300); }
.review h3 + .rv-list { margin-bottom: 16px; }
.rv-list { margin: 0; padding: 0; list-style: none; font-family: var(--mono); font-size: 12px; line-height: 1.8; color: oklch(0.7 0.01 300); }
.rv-list .add { color: var(--ok); }
.rv-hist li { color: var(--rework); }
.review label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 500; color: oklch(0.88 0.006 300); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chips button { height: 26px; padding: 0 10px; border: 1px solid oklch(0.3 0.014 300); border-radius: 13px; background: transparent; color: oklch(0.7 0.01 300); font-size: 12px; cursor: pointer; }
.chips button:hover { border-color: var(--rework); color: var(--rework); }
textarea { width: 100%; resize: vertical; padding: 10px 12px; border: 1px solid oklch(0.3 0.014 300); border-radius: 2px; background: var(--bg); color: var(--text); font: 13px/1.5 'IBM Plex Sans', system-ui, sans-serif; }
textarea::placeholder { color: oklch(0.45 0.012 300); }
.hint { margin: 8px 0 0; font-size: 12.5px; color: var(--rework); }
.rv-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.btn-rework { border-color: oklch(0.78 0.13 75 / 0.45); color: var(--rework); }
.btn-rework:hover { border-color: var(--rework); color: oklch(0.86 0.1 75); background: oklch(0.78 0.13 75 / 0.08); }
.phase .rw { font-family: var(--mono); font-size: 10px; color: var(--rework); margin-top: -8px; min-height: 12px; }
.done .done-summary { margin-top: -18px; font-size: 14px; color: oklch(0.78 0.08 300); }

@media (max-width: 760px) {
  .review-body { grid-template-columns: 1fr; padding: 16px; }
  .review-head { padding: 16px 16px 0; }
  .wrap { padding: 22px 16px 48px; }
  .legend { position: static; padding: 12px 16px 16px; }
  .playbook { padding: 16px; }
  .plan { padding: 24px 20px; }
  .plan-grid { grid-template-columns: 1fr; gap: 4px; }
  .plan-grid .k { padding-top: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
