:root {
  color-scheme: dark;
  --bg: #07111b;
  --panel: #0b1722;
  --panel-2: #0f1e2b;
  --line: rgba(162, 192, 205, .12);
  --line-strong: rgba(162, 192, 205, .22);
  --text: #e8f2f3;
  --muted: #8da4ae;
  --quiet: #5f7782;
  --accent: #61e3d0;
  --accent-dim: #2ca99e;
  --accent-glow: rgba(97, 227, 208, .16);
  --amber: #e8bd79;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; min-height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); }
body { min-height: 100vh; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(ellipse at 20% 0%, rgba(29, 76, 85, .15), transparent 36%), var(--bg); }
.topbar { height: 72px; flex: 0 0 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 26px; border-bottom: 1px solid var(--line); background: rgba(7, 17, 27, .96); position: relative; z-index: 2; }
.identity { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-glyph { width: 32px; height: 32px; border: 1px solid rgba(97, 227, 208, .35); border-radius: 10px; display: flex; align-items: center; justify-content: center; gap: 3px; background: rgba(97, 227, 208, .07); transform: rotate(-8deg); }
.brand-glyph span { width: 3px; border-radius: 3px; background: var(--accent); display: block; }
.brand-glyph span:nth-child(1) { height: 9px; opacity: .5; }
.brand-glyph span:nth-child(2) { height: 16px; }
.brand-glyph span:nth-child(3) { height: 11px; opacity: .72; }
.heading-group { min-width: 0; }
.eyebrow { margin: 0 0 4px; color: #77929d; font-size: 9px; letter-spacing: .18em; font-weight: 700; }
.eyebrow span { color: var(--accent-dim); padding: 0 3px; }
h1 { margin: 0; font-size: 18px; line-height: 1.1; font-weight: 650; letter-spacing: -.025em; }
.top-actions { display: flex; align-items: center; gap: 20px; }
.run-state { display: flex; align-items: center; gap: 8px; color: #8fb8b4; font-size: 9px; letter-spacing: .14em; font-weight: 700; }
.run-state i { width: 6px; height: 6px; display: block; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.run-state.paused i { background: var(--amber); box-shadow: 0 0 10px rgba(232,189,121,.5); }
.run-state.paused { color: #b8a17e; }
.icon-button { height: 34px; padding: 0 11px; border: 1px solid var(--line-strong); background: rgba(255,255,255,.025); border-radius: 7px; display: inline-flex; align-items: center; gap: 8px; color: #b7c9ce; font-size: 11px; cursor: pointer; transition: border-color .2s, background .2s, color .2s; }
.icon-button:hover { border-color: rgba(97,227,208,.5); background: rgba(97,227,208,.07); color: var(--text); }
.icon-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 374px; flex: 1; min-height: 0; }
.stage-column { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #081520; border-right: 1px solid var(--line); }
.stage-toolbar { height: 42px; flex: 0 0 42px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.012); }
.section-kicker { color: #8ba1ab; font-size: 9px; font-weight: 700; letter-spacing: .16em; }
.section-kicker b { color: var(--accent-dim); margin: 0 4px; }
.legend { display: flex; align-items: center; gap: 17px; color: #8197a1; font-size: 9px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 7px; height: 7px; display: inline-block; border-radius: 50%; }
.legend-bell { background: #b4e6de; box-shadow: 0 0 8px rgba(180,230,222,.4); }
.legend-ring { background: var(--accent); box-shadow: 0 0 8px rgba(97,227,208,.7); }
.legend-tracer { background: #7b9eae; }
.canvas-frame { position: relative; flex: 1; min-height: 0; overflow: hidden; background: radial-gradient(ellipse at 50% 40%, #102b38 0%, #0a1b28 42%, #08141f 100%); }
#flowCanvas { display: block; width: 100%; height: 100%; touch-action: pan-y; }
.canvas-label { position: absolute; top: 17px; color: rgba(168,194,201,.56); font-size: 8px; font-weight: 700; letter-spacing: .14em; pointer-events: none; }
.label-top-left { left: 20px; display: flex; align-items: center; gap: 7px; }
.label-top-left b { color: #53717d; }
.tiny-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 7px var(--accent); }
.label-top-right { right: 20px; }
.label-top-right strong { color: var(--accent); font-size: 10px; margin-left: 5px; }
.canvas-caption { position: absolute; left: 22px; bottom: 22px; max-width: min(480px, 72%); padding: 12px 15px 13px; border: 1px solid rgba(143,190,197,.15); border-left: 2px solid rgba(97,227,208,.75); border-radius: 0 7px 7px 0; background: rgba(6,17,26,.72); backdrop-filter: blur(9px); pointer-events: none; }
.caption-overline { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; color: var(--accent); font-size: 8px; font-weight: 750; letter-spacing: .16em; }
.caption-pulse { width: 5px; height: 5px; background: var(--accent); border-radius: 50%; }
.canvas-caption p { margin: 0; color: #b9cbd0; font-size: 11px; line-height: 1.55; }
.canvas-watermark { position: absolute; right: 19px; bottom: 19px; color: rgba(137,163,173,.32); font-size: 8px; font-weight: 700; letter-spacing: .18em; pointer-events: none; }
.canvas-watermark span { color: var(--accent-dim); padding: 0 3px; }
.transport-bar { height: 58px; flex: 0 0 58px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; border-top: 1px solid var(--line); background: #091722; }
.transport-controls { display: flex; align-items: center; gap: 7px; }
.transport-button { height: 32px; min-width: 66px; padding: 0 11px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line-strong); border-radius: 6px; background: rgba(255,255,255,.025); color: #a9bdc4; font-size: 10px; cursor: pointer; transition: .18s ease; }
.transport-button:hover { border-color: rgba(97,227,208,.48); color: var(--text); background: rgba(97,227,208,.06); }
.transport-button.primary { background: rgba(97,227,208,.13); border-color: rgba(97,227,208,.42); color: #9cf2e6; min-width: 82px; }
.transport-button.primary:hover { background: rgba(97,227,208,.2); }
.transport-button svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.transport-button.icon-only { min-width: 34px; padding: 0; }
.time-readout { display: flex; align-items: baseline; gap: 12px; }
.time-readout span { color: #647f8b; font-size: 8px; letter-spacing: .14em; font-weight: 700; }
.time-readout strong { color: #d5e6e7; font-size: 13px; font-variant-numeric: tabular-nums; font-weight: 600; }
.time-readout small { color: #78919b; font-size: 9px; font-weight: 500; }
.control-panel { min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 22px 20px 15px; background: linear-gradient(180deg, #0b1722 0%, #0a1620 100%); scrollbar-width: thin; scrollbar-color: #28424d transparent; }
.control-panel::-webkit-scrollbar { width: 5px; }
.control-panel::-webkit-scrollbar-thumb { background: #28424d; border-radius: 6px; }
.panel-heading { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; }
.panel-heading .eyebrow { margin-bottom: 5px; }
h2 { margin: 0; font-size: 18px; line-height: 1.15; font-weight: 620; letter-spacing: -.025em; }
.panel-index { color: #58717d; font-size: 8px; font-weight: 700; letter-spacing: .15em; padding-bottom: 2px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.section-heading h3 { margin: 0; color: #cbd9dc; font-size: 11px; font-weight: 620; letter-spacing: .01em; }
.section-heading > span { color: #59737e; font-size: 7px; font-weight: 750; letter-spacing: .16em; }
.preset-section { margin-bottom: 19px; }
.preset-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.preset-button { min-width: 0; min-height: 54px; display: flex; align-items: center; gap: 9px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.018); text-align: left; cursor: pointer; transition: border-color .2s, background .2s; }
.preset-button:hover { border-color: rgba(97,227,208,.32); }
.preset-button.active { border-color: rgba(97,227,208,.52); background: rgba(97,227,208,.065); }
.preset-button b { display: block; color: #c9d8db; font-size: 9px; font-weight: 650; margin-bottom: 3px; white-space: nowrap; }
.preset-button small { display: block; color: #718a94; font-size: 8px; white-space: nowrap; }
.preset-mark { flex: 0 0 23px; height: 23px; display: block; border-radius: 50%; border: 1px solid rgba(97,227,208,.4); position: relative; }
.preset-mark:before, .preset-mark:after { content: ""; position: absolute; border: 1px solid var(--accent); border-radius: 50%; opacity: .8; }
.short-mark:before { width: 10px; height: 5px; left: 5px; top: 8px; }
.short-mark:after { width: 5px; height: 2px; left: 8px; top: 10px; opacity: .35; }
.formed-mark:before { width: 14px; height: 8px; left: 3px; top: 6px; box-shadow: 0 0 7px rgba(97,227,208,.4); }
.formed-mark:after { width: 8px; height: 4px; left: 6px; top: 8px; background: rgba(97,227,208,.14); }
.control-section { padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.slider-control { margin-bottom: 12px; }
.slider-control.last-slider { margin-bottom: 13px; }
.slider-control.cycle-control { margin-bottom: 0; }
.slider-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.slider-label label { color: #aebfc4; font-size: 10px; font-weight: 550; }
.slider-label output { color: var(--accent); font-size: 10px; font-weight: 650; font-variant-numeric: tabular-nums; }
.slider-label output em { color: #65847f; font-size: 7px; font-style: normal; font-weight: 600; letter-spacing: .04em; margin-left: 2px; }
input[type="range"] { display: block; width: 100%; height: 14px; margin: 0; background: transparent; appearance: none; -webkit-appearance: none; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, var(--accent-dim) var(--range-progress, 50%), rgba(119,151,160,.22) var(--range-progress, 50%)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, var(--accent-dim) var(--range-progress, 50%), rgba(119,151,160,.22) var(--range-progress, 50%)); }
input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 11px; height: 11px; margin-top: -4px; border: 2px solid #a7fff0; border-radius: 50%; background: #1c756f; box-shadow: 0 0 0 3px rgba(97,227,208,.10), 0 0 9px rgba(97,227,208,.4); }
input[type="range"]::-moz-range-thumb { width: 8px; height: 8px; border: 2px solid #a7fff0; border-radius: 50%; background: #1c756f; box-shadow: 0 0 0 3px rgba(97,227,208,.10), 0 0 9px rgba(97,227,208,.4); }
.range-ends { display: flex; justify-content: space-between; color: #526b76; font-size: 8px; margin-top: 1px; gap: 5px; }
.range-ends span:last-child { text-align: right; }
.readout-section { padding: 16px 0 14px; border-bottom: 1px solid var(--line); }
.readout-section .section-heading { margin-bottom: 10px; }
.readout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.readout-card { min-height: 62px; padding: 9px 10px 8px; border: 1px solid rgba(153,188,195,.10); border-radius: 6px; background: rgba(255,255,255,.022); }
.readout-card > span { display: flex; align-items: center; gap: 5px; color: #708892; font-size: 7px; font-weight: 750; letter-spacing: .12em; }
.readout-card > span i { width: 11px; height: 11px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid #506c76; border-radius: 50%; color: #77949c; font-size: 7px; font-style: normal; letter-spacing: 0; cursor: help; }
.readout-card strong { display: block; margin-top: 5px; color: #e1efef; font-size: 18px; line-height: 1; font-weight: 570; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.readout-card > small { display: block; margin-top: 4px; color: #637c86; font-size: 8px; }
.readout-card.wide-readout { grid-column: 1 / -1; min-height: 57px; display: grid; grid-template-columns: 1fr auto; align-items: center; }
.wide-readout > span { grid-column: 1; grid-row: 1; }
.wide-readout strong { grid-column: 2; grid-row: 1 / span 2; margin: 0; color: var(--accent); font-size: 19px; }
.wide-readout strong small { color: #86b8b3; font-size: 9px; font-weight: 500; }
.wide-readout > small { grid-column: 1; grid-row: 2; }
.check-section { padding: 14px 0 13px; border-bottom: 1px solid var(--line); }
.check-top { display: flex; align-items: center; justify-content: space-between; }
.check-top > div { display: flex; align-items: center; gap: 7px; }
.check-icon { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border: 1px solid rgba(97,227,208,.4); border-radius: 50%; color: var(--accent); font-size: 10px; }
.check-top h3 { margin: 0; color: #cbd9dc; font-size: 10px; font-weight: 620; }
.check-type { color: #5f7d84; font-size: 7px; font-weight: 750; letter-spacing: .13em; }
.check-section > p { margin: 7px 0 9px; color: #7f969e; font-size: 9px; line-height: 1.45; }
.check-values { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 5px; }
.check-values > div { padding: 7px 7px 6px; border: 1px solid rgba(153,188,195,.09); border-radius: 5px; background: rgba(255,255,255,.016); }
.check-values span { display: block; color: #617b85; font-size: 7px; letter-spacing: .1em; font-weight: 750; }
.check-values strong { display: block; margin-top: 4px; color: #c9dcde; font-size: 11px; font-weight: 620; font-variant-numeric: tabular-nums; }
.check-values strong small { color: #7b969d; font-size: 8px; font-weight: 500; }
.check-values .check-diff strong { color: var(--accent); }
.check-note { margin-top: 7px; color: #617983; font-size: 8px; line-height: 1.45; }
.quality-section { display: flex; align-items: center; justify-content: space-between; padding: 13px 0 12px; border-bottom: 1px solid var(--line); }
.quality-label span { display: block; color: #8da5ac; font-size: 8px; font-weight: 750; letter-spacing: .12em; }
.quality-label small { display: block; color: #5e7780; font-size: 8px; margin-top: 4px; }
.quality-switch { display: flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 6px; background: rgba(0,0,0,.12); }
.quality-switch button { min-width: 43px; padding: 5px 8px; border: 0; border-radius: 4px; background: transparent; color: #77909a; font-size: 8px; cursor: pointer; }
.quality-switch button.selected { background: rgba(97,227,208,.13); color: #a1e9df; }
.science-panel { border-bottom: 1px solid var(--line); }
.science-panel summary { min-height: 43px; display: flex; align-items: center; justify-content: space-between; color: #c2d2d5; font-size: 10px; cursor: pointer; list-style: none; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary b { color: var(--accent); font-size: 8px; letter-spacing: .12em; margin-right: 8px; }
.summary-plus { color: var(--accent); font-size: 17px; font-weight: 300; transition: transform .2s; }
.science-panel[open] .summary-plus { transform: rotate(45deg); }
.science-content { padding: 0 0 14px; color: #91a6ad; font-size: 9px; line-height: 1.55; }
.science-content h4 { margin: 12px 0 6px; color: #c8d8da; font-size: 9px; font-weight: 650; }
.science-content h4:first-child { margin-top: 0; }
.science-content p { margin: 6px 0; }
.science-content .equation { padding: 6px 8px; border-left: 1px solid rgba(97,227,208,.38); background: rgba(97,227,208,.035); color: #b3d7d4; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 8px; overflow-wrap: anywhere; }
.science-content .constant-note { color: #8199a1; }
.science-content .disclaimer { padding-top: 8px; border-top: 1px solid var(--line); color: #7f969e; font-style: italic; }
.panel-footer { display: flex; justify-content: space-between; padding-top: 13px; color: #526a75; font-size: 7px; font-weight: 750; letter-spacing: .13em; }
.panel-footer span:last-child { display: flex; align-items: center; gap: 6px; }
.panel-footer i { width: 4px; height: 4px; border-radius: 50%; background: var(--accent-dim); }
@media (min-width: 1500px) { .workspace { grid-template-columns: minmax(0, 1fr) 400px; } .control-panel { padding-left: 24px; padding-right: 24px; } }
@media (max-width: 760px) {
  body { min-height: 100vh; }
  .app-shell { min-height: 100vh; }
  .topbar { height: 62px; flex-basis: 62px; padding: 0 14px; }
  .brand-glyph { width: 28px; height: 28px; }
  h1 { font-size: 15px; }
  .eyebrow { font-size: 8px; }
  .top-actions { gap: 10px; }
  .run-state { font-size: 8px; gap: 6px; }
  .icon-button { height: 31px; padding: 0 8px; gap: 5px; font-size: 9px; }
  .icon-button svg { width: 13px; height: 13px; }
  .workspace { display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(260px, 43dvh) minmax(0,1fr); min-height: 0; }
  .stage-column { border-right: 0; border-bottom: 1px solid var(--line); }
  .stage-toolbar { height: 31px; flex-basis: 31px; padding: 0 13px; }
  .section-kicker { font-size: 8px; }
  .legend { gap: 9px; font-size: 8px; }
  .legend span { gap: 4px; }
  .legend i { width: 6px; height: 6px; }
  .canvas-label { top: 11px; font-size: 7px; }
  .label-top-left { left: 12px; }
  .label-top-right { right: 12px; }
  .canvas-caption { left: 12px; bottom: 11px; max-width: 68%; padding: 8px 10px; }
  .caption-overline { font-size: 7px; margin-bottom: 3px; }
  .canvas-caption p { font-size: 9px; line-height: 1.4; }
  .canvas-watermark { right: 10px; bottom: 10px; font-size: 6px; }
  .transport-bar { height: 47px; flex-basis: 47px; padding: 0 12px; }
  .transport-button { height: 29px; min-width: 58px; padding: 0 8px; font-size: 9px; }
  .transport-button.primary { min-width: 73px; }
  .transport-button.icon-only { min-width: 30px; }
  .time-readout { gap: 7px; }
  .time-readout span { font-size: 7px; }
  .time-readout strong { font-size: 11px; }
  .control-panel { padding: 15px 14px 18px; overscroll-behavior: contain; }
  .panel-heading { margin-bottom: 14px; }
  h2 { font-size: 16px; }
  .preset-section { margin-bottom: 16px; }
  .preset-button { min-height: 50px; padding: 7px; gap: 7px; }
  .preset-button b { font-size: 8px; }
  .preset-button small { font-size: 7px; }
  .preset-mark { flex-basis: 20px; height: 20px; }
  .short-mark:before { left: 4px; top: 7px; }
  .short-mark:after { left: 7px; top: 9px; }
  .formed-mark:before { left: 2px; top: 5px; }
  .formed-mark:after { left: 5px; top: 7px; }
  .slider-control { margin-bottom: 11px; }
  .readout-card { min-height: 57px; }
}
@media (max-width: 370px) {
  .topbar { padding: 0 10px; }
  .top-actions { gap: 7px; }
  .run-state { font-size: 7px; }
  .screenshot-button span { display: none; }
  .legend { gap: 6px; }
  .legend span { font-size: 7px; }
  .preset-button { gap: 5px; }
  .preset-button b { font-size: 7px; }
  .preset-button small { font-size: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
body.embed-mode .app-shell { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
body.embed-mode .workspace { min-height: 0; }
@media (max-width: 760px) { body.embed-mode .workspace { grid-template-rows: minmax(250px, 43dvh) minmax(0,1fr); } }
