:root {
  color-scheme: dark;
  --bg: #080e15;
  --panel: #101923;
  --panel-2: #131f2b;
  --line: rgba(180, 204, 224, 0.12);
  --line-strong: rgba(180, 204, 224, 0.2);
  --text: #e8edf1;
  --muted: #8998a5;
  --faint: #60717f;
  --sand: #e4b875;
  --sand-bright: #ffd69a;
  --cyan: #6fd2e1;
  --green: #7ac5a2;
  --radius: 13px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-width: 320px; font-size: 13px; letter-spacing: 0.005em; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(ellipse at 30% -20%, rgba(53, 78, 97, 0.22), transparent 55%), var(--bg); }
.topbar { height: 58px; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(7, 13, 20, 0.86); flex: 0 0 auto; }
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 26px; height: 26px; display: flex; align-items: end; gap: 2px; padding: 4px; border: 1px solid rgba(230, 187, 126, 0.35); border-radius: 8px; transform: skew(-7deg); }
.brand-mark span { display: block; width: 4px; border-radius: 5px 5px 1px 1px; background: var(--sand); }
.brand-mark span:nth-child(1) { height: 8px; opacity: .55; }
.brand-mark span:nth-child(2) { height: 13px; opacity: .8; }
.brand-mark span:nth-child(3) { height: 17px; }
.eyebrow, .kicker, .panel-kicker, .section-label-row h3, .section-note, .readout-name, .validation-values small, .speed-control label, .app-footer { letter-spacing: .12em; font-size: 9px; font-weight: 700; }
.eyebrow { color: var(--sand); margin-bottom: 2px; }
.brand-title { color: #c4cdd4; font-size: 12px; font-weight: 600; }
.brand-title span { color: var(--faint); padding: 0 3px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.live-indicator { display: flex; align-items: center; gap: 7px; color: #9fb2bf; font-size: 9px; letter-spacing: .1em; font-weight: 700; }
.live-indicator i, .status-dot { width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px rgba(122,197,162,.7); }
.live-indicator.paused i { background: #c49a66; box-shadow: 0 0 8px rgba(196,154,102,.45); }
.icon-button { width: 25px; height: 25px; border: 1px solid var(--line-strong); border-radius: 50%; background: transparent; color: #9aaab5; cursor: pointer; }
.workspace { width: min(1600px, 100%); margin: 0 auto; padding: 20px 24px 14px; display: grid; grid-template-columns: minmax(0, 1fr) 354px; gap: 18px; flex: 1 0 auto; }
.stage-column { min-width: 0; display: flex; flex-direction: column; }
.stage-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 2px 2px 14px; }
.kicker { color: var(--sand); margin-bottom: 8px; }
.kicker-dot { color: #60717f; margin: 0 5px; }
h1 { margin: 0; font-size: clamp(22px, 2.3vw, 30px); line-height: 1.12; letter-spacing: -.045em; font-weight: 650; }
h1 em { color: #c3cdd4; font-style: normal; font-weight: 450; }
.title-dash { color: #677985; font-weight: 300; }
.stage-subtitle { color: var(--muted); font-size: 12px; margin: 8px 0 0; max-width: 700px; }
.stage-heading-meta { display: flex; gap: 6px; padding-bottom: 4px; flex: 0 0 auto; }
.meta-pill { border: 1px solid rgba(111,210,225,.23); color: var(--cyan); border-radius: 5px; padding: 5px 7px; font-size: 8px; font-weight: 700; letter-spacing: .11em; white-space: nowrap; }
.meta-pill.muted { border-color: var(--line); color: #8997a2; }
.viewport { height: clamp(430px, 55vh, 680px); min-height: 400px; position: relative; overflow: hidden; border: 1px solid rgba(177, 197, 214, .15); border-radius: 15px; background: radial-gradient(ellipse at 50% 75%, #332a21 0%, #1a2025 48%, #111a22 100%); box-shadow: 0 18px 55px rgba(0,0,0,.27), inset 0 1px 0 rgba(255,255,255,.035); isolation: isolate; }
.scene-root { position: absolute; inset: 0; z-index: 0; }
.webgl-canvas { width: 100%; height: 100%; display: block; outline: none; }
.scene-topline { position: absolute; top: 14px; left: 15px; right: 15px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; z-index: 2; }
.scene-chip { border: 1px solid rgba(205, 222, 235, .17); border-radius: 6px; padding: 7px 9px; background: rgba(8, 15, 22, .54); backdrop-filter: blur(10px); color: #d4dce2; font-size: 8px; font-weight: 700; letter-spacing: .1em; }
.chip-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--sand); margin-right: 5px; vertical-align: 1px; }
.scene-coordinates { font-size: 8px; letter-spacing: .1em; color: rgba(230, 237, 241, .68); text-shadow: 0 1px 5px #111; }
.scene-coordinates span { padding: 0 5px; color: var(--sand); }
.annotation { position: absolute; z-index: 2; pointer-events: none; display: flex; align-items: center; gap: 6px; color: rgba(236, 223, 203, .82); font-size: 8px; letter-spacing: .1em; font-weight: 700; text-shadow: 0 1px 5px #201810; }
.annotation-line { width: 24px; height: 1px; background: rgba(232, 190, 133, .75); }
.annotation-windward { left: 8%; top: 53%; }
.annotation-slip { left: 57%; top: 36%; }
.annotation-resonance { left: 55%; top: 68%; color: rgba(137, 224, 236, .9); }
.annotation-resonance .annotation-line { background: var(--cyan); }
.scene-bottom-left { position: absolute; bottom: 14px; left: 15px; display: flex; gap: 14px; z-index: 2; pointer-events: none; }
.legend-item { display: flex; align-items: center; gap: 6px; color: rgba(222, 230, 235, .72); font-size: 9px; text-shadow: 0 1px 4px #101820; }
.legend-grain { width: 6px; height: 6px; border-radius: 50%; background: #f2c27d; box-shadow: 0 0 6px #e7ad5f; }
.legend-wave { width: 14px; height: 2px; border-radius: 4px; background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
.scene-bottom-right { position: absolute; bottom: 14px; right: 15px; z-index: 2; color: rgba(222,230,235,.65); font-size: 8px; letter-spacing: .1em; display: flex; gap: 9px; pointer-events: none; }
.scene-divider { width: 1px; height: 10px; background: rgba(222,230,235,.25); }
.context-overlay, .loading-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(6, 11, 17, .78); z-index: 5; backdrop-filter: blur(7px); }
.context-overlay[hidden], .loading-overlay[hidden] { display: none; }
.context-card { max-width: 290px; text-align: center; padding: 20px; color: #dce5eb; }
.context-card strong { font-size: 14px; }
.context-card p { color: #91a0ac; line-height: 1.5; font-size: 11px; }
.context-icon { color: var(--cyan); font-size: 28px; margin-bottom: 8px; }
.loading-overlay { gap: 12px; align-content: center; color: #c9d4dc; font-size: 9px; letter-spacing: .18em; font-weight: 700; transition: opacity .35s ease; }
.loading-overlay.loaded { opacity: 0; pointer-events: none; }
.loader-ring { width: 26px; height: 26px; border: 2px solid rgba(224,184,117,.18); border-top-color: var(--sand); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.stage-toolbar { min-height: 56px; margin-top: 9px; padding: 8px 10px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 10px; background: rgba(17, 26, 36, .82); }
.transport-controls { display: flex; align-items: center; gap: 6px; }
.primary-button, .tool-button { border: 1px solid var(--line-strong); border-radius: 7px; background: rgba(255,255,255,.025); color: #c8d2d9; height: 34px; padding: 0 11px; cursor: pointer; font-size: 10px; font-weight: 650; transition: background .18s, border-color .18s, transform .18s; }
.primary-button { display: flex; align-items: center; gap: 7px; background: rgba(225, 180, 112, .14); border-color: rgba(225,180,112,.36); color: #f2cf9d; min-width: 80px; justify-content: center; }
.primary-button:hover { background: rgba(225,180,112,.22); }
.tool-button:hover, .icon-button:hover { border-color: rgba(210, 224, 236, .38); background: rgba(255,255,255,.07); }
.tool-button:active, .primary-button:active { transform: translateY(1px); }
.tool-button span { color: var(--sand); padding-left: 3px; }
.play-icon { font-size: 10px; }
.toolbar-divider { height: 25px; width: 1px; background: var(--line-strong); margin: 0 3px; }
.speed-control { display: flex; align-items: center; gap: 9px; min-width: 180px; }
.speed-control label { color: #7f909c; font-size: 8px; white-space: nowrap; }
.speed-control input { width: 80px; }
.speed-control output { color: #c9d3da; font-size: 10px; min-width: 33px; }
.toolbar-spacer { flex: 1; }
.tool-button.compact { padding: 0 8px; white-space: nowrap; }
.tool-button.compact span { color: #a8b6c0; }
input[type="range"] { appearance: none; height: 3px; border-radius: 5px; background: linear-gradient(90deg, #d7a86c 0%, #d7a86c 45%, #354452 45%, #354452 100%); outline: none; cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #e8bd82; border: 2px solid #1b2732; box-shadow: 0 0 0 1px rgba(232,189,130,.65); }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: #e8bd82; border: 2px solid #1b2732; box-shadow: 0 0 0 1px rgba(232,189,130,.65); }
.process-strip { margin-top: 11px; display: flex; align-items: center; gap: 10px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(14, 22, 31, .64); }
.process-step { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1; }
.process-index { color: var(--sand); font-size: 9px; font-weight: 750; letter-spacing: .08em; }
.process-step strong { display: block; color: #b9c5cd; font-size: 8px; letter-spacing: .13em; }
.process-step small { display: block; margin-top: 3px; color: #788894; font-size: 9px; white-space: nowrap; }
.process-arrow { color: #586a77; font-size: 14px; }
.control-panel { min-width: 0; padding: 16px 15px 13px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(180deg, rgba(18,28,39,.96), rgba(12,20,29,.96)); box-shadow: 0 18px 50px rgba(0,0,0,.16); align-self: start; }
.panel-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 14px; }
.panel-kicker { color: var(--sand); font-size: 8px; margin-bottom: 5px; }
.panel-header h2 { margin: 0; font-size: 18px; letter-spacing: -.035em; font-weight: 650; }
.panel-number { color: #b6c0c8; font-size: 10px; font-weight: 700; }
.panel-number span { color: #687987; }
.section-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.section-label-row h3 { margin: 0; color: #9baab5; font-size: 8px; }
.section-note { color: #617382; font-size: 7px; }
.preset-section, .parameter-section, .readout-section, .validation-section { padding-bottom: 13px; border-bottom: 1px solid var(--line); margin-bottom: 13px; }
.preset-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 6px; }
.preset-card { min-width: 0; min-height: 69px; text-align: left; padding: 8px 7px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.018); cursor: pointer; transition: .18s ease; }
.preset-card:hover { border-color: rgba(225,180,112,.36); background: rgba(225,180,112,.045); }
.preset-card.active { border-color: rgba(225,180,112,.5); background: rgba(225,180,112,.09); box-shadow: inset 0 0 0 1px rgba(225,180,112,.08); }
.preset-icon { display: block; color: var(--sand); font-size: 14px; line-height: 1; margin-bottom: 5px; }
.preset-card strong { display: block; color: #d7e0e6; font-size: 9px; white-space: nowrap; }
.preset-card small { display: block; color: #7c8c97; font-size: 8px; margin-top: 4px; white-space: nowrap; }
.parameter-list { display: flex; flex-direction: column; gap: 11px; }
.parameter-row { display: flex; flex-direction: column; gap: 6px; }
.parameter-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.parameter-label label { color: #c0cbd2; font-size: 10px; }
.parameter-label output { color: #e7c18b; font-size: 10px; font-variant-numeric: tabular-nums; }
.parameter-row input { width: 100%; }
.range-ends { display: flex; justify-content: space-between; color: #637582; font-size: 8px; }
.readout-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px; }
.readout-card { min-width: 0; padding: 9px 9px 8px; border: 1px solid rgba(170,195,213,.1); border-radius: 8px; background: rgba(255,255,255,.018); }
.readout-name { display: block; color: #7f909c; font-size: 7px; letter-spacing: .08em; white-space: nowrap; }
.readout-name i { color: #617b84; font-size: 6px; font-style: normal; margin-left: 2px; }
.readout-card > div:nth-child(2) { display: flex; align-items: baseline; gap: 4px; margin-top: 6px; }
.readout-card strong { color: #e8edf1; font-size: 21px; font-weight: 580; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.readout-card small { color: #8c9ca7; font-size: 9px; }
.readout-track { height: 2px; margin-top: 7px; border-radius: 3px; background: #293744; overflow: hidden; }
.readout-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #d8a76b, #75cddc); transition: width .22s ease; }
.readout-footnote { display: flex; align-items: center; gap: 6px; margin-top: 9px; color: #70818e; font-size: 8px; }
.readout-footnote .status-dot { width: 5px; height: 5px; }
.validation-card { padding: 10px; border: 1px solid rgba(122,197,162,.18); border-radius: 9px; background: rgba(71,126,103,.055); }
.validation-title { display: flex; align-items: center; gap: 7px; }
.validation-icon { width: 16px; height: 16px; display: grid; place-items: center; border-radius: 50%; background: rgba(122,197,162,.14); color: var(--green); font-size: 10px; }
.validation-title strong { color: #d4e2dc; font-size: 10px; }
.validation-tag { margin-left: auto; color: #79b89b; font-size: 7px; font-weight: 700; letter-spacing: .1em; }
.validation-values { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; margin-top: 11px; }
.validation-values small { display: block; color: #769186; font-size: 6px; white-space: nowrap; }
.validation-values strong { display: block; margin-top: 4px; color: #dce8e1; font-size: 12px; font-weight: 620; font-variant-numeric: tabular-nums; }
.validation-values .validation-diff { color: #91d2ad; }
.validation-card p { color: #7e9489; font-size: 8px; line-height: 1.45; margin: 9px 0 0; }
.science-details { border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.015); overflow: hidden; }
.science-details summary { min-height: 42px; padding: 0 11px; display: flex; align-items: center; justify-content: space-between; list-style: none; cursor: pointer; color: #cbd5dc; font-size: 10px; font-weight: 650; }
.science-details summary::-webkit-details-marker { display: none; }
.science-summary-icon { color: var(--sand); font-size: 15px; margin-right: 7px; vertical-align: -1px; }
.summary-chevron { color: #8495a1; font-size: 14px; transition: transform .2s; }
.science-details[open] .summary-chevron { transform: rotate(180deg); }
.science-content { padding: 0 11px 13px; color: #98a8b2; font-size: 9px; line-height: 1.55; }
.science-intro { color: #b7c3cb; margin: 2px 0 12px; }
.science-content h4 { color: #d5bd97; font-size: 8px; letter-spacing: .11em; margin: 12px 0 6px; }
.science-content p { margin: 6px 0; }
.science-content b { color: #dce4e9; font-weight: 600; }
.equation { padding: 8px; border-radius: 6px; background: rgba(5,11,17,.48); border: 1px solid rgba(170,195,213,.08); color: #cde2e7; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; text-align: center; }
.science-list { padding-left: 15px; margin: 6px 0; }
.science-list li { margin: 3px 0; }
.science-source-note { margin-top: 11px; padding-top: 9px; border-top: 1px solid var(--line); color: #758894; font-size: 8px; }
.disclaimer { color: #657681; font-size: 8px; line-height: 1.45; margin-top: 11px; }
.app-footer { display: flex; justify-content: space-between; padding: 8px 26px 12px; color: #556673; font-size: 7px; }
.app-footer b { color: #a17b4d; padding: 0 4px; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.embed-mode .topbar, .embed-mode .app-footer, .embed-mode .stage-heading { display: none; }
.embed-mode .workspace { padding: 0; grid-template-columns: minmax(0,1fr) 320px; gap: 0; }
.embed-mode .stage-column { padding: 8px; }
.embed-mode .viewport { height: calc(100vh - 92px); min-height: 360px; }
.embed-mode .control-panel { border-radius: 0; border-top: 0; border-bottom: 0; }
@media (max-width: 1120px) {
  .workspace { grid-template-columns: minmax(0,1fr) 320px; padding-left: 16px; padding-right: 16px; gap: 12px; }
  .control-panel { padding: 14px 12px; }
  .stage-heading-meta { display: none; }
  .process-strip { gap: 7px; padding: 10px; }
  .process-step small { font-size: 8px; }
  .speed-control { min-width: 145px; gap: 6px; }
  .speed-control input { width: 62px; }
}
@media (max-width: 850px) {
  .workspace { display: flex; flex-direction: column; padding: 15px 14px 10px; }
  .stage-heading { align-items: flex-start; }
  .viewport { height: min(58vh, 560px); min-height: 350px; }
  .control-panel { width: 100%; }
  .parameter-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); column-gap: 16px; }
  .app-footer { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 540px) {
  .topbar { height: 52px; padding: 0 14px; }
  .eyebrow { font-size: 8px; }
  .brand-title { font-size: 11px; }
  .workspace { padding: 12px 10px 10px; gap: 12px; }
  .stage-heading { margin: 1px 1px 10px; }
  h1 { font-size: 22px; max-width: 370px; line-height: 1.08; }
  h1 em { display: block; margin-top: 3px; font-size: 18px; }
  .stage-subtitle { font-size: 10px; line-height: 1.4; margin-top: 6px; }
  .kicker { font-size: 8px; margin-bottom: 6px; }
  .viewport { height: 43vh; min-height: 300px; max-height: 390px; border-radius: 11px; }
  .scene-topline { top: 9px; left: 9px; right: 9px; }
  .scene-chip { font-size: 7px; padding: 6px 7px; }
  .scene-coordinates { font-size: 7px; }
  .annotation { font-size: 6px; gap: 4px; }
  .annotation-line { width: 14px; }
  .annotation-windward { left: 5%; top: 56%; }
  .annotation-slip { left: 51%; top: 34%; }
  .annotation-resonance { left: 49%; top: 71%; }
  .scene-bottom-left { bottom: 9px; left: 9px; gap: 9px; }
  .legend-item { font-size: 7px; }
  .scene-bottom-right { bottom: 9px; right: 9px; font-size: 7px; }
  .stage-toolbar { flex-wrap: wrap; gap: 7px; padding: 7px; min-height: 0; }
  .transport-controls { gap: 5px; }
  .primary-button, .tool-button { height: 31px; padding: 0 8px; font-size: 9px; }
  .primary-button { min-width: 72px; }
  .toolbar-divider { display: none; }
  .speed-control { order: 3; flex: 1 0 100%; min-width: 0; padding: 3px 2px 1px; }
  .speed-control input { flex: 1; width: auto; }
  .toolbar-spacer { flex: 1; }
  .tool-button.compact { padding: 0 7px; }
  .process-strip { gap: 5px; padding: 9px 7px; margin-top: 8px; }
  .process-step { gap: 5px; }
  .process-index { font-size: 8px; }
  .process-step strong { font-size: 7px; }
  .process-step small { font-size: 7px; white-space: normal; line-height: 1.25; }
  .process-arrow { font-size: 11px; }
  .control-panel { padding: 13px 11px; }
  .panel-header h2 { font-size: 17px; }
  .parameter-list { grid-template-columns: 1fr; gap: 10px; }
  .preset-card { min-height: 66px; padding: 7px 6px; }
  .preset-card strong { font-size: 8px; }
  .preset-card small { font-size: 7px; }
  .readout-card { padding: 8px; }
  .readout-name { font-size: 6px; }
  .readout-card strong { font-size: 20px; }
  .validation-values { gap: 3px; }
  .validation-values small { font-size: 5px; letter-spacing: .07em; }
  .validation-values strong { font-size: 11px; }
  .app-footer { gap: 8px; font-size: 6px; padding: 8px 10px 12px; }
  .app-footer span:last-child { text-align: right; }
  .embed-mode .workspace { display: flex; flex-direction: column; }
  .embed-mode .stage-column { padding: 0; }
  .embed-mode .viewport { height: 55vh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
