:root {
  color-scheme: dark;
  --bg: #08151b;
  --panel: #0d1c23;
  --panel-2: #10232b;
  --panel-3: #142a32;
  --line: rgba(148, 183, 188, .14);
  --line-strong: rgba(148, 183, 188, .24);
  --text: #e2eceb;
  --muted: #8da3a6;
  --dim: #5d777d;
  --teal: #72c9c1;
  --teal-strong: #9be0d6;
  --amber: #e7b982;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--sans); }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
.app-shell { width: 100%; height: 100%; display: grid; grid-template-columns: 270px minmax(360px, 1fr) 254px; grid-template-rows: 60px minmax(0, 1fr) 120px; grid-template-areas: "header header header" "controls viewport data" "science science science"; background: var(--bg); }
.topbar { grid-area: header; display: flex; align-items: center; justify-content: space-between; padding: 0 20px 0 18px; background: #0b1920; border-bottom: 1px solid var(--line); z-index: 5; min-width: 0; }
.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 29px; height: 29px; display: flex; align-items: center; justify-content: center; gap: 2px; border: 1px solid rgba(114,201,193,.38); border-radius: 8px; background: linear-gradient(145deg, rgba(114,201,193,.13), rgba(114,201,193,.025)); transform: skewY(-4deg); }
.brand-mark span { display: block; width: 3px; border-radius: 4px; background: var(--teal); }
.brand-mark span:nth-child(1) { height: 9px; opacity: .55; }
.brand-mark span:nth-child(2) { height: 16px; }
.brand-mark span:nth-child(3) { height: 12px; opacity: .72; }
.brand-copy { min-width: 0; }
.eyebrow { font-size: 9px; font-weight: 750; letter-spacing: .16em; color: #82a2a5; line-height: 1.2; }
.eyebrow span { color: var(--teal); padding: 0 3px; }
.brand-title { margin-top: 4px; font-size: 14px; font-weight: 680; letter-spacing: -.015em; white-space: nowrap; }
.brand-subtitle { color: #8fa7aa; font-size: 12px; font-weight: 450; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.live-status { display: flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 9px; letter-spacing: .08em; color: #a6bbb8; }
.status-dot, .tag-dot { width: 6px; height: 6px; border-radius: 50%; background: #78d2b4; box-shadow: 0 0 10px rgba(120,210,180,.45); }
.topbar-divider, .transport-divider { width: 1px; height: 22px; background: var(--line-strong); }
.icon-button { border: 1px solid transparent; background: transparent; height: 32px; min-width: 32px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 7px; color: #9ab0b2; cursor: pointer; transition: background .18s, color .18s, border .18s; }
.icon-button:hover { color: var(--text); background: rgba(128,174,177,.1); border-color: var(--line); }
.icon-button svg, .export-button svg, .play-button svg, .transport-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#quality-label { font-family: var(--mono); font-size: 8px; letter-spacing: .08em; }
.export-button { display: inline-flex; align-items: center; gap: 7px; border: 1px solid rgba(114,201,193,.34); border-radius: 7px; padding: 7px 11px; color: #bce7df; background: rgba(71,153,146,.11); font-size: 10px; font-weight: 650; cursor: pointer; transition: background .18s, border .18s; }
.export-button:hover { background: rgba(71,153,146,.22); border-color: rgba(114,201,193,.6); }
.export-button svg { width: 14px; height: 14px; }
.controls-panel, .data-panel { min-height: 0; background: var(--panel); overflow: auto; scrollbar-width: thin; scrollbar-color: #29434b transparent; }
.controls-panel { grid-area: controls; border-right: 1px solid var(--line); padding: 20px 17px 18px; }
.data-panel { grid-area: data; border-left: 1px solid var(--line); padding: 20px 16px 18px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.panel-heading h2 { margin: 5px 0 0; font-size: 14px; font-weight: 650; letter-spacing: -.015em; }
.panel-index { font: 10px var(--mono); color: #59747a; }
.preset-section { margin-bottom: 19px; }
.section-label, .profile-heading, .validation-heading > div > span, .science-kicker { font-size: 9px; letter-spacing: .13em; font-weight: 750; color: #7d999d; }
.preset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-top: 9px; }
.preset-button { min-height: 57px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 5px 3px; border: 1px solid var(--line); border-radius: 7px; background: #102129; color: #91a8aa; font-size: 9px; cursor: pointer; transition: all .18s ease; }
.preset-button:hover { border-color: rgba(114,201,193,.35); color: var(--text); }
.preset-button.active { border-color: rgba(114,201,193,.55); color: #c6e8e2; background: linear-gradient(180deg, rgba(83,159,152,.18), rgba(38,89,89,.09)); box-shadow: inset 0 0 0 1px rgba(114,201,193,.05); }
.preset-icon { font-size: 17px; line-height: 1; color: var(--teal); }
.neap-icon { color: #9bbbc4; }
.narrow-icon { color: #d5b18b; }
.control-list { display: flex; flex-direction: column; gap: 15px; }
.control-item { min-width: 0; }
.control-label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.control-label label { font-size: 10px; font-weight: 560; color: #c5d4d2; }
.control-label output { color: #9bd9d0; font: 10px var(--mono); white-space: nowrap; }
input[type="range"] { width: 100%; height: 4px; margin: 0; appearance: none; -webkit-appearance: none; border-radius: 6px; background: linear-gradient(90deg, #5aaea5 0%, #5aaea5 50%, #263d44 50%, #263d44 100%); outline: none; cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #c6e9e2; border: 2px solid #438c86; box-shadow: 0 0 0 3px rgba(94,182,172,.13); }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: #c6e9e2; border: 2px solid #438c86; box-shadow: 0 0 0 3px rgba(94,182,172,.13); }
.range-ends { display: flex; justify-content: space-between; margin-top: 6px; color: #5e777c; font-size: 8px; }
.controls-note { display: flex; gap: 8px; margin-top: 19px; padding: 10px 9px; border: 1px solid rgba(113,163,163,.15); border-radius: 7px; background: rgba(47,91,94,.11); color: #8fa8a8; font-size: 9px; line-height: 1.5; }
.note-icon { flex: 0 0 15px; width: 15px; height: 15px; display: grid; place-items: center; border: 1px solid rgba(114,201,193,.38); border-radius: 50%; color: var(--teal); font: 10px Georgia, serif; }
.viewport-panel { grid-area: viewport; position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #0a171d; overflow: hidden; }
.viewport-topline { position: absolute; z-index: 3; left: 15px; right: 15px; top: 13px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.viewport-tag { display: inline-flex; align-items: center; gap: 8px; border: 1px solid rgba(166,204,203,.16); border-radius: 5px; padding: 6px 9px; background: rgba(8,22,28,.62); backdrop-filter: blur(8px); font: 8px var(--mono); letter-spacing: .1em; color: #b1c5c2; }
.tag-dot { width: 5px; height: 5px; }
.tag-separator { color: #5f777a; }
.viewport-tools { display: flex; gap: 12px; color: #9eb4b3; font: 8px var(--mono); letter-spacing: .04em; text-shadow: 0 1px 4px #000; }
.tool-hint { display: inline-flex; align-items: center; gap: 5px; }
kbd { padding: 3px 4px; border: 1px solid rgba(173,209,207,.24); border-radius: 3px; background: rgba(8,22,28,.45); color: #b7cfca; font: 7px var(--mono); }
.scene-host { position: relative; flex: 1; min-height: 0; overflow: hidden; background: radial-gradient(ellipse at 48% 44%, #1b3a43 0%, #10252d 54%, #09171d 100%); }
.scene-canvas { display: block; width: 100%; height: 100%; outline: none; }
.scene-loading { position: absolute; z-index: 4; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 12px; background: #0a171d; color: #86aaa9; font: 9px var(--mono); letter-spacing: .12em; transition: opacity .5s; }
.scene-loading.loaded { opacity: 0; pointer-events: none; }
.loading-spinner { width: 28px; height: 28px; border: 2px solid rgba(114,201,193,.18); border-top-color: var(--teal); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.scene-label { position: absolute; z-index: 2; display: flex; align-items: center; gap: 6px; color: rgba(217,236,231,.8); font: 8px var(--mono); letter-spacing: .11em; text-shadow: 0 1px 5px #071217; pointer-events: none; }
.mouth-label { left: 5%; bottom: 27%; }
.bore-label { left: 49%; bottom: 38%; color: #d5f2e9; }
.label-line { width: 20px; height: 1px; background: rgba(147,223,211,.8); }
.scene-compass { position: absolute; right: 18px; bottom: 24px; width: 27px; height: 37px; display: flex; align-items: center; flex-direction: column; gap: 3px; color: #a4c3c0; font: 8px var(--mono); opacity: .7; pointer-events: none; }
.compass-arrow { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 17px solid #9cc9c1; filter: drop-shadow(0 1px 2px #000); }
.scene-scale { position: absolute; left: 16px; bottom: 19px; display: flex; align-items: center; gap: 7px; color: #a5bcba; font: 8px var(--mono); text-shadow: 0 1px 4px #000; pointer-events: none; }
.scale-line { width: 54px; height: 1px; background: #c0d9d2; box-shadow: 0 2px 0 rgba(0,0,0,.35); }
.context-loss { position: absolute; z-index: 8; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: rgba(5,15,20,.88); text-align: center; color: #d7e7e3; }
.context-loss strong { font-size: 14px; }
.context-loss span { max-width: 260px; color: #9db4b3; font-size: 11px; line-height: 1.5; }
.transport-bar { flex: 0 0 54px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; border-top: 1px solid rgba(147,184,184,.16); background: #0d1d24; }
.transport-left, .transport-right { display: flex; align-items: center; gap: 9px; }
.play-button { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border: 1px solid rgba(112,201,191,.45); border-radius: 6px; background: rgba(68,151,143,.16); color: #c2e8e1; font-size: 10px; font-weight: 650; cursor: pointer; }
.play-button:hover { background: rgba(68,151,143,.28); }
.play-button svg { width: 13px; height: 13px; }
.transport-icon { width: 29px; height: 29px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 5px; background: transparent; color: #94aaac; cursor: pointer; }
.transport-icon:hover { border-color: var(--line); background: rgba(120,166,166,.1); color: #dce9e7; }
.transport-icon svg { width: 15px; height: 15px; }
.clock-readout { display: flex; flex-direction: column; gap: 2px; min-width: 63px; }
.clock-label { font: 7px var(--mono); color: #718d91; letter-spacing: .12em; }
.clock-readout strong { font: 12px var(--mono); color: #c7d9d5; }
.transport-right { gap: 8px; }
.transport-right label { font: 8px var(--mono); letter-spacing: .08em; color: #7e999b; white-space: nowrap; }
.transport-right input { width: 86px; }
.transport-right output { min-width: 35px; color: #a9dcd3; font: 9px var(--mono); }
.data-heading { margin-bottom: 15px; }
.telemetry-pulse { width: 7px; height: 7px; border-radius: 50%; background: #75cdb9; box-shadow: 0 0 0 4px rgba(117,205,185,.1), 0 0 10px rgba(117,205,185,.5); }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.metric-card { min-width: 0; padding: 10px 9px 9px; border: 1px solid var(--line); border-radius: 6px; background: linear-gradient(145deg, rgba(23,46,54,.7), rgba(14,31,38,.8)); }
.primary-metric { grid-column: span 2; background: linear-gradient(115deg, rgba(40,95,91,.25), rgba(17,43,48,.65)); border-color: rgba(114,201,193,.24); }
.metric-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; color: #7d999c; font: 7px var(--mono); letter-spacing: .1em; }
.metric-dot { width: 5px; height: 5px; border-radius: 50%; background: #79d1bf; }
.metric-unit { color: #5f7d82; font-size: 8px; }
.metric-value { margin-top: 7px; color: #dcebe7; font: 21px var(--mono); letter-spacing: -.055em; white-space: nowrap; }
.primary-metric .metric-value { color: #a9e0d5; font-size: 29px; }
.metric-value small { color: #83aaa7; font-size: 10px; letter-spacing: 0; }
.metric-foot { margin-top: 4px; color: #668187; font-size: 8px; line-height: 1.35; }
.profile-card { margin-top: 12px; padding: 10px 9px 8px; border: 1px solid var(--line); border-radius: 6px; background: rgba(15,34,41,.8); }
.profile-heading { display: flex; justify-content: space-between; font-size: 7px; letter-spacing: .1em; }
.profile-heading span:last-child { color: #5e7d82; }
#profile-svg { display: block; width: 100%; height: 75px; margin-top: 5px; overflow: visible; }
.profile-axis { display: flex; justify-content: space-between; color: #5e777c; font: 7px var(--mono); }
.validation-card { margin-top: 11px; padding: 11px 10px 9px; border: 1px solid rgba(118,177,166,.2); border-radius: 6px; background: linear-gradient(145deg, rgba(40,83,78,.15), rgba(13,31,37,.85)); }
.validation-heading { display: flex; align-items: center; gap: 8px; }
.validation-check { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: rgba(108,197,164,.14); color: #91d7ba; font-size: 12px; }
.validation-heading > div { display: flex; flex-direction: column; gap: 3px; }
.validation-heading > div > span { font-size: 7px; color: #7aa49c; }
.validation-heading strong { font-size: 10px; font-weight: 620; color: #d0e2dc; }
.validation-equation { margin: 9px 0 8px; color: #b9e5d9; font: 14px Georgia, serif; }
.validation-values { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.validation-values > div { display: flex; flex-direction: column; gap: 3px; }
.validation-values span, .validation-difference span { color: #64867f; font: 7px var(--mono); letter-spacing: .08em; }
.validation-values strong { color: #d0e4dc; font: 13px var(--mono); }
.validation-values small { color: #789c98; font-size: 8px; }
.validation-difference { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; padding-top: 7px; border-top: 1px solid rgba(118,177,166,.15); }
.validation-difference strong { color: #9ad8bb; font: 11px var(--mono); }
.validation-note { margin-top: 7px; color: #66807f; font-size: 7px; line-height: 1.4; }
.science-footer { grid-area: science; min-width: 0; border-top: 1px solid var(--line); background: #0b1920; display: flex; flex-direction: column; }
.science-details { flex: 1; min-height: 0; }
.science-details summary { min-height: 52px; display: flex; align-items: center; gap: 10px; padding: 8px 18px; cursor: pointer; list-style: none; user-select: none; }
.science-details summary::-webkit-details-marker { display: none; }
.science-summary-icon { width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid rgba(114,201,193,.22); border-radius: 6px; color: #9ddbd2; font: 15px Georgia, serif; background: rgba(70,133,128,.1); }
.science-details summary > span:nth-child(2) { display: flex; flex-direction: column; gap: 3px; }
.science-details summary strong { font-size: 10px; font-weight: 650; }
.science-details summary small { color: #789195; font-size: 8px; }
.summary-chevron { margin-left: auto; color: #83a6a4; font-size: 16px; transition: transform .2s; }
.science-details[open] .summary-chevron { transform: rotate(180deg); }
.science-content { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; padding: 0 20px 13px 54px; animation: reveal .2s ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.science-column { min-width: 0; }
.science-kicker { font-size: 7px; color: #6f9295; margin-bottom: 6px; }
.science-column p { margin: 4px 0; color: #8fa6a6; font-size: 8px; line-height: 1.45; }
.science-column strong { color: #c3d5d0; font-weight: 650; }
.science-column code { color: #a8d7ce; font: 8px var(--mono); white-space: normal; overflow-wrap: anywhere; }
.footer-meta { flex: 0 0 25px; display: flex; align-items: center; gap: 7px; padding: 0 18px; border-top: 1px solid rgba(148,183,188,.09); color: #5d777d; font: 7px var(--mono); letter-spacing: .055em; }
.footer-spacer { flex: 1; }
.footer-meta span:last-child { color: #627a7d; font-family: var(--sans); font-size: 7px; letter-spacing: 0; }
body.embed .topbar, body.embed .science-footer { display: none; }
body.embed .app-shell { grid-template-rows: minmax(0, 1fr); grid-template-areas: "controls viewport data"; }

@media (max-width: 1120px) and (min-width: 761px) {
  .app-shell { grid-template-columns: 235px minmax(300px,1fr) 225px; }
  .controls-panel { padding-left: 13px; padding-right: 13px; }
  .data-panel { padding-left: 12px; padding-right: 12px; }
  .viewport-tools { gap: 7px; }
  .tool-hint { gap: 3px; }
  .footer-meta { font-size: 6px; }
}
@media (max-height: 760px) and (min-width: 761px) {
  .app-shell { grid-template-rows: 54px minmax(0,1fr) 92px; }
  .controls-panel, .data-panel { padding-top: 13px; }
  .panel-heading { margin-bottom: 12px; }
  .control-list { gap: 11px; }
  .controls-note { margin-top: 12px; }
  .metric-card { padding: 7px 8px; }
  .metric-value { margin-top: 4px; font-size: 18px; }
  .primary-metric .metric-value { font-size: 25px; }
  .profile-card { margin-top: 8px; padding-top: 7px; }
  .validation-card { margin-top: 7px; padding: 8px; }
  .science-details summary { min-height: 42px; }
  .science-content { padding-bottom: 8px; }
  .science-column p { font-size: 7px; }
  .footer-meta { flex-basis: 21px; }
}
@media (max-width: 760px) {
  html, body { height: 100%; overflow: auto; }
  .app-shell { min-height: 100%; height: auto; overflow: visible; display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: 58px minmax(310px, 44vh) auto auto auto; grid-template-areas: "header" "viewport" "data" "controls" "science"; }
  .topbar { padding: 0 12px; }
  .brand-mark { width: 26px; height: 26px; }
  .brand-title { font-size: 12px; }
  .brand-subtitle { display: none; }
  .topbar-right { gap: 5px; }
  .live-status { font-size: 7px; gap: 5px; }
  .topbar-divider { display: none; }
  .icon-button { min-width: 28px; height: 28px; }
  #quality-label { display: none; }
  .export-button { padding: 6px 8px; font-size: 9px; }
  .viewport-panel { min-height: 310px; }
  .viewport-topline { left: 9px; right: 9px; top: 9px; }
  .viewport-tools { display: none; }
  .viewport-tag { font-size: 7px; padding: 5px 7px; }
  .scene-label { font-size: 7px; }
  .transport-bar { flex-basis: 49px; padding: 0 9px; }
  .transport-right label { display: none; }
  .transport-right input { width: 72px; }
  .controls-panel, .data-panel { border: 0; overflow: visible; padding: 16px 14px; }
  .data-panel { border-bottom: 1px solid var(--line); }
  .metric-grid { grid-template-columns: repeat(3,1fr); }
  .primary-metric { grid-column: span 1; }
  .metric-value, .primary-metric .metric-value { font-size: 19px; }
  .metric-foot { font-size: 7px; }
  .profile-card, .validation-card { margin-top: 10px; }
  .controls-panel { border-bottom: 1px solid var(--line); }
  .control-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px; row-gap: 16px; }
  .controls-note { margin-top: 15px; }
  .science-footer { min-height: 100px; }
  .science-details summary { padding: 8px 14px; }
  .science-content { grid-template-columns: 1fr; gap: 12px; padding: 0 15px 15px 50px; }
  .science-column p { font-size: 9px; }
  .science-column code { font-size: 8px; }
  .footer-meta { min-height: 28px; flex-wrap: wrap; padding: 5px 12px; font-size: 6px; }
  .footer-meta span:last-child { width: 100%; }
  body.embed { overflow: hidden; }
  body.embed .app-shell { height: 100%; min-height: 0; grid-template-rows: minmax(250px,1fr) auto; grid-template-areas: "viewport" "controls"; overflow: auto; }
  body.embed .data-panel { display: none; }
  body.embed .controls-panel { max-height: 42vh; overflow: auto; }
}
@media (max-width: 390px) {
  .brand-copy .eyebrow { font-size: 7px; }
  .brand-title { font-size: 11px; }
  .topbar { padding: 0 8px; }
  .export-button span { display: none; }
  .metric-grid { gap: 5px; }
  .metric-card { padding: 8px 6px; }
  .metric-top { font-size: 6px; }
  .metric-value, .primary-metric .metric-value { font-size: 17px; }
  .control-list { column-gap: 12px; }
  .transport-left { gap: 5px; }
  .transport-right { gap: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
