:root {
  color-scheme: dark;
  --bg: #080d17;
  --panel: #101a29;
  --panel-2: #0d1624;
  --panel-3: #142235;
  --line: rgba(164, 190, 218, .13);
  --line-strong: rgba(164, 190, 218, .22);
  --text: #edf4fa;
  --muted: #91a3b8;
  --faint: #62758d;
  --teal: #80e3d2;
  --teal-2: #4bbfac;
  --gold: #f3c97a;
  --coral: #f29d88;
  --radius: 18px;
  --shadow: 0 18px 55px rgba(0, 0, 0, .24);
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(900px 560px at 12% -10%, rgba(50, 91, 123, .16), transparent 60%),
    radial-gradient(800px 560px at 95% 18%, rgba(49, 104, 105, .10), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1.45;
}
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
.app-shell { max-width: 1680px; margin: 0 auto; min-height: 100vh; padding: 18px 22px 14px; display: flex; flex-direction: column; gap: 14px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 54px; }
.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(128, 227, 210, .2); border-radius: 14px; color: var(--teal); background: linear-gradient(145deg, rgba(128, 227, 210, .12), rgba(128, 227, 210, .025)); flex: 0 0 auto; }
.brand-mark svg { width: 34px; height: 34px; }
.eyebrow { color: #8ca3ba; font-size: 9px; font-weight: 800; letter-spacing: .16em; line-height: 1.4; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(17px, 1.6vw, 22px); font-weight: 670; letter-spacing: -.035em; line-height: 1.2; margin-top: 3px; }
h2 { font-size: 15px; font-weight: 660; letter-spacing: -.02em; }
h3 { font-size: 11px; font-weight: 760; letter-spacing: .08em; text-transform: uppercase; color: #b5c5d7; margin: 14px 0 6px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.scale-switch, .view-switch, .quality-switch { display: flex; align-items: center; gap: 3px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: rgba(10, 18, 29, .7); }
.switch-label { color: var(--faint); font-size: 8px; letter-spacing: .13em; font-weight: 800; padding: 0 7px 0 5px; }
.scale-choice, .view-choice, .quality-choice { border: 0; background: transparent; color: var(--muted); border-radius: 7px; padding: 6px 9px; cursor: pointer; font-size: 10px; font-weight: 650; transition: background .2s ease, color .2s ease; }
.scale-choice.active, .view-choice.active, .quality-choice.active { background: #203447; color: var(--teal); box-shadow: inset 0 0 0 1px rgba(128, 227, 210, .12); }
.action-button { border: 1px solid rgba(128, 227, 210, .24); background: rgba(128, 227, 210, .08); color: #c7f7ee; border-radius: 10px; padding: 9px 12px; display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 11px; font-weight: 700; transition: background .2s ease, transform .2s ease; }
.action-button:hover { background: rgba(128, 227, 210, .15); transform: translateY(-1px); }
.action-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(340px, .85fr); gap: 14px; flex: 1; min-height: 0; }
.visual-panel, .control-panel { background: linear-gradient(160deg, rgba(17, 28, 44, .97), rgba(11, 19, 31, .98)); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.visual-panel { padding: 16px; display: flex; flex-direction: column; min-height: 490px; overflow: hidden; }
.visual-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 1px 2px 13px; }
.visual-heading h2 { margin-top: 3px; font-size: 16px; }
.view-switch { flex: 0 0 auto; }
.view-choice { padding: 6px 15px; font-size: 10px; min-width: 58px; }
.canvas-frame { position: relative; flex: 1; min-height: 300px; overflow: hidden; border: 1px solid rgba(128, 160, 190, .12); border-radius: 14px; background: #091321; isolation: isolate; }
.canvas-frame::after { content: ""; pointer-events: none; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 90px rgba(0, 0, 0, .2); }
#scene { display: block; width: 100%; height: 100%; }
.canvas-hud { position: absolute; z-index: 2; top: 13px; color: rgba(189, 209, 227, .68); font-size: 8px; letter-spacing: .15em; font-weight: 800; pointer-events: none; }
.hud-top-left { left: 15px; }
.hud-top-right { right: 15px; text-align: right; }
.canvas-legend { position: absolute; z-index: 2; left: 14px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 12px; color: #93a6bb; font-size: 9px; pointer-events: none; }
.canvas-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.star-dot { background: var(--gold); box-shadow: 0 0 9px rgba(243, 201, 122, .8); }
.planet-dot { background: var(--teal); box-shadow: 0 0 8px rgba(128, 227, 210, .8); }
.legend-line { width: 18px; border-top: 1px dashed rgba(180, 205, 228, .65); display: inline-block; }
.caption-bar { display: flex; gap: 11px; align-items: flex-start; padding: 13px 4px 0; min-height: 62px; }
.status-pulse { width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; background: var(--teal); box-shadow: 0 0 0 4px rgba(128, 227, 210, .1), 0 0 14px rgba(128, 227, 210, .6); flex: 0 0 auto; }
.caption-kicker { color: #8297ad; font-size: 8px; font-weight: 800; letter-spacing: .15em; margin-bottom: 3px; }
.caption-bar p { color: #c2cfdd; font-size: 11px; line-height: 1.5; max-width: 850px; }
.control-panel { padding: 15px; min-height: 0; overflow: auto; scrollbar-width: thin; scrollbar-color: #31445a transparent; }
.panel-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; }
.panel-title-row h2 { margin-top: 3px; }
.tag { display: inline-flex; align-items: center; border-radius: 4px; padding: 2px 5px; font-size: 7px; font-weight: 850; letter-spacing: .09em; white-space: nowrap; line-height: 1.2; }
.tag-illustrative { color: #d9b778; background: rgba(243, 201, 122, .10); border: 1px solid rgba(243, 201, 122, .13); }
.tag-scaled { color: #8de4d5; background: rgba(128, 227, 210, .09); border: 1px solid rgba(128, 227, 210, .12); }
.tag-textbook { color: #b5c9ed; background: rgba(143, 174, 225, .1); border: 1px solid rgba(143, 174, 225, .13); }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 12px; }
.preset-button { display: flex; align-items: center; gap: 8px; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: left; background: rgba(8, 16, 27, .55); cursor: pointer; transition: border .2s ease, background .2s ease; }
.preset-button:hover { border-color: rgba(128, 227, 210, .28); }
.preset-button.active { background: rgba(128, 227, 210, .075); border-color: rgba(128, 227, 210, .35); }
.preset-icon { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 8px; background: #1a2b3d; color: var(--teal); font-size: 16px; flex: 0 0 auto; }
.quiet-icon { color: #a9bbd0; }
.preset-button strong { display: block; color: #dce8f2; font-size: 10px; font-weight: 720; }
.preset-button small { display: block; color: #7f93a9; font-size: 8px; margin-top: 1px; }
.readout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 14px; }
.readout-card { min-width: 0; border: 1px solid rgba(157, 185, 211, .11); border-radius: 10px; background: linear-gradient(145deg, rgba(24, 39, 58, .68), rgba(13, 24, 38, .7)); padding: 9px 10px 8px; position: relative; overflow: hidden; }
.readout-label { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; color: #8196ad; font-size: 7px; letter-spacing: .1em; font-weight: 850; }
.readout-value { color: #f0f6fb; font-size: 21px; line-height: 1.3; font-weight: 650; letter-spacing: -.04em; font-variant-numeric: tabular-nums; margin-top: 4px; }
.readout-value small { color: #a2b4c7; font-size: 11px; font-weight: 550; letter-spacing: 0; margin-left: 3px; }
.readout-foot { color: #72879e; font-size: 8px; margin-top: 1px; }
.meter-track { height: 2px; margin-top: 7px; border-radius: 4px; background: rgba(130, 160, 190, .12); overflow: hidden; }
.meter-fill { height: 100%; width: 0; border-radius: inherit; transition: width .12s linear; }
.teal-fill { background: var(--teal); box-shadow: 0 0 8px rgba(128, 227, 210, .55); }
.gold-fill { background: var(--gold); box-shadow: 0 0 8px rgba(243, 201, 122, .5); }
.controls-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 2px 0 7px; color: #8fa4b9; font-size: 8px; letter-spacing: .13em; font-weight: 850; }
.slider-list { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 13px; }
.slider-control { display: block; min-width: 0; }
.slider-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: #c5d2df; font-size: 9px; font-weight: 620; }
.slider-top output { color: var(--teal); font-variant-numeric: tabular-nums; font-size: 9px; white-space: nowrap; }
.info { display: inline-grid; place-items: center; width: 12px; height: 12px; border: 1px solid rgba(143, 169, 195, .35); border-radius: 50%; color: #93a9bf; font-size: 8px; font-style: normal; cursor: help; vertical-align: 1px; }
input[type="range"] { display: block; width: 100%; height: 14px; margin: 4px 0 0; appearance: none; background: transparent; cursor: pointer; accent-color: var(--teal); }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 5px; background: linear-gradient(90deg, rgba(128, 227, 210, .55), rgba(128, 227, 210, .16)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 5px; background: linear-gradient(90deg, rgba(128, 227, 210, .55), rgba(128, 227, 210, .16)); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 11px; height: 11px; margin-top: -4px; border-radius: 50%; background: #a6f2e5; border: 2px solid #163b42; box-shadow: 0 0 0 2px rgba(128, 227, 210, .12), 0 0 9px rgba(128, 227, 210, .45); }
input[type="range"]::-moz-range-thumb { width: 8px; height: 8px; border-radius: 50%; background: #a6f2e5; border: 2px solid #163b42; box-shadow: 0 0 0 2px rgba(128, 227, 210, .12); }
.range-ends { display: flex; justify-content: space-between; color: #62778e; font-size: 7px; font-variant-numeric: tabular-nums; }
.playback-block { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; }
.playback-top { display: flex; align-items: center; justify-content: space-between; color: #8fa4b9; font-size: 8px; letter-spacing: .13em; font-weight: 850; }
.playback-top strong { color: #e5eef6; font-size: 11px; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.transport-row { display: flex; gap: 6px; margin: 8px 0; }
.transport-button { border: 1px solid var(--line-strong); background: rgba(8, 16, 27, .68); color: #b6c6d6; border-radius: 8px; padding: 6px 9px; font-size: 9px; font-weight: 700; cursor: pointer; transition: background .2s ease, border .2s ease; }
.transport-button:hover { background: #1b2b3d; border-color: rgba(128, 227, 210, .25); }
.primary-transport { background: rgba(128, 227, 210, .13); border-color: rgba(128, 227, 210, .28); color: #bff5e9; min-width: 88px; }
.speed-control { display: block; }
.speed-control > span { display: flex; align-items: center; justify-content: space-between; color: #b4c3d2; font-size: 9px; }
.speed-control output { color: var(--teal); font-variant-numeric: tabular-nums; }
.speed-control input { margin-top: 2px; }
.audit-card { border: 1px solid rgba(143, 174, 225, .18); border-radius: 10px; padding: 9px 10px; margin-top: 11px; background: linear-gradient(135deg, rgba(35, 49, 72, .52), rgba(17, 27, 43, .55)); }
.audit-head { display: flex; align-items: center; justify-content: space-between; color: #9bb0c8; font-size: 8px; font-weight: 850; letter-spacing: .13em; }
.audit-title { margin-top: 5px; color: #e2ebf4; font-size: 10px; font-weight: 700; }
.audit-values { display: flex; align-items: end; gap: 9px; margin-top: 5px; }
.audit-values > div:first-child, .audit-values > div:nth-child(3) { min-width: 0; }
.audit-values small { display: block; color: #8196ad; font-size: 7px; }
.audit-values strong { display: block; color: #eaf2f9; font-size: 15px; font-weight: 680; font-variant-numeric: tabular-nums; }
.audit-divider { color: #5f738a; font-size: 8px; padding-bottom: 4px; }
.audit-diff { margin-left: auto; color: var(--teal); font-size: 9px; font-weight: 750; padding-bottom: 3px; white-space: nowrap; }
.audit-card p { margin-top: 5px; color: #7e92a8; font-size: 8px; line-height: 1.45; }
.science-panel { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; }
.science-panel summary { display: flex; justify-content: space-between; align-items: center; color: #b9c8d8; font-size: 10px; font-weight: 720; cursor: pointer; list-style: none; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary span { color: var(--teal); font-size: 14px; transition: transform .2s ease; }
.science-panel[open] summary span { transform: rotate(45deg); }
.science-content { padding-top: 4px; color: #9aadc0; font-size: 9px; line-height: 1.55; }
.science-content h3 { display: flex; align-items: center; gap: 6px; font-size: 8px; margin: 12px 0 4px; }
.science-content p { margin: 5px 0; }
.equation { margin: 6px 0; padding: 7px 8px; border-radius: 6px; background: rgba(6, 13, 22, .55); color: #c7e9e3; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 8px; overflow-wrap: anywhere; }
.disclaimer { color: #7c91a7; font-style: italic; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 10px !important; }
.footer-line { display: flex; justify-content: space-between; gap: 12px; color: #53677e; font-size: 8px; letter-spacing: .04em; }
.footer-line span:first-child { font-weight: 800; letter-spacing: .12em; }

@media (min-width: 1500px) {
  .app-shell { padding-left: 28px; padding-right: 28px; }
  .workspace { grid-template-columns: minmax(0, 1.7fr) minmax(370px, .75fr); }
  .visual-panel { padding: 19px; }
  .control-panel { padding: 18px; }
}
@media (max-width: 980px) {
  .app-shell { padding: 14px; }
  .workspace { grid-template-columns: minmax(0, 1.25fr) minmax(310px, .95fr); gap: 10px; }
  .visual-panel { padding: 12px; }
  .control-panel { padding: 12px; }
  .slider-list { grid-template-columns: 1fr; gap: 7px; }
  .slider-control { display: grid; grid-template-columns: 1fr 110px; column-gap: 10px; align-items: center; }
  .slider-top { grid-column: 1 / -1; }
  .slider-control input { grid-column: 1; grid-row: 2; }
  .range-ends { grid-column: 2; grid-row: 2; align-self: center; }
}
@media (max-width: 720px) {
  .app-shell { padding: 12px; gap: 10px; }
  .topbar { align-items: flex-start; flex-direction: column; gap: 10px; }
  .top-actions { width: 100%; justify-content: space-between; }
  .brand-mark { width: 38px; height: 38px; }
  .workspace { display: flex; flex-direction: column; gap: 10px; min-height: auto; }
  .visual-panel { min-height: 0; height: 410px; flex: 0 0 410px; }
  .canvas-frame { min-height: 220px; }
  .control-panel { overflow: visible; }
  .slider-list { grid-template-columns: 1fr 1fr; gap: 9px 12px; }
  .slider-control { display: block; }
  .slider-top { grid-column: auto; font-size: 9px; }
  .slider-control input { grid-column: auto; grid-row: auto; }
  .range-ends { grid-column: auto; grid-row: auto; }
  .footer-line { flex-direction: column; gap: 3px; padding: 4px 2px; }
}
@media (max-width: 420px) {
  .app-shell { padding: 9px; }
  h1 { font-size: 18px; }
  .switch-label { display: none; }
  .scale-choice, .quality-choice { padding: 6px 8px; }
  .action-button { padding: 8px 9px; }
  .visual-panel { height: 380px; flex-basis: 380px; padding: 10px; }
  .visual-heading h2 { font-size: 14px; }
  .view-choice { min-width: 50px; padding: 6px 10px; }
  .canvas-hud { font-size: 7px; }
  .canvas-legend { gap: 8px; font-size: 8px; left: 10px; bottom: 9px; }
  .caption-bar { padding-top: 10px; }
  .readout-value { font-size: 19px; }
  .slider-list { gap: 8px 10px; }
  .slider-top { font-size: 8px; }
  .controls-heading { font-size: 7px; }
  .controls-heading .tag { font-size: 6px; }
}
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
body.embed-mode .app-shell { height: 100vh; height: 100dvh; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
body.embed-mode .workspace { min-height: 0; }
body.embed-mode .control-panel { overscroll-behavior: contain; }
@media (max-width: 720px) {
  body.embed-mode .app-shell { display: block; padding-bottom: 14px; }
  body.embed-mode .topbar { margin-bottom: 10px; }
  body.embed-mode .visual-panel { margin-bottom: 10px; }
  body.embed-mode .control-panel { overflow: visible; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .status-pulse { box-shadow: 0 0 0 3px rgba(128, 227, 210, .1); }
}
