/* ===== Interactive labs (js/labs.js) ===== */
.lab-wrap { display: flex; flex-direction: column; gap: 16px; max-width: 1040px; }
.lab-setup { max-width: 820px; }
.lab-setup-title { font-family: var(--font-display); font-size: 1.2rem; }
.lab-setup-text { color: var(--text-muted); font-size: 0.92rem; line-height: 1.55; }
.lab-setup-ai { display: flex; flex-wrap: wrap; gap: 8px; }
.lab-setup-ai .editor-input { flex: 1 1 260px; min-width: 0; }
.lab-setup-sub { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 6px; }
.lab-setup > .btn-ghost { align-self: flex-start; }
.lab-starters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.lab-starter {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center;
  text-align: left; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--card); color: var(--text); font: inherit; cursor: pointer;
  transition: border-color var(--transition), transform var(--transition), background var(--transition);
}
.lab-starter:hover { border-color: var(--primary); transform: translateY(-2px); background: var(--card-raised); }
.lab-starter-icon { grid-row: span 2; font-size: 1.5rem; }
.lab-starter-title { font-weight: 600; font-size: 0.92rem; line-height: 1.25; }
.lab-starter-hint { font-size: 0.78rem; color: var(--text-muted); }

.lab-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.lab-chip {
  flex: 0 0 auto; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  padding: 6px 14px; border-radius: 999px; font: inherit; font-size: 0.84rem; cursor: pointer; white-space: nowrap;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.lab-chip:hover { color: var(--text); border-color: var(--border-strong); }
.lab-chip.active { background: var(--primary-tint); color: var(--text); border-color: var(--primary); }
.lab-chip-new { border-style: dashed; }

.lab { display: flex; flex-direction: column; gap: 14px; }
.lab-head { display: flex; flex-direction: column; gap: 4px; }
.lab-kind { font-size: 0.78rem; font-weight: 600; color: var(--secondary-text); text-transform: uppercase; letter-spacing: 0.05em; }
.lab-title { font-family: var(--font-display); font-size: 1.35rem; line-height: 1.2; }
.lab-intro { color: var(--text-muted); font-size: 0.92rem; line-height: 1.5; }
.lab-goal {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius);
  background: linear-gradient(120deg, color-mix(in srgb, var(--highlight) 16%, var(--card)), var(--card));
  border: 1px solid color-mix(in srgb, var(--highlight) 40%, var(--border));
}
.lab-goal-icon { font-size: 1.4rem; line-height: 1; }
.lab-goal strong { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text); }
.lab-goal p { margin-top: 2px; font-size: 0.95rem; }

