:root {
  color-scheme: dark;
  --bg: #071018;
  --panel: #0d1820;
  --panel-2: #101e27;
  --line: rgba(156, 188, 197, 0.13);
  --line-strong: rgba(156, 188, 197, 0.23);
  --text: #e7ece9;
  --muted: #8ea1a7;
  --muted-2: #60747b;
  --teal: #77c7c0;
  --teal-bright: #9be0d6;
  --amber: #d69b61;
  --sand: #a77b54;
  --danger: #e1a28a;
  --radius: 12px;
  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; background-image: radial-gradient(ellipse at 16% -10%, rgba(45, 90, 99, 0.16), transparent 44%), linear-gradient(180deg, #09141c 0%, #071018 65%); }
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--teal-bright); outline-offset: 3px; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.masthead { height: 66px; flex: 0 0 66px; display: flex; align-items: center; justify-content: space-between; padding: 0 26px; border-bottom: 1px solid var(--line); background: rgba(7, 16, 24, 0.88); }
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 28px; height: 28px; border: 1px solid rgba(119,199,192,.5); border-radius: 50%; position: relative; display: grid; place-items: center; }
.brand-mark span { position: absolute; width: 18px; height: 18px; border: 1px solid rgba(119,199,192,.75); border-radius: 50%; }
.brand-mark span:nth-child(2) { width: 11px; height: 11px; border-color: rgba(214,155,97,.8); }
.brand-mark span:nth-child(3) { width: 4px; height: 4px; background: var(--teal); border: 0; }
.brand-name { font-size: 10px; font-weight: 750; letter-spacing: .16em; color: #dce6e4; }
.brand-name span { color: var(--teal); padding: 0 4px; }
.brand-subtitle { margin-top: 4px; color: var(--muted-2); font-size: 8px; letter-spacing: .18em; }
.masthead-meta { display: flex; align-items: center; gap: 8px; }
.meta-chip { border: 1px solid var(--line); border-radius: 30px; padding: 7px 10px; color: #8da0a6; font-size: 8px; letter-spacing: .13em; }
.meta-chip b { color: var(--amber); padding: 0 3px; }
.meta-chip-bright { color: #b5d8d3; border-color: rgba(119,199,192,.26); }
.meta-chip-bright i { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 10px rgba(119,199,192,.65); }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 374px; gap: 14px; padding: 14px 14px 10px; flex: 1; min-height: 0; }
.stage-column { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.stage-heading { min-height: 72px; display: flex; align-items: flex-start; justify-content: space-between; padding: 2px 7px 0 9px; gap: 16px; }
.eyebrow { color: var(--teal); font-size: 8px; font-weight: 700; letter-spacing: .19em; }
h1 { margin: 7px 0 4px; font-size: clamp(20px, 2vw, 27px); line-height: 1.08; font-weight: 630; letter-spacing: -.035em; }
h1 span { color: #9eafb1; font-weight: 420; }
.stage-intro { margin: 0; color: var(--muted); font-size: 10px; letter-spacing: .015em; }
.stage-id { margin-top: 4px; min-width: 106px; padding: 8px 11px; border-left: 1px solid var(--line-strong); text-align: right; }
.stage-id span { display: block; color: var(--muted-2); font-size: 8px; letter-spacing: .16em; }
.stage-id strong { display: block; margin-top: 5px; font-size: 11px; color: #cbd7d3; letter-spacing: .08em; }

.scene-wrap { flex: 1; min-height: 420px; position: relative; overflow: hidden; border: 1px solid rgba(131, 166, 174, .19); border-radius: 13px; background: radial-gradient(ellipse at 50% 40%, #15252c 0%, #0b171f 52%, #071018 100%); box-shadow: 0 22px 55px rgba(0,0,0,.23), inset 0 0 60px rgba(100,160,160,.035); }
#sceneCanvas { display: block; width: 100%; height: 100%; min-height: 420px; outline: none; }
.scene-top-overlay, .scene-bottom-overlay { position: absolute; z-index: 3; left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.scene-top-overlay { top: 14px; }
.scene-bottom-overlay { bottom: 14px; align-items: flex-end; }
.scene-mode, .scene-scale { color: rgba(205,223,220,.74); font-size: 8px; letter-spacing: .15em; }
.scene-mode { display: inline-flex; align-items: center; gap: 7px; }
.scene-mode i { width: 6px; height: 6px; border-radius: 50%; background: #79d1be; box-shadow: 0 0 12px #5bb4a9; }
.scene-scale { color: rgba(148,169,171,.58); }
.scene-scale b { color: var(--amber); padding: 0 3px; }
.scene-bottom-label .eyebrow { font-size: 7px; color: rgba(125,196,189,.75); }
.scene-bottom-label strong { display: block; margin-top: 5px; color: rgba(221,230,226,.82); font-size: 10px; font-weight: 500; }
.orbit-hint { color: rgba(150,171,173,.65); font-size: 8px; letter-spacing: .12em; }
.orbit-hint b { color: var(--amber); padding: 0 4px; }
.mouse-icon { color: var(--teal); font-size: 13px; margin-right: 5px; }
.annotation { position: absolute; z-index: 4; top: 0; left: 0; display: flex; align-items: center; gap: 6px; opacity: 0; pointer-events: none; transition: opacity .2s ease; white-space: nowrap; }
.annotation i { display: block; width: 5px; height: 5px; border: 1px solid var(--teal-bright); border-radius: 50%; box-shadow: 0 0 8px var(--teal); }
.annotation span { padding: 4px 6px; border: 1px solid rgba(119,199,192,.2); border-radius: 4px; background: rgba(5,14,20,.74); color: #a9c7c4; font-size: 7px; letter-spacing: .12em; }
.annotation-front i { border-color: var(--amber); box-shadow: 0 0 8px var(--amber); }
.annotation-front span { border-color: rgba(214,155,97,.2); color: #d3b18d; }
.context-alert { position: absolute; z-index: 8; left: 50%; top: 50%; transform: translate(-50%,-50%); max-width: 82%; padding: 12px 16px; border: 1px solid rgba(225,162,138,.35); border-radius: 8px; background: rgba(14,25,31,.94); color: #edc2ad; font-size: 11px; text-align: center; box-shadow: 0 12px 32px rgba(0,0,0,.4); }
.scene-fallback { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; }
.scene-fallback[hidden] { display: none; }
.fallback-rings { position: absolute; width: min(54vw, 410px); aspect-ratio: 1; border-radius: 50%; background: repeating-radial-gradient(circle, transparent 0 11px, rgba(170,119,72,.62) 12px 15px, rgba(42,31,25,.8) 16px 19px, transparent 20px 29px), radial-gradient(circle at 42% 36%, #b88a5d, #79543b 52%, #3a2b22 75%); box-shadow: 0 35px 65px rgba(0,0,0,.55), inset -20px -22px 45px rgba(0,0,0,.5), inset 8px 9px 30px rgba(255,219,171,.13); transform: perspective(750px) rotateX(9deg) rotateY(-14deg); opacity: .55; }
.fallback-copy { position: relative; z-index: 1; width: min(350px, 80%); padding: 20px; border: 1px solid rgba(119,199,192,.2); border-radius: 10px; background: rgba(7,16,24,.83); text-align: center; backdrop-filter: blur(12px); }
.fallback-kicker { display: block; color: var(--amber); font-size: 8px; letter-spacing: .17em; }
.fallback-copy strong { display: block; margin: 9px 0 5px; font-size: 18px; }
.fallback-copy p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }

.stage-readouts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.stage-readout { padding: 9px 11px 8px; min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: linear-gradient(135deg, rgba(17,32,41,.84), rgba(10,21,29,.72)); }
.stage-readout span { display: block; color: var(--muted-2); font-size: 7px; letter-spacing: .14em; white-space: nowrap; }
.stage-readout strong { display: block; margin-top: 5px; font-size: 17px; line-height: 1; font-weight: 550; color: #e3e9e5; font-variant-numeric: tabular-nums; }
.stage-readout small { color: #8da2a3; font-size: 9px; font-weight: 450; }
.stage-footer { display: flex; justify-content: space-between; gap: 10px; padding: 0 5px 2px; color: var(--muted-2); font-size: 8px; letter-spacing: .05em; }
.model-note { display: flex; align-items: center; gap: 7px; min-width: 0; }
.status-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 7px rgba(119,199,192,.7); flex: 0 0 auto; }
.footer-legend { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-left: 7px; }
.legend-sand { background: #a77b54; }
.legend-oxide { background: #503022; border: 1px solid #bd8754; }

.control-panel { display: flex; flex-direction: column; min-height: 0; max-height: calc(100vh - 90px); overflow-y: auto; padding: 17px 17px 13px; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(180deg, rgba(15,27,35,.97), rgba(10,20,28,.98)); scrollbar-width: thin; scrollbar-color: #31464e transparent; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 5px 0 0; font-size: 16px; font-weight: 580; letter-spacing: -.02em; }
.panel-index { color: var(--muted-2); font-size: 8px; letter-spacing: .12em; padding-top: 3px; }
.transport-row { display: flex; align-items: center; gap: 6px; padding: 12px 0 13px; border-bottom: 1px solid var(--line); }
.transport-button, .icon-button, .secondary-action, .export-action { border: 1px solid var(--line-strong); border-radius: 7px; background: #14242d; cursor: pointer; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.transport-button:hover, .icon-button:hover, .secondary-action:hover { background: #1b313a; border-color: rgba(119,199,192,.35); }
.transport-button:active, .icon-button:active, .secondary-action:active, .export-action:active { transform: translateY(1px); }
.transport-button { height: 34px; min-width: 92px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-color: rgba(119,199,192,.34); background: rgba(37,82,83,.35); color: #b6e2db; font-size: 8px; font-weight: 700; letter-spacing: .12em; }
.play-icon { width: 0; height: 0; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 8px solid var(--teal-bright); }
.pause-icon { width: 8px; height: 10px; border: 0; border-left: 2px solid var(--teal-bright); border-right: 2px solid var(--teal-bright); }
.icon-button { width: 34px; height: 34px; font-size: 15px; color: #b5c7c4; }
.speed-select-label { margin-left: auto; color: var(--muted-2); font-size: 7px; letter-spacing: .14em; }
.speed-select { height: 32px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: #101f27; color: #c7d7d3; font-size: 10px; }
.section-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; color: #b1c3c0; font-size: 8px; font-weight: 700; letter-spacing: .14em; }
.section-hint { color: var(--muted-2); font-size: 7px; font-weight: 500; letter-spacing: .09em; }
.preset-section { padding: 13px 0 14px; border-bottom: 1px solid var(--line); }
.preset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.preset-button { min-width: 0; display: flex; align-items: center; gap: 6px; padding: 7px 6px; border: 1px solid var(--line); border-radius: 7px; background: rgba(17,31,39,.72); text-align: left; cursor: pointer; }
.preset-button:hover { border-color: var(--line-strong); }
.preset-button.active { border-color: rgba(119,199,192,.43); background: rgba(36,75,76,.22); box-shadow: inset 0 0 0 1px rgba(119,199,192,.06); }
.preset-swatch { display: block; width: 22px; height: 22px; flex: 0 0 22px; border-radius: 50%; background: repeating-radial-gradient(circle, #b88a5c 0 2px, #3e2a20 3px 4px, #8e6442 5px 6px); }
.fine-swatch { background: repeating-radial-gradient(circle, #bd9267 0 1px, #3b271d 2px 3px, #9d7049 4px 5px); }
.sparse-swatch { background: repeating-radial-gradient(circle, #bd9267 0 2px, #3b271d 3px 5px, #9d7049 6px 9px); }
.preset-button strong { display: block; color: #cbd8d3; font-size: 8px; font-weight: 600; white-space: nowrap; }
.preset-button small { display: block; margin-top: 3px; color: var(--muted-2); font-size: 7px; white-space: nowrap; }
.control-section { padding: 14px 0 13px; border-bottom: 1px solid var(--line); }
.slider-control { margin: 0 0 12px; }
.slider-control:last-child { margin-bottom: 0; }
.slider-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.slider-heading label { color: #bdcbc7; font-size: 9px; }
.slider-heading output { color: var(--teal-bright); font-size: 9px; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { display: block; width: 100%; height: 14px; margin: 0; background: transparent; accent-color: var(--teal); cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, rgba(119,199,192,.72), rgba(119,199,192,.17)); }
input[type="range"]::-webkit-slider-thumb { width: 11px; height: 11px; margin-top: -4px; appearance: none; border: 2px solid #c1ece4; border-radius: 50%; background: #347c79; box-shadow: 0 0 0 3px rgba(119,199,192,.12); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, rgba(119,199,192,.72), rgba(119,199,192,.17)); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid #c1ece4; border-radius: 50%; background: #347c79; box-shadow: 0 0 0 3px rgba(119,199,192,.12); }
.slider-scale { display: flex; justify-content: space-between; color: var(--muted-2); font-size: 7px; letter-spacing: .03em; }
.live-data-section { padding: 13px 0; border-bottom: 1px solid var(--line); }
.data-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.data-cell { padding: 9px; border: 1px solid var(--line); border-radius: 7px; background: rgba(7,17,24,.5); }
.data-cell span { display: block; color: var(--muted); font-size: 8px; }
.data-cell strong { display: block; margin-top: 6px; color: #dce8e2; font-size: 13px; font-weight: 570; font-variant-numeric: tabular-nums; }
.data-cell small { display: block; margin-top: 3px; color: var(--muted-2); font-size: 7px; }
.science-panel { margin-top: 11px; border: 1px solid var(--line); border-radius: 8px; background: rgba(6,15,21,.34); }
.science-panel summary { display: flex; justify-content: space-between; align-items: center; padding: 11px 10px; cursor: pointer; list-style: none; color: #d0dcd7; font-size: 10px; font-weight: 600; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-icon { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 7px; border-radius: 5px; background: rgba(119,199,192,.12); color: var(--teal-bright); font-size: 13px; }
.summary-state { color: var(--muted-2); font-size: 7px; letter-spacing: .12em; }
.science-panel[open] .summary-state { color: var(--teal); }
.science-content { padding: 0 10px 11px; color: #9eafb0; font-size: 8px; line-height: 1.55; }
.science-content p { margin: 6px 0 10px; }
.science-content p b { color: #cbd9d3; }
.science-equation { padding: 7px 8px; border-left: 2px solid rgba(119,199,192,.55); border-radius: 0 4px 4px 0; background: rgba(25,50,54,.3); color: #d1dfd9; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 9px; }
.validation-card { margin-top: 10px; padding: 9px; border: 1px solid rgba(119,199,192,.19); border-radius: 7px; background: rgba(16,39,41,.34); }
.validation-head { display: flex; justify-content: space-between; color: #9eb8b3; font-size: 7px; letter-spacing: .11em; }
.validation-head b { color: var(--teal-bright); font-size: 7px; }
.validation-card p { color: var(--muted); font-size: 8px; }
.validation-values { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.validation-values span { color: var(--muted-2); font-size: 6px; letter-spacing: .1em; }
.validation-values strong { display: block; margin-top: 4px; color: #dce7e1; font-size: 9px; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.science-caveat { margin-top: 9px; padding: 8px; border-radius: 6px; background: rgba(139,103,62,.1); color: #a99b89; font-size: 7px; }
.science-caveat b { color: #d0b28d; }
.panel-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding-top: 12px; }
.secondary-action, .export-action { height: 32px; color: #a9bbb7; font-size: 7px; font-weight: 700; letter-spacing: .1em; }
.secondary-action span, .export-action span { margin-right: 4px; color: var(--teal); font-size: 12px; vertical-align: -1px; }
.export-action { grid-column: 1 / -1; border-color: rgba(214,155,97,.32); background: rgba(93,59,33,.24); color: #e0b98e; }
.export-action:hover { border-color: rgba(214,155,97,.58); background: rgba(93,59,33,.38); }
.export-action span { color: var(--amber); }
.panel-status { padding-top: 8px; color: var(--muted-2); font-size: 7px; letter-spacing: .05em; text-align: center; }
.disclaimer-footer { display: flex; justify-content: space-between; gap: 12px; padding: 7px 21px 10px; color: #52666d; font-size: 7px; letter-spacing: .12em; }

@media (min-width: 1500px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 400px; padding: 18px 18px 12px; gap: 18px; }
  .scene-wrap, #sceneCanvas { min-height: 560px; }
  .control-panel { max-height: calc(100vh - 102px); padding: 20px; }
}

@media (max-width: 1080px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 340px; }
  .control-panel { padding: 14px; }
  .stage-heading { min-height: 66px; }
  .stage-id { display: none; }
  .preset-button { gap: 4px; padding: 6px 4px; }
  .preset-swatch { width: 18px; height: 18px; flex-basis: 18px; }
}

@media (max-width: 820px) {
  .masthead { height: 58px; flex-basis: 58px; padding: 0 14px; }
  .masthead-meta .meta-chip:first-child { display: none; }
  .workspace { display: flex; flex-direction: column; padding: 10px; gap: 10px; }
  .stage-heading { min-height: 70px; padding: 2px 3px 0; }
  h1 { font-size: 21px; }
  .stage-intro { font-size: 9px; }
  .scene-wrap { flex: none; height: min(54vh, 480px); min-height: 310px; }
  #sceneCanvas { min-height: 310px; }
  .stage-readouts { gap: 5px; }
  .stage-readout { padding: 8px 7px; }
  .stage-readout span { font-size: 6px; letter-spacing: .08em; }
  .stage-readout strong { font-size: 15px; }
  .stage-footer { font-size: 7px; }
  .control-panel { max-height: none; overflow: visible; padding: 14px; }
  .control-section { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; }
  .control-section > .section-label { grid-column: 1 / -1; }
  .slider-control { margin-bottom: 13px; }
  .disclaimer-footer { padding: 7px 12px 12px; font-size: 6px; }
}

@media (max-width: 480px) {
  .brand-name { font-size: 9px; }
  .brand-subtitle { font-size: 7px; }
  .meta-chip { font-size: 7px; padding: 6px 8px; }
  .workspace { padding: 8px; }
  .stage-heading { min-height: 66px; }
  .eyebrow { font-size: 7px; }
  h1 { font-size: 19px; margin-top: 6px; }
  h1 span { display: block; margin-top: 2px; font-size: 14px; }
  .stage-intro { max-width: 330px; font-size: 8px; }
  .scene-wrap { height: 42vh; min-height: 290px; max-height: 370px; }
  #sceneCanvas { min-height: 290px; }
  .scene-top-overlay { left: 10px; right: 10px; top: 10px; }
  .scene-bottom-overlay { left: 10px; right: 10px; bottom: 10px; }
  .scene-mode, .scene-scale { font-size: 6px; }
  .scene-bottom-label strong { font-size: 8px; }
  .orbit-hint { font-size: 6px; }
  .stage-readouts { grid-template-columns: repeat(2, 1fr); }
  .stage-readout { padding: 8px 9px; }
  .stage-readout span { font-size: 7px; }
  .stage-readout strong { font-size: 16px; }
  .stage-footer { flex-direction: column; gap: 6px; padding: 0 2px 3px; }
  .footer-legend { font-size: 6px; }
  .control-panel { padding: 12px; }
  .panel-head h2 { font-size: 15px; }
  .transport-row { gap: 5px; }
  .transport-button { min-width: 84px; }
  .preset-button { flex-direction: column; align-items: flex-start; gap: 4px; padding: 7px; }
  .preset-button strong { font-size: 7px; }
  .preset-button small { font-size: 6px; }
  .control-section { display: block; }
  .slider-control { margin-bottom: 14px; }
  .slider-heading label, .slider-heading output { font-size: 9px; }
  .disclaimer-footer { flex-direction: column; gap: 4px; line-height: 1.4; }
  .fallback-rings { width: min(78vw, 320px); }
}

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

body.embed .masthead, body.embed .stage-heading, body.embed .disclaimer-footer { display: none; }
body.embed .workspace { padding: 0; gap: 0; }
body.embed .scene-wrap { border-radius: 0; }
body.embed .control-panel { border-radius: 0; }
