/* States of Matter & Heating Curves styles (structure shared with the Greenhouse and Seasons labs). */
.sm {
  --sm-ink: #14263a; --sm-muted: #4b6075; --sm-paper: #eef4f7; --sm-card: #ffffff; --sm-line: #cfdce4;
  --sm-accent: #0d6670; --sm-accent-ink: #ffffff; --sm-sun: #e89a2c; --sm-soft: #f3f7f9; --sm-ok: #1f7a3d; --sm-no: #b3261e;
  --sm-shadow: 0 1px 2px rgba(16, 40, 60, .06), 0 8px 24px rgba(16, 40, 60, .07);
  color: var(--sm-ink); font: 16px/1.5 "Atkinson Hyperlegible", system-ui, sans-serif;
  background: radial-gradient(ellipse 90% 60% at 50% -10%, #dcebf3, var(--sm-paper) 70%);
  padding: 0 clamp(12px, 2vw, 28px) 56px; min-height: 70vh;
}
html[data-theme="dark"] .sm {
  --sm-ink: #e6eef3; --sm-muted: #aabdca; --sm-paper: #0f1b26; --sm-card: #172633; --sm-line: #33495a;
  --sm-accent: #3fb5a3; --sm-accent-ink: #062521; --sm-soft: #1d3040; --sm-ok: #7fdc9a; --sm-no: #ff9b93;
  --sm-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(--sm-paper) 70%);
}
.sm *, .sm *::before, .sm *::after { box-sizing: border-box; }
.sm [hidden] { display: none !important; }
.sm h1, .sm h2, .sm h3 { color: var(--sm-ink); font-family: inherit; }
.sm-eyebrow { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: .08em; color: var(--sm-accent); }
.sm-muted { color: var(--sm-muted); }

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

