/* Biocompiler model workbench. Shared palette and fonts live in theme.css. */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-weight: 500; }
button, select, textarea { border-radius: 6px; }
button:focus-visible, a:focus-visible, select:focus-visible,
input:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline-color: var(--accent);
}

.topbar, footer { border-color: var(--border); }
.brand { color: var(--text); font-weight: 600; letter-spacing: -.6px; }
.brand-cell {
  background: #4f9c9d;
  border-color: var(--accent);
  box-shadow: inset 0 0 4px #123e47;
}
.header-meta, .header-meta a { color: var(--muted); }
.header-meta a { font-size: 12px; }
.header-meta a:hover { color: var(--text); }
.intro { padding-top: 42px; padding-bottom: 36px; }
.intro h1 { font-weight: 500; letter-spacing: -1.7px; }
.intro-copy { color: var(--muted); font-size: 13px; line-height: 1.85; }
.eyebrow {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 1.25px;
}
.section-head h2, .experiment-heading h2 { font-weight: 500; letter-spacing: -.65px; }
.section-head > p { color: var(--muted); font-size: 12px; }
.edit-command-link, .evidence-intro > a { color: var(--accent); font-size: 12px; }
.edit-command-link:hover, .evidence-intro > a:hover { color: var(--accent-hover); }

