:root {
  color-scheme: dark;
  /* Palette and typography shared with interface/styles.css. */
  --bg: #000000;
  --bg-soft: #232323;
  --bg-softer: #2a2a2a;
  --text: #f4f4f4;
  --muted: #9b9b9b;
  --muted-strong: #d0d0d0;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --accent: #ffffff;
  --brand: #ff1515;
  --canvas: var(--bg);
  --surface: #0b0b0b;
  --soft: rgba(255, 255, 255, 0.025);
  --ink: var(--text);
  --active: var(--accent);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 1000px; overflow: hidden; }
button { font: inherit; cursor: pointer; }
button:focus-visible, .tree:focus-visible {
  outline: 2px solid var(--active);
  outline-offset: 4px;
}
button:disabled { opacity: .3; cursor: default; }
code { font-family: "Cascadia Code", Consolas, monospace; }
h2, h3, h4, p { overflow-wrap: anywhere; }
main { height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr) 86px; }
.tree-heading {
  position: relative;
  display: flex; align-items: center; justify-content: space-between; gap: 32px;
  padding: 26px 36px 22px; border-bottom: 1px solid var(--line);
  background: #050505;
}
.tree-heading::before {
  position: absolute; inset: 0 0 auto; height: 3px; content: "";
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand) 15%, rgba(255, 255, 255, 0.7) 15%, transparent 58%);
}
.tree-heading > div > .section-index { display: flex; align-items: center; gap: 9px; color: #c5c5c5; }
.tree-heading > div > .section-index::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: #ff2020; box-shadow: 0 0 0 4px rgba(255, 32, 32, 0.14);
}
.section-index {
  display: block; margin-bottom: 7px; color: var(--active);
  font-size: 10px; font-weight: 750; letter-spacing: .15em; text-transform: uppercase;
}
.tree-heading h2 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: .01em; }
.tree-heading p { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.navigation-arrows { display: flex; gap: 8px; }
.navigation-arrows button {
  min-height: 36px; padding: 8px 13px; border: 1px solid var(--line);
  border-radius: 999px; background: rgba(255, 255, 255, 0.045); color: var(--ink); font-size: 12px;
}
.navigation-arrows button:not(:disabled):hover {
  border-color: rgba(255, 255, 255, 0.32); background: rgba(255, 255, 255, 0.1);
}
.tree {
  display: flex; align-items: flex-start; gap: 48px;
  min-width: 0; overflow-x: auto; overflow-y: hidden;
  padding: 24px 36px 22px; scroll-padding-inline: 36px;
  overscroll-behavior-x: contain;
  scrollbar-color: #555555 var(--bg); scrollbar-width: thin;
  background: var(--bg);
}
.tree::after { content: ""; flex: 0 0 max(0px, calc(100% - 444px)); }
.tree-node, .single-child { display: contents; }
.node-box {
  position: relative; display: flex; flex-direction: column;
  flex: 0 0 396px; width: 396px; min-height: 0; max-height: 100%;
  padding: 20px; border: 1px solid var(--line-strong);
  border-radius: 20px; background: var(--surface);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.45), inset 0 1px rgba(255, 255, 255, 0.06); scroll-snap-align: start;
}
.node-box::after {
  position: absolute; top: 43px; left: calc(100% + 1px); width: 48px;
  content: "→"; color: var(--muted); text-align: center; font-size: 21px;
}
.node-box:last-child::after { content: none; }
.node-box.decision {
  background: linear-gradient(135deg, #2b1717, #171111 70%);
  border-color: rgba(255, 90, 90, 0.32);
  box-shadow: 0 0 22px rgba(255, 21, 21, 0.05), inset 0 1px rgba(255, 130, 130, 0.1);
}
.node-box.decision .phase-badge { background: rgba(255, 90, 90, 0.1); color: #ffaaaa; }
.node-box.start, .node-box.result { border-color: rgba(255, 255, 255, 0.2); }
.node-meta { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 18px; }
.node-meta > div { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.node-meta > div:first-child { min-width: 0; }
.node-meta-actions { flex: 0 0 auto; }
.phase-badge {
  padding: 5px 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.06);
  color: var(--muted-strong); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .07em;
}
.task-id { width: 100%; color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.llm-badge { padding: 4px 6px; border: 1px solid rgba(96, 165, 250, 0.35); border-radius: 999px; background: rgba(59, 130, 246, 0.14); color: #93c5fd; font-size: 10px; }
.node-box h3 { margin: 0; font-size: 20px; line-height: 1.3; font-weight: 600; letter-spacing: -.025em; }
.step-number { display: block; margin-bottom: 12px; color: var(--muted-strong); font-size: 11px; letter-spacing: .1em; font-family: Consolas, monospace; }
.node-summary { color: var(--muted); margin: 10px 0 0; font-size: 12px; line-height: 1.6; }
.node-details {
  display: grid; align-content: start; gap: 10px; min-height: 0;
  margin-top: 20px; padding-right: 5px; overflow-y: auto;
  scrollbar-color: #555555 transparent; scrollbar-width: thin;
}
.detail-section, .llm-callout { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.detail-section h4, .llm-callout > strong {
  display: block; margin: 0 0 8px; color: var(--muted); font-size: 9px;
  font-weight: 750; text-transform: uppercase; letter-spacing: .12em;
}
.detail-section p, .llm-callout p { margin: 0; font-size: 12px; line-height: 1.6; }
.detail-section p + p { margin-top: 7px; }
.artifact-list { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.artifact-list li { display: grid; gap: 3px; }
.artifact-list code { color: var(--muted-strong); font-size: 11px; overflow-wrap: anywhere; line-height: 1.5; }
.artifact-list span { color: var(--muted); font-size: 11px; line-height: 1.4; }
.outputs-section { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.05); }
.outputs-section h4 { color: var(--muted-strong); }
.llm-callout { border-color: var(--line-strong); background: var(--soft); color: var(--text); }
.llm-callout > strong { color: var(--muted-strong); }
.llm-callout code { font-size: 11px; }
.decision-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 15px; margin-top: auto; }
.decision-buttons button {
  padding: 10px; border: 1px solid var(--line-strong); border-radius: 999px;
  background: rgba(255, 255, 255, 0.045); color: var(--muted); font-size: 12px; font-weight: 700;
}
.decision-buttons button:hover { border-color: var(--active); color: var(--ink); }
.decision-buttons button.selected { background: var(--active); color: #000000; border-color: var(--active); }
.route-choice { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 11px; line-height: 1.5; }
.route-choice strong { display: block; color: var(--active); font-weight: 600; }
.route-choice span { display: block; margin-top: 3px; color: var(--muted); }
.info-tooltip { position: relative; display: inline-flex; }
.info-tooltip-trigger {
  display: grid; place-items: center; width: 23px; height: 23px; padding: 0;
  border: 1px solid var(--line-strong); border-radius: 50%; background: var(--bg-soft); color: var(--text); font-size: 12px;
}
.info-tooltip-content {
  position: absolute; top: 32px; right: 0; z-index: 40; width: 340px;
  max-height: calc(100dvh - 330px); padding: 16px; border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px; background: var(--bg-soft); box-shadow: 0 16px 40px #0009;
  color: var(--text); font-size: 12px; line-height: 1.65; overflow-y: auto;
  opacity: 0; visibility: hidden; pointer-events: none;
}
.info-tooltip::after { content: ""; position: absolute; top: 100%; right: 0; height: 12px; width: 40px; }
.info-tooltip:hover .info-tooltip-content, .info-tooltip:focus-within .info-tooltip-content { opacity: 1; visibility: visible; pointer-events: auto; }
.info-tooltip-content code { color: var(--muted-strong); font-size: 11px; }
.info-tooltip-example { display: block; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-strong); }
.info-tooltip-example.prompt-only { margin: 0; padding: 0; border: 0; }
.info-tooltip-example > strong, .info-tooltip-example > code { display: block; }
.info-tooltip-example > strong { margin-bottom: 7px; color: var(--muted-strong); font-size: 10px; text-transform: uppercase; }
.pipeline-navigation {
  display: flex; align-items: center; gap: 28px; padding: 16px 36px;
  border-top: 1px solid var(--line); background: var(--bg);
}
.navigation-status { flex: 0 0 120px; }
.navigation-status .section-index { color: var(--muted); font-size: 9px; }
#step-position { font-size: 13px; font-variant-numeric: tabular-nums; }
.step-navigation { display: flex; align-items: center; gap: 5px; flex: 1; min-width: 0; }
.step-navigation button {
  flex: 1; min-width: 0; height: 32px; padding: 0; border: 0; border-bottom: 2px solid var(--line);
  background: transparent; color: var(--muted); font-size: 10px; font-family: Consolas, monospace;
}
.step-navigation button:hover { color: var(--ink); border-color: var(--muted); }
.step-navigation button[aria-current="step"] { color: var(--active); border-color: var(--active); background: rgba(255, 255, 255, 0.05); }
.navigation-arrows button { width: 38px; font-size: 19px; padding: 4px; }
