/* ============================================================
   LESSON TAB PANEL — v2/challenge.html #ch-lesson-panel
   Self-contained lesson renderer styles.
   Scoped to body[data-v2-challenge] to prevent bleed.
   All colours reference CSS variables — no hardcoded hex.
   ============================================================ */

/* ── WARM ACCENT TOKEN ──────────────────────────────────────── */
:root { --slide-accent-warm: #EEC252; }

/* ── PANE BASE ──────────────────────────────────────────────── */
body[data-v2-challenge] #ch-lesson-panel {
    background: var(--bg);
    overflow: hidden;
}

/* ── LOADING / ERROR STATE ──────────────────────────────────── */
.chl-loading {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    font-size: 15px;
    color: var(--text-muted);
}

/* ── SLIDE SCROLL WRAPPER ───────────────────────────────────── */
/*
 * Fills available height between the pane top and the .chl-nav bar.
 * Only this element scrolls — the nav bar stays pinned at the bottom.
 */
.chl-slide-wrap {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0.75em 1em 0.625em;
    display: flex;
    flex-direction: column;
    gap: 0.875em;
}

/* ── SLIDE COUNTER ──────────────────────────────────────────── */
.chl-counter {
    font-size: 0.8em;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    text-align: center;
    flex-shrink: 0;
}

/* ── SLIDE TITLE ────────────────────────────────────────────── */
.chl-slide-title {
    font-size: 1.333em;
    font-weight: 800;
    color: var(--text);
    line-height: 1.25;
}

/* ── SLIDE BODY (hook / explanation raw HTML) ───────────────── */
/* Mobile: fluid clamp — unchanged. Desktop override below.     */
.chl-slide-body {
    font-size: clamp(0.8125rem, 3.5vw, 0.9375rem);
    line-height: 1.65;
    color: var(--text);
}

/* ── FONT TIER — all viewports ─────────────────────────────── */
/* --chl-font-size default (tier 3); JS (lesson-font-tier.js)   */
/* overrides via inline style on #ch-lesson-panel once slides   */
/* are loaded. Applied at all widths — no desktop gate.         */
#ch-lesson-panel {
    --chl-font-size: clamp(0.9375rem, 1.25vw, 1.25rem);
}
.chl-slide-wrap {
    font-size: var(--chl-font-size);
}

/* Prevent last-child bottom margin from triggering a scrollbar in short slides */
.chl-slide-wrap > * > *:last-child,
.chl-slide-body > *:last-child { margin-bottom: 0; }

.chl-slide-content {
    margin-block: auto;
    display: flex;
    flex-direction: column;
    gap: 0.875em;
}

/* Ensure V1 lesson shim classes render correctly inside the panel */
/* :not(pre code) keeps this from bleeding into <pre><code> blocks */
body[data-v2-challenge] #ch-lesson-panel code:not(pre code) {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 1px 5px;
    font-family: var(--mono);
    font-size: 0.88em;
}

/* ── EXAMPLE SLIDE ──────────────────────────────────────────── */
.chl-slide-desc {
    font-size: 0.933em;
    line-height: 1.6;
    color: var(--text);
}

/* Output block — light surface, mirrors objective pane expected-output */
.chl-output-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.667em 0.933em;
}

.chl-output-label {
    display: block;
    font-size: 0.733em;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.4em;
}

.chl-output-block pre {
    font-family: var(--mono);
    font-size: 0.867em;
    color: var(--text);
    line-height: 1.5;
    white-space: pre-wrap;
}

/* ── COMPLETION SLIDE ───────────────────────────────────────── */
.chl-checkpoints {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chl-checkpoints li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 1em;
    line-height: 1.4;
    color: var(--text);
}

.chl-checkpoints li::before {
    content: '\2713';
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    background: var(--primary);
    color: var(--text-inverse);
    border-radius: 50%;
    font-size: 0.8em;
    font-weight: 800;
    display: grid;
    place-items: center;
    margin-top: 1px;
}

/* ── NAVIGATION BAR ─────────────────────────────────────────── */
/*
 * Three-element flex row: back button — dot container — forward button.
 * Dots (#chl-slide-dots) take flex:1 between the two 48px circles.
 * Back button hidden (visibility:hidden) on slide 1 — layout stable.
 * Forward button tinted to the current slide's accent colour.
 */
.chl-nav {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px max(10px, env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border);
    background: var(--bg);
}

.chl-prev-btn,
.chl-next-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
    border: none;
    cursor: pointer;
    transition: filter 0.15s, opacity 0.15s, transform 0.1s;
    flex-shrink: 0;
}

/* Back: neutral */
.chl-prev-btn {
    background: rgba(255,255,255,0.12);
    color: var(--text);
}

:root:not([data-theme="dark"]) .chl-prev-btn {
    background: rgba(0,0,0,0.08);
    color: var(--text-secondary);
}

.chl-prev-btn:hover { filter: brightness(1.2); }
.chl-prev-btn:active { transform: scale(0.93); }

/* Forward: slide-type accent colours */
.chl-next-btn[data-slide-type="hook"],
.chl-next-btn[data-slide-type="warning"],
.chl-next-btn[data-slide-type="mistakes"] {
    background: var(--slide-accent-warm);
    color: #2c1600;
}

.chl-next-btn[data-slide-type="concept"],
.chl-next-btn[data-slide-type="analogy"] {
    background: #378add;
    color: #ffffff;
}

:root:not([data-theme="dark"]) .chl-next-btn[data-slide-type="concept"],
:root:not([data-theme="dark"]) .chl-next-btn[data-slide-type="analogy"] {
    background: #2563eb;
}

.chl-next-btn[data-slide-type="example"],
.chl-next-btn[data-slide-type="code-sequence"],
.chl-next-btn[data-slide-type="complete-function"] {
    background: #1d9e75;
    color: #ffffff;
}

