:root {
  color-scheme: dark;
  --bg: #070d17;
  --panel: rgba(12, 22, 36, .92);
  --panel-2: rgba(17, 31, 49, .9);
  --line: rgba(147, 183, 211, .16);
  --muted: #8fa4b8;
  --text: #eaf4fb;
  --ice: #79d9f6;
  --ice-2: #b9efff;
  --accent: #59b9db;
  --amber: #f0b76d;
  --green: #8de0bd;
  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 { overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { height: 100dvh; display: grid; grid-template-rows: 58px minmax(0,1fr) 76px; background: radial-gradient(ellipse at 52% 38%, #14283a 0%, #0a1422 48%, #070d17 100%); }
.topbar { display: flex; align-items: center; gap: 14px; padding: 0 20px; border-bottom: 1px solid var(--line); background: rgba(7,13,23,.78); z-index: 5; }
.brand-mark { width: 31px; height: 31px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(145deg, #9ae9fb, #347a9e); color: #062033; font-size: 17px; box-shadow: 0 0 24px rgba(94,196,226,.24); }
.brand-copy { min-width: 0; }
.brand-title { font-size: 13px; letter-spacing: .15em; text-transform: uppercase; font-weight: 750; }
.brand-sub { color: var(--muted); font-size: 10px; margin-top: 2px; letter-spacing: .08em; }
.top-spacer { flex: 1; }
.seed-chip, .live-chip { border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; color: #b8ccdb; font-size: 10px; letter-spacing: .08em; }
.live-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green); margin-right: 6px; box-shadow: 0 0 8px var(--green); }
.workspace { min-height: 0; display: grid; grid-template-columns: minmax(0,1fr) 342px; gap: 12px; padding: 12px; }
.stage-wrap { min-width: 0; min-height: 0; position: relative; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: radial-gradient(ellipse at 50% 46%, #1a3449, #0a1523 70%); box-shadow: 0 18px 50px rgba(0,0,0,.28); }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
.stage-vignette { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(6,13,22,.24), transparent 24%, transparent 78%, rgba(6,13,22,.2)), linear-gradient(0deg, rgba(6,13,22,.44), transparent 28%); }
.scene-kicker { position: absolute; left: 20px; top: 18px; pointer-events: none; }
.scene-kicker .eyebrow { color: #9db5c8; font-size: 9px; letter-spacing: .2em; text-transform: uppercase; }
.scene-kicker h1 { font-size: clamp(18px,2vw,25px); letter-spacing: -.035em; margin: 7px 0 4px; font-weight: 650; }
.scene-kicker p { color: #a8bdce; font-size: 11px; margin: 0; max-width: 400px; line-height: 1.5; }
.scene-hud { position: absolute; left: 18px; bottom: 18px; display: flex; gap: 8px; flex-wrap: wrap; pointer-events: none; }
.hud-pill { padding: 7px 10px; background: rgba(8,18,30,.76); border: 1px solid rgba(146,193,220,.2); border-radius: 8px; color: #c9dce9; font-size: 10px; backdrop-filter: blur(8px); }
.hud-pill strong { color: var(--ice-2); font-weight: 650; }
.orbit-hint { position: absolute; right: 17px; bottom: 18px; color: rgba(199,220,233,.64); font-size: 9px; letter-spacing: .08em; pointer-events: none; }
.side-panel { min-height: 0; overflow: auto; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: 0 18px 50px rgba(0,0,0,.22); scrollbar-width: thin; scrollbar-color: #2d4a60 transparent; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-heading h2 { margin: 0; font-size: 12px; letter-spacing: .13em; text-transform: uppercase; }
.panel-tag { font-size: 9px; color: var(--ice); letter-spacing: .12em; }
.control-group { padding: 10px 0 11px; border-top: 1px solid rgba(147,183,211,.1); }
.control-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.control-head label { font-size: 11px; color: #d5e4ee; }
.control-value { font-size: 11px; color: var(--ice-2); font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; height: 4px; margin: 0; accent-color: #76d3ee; cursor: pointer; }
.range-scale { display: flex; justify-content: space-between; color: #70889d; font-size: 9px; margin-top: 5px; }
.preset-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; margin: 4px 0 10px; }
.preset-btn, .utility-btn { background: rgba(31,53,73,.72); border: 1px solid rgba(147,183,211,.16); border-radius: 8px; padding: 8px 6px; font-size: 10px; color: #b8ccda; cursor: pointer; transition: .18s ease; }
.preset-btn:hover, .utility-btn:hover { border-color: rgba(121,217,246,.52); color: #e8f8ff; background: rgba(38,73,96,.8); }
.preset-btn[aria-pressed="true"] { color: #e6faff; border-color: rgba(121,217,246,.55); background: rgba(54,126,153,.25); }
.readout-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; margin: 8px 0 12px; }
.readout { border: 1px solid rgba(147,183,211,.12); border-radius: 9px; padding: 9px; background: rgba(18,35,52,.7); min-width: 0; }
.readout .label { color: #8fa7ba; font-size: 9px; letter-spacing: .07em; text-transform: uppercase; }
.readout .value { margin-top: 5px; font-size: 19px; letter-spacing: -.04em; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.readout .unit { font-size: 10px; color: #9db4c5; font-weight: 450; margin-left: 3px; }
.readout .micro { margin-top: 3px; font-size: 9px; color: #7892a7; }
.validation { padding: 11px; border-radius: 10px; border: 1px solid rgba(141,224,189,.22); background: rgba(19,53,48,.24); margin: 10px 0 12px; }
.validation-title { display: flex; align-items: center; justify-content: space-between; color: #a8e8ce; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.validation-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 9px; }
.validation-cell span { display: block; color: #8ba89e; font-size: 9px; }
.validation-cell strong { display: block; margin-top: 3px; color: #d8f6e9; font-size: 13px; font-variant-numeric: tabular-nums; }
.validation-foot { color: #91b4a8; font-size: 9px; margin-top: 7px; line-height: 1.4; }
details { border-top: 1px solid rgba(147,183,211,.12); padding-top: 10px; }
summary { cursor: pointer; color: #d8e8f2; font-size: 11px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; }
summary::-webkit-details-marker { display: none; }
summary::after { content: '+'; color: var(--ice); font-size: 15px; line-height: 10px; }
details[open] summary::after { content: '−'; }
.science-copy { color: #9db2c3; font-size: 10px; line-height: 1.6; padding-top: 8px; }
.science-copy .equation { color: #d9f4ff; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; background: rgba(5,13,22,.55); border-radius: 6px; padding: 7px; margin: 6px 0; overflow-wrap: anywhere; }
.science-copy ul { padding-left: 16px; margin: 6px 0; }
.science-copy li { margin: 3px 0; }
.bottom-bar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); background: rgba(7,13,23,.9); z-index: 5; }
.transport { display: flex; gap: 6px; }
.transport-btn { width: 37px; height: 37px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: #122235; color: #d9edf7; cursor: pointer; font-size: 14px; }
.transport-btn.primary { width: 76px; background: linear-gradient(135deg,#8de4f6,#4f9fbe); color: #072333; border-color: transparent; font-weight: 700; font-size: 11px; }
.transport-btn:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid #93e6ff; outline-offset: 3px; }
.transport-btn:hover { border-color: rgba(121,217,246,.6); }
.timeline { flex: 1; min-width: 0; padding: 0 12px; }
.timeline-top { display: flex; justify-content: space-between; color: #91a9bc; font-size: 9px; margin-bottom: 6px; }
.timeline-track { height: 4px; background: rgba(135,168,190,.18); border-radius: 10px; overflow: hidden; }
.timeline-fill { width: 0%; height: 100%; background: linear-gradient(90deg,#4f9ebf,#a2e9f7); box-shadow: 0 0 12px rgba(121,217,246,.4); transition: width .1s linear; }
.utility-group { display: flex; gap: 6px; }
.utility-btn { min-width: 36px; height: 36px; padding: 0 10px; }
.utility-btn.active { color: #dffaff; border-color: rgba(121,217,246,.58); }
.footer-note { color: #6f879b; font-size: 9px; margin-left: 4px; white-space: nowrap; }
.toast { position: absolute; left: 50%; bottom: 66px; transform: translate(-50%,12px); opacity: 0; pointer-events: none; padding: 9px 13px; background: rgba(9,23,35,.94); border: 1px solid rgba(121,217,246,.32); border-radius: 9px; color: #d8f5ff; font-size: 10px; transition: .22s ease; z-index: 8; }
.toast.show { opacity: 1; transform: translate(-50%,0); }
.embed-mode .topbar, .embed-mode .bottom-bar { display: none; }
.embed-mode .app-shell { grid-template-rows: minmax(0,1fr); }
.embed-mode .workspace { padding: 0; grid-template-columns: minmax(0,1fr) 310px; }
.embed-mode .stage-wrap { border-radius: 0; }
.embed-mode .side-panel { border-radius: 0; }
@media (max-width: 980px) {
  body { overflow: auto; }
  .app-shell { min-height: 100dvh; height: auto; grid-template-rows: 54px minmax(0,1fr) 72px; }
  .workspace { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(430px,55vh) auto; }
  .side-panel { max-height: none; }
  .stage-wrap { min-height: 430px; }
  .footer-note { display: none; }
  .embed-mode .workspace { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(430px,55vh) auto; }
}
@media (max-width: 520px) {
  .topbar { padding: 0 12px; gap: 9px; }
  .brand-sub { display: none; }
  .brand-title { font-size: 11px; }
  .seed-chip { font-size: 9px; padding: 5px 7px; }
  .live-chip { display: none; }
  .workspace { padding: 8px; gap: 8px; grid-template-rows: 430px auto; }
  .stage-wrap { border-radius: 12px; }
  .scene-kicker { left: 13px; top: 13px; }
  .scene-kicker h1 { font-size: 18px; }
  .scene-kicker p { font-size: 10px; max-width: 270px; }
  .scene-hud { left: 11px; bottom: 12px; gap: 5px; }
  .hud-pill { padding: 6px 7px; font-size: 9px; }
  .orbit-hint { display: none; }
  .side-panel { padding: 12px; }
  .bottom-bar { padding: 8px; gap: 6px; }
  .transport { gap: 4px; }
  .transport-btn { width: 32px; height: 34px; }
  .transport-btn.primary { width: 62px; }
  .timeline { padding: 0 5px; }
  .utility-group { gap: 4px; }
  .utility-btn { min-width: 32px; padding: 0 7px; height: 34px; font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
