/* Signal Relay: the cell communication repair bench. Scenes by art.js, colors from the --sr-* properties below (light
   and dark). Stage states are never color-only: an ON/OFF pill, a glow and the observation text all carry them. */
html {
  --sr-band: rgba(90, 63, 143, .13); --sr-line: #3e4c66; --sr-ink: #182236; --sr-text: #182236; --sr-legend: rgba(255, 255, 255, .78);
  --sr-out1: #eef3fb; --sr-out2: #dde8f6; --sr-in1: #f7f1e6; --sr-in2: #efe4d0;
  --sr-head-p: #e4a95b; --sr-head-line: #9a6a2a; --sr-tail: #c9a46c; --sr-tail-bg: #f5e6c8;
  --sr-gpcr: #6e4fae; --sr-gpcr-hi: #b7a1e6; --sr-gpcr-line: #3c2770;
  --sr-rtk: #1f8375; --sr-rtk-hi: #8fd8cb; --sr-rtk-line: #0f4d44;
  --sr-int: #c47a1e; --sr-int-hi: #f5c98a; --sr-int-line: #774409;
  --sr-prot: #3f74b8; --sr-prot-hi: #a9c9f0; --sr-prot-line: #1d406e;
  --sr-kin: #b84a7c; --sr-kin-hi: #f0a9c8; --sr-kin-line: #6e1f44;
  --sr-nuc: #c9b6e2; --sr-nuc-hi: #efe7fa; --sr-nuc-line: #6e5a94;
  --sr-gly: #2e7d4f; --sr-gly-hi: #9fdbb5; --sr-gly-line: #164a2c; --sr-glu: #f1d36b; --sr-glu-line: #8a6d10;
  --sr-lig: #d2362f; --sr-lig-line: #7a1410; --sr-camp: #e0832a; --sr-hormone: #d2362f;
  --sr-dna: #2b5797; --sr-dna2: #b84a7c; --sr-mrna: #c47a1e;
  --sr-on: #f2b705; --sr-flow: #b86e00; --sr-flag: #b3261e; --sr-model: #1d7a3a; --sr-accent: #5a3f8f;
  --sr-card1: #ffffff; --sr-card2: #f3f1f8;
  --sr-panel1: #faf8fd; --sr-panel2: #efebf6; --sr-chip: #ffffff; --sr-chip-on: #e6def5; --sr-chip-line: #a597c2;
  --sr-build: #b9520d; --sr-predict: #5a3f8f;
}
html[data-theme="dark"] {
  --sr-band: rgba(170, 140, 230, .14); --sr-line: #a7b4cc; --sr-ink: #e9edf6; --sr-text: #e9edf6; --sr-legend: rgba(18, 22, 34, .82);
  --sr-out1: #1d2638; --sr-out2: #18202f; --sr-in1: #2a2420; --sr-in2: #211c18;
  --sr-head-p: #c48a3c; --sr-head-line: #6e4a16; --sr-tail: #8a6b3c; --sr-tail-bg: #3a2f20;
  --sr-gpcr: #8c6ed0; --sr-gpcr-hi: #c9b8f2; --sr-gpcr-line: #2a1a55;
  --sr-rtk: #34a493; --sr-rtk-hi: #9fe3d6; --sr-rtk-line: #0b3a33;
  --sr-int: #d9902e; --sr-int-hi: #f7d29d; --sr-int-line: #5a3205;
  --sr-prot: #5b8fd6; --sr-prot-hi: #b6d3f6; --sr-prot-line: #142e52;
  --sr-kin: #d4689a; --sr-kin-hi: #f4bcd5; --sr-kin-line: #4e1230;
  --sr-nuc: #4a3c66; --sr-nuc-hi: #6c5a8e; --sr-nuc-line: #b6a2dc;
  --sr-gly: #3f9c66; --sr-gly-hi: #a5e0bd; --sr-gly-line: #0f3520; --sr-glu: #e8c75a; --sr-glu-line: #6e560c;
  --sr-lig: #ff6b5e; --sr-lig-line: #5a0d08; --sr-camp: #f29a45; --sr-hormone: #ff7a6e;
  --sr-dna: #79a8ec; --sr-dna2: #e88cb6; --sr-mrna: #f2b25a;
  --sr-on: #ffd23f; --sr-flow: #ffc247; --sr-flag: #ff7a6e; --sr-model: #6fd68f; --sr-accent: #b9a2f0;
  --sr-card1: #232a3a; --sr-card2: #1b2130;
  --sr-panel1: #191f2c; --sr-panel2: #20283a; --sr-chip: #222b3d; --sr-chip-on: #3d3263; --sr-chip-line: #5b5480;
  --sr-build: #ff9a52; --sr-predict: #c3a6ff;
}

