:root {
  color-scheme: dark;
  --bg: #07111b;
  --panel: #0b1722;
  --panel-2: #0e1d2a;
  --line: rgba(157, 190, 209, .12);
  --line-strong: rgba(157, 190, 209, .2);
  --text: #e9f1f4;
  --muted: #8da3b0;
  --quiet: #5d7482;
  --cyan: #63d9dc;
  --cyan-soft: rgba(99, 217, 220, .14);
  --amber: #f4b66b;
  --violet: #a89cff;
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; min-height: 100%; background: var(--bg); color: var(--text); }
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 22% 0%, rgba(32, 70, 83, .18), transparent 38%), var(--bg); }
.topbar { flex: 0 0 76px; min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(7, 17, 27, .92); z-index: 2; }
.brand-lockup { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark { width: 33px; height: 33px; border: 1px solid rgba(99,217,220,.3); border-radius: 10px; display: flex; align-items: center; justify-content: center; gap: 3px; background: rgba(99,217,220,.06); transform: rotate(-8deg); }
.brand-mark span { display: block; width: 3px; border-radius: 5px; background: var(--cyan); transform: rotate(8deg); }
.brand-mark span:nth-child(1) { height: 10px; opacity: .55; }
.brand-mark span:nth-child(2) { height: 17px; }
.brand-mark span:nth-child(3) { height: 12px; opacity: .72; }
.brand-copy { min-width: 0; }
.eyebrow { font-size: 9px; line-height: 1.2; letter-spacing: .19em; color: #7c96a3; font-weight: 750; white-space: nowrap; }
.eyebrow span { color: #49616e; padding: 0 3px; }
h1 { font-size: 20px; line-height: 1.25; margin: 4px 0 0; font-weight: 650; letter-spacing: -.035em; }
.top-actions { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.tool-button, .quality-button { height: 36px; border: 1px solid var(--line-strong); border-radius: 9px; background: rgba(14, 29, 42, .8); color: #a9bdc8; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 11px; cursor: pointer; transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease; font-size: 11px; font-weight: 650; }
.tool-button:hover, .quality-button:hover { background: #142737; border-color: rgba(99,217,220,.35); color: var(--text); }
.tool-button:active, .quality-button:active { transform: translateY(1px); }
.tool-button:focus-visible, .quality-button:focus-visible, .preset-card:focus-visible, summary:focus-visible, input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.tool-button.primary { color: #07171d; border-color: transparent; background: var(--cyan); padding: 0 14px; min-width: 86px; }
.tool-button.primary:hover { background: #86e8e9; color: #06161c; }
.button-icon { width: 16px; height: 16px; flex: 0 0 16px; }
.icon-only { width: 36px; padding: 0; }
.action-divider { height: 22px; width: 1px; background: var(--line-strong); margin: 0 3px; }
.quality-button { height: 30px; padding: 0 9px; font-size: 10px; color: #9bb0bc; }
.quality-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px rgba(99,217,220,.6); }
.workspace { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 378px; gap: 0; }
.stage-shell { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 18px 20px 14px 24px; border-right: 1px solid var(--line); }
.stage-head { flex: 0 0 32px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 3px 9px; }
.stage-heading { display: flex; align-items: center; gap: 8px; color: #9bb2be; font-size: 9px; font-weight: 750; letter-spacing: .15em; white-space: nowrap; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: #7b8d96; box-shadow: 0 0 0 3px rgba(123,141,150,.12); }
.live-dot.running { background: var(--cyan); box-shadow: 0 0 0 3px rgba(99,217,220,.12), 0 0 9px rgba(99,217,220,.55); }
.stage-legend { display: flex; align-items: center; gap: 14px; color: #78909c; font-size: 9px; white-space: nowrap; }
.stage-legend span { display: inline-flex; align-items: center; gap: 6px; }
.stage-legend i { width: 7px; height: 7px; display: inline-block; border-radius: 2px; }
.legend-source { background: var(--violet); }
.legend-front { border: 1px solid var(--cyan); background: transparent; }
.legend-band { background: var(--amber); }
.canvas-wrap { flex: 1 1 auto; min-height: 180px; position: relative; overflow: hidden; border: 1px solid rgba(128, 168, 186, .14); border-radius: 13px; background: #081622; box-shadow: 0 12px 35px rgba(0,0,0,.16), inset 0 1px rgba(255,255,255,.025); }
#simulationCanvas { display: block; width: 100%; height: 100%; }
.canvas-corner { position: absolute; pointer-events: none; display: flex; flex-direction: column; gap: 4px; }
.canvas-corner.top-left { top: 14px; left: 16px; }
.canvas-corner.top-right { top: 14px; right: 15px; }
.corner-kicker { color: #6e8794; font-size: 8px; letter-spacing: .16em; font-weight: 750; }
.canvas-corner strong { font-size: 9px; letter-spacing: .1em; color: #b4c7ce; font-weight: 650; }
.scale-tag { font-size: 8px; letter-spacing: .14em; color: #6c8592; border: 1px solid rgba(127,160,174,.18); padding: 4px 6px; border-radius: 4px; background: rgba(6,17,26,.48); }
.stage-footer { flex: 0 0 auto; padding-top: 12px; }
.readouts { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); border: 1px solid var(--line); border-radius: 10px; background: rgba(13, 27, 39, .72); overflow: hidden; }
.readout { padding: 10px 12px 9px; min-width: 0; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; }
.readout:last-child { border-right: 0; }
.readout-label { font-size: 8px; letter-spacing: .12em; color: #748c98; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.readout strong { font-size: 20px; line-height: 1.15; letter-spacing: -.04em; font-weight: 620; color: #e8f1f4; font-variant-numeric: tabular-nums; }
.readout-unit { font-size: 9px; color: #7e96a2; }
.readout-unit i { font-style: normal; font-size: 7px; letter-spacing: .09em; color: #536c78; margin-left: 3px; }
.time-readout strong { color: var(--cyan); }
.caption-row { display: flex; align-items: flex-start; gap: 9px; padding: 10px 4px 0; min-height: 35px; }
.caption-arrow { color: var(--cyan); font-size: 14px; line-height: 1.2; }
.caption-row p { margin: 0; color: #8da4af; font-size: 10px; line-height: 1.45; }
.control-panel { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 18px 14px; background: linear-gradient(180deg, rgba(12,24,35,.97), rgba(8,18,27,.98)); scrollbar-width: thin; scrollbar-color: #29404d transparent; }
.control-panel::-webkit-scrollbar { width: 6px; }
.control-panel::-webkit-scrollbar-thumb { background: #29404d; border-radius: 8px; }
.panel-section { padding-bottom: 15px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 11px; }
.section-heading > div { display: flex; align-items: baseline; gap: 8px; }
.section-index { color: var(--cyan); font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.section-heading h2 { margin: 0; font-size: 12px; letter-spacing: -.01em; font-weight: 650; }
.section-note { color: #617987; font-size: 7px; letter-spacing: .12em; font-weight: 700; text-align: right; }
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.preset-card { display: flex; align-items: center; gap: 8px; position: relative; min-width: 0; min-height: 54px; padding: 8px; border: 1px solid var(--line-strong); border-radius: 9px; background: rgba(15,31,44,.78); text-align: left; cursor: pointer; transition: border-color .18s ease, background .18s ease; }
.preset-card:hover { border-color: rgba(99,217,220,.32); }
.preset-card.selected { border-color: rgba(99,217,220,.52); background: rgba(40, 83, 91, .2); }
.preset-swatch { width: 33px; height: 32px; flex: 0 0 33px; border-radius: 6px; background: #102a35; border: 1px solid rgba(126,176,188,.16); display: flex; align-items: center; justify-content: center; gap: 3px; overflow: hidden; }
.band-swatch i { height: 19px; width: 2px; background: var(--amber); box-shadow: 0 0 5px rgba(244,182,107,.5); border-radius: 3px; }
.band-swatch i:nth-child(2) { height: 24px; opacity: .75; }
.band-swatch i:nth-child(3) { height: 16px; opacity: .85; }
.band-swatch i:nth-child(4) { height: 21px; }
.clear-swatch { background: linear-gradient(90deg, rgba(168,156,255,.22), rgba(99,217,220,.04)); }
.clear-swatch i { width: 20px; height: 1px; background: rgba(99,217,220,.5); }
.preset-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.preset-copy strong { font-size: 9px; font-weight: 700; white-space: nowrap; }
.preset-copy small { font-size: 7px; color: #8299a5; white-space: nowrap; }
.preset-check { display: none; position: absolute; top: 5px; right: 6px; color: var(--cyan); font-size: 9px; }
.preset-card.selected .preset-check { display: block; }
.conditions-section { padding-bottom: 12px; }
.slider-list { display: flex; flex-direction: column; gap: 10px; }
.control-row { min-width: 0; }
.control-topline { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.control-topline label { color: #c5d4da; font-size: 10px; font-weight: 560; }
.control-topline .symbol { color: #82a5af; font-style: italic; margin-left: 4px; }
.control-topline output { color: var(--cyan); font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
input[type="range"] { display: block; width: 100%; height: 12px; margin: 0; padding: 0; appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer; touch-action: pan-y; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 5px; background: linear-gradient(90deg, rgba(99,217,220,.72), rgba(99,217,220,.17)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 5px; background: linear-gradient(90deg, rgba(99,217,220,.72), rgba(99,217,220,.17)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #d5f7f3; border: 2px solid #48bdc4; margin-top: -4.5px; box-shadow: 0 0 0 3px rgba(99,217,220,.11), 0 0 9px rgba(99,217,220,.24); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; background: #d5f7f3; border: 2px solid #48bdc4; box-shadow: 0 0 0 3px rgba(99,217,220,.11); }
.range-ends { display: flex; justify-content: space-between; align-items: center; color: #607985; font-size: 7px; line-height: 1; margin-top: 2px; }
.range-ends em { color: #506a76; font-style: normal; letter-spacing: .1em; font-size: 6px; }
.check-card { border: 1px solid rgba(99,217,220,.19); border-radius: 10px; background: linear-gradient(135deg, rgba(18,47,55,.48), rgba(13,28,40,.6)); padding: 11px 11px 9px; margin-bottom: 13px; }
.check-head { display: flex; align-items: center; gap: 8px; }
.check-icon { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; background: rgba(99,217,220,.12); color: var(--cyan); font-size: 16px; }
.check-head > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.check-head strong { font-size: 9px; font-weight: 700; }
.check-head small { font-size: 7px; color: #8199a5; }
.check-status { margin-left: auto; color: var(--cyan); font-size: 7px; letter-spacing: .12em; font-weight: 800; }
.check-values { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; padding: 10px 0 7px; }
.check-values > div { display: flex; flex-direction: column; gap: 3px; border-right: 1px solid var(--line); }
.check-values > div:last-child { border: 0; }
.check-values span { font-size: 7px; color: #78909b; }
.check-values strong { font-size: 12px; color: #dbe8eb; font-variant-numeric: tabular-nums; }
.check-diff strong { color: var(--cyan); }
.check-foot { border-top: 1px solid var(--line); padding-top: 7px; color: #627d88; font-size: 7px; letter-spacing: .02em; }
.science-panel { border: 1px solid var(--line); border-radius: 10px; background: rgba(14,28,40,.55); margin-bottom: 12px; }
.science-panel summary { display: flex; align-items: center; gap: 9px; list-style: none; cursor: pointer; padding: 10px 11px; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-icon { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: rgba(168,156,255,.11); color: #b8adff; font-size: 13px; }
.science-panel summary > span:nth-child(2) { display: flex; flex-direction: column; gap: 2px; }
.science-panel summary strong { font-size: 9px; }
.science-panel summary small { color: #7f97a2; font-size: 7px; }
.summary-chevron { margin-left: auto; color: #77909b; font-size: 14px; transition: transform .2s ease; }
.science-panel[open] .summary-chevron { transform: rotate(180deg); }
.science-content { padding: 0 11px 12px; border-top: 1px solid var(--line); }
.science-content h3 { color: #c7d7dc; font-size: 9px; margin: 11px 0 6px; letter-spacing: .02em; }
.science-content p { color: #849ba6; font-size: 8px; line-height: 1.55; margin: 6px 0; }
.equation { color: #c9e9e7; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 9px; line-height: 1.5; padding: 7px 8px; background: rgba(5,14,22,.62); border: 1px solid rgba(99,217,220,.11); border-radius: 6px; overflow-wrap: anywhere; }
.science-disclaimer { color: #9fb4bd !important; padding-top: 7px; border-top: 1px solid var(--line); }
.panel-foot { display: flex; align-items: center; gap: 7px; color: #627b87; font-size: 7px; line-height: 1.4; padding: 0 2px 3px; }
.foot-dot { width: 5px; height: 5px; border-radius: 50%; background: #718d99; flex: 0 0 5px; }
@media (max-width: 980px) and (min-width: 701px) {
  .workspace { grid-template-columns: minmax(0,1fr) 340px; }
  .topbar { padding: 0 18px; }
  .stage-shell { padding-left: 18px; padding-right: 16px; }
  .control-panel { padding-left: 14px; padding-right: 14px; }
  .stage-legend { gap: 8px; font-size: 8px; }
}
@media (max-width: 700px) {
  body { overflow: hidden; }
  .topbar { flex: 0 0 64px; min-height: 64px; padding: 0 11px; gap: 7px; }
  .brand-lockup { gap: 8px; }
  .brand-mark { width: 27px; height: 27px; border-radius: 8px; }
  .eyebrow { font-size: 7px; letter-spacing: .13em; }
  h1 { font-size: 16px; margin-top: 3px; }
  .top-actions { gap: 4px; }
  .tool-button { height: 32px; padding: 0 8px; font-size: 9px; border-radius: 8px; }
  .tool-button.primary { min-width: 58px; padding: 0 8px; gap: 4px; }
  .button-icon { width: 14px; height: 14px; flex-basis: 14px; }
  .icon-only { width: 31px; padding: 0; }
  .action-divider { height: 18px; margin: 0 1px; }
  .quality-button { height: 27px; padding: 0 6px; font-size: 8px; gap: 5px; }
  .quality-dot { width: 5px; height: 5px; }
  .workspace { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(0, 1.02fr) minmax(0, 1fr); }
  .stage-shell { padding: 8px 9px 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .stage-head { flex: 0 0 23px; padding: 0 2px 6px; }
  .stage-heading { font-size: 7px; gap: 6px; letter-spacing: .12em; }
  .live-dot { width: 5px; height: 5px; }
  .stage-legend { gap: 8px; font-size: 7px; }
  .stage-legend span { gap: 4px; }
  .stage-legend i { width: 6px; height: 6px; }
  .canvas-wrap { min-height: 100px; border-radius: 9px; }
  .canvas-corner.top-left { top: 8px; left: 9px; gap: 2px; }
  .canvas-corner.top-right { top: 8px; right: 8px; }
  .corner-kicker { font-size: 6px; }
  .canvas-corner strong { font-size: 7px; }
  .scale-tag { font-size: 6px; padding: 3px 4px; }
  .stage-footer { padding-top: 6px; }
  .readouts { border-radius: 7px; }
  .readout { padding: 5px 6px 5px; gap: 2px; }
  .readout-label { font-size: 6px; letter-spacing: .07em; }
  .readout strong { font-size: 15px; }
  .readout-unit { font-size: 7px; }
  .readout-unit i { font-size: 5px; margin-left: 1px; }
  .caption-row { padding: 5px 2px 0; gap: 5px; min-height: 25px; }
  .caption-arrow { font-size: 11px; }
  .caption-row p { font-size: 8px; line-height: 1.3; }
  .control-panel { padding: 10px 12px 16px; }
  .panel-section { padding-bottom: 10px; margin-bottom: 10px; }
  .section-heading { margin-bottom: 7px; }
  .section-heading h2 { font-size: 11px; }
  .section-note { font-size: 6px; }
  .preset-card { min-height: 46px; padding: 6px; gap: 6px; }
  .preset-swatch { width: 28px; height: 27px; flex-basis: 28px; }
  .preset-copy strong { font-size: 8px; }
  .preset-copy small { font-size: 6px; }
  .slider-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 13px; row-gap: 9px; }
  .control-topline { gap: 4px; margin-bottom: 3px; }
  .control-topline label { font-size: 8px; }
  .control-topline output { font-size: 8px; white-space: nowrap; }
  .range-ends { font-size: 6px; }
  .range-ends em { font-size: 5px; }
  .check-card { padding: 8px 9px 7px; margin-bottom: 9px; }
  .check-icon { width: 21px; height: 21px; }
  .check-head strong { font-size: 8px; }
  .check-head small { font-size: 6px; }
  .check-values { padding: 7px 0 5px; }
  .check-values strong { font-size: 10px; }
  .science-panel summary { padding: 8px 9px; }
  .science-content { padding: 0 9px 9px; }
  .science-content p { font-size: 7px; }
  .equation { font-size: 8px; }
  .panel-foot { font-size: 6px; }
}
@media (max-width: 370px) {
  .eyebrow { display: none; }
  h1 { font-size: 15px; }
  .tool-button.primary { min-width: 48px; }
  .top-actions { gap: 3px; }
  .quality-button { font-size: 7px; }
  .stage-legend { gap: 5px; }
  .stage-legend span { font-size: 6px; }
  .readout { padding-left: 4px; padding-right: 4px; }
  .readout-label { font-size: 5px; }
  .readout strong { font-size: 13px; }
  .slider-list { column-gap: 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; overflow: hidden; }
