:root {
  color-scheme: dark;
  --bg: #090f16;
  --panel: #101923;
  --panel-2: #131f2a;
  --line: #263441;
  --line-soft: rgba(126, 153, 174, .15);
  --text: #e8eff3;
  --muted: #91a2ae;
  --dim: #647683;
  --accent: #76e4d2;
  --accent-soft: rgba(118, 228, 210, .12);
  --white-soft: rgba(235, 244, 248, .8);
  --radius: 14px;
  --space: 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: 0; background: var(--bg); color: var(--text); }
body { min-height: 100vh; overflow-x: 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 { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(ellipse at 38% 0%, rgba(35, 65, 79, .17), transparent 42%), var(--bg); }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
body.embed-mode .app-shell { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }

.topbar { height: 68px; flex: 0 0 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; border-bottom: 1px solid var(--line-soft); background: rgba(8, 14, 21, .82); }
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; color: var(--accent); border: 1px solid rgba(118, 228, 210, .24); border-radius: 11px; background: var(--accent-soft); }
.brand-mark svg { width: 30px; height: 30px; }
.eyebrow { color: var(--dim); font-size: 9px; line-height: 1.3; font-weight: 800; letter-spacing: .17em; }
.brand-title { margin-top: 2px; font-size: 14px; font-weight: 800; letter-spacing: .14em; }
.topbar-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(118, 228, 210, .55); }
.topbar-divider { height: 15px; width: 1px; background: var(--line); margin: 0 5px; }
.topbar-subtitle { color: var(--dim); }

