/* ---------- lesson tab ---------- */
.lesson-panel {
  padding: 34px 40px 40px;
  max-width: 940px;
  margin: auto;
  --cjk-sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --cjk-serif: "Songti SC", "Noto Serif CJK SC", "STSong", serif;
}
.lesson-panel h2 {
  font-family: var(--serif);
  font-size: 29px;
  font-weight: 400;
  letter-spacing: -0.5px;
  margin-bottom: 10px;
}
.lesson-panel h3 {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}
.lesson-lede {
  color: var(--muted);
  font-size: 13px;
  max-width: 560px;
  margin-bottom: 26px;
}
.lesson-box {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 20px 22px;
  margin-bottom: 20px;
}
.lesson-check {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}
.lesson-check input {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}
.lesson-files {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}
.lesson-file {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0 8px 26px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.lesson-file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lesson-file-detail {
  margin-left: auto;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50%;
}
.lesson-file.is-error .lesson-file-detail {
  color: #bc6a5d;
}
.lesson-file-remove {
  width: 28px;
  height: 28px;
  font-size: 18px;
}
.lesson-add {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  font-size: 11px;
}
.lesson-options {
  display: grid;
  grid-template-columns: 0.8fr 1fr 1.4fr;
  gap: 16px;
  margin-bottom: 24px;
}
.lesson-options label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
}
.lesson-options select,
.lesson-options input,
.lesson-voice {
  font: inherit;
  font-weight: 400;
  font-size: 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 10px;
  min-height: 38px;
}
.lesson-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}
.lesson-engine {
  font-size: 11px;
}
.lesson-error {
  font-size: 12px;
  color: #bc6a5d;
  margin-top: 14px;
}

/* ---------- generation progress ---------- */
.lesson-stages {
  display: flex;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 18px 0 22px;
  counter-reset: stage;
}
.lesson-stages li {
  counter-increment: stage;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 99px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.lesson-stages li::before {
  content: counter(stage) " · ";
}
.lesson-stages li.is-active {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 500;
}
.lesson-stages li.is-done {
  background: var(--soft);
  color: var(--ink);
}
.lesson-stages li.is-failed {
  border-color: #bc6a5d;
  color: #bc6a5d;
}
.lesson-threads {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  border-top: 1px solid var(--border);
}
.lesson-thread {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.lesson-thread strong {
  font-weight: 500;
}
.lesson-thread .muted {
  margin-left: auto;
  font-size: 11px;
  text-align: right;
}
.lesson-thread-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--muted);
  flex: none;
}
.lesson-thread.is-running .lesson-thread-dot {
  border-color: var(--accent);
  background: var(--accent);
  animation: lesson-pulse 1.2s ease-in-out infinite;
}
.lesson-thread.is-done .lesson-thread-dot {
  border-color: var(--accent);
  background: var(--accent);
}
.lesson-thread.is-failed .lesson-thread-dot {
  border-color: #bc6a5d;
  background: #bc6a5d;
}
@keyframes lesson-pulse {
  50% {
    opacity: 0.3;
  }
}
.lesson-cost {
  font-size: 11px;
  margin-bottom: 18px;
}

