:root {
  --ink: #172625;
  --muted: #66716f;
  --line: #d8dedb;
  --line-strong: #bec9c5;
  --paper: #f4f6f3;
  --surface: #ffffff;
  --surface-soft: #eef3f0;
  --teal: #246b63;
  --teal-dark: #174d47;
  --teal-soft: #dcece7;
  --blue: #2d68c4;
  --blue-soft: #e5eefb;
  --coral: #d96e58;
  --coral-soft: #f7dfd9;
  --gold: #d89b35;
  --gold-soft: #f8edd6;
  --plum: #7e476c;
  --danger: #b84b47;
  --success: #267b55;
  --shadow: 0 16px 38px rgba(23, 38, 37, 0.09);
  --topbar-height: 64px;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0)) 0 0 / 100% 150px no-repeat,
    var(--paper);
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(45, 104, 196, 0.28);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topics-link {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}

.topics-link:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand-mark,
.welcome-brand {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 6px;
  color: #fff;
  background: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-copy strong {
  font-size: 14px;
  line-height: 1.15;
}

.brand-copy small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.mode-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7f9f7;
}

.mode-button {
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.mode-button.active {
  color: var(--teal-dark);
  background: var(--surface);
  box-shadow: 0 1px 5px rgba(23, 38, 37, 0.1);
}

.app-shell {
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 34px;
}

.story-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.82);
}

.story-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
}

.story-track::before {
  content: "";
  position: absolute;
  left: 7%;
  right: 7%;
  top: 7px;
  height: 2px;
  background: #d8e0dd;
}

.story-track span {
  position: relative;
  min-width: 0;
  padding-top: 18px;
  color: #7b8784;
  font-size: 10px;
  font-weight: 750;
  text-align: center;
  white-space: nowrap;
}

.story-track span::before {
  content: "";
  position: absolute;
  top: 1px;
  left: calc(50% - 6px);
  width: 12px;
  height: 12px;
  border: 2px solid #c7d0cd;
  border-radius: 50%;
  background: #fff;
}

.story-track span.complete,
.story-track span.active {
  color: var(--teal-dark);
}

.story-track span.complete::before,
.story-track span.active::before {
  border-color: var(--teal);
  background: var(--teal);
}

.story-track span.active::before {
  box-shadow: 0 0 0 4px var(--teal-soft);
}

.story-strip > p {
  min-width: 122px;
  margin: 0;
  padding: 7px 10px;
  border-radius: 5px;
  color: var(--teal-dark);
  background: var(--teal-soft);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.mode-view {
  display: none;
}

.mode-view.active {
  display: block;
}

.page-heading {
  display: flex;
  align-items: center;
  min-height: 45px;
  margin-bottom: 14px;
}

.page-heading h1 {
  margin: 0;
  font-size: clamp(24px, 2.2vw, 32px);
  line-height: 1.1;
  letter-spacing: 0;
}

.level-navigation,
.lab-level-navigation {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 14px;
}

.level-button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 50px;
  padding: 8px 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.7);
  text-align: left;
  cursor: pointer;
}

.level-button:hover {
  border-color: var(--line-strong);
  background: var(--surface);
}

.level-button.active {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.level-number {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  border-radius: 50%;
  color: #fff;
  background: #7f8b88;
  font-size: 12px;
  font-weight: 800;
}

.level-button.active .level-number {
  background: var(--teal-dark);
}

.level-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 750;
}

.lesson-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(310px, 0.72fr);
  min-height: min(670px, calc(100vh - 172px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.visual-panel {
  min-width: 0;
  border-right: 1px solid var(--line);
  background: #fbfcfb;
}

.panel-heading {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
}

.panel-heading h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.2;
}

.panel-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-align: right;
}

.visual-canvas {
  display: grid;
  place-items: center;
  min-height: calc(100% - 52px);
  padding: 10px;
  overflow: hidden;
}

#learnSvg,
#labSvg {
  display: block;
  width: 100%;
  max-height: 610px;
  overflow: visible;
}

.lesson-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: clamp(24px, 3.2vw, 46px);
  background: var(--surface);
}

.step-progress {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  margin-bottom: 27px;
}

.step-progress span {
  height: 4px;
  border-radius: 2px;
  background: #e2e7e4;
}

.step-progress span.complete {
  background: var(--teal);
}