.workspace { width: 100%; max-width: 1680px; margin: 0 auto; padding: 18px 20px 20px; display: grid; grid-template-columns: minmax(0, 1fr) 356px; gap: 16px; flex: 1; min-height: 0; }
.visual-column { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.stage-card, .readout-card, .panel-section, .science-panel { background: linear-gradient(155deg, rgba(20, 31, 42, .98), rgba(13, 22, 31, .98)); border: 1px solid var(--line-soft); border-radius: var(--radius); }
.stage-card { flex: 1 1 auto; min-height: 300px; display: flex; flex-direction: column; overflow: hidden; }
.stage-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 17px 20px 13px; }
.stage-heading h1 { margin: 4px 0 0; font-size: clamp(17px, 1.7vw, 22px); letter-spacing: -.035em; font-weight: 650; }
.view-chip { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; border: 1px solid var(--line); color: var(--muted); padding: 7px 10px; border-radius: 7px; font-size: 9px; letter-spacing: .12em; font-weight: 800; }
.chip-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.stage-wrap { position: relative; flex: 1 1 auto; min-height: 190px; margin: 0 10px; overflow: hidden; border: 1px solid rgba(110, 140, 158, .14); border-radius: 10px; background: #08111a; }
#spaceCanvas { width: 100%; height: 100%; display: block; touch-action: pan-y; }
.canvas-label { position: absolute; top: 13px; color: rgba(174, 193, 204, .56); font-size: 8px; font-weight: 800; letter-spacing: .18em; pointer-events: none; }
.canvas-label-left { left: 14px; }
.canvas-label-right { right: 14px; }
.canvas-status { position: absolute; right: 13px; bottom: 12px; border: 1px solid rgba(118, 228, 210, .22); border-radius: 5px; padding: 6px 8px; color: var(--accent); background: rgba(8, 17, 26, .75); font-size: 8px; font-weight: 800; letter-spacing: .13em; pointer-events: none; }
.stage-footer { min-height: 62px; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 11px 19px 13px; }
.stage-footer p { max-width: 62%; margin: 0; color: #b3c1c9; font-size: 11px; line-height: 1.5; }
.stage-footer-meta { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }
.footer-key { display: inline-flex; align-items: center; gap: 5px; color: var(--dim); font-size: 8px; font-weight: 800; letter-spacing: .1em; white-space: nowrap; }
.key-dot { width: 6px; height: 6px; display: inline-block; border-radius: 50%; }
.primary-key { background: #b6c2c9; }
.secondary-key { background: var(--accent); }
.key-line { width: 12px; height: 1px; display: inline-block; border-top: 1px dashed var(--accent); }
.key-arrow { position: relative; width: 12px; height: 1px; display: inline-block; background: var(--accent); }
.key-arrow::after { content: ""; position: absolute; right: 0; top: -2px; width: 4px; height: 4px; border-top: 1px solid var(--accent); border-right: 1px solid var(--accent); transform: rotate(45deg); }

.readout-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; flex: 0 0 auto; }
.readout-card { min-width: 0; padding: 12px 13px 11px; }
.readout-label { min-height: 23px; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; color: var(--muted); font-size: 8px; line-height: 1.35; font-weight: 800; letter-spacing: .09em; }
.microtag { display: inline-block; color: #738894; font-size: 7px; font-weight: 800; letter-spacing: .1em; white-space: nowrap; }
.readout-value { margin-top: 3px; color: var(--text); font-size: clamp(18px, 2vw, 25px); line-height: 1.15; font-weight: 650; letter-spacing: -.04em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.readout-value small { color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: 0; }
.readout-foot { margin-top: 5px; color: var(--dim); font-size: 9px; line-height: 1.3; }

.control-column { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #30414e transparent; display: flex; flex-direction: column; gap: 10px; padding-right: 2px; }
.panel-section { padding: 16px; }
.panel-heading-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel-heading-row h2, .reality-section h2 { margin: 3px 0 0; font-size: 16px; font-weight: 650; letter-spacing: -.025em; }
.screenshot-button { padding: 7px 9px; }
.quality-button { border: 1px solid rgba(118, 228, 210, .28); background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 7px 9px; font-size: 8px; font-weight: 850; letter-spacing: .12em; cursor: pointer; }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 15px 0 17px; }
.preset-button { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 9px 8px; border: 1px solid var(--line); border-radius: 8px; background: rgba(8, 15, 22, .48); text-align: left; cursor: pointer; transition: border-color .18s ease, background .18s ease; }
.preset-button:hover { border-color: rgba(118, 228, 210, .38); }
.preset-button.active { border-color: rgba(118, 228, 210, .56); background: var(--accent-soft); }
.preset-symbol { width: 22px; height: 22px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 6px; background: rgba(118, 228, 210, .1); color: var(--accent); font-size: 15px; }
.preset-button b { display: block; font-size: 10px; font-weight: 700; }
.preset-button small { display: block; margin-top: 2px; color: var(--dim); font-size: 8px; }
.control-list { display: flex; flex-direction: column; gap: 14px; }
.control-block { min-width: 0; }
.control-topline { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.control-topline label { color: #c4d0d6; font-size: 10px; font-weight: 650; }
.control-topline output { color: var(--text); font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { display: block; width: 100%; height: 16px; margin: 6px 0 0; appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer; touch-action: pan-y; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(90deg, rgba(118, 228, 210, .72), rgba(118, 228, 210, .22)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 3px; background: linear-gradient(90deg, rgba(118, 228, 210, .72), rgba(118, 228, 210, .22)); }
input[type="range"]::-webkit-slider-thumb { width: 12px; height: 12px; margin-top: -4.5px; appearance: none; -webkit-appearance: none; border: 2px solid var(--accent); border-radius: 50%; background: #0d1a23; box-shadow: 0 0 0 3px rgba(118, 228, 210, .1); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid var(--accent); border-radius: 50%; background: #0d1a23; box-shadow: 0 0 0 3px rgba(118, 228, 210, .1); }
.control-scale { display: flex; justify-content: space-between; align-items: center; margin-top: 1px; color: #60727e; font-size: 7px; font-weight: 750; letter-spacing: .08em; }
.divider { height: 1px; margin: 16px 0 13px; background: var(--line-soft); }
.time-control { margin-bottom: 13px; }
.toggle-row { padding: 10px 0 12px; border-top: 1px solid var(--line-soft); }
.switch-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: relative; cursor: pointer; }
.switch-label b { display: block; color: #c4d0d6; font-size: 10px; font-weight: 650; }
.switch-label small { display: block; margin-top: 3px; color: var(--dim); font-size: 8px; }
.switch-label input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch-ui { width: 32px; height: 18px; flex: 0 0 auto; border: 1px solid #40515d; border-radius: 20px; background: #1b2934; transition: background .18s ease, border-color .18s ease; }
.switch-ui::after { content: ""; display: block; width: 12px; height: 12px; margin: 2px; border-radius: 50%; background: #8b9aa3; transition: transform .18s ease, background .18s ease; }
.switch-label input:checked + .switch-ui { border-color: rgba(118, 228, 210, .55); background: rgba(118, 228, 210, .22); }
.switch-label input:checked + .switch-ui::after { transform: translateX(14px); background: var(--accent); }
.switch-label input:focus-visible + .switch-ui { outline: 2px solid var(--accent); outline-offset: 3px; }
.transport-row { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 7px; }
.transport-button { min-height: 34px; border: 1px solid var(--line); border-radius: 7px; background: rgba(8, 15, 22, .55); color: #aab9c2; font-size: 8px; font-weight: 850; letter-spacing: .1em; cursor: pointer; transition: background .16s ease, border-color .16s ease, color .16s ease; }
.transport-button:hover { border-color: rgba(118, 228, 210, .42); color: var(--text); }
.transport-button.primary-action { border-color: rgba(118, 228, 210, .35); background: var(--accent); color: #08201e; }
.transport-button.primary-action:hover { background: #9af1e4; }
.transport-button span { margin-left: 4px; }
.elapsed-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; color: var(--dim); font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.elapsed-row strong { color: #c9d5da; font-size: 10px; font-weight: 650; letter-spacing: 0; font-variant-numeric: tabular-nums; }

.reality-section { padding: 14px 16px 15px; }
.reality-section h2 { margin-top: 4px; }
.reality-section p { margin: 8px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.live-check { margin-top: 10px; }
.science-panel { overflow: hidden; }
.science-panel summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; list-style: none; cursor: pointer; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary b { display: block; margin-top: 3px; font-size: 12px; font-weight: 700; }
.summary-plus { color: var(--accent); font-size: 19px; line-height: 1; transition: transform .18s ease; }
.science-panel[open] .summary-plus { transform: rotate(45deg); }
.science-content { padding: 0 16px 15px; border-top: 1px solid var(--line-soft); }
.science-content h3 { margin: 13px 0 7px; color: #cbd6dc; font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.science-content p, .science-content li { color: var(--muted); font-size: 9px; line-height: 1.55; }
.science-content p { margin: 6px 0; }
.equation { padding: 6px 8px; border-left: 2px solid rgba(118, 228, 210, .5); background: rgba(6, 14, 21, .42); color: #d5e1e5 !important; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 9px !important; }
.constant-note { display: flex; flex-direction: column; gap: 3px; margin-top: 9px; padding: 8px; border: 1px solid var(--line-soft); border-radius: 7px; }
.constant-note b { color: #cbd6dc; font-size: 8px; letter-spacing: .08em; text-transform: uppercase; }
.constant-note span { color: var(--muted); font-size: 8px; line-height: 1.5; }
.check-card { margin-top: 8px; padding: 9px; border: 1px solid rgba(118, 228, 210, .22); border-radius: 8px; background: rgba(118, 228, 210, .06); }
.check-card > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.check-card span { color: #b9c8ce; font-size: 9px; }
.check-card strong { color: var(--accent); font-size: 12px; font-variant-numeric: tabular-nums; }
.check-card small { display: block; margin-top: 5px; color: var(--dim); font-size: 8px; line-height: 1.4; }
.science-content ul { margin: 6px 0 0; padding-left: 15px; }
.science-content li { margin: 4px 0; }
.disclaimer { margin-top: 12px !important; padding-top: 9px; border-top: 1px solid var(--line-soft); color: #9baeb7 !important; font-style: italic; }

@media (min-width: 1500px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 380px; padding-left: 26px; padding-right: 26px; }
}

@media (max-width: 1050px) and (min-width: 701px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 320px; padding: 14px; gap: 12px; }
  .readout-card { padding: 10px; }
  .readout-label { font-size: 7px; }
  .stage-footer-meta { gap: 8px; }
}

@media (max-width: 700px) {
  .topbar { height: 54px; flex-basis: 54px; padding: 0 13px; }
  .brand-mark { width: 32px; height: 32px; border-radius: 9px; }
  .brand-mark svg { width: 25px; height: 25px; }
  .brand-lockup { gap: 9px; }
  .eyebrow { font-size: 8px; }
  .brand-title { font-size: 12px; }
  .topbar-meta { gap: 7px; font-size: 8px; }
  .topbar-subtitle, .topbar-divider { display: none; }
  .workspace { display: flex; flex-direction: column; gap: 9px; padding: 9px 9px 10px; flex: 1; min-height: 0; overflow: hidden; }
  .visual-column { flex: 0 0 49%; min-height: 0; gap: 7px; }
  .stage-card { min-height: 0; flex: 1 1 auto; }
  .stage-heading { padding: 9px 11px 7px; }
  .stage-heading h1 { font-size: 15px; }
  .view-chip { padding: 5px 7px; font-size: 7px; }
  .screenshot-button { padding: 5px 7px; font-size: 6px; }
  .stage-wrap { min-height: 0; margin: 0 6px; border-radius: 8px; }
  .canvas-label { top: 8px; font-size: 6px; }
  .canvas-label-left { left: 8px; }
  .canvas-label-right { right: 8px; }
  .canvas-status { right: 7px; bottom: 7px; padding: 4px 6px; font-size: 6px; }
  .stage-footer { min-height: 43px; padding: 6px 10px 7px; }
  .stage-footer p { max-width: 100%; font-size: 8px; line-height: 1.35; }
  .stage-footer-meta { display: none; }
  .readout-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .readout-card { padding: 6px 6px 5px; border-radius: 8px; }
  .readout-label { min-height: 18px; gap: 2px; font-size: 6px; letter-spacing: .04em; }
  .microtag { font-size: 5px; }
  .readout-value { margin-top: 2px; font-size: clamp(13px, 4vw, 17px); }
  .readout-value small { font-size: 7px; }
  .readout-foot { margin-top: 2px; font-size: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .control-column { flex: 1 1 0; min-height: 0; overflow-y: auto; padding-right: 0; gap: 8px; }
  .panel-section { padding: 12px; border-radius: 11px; }
  .panel-heading-row h2, .reality-section h2 { font-size: 14px; }
  .quality-button { padding: 6px 8px; }
  .preset-row { margin: 10px 0 12px; }
  .preset-button { padding: 7px; }
  .preset-symbol { width: 20px; height: 20px; }
  .control-list { gap: 10px; }
  .control-topline label { font-size: 9px; }
  .control-topline output { font-size: 9px; }
  input[type="range"] { margin-top: 4px; height: 14px; }
  .control-scale { font-size: 6px; }
  .divider { margin: 11px 0 9px; }
  .time-control { margin-bottom: 8px; }
  .toggle-row { padding: 8px 0 9px; }
  .transport-button { min-height: 32px; font-size: 7px; }
  .elapsed-row { margin-top: 8px; font-size: 7px; }
  .reality-section { padding: 11px 12px; }
  .reality-section p { font-size: 9px; }
  .science-panel summary { padding: 11px 12px; }
  .science-content { padding: 0 12px 12px; }
}

@media (max-width: 380px) {
  .visual-column { flex-basis: 47%; }
  .readout-label { font-size: 5.5px; }
  .readout-value { font-size: 12px; }
  .readout-value small { font-size: 6px; }
  .readout-foot { display: none; }
  .preset-button b { font-size: 9px; }
  .preset-button small { font-size: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
