/* ============================================
   LESSON-MODAL.CSS - Lesson Modal & Slides
   ============================================ */

/* ============================================
   LESSON MODAL STRUCTURE
   ============================================ */
.lesson-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.lesson-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1;
}

.lesson-modal-content {
    position: relative;
    background: linear-gradient(135deg, #5b21b6 0%, #7c3aed 100%); /* Kept as is, as it's not the primary gradient */
    border-radius: var(--radius-xl);
    max-width: 900px;
    max-height: 95vh;
    height: 95vh;
    width: 92%;
    /* FIX: As a flex child of .lesson-modal, min-width:auto (the default)
       lets wide descendants (nowrap buttons, pre-wrap code) force this box
       wider than its width:92% basis. min-width:0 surrenders that
       automatic minimum so overflow:hidden can actually clip content.
       max-width:100vw is a hard viewport stop for any remaining blowout. */
    min-width: 0;
    max-width: min(900px, 100vw);
    overflow: hidden;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
    z-index: 2;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.lesson-close-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.25);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    color: #ffffff;
    transition: var(--transition-standard);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    pointer-events: auto;
}

.lesson-close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.lesson-header {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lesson-title {
    font-size: 26px;
    font-weight: 700;
    color: #ffffff;
}

/* ============================================
   LESSON SLIDE CONTENT
   ============================================ */
.lesson-slide {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow-y: hidden;
    overflow-x: hidden;
    padding: 0 0 40px 0;
    min-height: 0;
}

/* Lesson surface cards (white cards inside slides) */
.lesson-surface {
    background: var(--surface);
    border-radius: 12px;
    padding: 30px;
    margin: 10px 0;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* Inset surfaces (code blocks, output panels within lesson surfaces) */
.lesson-surface--inset {
    background: var(--code-bg-dark);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 16px;
    position: relative;
}

/* Output-specific styling (extends inset) */
.lesson-surface--output {
    background: var(--output-bg);
    border: 2px solid var(--output-border);
    border-radius: 8px;
    padding: 16px;
}

/* Code block label */
.code-label {
    font-size: 14px;
    color: #94a3b8;
    margin-bottom: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Output block label */
.output-label {
    font-size: 14px;
    color: #059669;
    margin-bottom: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.slide-title {
    font-size: 30px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 16px;
}

.slide-description {
    font-size: 19px;
    color: #cbd5e1;
    margin-bottom: 28px;
    line-height: 1.6;
}

.slide-code-container {
    background: #1e293b;
    border-radius: 14px;
    padding: 24px;
    margin: 24px 0 14px 0;
}

.slide-code {
    margin: 0;
    color: #e2e8f0;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 18px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.slide-run-btn {
    background: var(--gradient-success);
    color: white;
    border: none;
    padding: 16px 40px;
    border-radius: var(--radius-md);
    font-size: 19px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-slow);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    display: block;
    margin: 24px auto;
}

.slide-run-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.slide-run-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.slide-run-btn-inline {
    background: var(--gradient-success);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: var(--radius-md);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-slow);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    white-space: nowrap;
    flex-shrink: 0;
}

/* FIX: At narrow viewports the nowrap+flex-shrink:0 combination forces
   the button's parent flex row wider than the modal. Give the button a
   min-width:0 escape and tighter padding so it yields space to the code
   block beside it. white-space:nowrap is preserved — label text is not
   broken — only the internal padding shrinks. */
@media (max-width: 400px) {
    .slide-run-btn-inline {
        padding: 12px 16px;
        font-size: 16px;
        min-width: 0;
    }
}

.slide-run-btn-inline:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.slide-run-btn-inline:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.slide-output-container {
    background: rgba(16, 185, 129, 0.1);
    border: 2px solid rgba(16, 185, 129, 0.3);
    border-radius: 14px;
    padding: 24px;
    margin: 14px 0 0 0;
}

.slide-output-label {
    font-size: 17px;
    font-weight: 600;
    color: #6ee7b7;
    margin-bottom: 16px;
}

.slide-output {
    margin: 0;
    color: #6ee7b7;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 18px;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* ============================================
   MISTAKE SLIDES
   ============================================ */
/* Mistake box container */
.mistake-box {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border-left: 4px solid #ef4444;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Wrong/Right section containers */
.mistake-section {
    margin-bottom: 12px;
}

/* Wrong label */
.mistake-wrong {
    color: #ef4444;
    font-weight: 600;
    font-size: 16px;
}

/* Right label */
.mistake-right {
    color: #10b981;
    font-weight: 600;
    font-size: 16px;
}

/* Code wrapper */
.mistake-code-wrapper {
    margin-top: 6px;
}

/* Wrong code block */
.mistake-code-wrong {
    background: rgba(239, 68, 68, 0.1);
    padding: 6px 10px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 15px;
    display: inline-block;
}

/* Right code block */
.mistake-code-right {
    background: rgba(16, 185, 129, 0.1);
    padding: 6px 10px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 15px;
    display: inline-block;
}

/* Explanation text */
.mistake-explanation {
    color: #64748b;
    font-size: 15px;
    font-style: italic;
    line-height: 1.5;
}

/* Mistake grid layout */
.mistake-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    grid-template-rows: auto auto;
}

.mistake-wrong code {
    background: rgba(239, 68, 68, 0.2);
    padding: 4px 8px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
}

.mistake-right code {
    background: rgba(16, 185, 129, 0.2);
    padding: 4px 8px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
}

/* ============================================
   COMPLETION SLIDE
   ============================================ */
.checkpoint-list {
    list-style: none;
    padding: 0;
    margin: 12px 0 20px 0;
    text-align: left;
}

.checkpoint-item {
    background: rgba(139, 92, 246, 0.05);
    border-left: 4px solid #8b5cf6;
    padding: 10px 14px;
    margin: 6px 0;
    border-radius: 6px;
    color: #2C3E50; /* Dark text for light mode */
    font-size: 19px;
    line-height: 1.5;
}

.completion-subtitle {
    font-size: 19px;
    margin: 4px 0 0 0;
    color: #64748b; /* Medium gray for light mode */
}

.lesson-challenge-btn {
    background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
    color: white;
    border: none;
    padding: 16px 40px;
    border-radius: 14px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 18px;
    transition: var(--transition-slow);
    box-shadow: 0 6px 20px rgba(167, 139, 250, 0.4);
}

.lesson-challenge-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(167, 139, 250, 0.5);
}

.lesson-back-btn {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
    color: white;
    border: none;
    padding: 16px 40px;
    border-radius: 14px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 18px;
    transition: var(--transition-slow);
    box-shadow: 0 6px 20px rgba(107, 114, 128, 0.4);
}

.lesson-back-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(107, 114, 128, 0.5);
}

/* ============================================
   FLOATING NAVIGATION (PowerPoint Style)
   ============================================ */

/* Floating Previous/Next Buttons - FIXED TO BE INSIDE MODAL */
.lesson-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.95);
    color: #7c3aed;
    border: 2px solid rgba(255, 255, 255, 0.3);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 32px;
    font-weight: 400;
    cursor: pointer;
    transition: var(--transition-standard);
    box-shadow: var(--shadow-dark);
    z-index: 101;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Courier New', monospace;
}

