@font-face { font-family: 'Golos Text'; src: url('/fonts/golos-text.ttf') format('truetype'); font-weight: 400 900; font-display: swap; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
:root { font-family: 'Golos Text', system-ui, sans-serif; font-synthesis: none; }
body {
  --page: #e9edf1; --ink: #1d2833; --muted: #526170; --line: #cbd4dc;
  --canvas: #f1f4f7; --node: #fbfcfe; --field: #fbfcfe; --paper: #fff;
  --accent: #305d9b; --accent-wash: #e0e9f4; --button: #293b4b; --button-top: #435969; --button-text: #fff;
  --rim: rgb(255 255 255 / .92); --low-rim: rgb(63 89 110 / .18); --shadow: 31 48 65;
  --coat: rgb(248 252 255 / .38); --blur: 10px; --saturation: 140%; --bevel: 1px;
  --reflection: rgb(255 255 255 / .28); --duration: 190ms; --travel: 12px;
  margin: 0; color: var(--ink); background: var(--page); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; color-scheme: light;
}
body[data-theme='dark'] {
  --page: #151e27; --ink: #ecf2f8; --muted: #b1bfcd; --line: #3f5263;
  --canvas: #1c2935; --node: #283947; --field: #253543; --paper: #23313d;
  --accent: #b0d1ff; --accent-wash: #334c66; --button: #cbdae7; --button-top: #e5eff7; --button-text: #1d2c3a;
  --rim: rgb(223 242 255 / .42); --low-rim: rgb(6 16 24 / .65); --shadow: 0 7 13;
  --coat: rgb(30 47 63 / .42); --reflection: rgb(191 224 255 / .12);
  color-scheme: dark;
}
body[data-material='matte'] { --coat: rgb(248 251 254 / .78); --blur: 24px; --saturation: 125%; --bevel: 0px; --reflection: transparent; --rim: rgb(255 255 255 / .94); --low-rim: transparent; }
body[data-material='edge'] { --coat: rgb(246 251 255 / .68); --blur: 22px; --saturation: 145%; --bevel: 2px; --reflection: rgb(255 255 255 / .45); }
body[data-theme='dark'][data-material='matte'] { --coat: rgb(32 45 58 / .83); --rim: rgb(214 233 250 / .10); }
body[data-theme='dark'][data-material='edge'] { --coat: rgb(31 48 64 / .76); --reflection: rgb(207 234 255 / .20); --rim: rgb(218 240 255 / .60); }
body[data-motion='smooth'] { --duration: 300ms; --travel: 20px; }
body[data-motion='none'] { --duration: 0ms; --travel: 0px; }
button, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; color: inherit; }
button:disabled { cursor: wait; opacity: .7; }
button:focus-visible, a:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button { touch-action: manipulation; }
button .icon { flex: 0 0 auto; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
code { font: 12px ui-monospace, 'SFMono-Regular', Consolas, monospace; }
main { max-width: 1344px; padding: 32px 36px 20px; margin: auto; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; font-weight: 550; letter-spacing: -.035em; }
h2 { font-size: 17px; font-weight: 550; letter-spacing: -.02em; }
.lab-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.lab-title { display: flex; gap: 12px; align-items: center; }
.lab-title > .icon { width: 23px; height: 23px; }
.lab-title > span { color: var(--muted); margin-left: 6px; font-size: 12px; }
.intro { color: var(--muted); margin: 12px 0 24px; max-width: 75ch; }
.segmented { display: inline-flex; gap: 3px; padding: 3px; background: rgb(var(--shadow) / .045); border: 1px solid var(--line); border-radius: 9px; }
.segmented button { min-height: 36px; padding: 7px 12px; border-radius: 6px; border: 0; background: transparent; color: var(--muted); font-size: 13px; }
.segmented button[aria-pressed='true'] { background: var(--field); color: var(--ink); box-shadow: 0 1px 3px rgb(var(--shadow) / .12); }
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; position: sticky; top: 8px; z-index: 10; background: var(--page); border-radius: 10px; }
.choices button { display: flex; align-items: center; text-align: left; gap: 14px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 10px; background: transparent; min-height: 72px; }
.choices button[aria-pressed='true'] { background: var(--field); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 3px 8px rgb(var(--shadow) / .07); }
.choices strong { display: block; font-weight: 550; }
.choices small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.choice-letter { font-size: 13px; color: var(--muted); }
.choices button[aria-pressed='true'] .choice-letter { color: var(--accent); }

