/* Guided labs inherit the website's generated theme tokens. */
:root {
  --paper: var(--bg-page);
  --panel: var(--bg-box);
  --ink: var(--text-primary);
  --muted: var(--text-secondary);
  --line: var(--border-light);
  --accent: var(--accent-primary);
  --soft: var(--bg-box-alt);
  --shadow: 0 12px 35px #0f172a08;
  color-scheme: light;
}
[data-theme="dark"] {
  color-scheme: dark;
  --shadow: 0 12px 35px #0002;
}
[hidden] {
  display: none !important;
}
body {
  background: var(--paper);
  color: var(--ink);
}
.topbar {
  background: #0f172a;
  color: #f1f5f9;
  border-color: #334155;
  min-height: 78px;
  padding: 14px 4vw;
}
.topbar a {
  color: #cbd5e1;
}
.topbar .brand {
  color: #f1f5f9;
}
.brand-mark {
  background: #18a9a81a;
  color: #22d3d1;
  border-color: #18a9a84d;
}
.brand small {
  color: #94a3b8;
}
.top-links {
  gap: 18px;
}
.lab-status {
  display: none;
}
.top-links button {
  border: 1px solid #475569;
  border-radius: 8px;
  background: transparent;
  color: #f1f5f9;
  padding: 8px 14px;
}
.theme-toggle {
  position: static !important;
  width: auto !important;
  height: auto !important;
  box-shadow: none !important;
  font-size: 0.875rem;
}
.workspace {
  display: block;
  max-width: 1600px;
  margin: auto;
}
.main {
  padding: 28px 4vw 40px;
  min-width: 0;
}
.mobile-nav,
.below {
  display: none;
}
.heading {
  margin-bottom: 20px;
  gap: 16px;
}
.heading h1 {
  font-size: clamp(25px, 3vw, 38px);
  letter-spacing: -0.035em;
  line-height: 1.16;
}
.heading p {
  display: none;
}
.eyebrow {
  color: var(--accent);
  font-size: 0.875rem;
  letter-spacing: 0.11em;
}
.lesson-count {
  color: var(--muted);
  border-color: var(--line);
  white-space: nowrap;
}
.stepper {
  display: flex;
  gap: 6px;
  margin: 0 0 18px;
  padding: 5px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  width: fit-content;
}
.stepper button {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  color: var(--muted);
  padding: 9px 17px;
  font-weight: 600;
  font-size: 0.875rem;
}
.stepper button span {
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 23px;
  height: 23px;
  font-size: 0.875rem;
  display: grid;
  place-items: center;
}
.stepper button.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 1px 4px #0f172a10;
}
.stepper button.active span {
  background: var(--accent);
  color: var(--bg-page);
  border-color: var(--accent);
}
.experiment {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr);
  gap: 22px;
  align-items: start;
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: visible;
}
.visual-column {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--soft);
}
.stage-top {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line);
  padding: 13px 18px;
}
.stage-name {
  color: var(--ink);
}
.live-pill {
  color: var(--accent);
  background: transparent;
}
.stage {
  height: clamp(310px, 44vh, 490px);
  min-height: 0;
  background: var(--soft);
}
.stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.stage-caption {
  color: var(--ink);
  background: transparent;
  pointer-events: none;
}
.legend {
  color: var(--ink);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  padding: 8px 10px;
  border-radius: 7px;
  max-width: 190px;
}
.legend:empty {
  display: none;
}
.legend-values,
.scene-note {
  color: var(--muted);
}
.scene-note {
  background: var(--panel);
  border-radius: 5px;
  padding: 3px 7px;
}
.stage-toolbar {
  background: var(--panel);
  color: var(--muted);
  border-color: var(--line);
  padding: 10px 14px;
}
.stage-toolbar button {
  background: var(--soft);
  color: var(--ink);
  border-color: var(--line);
}
.camera-hint {
  font-size: 0.875rem;
}
.metrics {
  background: var(--panel);
  border-color: var(--line);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 15px 18px;
  gap: 12px;
}
.metric {
  border-color: var(--line);
  min-width: 0;
}
.metric-label {
  font-size: 0.875rem;
  color: var(--muted);
}
.metric-value {
  color: var(--ink);
  font-size: clamp(16px, 1.6vw, 24px);
  overflow-wrap: anywhere;
}
.metric-value small {
  font-size: 0.875rem;
}
.lesson-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  overflow: hidden;
}
.step-panel {
  padding: 26px;
  border: 0;
  background: var(--panel);
  min-width: 0;
}
.step-panel h2 {
  font-size: 1.3125rem;
  line-height: 1.3;
  letter-spacing: -0.025em;
  margin: 8px 0 16px;
}
.intro-copy {
  font-size: 1.25rem;
  line-height: 1.55;
  letter-spacing: -0.015em;
  margin: 0 0 24px;
  color: var(--ink);
}
#key-terms {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 12px 16px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
  margin: 0;
}
#key-terms dt {
  font-weight: 650;
  color: var(--accent);
}
#key-terms dd {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}
.learning-goal {
  margin-top: 28px;
  background: var(--soft);
  padding: 16px;
  border-radius: 9px;
}
.learning-goal p {
  margin: 7px 0 0;
  color: var(--ink);
  font-size: 0.875rem;
  line-height: 1.7;
}
.inspector {
  width: auto;
  max-height: none;
  border: 0;
}
.inspector-head {
  gap: 12px;
}
.inspector-head h2 {
  font-size: 1.125rem;
  margin: 0;
}
.inspector-head button {
  color: var(--muted);
}
.experiment-prompt {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 14px 0 24px;
}
.control {
  margin-bottom: 18px;
}
.control label {
  color: var(--ink);
}
.control output {
  color: var(--accent);
  background: var(--soft);
}
.control select {
  background: var(--bg-input);
  color: var(--ink);
  border-color: var(--line);
}
.range-ends {
  color: var(--muted);
}
input {
  accent-color: var(--accent);
}
.advanced-settings {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin: 8px 0 20px;
}
.advanced-settings summary,
details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.875rem;
}
.advanced-settings[open] summary {
  margin-bottom: 20px;
}
.result-status {
  color: var(--accent);
  font-size: 0.875rem;
  margin-top: 18px;
}
.inspector-note {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.6;
}
.card {
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
}
.card p {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.75;
}
.card .eyebrow,
.card .takeaway,
#lesson-heading {
  display: none;
}
.equation {
  font-size: 0.875rem;
  background: var(--soft);
  color: var(--ink);
  border-color: var(--line);
  overflow-wrap: anywhere;
  padding: 12px;
  margin: 16px 0 24px;
}
.chart-heading {
  gap: 12px;
}
.chart-heading h2 {
  font-size: 1rem;
  margin: 0;
}
.chart-heading small {
  font-size: 0.875rem;
  color: var(--muted);
}
.chart text {
  fill: var(--muted);
}
.chart .gridline {
  stroke: var(--line);
}
.chart-caption {
  font-size: 0.875rem !important;
}
.chart-legend {
  color: var(--muted);
  font-size: 0.875rem;
}
.probe {
  color: var(--muted);
  font-size: 0.875rem;
}
.details {
  border-top: 1px solid var(--line);
  margin: 20px 0 0;
  padding-top: 14px;
}
.details p {
  font-size: 0.875rem;
  line-height: 1.75;
  color: var(--muted);
}
.challenge {
  display: block;
}
.challenge h2 {
  font-size: 1.375rem;
}
.challenge > div > p {
  display: none;
}
.answers {
  margin-top: 22px;
  display: grid;
  gap: 10px;
}
.answers button {
  color: var(--ink);
  background: var(--soft);
  border-color: var(--line);
  padding: 14px;
  text-align: left;
}
.answers button.correct {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  color: var(--ink);
}
.answers button.incorrect {
  background: color-mix(in srgb, #ef4444 10%, var(--panel));
  color: var(--ink);
}
.feedback {
  color: var(--muted);
  font-size: 0.875rem;
}
.lesson-bottom {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  border: 0;
}
.lesson-bottom small {
  margin-right: auto;
  color: var(--muted);
}
button.primary {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: var(--bg-page);
  border-radius: 8px;
  padding: 11px 18px;
  font-weight: 650;
}
#previous-step,
.action-row button:not(.primary) {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 8px;
}
#previous-step:disabled {
  cursor: default;
  opacity: 0.4;
}
.task-card {
  background: var(--soft);
  border: 1px solid var(--line);
  padding: 14px;
  border-radius: 9px;
  margin-bottom: 20px;
}
.task-card h3 {
  margin: 6px 0;
  font-size: 1.0625rem;
}
.task-card p,
#task-feedback,
#task-hint {
  font-size: 0.875rem;
  color: var(--muted);
}
.action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
#course-library {
  width: min(720px, calc(100% - 28px));
  max-height: 85vh;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 30px 100px #0005;
}
#course-library::backdrop {
  background: #0f172a99;
  backdrop-filter: blur(5px);
}
.library-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: start;
}
.library-heading h2 {
  font-size: 1.375rem;
  line-height: 1.3;
  margin: 6px 0 20px;
}
#close-library {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  width: 34px;
  height: 34px;
  font-size: 1.375rem;
}
.journey {
  display: block !important;
  position: static;
  width: auto;
  height: auto;
  max-height: none;
  padding: 0;
  background: transparent;
  border: 0;
}
.journey-head {
  display: none;
}
.module-list {
  padding: 0;
  overflow: visible;
  max-height: none;
}
.module-list details {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}
.module-list summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.875rem;
  color: var(--ink);
  font-weight: 650;
  padding: 8px 0;
}
.module-list summary small {
  color: var(--muted);
}
.module-button {
  background: transparent;
  color: var(--muted);
  border-radius: 7px;
}
.module-button:hover,
.module-button.active {
  background: var(--soft);
  color: var(--ink);
}
.module-button.active .num,
.module-button.completed .num {
  color: var(--accent);
}
.journey-footer {
  color: var(--muted);
  padding: 18px 0 0;
  border-color: var(--line);
}
.progress-track {
  background: var(--soft);
}
.progress-track span {
  background: var(--accent);
}
:focus-visible {
  outline-color: var(--accent-secondary) !important;
}
@media (min-width: 1500px) {
  .main {
    padding-left: 40px;
    padding-right: 40px;
  }
}
@media (max-width: 1000px) {
  .top-links > a:nth-of-type(2) {
    display: none;
  }
  .experiment {
    grid-template-columns: minmax(0, 1.2fr) minmax(300px, 1fr);
    gap: 16px;
  }
  .step-panel {
    padding: 22px;
  }
  .camera-hint {
    display: none;
  }
}
@media (max-width: 760px) {
  .topbar {
    padding: 12px 18px;
    gap: 10px;
  }
  .brand {
    font-size: 1.0625rem;
  }
  .brand-mark,
  .top-links > a {
    display: none;
  }
  .top-links {
    gap: 8px;
  }
  .top-links button {
    padding: 7px 10px;
    font-size: 0.875rem;
  }
  .main {
    padding: 22px 16px;
  }
  .heading {
    align-items: start;
  }
  .heading h1 {
    font-size: 1.6875rem;
  }
  .lesson-count {
    font-size: 0.875rem;
    padding: 4px 6px;
  }
  .stepper {
    width: 100%;
    gap: 2px;
    justify-content: space-between;
  }
  .stepper button {
    padding: 8px 5px;
    font-size: 0.875rem;
    gap: 5px;
    flex: 1;
    justify-content: center;
  }
  .stepper button span {
    width: 18px;
    height: 18px;
    font-size: 0.875rem;
  }
  .experiment {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .stage {
    height: 290px;
  }
  .step-panel {
    padding: 22px;
  }
  .metrics {
    padding: 12px 16px;
  }
  .metric-value {
    font-size: 1.25rem;
  }
  .lesson-bottom {
    flex-wrap: wrap;
  }
  .lesson-bottom small {
    width: 100%;
    font-size: 0.875rem;
  }
  .lesson-bottom .primary {
    margin-left: auto;
  }
  .stage-name {
    font-size: 0.875rem;
  }
  .live-pill {
    font-size: 0.875rem;
  }
  .intro-copy {
    font-size: 1.1875rem;
  }
  .lesson-panel {
    min-height: 0;
  }
  .topbar .brand small {
    font-size: 0.875rem;
  }
}
.stage {
  flex: none;
}
.stage-top {
  position: static;
  flex-shrink: 0;
}
.visual-column {
  color: var(--ink);
}
:root {
  --accent-text: color-mix(in srgb, var(--accent-primary) 65%, #0f172a);
}
[data-theme="dark"] {
  --accent-text: var(--accent-primary);
}
.eyebrow,
#key-terms dt,
.control output,
.result-status,
.live-pill {
  color: var(--accent-text);
}
button.primary {
  color: #0f172a;
}
.stepper button.active span {
  color: #0f172a;
}
.webgl-fallback {
  color: var(--ink);
  background: var(--soft);
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
.inspector:not([hidden]) {
  display: block !important;
}
button.primary:hover {
  background: var(--accent-primary-hover);
  border-color: var(--accent-primary-hover);
  color: #0f172a;
}
@media (max-width: 760px) {
  .lesson-bottom small {
    flex-basis: 100%;
    max-width: none !important;
  }
  .lesson-bottom {
    justify-content: space-between;
  }
  .lesson-bottom .primary {
    margin-left: auto;
  }
}

/* Shared site typography and persistent course navigation. */
@font-face { font-family: "Inter Variable"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("../../assets/fonts/inter-var.woff2") format("woff2"); }
:root { font-family: "Inter Variable", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { font-size: 1rem; }
button, input, select { font: inherit; }
.card p, #key-terms dd, .learning-goal p, .experiment-prompt, .feedback, .details p, .inspector-note, .task-card p, #task-feedback, #task-hint { font-size: 1rem; line-height: 1.75; }
.control label, .control select, .answers button, .module-button { font-size: 0.9375rem; }
.range-ends, .control output, .metric-label, .stage-name, .chart-caption, .legend, .legend-values, .scene-note, .stage-toolbar button, .probe { font-size: 0.875rem !important; }
.workspace { display: grid; grid-template-columns: 270px minmax(0, 1fr); max-width: 1800px; }
.course-sidebar.journey { position: sticky; top: 0; max-height: 100vh; overflow-y: auto; padding: 24px 18px; border-right: 1px solid var(--line); background: var(--panel); }
.overview-link { width: 100%; min-height: 44px; padding: 10px; margin-bottom: 18px; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; color: var(--ink); text-align: left; font-weight: 650; }
.main { padding: 28px; }
.module-list summary { align-items: start; }
.module-list summary small { white-space: nowrap; }
.module-button { min-height: 44px; line-height: 1.5; }
#course-overview { max-width: 1400px; margin: auto; padding: 48px 32px; }
.overview-heading { max-width: 800px; margin-bottom: 32px; }
.overview-heading h1 { font-size: clamp(36px, 5vw, 58px); letter-spacing: -.04em; line-height: 1.15; margin: 12px 0 20px; }
.overview-heading > p:first-of-type { font-size: 1.25rem; color: var(--muted); }
#overview-progress, #search-status, .module-prerequisite { color: var(--muted); font-size: 0.875rem; }
.course-search label { display: block; font-weight: 650; margin-bottom: 8px; }
.course-search input { width: min(100%, 640px); background: var(--panel); border: 1px solid var(--line); color: var(--ink); border-radius: 8px; padding: 14px; }
#course-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-top: 28px; }
.course-card { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); padding: 28px; }
.course-card h2 { font-size: 1.625rem; line-height: 1.3; margin: 10px 0; }
.course-card > p { line-height: 1.7; }
.course-card progress { display: block; width: 100%; height: 8px; accent-color: var(--accent); margin: 20px 0 8px; }
.course-card > small { color: var(--muted); }
.lesson-link { display: grid; gap: 8px; color: var(--ink); text-decoration: none; border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-top: 16px; transition: background .15s; }
.lesson-link:hover { background: var(--soft); border-color: var(--accent); }
.lesson-link strong { font-size: 1.125rem; }
.lesson-link > span:not(.lesson-state), .lesson-link small { color: var(--muted); }
.lesson-state { color: var(--accent-text); font-size: 0.875rem; font-weight: 650; }
.lesson-link small { font-size: 0.875rem; border-top: 1px solid var(--line); padding-top: 10px; }
@media (max-width: 1200px) { .experiment { grid-template-columns: 1fr; } .workspace { grid-template-columns: 250px minmax(0, 1fr); } }
@media (max-width: 760px) {
  .workspace { display: block; }
  .course-sidebar.journey { display: none !important; }
  .topbar { position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }
  .top-links button { min-height: 44px; font-size: 0.875rem; }
  .topbar .brand small { font-size: 0.875rem; }
  .main { padding: 24px 16px; }
  #course-overview { padding: 28px 16px; }
  #course-grid { grid-template-columns: 1fr; }
  .course-card { padding: 20px; }
  .stepper { flex-wrap: wrap; }
  .stepper button { flex: 1 1 40%; min-height: 44px; }
  #key-terms { grid-template-columns: 1fr; gap: 6px; }
  #key-terms dd { margin-bottom: 12px; }
  .lesson-count { white-space: normal; }
}

.worked-example { margin-top: 24px; padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.worked-example summary { font-size: 1rem; font-weight: 650; color: var(--ink); }
.worked-example p { font-size: 1rem; line-height: 1.75; }

.lesson-bottom button, .top-links a, .top-links button { font-size: 0.875rem; }
.lesson-bottom small, .journey-footer, .journey-footer small, .lesson-count, .live-pill { font-size: 0.875rem; }

.lesson-bottom #save { color: var(--ink); background: var(--panel); border: 1px solid var(--line); padding: 10px 14px; border-radius: 8px; min-height: 44px; }

/* Reading hierarchy: UI 14–16 px, body 17 px, lead 21 px at standard size. */
:root { --text-small: .875rem; --text-ui: 1rem; --text-body: 1.0625rem; --text-lead: 1.3125rem; }
html[data-reading-size="large"] { font-size: 112.5%; }
body { font-size: var(--text-body); line-height: 1.7; }
.heading h1 { font-size: clamp(1.875rem, 3vw, 2.625rem); line-height: 1.2; }
.overview-heading h1 { font-size: clamp(2.25rem, 5vw, 3.625rem); }
.step-panel h2, .challenge h2 { font-size: 1.5rem; line-height: 1.35; }
.course-card h2 { font-size: 1.75rem; }
.chart-heading h2, .inspector-head h2 { font-size: 1.25rem; }
.intro-copy, .overview-heading > p:first-of-type { font-size: var(--text-lead); line-height: 1.65; letter-spacing: normal; }
.card p, #key-terms dd, .learning-goal p, .experiment-prompt, .feedback, .details p, .worked-example p, .task-card p, #task-feedback, #task-hint, .inspector-note { font-size: var(--text-body); line-height: 1.75; }
.control label, .control select, .answers button, .stepper button, .module-button, .lesson-bottom button, .top-links button { font-size: var(--text-ui); }
.equation { font-size: var(--text-ui); line-height: 1.8; padding: 16px; }
.metric-value { font-size: clamp(1.5rem, 2vw, 1.875rem); font-variant-numeric: tabular-nums; }
.eyebrow, .stage-name, .metric-label, .brand small { letter-spacing: .055em; }
.stepper button span { min-width: 1.75rem; height: 1.75rem; }
.brand small { font-size: var(--text-small); }
.legend { max-width: 240px; }
.stage-top, .stage-toolbar, .chart-heading, .inspector-head { flex-wrap: wrap; }
.stage-toolbar .tool-group { flex-wrap: wrap; }
button, .lesson-bottom #save { min-height: 44px; }
#chart { overflow-x: auto; padding: 4px 0 12px; }
.chart { min-width: 440px; width: 100%; height: auto; }
.chart text { font-family: inherit; font-size: 14px; font-variant-numeric: tabular-nums; }
html[data-reading-size="large"] .chart { min-width: 495px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: var(--text-small); }
.reading-toggle[aria-pressed="true"] { border-color: var(--accent); }
.overview-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 24px 0; }
.overview-stats > div { background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.overview-stats strong { display: block; font-size: 1.75rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.overview-stats span { font-size: var(--text-small); color: var(--muted); }
.overview-heading > progress { width: 100%; height: 12px; accent-color: var(--accent); }
.overview-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.overview-actions a { color: var(--accent-text); align-self: center; padding: 10px; }
.progress-filter { margin-top: 16px; }
.progress-filter label { margin-right: 12px; }
.progress-filter select { font: inherit; padding: 10px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; max-width: 100%; }
.learning-progress { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px; margin-bottom: 20px; font-size: var(--text-small); }
.learning-progress strong { color: var(--accent-text); }
.learning-progress progress { width: 120px; height: 8px; accent-color: var(--accent); }
.module-button .nav-state { display: block; font-size: var(--text-small); font-weight: 400; color: var(--muted); margin-top: 4px; }
.stepper button.visited span { border-color: var(--accent-text); }
.step-visited { font-size: var(--text-small); }
.lesson-link[data-status="in-progress"] { border-left: 4px solid var(--accent); }
.lesson-link[data-status="completed"] .lesson-state { font-weight: 750; }
@media (max-width: 1000px) { .topbar { flex-wrap: wrap; } .top-links { flex-wrap: wrap; } }
@media (max-width: 760px) {
  .topbar { position: relative; z-index: 20; }
  .top-links { width: 100%; gap: 8px; }
  .top-links button { flex: 1 1 auto; }
  .heading { flex-wrap: wrap; }
  .heading h1 { font-size: 1.875rem; }
  .overview-stats { gap: 8px; }
  .overview-stats > div { padding: 12px 8px; }
  .overview-stats strong { font-size: 1.5rem; }
  .metrics { grid-template-columns: 1fr; }
  .metric { border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 0; }
  .metric:last-child { border: 0; }
  .learning-progress { position: sticky; top: 0; z-index: 5; background: var(--panel); }
  .learning-progress a { color: var(--accent-text); font-weight: 650; }
  .lesson-bottom #save { flex-basis: 100%; text-align: center; }
}

/* Keep evidence readable without squeezing it into a narrow desktop column. */
@media (min-width: 1201px) { .experiment { grid-template-columns: minmax(0, 1fr) minmax(500px, 1fr); } }
@media (max-width: 1600px) { html[data-reading-size="large"] .experiment { grid-template-columns: 1fr; } }
progress { appearance: none; border: 0; border-radius: 99px; overflow: hidden; background: var(--line); }
progress::-webkit-progress-bar { background: var(--line); border-radius: 99px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 99px; }
#chart:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }

.topbar { height: auto; }
.skip { z-index: 100; }

.chart { max-width: 42rem; }
.step-panel p, .course-card > p { max-width: 70ch; }
#key-terms dt { overflow-wrap: anywhere; }

.card .chart-scroll-hint { font-size: var(--text-small); color: var(--accent-text); margin: 0 0 12px; }

/* Module selection and lesson recovery. */
#course-picker { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin: 0 0 28px; }
#course-picker button { display: grid; align-content: start; gap: 8px; background: var(--panel); border: 1px solid var(--line); color: var(--ink); border-radius: 10px; padding: 16px; text-align: left; font-size: 1rem; line-height: 1.5; }
#course-picker button span { font-size: var(--text-small); color: var(--muted); }
#course-picker button[aria-pressed="true"] { border-color: var(--accent-text); background: var(--soft); box-shadow: inset 0 3px var(--accent); }
#clear-course-filters, #revisit-experiment, #review-module { color: var(--ink); background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; font-size: 1rem; }
#revisit-experiment { margin-top: 20px; }
#check-milestone { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 20px; margin-top: 24px; }
#check-milestone h3 { font-size: 1.25rem; margin: 0 0 12px; }
#check-milestone p { font-size: var(--text-body); }
#module-next { display: block; color: var(--accent-text); margin: 16px 0; overflow-wrap: anywhere; }
.step-panel { scroll-margin-top: 24px; }
@media (max-width: 1000px) { #course-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); } #course-picker button:first-child { grid-column: 1 / -1; } }
@media (max-width: 760px) { .step-panel { scroll-margin-top: 12rem; } .lesson-bottom #next { max-width: 100%; white-space: normal; } }

/* Keep field annotations outside the model at the restored type scale. */
.visual-column > .stage-caption { position: static; display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 16px; background: var(--panel); border-top: 1px solid var(--line); }
.visual-column > .stage-caption .legend { flex: 0 1 260px; width: 260px; max-width: 100%; }
.visual-column > .stage-caption .legend-values { gap: 18px; white-space: nowrap; }
.visual-column > .stage-caption .scene-note { flex: 1 1 220px; max-width: none; overflow-wrap: anywhere; }
.playback-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; width: 100%; border-top: 1px solid var(--line); padding-top: 12px; font-size: 1rem; }
.playback-controls select { font: inherit; min-height: 44px; padding: 8px; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
#motion-status { color: var(--muted); font-size: var(--text-small); }
#open-lessons { display: none; }
#lesson-drawer { width: min(420px, calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: var(--panel); }
#lesson-drawer::backdrop { background: #0f172a99; }
.drawer-heading { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.drawer-heading h2 { font-size: 1.25rem; margin: 0; }
#close-lessons, #open-lessons { font: inherit; min-height: 44px; padding: 8px 12px; color: var(--ink); background: var(--soft); border: 1px solid var(--line); border-radius: 8px; }
#lesson-drawer .course-sidebar.journey { display: block !important; position: static; max-height: none; border: 0; padding: 16px; }
#lesson-drawer .overview-link { margin: 0 0 12px; }
@media (max-width: 760px) { #open-lessons { display: inline-block; } }