:root:not([data-theme="dark"]) .chl-next-btn[data-slide-type="example"],
:root:not([data-theme="dark"]) .chl-next-btn[data-slide-type="code-sequence"],
:root:not([data-theme="dark"]) .chl-next-btn[data-slide-type="complete-function"] {
    background: #0d7a5a;
}

.chl-next-btn[data-slide-type="completion"] {
    background: #7f77dd;
    color: #ffffff;
}

:root:not([data-theme="dark"]) .chl-next-btn[data-slide-type="completion"] {
    background: #7c3aed;
}

/* Fallback for unknown/missing type */
.chl-next-btn:not([data-slide-type]) {
    background: var(--primary);
    color: var(--text-inverse);
}

.chl-next-btn:hover:not([data-locked]) { filter: brightness(1.08); }
.chl-next-btn:active:not([data-locked]) { transform: scale(0.93); }

/* ── SLIDE NAV DOTS ──────────────────────────────────────────── */
/*
 * #chl-slide-dots: flex:1 container between the two circular nav buttons.
 * Each .chl-slide-dot is a 24px button (WCAG 2.5.5 tap target).
 * The visual dot is the ::before pseudo-element, sized by --chl-dot-size
 * (JS-computed, 6–10px). Gap between buttons: --chl-dot-gap (JS-computed, 4–6px).
 */

#chl-slide-dots {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--chl-dot-gap, 6px);
    padding: 0 4px;
    overflow: hidden;
}

.chl-slide-dot {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
}

.chl-slide-dot::before {
    content: '';
    width: var(--chl-dot-size, 10px);
    height: var(--chl-dot-size, 10px);
    border-radius: 50%;
    display: block;
    box-sizing: border-box;
    transition: background-color 200ms ease, transform 200ms ease, border-color 200ms ease;
    flex-shrink: 0;
}

/* Visited: neutral filled */
.chl-slide-dot--visited::before {
    background-color: rgba(255,255,255,0.35);
}

:root:not([data-theme="dark"]) .chl-slide-dot--visited::before {
    background-color: rgba(0,0,0,0.25);
}

/* Current: accent colour + scale up */
.chl-slide-dot--current::before {
    transform: scale(1.4);
}

.chl-slide-dot--current[data-slide-type="hook"]::before,
.chl-slide-dot--current[data-slide-type="mistakes"]::before,
.chl-slide-dot--current[data-slide-type="warning"]::before {
    background-color: var(--slide-accent-warm);
}

.chl-slide-dot--current[data-slide-type="concept"]::before,
.chl-slide-dot--current[data-slide-type="analogy"]::before {
    background-color: #378add;
}

:root:not([data-theme="dark"]) .chl-slide-dot--current[data-slide-type="concept"]::before,
:root:not([data-theme="dark"]) .chl-slide-dot--current[data-slide-type="analogy"]::before {
    background-color: #2563eb;
}

.chl-slide-dot--current[data-slide-type="example"]::before,
.chl-slide-dot--current[data-slide-type="code-sequence"]::before,
.chl-slide-dot--current[data-slide-type="complete-function"]::before {
    background-color: #1d9e75;
}

:root:not([data-theme="dark"]) .chl-slide-dot--current[data-slide-type="example"]::before,
:root:not([data-theme="dark"]) .chl-slide-dot--current[data-slide-type="code-sequence"]::before,
:root:not([data-theme="dark"]) .chl-slide-dot--current[data-slide-type="complete-function"]::before {
    background-color: #0d7a5a;
}

.chl-slide-dot--current[data-slide-type="completion"]::before {
    background-color: #7f77dd;
}

:root:not([data-theme="dark"]) .chl-slide-dot--current[data-slide-type="completion"]::before {
    background-color: #7c3aed;
}

/* Unvisited: hollow border only, non-interactive */
.chl-slide-dot--unvisited {
    pointer-events: none;
    cursor: default;
}

.chl-slide-dot--unvisited::before {
    background-color: transparent;
    border: 1.5px solid rgba(255,255,255,0.15);
}

:root:not([data-theme="dark"]) .chl-slide-dot--unvisited::before {
    border-color: rgba(0,0,0,0.12);
}

@media (prefers-reduced-motion: reduce) {
    .chl-slide-dot::before { transition: background-color 200ms ease; }
    .chl-slide-dot--current::before { transform: none; }
}

/* ── RESPONSIVE: 320px floor ────────────────────────────────── */
@media (max-width: 320px) {
    .chl-slide-wrap  { padding: 0.625em 0.75em 0.5em; }
    .chl-nav         { padding: 10px 12px max(12px, env(safe-area-inset-bottom, 0px)); }
    .v2-code-block pre        { font-size: 11px; }
    .v2-expected-output pre   { font-size: 11px; }
    .ch-hint-body pre code    { font-size: 11px; }
    .ch-hint-solution-code    { font-size: 11px; }
}


/* ═══════════════════════════════════════════════════════════════
   V1 SHIM CLASSES — appended in one pass
   54 classes missing from V2; sourced from slide.content across
   all 27 lesson files. Deuteranopia-safe palette applied.
   ─────────────────────────────────────────────────────────────
   Colour tokens:
     blue/info/red/dark-red : bg #E8F7FE  border #1CB0F6  text #0E6A99
     teal                   : bg #E0F3FA  border #0E8FCC  text #0a5c82
     green/orange/warning   : bg #FFFBE6  border #FFD900  text #7a6500
     purple                 : bg #F2F2F7  border #5856D6  text #3a3875
   ═══════════════════════════════════════════════════════════════ */