/* ---------- player ---------- */
.lesson-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
}
.lesson-head .document-label {
  font-size: 9px;
  letter-spacing: 1.2px;
  color: var(--muted);
  margin-bottom: 6px;
}
.lesson-panel .lesson-heading {
  font-size: 24px;
  margin: 0;
}
.lesson-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.lesson-stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 1280px;
  height: 720px;
  transform-origin: 0 0;
}
.lesson-loading {
  position: absolute;
  right: 14px;
  bottom: 12px;
  font-size: 11px;
  color: var(--muted);
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 99px;
}
.lesson-caption {
  min-height: 3.4em;
  margin: 14px 4px 6px;
  font-size: 15px;
  line-height: 1.6;
  font-family: var(--ui), var(--cjk-sans);
}
.lesson-caption .spoken {
  color: var(--ink);
}
.lesson-caption .rest {
  color: var(--muted);
}
.lesson-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.lesson-controls .icon {
  width: 18px;
  height: 18px;
}
.lesson-controls .icon-button:disabled {
  opacity: 0.35;
  cursor: default;
}
.lesson-play {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: var(--bg);
  display: grid;
  place-items: center;
  flex: none;
}
.lesson-play:hover {
  filter: brightness(0.95);
}
.lesson-counter,
.lesson-time {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.lesson-progress {
  flex: 1;
  display: flex;
  gap: 3px;
  height: 22px;
  align-items: center;
  cursor: pointer;
  margin: 0 6px;
  position: relative;
  touch-action: none;
  user-select: none;
}
.lesson-seg {
  flex: 1 1 0;
  height: 5px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
  transition: height 0.15s;
}
.lesson-progress:hover .lesson-seg,
.lesson-progress.is-scrubbing .lesson-seg {
  height: 7px;
}
.lesson-thumb {
  position: absolute;
  top: 50%;
  left: 0;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--surface, #fff), 0 2px 6px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  transform: scale(0.7);
  transition: transform 0.15s;
}
.lesson-progress:hover .lesson-thumb,
.lesson-progress:focus-visible .lesson-thumb,
.lesson-progress.is-scrubbing .lesson-thumb {
  transform: scale(1);
}
.lesson-tip {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--ink);
  color: var(--bg);
  font: 11px/1.4 ui-monospace, SFMono-Regular, monospace;
  transform: translateX(-50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.lesson-progress:hover .lesson-tip,
.lesson-progress.is-scrubbing .lesson-tip {
  opacity: 1;
}
.lesson-seg i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
}
.lesson-voice {
  min-height: 32px;
  padding: 4px 8px;
  font-size: 11px;
}
.lesson-player:fullscreen {
  background: var(--bg);
  padding: 28px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.lesson-player:fullscreen .lesson-frame,
.lesson-player:fullscreen .lesson-caption,
.lesson-player:fullscreen .lesson-controls {
  width: min(100%, calc((100vh - 170px) * 16 / 9));
  margin-left: auto;
  margin-right: auto;
}
.lesson-player:fullscreen .lesson-caption {
  font-size: 19px;
}

/* ---------- slides (1280 × 720 logical pixels, scaled to fit) ---------- */
.ls-slide {
  width: 1280px;
  height: 720px;
  padding: 64px 84px 56px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--ui), var(--cjk-sans);
}
.ls-el {
  transition:
    opacity 0.5s ease,
    transform 0.5s ease,
    background-color 0.3s,
    box-shadow 0.3s,
    color 0.3s;
}
.ls-mounting .ls-el,
.ls-mounting .ls-ch {
  transition: none;
}
/* Text being written out (lesson-render.js writer). */
.ls-ch {
  transition: opacity 0.18s ease;
}
.ls-ch.is-unwritten {
  opacity: 0;
}
.ls-el.is-hidden {
  opacity: 0;
  transform: translateY(18px);
}
.ls-title {
  font-family: var(--serif), var(--cjk-serif);
  font-size: 54px;
  font-weight: 400;
  letter-spacing: -1px;
  line-height: 1.15;
}
.ls-title.is-highlight {
  color: var(--accent);
}
.ls-subtitle {
  font-size: 26px;
  color: var(--muted);
  margin-top: 16px;
  line-height: 1.4;
}
.ls-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 32px;
  margin-top: 34px;
}
.ls-layout-split .ls-body {
  display: grid;
  grid-template-columns: 1fr 1.08fr;
  align-items: center;
  gap: 48px;
}
.ls-layout-title {
  justify-content: center;
}
.ls-layout-title .ls-header {
  max-width: 1000px;
}
.ls-layout-title .ls-title {
  font-size: 84px;
  letter-spacing: -2px;
}
.ls-layout-title .ls-subtitle {
  font-size: 30px;
  margin-top: 26px;
}
.ls-title-rule {
  width: 120px;
  height: 6px;
  border-radius: 3px;
  background: var(--accent);
  margin-top: 46px;
  order: 2;
}
.ls-layout-title .ls-body {
  flex: 0;
  margin: 0;
}
.ls-bullets {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ls-bullet {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 14px 20px;
  border-radius: 14px;
  font-size: 30px;
  line-height: 1.35;
}
.ls-layout-split .ls-bullet {
  font-size: 27px;
  padding: 12px 16px;
}
.ls-bullet.is-highlight {
  background: var(--soft);
  box-shadow: inset 5px 0 var(--accent);
}
.ls-bullet-icon {
  width: 56px;
  height: 56px;
  flex: none;
  border-radius: 14px;
  background: var(--soft);
  color: var(--accent);
  display: grid;
  place-items: center;
}
.ls-bullet.is-highlight .ls-bullet-icon {
  background: var(--accent);
  color: var(--surface);
}
.ls-icon {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ls-takeaways .ls-bullet {
  border: 1.5px solid var(--border);
}
.ls-term {
  border-left: 6px solid var(--accent);
  padding: 8px 0 8px 34px;
}
.ls-term-word {
  font-family: var(--serif), var(--cjk-serif);
  font-size: 64px;
  line-height: 1.1;
  color: var(--accent);
}
.ls-term-definition {
  font-size: 30px;
  line-height: 1.45;
  margin-top: 18px;
  max-width: 1000px;
}
.ls-term.is-highlight {
  background: var(--soft);
}
.ls-visual {
  margin: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ls-layout-visual .ls-visual {
  flex: 1;
}
.ls-visual-canvas {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: var(--bg);
  padding: 18px;
}
.ls-visual.is-highlight .ls-visual-canvas {
  box-shadow: 0 0 0 4px var(--plot);
}
.ls-visual-canvas > svg {
  width: 100%;
  height: 100%;
  max-height: 470px;
}
.ls-layout-split .ls-visual-canvas > svg {
  max-height: 440px;
}
.ls-visual figcaption {
  font-size: 20px;
  color: var(--muted);
  text-align: center;
}
.ls-visual-error {
  font-size: 20px;
  color: #bc6a5d;
}

/* visuals */
.ls-grid {
  fill: none;
  stroke: var(--border);
  stroke-width: 1.2;
}
.ls-axis {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.6;
}
.ls-curve {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linejoin: round;
}
.ls-dot {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 3;
}
.ls-tick,
.ls-axis-label {
  fill: var(--muted);
  font-size: 17px;
  font-family: var(--ui), var(--cjk-sans);
}
.ls-axis-label {
  font-style: italic;
}
.ls-equilibrium {
  stroke: var(--plot);
  stroke-width: 1.5;
  stroke-dasharray: 6 6;
}
.ls-spring-coil {
  fill: none;
  stroke: var(--muted);
  stroke-width: 3;
  stroke-linejoin: round;
}
.ls-mass {
  fill: var(--accent);
}
.ls-mass-label {
  fill: var(--surface);
  font: italic 22px var(--serif);
}
.ls-readout {
  fill: var(--muted);
  font-size: 20px;
  font-family: ui-monospace, SFMono-Regular, monospace;
}
.ls-readout-strong {
  fill: var(--ink);
  font-weight: 600;
}
.ls-bar {
  fill: var(--plot);
  transition: opacity 0.3s, fill 0.3s;
}
.ls-bar[data-focus="is-focus"] {
  fill: var(--accent);
}
[data-focus="is-dim"] {
  opacity: 0.35;
}
.ls-bar-value {
  fill: var(--ink);
  font-size: 22px;
  font-weight: 600;
  font-family: var(--ui), var(--cjk-sans);
}
.ls-bar-label {
  fill: var(--muted);
  font-size: 20px;
  font-family: var(--ui), var(--cjk-sans);
}
.ls-steps {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.ls-step {
  flex: 1;
  min-height: 150px;
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  font-size: 23px;
  line-height: 1.3;
  transition: background 0.3s, border-color 0.3s, color 0.3s;
}
.ls-step-n {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 19px;
}
.ls-step.is-done {
  border-color: var(--plot);
}
.ls-step.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--surface);
}
.ls-step.is-active .ls-step-n {
  background: var(--surface);
}
.ls-step-arrow {
  color: var(--muted);
  flex: none;
}
.ls-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  width: 100%;
}
.ls-compare-col {
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 22px 26px;
  background: var(--surface);
  transition: opacity 0.3s, border-color 0.3s;
}
.ls-compare-col h4 {
  margin: 0 0 12px;
  font-size: 26px;
  color: var(--accent);
}
.ls-compare-col ul {
  margin: 0;
  padding-left: 24px;
  font-size: 22px;
  line-height: 1.45;
}
.ls-compare-col.is-focus {
  border-color: var(--accent);
}
.ls-compare-col.is-dim {
  opacity: 0.4;
}
.ls-code {
  margin: 0;
  width: 100%;
  font: 21px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--surface);
  border-radius: 12px;
  padding: 18px 0;
  overflow: hidden;
}
.ls-code-line {
  display: flex;
  gap: 18px;
  padding: 0 22px;
  white-space: pre;
  transition: background 0.3s;
}
.ls-code-n {
  color: var(--muted);
  width: 26px;
  text-align: right;
  flex: none;
}
.ls-code-line.is-active {
  background: var(--soft);
  box-shadow: inset 5px 0 var(--accent);
}
.ls-equation {
  text-align: center;
}
.ls-equation-formula {
  font-family: var(--serif), var(--cjk-serif);
  font-size: 70px;
}
.ls-equation-note {
  font-size: 24px;
  color: var(--muted);
  margin-top: 16px;
}

