:root {
  color-scheme: dark;
  --bg: #071321;
  --panel: #0c1b2b;
  --panel-2: #102337;
  --line: rgba(159, 190, 218, .14);
  --muted: #8198ad;
  --text: #e7f0f7;
  --cyan: #81d9e8;
  --gold: #f2d69b;
  --green: #7de1bd;
  --radius: 12px;
  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; background: radial-gradient(ellipse at 28% -20%, #17334b 0, #071321 52%); }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { height: 68px; flex: 0 0 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; border-bottom: 1px solid var(--line); background: rgba(7, 19, 33, .88); backdrop-filter: blur(16px); z-index: 5; }
.brand-lockup { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border: 1px solid rgba(129,217,232,.42); border-radius: 10px; position: relative; transform: rotate(30deg); display: grid; place-items: center; }
.brand-mark span { position: absolute; width: 17px; height: 1px; background: var(--cyan); transform: rotate(0deg); opacity: .85; }
.brand-mark span:nth-child(2) { transform: rotate(60deg); }
.brand-mark span:nth-child(3) { transform: rotate(120deg); }
.eyebrow { font-size: 9px; font-weight: 750; letter-spacing: .16em; color: #8ca8be; line-height: 1.3; }
.topbar h1 { margin: 3px 0 0; font-size: 15px; letter-spacing: -.025em; font-weight: 650; white-space: nowrap; }
.topbar h1 span { color: #9bb1c5; font-weight: 450; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.status-pill { display: flex; align-items: center; gap: 7px; border: 1px solid rgba(125,225,189,.22); border-radius: 99px; padding: 6px 10px; color: #9de7ca; font-size: 9px; letter-spacing: .1em; font-weight: 750; }
.status-pill i, .live-dot { width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: #71e0b5; box-shadow: 0 0 10px rgba(113,224,181,.75); }
.icon-button { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: rgba(255,255,255,.035); color: #a9c0d2; font-size: 21px; cursor: pointer; }
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 354px; gap: 14px; padding: 14px; }
.stage-wrap { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.stage { position: relative; flex: 1 1 auto; min-height: 500px; overflow: hidden; border: 1px solid rgba(140,184,212,.18); border-radius: 14px; background: radial-gradient(ellipse at 52% 36%, #24475c 0%, #122b40 38%, #091725 75%); isolation: isolate; }
#sceneCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
.stage-vignette { position: absolute; inset: 0; pointer-events: none; z-index: 1; background: linear-gradient(180deg, rgba(4,13,23,.26), transparent 30%, transparent 70%, rgba(4,13,23,.25)), linear-gradient(90deg, rgba(5,15,25,.25), transparent 24%, transparent 76%, rgba(5,15,25,.18)); }
.scene-title-card { position: absolute; z-index: 2; top: 20px; left: 20px; width: min(320px, 52%); padding: 13px 15px 14px; border: 1px solid rgba(184,217,236,.15); border-radius: 10px; background: rgba(7,20,33,.5); backdrop-filter: blur(10px); pointer-events: none; }
.scene-title-card .eyebrow { display: flex; align-items: center; gap: 9px; font-size: 8px; }
.scene-title { margin-top: 9px; font-size: clamp(16px, 1.7vw, 23px); font-weight: 600; letter-spacing: -.04em; line-height: 1.08; }
.scene-title-card p { color: #b0c4d2; font-size: 10px; line-height: 1.5; margin: 7px 0 0; max-width: 265px; }
.scene-compass { position: absolute; z-index: 2; top: 22px; right: 22px; display: grid; justify-items: center; color: rgba(213,234,246,.75); font-size: 8px; letter-spacing: .12em; pointer-events: none; }
.scene-compass b { color: var(--cyan); font-size: 20px; font-weight: 400; line-height: 1.1; }
.scene-compass small { margin-top: 3px; font-size: 7px; color: #9cb4c5; }
.annotation { position: absolute; z-index: 3; pointer-events: none; display: flex; align-items: center; gap: 7px; opacity: .9; transition: opacity .2s; }
.annotation-label { color: #e7f5fa; font-size: 8px; font-weight: 750; letter-spacing: .13em; text-shadow: 0 1px 8px #06101b, 0 1px 2px #06101b; white-space: nowrap; }
.annotation-line { display: block; width: 26px; height: 1px; background: linear-gradient(90deg, var(--cyan), transparent); }
.annotation-sun { top: 26%; right: 24%; }
.annotation-spot { bottom: 32%; left: 54%; }
.annotation-spot .annotation-line { width: 36px; background: linear-gradient(90deg, var(--gold), transparent); }
.annotation-crystals { top: 58%; left: 20%; }
.annotation-crystals .annotation-line { width: 22px; }
.stage-footer { position: absolute; z-index: 2; left: 19px; right: 19px; bottom: 15px; display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
.scene-scale, .drag-hint { font-size: 8px; letter-spacing: .1em; color: #b3c6d4; display: flex; align-items: center; gap: 8px; }
.scene-scale b { color: var(--gold); font-weight: 750; }
.scale-line { width: 25px; height: 1px; background: #a5c4d5; }
.drag-hint { color: #829caf; }
.drag-hint span { color: var(--cyan); font-size: 14px; }
.context-warning { position: absolute; z-index: 6; left: 50%; top: 50%; transform: translate(-50%,-50%); max-width: 80%; padding: 14px 18px; border: 1px solid rgba(242,214,155,.4); border-radius: 10px; background: rgba(18,28,38,.92); color: #ffe6b3; font-size: 12px; text-align: center; }
.metrics-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; flex: 0 0 auto; }
.metric-card { min-width: 0; padding: 10px 12px 9px; border: 1px solid var(--line); border-radius: 10px; background: linear-gradient(145deg, rgba(17,38,56,.94), rgba(10,25,40,.95)); }
.metric-label { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; font-size: 8px; letter-spacing: .08em; color: #9ab0c2; font-weight: 750; white-space: nowrap; }
.metric-label b { color: #6db9c8; font-size: 7px; font-weight: 800; }
.metric-card strong { display: block; margin-top: 5px; font-size: clamp(17px, 1.7vw, 22px); line-height: 1.05; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.metric-card small { display: block; margin-top: 4px; color: #7890a5; font-size: 9px; }
.control-panel { min-height: 0; max-height: calc(100vh - 96px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: #29445b transparent; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(165deg, rgba(13,30,47,.98), rgba(8,22,36,.98)); padding: 17px 16px 13px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.panel-heading h2 { margin: 4px 0 0; font-size: 18px; letter-spacing: -.035em; font-weight: 620; }
.panel-index { color: #607d95; font-size: 9px; letter-spacing: .12em; padding-top: 4px; }
.section-kicker { color: #829bb0; font-size: 8px; font-weight: 800; letter-spacing: .14em; margin-bottom: 9px; }
.preset-section { padding: 12px 0 13px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.preset-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 7px; }
.preset-button { min-width: 0; padding: 8px 4px 7px; border: 1px solid rgba(150,185,210,.14); border-radius: 9px; background: rgba(255,255,255,.025); display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; transition: border-color .18s, background .18s, transform .18s; }
.preset-button:hover { border-color: rgba(129,217,232,.42); transform: translateY(-1px); }
.preset-button.active { border-color: rgba(129,217,232,.5); background: rgba(74,153,171,.13); box-shadow: inset 0 0 0 1px rgba(129,217,232,.06); }
.preset-icon { height: 20px; color: var(--cyan); font-size: 17px; line-height: 1; }
.dense-icon { color: var(--gold); }
.turbulent-icon { color: #c1a9ef; }
.preset-button b { font-size: 10px; font-weight: 650; }
.preset-button small { font-size: 8px; color: #8299ac; }
.preset-description { margin: 8px 0 0; color: #90a8bb; font-size: 9px; line-height: 1.4; min-height: 25px; }
.parameter-section { padding: 14px 0 12px; border-bottom: 1px solid var(--line); }
.control-row { margin-bottom: 13px; }
.control-row:last-child { margin-bottom: 0; }
.control-row label, .transport-bottom label { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: #c3d2df; font-size: 10px; font-weight: 560; }
.control-row output, .transport-bottom output { color: var(--cyan); font-variant-numeric: tabular-nums; font-weight: 700; }
input[type="range"] { display: block; width: 100%; height: 16px; margin: 6px 0 2px; accent-color: #78cddd; cursor: pointer; background: transparent; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 9px; background: linear-gradient(90deg, #4e9caf, #36546b); }
input[type="range"]::-webkit-slider-thumb { margin-top: -5px; width: 13px; height: 13px; border-radius: 50%; border: 2px solid #d9f5fa; background: #69bfd0; box-shadow: 0 0 0 3px rgba(105,191,208,.12); -webkit-appearance: none; }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 9px; background: linear-gradient(90deg, #4e9caf, #36546b); }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; border: 2px solid #d9f5fa; background: #69bfd0; }
.range-ends { display: flex; justify-content: space-between; color: #607b91; font-size: 8px; }
.transport-section { padding: 14px 0 12px; border-bottom: 1px solid var(--line); }
.transport-buttons { display: grid; grid-template-columns: 1.2fr .9fr .8fr; gap: 7px; }
.primary-button, .secondary-button { min-height: 34px; border-radius: 8px; cursor: pointer; font-size: 10px; font-weight: 700; transition: background .18s, border-color .18s, transform .18s; }
.primary-button { border: 1px solid rgba(129,217,232,.3); background: linear-gradient(135deg, #286276, #19485b); color: #e6faff; }
.primary-button:hover { background: linear-gradient(135deg, #347e91, #20576c); }
.primary-button span:first-child { margin-right: 5px; }
.secondary-button { border: 1px solid var(--line); background: rgba(255,255,255,.035); color: #b8c9d6; }
.secondary-button:hover, .utility-button:hover { border-color: rgba(129,217,232,.4); background: rgba(129,217,232,.08); }
.transport-bottom { margin-top: 13px; }
.utility-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 11px; }
.utility-button { min-height: 29px; border: 1px solid var(--line); border-radius: 7px; padding: 0 8px; background: rgba(255,255,255,.025); color: #9eb4c5; font-size: 8px; cursor: pointer; white-space: nowrap; }
.export-button { color: var(--gold); }
.quality-toggle { display: flex; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: rgba(0,0,0,.15); }
.quality-button { padding: 5px 7px; border: 0; border-radius: 6px; background: transparent; color: #7e96aa; font-size: 8px; cursor: pointer; }
.quality-button.active { background: #1a3a50; color: #c6eaf0; }
.secondary-readouts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.readout { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.readout span { color: #829bb0; font-size: 8px; }
.readout strong { color: #dce9f2; font-size: 13px; font-variant-numeric: tabular-nums; }
.science-panel { border-bottom: 1px solid var(--line); }
.science-panel summary { min-height: 45px; display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; list-style: none; color: #dbeaf3; font-size: 11px; font-weight: 650; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary > span:first-child { display: flex; align-items: center; gap: 8px; }
.science-panel summary i { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: rgba(129,217,232,.12); color: var(--cyan); font-style: normal; font-size: 13px; }
.summary-hint { color: #6e879c; font-size: 7px; letter-spacing: .11em; }
.science-content { padding: 0 0 12px; }
.science-block { padding: 11px 0; border-top: 1px solid rgba(159,190,218,.09); }
.science-tag { color: #7fb9c7; font-size: 7px; letter-spacing: .12em; font-weight: 800; }
.science-block h3, .validation-card h3 { margin: 5px 0 7px; font-size: 11px; font-weight: 650; color: #d9e8f0; }
.equation { padding: 8px 10px; border: 1px solid rgba(129,217,232,.13); border-radius: 7px; background: rgba(129,217,232,.045); color: #c5edf2; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; letter-spacing: .01em; overflow-wrap: anywhere; }
.science-block p, .validation-card p { color: #8ea5b8; font-size: 9px; line-height: 1.55; margin: 7px 0 0; }
.validation-card { margin: 10px 0; padding: 11px; border: 1px solid rgba(125,225,189,.22); border-radius: 9px; background: rgba(40,110,91,.09); }
.validation-head { display: flex; justify-content: space-between; align-items: center; }
.validation-pass { color: #85e4bf; font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.validation-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; margin-top: 9px; }
.validation-grid div { display: flex; flex-direction: column; gap: 4px; }
.validation-grid small { color: #76988f; font-size: 7px; letter-spacing: .08em; }
.validation-grid b { color: #d6f3e7; font-size: 11px; font-variant-numeric: tabular-nums; }
.limitation-block ul { padding-left: 15px; margin: 8px 0 0; color: #8ea5b8; font-size: 9px; line-height: 1.55; }
.limitation-block li { margin: 4px 0; }
.panel-footnote { padding-top: 12px; color: #6e879b; font-size: 7px; letter-spacing: .12em; display: flex; align-items: center; gap: 6px; }
.panel-footnote span:not(.footnote-dot) { color: #425d72; }
.footnote-dot { width: 5px; height: 5px; border-radius: 50%; background: #d4b678; }
.page-footer { flex: 0 0 27px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 18px 8px; color: #617a8e; font-size: 8px; letter-spacing: .025em; }
.page-footer span:last-child { letter-spacing: .1em; font-size: 7px; }
.page-footer b { color: #3b5d72; }
.embed-mode .topbar, .embed-mode .page-footer { display: none; }
.embed-mode .workspace { padding: 0; gap: 0; grid-template-columns: minmax(0,1fr) 330px; }
.embed-mode .stage { border-radius: 0; }
.embed-mode .control-panel { border-radius: 0; max-height: 100vh; }
@media (max-width: 1120px) {
  .workspace { grid-template-columns: minmax(0,1fr) 320px; gap: 10px; padding: 10px; }
  .control-panel { padding: 14px 13px 12px; }
  .scene-title-card { width: min(280px, 54%); }
  .metric-card { padding: 9px 9px 8px; }
  .metric-label { font-size: 7px; }
}
@media (max-width: 820px) {
  .topbar { height: 60px; flex-basis: 60px; padding: 0 13px; }
  .topbar h1 { font-size: 13px; }
  .topbar h1 span { display: none; }
  .workspace { display: flex; flex-direction: column; padding: 9px; gap: 9px; }
  .stage-wrap { flex: 0 0 auto; }
  .stage { min-height: 0; height: min(55vh, 440px); }
  .control-panel { max-height: none; overflow: visible; }
  .metrics-strip { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .metric-card strong { font-size: 17px; }
  .scene-title-card { top: 12px; left: 12px; padding: 10px 11px; width: min(260px, 60%); }
  .scene-title-card p { font-size: 9px; }
  .scene-compass { top: 15px; right: 15px; }
  .annotation-label { font-size: 7px; }
  .stage-footer { left: 12px; right: 12px; bottom: 11px; }
  .drag-hint { font-size: 7px; }
  .embed-mode .workspace { display: flex; }
  .embed-mode .stage { height: 56vh; }
}
@media (max-width: 480px) {
  .topbar { padding: 0 11px; }
  .brand-lockup { gap: 9px; }
  .brand-mark { width: 29px; height: 29px; }
  .eyebrow { font-size: 8px; }
  .topbar h1 { font-size: 12px; }
  .status-pill { padding: 5px 7px; font-size: 7px; }
  .icon-button { width: 30px; height: 30px; }
  .workspace { padding: 7px; }
  .stage { height: 330px; border-radius: 11px; }
  .scene-title-card { width: 66%; top: 10px; left: 10px; }
  .scene-title { font-size: 16px; }
  .scene-title-card p { max-width: 205px; font-size: 8px; }
  .scene-compass { top: 12px; right: 12px; }
  .annotation-crystals { top: 62%; left: 9%; }
  .annotation-spot { bottom: 27%; left: 49%; }
  .annotation-sun { top: 31%; right: 12%; }
  .annotation-line { width: 14px; }
  .annotation-label { font-size: 6px; letter-spacing: .08em; }
  .stage-footer { left: 10px; right: 10px; bottom: 9px; }
  .scene-scale, .drag-hint { font-size: 6px; gap: 5px; }
  .metrics-strip { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
  .metric-card { padding: 8px 9px; }
  .metric-label { font-size: 7px; }
  .metric-card strong { font-size: 18px; }
  .metric-card small { font-size: 8px; }
  .control-panel { border-radius: 11px; padding: 14px 12px 12px; }
  .panel-heading h2 { font-size: 17px; }
  .preset-button { padding: 8px 2px 7px; }
  .preset-button b { font-size: 9px; }
  .preset-button small { font-size: 7px; }
  .control-row label { font-size: 10px; }
  .secondary-readouts { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .page-footer { padding: 2px 10px 9px; flex-direction: column; align-items: flex-start; gap: 4px; font-size: 7px; }
  .embed-mode .workspace { padding: 0; }
  .embed-mode .stage { height: 48vh; border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