/* One optical layer. No opacity/filter on its ancestors: the backdrop is real
   graph content, not a duplicated or prerendered texture. */
.optical {
  position: relative; background: var(--coat); border: 1px solid var(--rim);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--saturation));
  backdrop-filter: blur(var(--blur)) saturate(var(--saturation));
  box-shadow: inset 0 1px 0 var(--rim), inset 0 -1px 0 var(--low-rim), 0 12px 30px -12px rgb(var(--shadow) / .27), 0 2px 5px rgb(var(--shadow) / .06);
}
.optical::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: linear-gradient(123deg, var(--reflection), transparent 32%, transparent 72%, rgb(var(--shadow) / .035)); }
.optical::after { content: ''; position: absolute; inset: var(--bevel); border: 1px solid var(--reflection); border-radius: inherit; pointer-events: none; }
.optical > * { position: relative; }
body[data-material='matte'] .optical { border-color: rgb(255 255 255 / .86); box-shadow: 0 4px 14px rgb(var(--shadow) / .06), inset 0 1px 0 var(--rim); }
body[data-theme='dark'][data-material='matte'] .optical { border-color: rgb(190 212 235 / .13); }

.stage { height: 620px; position: relative; overflow: hidden; border-radius: 18px; border: 1px solid var(--line); background: var(--canvas); }
.stage-head { position: absolute; z-index: 4; inset: 12px 12px auto; padding: 14px 18px; border-radius: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.workflow-name { display: flex; align-items: center; gap: 12px; font-size: 16px; letter-spacing: -.02em; }
.workflow-name strong { font-weight: 550; }
.stage-actions { display: flex; gap: 8px; }
.stage-actions button, .graph-tools button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; border: 1px solid var(--line); padding: 6px 10px; border-radius: 7px; background: transparent; font-size: 12px; }
.stage-actions button[aria-expanded='true'] { background: var(--field); }
.viewport { position: absolute; inset: 0; overflow: hidden; touch-action: pan-y; cursor: grab; }
.viewport.dragging { cursor: grabbing; }
.canvas { position: absolute; width: 1140px; height: 620px; transform-origin: 0 0; }
.connectors { position: absolute; inset: 0; width: 1140px; height: 620px; fill: none; stroke: var(--line); stroke-width: 1.5; }
.node { position: absolute; width: 196px; height: 110px; border: 1px solid var(--line); border-radius: 10px; background: var(--node); padding: 15px 16px; text-align: left; box-shadow: 0 2px 3px rgb(var(--shadow) / .04); display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.node:nth-of-type(1) { left: 42px; top: 88px; }
.node:nth-of-type(2) { left: 302px; top: 88px; }
.node:nth-of-type(3) { left: 562px; top: 88px; }
.node:nth-of-type(4) { left: 822px; top: 88px; }
.node:nth-of-type(5) { left: 562px; top: 324px; }
.node:nth-of-type(6) { left: 822px; top: 324px; }
.node.selected { border-color: var(--accent); background: var(--accent-wash); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 16%, transparent); }
.node strong { font-weight: 550; font-size: 13px; }
.node-kind { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; }
.node-kind .icon { width: 16px; height: 16px; }
.node .state { margin-top: auto; font-size: 11px; }
.branch-caption { position: absolute; top: 59px; left: 824px; font-size: 12px; color: var(--muted); }
.branch-caption.social { left: 565px; top: 293px; }
.graph-tools { position: absolute; z-index: 2; bottom: 16px; left: 16px; display: flex; gap: 4px; padding: 4px; border-radius: 9px; }
.graph-tools button { border: 0; }
.graph-tools button:hover { background: var(--field); }