@media (max-width: 700px) {
  .lesson-panel {
    padding: 26px 18px 30px;
  }
  .lesson-options {
    grid-template-columns: 1fr;
  }
  .lesson-head {
    flex-wrap: wrap;
  }
  .lesson-controls {
    flex-wrap: wrap;
  }
  .lesson-progress {
    order: 10;
    flex-basis: 100%;
    margin: 4px 0 0;
  }
  .lesson-time {
    margin-left: auto;
  }
}

/* ---------- tutor: questions during a lesson and the tutor's cursor ---------- */
.lesson-panel,
.lesson-player:fullscreen {
  --tutor-ink: #d9480f;
}
html[data-theme="dark"] .lesson-panel,
html[data-theme="dark"] .lesson-player:fullscreen {
  --tutor-ink: #ff8a4c;
}
.lesson-ask-btn {
  min-height: 32px;
  padding: 4px 12px;
  font-size: 12px;
  gap: 6px;
}
.lesson-ask-btn[aria-expanded="true"] {
  border-color: var(--tutor-ink);
  color: var(--tutor-ink);
}
.tutor-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  opacity: 0;
  transition: opacity 0.25s;
}
.tutor-layer.is-active {
  opacity: 1;
}
.tutor-stroke {
  fill: none;
  stroke: var(--tutor-ink);
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
}
.tutor-ring {
  fill: none;
  stroke: var(--tutor-ink);
  stroke-width: 2.5;
}
.tutor-dot {
  fill: var(--tutor-ink);
}
.tutor-mark {
  transition: opacity 0.4s;
}
.tutor-mark.is-old {
  opacity: 0.3;
}
.tutor-pointer-arrow {
  fill: var(--tutor-ink);
  stroke: #fff;
  stroke-width: 1.4;
  stroke-linejoin: round;
}
.tutor-pointer-tag {
  fill: var(--tutor-ink);
}
.tutor-pointer-label {
  fill: #fff;
  font: 600 11px var(--ui), var(--cjk-sans);
}
.lesson-ask {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px 12px;
  background: var(--surface);
}
.ask-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.lesson-panel .ask-title {
  margin: 0;
  font-size: 13px;
}
.ask-log {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 240px;
  overflow-y: auto;
}
.ask-msg {
  padding: 8px 0;
  font-size: 14px;
  line-height: 1.55;
  font-family: var(--ui), var(--cjk-sans);
}
.ask-msg + .ask-msg {
  border-top: 1px solid var(--border);
}
.ask-who {
  display: block;
  font-size: 10px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}
