/* Gene Switchboard: a regulation switchboard on a reporter bench. Scene drawn by art.js (colors from the --gs-* properties). */
html {
  --gs-panel1: #f3f8f9; --gs-panel2: #e3eef1; --gs-panel-line: #21576b; --gs-ink: #13303b; --gs-accent: #21576b;
  --gs-key: #ffffff; --gs-key-line: #9db4bc; --gs-key-on: #21576b; --gs-key-on-ink: #ffffff;
  --gs-ok: #13704a; --gs-bad: #b3261e; --gs-fixed: #9a6200;
  --gs-wall: #6b9a5a; --gs-cyto1: #f3f7df; --gs-cyto2: #dfeac0; --gs-ribo: #8aa36a;
  --gs-nuc1: #f1ebf8; --gs-nuc2: #ddd0ee; --gs-env: #7b5ea7;
  --gs-text: #18303a; --gs-strand-a: #d0534e; --gs-strand-b: #3f73b8; --gs-rung: #8796a0;
  --gs-r-cap: #c8ecd2; --gs-r-pro: #ffe2a8; --gs-r-op: #e7d2f5; --gs-r-gene: #cfe5f7; --gs-r-enh: #ffd5c2; --gs-r-line: #2f4a56;
  --gs-pol1: #b8d0e8; --gs-pol2: #5d7fa6; --gs-rep1: #d6b5ef; --gs-rep2: #7d4fa8; --gs-cap1: #b4ebc4; --gs-cap2: #2f8f5b;
  --gs-actm1: #ffc2a0; --gs-actm2: #d0582a; --gs-actn1: #a8ecef; --gs-actn2: #23868d; --gs-bead1: #e6d6c4; --gs-bead2: #9a7a5c;
  --gs-glc: #fff7e0; --gs-glc-line: #b08a2a; --gs-ind: #f6a8c8; --gs-ind-line: #a23a6a; --gs-trp: #ffbf70; --gs-trp-line: #a35a12;
  --gs-mrna: #c2185b; --gs-glow1: #b8ffd8; --gs-glow2: #1fbf74; --gs-tube: #f8fbfc; --gs-tube-line: #54707a;
}
html[data-theme="dark"] {
  --gs-panel1: #1b2a30; --gs-panel2: #152126; --gs-panel-line: #6fb4c9; --gs-ink: #e6f1f4; --gs-accent: #8fd0e2;
  --gs-key: #22343b; --gs-key-line: #557480; --gs-key-on: #8fd0e2; --gs-key-on-ink: #0d2229;
  --gs-ok: #4fd08c; --gs-bad: #ff8a80; --gs-fixed: #ffc66b;
  --gs-wall: #6f9d5e; --gs-cyto1: #26301c; --gs-cyto2: #1b2414; --gs-ribo: #7f9a62;
  --gs-nuc1: #2a2236; --gs-nuc2: #1f1a2a; --gs-env: #a88bd6;
  --gs-text: #eaf2f4; --gs-strand-a: #ff8a84; --gs-strand-b: #84b4f5; --gs-rung: #7d8c96;
  --gs-r-cap: #1f4a33; --gs-r-pro: #5a4416; --gs-r-op: #48305e; --gs-r-gene: #1e3d57; --gs-r-enh: #5c3322; --gs-r-line: #a9c2cc;
  --gs-pol1: #9dbbe0; --gs-pol2: #46668e; --gs-rep1: #d0aaf0; --gs-rep2: #6a3f95; --gs-cap1: #9fe6b6; --gs-cap2: #267a4c;
  --gs-actm1: #ffb48c; --gs-actm2: #b84a20; --gs-actn1: #96e6ea; --gs-actn2: #1d767c; --gs-bead1: #cdb9a3; --gs-bead2: #7e6148;
  --gs-glc: #f2e7c4; --gs-glc-line: #d9b453; --gs-ind: #f39cc0; --gs-ind-line: #ffd0e3; --gs-trp: #ffb35c; --gs-trp-line: #ffe0b8;
  --gs-mrna: #ff7fb0; --gs-glow1: #c8ffe2; --gs-glow2: #2bd487; --gs-tube: #14242a; --gs-tube-line: #8fb0ba;
}

/* ── layout ── */
.gs { position: absolute; inset: 0; display: grid; grid-template-columns: 362px minmax(0, 1fr); gap: 12px; padding: 10px;
  color: var(--tlg-text); font-size: 16px; }
.gs input, .gs button { font: inherit; }
.gs-controls { display: flex; flex-direction: column; gap: 5px; min-height: 0; overflow: auto; padding: 8px 11px;
  background: linear-gradient(var(--gs-panel1), var(--gs-panel2)); color: var(--gs-ink); border: 3px solid var(--gs-panel-line);
  border-radius: 14px; box-shadow: 0 3px 8px rgba(0,0,0,.16), inset 0 1px 0 rgba(255,255,255,.5); }