/* buttons */
.sm .sm-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(--sm-line); background: var(--sm-card); color: var(--sm-ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.sm .sm-btn:hover { border-color: var(--sm-accent); }
.sm .sm-btn:disabled { opacity: .5; cursor: not-allowed; }
.sm .sm-btn--pri { background: var(--sm-accent); border-color: var(--sm-accent); color: var(--sm-accent-ink); }
.sm .sm-btn--ghost { background: transparent; }
.sm .sm-btn--small { min-height: 36px; padding: 6px 12px; margin-top: 6px; }
.sm button:focus-visible, .sm a:focus-visible, .sm input:focus-visible, .sm select:focus-visible, .sm textarea:focus-visible { outline: 3px solid #eaa33d; outline-offset: 2px; }

/* level gate */
.sm-gate { max-width: 1500px; margin: 8px auto 0; padding: clamp(18px, 4vw, 48px); border-radius: 22px; background: linear-gradient(140deg, #071a30, #11405e 60%, #b9853d); }
.sm-gate-card { max-width: 860px; margin: 0 auto; padding: clamp(22px, 4vw, 44px); border-radius: 18px; background: var(--sm-card); box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.sm-gate-card h2 { font-size: clamp(28px, 4vw, 42px); margin: 6px 0; }
.sm-gate-lede { font-size: 18px; color: var(--sm-muted); }
.sm-gate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.sm-gate-grid button { all: unset; box-sizing: border-box; display: flex; flex-direction: column; gap: 6px; padding: 18px; border: 2px solid var(--sm-line); border-radius: 14px; cursor: pointer; background: var(--sm-soft); color: var(--sm-ink); }
.sm-gate-grid button:hover, .sm-gate-grid button:focus-visible { border-color: var(--sm-accent); box-shadow: 0 0 0 3px rgba(13, 102, 112, .25); }
.sm-gate-grid button:disabled { opacity: .45; cursor: not-allowed; }
.sm-gate-grid b { font-size: 21px; }
.sm-gate-grid span { color: var(--sm-muted); }
.sm-gate-grid em { font-style: normal; font-weight: 700; color: var(--sm-accent); }

/* tabs */
#workspace { max-width: 1500px; margin: 0 auto; }
.sm-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; }
.sm-tabs button { appearance: none; font: 700 16px/1.2 "Atkinson Hyperlegible", system-ui, sans-serif; white-space: nowrap; min-height: 44px; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--sm-line); background: var(--sm-card); color: var(--sm-ink); cursor: pointer; }
.sm-tabs button.is-on { background: var(--sm-ink); color: var(--sm-card); border-color: var(--sm-ink); }

/* stage */
.sm-stage { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.sm-scene { background: #0a1a30; border-radius: 16px; overflow: hidden; box-shadow: var(--sm-shadow); color: #eaf3f8; }
.sm-viewbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 10px; background: #0d223b; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.sm-views { display: flex; gap: 6px; flex-wrap: wrap; }
.sm-views button { appearance: none; font: 700 16px/1.2 "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 40px; padding: 8px 14px; border-radius: 9px; border: 1px solid rgba(255, 255, 255, .18); background: transparent; color: #d7e7f2; cursor: pointer; }
.sm-views button.is-on { background: #f3b54a; color: #1a1408; border-color: #f3b54a; }
.sm-transport { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sm-scene .sm-btn { background: #16304d; border-color: rgba(255, 255, 255, .2); color: #eef6fb; min-height: 40px; padding: 8px 12px; }
.sm-scene .sm-btn:hover { border-color: #f3b54a; }
.sm-speed { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.sm-speed select, .sm-controls select { font: 600 16px "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 40px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .25); background: #16304d; color: #eef6fb; padding: 6px 8px; }
.sm-canvas-wrap { position: relative; }
#scene { display: block; width: 100%; touch-action: none; }
.sm-caption { margin: 0; padding: 10px 14px; background: #0d223b; color: #d6e6f1; border-top: 1px solid rgba(255, 255, 255, .08); min-height: 3.2em; }
.sm-controls { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 10px 14px 12px; background: #10263f; }
.sm-ctl input[type=range] { margin: 0; }
.sm-ctl { display: flex; flex-direction: column; gap: 2px; font-weight: 700; min-width: 210px; flex: 1 1 210px; }
.sm-ctl input[type=range] { width: 100%; accent-color: #f3b54a; min-height: 28px; }
.sm-out { font-weight: 800; color: #ffd27a; margin-left: 6px; }
.sm-check { display: flex; align-items: center; gap: 8px; font-weight: 700; align-self: center; }
.sm-check input { width: 20px; height: 20px; accent-color: #f3b54a; }

/* readouts */
.sm-readouts { display: flex; flex-direction: column; gap: 12px; }
.sm-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sm-metric { background: var(--sm-card); border: 1px solid var(--sm-line); border-left: 4px solid var(--sm-sun); border-radius: 12px; padding: 7px 10px; box-shadow: var(--sm-shadow); line-height: 1.3; }
.sm-metric--v { border-left-color: var(--sm-accent); }
.sm-metric span, .sm-metric small { display: block; font-size: 16px; color: var(--sm-muted); }
.sm-metric span { font-weight: 700; color: var(--sm-ink); }
.sm-metric b { display: block; font-size: 22px; line-height: 1.25; color: var(--sm-ink); white-space: nowrap; }
.sm-year { background: var(--sm-card); border: 1px solid var(--sm-line); border-radius: 12px; padding: 10px; box-shadow: var(--sm-shadow); }
.sm-year h3 { margin: 0 0 6px; font-size: 18px; }
.sm-year canvas, #labGraph { display: block; width: 100%; }

/* lab work */
.sm-work { display: grid; grid-template-columns: minmax(300px, .85fr) minmax(0, 1.4fr); gap: 14px; margin-top: 14px; }
.sm-panel { background: var(--sm-card); border: 1px solid var(--sm-line); border-radius: 16px; padding: 16px 18px; box-shadow: var(--sm-shadow); }
.sm-panel h2 { margin: 4px 0 8px; font-size: 22px; line-height: 1.2; }
.sm-panel h3 { margin: 14px 0 6px; font-size: 18px; }
.sm-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.sm-pred { border: 1px solid var(--sm-line); border-radius: 12px; padding: 10px 12px; margin: 10px 0; background: var(--sm-soft); }
.sm-pred legend { font-weight: 700; padding: 0 4px; }
.sm-pred label { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; cursor: pointer; }
.sm-pred input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--sm-accent); }
.sm-cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.sm-cards li { border: 1px dashed var(--sm-line); border-radius: 10px; padding: 8px 10px; }
.sm-cards li span { display: block; color: var(--sm-muted); }
.sm-cards li.done { border-style: solid; border-color: var(--sm-ok); background: rgba(31, 122, 61, .08); }
.sm-steps { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.sm-steps li { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--sm-line); font-weight: 700; }
.sm-steps li.done { border-color: var(--sm-ok); color: var(--sm-ok); }
.sm-months { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.sm .sm-chip { appearance: none; font: 700 16px "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 40px; min-width: 56px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--sm-line); background: var(--sm-soft); color: var(--sm-ink); cursor: pointer; }
.sm .sm-chip.done { border-color: var(--sm-ok); color: var(--sm-ok); }
.sm .sm-chip.is-on { outline: 2px solid var(--sm-sun); }
.sm-inline { display: flex; flex-direction: column; gap: 4px; font-weight: 700; }
.sm-inline select { font: 600 16px "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 40px; border-radius: 8px; border: 1px solid var(--sm-line); background: var(--sm-card); color: var(--sm-ink); padding: 6px 8px; max-width: 100%; }
.sm-feedback { min-height: 1.5em; font-weight: 700; color: var(--sm-accent); margin: 8px 0 0; }
.sm-data-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.sm-data-head h3 { margin: 2px 0 8px; font-size: 20px; }
.sm-table { overflow: auto; max-height: 290px; border: 1px solid var(--sm-line); border-radius: 10px; margin-bottom: 12px; }
.sm table { width: 100%; border-collapse: collapse; font-size: 16px; }
.sm th, .sm td { padding: 7px 10px; border-bottom: 1px solid var(--sm-line); text-align: right; white-space: nowrap; color: var(--sm-ink); }
.sm th:first-child, .sm td:first-child, .sm th:nth-child(2), .sm td:nth-child(2) { text-align: left; }
.sm th { position: sticky; top: 0; background: var(--sm-soft); font-weight: 800; }
.sm-empty { text-align: center !important; color: var(--sm-muted) !important; }

/* CER */
.sm-cer { margin-top: 14px; }
.sm-cer-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.sm-checklist { list-style: none; margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--sm-soft); min-width: 280px; }
.sm-checklist li { padding: 2px 0; color: var(--sm-muted); }
.sm-checklist li.done { color: var(--sm-ok); font-weight: 700; }
.sm-cer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.sm-cer-grid label { display: flex; flex-direction: column; font-weight: 800; }
.sm-cer-grid small { font-weight: 500; color: var(--sm-muted); }
.sm-cer-grid textarea { font: 16px/1.45 "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 130px; padding: 10px; margin-top: 4px; border: 1px solid var(--sm-line); border-radius: 10px; background: var(--sm-card); color: var(--sm-ink); resize: vertical; }
.sm-turnin { margin-top: 12px; }

/* test */
.sm-test { margin-top: 14px; max-width: 980px; }
.sm-test-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.sm-test-head h2 small { font-size: 18px; color: var(--sm-muted); }
.sm-progress { flex: 0 1 260px; height: 10px; background: var(--sm-soft); border-radius: 999px; overflow: hidden; border: 1px solid var(--sm-line); }
.sm-progress i { display: block; height: 100%; background: var(--sm-accent); }
.sm-tag { display: inline-block; margin: 8px 0 0; padding: 3px 10px; border-radius: 999px; background: #fff1d6; color: #6b4300; font-weight: 700; }
html[data-theme="dark"] .sm-tag { background: #4a3510; color: #ffe2a8; }
.sm-q { font-size: 19px; font-weight: 700; margin: 12px 0; }
.sm-run { margin-bottom: 10px; }
.sm-readout { margin: 8px 0 0; padding: 10px 12px; border-left: 4px solid var(--sm-sun); background: var(--sm-soft); border-radius: 8px; }
.sm-choices { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.sm-choice { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 2px solid var(--sm-line); border-radius: 12px; cursor: pointer; background: var(--sm-card); }
.sm-choice input { position: absolute; opacity: 0; pointer-events: none; }
.sm-choice:focus-within { outline: 3px solid #eaa33d; outline-offset: 2px; }
.sm-choice.is-picked { border-color: var(--sm-accent); background: var(--sm-soft); }
.sm-choice.ok { border-color: var(--sm-ok); }
.sm-choice.no { border-color: var(--sm-no); }
.sm-choice em { margin-left: auto; font-style: normal; font-weight: 900; font-size: 20px; }
.sm-choice.ok em { color: var(--sm-ok); } .sm-choice.no em { color: var(--sm-no); }
.sm-letter { flex: 0 0 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--sm-soft); border: 1px solid var(--sm-line); }
.sm-choices:disabled .sm-choice { cursor: default; }
.sm-explain { padding: 10px 12px; border-radius: 10px; background: var(--sm-soft); }
.sm-explain.ok { border-left: 4px solid var(--sm-ok); } .sm-explain.no { border-left: 4px solid var(--sm-no); }
.sm-test-nav { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; }
.sm-test-nav .sm-btn--pri { margin-left: auto; }
.sm-review { padding-left: 22px; }
.sm-review li { margin: 8px 0; }
.sm-review li.ok > b { color: var(--sm-ok); } .sm-review li.no > b { color: var(--sm-no); }

/* dialogs */
.sm-dialog { max-width: 720px; 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; }
html[data-theme="dark"] .sm-dialog { background: #172633; color: #e6eef3; }
html[data-theme="dark"] .sm-dialog a { color: #8fd6f0; }
.sm-dialog::backdrop { background: rgba(6, 21, 37, .7); }
.sm-dialog h2 { margin-top: 0; }
.sm-x { float: right; font-size: 28px; line-height: 1; min-width: 44px; min-height: 44px; border: 0; background: transparent; color: inherit; cursor: pointer; }

/* responsive */
@media (max-width: 1100px) {
  .sm-stage { grid-template-columns: minmax(0, 1fr); }
  .sm-metrics { grid-template-columns: repeat(3, 1fr); }
  .sm-work { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .sm-gate-grid, .sm-cer-grid { grid-template-columns: minmax(0, 1fr); }
  .sm-metrics { grid-template-columns: 1fr 1fr; }
  .sm-viewbar { flex-direction: column; align-items: stretch; }
  .sm-views button { flex: 1; }
  .sm-ctl { min-width: 0; flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) { .sm * { transition: none !important; animation: none !important; } }
@media print { .sm-scene, .sm-tabs, .sm-actions, .sm-turnin { display: none !important; } }

.sm small { font-size: 16px; }
.sm .sm-th-title { text-align: left !important; background: var(--sm-card); color: var(--sm-accent); font-weight: 800; position: static; }
.sm .sm-th-sub { position: static; }
.sm-caption { font-size: 16px; }

/* ── v3 structure: modes, tabs, coach, pre-lab, advanced, toast ── */
.sm-modes { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 2px 0 8px; }
.sm-modes-label { font-weight: 800; margin-right: 4px; }
.sm-modes button { appearance: none; font: 700 16px/1.2 "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 44px; padding: 8px 14px; border-radius: 10px; border: 2px solid var(--sm-line); background: var(--sm-card); color: var(--sm-ink); cursor: pointer; }
.sm-modes button.is-on { border-color: var(--sm-accent); background: var(--sm-accent); color: var(--sm-accent-ink); }
.sm-modes-note { color: var(--sm-muted); }
.sm-tabs button.is-on { background: var(--sm-ink); color: var(--sm-card); border-color: var(--sm-ink); }
.sm-stage { grid-template-columns: minmax(0, 1fr) 350px; }
.sm-side { display: flex; flex-direction: column; gap: 10px; }
.sm-coach { background: var(--sm-card); border: 1px solid var(--sm-line); border-radius: 14px; padding: 12px 14px; box-shadow: var(--sm-shadow); }
.sm-coach h2 { font-size: 18px; margin: 2px 0 6px; }
.sm-next { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border-radius: 10px; background: var(--sm-soft); border-left: 4px solid var(--sm-sun); }
.sm-stepchecks { list-style: none; margin: 8px 0; padding: 0; }
.sm-stepchecks li { padding: 2px 0; color: var(--sm-muted); }
.sm-stepchecks li.done { color: var(--sm-ok); font-weight: 700; }
.sm-ch summary { cursor: pointer; font-weight: 800; padding: 4px 0; min-height: 32px; }
.sm-ice canvas { display: block; width: 100%; border-radius: 8px; margin: 6px 0; }
.sm-ice input[type=range] { width: 100%; accent-color: var(--sm-accent); }
.sm-zoom { position: absolute; left: 10px; bottom: 34px; display: flex; flex-direction: column; gap: 6px; }
.sm-zoom button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid rgba(255,255,255,.3); background: rgba(10,26,48,.85); color: #fff; font: 800 20px/1 system-ui; cursor: pointer; }
.sm-adv { background: #0d223b; border-top: 1px solid rgba(255,255,255,.08); }
.sm-adv summary { cursor: pointer; padding: 10px 14px; font-weight: 800; color: #ffd27a; min-height: 44px; }
.sm-adv-grid { display: flex; flex-wrap: wrap; gap: 10px 22px; padding: 4px 14px 14px; }
.sm-adv-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; flex: 1 1 100%; }
.sm-adv .sm-metric { background: #16304d; border-color: rgba(255,255,255,.12); color: #eaf3f8; }
.sm-adv .sm-metric span, .sm-adv .sm-metric b, .sm-adv .sm-metric small { color: #eaf3f8; }
.sm-seed { display: flex; align-items: center; gap: 10px; }
.sm-seed b { font-size: 20px; color: #ffd27a; }
.sm-ctl small { font-weight: 500; color: #c3dce6; }
.sm-scene select { font: 600 16px "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 40px; border-radius: 8px; border: 1px solid rgba(255,255,255,.25); background: #16304d; color: #eef6fb; padding: 6px 8px; }
.sm-flash { animation: eqFlash 2.4s ease-out; border-radius: 10px; }
@keyframes eqFlash { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,184,0,0); } 15%, 55% { box-shadow: 0 0 0 5px #ffb800; } }
.sm-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; max-width: min(640px, calc(100vw - 32px)); padding: 12px 18px; border-radius: 12px; background: #10253b; color: #fff; font-weight: 700; box-shadow: 0 12px 40px rgba(0,0,0,.35); }
/* pre-lab */
.sm-prelab h3 { margin-top: 18px; }
.sm-qbox { padding: 12px 14px; border-radius: 12px; background: var(--sm-soft); border-left: 5px solid var(--sm-accent); margin: 10px 0; }
.sm-qbox small { display: block; color: var(--sm-muted); font-weight: 700; }
.sm-qbox b { font-size: 19px; }
.sm-prelab-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 24px; }
.sm-vocab { display: flex; flex-wrap: wrap; gap: 8px; }
.sm .sm-term { position: relative; appearance: none; font: inherit; color: var(--sm-accent); font-weight: 800; background: none; border: 0; border-bottom: 2px dotted currentColor; padding: 0 1px; cursor: help; }
.sm-vocab .sm-term { border: 1px solid var(--sm-line); border-radius: 999px; padding: 6px 12px; background: var(--sm-soft); min-height: 40px; }
.sm-tip { display: none; position: absolute; left: 0; top: calc(100% + 6px); z-index: 20; width: min(320px, 80vw); padding: 10px 12px; border-radius: 10px; background: #10253b; color: #fff; font-weight: 500; text-align: left; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.sm-term:hover .sm-tip, .sm-term:focus .sm-tip, .sm-term:focus-visible .sm-tip { display: block; }
.sm-safety { padding-left: 0; list-style: none; }
.sm-safety li { padding: 6px 10px; margin: 6px 0; border-radius: 8px; background: #fff4d6; color: #5a3b00; }
html[data-theme="dark"] .sm-safety li { background: #3d2c0b; color: #ffe2a8; }
.sm-frame { line-height: 2.4; font-size: 17px; }
.sm-frame select { font: 700 16px "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 40px; border-radius: 8px; border: 2px solid var(--sm-accent); background: var(--sm-card); color: var(--sm-ink); padding: 4px 8px; }
.sm-because { display: flex; flex-direction: column; font-weight: 700; }
.sm-because textarea { font: 16px/1.45 "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 80px; padding: 10px; margin-top: 4px; border: 1px solid var(--sm-line); border-radius: 10px; background: var(--sm-card); color: var(--sm-ink); }
.sm-varpool { display: flex; flex-wrap: wrap; gap: 8px; min-height: 52px; padding: 8px; border: 1px dashed var(--sm-line); border-radius: 12px; }
.sm-varbins { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.sm-varbin { min-height: 120px; padding: 8px; border: 2px solid var(--sm-line); border-radius: 12px; background: var(--sm-soft); display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px; cursor: pointer; }
.sm-varbin h4 { flex: 1 1 100%; margin: 0 0 4px; }
.sm .sm-varchip { appearance: none; font: 700 16px "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 40px; padding: 6px 12px; border-radius: 999px; border: 2px solid var(--sm-line); background: var(--sm-card); color: var(--sm-ink); cursor: pointer; }
.sm .sm-varchip.picked { border-color: var(--sm-sun); box-shadow: 0 0 0 3px rgba(232,154,44,.35); }
.sm .sm-varchip.right { border-color: var(--sm-ok); } .sm .sm-varchip.wrong { border-color: var(--sm-no); }
/* data + CER */
.sm-data h3 { margin: 14px 0 6px; font-size: 18px; }
#labGraph { margin-top: 14px; border-radius: 10px; }
.sm-pick { margin: 10px 0; border: 1px solid var(--sm-line); border-radius: 12px; padding: 8px 12px; }
.sm-pick summary { cursor: pointer; font-weight: 800; min-height: 32px; }
.sm-rowpick { display: flex; gap: 8px; align-items: flex-start; padding: 3px 0; }
.sm-rowpick input { width: 18px; height: 18px; margin-top: 3px; }
#rowPick { max-height: 220px; overflow: auto; }
.sm-done { margin-top: 14px; padding: 14px 16px; border-radius: 12px; background: rgba(31,122,61,.10); border: 2px solid var(--sm-ok); }
.sm-more { position: relative; }
.sm-more summary { list-style: none; }
.sm-more summary::-webkit-details-marker { display: none; }
.sm-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(--sm-card); border: 1px solid var(--sm-line); box-shadow: var(--sm-shadow); min-width: 240px; }
@media (max-width: 1100px) { .sm-prelab-grid { grid-template-columns: minmax(0, 1fr); } .sm-stage { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .sm-varbins { grid-template-columns: minmax(0, 1fr); } .sm-adv-metrics { grid-template-columns: minmax(0, 1fr); } }
@media print {
  .tlg-header, .tlg-footer, .sm-bar .sm-actions, .sm-modes, .sm-tabs, #stageWrap, .sm-pick, .sm-turnin, .sm-toast, #testCard { display: none !important; }
  .sm { background: #fff; color: #000; }
  #tab-data, #tab-cer { display: block !important; box-shadow: none; }
}
/* compact header rows so the scene and its controls fit at 1366×768 */
.sm-titles .sm-eyebrow { display: none; }
.sm-bar { padding: 8px 0 6px; }
.sm-bar h1 { font-size: 26px; white-space: nowrap; }
.sm-bar .sm-btn { min-height: 40px; padding: 7px 12px; }
.sm-modes { padding: 0 0 6px; }
.sm-modes button, .sm-tabs button { min-height: 40px; padding: 7px 13px; }
.sm-tabs { padding: 0 0 8px; }
@media (max-width: 760px) { .sm-bar h1 { white-space: normal; } }
/* scene full width; coach, readouts and graph in a row underneath */
.sm-stage { grid-template-columns: minmax(0, 1fr); }
.sm-side { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.1fr); gap: 12px; align-items: start; }
.sm-side .sm-metrics { grid-template-columns: 1fr 1fr; }
@media (max-width: 1100px) { .sm-side { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .sm-side .sm-year { grid-column: 1 / -1; } }
@media (max-width: 760px) { .sm-side { grid-template-columns: minmax(0, 1fr); } }

/* Chemical Equilibrium Lab additions */
.sm-row--wrap { flex-wrap: wrap; }
.sm-dec { display: grid; gap: 6px; padding: 10px; border-radius: 10px; background: var(--sm-soft, rgba(120,160,200,.1)); margin: 8px 0; }
.sm-dec input[type=number] { font: inherit; font-size: 16px; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--sm-line, #9ab); background: transparent; color: inherit; }
.sm-links a { white-space: nowrap; }
body.sm-printing .sm-stage, body.sm-printing .sm-tabs, body.sm-printing .sm-modes { display: none; }
#sideChart { display: block; width: 100%; }
.sm-coach, .sm-side > * { min-width: 0; }
.sm-cards li { overflow-wrap: anywhere; max-width: 100%; box-sizing: border-box; }
.sm-cards li select { max-width: 100%; }
@media (max-width: 640px) { .sm-zoom { bottom: auto; top: 96px; } }
.sm-graph { background: var(--sm-card); border: 1px solid var(--sm-line); border-radius: 12px; padding: 10px; box-shadow: var(--sm-shadow); }
.sm-graph h3 { margin: 0 0 6px; font-size: 18px; }
.sm-sys { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: #d7e7f2; }
.sm-sys select { font: 600 16px "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 40px; border-radius: 8px; border: 1px solid rgba(255,255,255,.25); background: #16304d; color: #eef6fb; padding: 6px 8px; max-width: 280px; }
.sm-adds { flex-direction: row !important; flex-wrap: wrap; gap: 8px; align-items: center; flex: 2 1 380px !important; }
.sm-adds .sm-btn { min-height: 40px; }
.sm-stresscard { display: grid; gap: 8px; padding: 10px; border-radius: 10px; background: var(--sm-soft); border-left: 4px solid var(--sm-sun); margin: 8px 0; }
.sm-stresscard select, .sm-coach select, .sm-coach input[type=number] { font: 600 16px "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 40px; border-radius: 8px; border: 1px solid var(--sm-line); background: var(--sm-card); color: var(--sm-ink); padding: 6px 8px; max-width: 100%; }
.sm-predrow { display: flex; flex-wrap: wrap; gap: 6px; }
.sm .sm-pbtn { appearance: none; font: 700 16px "Atkinson Hyperlegible", system-ui, sans-serif; min-height: 40px; padding: 6px 12px; border-radius: 999px; border: 2px solid var(--sm-line); background: var(--sm-card); color: var(--sm-ink); cursor: pointer; }
.sm .sm-pbtn.is-on { border-color: var(--sm-accent); background: var(--sm-accent); color: var(--sm-accent-ink); }
.sm-ice { width: 100%; border-collapse: collapse; margin: 6px 0; }
.sm-ice th, .sm-ice td { padding: 4px 6px !important; text-align: center !important; font-size: 16px; }
.sm-pending { padding: 8px 10px; border-radius: 10px; border: 2px dashed var(--sm-sun); margin: 8px 0; }
.sm-coach { max-height: 560px; overflow: auto; }
.sm-side { grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr) minmax(0, 1.25fr) !important; }
@media (max-width: 1100px) { .sm-side { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; } }
@media (max-width: 760px) { .sm-side { grid-template-columns: minmax(0, 1fr) !important; } .sm-sys { width: 100%; } .sm-sys select { flex: 1; max-width: none; } }
.sm-ok { color: var(--sm-ok); font-weight: 800; } .sm-no { color: var(--sm-no); font-weight: 800; }

.sm-metric b { font-size: 19px; white-space: normal; overflow-wrap: anywhere; }
.sm-side .sm-metrics { grid-template-columns: 1fr 1fr; }
/* the site's "Sign in to save your progress" note sits in the title bar (page flow), never over the bench */
.sm-signin:empty { display: none; }
.sm-signin { margin-left: auto; display: flex; }
.sm-signin .tlg-signin-note--inline { margin: 0; }