.step-label,
.compact-heading p {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lesson-panel h2 {
  margin: 0 0 14px;
  font-size: clamp(24px, 2.4vw, 36px);
  line-height: 1.12;
  letter-spacing: 0;
}

.lesson-text {
  margin: 0;
  color: #34423f;
  font-size: clamp(16px, 1.25vw, 19px);
  line-height: 1.58;
}

.notice-box {
  margin-top: 24px;
  padding: 14px 15px;
  border-left: 3px solid var(--gold);
  background: var(--gold-soft);
}

.notice-box span {
  color: #76541a;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.notice-box p {
  margin: 5px 0 0;
  color: #594522;
  font-size: 14px;
  line-height: 1.45;
}

.lesson-action {
  margin-top: 22px;
  padding: 15px;
  border: 1px solid #c7d8d3;
  border-radius: 6px;
  background: var(--teal-soft);
}

.lesson-action p {
  margin: 0 0 11px;
  font-size: 13px;
  font-weight: 750;
}

.lesson-buttons {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 34px;
}

.primary-button,
.secondary-button {
  min-height: 40px;
  padding: 0 18px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  border: 1px solid var(--teal-dark);
  color: #fff;
  background: var(--teal-dark);
}

.primary-button:hover {
  background: #103f3a;
}

.secondary-button {
  border: 1px solid var(--line-strong);
  color: #32423f;
  background: #fff;
}

.secondary-button:hover {
  border-color: #8d9c98;
  background: #f7f9f8;
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.38;
  cursor: default;
}

.choice-row {
  display: grid;
  gap: 8px;
}

.choice-button {
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid #b8cbc5;
  border-radius: 5px;
  color: #29423d;
  background: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.choice-button:hover,
.choice-button.selected {
  border-color: var(--teal);
  background: #fff;
}

.choice-feedback {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.lab-level-navigation {
  margin-bottom: 10px;
}

.lab-layout {
  display: grid;
  grid-template-columns: 270px minmax(480px, 1fr) 320px;
  grid-template-rows: minmax(470px, calc(100vh - 380px)) 250px;
  gap: 10px;
}

.panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: 0 7px 22px rgba(23, 38, 37, 0.06);
}

.lab-controls,
.lab-question {
  padding: 18px;
  overflow-y: auto;
}

.compact-heading {
  margin-bottom: 17px;
}

.compact-heading p {
  margin-bottom: 4px;
}

.compact-heading h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.control-group {
  margin-bottom: 18px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8faf8;
}

.control-group.primary-control {
  border-color: #8eb0df;
  background: var(--blue-soft);
}

.control-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.control-heading label {
  color: #30413e;
  font-size: 12px;
  font-weight: 800;
}

.control-value {
  color: var(--blue);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 3px;
  border: 1px solid #cbd4d1;
  border-radius: 6px;
  background: #edf1ef;
}

.segmented-control.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.segment-button {
  min-width: 0;
  min-height: 34px;
  padding: 5px 7px;
  overflow: hidden;
  border: 0;
  border-radius: 4px;
  color: #5e6d69;
  background: transparent;
  font-size: 11px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.segment-button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 1px 4px rgba(23, 38, 37, 0.13);
}

.segmented-control.three .segment-button {
  padding-right: 2px;
  padding-left: 2px;
  font-size: 10px;
}

input[type="range"] {
  width: 100%;
  height: 5px;
  margin: 8px 0 2px;
  accent-color: var(--blue);
}

.range-ends {
  display: flex;
  justify-content: space-between;
  color: #7a8683;
  font-size: 10px;
}

.reset-button {
  width: 100%;
  margin-top: 4px;
}

.detail-toggle {
  width: 100%;
  min-height: 34px;
  margin: 0 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: #53615e;
  background: #ffffff;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.detail-toggle:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
}

.situation-button {
  width: 100%;
  min-height: 40px;
  margin: 2px 0 10px;
  padding: 8px 10px;
  border: 1px solid #d7b76c;
  border-radius: 5px;
  color: #644913;
  background: var(--gold-soft);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.situation-panel {
  margin: 0 0 16px;
  padding: 0;
  border: 0;
  background: transparent;
}

.situation-panel p {
  margin: 0 0 10px;
  color: #46534f;
  font-size: 11.5px;
  line-height: 1.45;
}

.situation-options {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid #d7dfdc;
  border-radius: 6px;
  background: #ffffff;
}

.situation-options button {
  min-height: 38px;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid #e4e9e7;
  border-radius: 0;
  color: #40504c;
  background: #fff;
  font-size: 10.5px;
  font-weight: 780;
  text-align: left;
  cursor: pointer;
}

.situation-options button:last-child {
  border-bottom: 0;
}

.situation-options button.active {
  color: #81421f;
  background: #fff3e8;
  box-shadow: inset 3px 0 0 #bd5b2f;
}

.situation-guide-stage {
  padding: 11px 12px;
  border: 1px solid #efd7c6;
  border-left: 3px solid #b85a2f;
  border-radius: 0 6px 6px 0;
  background: #fffaf6;
}

.situation-guide-stage .question-title {
  margin-bottom: 6px;
  font-size: 17px;
}

.situation-guide-stage .question-prompt {
  margin: 0;
  font-size: 12.5px;
}

.situation-result-label {
  margin: 13px 0 5px;
  color: #8e451f;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.question-feedback.situation-result {
  min-height: 0;
  margin: 0;
  padding: 9px 10px;
  border-left: 3px solid #5ba47d;
  background: #eef8f2;
}

.situation-boundary {
  margin: 13px 0 0;
  padding-top: 11px;
  border-top: 1px solid #e3e8e6;
  color: #74807d;
  font-size: 10.5px;
  line-height: 1.45;
}

.lab-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #f8fafb;
}

.lab-canvas {
  display: grid;
  place-items: center;
  flex: 1 1 auto;
  min-height: 0;
  padding: 4px 10px 8px;
  overflow: hidden;
}

.lab-toast {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 4;
  max-width: calc(100% - 34px);
  padding: 9px 13px;
  transform: translate(-50%, 12px);
  border: 1px solid #b8c9c4;
  border-radius: 5px;
  color: #30423e;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 22px rgba(23, 38, 37, 0.12);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.lab-toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.question-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.question-tabs {
  display: flex;
  gap: 5px;
}

.question-tab {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--muted);
  background: #fff;
  font-size: 11px;
  font-weight: 850;
  cursor: pointer;
}

.question-tab.active {
  border-color: var(--teal);
  color: #fff;
  background: var(--teal);
}

.question-tab.complete:not(.active) {
  border-color: #89b99f;
  color: var(--success);
  background: #e8f4ed;
}

.question-stage-track {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  margin-bottom: 18px;
}

.question-stage-track span {
  height: 4px;
  border-radius: 2px;
  background: #dfe5e2;
}

.question-stage-track span.active {
  background: var(--teal);
}

.question-stage-name {
  margin: 0 0 7px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.question-title {
  margin: 0 0 9px;
  font-size: 19px;
  line-height: 1.25;
}

.question-prompt {
  margin: 0 0 15px;
  color: #43514e;
  font-size: 13px;
  line-height: 1.48;
}

.question-option {
  display: block;
  width: 100%;
  min-height: 40px;
  margin: 7px 0;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}

.question-option:hover {
  border-color: var(--teal);
  background: #f6faf8;
}

.question-option.selected {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.question-feedback {
  min-height: 38px;
  margin: 12px 0 0;
  padding: 9px 10px;
  border-radius: 5px;
  color: var(--muted);
  background: #f0f3f1;
  font-size: 12px;
  line-height: 1.4;
}

.question-feedback.correct {
  color: #1f6645;
  background: #e8f4ed;
}

.question-feedback.incorrect {
  color: #8b3d39;
  background: #fae9e7;
}

.manipulate-button {
  width: 100%;
}

.lab-graph {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(210px, 0.28fr) minmax(0, 1fr);
  align-items: stretch;
  min-height: 0;
}

.graph-summary {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 20px 24px;
  border-right: 1px solid var(--line);
  background: #fafbfa;
  min-height: 0;
}

.model-note {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.graph-summary-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.graph-summary-value {
  margin: 0;
  color: var(--teal-dark);
  font-size: clamp(25px, 2.4vw, 36px);
  font-weight: 850;
  line-height: 1.05;
}

.graph-summary-note {
  margin: 7px 0 0;
  color: #53615e;
  font-size: 11.5px;
  line-height: 1.34;
}

.graph-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

body.topic-immune.lab-portal-mode .graph-summary {
  padding: 10px 16px;
}

body.topic-immune.lab-portal-mode .model-note {
  margin-bottom: 7px;
}

.graph-summary-grid.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.graph-summary-item {
  min-width: 0;
}

.graph-summary-item .graph-summary-value {
  font-size: clamp(18px, 1.65vw, 25px);
  overflow-wrap: anywhere;
}

.graph-wrap {
  display: grid;
  grid-template-rows: 34px minmax(0, 1fr);
  align-items: stretch;
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 7px 14px 8px 8px;
  overflow: hidden;
}

.graph-playback {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 0 3px 0 58px;
}

.graph-metric {
  min-width: 0;
  margin-right: auto;
  overflow: hidden;
  color: #344642;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.graph-time {
  min-width: 68px;
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.graph-control {
  min-height: 26px;
  padding: 3px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: #40514d;
  background: #fff;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.graph-control:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
}

#labGraph {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 100%;
}

.graph-axis-text {
  fill: #66736f;
  font-size: 16px;
  font-weight: 650;
}

.graph-axis-title {
  fill: #344642;
  font-size: 17px;
  font-weight: 750;
}

.welcome-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(18, 30, 29, 0.52);
}

.welcome-card {
  width: min(520px, 100%);
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 26px 70px rgba(11, 26, 24, 0.27);
}

.welcome-brand {
  margin-bottom: 18px;
}

.welcome-card h1 {
  margin: 0 0 22px;
  font-size: 29px;
  line-height: 1.12;
}

.welcome-options {
  display: grid;
  gap: 9px;
}

.welcome-option {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.welcome-option.selected {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.welcome-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: var(--teal-dark);
  background: #fff;
}

.welcome-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.welcome-option strong,
.welcome-option small {
  display: block;
}

.welcome-option strong {
  margin-bottom: 3px;
  font-size: 14px;
}

.welcome-option small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.welcome-start {
  width: 100%;
  margin-top: 18px;
}

.svg-label {
  fill: #32413f;
  font-size: 14px;
  font-weight: 750;
}

.svg-small-label {
  fill: #5f6d6a;
  font-size: 12px;
  font-weight: 650;
}

.svg-caption {
  fill: #293a37;
  font-size: 16px;
  font-weight: 800;
}

.svg-faint {
  fill: #7b8986;
  font-size: 11px;
  font-weight: 650;
}

.scene-legend {
  pointer-events: none;
}

.scene-legend-label {
  fill: #4c5b58;
  font-size: 12px;
  font-weight: 750;
}

.pathogen-drift-a {
  animation: pathogenDriftA 3.8s ease-in-out infinite alternate;
}

.pathogen-drift-b {
  animation: pathogenDriftB 4.4s ease-in-out infinite alternate;
}

.signal-particle {
  animation: signalTravel 2.4s ease-out infinite;
}

.signal-particle.delay-1 { animation-delay: -0.8s; }
.signal-particle.delay-2 { animation-delay: -1.6s; }

.cell-breathe {
  transform-box: fill-box;
  transform-origin: center;
  animation: cellBreathe 3s ease-in-out infinite;
}

.neutrophil-move {
  animation: neutrophilMove 4.6s ease-in-out infinite;
}

.antibody-float {
  transform-box: fill-box;
  transform-origin: center;
  animation: antibodyFloat 3.2s ease-in-out infinite alternate;
}

.memory-pulse {
  transform-box: fill-box;
  transform-origin: center;
  animation: memoryPulse 2.4s ease-in-out infinite;
}

body.lab-portal-mode #labSvg .pathogen-drift-a,
body.lab-portal-mode #labSvg .pathogen-drift-b,
body.lab-portal-mode #labSvg .signal-particle,
body.lab-portal-mode #labSvg .cell-breathe,
body.lab-portal-mode #labSvg .neutrophil-move,
body.lab-portal-mode #labSvg .antibody-float,
body.lab-portal-mode #labSvg .memory-pulse {
  animation: none;
}

@keyframes pathogenDriftA {
  from { transform: translate(-3px, -2px) rotate(-2deg); }
  to { transform: translate(6px, 4px) rotate(3deg); }
}

@keyframes pathogenDriftB {
  from { transform: translate(4px, -3px) rotate(2deg); }
  to { transform: translate(-5px, 5px) rotate(-4deg); }
}

@keyframes signalTravel {
  0% { opacity: 0.28; transform: translate(0, 0) scale(0.75); }
  25% { opacity: 0.9; }
  100% { opacity: 0.28; transform: translate(36px, 12px) scale(1.08); }
}

@keyframes cellBreathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.018); }
}

