:root {
  color-scheme: dark;
  --bg: #07111b;
  --panel: #0d1b28;
  --panel-2: #102231;
  --line: rgba(153, 184, 207, .13);
  --line-strong: rgba(153, 184, 207, .22);
  --text: #e7f0f6;
  --muted: #91a5b5;
  --dim: #657b8c;
  --accent: #53d7c0;
  --blue: #58b9f3;
  --amber: #f0b86a;
  --violet: #b29cff;
  --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 { overflow-x: hidden; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { min-height: 100vh; background: radial-gradient(ellipse at 12% 0%, rgba(29, 70, 89, .22), transparent 42%), var(--bg); }
.topbar { height: 76px; display: flex; align-items: center; gap: 14px; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(7, 17, 27, .92); }
.brand-mark { width: 31px; height: 31px; display: flex; align-items: center; justify-content: center; gap: 3px; border: 1px solid rgba(83,215,192,.35); border-radius: 9px; background: rgba(83,215,192,.07); }
.brand-mark span { width: 3px; border-radius: 4px; background: var(--accent); }
.brand-mark span:nth-child(1) { height: 9px; opacity: .65; }
.brand-mark span:nth-child(2) { height: 17px; }
.brand-mark span:nth-child(3) { height: 12px; opacity: .8; }
.heading-group { min-width: 0; }
.eyebrow { color: #8ea8b8; font-size: 9px; line-height: 1.3; font-weight: 750; letter-spacing: .16em; }
.eyebrow span { color: var(--accent); padding: 0 4px; }
h1 { margin: 3px 0 0; font-size: 20px; letter-spacing: -.035em; line-height: 1.15; font-weight: 680; }
.top-note { margin-left: auto; display: flex; align-items: center; gap: 8px; color: #8da3b3; font-size: 9px; letter-spacing: .15em; font-weight: 750; white-space: nowrap; }
.live-dot, .live-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 11px rgba(83,215,192,.65); }
.workspace { display: grid; grid-template-columns: minmax(0, 1.48fr) minmax(350px, .82fr); min-height: calc(100vh - 76px); }
.stage-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 16px 16px 14px 20px; border-right: 1px solid var(--line); }
.stage-toolbar { min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 4px 11px; }
.view-switch { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: #091722; }
.view-button, .quiet-button, .icon-button { border: 0; cursor: pointer; transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease; }
.view-button { padding: 7px 12px; border-radius: 6px; background: transparent; color: #8197a8; font-size: 11px; font-weight: 650; }
.view-button:hover { color: var(--text); }
.view-button.active { color: #dcfff8; background: rgba(83,215,192,.13); box-shadow: inset 0 0 0 1px rgba(83,215,192,.22); }
.stage-actions { display: flex; align-items: center; gap: 7px; }
.quiet-button { padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; background: #0b1925; color: #a6b8c4; font-size: 10px; font-weight: 650; }
.quiet-button:hover, .icon-button:hover { border-color: rgba(83,215,192,.4); color: var(--accent); }
.icon-button { width: 31px; height: 31px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 7px; background: #0b1925; }
.icon-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.canvas-wrap { position: relative; flex: 1; min-height: 330px; overflow: hidden; border: 1px solid rgba(128,167,190,.16); border-radius: 13px; background: #091723; box-shadow: 0 18px 45px rgba(0,0,0,.18), inset 0 0 40px rgba(41,84,106,.08); }
#machineCanvas { display: block; width: 100%; height: 100%; }
.canvas-topline, .canvas-bottomline { position: absolute; left: 15px; right: 15px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.canvas-topline { top: 13px; }
.canvas-bottomline { bottom: 12px; color: #7790a2; font-size: 8px; letter-spacing: .14em; font-weight: 750; }
.live-pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 9px; border: 1px solid rgba(83,215,192,.22); border-radius: 99px; background: rgba(8,24,34,.78); color: #a8c9c7; font-size: 8px; letter-spacing: .13em; font-weight: 800; }
.live-pill i { width: 5px; height: 5px; }
.canvas-meta { color: #688092; font-size: 8px; letter-spacing: .12em; font-weight: 750; }
.canvas-meta b { color: var(--accent); padding: 0 3px; }
.stage-footer { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; min-height: 58px; padding: 13px 5px 0; }
.stage-footer p { max-width: 66%; margin: 0; color: #a9bac6; font-size: 11px; line-height: 1.55; }
.flow-legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding-top: 2px; color: #7f95a5; font-size: 9px; white-space: nowrap; }
.flow-legend span { display: inline-flex; align-items: center; gap: 5px; }
.flow-legend i { width: 7px; height: 7px; border-radius: 2px; }
.legend-supply { background: #58b9f3; }
.legend-waste { background: #f0b86a; }
.legend-delivery { background: #53d7c0; }
.control-panel { min-width: 0; padding: 18px 19px 22px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #294151 transparent; background: rgba(11, 25, 37, .66); }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.section-heading h2 { margin: 4px 0 0; font-size: 15px; letter-spacing: -.025em; font-weight: 660; }
.model-tag { margin-bottom: 2px; padding: 4px 6px; border: 1px solid rgba(83,215,192,.18); border-radius: 5px; color: #7dc5b9; background: rgba(83,215,192,.055); font-size: 7px; letter-spacing: .1em; font-weight: 800; white-space: nowrap; }
.readout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.readout-card { min-width: 0; min-height: 88px; padding: 11px 11px 9px; border: 1px solid var(--line); border-radius: 9px; background: linear-gradient(145deg, rgba(20,42,57,.82), rgba(12,27,40,.9)); }
.primary-readout { border-color: rgba(88,185,243,.24); background: linear-gradient(145deg, rgba(24,62,83,.62), rgba(12,27,40,.94)); }
.readout-label { display: flex; justify-content: space-between; gap: 4px; color: #92a7b6; font-size: 8px; letter-spacing: .1em; font-weight: 800; }
.readout-label span { color: #627e90; font-size: 6px; letter-spacing: .09em; white-space: nowrap; }
.readout-value { margin-top: 7px; color: #e8f5fb; font-size: 25px; line-height: 1; font-weight: 670; letter-spacing: -.045em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.primary-readout .readout-value { color: #9bdcff; }
.readout-value small { color: #8da5b5; font-size: 10px; letter-spacing: 0; font-weight: 600; }
.readout-foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; color: #7890a0; font-size: 8px; }
.readout-dot { width: 5px; height: 5px; border-radius: 50%; }
.readout-dot.blue { background: var(--blue); }.readout-dot.amber { background: var(--amber); }.readout-dot.violet { background: var(--violet); }
.efficiency-track { height: 3px; margin-top: 10px; overflow: hidden; border-radius: 4px; background: #203545; }
.efficiency-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #3a9f9b, var(--accent)); transition: width .25s ease; }
.energy-check { display: flex; gap: 9px; margin-top: 9px; padding: 10px 11px; border: 1px solid rgba(83,215,192,.16); border-radius: 8px; background: rgba(15,43,47,.34); }
.check-icon { flex: 0 0 18px; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; background: rgba(83,215,192,.14); color: var(--accent); font-size: 11px; font-weight: 800; }
.check-title { color: #b5d6d2; font-size: 9px; font-weight: 750; letter-spacing: .02em; }
.check-title span { margin-left: 4px; color: #648f89; font-size: 6px; letter-spacing: .1em; }
.check-copy p { margin: 4px 0 0; color: #829ba8; font-size: 9px; line-height: 1.4; }
.design-section { margin-top: 21px; }
.compact-heading { margin-bottom: 10px; }
.text-button { padding: 3px 0; border: 0; background: transparent; color: #82a0b2; cursor: pointer; font-size: 9px; font-weight: 700; }
.text-button:hover { color: var(--accent); }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 15px; }
.preset-button { min-width: 0; display: flex; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #0b1a26; text-align: left; cursor: pointer; transition: border-color .18s ease, background .18s ease; }
.preset-button:hover { border-color: var(--line-strong); }
.preset-button.selected { border-color: rgba(83,215,192,.34); background: rgba(25,64,67,.3); }
.preset-icon { flex: 0 0 25px; width: 25px; height: 25px; display: grid; place-items: center; border-radius: 7px; font-size: 15px; font-weight: 750; }
.balanced-icon { color: var(--accent); background: rgba(83,215,192,.11); }.highlift-icon { color: #e8b777; background: rgba(240,184,106,.1); }
.preset-button b, .preset-button small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preset-button b { color: #c7d5df; font-size: 9px; font-weight: 700; }
.preset-button small { margin-top: 3px; color: #758d9e; font-size: 7px; }
.slider-list { display: grid; gap: 13px; }
.slider-control { display: block; min-width: 0; }
.slider-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: #b3c2cd; font-size: 10px; font-weight: 620; }
.slider-top b { color: #e1edf3; font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.slider-control input[type="range"] { display: block; width: 100%; height: 16px; margin: 5px 0 0; appearance: none; background: transparent; cursor: pointer; touch-action: pan-y; }
.slider-control input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 8px; background: linear-gradient(90deg, #276e75, #244051); }
.slider-control input[type="range"]::-moz-range-track { height: 4px; border-radius: 8px; background: linear-gradient(90deg, #276e75, #244051); }
.slider-control input[type="range"]::-webkit-slider-thumb { width: 13px; height: 13px; margin-top: -4.5px; appearance: none; border: 2px solid #d6fff7; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(83,215,192,.13); }
.slider-control input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border: 2px solid #d6fff7; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(83,215,192,.13); }
.slider-scale { display: flex; justify-content: space-between; color: #61798a; font-size: 7px; font-variant-numeric: tabular-nums; }
.slider-scale em { color: #597c7b; font-size: 6px; font-style: normal; letter-spacing: .1em; font-weight: 800; }
.transport-section { margin-top: 19px; padding-top: 13px; border-top: 1px solid var(--line); }
.transport-buttons { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 7px; }
.transport-buttons button { min-height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-strong); border-radius: 7px; cursor: pointer; font-size: 9px; font-weight: 700; transition: background .18s ease, border-color .18s ease; }
.transport-main { background: rgba(83,215,192,.14); border-color: rgba(83,215,192,.3) !important; color: #bdf7ec; }
.transport-main:hover { background: rgba(83,215,192,.21); }
.transport-secondary { background: #102332; color: #a5b9c6; }
.transport-secondary:hover { border-color: rgba(83,215,192,.34); color: var(--text); }
.pause-symbol { font-size: 11px; }
.keyboard-hint { margin-top: 9px; color: #637b8c; font-size: 7px; letter-spacing: .11em; }
kbd { margin: 0 3px 0 7px; padding: 2px 4px; border: 1px solid #2a4050; border-radius: 3px; color: #a2b7c5; background: #0c1a26; font-family: inherit; font-size: 7px; }
.science-panel { margin-top: 16px; border: 1px solid var(--line); border-radius: 9px; background: rgba(10,25,37,.68); }
.science-panel summary { display: flex; align-items: center; gap: 9px; padding: 11px; cursor: pointer; list-style: none; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-mark { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 7px; color: var(--accent); background: rgba(83,215,192,.1); font-size: 14px; }
.science-panel summary b, .science-panel summary small { display: block; }
.science-panel summary b { color: #c7d6df; font-size: 10px; }
.science-panel summary small { margin-top: 2px; color: #72899a; font-size: 8px; }
.chevron { margin-left: auto; color: #7d96a6; transition: transform .2s ease; }
.science-panel[open] .chevron { transform: rotate(180deg); }
.science-content { padding: 0 12px 13px; border-top: 1px solid var(--line); }
.science-content h3 { margin: 13px 0 6px; color: #c2d3dd; font-size: 10px; }
.science-content p, .science-content li { color: #8da2b0; font-size: 9px; line-height: 1.55; }
.science-content p { margin: 5px 0; }
.science-content ul { margin: 7px 0 10px; padding-left: 17px; }
.equation { margin: 7px 0; padding: 8px; border: 1px solid rgba(118,158,179,.12); border-radius: 6px; background: rgba(18,40,54,.6); color: #d1e4ec; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 9px; line-height: 1.5; overflow-wrap: anywhere; }
.number-tag { display: inline-block; margin-left: 3px; padding: 2px 4px; border-radius: 3px; font-family: var(--font); font-size: 6px; font-weight: 800; letter-spacing: .09em; vertical-align: 1px; }
.number-tag.scaled { color: #d2b7ff; background: rgba(178,156,255,.11); }
.number-tag.illustrative { color: #e8c58d; background: rgba(240,184,106,.11); }
.number-tag.textbook { color: #8ed9ca; background: rgba(83,215,192,.1); }
.constants-note { margin-top: 10px; color: #8197a5; font-size: 8px; line-height: 1.6; }
.disclaimer { margin-top: 12px !important; padding-top: 9px; border-top: 1px solid var(--line); color: #718b9a !important; font-style: italic; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button:active { transform: translateY(1px); }
@media (min-width: 1500px) { .workspace { grid-template-columns: minmax(0, 1.6fr) minmax(390px, .78fr); } .stage-panel { padding-left: 26px; padding-right: 22px; } .control-panel { padding-left: 24px; padding-right: 24px; } }
@media (max-width: 900px) and (min-width: 621px) { .workspace { grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); } .stage-panel { padding-left: 12px; padding-right: 12px; } .control-panel { padding-left: 13px; padding-right: 13px; } .view-button { padding-left: 8px; padding-right: 8px; } }
@media (max-width: 620px) {
  .app-shell { min-height: 100vh; }
  .topbar { height: 58px; gap: 10px; padding: 0 13px; }
  .brand-mark { width: 27px; height: 27px; }
  .eyebrow { font-size: 7px; }
  h1 { font-size: 16px; }
  .top-note { font-size: 7px; letter-spacing: .1em; gap: 6px; }
  .workspace { display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(255px, 43dvh) minmax(0,1fr); min-height: calc(100vh - 58px); }
  .stage-panel { padding: 8px 8px 7px; border-right: 0; border-bottom: 1px solid var(--line); }
  .stage-toolbar { min-height: 37px; padding: 0 1px 7px; gap: 5px; }
  .view-switch { gap: 1px; padding: 2px; }
  .view-button { padding: 6px 8px; font-size: 9px; }
  .stage-actions { gap: 5px; }
  .quiet-button { padding: 6px 7px; font-size: 8px; }
  .icon-button { width: 28px; height: 28px; }
  .canvas-wrap { min-height: 0; border-radius: 9px; }
  .canvas-topline { top: 8px; left: 9px; right: 9px; }
  .live-pill { padding: 5px 7px; font-size: 7px; }
  .canvas-meta { font-size: 6px; }
  .canvas-bottomline { left: 9px; right: 9px; bottom: 8px; font-size: 6px; }
  .stage-footer { min-height: 42px; padding: 8px 2px 0; gap: 7px; }
  .stage-footer p { max-width: 66%; font-size: 9px; line-height: 1.35; }
  .flow-legend { gap: 7px; font-size: 7px; }
  .flow-legend span { gap: 3px; }
  .flow-legend i { width: 6px; height: 6px; }
  .control-panel { padding: 13px 13px 18px; min-height: 0; }
  .section-heading h2 { font-size: 14px; }
  .readout-card { min-height: 79px; padding: 9px; }
  .readout-value { font-size: 22px; }
  .readout-label { font-size: 7px; }
  .readout-label span { font-size: 5px; }
  .readout-foot { font-size: 7px; }
  .design-section { margin-top: 17px; }
  .slider-list { gap: 11px; }
}
@media (max-width: 370px) {
  .top-note { display: none; }
  .view-button { padding: 6px 6px; }
  .preset-button { padding: 7px 6px; gap: 5px; }
  .preset-button b { font-size: 8px; }
  .preset-button small { font-size: 6px; }
  .stage-footer p { max-width: 62%; font-size: 8px; }
}
@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 { height: calc(100vh - 76px); height: calc(100dvh - 76px); min-height: 0; }
@media (max-width: 620px) {
  body.embed-mode .workspace { height: calc(100vh - 58px); height: calc(100dvh - 58px); min-height: 0; grid-template-rows: minmax(245px, 43dvh) minmax(0,1fr); }
}