.inspector { position: absolute; z-index: 3; width: 348px; right: 18px; top: 108px; bottom: 18px; border-radius: 16px; display: flex; flex-direction: column; }
.inspector-head { display: flex; align-items: center; gap: 10px; padding: 19px 18px 14px 22px; }
.inspector-head > div { display: flex; gap: 10px; align-items: center; }
.inspector-head h2 { font-size: 15px; }
.icon-button { display: inline-grid; place-items: center; flex: 0 0 auto; border: 0; width: 36px; height: 36px; border-radius: 7px; background: transparent; color: var(--muted); }
.icon-button:hover { background: var(--field); color: var(--ink); }
.inspector-head > button { margin-left: auto; }
.inspector-scroll { padding: 8px 22px 22px; overflow: auto; flex: 1; }
.inspector dl { margin: 26px 0; }
.inspector dl > div { margin-top: 18px; }
.inspector dt { color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.inspector dd { margin: 0; font-size: 14px; font-weight: 450; }
.read-button { display: flex; align-items: center; gap: 9px; min-height: 44px; width: 100%; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--field); font-size: 13px; padding: 10px 12px; text-align: left; }
.read-button > .icon:last-child { margin-left: auto; }
.inspector-footer { border-top: 1px solid var(--line); padding: 16px 22px; }
.primary { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 42px; border: 1px solid var(--low-rim); border-radius: 8px; background: var(--button) linear-gradient(var(--button-top), var(--button)); box-shadow: inset 0 1px 0 rgb(255 255 255 / .22), 0 1px 3px rgb(var(--shadow) / .08); color: var(--button-text); padding: 10px 15px; font-size: 13px; font-weight: 500; }
.inspector-footer .primary { width: 100%; }

.history { position: absolute; top: 88px; right: 18px; width: 348px; border-radius: 14px; z-index: 5; padding: 18px; }
.popover-head { display: flex; align-items: center; justify-content: space-between; padding: 0 0 10px; }
.popover-head h2 { font-size: 14px; }
.history ol { list-style: none; padding: 0; margin: 0; }
.history li { padding: 13px 3px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 7px 10px; font-size: 12px; }
.history li > span:last-child { grid-column: 1 / -1; color: var(--muted); }
.history time { color: var(--muted); font-size: 11px; align-self: center; }

/* Light is local to an indicator: a 5px source and a 7px diffuse halo.
   The optional edge reflection occupies 32px, never the whole card. */
