:root {
  color-scheme: dark;
  --bg: #090f19;
  --panel: #101a28;
  --panel-2: #0d1623;
  --line: #233448;
  --line-soft: rgba(117, 145, 174, .16);
  --text: #edf4fb;
  --muted: #91a4ba;
  --dim: #61768e;
  --accent: #65dfcf;
  --accent-soft: rgba(101, 223, 207, .14);
  --accent-strong: #9af4e7;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; min-width: 320px; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { min-height: 100vh; }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
button, input, select { font: inherit; }
button, select, input[type="range"] { -webkit-tap-highlight-color: transparent; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; gap: 0; padding: 0; background: radial-gradient(ellipse at 16% -8%, rgba(44, 94, 110, .18), transparent 35%), var(--bg); }
body.embed-mode .app-shell { height: 100%; min-height: 0; }
.topbar { flex: 0 0 64px; display: flex; align-items: center; gap: 14px; padding: 0 22px; border-bottom: 1px solid var(--line-soft); background: rgba(8, 14, 23, .82); }
.brand-mark { width: 30px; height: 30px; border: 1px solid rgba(101,223,207,.42); border-radius: 9px; display: flex; align-items: center; justify-content: center; gap: 2px; transform: rotate(-8deg); flex: 0 0 auto; }
.brand-mark span { width: 3px; border-radius: 4px; background: var(--accent); display: block; }
.brand-mark span:nth-child(1) { height: 9px; opacity: .55; }
.brand-mark span:nth-child(2) { height: 17px; }
.brand-mark span:nth-child(3) { height: 12px; opacity: .75; }
.heading-group { min-width: 0; flex: 1; }
.eyebrow, .panel-kicker { color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .17em; line-height: 1.2; }
.eyebrow-dot { display: inline-block; width: 3px; height: 3px; margin: 0 7px 2px; border-radius: 50%; background: var(--dim); }
h1 { margin: 4px 0 0; font-size: 16px; font-weight: 670; letter-spacing: -.025em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title-divider { color: var(--dim); padding: 0 5px; font-weight: 400; }
.subtitle { color: #a8b7c9; font-weight: 450; }
.top-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .13em; flex: 0 0 auto; }
.live-dot, .pill-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px rgba(101,223,207,.65); }
.live-dot.paused { background: #8293a6; box-shadow: none; }
.workspace { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(320px, .88fr); gap: 12px; padding: 14px 18px 10px; }
.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(160deg, rgba(17,28,43,.98), rgba(12,20,32,.98)); box-shadow: 0 12px 36px rgba(0,0,0,.16); }
.panel-heading { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 15px 9px; border-bottom: 1px solid var(--line-soft); }
.panel-heading h2 { margin: 4px 0 0; font-size: 15px; font-weight: 650; letter-spacing: -.025em; }
.panel-kicker { color: var(--dim); font-size: 8px; }
.state-pill { display: flex; align-items: center; gap: 7px; padding: 6px 9px; border: 1px solid rgba(101,223,207,.22); border-radius: 20px; color: var(--accent); background: rgba(101,223,207,.055); font-size: 8px; font-weight: 800; letter-spacing: .11em; white-space: nowrap; }
.state-pill.unlocked { color: #9aabc0; border-color: rgba(145,164,186,.2); background: rgba(145,164,186,.05); }
.state-pill.unlocked .pill-dot { background: #8496ab; box-shadow: none; }
.scene-canvas-wrap, .atlas-canvas-wrap { flex: 1 1 auto; min-height: 0; position: relative; }
canvas { display: block; width: 100%; height: 100%; outline: none; }
.canvas-corner-note { position: absolute; top: 12px; left: 14px; color: #71879e; font-size: 8px; font-weight: 800; letter-spacing: .15em; pointer-events: none; }
.canvas-corner-note span { color: var(--accent); padding: 0 4px; }
.readout-strip { flex: 0 0 72px; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); border-top: 1px solid var(--line-soft); background: rgba(7,13,22,.38); }
.readout { min-width: 0; padding: 9px 12px 7px; border-right: 1px solid var(--line-soft); position: relative; display: flex; flex-direction: column; gap: 2px; }
.readout:last-child { border-right: 0; }
.readout-label { color: var(--dim); font-size: 7px; font-weight: 800; letter-spacing: .12em; white-space: nowrap; }
.readout strong { font-size: 17px; line-height: 1.1; font-weight: 650; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.readout-unit { color: #8295aa; font-size: 8px; white-space: nowrap; }
.value-tag { color: #60788c; font-size: 7px; font-weight: 800; letter-spacing: .11em; }
.readout .value-tag { position: absolute; right: 9px; top: 9px; }
.map-state { color: var(--accent); font-size: 8px; font-weight: 800; letter-spacing: .12em; white-space: nowrap; }
.atlas-legend { flex: 0 0 34px; display: flex; align-items: center; gap: 13px; padding: 0 14px; border-top: 1px solid var(--line-soft); }
.legend-item, .legend-live { color: #9bacc0; font-size: 8px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend-swatch { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.legend-swatch.locked { background: var(--accent); box-shadow: 0 0 8px rgba(101,223,207,.3); }
.legend-swatch.unlocked { background: #25364a; border: 1px solid #3a4d63; }
.legend-live { margin-left: auto; color: var(--accent); font-size: 7px; font-weight: 800; letter-spacing: .09em; }
.legend-live i { width: 8px; height: 8px; display: inline-block; border: 1.5px solid var(--accent-strong); border-radius: 50%; box-shadow: 0 0 0 3px rgba(101,223,207,.13); }
.atlas-caption { flex: 0 0 30px; padding: 7px 14px 8px; color: #7f92a8; font-size: 8px; line-height: 1.4; border-top: 1px solid rgba(117,145,174,.09); }
.control-dock { flex: 0 0 auto; padding: 11px 18px 10px; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); background: rgba(11,18,29,.88); }
.controls-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.control-card { min-width: 0; padding: 8px 11px 7px; border: 1px solid rgba(104,130,158,.18); border-radius: 10px; background: rgba(18,29,44,.65); }
.control-topline { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.control-topline label { color: #9aacc0; font-size: 8px; font-weight: 800; letter-spacing: .1em; white-space: nowrap; }
.control-topline output { color: var(--accent-strong); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.symbol { color: var(--accent); font-size: 10px; margin-left: 3px; }
input[type="range"] { width: 100%; height: 16px; margin: 5px 0 0; accent-color: var(--accent); cursor: pointer; background: transparent; }
input[type="range"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 5px; }
.control-foot { display: flex; align-items: center; justify-content: space-between; gap: 5px; color: #5f748b; font-size: 7px; font-weight: 750; letter-spacing: .08em; }
.control-foot .value-tag { margin-left: auto; }
.transport-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 9px; }
.preset-group { flex: 0 0 auto; }
select { min-height: 32px; max-width: 100%; padding: 0 28px 0 11px; color: #c4d1df; background: #121f2e; border: 1px solid #30445a; border-radius: 8px; font-size: 9px; font-weight: 650; outline: none; }
select:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.transport-buttons { display: flex; align-items: center; gap: 7px; }
.button { min-height: 32px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 11px; border: 1px solid #30445a; border-radius: 8px; background: #132132; color: #b9c8d8; font-size: 9px; font-weight: 700; cursor: pointer; transition: background .18s ease, border-color .18s ease, transform .18s ease; white-space: nowrap; }
.button:hover { border-color: #58758b; background: #1a2b3e; }
.button:active { transform: translateY(1px); }
.button.primary { border-color: rgba(101,223,207,.48); background: rgba(101,223,207,.13); color: var(--accent-strong); }
.button.primary:hover { background: rgba(101,223,207,.2); }
.button-symbol { font-size: 13px; line-height: 1; }
.quality-button { min-width: 54px; color: var(--accent); letter-spacing: .08em; }
.export-button { border-color: rgba(101,223,207,.28); }
.science-panel { flex: 0 0 auto; border-top: 0; background: #0b1420; }
.science-panel summary { height: 39px; display: flex; align-items: center; gap: 9px; padding: 0 20px; color: #a9bacb; cursor: pointer; list-style: none; font-size: 8px; font-weight: 850; letter-spacing: .14em; user-select: none; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-icon { color: var(--accent); font-size: 14px; }
.summary-hint { color: #667b91; font-size: 8px; font-weight: 500; letter-spacing: .02em; margin-left: 3px; }
.chevron { margin-left: auto; color: var(--accent); font-size: 14px; transition: transform .2s ease; }
.science-panel[open] .chevron { transform: rotate(180deg); }
.science-content { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; padding: 12px 20px 18px; border-top: 1px solid var(--line-soft); max-height: 38vh; overflow: auto; }
.science-column { min-width: 0; }
.science-column h3 { margin: 0 0 7px; color: var(--accent); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.science-column p { margin: 0 0 7px; color: #91a4b9; font-size: 10px; line-height: 1.55; }
.science-column .equation { color: #e2edf7; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; letter-spacing: .02em; }
.check-equation { color: #dce8f4 !important; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.textbook-tag { margin-left: 4px; color: #d6bd83; }
.check-readout { display: flex; flex-wrap: wrap; gap: 6px 12px; color: #8195ab; font-size: 8px; }
.check-readout b { color: #e4edf5; font-variant-numeric: tabular-nums; }
.full-width { grid-column: 1 / -1; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.science-column .disclaimer { margin: 0; color: #6f8499; font-style: italic; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 760px) {
  .topbar { flex-basis: 54px; padding: 0 11px; gap: 9px; }
  .brand-mark { width: 26px; height: 26px; }
  .eyebrow { font-size: 7px; }
  h1 { font-size: 13px; margin-top: 3px; }
  .subtitle, .title-divider { display: none; }
  .top-status { font-size: 8px; gap: 6px; }
  .workspace { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(0,1.2fr) minmax(0,1fr); gap: 8px; padding: 8px 9px 7px; }
  .panel-heading { min-height: 43px; padding: 7px 11px 6px; }
  .panel-heading h2 { font-size: 12px; margin-top: 2px; }
  .panel-kicker { font-size: 7px; }
  .state-pill { padding: 4px 7px; font-size: 7px; }
  .scene-canvas-wrap, .atlas-canvas-wrap { min-height: 0; }
  .canvas-corner-note { top: 8px; left: 10px; font-size: 7px; }
  .readout-strip { flex-basis: 55px; }
  .readout { padding: 6px 7px 5px; gap: 1px; }
  .readout-label { font-size: 6px; letter-spacing: .08em; }
  .readout strong { font-size: 13px; }
  .readout-unit { font-size: 7px; }
  .readout .value-tag { display: none; }
  .atlas-legend { flex-basis: 26px; gap: 9px; padding: 0 10px; }
  .legend-item { font-size: 7px; gap: 4px; }
  .legend-live { font-size: 6px; gap: 4px; }
  .atlas-caption { flex-basis: 23px; padding: 5px 10px; font-size: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .control-dock { padding: 7px 9px 8px; }
  .controls-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
  .control-card { padding: 5px 8px 4px; border-radius: 8px; }
  .control-topline label { font-size: 7px; letter-spacing: .07em; }
  .control-topline output { font-size: 10px; }
  .symbol { font-size: 9px; }
  input[type="range"] { height: 13px; margin: 2px 0 0; }
  .control-foot { font-size: 6px; }
  .transport-row { padding-top: 7px; gap: 6px; align-items: center; }
  select { min-height: 29px; width: 142px; padding-left: 8px; font-size: 8px; }
  .transport-buttons { gap: 4px; }
  .button { min-height: 29px; padding: 0 8px; gap: 4px; font-size: 8px; border-radius: 7px; }
  .button-symbol { font-size: 11px; }
  .quality-button { min-width: 43px; }
  .export-button { padding: 0 7px; }
  .science-panel summary { height: 34px; padding: 0 12px; font-size: 7px; gap: 7px; }
  .summary-hint { display: none; }
  .science-content { grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px 12px 14px; max-height: 22vh; overflow: auto; }
  .science-column h3 { font-size: 8px; }
  .science-column p { font-size: 9px; }
  .science-column .equation { font-size: 10px; }
  .full-width { grid-column: 1 / -1; }
}
@media (max-width: 390px) {
  .transport-row { flex-wrap: wrap; }
  .preset-group { flex: 1 1 100%; }
  .preset-group select { width: 100%; }
  .transport-buttons { width: 100%; justify-content: space-between; }
  .button { flex: 1 1 auto; padding-left: 5px; padding-right: 5px; }
  .export-button { flex: 1.25 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
