:root {
  color-scheme: dark;
  --bg: #0b121a;
  --panel: #111b25;
  --panel-2: #15222e;
  --panel-3: #1a2936;
  --line: rgba(166, 190, 207, .13);
  --line-strong: rgba(166, 190, 207, .22);
  --text: #e7edf0;
  --muted: #9aaab5;
  --soft: #728491;
  --cyan: #7cc6d2;
  --cyan-strong: #9ce1e6;
  --amber: #e2ad72;
  --green: #87c8a6;
  --danger: #df8e7e;
  --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 { overflow: hidden; font-size: 13px; letter-spacing: .005em; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(ellipse at 25% -20%, rgba(60, 105, 123, .14), transparent 50%), var(--bg); }
.topbar { height: 64px; flex: 0 0 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(9, 15, 22, .94); z-index: 5; }
.brand-lockup { display: flex; align-items: center; gap: 11px; min-width: 240px; }
.brand-mark { width: 29px; height: 29px; border: 1px solid rgba(124, 198, 210, .4); border-radius: 8px; display: flex; align-items: center; justify-content: center; gap: 2px; transform: rotate(-7deg); background: linear-gradient(145deg, rgba(124,198,210,.13), rgba(124,198,210,.02)); }
.brand-mark span { display: block; width: 3px; border-radius: 2px; background: var(--cyan); transform: skewY(-25deg); }
.brand-mark span:nth-child(1) { height: 9px; opacity: .55; }
.brand-mark span:nth-child(2) { height: 16px; }
.brand-mark span:nth-child(3) { height: 12px; opacity: .72; }
.brand-name { font-size: 11px; letter-spacing: .17em; font-weight: 800; color: #eaf2f5; }
.brand-name span { color: var(--cyan); font-weight: 600; }
.brand-sub { margin-top: 3px; font-size: 8px; letter-spacing: .19em; color: #778a97; font-weight: 700; }
.topbar-center { display: flex; align-items: center; gap: 14px; color: #90a2ad; font-size: 9px; letter-spacing: .15em; font-weight: 750; }
.seed-label { color: var(--cyan); }
.topbar-divider { height: 15px; width: 1px; background: var(--line-strong); }
.topbar-right { min-width: 240px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; font-size: 9px; letter-spacing: .13em; color: #92a3ad; font-weight: 700; }
.live-dot, .chip-dot, .tiny-pulse { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #79c5a1; box-shadow: 0 0 0 3px rgba(121,197,161,.12), 0 0 10px rgba(121,197,161,.55); }
.version-tag { margin-left: 5px; padding: 5px 7px; border: 1px solid var(--line-strong); border-radius: 5px; color: #a9bdc6; font-size: 8px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; padding: 12px; min-height: 0; flex: 1 1 auto; height: calc(100vh - 92px); }
.stage-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, rgba(19,31,42,.94), rgba(12,20,28,.98)); box-shadow: 0 16px 50px rgba(0,0,0,.14); }
.stage-head { min-height: 88px; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 15px 20px 13px; border-bottom: 1px solid var(--line); }
.eyebrow { color: #7e9ba7; font-size: 8px; letter-spacing: .18em; font-weight: 800; }
.stage-heading h1 { margin: 6px 0 3px; font-size: clamp(18px, 2vw, 25px); letter-spacing: -.035em; line-height: 1.1; font-weight: 650; }
.stage-heading h1 em { font-style: normal; color: var(--cyan-strong); }
.stage-heading p { margin: 0; color: #91a2ad; font-size: 11px; }
.stage-tags { display: flex; gap: 6px; align-items: center; padding-left: 12px; }
.tag { padding: 6px 8px; border: 1px solid rgba(152,178,191,.17); border-radius: 5px; color: #8ea2ae; font-size: 7px; letter-spacing: .12em; font-weight: 800; white-space: nowrap; }
.tag-cyan { color: #91d2db; border-color: rgba(124,198,210,.3); background: rgba(124,198,210,.07); }
.scene-wrap { position: relative; flex: 1 1 auto; min-height: 240px; overflow: hidden; background: radial-gradient(ellipse at 48% 48%, #293a43 0%, #1b2a35 43%, #0e1922 100%); isolation: isolate; }
.scene-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; touch-action: none; }
.scene-vignette { position: absolute; z-index: 1; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(5,12,18,.34), transparent 22%, transparent 75%, rgba(5,12,18,.52)), linear-gradient(90deg, rgba(5,12,18,.24), transparent 18%, transparent 82%, rgba(5,12,18,.24)); }
.scene-topline { position: absolute; z-index: 2; top: 13px; left: 15px; right: 15px; display: flex; justify-content: space-between; pointer-events: none; }
.scene-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 8px; border: 1px solid rgba(198,218,224,.16); border-radius: 5px; background: rgba(9,17,24,.54); color: #b5c4ca; font-size: 8px; letter-spacing: .12em; font-weight: 800; backdrop-filter: blur(8px); }
.chip-dot { width: 5px; height: 5px; }
.scene-chip-right { color: #8ea1ac; }
.annotation { position: absolute; z-index: 2; display: flex; align-items: center; gap: 7px; color: rgba(209,225,227,.74); font-size: 7px; font-weight: 800; letter-spacing: .14em; text-shadow: 0 1px 5px rgba(0,0,0,.7); pointer-events: none; }
.annotation-line { width: 25px; height: 1px; background: rgba(134,204,213,.75); box-shadow: 0 0 7px rgba(134,204,213,.35); }
.annotation-a { top: 25%; left: 5%; }
.annotation-b { top: 52%; right: 4%; flex-direction: row-reverse; }
.annotation-c { bottom: 22%; left: 12%; }
.scene-legend { position: absolute; z-index: 2; bottom: 43px; left: 15px; display: flex; gap: 13px; color: #a7b6bd; font-size: 8px; pointer-events: none; }
.scene-legend span { display: flex; align-items: center; gap: 5px; }
.legend-swatch { width: 7px; height: 7px; display: inline-block; border-radius: 2px; }
.legend-rock { background: #a77a55; }
.legend-salt { background: #e5e1d6; }
.legend-dust { background: #e2ad72; }
.scene-footer { position: absolute; z-index: 2; bottom: 12px; left: 15px; right: 15px; display: flex; justify-content: space-between; color: #93a5af; font-size: 8px; letter-spacing: .14em; font-weight: 800; pointer-events: none; }
#scene-state { color: #8bc8a8; }
.context-overlay { position: absolute; z-index: 4; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: rgba(6,13,19,.92); color: #e4edf0; text-align: center; }
.context-overlay[hidden] { display: none; }
.context-overlay strong { font-size: 15px; }
.context-overlay span { color: var(--muted); font-size: 11px; }
.metrics-strip { flex: 0 0 auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); background: rgba(10,17,24,.58); }
.metric { min-width: 0; padding: 12px 14px 10px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric-label { display: block; color: #8397a3; font-size: 7px; letter-spacing: .1em; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-label b { color: #a7b6bf; font-size: 6px; margin-left: 4px; font-weight: 800; }
.metric strong { display: block; margin-top: 5px; color: #edf3f4; font-size: 21px; font-weight: 600; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.metric strong small { font-size: 10px; color: #9db0ba; font-weight: 500; letter-spacing: 0; }
.metric-sub { display: block; margin-top: 1px; color: #758894; font-size: 8px; }
.stage-bottomline { flex: 0 0 25px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; color: #687b87; font-size: 7px; letter-spacing: .13em; font-weight: 800; }
.tiny-pulse { width: 5px; height: 5px; margin-right: 5px; vertical-align: 1px; }

.control-panel { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, rgba(19,31,42,.98), rgba(13,22,31,.98)); padding: 16px 16px 12px; scrollbar-width: thin; scrollbar-color: #344957 transparent; }
.control-panel::-webkit-scrollbar { width: 5px; }
.control-panel::-webkit-scrollbar-thumb { background: #344957; border-radius: 5px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-head h2 { margin: 4px 0 0; font-size: 17px; letter-spacing: -.025em; font-weight: 650; }
.icon-button { width: 31px; height: 31px; border: 1px solid var(--line-strong); border-radius: 8px; background: #192834; color: #a8bac3; font-size: 20px; cursor: pointer; transition: background .18s, color .18s, border-color .18s; }
.icon-button:hover { color: var(--cyan-strong); border-color: rgba(124,198,210,.42); background: #203541; }
.run-controls { display: grid; grid-template-columns: 1.35fr 1fr 38px; gap: 7px; margin-bottom: 18px; }
.primary-button, .secondary-button { height: 36px; border-radius: 7px; border: 1px solid transparent; cursor: pointer; font-size: 10px; font-weight: 800; letter-spacing: .025em; transition: transform .15s, background .15s, border-color .15s; }
.primary-button { display: flex; justify-content: center; align-items: center; gap: 8px; color: #10202a; background: linear-gradient(135deg, #9bd8dc, #6fb8c3); box-shadow: 0 5px 18px rgba(98,183,194,.12); }
.primary-button:hover { background: linear-gradient(135deg, #b1e7e8, #84cbd3); transform: translateY(-1px); }
.secondary-button { color: #b5c5cc; background: #1a2935; border-color: var(--line-strong); }
.secondary-button:hover { background: #223644; border-color: rgba(124,198,210,.32); }
.camera-button { font-size: 17px; }
.play-glyph { font-size: 12px; }
.section-label { display: flex; align-items: center; gap: 8px; margin: 13px 0 11px; color: #7f9ba7; font-size: 8px; letter-spacing: .16em; font-weight: 850; }
.section-rule { height: 1px; flex: 1; background: var(--line); }
.section-index { color: #586e7b; font-size: 8px; font-variant-numeric: tabular-nums; }
.control-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: center; margin-bottom: 10px; }
.control-row label, .speed-row label { color: #c5d1d6; font-size: 10px; font-weight: 600; }
.unit { color: #718793; font-size: 9px; font-weight: 500; }
.control-row output, .speed-row output { color: var(--cyan-strong); font-size: 10px; font-weight: 750; font-variant-numeric: tabular-nums; }
input[type="range"] { appearance: none; -webkit-appearance: none; grid-column: 1 / -1; width: 100%; height: 15px; margin: 0; background: transparent; cursor: pointer; accent-color: var(--cyan); }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, #65aeb9, #334b58); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, #65aeb9, #334b58); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border-radius: 50%; border: 2px solid #d3f0ee; background: #73c2cc; box-shadow: 0 0 0 3px rgba(115,194,204,.12); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; border: 2px solid #d3f0ee; background: #73c2cc; box-shadow: 0 0 0 3px rgba(115,194,204,.12); }
input[type="range"]:focus-visible { outline: 1px solid var(--cyan); outline-offset: 3px; border-radius: 5px; }
.preset-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.preset-button { min-width: 0; min-height: 48px; padding: 6px 4px; border: 1px solid var(--line-strong); border-radius: 7px; background: #162530; color: #a9b9c0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; font-size: 8px; font-weight: 700; transition: background .16s, border-color .16s, color .16s; }
.preset-button:hover { background: #1d3340; border-color: rgba(124,198,210,.35); }
.preset-button.active { color: #cce9e9; border-color: rgba(124,198,210,.54); background: rgba(77,145,157,.17); box-shadow: inset 0 0 0 1px rgba(124,198,210,.08); }
.preset-icon { color: var(--cyan); font-size: 16px; line-height: 1; }
.speed-row { display: flex; justify-content: space-between; align-items: center; margin: 14px 0 1px; }
.speed-slider { display: block !important; }
.speed-scale { display: flex; justify-content: space-between; color: #708591; font-size: 7px; letter-spacing: .08em; margin-top: -1px; }
.utility-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 13px 0; }
.utility-button { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 33px; border: 1px solid var(--line-strong); border-radius: 7px; background: #172631; color: #aabac2; font-size: 9px; cursor: pointer; transition: background .16s, border-color .16s; }
.utility-button:hover { background: #203441; border-color: rgba(124,198,210,.35); }
.utility-button b { color: var(--cyan-strong); font-weight: 750; }
.utility-icon { color: var(--cyan); font-size: 14px; }
.validation-card { padding: 10px 11px 9px; border: 1px solid rgba(135,200,166,.22); border-radius: 8px; background: linear-gradient(130deg, rgba(67,112,94,.12), rgba(21,36,43,.5)); }
.validation-head { display: flex; align-items: center; justify-content: space-between; color: #8fa9a2; font-size: 8px; font-weight: 850; letter-spacing: .13em; }
.pass-pill { color: #91d4ae; border: 1px solid rgba(135,200,166,.3); border-radius: 4px; padding: 3px 5px; font-size: 7px; }
.validation-equation { margin-top: 7px; color: #91a3aa; font-size: 9px; }
.validation-values { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.validation-values div { display: flex; flex-direction: column; gap: 3px; }
.validation-values span { color: #728b89; font-size: 7px; letter-spacing: .1em; font-weight: 800; }
.validation-values strong { color: #dce9e4; font-size: 12px; font-variant-numeric: tabular-nums; font-weight: 650; }
.validation-foot { margin-top: 8px; color: #718985; font-size: 8px; }
.science-details { margin-top: 11px; border: 1px solid var(--line); border-radius: 8px; background: rgba(11,19,27,.45); }
.science-details summary { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 10px; list-style: none; cursor: pointer; color: #c5d2d7; font-size: 10px; font-weight: 750; }
.science-details summary::-webkit-details-marker { display: none; }
.science-details summary::after { content: '＋'; margin-left: auto; color: var(--cyan); font-size: 14px; }
.science-details[open] summary::after { content: '−'; }
.science-icon { color: var(--cyan); font-size: 15px; }
.summary-hint { color: #657a86; font-size: 7px; letter-spacing: .11em; font-weight: 750; }
.science-content { padding: 0 11px 12px; color: #9aabb3; font-size: 9px; line-height: 1.55; }
.science-content h3 { margin: 11px 0 5px; color: #c6d6da; font-size: 10px; }
.science-content p { margin: 4px 0 8px; }
.science-content ul { margin: 5px 0 8px; padding-left: 16px; }
.science-content li { margin: 3px 0; }
.equation-block { padding: 8px; margin: 7px 0; border: 1px solid rgba(124,198,210,.14); border-radius: 6px; background: rgba(33,57,67,.22); }
.equation-label { display: block; margin-bottom: 4px; color: #81aeb6; font-size: 7px; letter-spacing: .09em; font-weight: 800; }
.equation-block code { display: block; color: #e0eceb; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.equation-block small { display: block; margin-top: 4px; color: #7e939d; font-size: 8px; }
.disclaimer { padding-top: 7px; border-top: 1px solid var(--line); color: #7d9a8e; font-style: italic; }
.keyboard-hint { margin-top: 11px; padding-top: 9px; border-top: 1px solid var(--line); color: #647984; font-size: 8px; }
.keyboard-hint span { color: #91a7b1; font-size: 7px; letter-spacing: .12em; font-weight: 850; margin-right: 6px; }
.footer { height: 28px; flex: 0 0 28px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; color: #566b77; font-size: 7px; letter-spacing: .13em; font-weight: 800; }
.footer i { color: #7caeb5; font-style: normal; margin: 0 4px; }

button:focus-visible, summary:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
button:active { transform: translateY(1px); }
@media (max-width: 1080px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 318px; gap: 9px; padding: 9px; }
  .control-panel { padding: 13px 12px 10px; }
  .stage-head { padding-left: 15px; padding-right: 15px; }
  .stage-tags { gap: 4px; }
  .tag { padding: 5px 6px; }
}
@media (max-width: 780px) {
  body { overflow: auto; }
  .app-shell { min-height: 100vh; }
  .topbar { height: 56px; flex-basis: 56px; padding: 0 13px; }
  .brand-lockup { min-width: 0; }
  .topbar-center { display: none; }
  .topbar-right { min-width: 0; font-size: 8px; }
  .version-tag { display: none; }
  .workspace { display: flex; flex-direction: column; height: auto; min-height: 0; padding: 8px; gap: 8px; }
  .stage-panel { min-height: 0; flex: 0 0 auto; }
  .stage-head { min-height: 83px; padding: 12px 13px 10px; }
  .stage-heading h1 { font-size: 20px; }
  .stage-heading p { font-size: 10px; }
  .stage-tags { display: none; }
  .scene-wrap { flex: none; height: min(52vh, 430px); min-height: 300px; }
  .metrics-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { padding: 9px 11px 8px; border-bottom: 1px solid var(--line); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(3), .metric:nth-child(4) { border-bottom: 0; }
  .metric strong { font-size: 19px; }
  .stage-bottomline { font-size: 6px; padding: 0 10px; }
  .control-panel { overflow: visible; padding: 14px 14px 12px; }
  .control-row { margin-bottom: 12px; }
  .annotation { font-size: 6px; }
  .annotation-line { width: 15px; }
  .scene-legend { gap: 8px; left: 10px; font-size: 7px; }
  .scene-topline { left: 9px; right: 9px; }
  .scene-chip { font-size: 7px; }
  .footer { padding: 0 12px; }
}
@media (max-width: 390px) {
  .brand-name { font-size: 10px; }
  .brand-sub { font-size: 7px; }
  .topbar-right { letter-spacing: .08em; }
  .stage-heading h1 { font-size: 18px; }
  .metric-label { font-size: 6px; }
  .metric strong { font-size: 18px; }
  .metric-sub { font-size: 7px; }
  .scene-wrap { min-height: 280px; }
  .scene-legend { bottom: 42px; }
}
@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 .topbar, body.embed .footer { display: none; }
body.embed .workspace { height: 100vh; padding: 6px; }
@media (max-width: 780px) {
  body.embed .workspace { height: auto; }
}
