:root{
  color-scheme:dark;
  --bg:#0b0d0c;--surface:#111411;--surface-2:#171b17;--surface-3:#1d221d;
  --text:#eef1e8;--muted:#969e92;--faint:#62695f;
  --line:rgba(238,241,232,.12);--line-strong:rgba(238,241,232,.24);
  --accent:#b9f568;--accent-soft:rgba(185,245,104,.12);
  --blue:#73bdf8;--orange:#f3ae66;--red:#ff786e;--purple:#c09bf7;--max:1240px
}
html[data-theme="light"]{
  color-scheme:light;--bg:#f2f1e9;--surface:#e7e6dd;--surface-2:#f9f8f3;--surface-3:#fff;
  --text:#171914;--muted:#62685e;--faint:#858b80;--line:rgba(23,25,20,.12);
  --line-strong:rgba(23,25,20,.22);--accent:#557a13;--accent-soft:rgba(85,122,19,.10);
  --blue:#286fae;--orange:#a95f1d;--red:#b8423a;--purple:#7350a2
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{margin:0;color:var(--text);background:radial-gradient(circle at 53% 18%,color-mix(in srgb,var(--accent) 5%,transparent),transparent 34rem),var(--bg);font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
button,a{-webkit-tap-highlight-color:transparent}
button{font:inherit;color:inherit}
a{color:inherit;text-decoration:none}
button:focus-visible,a:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
.topbar,main,footer{width:min(calc(100% - 40px),var(--max));margin-inline:auto}
.topbar{position:sticky;top:14px;z-index:50;display:flex;align-items:center;justify-content:space-between;min-height:58px;margin-top:14px;padding:0 14px;border:1px solid var(--line);border-radius:16px;background:color-mix(in srgb,var(--bg) 82%,transparent);backdrop-filter:blur(18px)}
.brand{display:flex;align-items:center;gap:8px;font:700 .86rem ui-monospace,SFMono-Regular,Menlo,monospace}
.brand-mark{display:grid;place-items:center;width:28px;height:28px;border-radius:8px;background:var(--accent);color:var(--bg)}
.brand .slash{color:var(--faint)}.brand strong{color:var(--muted)}
.top-actions{display:flex;align-items:center;gap:8px}
.trace-pill{display:flex;align-items:center;gap:7px;padding:6px 9px;border:1px solid var(--line);border-radius:999px;color:var(--muted);font-size:.72rem}
.trace-pill i{width:6px;height:6px;border-radius:50%;background:var(--accent);box-shadow:0 0 0 4px var(--accent-soft)}
.theme-toggle{display:flex;align-items:center;gap:7px;padding:7px 9px;border:0;border-radius:9px;background:transparent;color:var(--muted);cursor:pointer}
.theme-toggle:hover{background:var(--surface)}
.theme-dot{width:8px;height:8px;border:2px solid currentColor;border-radius:50%}

.intro{display:flex;align-items:end;justify-content:space-between;gap:24px;padding:32px 0 18px}
.kicker{display:block;margin-bottom:8px;color:var(--accent);font:700 .66rem ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:.12em}
.intro h1{margin:0;max-width:900px;font-size:clamp(1.65rem,2.9vw,2.6rem);line-height:1.08;letter-spacing:-.035em;font-weight:650}
.scenario-tabs{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}
.scenario-tabs button,.sim-controls button{
  min-height:36px;padding:0 12px;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--muted);font-size:.76rem;font-weight:700;cursor:pointer
}
.scenario-tabs button[aria-selected="true"]{border-color:color-mix(in srgb,var(--accent) 50%,var(--line));background:var(--accent-soft);color:var(--text)}

.simulator{overflow:hidden;border:1px solid var(--line);border-radius:20px;background:var(--surface);box-shadow:0 24px 70px rgba(0,0,0,.14)}
.sim-bar{display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:54px;padding:8px 12px;border-bottom:1px solid var(--line)}
.task-id{display:flex;align-items:center;gap:8px;font:700 .72rem ui-monospace,SFMono-Regular,Menlo,monospace}
.task-id>span:last-child{color:var(--faint);font-weight:600}.task-dot{width:8px;height:8px;border-radius:50%;background:var(--accent);box-shadow:0 0 0 5px var(--accent-soft)}
.sim-controls{display:flex;gap:6px}.sim-controls button{min-height:34px;background:transparent}
.sim-controls button[data-control="play"]{background:var(--accent);border-color:transparent;color:var(--bg)}
.sim-controls button:disabled{opacity:.28;cursor:not-allowed}

.stage{position:relative;min-height:650px;overflow:hidden;isolation:isolate;background:linear-gradient(var(--line) 1px,transparent 1px),linear-gradient(90deg,var(--line) 1px,transparent 1px);background-size:40px 40px}
.stage::after{content:"";position:absolute;inset:0;z-index:-3;background:radial-gradient(circle at 50% 45%,var(--accent-soft),transparent 30rem)}
.hud{display:grid;grid-template-columns:minmax(0,1fr) minmax(250px,340px);align-items:center;gap:18px;min-height:92px;padding:12px 14px;border-top:1px solid var(--line);background:var(--surface-2)}
.progress-wrap{min-width:0}.phase-dots{display:flex;gap:5px;min-width:0}
.phase-dot{position:relative;flex:1;min-width:0;height:24px;padding:0;border:0;background:transparent;cursor:pointer}
.phase-dot::before{content:"";position:absolute;left:0;right:0;top:10px;height:4px;border-radius:99px;background:var(--line-strong);transition:background .18s ease,transform .18s ease}
.phase-dot.done::before,.phase-dot.current::before{background:var(--accent)}
.phase-dot.current::before{transform:scaleY(2)}
.phase-dot:hover::before{background:color-mix(in srgb,var(--accent) 65%,var(--line-strong))}
.phase-dot:focus-visible{outline:1px solid var(--accent);outline-offset:2px;border-radius:5px}
.phase-dot::after{content:attr(data-index);position:absolute;left:50%;top:-7px;transform:translateX(-50%);color:transparent;font:700 .52rem ui-monospace,SFMono-Regular,Menlo,monospace}
.phase-dot.current::after{color:var(--accent)}
.readout{text-align:right;min-width:0}.readout-key{display:block;color:var(--faint);font:700 .6rem ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:.1em}
.readout strong{display:block;margin-top:3px;font-size:.84rem}.readout small{display:block;margin-top:4px;color:var(--muted);font-size:.68rem;line-height:1.35}
.trace-note{display:flex;align-items:center;gap:10px;margin:12px 2px 0;color:var(--faint);font-size:.69rem}
.trace-note span{font:700 .59rem ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:.1em}.trace-note strong{font-weight:600;color:var(--muted)}
footer{display:flex;justify-content:space-between;gap:20px;padding:24px 0 38px;color:var(--faint);font:650 .69rem ui-monospace,SFMono-Regular,Menlo,monospace}

@keyframes edge-flow{to{stroke-dashoffset:-36}}

@media(max-width:900px){
  .intro{align-items:flex-start;flex-direction:column}
  .scenario-tabs{justify-content:flex-start}
  .stage{min-height:650px}
}
@media(max-width:620px){
  body{background:var(--bg)}
  .topbar,main,footer{width:min(calc(100% - 18px),var(--max))}
  .topbar{top:6px;min-height:48px;margin-top:6px;padding:0 10px;border-radius:13px}
  .brand{gap:7px;font-size:.78rem}.brand-mark{width:26px;height:26px;border-radius:7px}
  .trace-pill,.brand .slash,.brand strong,.theme-label{display:none}
  .theme-toggle{min-width:34px;min-height:34px;justify-content:center;padding:0}
  .theme-dot{width:9px;height:9px}

  .intro{gap:12px;padding:16px 0 10px}
  .kicker{margin-bottom:5px;font-size:.55rem;letter-spacing:.09em}
  .intro h1{max-width:100%;font-size:clamp(1.55rem,8vw,1.95rem);line-height:1.02;letter-spacing:-.04em}
  .scenario-tabs{display:flex;gap:5px;width:100%;overflow-x:auto;flex-wrap:nowrap;justify-content:flex-start;padding-bottom:1px;scrollbar-width:none}
  .scenario-tabs::-webkit-scrollbar{display:none}
  .scenario-tabs button{flex:1 0 auto;min-height:34px;padding:0 11px;border-radius:9px;font-size:.65rem}

  .simulator{display:flex;flex-direction:column;border-radius:16px}
  .sim-bar{order:1;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:8px;min-height:48px;padding:6px 8px}
  .task-id{min-width:0;gap:6px;white-space:nowrap;font-size:.63rem}
  .task-id strong{overflow:hidden;text-overflow:ellipsis}
  .task-id>span:last-child{font-size:.56rem}
  .task-dot{width:7px;height:7px;box-shadow:0 0 0 4px var(--accent-soft)}
  .sim-controls{display:flex;gap:4px}
  .sim-controls button{min-width:36px;min-height:34px;padding:0 8px;border-radius:8px;font-size:.67rem}
  .sim-controls button[data-control="play"]{min-width:48px}
  .sim-controls button[data-control="reset"]{min-width:42px;padding-inline:6px;font-size:.61rem}

  .hud{order:2;display:flex;flex-direction:column;align-items:stretch;gap:8px;min-height:0;padding:10px 10px 9px;border-top:0;border-bottom:1px solid var(--line)}
  .readout{order:1;text-align:left}
  .readout-key{font-size:.55rem}
  .readout strong{margin-top:2px;font-size:.82rem;line-height:1.2}
  .readout small{margin-top:3px;font-size:.66rem;line-height:1.35}
  .progress-wrap{order:2;width:100%;max-width:100%;overflow-x:auto;min-width:0;padding:2px 6px 3px;scroll-padding-inline:6px;scrollbar-width:none;overscroll-behavior-inline:contain}
  .progress-wrap::-webkit-scrollbar{display:none}
  .phase-dots{display:flex;gap:5px;width:max-content;min-width:max-content}
  .phase-dot{flex:0 0 29px;width:29px;height:25px;border:1px solid var(--line);border-radius:7px;background:var(--surface);transition:border-color .16s ease,background .16s ease}
  .phase-dot::before{left:5px;right:5px;top:auto;bottom:4px;height:2px;background:var(--line-strong)}
  .phase-dot::after{top:4px;color:var(--faint);font-size:.48rem}
  .phase-dot.done{border-color:color-mix(in srgb,var(--accent) 26%,var(--line))}
  .phase-dot.done::before{background:var(--accent)}
  .phase-dot.current{border-color:var(--accent);background:var(--accent-soft)}
  .phase-dot.current::before{transform:none;background:var(--accent)}
  .phase-dot.current::after{color:var(--accent)}

  .stage{order:3;min-height:420px;height:420px;background-size:28px 28px}
  .trace-note{align-items:flex-start;flex-direction:column;gap:3px;margin-top:9px;font-size:.62rem}
  .trace-note span{font-size:.53rem}
  footer{padding:18px 0 28px;font-size:.63rem}
}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important}}
/* Morrows flow renderer. Layout comes from ELK + data/flows.json; these rules
   control appearance only, not individual node coordinates. */