.ask-a .ask-who {
  color: var(--tutor-ink);
}
.ask-text {
  margin: 0;
}
.ask-a.is-pending .ask-text {
  color: var(--muted);
}
.ask-a.is-error .ask-text {
  color: #b42318;
}
.ask-cue {
  color: var(--muted);
  transition: color 0.2s;
}
.ask-a.is-done .ask-cue,
.ask-cue.is-current {
  color: var(--ink);
}
.ask-replay {
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 12px;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}
.ask-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-top: 10px;
}
.ask-input {
  flex: 1;
  resize: none;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.4 var(--ui), var(--cjk-sans);
}
.ask-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
.ask-buttons {
  display: flex;
  gap: 6px;
  align-items: center;
}
.ask-mic .icon {
  width: 20px;
  height: 20px;
}
.ask-mic.is-listening {
  color: #fff;
  background: var(--tutor-ink);
}
@media (prefers-reduced-motion: no-preference) {
  .ask-mic.is-listening {
    animation: ask-pulse 1.2s ease-in-out infinite;
  }
}
@keyframes ask-pulse {
  50% {
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--tutor-ink) 25%, transparent);
  }
}
.ask-status {
  min-height: 1.4em;
  margin: 6px 0 0;
  font-size: 12px;
}
/* Full screen: the question panel sits beside the slide. */
.lesson-player.is-asking:fullscreen {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-rows: auto auto auto;
  align-content: center;
  column-gap: 24px;
}
.lesson-player.is-asking:fullscreen .lesson-frame,
.lesson-player.is-asking:fullscreen .lesson-caption,
.lesson-player.is-asking:fullscreen .lesson-controls {
  grid-column: 1;
  width: min(100%, calc((100vh - 170px) * 16 / 9));
}
.lesson-player.is-asking:fullscreen .lesson-ask {
  grid-column: 2;
  grid-row: 1 / span 3;
  margin: 0;
  align-self: stretch;
  display: flex;
  flex-direction: column;
}
.lesson-player.is-asking:fullscreen .ask-log {
  flex: 1;
  max-height: none;
}
@media (max-width: 700px) {
  .ask-form {
    flex-direction: column;
    align-items: stretch;
  }
  .ask-buttons {
    justify-content: flex-end;
  }
}

/* ---------- colour palette, rich text and formulas ---------- */
:root {
  --c-blue: #2563eb;
  --c-orange: #e8590c;
  --c-green: #2b8a3e;
  --c-red: #e03131;
  --c-purple: #9c36b5;
  --c-teal: #0c8599;
  --hl: rgba(255, 212, 59, 0.4);
}
html[data-theme="dark"] {
  --c-blue: #74a7ff;
  --c-orange: #ffa94d;
  --c-green: #69db7c;
  --c-red: #ff8787;
  --c-purple: #da77f2;
  --c-teal: #3bc9db;
  --hl: rgba(255, 212, 59, 0.3);
}
.lc-blue { color: var(--c-blue); }
.lc-orange { color: var(--c-orange); }
.lc-green { color: var(--c-green); }
.lc-red { color: var(--c-red); }
.lc-purple { color: var(--c-purple); }
.lc-teal { color: var(--c-teal); }
mark.ls-hl {
  color: inherit;
  font-weight: 600;
  background: linear-gradient(transparent 52%, var(--hl) 52%);
  padding: 0 0.06em;
}
/* inline-block so a highlighted fraction or root keeps KaTeX's layout */
.lc-hl {
  display: inline-block;
  background: var(--hl);
  border-radius: 0.2em;
  padding: 0.05em 0.2em;
}
.ls-math .katex {
  font-size: 1.08em;
}
.ls-tex-fallback {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.85em;
}
.ls-equation-formula {
  font-size: 54px;
}
.ls-layout-split .ls-title .katex,
.ls-title .katex {
  font-size: 1em;
}

/* ---------- live demonstrations: arrows, cart, skaters, free-body diagram ---------- */
.ls-arrow line {
  stroke: var(--arrow);
  stroke-width: 6;
  stroke-linecap: round;
}
.ls-arrow path {
  fill: var(--arrow);
}
.ls-arrow-thin line {
  stroke-width: 4;
}
.ls-arrow.is-dim,
.ls-svg-label.is-dim {
  opacity: 0.25;
}
.ls-fbd-force.is-focus line {
  stroke-width: 9;
}
.ls-net line {
  stroke-width: 3.5;
  stroke-dasharray: 9 7;
}
.ls-ticks {
  stroke: var(--muted);
}
.ls-cart-body {
  fill: var(--c-blue);
  transition: opacity 0.3s;
}
.ls-cart-body.is-arrived {
  opacity: 0.5;
}
.ls-wheel {
  fill: var(--ink);
}
.ls-cart .ls-readout,
.ls-push .ls-readout {
  font-size: 21px;
  font-weight: 600;
}
.ls-ice {
  fill: color-mix(in srgb, var(--c-teal) 14%, transparent);
}
.ls-skater-body,
.ls-skater-head {
  fill: var(--body);
}
.ls-skater-head {
  opacity: 0.85;
}
.ls-skater-label {
  fill: var(--muted);
  font: 17px var(--ui);
}
.ls-fbd-body {
  fill: var(--soft);
  stroke: var(--ink);
  stroke-width: 2;
}
.ls-svg-label {
  overflow: visible;
}
.ls-svg-label > div {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.15;
  font: 22px var(--ui), var(--cjk-sans);
  color: var(--label, var(--ink));
}
.ls-fbd-name > div {
  font-size: 25px;
  font-weight: 600;
}
.ls-fbd-label > div {
  font-weight: 600;
}