/* ── Group 1: Callout colour modifiers ───────────────────────── */
.lesson-callout--blue,
.lesson-callout--info,
.lesson-callout--red {
    background: #E8F7FE;
    border-left: 3px solid #1CB0F6;
    color: #0E6A99;
}
.lesson-callout--blue h4,
.lesson-callout--info h4,
.lesson-callout--red h4 { color: #0E6A99; }

.lesson-callout--teal {
    background: #E0F3FA;
    border-left: 3px solid #0E8FCC;
    color: #0a5c82;
}
.lesson-callout--teal h4 { color: #0a5c82; }

.lesson-callout--green,
.lesson-callout--orange {
    background: #FFFBE6;
    border-left: 3px solid #FFD900;
    color: #7a6500;
}
.lesson-callout--green h4,
.lesson-callout--orange h4 { color: #7a6500; }

.lesson-callout--purple {
    background: #F2F2F7;
    border-left: 3px solid #5856D6;
    color: #3a3875;
}
.lesson-callout--purple h4 { color: #3a3875; }

/* ── Group 2: Emphasis base + colour modifiers ───────────────── */
.lesson-emphasis { font-weight: 700; }

.lesson-emphasis--blue,
.lesson-emphasis--info,
.lesson-emphasis--red { color: #1CB0F6; }

.lesson-emphasis--teal { color: #0E8FCC; }

.lesson-emphasis--green,
.lesson-emphasis--orange,
.lesson-emphasis--warning { color: #7a6500; }

.lesson-emphasis--purple { color: #5856D6; }

/* ── Group 3: Code inline base + modifiers ───────────────────── */
.lesson-code-inline {
    font-family: monospace;
    font-size: 0.8125em;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 5px;
    color: var(--text);
}
.lesson-code-inline--accent  { color: #1CB0F6; font-weight: 700; }
.lesson-code-inline--comment { color: var(--text-muted); font-style: italic; }
.lesson-code-inline--result  { color: #7a6500; font-weight: 700; }
.lesson-code-inline--purple  { color: #5856D6; }
.lesson-code-inline--box-sm  { padding: 2px 8px; font-size: 0.75em; }
.lesson-code-inline--box-lg  { padding: 4px 12px; font-size: 0.875em; }

/* ── Group 4: Inline code — separate base (lesson-19 only) ───── */
.lesson-inline-code {
    font-family: monospace;
    font-size: 0.8125em;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 5px;
    color: var(--text);
}
.lesson-inline-code--orange { color: #7a6500; font-weight: 700; }

/* ── Group 5: Container modifier ────────────────────────────── */
.lesson-container--padded { padding: 16px 20px; }

/* ── Group 6: Info box + text utilities ──────────────────────── */
.lesson-info-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.625em 0.875em;
    font-size: 0.875em;
    line-height: 1.6;
    color: var(--text);
}
.lesson-text-md        { font-size: 0.875em; line-height: 1.6; color: var(--text); }
.lesson-text-secondary { font-size: 0.8125em; color: var(--text-muted); }
.lesson-section-heading {
    font-size: 1em;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0.5em;
}

/* ── Group 7: Subsection headings + modifiers ────────────────── */
.lesson-subsection-heading {
    font-size: 0.9375em;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.375em;
}
.lesson-subsection-heading--sm   { font-size: 0.8125em; }
.lesson-subsection-heading--md   { font-size: 0.875em; }
.lesson-subsection-heading--blue { color: #1CB0F6; }
.lesson-subsection-heading--red  { color: #1CB0F6; }

/* ── Group 8: Hero / hook layout classes ─────────────────────── */
.lesson-hero-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    padding: 12px 0;
}
.lesson-hero-icon        { font-size: 3em; line-height: 1; display: block; }
.lesson-hero-icon--medium  { font-size: 2.25em; }
.lesson-hero-icon--blue    { color: #1CB0F6; }
.lesson-hero-icon--teal    { color: #0E8FCC; }
.lesson-hero-icon--green   { color: #7a6500; }
.lesson-hero-icon--orange  { color: #7a6500; }
.lesson-hero-icon--red     { color: #1CB0F6; }
.lesson-hero-icon--dark-red { color: #1CB0F6; }
.lesson-hero-icon--purple  { color: #5856D6; }
.lesson-hero-icon--warning { color: #7a6500; }
.lesson-hero-lead {
    font-size: 1.125em;
    font-weight: 800;
    color: var(--text);
    line-height: 1.25;
}
.lesson-hero-subtext {
    font-size: 0.875em;
    color: var(--text-muted);
    line-height: 1.5;
}
.lesson-hook-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 8px 0;
}
.lesson-hook-heading    { font-size: 1.125em; font-weight: 800; color: var(--text); }
.lesson-hook-subheading { font-size: 0.875em; color: var(--text-muted); }
.lesson-hook-icon       { font-size: 2.25em; line-height: 1; }
.lesson-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75em 0.875em;
}
.lesson-feature-item {
    display: flex;
    align-items: center;
    gap: 0.625em;
    font-size: 0.875em;
    line-height: 1.5;
    color: var(--text);
}

.lesson-feature-item > :first-child {
    flex-shrink: 0;
    min-width: 1.5em;
    text-align: center;
}

/* ── Group 9: Table system ───────────────────────────────────── */
.lesson-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125em;
    margin: 8px 0;
}
.lesson-table__header          { background: var(--surface); }
.lesson-table__th {
    padding: 8px 10px;
    font-weight: 700;
    text-align: left;
    border-bottom: 2px solid var(--border);
    color: var(--text);
}
.lesson-table__th--center      { text-align: center; }
.lesson-table__td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: top;
}
.lesson-table__td--center      { text-align: center; }
.lesson-table__td--highlight   { font-weight: 700; color: #1CB0F6; }
.lesson-table__row--striped:nth-child(even) { background: var(--surface); }


/* ═══════════════════════════════════════════════════════════════════════
   V2 LESSON RENDERER — slide type styles
   Added to support V2 JSON slide types rendered by renderLessonSlide().
   Uses existing design tokens only. No existing rules modified.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── HOOK SLIDE ─────────────────────────────────────────────────────── */

.chl-hook-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 1;
    gap: 10px;
    padding: 1.5em 0.25em;
}

.chl-hook-icon {
    line-height: 1;
    margin-bottom: 4px;
}

.chl-hook-heading {
    font-size: 1.333em;
    font-weight: 800;
    color: var(--text);
    margin: 0;
    line-height: 1.2;
}

.chl-hook-prose {
    font-size: 0.9375em;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.55;
}

/* ── CONCEPT SLIDE ──────────────────────────────────────────────────── */

.chl-concept-prose {
    font-size: 0.9375em;
    color: var(--text);
    margin: 0 0 8px;
    line-height: 1.6;
}

.chl-concept-prose:last-of-type {
    margin-bottom: 0;
}

.chl-concept-callout {
    list-style: none;
    counter-reset: chl-callout;
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 0.75em 1em 0.75em 1em;
    margin: 10px 0 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chl-concept-callout li {
    counter-increment: chl-callout;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.9em;
    color: var(--text);
    line-height: 1.5;
}

.chl-concept-callout li::before {
    content: counter(chl-callout);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--text-inverse);
    font-size: 0.75em;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}

.chl-concept-info {
    margin-top: 10px;
    padding: 0.65em 0.85em;
    border-left: 3px solid var(--primary);
    background: var(--surface);
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
    font-size: 0.875em;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ── EXAMPLE SLIDE — no new rules needed (reuses .chl-code-block) ──── */

/* ── CODE-SEQUENCE SLIDE ────────────────────────────────────────────── */

.chl-seq-dots {
    display: flex;
    justify-content: center;
    gap: 7px;
    margin-bottom: 10px;
}

.chl-seq-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    transition: background 0.15s;
}

.chl-seq-dot--active {
    background: var(--primary);
}

/* Sequence code block: no height cap — function always shown in full */
.chl-code-block--seq {
    max-height: none;
    overflow-y: visible;
}

/* Ghost lines: visually muted but take up the same space as normal lines */
.chl-seq-ghost {
    opacity: 0.28;
}

/* ── COMPLETE-FUNCTION SLIDE ────────────────────────────────────────── */

.chl-complete-badge {
    display: inline-block;
    padding: 3px 10px;
    background: var(--primary);
    color: var(--text-inverse);
    font-size: 0.75em;
    font-weight: 700;
    border-radius: var(--radius-xs);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

/* Complete-function code block: no height cap */
.chl-code-block--complete {
    max-height: none;
    overflow-y: visible;
}

/* ── WARNING SLIDE ──────────────────────────────────────────────────── */

.chl-slide-title--warning {
    color: var(--hint-border);   /* amber #F59E0B */
}

.chl-warning-info {
    margin-top: 10px;
    padding: 0.65em 0.85em;
    border-left: 3px solid var(--hint-border);
    background: var(--hint-bg);
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
    font-size: 0.875em;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ── COMPLETION SLIDE ───────────────────────────────────────────────── */

.chl-completion-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
    gap: 12px;
    padding: 1.5em 0.25em 1em;
}

.chl-completion-icon {
    font-size: 3em;
    line-height: 1;
}

.chl-completion-heading {
    font-size: 1.333em;
    font-weight: 800;
    color: var(--text);
    margin: 0;
    line-height: 1.2;
}

.chl-completion-list {
    list-style: none;
    padding: 0;
    margin: 4px 0 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.chl-completion-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.9em;
    color: var(--text);
    line-height: 1.5;
}

.chl-completion-item::before {
    content: '\2713';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--text-inverse);
    font-size: 0.75em;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}


/* === SLIDE REDESIGN === */

/* ── Layout — slide wrap ──────────────────────────────────────────────── */

.chl-slide-wrap {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.chl-hook-body,
.chl-completion-body {
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* ── Progress bar ─────────────────────────────────────────────────────── */

.chl-progress-wrap {
    height: 3px;
    width: 100%;
    overflow: hidden;
    background: var(--bg);
}

.chl-progress-fill {
    height: 3px;
    transition: width 0.4s ease, background-color 0.4s ease;
}

.chl-progress-fill[data-slide-type="hook"]          { background: var(--slide-accent-warm); }
.chl-progress-fill[data-slide-type="concept"]       { background: #378add; }
.chl-progress-fill[data-slide-type="example"]       { background: #1d9e75; }
.chl-progress-fill[data-slide-type="code-sequence"] { background: #1d9e75; }
.chl-progress-fill[data-slide-type="mistakes"]      { background: var(--slide-accent-warm); }
.chl-progress-fill[data-slide-type="completion"]    { background: #7f77dd; }

:root:not([data-theme="dark"]) .chl-progress-fill[data-slide-type="hook"]          { background: #d97706; }
:root:not([data-theme="dark"]) .chl-progress-fill[data-slide-type="concept"]       { background: #2563eb; }
:root:not([data-theme="dark"]) .chl-progress-fill[data-slide-type="example"]       { background: #0d7a5a; }
:root:not([data-theme="dark"]) .chl-progress-fill[data-slide-type="code-sequence"] { background: #0d7a5a; }
:root:not([data-theme="dark"]) .chl-progress-fill[data-slide-type="mistakes"]      { background: #b45309; }
:root:not([data-theme="dark"]) .chl-progress-fill[data-slide-type="completion"]    { background: #7c3aed; }

/* ── Hook slide ───────────────────────────────────────────────────────── */

.chl-hook-body {
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 14px;
    padding: 28px 20px;
    position: relative;
    background: #0f172a;
}

:root:not([data-theme="dark"]) .chl-hook-body {
    background: #fffbeb;
}

.chl-hook-glow {
    position: absolute;
    top: 28%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(238,194,82,0.13) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

:root:not([data-theme="dark"]) .chl-hook-glow {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(238,194,82,0.15) 0%, transparent 70%);
}

.chl-hook-icon-wrap {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    position: relative;
    background: rgba(238,194,82,0.10);
    border: 1px solid rgba(238,194,82,0.22);
}

:root:not([data-theme="dark"]) .chl-hook-icon-wrap {
    background: rgba(238,194,82,0.15);
    border-color: rgba(238,194,82,0.35);
}

.chl-hook-heading {
    font-size: 1.692em;
    font-weight: 500;
    line-height: 1.2;
    color: #fef3c7;
}

:root:not([data-theme="dark"]) .chl-hook-heading {
    color: #1c1917;
}

.chl-hook-prose {
    font-size: 1em;
    line-height: 1.7;
    color: var(--slide-accent-warm);
    opacity: 0.75;
}

:root:not([data-theme="dark"]) .chl-hook-prose {
    color: #44403c;
    opacity: 1;
}

.chl-hook-tag {
    font-size: 0.846em;
    padding: 3px 12px;
    border-radius: 99px;
    background: rgba(238,194,82,0.10);
    border: 0.5px solid rgba(238,194,82,0.25);
    color: var(--slide-accent-warm);
}

:root:not([data-theme="dark"]) .chl-hook-tag {
    background: rgba(238,194,82,0.18);
    border-color: rgba(238,194,82,0.3);
    color: #92400e;
}

/* ── Concept slide ────────────────────────────────────────────────────── */

.chl-concept-accent {
    height: 3px;
    flex-shrink: 0;
    background: #185fa5;
}

:root:not([data-theme="dark"]) .chl-concept-accent {
    background: #2563eb;
}

/* :has() — first use in codebase; Chrome 105+, Safari 15.4+, Firefox 121+ */
/* 3c: gradient moved to #ch-lesson-panel — slide-wrap is transparent so the
 * panel gradient fills edge-to-edge at any viewport width. */
.chl-slide-wrap:has(.chl-concept-accent) {
    flex: 1;
    background: transparent;
}

/* 2b + 3c: strengthened wash on panel, not slide-wrap */
body[data-v2-challenge] #ch-lesson-panel:has(.chl-concept-accent) {
    background: radial-gradient(ellipse 100% 60% at 50% 15%, #152d6b 0%, #070e1e 100%);
}

:root:not([data-theme="dark"]) body[data-v2-challenge] #ch-lesson-panel:has(.chl-concept-accent) {
    background: radial-gradient(ellipse at 50% 20%, #dbeafe 0%, #f0f7ff 100%);
}

.chl-slide-wrap:has(.chl-concept-accent) .chl-slide-title {
    font-size: 1.308em;
    font-weight: 500;
    color: #e0f0ff;
    margin-bottom: 10px;
}

:root:not([data-theme="dark"]) .chl-slide-wrap:has(.chl-concept-accent) .chl-slide-title {
    color: #1e3a5f;
}

.chl-concept-prose {
    font-size: 1em;
    line-height: 1.7;
    color: #7eb8e8;
}

:root:not([data-theme="dark"]) .chl-concept-prose {
    color: #1d4ed8;
}

.chl-concept-callout {
    list-style: none;
    padding: 12px 14px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(24,95,165,0.2);
    border: 0.5px solid rgba(55,138,221,0.25);
    counter-reset: callout-counter;
}

:root:not([data-theme="dark"]) .chl-concept-callout {
    background: rgba(219,234,254,0.7);
    border-color: rgba(37,99,235,0.2);
}

.chl-concept-callout li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1em;
    color: #bfdbfe;
    counter-increment: callout-counter;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

:root:not([data-theme="dark"]) .chl-concept-callout li {
    color: #1e40af;
}

.chl-concept-callout li::before {
    content: counter(callout-counter);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.846em;
    font-weight: 500;
    background: #185fa5;
    color: #e6f1fb;
}

:root:not([data-theme="dark"]) .chl-concept-callout li::before {
    background: #2563eb;
    color: #eff6ff;
}

.chl-concept-callout li.chl-anim-visible {
    opacity: 1;
    transform: translateY(0);
}

.chl-concept-info {
    border-left: 3px solid #378add;
    border-radius: 0 8px 8px 0;
    padding: 10px 12px;
    font-size: 0.923em;
    line-height: 1.5;
    background: rgba(12,68,124,0.35);
    color: #93c5fd;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

:root:not([data-theme="dark"]) .chl-concept-info {
    background: rgba(219,234,254,0.5);
    border-color: #3b82f6;
    color: #1d4ed8;
}

.chl-concept-info.chl-anim-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ── Example slide ────────────────────────────────────────────────────── */

.chl-example-accent {
    height: 3px;
    flex-shrink: 0;
    background: #0f6e56;
}

:root:not([data-theme="dark"]) .chl-example-accent {
    background: #0d7a5a;
}

/* 3c: transparent — gradient lives on #ch-lesson-panel below */
.chl-slide-wrap:has(.chl-example-accent) {
    flex: 1;
    background: transparent;
    justify-content: center;
    gap: 14px;
    padding: 16px 18px;
}

/* 2b + 3c: strengthened teal wash on panel */
body[data-v2-challenge] #ch-lesson-panel:has(.chl-example-accent) {
    background: radial-gradient(ellipse 100% 60% at 50% 20%, #083d28 0%, #030b07 100%);
}

:root:not([data-theme="dark"]) body[data-v2-challenge] #ch-lesson-panel:has(.chl-example-accent) {
    background: radial-gradient(ellipse at 50% 25%, #d1fae5 0%, #f0fdf8 100%);
}

.chl-slide-wrap:has(.chl-example-accent) .chl-slide-title {
    font-size: 1.308em;
    font-weight: 500;
    color: #ccfbef;
}

:root:not([data-theme="dark"]) .chl-slide-wrap:has(.chl-example-accent) .chl-slide-title {
    color: #064e3b;
}

.chl-slide-wrap:has(.chl-example-accent) .chl-slide-desc {
    font-size: 1em;
    line-height: 1.5;
    color: #5dcaa5;
}

:root:not([data-theme="dark"]) .chl-slide-wrap:has(.chl-example-accent) .chl-slide-desc {
    color: #065f46;
}

/* Scoped to example context only — .chl-code-block--seq and
   .chl-code-block--complete are intentionally unstyled by this block. */
.chl-slide-wrap:has(.chl-example-accent) .chl-code-block {
    border-radius: 10px;
    overflow: hidden;
    border: 0.5px solid #0f6e56;
    background: rgba(2,15,11,0.8);
}

:root:not([data-theme="dark"]) .chl-slide-wrap:has(.chl-example-accent) .chl-code-block {
    background: #f8fffe;
    border-color: #5dcaa5;
}

.chl-slide-wrap:has(.chl-example-accent) .chl-code-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    background: rgba(4,26,20,0.9);
    border-bottom: 0.5px solid #0f6e56;
}

:root:not([data-theme="dark"]) .chl-slide-wrap:has(.chl-example-accent) .chl-code-header {
    background: #ecfdf5;
    border-bottom-color: #a7f3d0;
}

.chl-slide-wrap:has(.chl-example-accent) .chl-code-lang-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #1d9e75;
    flex-shrink: 0;
}

:root:not([data-theme="dark"]) .chl-slide-wrap:has(.chl-example-accent) .chl-code-lang-dot {
    background: #0d7a5a;
}

.chl-slide-wrap:has(.chl-example-accent) .chl-code-lang-label {
    font-size: 0.846em;
    font-family: var(--mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #1d9e75;
}

:root:not([data-theme="dark"]) .chl-slide-wrap:has(.chl-example-accent) .chl-code-lang-label {
    color: #0d7a5a;
}

.chl-slide-wrap:has(.chl-example-accent) .chl-code-block pre {
    padding: 16px;
    font-size: 1em;
    line-height: 1.9;
    color: #a7f3d0;
    white-space: pre;
    overflow-x: auto;
}

:root:not([data-theme="dark"]) .chl-slide-wrap:has(.chl-example-accent) .chl-code-block pre {
    color: #065f46;
}

/* ── Mistakes slide ───────────────────────────────────────────────────── */

.chl-slide-wrap:has(.v2-mistake-body) {
    flex: 1;
    background: #0f172a;
    position: relative;
    overflow: hidden;
    padding: 16px 18px;
    gap: 0;
}

:root:not([data-theme="dark"]) .chl-slide-wrap:has(.v2-mistake-body) {
    background: #fafafa;
}

.chl-slide-wrap:has(.v2-mistake-body)::before {
    content: "";
    position: absolute;
    top: 30%;
    left: -10%;
    width: 160px;
    height: 160px;
    background: radial-gradient(circle, rgba(180,117,23,0.12) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

:root:not([data-theme="dark"]) .chl-slide-wrap:has(.v2-mistake-body)::before {
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(238,194,82,0.10) 0%, transparent 70%);
}

.chl-slide-wrap:has(.v2-mistake-body)::after {
    content: "";
    position: absolute;
    top: 50%;
    right: -10%;
    width: 160px;
    height: 160px;
    background: radial-gradient(circle, rgba(24,95,165,0.14) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

:root:not([data-theme="dark"]) .chl-slide-wrap:has(.v2-mistake-body)::after {
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(37,99,235,0.08) 0%, transparent 70%);
}

.v2-mistake-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.875em;
    position: relative;
    padding: 4px 0;
}

.v2-mistake-incorrect,
.v2-mistake-correct {
    border-radius: 10px;
    padding: 14px;
}

/* 1a: amber replaces red for INCORRECT box */
.v2-mistake-incorrect {
    background: rgba(238,194,82,0.12);
    border: 0.5px solid var(--slide-accent-warm);
}

:root:not([data-theme="dark"]) .v2-mistake-incorrect {
    background: rgba(238,194,82,0.12);
    border-color: var(--slide-accent-warm);
}

.v2-mistake-incorrect .v2-mistake-label { color: var(--slide-accent-warm); }
/* Light mode: #EEC252 fails AA on near-white — using darker amber #92400e (~9:1) */
:root:not([data-theme="dark"]) .v2-mistake-incorrect .v2-mistake-label { color: #92400e; }

.v2-mistake-incorrect pre { color: #fcd34d; }
:root:not([data-theme="dark"]) .v2-mistake-incorrect pre { color: #92400e; }

/* 1a: blue replaces green for CORRECT box */
.v2-mistake-correct {
    background: rgba(37,99,235,0.12);
    border: 0.5px solid #2563eb;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

:root:not([data-theme="dark"]) .v2-mistake-correct {
    background: rgba(24,95,165,0.10);
    border-color: #185fa5;
}

.v2-mistake-correct.v2-mistake-correct--visible {
    opacity: 1;
    transform: translateY(0);
}

.v2-mistake-correct .v2-mistake-label { color: #93c5fd; }
:root:not([data-theme="dark"]) .v2-mistake-correct .v2-mistake-label { color: #185fa5; }

.v2-mistake-correct pre { color: #93c5fd; }
:root:not([data-theme="dark"]) .v2-mistake-correct pre { color: #1e40af; }

.v2-mistake-label {
    font-size: 0.769em;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.v2-mistake-explanation {
    border-left: 3px solid #378add;
    border-radius: 0 8px 8px 0;
    padding: 11px 13px;
    font-size: 1em;
    line-height: 1.5;
    background: #1e3a5f;
    color: #bfdbfe;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

:root:not([data-theme="dark"]) .v2-mistake-explanation {
    background: #dbeafe;
    border-color: #3b82f6;
    color: #1e40af;
}

.v2-mistake-explanation.v2-mistake-explanation--visible {
    opacity: 1;
    transform: translateY(0);
}

.v2-mistake-reveal-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.923em;
    cursor: pointer;
    border: 0.5px solid #185fa5;
    background: rgba(24,95,165,0.2);
    color: #60a5fa;
    font-family: inherit;
}

:root:not([data-theme="dark"]) .v2-mistake-reveal-btn {
    background: rgba(37,99,235,0.08);
    border-color: #3b82f6;
    color: #1d4ed8;
}

.v2-mistake-reveal-btn[style*="display: none"] { display: none; }

#chl-next-btn[data-locked="true"] {
    opacity: 0.3;
    pointer-events: none;
    cursor: not-allowed;
}

/* ── Completion slide ─────────────────────────────────────────────────── */

.chl-completion-body {
    align-items: center;
    gap: 0;
    text-align: left;
    padding: 20px 18px;
    background: radial-gradient(ellipse at 50% 20%, #160d2e 0%, #0f172a 70%);
    isolation: isolate;
}

:root:not([data-theme="dark"]) .chl-completion-body {
    background: radial-gradient(ellipse at 50% 20%, #ede9fe 0%, #faf9ff 100%);
}

.chl-completion-icon-wrap {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    margin-bottom: 10px;
    background: rgba(127,119,221,0.15);
    border: 1px solid rgba(127,119,221,0.3);
}

:root:not([data-theme="dark"]) .chl-completion-icon-wrap {
    background: rgba(139,92,246,0.12);
    border-color: rgba(139,92,246,0.3);
}

.chl-completion-heading {
    font-size: 1.538em;
    font-weight: 500;
    color: #ede9fe;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

:root:not([data-theme="dark"]) .chl-completion-heading {
    color: #3b0764;
}

.chl-completion-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    gap: 0;
    width: 100%;
    list-style: none;
    padding: 0;
    margin: 0;
}

.chl-completion-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 1em;
    line-height: 1.5;
    padding: 6px 0;
    border-bottom: 0.5px solid rgba(127,119,221,0.12);
    color: #c4b5fd;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

:root:not([data-theme="dark"]) .chl-completion-item {
    color: #4c1d95;
    border-bottom-color: rgba(139,92,246,0.15);
}

.chl-completion-item:last-child { border-bottom: none; }

.chl-completion-item.chl-anim-visible {
    opacity: 1;
    transform: translateY(0);
}

.chl-completion-item::before {
    content: "✓";
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.846em;
    margin-top: 1px;
    background: #3c3489;
    border: 0.5px solid #7f77dd;
    color: #ede9fe;
}

:root:not([data-theme="dark"]) .chl-completion-item::before {
    background: #7c3aed;
    border-color: #a78bfa;
    color: #faf5ff;
}

/* ── Animations ───────────────────────────────────────────────────────── */

/* 3b: tap-to-reveal pulse — removed when button is tapped */
@keyframes chl-reveal-pulse {
    0%, 100% { transform: scale(1);    box-shadow: 0 0 0 0   rgba(238,194,82,0.45); }
    50%       { transform: scale(1.03); box-shadow: 0 0 0 8px rgba(238,194,82,0);    }
}

.v2-mistake-reveal-btn--pulse {
    animation: chl-reveal-pulse 2s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
    .v2-mistake-reveal-btn--pulse { animation: none; }
}

@keyframes chl-rock {
    0%   { transform: rotate(-8deg); }
    50%  { transform: rotate(8deg); }
    100% { transform: rotate(-8deg); }
}

@keyframes chl-pulse-dark {
    0%   { box-shadow: 0 0 0 0 rgba(127,119,221,0.35); }
    70%  { box-shadow: 0 0 0 10px rgba(127,119,221,0); }
    100% { box-shadow: 0 0 0 0 rgba(127,119,221,0); }
}

@keyframes chl-pulse-light {
    0%   { box-shadow: 0 0 0 0 rgba(139,92,246,0.35); }
    70%  { box-shadow: 0 0 0 10px rgba(139,92,246,0); }
    100% { box-shadow: 0 0 0 0 rgba(139,92,246,0); }
}

.chl-completion-icon {
    animation: chl-rock 1.8s ease-in-out infinite;
    transform-origin: center bottom;
    display: inline-block;
}

[data-theme="dark"] .chl-completion-icon-wrap {
    animation: chl-pulse-dark 2s ease-out infinite;
}

:root:not([data-theme="dark"]) .chl-completion-icon-wrap {
    animation: chl-pulse-light 2s ease-out infinite;
}

/* ── Desktop: extend slide wrap background into panel padding area ────── */
/* Static fullscreen button in #pane-objective: hidden on mobile, shown on desktop. */
/* Fullscreen button: hidden on mobile, shown on desktop (see @media 1024px below). */
#ch-fullscreen-btn { display: none; }

#ch-obj-fullscreen-btn { display: none; }

/* #ch-lesson-panel has padding-bottom: var(--desktop-tabs-h) (56px) to    */
/* reserve space above the desktop tab bar. .chl-slide-wrap's flex:1 fills  */
/* only the content area, leaving that 56px showing the panel's --bg.      */
/* Matching padding-bottom here extends the wrap's background into that gap. */
@media (min-width: 1024px) {
    .chl-slide-wrap {
        padding-bottom: var(--desktop-tabs-h, 0px);
    }

    /* ── Fullscreen toggle button (lesson panel + objective pane) ────── */
    /* #ch-obj-fullscreen-btn is static HTML; display:none is set at base
     * level (outside this media query) so it is hidden on mobile. */
    #ch-fullscreen-btn,
    #ch-obj-fullscreen-btn {
        display: block;
        position: absolute;
        top: 25%;
        left: 0;
        transform: translate(-100%, -50%);
        z-index: 20;
        background: rgba(238, 194, 82, 0.18);
        border: none;
        cursor: pointer;
        border-radius: 50% 0 0 50%;
        padding: 12px 4px 12px 8px;
        backdrop-filter: blur(4px);
        transition: background 0.2s;
        color: var(--hint-border);
        font-size: 16px;
        line-height: 1;
    }

    #ch-fullscreen-btn:hover,
    #ch-obj-fullscreen-btn:hover {
        background: rgba(238, 194, 82, 0.32);
    }

    body.ch-fullscreen #ch-fullscreen-btn,
    body.ch-fullscreen #ch-obj-fullscreen-btn {
        left: 0;
        transform: translateY(-50%);
        border-radius: 0 50% 50% 0;
        padding: 12px 8px 12px 4px;
    }

    /* Allow #ch-obj-fullscreen-btn to visually overflow the pane's left edge
     * in non-fullscreen (mirrors the same override on #ch-lesson-panel in
     * v2-challenge-layout.css). Specificity (0,1,2,1) beats layout.css (0,1,0,1). */
    body[data-v2-challenge]:not(.ch-fullscreen) #pane-objective {
        overflow: visible;
    }
}

/* ── Fullscreen panel clip removal ──────────────────────────────────────────
 * Remove overflow:hidden and border-radius from the panel in fullscreen.
 * The panel is position:fixed; inset:0 — any clip on it would cut the
 * background at the viewport edges. Slide animations target .chl-slide-wrap,
 * not the panel, so the panel never moves and these properties are safe to clear.
 * Specificity (0,1,2,1) overrides the base (0,1,1,1) rules.
 * ─────────────────────────────────────────────────────────────────────────── */
body[data-v2-challenge].ch-fullscreen #ch-lesson-panel {
    overflow: visible;
    border-radius: 0;
}

/* ── Fullscreen background — edge-to-edge fill ───────────────────────────────
 * In fullscreen, .chl-slide-wrap is capped at max-width: 56rem and centered.
 * Slides with flat backgrounds (hook, mistakes, completion) are already seamless
 * because their slide-type colour matches the panel background.
 *
 * Concept and example slides use radial gradients on .chl-slide-wrap. On screens
 * wider than 56rem the gradient stops at the slide-wrap boundary, leaving a
 * visible seam against the flat panel colour. Fix: move the gradient to the panel
 * so it fills 100vw × 100vh, and make the slide-wrap transparent so the panel
 * gradient shows through edge-to-edge with no hard boundary.
 *
 * Dark (default) panel rules first; light-mode overrides follow.
 * Slide-wrap transparent overrides apply regardless of colour scheme.
 * Uses :has() — Chrome 105+, Safari 15.4+, Firefox 121+.
 * ─────────────────────────────────────────────────────────────────────────── */
body.ch-fullscreen #ch-lesson-panel:has(.chl-hook-body)       { background: #0f172a; }
body.ch-fullscreen #ch-lesson-panel:has(.chl-concept-accent)  { background: radial-gradient(ellipse 100% 60% at 50% 15%, #152d6b 0%, #070e1e 100%); }
body.ch-fullscreen #ch-lesson-panel:has(.chl-example-accent)  { background: radial-gradient(ellipse 100% 60% at 50% 20%, #083d28 0%, #030b07 100%); }
body.ch-fullscreen #ch-lesson-panel:has(.v2-mistake-body)     { background: #0f172a; }
body.ch-fullscreen #ch-lesson-panel:has(.chl-completion-body) { background: #0f172a; }

:root:not([data-theme="dark"]) body.ch-fullscreen #ch-lesson-panel:has(.chl-hook-body)       { background: #fffbeb; }
:root:not([data-theme="dark"]) body.ch-fullscreen #ch-lesson-panel:has(.chl-concept-accent)  { background: radial-gradient(ellipse at 50% 20%, #dbeafe 0%, #f0f7ff 100%); }
:root:not([data-theme="dark"]) body.ch-fullscreen #ch-lesson-panel:has(.chl-example-accent)  { background: radial-gradient(ellipse at 50% 25%, #d1fae5 0%, #f0fdf8 100%); }
:root:not([data-theme="dark"]) body.ch-fullscreen #ch-lesson-panel:has(.v2-mistake-body)     { background: #fafafa; }
:root:not([data-theme="dark"]) body.ch-fullscreen #ch-lesson-panel:has(.chl-completion-body) { background: #faf9ff; }

/* Slide-wrap gradient is now redundant in fullscreen — panel gradient fills edge-to-edge.
 * Specificity (0,0,3,1) overrides the base slide-wrap gradient rules (0,0,2,0 / 0,0,3,0). */
body.ch-fullscreen .chl-slide-wrap:has(.chl-concept-accent),
body.ch-fullscreen .chl-slide-wrap:has(.chl-example-accent) {
    background: transparent;
}

/* ── Fullscreen: Objective pane ─────────────────────────────────────────────
 * In fullscreen, #ch-lesson-panel is position:fixed z-index:1000 and covers
 * the viewport regardless of .is-active. The objective pane must sit above it
 * when active, and text scales up to match lesson-slide presentation sizing.
 * ─────────────────────────────────────────────────────────────────────────── */
@media (min-width: 1024px) {
    body.ch-fullscreen #pane-objective.is-active {
        display: flex !important;
        position: fixed;
        inset: 0;
        z-index: 1001;
        width: 100vw;
        height: 100vh;
        background: var(--bg);
        padding-bottom: 0;
    }

    body.ch-fullscreen #pane-objective.is-active #ch-objective-scroll {
        max-width: 56rem;
        width: 100%;
        margin-inline: auto;
        padding: clamp(2rem, 5vw, 4rem) clamp(1.5rem, 4vw, 3rem);
    }

    body.ch-fullscreen #pane-objective.is-active .ch-obj-lesson-tag {
        font-size: clamp(13px, 1vw, 18px);
    }

    body.ch-fullscreen #pane-objective.is-active .ch-obj-title {
        font-size: clamp(36px, 4vw, 60px);
    }

    body.ch-fullscreen #pane-objective.is-active .ch-obj-objective {
        font-size: clamp(22px, 1.8vw, 30px);
    }

    body.ch-fullscreen #pane-objective.is-active .ch-criteria-heading {
        font-size: clamp(13px, 1vw, 18px);
    }

    body.ch-fullscreen #pane-objective.is-active .ch-criteria-list {
        font-size: clamp(18px, 1.4vw, 26px);
    }

    body.ch-fullscreen #pane-objective.is-active .chl-nav {
        display: flex;
    }
}