.task-id [data-back]{
  border:1px solid var(--line-strong);border-radius:8px;background:var(--surface-3);
  color:var(--accent);font:700 .66rem ui-monospace,SFMono-Regular,Menlo,monospace;
  padding:6px 9px;cursor:pointer
}
.task-id [data-back][hidden]{display:none}
.flow-breadcrumb{margin-left:4px;padding-left:9px;border-left:1px solid var(--line-strong);color:var(--faint);font-size:.63rem}
.stage{min-height:568px;height:568px}
.graph-zones,.graph-nodes,.graph-links{position:absolute;inset:0}
.graph-zones{z-index:0;pointer-events:none}
.graph-zone{position:absolute;border:1px dashed var(--line-strong);border-radius:15px;background:color-mix(in srgb,var(--accent) 1.5%,transparent)}
.graph-zone[data-zone="actors"]{background:color-mix(in srgb,var(--purple) 3%,transparent)}
.graph-zone[data-zone="control"]{background:color-mix(in srgb,var(--blue) 2%,transparent)}
.graph-zone[data-zone="rescue"]{background:color-mix(in srgb,var(--orange) 3%,transparent)}
.graph-zone span{position:absolute;left:12px;top:9px;color:var(--faint);font:700 .59rem ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:.07em}
.graph-links{z-index:1;width:100%;height:100%;pointer-events:none;overflow:hidden}
.graph-link{
  fill:none;stroke:var(--line-strong);stroke-width:1.5;stroke-linecap:round;
  stroke-linejoin:round;opacity:.33;marker-end:url(#graph-arrow)
}
.graph-link.is-current{stroke:var(--accent);stroke-width:2.5;opacity:1;stroke-dasharray:7 8;animation:edge-flow 1s linear infinite}
.graph-link.is-error{stroke:var(--red);animation:none}
.graph-link.is-rescue{stroke:var(--orange)}
.graph-signal{fill:var(--accent)}
.graph-signal.is-rescue{fill:var(--orange)}
.graph-nodes{z-index:2}
.graph-node{
  position:absolute;display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:4px;padding:9px 7px;border:1px solid var(--line-strong);border-radius:13px;
  background:var(--surface-3);color:var(--text);cursor:pointer;box-shadow:0 5px 18px rgba(0,0,0,.11);
  transition:border-color .16s ease,background .16s ease,opacity .16s ease,box-shadow .16s ease
}
.graph-node:hover{border-color:var(--accent);background:color-mix(in srgb,var(--accent) 7%,var(--surface-3))}
.graph-node.is-active{border-color:color-mix(in srgb,var(--accent) 80%,var(--line-strong));box-shadow:0 0 0 1px var(--accent-soft),0 0 20px var(--accent-soft)}
.graph-node.is-selected{outline:2px solid var(--accent);outline-offset:3px}
.graph-node.is-error{border-color:var(--red)}
.graph-node.is-rescue{border-color:var(--orange)}
.graph-node.is-complete{border-color:var(--accent)}
.graph-node.is-dim{opacity:.45}
.graph-node-icon{display:grid;place-items:center;width:23px;height:23px;border-radius:8px;background:var(--surface);border:1px solid var(--line-strong);color:var(--accent);font:700 .78rem ui-monospace,SFMono-Regular,Menlo,monospace}
.graph-node strong{font-size:.77rem;font-weight:700;white-space:nowrap}
.graph-node small{display:block;max-width:100%;color:var(--muted);font:.58rem ui-monospace,SFMono-Regular,Menlo,monospace;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.graph-drill{position:absolute;right:-6px;top:-7px;width:19px;height:19px;display:grid;place-items:center;border:1px solid var(--accent);border-radius:7px;background:var(--surface-2);color:var(--accent);font-size:.75rem;line-height:1}
.graph-node:has(.graph-drill):hover .graph-drill{background:var(--accent);color:var(--bg)}
.trace-note strong a{color:var(--accent)}
.stage[aria-busy="true"] .graph-nodes{opacity:.7}
@media(max-width:620px){
  .stage{order:3;min-height:420px;height:420px;background-size:28px 28px}
  .graph-zones{display:none}
  .graph-node{height:80px;padding:7px 5px;border-radius:12px}
  .graph-node strong{font-size:.73rem}
  .graph-node small{font-size:.53rem}
  .flow-breadcrumb{display:none}
  .task-id [data-back]{padding:5px 6px;font-size:.54rem}
  .task-id>span:last-child{font-size:.54rem}
  .graph-drill{width:19px;height:19px;right:-4px}
}
@media(prefers-reduced-motion:reduce){
  .graph-link.is-current{animation:none}
}

/* Guided-execution narrative: one event, its reason, and observable state
   transitions before the graph. The diagram is secondary evidence, not prose. */
.intro{padding:20px 0 10px}
.intro h1{font-size:clamp(1.7rem,2.55vw,2.25rem);letter-spacing:-.034em;line-height:1.08}
.intro-deck{max-width:760px;margin:7px 0 0;color:var(--muted);font-size:.79rem;line-height:1.42}
.concept-strip{display:flex;align-items:center;flex-wrap:wrap;gap:7px;margin:0 0 12px}
.concept-strip span{display:inline-flex;align-items:center;gap:6px;min-height:29px;padding:5px 10px;border:1px solid var(--line);border-radius:8px;color:var(--muted);font-size:.71rem}
.concept-strip strong{font-size:.72rem;color:var(--text)}
.concept-strip em{font-style:normal;color:var(--faint)}
.simulator{display:flex;flex-direction:column}
.sim-bar{order:0}
.demo-flag{padding:4px 6px;border:1px solid var(--line-strong);border-radius:5px;background:var(--surface-2);font:700 .53rem ui-monospace,SFMono-Regular,Menlo,monospace!important;color:var(--muted)!important;letter-spacing:.02em}
.storyboard{order:1;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:22px;align-items:center;min-height:122px;padding:15px 20px;background:linear-gradient(115deg,var(--surface-2),var(--surface));border-bottom:1px solid var(--line)}
.story-meta{display:block;margin-bottom:7px;font:750 .63rem ui-monospace,SFMono-Regular,Menlo,monospace;color:var(--accent);letter-spacing:.065em}
.story-voice strong{display:block;font-size:1.2rem;line-height:1.17;letter-spacing:-.022em;font-weight:720}
.story-voice p{max-width:630px;margin:6px 0 0;color:var(--muted);font-size:.75rem;line-height:1.45}
.change-list{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:7px;max-width:540px}
.change-chip{display:flex;flex-direction:column;gap:6px;min-width:108px;padding:9px 10px;border:1px solid var(--line-strong);border-radius:9px;background:var(--surface-3)}
.change-chip>span{font:700 .6rem ui-monospace,SFMono-Regular,Menlo,monospace;color:var(--muted)}
.change-transition{display:flex;align-items:center;gap:5px;font:650 .67rem ui-monospace,SFMono-Regular,Menlo,monospace;white-space:nowrap}
.change-transition del{color:var(--faint);font-weight:500;text-decoration:line-through;text-decoration-color:var(--faint)}
.change-transition i{font-style:normal;color:var(--faint)}
.change-transition strong{font-weight:780;color:var(--accent)}
.change-chip.is-unchanged .change-transition strong{color:var(--text)}
.change-none{color:var(--muted);font-size:.71rem}
.hud{order:2;display:flex;flex-direction:column;align-items:stretch;gap:5px;min-height:60px;padding:10px 16px 9px;border-top:0;border-bottom:1px solid var(--line);background:var(--surface-2)}
.progress-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;color:var(--muted);font-size:.67rem;line-height:1.25}
.progress-hint{flex-shrink:0;font:650 .58rem ui-monospace,SFMono-Regular,Menlo,monospace;color:var(--faint)}
.hud .progress-wrap{order:initial}
.hud .readout{display:none}
.stage{order:3}
.graph-node.is-future{opacity:.46;filter:saturate(.45)}
.graph-node.is-future.is-selected{opacity:1}
.graph-node.is-future:hover{opacity:1}
.graph-legend{position:absolute;bottom:8px;left:12px;z-index:4;display:flex;align-items:center;gap:13px;padding:6px 8px;border:1px solid var(--line);border-radius:8px;background:color-mix(in srgb,var(--surface) 94%,transparent);color:var(--faint);font:600 .56rem ui-monospace,SFMono-Regular,Menlo,monospace;pointer-events:none}
.graph-legend span{display:flex;align-items:center;gap:6px}
.graph-legend i{width:17px;height:3px;display:inline-block;border-radius:2px}
.graph-legend .legend-moving{background:var(--accent)}
.graph-legend .legend-related{background:var(--faint);opacity:.6}
.graph-legend b{color:var(--accent);font-size:.75rem}
@media(max-width:900px){
 .intro{gap:10px}
 .storyboard{grid-template-columns:1fr;gap:11px;padding:12px 14px}
 .change-list{max-width:none;justify-content:flex-start}
}
@media(max-width:620px){
 .intro{padding:13px 0 8px}
 .intro h1{font-size:1.72rem;line-height:1.04}
 .intro-deck{font-size:.7rem;line-height:1.32;margin-top:5px}
 .concept-strip{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;margin-bottom:8px}
 .concept-strip span{flex-direction:column;justify-content:center;gap:1px;min-height:42px;padding:4px 3px;text-align:center;font-size:.54rem}
 .concept-strip strong{font-size:.62rem}
 .demo-flag{font-size:.46rem!important;padding:3px 4px}
 .task-id{gap:4px}
 .storyboard{order:1;min-height:0;gap:9px;padding:11px 10px 10px}
 .story-meta{font-size:.51rem;margin-bottom:5px}
 .story-voice strong{font-size:1rem;line-height:1.14}
 .story-voice p{font-size:.67rem;line-height:1.35;margin-top:4px}
 .change-list{flex-wrap:nowrap;gap:4px;overflow-x:auto;width:100%;max-width:100%;justify-content:flex-start;scrollbar-width:none}
 .change-chip{flex:1 0 auto;min-width:0;max-width:50%;padding:6px 8px;gap:4px}
 .change-chip>span{font-size:.54rem}
 .change-transition{font-size:.57rem;gap:3px}
 .hud{order:2;min-height:0;padding:8px 9px;gap:4px}
 .progress-heading{font-size:.61rem;line-height:1.3}
 .progress-heading span:first-child{min-width:0}
 .progress-hint{display:none}
 .graph-legend{left:8px;bottom:6px;gap:8px;padding:5px 6px;font-size:.47rem}
 .graph-legend span{gap:4px}
 .graph-legend i{width:12px}
 .stage{order:3}
}

/* Iteration 2 — keep the entire desktop execution map inside one screen,
   and show every state on mobile without horizontal scrolling. */
.stage{min-height:492px;height:492px}
.graph-node.is-future{opacity:.64;filter:saturate(.7)}
@media(max-width:620px){
 .intro h1{font-size:1.48rem}
 .intro-deck{font-size:.68rem;line-height:1.27}
 .concept-strip span{min-height:32px}
 .sim-bar{padding:5px 7px}
 .demo-flag{font-size:0!important;padding:3px 4px}
 .demo-flag::after{content:"DEMO";font-size:.5rem}
 .storyboard{gap:7px}
 .change-list{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;overflow:visible}
 .change-chip{width:auto;min-width:0;max-width:none}
 .change-chip>span{font-size:.55rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
 .change-transition{display:block;white-space:normal;line-height:1.25}
 .change-transition del,.change-transition i{display:none}
 .change-transition strong{display:block;font-size:.59rem;overflow-wrap:anywhere}
 .stage{min-height:420px;height:420px}
}

/* Entry points for each scenario's defining event. */
.intro-demo-note{color:var(--text);font-weight:640}
.progress-jump{border:0;background:transparent;color:var(--accent);cursor:pointer;font:700 .65rem ui-monospace,SFMono-Regular,Menlo,monospace;white-space:nowrap;text-decoration:underline;text-underline-offset:3px;padding:3px 0}
.progress-jump[hidden]{display:none}
.progress-jump:hover{filter:brightness(1.2)}
@media(max-width:620px){
 .progress-heading{align-items:flex-start;gap:8px}
 .progress-jump{font-size:.57rem;line-height:1.25;text-align:right;max-width:125px;white-space:normal;flex-shrink:0}
 .intro-demo-note{display:block;font-size:.63rem;margin-top:2px}
}

/* The Task is the identity that survives all three scenarios. */
.graph-node.is-durable:not(.is-active){border-color:color-mix(in srgb,var(--blue) 50%,var(--line-strong))}
.graph-node.is-durable.is-future{opacity:1;filter:none}

/* Operational tree inspired by terminal agent trees. The persistent data
   sidecar is separate from the active control/execution branch. */
.stage{background-color:#11171b;background-image:linear-gradient(rgba(140,175,189,.045) 1px,transparent 1px),linear-gradient(90deg,rgba(140,175,189,.045) 1px,transparent 1px);background-size:30px 30px}
.graph-zone{border-style:dashed;border-width:1.5px;border-radius:7px;background:rgba(14,21,26,.72)}
.graph-zone[data-tone="blue"]{border-color:color-mix(in srgb,var(--blue) 48%,transparent);background:color-mix(in srgb,var(--blue) 3%,#101920)}
.graph-zone[data-tone="purple"]{border-color:color-mix(in srgb,var(--purple) 48%,transparent);background:color-mix(in srgb,var(--purple) 3%,#111720)}
.graph-zone[data-tone="green"]{border-color:color-mix(in srgb,var(--accent) 48%,transparent);background:color-mix(in srgb,var(--accent) 3%,#111a1b)}
.graph-zone>span{top:10px;left:14px;font-size:.64rem;letter-spacing:.11em;color:var(--text)}
.graph-zone[data-tone="blue"]>span{color:var(--blue)}
.graph-zone[data-tone="purple"]>span{color:var(--purple)}
.graph-zone[data-tone="green"]>span{color:var(--accent)}
.graph-zone>small{position:absolute;left:14px;top:29px;color:var(--muted);font:500 .57rem ui-monospace,SFMono-Regular,Menlo,monospace}
.graph-node{border-radius:8px;background:color-mix(in srgb,var(--surface-3) 86%,#13202b);box-shadow:0 4px 16px rgba(0,0,0,.15)}
.graph-node[data-tone="purple"] .graph-node-icon{color:var(--purple)}
.graph-node[data-tone="blue"] .graph-node-icon{color:var(--blue)}
.graph-node[data-tone="orange"] .graph-node-icon{color:var(--orange)}
.graph-node[data-tone="purple"].is-active{border-color:var(--purple);box-shadow:0 0 20px color-mix(in srgb,var(--purple) 22%,transparent)}
.graph-node[data-tone="blue"].is-active{border-color:var(--blue);box-shadow:0 0 20px color-mix(in srgb,var(--blue) 20%,transparent)}
.graph-node[data-tone="orange"].is-rescue{border-color:var(--orange);box-shadow:0 0 20px color-mix(in srgb,var(--orange) 20%,transparent)}
.graph-link:not(.is-current){opacity:.22}
.graph-legend{bottom:12px;right:12px;left:auto}
.event-console{order:4;border-top:1px solid var(--line);background:#0e1419;padding:0 14px 10px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace}
.event-console-head{height:38px;display:flex;align-items:center;justify-content:space-between;gap:10px;border-bottom:1px solid var(--line);color:var(--accent);font-size:.67rem;font-weight:750;letter-spacing:.055em}
.event-console-head>span:first-child{display:inline-flex;align-items:center;gap:8px}
.event-console-head i{width:7px;height:7px;border-radius:50%;background:var(--accent);box-shadow:0 0 0 4px var(--accent-soft)}
.event-console-head small{margin-left:6px;color:var(--muted);font-size:.59rem;font-weight:500;letter-spacing:0}
.event-console-head>span:last-child{color:var(--muted)}
.event-console-rows{min-height:40px;padding:5px 0}
.event-row{width:100%;display:grid;grid-template-columns:36px minmax(105px,180px) minmax(0,1fr) 51px;align-items:center;gap:10px;min-height:30px;border:0;border-radius:5px;background:transparent;padding:3px 8px;text-align:left;cursor:pointer;color:var(--muted);font-size:.64rem;transition:background .15s ease}
.event-row:hover{background:color-mix(in srgb,var(--accent) 8%,transparent)}
.event-row.is-current{background:color-mix(in srgb,var(--accent) 7%,transparent);color:var(--text)}
.event-row.is-next{opacity:.45}
.event-seq{font-size:.59rem;color:var(--faint)}
.event-actor{font-size:.66rem;font-weight:700;color:var(--blue);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.event-row[data-tone="handoff"] .event-actor{color:var(--purple)}
.event-row[data-tone="warning"] .event-actor{color:var(--orange)}
.event-row[data-tone="recovered"] .event-actor{color:var(--accent)}
.event-row[data-tone="review"] .event-actor{color:var(--blue)}
.event-action{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.event-badge{font-weight:700;text-align:right;color:var(--faint);font-size:.59rem}
.event-row.is-current .event-badge{color:var(--accent)}
.event-row[data-tone="warning"].is-current .event-badge{color:var(--orange)}
.event-row[data-tone="handoff"].is-current .event-badge{color:var(--purple)}
html[data-theme="light"] .stage{background-color:#f0f3ed;background-image:linear-gradient(rgba(35,61,68,.07) 1px,transparent 1px),linear-gradient(90deg,rgba(35,61,68,.07) 1px,transparent 1px)}
html[data-theme="light"] .graph-zone{background:rgba(232,240,243,.75)}
html[data-theme="light"] .graph-zone[data-tone="purple"]{background:rgba(241,232,249,.72)}
html[data-theme="light"] .graph-zone[data-tone="green"]{background:rgba(229,240,220,.72)}
html[data-theme="light"] .event-console{background:#f6f7f2}
@media(max-width:999px) and (min-width:621px){
 .graph-zone>small{display:none}
}
@media(max-width:620px){
 .stage{background-size:28px 28px}
 .graph-legend{left:8px;right:auto;bottom:6px}
 .event-console{padding:0 8px 8px}
 .event-console-head{height:34px;font-size:.62rem}
 .event-console-head small{font-size:.52rem;margin-left:2px}
 .event-row{grid-template-columns:23px 73px minmax(0,1fr) 30px;min-height:32px;gap:5px;padding:2px 4px;font-size:.56rem}
 .event-seq,.event-badge{font-size:.5rem}
 .event-actor{font-size:.57rem}
}

/* Two new control objects are created atomically; highlight their cards
   without adding misleading sequential arrows across the agent tree. */
.graph-node.is-created{border-color:var(--blue);box-shadow:0 0 19px color-mix(in srgb,var(--blue) 19%,transparent)}
.graph-node.is-created::before{content:"NEW";position:absolute;top:-9px;left:-7px;padding:2px 4px;border:1px solid var(--blue);border-radius:4px;background:var(--surface-2);font:750 .5rem ui-monospace,SFMono-Regular,Menlo,monospace;color:var(--blue)}

/* Recorded mode is intentionally visually distinct from narrated simulations.
   Its arrows are MODEL MAPPINGS from real event types, not captured tool calls. */
.trace-provenance{order:2;display:flex;align-items:center;gap:12px;flex-wrap:wrap;
  background:color-mix(in srgb,var(--blue) 6%,var(--surface-2));
  border-block:1px solid color-mix(in srgb,var(--blue) 24%,var(--line));
  padding:9px 18px;color:var(--muted);font-size:.67rem;line-height:1.4}
.trace-provenance[hidden]{display:none}
.trace-provenance strong{flex-shrink:0;color:var(--blue);
  font:750 .64rem ui-monospace,SFMono-Regular,Menlo,monospace}
html[data-playback-mode="recorded"] .storyboard{
  border-left:3px solid var(--blue)}
html[data-playback-mode="recorded"] .story-meta{
  color:var(--blue);overflow-wrap:anywhere}
html[data-playback-mode="recorded"] .event-console-head,
html[data-playback-mode="recorded"] .event-row.is-current .event-badge{color:var(--blue)}
html[data-playback-mode="recorded"] .event-console-head i{background:var(--blue);box-shadow:0 0 0 4px color-mix(in srgb,var(--blue) 12%,transparent)}
html[data-playback-mode="recorded"] .change-transition strong{color:var(--blue)}
html[data-playback-mode="recorded"] .phase-dot.done::before,
html[data-playback-mode="recorded"] .phase-dot.current::before{background:var(--blue)}
html[data-playback-mode="recorded"] .graph-link.is-current{stroke:var(--blue)}
html[data-playback-mode="recorded"] .graph-signal{fill:var(--blue)}
html[data-playback-mode="recorded"] .graph-node.is-active{border-color:var(--blue)}
html[data-playback-mode="recorded"] .scenario-tabs [data-scenario="recorded"][aria-selected="true"]{border-color:var(--blue)}
@media(max-width:620px){
 .trace-provenance{padding:8px 10px;gap:3px;font-size:.62rem}
 .trace-provenance strong{font-size:.56rem}
 html[data-playback-mode="recorded"] .demo-flag::after{content:"STORE TEST"}
}

.trace-provenance a{margin-left:auto;color:var(--blue);font:700 .63rem ui-monospace,SFMono-Regular,Menlo,monospace;white-space:nowrap;text-decoration:underline;text-underline-offset:3px}
@media(max-width:620px){.trace-provenance a{margin-top:3px;margin-left:0;font-size:.59rem}}

/* Explicit private-import action stays local to the visitor's browser; do
   not style it like a service connection or imply a live server feed. */
.scenario-tabs .trace-import-trigger{border:1px dashed color-mix(in srgb,var(--blue) 75%,var(--line));
  color:var(--blue);background:transparent}
.scenario-tabs .trace-import-trigger:hover{background:color-mix(in srgb,var(--blue) 9%,transparent)}
.scenario-tabs [data-scenario="private"][hidden],
[data-import-file][hidden],
.trace-provenance [hidden]{display:none!important}
.scenario-tabs [data-scenario="private"][aria-selected="true"]{border-color:var(--blue);color:var(--blue)}
.trace-import-status{align-self:center;color:var(--muted);font:600 .62rem ui-monospace,SFMono-Regular,Menlo,monospace}
.trace-import-status:empty{display:none}
.trace-provenance .trace-clear{border:1px solid var(--blue);border-radius:7px;padding:6px 8px;
  background:transparent;color:var(--blue);font:700 .6rem ui-monospace,SFMono-Regular,Menlo,monospace;cursor:pointer}
@media(max-width:620px){
  .scenario-tabs .trace-import-trigger{font-size:.61rem;padding:0 8px}
  .trace-import-status{width:100%;font-size:.56rem}
  html[data-playback-mode="recorded"] .demo-flag[data-imported="true"]::after{content:"LOCAL"}
}

/* Five scenarios + a local file picker must all be discoverable without
   horizontal scrolling on a phone; previous single-line tab strip hid
   Local trace and the Import action outside the viewport. */
@media(max-width:620px){
  .scenario-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));
    gap:5px;width:100%;overflow:visible;justify-content:stretch;flex-wrap:unset}
  .scenario-tabs button{min-width:0;min-height:36px;padding:4px 5px;
    white-space:normal;font-size:.61rem;line-height:1.15;overflow-wrap:anywhere}
  .scenario-tabs .trace-import-trigger{font-size:.6rem;padding:4px 5px}
  .scenario-tabs .trace-import-status{grid-column:1/-1}
}

@media(max-width:620px){
 html[data-playback-mode="recorded"] .stage{min-height:270px}
}