.lesson-nav-btn:hover:not(:disabled) {
    background: #ffffff;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.lesson-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.lesson-nav-btn:first-of-type {
    left: 20px;
}

.lesson-nav-btn:last-of-type {
    right: 20px;
}

.lesson-nav-btn.primary {
    background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
    color: white;
    border-color: rgba(167, 139, 250, 0.3);
}

.lesson-nav-btn.primary:hover:not(:disabled) {
    background: var(--gradient-primary);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

/* Simple Slide Counter at Bottom */
.lesson-slide-counter {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(0, 0, 0, 0.25);
    padding: 8px 16px;
    border-radius: 20px;
    z-index: 99;
    backdrop-filter: blur(8px);
}
.lesson-number-display {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.25);  /* ← Changed to transparent like bottom */
    color: rgba(255, 255, 255, 0.9);  /* ← Changed to match bottom */
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 600;
    z-index: 10002;
    backdrop-filter: blur(8px);  /* ← Added blur like bottom */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ============================================
   LESSON CONTENT STYLES (Phase 3)
   ============================================ */

/* Hero Icons (Hook Slides) */
.lesson-hero-icon {
    font-size: 80px;
    margin-bottom: 36px;
}

.lesson-hero-icon--medium {
    font-size: 70px;
    margin-bottom: 28px;
}

.lesson-hero-icon--small {
    font-size: 48px;
}

/* Hero Icon Color Modifiers */
.lesson-hero-icon--blue {
    color: var(--accent-blue);
}

.lesson-hero-icon--purple {
    color: var(--accent-purple);
}

.lesson-hero-icon--red {
    color: var(--accent-red);
}

.lesson-hero-icon--dark-red {
    color: var(--accent-dark-red);
}

.lesson-hero-icon--orange {
    color: var(--accent-orange);
}

.lesson-hero-icon--green {
    color: var(--accent-green);
}

.lesson-hero-icon--teal {
    color: var(--accent-teal);
}

.lesson-hero-icon--warning {
    color: var(--warning-orange);
}

/* ============================================
   HOOK/COMPLETION SLIDE UTILITIES (Phase 8)
   ============================================ */

/* Hook Slide Container - Centered content wrapper */
.lesson-hook-container {
    text-align: center;
    padding: 40px 20px;
}

/* Large Icon/Emoji for Hook Slides */
.lesson-hook-icon {
    font-size: 80px;
    margin-bottom: 36px;
}

/* Main Hook Heading - Large centered text */
.lesson-hook-heading {
    font-size: 28px;
    line-height: 1.8;
    color: var(--text-primary);
    max-width: 700px;
    margin: 0 auto;
    font-weight: 300;
}

/* Hook Subheading - Secondary message */
.lesson-hook-subheading {
    font-size: 22px;
    margin-top: 36px;
    color: var(--text-secondary);
    font-weight: 300;
}

/* Centered Content Containers */
.lesson-center {
    text-align: center;
    padding: 40px 20px;
}

.lesson-center--compact {
    text-align: center;
    padding: 30px 20px;
}

/* Content Containers */
.lesson-container {
    max-width: 800px;
    margin: 0 auto;
}

.lesson-container--lg {
    max-width: 900px;
    margin: 0 auto;
}

.lesson-container--padded {
    max-width: 900px;
    margin: 0 auto;
    padding: 30px 20px;
}

/* Card Containers (for tables, content blocks) */
.lesson-card {
    background: var(--surface);
    border-radius: 12px;
    border: 2px solid var(--border-light);
    padding: 16px;
}

@media (min-width: 768px) {
    .lesson-card {
        padding: 24px;
    }
}

.lesson-hero-section {
    text-align: center;
    padding: 30px 20px;
}

.lesson-feature-item {
    margin: 16px 0;
}

/* Headings */
.lesson-heading-xl {
    font-size: 28px;
    line-height: 1.8;
    color: var(--text-heading);
    max-width: 700px;
    margin: 0 auto;
    font-weight: 300;
}

.lesson-section-heading {
    font-size: 28px;
    margin-bottom: 24px;
    font-weight: 300;
}

/* Subsection headings (h3) - smaller than section headings */
.lesson-subsection-heading {
    font-size: 22px;
    margin-bottom: 16px;
    font-weight: 300;
}

.lesson-subsection-heading--lg {
    font-size: 22px;
}

.lesson-subsection-heading--md {
    font-size: 20px;
}

.lesson-subsection-heading--sm {
    font-size: 18px;
    margin-bottom: 10px;
}

/* Color modifiers for subsection headings */
.lesson-subsection-heading--blue {
    color: var(--heading-blue);
}

.lesson-subsection-heading--red {
    color: var(--accent-red);
}

.lesson-heading-lg {
    font-size: 26px;
    line-height: 1.6;
    color: var(--text-heading);
    max-width: 700px;
    margin: 0 auto;
    font-weight: 300;
}

.lesson-heading-md {
    font-size: 22px;
    color: var(--text-heading);
    font-weight: 600;
}

.lesson-heading-sm {
    font-size: 20px;
    color: var(--text-heading);
    font-weight: 600;
}

/* Body Text */
.lesson-text-xl {
    font-size: 22px;
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: 32px;
    font-weight: 300;
}

.lesson-text-lg {
    font-size: 20px;
    color: var(--text-primary);
    font-weight: 300;
}

.lesson-hero-lead {
    font-size: 26px;
    line-height: 1.6;
    color: var(--text-primary);
    max-width: 700px;
    margin: 0 auto;
    font-weight: 300;
}

.lesson-hero-subtext {
    font-size: 20px;
    margin-top: 28px;
    color: var(--text-secondary);
    font-weight: 300;
}

.lesson-text-md {
    font-size: 19px;
    color: var(--text-primary);
    margin: 0;
    font-weight: 300;
}

.lesson-text-sm {
    font-size: 17px;
    color: var(--text-primary);
    font-weight: 300;
}

.lesson-text-muted {
    font-size: 22px;
    margin-top: 36px;
    color: var(--text-secondary);
    font-weight: 300;
}

.lesson-text-secondary {
    color: var(--text-secondary);
    font-weight: 300;
}

/* Callout Boxes (Info Boxes with Accent Border) */
.lesson-callout {
    background: var(--surface-muted);
    padding: 28px 32px;
    border-radius: 8px;
    border-left: 4px solid var(--accent-blue);
}

.lesson-callout--info {
    border-left-color: var(--accent-blue);
}

.lesson-callout--warning {
    background: var(--warning-bg);
    border-left-color: var(--warning-orange);
}

.lesson-callout--success {
    background: #d5f4e6;
    border-left-color: var(--accent-green);
}

.lesson-callout--danger {
    background: #fef5e7;
    border-left-color: var(--accent-red);
}

/* Callout Border Color Variants (Removes inline styles from JS templates) */
.lesson-callout--purple {
    border-left-color: var(--accent-purple);
}

.lesson-callout--orange {
    border-left-color: var(--accent-orange);
}

.lesson-callout--red {
    border-left-color: var(--accent-red);
}

.lesson-callout--blue {
    border-left-color: var(--accent-blue);
}

.lesson-callout--green {
    border-left-color: var(--accent-green);
}

.lesson-callout--teal {
    border-left-color: var(--accent-teal);
}

.lesson-callout h4 {
    margin: 0 0 18px 0;
    color: var(--text-primary);
    font-size: 22px;
    font-weight: 600;
}

.lesson-callout h3 {
    margin: 0 0 16px 0;
    color: var(--text-primary);
    font-size: 22px;
    font-weight: 600;
}

/* Info Boxes (White Boxes with Border) */
.lesson-info-box {
    margin-top: 28px;
    padding: 24px;
    background: var(--surface);
    border-radius: 8px;
    border: 2px solid var(--surface-muted);
}

.lesson-info-box p {
    font-size: 19px;
    color: var(--text-primary);
    margin: 0;
    font-weight: 300;
}

/* Lists */
.lesson-list {
    margin: 0;
    padding-left: 28px;
    line-height: 2.2;
    color: var(--text-primary);
    font-size: 19px;
    font-weight: 300;
}

.lesson-list--clean {
    list-style: none;
    padding: 0;
}

/* Inline Code Pills */
.lesson-code-inline {
    background: var(--surface-muted);
    padding: 4px 10px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 18px;
}

.lesson-code-inline--lg {
    background: var(--surface-muted);
    padding: 4px 12px;
    border-radius: 4px;
    color: var(--accent-blue);
    font-family: 'Courier New', monospace;
    font-size: 20px;
}

.lesson-code-inline--md {
    background: var(--surface);
    padding: 4px 10px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 18px;
}

.lesson-code-inline--box-lg {
    background: var(--surface);
    padding: 4px 10px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 18px;
}

.lesson-code-inline--box-sm {
    background: var(--surface);
    padding: 2px 8px;
    border-radius: 3px;
}

/* Inline Code Color Variants (Removes inline styles from JS templates) */
.lesson-code-inline--accent {
    color: var(--accent-orange);
}

.lesson-code-inline--result {
    color: var(--accent-green);
}

.lesson-code-inline--comment {
    color: var(--text-secondary);
}

.lesson-code-inline--purple {
    color: var(--accent-purple);
}

/* Standalone Inline Code (for emphasized code snippets) */
.lesson-inline-code {
    background: var(--surface-muted);
    padding: 4px 12px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 18px;
}

.lesson-inline-code--orange {
    color: var(--accent-orange);
}

/* Emphasis Color Variants (Removes inline styles from JS templates) */
.lesson-emphasis {
    font-weight: inherit;
}

.lesson-emphasis--red {
    color: var(--accent-red);
}

.lesson-emphasis--blue {
    color: var(--accent-blue);
}

.lesson-emphasis--purple {
    color: var(--accent-purple);
}

.lesson-emphasis--orange {
    color: var(--accent-orange);
}

.lesson-emphasis--green {
    color: var(--accent-green);
}

.lesson-emphasis--teal {
    color: var(--accent-teal);
}

/* ============================================
   LESSON TABLES (BEM Structure)
   Complex data tables for lesson content
   ============================================ */

/* Base table component */
.lesson-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 16px;
}