/* ---------- mini lab ---------- */
.lesson-lab {
  margin-top: 34px;
  border-top: 1px solid var(--border);
  padding-top: 26px;
}
.lesson-lab .document-label {
  font-size: 9px;
  letter-spacing: 1.2px;
  color: var(--muted);
  margin-bottom: 6px;
}
.lesson-panel .lab-title {
  font-family: var(--serif), var(--cjk-serif);
  font-size: 24px;
  font-weight: 400;
  margin-bottom: 6px;
}
.lab-intro {
  font-size: 13px;
  color: var(--muted);
  max-width: 680px;
}
.lab-why,
.lab-skip {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  font-style: italic;
}
.lab-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  margin-top: 18px;
  align-items: start;
}
.lab-sim {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: var(--surface);
}
.lab-canvas {
  aspect-ratio: 640 / 300;
  padding: 6px;
}
.lab-canvas > svg {
  width: 100%;
  height: 100%;
}
.lab-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 18px;
  margin-top: 14px;
}
.lab-control {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}
.lab-control-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.lab-value {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 12px;
  color: var(--muted);
}
.lab-control input {
  width: 100%;
  accent-color: var(--accent);
}
.lab-buttons {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.lab-progress {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}
.lab-tasks {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lab-task {
  display: flex;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.55;
  transition: background 0.3s, border-color 0.3s;
}
.lab-mark {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex: none;
  display: grid;
  place-items: center;
  margin-top: 1px;
}
.lab-task.is-now {
  border-color: var(--accent);
}
.lab-task.is-now .lab-mark {
  border-color: var(--accent);
}
.lab-task.is-done {
  background: color-mix(in srgb, var(--c-green) 9%, var(--surface));
  border-color: color-mix(in srgb, var(--c-green) 45%, var(--border));
}
.lab-task.is-done .lab-mark {
  background: var(--c-green);
  border-color: var(--c-green);
}
.lab-task.is-done .lab-mark::after {
  content: "✓";
  color: var(--surface);
  font-size: 13px;
  font-weight: 700;
}
.lab-hint {
  font-size: 11px;
  color: var(--muted);
}
.lab-answer-toggle {
  background: none;
  border: 0;
  padding: 0;
  margin-top: 6px;
  font-size: 12px;
  color: var(--accent);
}
.lab-answer {
  margin-top: 6px;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 7px;
}
@media (max-width: 700px) {
  .lab-grid,
  .lab-controls {
    grid-template-columns: 1fr;
  }
}

/* ---------- quiz: questions, whiteboard, grading and the mistake book (lesson-quiz.js) ---------- */
.lesson-quiz,
.lesson-reading {
  margin-top: 34px;
  padding-top: 26px;
  border-top: 1px solid var(--border);
}
.lesson-quiz .document-label,
.lesson-reading .document-label {
  font-size: 9px;
  letter-spacing: 1.2px;
  color: var(--muted);
  margin-bottom: 6px;
}
/* Further reading (js/lesson-reading.js) */
.reading-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  border-top: 1px solid var(--border);
}
.reading-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.reading-kind {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--soft);
  display: grid;
  place-items: center;
}
.reading-kind svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.6;
  stroke-linejoin: round;
}
.reading-kind svg .fill {
  fill: var(--ink);
  stroke: none;
}
.reading-body {
  min-width: 0;
}
.reading-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  overflow-wrap: anywhere;
}
a.reading-title:hover {
  text-decoration: underline;
}
.reading-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.reading-level {
  padding: 1px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
}
.reading-blurb {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.5;
  max-width: 640px;
}
.reading-note {
  font-size: 12px;
}
.lesson-panel .quiz-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  margin: 0 0 6px;
}
.quiz-lede,
.quiz-note {
  color: var(--muted);
  font-size: 13px;
  max-width: 620px;
}
.quiz-note {
  margin-top: 8px;
}
.quiz-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 16px 0;
}
.quiz-gap {
  flex: 1;
}
.quiz-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--c-red);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}
.link-button {
  border: 0;
  background: none;
  padding: 4px 2px;
  color: var(--accent);
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
}
.quiz-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 14px;
}
.quiz-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
.quiz-dot.is-answered {
  background: var(--soft);
  color: var(--ink);
}
.quiz-dot.is-current {
  border-color: var(--accent);
  color: var(--ink);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent);
}
.quiz-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 22px;
  background: var(--surface);
}
.quiz-meta {
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 8px;
}
.quiz-prompt {
  font-size: 16px;
  line-height: 1.55;
  margin: 0 0 14px;
  font-family: var(--ui), var(--cjk-sans);
}
.quiz-choices {
  display: grid;
  gap: 8px;
}
.quiz-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.quiz-choice:hover {
  border-color: var(--muted);
}
.quiz-choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--soft);
}
.quiz-choice input {
  accent-color: var(--accent);
}
.quiz-letter {
  font-weight: 600;
  color: var(--muted);
  width: 14px;
}
.quiz-hint {
  font-size: 12px;
  margin: -4px 0 8px;
}
.board {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.board-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.board-tool {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  background: none;
  color: var(--ink);
  cursor: pointer;
}
.board-tool[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--surface);
}
.board-tool .icon {
  width: 18px;
  height: 18px;
}
.board-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ink);
}
.board-blue .board-swatch {
  background: var(--c-blue);
}
.board-red .board-swatch {
  background: var(--c-red);
}
.board-gap {
  flex: 1;
}
.board-action {
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.board-action:disabled {
  color: var(--muted);
  opacity: 0.5;
  cursor: default;
}
.board-status {
  font-size: 11px;
  margin: 0 6px;
}
.board-save:disabled {
  opacity: 0.45;
}
.board-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1000 / 560;
  touch-action: none;
  cursor: crosshair;
  background-color: var(--surface);
  background-image: radial-gradient(color-mix(in srgb, var(--muted) 35%, transparent) 1px, transparent 1px);
  background-size: 22px 22px;
}
.board-canvas:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.quiz-thumb {
  display: block;
  max-width: 100%;
  height: auto;
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}
.quiz-grading {
  list-style: none;
  padding: 0;
  margin: 12px 0;
}
.quiz-grading-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.quiz-grading-row.is-pending .muted::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: quiz-blink 1s ease-in-out infinite;
}
@keyframes quiz-blink {
  50% {
    opacity: 0.2;
  }
}
.quiz-grading-n {
  font-weight: 600;
}
.quiz-score strong {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 400;
}
.quiz-results {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}
.quiz-result {
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 0 10px 10px 0;
  padding: 14px 18px;
  background: var(--surface);
}
.quiz-result.is-correct {
  border-left-color: var(--c-green);
}
.quiz-result.is-partial {
  border-left-color: var(--c-orange);
}
.quiz-result.is-wrong,
.quiz-result.is-blank {
  border-left-color: var(--c-red);
}
.quiz-result-top {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.quiz-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--soft);
  color: var(--ink);
  white-space: nowrap;
}
.quiz-badge.is-correct {
  color: var(--c-green);
}
.quiz-badge.is-partial {
  color: var(--c-orange);
}
.quiz-badge.is-wrong,
.quiz-badge.is-blank,
.quiz-badge.is-error {
  color: var(--c-red);
}
.quiz-result-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  font-size: 13px;
}
.quiz-col-label {
  font-size: 10px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 4px;
}
.quiz-yours p,
.quiz-solution p {
  margin: 0 0 6px;
}
.quiz-steps {
  margin: 4px 0 6px;
  padding-left: 20px;
}
.quiz-steps li {
  margin-bottom: 4px;
}
.quiz-explanation,
.quiz-read {
  color: var(--muted);
}
.quiz-mistake {
  display: inline-block;
  margin: 10px 0 0;
  padding: 2px 10px;
  border-radius: 99px;
  font-size: 12px;
  color: var(--c-red);
  background: color-mix(in srgb, var(--c-red) 10%, transparent);
}
.quiz-feedback {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--soft);
  font-size: 13px;
  line-height: 1.55;
}
/* mistake book */
.quiz-book {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 22px 26px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  --cjk-sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
}
.quiz-book::backdrop {
  background: rgba(0, 0, 0, 0.45);
}
.quiz-book-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.quiz-book-head h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 24px;
  margin: 0;
}
.quiz-book-close {
  font-size: 22px;
}
.quiz-book-lede {
  font-size: 13px;
}
.quiz-book-filter {
  display: flex;
  gap: 6px;
  margin: 8px 0 14px;
}
.quiz-chip {
  border: 1px solid var(--border);
  background: none;
  color: var(--ink);
  border-radius: 99px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
}
.quiz-chip.is-on {
  border-color: var(--accent);
  background: var(--soft);
}
.quiz-book-empty {
  color: var(--muted);
  padding: 30px 0;
  text-align: center;
}
.quiz-book-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}
.quiz-book-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  background: var(--surface);
}
.quiz-book-item.is-mastered {
  opacity: 0.7;
}
.quiz-book-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 6px;
}
.quiz-book-meta .quiz-badge {
  margin-left: 8px;
}
.quiz-book-item details {
  margin-top: 10px;
  font-size: 13px;
}
.quiz-book-item summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 12px;
}
.quiz-retry {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
}
.quiz-retry .quiz-choices,
.quiz-retry .quiz-board {
  flex: 1 1 100%;
}
.quiz-retry-result {
  min-height: 1.2em;
  font-size: 13px;
  margin: 6px 0 0;
}
.quiz-retry-result.is-correct {
  color: var(--c-green);
}
.quiz-retry-result.is-wrong {
  color: var(--c-red);
}
.quiz-remove {
  margin-top: 8px;
  color: var(--muted);
}
@media (max-width: 700px) {
  .quiz-result-cols {
    grid-template-columns: 1fr;
  }
  .quiz-card {
    padding: 16px;
  }
  .board-status {
    flex-basis: 100%;
    order: 9;
  }
}