.core { height: 100%; display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr); gap: 16px; padding: 16px; overflow: auto; color: var(--sr-ink); font-size: 16px; box-sizing: border-box; }
.core * { box-sizing: border-box; }
.core-bench, .core-panel { min-width: 0; border-radius: 16px; overflow: auto; }
.core-bench { display: flex; flex-direction: column; gap: 10px; }
.core-panel { padding: 14px 16px; background: linear-gradient(180deg, var(--sr-panel1), var(--sr-panel2)); border: 1px solid var(--sr-chip-line); box-shadow: 0 2px 10px rgba(30, 20, 60, .12); }
.core-scene { flex: 0 0 auto; overflow: auto; border-radius: 14px; border: 2px solid var(--sr-line); background: var(--sr-in2); box-shadow: 0 4px 14px rgba(30, 20, 60, .22); }
.core-scene:focus-visible { outline: 3px solid #dd9823; outline-offset: 3px; }
.core-scene svg { display: block; width: 100%; height: auto; }
.core-scene svg text, .ps-start-art svg text, .ps svg text { font-family: inherit; }
svg .sr-head, svg .sr-tag, svg .sr-strong, svg .sr-muted, svg .sr-small, svg .sr-region, svg .sr-in-label, svg .sr-count, svg .sr-gain, svg .sr-pill text, svg .sr-model text { fill: var(--sr-text); font-size: 20px; }
svg .sr-head { font-size: 22px; font-weight: 800; }
svg .sr-tag, svg .sr-strong, svg .sr-gain { font-weight: 700; }
svg .sr-muted { fill: var(--sr-line); font-style: italic; }
svg .sr-region { fill: var(--sr-line); font-weight: 800; letter-spacing: .08em; opacity: .85; }
svg .sr-in-label { font-weight: 800; fill: #fff; paint-order: stroke; stroke: rgba(0, 0, 0, .45); stroke-width: 3px; }
svg .sr-count { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
svg .sr-counter { fill: var(--sr-card1); stroke: var(--sr-line); stroke-width: 1.5; }

svg .sr-tail { stroke: var(--sr-tail); stroke-width: 1.4; }
svg .sr-head-p { fill: var(--sr-head-p); stroke: var(--sr-head-line); stroke-width: .8; }
svg .sr-loop { fill: none; stroke: var(--sr-gpcr-line); stroke-width: 3; }
svg .sr-lig polygon, svg .sr-lig ellipse { fill: var(--sr-lig); stroke: var(--sr-lig-line); stroke-width: 1.3; }
svg .sr-lig path { stroke: var(--sr-lig-line); stroke-width: 2.4; }
svg .sr-noligand circle { fill: none; stroke: var(--sr-line); stroke-width: 2; stroke-dasharray: 4 3; }
svg .sr-noligand path { stroke: var(--sr-line); stroke-width: 2.4; }
svg .sr-camp { fill: var(--sr-camp); stroke: var(--sr-lig-line); stroke-width: 1; }
svg .sr-glu, svg .sr-g1p { fill: var(--sr-glu); stroke: var(--sr-glu-line); stroke-width: 1.2; }
svg .sr-g1p { stroke-width: 2; }
svg .sr-phos circle { fill: var(--sr-on); stroke: var(--sr-flow); stroke-width: 1.5; }
svg .sr-phos text { fill: #241a00; font-size: 20px; font-weight: 800; }
svg .sr-dna { fill: none; stroke: var(--sr-dna); stroke-width: 3; }
svg .sr-dna2 { stroke: var(--sr-dna2); }
svg .sr-gene { fill: none; stroke: var(--sr-ink); stroke-width: 2; stroke-dasharray: 5 3; }
svg .sr-mrna { fill: none; stroke: var(--sr-mrna); stroke-width: 4; stroke-linecap: round; }
svg .sr-arrow { fill: none; stroke: var(--sr-line); stroke-width: 2.6; stroke-dasharray: 7 5; }
svg .sr-arrow.sr-flow { stroke: var(--sr-flow); stroke-width: 3.6; stroke-dasharray: 10 6; animation: sr-flow 1s linear infinite; }
svg .sr-empty rect { fill: none; stroke: var(--sr-line); stroke-width: 2; stroke-dasharray: 6 5; }
svg .sr-empty text { fill: var(--sr-line); font-size: 20px; font-style: italic; }
svg .sr-part.sr-on { filter: url(#sr-glow); }
svg .sr-part.sr-off { opacity: .5; }
svg .sr-x { fill: none; stroke: var(--sr-flag); stroke-width: 5; stroke-linecap: round; }
svg .sr-pp circle { fill: var(--sr-prot); stroke: var(--sr-prot-line); stroke-width: 1.4; }
svg .sr-pill rect { fill: var(--sr-card1); stroke: var(--sr-line); stroke-width: 1.5; }
svg .sr-pill text { font-weight: 800; }
svg .sr-pill-on rect { fill: var(--sr-on); stroke: var(--sr-flow); stroke-width: 2; }
svg .sr-pill-on text { fill: #241a00; }
svg .sr-pill-off rect { fill: var(--sr-card1); stroke: var(--sr-line); stroke-dasharray: 4 3; }
svg .sr-pill-fault rect { fill: var(--sr-card1); stroke: var(--sr-flag); stroke-width: 2.4; }
svg .sr-pill-fault text { fill: var(--sr-flag); }
svg .sr-pill-note rect { stroke: var(--sr-accent); stroke-width: 2; }
svg .sr-stuck circle { stroke: var(--sr-flag) !important; stroke-width: 3 !important; }
svg .sr-null rect { opacity: .6; }
svg .sr-unit { fill: none; stroke: var(--sr-gpcr); stroke-width: 2; }
svg .sr-unit-on { fill: var(--sr-gpcr); stroke: var(--sr-on); }
svg .sr-dot-rec { fill: var(--sr-gpcr); }
svg .sr-dot-g { fill: var(--sr-prot); }
svg .sr-dot-prod { fill: var(--sr-glu); stroke: var(--sr-glu-line); stroke-width: 1; }
svg .sr-vessel { fill: none; stroke: var(--sr-lig); stroke-width: 6; stroke-linecap: round; opacity: .7; }
svg .sr-uterus, svg .sr-muscle, svg .sr-liver { fill: var(--sr-kin-hi); stroke: var(--sr-kin-line); stroke-width: 2; }
svg .sr-liver { fill: #b8644a; stroke: #5a2a1a; }
svg .sr-head-b { fill: var(--sr-int-hi); stroke: var(--sr-int-line); stroke-width: 2; }
svg .sr-cervix { stroke: var(--sr-kin-line); stroke-width: 5; stroke-linecap: round; }
svg .sr-bar { fill: var(--sr-accent); }
svg .sr-hormone { fill: var(--sr-hormone); stroke: var(--sr-lig-line); stroke-width: 1.2; }
svg .sr-model rect { fill: var(--sr-card1); stroke: var(--sr-model); stroke-width: 2.5; }
svg .sr-model text { fill: var(--sr-model); font-weight: 800; }
svg .sr-pop { animation: sr-pop .45s ease-out both; }
@keyframes sr-flow { to { stroke-dashoffset: -32; } }
@keyframes sr-pop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.core-observation { margin: 0; min-height: 3em; padding: 10px 14px; line-height: 1.45; font-weight: 600; border-left: 5px solid var(--sr-accent); background: var(--sr-panel1); border-radius: 0 10px 10px 0; }
.sr-case { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; background: var(--sr-chip); border: 1px dashed var(--sr-chip-line); }
.sr-case p { margin: 6px 0; line-height: 1.45; }
.sr-case .sr-case-kicker { margin-top: 0; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; color: var(--sr-predict); }
.sr-table { border-collapse: collapse; margin: 6px 0; width: 100%; font-variant-numeric: tabular-nums; }
.sr-table th, .sr-table td { border: 1px solid var(--sr-chip-line); padding: 5px 8px; text-align: left; }
.sr-table tr:first-child th { background: var(--sr-panel2); }

.sr-step { margin: 14px 0 8px; padding-top: 10px; border-top: 1px solid var(--sr-chip-line); font-size: 16px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.sr-step-build { color: var(--sr-build); }
.sr-step-predict { color: var(--sr-predict); }
.sr-field { display: grid; gap: 6px; margin: 0 0 12px; }
.sr-label { font-weight: 700; line-height: 1.35; }
.sr-num { display: flex; align-items: center; gap: 8px; }
.sr-num input { flex: 1 1 auto; min-width: 0; font: inherit; font-size: 18px; font-weight: 700; min-height: 44px; padding: 8px 12px; border-radius: 10px; border: 2px solid var(--sr-chip-line); background: var(--sr-chip); color: inherit; font-variant-numeric: tabular-nums; }
.sr-unit { flex: 0 0 auto; font-weight: 600; }
.sr-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sr-chips-col { display: grid; grid-template-columns: 1fr; gap: 6px; }
.core .sr-chip { font: inherit; font-size: 16px; font-weight: 700; min-height: 44px; padding: 8px 14px; border-radius: 22px; border: 2px solid var(--sr-chip-line); background: var(--sr-chip); color: inherit; cursor: pointer; text-align: left; line-height: 1.3; }
.core .sr-chip.on { background: var(--sr-chip-on); border-color: var(--sr-accent); box-shadow: inset 0 0 0 1px var(--sr-accent); }
.core .sr-chip.on::before { content: "✓ "; }
.core .sr-chip:hover:not(:disabled) { border-color: var(--sr-accent); }
.sr-actions { display: flex; gap: 10px; margin-top: 8px; }
.core-run, .core-revise { font: inherit; font-size: 16px; font-weight: 800; min-height: 46px; border-radius: 12px; padding: 10px 16px; cursor: pointer; }
.core-run { flex: 1 1 auto; background: #5a3f8f; color: #fff; border: 0; box-shadow: 0 3px 0 #3a2766; }
.core-revise { background: var(--sr-chip); color: inherit; border: 2px solid var(--sr-chip-line); }
.core button:disabled, .core input:disabled { opacity: .6; cursor: default; }
.core .sr-chip.on:disabled { opacity: .85; }
.core-run:disabled { box-shadow: none; }
.core :focus-visible { outline: 3px solid #dd9823; outline-offset: 2px; }
.core-status { margin: 8px 0 4px; line-height: 1.4; font-weight: 600; }
.sr-precision { margin: 0 0 6px; line-height: 1.4; }
.core-about summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 700; }
.core-about p { line-height: 1.5; margin: 0 0 8px; }
.sr-example { margin: 8px 0; }

body .ps-kicker, body .ps-hint-note, body .ps-badge { font-size: 16px; }

@media (max-width: 900px) {
  .core { height: auto; grid-template-columns: 1fr; padding: 12px; }
  .core-bench, .core-panel { overflow: visible; }
  .core-panel { padding-bottom: 30px; }
  .core-scene svg { min-width: 760px; }
}
@media (prefers-reduced-motion: reduce) { .core *, svg .sr-flow, svg .sr-pop { animation: none !important; transition: none !important; } }
