:root {
  color-scheme: dark;
  --bg: #071019;
  --panel: #0d1924;
  --panel-2: #101f2c;
  --line: rgba(162, 198, 210, .13);
  --line-strong: rgba(162, 198, 210, .22);
  --text: #e5f0f1;
  --muted: #8ba2aa;
  --dim: #5f7680;
  --accent: #73e8c0;
  --accent-soft: rgba(115, 232, 192, .13);
  --accent-glow: rgba(115, 232, 192, .28);
  --radius: 14px;
  --font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); }
body { overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { width: 100%; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: radial-gradient(ellipse at 48% -20%, rgba(32, 77, 80, .2), transparent 45%), var(--bg); }
.topbar { flex: 0 0 76px; display: flex; align-items: center; justify-content: space-between; padding: 12px 26px; border-bottom: 1px solid var(--line); background: rgba(7, 16, 25, .88); }
.brand-lockup { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-mark { width: 38px; height: 38px; border: 1px solid rgba(115,232,192,.3); border-radius: 11px; display: flex; align-items: center; justify-content: center; gap: 3px; background: var(--accent-soft); transform: rotate(-8deg); }
.brand-mark span { display: block; width: 4px; height: 17px; border-radius: 5px; background: var(--accent); transform: rotate(28deg); opacity: .95; }
.brand-mark span:nth-child(2) { height: 22px; opacity: .65; }
.brand-mark span:nth-child(3) { height: 13px; opacity: .8; }
.eyebrow { color: var(--accent); font-size: 9px; letter-spacing: .18em; font-weight: 800; line-height: 1.4; }
h1 { margin: 2px 0 0; font-size: clamp(17px, 1.8vw, 22px); font-weight: 650; letter-spacing: -.035em; line-height: 1.1; }
.subtitle { margin: 4px 0 0; font-size: 11px; color: var(--muted); letter-spacing: .015em; }
.top-status { display: flex; align-items: center; gap: 9px; font-size: 9px; letter-spacing: .12em; color: var(--muted); font-weight: 750; white-space: nowrap; }
.status-dot, .live-chip span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent-glow); }
.status-divider { height: 17px; width: 1px; background: var(--line-strong); margin: 0 7px; }
.clock-label { color: var(--dim); }
.top-status strong { color: var(--text); font-size: 11px; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.workspace { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 356px; gap: 16px; padding: 16px 20px 12px; overflow: hidden; }
.visual-column { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.stage-card { min-height: 0; flex: 1 1 auto; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #09141e; box-shadow: 0 18px 50px rgba(0,0,0,.16); }
.stage-toolbar { height: 42px; flex: 0 0 42px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; border-bottom: 1px solid var(--line); background: rgba(13, 25, 36, .82); }
.stage-kicker { color: #a6bcc2; font-size: 9px; font-weight: 800; letter-spacing: .14em; display: flex; align-items: center; gap: 8px; }
.pulse-ring { width: 7px; height: 7px; border: 1px solid var(--accent); border-radius: 50%; box-shadow: 0 0 0 3px rgba(115,232,192,.08); }
.toolbar-sep { color: var(--dim); }
.stage-tools { display: flex; align-items: center; gap: 8px; }
.scale-label { color: var(--dim); font-size: 8px; letter-spacing: .1em; margin-right: 4px; }
.scale-label b { color: #b5c9ca; font-weight: 700; margin-left: 3px; }
.icon-button { border: 1px solid var(--line-strong); background: rgba(255,255,255,.025); border-radius: 6px; padding: 6px 8px; color: #a9bdc1; font-size: 8px; letter-spacing: .09em; font-weight: 800; cursor: pointer; transition: border-color .18s, background .18s, color .18s; }
.icon-button:hover, .icon-button:focus-visible { border-color: rgba(115,232,192,.55); color: var(--accent); outline: none; }
.screenshot-btn { color: var(--accent); border-color: rgba(115,232,192,.3); }
.canvas-wrap { position: relative; min-height: 0; flex: 1 1 auto; overflow: hidden; background: radial-gradient(ellipse at 50% 50%, #10212a 0%, #09141d 72%); }
#simCanvas { display: block; width: 100%; height: 100%; outline: none; }
.canvas-corner { position: absolute; top: 12px; color: rgba(169,194,195,.6); font-size: 8px; font-weight: 750; letter-spacing: .13em; pointer-events: none; }
.corner-tl { left: 14px; }
.corner-tr { right: 14px; }
.corner-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin-right: 5px; vertical-align: 1px; }
.canvas-legend { position: absolute; left: 14px; bottom: 12px; display: flex; gap: 14px; color: rgba(165,189,193,.68); font-size: 7px; font-weight: 750; letter-spacing: .1em; pointer-events: none; }
.canvas-legend span { display: flex; align-items: center; gap: 6px; }
.legend-cell { display: inline-block; width: 13px; height: 4px; border-radius: 4px; background: #c0d7d1; box-shadow: 4px 0 0 -1px var(--accent); }
.legend-band { display: inline-block; width: 12px; height: 6px; border-radius: 2px; background: rgba(115,232,192,.35); border: 1px solid rgba(115,232,192,.55); }
.canvas-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 12px; pointer-events: none; }
.canvas-empty[hidden] { display: none; }
.scaled-tag { color: var(--dim); font-size: 7px; letter-spacing: .08em; }
.scale-label i { color: var(--dim); font-style: normal; font-size: 7px; }
.stage-caption { flex: 0 0 auto; min-height: 58px; display: flex; align-items: center; gap: 11px; padding: 9px 14px 10px; background: rgba(13,25,36,.85); border-top: 1px solid var(--line); }
.caption-icon { width: 25px; height: 25px; flex: 0 0 25px; display: grid; place-items: center; color: var(--accent); border: 1px solid rgba(115,232,192,.25); background: var(--accent-soft); border-radius: 8px; font-size: 16px; }
.caption-label { display: block; color: var(--accent); font-size: 8px; font-weight: 850; letter-spacing: .14em; margin-bottom: 3px; }
.stage-caption p { margin: 0; color: #aabec2; font-size: 10px; line-height: 1.42; }
.readout-grid { flex: 0 0 92px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.readout-card { min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: linear-gradient(145deg, rgba(15,29,41,.95), rgba(10,20,29,.95)); padding: 9px 11px 8px; display: flex; flex-direction: column; justify-content: space-between; }
.primary-readout { border-color: rgba(115,232,192,.25); }
.readout-top { display: flex; justify-content: space-between; gap: 5px; color: #92a9ae; font-size: 8px; font-weight: 850; letter-spacing: .1em; white-space: nowrap; }
.readout-tag { color: var(--dim); font-size: 7px; letter-spacing: .08em; }
.readout-value { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.readout-value strong { color: var(--text); font-size: clamp(17px, 2vw, 23px); font-weight: 650; letter-spacing: -.045em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.primary-readout .readout-value strong { color: var(--accent); }
.readout-value span { min-width: 0; color: var(--muted); font-size: 8px; line-height: 1.2; }
.meter-track { height: 3px; background: rgba(255,255,255,.07); border-radius: 4px; overflow: hidden; margin-top: 2px; }
.meter-fill { height: 100%; width: 0%; background: var(--accent); border-radius: 4px; box-shadow: 0 0 8px var(--accent-glow); transition: width .25s ease; }
.readout-foot { color: var(--dim); font-size: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.check-card { flex: 0 0 49px; display: flex; align-items: center; gap: 10px; border: 1px solid rgba(115,232,192,.16); border-radius: 10px; padding: 7px 12px; background: rgba(11, 27, 31, .65); min-width: 0; }
.check-icon { width: 23px; height: 23px; flex: 0 0 23px; display: grid; place-items: center; color: var(--accent); border-radius: 7px; background: var(--accent-soft); font-size: 12px; }
.check-copy { min-width: 0; flex: 1; }
.check-heading { color: #c2d5d4; font-size: 8px; letter-spacing: .1em; font-weight: 850; }
.check-heading span { color: var(--dim); font-weight: 600; letter-spacing: .02em; margin-left: 7px; }
.check-copy p { margin: 3px 0 0; color: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.check-state { color: var(--accent); font-size: 7px; font-weight: 850; letter-spacing: .12em; border: 1px solid rgba(115,232,192,.22); padding: 5px 7px; border-radius: 5px; white-space: nowrap; }
.control-column { min-height: 0; overflow: hidden; }
.control-panel { height: 100%; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(160deg, rgba(15,29,41,.96), rgba(9,19,28,.98)); padding: 16px 16px 12px; scrollbar-width: thin; scrollbar-color: #2b454d transparent; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.panel-heading h2 { margin: 3px 0 0; font-size: 17px; letter-spacing: -.035em; font-weight: 650; }
.live-chip { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid rgba(115,232,192,.2); background: rgba(115,232,192,.06); border-radius: 6px; color: var(--accent); font-size: 7px; letter-spacing: .12em; font-weight: 850; white-space: nowrap; }
.live-chip span { width: 5px; height: 5px; }
.section-label { display: flex; align-items: center; justify-content: space-between; color: #a7bbc0; font-size: 8px; letter-spacing: .12em; font-weight: 850; margin-bottom: 8px; }
.section-label span { color: var(--dim); font-size: 7px; }
.preset-block { padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.preset-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.preset-btn { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 9px 8px; text-align: left; background: rgba(255,255,255,.025); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; transition: border-color .18s, background .18s; }
.preset-btn:hover, .preset-btn:focus-visible { border-color: rgba(115,232,192,.42); outline: none; }
.preset-btn.active { border-color: rgba(115,232,192,.46); background: rgba(115,232,192,.075); }
.preset-symbol { width: 24px; height: 24px; flex: 0 0 24px; display: grid; place-items: center; border-radius: 6px; color: var(--accent); background: rgba(115,232,192,.1); font-size: 17px; }
.preset-btn b { display: block; font-size: 9px; font-weight: 750; color: #d8e5e4; white-space: nowrap; }
.preset-btn small { display: block; margin-top: 3px; color: var(--dim); font-size: 7px; white-space: nowrap; }
.controls-block { padding: 13px 0 12px; border-bottom: 1px solid var(--line); }
.control-row { margin: 0 0 12px; }
.control-row:last-child { margin-bottom: 0; }
.control-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.control-head label { color: #c8d6d7; font-size: 10px; font-weight: 650; }
.control-head output { color: var(--accent); font-size: 9px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { display: block; width: 100%; height: 15px; margin: 0; background: transparent; cursor: pointer; accent-color: var(--accent); }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(90deg, rgba(115,232,192,.5), rgba(115,232,192,.14)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 12px; height: 12px; border: 2px solid #071019; border-radius: 50%; background: var(--accent); margin-top: -4.5px; box-shadow: 0 0 0 1px rgba(115,232,192,.55), 0 0 9px rgba(115,232,192,.25); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 3px; background: linear-gradient(90deg, rgba(115,232,192,.5), rgba(115,232,192,.14)); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid #071019; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px rgba(115,232,192,.55); }
input[type="range"]:focus-visible { outline: 1px solid rgba(115,232,192,.55); outline-offset: 3px; border-radius: 4px; }
.range-ends { display: flex; justify-content: space-between; color: #536b74; font-size: 7px; letter-spacing: .1em; margin-top: 1px; }
.panel-actions { display: grid; grid-template-columns: 1.1fr .8fr .9fr; gap: 7px; padding: 13px 0 12px; }
.run-button, .secondary-button { height: 34px; border-radius: 7px; cursor: pointer; font-size: 8px; letter-spacing: .1em; font-weight: 850; transition: transform .15s, background .15s, border-color .15s; }
.run-button { display: flex; align-items: center; justify-content: center; gap: 7px; color: #062019; background: var(--accent); border: 1px solid var(--accent); }
.run-button:hover { background: #93f3d2; transform: translateY(-1px); }
.run-button span { font-size: 11px; }
.secondary-button { color: #b8c9ca; background: rgba(255,255,255,.03); border: 1px solid var(--line-strong); }
.secondary-button:hover { color: var(--accent); border-color: rgba(115,232,192,.42); }
button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.science-panel { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.science-panel summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; padding: 12px 1px; color: #d0dfdf; font-size: 9px; font-weight: 850; letter-spacing: .12em; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary::after { content: "+"; color: var(--accent); font-size: 16px; font-weight: 400; margin-left: 10px; }
.science-panel[open] summary::after { content: "−"; }
.summary-meta { color: var(--dim); font-size: 7px; font-weight: 650; letter-spacing: .08em; margin-left: auto; }
.science-content { padding: 0 1px 12px; color: #a3b8bb; font-size: 9px; line-height: 1.52; }
.science-content h3 { margin: 11px 0 4px; color: #d4e2e1; font-size: 9px; letter-spacing: .02em; }
.science-content p { margin: 4px 0 8px; }
.equation { padding: 7px 8px; margin: 6px 0; border: 1px solid var(--line); border-radius: 6px; background: rgba(0,0,0,.15); color: #bcebd9; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 8px; line-height: 1.5; overflow-wrap: anywhere; }
.science-source { color: #82999e; font-size: 8px; }
.disclaimer { color: var(--accent); font-size: 8px; }
.keyboard-hint { padding-top: 10px; color: #637a82; font-size: 8px; letter-spacing: .03em; }
.keyboard-hint span { color: #91a7ab; font-size: 7px; font-weight: 850; letter-spacing: .12em; margin-right: 6px; }
.footer-line { flex: 0 0 24px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; color: #4d646c; font-size: 7px; letter-spacing: .12em; font-weight: 750; }
.footer-line i { color: var(--accent); font-style: normal; padding: 0 4px; }
@media (max-width: 1080px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 326px; gap: 12px; padding: 12px; }
  .readout-grid { gap: 6px; }
  .readout-card { padding: 8px; }
  .readout-value { gap: 4px; }
  .readout-value span { font-size: 7px; }
}
@media (max-width: 760px) {
  body { overflow: hidden; }
  .topbar { flex-basis: 64px; padding: 8px 12px; }
  .brand-mark { width: 31px; height: 31px; }
  .brand-lockup { gap: 10px; }
  .eyebrow { font-size: 8px; }
  h1 { font-size: 17px; }
  .subtitle { font-size: 9px; }
  .top-status { gap: 6px; font-size: 8px; }
  .status-divider { margin: 0 3px; }
  .workspace { display: flex; flex-direction: column; gap: 8px; padding: 8px 9px 6px; overflow: hidden; }
  .visual-column { flex: 0 0 58%; min-height: 0; gap: 6px; }
  .stage-card { flex: 1 1 auto; min-height: 0; }
  .stage-toolbar { height: 33px; flex-basis: 33px; padding: 0 8px; }
  .stage-kicker { font-size: 7px; gap: 5px; letter-spacing: .1em; }
  .stage-kicker .toolbar-sep, .stage-kicker .field-size { display: none; }
  .stage-tools { gap: 5px; }
  .scale-label { display: none; }
  .icon-button { padding: 5px 6px; font-size: 7px; }
  .canvas-corner { top: 8px; font-size: 6px; }
  .corner-tl { left: 8px; }
  .corner-tr { right: 8px; }
  .canvas-legend { left: 8px; bottom: 7px; gap: 9px; font-size: 6px; }
  .stage-caption { min-height: 46px; padding: 6px 8px; gap: 7px; }
  .caption-icon { width: 20px; height: 20px; flex-basis: 20px; font-size: 13px; }
  .caption-label { font-size: 7px; margin-bottom: 2px; }
  .stage-caption p { font-size: 8px; line-height: 1.3; }
  .readout-grid { flex: 0 0 70px; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 4px; }
  .readout-card { padding: 6px 6px 5px; border-radius: 7px; }
  .readout-top { font-size: 6px; letter-spacing: .06em; }
  .readout-tag { display: none; }
  .readout-value { display: block; }
  .readout-value strong { display: block; font-size: 16px; line-height: 1.1; }
  .readout-value span { display: block; font-size: 6px; margin-top: 2px; }
  .readout-foot { font-size: 6px; }
  .meter-track { margin-top: 4px; }
  .check-card { flex-basis: 35px; padding: 5px 7px; gap: 6px; border-radius: 7px; }
  .check-icon { width: 18px; height: 18px; flex-basis: 18px; font-size: 10px; }
  .check-heading { font-size: 6px; letter-spacing: .06em; }
  .check-heading span { display: none; }
  .check-copy p { font-size: 7px; margin-top: 2px; }
  .check-state { font-size: 6px; padding: 4px 5px; }
  .control-column { flex: 1 1 auto; min-height: 0; }
  .control-panel { padding: 10px 11px 9px; border-radius: 10px; }
  .panel-heading { margin-bottom: 9px; }
  .panel-heading h2 { font-size: 14px; }
  .live-chip { padding: 5px 6px; font-size: 6px; }
  .section-label { font-size: 7px; margin-bottom: 6px; }
  .preset-block { padding-bottom: 9px; }
  .preset-btn { padding: 6px; gap: 6px; }
  .preset-symbol { width: 20px; height: 20px; flex-basis: 20px; font-size: 14px; }
  .preset-btn b { font-size: 8px; }
  .preset-btn small { font-size: 6px; }
  .controls-block { padding: 9px 0; }
  .control-row { margin-bottom: 8px; }
  .control-head { margin-bottom: 3px; }
  .control-head label { font-size: 9px; }
  .control-head output { font-size: 8px; }
  input[type="range"] { height: 12px; }
  .range-ends { font-size: 6px; }
  .panel-actions { padding: 9px 0; }
  .run-button, .secondary-button { height: 29px; font-size: 7px; }
  .science-panel summary { padding: 9px 1px; font-size: 8px; }
  .science-content { font-size: 8px; }
  .keyboard-hint { padding-top: 7px; font-size: 7px; }
  .footer-line { display: none; }
}
@media (max-width: 420px) {
  .top-status .clock-label { display: none; }
  .top-status .status-divider { display: none; }
  .top-status { font-size: 7px; }
  .readout-top { white-space: normal; min-height: 15px; }
  .readout-value strong { font-size: 15px; }
  .readout-value span { line-height: 1.05; }
  .readout-foot { display: none; }
  .canvas-legend span:last-child { display: none; }
}
@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; }
@keyframes stageReveal {
  from { opacity: 0; transform: translateY(8px) scale(.994); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.stage-card { animation: stageReveal .72s cubic-bezier(.2,.78,.2,1) both; }
.control-panel { animation: stageReveal .68s cubic-bezier(.2,.78,.2,1) .08s both; }
