:root {
  color-scheme: dark;
  --bg: #081116;
  --panel: #0d1a20;
  --panel-raised: #102129;
  --panel-soft: #12252d;
  --line: rgba(173, 213, 218, .12);
  --line-strong: rgba(173, 213, 218, .2);
  --text: #e4f0ef;
  --muted: #8ca4a7;
  --dim: #62797d;
  --accent: #56e0d0;
  --accent-soft: rgba(86, 224, 208, .13);
  --violet: #9c8cff;
  --warn: #f0b779;
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; background: var(--bg); color: var(--text); }
body { overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { height: 100vh; height: 100dvh; display: flex; flex-direction: column; min-width: 0; background: radial-gradient(ellipse at 35% 35%, rgba(20, 65, 70, .12), transparent 45%), var(--bg); }
.topbar { height: 72px; flex: 0 0 72px; display: flex; align-items: center; gap: 14px; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(8, 17, 22, .94); z-index: 2; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid rgba(86, 224, 208, .28); background: var(--accent-soft); color: var(--accent); border-radius: 12px; }
.brand-mark svg { width: 27px; height: 27px; }
.heading-group { min-width: 0; }
.eyebrow { color: var(--muted); font-size: 9px; line-height: 1.3; letter-spacing: .16em; font-weight: 750; }
h1 { margin: 3px 0 0; font-size: 17px; line-height: 1.2; font-weight: 650; letter-spacing: -.025em; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.model-pill { display: inline-flex; align-items: center; gap: 7px; border: 1px solid rgba(86,224,208,.22); background: rgba(86,224,208,.07); color: #9beee4; padding: 7px 10px; border-radius: 99px; font-size: 9px; letter-spacing: .09em; font-weight: 750; white-space: nowrap; }
.live-dot, .tiny-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px rgba(86,224,208,.65); }
.version-note { color: var(--dim); font-size: 9px; letter-spacing: .14em; font-weight: 700; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 390px; flex: 1; min-height: 0; min-width: 0; }
.stage-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 18px 20px 16px; gap: 12px; }
.stage-topline { height: 18px; flex: 0 0 18px; display: flex; align-items: center; justify-content: space-between; color: #9cb4b7; font-size: 9px; letter-spacing: .14em; font-weight: 750; }
.stage-topline > span:first-child { display: flex; align-items: center; gap: 8px; }
.stage-coordinate { color: var(--dim); }
.stage-wrap { position: relative; flex: 1; min-height: 180px; overflow: hidden; border: 1px solid rgba(130, 184, 188, .16); border-radius: 18px; background: #09171d; box-shadow: 0 20px 60px rgba(0,0,0,.18), inset 0 0 60px rgba(26,75,80,.08); }
.stage-wrap::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255,255,255,.018), inset 0 -60px 80px rgba(4,13,17,.16); }
#fieldCanvas { display: block; width: 100%; height: 100%; }
.canvas-legend { position: absolute; top: 14px; right: 14px; display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; max-width: 65%; padding: 8px 10px; border: 1px solid rgba(171,210,213,.12); border-radius: 9px; background: rgba(7,17,22,.68); backdrop-filter: blur(8px); color: #b4c7c8; font-size: 9px; letter-spacing: .02em; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend-swatch { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.legend-swatch.positive { background: var(--accent); box-shadow: 0 0 7px rgba(86,224,208,.7); }
.legend-swatch.negative { background: var(--violet); box-shadow: 0 0 7px rgba(156,140,255,.65); }
.legend-swatch.sensor { background: #e4fff9; border: 1px solid var(--accent); }
.canvas-footer { position: absolute; bottom: 13px; left: 15px; right: 15px; display: flex; justify-content: space-between; pointer-events: none; color: rgba(167,194,196,.65); font-size: 8px; letter-spacing: .12em; font-weight: 700; }
.stage-caption { min-height: 66px; flex: 0 0 auto; display: flex; align-items: center; gap: 13px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 13px; background: rgba(14,29,35,.76); }
.caption-icon { width: 32px; height: 32px; display: grid; place-items: center; flex: 0 0 auto; color: var(--accent); background: var(--accent-soft); border-radius: 10px; font-size: 21px; }
.caption-kicker { margin-bottom: 4px; color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.stage-caption p { margin: 0; color: #b4c7c8; font-size: 11px; line-height: 1.45; }
.control-panel { min-height: 0; min-width: 0; border-left: 1px solid var(--line); background: linear-gradient(180deg, rgba(14,27,33,.97), rgba(10,21,26,.98)); }
.panel-scroll { height: 100%; overflow-y: auto; overscroll-behavior: contain; padding: 20px 20px 18px; scrollbar-width: thin; scrollbar-color: #294148 transparent; }
.panel-scroll::-webkit-scrollbar { width: 5px; }
.panel-scroll::-webkit-scrollbar-thumb { background: #294148; border-radius: 10px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-bottom: 13px; }
h2 { margin: 4px 0 0; font-size: 14px; font-weight: 650; letter-spacing: -.02em; }
.unit-note { color: #6d878b; font-size: 8px; letter-spacing: .12em; font-weight: 800; white-space: nowrap; }
.metrics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.metric-card { min-width: 0; padding: 11px 12px 10px; border: 1px solid var(--line); border-radius: 11px; background: rgba(19,39,47,.62); }
.metric-main { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; column-gap: 10px; padding: 12px 14px; border-color: rgba(86,224,208,.19); background: linear-gradient(110deg, rgba(27,70,72,.38), rgba(18,39,46,.62)); }
.metric-label { color: #8ea8aa; font-size: 9px; font-weight: 650; letter-spacing: .025em; }
.metric-value { margin-top: 5px; color: #ecf8f6; font-size: 23px; line-height: 1; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.04em; white-space: nowrap; }
.metric-main .metric-value { grid-column: 2; grid-row: 1 / span 2; margin: 0; color: var(--accent); font-size: 27px; }
.metric-value small { margin-left: 4px; color: #91adae; font-size: 10px; font-weight: 550; letter-spacing: 0; }
.metric-foot { margin-top: 6px; color: #60797d; font-size: 8px; letter-spacing: .03em; }
.metric-main .metric-foot { grid-column: 1; }
.threshold-track { position: relative; height: 5px; margin: 13px 2px 5px; overflow: visible; border-radius: 99px; background: #263c42; }
.threshold-track-fill { position: absolute; inset: 0 auto 0 0; width: 72%; border-radius: inherit; background: linear-gradient(90deg, #287c78, var(--accent)); box-shadow: 0 0 12px rgba(86,224,208,.28); transition: width .18s ease; }
.threshold-marker { position: absolute; top: -3px; left: 45%; width: 2px; height: 11px; border-radius: 2px; background: #e3e9dc; box-shadow: 0 0 0 2px rgba(8,17,22,.75); }
.threshold-labels { display: flex; justify-content: space-between; color: #6e888b; font-size: 8px; letter-spacing: .05em; }
#thresholdStatus { color: var(--accent); font-weight: 800; letter-spacing: .1em; }
.control-section { margin-top: 22px; padding-top: 17px; border-top: 1px solid var(--line); }
.compact-heading { margin-bottom: 15px; }
.control-row { margin-bottom: 14px; }
.control-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.control-title label { color: #c5d5d4; font-size: 10px; font-weight: 600; }
.control-title output { color: var(--accent); font-size: 10px; font-variant-numeric: tabular-nums; font-weight: 700; }
input[type="range"] { display: block; width: 100%; height: 13px; margin: 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(86,224,208,.65), #294148); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 5px; background: linear-gradient(90deg, rgba(86,224,208,.65), #294148); }
input[type="range"]::-webkit-slider-thumb { width: 13px; height: 13px; margin-top: -5px; border: 2px solid #b9fff5; border-radius: 50%; appearance: none; -webkit-appearance: none; background: #2eaaa0; box-shadow: 0 0 0 4px rgba(86,224,208,.1), 0 0 10px rgba(86,224,208,.45); }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border: 2px solid #b9fff5; border-radius: 50%; background: #2eaaa0; box-shadow: 0 0 0 4px rgba(86,224,208,.1); }
input[type="range"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.range-ends { display: flex; justify-content: space-between; margin-top: 3px; color: #5f777b; font-size: 8px; font-variant-numeric: tabular-nums; }
.last-control { margin-bottom: 2px; }
.preset-section { margin-top: 19px; padding-top: 16px; border-top: 1px solid var(--line); }
.preset-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.preset-button { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 9px 8px; text-align: left; border: 1px solid var(--line); border-radius: 10px; background: rgba(17,35,42,.6); cursor: pointer; transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.preset-button:hover { border-color: rgba(86,224,208,.35); background: rgba(24,52,57,.8); }
.preset-button:active { transform: translateY(1px); }
.preset-button.active { border-color: rgba(86,224,208,.42); background: rgba(33,80,78,.24); }
.preset-icon { width: 27px; height: 27px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 8px; background: rgba(86,224,208,.1); color: var(--accent); font-size: 18px; }
.far-icon { color: #a99cff; background: rgba(156,140,255,.1); }
.preset-button strong { display: block; color: #d6e4e2; font-size: 9px; font-weight: 700; white-space: nowrap; }
.preset-button small { display: block; margin-top: 3px; color: #71898d; font-size: 8px; white-space: nowrap; }
.check-section { margin-top: 17px; padding: 13px 13px 11px; border: 1px solid rgba(86,224,208,.16); border-radius: 12px; background: rgba(12,29,34,.7); }
.check-heading { display: flex; align-items: center; justify-content: space-between; }
.check-heading h2 { font-size: 12px; }
.check-icon { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 7px; color: var(--accent); background: rgba(86,224,208,.1); font-size: 13px; }
.check-values { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 13px; }
.check-values div { min-width: 0; }
.check-values span { display: block; color: #71898d; font-size: 8px; }
.check-values strong { display: block; margin-top: 4px; color: #d6e9e6; font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums; }
.check-result { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); color: #799195; font-size: 8px; line-height: 1.45; }
.transport-section { margin-top: 16px; }
.transport-buttons { display: grid; grid-template-columns: 1fr 1fr 38px; gap: 7px; }
.transport-button { min-height: 36px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 9px; background: #14262d; color: #c6d8d7; font-size: 10px; font-weight: 650; cursor: pointer; transition: background .16s ease, border-color .16s ease; }
.transport-button:hover { background: #1a343a; border-color: rgba(86,224,208,.3); }
.transport-button.primary { border-color: rgba(86,224,208,.32); background: rgba(43,119,111,.22); color: #aaf5eb; }
.transport-button.primary:hover { background: rgba(43,119,111,.34); }
.transport-button.icon-only { font-size: 18px; }
.utility-row { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; }
.text-button { display: inline-flex; align-items: center; gap: 7px; padding: 5px 2px; border: 0; background: transparent; color: #789296; font-size: 9px; cursor: pointer; }
.text-button:hover { color: var(--accent); }
.quality-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 7px rgba(86,224,208,.5); }
.science-panel { margin-top: 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.science-panel summary { display: flex; align-items: center; gap: 9px; padding: 13px 0; color: #c9d9d7; font-size: 10px; font-weight: 700; cursor: pointer; list-style: none; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-symbol { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 7px; background: rgba(86,224,208,.1); color: var(--accent); font-size: 14px; }
.summary-chevron { margin-left: auto; color: #779194; font-size: 16px; transition: transform .18s ease; }
.science-panel[open] .summary-chevron { transform: rotate(180deg); }
.science-content { padding: 0 0 13px; }
.science-lead { margin: 0 0 12px; color: #a5baba; font-size: 9px; line-height: 1.6; }
.equation-block { margin: 8px 0; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(4,14,18,.38); }
.equation-label { margin-bottom: 7px; color: #6f8a8d; font-size: 7px; letter-spacing: .12em; font-weight: 800; }
.equation-block code { display: block; margin: 4px 0; color: #b7f0e8; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 9px; line-height: 1.5; white-space: normal; }
.science-note { margin: 9px 0 0; color: #829a9c; font-size: 8px; line-height: 1.6; }
.science-note strong { color: #b8cbca; }
.disclaimer { margin: 11px 0 0; padding-top: 9px; border-top: 1px solid var(--line); color: #6f878a; font-size: 8px; font-style: italic; line-height: 1.5; }
.panel-footer { margin-top: 13px; color: #536d71; font-size: 7px; letter-spacing: .1em; text-align: center; }
.panel-footer span { padding: 0 3px; color: #7da39f; }
button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 1050px) and (min-width: 761px) {
  .workspace { grid-template-columns: minmax(0,1fr) 350px; }
  .panel-scroll { padding: 17px 15px; }
  .stage-panel { padding: 16px 15px 14px; }
}
@media (max-width: 760px) {
  body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
  .app-shell { height: 100vh; height: 100dvh; }
  .topbar { height: 58px; flex-basis: 58px; padding: 0 12px; gap: 9px; }
  .brand-mark { width: 32px; height: 32px; border-radius: 10px; }
  .brand-mark svg { width: 23px; height: 23px; }
  .eyebrow { font-size: 7px; }
  h1 { font-size: 13px; }
  .topbar-right { gap: 0; }
  .model-pill { padding: 6px 7px; font-size: 7px; }
  .version-note { display: none; }
  .workspace { display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(245px, 43dvh) minmax(0,1fr); min-height: 0; }
  .stage-panel { padding: 10px 10px 8px; gap: 7px; }
  .stage-topline { height: 13px; flex-basis: 13px; font-size: 7px; }
  .stage-wrap { min-height: 0; border-radius: 13px; }
  .canvas-legend { top: 7px; right: 7px; gap: 7px; max-width: 74%; padding: 6px 7px; font-size: 7px; }
  .legend-item { gap: 4px; }
  .legend-swatch { width: 6px; height: 6px; }
  .canvas-footer { bottom: 7px; left: 9px; right: 9px; font-size: 6px; }
  .stage-caption { min-height: 49px; padding: 7px 10px; gap: 8px; border-radius: 10px; }
  .caption-icon { width: 26px; height: 26px; font-size: 17px; border-radius: 8px; }
  .caption-kicker { margin-bottom: 2px; font-size: 7px; }
  .stage-caption p { font-size: 8px; line-height: 1.35; }
  .control-panel { border-left: 0; border-top: 1px solid var(--line); min-height: 0; }
  .panel-scroll { padding: 12px 13px 16px; }
  .section-heading { margin-bottom: 9px; }
  h2 { font-size: 12px; }
  .unit-note { font-size: 7px; }
  .metrics-grid { gap: 6px; }
  .metric-card { padding: 8px 9px 7px; border-radius: 9px; }
  .metric-main { padding: 8px 10px; }
  .metric-label { font-size: 8px; }
  .metric-value { margin-top: 4px; font-size: 18px; }
  .metric-main .metric-value { font-size: 22px; }
  .metric-value small { font-size: 8px; }
  .metric-foot { margin-top: 4px; font-size: 7px; }
  .threshold-track { margin-top: 10px; }
  .threshold-labels { font-size: 7px; }
  .control-section { margin-top: 14px; padding-top: 12px; }
  .compact-heading { margin-bottom: 11px; }
  .control-row { margin-bottom: 10px; }
  .control-title { margin-bottom: 4px; }
  .control-title label, .control-title output { font-size: 9px; }
  .range-ends { font-size: 7px; }
  .preset-section { margin-top: 13px; padding-top: 12px; }
  .preset-button { padding: 7px 6px; gap: 6px; }
  .preset-icon { width: 24px; height: 24px; font-size: 15px; }
  .preset-button strong { font-size: 8px; }
  .preset-button small { font-size: 7px; }
  .check-section { margin-top: 12px; padding: 10px; }
  .check-heading h2 { font-size: 10px; }
  .check-values { margin-top: 9px; }
  .check-values span, .check-result { font-size: 7px; }
  .check-values strong { font-size: 9px; }
  .transport-section { margin-top: 12px; }
  .transport-button { min-height: 33px; font-size: 9px; }
  .utility-row { margin-top: 6px; }
  .text-button { font-size: 8px; }
  .science-panel { margin-top: 12px; }
  .science-panel summary { padding: 10px 0; font-size: 9px; }
  .panel-footer { margin-top: 10px; font-size: 6px; }
}
@media (max-width: 380px) {
  .model-pill { font-size: 6px; }
  .canvas-legend { max-width: 78%; gap: 5px; font-size: 6px; }
  .legend-item { gap: 3px; }
  .stage-caption p { font-size: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
