:root {
  color-scheme: dark;
  --bg: #080d16;
  --panel: #0e1724;
  --panel-2: #101c2b;
  --line: rgba(155, 181, 208, .14);
  --line-strong: rgba(155, 181, 208, .24);
  --text: #eaf2fa;
  --muted: #8ea0b5;
  --dim: #5c7087;
  --accent: #6de3ff;
  --accent-soft: rgba(109, 227, 255, .12);
  --accent-glow: rgba(109, 227, 255, .28);
  --radius: 14px;
  --grid: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-width: 320px; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-height: 100vh; background: radial-gradient(ellipse at 28% -12%, rgba(45, 87, 125, .18), transparent 42%), var(--bg); }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.app-shell { width: min(1600px, 100%); min-height: 100vh; margin: 0 auto; padding: 16px 20px 18px; display: grid; grid-template-rows: auto minmax(370px, 1fr) auto auto; gap: 12px; }
body.embed-mode .app-shell { height: 100%; min-height: 0; grid-template-rows: auto minmax(0, 1fr) auto auto; overflow: hidden; }
.topbar { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 2px 2px; }
.brand-lockup { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border: 1px solid rgba(109,227,255,.35); border-radius: 50%; position: relative; display: grid; place-items: center; box-shadow: 0 0 22px rgba(109,227,255,.09), inset 0 0 16px rgba(109,227,255,.08); flex: 0 0 auto; }
.brand-mark:before, .brand-mark:after { content: ""; position: absolute; background: var(--accent); opacity: .8; }
.brand-mark:before { width: 22px; height: 1px; transform: rotate(42deg); }
.brand-mark:after { width: 22px; height: 1px; transform: rotate(-42deg); }
.brand-mark span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); z-index: 1; }
.brand-mark i { position: absolute; width: 27px; height: 12px; border: 1px solid rgba(109,227,255,.65); border-radius: 50%; transform: rotate(-25deg); }
.eyebrow, .section-kicker { color: var(--dim); font-size: 9px; letter-spacing: .17em; font-weight: 750; line-height: 1.4; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(17px, 1.55vw, 21px); letter-spacing: -.035em; font-weight: 680; margin-top: 2px; line-height: 1.1; }
h1 span { color: #9db0c4; font-weight: 440; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.live-indicator { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 99px; color: #b9c8d7; font-size: 9px; font-weight: 750; letter-spacing: .12em; white-space: nowrap; }
.live-dot, .view-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 9px var(--accent-glow); }
.live-dot { animation: pulse 2.2s ease-in-out infinite; }
.source-legend { display: flex; align-items: center; gap: 7px; color: var(--dim); font-size: 8px; letter-spacing: .12em; white-space: nowrap; }
.source-legend b { color: var(--accent); font-size: 12px; }
.workspace { min-height: 0; display: grid; grid-template-columns: minmax(0, 1.58fr) minmax(350px, .92fr); gap: 12px; }
.panel { background: linear-gradient(145deg, rgba(17,29,44,.97), rgba(11,19,31,.98)); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 35px rgba(0,0,0,.14); }
.scene-panel { min-width: 0; min-height: 0; padding: 16px 16px 11px; display: flex; flex-direction: column; overflow: hidden; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-heading h2, .dock-heading h2, .check-heading h2 { font-size: 13px; font-weight: 640; letter-spacing: -.02em; margin-top: 3px; }
.view-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 8px; letter-spacing: .12em; white-space: nowrap; }
.scene-wrap { position: relative; flex: 1; min-height: 0; margin-top: 10px; border-radius: 10px; overflow: hidden; background: radial-gradient(ellipse at 50% 48%, rgba(27,52,76,.25), rgba(5,11,20,.6) 68%), #08111c; border: 1px solid rgba(120,156,190,.1); }
#orbitCanvas { width: 100%; height: 100%; display: block; }
.scene-corner { position: absolute; top: 10px; z-index: 1; color: #61768d; font-size: 8px; letter-spacing: .13em; pointer-events: none; }
.scene-corner-left { left: 12px; }
.scene-corner-right { right: 12px; }
.scene-corner span { color: var(--accent); }
.scaled-tag { color: var(--accent); border: 1px solid rgba(109,227,255,.22); padding: 2px 5px; border-radius: 4px; }
.scene-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; min-height: 25px; padding-top: 8px; color: #a6b6c7; font-size: 9px; }
.scene-legend span { display: inline-flex; align-items: center; gap: 6px; }
.scene-legend i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.legend-pulsar { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.legend-companion { background: #d7dce7; box-shadow: 0 0 7px rgba(215,220,231,.45); }
.legend-ray { width: 13px !important; height: 1px !important; border-radius: 0 !important; background: var(--accent); }
.legend-note { margin-left: auto; color: #657990; font-size: 8px; }
.insight-column { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(125px, 1fr) auto auto; gap: 9px; }
.metrics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.metric-card { min-width: 0; background: linear-gradient(145deg, rgba(17,29,44,.96), rgba(12,21,34,.98)); border: 1px solid var(--line); border-radius: 11px; padding: 10px 11px 9px; min-height: 77px; }
.metric-primary { border-color: rgba(109,227,255,.3); background: linear-gradient(145deg, rgba(21,48,63,.72), rgba(12,25,39,.98)); }
.metric-label { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; color: #8195aa; font-size: 7px; font-weight: 750; letter-spacing: .1em; line-height: 1.4; }
.source-tag { font-style: normal; font-size: 6px; letter-spacing: .1em; color: #5d8292; border: 1px solid rgba(109,227,255,.16); border-radius: 3px; padding: 1px 3px; white-space: nowrap; }
.metric-value { display: flex; align-items: baseline; gap: 5px; margin-top: 5px; font-size: clamp(19px, 2vw, 25px); line-height: 1; letter-spacing: -.045em; font-weight: 620; font-variant-numeric: tabular-nums; }
.metric-primary .metric-value { color: var(--accent); }
.metric-value small { color: #8094a9; font-size: 9px; letter-spacing: 0; font-weight: 500; }
.metric-foot { color: #62778d; font-size: 8px; margin-top: 5px; }
.chart-card { min-height: 0; padding: 11px 12px 8px; display: flex; flex-direction: column; }
.compact-heading h2 { font-size: 11px; }
.chart-unit { color: var(--accent); font-size: 9px; font-weight: 700; }
#delayChart { width: 100%; flex: 1; min-height: 70px; display: block; margin-top: 4px; }
.chart-axis-note { display: flex; justify-content: space-between; color: #63778c; font-size: 7px; letter-spacing: .12em; padding: 1px 2px 0; }
.chart-axis-note b { color: var(--accent); font-weight: 600; }
#phaseReadout { color: #9aafc4; font-variant-numeric: tabular-nums; }
.caption-card { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; }
.caption-icon { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; color: var(--accent); background: var(--accent-soft); font-size: 13px; flex: 0 0 auto; }
.caption-card p { color: #a8b8c8; font-size: 9px; line-height: 1.45; margin-top: 3px; }
.check-card { padding: 10px 12px 9px; }
.check-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.check-heading h2 { font-size: 10px; }
.check-badge { border: 1px solid rgba(109,227,255,.22); color: var(--accent); padding: 3px 5px; border-radius: 4px; font-size: 6px; letter-spacing: .13em; white-space: nowrap; }
.check-equation { color: #c7d7e6; font-family: Georgia, serif; font-size: 13px; margin: 7px 0 6px; letter-spacing: .01em; }
.check-values { display: grid; grid-template-columns: 1fr 1fr .8fr; gap: 6px; }
.check-values > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 4px; }
.check-values span { width: 100%; color: #6f849a; font-size: 6px; letter-spacing: .11em; }
.check-values em { font-style: normal; font-size: 5px; color: #5d8292; }
.check-values strong { font-size: 11px; font-variant-numeric: tabular-nums; color: #dce8f3; }
.check-values small { color: #71869c; font-size: 7px; }
.control-dock { padding: 11px 13px 10px; }
.dock-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.dock-heading h2 { font-size: 12px; }
.preset-group { display: flex; align-items: center; gap: 6px; }
.preset-label { color: #687d92; font-size: 7px; letter-spacing: .14em; margin-right: 3px; }
.preset-button { border: 1px solid var(--line-strong); background: rgba(255,255,255,.02); color: #9cafc2; border-radius: 6px; padding: 6px 9px; font-size: 8px; cursor: pointer; transition: border-color .2s ease, color .2s ease, background .2s ease; }
.preset-button:hover { border-color: rgba(109,227,255,.45); color: var(--text); }
.preset-button.active { border-color: rgba(109,227,255,.4); background: var(--accent-soft); color: var(--accent); }
.controls-grid { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 8px; }
.control-card { min-width: 0; padding: 7px 8px 5px; background: rgba(5,12,21,.38); border: 1px solid rgba(155,181,208,.09); border-radius: 8px; display: block; cursor: pointer; }
.control-name { display: flex; align-items: center; justify-content: space-between; gap: 4px; color: #a5b5c6; font-size: 8px; white-space: nowrap; }
.control-name em { font-style: normal; font-size: 5px; letter-spacing: .08em; color: #587c8b; }
.control-value { display: block; color: #e0eaf4; font-size: 12px; font-weight: 620; font-variant-numeric: tabular-nums; margin-top: 2px; }
.control-value small { color: #71869b; font-size: 7px; font-weight: 450; }
.control-card input[type=range] { display: block; width: 100%; margin: 4px 0 3px; height: 11px; accent-color: var(--accent); cursor: ew-resize; }
.control-ends { display: flex; justify-content: space-between; color: #5e7287; font-size: 6px; }
.dock-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.transport-controls, .display-toggles { display: flex; align-items: center; gap: 6px; }
.transport-button, .quality-button, .screenshot-button { min-height: 27px; border: 1px solid var(--line-strong); background: rgba(255,255,255,.025); color: #9fb1c4; border-radius: 6px; padding: 5px 9px; font-size: 7px; letter-spacing: .1em; font-weight: 750; cursor: pointer; transition: .18s ease; }
.transport-button:hover, .quality-button:hover, .screenshot-button:hover { border-color: rgba(109,227,255,.42); color: var(--text); }
.play-button { border-color: rgba(109,227,255,.38); background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; gap: 7px; min-width: 75px; justify-content: center; }
.play-icon { font-size: 10px; line-height: 1; }
.transport-button span:last-child { font-size: 11px; }
.toggle-control { display: inline-flex; align-items: center; gap: 5px; color: #91a5ba; font-size: 8px; cursor: pointer; user-select: none; }
.toggle-control input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-ui { width: 23px; height: 13px; border-radius: 99px; background: #273649; border: 1px solid #3b5066; position: relative; transition: .2s ease; }
.toggle-ui:after { content: ""; position: absolute; left: 2px; top: 2px; width: 7px; height: 7px; border-radius: 50%; background: #8ea0b4; transition: .2s ease; }
.toggle-control input:checked + .toggle-ui { background: rgba(109,227,255,.22); border-color: rgba(109,227,255,.5); }
.toggle-control input:checked + .toggle-ui:after { left: 12px; background: var(--accent); box-shadow: 0 0 6px var(--accent-glow); }
.toggle-control input:focus-visible + .toggle-ui { outline: 2px solid var(--accent); outline-offset: 3px; }
.quality-button { padding-inline: 8px; }
.quality-button b { color: var(--accent); margin-left: 4px; }
.screenshot-button { color: var(--accent); border-color: rgba(109,227,255,.28); }
.screenshot-button span { font-size: 12px; margin-right: 4px; }
.science-panel { overflow: hidden; }
.science-panel summary { list-style: none; cursor: pointer; min-height: 34px; display: flex; align-items: center; gap: 9px; padding: 8px 13px; color: #b2c2d1; font-size: 8px; font-weight: 750; letter-spacing: .14em; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-summary-mark { color: var(--accent); font-size: 14px; font-family: Georgia, serif; }
.summary-hint { color: #667c91; font-size: 8px; letter-spacing: .02em; font-weight: 450; }
.summary-chevron { margin-left: auto; color: var(--accent); font-size: 14px; transition: transform .2s ease; }
.science-panel[open] .summary-chevron { transform: rotate(180deg); }
.science-content { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; border-top: 1px solid var(--line); padding: 13px 15px 15px; }
.science-block h3 { color: #dce8f2; font-size: 11px; margin: 4px 0 7px; }
.science-block p { color: #93a7ba; font-size: 9px; line-height: 1.55; margin: 4px 0; }
.science-block strong { color: #c7d8e7; font-weight: 650; }
.textbook-tag { display: inline-block; color: var(--accent); font-size: 6px; letter-spacing: .12em; border: 1px solid rgba(109,227,255,.25); border-radius: 3px; padding: 1px 4px; white-space: nowrap; }
.science-block .disclaimer { color: #7d91a6; font-style: italic; margin-top: 9px; }
@keyframes pulse { 0%,100% { opacity: .55; box-shadow: 0 0 4px var(--accent-glow); } 50% { opacity: 1; box-shadow: 0 0 10px var(--accent); } }
@media (min-width: 1500px) { .app-shell { padding-inline: 28px; } }
@media (max-width: 1050px) {
  .app-shell { padding: 12px; gap: 9px; }
  .workspace { grid-template-columns: minmax(0,1.25fr) minmax(320px,.9fr); gap: 9px; }
  .control-name em { display: none; }
  .controls-grid { gap: 6px; }
  .control-card { padding-inline: 6px; }
  .legend-note { display: none !important; }
}
@media (max-width: 760px) {
  html, body { min-width: 320px; }
  body.embed-mode { overflow: hidden; }
  .app-shell, body.embed-mode .app-shell { padding: 8px; gap: 7px; grid-template-rows: auto minmax(0,1fr) auto auto; }
  .topbar { min-height: 44px; }
  .brand-mark { width: 28px; height: 28px; }
  .brand-mark i { width: 22px; height: 10px; }
  .brand-mark:before, .brand-mark:after { width: 18px; }
  .brand-lockup { gap: 9px; }
  .eyebrow { font-size: 7px; }
  h1 { font-size: 15px; }
  .topbar-right { gap: 0; }
  .source-legend { display: none; }
  .live-indicator { padding: 6px 8px; font-size: 7px; }
  .workspace { display: flex; flex-direction: column; gap: 7px; min-height: 0; }
  .scene-panel { flex: 0 0 49%; min-height: 170px; padding: 10px 10px 7px; }
  .panel-heading h2 { font-size: 11px; }
  .section-kicker { font-size: 7px; }
  .view-label { font-size: 6px; }
  .scene-wrap { margin-top: 6px; }
  .scene-legend { min-height: 18px; padding-top: 5px; gap: 10px; font-size: 7px; }
  .scene-legend i { width: 6px; height: 6px; }
  .insight-column { flex: 1 1 auto; min-height: 0; grid-template-columns: 1fr 1fr; grid-template-rows: auto minmax(82px,1fr); gap: 6px; }
  .metrics-grid { grid-column: 1 / -1; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 5px; }
  .metric-card { min-height: 55px; padding: 6px 6px 5px; border-radius: 8px; }
  .metric-label { font-size: 5px; gap: 2px; letter-spacing: .07em; }
  .source-tag { font-size: 4px; padding: 0 2px; }
  .metric-value { font-size: clamp(13px,4vw,18px); gap: 2px; margin-top: 4px; }
  .metric-value small { font-size: 6px; }
  .metric-foot { display: none; }
  .chart-card { grid-column: 1 / -1; padding: 6px 8px 5px; border-radius: 8px; }
  .compact-heading h2 { font-size: 9px; }
  #delayChart { min-height: 40px; margin-top: 0; }
  .chart-axis-note { font-size: 5px; }
  .caption-card, .check-card { display: none; }
  .control-dock { padding: 8px; border-radius: 10px; }
  .dock-heading { margin-bottom: 6px; }
  .dock-heading h2 { font-size: 10px; }
  .preset-group { gap: 4px; }
  .preset-label { display: none; }
  .preset-button { padding: 5px 6px; font-size: 7px; }
  .controls-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 5px; }
  .control-card { padding: 5px 6px 3px; border-radius: 6px; }
  .control-name { font-size: 7px; }
  .control-name em { display: none; }
  .control-value { font-size: 10px; margin-top: 1px; }
  .control-value small { font-size: 6px; }
  .control-card input[type=range] { height: 9px; margin: 2px 0 1px; }
  .control-ends { font-size: 5px; }
  .dock-footer { margin-top: 6px; gap: 5px; flex-wrap: wrap; }
  .transport-controls, .display-toggles { gap: 4px; }
  .transport-button, .quality-button, .screenshot-button { min-height: 23px; padding: 4px 6px; font-size: 6px; }
  .play-button { min-width: 64px; }
  .toggle-control { gap: 3px; font-size: 7px; }
  .toggle-ui { width: 19px; height: 11px; }
  .toggle-ui:after { width: 5px; height: 5px; }
  .toggle-control input:checked + .toggle-ui:after { left: 11px; }
  .science-panel summary { min-height: 29px; padding: 6px 9px; font-size: 7px; }
  .summary-hint { display: none; }
  .science-content { grid-template-columns: 1fr; gap: 8px; padding: 9px; max-height: 28vh; overflow: auto; }
  .science-block h3 { font-size: 10px; }
  .science-block p { font-size: 8px; }
}
@media (max-width: 390px) {
  .app-shell, body.embed-mode .app-shell { padding: 6px; gap: 6px; }
  .scene-panel { flex-basis: 46%; padding: 8px 8px 5px; }
  .scene-legend { gap: 7px; }
  .view-label { font-size: 5px; }
  .metric-card { padding-inline: 4px; }
  .metric-label { font-size: 4.5px; }
  .metric-value { font-size: 13px; }
  .dock-heading h2 { font-size: 9px; }
  .preset-button { font-size: 6px; padding: 5px; }
  .display-toggles { margin-left: auto; }
  .screenshot-button { padding-inline: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
/* Tight vertical rhythm keeps the complete analytical readout visible in embeds. */
@media (min-width: 761px) {
  .metric-card { min-height: 64px; padding-top: 8px; padding-bottom: 7px; }
  .metric-foot { margin-top: 3px; font-size: 7px; }
  .chart-card { min-height: 102px; }
  .caption-card { padding: 7px 10px; gap: 8px; }
  .caption-icon { width: 21px; height: 21px; }
  .caption-card p { font-size: 8px; line-height: 1.35; }
  .check-card { padding: 8px 10px 7px; }
  .check-equation { margin: 4px 0 4px; font-size: 12px; }
  .check-values strong { font-size: 10px; }
}
@media (max-width: 760px) {
  .scene-panel { flex-basis: 40%; }
  .insight-column { grid-template-columns: 1fr 1fr; grid-template-rows: auto minmax(76px,1fr) auto; }
  .metrics-grid, .chart-card { grid-column: 1 / -1; }
  .caption-card { grid-column: 1; display: flex; padding: 6px 7px; gap: 6px; }
  .caption-icon { width: 17px; height: 17px; font-size: 10px; }
  .caption-card p { font-size: 6.5px; line-height: 1.3; }
  .check-card { grid-column: 2; display: block; padding: 6px 7px; }
  .check-heading h2 { font-size: 7px; }
  .check-equation { font-size: 9px; margin: 3px 0; }
  .check-values { gap: 3px; }
  .check-values span { font-size: 4px; }
  .check-values strong { font-size: 7px; }
  .check-values small { font-size: 5px; }
  .check-badge { font-size: 4px; padding: 2px 3px; }
}
@media (max-width: 390px) {
  .scene-panel { flex-basis: 38%; }
  .check-values strong { font-size: 6.5px; }
  .check-equation { font-size: 8px; }
}
/* Pair the changing explanation with its independent check in one compact panel. */
@media (min-width: 761px) {
  .caption-card { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.12fr); align-items: center; gap: 12px; }
  .caption-main { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
  .caption-card .check-card { min-width: 0; padding: 0 0 0 12px; border: 0; border-left: 1px solid var(--line); border-radius: 0; background: transparent; box-shadow: none; }
}
@media (max-width: 760px) {
  .caption-card { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; align-items: stretch; padding: 6px 7px; gap: 6px; }
  .caption-main { display: flex; align-items: flex-start; gap: 6px; min-width: 0; }
  .caption-card .check-card { grid-column: auto; display: block; min-width: 0; padding: 0 0 0 7px; border: 0; border-left: 1px solid var(--line); border-radius: 0; background: transparent; box-shadow: none; }
}
/* The expanded science drawer floats beside the canvas instead of squeezing the live layout. */
.science-panel[open] {
  position: fixed;
  z-index: 30;
  top: 78px;
  right: 20px;
  width: min(452px, calc(100vw - 40px));
  max-height: calc(100dvh - 110px);
  overflow: auto;
  box-shadow: 0 22px 70px rgba(0,0,0,.62);
  background: linear-gradient(145deg, rgba(17,29,44,.99), rgba(8,15,25,.99));
}
.science-panel[open] summary { position: sticky; top: 0; z-index: 2; background: #111d2c; }
@media (max-width: 760px) {
  .science-panel[open] {
    top: auto;
    left: 6px;
    right: 6px;
    bottom: 6px;
    width: auto;
    max-height: 34dvh;
  }
  .science-panel[open] .science-content { max-height: none; overflow: visible; }
}