/* ---------- live call: voice call with the tutor (lesson-call.js) ---------- */
.lesson-call-btn.is-live {
  background: var(--c-red);
  border-color: var(--c-red);
  color: #fff;
}
/* The call docks at the bottom of the screen: the tutor's crystal ball, then the chat. */
.lesson-call {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 16px;
  width: min(760px, calc(100vw - 32px));
  padding: 10px 18px 10px 10px;
  border-radius: 28px;
  background: #101010;
  color: #fafafa;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.55);
  transform: translateX(-50%);
  animation: call-dock-in 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.lesson-call[hidden] {
  display: none;
}
@keyframes call-dock-in {
  from {
    opacity: 0;
    transform: translate(-50%, 24px);
  }
}
body.call-live {
  padding-bottom: 200px;
}
.lesson-call .call-ball {
  flex: none;
  width: 148px;
  height: 148px;
  border-radius: 50%;
}
.call-body {
  flex: 1;
  min-width: 0;
}
.lesson-call .button.secondary {
  border-color: rgba(250, 250, 250, 0.5);
  color: #fafafa;
}
.lesson-call .button.secondary:not(:disabled):hover {
  background: #fafafa;
  border-color: #fafafa;
  color: #101010;
}
.call-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.call-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c-green);
  flex: none;
}
.lesson-call[data-state="connecting"] .call-dot {
  background: var(--muted);
  animation: lesson-pulse 1s ease-in-out infinite;
}
.lesson-call[data-state="speaking"] .call-dot {
  background: var(--c-orange);
  box-shadow: 0 0 0 0 var(--c-orange);
  animation: call-ring 1.2s ease-out infinite;
}
@keyframes call-ring {
  to {
    box-shadow: 0 0 0 10px transparent;
  }
}
.call-status {
  font-size: 13px;
  font-weight: 500;
  margin-right: auto;
}
.call-end {
  background: var(--c-red);
  color: #fff;
}
.call-log {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  line-height: 1.5;
}
.call-log:empty {
  display: none;
}
.call-line strong {
  font-weight: 600;
  margin-right: 8px;
}
.call-line.is-ai strong {
  color: #ff5a4f;
}
.call-line.is-user strong {
  color: rgba(250, 250, 250, 0.55);
}
.call-type {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.call-input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 13px;
  color: #fafafa;
  background: rgba(250, 250, 250, 0.08);
  border: 1px solid rgba(250, 250, 250, 0.18);
  border-radius: 999px;
  padding: 7px 14px;
}
.call-input::placeholder {
  color: rgba(250, 250, 250, 0.4);
}
/* The student's box: during a call, a drag over the slide marks what they are asking about. */
.call-boxer {
  position: absolute;
  inset: 0;
  z-index: 5;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}
