/* Toxicology Dose-Response Lab. Everything is scoped under .tx so site.css (loaded after this file) can't collide.
   Text is 16px or larger everywhere; tap targets are 44px or taller. */
.tx {
  --tx-ink: #14263a; --tx-muted: #4b6075; --tx-paper: #eef4f7; --tx-card: #ffffff; --tx-line: #cfdce4;
  --tx-accent: #0d5f8a; --tx-accent-ink: #ffffff; --tx-sun: #e89a2c; --tx-soft: #f1f6f9; --tx-ok: #1f7a3d; --tx-no: #b3261e;
  --tx-shadow: 0 1px 2px rgba(16, 40, 60, .06), 0 8px 24px rgba(16, 40, 60, .07);
  color: var(--tx-ink); font: 16px/1.5 "Atkinson Hyperlegible", system-ui, sans-serif;
  background: radial-gradient(ellipse 90% 60% at 50% -10%, #dcebf3, var(--tx-paper) 70%);
  padding: 0 clamp(12px, 2vw, 28px) 56px; min-height: 70vh;
}
html[data-theme="dark"] .tx {
  --tx-ink: #e6eef3; --tx-muted: #aabdca; --tx-paper: #0f1b26; --tx-card: #172633; --tx-line: #33495a;
  --tx-accent: #5cc8ff; --tx-accent-ink: #06202e; --tx-soft: #1d3040; --tx-ok: #7fdc9a; --tx-no: #ff9b93;
  --tx-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  background: radial-gradient(ellipse 90% 60% at 50% -10%, #19324a, var(--tx-paper) 70%);
}
.tx *, .tx *::before, .tx *::after { box-sizing: border-box; }
.tx [hidden] { display: none !important; }
.tx h1, .tx h2, .tx h3 { color: var(--tx-ink); font-family: inherit; }
.tx p { margin: 0 0 8px; }
.tx-eyebrow { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: .06em; color: var(--tx-accent); }
.tx-muted { color: var(--tx-muted); }
.tx > * { max-width: 1500px; margin-left: auto; margin-right: auto; }

/* title bar */
.tx-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; padding: 10px 0 8px; }
.tx-titles { flex: 1 1 280px; min-width: 0; }
.tx-bar h1 { margin: 0; font-size: clamp(24px, 2.6vw, 32px); line-height: 1.15; }
.tx-level { padding: 4px 12px; border-radius: 999px; background: var(--tx-soft); border: 1px solid var(--tx-line); font-weight: 700; }
.tx-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* buttons */
.tx .tx-btn { appearance: none; font: 700 16px/1.2 "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 44px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--tx-line); background: var(--tx-card); color: var(--tx-ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tx .tx-btn:hover { border-color: var(--tx-accent); }
.tx .tx-btn:focus-visible, .tx button:focus-visible, .tx input:focus-visible, .tx select:focus-visible, .tx textarea:focus-visible, .tx summary:focus-visible, .tx [tabindex]:focus-visible { outline: 3px solid #eaa33d; outline-offset: 2px; }
.tx .tx-btn--pri { background: var(--tx-accent); border-color: var(--tx-accent); color: var(--tx-accent-ink); }
.tx .tx-btn--ghost { background: transparent; }
.tx .tx-btn:disabled { opacity: .55; cursor: not-allowed; }
.tx .tx-btn--small { padding: 8px 14px; }
.tx-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; }
.tx-more { position: relative; }
.tx-more summary { list-style: none; }
.tx-more summary::-webkit-details-marker { display: none; }
.tx-more-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 12px; background: var(--tx-card); border: 1px solid var(--tx-line); box-shadow: var(--tx-shadow); min-width: 250px; }
.tx-msg { margin: 8px 0 0; padding: 8px 10px; border-radius: 10px; background: var(--tx-soft); border-left: 4px solid var(--tx-accent); font-weight: 700; }
.tx-msg:empty { display: none; }

/* start card */
.tx-gate { margin-top: 8px; padding: clamp(14px, 3vw, 40px); border-radius: 22px; background: linear-gradient(140deg, #101c3a, #1f5f9a 48%, #d8743a); }
.tx-gate-card { max-width: 980px; margin: 0 auto; padding: clamp(18px, 3vw, 36px); border-radius: 18px; background: var(--tx-card); box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.tx-gate-card h2 { font-size: clamp(26px, 3.6vw, 38px); margin: 4px 0 6px; line-height: 1.15; }
.tx-gate-lede { font-size: 18px; color: var(--tx-muted); }
.tx-how { margin: 10px 0; padding-left: 26px; font-size: 18px; }
.tx-how li { padding: 2px 0; }
.tx-gate-pick { font-weight: 800; margin: 14px 0 0; }
.tx-gate-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 10px; }
.tx-gate-grid button { all: unset; box-sizing: border-box; display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 2px solid var(--tx-line); border-radius: 14px; cursor: pointer; background: var(--tx-soft); color: var(--tx-ink); min-height: 44px; }
.tx-gate-grid button:hover { border-color: var(--tx-accent); }
.tx-gate-grid button:focus-visible { outline: 3px solid #eaa33d; outline-offset: 2px; }
.tx-gate-grid button.is-first { border-color: var(--tx-accent); }
.tx-gate-grid b { font-size: 20px; line-height: 1.25; }
.tx-gate-grid span { color: var(--tx-muted); }
.tx-gate-grid em { font-style: normal; font-weight: 800; color: var(--tx-accent); }

/* modes + tabs */
.tx-modes { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 0 8px; }
.tx-modes-label { font-weight: 800; margin-right: 4px; }
.tx-modes button, .tx-tabs button { appearance: none; font: 700 16px/1.2 "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 44px; padding: 8px 14px; border: 2px solid var(--tx-line); background: var(--tx-card); color: var(--tx-ink); cursor: pointer; }
.tx-modes button { border-radius: 10px; }
.tx-modes button.is-on { border-color: var(--tx-accent); background: var(--tx-accent); color: var(--tx-accent-ink); }
.tx-modes-note { color: var(--tx-muted); margin-left: 4px; }
.tx-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 10px; }
.tx-tabs button { border-radius: 999px; border-width: 1px; }
.tx-tabs button.is-on { background: var(--tx-ink); color: var(--tx-card); border-color: var(--tx-ink); }

/* bench */
.tx-stage { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 14px; align-items: start; }
.tx-stage.is-test { grid-template-columns: minmax(0, 1fr); max-width: 980px; }
.tx-stage.is-test .tx-side, .tx-stage.is-test .tx-bench-controls { display: none; }
.tx-main { min-width: 0; }
.tx-scene { background: #0b1722; border-radius: 16px; overflow: hidden; box-shadow: var(--tx-shadow); color: #eaf3f8; }
.tx-canvas-wrap { padding: 8px 8px 0; }
.tx-canvas-wrap canvas { display: block; width: 100%; touch-action: pan-y; }
.tx-key { display: flex; flex-wrap: wrap; gap: 4px 16px; list-style: none; margin: 6px 0 0; padding: 0 14px; }
.tx-key li { display: flex; align-items: center; gap: 6px; }
.tx-key b { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #eaf3f8; color: #16232f; }
.tx-bench-controls { padding: 4px 14px 12px; display: grid; gap: 10px; }
.tx-dial { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: #10263f; border: 1px solid rgba(255, 255, 255, .12); }
.tx-dial label { grid-column: 1 / -1; font-weight: 800; color: #ffd27a; }
.tx-dial input[type=range] { width: 100%; min-height: 44px; margin: 0; accent-color: #f3b54a; }
.tx-dial p { grid-column: 1 / -1; margin: 0; color: #c7d6e2; }
.tx-scene .tx-btn { background: #16304d; border-color: rgba(255, 255, 255, .28); color: #eef6fb; }
.tx-scene .tx-btn:hover { border-color: #f3b54a; }
.tx-scene .tx-btn--pri { background: #f3b54a; border-color: #f3b54a; color: #1c1403; }
.tx-step { min-width: 76px; }
.tx-rack { padding: 8px 10px 10px; border-radius: 12px; background: #10263f; border: 1px solid rgba(255, 255, 255, .12); }
.tx-rack-label { margin: 0 0 8px; font-weight: 800; color: #ffd27a; }
.tx-rack-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tx-cuvbtn { appearance: none; display: grid; grid-template-columns: auto auto; align-items: center; gap: 2px 8px; min-height: 60px; min-width: 104px; padding: 6px 10px 6px 6px; border-radius: 12px; border: 2px solid rgba(255, 255, 255, .25); background: #16304d; color: #eef6fb; font: 16px/1.2 "Atkinson Hyperlegible", system-ui, sans-serif; cursor: pointer; text-align: left; }
.tx-cuvbtn .tx-cuv { grid-row: 1 / span 2; }
.tx-cuvbtn span { display: flex; flex-direction: column; }
.tx-cuvbtn b { font-size: 18px; }
.tx-cuvbtn small { font-size: 16px; color: #c7d6e2; }
.tx-cuvbtn em { grid-column: 2; font-style: normal; font-weight: 800; color: #ffd27a; }
.tx-cuvbtn.is-on { border-color: #f3b54a; background: #1f3d5f; box-shadow: 0 0 0 2px rgba(243, 181, 74, .35); }
.tx-cuvbtn:hover { border-color: #f3b54a; }
.tx-cuvbtn:disabled { opacity: .6; cursor: not-allowed; }
.tx-ex { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; margin-top: 10px; }
.tx-ex label { display: flex; flex-direction: column; font-weight: 700; }
.tx-ex output { font-weight: 800; color: #ffd27a; font-variant-numeric: tabular-nums; }
.tx-ex input[type=range] { width: 100%; min-height: 44px; margin: 0; accent-color: #f3b54a; }
.tx-do { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tx-do .tx-btn--undo { margin-left: auto; }
.tx-scene .tx-msg { background: #16304d; color: #eef6fb; border-left-color: #8fd0ff; margin: 0; }
.tx-scene .tx-msg.ok { border-left-color: #7ce0a3; }
.tx-scene .tx-msg.no { border-left-color: #ff9b93; }
.tx-caption { margin: 0; padding: 10px 14px; background: #0d223b; color: #d6e6f1; border-top: 1px solid rgba(255, 255, 255, .08); }

/* side: coach, graph, checks */
.tx-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tx-coach, .tx-sidegraph, .tx-compare, .tx-ch { background: var(--tx-card); border: 1px solid var(--tx-line); border-radius: 14px; padding: 12px 14px; box-shadow: var(--tx-shadow); }
.tx-next { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 8px 10px; margin-top: 6px; border-radius: 10px; background: var(--tx-soft); border-left: 4px solid var(--tx-sun); font-size: 17px; }
.tx-hint { margin: 8px 0 0; padding: 8px 10px; border-radius: 10px; border: 1px dashed var(--tx-accent); }
.tx-stepchecks { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; }
.tx-stepchecks li { display: grid; grid-template-columns: 22px minmax(0, 1fr); color: var(--tx-muted); }
.tx-stepchecks li.done { color: var(--tx-ok); font-weight: 700; }
.tx-sidegraph h3 { margin: 0 0 6px; font-size: 18px; }
.tx-sidegraph canvas, .tx-graph canvas { display: block; width: 100%; }
.tx-seg { display: flex; gap: 6px; margin: 0 0 8px; }
.tx-seg button { appearance: none; flex: 1; min-height: 44px; font: 700 16px/1.2 "Atkinson Hyperlegible", system-ui, sans-serif; border-radius: 10px; border: 2px solid var(--tx-line); background: var(--tx-card); color: var(--tx-ink); cursor: pointer; }
.tx-seg button.is-on { border-color: var(--tx-accent); background: var(--tx-accent); color: var(--tx-accent-ink); }
.tx-more-checks { display: flex; flex-direction: column; gap: 10px; }
.tx-checks-title { margin: 4px 0 0; font-size: 18px; }
.tx-compare > b, .tx-ch summary { font-size: 17px; font-weight: 800; }
.tx-compare p { margin: 6px 0; }
.tx-compare input[type=text] { min-height: 44px; width: 8.5em; max-width: 100%; font: 600 16px "Atkinson Hyperlegible", system-ui, sans-serif; border: 1px solid var(--tx-line); border-radius: 8px; padding: 4px 8px; background: var(--tx-card); color: var(--tx-ink); }
.tx-compare-out { margin: 6px 0 0; font-weight: 700; }
.tx-compare-out:empty { display: none; }
.tx-compare-out.no { color: var(--tx-no); } .tx-compare-out.ok { color: var(--tx-ok); }
.tx-plain { border: 0; margin: 0; padding: 0; min-width: 0; }
.tx-rowpick { display: grid; grid-template-columns: 26px minmax(0, 1fr); align-items: start; gap: 4px; min-height: 44px; padding: 8px 4px; cursor: pointer; }
.tx-rowpick input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--tx-accent); }
.tx-ch summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.tx-cards { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 8px; }
.tx-cards li { padding: 8px 10px; border-radius: 10px; background: var(--tx-soft); border-left: 4px solid var(--tx-line); }
.tx-cards li.done { border-left-color: var(--tx-ok); }
.tx-cards b, .tx-cards span { display: block; }
.tx-flash { animation: tx-flash 1.2s ease 2; }
@keyframes tx-flash { 50% { box-shadow: 0 0 0 5px rgba(234, 163, 61, .85); } }

/* panels: pre-lab, data, CER, test */
.tx-panel { background: var(--tx-card); border: 1px solid var(--tx-line); border-radius: 16px; padding: 16px 18px; box-shadow: var(--tx-shadow); }
.tx-panel h2 { margin: 4px 0 8px; font-size: 22px; line-height: 1.25; }
.tx-panel h3 { margin: 14px 0 6px; font-size: 18px; }
.tx-qbox { padding: 10px 14px; border-radius: 12px; background: var(--tx-soft); border-left: 4px solid var(--tx-accent); margin: 8px 0; }
.tx-qbox small { display: block; font-size: 16px; font-weight: 800; color: var(--tx-accent); }
.tx-qbox b { font-size: 18px; }
.tx-prelab-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 8px 28px; }
.tx-practice { display: flex; gap: 10px; padding: 10px 12px; margin: 10px 0; border-radius: 12px; background: var(--tx-soft); border: 1px solid var(--tx-line); }
.tx-practice a, .tx-dialog a { color: var(--tx-accent); font-weight: 700; }
.tx-fig { margin: 0 0 8px; text-align: center; }
.tx-wheel { max-width: 100%; height: auto; color: var(--tx-ink); }
.tx-fig figcaption { color: var(--tx-muted); }
.tx-vocab { display: flex; flex-wrap: wrap; gap: 8px; }
.tx-term { position: relative; appearance: none; min-width: 44px; font: 700 16px/1.2 "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 44px; padding: 8px 12px; border-radius: 999px; border: 1px dashed var(--tx-accent); background: var(--tx-soft); color: var(--tx-ink); cursor: help; }
p .tx-term { min-height: 0; padding: 0 4px; border-width: 0 0 2px; border-radius: 4px; background: none; }
.tx-tip { display: none; position: absolute; left: 0; top: calc(100% + 6px); z-index: 20; width: min(320px, 78vw); padding: 10px 12px; border-radius: 10px; background: #10253b; color: #fff; font-weight: 500; line-height: 1.45; text-align: left; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); }
.tx-term:hover .tx-tip, .tx-term:focus .tx-tip { display: block; }
.tx-safety { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tx-safety li { display: grid; grid-template-columns: 24px minmax(0, 1fr); }
.tx-frame { font-size: 17px; line-height: 2.5; }
.tx-frame select, .tx-compare select { font: 700 16px "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 44px; max-width: 100%; border-radius: 8px; border: 2px solid var(--tx-accent); background: var(--tx-card); color: var(--tx-ink); padding: 4px 8px; }
.tx-because { display: block; font-weight: 700; margin-top: 4px; }
.tx-area, .tx-cer-grid textarea { display: block; width: 100%; font: 16px/1.45 "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 84px; padding: 10px; margin-top: 4px; border: 1px solid var(--tx-line); border-radius: 10px; background: var(--tx-card); color: var(--tx-ink); }
.tx-data-head, .tx-cer-head, .tx-test-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 8px 16px; }
.tx-table { overflow-x: auto; border: 1px solid var(--tx-line); border-radius: 10px; margin-bottom: 8px; }
.tx-table table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.tx-table th, .tx-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--tx-line); vertical-align: top; }
.tx-table th { background: var(--tx-soft); min-width: 96px; }
.tx-empty { color: var(--tx-muted); }
.tx-graph { max-width: 760px; margin-top: 8px; }
.tx-cer-head > div { flex: 1 1 320px; min-width: 0; }
.tx-checklist { flex: 1 1 320px; list-style: none; margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--tx-soft); display: grid; gap: 4px; }
.tx-checklist li { display: grid; grid-template-columns: 22px minmax(0, 1fr); color: var(--tx-muted); }
.tx-checklist li.done { color: var(--tx-ok); font-weight: 700; }
.tx-pick { margin: 10px 0; padding: 4px 12px; border: 1px dashed var(--tx-line); border-radius: 10px; }
.tx-pick summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.tx-cer-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tx-cer-grid label { font-weight: 800; display: block; }
.tx-cer-grid small { font-size: 16px; font-weight: 500; color: var(--tx-muted); margin-left: 6px; }
.tx-cer-grid textarea { min-height: 170px; }
.tx-turnin { margin-top: 14px; }
.tx-done { margin-top: 14px; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--tx-ok); background: var(--tx-soft); }
.tx-done h3 { margin-top: 0; }
.tx-test { margin-top: 14px; max-width: 980px; }
.tx-test-head h2 small { font-size: 18px; color: var(--tx-muted); }
.tx-progress { flex: 0 0 200px; height: 10px; border-radius: 999px; background: var(--tx-soft); border: 1px solid var(--tx-line); overflow: hidden; margin-top: 12px; }
.tx-progress i { display: block; height: 100%; background: var(--tx-accent); }
.tx-tag { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--tx-soft); border: 1px solid var(--tx-line); font-weight: 700; }
.tx-q { font-size: 18px; margin: 12px 0 8px; }
.tx-test-list { margin: 6px 0; padding-left: 24px; }
.tx-choices { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; min-width: 0; }
.tx-choice { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 12px; border: 2px solid var(--tx-line); border-radius: 12px; cursor: pointer; background: var(--tx-card); position: relative; }
.tx-choice input, .tx-unit input { position: absolute; opacity: 0; pointer-events: none; }
.tx-choice:focus-within, .tx-unit:focus-within { outline: 3px solid #eaa33d; outline-offset: 2px; }
.tx-choice.is-picked, .tx-unit.is-picked { border-color: var(--tx-accent); background: var(--tx-soft); box-shadow: inset 0 0 0 1px var(--tx-accent); }
.tx-choice.ok { border-color: var(--tx-ok); } .tx-choice.no { border-color: var(--tx-no); }
.tx-choice em { margin-left: auto; font-style: normal; font-weight: 900; font-size: 20px; }
.tx-choice.ok em { color: var(--tx-ok); } .tx-choice.no em { color: var(--tx-no); }
.tx-choices:disabled .tx-choice, .tx-units:disabled .tx-unit { cursor: default; }
.tx-letter { flex: 0 0 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--tx-soft); border: 1px solid var(--tx-line); font-weight: 800; }
.tx-numq { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-end; }
.tx-numq-val { display: flex; flex-direction: column; font-weight: 700; }
.tx-numq-val input { min-height: 48px; width: 11em; max-width: 100%; margin-top: 4px; font: 700 18px "Atkinson Hyperlegible", system-ui, sans-serif; border: 2px solid var(--tx-line); border-radius: 10px; padding: 6px 10px; background: var(--tx-card); color: var(--tx-ink); }
.tx-units { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
.tx-units legend { font-weight: 700; padding: 0; margin-bottom: 4px; }
.tx-unit { position: relative; display: inline-flex; align-items: center; min-height: 48px; padding: 8px 14px; border: 2px solid var(--tx-line); border-radius: 10px; cursor: pointer; font-weight: 700; background: var(--tx-card); }
.tx-unit.is-picked::before { content: "✓ "; white-space: pre; }
.tx-eqline { margin-top: 8px; }
.tx-run { margin: 12px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.tx-readout { flex: 1 1 100%; margin: 4px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--tx-soft); border-left: 4px solid var(--tx-sun); }
.tx-explain { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--tx-soft); border-left: 4px solid var(--tx-line); }
.tx-explain.ok { border-left-color: var(--tx-ok); } .tx-explain.no { border-left-color: var(--tx-no); }
.tx-test-nav { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; }
.tx-test-nav .tx-btn--pri { margin-left: auto; }
.tx-review { padding-left: 24px; display: grid; gap: 10px; }
.tx-review li.ok::marker { color: var(--tx-ok); } .tx-review li.no::marker { color: var(--tx-no); }

/* dialogs */
.tx-dialog { max-width: min(720px, calc(100vw - 24px)); border: 0; border-radius: 16px; padding: 22px 26px; color: #14263a; background: #fff; box-shadow: 0 20px 70px rgba(0, 0, 0, .4); font: 16px/1.55 "Atkinson Hyperlegible", system-ui, sans-serif; --tx-accent: #0d5f8a; }
.tx-dialog::backdrop { background: rgba(6, 21, 37, .7); }
.tx-dialog h2 { margin: 0 44px 8px 0; }
.tx-dialog p { margin: 0 0 10px; }
.tx-x { position: absolute; right: 12px; top: 12px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid #cfdce4; background: #f1f6f9; color: #14263a; font-size: 24px; line-height: 1; cursor: pointer; }
.tx-dialog button:focus-visible { outline: 3px solid #eaa33d; outline-offset: 2px; }

@media (max-width: 1180px) {
  .tx-stage { display: flex; flex-direction: column; }
  .tx-stage:not(.is-test) .tx-side { display: contents; }
  .tx-coach { order: -1; }
  .tx-prelab-grid, .tx-cer-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .tx-gate-grid { grid-template-columns: minmax(0, 1fr); }
  .tx-ex { grid-template-columns: minmax(0, 1fr); }
  .tx-progress { flex-basis: 100%; }
  .tx-frame select { width: 100%; }
  .tx-do .tx-btn { flex: 1 1 100%; }
  .tx-cuvbtn { flex: 1 1 130px; }
  .tx-more-menu { right: auto; left: 0; }
}
@media (prefers-reduced-motion: reduce) { .tx * { transition: none !important; animation: none !important; } }
@media print {
  .tx-scene, .tx-tabs, .tx-modes, .tx-actions, .tx-turnin, .tx-side, .tx-gate, .tx-pick, #export, #toCer { display: none !important; }
}
.tx-signin:empty { display: none; }
.tx-signin .tlg-signin-note { margin: 0 0 8px; }
.tx-links a { display: block; padding: 4px 0; }
.tx-dialog b { white-space: nowrap; }

/* ── Toxicology bench additions ── */
.tx { background: radial-gradient(ellipse 90% 60% at 50% -10%, #dcefe9, var(--tx-paper) 70%); }
html[data-theme="dark"] .tx { background: radial-gradient(ellipse 90% 60% at 50% -10%, #173a3a, var(--tx-paper) 70%); }
.tx-gate { background: linear-gradient(140deg, #0e2a33, #1d6f7a 50%, #e07a3a); }
.tx-gate-top { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 16px; align-items: center; }
.tx-gate-art { width: 220px; height: auto; display: block; }
.tx-scene { background: #0b1a20; }
.tx-caption { background: #0d2329; }
.tx-setup { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.tx-field { flex: 1 1 200px; min-width: 0; }
.tx-mini { display: block; font-weight: 800; color: #ffd27a; margin-bottom: 4px; }
.tx-scene .tx-seg button { background: #16304d; color: #eef6fb; border-color: rgba(255, 255, 255, .28); }
.tx-scene .tx-seg button.is-on { background: #f3b54a; border-color: #f3b54a; color: #1c1403; }
.tx-scene .tx-seg button:disabled { opacity: .55; cursor: not-allowed; }
.tx-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; counter-reset: s; }
.tx-steps li { counter-increment: s; display: flex; }
.tx-steps .tx-btn { flex: 1; text-align: left; justify-content: flex-start; align-items: flex-start; padding: 8px 10px; line-height: 1.25; }
.tx-steps .tx-btn::before { content: counter(s); flex: 0 0 26px; height: 26px; display: inline-grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, .14); font-weight: 800; }
.tx-steps li.is-done .tx-btn::before { content: "✓"; background: #2f8f5b; color: #fff; }
.tx-scene .tx-btn--pri::before { background: rgba(0, 0, 0, .15); }
.tx-row--tight { margin: 0; }
.tx-wellpick { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; font-weight: 700; color: #eef6fb; }
.tx-wellpick select { min-height: 44px; font: 700 16px "Atkinson Hyperlegible", system-ui, sans-serif; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .3); background: #16304d; color: #eef6fb; padding: 4px 8px; }
.tx-coach-h { font-size: 18px; font-weight: 800; margin: 0 0 4px; color: var(--tx-accent); }
.tx-coach { border-left: 6px solid var(--tx-sun); }
.tx-coach p:last-of-type { margin-bottom: 0; }
.tx-coach .tx-btn { margin-top: 8px; }
.tx-legend { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.tx-legend li { display: inline-flex; align-items: center; gap: 6px; }
.tx-mk { font-size: 18px; line-height: 1; }
.tx-data-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px 24px; align-items: start; }
.tx-data-graph canvas { display: block; width: 100%; border-radius: 10px; border: 1px solid var(--tx-line); }
.tx-graph-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; }
.tx-graph-head h3 { margin: 6px 0; }
.tx-graph-head .tx-seg { margin: 0; flex: 0 1 380px; }
.tx-reader { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--tx-soft); border: 1px solid var(--tx-line); }
.tx-reader h3 { margin-top: 0; }
.tx-curlabel { display: block; font-weight: 700; margin-top: 4px; }
.tx-curlabel output { font-weight: 800; font-variant-numeric: tabular-nums; }
.tx-cursor { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.tx-cursor input[type=range] { width: 100%; min-height: 44px; margin: 0; accent-color: var(--tx-accent); }
.tx-step { min-width: 48px; }
.tx-curread { margin: 6px 0 0; min-height: 24px; }
.tx-ok { color: var(--tx-ok); font-weight: 800; } .tx-no { color: var(--tx-no); font-weight: 800; }
.tx-readings { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.tx-readings li.ok { color: var(--tx-ok); } .tx-readings li.no { color: var(--tx-no); }
.tx-quiz { margin-top: 16px; display: grid; gap: 12px; }
.tx-quiz h3 { margin: 0; }
.tx-qcard { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--tx-line); background: var(--tx-card); }
.tx-qcard.is-ok { border-color: var(--tx-ok); }
.tx-qcard.is-wait { background: var(--tx-soft); }
.tx-qcard fieldset { border: 0; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; min-width: 0; }
.tx-qcard legend { font-size: 17px; margin-bottom: 8px; padding: 0; }
.tx-qcard p { margin: 0 0 4px; }
.tx-inline { margin-left: 8px; }
.tx-question { font-size: 18px; padding: 10px 14px; border-radius: 12px; background: var(--tx-soft); border-left: 4px solid var(--tx-accent); }
.tx-pre-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 8px 28px; }
.tx-plan { padding-left: 24px; }
.tx-plan li { padding: 2px 0; }
.tx-vocab { margin: 0; display: grid; gap: 6px; }
.tx-vocab dt { font-weight: 800; }
.tx-vocab dd { margin: 0 0 4px; color: var(--tx-muted); }
.tx-pred { margin-top: 12px; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--tx-accent); }
.tx-pred h3 { margin-top: 0; }
.tx-pred fieldset { border: 0; padding: 0; margin: 0 0 10px; display: grid; gap: 8px; min-width: 0; }
.tx-pred legend { font-size: 17px; margin-bottom: 8px; padding: 0; }
.tx-pred label[for=predWhy] { display: block; font-weight: 800; }
.tx-pred small { font-weight: 500; color: var(--tx-muted); font-size: 16px; }
.tx-pred textarea { display: block; width: 100%; font: 16px/1.45 "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 64px; padding: 10px; margin-top: 4px; border: 1px solid var(--tx-line); border-radius: 10px; background: var(--tx-card); color: var(--tx-ink); }
.tx-dil { width: 100%; max-width: 560px; height: auto; font: 600 16px "Atkinson Hyperlegible", system-ui, sans-serif; }
.tx-dil text { fill: var(--tx-muted); } .tx-dil .b { fill: var(--tx-ink); font-weight: 800; } .tx-dil .u { fill: var(--tx-muted); }
.tx-dil .glass { fill: none; stroke: var(--tx-muted); stroke-width: 2; }
.tx-dil .arr { fill: none; stroke: var(--tx-sun); stroke-width: 2.5; marker-end: none; }
.tx-fig { width: 100%; max-width: 560px; height: auto; display: block; margin: 4px 0 10px; font: 600 16px "Atkinson Hyperlegible", system-ui, sans-serif; background: var(--tx-card); border: 1px solid var(--tx-line); border-radius: 10px; }
.tx-fig text { fill: var(--tx-muted); } .tx-fig .t { fill: var(--tx-ink); font-weight: 700; }
.tx-fig .g { stroke: var(--tx-line); stroke-width: 1; } .tx-fig .a { stroke: var(--tx-ink); stroke-width: 1.6; }
.tx-fig .h { stroke: #b45309; stroke-width: 1.5; stroke-dasharray: 6 5; }
.tx-fig .c { fill: none; stroke-width: 3; } .tx-fig .c0 { stroke: #2f6fd1; } .tx-fig .c1 { stroke: #d9682b; stroke-dasharray: 9 5; }
.tx-fig .p0 { fill: #2f6fd1; stroke: var(--tx-card); stroke-width: 2; } .tx-fig .p1 { fill: #d9682b; stroke: var(--tx-card); stroke-width: 2; }
.tx-fig .lbl { font-weight: 800; } .tx-fig .l0 { fill: #2f6fd1; } .tx-fig .l1 { fill: #c2541b; }
html[data-theme="dark"] .tx-fig .l0, html[data-theme="dark"] .tx-fig .p0 { fill: #7fb2ff; } html[data-theme="dark"] .tx-fig .c0 { stroke: #7fb2ff; }
html[data-theme="dark"] .tx-fig .h { stroke: #ffb454; }
.tx-key { padding-left: 20px; display: grid; gap: 6px; }
.tx-dialog b { white-space: normal; }
@media (max-width: 1180px) {
  .tx-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tx-data-grid, .tx-pre-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .tx-gate-top { grid-template-columns: minmax(0, 1fr); }
  .tx-gate-art { width: 160px; margin: 0 auto; }
  .tx-steps { grid-template-columns: minmax(0, 1fr); }
  .tx-wellpick { margin-left: 0; flex-wrap: wrap; }
  .tx-setup .tx-field { flex-basis: 100%; }
}
@media print { .tx-reader, .tx-quiz .tx-btn { display: none !important; } }
.tx-qcard fieldset.is-short { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.tx-qcard fieldset.is-short legend { grid-column: 1 / -1; }
.tx-setup { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.tx-seg { flex-wrap: wrap; }
.tx-seg button { min-width: 48px; }
