:root {
  color-scheme: dark;
  --bg: #111211;
  --panel: #191b19;
  --panel-2: #202320;
  --panel-3: #252925;
  --line: #343a35;
  --line-soft: #292e2a;
  --text: #f1f0e9;
  --muted: #a4aaa2;
  --subtle: #747d75;
  --accent: #e5ad5c;
  --accent-dim: rgba(229, 173, 92, .14);
  --water: #7199a0;
  --good: #a8b7a2;
  --bad: #d6a08d;
  --radius: 15px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
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;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(ellipse at 47% -18%, rgba(229,173,92,.055), transparent 38%), var(--bg);
}
.topbar {
  height: 68px;
  min-height: 68px;
  padding: 0 25px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(17,18,17,.96);
}
.brand-lockup { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark {
  width: 35px; height: 35px; border: 1px solid rgba(229,173,92,.42); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; gap: 3px; transform: rotate(-2deg);
  background: linear-gradient(145deg, rgba(229,173,92,.13), rgba(229,173,92,.02));
}
.brand-mark span { display: block; width: 3px; border-radius: 3px; background: var(--accent); }
.brand-mark span:nth-child(1) { height: 10px; opacity: .65; }
.brand-mark span:nth-child(2) { height: 18px; }
.brand-mark span:nth-child(3) { height: 13px; opacity: .8; }
.eyebrow, .section-kicker, .scene-kicker, .scene-meta, .readout-label, .subhead, .footer-status, .page-footer {
  font-size: 9px; line-height: 1.3; letter-spacing: .16em; font-weight: 750;
}
.eyebrow { color: var(--muted); margin-bottom: 3px; }
.eyebrow-dot { display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); margin: 0 5px 1px; }
.brand-lockup h1 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -.025em; }
.topbar-right { display: flex; align-items: center; gap: 15px; }
.archive-chip { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 30px; padding: 7px 11px; color: var(--muted); font-size: 9px; letter-spacing: .12em; font-weight: 700; }
.status-dot { width: 6px; height: 6px; display: inline-block; flex: 0 0 auto; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(229,173,92,.36); }
.quality-toggle { border: 0; background: transparent; color: var(--muted); padding: 7px 0 7px 8px; font-size: 9px; font-weight: 750; letter-spacing: .13em; cursor: pointer; }
.quality-toggle:hover { color: var(--accent); }