.call-boxer[hidden],
.call-box[hidden],
.call-boxer-hint[hidden] {
  display: none;
}
.call-boxer-hint {
  position: absolute;
  left: 50%;
  top: 12px;
  margin: 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(16, 16, 16, 0.82);
  color: #fafafa;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
  animation: call-hint 4s ease-in-out infinite;
}
@keyframes call-hint {
  50% {
    opacity: 0.55;
  }
}
.call-box {
  position: absolute;
  border: 2px dashed var(--c-red);
  border-radius: 6px;
  background: rgba(237, 28, 30, 0.07);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}
.call-box.is-drawing {
  box-shadow: none;
}
.call-box.is-seen {
  border-style: solid;
}
.call-box.is-reading {
  animation: lesson-pulse 1s ease-in-out infinite;
}
.call-box-tag {
  position: absolute;
  left: -2px;
  bottom: calc(100% + 4px);
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--c-red);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.call-box-tag:empty,
.call-box.is-drawing .call-box-tag,
.call-box.is-drawing .call-box-clear {
  display: none;
}
.call-box-clear {
  position: absolute;
  right: -11px;
  top: -11px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #101010;
  color: #fafafa;
  font: 600 14px/22px var(--ui);
  cursor: pointer;
  pointer-events: auto;
}
.call-shot {
  display: block;
  max-width: 160px;
  max-height: 64px;
  margin-top: 4px;
  border-radius: 6px;
  border: 1px solid rgba(250, 250, 250, 0.25);
}
@media (max-width: 600px) {
  .lesson-call {
    gap: 10px;
    padding-right: 12px;
  }
  .lesson-call .call-ball {
    width: 88px;
    height: 88px;
  }
}

