:root { color-scheme: dark; --bg:#0c111b; --panel:#121b29; --line:#263447; --text:#e8eef6; --muted:#99acc3; --mint:#8cf0ce; --blue:#8dbbff; --orange:#ffbb88; }
* { box-sizing:border-box; }
body { margin:0; padding:25px 36px 18px; background:var(--bg); color:var(--text); font:14px/1.5 system-ui,sans-serif; }
button,input,select { font:inherit; }
button { border:1px solid #3b5069; border-radius:7px; padding:10px 15px; background:#1b2a3d; color:var(--text); cursor:pointer; white-space:nowrap; }
button:hover:not(:disabled) { background:#293e55; border-color:var(--mint); }
button:disabled { opacity:.4; cursor:default; }
:focus-visible { outline:2px solid var(--mint); outline-offset:3px; }
h1,h2,p { margin:0; }
h1 { font-size:clamp(26px,2.5vw,38px); letter-spacing:-1.3px; font-weight:650; line-height:1.2; margin-top:4px; }
h2 { font-size:16px; font-weight:600; }
.eyebrow { font-size:10px; letter-spacing:2px; color:var(--mint); font-weight:700; }
.title-dot { color:var(--mint); }
.masthead { display:flex; justify-content:space-between; align-items:center; margin-bottom:20px; }
.header-note { color:var(--text); text-align:right; font-size:13px; }
.header-note span { color:var(--muted); }
.toolbar { display:flex; gap:12px; align-items:flex-end; padding:14px 18px; border:1px solid var(--line); border-radius:10px; background:#111b29; }
.toolbar label { display:flex; flex-direction:column; gap:5px; color:var(--muted); font-size:11px; }
.toolbar label:first-child { flex:1; }
input,select { color:var(--text); background:#0c1522; border:1px solid #3b5069; border-radius:6px; padding:10px 12px; font-size:14px; width:100%; }
.primary { color:#09241d; background:var(--mint); border-color:var(--mint); font-weight:700; }
.primary:hover:not(:disabled) { background:#b8ffe7; }
.transport { display:flex; gap:6px; border-left:1px solid var(--line); padding-left:14px; }
#next { border-color:#598b7d; }
.session-bar { display:flex; gap:15px; justify-content:space-between; padding:11px 2px; font-size:11px; color:var(--muted); }
#status { color:#c7d8e9; }
#capture { white-space:nowrap; }
.workspace { display:grid; grid-template-columns:1.1fr 1fr; gap:14px; }
.panel { border:1px solid var(--line); border-radius:10px; background:var(--panel); overflow:hidden; min-width:0; }
.panel-heading { display:flex; justify-content:space-between; align-items:center; padding:13px 17px 6px; }
.panel-number { color:var(--mint); font:11px ui-monospace,monospace; margin-right:9px; }
.pill { font:10px ui-monospace,monospace; letter-spacing:.6px; border:1px solid #376b5f; color:var(--mint); padding:3px 7px; border-radius:4px; }
.pill.neutral { color:#acbfd7; border-color:#3b5069; }
.pill.error-pill { color:#ffb6a8; border-color:#a94f4f; }
.panel-caption { color:var(--muted); font-size:11px; padding:0 17px 10px; }
#stage-track { display:flex; gap:7px; margin:0 17px; }
#stage-track button { font:11px ui-monospace,monospace; padding:4px 0; width:28px; border-radius:5px; }
#stage-track button[aria-current] { background:var(--mint); border-color:var(--mint); color:#09241d; }
.diagram { position:relative; }
.diagram svg { display:block; width:100%; height:230px; }
.wire { fill:none; stroke-width:2; color:#3b5069; stroke:currentColor; }
.outbound { color:#436c83; }
.inbound { color:#397362; }
.wire-label { fill:var(--muted); font-size:9px; text-anchor:middle; font-family:ui-monospace,monospace; }
.node rect { fill:#182437; stroke:#3b5069; stroke-width:1; }
.node text { fill:var(--text); font-size:14px; text-anchor:middle; font-family:system-ui,sans-serif; }
.node text.node-sub { fill:var(--muted); font-size:10px; }
.node.active rect { fill:#173b36; stroke:var(--mint); stroke-width:2; }
#packet circle { fill:var(--mint); stroke:#0b2622; stroke-width:2; }
#packet path { fill:none; stroke:#143f34; stroke-width:1.3; }
#packet.error-packet circle { fill:#ffb6a8; }
.promise { position:absolute; left:5%; top:64%; width:27%; border:1px dashed #426452; padding:7px 6px; color:var(--mint); font:10px/1.3 ui-monospace,monospace; border-radius:5px; }
.promise-light { display:inline-block; width:5px; height:5px; border-radius:50%; background:var(--mint); margin-right:4px; }
.promise.pending .promise-light { animation:blink 1.2s ease-in-out infinite; }
.flow-foot { padding:0 17px 13px; display:flex; flex-direction:column; gap:3px; }
.flow-foot span:first-child { color:var(--mint); font-size:11px; }
.flow-foot span:last-child { color:var(--muted); font-size:10px; }
pre,code { font-family:ui-monospace,SFMono-Regular,Consolas,monospace; }
#code { position:relative; margin:0; padding:5px 0 12px; height:300px; overflow:auto; font-size:11px; line-height:1.85; color:#c4d4e8; scrollbar-color:#3b5069 transparent; }
.code-line { display:block; min-width:max-content; padding:0 18px 0 0; border-left:3px solid transparent; }
.code-line.active { background:#1c3a35; border-left-color:var(--mint); color:#dbfff1; }
.line-number { display:inline-block; width:42px; color:#8195ad; text-align:right; margin-right:15px; user-select:none; }
.response-panel,.logs-panel { height:232px; }
.request-meta { margin:0 17px; display:grid; gap:6px; }
.request-meta>div { display:flex; gap:8px; font-size:10px; }
.request-meta span { color:var(--mint); width:35px; flex-shrink:0; }
.request-meta code { overflow-wrap:anywhere; color:#c7d8e9; }
#response-body { white-space:pre-wrap; overflow-wrap:anywhere; font-size:11px; line-height:1.5; background:#0d1623; border-top:1px solid var(--line); margin:10px 0 0; padding:10px 17px; height:114px; overflow:auto; color:var(--blue); }
#logs { position:relative; padding:0 17px 10px; height:164px; overflow:auto; font-size:11px; }
.empty-log { color:var(--muted); padding-top:15px; }
.log-entry { padding:6px 0; border-bottom:1px solid #263447; }
.log-entry summary { color:#c4d4e8; cursor:pointer; }
.log-entry[open] summary { color:var(--mint); }
.log-entry pre { white-space:pre-wrap; overflow-wrap:anywhere; font-size:11px; margin:6px 0 0 10px; color:var(--blue); }
.log-error summary,.log-error pre { color:#ffb6a8!important; }
.lesson-strip { margin-top:14px; display:grid; grid-template-columns:1fr 270px; gap:24px; padding:16px 20px; border:1px solid #376b5f; border-radius:10px; background:#10251f; }
.lesson-strip h2 { font-size:21px; margin:2px 0 4px; letter-spacing:-.4px; }
.lesson-strip p { color:#b9cfc7; font-size:12px; max-width:900px; }
.result-card { border-left:1px solid #376b5f; padding-left:20px; display:flex; flex-direction:column; justify-content:center; min-width:0; }
.result-card p { font-size:18px; color:#e2fff2; margin-top:4px; overflow-wrap:anywhere; }
.debug-section { margin-top:20px; display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px; border-top:1px solid var(--line); padding-top:17px; }
.debug-section p { color:var(--muted); font-size:12px; margin-top:3px; }
#debug-example { flex-basis:100%; padding:16px; background:#182437; border:1px solid var(--line); border-radius:8px; }
.debug-grid { display:grid; grid-template-columns:1fr 1fr; gap:15px; margin-top:12px; }
.debug-grid code { color:var(--orange); }
.debug-grid pre { padding:10px; background:#0c1522; overflow-wrap:anywhere; white-space:pre-wrap; }
.page-note { font-size:10px; color:var(--muted); padding-top:14px; }
a { color:var(--mint); }
@keyframes blink { 50% { opacity:.3; } }
@media (min-width:1500px) { body { max-width:1800px; margin:auto; } #code { font-size:13px; } #logs,.log-entry pre,#response-body { font-size:12px; } .panel-caption,.session-bar { font-size:12px; } }
@media (max-width:1050px) { body { padding:20px; } .toolbar { flex-wrap:wrap; } .toolbar label:first-child { flex-basis:40%; } .transport { margin-left:auto; } .lesson-strip { grid-template-columns:1fr 200px; } }
@media (max-width:720px) { body { padding:16px; } .header-note { display:none; } .toolbar label:first-child { flex-basis:100%; } .toolbar label:nth-child(2) { flex:1; } .transport { width:100%; border:0; padding:0; } .workspace { grid-template-columns:1fr; } .session-bar { flex-direction:column; gap:3px; } .lesson-strip { grid-template-columns:1fr; } .result-card { border-left:0; border-top:1px solid #376b5f; padding:10px 0 0; } .debug-grid { grid-template-columns:1fr; } }
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { animation:none!important; transition:none!important; scroll-behavior:auto!important; } }
@media (min-width:1060px) {
  body { padding-top:18px; }
  .masthead { margin-bottom:14px; }
  .toolbar { padding:10px 15px; }
  .workspace { grid-template-rows:clamp(270px,34vh,360px) clamp(190px,23vh,240px); }
  .response-panel,.logs-panel { height:auto; }
  #code { height:calc(100% - 70px); }
  .diagram svg { height:clamp(160px,21vh,225px); }
  .panel-caption { padding-bottom:7px; }
  #logs { height:calc(100% - 75px); }
  #response-body { height:calc(100% - 123px); }
  .lesson-strip { padding:12px 17px; }
  .lesson-strip h2 { font-size:19px; }
  .debug-section { margin-top:14px; padding-top:12px; }
}
/* Keep every flow caption inside its panel at presentation sizes. */
.flow-panel { display:flex; flex-direction:column; }
.flow-panel .panel-heading,.flow-panel .panel-caption,.flow-panel nav,.flow-foot { flex-shrink:0; }
.flow-panel .diagram { flex:1; min-height:0; }
.flow-panel .diagram svg { height:100%; min-height:145px; }
.node text { font-size:17px; }
.node text.node-sub { font-size:12px; }
@media (min-width:1060px) {
  .workspace { grid-template-rows:clamp(290px,36vh,380px) clamp(180px,21vh,225px); }
  #code { font-size:12px; }
}
