:root {
  color-scheme: dark;
  --bg: #0b1117;
  --panel: #111a22;
  --panel-2: #151f28;
  --line: rgba(171, 194, 207, .13);
  --line-strong: rgba(171, 194, 207, .22);
  --text: #e8f0f2;
  --muted: #8b9ba5;
  --faint: #61717c;
  --accent: #68e0cb;
  --accent-dim: rgba(104, 224, 203, .13);
  --steel: #9eb0ba;
  --amber: #c3a77b;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; min-width: 0; height: 100%; background: var(--bg); color: var(--text); }
body { overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
.app { width: 100%; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: radial-gradient(ellipse at 34% 18%, rgba(34, 65, 70, .14), transparent 44%), var(--bg); }
.topbar { height: 68px; flex: 0 0 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(9, 15, 20, .88); }
.brand-lockup { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border: 1px solid rgba(104,224,203,.45); border-radius: 10px; position: relative; display: grid; place-items: center; background: rgba(104,224,203,.06); }
.brand-mark::before, .brand-mark::after, .brand-mark span { content: ""; position: absolute; border: 1px solid var(--accent); border-radius: 50%; }
.brand-mark::before { width: 20px; height: 20px; opacity: .8; }
.brand-mark::after { width: 7px; height: 7px; background: var(--accent); }
.brand-mark span:nth-child(1) { width: 28px; height: 1px; border: 0; border-radius: 0; background: var(--accent); transform: rotate(45deg); opacity: .65; }
.brand-mark span:nth-child(2) { width: 28px; height: 1px; border: 0; border-radius: 0; background: var(--accent); transform: rotate(-45deg); opacity: .65; }
.brand-mark span:nth-child(3) { display: none; }
.eyebrow { color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .17em; line-height: 1.4; }
.eyebrow-dot { display: inline-block; width: 4px; height: 4px; margin: 0 5px 2px; border-radius: 50%; background: var(--accent); }
h1 { margin: 2px 0 0; font-size: 19px; line-height: 1.1; font-weight: 650; letter-spacing: -.035em; }
.topbar-meta { display: flex; align-items: center; gap: 9px; color: var(--muted); font: 700 9px var(--mono); letter-spacing: .1em; white-space: nowrap; }
.status-dot, .live-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(104,224,203,.55); }
.meta-divider { width: 1px; height: 16px; margin: 0 4px; background: var(--line-strong); }
.mode-tag { color: var(--accent); }
.workspace { min-height: 0; flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 0; }
.stage-column { 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: 43px; flex: 0 0 43px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.view-switch { display: flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: #0d151c; }
.view-button { border: 0; border-radius: 6px; padding: 7px 11px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 650; cursor: pointer; transition: background .18s ease, color .18s ease; }
.view-button:hover { color: var(--text); }
.view-button.active { color: var(--accent); background: var(--accent-dim); box-shadow: inset 0 0 0 1px rgba(104,224,203,.16); }
.transport-controls { display: flex; gap: 5px; }
.icon-button { width: 31px; height: 31px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: #101920; color: #b9c7cd; font-size: 15px; cursor: pointer; transition: border-color .18s ease, background .18s ease, color .18s ease; }
.icon-button:hover { border-color: rgba(104,224,203,.45); color: var(--accent); background: #14232a; }
.icon-button:focus-visible, .view-button:focus-visible, .preset-button:focus-visible, .quality-switch button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#stepButton { font-size: 12px; }
#resetButton { font-size: 20px; line-height: 1; }
.screenshot-button { color: var(--accent); }
.canvas-wrap { animation: stageReveal .85s cubic-bezier(.2,.75,.25,1) both; position: relative; flex: 1 1 auto; min-height: 260px; overflow: hidden; border: 1px solid rgba(157,185,194,.17); border-radius: 13px; background: #0c151c; box-shadow: 0 16px 48px rgba(0,0,0,.18), inset 0 0 0 1px rgba(255,255,255,.012); }
#machineCanvas { display: block; width: 100%; height: 100%; }
.canvas-corner { position: absolute; top: 15px; display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
.canvas-corner.top-left { left: 17px; }
.canvas-corner.top-right { right: 17px; }
.corner-kicker { color: #71848d; font: 700 8px var(--mono); letter-spacing: .16em; }
.corner-name { color: #d3e0e3; font: 700 10px var(--mono); letter-spacing: .11em; }
.live-pill { display: flex; align-items: center; gap: 7px; border: 1px solid rgba(104,224,203,.22); border-radius: 20px; padding: 6px 9px; color: var(--accent); background: rgba(10,24,28,.78); font: 700 8px var(--mono); letter-spacing: .1em; }
.live-pill i { width: 5px; height: 5px; }
.canvas-legend { position: absolute; left: 17px; bottom: 14px; display: flex; flex-wrap: wrap; gap: 14px; color: #81919a; font: 650 9px var(--mono); letter-spacing: .02em; pointer-events: none; }
.canvas-legend span, .comparison-key { display: flex; align-items: center; gap: 6px; }
.canvas-legend i, .comparison-key i { width: 7px; height: 7px; display: inline-block; border-radius: 2px; }
.legend-input { background: #9baab2; }
.legend-spring { background: var(--accent); }
.legend-output { background: var(--amber); }
.stage-caption { min-height: 59px; flex: 0 0 59px; display: flex; align-items: center; gap: 12px; padding: 9px 5px 0; }
.caption-icon { width: 28px; height: 28px; display: grid; place-items: center; flex: 0 0 28px; border: 1px solid rgba(104,224,203,.2); border-radius: 8px; color: var(--accent); background: var(--accent-dim); font-size: 16px; }
.caption-label { color: #7e909a; font: 700 8px var(--mono); letter-spacing: .15em; }
.stage-caption p { max-width: 690px; margin: 3px 0 0; color: #b5c2c7; font-size: 11px; line-height: 1.45; }
.sim-clock { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; white-space: nowrap; }
.sim-clock span, .sim-clock small { color: #6f818b; font: 700 8px var(--mono); letter-spacing: .1em; }
.sim-clock strong { color: #dce7e9; font: 650 13px var(--mono); }
.control-column { min-width: 0; min-height: 0; overflow-y: auto; padding: 17px 16px 14px; background: rgba(13,20,27,.58); scrollbar-width: thin; scrollbar-color: #31424b transparent; }
.panel { padding: 0 0 15px; margin: 0 0 14px; border-bottom: 1px solid var(--line); }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 12px; }
.panel-heading h2 { margin: 3px 0 0; color: #e4edef; font-size: 15px; font-weight: 650; letter-spacing: -.025em; }
.panel-index { color: #61727c; font: 700 8px var(--mono); letter-spacing: .1em; }
.metrics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.metric-card { min-width: 0; padding: 11px 11px 9px; border: 1px solid var(--line); border-radius: 9px; background: linear-gradient(145deg, rgba(23,35,44,.85), rgba(15,24,31,.92)); }
.metric-primary { border-color: rgba(104,224,203,.23); background: linear-gradient(145deg, rgba(24,53,55,.55), rgba(15,27,32,.95)); }
.metric-label { color: #8a9ba4; font: 750 8px var(--mono); letter-spacing: .1em; }
.metric-label span { float: right; color: var(--accent); }
.metric-value { margin-top: 7px; color: #e5eeee; font: 600 22px var(--mono); letter-spacing: -.055em; white-space: nowrap; }
.metric-primary .metric-value { color: var(--accent); }
.metric-value small { color: #8ea0a9; font: 500 10px var(--mono); letter-spacing: 0; }
.metric-foot { margin-top: 6px; color: #687983; font: 700 7px var(--mono); letter-spacing: .08em; }
.metric-foot b { float: right; color: #8a9aa2; font-weight: 700; }
.comparison-strip { margin-top: 12px; padding: 10px 10px 8px; border: 1px solid var(--line); border-radius: 8px; background: rgba(8,15,20,.42); }
.comparison-title { display: flex; justify-content: space-between; gap: 6px; margin-bottom: 9px; color: #a7b6bc; font: 750 8px var(--mono); letter-spacing: .09em; }
.comparison-title span { color: #61727b; font-size: 7px; }
.comparison-row { display: grid; grid-template-columns: 94px 1fr 34px; align-items: center; gap: 8px; margin-top: 7px; }
.comparison-key { color: #91a0a8; font-size: 9px; }
.bar-track { height: 5px; border-radius: 8px; overflow: hidden; background: #202c34; }
.bar-fill { height: 100%; width: 0; border-radius: inherit; transition: width .25s ease; }
.direct-fill { background: #93a4ad; }
.spring-fill { background: var(--accent); }
.comparison-row strong { color: #c8d4d8; font: 600 9px var(--mono); text-align: right; }
.controls-panel { padding-bottom: 13px; }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 14px; }
.preset-button { min-width: 0; display: flex; align-items: center; gap: 8px; padding: 9px 8px; border: 1px solid var(--line); border-radius: 8px; background: #101920; 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(104,224,203,.36); background: rgba(104,224,203,.07); }
.preset-icon { color: var(--accent); font-size: 18px; line-height: 1; }
.preset-button b { display: block; overflow: hidden; color: #d5e0e3; font-size: 9px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.preset-button small { display: block; margin-top: 3px; color: #778891; font-size: 8px; white-space: nowrap; }
.control-list { display: grid; gap: 12px; }
.control-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.control-top label { color: #c9d5d9; font-size: 10px; font-weight: 600; }
.control-top output { color: var(--accent); font: 600 10px var(--mono); white-space: nowrap; }
input[type="range"] { display: block; width: 100%; height: 14px; margin: 5px 0 0; padding: 0; appearance: none; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 5px; background: linear-gradient(90deg, var(--accent) 0%, rgba(104,224,203,.35) 100%); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 5px; background: linear-gradient(90deg, var(--accent) 0%, rgba(104,224,203,.35) 100%); }
input[type="range"]::-webkit-slider-thumb { width: 11px; height: 11px; margin-top: -4px; appearance: none; border: 2px solid #b6fff1; border-radius: 50%; background: #1b4645; box-shadow: 0 0 0 3px rgba(104,224,203,.12); }
input[type="range"]::-moz-range-thumb { width: 8px; height: 8px; border: 2px solid #b6fff1; border-radius: 50%; background: #1b4645; box-shadow: 0 0 0 3px rgba(104,224,203,.12); }
input[type="range"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.control-hint { display: flex; justify-content: space-between; color: #647680; font-size: 8px; }
.control-hint span { color: #778a92; font: 700 7px var(--mono); letter-spacing: .09em; }
.quality-row { display: flex; align-items: center; justify-content: space-between; margin-top: 15px; padding-top: 12px; border-top: 1px solid var(--line); }
.quality-row b { display: block; color: #c8d5d9; font-size: 9px; font-weight: 650; }
.quality-row small { display: block; margin-top: 3px; color: #6f8089; font-size: 8px; }
.quality-switch { display: flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: #0b1319; }
.quality-switch button { padding: 5px 9px; border: 0; border-radius: 5px; color: #81919a; background: transparent; font-size: 8px; cursor: pointer; }
.quality-switch button.active { color: var(--accent); background: rgba(104,224,203,.12); }
.check-card { padding: 11px; border: 1px solid rgba(104,224,203,.2); border-radius: 8px; background: rgba(20,48,48,.25); }
.check-heading { display: flex; align-items: center; gap: 7px; }
.check-mark { width: 16px; height: 16px; display: grid; place-items: center; border-radius: 5px; color: var(--accent); background: rgba(104,224,203,.13); font-size: 10px; }
.check-heading b { color: #d5e2e3; font-size: 9px; font-weight: 650; }
.check-tag { margin-left: auto; color: #78bdb2; font: 700 7px var(--mono); letter-spacing: .08em; }
.check-card p { margin: 9px 0 8px; color: #8ea0a8; font-size: 9px; line-height: 1.5; }
.check-card p strong { color: #d7e4e5; font: 600 9px var(--mono); }
.check-result { display: flex; justify-content: space-between; padding-top: 7px; border-top: 1px solid rgba(104,224,203,.12); color: #82939a; font-size: 8px; }
.check-result strong { color: var(--accent); font: 650 10px var(--mono); }
.science-details { margin-top: 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(10,17,23,.5); }
.science-details summary { display: flex; align-items: center; gap: 8px; padding: 10px 11px; color: #c9d5d9; font-size: 10px; font-weight: 650; cursor: pointer; list-style: none; }
.science-details summary::-webkit-details-marker { display: none; }
.science-details summary span { color: var(--accent); }
.science-details summary i { margin-left: auto; color: var(--accent); font: normal 14px var(--mono); }
.science-details[open] summary { border-bottom: 1px solid var(--line); }
.science-details[open] summary i { transform: rotate(45deg); }
.science-content { padding: 10px 11px 12px; color: #91a1a8; font-size: 9px; line-height: 1.55; }
.science-content h3 { margin: 8px 0 4px; color: #d0dcdf; font-size: 9px; font-weight: 700; }
.science-content p { margin: 4px 0 7px; }
.equation { margin: 6px 0; padding: 7px 8px; overflow-x: auto; border-left: 2px solid rgba(104,224,203,.5); background: rgba(104,224,203,.05); color: #d1e4e2; font: 10px var(--mono); white-space: nowrap; }
.science-content ul { margin: 6px 0 9px; padding-left: 15px; }
.science-content li { margin: 4px 0; }
.science-content li b { color: #80c9bd; font: 700 7px var(--mono); letter-spacing: .06em; }
.disclaimer { margin-top: 10px !important; padding-top: 8px; border-top: 1px solid var(--line); color: #9eafb4; font-style: italic; }
.panel-footer { display: flex; justify-content: space-between; color: #596a74; font: 700 7px var(--mono); letter-spacing: .1em; }
@keyframes stageReveal { from { opacity: 0; transform: translateY(9px) scale(.995); } to { opacity: 1; transform: translateY(0) scale(1); } }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
@media (max-width: 1040px) and (min-width: 761px) {
  .workspace { grid-template-columns: minmax(0,1fr) 330px; }
  .stage-column { padding-left: 14px; padding-right: 14px; }
  .control-column { padding-left: 13px; padding-right: 13px; }
  .metric-value { font-size: 19px; }
}
@media (max-width: 760px) {
  .topbar { height: 56px; flex-basis: 56px; padding: 0 13px; }
  .brand-mark { width: 30px; height: 30px; }
  h1 { font-size: 17px; }
  .eyebrow { font-size: 8px; }
  .topbar-meta { gap: 6px; font-size: 7px; }
  .mode-tag, .meta-divider { display: none; }
  .workspace { display: flex; flex-direction: column; overflow: hidden; }
  .stage-column { flex: 0 0 47%; min-height: 285px; padding: 9px 9px 7px; border-right: 0; border-bottom: 1px solid var(--line); }
  .stage-toolbar { min-height: 39px; flex-basis: 39px; align-items: flex-start; gap: 5px; }
  .view-switch { gap: 1px; padding: 2px; }
  .view-button { padding: 7px 7px; font-size: 9px; }
  .transport-controls { gap: 3px; }
  .icon-button { width: 27px; height: 29px; border-radius: 7px; }
  .canvas-wrap { min-height: 170px; border-radius: 9px; }
  .canvas-corner { top: 9px; }
  .canvas-corner.top-left { left: 10px; }
  .canvas-corner.top-right { right: 9px; }
  .corner-kicker { font-size: 7px; }
  .corner-name { font-size: 8px; }
  .live-pill { padding: 4px 6px; font-size: 7px; }
  .canvas-legend { left: 10px; bottom: 8px; gap: 8px; font-size: 7px; }
  .canvas-legend i { width: 6px; height: 6px; }
  .stage-caption { min-height: 42px; flex-basis: 42px; gap: 8px; padding: 5px 2px 0; }
  .caption-icon { width: 23px; height: 23px; flex-basis: 23px; font-size: 13px; }
  .caption-label { font-size: 7px; }
  .stage-caption p { max-width: none; font-size: 9px; line-height: 1.3; }
  .sim-clock { display: none; }
  .control-column { flex: 1 1 auto; min-height: 0; padding: 13px 12px 12px; overflow-y: auto; overscroll-behavior: contain; }
  .panel { padding-bottom: 12px; margin-bottom: 12px; }
  .panel-heading { margin-bottom: 9px; }
  .panel-heading h2 { font-size: 14px; }
  .metric-card { padding: 9px 9px 8px; }
  .metric-value { margin-top: 5px; font-size: 20px; }
  .metric-foot { font-size: 6px; }
  .comparison-strip { margin-top: 9px; }
  .controls-panel .control-list { grid-template-columns: 1fr 1fr; column-gap: 14px; row-gap: 11px; }
  .control-top label { font-size: 9px; }
  .control-top output { font-size: 9px; }
  .control-hint { font-size: 7px; }
  .preset-button { padding: 8px 6px; }
  .preset-button b { font-size: 8px; }
  .preset-button small { font-size: 7px; }
}
@media (max-width: 390px) {
  .topbar-meta { font-size: 6px; }
  .view-button { padding-left: 6px; padding-right: 6px; font-size: 8px; }
  .icon-button { width: 25px; }
  .controls-panel .control-list { column-gap: 10px; }
  .control-top label { font-size: 8px; }
  .control-top output { font-size: 8px; }
  .metric-value { font-size: 18px; }
  .metric-value small { font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
