:root {
  color-scheme: dark;
  --bg: #111315;
  --panel: #191c1f;
  --panel-2: #1e2225;
  --line: #343a3e;
  --line-soft: #292e32;
  --text: #f1f0ec;
  --muted: #a4a9aa;
  --dim: #747c80;
  --accent: #e7aa62;
  --accent-soft: rgba(231,170,98,.14);
  --good: #d8d7d1;
  --radius: 16px;
}
* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; line-height: 1.45; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.app-shell { width: 100%; min-height: 100vh; }
.brandbar { height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(16px,3.5vw,48px); border-bottom: 1px solid var(--line-soft); color: var(--muted); letter-spacing: .14em; font-size: 10px; font-weight: 750; }
.brand-lockup { display: flex; align-items: center; gap: 10px; }
.brand-mark { display: inline-grid; place-items: center; width: 23px; height: 23px; border: 1px solid #666d70; border-radius: 7px; color: var(--accent); font-size: 12px; letter-spacing: 0; }
.brand-meta { display: flex; align-items: center; gap: 10px; }
.brand-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.app-main { width: min(1480px,100%); margin: 0 auto; padding: 30px clamp(14px,3.5vw,48px) 28px; }
.intro-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 23px; }
.intro-copy { min-width: 0; max-width: 710px; }
.eyebrow, .section-kicker { color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .16em; }
.eyebrow { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
.eyebrow-line { width: 21px; height: 1px; background: var(--accent); }
h1 { margin: 0; font-size: clamp(30px,4vw,48px); font-weight: 640; line-height: 1.04; letter-spacing: -.045em; }
.lede { max-width: 660px; margin: 10px 0 0; color: #b6bbbc; font-size: clamp(13px,1.2vw,15px); line-height: 1.55; }
.transport { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; flex: 0 0 auto; }
.button { min-height: 36px; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; background: #222629; color: var(--text); font-size: 11px; font-weight: 700; cursor: pointer; transition: background .16s ease,border-color .16s ease,transform .16s ease; }
.button:hover { background: #2b3033; border-color: #62696b; }
.button:active { transform: translateY(1px); }
.button-primary { background: var(--accent); border-color: var(--accent); color: #1b1712; }
.button-primary:hover { background: #f0bd7f; border-color: #f0bd7f; }
.button-secondary { background: var(--accent-soft); border-color: rgba(231,170,98,.48); color: var(--accent); }
.button-secondary:hover { background: rgba(231,170,98,.22); }
.button-quiet { background: transparent; }
.button-square { min-width: 36px; padding: 0 9px; }
.quality-button { min-width: 86px; }
.workspace { display: grid; grid-template-columns: minmax(0,1.28fr) minmax(330px,.82fr); gap: 14px; align-items: stretch; }
.panel { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); min-width: 0; }
.apparatus-panel { padding: 17px 17px 14px; }
.controls-panel { padding: 17px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 13px; }
.panel-head h2, .section-title-row h2 { margin: 3px 0 0; font-size: 17px; line-height: 1.2; letter-spacing: -.025em; font-weight: 630; }
.panel-chip { display: flex; align-items: center; gap: 7px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-size: 9px; letter-spacing: .1em; font-weight: 800; white-space: nowrap; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: #7e8586; }
.panel-chip.is-live .live-dot { background: var(--accent); box-shadow: 0 0 0 4px rgba(231,170,98,.12); }
.scene-wrap { position: relative; overflow: hidden; width: 100%; aspect-ratio: 1.48; min-height: 230px; border: 1px solid #30373a; border-radius: 12px; background: #15191b; touch-action: none; user-select: none; }
#sceneCanvas, #previewFallback { display: block; width: 100%; height: 100%; }
#sceneCanvas { cursor: grab; }
#sceneCanvas.is-dragging { cursor: grabbing; }
#previewFallback { object-fit: contain; padding: 8px; }
.scene-topline, .scene-bottomline { position: absolute; left: 13px; right: 13px; display: flex; justify-content: space-between; gap: 12px; color: #8f9798; font-size: 8px; font-weight: 800; letter-spacing: .13em; pointer-events: none; }
.scene-topline { top: 11px; }
.scene-bottomline { bottom: 10px; }
.scene-caption { min-height: 37px; margin: 10px 2px 8px; color: #c4c7c5; font-size: 12px; line-height: 1.45; }
.scene-legend { display: flex; flex-wrap: wrap; gap: 15px; padding-top: 8px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 10px; }
.scene-legend span, .chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { display: inline-block; width: 8px; height: 8px; border-radius: 2px; }
.legend-metal { background: #aeb1ac; }
.legend-liquid { background: #626c70; }
.legend-force { background: var(--accent); }
.text-button { padding: 3px 0; border: 0; background: transparent; color: var(--accent); font-size: 10px; font-weight: 700; cursor: pointer; text-decoration: none; }
.text-button:hover { text-decoration: underline; }
.control-provenance { margin-top: 4px; color: #7f8889; font-size: 9px; }
.preset-block { margin-bottom: 16px; }
.control-label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.control-label { color: #d9dcda; font-size: 10px; font-weight: 750; letter-spacing: .035em; }
.control-note { color: var(--dim); font-size: 9px; }
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.preset-button { min-height: 32px; padding: 0 9px; border: 1px solid var(--line); border-radius: 7px; background: #202427; color: #bdc2c1; text-align: left; font-size: 10px; font-weight: 650; cursor: pointer; }
.preset-button span { margin-right: 5px; color: #777f81; font-size: 8px; font-weight: 800; }
.preset-button:hover { border-color: #62696b; }
.preset-button.is-active { border-color: rgba(231,170,98,.72); background: var(--accent-soft); color: var(--accent); }
.preset-button.is-active span { color: var(--accent); }
.preset-fail { border-style: dashed; }
.sliders { display: grid; gap: 12px; }
.slider-control { min-width: 0; }
.slider-control output { color: var(--accent); font-size: 11px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { display: block; width: 100%; height: 15px; margin: 5px 0 0; accent-color: var(--accent); cursor: pointer; }
.range-ends { display: flex; justify-content: space-between; margin-top: -1px; color: #777f81; font-size: 8px; }
.correction-box { display: grid; gap: 10px; margin: 14px 0 13px; padding: 11px 10px; border: 1px solid var(--line-soft); border-radius: 10px; background: #171a1c; }
.correction-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.correction-row strong { display: block; color: #d8dbd9; font-size: 10px; font-weight: 700; }
.correction-row small { display: block; margin-top: 2px; color: #828a8c; font-size: 9px; line-height: 1.35; }
.switch { position: relative; display: inline-flex; width: 34px; height: 19px; flex: 0 0 auto; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: absolute; inset: 0; border: 1px solid #52595c; border-radius: 99px; background: #303638; transition: .16s ease; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 11px; height: 11px; border-radius: 50%; background: #a2a8a7; transition: .16s ease; }
.switch input:checked + .switch-track { border-color: var(--accent); background: rgba(231,170,98,.25); }
.switch input:checked + .switch-track::after { transform: translateX(15px); background: var(--accent); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.collect-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.button-wide { width: 100%; justify-content: center; }
.data-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 9px; }
.control-footnote { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-soft); color: #7f8789; font-size: 9px; line-height: 1.5; }
.results-section { margin-top: 28px; }
.section-title-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 15px; margin-bottom: 12px; }
.section-title-row h2 { font-size: 20px; }
.result-context { color: #858d8f; font-size: 10px; }
.results-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 9px; }
.metric-card { min-width: 0; padding: 14px 15px 13px; border: 1px solid var(--line-soft); border-radius: 12px; background: #191c1f; }
.metric-featured { border-color: rgba(231,170,98,.45); background: linear-gradient(135deg,rgba(231,170,98,.1),#191c1f 72%); }
.metric-label { color: #8c9596; font-size: 8px; font-weight: 800; letter-spacing: .13em; }
.metric-value { margin-top: 9px; color: var(--text); font-size: clamp(19px,2.3vw,27px); line-height: 1; font-weight: 650; letter-spacing: -.04em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric-featured .metric-value { color: var(--accent); }
.metric-unit { margin-top: 7px; color: #899193; font-size: 9px; line-height: 1.35; }
.uncertainty-strip { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-top: 9px; padding: 10px 13px; border: 1px solid var(--line-soft); border-radius: 10px; background: #171a1c; }
.uncertainty-copy { display: flex; align-items: center; gap: 10px; min-width: 0; }
.uncertainty-icon { display: grid; place-items: center; width: 25px; height: 25px; flex: 0 0 auto; border: 1px solid rgba(231,170,98,.5); border-radius: 50%; color: var(--accent); font-size: 15px; }
.uncertainty-copy strong { display: block; color: #e2e3df; font-size: 11px; }
.uncertainty-copy small { display: block; margin-top: 2px; color: #858d8f; font-size: 9px; }
.signal-readout { flex: 0 0 auto; text-align: right; }
.signal-readout span { display: block; color: #828a8c; font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.signal-readout strong { color: var(--accent); font-size: 14px; font-variant-numeric: tabular-nums; }
.interpretation { min-height: 22px; margin: 9px 1px 0; color: #c5c9c6; font-size: 11px; }
.analysis-grid { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(310px,.85fr); gap: 14px; margin-top: 17px; }
.chart-panel, .record-panel { padding: 16px; }
.chart-legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; color: #92999a; font-size: 9px; }
.legend-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.legend-data { background: var(--accent); }
.legend-line { display: inline-block; width: 16px; height: 0; border-top: 1px dashed #d5d7d1; }
.legend-band { display: inline-block; width: 12px; height: 8px; border: 1px solid #777f80; background: rgba(170,178,176,.12); border-radius: 2px; }
.plot-wrap { width: 100%; height: 210px; }
#plotCanvas { display: block; width: 100%; height: 100%; }
.chart-foot { display: flex; justify-content: space-between; gap: 12px; padding-top: 8px; border-top: 1px solid var(--line-soft); color: #858d8f; font-size: 9px; }
.record-badge { padding: 5px 7px; border: 1px solid var(--line); border-radius: 5px; color: #9ca3a3; font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.record-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 10px; margin: 20px 0 15px; }
.record-stat-grid span { display: block; color: #8b9394; font-size: 9px; }
.record-stat-grid strong { display: block; margin-top: 4px; color: #e5e6e1; font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.record-stat-grid strong small { color: #8d9697; font-size: 9px; font-weight: 500; letter-spacing: 0; }
.record-note { color: #909899; font-size: 10px; line-height: 1.5; }
.record-divider { height: 1px; margin: 13px 0 10px; background: var(--line-soft); }
.record-foot { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 7px; color: #92999a; font-size: 9px; }
.record-foot strong { color: #d9dcd8; font-size: 10px; font-weight: 700; text-align: right; }
.checks-panel { margin-top: 14px; padding: 16px; }
.check-status { color: #a8aeaa; font-size: 8px; font-weight: 800; letter-spacing: .13em; }
.checks-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.check-item { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 10px; border: 1px solid var(--line-soft); border-radius: 9px; background: #171a1c; }
.check-mark { display: grid; place-items: center; width: 20px; height: 20px; flex: 0 0 auto; border-radius: 50%; background: #303638; color: var(--accent); font-size: 11px; }
.check-item div { min-width: 0; flex: 1; }
.check-item strong { display: block; color: #d9dcd9; font-size: 9px; }
.check-item small { display: block; margin-top: 2px; color: #7e8789; font-size: 8px; line-height: 1.35; }
.check-item b { flex: 0 0 auto; color: var(--accent); font-size: 10px; font-variant-numeric: tabular-nums; }
.science-panel { margin-top: 14px; padding: 0 16px; }
.science-panel summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; cursor: pointer; list-style: none; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary strong { display: block; margin-top: 3px; color: #e6e7e2; font-size: 14px; font-weight: 650; }
.summary-plus { display: grid; place-items: center; width: 27px; height: 27px; border: 1px solid var(--line); border-radius: 50%; color: var(--accent); font-size: 16px; transition: transform .18s ease; }
.science-panel[open] .summary-plus { transform: rotate(45deg); }
.science-content { padding: 2px 0 17px; border-top: 1px solid var(--line-soft); }
.science-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; padding-top: 16px; }
.science-content h3 { margin: 0 0 6px; color: #e1e3df; font-size: 12px; font-weight: 700; }
.science-content p { margin: 0 0 13px; color: #a4acab; font-size: 10px; line-height: 1.65; }
.equation { margin: 8px 0 15px; padding: 9px 11px; border-left: 2px solid var(--accent); background: #202427; color: #e6d2b9; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; overflow-wrap: anywhere; }
.science-note { margin: 4px 0 12px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; color: #aab0ae; font-size: 10px; line-height: 1.55; }
.science-note strong { color: var(--accent); }
.source-line { color: #7f8889 !important; font-size: 9px !important; }
.page-footer { display: flex; justify-content: space-between; gap: 12px; padding: 18px 2px 0; color: #687174; font-size: 8px; font-weight: 800; letter-spacing: .13em; }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
body.embed-mode .brandbar { display: none; }
body.embed-mode .app-shell { height: 100vh; height: 100dvh; min-height: 0; }
body.embed-mode .app-main { height: 100%; overflow: auto; overscroll-behavior: contain; padding-top: 16px; }
body.embed-mode .intro-row { margin-bottom: 14px; }
body.embed-mode .intro-copy { max-width: 540px; }
body.embed-mode h1 { font-size: clamp(26px,3.2vw,40px); }
body.embed-mode .workspace { gap: 10px; }
@media (max-width: 1050px) {
  .intro-row { align-items: flex-start; flex-direction: column; }
  .transport { justify-content: flex-start; }
  .workspace { grid-template-columns: minmax(0,1.1fr) minmax(310px,.9fr); }
  .analysis-grid { grid-template-columns: minmax(0,1.1fr) minmax(290px,.9fr); }
}
@media (max-width: 820px) {
  .app-main { padding-top: 22px; }
  .workspace, .analysis-grid { grid-template-columns: 1fr; }
  .controls-panel { order: 2; }
  .apparatus-panel { order: 1; }
  .results-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .checks-grid { grid-template-columns: 1fr; }
  .check-item { min-height: 56px; }
  .scene-wrap { aspect-ratio: 1.48; }
}
@media (max-width: 520px) {
  .brandbar { height: 45px; padding: 0 14px; font-size: 8px; }
  .brand-meta { font-size: 7px; gap: 6px; }
  .app-main { padding: 18px 12px 20px; }
  .intro-row { gap: 14px; margin-bottom: 16px; }
  h1 { font-size: 34px; }
  .lede { font-size: 12px; }
  .transport { width: 100%; display: grid; grid-template-columns: 1.4fr 1fr .7fr .7fr; }
  .transport .quality-button { grid-column: 1 / -1; }
  .button { min-height: 34px; padding: 0 9px; font-size: 10px; }
  .workspace { gap: 10px; }
  .apparatus-panel, .controls-panel, .chart-panel, .record-panel, .checks-panel { padding: 13px; }
  .panel-head h2 { font-size: 15px; }
  .scene-wrap { min-height: 0; aspect-ratio: 1.25; }
  .scene-topline, .scene-bottomline { left: 9px; right: 9px; font-size: 6px; letter-spacing: .08em; }
  .scene-caption { font-size: 11px; }
  .scene-legend { gap: 10px; font-size: 9px; }
  .preset-button { min-height: 34px; font-size: 9px; }
  .sliders { gap: 11px; }
  .correction-box { margin-top: 12px; }
  .results-section { margin-top: 21px; }
  .section-title-row h2 { font-size: 18px; }
  .metric-card { padding: 12px 11px; }
  .metric-value { font-size: 22px; }
  .metric-unit { font-size: 8px; }
  .uncertainty-strip { align-items: flex-start; }
  .uncertainty-copy small { max-width: 210px; }
  .signal-readout span { font-size: 7px; }
  .analysis-grid { gap: 10px; }
  .plot-wrap { height: 190px; }
  .chart-legend { gap: 7px; font-size: 8px; }
  .record-stat-grid { gap: 12px 7px; }
  .record-stat-grid strong { font-size: 15px; }
  .record-foot { align-items: flex-start; flex-direction: column; gap: 2px; }
  .record-foot strong { text-align: left; }
  .science-columns { grid-template-columns: 1fr; gap: 4px; }
  .page-footer { flex-direction: column; font-size: 7px; }
  body.embed-mode .app-main { padding: 12px 10px 18px; }
  body.embed-mode .scene-wrap { aspect-ratio: 1.25; }
}