.gs-right { display: flex; flex-direction: column; gap: 6px; min-width: 0; min-height: 0; }
.gs-kicker { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--gs-accent); }
.gs-step { display: grid; gap: 5px; }
.gs-step-h { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 17px; line-height: 1.2; flex-wrap: wrap; }
.gs-n { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--gs-accent);
  color: #fff; font-size: 16px; font-weight: 800; }
html[data-theme="dark"] .gs-n { color: #0d2229; }
.is-done > .gs-step-h .gs-n { background: var(--gs-ok); }

/* groups */
.gs-g { display: grid; gap: 3px; }
.gs-g-h { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; font-weight: 700; line-height: 1.25; }
.gs-badge { font-size: 16px; font-weight: 700; color: var(--gs-fixed); white-space: nowrap; }
.gs-badge--only { color: var(--gs-ink); opacity: .75; font-weight: 600; }
.gs-mark { font-weight: 800; font-size: 16px; }
.gs-mark.is-ok { color: var(--gs-ok); } .gs-mark.is-bad { color: var(--gs-bad); }
.gs-opts { display: grid; gap: 6px; margin: 0; }
.gs-opts--pills.gs-n1 { grid-template-columns: 1fr; }
.gs-opts--pills.gs-n2 { grid-template-columns: 1fr 1fr; }
.gs-opts--pills.gs-n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.gs-opts--pills.gs-n3 .gs-o { padding: 3px 5px; gap: 4px; }
.gs-opts--pills.gs-n3 .gs-o-icon { width: 16px; }
.gs-opts--cards { grid-template-columns: 1fr 1fr; }
.gs-opts--tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* one switch key: native radio stretched over the whole key */
.gs-o { position: relative; display: flex; align-items: center; gap: 6px; min-height: 42px; padding: 3px 8px; border: 2px solid var(--gs-key-line);
  border-radius: 10px; background: var(--gs-key); color: var(--gs-ink); cursor: pointer; box-shadow: 0 2px 0 var(--gs-key-line); }
.gs-o input { position: absolute; z-index: 2; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; font-size: 16px; }
.gs-o-icon { flex: none; display: grid; place-items: center; width: 32px; }
.gs-o-icon svg { width: 32px; height: 26px; overflow: visible; }
.gs-opts--pills .gs-o-icon svg[viewBox="0 0 16 28"] { width: 15px; }
.gs-o-t { display: grid; line-height: 1.15; min-width: 0; }
.gs-o-t b { font-size: 16px; }
.gs-o-t small { font-size: 14px; opacity: .85; }
.gs-opts--tiles .gs-o { min-height: 60px; padding: 5px 9px; }
.gs-opts--tiles .gs-o-t { font-size: 16px; line-height: 1.2; }
.gs-o:has(input:checked) { border-color: var(--gs-key-on); background: var(--gs-key-on); color: var(--gs-key-on-ink); box-shadow: inset 0 2px 4px rgba(0,0,0,.25); transform: translateY(1px); }
.gs-o:has(input:focus-visible) { outline: 3px solid var(--tlg-focus, #1a73e8); outline-offset: 2px; }
.gs-o:hover:not(:has(input:disabled)) { border-color: var(--gs-key-on); }
.gs-o:has(input:disabled) { cursor: default; }
.gs-o.is-fixed { border-style: dashed; border-color: var(--gs-fixed); }
.gs-o.is-fixed:has(input:checked) { border-style: solid; }
.gs-g.is-sealed .gs-o { background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgba(33,87,107,.1) 6px 12px); }
.gs-seal { margin: 0; font-size: 16px; font-weight: 700; color: var(--gs-accent); }

/* run button */
.gs-run { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 8px 12px; font-size: 18px; font-weight: 800;
  color: #fff; background: linear-gradient(#2a8c62, #1f6b4b); border: 2px solid #17533a; border-radius: 10px; cursor: pointer; box-shadow: 0 3px 0 #123f2c; }
.gs-run-n { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,.25); font-size: 16px; }
.gs-run:hover:not(:disabled) { filter: brightness(1.07); }
.gs-run:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #123f2c; }
.gs-run:focus-visible { outline: 3px solid var(--tlg-focus, #1a73e8); outline-offset: 3px; }
.gs-run:disabled { cursor: default; background: #c9cfcd; border-color: #a9b1ae; color: #3c4643; box-shadow: none; }
html[data-theme="dark"] .gs-run:disabled { background: #3a4240; border-color: #56605d; color: #d6dcda; }
.gs-run.is-done:disabled { background: #e3efe9; color: #17533a; border-color: #7fb8a6; font-size: 16px; }
html[data-theme="dark"] .gs-run.is-done:disabled { background: #1f3a33; color: #b9ecd9; border-color: #3f7d6b; }

/* order chips */
.gs-spec { display: flex; flex-wrap: wrap; gap: 6px; }
.gs-chip { display: flex; align-items: baseline; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--tlg-surface, #fff);
  border: 2px solid var(--tlg-border, #ccd); font-size: 16px; line-height: 1.25; }
.gs-chip-k { opacity: .85; }
.gs-chip--target { border-color: var(--gs-glow2); }
.gs-chip--fixed { border-color: var(--gs-fixed); border-style: dashed; }
.gs-chip--ap { border-color: var(--gs-accent); }

/* scene */
.gs-scene { flex: 1 1 auto; min-height: 0; display: flex; justify-content: center; }
.gs-svg { display: block; width: 100%; height: 100%; max-height: 100%; }
.gs-readout { margin: 0; font-size: 16px; line-height: 1.3; min-height: 1.3em; }
.gs-explain { padding: 7px 10px 9px; border: 2px solid var(--gs-panel-line); border-radius: 12px; background: linear-gradient(var(--gs-panel1), var(--gs-panel2)); color: var(--gs-ink); display: grid; gap: 6px; }
.gs-explain .gs-g-h { display: none; }
.gs-explain .is-done .gs-n, .gs-explain.is-done .gs-n { background: var(--gs-ok); }
.gs-explain .gs-step-h .gs-mark { margin-left: auto; }
.gs-about { font-size: 16px; }
.gs-about summary { cursor: pointer; font-weight: 700; min-height: 26px; }
.gs-about p { margin: 6px 0 0; line-height: 1.35; }

.gs-t { font-family: var(--tlg-font, sans-serif); font-size: 18px; fill: var(--gs-text); }
.gs-t-b { font-weight: 700; }
.gs-t-small { font-size: 17px; }
.gs-t-prot { font-size: 17px; font-weight: 800; fill: #10202a; }
.gs-t-letter { font-size: 20px; }
.gs-t-note { font-size: 17px; font-style: italic; opacity: .9; }
.gs-t-gone { fill: var(--gs-bad); }
.gs-t-band { font-size: 17px; }
.gs-t-target { font-weight: 800; }
.gs-wall { fill: none; stroke: var(--gs-wall); stroke-width: 6; }
.gs-cyto { fill: url(#gs-g-cyto); stroke: var(--gs-wall); stroke-width: 3; stroke-opacity: .7; }
.gs-ribos circle { fill: var(--gs-ribo); opacity: .4; }
.gs-ribos { animation: gs-drift 10s ease-in-out infinite alternate; }
@keyframes gs-drift { from { transform: translate(-5px, 3px); } to { transform: translate(5px, -3px); } }
.gs-nucleus { fill: none; stroke: var(--gs-env); stroke-width: 6; }
.gs-nucleus-in { fill: url(#gs-g-nuc); stroke: var(--gs-env); stroke-width: 2.5; stroke-opacity: .7; }
.gs-pore { fill: var(--gs-nuc1); stroke: var(--gs-env); stroke-width: 2; }

.gs-strand { fill: none; stroke-width: 5; stroke-linecap: round; }
.gs-strand--a { stroke: var(--gs-strand-a); } .gs-strand--b { stroke: var(--gs-strand-b); opacity: .85; }
.gs-rung { stroke: var(--gs-rung); stroke-width: 2.5; }
.gs-join { stroke: var(--gs-rung); stroke-width: 3; stroke-dasharray: 4 5; }
.gs-r { stroke: var(--gs-r-line); stroke-width: 2; stroke-opacity: .6; }
.gs-r--cap { fill: var(--gs-r-cap); } .gs-r--pro { fill: var(--gs-r-pro); } .gs-r--op { fill: var(--gs-r-op); }
.gs-r--gene { fill: var(--gs-r-gene); } .gs-r--enh { fill: var(--gs-r-enh); }
.gs-r--gone { fill: none; stroke: var(--gs-bad); stroke-dasharray: 7 5; stroke-opacity: 1; }
.gs-nuc-body { fill: url(#gs-g-nucl); stroke: var(--gs-bead2); stroke-width: 2; }
.gs-nuc-wrap { fill: none; stroke: var(--gs-strand-a); stroke-width: 4; stroke-linecap: round; }
.gs-nuc-hi { fill: #fff; opacity: .35; }

.gs-glc { fill: var(--gs-glc); stroke: var(--gs-glc-line); stroke-width: 2; }
.gs-ind { fill: var(--gs-ind); stroke: var(--gs-ind-line); stroke-width: 2; }
.gs-trp { fill: var(--gs-trp); stroke: var(--gs-trp-line); stroke-width: 2; }
.gs-camp { fill: #ffd84a; stroke: #8a6a00; stroke-width: 1.5; }

.gs-p { transition: transform .7s cubic-bezier(.45,.05,.3,1); }
.gs-bob { animation: gs-bob 3.2s ease-in-out infinite alternate; }
.gs-p:nth-child(2) .gs-bob { animation-delay: -1.1s; } .gs-p:nth-child(3) .gs-bob { animation-delay: -2.2s; }
.gs-p.is-docked .gs-bob { animation: none; }
.gs-p.is-docked .gs-t-small { opacity: 0; }
@keyframes gs-bob { from { transform: translateY(-3px); } to { transform: translateY(3px); } }
.gs-pol { fill: url(#gs-g-pol); stroke: #2c4560; stroke-width: 2; }
.gs-pol-cleft { fill: none; stroke: #2c4560; stroke-width: 2; }
.gs-rep { fill: url(#gs-g-rep); stroke: #4a2a6c; stroke-width: 2; }
.gs-cap { fill: url(#gs-g-cap); stroke: #1c5a39; stroke-width: 2; }
.gs-act { stroke-width: 2; }
.gs-act--muscle .gs-act { fill: url(#gs-g-actm); stroke: #8a3410; }
.gs-act--neural .gs-act { fill: url(#gs-g-actn); stroke: #15565b; }
.gs-ghost { fill: none !important; stroke: var(--gs-text); stroke-dasharray: 5 4; opacity: .7; }
.gs-shine { fill: #fff; opacity: .45; }
.gs-lock rect, .gs-lockI { fill: #f3c969; stroke: #6b4e00; stroke-width: 2; }
.gs-lock path { fill: none; stroke: #6b4e00; stroke-width: 2.5; }
.gs-block circle { fill: var(--gs-bad); stroke: #fff; stroke-width: 2; }
.gs-block path { stroke: #fff; stroke-width: 3.5; stroke-linecap: round; }
.gs-on { animation: gs-pop .4s .6s both; }
@keyframes gs-pop { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }

.gs-mrna { fill: none; stroke: var(--gs-mrna); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; animation: gs-grow .9s ease-out forwards; }
.gs-mrna--trace { stroke-width: 2.5; opacity: .55; }
.gs-mrnas.is-still .gs-mrna { animation: none; stroke-dashoffset: 0; }

.gs-tube { fill: var(--gs-tube); stroke: var(--gs-tube-line); stroke-width: 2.5; }
.gs-tube-hi { fill: #fff; opacity: .5; }
.gs-fill { fill: url(#gs-g-glow); transition: height .8s ease-out, y .8s ease-out; opacity: .6; }
.gs-fill.is-lit { opacity: 1; filter: drop-shadow(0 0 6px var(--gs-glow2)); }
.gs-fill.is-instant { transition: none; }
.gs-band { stroke: var(--gs-tube-line); stroke-width: 1.5; stroke-dasharray: 4 4; }
.gs-meter.is-win { animation: gs-win .9s ease-out; transform-origin: 620px 170px; }
.gs-meter.is-miss { animation: gs-miss .5s ease-in-out; }
@keyframes gs-win { 30% { transform: scale(1.04); } 100% { transform: none; } }
@keyframes gs-miss { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
@keyframes gs-grow { to { stroke-dashoffset: 0; } }

/* small control icons */
.gs-i-none { stroke: currentColor; stroke-width: 3; stroke-linecap: round; opacity: .55; }
.gs-pro { fill: var(--gs-r-pro); stroke: var(--gs-r-line); stroke-width: 1.5; }
.gs-actm { fill: url(#gs-g-actm); stroke: #8a3410; stroke-width: 1.5; }
.gs-actn { fill: url(#gs-g-actn); stroke: #15565b; stroke-width: 1.5; }
.gs-bead { fill: url(#gs-g-nucl); stroke: var(--gs-bead2); stroke-width: 1.5; }
.gs-i-dna { stroke: var(--gs-strand-a); stroke-width: 3; }
.gs-o:has(input:checked) .gs-ghost { stroke: currentColor; }

/* Briefing example */
.gs-ex { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.gs-ex-cell { display: flex; gap: 8px; align-items: center; font-size: 16px; line-height: 1.3; }
.gs-ex-cell svg { flex: none; width: 34px; height: 72px; }
.gs-ex-out { font-weight: 800; }
.gs-ex-note { margin: 8px 0 0; font-size: 16px; font-style: italic; }
.ps-brief--drawer .gs-ex { grid-template-columns: 1fr 1fr; }

@media (max-width: 900px) {
  .gs { position: static; grid-template-columns: 1fr; }
  .gs-controls { overflow: visible; }
  .gs-scene { min-height: 0; }
  .gs-opts--tiles { grid-template-columns: 1fr; }
  .gs-ex { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .gs *, .gs-svg * { animation: none !important; transition: none !important; }
  .gs-mrna { stroke-dashoffset: 0; }
}