.lab-main { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(240px, 1fr); gap: 16px; align-items: start; }
.lab-stage { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 10px; min-width: 0; }
.lab-svg { display: block; width: 100%; height: auto; touch-action: manipulation; user-select: none; }
.lab-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.lab-controls { display: flex; flex-direction: column; gap: 12px; padding: 14px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.lab-param { display: flex; flex-direction: column; gap: 6px; cursor: pointer; }
.lab-param-top { display: flex; justify-content: space-between; gap: 8px; font-size: 0.86rem; }
.lab-param-name { color: var(--text-muted); }
.lab-param output { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lab-param input[type="range"], .lab-time input[type="range"] { width: 100%; accent-color: var(--primary); height: 28px; margin: 0; cursor: pointer; }

.lab-readouts { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.lab-readout { padding: 10px 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lab-readout-label { font-size: 0.74rem; color: var(--text-muted); line-height: 1.25; }
.lab-readout-val { font-family: var(--font-mono); font-size: 1rem; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.lab-gauge { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; margin-top: 4px; }
.lab-gauge span { display: block; height: 100%; width: 0; background: var(--grad-brand); }

.lab-bars { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.lab-bar-row { display: grid; grid-template-columns: minmax(60px, 0.9fr) 1.6fr auto; gap: 8px; align-items: center; font-size: 0.8rem; }
.lab-bar-label { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lab-bar-track { height: 10px; border-radius: 5px; background: var(--border); overflow: hidden; }
.lab-bar-fill { display: block; height: 100%; width: 0; border-radius: 5px; }
.lab-bar-val { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* SVG parts */
.lab-grid { stroke: var(--border); stroke-width: 1; }
.lab-axis { stroke: var(--border-strong); stroke-width: 1.5; }
.lab-frame { fill: none; stroke: var(--border-strong); stroke-width: 1; }
.lab-tick { fill: var(--text-muted); font-size: 11px; font-family: var(--font-body); }
.lab-axis-label { fill: var(--text-muted); font-size: 12px; font-weight: 600; font-family: var(--font-body); }
.lab-curve { fill: none; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.lab-guide { stroke: var(--text-muted); stroke-dasharray: 4 4; stroke-width: 1; }
.lab-dot { fill: var(--highlight); stroke: var(--card); stroke-width: 2.5; }
.lab-dot-label { fill: var(--text); font-size: 12px; font-weight: 600; font-family: var(--font-body); paint-order: stroke; stroke: var(--card); stroke-width: 4px; }
.lab-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.8rem; color: var(--text-muted); padding: 6px 6px 2px; }
.lab-legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.lab-ground { fill: color-mix(in srgb, var(--accent-lime) 14%, transparent); }
.lab-trail { fill: none; stroke: var(--text-muted); stroke-width: 1.5; stroke-dasharray: 5 5; opacity: 0.7; }
.lab-ball { fill: var(--accent-orange); stroke: var(--card); stroke-width: 2; }
.lab-rod { stroke: var(--text); stroke-width: 2; }
.lab-pivot { fill: var(--text); }
.lab-time { display: flex; align-items: center; gap: 10px; padding: 8px 4px 2px; }
.lab-time output { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted); min-width: 76px; text-align: right; font-variant-numeric: tabular-nums; }
.lab-play {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; border: none; background: var(--primary); color: #fff;
  font-size: 0.9rem; cursor: pointer; display: grid; place-items: center;
}
.lab-play:hover { background: var(--primary-hover); }

/* circuit */
.lab-wire { fill: none; stroke: var(--text-muted); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.lab-flow { fill: none; stroke: var(--highlight); stroke-width: 3; stroke-dasharray: 3 14; stroke-linecap: round; pointer-events: none; transition: opacity 0.2s; }
.lab-res { fill: none; stroke: var(--text); stroke-width: 3; stroke-linejoin: round; }
.lab-glow { fill: var(--highlight); opacity: 0; filter: blur(8px); transition: opacity 0.15s; pointer-events: none; }
.lab-batt { stroke: var(--text); stroke-width: 4; stroke-linecap: round; }
.lab-batt.short { stroke-width: 7; }
.lab-clabel { fill: var(--text); font-size: 13px; font-weight: 600; font-family: var(--font-body); }
.lab-cval { fill: var(--text-muted); font-size: 11px; font-family: var(--font-mono); }
.lab-switch { cursor: pointer; outline: none; }
.lab-switch .lab-hit { fill: transparent; }
.lab-switch-arm { stroke: var(--correct); stroke-width: 4; stroke-linecap: round; transition: d 0.2s; }
.lab-switch circle { fill: var(--text); }
.lab-switch.open .lab-switch-arm { stroke: var(--wrong); }
.lab-switch:hover .lab-hit, .lab-switch:focus-visible .lab-hit { fill: var(--primary-tint); stroke: var(--primary); stroke-width: 1.5; rx: 8px; }
.lab-rewire { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 4px 2px; }
.lab-hint { font-size: 0.8rem; color: var(--text-muted); }

/* timeline */
.lab-tl-axis { stroke: var(--border-strong); stroke-width: 4; stroke-linecap: round; }
.lab-tl-done { stroke: var(--primary); stroke-width: 4; stroke-linecap: round; }
.lab-ev line { stroke: var(--border-strong); stroke-width: 1.5; }
.lab-ev circle { fill: var(--card); stroke: var(--border-strong); stroke-width: 2.5; transition: fill 0.2s, stroke 0.2s; }
.lab-ev text { fill: var(--text-muted); font-size: 11px; font-family: var(--font-body); transition: fill 0.2s; }
.lab-ev-year { font-weight: 700; font-family: var(--font-mono); }
.lab-ev.on circle { fill: var(--primary); stroke: var(--primary); }
.lab-ev.on text { fill: var(--text); }
.lab-tl-now { stroke: var(--highlight); stroke-width: 2; }
.lab-tl-nowtext { fill: var(--highlight); font-size: 13px; font-weight: 700; font-family: var(--font-mono); }
.lab-ev-card { margin: 4px 6px 4px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); min-height: 52px; font-size: 0.9rem; }
.lab-ev-card strong { display: block; }
.lab-ev-card p { color: var(--text-muted); font-size: 0.84rem; margin-top: 2px; }
.lab-ev-cyear { font-family: var(--font-mono); color: var(--primary); font-weight: 700; font-size: 0.82rem; }

/* challenges */
.lab-challenges { padding: 14px 16px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.lab-challenges h4 { font-size: 0.95rem; margin-bottom: 8px; display: flex; gap: 8px; align-items: center; }
.lab-score { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }
.lab-challenges ol { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.lab-ch { display: flex; gap: 10px; align-items: flex-start; font-size: 0.92rem; line-height: 1.45; }
.lab-ch-box {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--border-strong); margin-top: 1px;
  display: grid; place-items: center; transition: background 0.2s, border-color 0.2s;
}
.lab-ch.live .lab-ch-box { border-color: var(--correct); }
.lab-ch.done .lab-ch-box { background: var(--correct); border-color: var(--correct); }
.lab-ch.done .lab-ch-box::after { content: '✓'; color: #fff; font-size: 0.8rem; font-weight: 700; }
.lab-ch.done .lab-ch-text { color: var(--text-muted); }
.lab-ch.pop .lab-ch-box { animation: lab-pop 0.45s ease; }
@keyframes lab-pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
.lab-ch-hint { margin-top: 2px; font-size: 0.82rem; color: var(--text-muted); }
.lab-ch-hint summary { cursor: pointer; color: var(--secondary); width: max-content; }
.lab-foot { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 560px) {
  .lab-tick { font-size: 18px; }
  .lab-axis-label, .lab-dot-label { font-size: 19px; }
  .lab-clabel { font-size: 19px; }
  .lab-cval { font-size: 17px; }
  .lab-ev text { font-size: 15px; }
}
@media (max-width: 760px) {
  .lab-main { grid-template-columns: minmax(0, 1fr); }
  .lab-stage { padding: 6px; }
  .lab-title { font-size: 1.15rem; }
}

/* ===== Video lessons (js/lesson.js) ===== */
.vl-wrap { display: flex; flex-direction: column; gap: 14px; max-width: 960px; }
.vl-setup { max-width: 760px; }
.vl-setup-title { font-family: var(--font-display); font-size: 1.2rem; }
.vl-setup-text, .vl-note { color: var(--text-muted); font-size: 0.88rem; line-height: 1.5; }
.vl-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.vl-card { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 8px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--border); }
.vl-card-play { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; background: none; border: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; padding: 4px; }
.vl-card-thumb { flex: 0 0 auto; width: 54px; height: 40px; border-radius: var(--radius-sm); background: var(--grad-brand); color: #fff; display: grid; place-items: center; font-size: 0.9rem; }
.vl-card-meta { display: flex; flex-direction: column; min-width: 0; }
.vl-card-meta strong { font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vl-card-meta span { font-size: 0.78rem; color: var(--text-muted); }
.vl-card:hover { border-color: var(--primary); }
.vl-new { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: var(--radius-lg); background: var(--card); border: 1px solid var(--border); }
.vl-label { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); }
.vl-new-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.vl-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vl-name { font-family: var(--font-display); font-size: 1.15rem; min-width: 0; overflow-wrap: anywhere; }
.vl-player {
  position: relative; border-radius: var(--radius-lg); overflow: hidden; background: #0b0d14;
  border: 1px solid var(--border); box-shadow: var(--shadow); outline: none;
}
.vl-player:focus-visible { box-shadow: 0 0 0 3px var(--primary-glow), var(--shadow); }
.vl-stage {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden; container-type: inline-size;
  background: radial-gradient(120% 90% at 0% 0%, color-mix(in srgb, var(--primary) 22%, var(--surface)), var(--surface) 60%);
}
.vl-slide {
  position: absolute; inset: 0; display: flex; padding: 5.5cqw 6cqw 4cqw;
  opacity: 0; transform: translateX(0) scale(0.985);
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.vl-slide.from-right { transform: translateX(6%); }
.vl-slide.from-left { transform: translateX(-6%); }
.vl-slide.in { opacity: 1; transform: none; }
.vl-slide.leaving { opacity: 0; }
.vl-slide.leaving.to-left { transform: translateX(-6%); }
.vl-slide.leaving.to-right { transform: translateX(6%); }
.vl-slide-inner { position: relative; width: 100%; height: 100%; display: flex; gap: 4cqw; align-items: center; color: var(--text); }
.vl-slide-num { position: absolute; top: -3cqw; right: 0; font-family: var(--font-mono); font-size: clamp(10px, 1.5cqw, 14px); color: var(--text-muted); }
.vl-text { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 2.2cqw; }
.vl-slide-title { font-family: var(--font-display); font-size: clamp(17px, 4.4cqw, 42px); line-height: 1.12; margin: 0; }
.vl-bullets { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 1.4cqw; }
.vl-bullets li {
  position: relative; padding-left: 3.4cqw; font-size: clamp(12px, 2.5cqw, 24px); line-height: 1.35;
  opacity: 0; transform: translateY(8px); transition: opacity 0.4s ease, transform 0.4s ease; transition-delay: calc(0.25s + var(--d) * 0.35s);
}
.vl-bullets li::before { content: ''; position: absolute; left: 0; top: 0.5em; width: 1.3cqw; height: 1.3cqw; min-width: 6px; min-height: 6px; border-radius: 50%; background: var(--secondary); }
.vl-slide.in .vl-bullets li { opacity: 1; transform: none; }
.vl-formula { font-size: clamp(13px, 2.6cqw, 26px); padding: 1.2cqw 2cqw; border-radius: var(--radius); background: var(--primary-tint); border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent); align-self: flex-start; max-width: 100%; overflow-x: auto; }
.vl-diagram { flex: 1 1 0; min-width: 0; max-height: 100%; display: flex; align-items: center; justify-content: center; }
.vl-figure { margin: 0; width: 100%; max-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 0.8cqw; }
.vl-figure { position: relative; }
.vl-fig-hide { position: absolute; top: 0.6cqw; right: 0.6cqw; width: 26px; height: 26px; border-radius: 50%; border: none; background: rgba(11, 13, 20, 0.6); color: #fff; font-size: 12px; cursor: pointer; opacity: 0; transition: opacity 0.15s; z-index: 1; }
.vl-figure:hover .vl-fig-hide, .vl-fig-hide:focus-visible { opacity: 1; }
@media (hover: none) { .vl-fig-hide { opacity: 0.85; } }
.vl-preview-stage .vl-fig-hide { display: none; }
.vl-figure img { display: block; max-width: 100%; max-height: 34cqw; object-fit: contain; border-radius: 1.2cqw; background: #fff; box-shadow: 0 1cqw 3cqw rgba(0, 0, 0, 0.12); }
.vl-figure figcaption { font-size: max(9px, 1.15cqw); color: var(--text-muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vl-figure figcaption a { color: inherit; }
.vl-figure.pending { aspect-ratio: 4 / 3; max-width: 32cqw; border-radius: 1.2cqw; background: linear-gradient(90deg, rgba(124,58,237,0.06), rgba(124,58,237,0.14), rgba(124,58,237,0.06)); background-size: 200% 100%; animation: vl-shimmer 1.4s linear infinite; }
@keyframes vl-shimmer { to { background-position: -200% 0; } }
.vl-preview-stage .vl-figure figcaption { display: none; }
.vl-diagram .diagram-container { margin: 0; padding: 1.5cqw; border-left: none; background: transparent; width: 100%; }
.vl-diagram .diagram-title, .vl-diagram .diagram-description { display: none; }
.vl-diagram .diagram-svg { max-height: 34cqw; }
.vl-diagram .diagram-svg text { fill: var(--text); }
.vl-branch { width: 100%; height: auto; max-height: 36cqw; }
.vl-br-line { stroke: var(--border-strong); stroke-width: 2; }
.vl-br-kid rect { fill: var(--card); stroke: var(--secondary); stroke-width: 2; }
.vl-br-kid text { fill: var(--text); font-size: 15px; font-family: var(--font-body); }
.vl-br-root rect { fill: var(--primary); }
.vl-br-root text { fill: #fff; font-size: 17px; font-weight: 700; font-family: var(--font-body); }
.vl-cover { justify-content: center; text-align: center; }
.vl-cover .vl-text { align-items: center; }
.vl-cover .vl-slide-title { font-size: clamp(22px, 6cqw, 58px); background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent; padding-bottom: 0.1em; }
.vl-cover .vl-bullets li::before { display: none; }
.vl-cover .vl-bullets li { padding-left: 0; color: var(--text-muted); }

.vl-caption {
  display: none; position: absolute; z-index: 2; left: 50%; bottom: 2.6cqw; transform: translateX(-50%); width: max-content; max-width: 92%;
  padding: 0.35em 0.8em; border-radius: 6px; background: rgba(0, 0, 0, 0.75); color: #fff; text-align: center;
  font-size: clamp(12px, 2cqw, 19px); line-height: 1.4; pointer-events: none;
}
.vl-caption:empty { visibility: hidden; }
.vl-player.cc-on .vl-caption { display: block; }
.vl-player.cc-on .vl-slide { padding-bottom: calc(4cqw + 3.4em); }
.vl-bar { background: #0b0d14; padding: 10px 12px 10px; color: #e8ecf4; }
.vl-progress { position: relative; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.16); cursor: pointer; margin: 4px 0 10px; touch-action: none; }
.vl-progress::before { content: ''; position: absolute; left: 0; right: 0; top: -8px; bottom: -8px; } /* a taller target for fingers */
.vl-progress-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 4px; background: var(--grad-brand); }
.vl-mark {
  position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; padding: 0;
  border: 2px solid #0b0d14; background: rgba(255, 255, 255, 0.55); cursor: pointer; transition: transform 0.15s, background 0.15s;
}
.vl-mark:first-of-type { margin-left: 0; }
.vl-mark.past { background: #fff; }
.vl-mark.current { background: var(--highlight); transform: scale(1.3); }
.vl-mark:hover { transform: scale(1.4); }
.vl-controls { display: flex; align-items: center; gap: 6px; }
.vl-btn {
  min-width: 36px; height: 36px; border-radius: 8px; border: none; background: transparent; color: #e8ecf4;
  font: inherit; font-size: 1rem; cursor: pointer; display: grid; place-items: center; padding: 0 8px;
}
.vl-btn:hover { background: rgba(255, 255, 255, 0.1); }
.vl-btn:focus-visible { outline: 2px solid var(--primary); }
.vl-btn-main { width: 44px; height: 44px; border-radius: 50%; background: var(--primary); color: #fff; }
.vl-btn-main:hover { background: var(--primary-hover); }
.vl-preview {
  position: absolute; bottom: calc(100% + 12px); width: 220px; transform: translateX(-50%); z-index: 5; pointer-events: none;
  background: #0b0d14; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 8px; overflow: hidden; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.vl-preview[hidden] { display: none; }
.vl-stage.vl-preview-stage { aspect-ratio: 16 / 9; }
.vl-preview-stage .vl-slide { transition: none; }
.vl-preview-cap { padding: 6px 8px 0; font-size: 0.72rem; line-height: 1.35; color: #e8ecf4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vl-preview-cap:empty { display: none; }
.vl-preview-time { padding: 4px 8px 6px; font-family: var(--font-mono); font-size: 0.72rem; color: #e8ecf4; opacity: 0.85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vl-time { font-family: var(--font-mono); font-size: 0.82rem; margin-left: 4px; white-space: nowrap; }
.vl-count { font-family: var(--font-mono); font-size: 0.82rem; opacity: 0.8; margin-left: 4px; white-space: nowrap; }
.vl-spacer { flex: 1; }
.vl-voice-status { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; opacity: 0.85; white-space: nowrap; }
.vl-voice-status:empty { display: none; }
.vl-voice-status::before { content: ''; width: 12px; height: 12px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; animation: vl-spin 0.8s linear infinite; }
.vl-check { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.vl-rate { font-size: 0.82rem; font-weight: 600; }
.vl-cc { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; border: 1.5px solid rgba(255, 255, 255, 0.4); height: 26px; min-width: 34px; }
.vl-cc.on { background: #fff; color: #0b0d14; border-color: #fff; }
.vl-player:fullscreen { display: flex; flex-direction: column; justify-content: center; border-radius: 0; border: none; background: #000; }
.vl-player:fullscreen .vl-stage { width: min(100vw, calc((100vh - 90px) * 16 / 9)); margin: 0 auto; }

.vl-outline { list-style: decimal; margin: 0; padding-left: 26px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px 18px; color: var(--text-muted); font-size: 0.86rem; }
.vl-outline li { min-width: 0; }
.vl-outline-item { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: none; border: none; color: var(--text-muted); font: inherit; text-align: left; padding: 3px 0; cursor: pointer; }
.vl-outline-item:hover { color: var(--text); }
.vl-outline-item.current { color: var(--primary); font-weight: 600; }
.vl-foot { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 560px) {
  .vl-stage { aspect-ratio: 4 / 3.4; }
  .vl-slide { padding: 9cqw 6cqw 22cqw; }
  .vl-slide-inner { flex-direction: column; align-items: stretch; justify-content: center; gap: 3cqw; }
  .vl-slide-num { top: -6cqw; }
  .vl-cover { align-items: center; }
  .vl-diagram .diagram-svg, .vl-branch { max-height: 40cqw; }
  .vl-figure img { max-height: 40cqw; }
  .vl-player.cc-on .vl-slide { padding-bottom: calc(6cqw + 4.6em); }
  .vl-count { display: none; }
  .vl-time { font-size: 0.74rem; }
  .vl-preview { width: 168px; }
  .vl-voice-status { font-size: 0; gap: 0; }
  .vl-btn { min-width: 32px; padding: 0 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .vl-slide, .vl-slide.from-right, .vl-slide.from-left, .vl-slide.leaving.to-left, .vl-slide.leaving.to-right { transform: none; transition: opacity 0.2s; }
  .vl-bullets li { transform: none; transition: opacity 0.2s; transition-delay: 0s; }
  .lab-ch.pop .lab-ch-box { animation: none; }
  .vl-figure.pending { animation: none; }
}

/* Video lessons: another version, "I didn't understand", voice panel */
.vl-versions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.vl-version { width: auto; max-width: 100%; }
.vl-confused {
  position: absolute; z-index: 3; left: 2cqw; top: 2cqw; min-height: 28px; padding: 3px 10px; border-radius: 999px;
  background: rgba(11, 13, 20, 0.8); color: #fff; border: 1px solid rgba(255, 255, 255, 0.4); font: inherit; font-size: 0.75rem; cursor: pointer;
}
.vl-confused:hover { background: #0b0d14; border-color: #fff; }
.vl-confused:focus-visible { outline: 2px solid var(--highlight); outline-offset: 2px; }
.vl-panel { display: flex; flex-direction: column; gap: 8px; padding: 14px; background: var(--card); color: var(--text); border-top: 1px solid var(--border); }
.vl-panel[hidden], .vl-revbar[hidden], .vl-notice[hidden] { display: none; }
.vl-panel-title { font-family: var(--font-display); font-size: 1rem; margin: 0; outline: none; }
.vl-chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.vl-chip {
  min-height: 40px; padding: 8px 12px; border-radius: var(--radius); background: var(--card-raised); color: var(--text);
  border: 1px solid var(--border-strong); font: inherit; font-size: 0.86rem; text-align: left; cursor: pointer;
}
.vl-chip:hover { border-color: var(--primary); background: var(--primary-tint); }
.vl-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.vl-chip[aria-checked="true"] { border-color: var(--primary); background: var(--primary); color: #fff; }
.vl-panel textarea { resize: vertical; min-height: 56px; }
.vl-panel-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.vl-weak { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.vl-weak[hidden] { display: none; }
.vl-weak-text { flex: 1 1 200px; font-size: 0.9rem; }

/* "Did you get this?" card under the player bar */
.vl-checkpoint { padding: 14px; background: var(--card); color: var(--text); border-top: 1px solid var(--border); }
.vl-checkpoint[hidden] { display: none; }
.vl-check-card { display: flex; flex-direction: column; gap: 10px; }
.vl-check-title { font-family: var(--font-display); font-size: 1rem; }
.vl-check-q { margin: 0; font-size: 0.96rem; line-height: 1.5; }
.vl-opts { display: grid; gap: 8px; }
.vl-opt {
  min-height: 44px; padding: 8px 12px; border-radius: var(--radius); background: var(--card-raised); color: var(--text);
  border: 1px solid var(--border-strong); font: inherit; font-size: 0.9rem; text-align: left; cursor: pointer;
}
.vl-opt:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-tint); }
.vl-opt:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.vl-opt:disabled { cursor: default; opacity: 1; }
.vl-opt.right { border-color: var(--success, #16a34a); background: color-mix(in srgb, var(--success, #16a34a) 16%, var(--card)); }
.vl-opt.wrong { border-color: var(--danger, #dc2626); background: color-mix(in srgb, var(--danger, #dc2626) 14%, var(--card)); }
.vl-check-why { margin: 0; font-size: 0.88rem; line-height: 1.5; color: var(--text-muted); }
.vl-check-why strong { color: var(--text); }
.vl-check-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.vl-panel-busy { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.vl-ask-about { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; margin-bottom: 0.4rem; }
.vl-ask-thread { display: flex; flex-direction: column; gap: 0.5rem; max-height: 18rem; overflow-y: auto; margin-bottom: 0.6rem; }
.vl-ask-q { align-self: flex-end; max-width: 85%; margin: 0; padding: 0.4rem 0.7rem; border-radius: 0.8rem; background: var(--primary); color: #fff; line-height: 1.45; white-space: pre-wrap; }
.vl-ask-answer { margin: 0; line-height: 1.55; white-space: pre-wrap; color: var(--text); }
.vl-panel-error { color: var(--bad-text); margin: 0; line-height: 1.45; }
.vl-spin { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--border-strong); border-top-color: var(--primary); animation: vl-spin 0.8s linear infinite; }
@keyframes vl-spin { to { transform: rotate(360deg); } }
.vl-speed { width: 100%; accent-color: var(--primary); }
.vl-revbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--text-muted); font-size: 0.86rem; }
.vl-notice { padding: 14px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--warn-text); color: var(--text); display: flex; flex-direction: column; gap: 8px; }
.vl-notice p { margin: 0; line-height: 1.5; font-size: 0.9rem; color: var(--text-muted); }
.vl-player:fullscreen .vl-panel { position: absolute; z-index: 5; left: 0; right: 0; bottom: 0; max-height: 75vh; overflow: auto; }
@media (max-width: 560px) {
  .vl-chips { grid-template-columns: 1fr; }
  .vl-confused { left: 6px; top: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .vl-spin, .vl-voice-status::before { animation-duration: 3s; }
}

/* Video lesson history */
.vl-setup-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.vl-history { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.vl-history-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.vl-hist-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 420px; overflow-y: auto; }
.vl-hist-row { display: flex; align-items: center; gap: 6px; border-radius: 8px; }
.vl-hist-row:hover { background: var(--primary-tint); }
.vl-hist-open { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; background: none; border: none; padding: 8px; font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.vl-hist-open strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vl-hist-open span { font-size: 0.78rem; color: var(--text-muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
