:root {
  color-scheme: dark;
  --bg: #0b1117;
  --panel: #111a22;
  --panel-2: #15212b;
  --line: #293743;
  --line-soft: #202d37;
  --text: #e7eef2;
  --muted: #9aabb6;
  --dim: #6e818e;
  --accent: #62d5c4;
  --accent-soft: rgba(98, 213, 196, .13);
  --accent-line: rgba(98, 213, 196, .45);
  --radius: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); }
body { overflow-x: hidden; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { height: 100vh; min-height: 0; display: grid; grid-template-rows: 56px minmax(0, 1fr) 28px; background: radial-gradient(ellipse at 18% 0%, rgba(35, 69, 77, .22), transparent 36%), var(--bg); }
.brandbar { display: flex; align-items: center; gap: 12px; padding: 0 24px; border-bottom: 1px solid var(--line-soft); background: rgba(9, 15, 20, .92); }
.brandmark { width: 22px; height: 22px; display: flex; align-items: flex-end; gap: 3px; padding: 3px; border: 1px solid var(--accent-line); border-radius: 6px; }
.brandmark span { display: block; width: 3px; border-radius: 2px; background: var(--accent); }
.brandmark span:nth-child(1) { height: 7px; opacity: .65; }
.brandmark span:nth-child(2) { height: 12px; }
.brandmark span:nth-child(3) { height: 9px; opacity: .8; }
.brand-copy { display: flex; flex-direction: column; gap: 1px; line-height: 1.1; }
.brand-copy strong { font-size: 10px; letter-spacing: .18em; }
.brand-copy span { color: var(--muted); font-size: 10px; }
.brand-meta { margin-left: auto; display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 9px; letter-spacing: .13em; }
.live-dot, .phase-dot { width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(98,213,196,.55); }
.meta-divider { color: #43535e; }
.workspace { min-height: 0; display: grid; grid-template-columns: minmax(0, 1.56fr) minmax(360px, .94fr); gap: 1px; background: var(--line-soft); }
.stage-panel { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(250px, 1fr) auto; padding: 20px 22px 16px; background: #0d151c; }
.stage-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 2px 14px; }
.eyebrow { margin: 0 0 6px; color: var(--accent); font-size: 9px; font-weight: 700; letter-spacing: .17em; }
.eyebrow span { color: #52636d; padding: 0 4px; }
h1 { margin: 0; max-width: 760px; font-size: clamp(19px, 2vw, 27px); line-height: 1.16; letter-spacing: -.035em; font-weight: 640; }
.phase-pill { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 99px; color: #b7c5cd; background: #111c24; font-size: 10px; white-space: nowrap; }
.phase-pill.is-warning { border-color: var(--accent-line); color: var(--accent); }
.canvas-wrap { position: relative; min-width: 0; min-height: 0; overflow: hidden; border: 1px solid #2a3943; border-radius: 14px; background: #0b141b; box-shadow: inset 0 0 50px rgba(0,0,0,.24), 0 12px 36px rgba(0,0,0,.12); }
#scene { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
#scene.dragging { cursor: grabbing; }
.scale-note { margin: -5px 0 7px; color: #778b96; font-size: 7px; letter-spacing: .12em; }
.stage-foot { padding: 12px 2px 0; }
.what-seeing { min-height: 32px; margin: 0 0 10px; max-width: 920px; color: #c5d1d7; font-size: 12px; line-height: 1.45; }
.readout-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.readout { min-width: 0; padding: 9px 10px 8px; border: 1px solid var(--line-soft); border-radius: 9px; background: rgba(19, 31, 40, .72); }
.readout > span { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; color: var(--muted); font-size: 8px; letter-spacing: .09em; line-height: 1.25; }
.readout i { color: #70828d; font-size: 7px; font-style: normal; letter-spacing: .07em; }
.readout strong { display: block; margin-top: 5px; font-size: 18px; font-weight: 620; letter-spacing: -.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.readout strong small { color: #a8bac4; font-size: 10px; font-weight: 500; letter-spacing: 0; }
.control-panel { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 18px 14px; background: #101820; scrollbar-width: thin; scrollbar-color: #344550 transparent; }
.panel-section { padding-bottom: 16px; margin-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 11px; }
h2 { margin: 0; font-size: 12px; font-weight: 650; letter-spacing: .015em; }
.tiny-tag { color: var(--dim); font-size: 8px; letter-spacing: .14em; white-space: nowrap; }
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.preset { min-width: 0; padding: 9px 10px 8px; text-align: left; border: 1px solid var(--line); border-radius: 9px; background: #121e27; cursor: pointer; transition: border-color .16s ease, background .16s ease, transform .16s ease; }
.preset:hover { border-color: #536a75; transform: translateY(-1px); }
.preset.active { border-color: var(--accent-line); background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(98,213,196,.06); }
.preset strong { display: block; margin-bottom: 4px; font-size: 10px; font-weight: 650; }
.preset span { display: block; color: var(--muted); font-size: 8px; line-height: 1.35; }
.controls-section { padding-bottom: 14px; }
.control-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; row-gap: 13px; }
.control { display: block; min-width: 0; }
.control-top { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; margin-bottom: 7px; color: #c6d2d8; font-size: 10px; }
.control-top output { color: var(--accent); font-size: 9px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
input[type="range"] { display: block; width: 100%; height: 13px; margin: 0; accent-color: var(--accent); cursor: pointer; background: transparent; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: #344650; }
input[type="range"]::-webkit-slider-thumb { width: 12px; height: 12px; margin-top: -4.5px; appearance: none; border: 2px solid #0d171e; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--accent-line); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 3px; background: #344650; }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid #0d171e; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--accent-line); }
.range-ends { display: flex; justify-content: space-between; color: #71838e; font-size: 8px; margin-top: 2px; }
.transport-section { padding: 0 0 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.sequence-bar { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 8px; letter-spacing: .1em; }
#timeText { color: #82949e; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.timeline { position: relative; height: 4px; margin: 9px 2px 11px; border-radius: 5px; background: #2c3a44; }
.timeline > span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); box-shadow: 0 0 10px rgba(98,213,196,.3); }
.timeline .tick { position: absolute; top: -3px; width: 1px; height: 10px; background: #82949e; opacity: .7; }
.tick-one { left: 37.5%; } .tick-two { left: 75%; } .tick-three { right: 0; }
.transport-buttons { display: grid; grid-template-columns: minmax(0, 1fr) auto 34px; gap: 7px; }
.primary-button, .secondary-button, .icon-button, .experiment-button, .quality-button { border-radius: 8px; cursor: pointer; transition: background .15s ease, border-color .15s ease, transform .15s ease; }
.primary-button { min-height: 34px; padding: 0 12px; border: 1px solid var(--accent-line); background: var(--accent-soft); color: #d8f5ef; font-size: 10px; font-weight: 650; }
.primary-button:hover, .experiment-button:hover { background: rgba(98,213,196,.2); }
.play-icon { margin-right: 5px; font-size: 9px; }
.secondary-button { min-height: 34px; padding: 0 10px; border: 1px solid var(--line); background: #15212a; color: #c6d2d8; font-size: 9px; }
.secondary-button:hover, .icon-button:hover { border-color: #607580; }
.icon-button { min-height: 34px; border: 1px solid var(--line); background: #15212a; color: #c6d2d8; font-size: 18px; }
.experiment-card, .checks-card { padding: 13px 13px 12px; margin-bottom: 13px; border: 1px solid var(--line); border-radius: 11px; background: #121e27; }
.experiment-head { display: flex; align-items: flex-start; gap: 9px; }
.experiment-icon { display: grid; place-items: center; flex: 0 0 25px; width: 25px; height: 25px; border-radius: 7px; color: var(--accent); background: var(--accent-soft); font-size: 16px; }
.experiment-head h2 { margin: 1px 0 4px; }
.experiment-head p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.4; }
.experiment-button { width: 100%; display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding: 8px 10px; border: 1px solid var(--accent-line); background: rgba(98,213,196,.1); color: #d8f5ef; font-size: 9px; font-weight: 650; text-align: left; }
.experiment-button span { font-size: 14px; }
.experiment-result { min-height: 25px; padding-top: 8px; color: #94a8b3; font-size: 9px; line-height: 1.45; }
.experiment-result strong { color: var(--accent); font-weight: 650; }
.checks-card { padding-bottom: 9px; }
.checks-card .section-title-row { margin-bottom: 8px; }
.check-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 0; border-top: 1px solid rgba(45,61,72,.55); color: #c1cdd3; font-size: 9px; }
.check-row span { min-width: 0; }
.check-row b { margin-right: 7px; color: #70848f; font-size: 8px; font-weight: 600; }
.check-row strong { color: var(--accent); font-size: 9px; font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.checks-note { margin: 6px 0 0; color: #778b96; font-size: 8px; line-height: 1.45; }
.science-panel { margin: 0 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #0e171e; }
.science-panel summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 12px; cursor: pointer; list-style: none; font-size: 11px; font-weight: 650; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary::after { content: "+"; color: var(--accent); font-size: 17px; font-weight: 400; }
.science-panel[open] summary::after { content: "−"; }
.summary-hint { margin-left: auto; color: #71848f; font-size: 7px; letter-spacing: .12em; font-weight: 500; }
.science-content { padding: 0 12px 13px; border-top: 1px solid var(--line-soft); }
.science-content h3 { margin: 12px 0 5px; color: #dce7eb; font-size: 10px; }
.science-content p { margin: 0 0 7px; color: #9eafb8; font-size: 9px; line-height: 1.55; }
.science-content .equation { padding: 8px 10px; border-left: 2px solid var(--accent); background: #14212a; color: #d4e3e8; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; line-height: 1.7; }
.not-affiliated { color: #7d909a !important; font-style: italic; }
.quality-row { display: flex; align-items: center; gap: 8px; padding: 3px 1px 2px; color: #81939e; font-size: 8px; letter-spacing: .12em; }
.quality-button { padding: 5px 8px; border: 1px solid var(--line); background: #15212a; color: var(--accent); font-size: 8px; letter-spacing: .08em; }
.quality-button span { margin-left: 5px; color: #81939e; }
.quality-note { margin-left: auto; color: #71838d; font-size: 8px; letter-spacing: 0; }
.page-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 24px; border-top: 1px solid var(--line-soft); color: #70828d; background: #0a1015; font-size: 8px; letter-spacing: .08em; }
.page-footer span:last-child { letter-spacing: 0; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
body.embed-mode .app-shell { height: 100%; min-height: 0; grid-template-rows: minmax(0, 1fr); }
body.embed-mode .brandbar, body.embed-mode .page-footer { display: none; }
body.embed-mode .workspace { height: 100%; grid-template-rows: minmax(0, 1fr); }
body.embed-mode .stage-panel { padding: 15px 16px 12px; }
body.embed-mode .control-panel { padding-top: 14px; }

@media (max-width: 900px) {
  .app-shell { grid-template-rows: 52px minmax(0, 1fr) 28px; }
  .workspace { grid-template-columns: minmax(0, 1.2fr) minmax(330px, .95fr); }
  .stage-panel { padding: 16px 14px 12px; }
  .control-panel { padding: 14px 13px; }
  .readout-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .readout { padding: 7px 8px; }
  .readout strong { font-size: 16px; }
}
@media (max-width: 680px) {
  .app-shell { display: block; height: auto; min-height: 100vh; }
  .brandbar { height: 48px; padding: 0 14px; }
  .brand-meta { font-size: 8px; gap: 6px; }
  .workspace { display: block; }
  .stage-panel { min-height: 560px; padding: 14px 12px 12px; grid-template-rows: auto minmax(280px, 1fr) auto; }
  .stage-head { align-items: flex-start; padding-bottom: 11px; }
  h1 { font-size: 20px; max-width: 260px; }
  .eyebrow { font-size: 8px; }
  .phase-pill { margin-top: 18px; padding: 7px 8px; font-size: 8px; }
  .canvas-wrap { min-height: 280px; }
  .stage-foot { padding-top: 9px; }
  .what-seeing { font-size: 10px; min-height: 28px; margin-bottom: 8px; }
  .readout-grid { gap: 6px; }
  .readout { padding: 7px; }
  .readout > span { font-size: 7px; }
  .readout i { font-size: 6px; }
  .readout strong { font-size: 15px; }
  .control-panel { overflow: visible; padding: 14px 12px 18px; }
  .page-footer { min-height: 28px; padding: 0 12px; font-size: 7px; }
  .page-footer span:last-child { text-align: right; }
}
@media (max-width: 420px) {
  .brand-meta { letter-spacing: .07em; }
  .stage-head { gap: 6px; }
  h1 { max-width: 220px; font-size: 18px; }
  .phase-pill { max-width: 104px; white-space: normal; line-height: 1.2; }
  .control-list { column-gap: 11px; row-gap: 12px; }
  .control-top { align-items: flex-start; flex-direction: column; gap: 2px; font-size: 9px; }
  .control-top output { font-size: 8px; }
  .preset { padding: 8px; }
  .preset strong { font-size: 9px; }
  .preset span { font-size: 7px; }
  .page-footer span:last-child { max-width: 58%; }
}
@media (max-height: 680px) and (min-width: 681px) {
  .stage-panel { padding-top: 12px; padding-bottom: 10px; }
  .stage-head { padding-bottom: 8px; }
  .control-panel { padding-top: 10px; }
  .panel-section { padding-bottom: 10px; margin-bottom: 10px; }
  .control-list { row-gap: 8px; }
  .experiment-card, .checks-card { margin-bottom: 9px; padding-top: 10px; padding-bottom: 9px; }
}
@media (max-width: 680px) and (max-height: 680px) {
  body.embed-mode .workspace { grid-template-rows: minmax(0, 42%) minmax(0, 58%); }
}
@media (min-width: 681px) and (max-width: 900px) {
  body.embed-mode .workspace { grid-template-columns: minmax(0, 1.2fr) minmax(320px, .95fr); }
}
@media (max-width: 680px) {
  body.embed-mode .workspace { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 44%) minmax(0, 56%); }
  body.embed-mode .stage-panel { min-height: 0; padding: 10px 10px 8px; grid-template-rows: auto minmax(0,1fr) auto; }
  body.embed-mode .stage-head { padding-bottom: 7px; }
  body.embed-mode h1 { max-width: 230px; font-size: 16px; }
  body.embed-mode .eyebrow { margin-bottom: 4px; font-size: 7px; }
  body.embed-mode .phase-pill { margin-top: 13px; font-size: 7px; }
  body.embed-mode .canvas-wrap { min-height: 0; }
  body.embed-mode .scale-note { margin: -3px 0 4px; font-size: 6px; }
  body.embed-mode .stage-foot { padding-top: 6px; }
  body.embed-mode .what-seeing { min-height: 0; margin-bottom: 5px; font-size: 8px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  body.embed-mode .readout-grid { gap: 4px; }
  body.embed-mode .readout { padding: 4px 5px; }
  body.embed-mode .readout > span { font-size: 6px; }
  body.embed-mode .readout i { display: none; }
  body.embed-mode .readout strong { margin-top: 2px; font-size: 12px; }
  body.embed-mode .readout strong small { font-size: 8px; }
  body.embed-mode .control-panel { overflow-y: auto; padding: 9px 10px 12px; }
  body.embed-mode .panel-section { padding-bottom: 9px; margin-bottom: 9px; }
  body.embed-mode .section-title-row { margin-bottom: 7px; }
  body.embed-mode .preset { padding: 6px 7px; }
  body.embed-mode .preset strong { font-size: 8px; }
  body.embed-mode .preset span { font-size: 7px; }
  body.embed-mode .control-list { row-gap: 8px; }
  body.embed-mode .control-top { flex-direction: row; align-items: baseline; font-size: 8px; }
  body.embed-mode .control-top output { font-size: 7px; }
  body.embed-mode .range-ends { font-size: 7px; }
  body.embed-mode .transport-section { padding-bottom: 8px; margin-bottom: 8px; }
  body.embed-mode .transport-buttons button { min-height: 29px; }
  body.embed-mode .experiment-card, body.embed-mode .checks-card { margin-bottom: 8px; padding: 8px; }
  body.embed-mode .experiment-head p { font-size: 8px; }
  body.embed-mode .experiment-button { margin-top: 7px; padding: 6px 8px; }
  body.embed-mode .science-panel summary { padding: 8px 9px; }
  body.embed-mode .quality-row { padding-bottom: 4px; }
}
