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

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

/* buttons */
.he .he-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(--he-line); background: var(--he-card); color: var(--he-ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.he .he-btn:hover { border-color: var(--he-accent); }
.he .he-btn:focus-visible, .he button:focus-visible, .he input:focus-visible, .he select:focus-visible, .he textarea:focus-visible, .he summary:focus-visible, .he [tabindex]:focus-visible { outline: 3px solid #eaa33d; outline-offset: 2px; }
.he .he-btn--pri { background: var(--he-accent); border-color: var(--he-accent); color: var(--he-accent-ink); }
.he .he-btn--ghost { background: transparent; }
.he .he-btn:disabled { opacity: .55; cursor: not-allowed; }
.he .he-btn--small { padding: 8px 14px; }
.he-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; }
.he-more { position: relative; }
.he-more summary { list-style: none; }
.he-more summary::-webkit-details-marker { display: none; }
.he-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(--he-card); border: 1px solid var(--he-line); box-shadow: var(--he-shadow); min-width: 250px; }
.he-msg { margin: 8px 0 0; padding: 8px 10px; border-radius: 10px; background: var(--he-soft); border-left: 4px solid var(--he-accent); font-weight: 700; }
.he-msg:empty { display: none; }

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

/* modes + tabs */
.he-modes { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 0 8px; }
.he-modes-label { font-weight: 800; margin-right: 4px; }
.he-modes button, .he-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(--he-line); background: var(--he-card); color: var(--he-ink); cursor: pointer; }
.he-modes button { border-radius: 10px; }
.he-modes button.is-on { border-color: var(--he-accent); background: var(--he-accent); color: var(--he-accent-ink); }
.he-modes-note { color: var(--he-muted); margin-left: 4px; }
.he-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 10px; }
.he-tabs button { border-radius: 999px; border-width: 1px; }
.he-tabs button.is-on { background: var(--he-ink); color: var(--he-card); border-color: var(--he-ink); }

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

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

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

/* dialogs */
.he-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; --he-accent: #0d5f8a; }
.he-dialog::backdrop { background: rgba(6, 21, 37, .7); }
.he-dialog h2 { margin: 0 44px 8px 0; }
.he-dialog p { margin: 0 0 10px; }
.he-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; }
.he-dialog button:focus-visible { outline: 3px solid #eaa33d; outline-offset: 2px; }

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

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

/* ── Heat Engine Lab additions ── */
.he-scene { background: #101a26; }
.he-caption { background: #142233; }
.he-mini sub, .he-fixed sub { font-size: 75%; }
.he-fixed { margin: 0; color: #d6e6f1; }
.he-fixed:empty { display: none; }
.he-run { gap: 8px; }
.he-run { margin-top: 10px; }
.he-run .he-btn { flex: 1 1 140px; }
.he-coach .he-row--tight { margin-top: 8px; }
.he-scene .he-btn { background: #1d3a5a; color: #eef6fb; border-color: rgba(255, 255, 255, .28); }
.he-scene .he-btn--pri { background: #f3b54a; border-color: #f3b54a; color: #1c1403; }
.he-scene .he-btn:disabled { background: #1a2a3c; color: #9fb2c4; }
.he-energy { background: var(--he-card); border: 1px solid var(--he-line); border-radius: 14px; padding: 12px 14px; box-shadow: var(--he-shadow); }
.he-energy h3 { margin: 0 0 6px; font-size: 18px; }
.he-energy:empty { display: none; }
.he-ebar { display: grid; grid-template-columns: 96px minmax(0, 1fr) 84px; gap: 4px 10px; align-items: center; margin: 4px 0; }
.he-ebar b { font-size: 16px; }
.he-ebar-track { position: relative; height: 30px; border-radius: 8px; background: var(--he-soft); overflow: hidden; }
.he-ebar-track::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: var(--he-muted); opacity: .6; }
.he-ebar-fill { position: absolute; top: 4px; bottom: 4px; border-radius: 5px; transition: width .15s linear, left .15s linear; }
.he-ebar-fill.q { background: repeating-linear-gradient(135deg, #e0552a 0 8px, #ef7a4c 8px 14px); }
.he-ebar-fill.qn { background: repeating-linear-gradient(135deg, #2c7fd6 0 8px, #5aa0e6 8px 14px); }
.he-ebar-fill.w { background: #f39a1e; }
.he-ebar-fill.wn { background: #8b5cf6; }
.he-ebar-fill.u { background: repeating-linear-gradient(90deg, #2a9d6a 0 6px, #46b882 6px 10px); }
.he-ebar-val { font-weight: 700; text-align: right; white-space: nowrap; }
.he-eq { margin: 6px 0 0; font-weight: 700; }
.he-strokes { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.he-strokes li { display: grid; grid-template-columns: 24px minmax(0, 1fr); color: var(--he-muted); }
.he-strokes li.is-done { color: var(--he-ok); font-weight: 700; }
.he-strokes li.is-now { color: var(--he-ink); font-weight: 700; }
p.he-legend { display: block; margin: 6px 0 0; }
.he-find { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--he-soft); border: 1px solid var(--he-line); }
.he-find h3 { margin: 0 0 6px; }
.he-find-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.he-find-row label { display: grid; gap: 4px; font-weight: 700; }
.he-find-row input { min-height: 44px; width: 11em; font: 700 18px "Atkinson Hyperlegible", system-ui, sans-serif; padding: 6px 10px; border-radius: 8px; border: 2px solid var(--he-line); background: var(--he-card); color: var(--he-ink); }
.he-find .he-explain { margin-top: 8px; }
.he-data-tables td:first-child { white-space: nowrap; }
.he-pv-mini { width: 100%; max-width: 520px; height: auto; display: block; }
.he-fig text { font: 600 16px "Atkinson Hyperlegible", system-ui, sans-serif; fill: var(--he-ink); }
.he-fig .ax { stroke: var(--he-ink); stroke-width: 1.6; fill: none; }
.he-fig .g { stroke: var(--he-line); stroke-width: 1; }
.he-fig .loop { fill: rgba(192, 86, 26, .16); stroke: #c0561a; stroke-width: 3; }
.he-fig .path2 { fill: none; stroke: #1f63c4; stroke-width: 3; stroke-dasharray: 9 6; }
.he-fig .dot { fill: var(--he-card); stroke: #c0561a; stroke-width: 2; }
html[data-theme="dark"] .he-fig .loop { fill: rgba(255, 176, 102, .2); stroke: #ffb066; }
html[data-theme="dark"] .he-fig .dot { stroke: #ffb066; }
html[data-theme="dark"] .he-fig .path2 { stroke: #7cc4ff; }
@media (max-width: 760px) { .he-ebar { grid-template-columns: 96px minmax(0, 1fr) 84px; } }

.he-scene .he-bench-controls { padding: 12px 14px 10px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
/* data tab: graph and the "find it" box side by side, tables full width below (the stroke table has 7 columns) */
.he .he-data-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.he .he-data-graph { display: grid; grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr); column-gap: 20px; align-items: start; }
.he .he-data-graph > :not(.he-find) { grid-column: 1; }
.he .he-data-graph > .he-find { grid-column: 2; grid-row: 1 / span 3; margin-top: 0; }
@media (max-width: 900px) { .he .he-data-graph { grid-template-columns: minmax(0, 1fr); } .he .he-data-graph > .he-find { grid-column: 1; grid-row: auto; margin-top: 12px; } }
.he .he-seg { flex-wrap: wrap; } .he .he-scene .he-seg button { white-space: nowrap; flex: 1 0 auto; padding-left: 10px; padding-right: 10px; }