@keyframes neutrophilMove {
  0%, 18% { transform: translate(0, 0); }
  70%, 100% { transform: translate(56px, -84px); }
}

@keyframes antibodyFloat {
  from { transform: translate(-2px, -3px) rotate(-3deg); }
  to { transform: translate(4px, 5px) rotate(4deg); }
}

@keyframes memoryPulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.05); filter: brightness(1.06); }
}

@media (max-width: 1180px) {
  .lab-layout {
    grid-template-columns: 245px minmax(420px, 1fr);
    grid-template-rows: minmax(460px, auto) auto 245px;
  }

  .lab-question {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 20px;
  }

  .question-heading {
    display: block;
  }

  .question-tabs {
    margin-top: 14px;
  }

  .lab-graph {
    grid-row: 3;
  }
}

@media (max-width: 820px) {
  :root {
    --topbar-height: 58px;
  }

  .topbar {
    padding: 0 14px;
  }

  .brand-copy small {
    display: none;
  }

  .mode-button {
    padding: 0 9px;
    font-size: 12px;
  }

  .app-shell {
    width: min(100% - 20px, 680px);
    padding-top: 16px;
  }

  .story-strip {
    grid-template-columns: 1fr;
  }

  .story-strip > p {
    justify-self: end;
  }

  .level-navigation,
  .lab-level-navigation {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lesson-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .visual-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .visual-canvas {
    min-height: 330px;
  }

  .lesson-panel {
    min-height: 420px;
    padding: 26px;
  }

  .lab-layout {
    display: flex;
    flex-direction: column;
  }

  body.topic-immune.lab-portal-mode.lab-situation-mode .lab-question {
    order: 1;
  }

  body.topic-immune.lab-portal-mode.lab-situation-mode .lab-visual {
    order: 2;
  }

  body.topic-immune.lab-portal-mode.lab-situation-mode .lab-graph {
    order: 3;
  }

  body.topic-immune.lab-portal-mode.lab-situation-mode .lab-controls {
    order: 4;
  }

  .lab-controls,
  .lab-question {
    display: block;
    overflow: visible;
  }

  .lab-visual {
    min-height: 450px;
  }

  .lab-graph {
    display: block;
  }

  .graph-summary {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .graph-wrap {
    min-height: 240px;
  }
}

@media (max-width: 520px) {
  .brand-mark {
    width: 32px;
    height: 32px;
  }

  .brand-copy strong {
    max-width: 92px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
  }

  .mode-button {
    min-height: 31px;
    padding: 0 7px;
    font-size: 11px;
  }

  .topics-link {
    min-height: 31px;
    padding: 0 7px;
    font-size: 11px;
  }

  .story-strip {
    padding: 9px 8px;
  }

  .story-track {
    overflow: visible;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding-bottom: 0;
  }

  .story-track span {
    min-height: 42px;
    padding-inline: 2px;
    font-size: 9px;
    line-height: 1.12;
    white-space: normal;
  }

  .story-track::before {
    left: 42px;
    right: 42px;
  }

  .level-button {
    min-height: 45px;
    padding: 7px 8px;
  }

  .level-name {
    font-size: 11px;
  }

  .panel-heading {
    min-height: 48px;
    padding: 0 13px;
  }

  .panel-heading span {
    display: none;
  }

  .visual-canvas {
    min-height: 275px;
    padding: 2px;
  }

  .lesson-panel {
    min-height: 390px;
    padding: 22px 20px;
  }

  .lesson-panel h2 {
    font-size: 25px;
  }

  .lesson-text {
    font-size: 16px;
  }

  body.topic-immune.lab-portal-mode .lab-layout .lab-visual {
    min-height: 310px;
  }

  .graph-playback {
    padding-left: 4px;
  }

  .graph-metric {
    font-size: 11px;
  }

  .graph-axis-text {
    font-size: 10px;
  }

  .graph-axis-title {
    font-size: 11px;
  }

  .welcome-card {
    padding: 24px 18px;
  }

  .welcome-card h1 {
    font-size: 25px;
  }
}

@media (max-width: 620px) {
  :is(#learnSvg, #labSvg) .svg-label { font-size: 24px; }
  :is(#learnSvg, #labSvg) .svg-small-label { font-size: 21px; }
  :is(#learnSvg, #labSvg) .svg-caption { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