/* Table header row */
.lesson-table__header {
    background: var(--table-header-bg);
    color: white;
}

/* Table header cells */
.lesson-table__th {
    padding: 16px;
    text-align: left;
    border: 1px solid var(--step-border-gray);
}

.lesson-table__th--center {
    text-align: center;
}

/* Table data rows */
.lesson-table__row {
    /* Base row, no background */
}

.lesson-table__row--striped {
    background: var(--surface-muted);
}

/* Table data cells */
.lesson-table__td {
    padding: 12px;
    border: 1px solid var(--step-border-gray);
}

.lesson-table__td--center {
    text-align: center;
}

.lesson-table__td--highlight {
    background: var(--step-bg-green);
    font-weight: bold;
}

/* ============================================
   MOBILE RESPONSIVE OVERRIDES
   ============================================ */

/* Mobile/Tablet: Fix height-locking and enable scrolling */
@media (max-width: 768px) {
    .lesson-modal-content {
        /* Flexible height, constrained by viewport */
        height: auto;
        max-height: 90vh;
        /* SCROLL MODEL: Card is the scroll container */
        overflow-x: hidden;      /* Explicit: no horizontal scroll */
        overflow-y: auto;        /* Explicit: vertical scroll */
        /* Reduce padding to give more space for content */
        padding: 16px;
        width: 95%;
    }

    .lesson-slide {
        /* Slide doesn't scroll - card scrolls instead */
        overflow: visible;
        /* Remove height constraint - slide sizes to content */
        max-height: none;
        /* Reduce bottom padding */
        padding: 0 0 20px 0;
    }

    .lesson-header {
        margin-bottom: 12px;
        padding-bottom: 12px;
    }

    .lesson-title {
        font-size: 22px;
    }

    /* Adjust slide content for mobile readability */
    .slide-title {
        font-size: 24px;
        margin-bottom: 12px;
    }

    .slide-description {
        font-size: 16px;
        margin-bottom: 20px;
    }

    .lesson-surface {
        padding: 20px;
        margin: 8px 0;
    }

    /* Make nav buttons smaller on mobile */
    .lesson-nav-btn {
        width: 48px;
        height: 48px;
        font-size: 24px;
    }

    .lesson-nav-btn:first-of-type {
        left: 10px;
    }

    .lesson-nav-btn:last-of-type {
        right: 10px;
    }

    /* POLISH: Fix mistake grid overflow on mobile */
    .mistake-grid {
        grid-template-columns: 1fr; /* Single column on mobile */
        gap: 15px;
    }

    /* POLISH: Target specific overflow culprits, not universal selector */
    .mistake-grid,
    .lesson-surface,
    .lesson-callout,
    .lesson-info-box,
    .slide-code-container,
    .lesson-surface--inset,
    .checkpoint-list li {
        max-width: 100%;
        box-sizing: border-box;
    }

    /* FIX: Extend overflow-wrap to ALL prose containers, not just the
       original four. Headings and callout wrappers were omitted in the
       first pass; long words in these elements could still push the modal
       wider than the viewport. Code elements deliberately excluded —
       they use overflow-x:auto instead so Python syntax stays readable. */
    .lesson-surface,
    .slide-description,
    .lesson-text-md,
    .lesson-text-lg,
    .lesson-hook-heading,
    .lesson-heading-xl,
    .lesson-heading-lg,
    .lesson-heading-md,
    .lesson-callout {
        overflow-wrap: anywhere;
    }

    /* POLISH: Code blocks scroll horizontally if needed */
    .slide-code-container,
    .lesson-surface--inset {
        overflow-x: auto;
    }

    /* POLISH: Scope contrast fix to specific elements that need it */
    .lesson-callout p {
        color: var(--text-primary);
        opacity: 0.9;
    }
}
