:root {
  color-scheme: dark;
  --bg: #070d17;
  --panel: #0d1624;
  --panel-2: #101d2d;
  --line: rgba(166, 198, 226, .12);
  --line-strong: rgba(166, 198, 226, .22);
  --text: #edf5ff;
  --muted: #8ea2b8;
  --faint: #61758b;
  --cyan: #78d9f5;
  --blue: #67a8f5;
  --gold: #ffd58a;
  --green: #75e0bd;
  --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-height: 100vh; overflow-x: hidden; }
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(ellipse at 42% -20%, rgba(37, 75, 111, .22), transparent 55%), var(--bg); }
.topbar { height: 68px; flex: 0 0 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(8, 15, 26, .94); position: relative; z-index: 4; }
.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 270px; }
.brand-mark { width: 28px; height: 28px; position: relative; display: flex; align-items: center; justify-content: center; gap: 2px; transform: rotate(30deg); }
.brand-mark span { width: 5px; height: 22px; border-radius: 5px; background: linear-gradient(180deg, #c1f3ff, #54a7d9); opacity: .9; }
.brand-mark span:nth-child(2) { height: 17px; opacity: .7; }
.brand-mark span:nth-child(3) { height: 11px; opacity: .5; }
.brand-name { font-size: 11px; letter-spacing: .16em; font-weight: 800; }
.brand-name span { color: #8fa8c2; font-weight: 500; }
.brand-subtitle { margin-top: 4px; font-size: 8px; letter-spacing: .19em; color: var(--faint); font-weight: 700; }
.topbar-center { display: flex; align-items: center; gap: 10px; font-size: 9px; letter-spacing: .16em; font-weight: 700; color: #b2c6db; }
.live-dot, .render-indicator i, .quality-dot, .ray-counter-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px rgba(117, 224, 189, .65); }
.topbar-divider { color: #4d6278; }
.topbar-actions { display: flex; align-items: center; gap: 12px; min-width: 270px; justify-content: flex-end; }
.seed-chip { padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 5px; font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; color: #9fb5ca; letter-spacing: .08em; }
.icon-button { width: 27px; height: 27px; border: 1px solid var(--line-strong); border-radius: 50%; background: transparent; color: #a9c1d9; cursor: pointer; font-size: 12px; }
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 0; }
.stage-panel { min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.stage-toolbar { height: 43px; flex: 0 0 43px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; border-bottom: 1px solid var(--line); background: rgba(9, 17, 29, .8); }
.stage-breadcrumb { font-size: 9px; font-weight: 800; letter-spacing: .13em; color: #c2d5e8; }
.stage-breadcrumb > span:first-child { color: var(--cyan); }
.breadcrumb-muted { color: #72889f; font-weight: 500; }
.stage-toolbar-actions { display: flex; align-items: center; gap: 20px; }
.render-indicator { display: flex; align-items: center; gap: 7px; color: #8fa9c2; font-size: 8px; letter-spacing: .13em; font-weight: 800; }
.render-indicator i { width: 5px; height: 5px; }
.text-button { border: 0; background: transparent; color: #9db4ca; cursor: pointer; font-size: 10px; }
.text-button:hover { color: white; }
.text-button span { color: var(--cyan); margin-right: 5px; }
.viewport { flex: 1; min-height: 420px; position: relative; overflow: hidden; background: radial-gradient(ellipse at 52% 55%, #203d5a 0%, #10243b 43%, #091422 78%, #07101b 100%); }
#scene-canvas { display: block; width: 100%; height: 100%; min-height: 420px; touch-action: none; outline: none; }
.viewport-vignette { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(5, 11, 19, .38), transparent 24%, transparent 76%, rgba(4, 10, 17, .55)), radial-gradient(ellipse at center, transparent 44%, rgba(3, 8, 15, .38)); }
.scene-label { position: absolute; z-index: 2; display: flex; flex-direction: column; gap: 4px; pointer-events: none; text-shadow: 0 2px 12px rgba(0,0,0,.65); }
.scene-label-top { top: 22px; left: 24px; }
.scene-label-bottom { left: 24px; bottom: 21px; max-width: 340px; }
.scene-label-kicker { font-size: 8px; letter-spacing: .18em; color: #9ec8e5; font-weight: 800; }
.scene-label strong { font-size: 15px; letter-spacing: .01em; font-weight: 650; }
.scene-label-detail { color: #a7bfd4; font-size: 10px; }
.scene-legend { position: absolute; z-index: 2; right: 21px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; color: #b6c9dc; font-size: 9px; text-shadow: 0 1px 6px #07101b; }
.scene-legend > div { display: flex; align-items: center; gap: 8px; }
.legend-line { width: 18px; height: 2px; border-radius: 2px; display: inline-block; }
.legend-sun { background: #ffd58a; box-shadow: 0 0 7px #ffd58a; }
.legend-inside { background: #75e7ef; box-shadow: 0 0 7px #75e7ef; }
.legend-exit { background: #e9a9ff; box-shadow: 0 0 7px #e9a9ff; }
.context-overlay, .loading-overlay { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 9px; background: rgba(6, 13, 22, .88); color: #c2d6e9; text-align: center; font-size: 11px; }
.context-overlay[hidden], .loading-overlay[hidden] { display: none; }
.context-overlay strong { color: white; font-size: 15px; }
.context-overlay span { color: #8fa8c0; max-width: 280px; line-height: 1.5; }
.context-icon { font-size: 32px; color: var(--cyan); }
.loading-overlay { z-index: 6; background: #081321; font-size: 9px; letter-spacing: .2em; font-weight: 800; color: #91b6d2; transition: opacity .4s ease; }
.loader-ring { width: 26px; height: 26px; border: 2px solid rgba(120,217,245,.18); border-top-color: var(--cyan); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.transport-bar { height: 54px; flex: 0 0 54px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 16px; border-top: 1px solid var(--line); background: #0a1421; }
.transport-left, .transport-right { display: flex; align-items: center; gap: 9px; }
.primary-control, .transport-button, .export-button, .quality-toggle { border: 1px solid var(--line-strong); background: rgba(21, 37, 55, .65); border-radius: 6px; cursor: pointer; height: 32px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 11px; font-size: 9px; letter-spacing: .09em; font-weight: 800; }
.primary-control { border-color: rgba(120,217,245,.42); background: rgba(44, 115, 147, .22); color: #c5f4ff; min-width: 90px; }
.primary-control:hover, .transport-button:hover, .export-button:hover { border-color: rgba(120,217,245,.65); background: rgba(49, 111, 145, .3); }
#play-icon { font-size: 13px; }
.transport-button { color: #a9bfd3; }
.transport-button span { color: var(--cyan); font-size: 13px; }
.sim-time { color: #728da6; font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; }
.transport-divider { height: 20px; width: 1px; background: var(--line-strong); margin: 0 4px; }
.speed-control { color: #6f879e; font-size: 8px; letter-spacing: .14em; font-weight: 800; }
.speed-select { border: 1px solid var(--line-strong); border-radius: 5px; color: #bcd0e2; background: #101d2b; height: 30px; padding: 0 7px; font-size: 10px; }
.quality-toggle { height: 30px; color: #9eb3c7; font-size: 8px; padding: 0 9px; }
.quality-dot { width: 5px; height: 5px; background: #8ed8ff; box-shadow: 0 0 8px #8ed8ff; }
.quality-toggle[aria-pressed="false"] .quality-dot { background: #e8bd77; box-shadow: 0 0 8px #e8bd77; }
.export-button { height: 30px; border-color: rgba(120,217,245,.3); color: #bfeeff; background: rgba(45, 108, 139, .16); }
.export-button span { font-size: 14px; }
.control-panel { min-width: 0; background: linear-gradient(180deg, rgba(14, 24, 39, .99), rgba(10, 18, 30, .99)); overflow-y: auto; max-height: calc(100vh - 102px); scrollbar-width: thin; scrollbar-color: #31485e transparent; padding: 19px 18px 22px; }
.panel-heading { padding: 1px 1px 17px; border-bottom: 1px solid var(--line); }
.panel-eyebrow { display: flex; justify-content: space-between; color: var(--cyan); font-size: 8px; letter-spacing: .17em; font-weight: 850; }
.panel-eyebrow span { color: #647d96; }
.panel-heading h1 { font-size: 25px; letter-spacing: -.035em; margin: 8px 0 5px; font-weight: 650; }
.panel-heading p { margin: 0; color: #91a6bb; font-size: 10px; line-height: 1.55; max-width: 300px; }
.preset-section, .controls-section, .readouts-section, .validation-section { padding: 16px 0 15px; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.section-heading h2 { margin: 0; color: #c4d7e9; font-size: 9px; letter-spacing: .13em; font-weight: 850; }
.micro-label { color: #617b93; font-size: 7px; letter-spacing: .13em; white-space: nowrap; }
.preset-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 7px; }
.preset-button { min-width: 0; padding: 7px 6px; border: 1px solid var(--line); border-radius: 7px; background: rgba(19, 32, 49, .6); cursor: pointer; display: flex; flex-direction: column; align-items: stretch; gap: 7px; text-align: left; transition: border-color .18s ease, background .18s ease; }
.preset-button:hover { border-color: rgba(120,217,245,.35); }
.preset-button.active { border-color: rgba(120,217,245,.52); background: rgba(48, 106, 136, .2); }
.preset-button > span:last-child { display: flex; flex-direction: column; gap: 3px; }
.preset-button strong { font-size: 9px; font-weight: 700; }
.preset-button small { color: #8299ae; font-size: 7px; }
.preset-swatch { height: 22px; border-radius: 4px; display: block; position: relative; overflow: hidden; }
.preset-swatch i { position: absolute; width: 9px; height: 9px; border-radius: 50%; right: 13px; top: 6px; background: #fff0c2; box-shadow: 0 0 9px 3px rgba(255,218,147,.35); }
.preset-low { background: linear-gradient(180deg,#8d9fb0,#42566d 60%,#28394a); }
.preset-golden { background: linear-gradient(180deg,#718da7,#536b83 55%,#293f52); }
.preset-golden i { background: #ffe3a6; box-shadow: 0 0 10px 4px rgba(255,204,120,.45); }
.preset-high { background: linear-gradient(180deg,#4d779a,#2e5677 65%,#203c55); }
.preset-high i { background: #e7f6ff; box-shadow: 0 0 9px 3px rgba(165,224,255,.4); }
.controls-section { padding-bottom: 16px; }
.control-row { margin-bottom: 13px; }
.control-row:last-child { margin-bottom: 0; }
.control-label-line { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.control-label-line label { font-size: 10px; color: #c1d2e2; }
.control-label-line output { color: #8de0f7; font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
input[type="range"] { appearance: none; -webkit-appearance: none; display: block; width: 100%; height: 4px; border-radius: 10px; background: linear-gradient(90deg, #62c5e8 0%, #397fae 45%, #253b52 45%, #253b52 100%); outline: none; cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #d8f8ff; border: 2px solid #4ca7cb; box-shadow: 0 0 0 3px rgba(89, 192, 226, .12); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; background: #d8f8ff; border: 2px solid #4ca7cb; box-shadow: 0 0 0 3px rgba(89, 192, 226, .12); }
.range-ends { display: flex; justify-content: space-between; margin-top: 6px; color: #5f758b; font-size: 6px; letter-spacing: .1em; }
.readouts-section { padding-top: 15px; }
.readout-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px; }
.readout-card { min-height: 67px; padding: 9px 9px 8px; border: 1px solid var(--line); border-radius: 7px; background: rgba(16, 30, 46, .74); display: flex; flex-direction: column; gap: 4px; }
.readout-name { color: #7891a8; font-size: 7px; letter-spacing: .1em; font-weight: 800; }
.readout-card strong { font: 19px ui-monospace, SFMono-Regular, Menlo, monospace; color: #e4f5ff; letter-spacing: -.04em; }
.readout-card small { color: #667f96; font-size: 6px; letter-spacing: .08em; }
.ray-counter { margin-top: 8px; display: flex; align-items: center; gap: 7px; color: #7892a9; font-size: 8px; }
.ray-counter-dot { width: 5px; height: 5px; }
.ray-counter-tag { margin-left: auto; color: #6b9db4; font-size: 7px; letter-spacing: .14em; }
.validation-section { padding-top: 15px; }
.validation-card { border: 1px solid rgba(117,224,189,.2); border-radius: 8px; padding: 10px; background: rgba(27, 71, 68, .12); }
.validation-title { display: flex; align-items: center; gap: 7px; }
.validation-title strong { font-size: 9px; font-weight: 700; flex: 1; }
.validation-check { width: 16px; height: 16px; display: grid; place-items: center; border-radius: 50%; color: #09221c; background: var(--green); font-size: 10px; font-weight: 900; }
.validation-title > span:last-child { color: var(--green); font-size: 7px; letter-spacing: .13em; font-weight: 900; }
.validation-values { display: grid; grid-template-columns: repeat(3,1fr); gap: 4px; margin: 11px 0 8px; }
.validation-values > div { display: flex; flex-direction: column; gap: 4px; }
.validation-values small { color: #668c86; font-size: 6px; letter-spacing: .12em; }
.validation-values strong { color: #d3eee6; font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.validation-card p { margin: 0; color: #819c99; font-size: 8px; line-height: 1.45; }
.science-panel { margin-top: 13px; border: 1px solid var(--line); border-radius: 8px; background: rgba(13, 25, 39, .55); }
.science-panel summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 12px 11px; cursor: pointer; color: #c6d8e8; font-size: 9px; font-weight: 850; letter-spacing: .12em; }
.science-panel summary::-webkit-details-marker { display: none; }
.summary-hint { color: #627b92; font-size: 7px; font-weight: 600; letter-spacing: .08em; margin-left: auto; }
.chevron { color: var(--cyan); font-size: 15px; transition: transform .2s ease; }
.science-panel[open] .chevron { transform: rotate(180deg); }
.science-content { padding: 0 12px 13px; color: #95aabd; font-size: 9px; line-height: 1.55; }
.science-content h3 { margin: 12px 0 5px; color: #d2e4f3; font-size: 9px; }
.science-content p { margin: 5px 0 8px; }
.science-content ul { padding-left: 16px; margin: 6px 0 10px; }
.science-content li { margin: 4px 0; }
.science-content b { color: #c7e7f3; }
.equation { padding: 7px 9px; border-left: 2px solid #58b8d8; margin: 6px 0; background: rgba(43, 96, 119, .12); color: #c5eafa; font: 11px Georgia, serif; }
.science-note { border-top: 1px solid var(--line); padding-top: 8px; color: #7f9cb2; font-style: italic; }
.footer-bar { height: 34px; flex: 0 0 34px; display: flex; align-items: center; justify-content: space-between; padding: 0 19px; border-top: 1px solid var(--line); color: #657b91; font-size: 8px; background: #080f1a; }
.footer-right { display: flex; align-items: center; gap: 7px; letter-spacing: .1em; font-size: 7px; }
#engine-status { color: #79c9d9; }
.footer-separator { color: #3c536a; }
.shortcut-popover { position: fixed; z-index: 20; top: 58px; right: 18px; width: 245px; padding: 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: #101e2d; box-shadow: 0 16px 50px rgba(0,0,0,.4); }
.shortcut-popover[hidden] { display: none; }
.shortcut-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; color: #d4e7f6; font-size: 9px; letter-spacing: .12em; }
.shortcut-head button { background: none; border: 0; color: #93abc0; font-size: 18px; cursor: pointer; }
.shortcut-popover > div:not(.shortcut-head) { display: flex; align-items: center; gap: 10px; padding: 5px 0; color: #9ab0c5; font-size: 9px; }
kbd { min-width: 31px; text-align: center; padding: 3px 5px; border: 1px solid var(--line-strong); border-radius: 4px; color: #d0e4f4; background: #17283a; font-size: 8px; }
body.embed .topbar, body.embed .footer-bar { display: none; }
body.embed .workspace { min-height: 100vh; }
body.embed .control-panel { max-height: 100vh; }
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }

@media (min-width: 1500px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 405px; }
  .control-panel { padding-left: 22px; padding-right: 22px; }
  .viewport { min-height: 560px; }
}
@media (max-width: 1050px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 340px; }
  .topbar-center { display: none; }
  .brand-lockup, .topbar-actions { min-width: 220px; }
  .control-panel { padding-left: 14px; padding-right: 14px; }
  .transport-bar { padding: 0 10px; }
  .primary-control, .transport-button { padding: 0 8px; }
}
@media (max-width: 820px) {
  .topbar { height: 58px; flex-basis: 58px; padding: 0 14px; }
  .brand-lockup { min-width: 0; }
  .topbar-actions { min-width: 0; }
  .seed-chip { display: none; }
  .workspace { display: flex; flex-direction: column; }
  .stage-panel { border-right: 0; }
  .stage-toolbar { padding: 0 13px; }
  .viewport { min-height: 360px; height: 48vh; flex: 0 0 48vh; }
  #scene-canvas { min-height: 360px; }
  .control-panel { overflow: visible; max-height: none; padding: 18px 15px 24px; }
  .panel-heading h1 { font-size: 23px; }
  .transport-bar { height: auto; min-height: 54px; flex-wrap: wrap; padding: 8px 10px; }
  .transport-left, .transport-right { gap: 6px; }
  .scene-label-top { top: 15px; left: 15px; }
  .scene-label-bottom { bottom: 15px; left: 15px; max-width: 250px; }
  .scene-legend { right: 12px; bottom: 15px; font-size: 8px; }
  .footer-bar { height: auto; min-height: 34px; flex-wrap: wrap; gap: 6px; padding: 8px 12px; }
}
@media (max-width: 470px) {
  .brand-name { font-size: 10px; }
  .brand-subtitle { font-size: 7px; }
  .brand-mark { width: 23px; height: 23px; }
  .stage-breadcrumb { font-size: 8px; }
  .breadcrumb-muted { display: none; }
  .render-indicator { display: none; }
  .stage-toolbar-actions { gap: 0; }
  .viewport { height: 43vh; flex-basis: 43vh; min-height: 310px; }
  #scene-canvas { min-height: 310px; }
  .scene-label strong { font-size: 13px; }
  .scene-label-detail { font-size: 8px; }
  .scene-label-bottom { max-width: 205px; }
  .scene-legend { font-size: 7px; gap: 6px; bottom: 13px; right: 8px; }
  .legend-line { width: 12px; }
  .transport-left { width: 100%; justify-content: flex-start; }
  .transport-right { width: 100%; justify-content: flex-end; }
  .transport-divider { margin: 0 1px; }
  .primary-control, .transport-button { height: 29px; font-size: 8px; }
  .speed-control { font-size: 7px; }
  .speed-select { height: 28px; }
  .export-button, .quality-toggle { height: 28px; }
  .footer-right { flex-wrap: wrap; }
}
@media (max-width: 470px) {
  .transport-left { flex-wrap: wrap; row-gap: 7px; }
  .sim-time { font-size: 8px; }
}
