:root {
  color-scheme: dark;
  --bg: #06111c;
  --panel: #0b1b29;
  --panel-2: #0d2130;
  --line: rgba(139, 190, 206, .13);
  --line-strong: rgba(139, 190, 206, .22);
  --text: #e8f2f4;
  --muted: #8ba7b2;
  --dim: #5e7d89;
  --teal: #54d6ce;
  --teal-bright: #81f0df;
  --amber: #f0bd73;
  --blue: #5baccb;
  --danger: #ff9c86;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-width: 320px; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--teal-bright); outline-offset: 3px; }
.app-shell { min-height: 100vh; background: radial-gradient(ellipse at 49% -20%, rgba(24, 76, 96, .23), transparent 48%), var(--bg); }

.topbar {
  min-height: 72px; display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 12px 22px; border-bottom: 1px solid var(--line);
  background: rgba(6, 17, 28, .94);
}
.brand-lockup { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border: 1px solid rgba(84,214,206,.48); border-radius: 10px; display: flex; align-items: center; justify-content: center; gap: 3px; background: rgba(34, 114, 130, .15); flex: 0 0 auto; }
.brand-mark span { width: 3px; border-radius: 4px; background: var(--teal); display: block; }
.brand-mark span:nth-child(1) { height: 10px; opacity: .58; transform: translateY(2px); }
.brand-mark span:nth-child(2) { height: 19px; }
.brand-mark span:nth-child(3) { height: 13px; opacity: .72; transform: translateY(-1px); }
.eyebrow { color: #7296a4; font-size: 9px; letter-spacing: .16em; font-weight: 750; line-height: 1.4; }
h1 { margin: 3px 0 0; font-size: 17px; line-height: 1.25; letter-spacing: -.035em; font-weight: 680; }
.title-divider { color: #416475; padding: 0 5px; font-weight: 400; }
.title-sub { color: #9ab4bd; font-size: 14px; font-weight: 450; letter-spacing: -.01em; }
.topbar-meta { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
.live-indicator, .seed-tag, .mode-tag { border: 1px solid var(--line); border-radius: 5px; padding: 7px 9px; font-size: 9px; letter-spacing: .12em; color: #9ab5bf; white-space: nowrap; }
.live-indicator { display: flex; align-items: center; gap: 7px; }
.live-indicator i, .live-mini i { width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: var(--teal); box-shadow: 0 0 9px rgba(84,214,206,.8); }
.seed-tag { color: var(--amber); border-color: rgba(240,189,115,.22); }
.mode-tag { color: var(--teal); border-color: rgba(84,214,206,.22); }

.workspace {
  display: grid; grid-template-columns: 294px minmax(360px, 1fr) 284px; gap: 12px;
  padding: 12px; height: calc(100vh - 105px); min-height: 590px; max-height: 1100px;
}
.sidebar { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #254453 transparent; }
.panel { background: linear-gradient(145deg, rgba(13, 34, 49, .98), rgba(8, 25, 38, .98)); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 32px rgba(0,0,0,.13); }
.controls-panel, .data-panel { padding: 15px 14px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.panel-heading h2 { margin: 4px 0 0; font-size: 15px; letter-spacing: -.025em; font-weight: 650; }
.panel-icon { width: 29px; height: 29px; display: grid; place-items: center; color: var(--teal); border: 1px solid rgba(84,214,206,.2); border-radius: 7px; background: rgba(84,214,206,.06); font-size: 20px; }
.preset-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; padding: 4px; background: rgba(3, 14, 23, .6); border: 1px solid var(--line); border-radius: 7px; margin-bottom: 15px; }
.preset-button { border: 0; border-radius: 5px; background: transparent; color: #819eaa; padding: 7px 4px; font-size: 10px; cursor: pointer; transition: background .2s ease, color .2s ease; }
.preset-button:hover { color: var(--text); background: rgba(255,255,255,.045); }
.preset-button.active { color: #dffaf6; background: rgba(58, 155, 156, .22); box-shadow: inset 0 0 0 1px rgba(84,214,206,.23); }
.control-list { display: flex; flex-direction: column; gap: 13px; }
.control-item { min-width: 0; }
.control-label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.control-label label { font-size: 11px; color: #c6d8de; font-weight: 550; }
.control-label output { color: var(--teal-bright); font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { width: 100%; height: 4px; appearance: none; -webkit-appearance: none; background: linear-gradient(90deg, #278e96, #4dcac2 65%, #244451); border-radius: 99px; display: block; cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: #d7fffa; border: 3px solid #2b9fa3; box-shadow: 0 0 0 3px rgba(84,214,206,.12); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; background: #d7fffa; border: 3px solid #2b9fa3; box-shadow: 0 0 0 3px rgba(84,214,206,.12); }
.range-ends { display: flex; align-items: center; justify-content: space-between; color: #557582; font-size: 8px; margin-top: 5px; letter-spacing: .02em; }
.range-ends span:nth-child(2) { color: #7596a2; }
.divider { height: 1px; background: var(--line); margin: 16px 0 13px; }
.transport-heading { margin-bottom: 9px; }
.transport-heading h3 { font-size: 12px; margin: 3px 0 0; font-weight: 620; }
.transport-row { display: grid; grid-template-columns: 1.15fr .8fr .8fr; gap: 6px; }
.action-button { border: 1px solid var(--line-strong); border-radius: 6px; background: rgba(18, 46, 62, .62); color: #b6cbd2; padding: 8px 6px; font-size: 10px; display: flex; align-items: center; justify-content: center; gap: 5px; cursor: pointer; transition: .18s ease; }
.action-button:hover, .utility-button:hover { background: rgba(49, 112, 128, .24); border-color: rgba(84,214,206,.38); color: white; }
.action-button.primary { background: linear-gradient(135deg, #1c777e, #165a6c); border-color: rgba(84,214,206,.48); color: #eafffc; font-weight: 650; }
.action-button.primary:hover { filter: brightness(1.15); }
.button-symbol { font-size: 12px; line-height: 1; }
.speed-control { margin-top: 13px; }
.utility-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 11px; }
.utility-button { border: 1px solid var(--line); border-radius: 6px; background: rgba(5, 20, 31, .6); color: #91acb6; font-size: 9px; padding: 8px 5px; cursor: pointer; transition: .18s ease; }
.quality-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 11px; border-top: 1px solid var(--line); }
.quality-label { color: #668793; font-size: 8px; letter-spacing: .14em; font-weight: 750; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 6px; background: rgba(3,14,23,.55); }
.segmented button { border: 0; border-radius: 4px; padding: 5px 10px; color: #75939e; background: transparent; font-size: 9px; cursor: pointer; }
.segmented button.selected { color: #e4fffb; background: rgba(61,151,155,.28); }
.science-panel { padding: 0 14px; }
.science-panel summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; padding: 13px 0; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary strong { display: block; font-size: 13px; margin-top: 3px; }
.summary-chevron { color: var(--teal); font-size: 18px; transition: transform .2s ease; }
.science-panel[open] .summary-chevron { transform: rotate(180deg); }
.science-content { border-top: 1px solid var(--line); padding: 12px 0 14px; }
.science-lead { color: #a7c0c8; font-size: 10px; line-height: 1.55; margin: 0 0 11px; }
.equation-block { border: 1px solid rgba(130,180,195,.1); background: rgba(4,17,27,.45); border-radius: 6px; padding: 8px 9px; margin: 6px 0; }
.equation-label { display: block; color: #71939f; font-size: 8px; font-weight: 750; letter-spacing: .12em; margin-bottom: 5px; }
.equation-block code { color: #e0f5f3; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10px; }
.equation-block small { display: block; margin-top: 5px; color: #89aab4; font-size: 9px; }
.science-legend { display: flex; gap: 7px; align-items: center; color: #91aeb7; font-size: 9px; margin-top: 9px; }
.science-legend b { color: #c7dce1; font-size: 8px; letter-spacing: .08em; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.legend-dot.teal { background: var(--teal); box-shadow: 0 0 8px rgba(84,214,206,.55); }
.legend-dot.amber { background: var(--amber); }
.science-content h4 { color: #c6d9de; font-size: 10px; margin: 15px 0 6px; }
.science-content ul { padding-left: 15px; margin: 0; color: #89a6b1; font-size: 9px; line-height: 1.55; }
.science-content li { margin: 4px 0; }
.textbook-note { color: #75949e; font-size: 9px; line-height: 1.5; border-left: 2px solid var(--teal); padding-left: 8px; margin: 12px 0 0; }

.viewer-column { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.viewer-frame { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; border: 1px solid rgba(91,160,178,.25); border-radius: 10px; overflow: hidden; background: #061723; box-shadow: 0 16px 50px rgba(0,0,0,.24); }
.scene-container { position: relative; flex: 1; min-height: 340px; overflow: hidden; background: radial-gradient(ellipse at 50% 30%, #12384b, #071a29 70%); }
.ocean-canvas { width: 100%; height: 100%; display: block; outline: none; }
.scene-topline { position: absolute; top: 13px; left: 14px; right: 14px; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px; pointer-events: none; }
.scene-chip, .orientation-chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid rgba(135,197,208,.2); border-radius: 5px; background: rgba(5,20,31,.72); backdrop-filter: blur(10px); color: #b7d2d9; padding: 7px 9px; font-size: 8px; font-weight: 750; letter-spacing: .12em; }
.chip-pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 9px var(--teal); }
.orientation-chip { color: #72939e; font-weight: 650; }
.orientation-chip b { color: var(--amber); font-size: 15px; }
.scene-annotation { position: absolute; z-index: 2; display: flex; flex-direction: column; gap: 3px; padding: 9px 11px; border: 1px solid rgba(117,184,197,.17); border-radius: 6px; background: rgba(4,18,28,.65); backdrop-filter: blur(9px); pointer-events: none; }
.annotation-left { left: 15px; bottom: 59px; }
.annotation-right { right: 15px; bottom: 59px; text-align: right; }
.annotation-kicker { color: var(--teal); font-size: 7px; letter-spacing: .15em; font-weight: 800; }
.annotation-right .annotation-kicker { color: var(--amber); }
.scene-annotation strong { font-size: 10px; color: #e0f1f2; font-weight: 650; }
.scene-annotation small { color: #88a9b3; font-size: 8px; }
.scene-legend { position: absolute; left: 50%; transform: translateX(-50%); bottom: 14px; z-index: 2; display: flex; gap: 14px; padding: 7px 11px; border: 1px solid rgba(117,184,197,.15); border-radius: 5px; background: rgba(4,18,28,.72); backdrop-filter: blur(9px); white-space: nowrap; pointer-events: none; }
.scene-legend span { display: flex; align-items: center; gap: 6px; color: #a6c0c8; font-size: 8px; }
.legend-line { width: 15px; height: 2px; display: inline-block; border-radius: 3px; }
.legend-line.foam { background: #e3fbf5; box-shadow: 0 0 6px rgba(227,251,245,.6); }
.legend-line.teal-line { background: var(--teal); }
.legend-line.amber-line { background: var(--amber); }
.viewer-footer { height: 30px; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; background: #091b28; color: #62818d; font-size: 8px; letter-spacing: .045em; }
.viewer-footer b { color: #a3bec7; font-size: 8px; letter-spacing: .1em; }
.viewer-footer #simClock { color: #8cb5bf; font-variant-numeric: tabular-nums; }
.key-dot { padding: 0 4px; color: #315362; }
.cause-strip { min-height: 62px; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-around; gap: 7px; padding: 8px 12px; background: linear-gradient(90deg, rgba(12,34,47,.9), rgba(10,29,42,.9)); border: 1px solid var(--line); border-radius: 8px; }
.cause-step { display: flex; align-items: center; gap: 9px; min-width: 0; }
.cause-number { width: 25px; height: 25px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 6px; border: 1px solid rgba(84,214,206,.24); background: rgba(84,214,206,.08); color: var(--teal); font-size: 9px; font-weight: 800; }
.cause-step b { display: block; color: #d0e2e6; font-size: 8px; letter-spacing: .1em; white-space: nowrap; }
.cause-step small { display: block; color: #73929d; font-size: 8px; margin-top: 3px; white-space: nowrap; }
.cause-arrow { color: #426b78; font-size: 16px; }
.context-overlay { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(3,12,20,.84); }
.context-overlay[hidden] { display: none; }
.context-card { max-width: 290px; padding: 22px; border: 1px solid rgba(255,156,134,.35); border-radius: 10px; background: #0b1d2a; text-align: center; }
.context-icon { color: var(--danger); font-size: 26px; }
.context-card strong { display: block; margin-top: 8px; font-size: 13px; }
.context-card p { color: #91aab3; font-size: 10px; line-height: 1.5; }
.embed-controls { display: none; }

.live-mini { display: flex; align-items: center; gap: 6px; color: #71949f; font-size: 8px; letter-spacing: .11em; white-space: nowrap; }
.readout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.readout-card { min-width: 0; border: 1px solid rgba(130,180,195,.12); border-radius: 7px; background: rgba(4,17,27,.52); padding: 10px 9px; }
.readout-card.featured { grid-column: span 2; background: linear-gradient(110deg, rgba(22,76,85,.43), rgba(8,30,43,.75)); border-color: rgba(84,214,206,.22); }
.readout-top { display: flex; justify-content: space-between; align-items: center; gap: 5px; color: #8ca9b3; font-size: 9px; }
.readout-symbol { color: #6dbdbd; font-family: Georgia, serif; font-size: 13px; }
.readout-card strong { display: block; color: #effaf9; font-size: 23px; font-weight: 620; letter-spacing: -.045em; font-variant-numeric: tabular-nums; line-height: 1.3; margin-top: 5px; }
.readout-card:not(.featured) strong { font-size: 19px; }
.readout-card small { color: #72919c; font-size: 8px; }
.readout-card small span { color: #62a9a9; font-size: 7px; letter-spacing: .05em; }
.readout-track { height: 3px; background: rgba(122,183,190,.13); border-radius: 4px; margin-top: 9px; overflow: hidden; }
.readout-track i { display: block; width: 44%; height: 100%; background: linear-gradient(90deg, #328e98, #7be1d1); border-radius: inherit; transition: width .2s ease; }
.validation-card { margin-top: 10px; padding: 11px; border: 1px solid rgba(240,189,115,.2); border-radius: 7px; background: linear-gradient(135deg, rgba(87,65,39,.14), rgba(4,17,27,.55)); }
.validation-heading { display: flex; justify-content: space-between; align-items: center; }
.validation-status { color: var(--amber); border: 1px solid rgba(240,189,115,.24); border-radius: 4px; padding: 3px 5px; font-size: 7px; font-weight: 800; letter-spacing: .1em; }
.validation-card h3 { margin: 7px 0 3px; font-size: 12px; font-weight: 650; }
.validation-card p { color: #8ba7b1; font-size: 8px; line-height: 1.45; margin: 0; }
.validation-values { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 11px; padding: 9px 0; border-top: 1px solid rgba(140,170,180,.1); border-bottom: 1px solid rgba(140,170,180,.1); }
.validation-values div { min-width: 0; }
.validation-values small { display: block; color: #688894; font-size: 7px; letter-spacing: .1em; }
.validation-values b { display: inline-block; color: #e4f2f1; font-size: 14px; font-variant-numeric: tabular-nums; margin-top: 4px; }
.validation-values span { color: #7999a4; font-size: 8px; margin-left: 3px; }
.validation-diff { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; color: #83a0aa; font-size: 8px; }
.validation-diff strong { color: var(--teal-bright); font-size: 11px; font-variant-numeric: tabular-nums; }
.validation-foot { color: #5f7f8b; font-size: 7px; margin-top: 7px; }
.data-footnote { display: flex; gap: 7px; align-items: flex-start; margin-top: 11px; color: #6d8b96; font-size: 8px; line-height: 1.45; }
.footnote-dot { width: 5px; height: 5px; margin-top: 3px; border-radius: 50%; background: var(--amber); flex: 0 0 auto; }
.interpretation-panel { padding: 13px 14px; }
.interpretation-panel h3 { margin: 4px 0 6px; font-size: 12px; }
.interpretation-panel p { color: #91aab3; font-size: 9px; line-height: 1.55; margin: 0; }
.interpretation-callout { display: grid; grid-template-columns: 15px 1fr; gap: 3px 5px; margin-top: 10px; padding: 9px; border-radius: 6px; background: rgba(54,135,139,.1); border: 1px solid rgba(84,214,206,.13); }
.interpretation-callout > span { color: var(--teal); grid-row: span 2; }
.interpretation-callout b { color: #c7e7e5; font-size: 9px; }
.interpretation-callout small { color: #7fa3aa; font-size: 8px; line-height: 1.4; }
.disclaimer-footer { display: flex; justify-content: space-between; align-items: center; padding: 0 23px 10px; color: #587681; font-size: 8px; letter-spacing: .025em; }
.disclaimer-footer span { color: #42616e; font-size: 7px; letter-spacing: .13em; }

body.embed .topbar, body.embed .control-sidebar, body.embed .data-sidebar, body.embed .disclaimer-footer { display: none; }
body.embed .workspace { display: block; height: 100vh; min-height: 0; max-height: none; padding: 0; }
body.embed .viewer-column { height: 100%; gap: 0; }
body.embed .viewer-frame { border: 0; border-radius: 0; }
body.embed .scene-container { min-height: 0; }
body.embed .cause-strip, body.embed .viewer-footer { display: none; }
body.embed .scene-annotation { bottom: 56px; }
body.embed .embed-controls { display: flex; position: absolute; z-index: 4; top: 58px; left: 14px; gap: 6px; }
body.embed .embed-controls button { border: 1px solid rgba(135,197,208,.24); border-radius: 5px; padding: 7px 10px; color: #d6efef; background: rgba(5,20,31,.78); font-size: 9px; cursor: pointer; }

@media (max-width: 1180px) {
  .workspace { grid-template-columns: 270px minmax(300px, 1fr) 255px; gap: 9px; padding: 9px; }
  .controls-panel, .data-panel { padding: 12px 11px; }
  .scene-legend { gap: 9px; }
  .scene-legend span { font-size: 7px; }
}
@media (max-width: 920px) {
  .topbar { padding: 11px 14px; }
  .workspace { display: flex; flex-direction: column; height: auto; max-height: none; min-height: 0; padding: 10px; gap: 10px; }
  .viewer-column { order: 0; min-height: 0; }
  .viewer-frame { height: 480px; flex: 0 0 auto; }
  .scene-container { min-height: 0; }
  .control-sidebar { order: 1; overflow: visible; }
  .data-sidebar { order: 2; overflow: visible; }
  .control-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px; }
  .controls-panel { padding: 15px; }
  .data-panel { padding: 15px; }
  .readout-grid { grid-template-columns: repeat(3,1fr); }
  .readout-card.featured { grid-column: span 1; }
  .validation-card { max-width: none; }
  .interpretation-panel { margin-bottom: 2px; }
  .disclaimer-footer { padding: 2px 14px 12px; }
}
@media (max-width: 600px) {
  .topbar { min-height: 62px; padding: 9px 11px; gap: 8px; }
  .brand-mark { width: 30px; height: 30px; }
  .eyebrow { font-size: 8px; }
  h1 { font-size: 14px; }
  .title-sub, .title-divider { display: none; }
  .topbar-meta { gap: 4px; }
  .live-indicator { padding: 6px; font-size: 0; }
  .live-indicator i { width: 7px; height: 7px; }
  .seed-tag, .mode-tag { padding: 6px; font-size: 7px; }
  .workspace { padding: 8px; gap: 8px; }
  .viewer-frame { height: 420px; }
  .scene-topline { top: 9px; left: 9px; right: 9px; }
  .scene-chip, .orientation-chip { padding: 6px 7px; font-size: 7px; }
  .orientation-chip { gap: 4px; }
  .scene-annotation { padding: 7px 8px; bottom: 53px; }
  .annotation-left { left: 8px; }
  .annotation-right { right: 8px; }
  .scene-annotation strong { font-size: 8px; }
  .scene-annotation small { font-size: 7px; }
  .scene-legend { bottom: 9px; gap: 8px; padding: 6px 7px; }
  .scene-legend span { font-size: 6px; gap: 4px; }
  .legend-line { width: 10px; }
  .viewer-footer { padding: 0 8px; font-size: 7px; }
  .viewer-footer b { font-size: 7px; }
  .cause-strip { min-height: 58px; gap: 4px; padding: 7px 5px; }
  .cause-step { gap: 5px; }
  .cause-number { width: 21px; height: 21px; font-size: 8px; }
  .cause-step b { font-size: 6px; letter-spacing: .04em; }
  .cause-step small { font-size: 6px; }
  .cause-arrow { font-size: 12px; }
  .control-list { grid-template-columns: 1fr; gap: 14px; }
  .controls-panel, .data-panel { padding: 13px 12px; }
  .readout-grid { grid-template-columns: 1fr 1fr; }
  .readout-card.featured { grid-column: span 2; }
  .readout-card { padding: 10px; }
  .readout-card strong { font-size: 22px; }
  .readout-card:not(.featured) strong { font-size: 19px; }
  .disclaimer-footer { display: block; line-height: 1.5; padding: 2px 12px 12px; }
  .disclaimer-footer span { display: block; margin-top: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