/* ---------- lesson journey: the step rail over the session (js/lesson-journey.js) ---------- */
.document-toolbar.has-journey {
  flex-wrap: wrap;
  row-gap: 0;
  padding: 0 10px 0;
}
.journey {
  flex: 1 0 100%;
  display: flex;
  align-items: flex-end;
  gap: 20px;
  padding: 16px 6px 0;
  border-bottom: 1px dotted var(--rule);
}
.journey-steps {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.journey-btn {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  column-gap: 8px;
  row-gap: 10px;
  width: 100%;
  padding: 2px 0 14px;
  border: 0;
  background: none;
  color: var(--faint);
  text-align: left;
  cursor: pointer;
  transition: color 0.25s;
}
.journey-btn:hover:not(:disabled),
.journey-step.is-done .journey-btn,
.journey-step.is-current .journey-btn {
  color: var(--ink);
}
.journey-btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.journey-btn:disabled {
  cursor: default;
}
.journey-no {
  font: 400 var(--fs-mono) / 1 var(--mono);
  letter-spacing: -0.04em;
}
.journey-step.is-done .journey-no {
  color: var(--muted);
}
.journey-label {
  overflow: hidden;
  font: 500 14px / 1.15 var(--display);
  letter-spacing: -0.01em;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.journey-step.is-current .journey-label {
  font-weight: 650;
}
.journey-bar {
  position: relative;
  grid-column: 1 / -1;
  height: 3px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--border);
}
.journey-bar i {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.9s var(--ease);
}
.journey-step.is-done .journey-bar i {
  transform: scaleX(1);
}
/* The step you are on: a short stub of ink that breathes, waiting to be filled. */
.journey-step.is-current:not(.is-done) .journey-bar i {
  transform: scaleX(0.14);
  animation: journey-breathe 2.6s ease-in-out infinite;
}
.journey.is-away .journey-step.is-current:not(.is-done) .journey-btn {
  color: var(--faint);
}
.journey.is-away .journey-step.is-current .journey-bar i {
  animation: none;
}
/* Just finished: a sheen runs along the freshly filled bar. */
.journey-step.just-done .journey-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.85), transparent);
  transform: translateX(-100%);
  animation: journey-sheen 1.1s 0.45s var(--ease) both;
}
.journey-step.is-skipped .journey-btn {
  color: var(--faint);
  opacity: 0.6;
}
.journey-step.is-skipped .journey-label {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
.journey-step.is-skipped .journey-bar {
  background: repeating-linear-gradient(90deg, var(--border) 0 4px, transparent 4px 8px);
}
.journey-summary {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin: 0;
  padding-bottom: 14px;
}
.journey-now {
  display: none;
  font: 650 14px / 1.15 var(--display);
}
.journey-count {
  color: var(--muted);
  font-size: var(--fs-mono);
  letter-spacing: -0.04em;
  transition: color 0.3s;
}
.journey-count.is-full {
  color: var(--ink);
}
@keyframes journey-breathe {
  50% {
    transform: scaleX(0.3);
    opacity: 0.55;
  }
}
@keyframes journey-sheen {
  to {
    transform: translateX(100%);
  }
}
@media (prefers-reduced-motion: reduce) {
  .journey-bar i,
  .journey-step.is-current:not(.is-done) .journey-bar i,
  .journey-step.just-done .journey-bar::after {
    animation: none;
    transition: none;
  }
}

/* The Transcript, Summary notes and Lesson tabs step back to a second, quieter row under the rail. */
.has-journey .tabs-nav,
.has-journey .document-actions {
  padding: 6px 0;
}
.has-journey .tab {
  height: 28px;
  padding: 0 10px;
  margin: 0;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
}
.has-journey .tab:hover {
  background: var(--bg-2);
  color: var(--ink);
}
.has-journey .tab.active {
  background: var(--bg-2);
  color: var(--ink);
}
.has-journey #note-settings summary,
.has-journey .document-actions .icon-button {
  height: 28px;
  color: var(--muted);
}

/* Changing step scrolls the session back to the rail, clear of the floating navigation. */
.document {
  scroll-margin-top: 96px;
}
/* One step at a time: the panel shows only the current step's section. */
.lesson-panel[data-step]:not([data-step="lesson"]) .lesson-player,
.lesson-panel[data-step]:not([data-step="lab"]):not([data-step="experiment"]) .lesson-lab,
.lesson-panel[data-step]:not([data-step="test"]) .lesson-quiz,
.lesson-panel[data-step]:not([data-step="reading"]) .lesson-reading {
  display: none;
}
.lesson-panel[data-step] .lesson-lab,
.lesson-panel[data-step] .lesson-quiz,
.lesson-panel[data-step] .lesson-reading {
  margin-top: 8px;
  padding-top: 0;
  border-top: 0;
}
.lesson-panel[data-step] > section:not([hidden]) {
  animation: journey-enter 0.5s var(--ease) both;
}
/* Mini lab is the simulation on its own; Experiment brings in the tasks beside it. */
.lesson-panel[data-step="lab"] .lab-tasks-box {
  display: none;
}
.lesson-panel[data-step="lab"] .lab-grid {
  grid-template-columns: 1fr;
}
.journey-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px dotted var(--rule);
}
.journey-next {
  margin-left: auto;
}
@keyframes journey-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .lesson-panel[data-step] > section:not([hidden]) {
    animation: none;
  }
}
@media (max-width: 700px) {
  .journey {
    gap: 12px;
    padding-top: 12px;
  }
  .journey-label {
    display: none;
  }
  .journey-btn {
    row-gap: 8px;
    padding-bottom: 10px;
  }
  .journey-summary {
    padding-bottom: 10px;
  }
  .journey-now {
    display: inline;
  }
  .journey-foot .button {
    flex: 1 1 auto;
  }
}
