:root {
  color-scheme: dark;
  --bg: #090b13;
  --panel: #111522;
  --panel-2: #151b2b;
  --panel-3: #0d1220;
  --line: rgba(174, 190, 224, .12);
  --line-strong: rgba(174, 190, 224, .2);
  --text: #edf1fb;
  --muted: #8f9ab2;
  --muted-2: #68748d;
  --accent: #a78bfa;
  --accent-soft: rgba(167, 139, 250, .14);
  --accent-glow: rgba(167, 139, 250, .24);
  --good: #b5a2ff;
  --radius: 16px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; min-height: 100%; background: var(--bg); color: var(--text); }
body { overflow: hidden; }
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 { height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding: 16px 18px 14px; gap: 12px; max-width: 1800px; margin: 0 auto; }
.topbar { flex: 0 0 58px; display: flex; align-items: center; justify-content: space-between; padding: 0 5px; min-width: 0; }
.brand-lockup { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-glyph { width: 38px; height: 38px; border: 1px solid rgba(167,139,250,.4); border-radius: 50%; position: relative; display: grid; place-items: center; background: radial-gradient(circle at 50% 50%, rgba(167,139,250,.18), transparent 66%); flex: 0 0 auto; }
.brand-glyph:before { content: ""; width: 19px; height: 19px; border: 1px solid var(--accent); border-radius: 50%; transform: rotate(-26deg) scaleX(1.5); opacity: .9; }
.brand-glyph span { position: absolute; width: 7px; height: 7px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 12px var(--accent); }
.brand-glyph i { position: absolute; width: 5px; height: 5px; background: #e8e1ff; border-radius: 50%; right: 4px; top: 7px; }
.eyebrow { color: var(--muted); font-size: 9px; letter-spacing: .17em; font-weight: 750; line-height: 1.3; }
.eyebrow span { color: var(--accent); padding: 0 4px; }
.brand-copy h1 { font-size: 17px; letter-spacing: -.035em; margin: 3px 0 0; line-height: 1.1; font-weight: 690; }
.topbar-right { display: flex; align-items: center; gap: 13px; }
.model-pill, .run-state { font-family: var(--mono); font-size: 9px; letter-spacing: .08em; color: var(--muted); white-space: nowrap; }
.model-pill { border: 1px solid var(--line); border-radius: 30px; padding: 8px 11px; display: flex; align-items: center; gap: 8px; background: rgba(18,23,37,.72); }
.pulse-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.run-state { color: var(--accent); min-width: 52px; text-align: right; }
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(360px, .88fr); gap: 12px; }
.stage-panel, .control-panel { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(19,24,39,.97), rgba(12,16,27,.98)); min-width: 0; min-height: 0; }
.stage-panel { display: flex; flex-direction: column; padding: 17px 18px 12px; overflow: hidden; }
.stage-topline { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 2px 13px; }
.stage-heading { font-size: clamp(16px, 1.55vw, 21px); font-weight: 620; letter-spacing: -.04em; margin-top: 4px; }
.scale-chip { border: 1px solid var(--line); border-radius: 30px; padding: 7px 10px; color: #aab4c9; font-family: var(--mono); font-size: 8px; letter-spacing: .09em; white-space: nowrap; }
.chip-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin: 0 6px 1px 0; }
.canvas-frame { flex: 1 1 auto; min-height: 180px; position: relative; border: 1px solid rgba(150,165,201,.1); border-radius: 12px; overflow: hidden; background: radial-gradient(ellipse at 57% 50%, #11192a 0%, #0b101c 56%, #080b13 100%); }
#sceneCanvas { display: block; width: 100%; height: 100%; }
.canvas-corner { position: absolute; top: 13px; display: flex; flex-direction: column; gap: 4px; padding: 7px 9px; border: 1px solid rgba(166,181,215,.1); border-radius: 8px; background: rgba(8,11,19,.62); backdrop-filter: blur(8px); }
.canvas-corner-left { left: 13px; }
.canvas-corner-right { right: 13px; text-align: right; }
.micro-label { color: var(--muted-2); font-size: 8px; letter-spacing: .14em; font-weight: 750; }
.canvas-corner strong { color: #d9d2ff; font: 600 11px var(--mono); }
.canvas-legend { position: absolute; left: 14px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 13px; font-size: 9px; color: #a5afc5; background: rgba(8,11,19,.6); border: 1px solid rgba(166,181,215,.1); padding: 7px 10px; border-radius: 8px; backdrop-filter: blur(8px); }
.legend-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.primary-dot { background: #aeb8cb; }
.secondary-dot { background: var(--accent); box-shadow: 0 0 7px var(--accent); }
.legend-line { display: inline-block; width: 13px; height: 0; border-top: 1px dashed #8c80c5; margin-right: 5px; vertical-align: 3px; }
.stage-caption { flex: 0 0 auto; display: flex; gap: 11px; align-items: flex-start; padding: 13px 3px 9px; min-height: 69px; }
.caption-mark { width: 26px; height: 26px; flex: 0 0 auto; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); border: 1px solid rgba(167,139,250,.2); border-radius: 8px; font-size: 13px; }
.stage-caption p { margin: 4px 0 0; color: #c1c9da; font-size: 11px; line-height: 1.48; max-width: 780px; }
.stage-footer { flex: 0 0 auto; border-top: 1px solid var(--line); padding: 9px 2px 0; display: flex; justify-content: space-between; gap: 8px; color: var(--muted-2); font-size: 9px; line-height: 1.4; }
.footer-right { font-family: var(--mono); font-size: 8px; letter-spacing: .08em; white-space: nowrap; }
.footer-right b { color: var(--accent); font-weight: 600; }
.control-panel { overflow-y: auto; overscroll-behavior: contain; padding: 14px; scrollbar-width: thin; scrollbar-color: #343c53 transparent; }
.control-panel::-webkit-scrollbar { width: 5px; }
.control-panel::-webkit-scrollbar-thumb { background: #343c53; border-radius: 8px; }
.panel-section { padding-bottom: 13px; margin-bottom: 13px; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.section-heading h2 { margin: 0; font-size: 12px; font-weight: 650; letter-spacing: -.01em; }
.classification { color: #8c96ae; font: 700 7px var(--mono); letter-spacing: .09em; white-space: nowrap; }
.classification.textbook { color: #b8a9f8; }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.metric-card { min-width: 0; padding: 10px 11px 9px; border: 1px solid rgba(165,180,216,.1); border-radius: 10px; background: linear-gradient(145deg, rgba(26,33,52,.8), rgba(17,22,36,.7)); }
.metric-wide { grid-column: span 2; }
.metric-label { color: var(--muted); font-size: 9px; margin-bottom: 5px; }
.metric-value { color: #f0edff; font: 600 clamp(17px, 1.8vw, 22px) var(--mono); letter-spacing: -.06em; white-space: nowrap; }
.metric-value small { color: #aeb7ca; font-size: 10px; letter-spacing: 0; font-weight: 500; }
.metric-sub { color: var(--muted-2); font-size: 8px; margin-top: 4px; }
.torque-block { margin-top: 11px; }
.torque-heading { display: flex; justify-content: space-between; color: #aeb8cc; font-size: 9px; margin-bottom: 7px; }
.torque-row { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 9px; margin: 6px 0 4px; }
.torque-row strong { color: #e0d9ff; font: 600 9px var(--mono); }
.torque-track { height: 4px; background: #242b3d; border-radius: 5px; overflow: hidden; }
.torque-fill { height: 100%; width: 55%; border-radius: inherit; background: var(--accent); box-shadow: 0 0 9px var(--accent-glow); transition: width .2s ease; }
.tide-fill { opacity: .55; }
.clock-strip { display: flex; justify-content: space-between; gap: 8px; margin-top: 11px; color: var(--muted-2); font: 8px var(--mono); letter-spacing: .04em; }
.clock-strip b { color: #d6d0f5; font-weight: 600; margin-left: 4px; }
.controls-section { padding-bottom: 13px; }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.preset-button { min-height: 31px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line-strong); background: #141a29; color: #9da8bf; font-size: 9px; cursor: pointer; transition: background .18s ease, border-color .18s ease, color .18s ease; }
.preset-button:hover { border-color: rgba(167,139,250,.5); color: #e7e0ff; }
.preset-button.active { color: #e8e1ff; background: var(--accent-soft); border-color: rgba(167,139,250,.45); box-shadow: inset 0 0 0 1px rgba(167,139,250,.05); }
.control-item { margin: 10px 1px 12px; }
.control-label-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.control-label-line label { color: #c7cede; font-size: 9px; }
.control-label-line em { color: #e4ddff; font-style: italic; }
.control-label-line output { color: #e5ddff; font: 600 9px var(--mono); white-space: nowrap; }
input[type="range"] { display: block; width: 100%; height: 13px; margin: 0; appearance: none; background: transparent; cursor: pointer; accent-color: var(--accent); }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; background: linear-gradient(90deg, rgba(167,139,250,.55), #333a4d); border-radius: 4px; }
input[type="range"]::-moz-range-track { height: 3px; background: linear-gradient(90deg, rgba(167,139,250,.55), #333a4d); border-radius: 4px; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #d8ccff; border: 2px solid #8067d3; margin-top: -4.5px; box-shadow: 0 0 0 4px rgba(167,139,250,.12); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; background: #d8ccff; border: 2px solid #8067d3; box-shadow: 0 0 0 4px rgba(167,139,250,.12); }
.range-ends { display: flex; justify-content: space-between; color: #69758e; font: 7px var(--mono); margin-top: 2px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0 11px; }
.switch-label { display: inline-flex; align-items: center; gap: 8px; position: relative; color: #b9c2d4; font-size: 9px; cursor: pointer; }
.switch-label input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { width: 28px; height: 16px; border-radius: 20px; background: #333b50; border: 1px solid #47516a; position: relative; transition: background .18s ease; }
.switch:after { content: ""; width: 10px; height: 10px; position: absolute; left: 2px; top: 2px; border-radius: 50%; background: #9aa5bc; transition: transform .18s ease, background .18s ease; }
.switch-label input:checked + .switch { background: rgba(167,139,250,.35); border-color: rgba(167,139,250,.65); }
.switch-label input:checked + .switch:after { transform: translateX(12px); background: #e5dcff; }
.switch-label input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 3px; }
.quality-control { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 8px; }
.quality-button { border: 1px solid rgba(167,139,250,.35); color: #e2d9ff; background: var(--accent-soft); border-radius: 6px; padding: 5px 8px; font: 700 8px var(--mono); letter-spacing: .08em; cursor: pointer; }
.transport-row { display: grid; grid-template-columns: 1.1fr .9fr .9fr 34px; gap: 6px; }
.transport-row button { min-height: 34px; border-radius: 8px; font-size: 9px; cursor: pointer; transition: transform .16s ease, border-color .16s ease, background .16s ease; }
.transport-row button:active { transform: translateY(1px); }
.transport-primary { border: 1px solid rgba(167,139,250,.45); background: var(--accent); color: #151126; font-weight: 750; }
.transport-primary:hover { background: #b9a5ff; }
.transport-secondary, .capture-button { border: 1px solid var(--line-strong); background: #171d2d; color: #bdc6d8; }
.transport-secondary:hover, .capture-button:hover { border-color: rgba(167,139,250,.5); color: #f0eaff; }
.button-symbol { font-size: 12px; margin-right: 4px; vertical-align: -1px; }
.capture-button { font-size: 15px !important; color: var(--accent); }
.check-section { padding-bottom: 12px; }
.check-card { border: 1px solid rgba(167,139,250,.18); background: linear-gradient(145deg, rgba(167,139,250,.08), rgba(16,21,34,.65)); border-radius: 10px; padding: 10px 11px; }
.check-title { color: #d8d1ec; font-size: 9px; margin-bottom: 8px; }
.check-values { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check-values div { display: flex; flex-direction: column; gap: 4px; }
.check-values span { color: var(--muted-2); font-size: 8px; }
.check-values strong { color: #eee9ff; font: 600 12px var(--mono); }
.check-result { display: flex; align-items: center; gap: 6px; margin-top: 8px; color: #bcb1ec; font: 8px var(--mono); }
.check-indicator { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); flex: 0 0 auto; }
.check-note { color: var(--muted-2); font-size: 8px; line-height: 1.45; margin-top: 7px; }
.science-section { border: 1px solid var(--line); border-radius: 10px; background: rgba(15,20,33,.75); overflow: hidden; }
.science-section details { width: 100%; }
.science-section summary { min-height: 42px; display: flex; align-items: center; gap: 9px; padding: 0 11px; cursor: pointer; list-style: none; color: #d9dff0; font-size: 10px; font-weight: 620; }
.science-section summary::-webkit-details-marker { display: none; }
.science-icon { color: var(--accent); font-size: 15px; }
.summary-hint { margin-left: auto; color: var(--muted-2); font: 7px var(--mono); letter-spacing: .1em; }
.science-content { border-top: 1px solid var(--line); padding: 11px; color: #aeb9cd; font-size: 9px; line-height: 1.55; }
.science-content h3 { color: #e2e6f2; font-size: 10px; margin: 9px 0 5px; }
.science-content h3:first-child { margin-top: 0; }
.science-content p { margin: 5px 0 8px; }
.science-content b { color: #e3ddf8; }
.equation { color: #e2dcf7; background: rgba(167,139,250,.07); border-left: 2px solid rgba(167,139,250,.55); padding: 6px 8px; margin: 5px 0; font: 9px/1.55 var(--mono); overflow-wrap: anywhere; }
.science-content ul { padding-left: 16px; margin: 5px 0 9px; }
.science-content li { margin: 4px 0; }
.real-scaled-note { border: 1px solid rgba(167,139,250,.2); background: rgba(167,139,250,.07); padding: 8px 9px; border-radius: 7px; margin-top: 8px; }
.disclaimer { color: #8792aa; font-style: italic; font-size: 8px; margin-top: 10px !important; }
.panel-bottom-note { color: #68748b; font-size: 8px; text-align: center; padding: 10px 0 2px; }
.panel-bottom-note span { color: var(--accent); padding: 0 4px; }
@media (max-width: 900px) {
  .app-shell { padding: 10px; gap: 8px; }
  .workspace { grid-template-columns: minmax(0, 1.2fr) minmax(320px, .95fr); gap: 8px; }
  .stage-panel { padding: 13px 13px 10px; }
  .control-panel { padding: 11px; }
  .metric-value { font-size: 18px; }
}
@media (max-width: 700px) {
  .app-shell { padding: 8px; gap: 7px; }
  .topbar { flex-basis: 48px; padding: 0 3px; }
  .brand-glyph { width: 32px; height: 32px; }
  .brand-copy h1 { font-size: 14px; }
  .eyebrow { font-size: 8px; }
  .model-pill { padding: 6px 8px; font-size: 7px; }
  .run-state { font-size: 8px; min-width: 40px; }
  .topbar-right { gap: 7px; }
  .workspace { display: flex; flex-direction: column; gap: 7px; }
  .stage-panel { flex: 0 0 39%; min-height: 235px; padding: 10px 10px 8px; }
  .stage-topline { padding-bottom: 8px; }
  .stage-heading { font-size: 15px; }
  .scale-chip { font-size: 7px; padding: 6px 8px; }
  .canvas-frame { min-height: 120px; }
  .stage-caption { min-height: 54px; padding: 8px 1px 5px; gap: 8px; }
  .caption-mark { width: 22px; height: 22px; font-size: 11px; }
  .stage-caption p { font-size: 9px; line-height: 1.35; margin-top: 3px; }
  .stage-footer { font-size: 7px; padding-top: 6px; }
  .footer-right { font-size: 7px; }
  .canvas-corner { top: 7px; padding: 5px 7px; }
  .canvas-corner-left { left: 7px; }
  .canvas-corner-right { right: 7px; }
  .canvas-legend { left: 7px; bottom: 7px; gap: 8px; font-size: 7px; padding: 5px 7px; }
  .control-panel { flex: 1 1 0; min-height: 0; padding: 10px; }
  .metric-card { padding: 8px 9px; }
  .metric-value { font-size: 18px; }
  .metric-sub { font-size: 7px; }
  .panel-section { margin-bottom: 10px; padding-bottom: 10px; }
  .control-item { margin: 8px 1px 10px; }
}
@media (max-width: 390px) {
  .model-pill { font-size: 6px; letter-spacing: .04em; }
  .stage-panel { flex-basis: 37%; }
  .stage-footer { gap: 5px; }
  .footer-right { letter-spacing: .02em; }
  .metric-value { font-size: 16px; }
  .transport-row { grid-template-columns: 1fr 1fr 1fr 32px; }
  .transport-row button { font-size: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