[data-state='done'] { --signal: #21734f; --signal-core: #6cebb0; --signal-rgb: 55 191 127; }
[data-state='running'] { --signal: #2f65af; --signal-core: #83baff; --signal-rgb: 60 133 244; }
[data-state='review'] { --signal: #805718; --signal-core: #ffd08b; --signal-rgb: 234 163 55; }
[data-state='error'] { --signal: #b3423a; --signal-core: #ffaaa0; --signal-rgb: 231 94 82; }
[data-state='pending'] { --signal: #5c6e80; --signal-core: #b5c2cd; --signal-rgb: 126 148 165; }
body[data-theme='dark'] [data-state='done'] { --signal: #93e5bd; }
body[data-theme='dark'] [data-state='running'] { --signal: #a6caff; }
body[data-theme='dark'] [data-state='review'] { --signal: #f3ca8f; }
body[data-theme='dark'] [data-state='error'] { --signal: #ffb3a9; }
body[data-theme='dark'] [data-state='pending'] { --signal: #b0bfce; }
.state { display: inline-flex; align-items: center; gap: 9px; color: var(--signal); font-size: 12px; font-weight: 500; }
.lamp { position: relative; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--signal); flex: 0 0 auto; }
body:not([data-light='none']) .lamp { background: radial-gradient(circle at 35% 25%, var(--signal-core), var(--signal) 80%); box-shadow: 0 0 0 2px rgb(var(--signal-rgb) / .08), 0 0 7px 1px rgb(var(--signal-rgb) / .38); }
body[data-theme='dark']:not([data-light='none']) .lamp { box-shadow: 0 0 0 2px rgb(var(--signal-rgb) / .07), 0 0 7px 1px rgb(var(--signal-rgb) / .54); }
.status-plate { padding: 8px 11px; border: 1px solid rgb(var(--signal-rgb) / .25); background: rgb(var(--signal-rgb) / .065); border-radius: 7px; }
body[data-light='edge'] .inspector::after, body[data-light='edge'] .status-sample::after { background: linear-gradient(90deg, transparent, rgb(var(--signal-rgb) / .7), transparent) no-repeat 22px 0 / 36px 1px; box-shadow: inset 0 2px 8px -6px rgb(var(--signal-rgb) / .6); }
body[data-light='edge'] .node::after { content: ''; position: absolute; top: -1px; left: 19px; width: 32px; height: 2px; background: var(--signal-core); border-radius: 50%; box-shadow: 0 0 6px 1px rgb(var(--signal-rgb) / .35); }
body [data-state='pending'] .lamp { box-shadow: none !important; background: var(--signal); }
body[data-light='edge'] .node[data-state='pending']::after { display: none; }

.tuning { margin-top: 26px; }
.tuning-heading { display: flex; align-items: baseline; gap: 18px; margin-bottom: 12px; }
.tuning-heading p, .muted { font-size: 12px; color: var(--muted); }
.status-samples { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.status-sample { min-height: 58px; border-radius: 10px; text-align: left; padding: 14px 18px; }
.status-sample[aria-pressed='true'] { outline: 1px solid var(--signal); outline-offset: 3px; }
.tuning-controls { display: flex; gap: 40px; flex-wrap: wrap; margin-top: 24px; }
.tuning-controls label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.muted { margin-top: 12px; }
.feedback { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--line); }
.feedback > div:first-child { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; }
.feedback p { color: var(--muted); font-size: 12px; }
.feedback > label { display: block; color: var(--muted); font-size: 13px; margin: 18px 0 8px; }
.feedback textarea { width: 100%; max-width: 850px; padding: 12px 14px; background: var(--field); color: var(--ink); border: 1px solid var(--line); border-radius: 9px; resize: vertical; font-size: 14px; line-height: 1.6; display: block; }
.feedback textarea::placeholder { color: var(--muted); opacity: .85; }
.feedback-actions { display: flex; align-items: center; gap: 16px; margin-top: 14px; }
.feedback-actions > span { max-width: 48ch; font-size: 12px; color: var(--muted); }
#copy-fallback { margin-top: 14px; }
.lab-footer { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 20px; font-size: 12px; color: var(--muted); }
.lab-footer a { color: var(--muted); text-decoration: none; min-height: 36px; display: flex; align-items: center; gap: 6px; }
.lab-footer .icon { width: 14px; height: 14px; }

.reader { padding: 8px; width: min(760px, calc(100vw - 32px)); max-height: min(90dvh, 880px); border-radius: 18px; color: var(--ink); }
.reader::backdrop { background: rgb(15 28 41 / .22); }
.reader header { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px 12px; font-size: 13px; }
.reader article { background: var(--paper); padding: 32px 40px; border-radius: 11px; color: var(--ink); }
.reader article h2 { font-size: 28px; line-height: 1.25; letter-spacing: -.035em; margin-bottom: 24px; }
.reader article h3 { font-size: 18px; font-weight: 550; margin: 24px 0 10px; }
.reader article p { font-size: 16px; line-height: 1.75; margin-top: 14px; }
.reader article .article-kicker { margin: 0 0 16px; font-size: 12px; color: var(--muted); }

.entering { animation: enter var(--duration) cubic-bezier(.2,.8,.25,1) both; }
.leaving { animation: enter calc(var(--duration) * .7) ease-in reverse both; }
.history.entering { animation-name: drop; }
.history.leaving { animation-name: drop; }
.reader.entering { animation-name: rise; }
.reader.leaving { animation-name: rise; }
@keyframes enter { from { transform: translateX(var(--travel)); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes drop { from { transform: translateY(calc(var(--travel) * -.5)); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes rise { from { transform: translateY(var(--travel)) scale(.992); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
.canvas.moving { transition: transform 420ms cubic-bezier(.2,.8,.25,1); }
@media (max-width: 760px) {
  main { padding: 20px 14px 16px; }
  h1 { font-size: 20px; }
  .lab-header { flex-wrap: wrap; gap: 12px; }
  .lab-title > span { display: none; }
  .theme-switch { margin-left: auto; }
  .theme-switch button { padding: 6px 9px; font-size: 12px; }
  .intro { margin: 12px 0 18px; font-size: 13px; }
  .choices { gap: 8px; }
  .choices button { padding: 10px; flex-direction: column; align-items: flex-start; gap: 5px; min-height: 64px; }
  .choices strong { font-size: 12px; }
  .choices small { display: none; }
  .choice-letter { font-size: 11px; }
  .stage { height: 650px; }
  .stage-head { inset: 9px 9px auto; flex-direction: column; align-items: stretch; gap: 12px; padding: 13px; }
  .workflow-name { font-size: 14px; }
  .stage-actions { gap: 8px; }
  .stage-actions button { flex: 1; min-height: 36px; }
  .inspector { inset: auto 10px 10px; width: auto; height: 380px; }
  .inspector-head { padding: 12px 12px 8px 18px; }
  .inspector-scroll { padding: 5px 18px 16px; }
  .inspector dl { margin: 16px 0; }
  .inspector dl > div { margin-top: 12px; }
  .inspector-footer { padding: 12px 18px; }
  .graph-tools { bottom: auto; top: 210px; left: 12px; }
  .stage:not(:has(.inspector:not([hidden]))) .graph-tools { top: auto; bottom: 12px; }
  .history { top: 126px; right: 10px; left: 10px; width: auto; }
  .status-samples { grid-template-columns: 1fr 1fr; gap: 12px; }
  .status-sample { min-height: 54px; padding: 13px 16px; }
  .tuning-heading { display: block; }
  .tuning-heading p { margin-top: 6px; }
  .tuning-controls { gap: 18px; }
  .tuning-controls > div { flex: 1 1 250px; }
  .tuning-controls .segmented { display: flex; }
  .tuning-controls .segmented button { flex: 1; min-height: 40px; }
  .feedback > div:first-child { display: block; }
  .feedback p { margin-top: 6px; }
  .feedback textarea { font-size: 16px; }
  .feedback-actions { align-items: stretch; flex-direction: column; gap: 10px; }
  .feedback-actions .primary { align-self: flex-start; }
  .lab-footer { align-items: flex-start; gap: 12px; flex-direction: column; }
  .reader { width: calc(100vw - 20px); max-height: 92dvh; padding: 6px; }
  .reader article { padding: 24px 20px; }
  .reader article h2 { font-size: 25px; }
  .inspector.entering, .inspector.leaving { animation-name: rise; }
}
@media (prefers-reduced-motion: reduce) { .entering, .leaving { animation: none; } .canvas.moving { transition: none; } }
body[data-motion='none'] .canvas.moving { transition: none; }
@media (prefers-reduced-transparency: reduce) { .optical { background: var(--field); -webkit-backdrop-filter: none; backdrop-filter: none; } }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .optical { background: var(--field); } }
