:root {
  color-scheme: dark;
  --bg: #080d18;
  --panel: #101827;
  --panel-2: #0d1522;
  --line: rgba(155, 180, 205, .13);
  --line-strong: rgba(155, 180, 205, .22);
  --text: #e7eff7;
  --muted: #8b9caf;
  --subtle: #5d7085;
  --accent: #70e0cf;
  --accent-soft: rgba(112, 224, 207, .12);
  --accent-glow: rgba(112, 224, 207, .28);
  --warm: #eabf83;
  --danger: #f08f83;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-height: 100vh; overflow: auto; }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { min-height: 100vh; max-width: 1920px; margin: 0 auto; display: flex; flex-direction: column; background: radial-gradient(ellipse at 30% -20%, rgba(37, 76, 95, .2), transparent 42%), var(--bg); }
body.embed-mode .app-shell { height: 100%; min-height: 0; }
.topbar { height: 68px; min-height: 68px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(8, 13, 24, .94); position: relative; z-index: 3; }
.brand-lockup { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border: 1px solid rgba(112,224,207,.36); border-radius: 50%; position: relative; display: grid; place-items: center; flex: 0 0 auto; box-shadow: 0 0 24px rgba(112,224,207,.08), inset 0 0 18px rgba(112,224,207,.08); }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; border: 1px solid rgba(112,224,207,.38); border-radius: 50%; transform: rotate(-34deg); width: 28px; height: 12px; }
.brand-mark::after { transform: rotate(54deg); width: 23px; height: 10px; border-color: rgba(112,224,207,.22); }
.brand-mark span { width: 3px; height: 3px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); position: absolute; }
.brand-mark span:nth-child(1) { transform: translate(10px,-7px); }
.brand-mark span:nth-child(2) { transform: translate(-9px,7px); opacity: .6; }
.eyebrow { color: #8fa2b7; font-size: 9px; letter-spacing: .19em; font-weight: 750; margin-bottom: 4px; white-space: nowrap; }
.eyebrow-dot { display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--accent); margin: 0 5px 2px; }
h1 { font-size: 15px; letter-spacing: -.02em; font-weight: 600; margin: 0; color: #eaf2f8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
h1 span { color: var(--accent); padding: 0 2px; }
.header-actions { display: flex; align-items: center; gap: 18px; }
.live-indicator { color: #91a5b9; font-size: 9px; font-weight: 750; letter-spacing: .14em; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 9px var(--accent-glow); }
.icon-button { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line-strong); background: #101a29; display: grid; place-items: center; cursor: pointer; transition: border-color .2s, background .2s, transform .2s; }
.icon-button:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
.icon-button svg { width: 17px; height: 17px; fill: none; stroke: #b6c8d8; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 356px; gap: 12px; padding: 12px; }
.visual-stack { min-width: 0; min-height: 0; display: grid; grid-template-rows: minmax(300px, 1.65fr) minmax(190px, .8fr); gap: 12px; }
.panel { background: linear-gradient(145deg, rgba(17, 27, 42, .98), rgba(12, 20, 33, .98)); border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 10px 32px rgba(0,0,0,.14); min-width: 0; }
.scene-card, .plot-card { min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.panel-topline { height: 43px; min-height: 43px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(155,180,205,.08); }
.section-label { font-size: 9px; letter-spacing: .16em; font-weight: 800; color: #a9bbcb; display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.section-index { color: var(--accent); font-variant-numeric: tabular-nums; font-size: 10px; }
.scene-tools { display: flex; align-items: center; gap: 14px; }
.scale-tag, .textbook-tag { font-size: 8px; letter-spacing: .12em; color: #8297ab; border: 1px solid rgba(155,180,205,.15); padding: 4px 6px; border-radius: 4px; white-space: nowrap; }
.toggle-control { display: flex; align-items: center; gap: 7px; font-size: 9px; color: #a7b8c8; cursor: pointer; user-select: none; }
.toggle-control input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-track { width: 23px; height: 13px; border-radius: 10px; background: #283648; border: 1px solid #405266; position: relative; transition: background .2s; }
.toggle-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 7px; height: 7px; border-radius: 50%; background: #93a5b6; transition: transform .2s, background .2s; }
.toggle-control input:checked + .toggle-track { background: rgba(112,224,207,.2); border-color: rgba(112,224,207,.55); }
.toggle-control input:checked + .toggle-track::after { transform: translateX(10px); background: var(--accent); }
.toggle-control input:focus-visible + .toggle-track { outline: 2px solid var(--accent); outline-offset: 3px; }
canvas { display: block; width: 100%; min-width: 0; }
#sceneCanvas { flex: 1; min-height: 0; }
.scene-footer { min-height: 46px; padding: 8px 16px 10px; display: flex; justify-content: space-between; align-items: center; gap: 18px; border-top: 1px solid rgba(155,180,205,.08); }
.scene-caption { color: #a8b9c9; font-size: 10px; line-height: 1.5; max-width: 62%; }
.scene-key { display: flex; align-items: center; gap: 12px; color: #7f92a6; font-size: 7px; letter-spacing: .1em; white-space: nowrap; }
.scene-key span { display: flex; align-items: center; gap: 5px; }
.scene-key i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; }
.key-star { background: #f2d6a1; box-shadow: 0 0 6px rgba(242,214,161,.6); }
.key-limb { background: #8293a9; }
.key-wave { background: var(--accent); box-shadow: 0 0 6px var(--accent-glow); }
.plot-heading { height: 39px; min-height: 39px; }
.plot-legend { display: flex; align-items: center; gap: 7px; font-size: 8px; letter-spacing: .1em; color: #8fa2b5; }
.legend-line { display: inline-block; width: 17px; height: 2px; background: var(--accent); box-shadow: 0 0 7px var(--accent-glow); }
#plotCanvas { flex: 1; min-height: 0; }
.plot-footer { height: 25px; min-height: 25px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border-top: 1px solid rgba(155,180,205,.07); font-size: 7px; color: #71859a; letter-spacing: .12em; }
.control-panel { min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #34475a transparent; padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.control-panel::-webkit-scrollbar { width: 5px; }
.control-panel::-webkit-scrollbar-thumb { background: #34475a; border-radius: 6px; }
.control-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.quality-switch { display: flex; border: 1px solid var(--line-strong); border-radius: 6px; padding: 2px; background: #0a1320; }
.quality-button { border: 0; border-radius: 4px; padding: 5px 7px; background: transparent; color: #71859a; font-size: 7px; letter-spacing: .1em; font-weight: 800; cursor: pointer; }
.quality-button.active { color: #071b1b; background: var(--accent); }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.preset-button { min-width: 0; min-height: 52px; border: 1px solid var(--line); background: rgba(7,14,24,.55); border-radius: 8px; padding: 7px 8px; display: flex; align-items: center; gap: 7px; text-align: left; cursor: pointer; transition: border-color .2s, background .2s; }
.preset-button:hover { border-color: rgba(112,224,207,.45); }
.preset-button.active { border-color: rgba(112,224,207,.55); background: rgba(112,224,207,.08); }
.preset-icon { font-size: 17px; color: var(--accent); width: 21px; text-align: center; flex: 0 0 auto; }
.soft-icon { color: var(--warm); }
.preset-button b { display: block; font-size: 9px; font-weight: 700; color: #dce7ef; white-space: nowrap; }
.preset-button small { display: block; font-size: 7px; color: #7f91a4; margin-top: 3px; white-space: nowrap; }
.controls-list { display: flex; flex-direction: column; gap: 12px; }
.control-group { min-width: 0; }
.control-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.control-title label { font-size: 10px; font-weight: 650; color: #c8d5e1; }
.value { font-size: 12px; color: var(--accent); font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.value small { font-size: 9px; color: #8ba5b4; font-weight: 600; }
input[type="range"] { width: 100%; margin: 0; height: 14px; appearance: none; background: transparent; cursor: pointer; display: block; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, rgba(112,224,207,.68), rgba(112,224,207,.22)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, rgba(112,224,207,.68), rgba(112,224,207,.22)); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 11px; height: 11px; border-radius: 50%; background: var(--accent); border: 2px solid #12222c; box-shadow: 0 0 0 1px var(--accent), 0 0 8px var(--accent-glow); margin-top: -4px; }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); border: 2px solid #12222c; box-shadow: 0 0 0 1px var(--accent), 0 0 8px var(--accent-glow); }
input[type="range"]:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.range-hints { display: flex; justify-content: space-between; color: #65798d; font-size: 7px; font-variant-numeric: tabular-nums; margin-top: 1px; }
.control-note { color: #71859a; font-size: 8px; line-height: 1.4; margin-top: 4px; }
.readout-block { border-top: 1px solid var(--line); padding-top: 13px; }
.readout-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.readout { min-width: 0; border: 1px solid rgba(155,180,205,.11); border-radius: 7px; padding: 8px 7px 7px; background: rgba(5,12,21,.34); }
.readout-name { display: block; font-size: 6px; letter-spacing: .12em; color: #8195a9; font-weight: 800; white-space: nowrap; }
.readout strong { display: block; font-size: 15px; color: #e5f4f0; margin-top: 5px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.readout strong small { font-size: 9px; color: var(--accent); font-weight: 600; }
.readout em { display: block; font-style: normal; color: #667d91; font-size: 6px; margin-top: 3px; }
.check-row { border: 1px solid rgba(112,224,207,.2); background: rgba(112,224,207,.045); border-radius: 7px; margin-top: 8px; padding: 8px; }
.check-heading { display: flex; align-items: center; gap: 6px; font-size: 7px; letter-spacing: .1em; color: #a8c0c6; font-weight: 800; }
.check-mark { color: var(--accent); font-size: 11px; }
.textbook-tag { margin-left: auto; padding: 3px 5px; color: var(--accent); border-color: rgba(112,224,207,.22); }
.check-result { display: flex; justify-content: space-between; gap: 4px; margin-top: 8px; color: #8297a9; font-size: 7px; font-variant-numeric: tabular-nums; }
.check-result b { color: #dbe8ec; font-weight: 700; }
.check-result strong { color: var(--accent); font-size: 8px; white-space: nowrap; }
.check-caption { color: #647d8e; font-size: 7px; margin-top: 5px; }
.playback-block { border-top: 1px solid var(--line); padding-top: 12px; }
.playback-controls { display: flex; align-items: center; gap: 6px; margin-top: 9px; }
.play-button { height: 31px; border: 1px solid rgba(112,224,207,.4); border-radius: 6px; background: rgba(112,224,207,.12); color: var(--accent); padding: 0 10px; display: flex; align-items: center; gap: 7px; cursor: pointer; font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.play-button:hover { background: rgba(112,224,207,.2); }
#playGlyph { font-size: 12px; }
.transport-button { width: 31px; height: 31px; border: 1px solid var(--line-strong); border-radius: 6px; background: #101b2a; color: #9db0c1; font-size: 16px; cursor: pointer; }
.transport-button:hover { color: var(--accent); border-color: var(--accent); }
.playback-speed { margin-left: auto; text-align: right; }
.playback-speed label { display: block; font-size: 6px; color: #73879b; letter-spacing: .12em; }
.playback-speed span { color: #d6e4e9; font-size: 11px; font-weight: 700; }
#timeScale { margin-top: 7px; }
.what-seeing { border-left: 2px solid var(--accent); padding: 8px 10px; background: rgba(112,224,207,.045); border-radius: 0 7px 7px 0; }
.what-title { display: flex; align-items: center; gap: 7px; font-size: 7px; letter-spacing: .13em; color: var(--accent); font-weight: 850; }
.what-pulse { width: 5px; height: 5px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 7px var(--accent); }
.what-seeing p { color: #9aabba; font-size: 9px; line-height: 1.55; margin: 6px 0 0; }
.science-panel { border: 1px solid var(--line); border-radius: 7px; background: rgba(5,12,21,.3); }
.science-panel summary { min-height: 36px; padding: 0 10px; display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; font-size: 8px; color: #aebdca; font-weight: 800; letter-spacing: .13em; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-icon { color: var(--accent); font-size: 14px; }
.summary-chevron { margin-left: auto; color: #8296a8; font-size: 15px; transition: transform .2s; }
.science-panel[open] .summary-chevron { transform: rotate(180deg); }
.science-content { border-top: 1px solid var(--line); padding: 10px; }
.science-content h3 { color: #d5e2e9; font-size: 9px; margin: 9px 0 6px; }
.science-content h3:first-child { margin-top: 0; }
.science-content p { color: #8fa2b4; font-size: 8px; line-height: 1.6; margin: 5px 0 9px; }
.equation { border: 1px solid rgba(112,224,207,.15); background: rgba(112,224,207,.045); color: #bceee4; padding: 8px; border-radius: 5px; font-family: Georgia, serif; font-size: 12px; letter-spacing: .02em; text-align: center; }
.science-content .disclaimer { color: #9ab0bd; font-style: italic; padding-top: 7px; border-top: 1px solid var(--line); }
.panel-bottom { display: flex; justify-content: space-between; gap: 6px; color: #5e7388; font-size: 6px; letter-spacing: .1em; margin-top: auto; padding-top: 5px; }
.panel-bottom b { color: #89a1b1; font-weight: 800; }
button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (min-width: 1500px) { .workspace { grid-template-columns: minmax(0, 1fr) 380px; } .control-panel { padding: 17px; gap: 16px; } .controls-list { gap: 15px; } }
@media (max-width: 980px) and (min-width: 701px) { .workspace { grid-template-columns: minmax(0, 1fr) 320px; gap: 9px; padding: 9px; } .control-panel { padding: 11px; } .scene-key { gap: 7px; } .scene-caption { max-width: 56%; } }
@media (max-width: 700px) {
  body { min-height: 100vh; }
  .topbar { height: 58px; min-height: 58px; padding: 0 12px; }
  .brand-lockup { gap: 9px; }
  .brand-mark { width: 29px; height: 29px; }
  .eyebrow { font-size: 7px; letter-spacing: .15em; }
  h1 { font-size: 12px; max-width: 250px; }
  .header-actions { gap: 10px; }
  .live-indicator { font-size: 7px; gap: 5px; }
  .icon-button { width: 30px; height: 30px; }
  .workspace { display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: 435px minmax(0,1fr); gap: 9px; padding: 9px; overflow: hidden; }
  .visual-stack { grid-template-rows: 255px 171px; gap: 9px; }
  .panel { border-radius: 10px; }
  .panel-topline { height: 34px; min-height: 34px; padding: 0 10px; }
  .section-label { font-size: 8px; gap: 6px; }
  .scale-tag { font-size: 6px; padding: 3px 4px; }
  .scene-tools { gap: 9px; }
  .scene-footer { min-height: 41px; padding: 6px 10px; }
  .scene-caption { max-width: 100%; font-size: 8px; line-height: 1.35; }
  .scene-key { display: none; }
  .plot-heading { height: 31px; min-height: 31px; }
  .plot-legend { font-size: 6px; gap: 4px; }
  .plot-legend .scale-tag { display: none; }
  .plot-footer { height: 21px; min-height: 21px; padding: 0 10px; font-size: 6px; }
  .control-panel { padding: 12px; gap: 12px; overflow-y: auto; overscroll-behavior: contain; }
  .preset-button { min-height: 48px; }
  .controls-list { gap: 12px; }
  .control-title label { font-size: 10px; }
  .control-note { font-size: 8px; }
  .readout-grid { gap: 5px; }
  .readout { padding: 8px 6px; }
  .readout-name { font-size: 6px; }
  .readout strong { font-size: 14px; }
  .panel-bottom { padding-bottom: 3px; }
}
@media (max-width: 380px) {
  .workspace { grid-template-rows: 414px minmax(0,1fr); }
  .visual-stack { grid-template-rows: 240px 165px; }
  h1 { max-width: 210px; font-size: 11px; }
  .live-indicator { display: none; }
  .preset-button { padding: 6px; gap: 4px; }
  .preset-button b { font-size: 8px; }
  .preset-button small { font-size: 6px; }
  .readout strong { font-size: 12px; }
  .check-result { font-size: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
