:root {
  color-scheme: dark;
  --bg: #09111b;
  --panel: #101c29;
  --panel-2: #132231;
  --line: #26394b;
  --line-soft: rgba(126, 158, 183, .14);
  --text: #e9f1f6;
  --muted: #91a5b7;
  --quiet: #61788c;
  --accent: #6de2c2;
  --accent-soft: rgba(109, 226, 194, .12);
  --accent-line: rgba(109, 226, 194, .38);
  --warning: #e3c18a;
  --radius: 14px;
  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-height: 100%; background: var(--bg); color: var(--text); }
body { min-height: 100vh; overflow-x: hidden; }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(ellipse at 45% -35%, rgba(35, 82, 92, .2), transparent 56%), var(--bg); }
.embed-mode .app-shell { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
.topbar { flex: 0 0 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 9px 22px; border-bottom: 1px solid var(--line-soft); background: rgba(9, 17, 27, .9); }
.identity { min-width: 0; display: flex; align-items: center; gap: 12px; }
.mark { width: 43px; height: 43px; display: grid; place-items: center; color: var(--accent); border: 1px solid var(--accent-line); border-radius: 13px; background: var(--accent-soft); flex: 0 0 auto; }
.mark svg { width: 34px; height: 34px; }
.title-stack { min-width: 0; }
.eyebrow, .section-kicker { color: var(--accent); font-size: 9px; font-weight: 750; letter-spacing: .16em; line-height: 1.2; }
h1 { margin: 3px 0 0; font-size: 20px; line-height: 1.05; letter-spacing: -.035em; font-weight: 680; }
.title-stack p { margin: 3px 0 0; color: var(--muted); font-size: 10px; line-height: 1.2; }
.top-actions { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.live-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; margin-right: 5px; color: #b6c8d5; border: 1px solid var(--line); border-radius: 999px; font-size: 9px; font-weight: 750; letter-spacing: .12em; white-space: nowrap; }
.live-dot, .hint-dot, .status-led { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px rgba(109, 226, 194, .55); }
.tool-button { height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: #111e2b; color: #c7d4de; font-size: 11px; font-weight: 620; cursor: pointer; transition: background .18s ease, border-color .18s ease, transform .18s ease; white-space: nowrap; }
.tool-button:hover { border-color: #496176; background: #192a39; }
.tool-button:active { transform: translateY(1px); }
.tool-button.primary { color: #092018; background: var(--accent); border-color: var(--accent); }
.tool-button.primary:hover { background: #8af0d5; }
.control-rack { flex: 0 0 auto; padding: 9px 22px 8px; background: #0d1824; border-bottom: 1px solid var(--line-soft); }
.controls-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px; }
.control-item { min-width: 0; }
.control-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.control-head label { min-width: 0; color: #d4e0e8; font-size: 10px; font-weight: 640; white-space: nowrap; }
.control-head label em { color: var(--quiet); font-size: 8px; font-style: normal; font-weight: 500; margin-left: 3px; }
.control-head output { color: var(--accent); font-size: 11px; font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
input[type="range"] { display: block; width: 100%; height: 13px; margin: 0; accent-color: var(--accent); cursor: pointer; background: transparent; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; background: #34495a; border-radius: 5px; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border: 2px solid #0d1824; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
input[type="range"]::-moz-range-track { height: 3px; background: #34495a; border-radius: 5px; }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border: 2px solid #0d1824; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.range-ends { display: flex; justify-content: space-between; color: #60788c; font-size: 8px; font-variant-numeric: tabular-nums; margin-top: 1px; }
.preset-row { display: flex; align-items: center; gap: 7px; margin-top: 6px; min-height: 24px; }
.preset-label, .quality-control > span { color: #6f879a; font-size: 8px; font-weight: 750; letter-spacing: .14em; margin-right: 2px; }
.preset-button { border: 1px solid #2a4052; background: #132231; color: #b4c5d1; padding: 4px 10px; border-radius: 999px; font-size: 9px; font-weight: 650; cursor: pointer; transition: all .18s ease; }
.preset-button:hover, .preset-button.active { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.quality-control { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.quality-control button { padding: 4px 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: #7e93a5; font-size: 9px; cursor: pointer; }
.quality-control button[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.workspace { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(380px, .85fr); gap: 12px; padding: 12px 18px 10px; }
.panel { min-width: 0; background: linear-gradient(155deg, rgba(20, 36, 51, .98), rgba(14, 26, 39, .98)); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0, 0, 0, .13); }
.map-panel { min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.panel-heading { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px 8px; }
.panel-heading h2, .chart-heading h2 { margin: 3px 0 0; font-size: 13px; font-weight: 670; letter-spacing: -.015em; }
.panel-hint { display: flex; align-items: center; gap: 7px; color: #8fa4b5; font-size: 9px; white-space: nowrap; }
.hint-dot { width: 5px; height: 5px; }
.map-stage { position: relative; flex: 1 1 auto; min-height: 0; padding: 0 7px; }
#mapCanvas { width: 100%; height: 100%; display: block; touch-action: pan-y; cursor: crosshair; }
.map-tooltip { position: absolute; z-index: 2; top: 9px; left: 13px; pointer-events: none; padding: 6px 8px; border: 1px solid rgba(109, 226, 194, .3); border-radius: 7px; background: rgba(8, 17, 27, .88); color: #d9e9ed; font-size: 9px; font-variant-numeric: tabular-nums; opacity: 0; transition: opacity .12s ease; }
.map-tooltip.visible { opacity: 1; }
.map-loading { position: absolute; inset: 0; display: grid; place-items: center; color: #a5b9c6; font-size: 11px; letter-spacing: .04em; background: rgba(9, 17, 27, .2); pointer-events: none; transition: opacity .3s ease; }
.map-loading.done { opacity: 0; }
.map-legend { flex: 0 0 30px; display: flex; align-items: center; gap: 15px; padding: 0 16px; border-top: 1px solid var(--line-soft); color: #9aafbd; font-size: 9px; }
.legend-key { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.swatch { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.swatch.locked { background: #6de2c2; box-shadow: 0 0 8px rgba(109, 226, 194, .25); }
.swatch.drift { background: #29485a; }
.legend-note { margin-left: auto; color: #71889b; font-size: 8px; text-align: right; }
.insights { min-height: 0; display: flex; flex-direction: column; gap: 9px; }
.readout-grid { flex: 0 0 auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.readout-card { min-width: 0; padding: 10px 10px 8px; border: 1px solid var(--line); border-radius: 11px; background: #111e2b; }
.readout-label { color: #8fa4b5; font-size: 8px; letter-spacing: .09em; font-weight: 760; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.readout-label span { display: block; margin-top: 2px; color: #5f778a; font-size: 7px; letter-spacing: .04em; font-weight: 500; }
.readout-value { margin-top: 5px; color: var(--accent); font-size: clamp(17px, 1.75vw, 24px); line-height: 1; font-weight: 670; letter-spacing: -.045em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.readout-unit { margin-top: 4px; color: #71899b; font-size: 8px; line-height: 1.15; }
.lock-status { flex: 0 0 29px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid var(--accent-line); border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 9px; font-weight: 780; letter-spacing: .1em; }
.status-led { width: 6px; height: 6px; flex: 0 0 auto; }
.status-detail { margin-left: auto; color: #a1b9c1; font-size: 8px; font-weight: 520; letter-spacing: 0; }
.chart-panel { min-height: 0; flex: 1 1 0; display: flex; flex-direction: column; overflow: hidden; }
.chart-heading { flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 12px 2px; }
.chart-heading h2 { font-size: 11px; }
.chart-heading .section-kicker { font-size: 8px; }
.chart-tag { color: #7f96a8; font-size: 8px; white-space: nowrap; }
.chart-tag b { color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 650; }
.chart-panel canvas { width: 100%; height: 100%; min-height: 0; display: block; }
.caption-strip { flex: 0 0 auto; min-height: 39px; display: flex; align-items: center; gap: 10px; padding: 6px 22px; border-top: 1px solid var(--line-soft); background: #0d1824; }
.caption-icon { width: 20px; height: 20px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid var(--accent-line); border-radius: 6px; color: var(--accent); background: var(--accent-soft); font-size: 12px; }
.caption-strip p { flex: 1 1 auto; min-width: 0; margin: 0; color: #b6c6d1; font-size: 10px; line-height: 1.3; }
.science-toggle { flex: 0 0 auto; border: 0; padding: 5px 0 5px 10px; background: transparent; color: var(--accent); font-size: 10px; font-weight: 650; cursor: pointer; white-space: nowrap; }
.chevron { display: inline-block; margin-left: 4px; transition: transform .2s ease; }
.science-drawer { flex: 0 0 auto; border-top: 1px solid var(--line-soft); background: #0a141f; }
.science-body { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; max-height: 38vh; overflow: auto; padding: 17px 22px 20px; }
.science-body[hidden] { display: none; }
.science-drawer.open .chevron { transform: rotate(180deg); }
.science-column p { margin: 8px 0 0; color: #9db0bd; font-size: 10px; line-height: 1.55; }
.equation { margin-top: 9px; color: #e2edf2; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; line-height: 1.5; letter-spacing: -.02em; }
.fraction { display: inline-block; padding: 0 2px; border-bottom: 1px solid #9fb2bf; }
.check-line { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 10px; color: #8da4b5; font-size: 9px; }
.check-line b { margin-left: 3px; color: var(--accent); font-variant-numeric: tabular-nums; }
.check-line strong { color: #dce9e8; font-weight: 650; }
.science-column p.simplification { margin-top: 12px; color: #8298a9; }
.science-column p.disclaimer { color: #7d958d; font-size: 9px; }
@media (max-width: 920px) and (min-width: 761px) {
  .workspace { grid-template-columns: minmax(0, 1.1fr) minmax(330px, .9fr); padding-left: 12px; padding-right: 12px; }
  .controls-grid { gap: 10px; }
  .control-head label { font-size: 9px; }
  .readout-card { padding-left: 7px; padding-right: 7px; }
  .readout-label { font-size: 7px; }
  .topbar { padding-left: 14px; padding-right: 14px; }
  .tool-button { padding: 0 8px; }
}
@media (max-width: 760px) {
  .embed-mode .app-shell { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto; }
  .topbar { min-height: 62px; flex-basis: auto; padding: 7px 11px; gap: 8px; }
  .mark { width: 36px; height: 36px; border-radius: 10px; }
  .mark svg { width: 29px; height: 29px; }
  .eyebrow { font-size: 7px; }
  h1 { font-size: 17px; }
  .title-stack p { font-size: 8px; }
  .top-actions { gap: 4px; }
  .live-pill { display: none; }
  .tool-button { width: 32px; height: 32px; padding: 0; font-size: 12px; border-radius: 8px; }
  .tool-button span { display: none; }
  .control-rack { padding: 7px 11px 6px; }
  .controls-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 13px; }
  .control-item { min-height: 39px; }
  .control-head { margin-bottom: 2px; }
  .control-head label { font-size: 9px; }
  .control-head label em { font-size: 7px; }
  .control-head output { font-size: 10px; }
  .range-ends { font-size: 7px; margin-top: -1px; }
  input[type="range"] { height: 10px; }
  .preset-row { margin-top: 4px; min-height: 23px; gap: 5px; }
  .preset-label, .quality-control > span { font-size: 7px; }
  .preset-button { padding: 4px 8px; font-size: 8px; }
  .quality-control button { padding: 4px 6px; font-size: 8px; }
  .workspace { min-height: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(235px, 1.12fr) minmax(205px, .88fr); gap: 7px; padding: 7px 9px 6px; }
  .panel-heading { padding: 8px 11px 4px; }
  .panel-heading h2 { font-size: 11px; }
  .section-kicker { font-size: 7px; }
  .panel-hint { font-size: 8px; }
  .map-legend { flex-basis: 24px; padding: 0 10px; gap: 9px; font-size: 8px; }
  .legend-note { font-size: 7px; }
  .insights { display: grid; grid-template-columns: 1fr; grid-template-rows: auto auto minmax(90px, 1fr); gap: 5px; }
  .readout-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
  .readout-card { padding: 6px 7px 5px; border-radius: 8px; }
  .readout-label { font-size: 7px; letter-spacing: .04em; }
  .readout-label span { display: inline; margin-left: 2px; font-size: 6px; }
  .readout-value { margin-top: 4px; font-size: 17px; }
  .readout-unit { margin-top: 3px; font-size: 7px; }
  .lock-status { display: flex; min-height: 25px; }
  .response-panel { display: flex; min-height: 92px; }
  .orbit-panel { display: none; }
  .chart-heading { padding: 5px 9px 0; }
  .chart-heading h2 { font-size: 9px; }
  .chart-heading .section-kicker { font-size: 6px; }
  .caption-strip { min-height: 35px; padding: 5px 10px; gap: 7px; }
  .caption-icon { width: 18px; height: 18px; }
  .caption-strip p { font-size: 8px; }
  .science-toggle { font-size: 9px; padding-left: 4px; }
  .science-body { grid-template-columns: 1fr; gap: 15px; padding: 13px 14px 17px; max-height: 42dvh; }
  .equation { font-size: 10px; }
  .science-column p { font-size: 9px; }
}
@media (max-width: 380px) {
  .title-stack p { display: none; }
  .tool-button { width: 29px; height: 30px; }
  .control-head label { font-size: 8px; }
  .readout-value { font-size: 15px; }
  .map-legend { gap: 7px; }
  .legend-note { 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; }
}