.workspace {
  flex: 1 0 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.58fr) minmax(340px, .82fr);
  gap: 14px;
  padding: 14px 18px 16px;
  max-width: 1720px;
  width: 100%;
  margin: 0 auto;
}
.exhibit-column { min-width: 0; display: flex; flex-direction: column; gap: 11px; }
.scene-card, .analysis-card, .lab-panel, .science-panel {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(33,36,33,.98), rgba(24,26,24,.98));
  border-radius: var(--radius);
  box-shadow: 0 14px 38px rgba(0,0,0,.14);
}
.scene-card { padding: 12px 13px 10px; overflow: hidden; }
.scene-topline { display: flex; justify-content: space-between; align-items: center; padding: 1px 3px 10px; }
.scene-kicker { color: var(--muted); }
.scene-meta { color: var(--accent); font-size: 8px; }
.scene-wrap {
  position: relative;
  overflow: hidden;
  min-height: 270px;
  aspect-ratio: 16 / 9;
  border: 1px solid #333a35;
  border-radius: 11px;
  background: radial-gradient(ellipse at 50% 68%, #262c29 0%, #1b201d 42%, #171b19 100%);
}
#scene { display: block; width: 100%; height: 100%; }
.scene-fallback { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 24px; color: var(--muted); }
.scene-fallback[hidden] { display: none; }
.fallback-vessel { border: 2px solid #b17e4c; border-radius: 12px 12px 20px 20px; padding: 30px 22px; color: var(--accent); letter-spacing: .1em; font-size: 11px; }
.scene-fallback p { max-width: 280px; font-size: 12px; line-height: 1.5; }
.scene-caption {
  position: absolute; left: 13px; bottom: 43px; max-width: min(390px, 72%); padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.09); border-radius: 8px; background: rgba(14,16,15,.72);
  color: #d5d8d2; font-size: 10px; line-height: 1.45; backdrop-filter: blur(7px);
}
.scene-legend { position: absolute; right: 12px; bottom: 12px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; color: #a9b0a8; font-size: 8px; }
.scene-legend span { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.scene-legend i { width: 7px; height: 7px; border-radius: 2px; display: inline-block; }
.legend-weight { background: #9da19b; }
.legend-fluid { background: #7199a0; }
.legend-shaft { background: var(--accent); }
.scene-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 2px 0; }
.transport-controls { display: flex; align-items: center; gap: 7px; min-width: 0; }
.control-button, .icon-button {
  height: 33px; border-radius: 8px; border: 1px solid var(--line); background: #252925; color: #d8ddd6;
  cursor: pointer; transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.control-button { padding: 0 11px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.control-button:hover, .icon-button:hover { border-color: #6d6657; background: #30352f; }
.control-button:active, .icon-button:active { transform: translateY(1px); }
.control-button.primary { background: var(--accent); color: #241b10; border-color: var(--accent); }
.control-button.primary:hover { background: #f0bc70; }
.button-icon { margin-right: 5px; font-size: 11px; }
.icon-button { width: 33px; font-size: 15px; font-weight: 700; }
.transport-note { color: var(--subtle); font-size: 9px; text-align: right; }

.readout-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; }
.readout-card { min-width: 0; padding: 11px 12px 10px; border: 1px solid var(--line); border-radius: 11px; background: rgba(29,32,29,.9); }
.readout-label { color: var(--subtle); font-size: 8px; letter-spacing: .11em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.readout-value { margin-top: 7px; color: var(--text); font-size: clamp(19px, 2vw, 25px); line-height: 1.05; letter-spacing: -.055em; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.readout-value small { color: var(--muted); font-size: 10px; font-weight: 550; letter-spacing: 0; }
.result-readout .readout-value { color: var(--accent); }
.readout-sub { margin-top: 5px; color: var(--subtle); font-size: 8px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.analysis-card { padding: 14px 15px 12px; }
.analysis-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.section-kicker { color: var(--accent); font-size: 8px; }
.analysis-heading h2, .panel-heading h2 { margin: 4px 0 0; font-size: 17px; letter-spacing: -.035em; font-weight: 620; }
.result-tag { border: 1px solid var(--line); border-radius: 20px; padding: 6px 9px; color: var(--muted); font-size: 8px; font-weight: 750; letter-spacing: .1em; white-space: nowrap; }
.plot-wrap { height: 105px; margin-top: 6px; }
#result-plot { display: block; width: 100%; height: 100%; }
.plot-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 0; color: var(--muted); font-size: 8px; }
.plot-legend span { display: flex; align-items: center; gap: 6px; }
.plot-key { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.archive-key { background: #a6ada5; }
.modern-key { background: var(--accent); }
.user-key { background: #e8d5b7; }
.checks-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 7px; margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--line-soft); }
.check-item { min-width: 0; padding: 0 7px; border-right: 1px solid var(--line-soft); }
.check-item:first-child { padding-left: 0; }
.check-item:last-child { border-right: 0; padding-right: 0; }
.check-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: var(--subtle); font-size: 7px; letter-spacing: .1em; font-weight: 800; }
.check-head b { color: var(--good); font-size: 7px; letter-spacing: .08em; }
.check-head b.fail { color: var(--bad); }
.check-value { margin-top: 6px; color: var(--text); font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.check-note { margin-top: 4px; color: var(--subtle); font-size: 8px; line-height: 1.35; }
.uncertainty-note { display: flex; gap: 9px; align-items: flex-start; padding: 9px 10px; margin-top: 12px; border: 1px solid rgba(229,173,92,.22); border-radius: 9px; background: rgba(229,173,92,.055); }
.uncertainty-mark { display: grid; place-items: center; flex: 0 0 auto; width: 19px; height: 19px; border-radius: 50%; background: var(--accent-dim); color: var(--accent); font-size: 12px; font-weight: 800; }
.uncertainty-note p { margin: 0; color: #b5b9b2; font-size: 8px; line-height: 1.5; }
.uncertainty-note strong { color: #e0e1d9; font-weight: 700; }

.lab-panel { min-width: 0; padding: 16px 16px 13px; display: flex; flex-direction: column; gap: 13px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #4a504a transparent; }
.panel-heading p { margin: 7px 0 0; max-width: 370px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.preset-section, .control-section { padding-top: 12px; border-top: 1px solid var(--line-soft); }
.subhead { display: flex; justify-content: space-between; gap: 8px; color: #b0b6ae; font-size: 8px; letter-spacing: .13em; }
.subhead-hint { color: var(--subtle); font-size: 7px; }
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 9px; }
.preset-button { min-width: 0; min-height: 34px; padding: 7px 8px; text-align: left; border: 1px solid var(--line); border-radius: 8px; background: #202420; color: #cbd0c9; font-size: 9px; font-weight: 650; cursor: pointer; }
.preset-button span { color: var(--subtle); font-size: 7px; margin-right: 5px; }
.preset-button:hover { border-color: #65695e; }
.preset-button.active { border-color: rgba(229,173,92,.65); background: var(--accent-dim); color: #f0c88e; }
.preset-button.fail-preset em { color: var(--bad); font-size: 7px; font-style: normal; font-weight: 800; letter-spacing: .06em; margin-left: 3px; }
.slider-control { margin-top: 11px; }
.slider-label { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.slider-label label { color: #d8ddd5; font-size: 10px; font-weight: 600; }
.slider-label label span { color: var(--subtle); cursor: help; font-size: 9px; }
.slider-label output { color: var(--accent); font-size: 9px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
input[type="range"] { width: 100%; height: 14px; display: block; margin: 5px 0 0; appearance: none; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 5px; background: linear-gradient(90deg, var(--accent) 0%, var(--accent) var(--fill, 0%), #555c54 var(--fill, 0%), #555c54 100%); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 5px; background: #555c54; }
input[type="range"]::-moz-range-progress { height: 3px; border-radius: 5px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border: 2px solid #171a17; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid #171a17; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.range-ends { display: flex; justify-content: space-between; color: #747d75; font-size: 7px; }
.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; padding: 9px 0 1px; border-top: 1px solid var(--line-soft); }
.toggle-row strong { display: block; color: #d8ddd5; font-size: 9px; font-weight: 650; }
.toggle-row small { display: block; margin-top: 3px; color: var(--subtle); font-size: 8px; line-height: 1.35; }
.switch { position: relative; flex: 0 0 auto; width: 34px; height: 19px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { position: absolute; inset: 0; border: 1px solid #4b524b; border-radius: 20px; background: #2b302b; cursor: pointer; transition: .18s; }
.switch span::before { content: ""; position: absolute; width: 11px; height: 11px; top: 3px; left: 3px; border-radius: 50%; background: #8a9289; transition: .18s; }
.switch input:checked + span { border-color: var(--accent); background: rgba(229,173,92,.2); }
.switch input:checked + span::before { transform: translateX(15px); background: var(--accent); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }
.panel-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.footer-status { display: flex; align-items: center; gap: 7px; color: var(--subtle); font-size: 7px; letter-spacing: .1em; }
.text-button { padding: 4px 0; border: 0; background: transparent; color: var(--muted); font-size: 8px; text-decoration: underline; text-decoration-color: #626a61; text-underline-offset: 3px; cursor: pointer; }
.text-button:hover { color: var(--accent); }

.science-panel { margin: 0 18px 10px; padding: 0 15px; }
.science-panel summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; list-style: none; cursor: pointer; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary > span:first-child { display: flex; flex-direction: column; gap: 4px; }
.science-panel summary strong { font-size: 12px; font-weight: 650; }
.summary-chevron { color: var(--accent); font-size: 20px; font-weight: 300; transition: transform .2s; }
.science-panel[open] .summary-chevron { transform: rotate(45deg); }
.science-content { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 17px; padding: 0 0 16px; }
.science-block { min-width: 0; }
.science-block h3 { margin: 0 0 6px; color: #e0e3dc; font-size: 10px; font-weight: 700; }
.science-block p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.55; }
.science-block code { color: #f0c88e; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }
.science-source { border-left: 1px solid var(--line); padding-left: 13px; }
.science-source .affiliation-note { margin-top: 7px; color: var(--subtle); font-size: 8px; }
.page-footer { display: flex; justify-content: space-between; gap: 10px; padding: 0 23px 12px; color: #646c64; font-size: 7px; letter-spacing: .15em; }

@media (max-width: 1100px) {
  .workspace { grid-template-columns: minmax(0,1.35fr) minmax(310px,.9fr); padding-left: 12px; padding-right: 12px; gap: 10px; }
  .readout-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .science-content { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .science-source { border-left: 0; padding-left: 0; }
}

@media (max-width: 760px) {
  .topbar { height: 55px; min-height: 55px; padding: 0 14px; }
  .brand-mark { width: 30px; height: 30px; }
  .brand-lockup h1 { font-size: 14px; }
  .eyebrow { font-size: 7px; }
  .archive-chip { display: none; }
  .quality-toggle { font-size: 8px; }
  .workspace { display: flex; flex-direction: column; gap: 10px; padding: 10px 10px 12px; }
  .exhibit-column { gap: 9px; }
  .scene-card { padding: 10px 9px 8px; }
  .scene-topline { padding-bottom: 8px; }
  .scene-wrap { aspect-ratio: 4 / 3; min-height: 245px; max-height: 340px; }
  .scene-caption { left: 8px; bottom: 38px; max-width: 75%; font-size: 8px; padding: 6px 7px; }
  .scene-legend { right: 8px; bottom: 8px; gap: 7px; font-size: 7px; }
  .scene-legend span { gap: 4px; }
  .scene-controls { padding-top: 8px; align-items: flex-start; }
  .transport-controls { gap: 5px; flex-wrap: wrap; }
  .control-button { height: 31px; padding: 0 8px; font-size: 9px; }
  .icon-button { width: 31px; height: 31px; }
  .transport-note { max-width: 100px; font-size: 8px; line-height: 1.4; }
  .readout-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
  .readout-card { padding: 9px 10px 8px; }
  .readout-label { font-size: 7px; }
  .readout-value { margin-top: 5px; font-size: 20px; }
  .readout-sub { font-size: 7px; }
  .analysis-card { padding: 12px 11px 10px; }
  .analysis-heading h2 { font-size: 15px; }
  .plot-wrap { height: 98px; }
  .checks-grid { gap: 4px; margin-top: 10px; padding-top: 9px; }
  .check-item { padding: 0 5px; }
  .check-head { font-size: 6px; letter-spacing: .06em; }
  .check-head b { font-size: 6px; }
  .check-value { font-size: 11px; }
  .check-note { font-size: 7px; }
  .uncertainty-note { margin-top: 9px; padding: 8px; }
  .uncertainty-note p { font-size: 7px; }
  .lab-panel { padding: 14px 13px 12px; gap: 11px; overflow: visible; }
  .panel-heading h2 { font-size: 16px; }
  .panel-heading p { font-size: 9px; }
  .science-panel { margin: 0 10px 10px; padding: 0 12px; }
  .science-content { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
  .science-block p { font-size: 8px; }
  .page-footer { padding: 0 14px 10px; font-size: 6px; }
}

@media (max-width: 390px) {
  .topbar { padding: 0 11px; }
  .brand-lockup { gap: 9px; }
  .brand-lockup h1 { font-size: 13px; }
  .workspace { padding-left: 8px; padding-right: 8px; }
  .scene-wrap { min-height: 238px; }
  .scene-caption { max-width: 73%; bottom: 37px; }
  .scene-legend { font-size: 6px; }
  .transport-note { max-width: 78px; }
  .control-button { padding: 0 7px; }
  .analysis-heading h2 { font-size: 14px; }
  .result-tag { padding: 5px 7px; font-size: 7px; }
  .science-panel { margin-left: 8px; margin-right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

body.embed-mode .topbar { display: none; }
body.embed-mode .workspace { min-height: 0; }
body.embed-mode .science-panel, body.embed-mode .page-footer { display: none; }
body.embed-mode .workspace { flex: 1; }
body.embed-mode .lab-panel { overscroll-behavior: contain; }
@media (max-width: 760px) {
  body.embed-mode .workspace { overflow-y: auto; }
  body.embed-mode .scene-wrap { min-height: 238px; }
}
#scene { cursor: grab; touch-action: pan-y; }
#scene.dragging { cursor: grabbing; }
@media (min-width: 761px) {
  body.embed-mode .workspace { height: 100dvh; flex: 1 1 0; min-height: 0; overflow: hidden; }
  body.embed-mode .exhibit-column { height: 100%; min-height: 0; }
  body.embed-mode .scene-card { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; }
  body.embed-mode .scene-wrap { flex: 1 1 auto; aspect-ratio: auto; min-height: 220px; max-height: none; }
  body.embed-mode .lab-panel { height: 100%; min-height: 0; }
}
@media (min-width: 761px) {
  body.embed-mode .analysis-card { padding: 10px 12px 8px; }
  body.embed-mode .plot-wrap { height: 76px; }
  body.embed-mode .checks-grid { margin-top: 8px; padding-top: 7px; }
  body.embed-mode .uncertainty-note { margin-top: 8px; padding: 7px 8px; }
  body.embed-mode .uncertainty-note p { font-size: 7px; }
}
.number-key { margin-top: 8px; color: var(--subtle); font-size: 7px; line-height: 1.5; }
.number-key span { display: inline-block; margin-right: 3px; color: var(--accent); font-size: 7px; font-weight: 800; letter-spacing: .08em; }
@media (max-width: 760px) { .number-key { font-size: 7px; } }
