:root {
  color-scheme: dark;
  --bg: #0b1115;
  --panel: #111a20;
  --panel-soft: #152129;
  --line: #293840;
  --line-soft: #1e2b32;
  --text: #edf3f1;
  --muted: #9aabad;
  --quiet: #6f8287;
  --accent: #6be1ca;
  --accent-soft: rgba(107, 225, 202, .12);
  --paper: #c8c0aa;
  --paper-dark: #8e8879;
  font-family: 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 { min-width: 320px; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.brand-header {
  height: 42px; flex: 0 0 42px; display: flex; align-items: center; gap: 22px;
  padding: 0 22px; border-bottom: 1px solid var(--line-soft); background: #0d1418;
  color: var(--muted); font-size: 10px; letter-spacing: .14em; font-weight: 700;
}
.brand-mark { color: var(--text); display: flex; align-items: center; gap: 9px; }
.brand-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px rgba(107,225,202,.5); }
.brand-meta span { color: var(--accent); padding: 0 5px; }
.brand-right { margin-left: auto; color: var(--quiet); }
.workspace {
  width: min(1600px, 100%); margin: 0 auto; padding: 16px 18px 20px; flex: 1; min-height: 0;
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr); gap: 16px;
  height: calc(100vh - 42px);
}
.visual-column, .controls-column { min-width: 0; min-height: 0; overflow-y: auto; scrollbar-color: #34464d transparent; scrollbar-width: thin; }
.visual-column { padding-right: 2px; }
.scene-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 3px 2px 13px; }
.eyebrow { color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .17em; line-height: 1.4; }
h1 { margin: 5px 0 4px; font-size: clamp(20px, 2.1vw, 28px); line-height: 1.14; letter-spacing: -.035em; font-weight: 680; }
.lede { color: var(--muted); margin: 0; font-size: 12px; line-height: 1.45; }
.scene-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; padding-top: 2px; flex: 0 0 auto; }
.mechanism-pill, .input-tag, .experiment-mark { border: 1px solid rgba(107,225,202,.28); background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 6px 9px; font-size: 8px; letter-spacing: .13em; font-weight: 800; white-space: nowrap; }
.quiet-button { background: transparent; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); padding: 6px 9px; font-size: 9px; letter-spacing: .1em; font-weight: 800; cursor: pointer; }
.quiet-button:hover { border-color: var(--accent); color: var(--text); }
.scene-wrap { position: relative; height: clamp(340px, 55vh, 500px); min-height: 320px; overflow: hidden; border: 1px solid #28383e; border-radius: 12px; background: #0d171c; box-shadow: 0 18px 48px rgba(0,0,0,.22); }
#scene { width: 100%; height: 100%; display: block; cursor: grab; touch-action: pan-y; }
#scene.is-dragging { cursor: grabbing; }
.scene-corner { position: absolute; bottom: 10px; z-index: 2; color: #829398; font-size: 8px; letter-spacing: .13em; font-weight: 800; pointer-events: none; }
.scene-corner span { color: var(--accent); padding: 0 4px; }
.scene-corner-left { left: 12px; }
.scene-corner-right { right: 12px; }
.scene-caption { min-height: 38px; display: flex; align-items: center; padding: 8px 12px; margin-top: 9px; border-left: 2px solid var(--accent); background: rgba(107,225,202,.055); color: #cbd8d6; font-size: 11px; line-height: 1.45; }
.readout-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; margin-top: 10px; }
.readout-card { min-width: 0; border: 1px solid var(--line-soft); background: var(--panel); border-radius: 8px; padding: 10px 11px 9px; }
.readout-label { color: var(--quiet); font-size: 8px; font-weight: 800; letter-spacing: .13em; white-space: nowrap; }
.readout-value { margin-top: 6px; font-size: clamp(17px, 1.8vw, 22px); font-variant-numeric: tabular-nums; letter-spacing: -.04em; font-weight: 650; white-space: nowrap; }
.readout-value small { color: var(--muted); font-size: 10px; font-weight: 500; letter-spacing: 0; }
.readout-note { margin-top: 5px; color: var(--quiet); font-size: 7px; letter-spacing: .1em; line-height: 1.35; }
.checks-section { margin-top: 17px; }
.section-topline { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 0 2px 9px; }
h2 { margin: 3px 0 0; font-size: 16px; letter-spacing: -.02em; font-weight: 650; }
.tolerance-note { color: var(--quiet); font-size: 8px; letter-spacing: .1em; white-space: nowrap; }
.checks-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.check-card { position: relative; min-width: 0; padding: 10px 11px 9px; border: 1px solid var(--line-soft); background: #10191e; border-radius: 8px; }
.check-name { color: #c8d4d2; font-size: 10px; font-weight: 650; }
.check-result { margin-top: 5px; font-size: 16px; font-weight: 680; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.check-detail { max-width: 88%; color: var(--quiet); font-size: 8px; line-height: 1.4; margin-top: 3px; }
.check-status { position: absolute; right: 9px; top: 10px; color: var(--accent); font-size: 7px; font-weight: 850; letter-spacing: .12em; }
.check-status.fail { color: #c0c9c7; }
.number-note { margin: 8px 2px 0; color: var(--quiet); font-size: 9px; line-height: 1.5; }
.science-panel { margin: 14px 0 4px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.science-panel summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; color: var(--text); font-size: 9px; font-weight: 850; letter-spacing: .14em; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary::after { content: "+"; color: var(--accent); font-size: 17px; font-weight: 400; margin-left: auto; }
.science-panel[open] summary::after { content: "−"; }
.summary-hint { color: var(--quiet); font-size: 8px; letter-spacing: .04em; font-weight: 500; }
.science-content { border-top: 1px solid var(--line-soft); padding: 4px 14px 12px; color: #b4c2c0; font-size: 10px; line-height: 1.65; }
.science-content p { margin: 8px 0; }
.science-content strong { color: var(--text); }
.equation { color: var(--accent); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.affiliation-note { color: var(--quiet); font-size: 9px; }
.controls-column { padding: 14px 14px 16px; border: 1px solid var(--line); border-radius: 11px; background: linear-gradient(180deg, #121c22, #10181d); }
.controls-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 1px 13px; border-bottom: 1px solid var(--line-soft); }
.controls-header h2 { font-size: 18px; }
.input-tag { font-size: 7px; padding: 5px 7px; }
.preset-section { padding: 13px 0 12px; border-bottom: 1px solid var(--line-soft); }
.subsection-heading { color: var(--quiet); font-size: 8px; font-weight: 850; letter-spacing: .14em; }
.preset-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; margin-top: 8px; }
.preset-button { min-width: 0; text-align: left; padding: 9px 10px; border: 1px solid var(--line); background: #0e171c; border-radius: 6px; color: #c5d0cf; font-size: 10px; cursor: pointer; transition: border-color .15s, background .15s; }
.preset-button:hover, .preset-button.is-active { border-color: rgba(107,225,202,.65); background: var(--accent-soft); color: var(--text); }
.preset-button span { display: block; color: var(--accent); font-size: 7px; letter-spacing: .13em; margin-top: 3px; font-weight: 850; }
.parameter-section { padding: 12px 0 2px; border-bottom: 1px solid var(--line-soft); }
.parameter-heading { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.parameter-heading h3, .experiment-heading h3 { margin: 0; font-size: 12px; font-weight: 700; }
.parameter-heading span { color: var(--quiet); font-size: 7px; letter-spacing: .12em; }
.control-row { padding: 7px 0 6px; }
.control-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.control-top label { color: #d8e1df; font-size: 10px; font-weight: 600; }
.control-top label span { color: var(--quiet); font-family: ui-monospace, monospace; margin-left: 3px; }
.control-top output { color: var(--accent); font-size: 10px; font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
input[type="range"] { width: 100%; height: 15px; margin: 5px 0 0; background: transparent; accent-color: var(--accent); cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 4px; background: #3a4a50; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; margin-top: -5px; border: 2px solid var(--accent); border-radius: 50%; background: #10221f; box-shadow: 0 0 0 3px rgba(107,225,202,.1); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 4px; background: #3a4a50; }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border: 2px solid var(--accent); border-radius: 50%; background: #10221f; }
.control-help { margin: 1px 0 0; color: var(--quiet); font-size: 8px; line-height: 1.35; }
.time-section { padding: 13px 0 12px; border-bottom: 1px solid var(--line-soft); }
.time-top { display: flex; justify-content: space-between; align-items: center; }
.time-top output { color: var(--accent); font-size: 10px; font-variant-numeric: tabular-nums; }
.transport-controls { display: grid; grid-template-columns: 1.1fr 1fr .8fr; gap: 6px; margin-top: 8px; }
.primary-button, .secondary-button, .record-button { border-radius: 6px; padding: 9px 8px; font-size: 9px; font-weight: 750; cursor: pointer; }
.primary-button { border: 1px solid var(--accent); background: var(--accent); color: #09211c; }
.primary-button:hover { filter: brightness(1.08); }
.secondary-button { border: 1px solid var(--line); background: #0d161b; color: #c6d1cf; }
.secondary-button:hover { border-color: var(--accent); }
.experiment-section { padding: 13px 0 11px; }
.experiment-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.experiment-heading h3 { margin-top: 3px; font-size: 13px; }
.experiment-mark { font-size: 7px; }
.experiment-section p { margin: 7px 0 9px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.record-button { width: 100%; border: 1px solid rgba(107,225,202,.55); background: rgba(107,225,202,.1); color: var(--accent); }
.record-button:hover { background: rgba(107,225,202,.18); }
.experiment-result { margin-top: 8px; min-height: 46px; padding: 9px 10px; border-radius: 6px; border: 1px solid var(--line-soft); background: #0d161a; color: #b7c7c4; font-size: 9px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.experiment-result strong { color: var(--text); }
.parameter-footnote { padding-top: 9px; border-top: 1px solid var(--line-soft); color: var(--quiet); font-size: 8px; line-height: 1.5; }
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 .brand-header { display: none; }
body.embed-mode .workspace { height: 100vh; height: 100dvh; }

@media (max-width: 900px) {
  .workspace { grid-template-columns: minmax(0,1.1fr) minmax(310px,.9fr); gap: 10px; padding: 12px; }
  .controls-column { padding: 12px; }
  .readout-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .readout-value { font-size: 19px; }
}
@media (max-width: 700px) {
  .brand-header { height: 34px; flex-basis: 34px; padding: 0 13px; }
  .brand-meta { display: none; }
  .brand-right { font-size: 8px; }
  .workspace, body.embed-mode .workspace { display: flex; flex-direction: column; height: auto; min-height: calc(100dvh - 34px); overflow: visible; padding: 11px 10px 20px; gap: 12px; }
  body.embed-mode .workspace { min-height: 100dvh; }
  .visual-column, .controls-column { overflow: visible; }
  .scene-heading { padding-bottom: 10px; gap: 8px; }
  h1 { font-size: 21px; max-width: 260px; }
  .lede { max-width: 260px; font-size: 11px; }
  .scene-actions { gap: 6px; }
  .mechanism-pill { font-size: 7px; padding: 5px 7px; }
  .quiet-button { font-size: 8px; padding: 5px 7px; }
  .scene-wrap { height: clamp(320px, 45vh, 420px); min-height: 320px; }
  .scene-caption { font-size: 10px; }
  .readout-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .readout-card { padding: 9px; }
  .readout-value { font-size: 20px; }
  .checks-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .controls-column { padding: 13px; }
  .controls-header h2 { font-size: 17px; }
  .science-content { font-size: 9px; }
  .summary-hint { display: none; }
  body.embed-mode .brand-header { display: none; }
}
@media (max-width: 370px) {
  .scene-actions { max-width: 112px; }
  .mechanism-pill { white-space: normal; text-align: center; }
  .readout-label { font-size: 7px; }
  .checks-grid { grid-template-columns: 1fr; }
  .preset-button { font-size: 9px; }
}
@media (max-width: 700px) {
  .scene-heading h1 { max-width: 225px; }
  .scene-actions { max-width: 118px; }
  .section-topline { align-items: flex-start; flex-direction: column; gap: 4px; }
  body.embed-mode .workspace { height: 100dvh; min-height: 100dvh; overflow-y: auto; overflow-x: hidden; }
}