/* The animation remains the focus; controls sit on quiet, opaque surfaces. */
.story-theater { background: var(--surface); border-color: var(--border); border-radius: 10px 10px 0 0; }
.story-topline {
  background: var(--surface);
  border-color: var(--border);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .65px;
  flex-wrap: wrap;
  row-gap: 8px;
}
.story-topline > span:first-child { color: var(--muted); }
.story-topline code { color: var(--accent); font-family: var(--font-mono); font-size: 13px; min-width: 0; overflow-wrap: anywhere; }
.story-topline > span:last-child { color: var(--muted); font-size: 12px; letter-spacing: 0; }
.stages, .story-theater > .stages { border-color: var(--border); }
.stage, .story-theater > .stages .stage {
  background: var(--surface);
  border-color: var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.stage > span { font-family: var(--font-mono); color: var(--subtle); font-size: 12px; }
.stage > i { color: var(--subtle); }
.stage:hover, .story-theater > .stages .stage:hover { color: var(--text); background: var(--surface-raised); }
.stage.active, .story-theater > .stages .stage.active {
  background: var(--surface-raised);
  color: var(--accent);
  box-shadow: inset 0 2px var(--accent);
}
.stage.active > span, .stage.passed > span { color: var(--accent); }
.story-chapter-marker { font-family: var(--font-sans); font-size: 12px; font-weight: 600; letter-spacing: 1px; }
.story-chapter-marker > span:first-child { color: var(--accent); background: #071118e6; border-color: #41616b; }
.story-chapter-marker > span:last-child { color: var(--text); }
.story-model-clock { color: var(--text); font-family: var(--font-mono); font-size: 12px; background: #071118e6; border-color: #41616b; }
.story-viewport[data-unavailable="true"]:after { font-size: 13px; }
.story-viewport[data-phase="response"] .story-model-clock { color: var(--accent); border-color: #49786e; }
.story-caption { background: var(--surface-raised); border-color: var(--border); }
.story-detail-panel { overflow: hidden; height: auto; min-height: 0; }
.story-caption h3 { color: var(--text); font-weight: 500; }
.story-caption > div:first-child { position: relative; }
.story-caption .caption-ghost { position: absolute; top: 0; left: 0; width: 100%; pointer-events: none; }
.story-caption p { color: var(--muted); font-size: 12px; line-height: 1.8; }
.story-metric { border-color: var(--border); }
.story-metric span { color: var(--muted); font-size: 13px; }
.story-metric strong { color: var(--accent); font-family: var(--font-mono); font-size: 12px; }
.story-controls { background: var(--surface); border-color: var(--border); }
.story-primary, .primary { background: var(--accent); border-color: var(--accent); color: var(--bg); font-size: 12px; font-weight: 600; }
.story-primary > span { font-size: 12px; }
.story-primary:hover, .primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.story-restart, .restart { color: var(--muted); }
.story-restart:hover, .restart:hover { color: var(--accent); }
.story-scrub > div, .scrub-labels { color: var(--muted); font-family: var(--font-sans); font-size: 12px; }
.story-clock { color: var(--muted); font-family: var(--font-mono); font-size: 12px; min-width: 78px; }
input[type=range], input[type=checkbox] { accent-color: var(--accent); }
.representation-inspector { background: var(--surface); border-color: var(--border); }
.representation-inspector > summary { color: var(--text); font-size: 12px; }
.representation-inspector > summary::before { color: var(--accent); font-family: var(--font-mono); }
.representation-inspector > summary > span { color: var(--muted); font-size: 13px; }
.representation-inspector > .stage-detail, .stage-detail { background: var(--surface); border-color: var(--border); }
.stage-detail p:not(.eyebrow) { color: var(--muted); font-size: 13px; }
.stage-detail .stage-boundary { color: var(--muted) !important; font-size: 13px !important; }
.stage-detail pre { background: var(--bg); border-color: var(--border); color: #b0d9d2; font-family: var(--font-mono); font-size: 13px; line-height: 1.9; }
.story-scope { color: var(--muted); font-size: 13px; line-height: 1.8; }

.molecular-focus { background: #071118f0; border-color: #41616b; }
.molecular-focus button { color: var(--muted); font-family: var(--font-sans); font-size: 13px; font-weight: 500; }
.molecular-focus button:hover { color: var(--text); }
.molecular-focus button[aria-pressed="true"] { color: var(--bg); background: var(--accent); }
.molecular-focus button:focus-visible { outline-color: var(--accent); }
.molecular-readouts, .story-theater > .molecular-readouts { background: var(--surface); border-color: var(--border); }
.story-detail-panel > .molecular-readouts { position: relative; inset: auto; margin: 0; border: 0; border-top: 1px solid var(--border); border-radius: 0; padding: 16px 24px; justify-content: space-between; }
.story-detail-panel > .molecular-readouts div { flex: 1; }
.story-detail-panel > .molecular-readouts small { max-width: 130px; flex: 1; text-align: right; }
.story-detail-panel > .molecular-readouts strong { font-size: 16px; }
.molecular-readouts div > span { font-family: var(--font-sans); font-size: 12px; font-weight: 500; letter-spacing: .3px; color: #83d8df; }
.molecular-readouts div:nth-child(2) > span { color: #e9bc76; }
.molecular-readouts div:nth-child(3) > span { color: #cab0e9; }
.molecular-readouts strong { color: var(--text); font-family: var(--font-mono); font-weight: 400; }
.molecular-readouts small { color: var(--muted); font-family: var(--font-mono); font-size: 12px; }
.molecular-note { background: var(--surface-raised); border-color: var(--border); color: var(--muted); font-size: 13px; line-height: 1.8; }
.story-viewport.is-recap { background: var(--surface); min-height: 0; }
.story-viewport.is-recap canvas:not([hidden]),
.story-viewport.is-recap > img:not([hidden]):not(.hidden) { display: block !important; }
.story-recap { color: var(--text); background: var(--surface); min-height: 510px; }
.story-recap .eyebrow, .recap-why > span { color: var(--accent); }
.story-recap h3 { font-weight: 500; letter-spacing: -.8px; line-height: 1.25; }
.recap-software { color: var(--muted); font-size: 14px; }
.recap-steps section, .recap-why { border-color: var(--border); }
.recap-steps section > span, .recap-why > span { color: var(--accent); font-family: var(--font-sans); font-size: 12px; font-weight: 600; letter-spacing: .7px; }
.recap-steps p { color: var(--muted); font-size: 12px; }
.recap-why p { color: var(--text); font-size: 14px; }
.recap-boundary { color: var(--muted); font-size: 13px; }

/* Editable source and numerical results keep a distinct monospace voice. */
.lab { background: var(--surface); border-color: var(--border); border-radius: 10px; }
.program-panel { background: var(--surface); border-color: var(--border); }
.step-number { color: var(--accent); font-family: var(--font-mono); font-size: 13px; }
.panel-title h2 { font-size: 15px; font-weight: 500; }
.mini-label { color: var(--muted); font-family: var(--font-sans); font-size: 12px; font-weight: 500; letter-spacing: .3px; }
.field-label { color: var(--text); font-size: 12px; font-weight: 500; }
select { background: var(--surface-raised); border-color: var(--border); color: var(--text); font-size: 12px; }
.field-note { color: var(--muted); font-size: 13px; line-height: 1.75; }
.code-header { background: var(--bg); border-color: var(--border); font-family: var(--font-mono); font-size: 12px; }
.code-header span { color: var(--muted); }
textarea { background: var(--bg); border-color: var(--border); color: #b0d9d2; font-family: var(--font-mono); font-size: 13px; line-height: 1.9; }
.compile-status { color: var(--accent); font-family: var(--font-sans); font-size: 13px; }
.compile-status.error { color: #ffb3a4; }
.context-note { color: var(--muted); border-color: var(--border); font-size: 13px; }
.context-note strong { color: var(--text); font-size: 13px; font-weight: 500; }
.small-dot, .status-dot { background: var(--accent); }
.scene-heading .eyebrow { color: var(--muted); font-size: 12px; }
.scene-heading p { color: var(--muted); font-size: 13px; }
.scene-tools button { background: #071118e6; color: var(--text); border-color: #41616b; font-size: 13px; }
.scene-tools span { color: var(--muted); font-family: var(--font-sans); font-size: 12px; }
.live-clock > span { color: var(--accent); font-family: var(--font-sans); font-size: 12px; font-weight: 500; letter-spacing: 1px; }
.live-clock strong { color: var(--text); font-family: var(--font-mono); }
.live-clock small { color: var(--muted); }
.pathway-legend button { background: #071118ed; border-color: #41616b; }
.pathway-legend button:hover { background: var(--surface-raised); }
.pathway-legend b { color: var(--text); font-size: 13px; }
.pathway-legend button > span:last-child { color: var(--muted); font-size: 12px; }
.scene-caption { color: #b4c7ce; font-size: 12px; }
.transport, .live-values { background: var(--surface-raised); border-color: var(--border); }
.play-button { background: var(--accent); color: var(--bg); font-size: 13px; }
.play-button:hover { background: var(--accent-hover); }
.speed-label { color: var(--muted); font-size: 12px; }
.speed-label select { color: var(--text); background: var(--surface); border-color: #41616b; font-family: var(--font-mono); font-size: 13px; }
.live-values > div { border-color: var(--border); min-width: 0; }
.live-values span { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.live-values strong { color: var(--text); font-family: var(--font-mono); font-size: 23px; letter-spacing: -.65px; }
.live-values small { color: var(--muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.results-actions label { color: var(--muted); font-size: 13px; }
.outline { color: var(--text); border-color: #41616b; font-size: 13px; }
.outline:hover { color: var(--accent); background: var(--surface); }
.chart-panel { background: var(--surface); border-color: var(--border); border-radius: 8px; }
.chart-title h3 { font-size: 13px; font-weight: 500; }
.chart-title span { color: var(--muted); font-family: var(--font-mono); font-size: 12px; }
.chart-panel p { color: var(--muted); font-size: 13px; line-height: 1.8; }
.chart-panel svg text { fill: var(--muted); font-family: var(--font-mono); font-size: 12px; }
.chart-panel svg line:not(.playhead) { stroke: var(--border); }
.chart-panel svg .playhead { stroke: var(--text); }
.chart-panel svg rect { fill: var(--accent); }
.run-summary, .run-summary > div { border-color: var(--border); }
.run-summary span { color: var(--muted); font-size: 13px; }
.run-summary strong { color: var(--text); font-family: var(--font-mono); font-size: 15px; }
.run-summary .amber-text { color: #e9bc76; }
.results-note { color: var(--muted); font-size: 13px; line-height: 1.8; }
.evidence-section { border-color: var(--border); }
.evidence-intro > p:not(.eyebrow) { color: var(--muted); font-size: 13px; }
details { border-color: var(--border); }
summary { color: var(--text); font-size: 13px; font-weight: 500; }
details p { color: var(--muted); font-size: 12px; }
.source-links a { color: var(--text); font-size: 12px; }
.source-links a:hover { color: var(--accent); }
.source-links a > span { color: var(--subtle); font-family: var(--font-mono); font-size: 12px; }
.source-links small { color: var(--muted); font-size: 12px; }
footer { color: var(--muted); font-family: var(--font-sans); font-size: 12px; letter-spacing: .2px; }

@media (max-width: 1050px) {
  .stage, .story-theater > .stages .stage { font-size: 13px; gap: 7px; padding-right: 10px; padding-left: 10px; }
  .story-topline > span:last-child { font-size: 12px; }
  .story-metric strong { font-size: 13px; }
  .live-values strong { font-size: 19px; }
  .live-values span { font-size: 12px; }
  .live-values small { font-size: 12px; }
  .run-summary strong { font-size: 13px; }
}

@media (max-width: 760px) {
  .story-viewport:not(.is-recap) { height: 410px; }
  .viewport { height: 620px; display: grid; grid-template-columns: minmax(0,1fr) auto; grid-template-rows: auto auto 1fr; gap: 16px 12px; padding: 20px; }
  .scene-heading { position: relative; inset: auto; grid-column: 1 / -1; grid-row: 1; min-width: 0; }
  .scene-heading p { max-width: none; }
  .live-clock { position: relative; inset: auto; grid-column: 1; grid-row: 2; align-self: start; }
  .scene-tools { position: relative; inset: auto; grid-column: 2; grid-row: 2; align-self: start; }
  .intro { padding-top: 28px; padding-bottom: 26px; }
  .intro .eyebrow, .lowering-section .section-head .eyebrow { font-size: 12px; letter-spacing: .8px; }
  .intro h1 { font-size: 34px; letter-spacing: -1.2px; }
  .intro-copy { font-size: 12px; }
  .header-meta { gap: 14px; }
  .header-meta a { font-size: 12px; }
  .story-topline { font-size: 12px; letter-spacing: .3px; }
  .story-topline code { font-size: 12px; }
  .story-chapter-marker { font-size: 12px; letter-spacing: .5px; }
  .story-model-clock { font-size: 12px; }
  .story-viewport[data-unavailable="true"]:after { font-size: 12px; }
  .story-caption p { font-size: 13px; }
  .story-metric span { font-size: 12px; }
  .story-metric strong { font-size: 12px; }
  .story-primary { font-size: 13px; }
  .story-clock { font-size: 12px; }
  .representation-inspector > summary { font-size: 13px; }
  .stage-detail p:not(.eyebrow) { font-size: 12px; }
  .story-scope { font-size: 12px; }
  .scene-heading .eyebrow { font-size: 12px; letter-spacing: .7px; }
  .scene-heading p, .scene-tools button { font-size: 12px; }
  .scene-caption { font-size: 12px; line-height: 1.5; }
  .pathway-legend { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); left: 12px; right: 12px; bottom: 110px; gap: 6px; }
  .pathway-legend button { min-width: 0; padding: 8px 6px; column-gap: 5px; grid-template-columns: 5px minmax(0,1fr); }
  .pathway-legend b, .pathway-legend button > span:last-child { min-width: 0; overflow-wrap: anywhere; }
  .pathway-legend b { font-size: 12px; }
  .pathway-legend button > span:last-child { font-size: 12px; }
  .live-values strong { font-size: 15px; }
  .live-values > div { padding-right: 8px; padding-left: 8px; }
  .live-values > div:first-child { padding-left: 0; }
  .live-values span { font-size: 12px; }
  .live-values small { font-size: 12px; }
  .speed-label { font-size: 0; }
  .run-summary span { font-size: 12px; }
  .source-links a { font-size: 13px; }
  .source-links small { font-size: 12px; }
  footer { font-size: 12px; }
}

@media (max-width: 600px) {
  .story-recap { min-height: 0; }
  .story-detail-panel > .molecular-readouts { padding: 13px 14px; gap: 12px; }
  .story-detail-panel > .molecular-readouts strong { font-size: 12px; }
  .topbar { height: auto; min-height: 80px; flex-wrap: wrap; gap: 12px; padding-top: 18px; padding-bottom: 18px; }
  .header-meta { width: 100%; justify-content: space-between; }
  .header-meta a { margin-left: 0; white-space: nowrap; }
  .molecular-focus { flex-wrap: wrap; }
  .molecular-focus button { font-size: 12px; padding: 6px 4px; }
  .molecular-readouts div > span, .story-theater > .molecular-readouts div > span { font-size: 12px; letter-spacing: 0; }
  .molecular-note { font-size: 12px; }
  .recap-software { font-size: 12px; }
  .recap-steps p { font-size: 12px; }
  .recap-why p { font-size: 13px; }
}
