/* =========================================================
   PYLEARN — LEVEL COURSE PAGES
   Intermediate Learning Interface
========================================================= */


/* =========================================================
   LEVEL PAGE FOUNDATION
========================================================= */

.level-page {
    min-height: 100vh;
    background: var(--bg);
}


/* =========================================================
   LEVEL HERO
========================================================= */

.level-hero {
    padding: 90px 20px 70px;

    background:
        linear-gradient(
            135deg,
            rgba(55, 118, 171, 0.12),
            rgba(255, 211, 67, 0.10)
        );

    border-bottom: 1px solid var(--border);
}

.level-hero-container {
    max-width: 1200px;
    margin: 0 auto;
}

.back-home {
    display: inline-flex;
    align-items: center;
    gap: 9px;

    margin-bottom: 34px;

    color: var(--text);
    text-decoration: none;

    font-size: 14px;
    font-weight: 700;

    transition: color 0.2s ease,
                transform 0.2s ease;
}

.back-home:hover {
    color: var(--primary);
    transform: translateX(-3px);
}

.level-badge {
    display: inline-flex;
    align-items: center;
    gap: 9px;

    padding: 8px 15px;

    border-radius: 30px;

    background: var(--primary);
    color: #ffffff;

    font-size: 12px;
    font-weight: 800;

    letter-spacing: 0.8px;
}

.level-hero h1 {
    margin: 20px 0 18px;

    max-width: 850px;

    font-size: clamp(40px, 6vw, 68px);
    line-height: 1.02;
    letter-spacing: -2px;

    color: var(--heading);
}

.level-hero h1 span {
    color: var(--primary);
}

.level-hero p {
    max-width: 780px;

    margin: 0;

    color: var(--text-muted);

    font-size: 18px;
    line-height: 1.8;
}


/* =========================================================
   COURSE LAYOUT
========================================================= */

.level-layout {
    max-width: 1250px;

    margin: 0 auto;
    padding: 55px 20px 100px;

    display: grid;
    grid-template-columns: 285px minmax(0, 1fr);

    gap: 45px;
    align-items: start;
}


/* =========================================================
   LESSON SIDEBAR
========================================================= */

.lesson-sidebar {
    position: sticky;
    top: 100px;

    padding: 24px;

    border: 1px solid var(--border);
    border-radius: 18px;

    background: var(--surface);
    box-shadow: var(--shadow);

    z-index: 5;
}

.lesson-sidebar h3 {
    margin: 0 0 18px;

    color: var(--heading);

    font-size: 17px;
    font-weight: 800;
}

.lesson-sidebar ul {
    list-style: none;

    margin: 0;
    padding: 0;
}

.lesson-sidebar li {
    margin: 3px 0;
}

.lesson-sidebar a {
    display: flex;
    align-items: flex-start;
    gap: 10px;

    padding: 10px 11px;

    border-radius: 9px;

    color: var(--text);
    text-decoration: none;

    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;

    transition:
        background 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

.lesson-sidebar a:hover {
    background: rgba(55, 118, 171, 0.10);

    color: var(--primary);

    transform: translateX(3px);
}

.lesson-sidebar .number {
    flex-shrink: 0;

    min-width: 24px;

    color: var(--primary);

    font-size: 12px;
    font-weight: 800;
}


/* =========================================================
   COURSE PROGRESS
========================================================= */

.level-progress {
    margin-top: 22px;
    padding-top: 20px;

    border-top: 1px solid var(--border);
}

.progress-top {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 9px;

    color: var(--text-muted);

    font-size: 12px;
    font-weight: 700;
}

.progress-track {
    width: 100%;
    height: 7px;

    overflow: hidden;

    border-radius: 50px;

    background: var(--border);
}

.progress-fill {
    width: 0%;
    height: 100%;

    border-radius: inherit;

    background:
        linear-gradient(
            90deg,
            var(--primary),
            #4f8fc5
        );

    transition: width 0.35s ease;
}


/* =========================================================
   MAIN COURSE CONTENT
========================================================= */

.level-content {
    min-width: 0;
}


/* =========================================================
   INDIVIDUAL LESSON
========================================================= */

.lesson-section {
    scroll-margin-top: 105px;

    margin-bottom: 50px;
    padding: 38px;

    border: 1px solid var(--border);
    border-radius: 20px;

    background: var(--surface);

    box-shadow: var(--shadow);

    transition:
        border-color 0.25s ease,
        box-shadow 0.25s ease;
}

.lesson-section:hover {
    border-color: rgba(55, 118, 171, 0.35);
}

.lesson-number {
    display: inline-block;

    margin-bottom: 12px;

    color: var(--primary);

    font-size: 12px;
    font-weight: 800;

    letter-spacing: 1.2px;
    text-transform: uppercase;
}

.lesson-section h2 {
    margin: 0 0 18px;

    color: var(--heading);

    font-size: clamp(28px, 4vw, 40px);
    line-height: 1.15;
    letter-spacing: -0.7px;
}

.lesson-section h3 {
    margin: 34px 0 12px;

    color: var(--heading);

    font-size: 21px;
    line-height: 1.3;
}

.lesson-section h4 {
    margin: 25px 0 10px;

    color: var(--heading);

    font-size: 17px;
}

.lesson-section p {
    margin: 0 0 17px;

    color: var(--text);

    font-size: 15px;
    line-height: 1.85;
}

.lesson-section ul,
.lesson-section ol {
    margin: 15px 0 22px;
    padding-left: 23px;

    color: var(--text);

    font-size: 15px;
    line-height: 1.85;
}

.lesson-section li {
    margin-bottom: 6px;
}

.lesson-section strong {
    color: var(--heading);
}


/* =========================================================
   INTRO / INFORMATION BOX
========================================================= */

.info-box {
    margin: 25px 0;

    padding: 20px 22px;

    border-left: 4px solid var(--primary);
    border-radius: 10px;

    background:
        rgba(55, 118, 171, 0.08);

    color: var(--text);

    font-size: 14px;
    line-height: 1.75;
}

.info-box strong {
    display: block;

    margin-bottom: 6px;

    color: var(--heading);
}


/* =========================================================
   IMPORTANT CONCEPT BOX
========================================================= */

.concept-box {
    margin: 25px 0;

    padding: 22px;

    border: 1px solid var(--border);
    border-radius: 13px;

    background: var(--bg-secondary);
}

.concept-box-title {
    display: flex;
    align-items: center;
    gap: 9px;

    margin-bottom: 10px;

    color: var(--primary);

    font-size: 13px;
    font-weight: 800;

    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.concept-box p:last-child {
    margin-bottom: 0;
}


/* =========================================================
   CODE EXAMPLES
========================================================= */

.code-example {
    margin: 25px 0;

    overflow: hidden;

    border: 1px solid #273244;
    border-radius: 13px;

    background: #111827;

    box-shadow:
        0 10px 25px rgba(0, 0, 0, 0.10);
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    min-height: 44px;
    padding: 0 15px;

    background: #1f2937;

    border-bottom: 1px solid #303b4d;

    color: #d1d5db;

    font-size: 12px;
    font-weight: 700;
}

.copy-code {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    padding: 6px 9px;

    border: 0;
    border-radius: 6px;

    background: transparent;

    color: #d1d5db;

    cursor: pointer;

    font-size: 12px;
    font-weight: 700;

    transition:
        background 0.2s ease,
        color 0.2s ease;
}

.copy-code:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.code-example pre {
    margin: 0;

    padding: 22px;

    overflow-x: auto;

    color: #f9fafb;

    font-family:
        "Consolas",
        "Monaco",
        "Courier New",
        monospace;

    font-size: 14px;
    line-height: 1.75;

    tab-size: 4;
}

.code-example code {
    font-family: inherit;
}


/* =========================================================
   OUTPUT BOX
========================================================= */

.output-box {
    margin: 20px 0 25px;

    border: 1px solid var(--border);
    border-radius: 12px;

    overflow: hidden;

    background: var(--bg-secondary);
}

.output-title {
    padding: 10px 15px;

    border-bottom: 1px solid var(--border);

    color: var(--primary);

    font-size: 11px;
    font-weight: 800;

    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.output-box pre {
    margin: 0;

    padding: 16px;

    overflow-x: auto;

    color: var(--text);

    font-family:
        "Consolas",
        "Monaco",
        monospace;

    font-size: 14px;
    line-height: 1.7;
}


/* =========================================================
   PRACTICE BOX
========================================================= */

.practice-box {
    margin-top: 30px;

    padding: 24px;

    border: 1px solid var(--border);
    border-radius: 14px;

    background:
        linear-gradient(
            135deg,
            rgba(255, 211, 67, 0.10),
            rgba(55, 118, 171, 0.07)
        );
}

.practice-box h3 {
    margin-top: 0;

    display: flex;
    align-items: center;
    gap: 9px;
}

.practice-box h3::before {
    content: "✦";

    color: var(--primary);

    font-size: 18px;
}

.practice-box p:last-child {
    margin-bottom: 0;
}


/* =========================================================
   CHALLENGE BOX
========================================================= */

.challenge-box {
    margin-top: 28px;

    padding: 24px;

    border: 1px solid rgba(255, 211, 67, 0.35);
    border-radius: 14px;

    background:
        linear-gradient(
            135deg,
            rgba(255, 211, 67, 0.13),
            rgba(255, 255, 255, 0.02)
        );
}

.challenge-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 38px;
    height: 38px;

    margin-bottom: 12px;

    border-radius: 10px;

    background: var(--primary);
    color: #ffffff;
}

.challenge-box h3 {
    margin-top: 0;
}


/* =========================================================
   LESSON FOOTER
========================================================= */

.lesson-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    margin-top: 35px;
    padding-top: 23px;

    border-top: 1px solid var(--border);

    color: var(--text-muted);

    font-size: 13px;
    font-weight: 600;
}

.complete-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    padding: 11px 18px;

    border: 1px solid var(--primary);
    border-radius: 9px;

    background: var(--primary);
    color: #ffffff;

    font-size: 13px;
    font-weight: 700;

    cursor: pointer;

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}

.complete-button:hover {
    transform: translateY(-2px);

    box-shadow:
        0 7px 18px rgba(55, 118, 171, 0.22);
}

.complete-button.completed {
    border-color: #198754;

    background: #198754;
}


/* =========================================================
   PREVIOUS / NEXT NAVIGATION
========================================================= */

.lesson-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    margin-top: 10px;
}

.lesson-navigation a {
    display: inline-flex;
    align-items: center;
    gap: 9px;

    padding: 12px 18px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: var(--surface);
    color: var(--text);

    text-decoration: none;

    font-size: 13px;
    font-weight: 700;

    transition:
        color 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.lesson-navigation a:hover {
    color: var(--primary);

    border-color: var(--primary);

    transform: translateY(-2px);

    box-shadow:
        0 7px 18px rgba(55, 118, 171, 0.10);
}


/* =========================================================
   ACTIVE LESSON
========================================================= */

.lesson-sidebar a.active {
    background: rgba(55, 118, 171, 0.12);

    color: var(--primary);
}

.lesson-sidebar a.active .number {
    color: var(--primary);
}


/* =========================================================
   DARK MODE
========================================================= */

body.dark-mode .level-hero {
    background:
        linear-gradient(
            135deg,
            rgba(55, 118, 171, 0.18),
            rgba(255, 211, 67, 0.06)
        );
}

body.dark-mode .lesson-section:hover {
    border-color: rgba(55, 118, 171, 0.55);
}

body.dark-mode .code-example {
    box-shadow:
        0 15px 35px rgba(0, 0, 0, 0.25);
}

body.dark-mode .practice-box {
    background:
        linear-gradient(
            135deg,
            rgba(255, 211, 67, 0.08),
            rgba(55, 118, 171, 0.08)
        );
}


/* =========================================================
   TABLET
========================================================= */

@media (max-width: 950px) {

    .level-layout {
        grid-template-columns: 245px minmax(0, 1fr);

        gap: 30px;
    }

    .lesson-sidebar {
        padding: 20px;
    }

    .lesson-section {
        padding: 30px;
    }

}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 760px) {

    .level-hero {
        padding: 65px 18px 55px;
    }

    .level-hero h1 {
        letter-spacing: -1.3px;
    }

    .level-hero p {
        font-size: 16px;
        line-height: 1.7;
    }

    .level-layout {
        display: block;

        padding: 40px 15px 70px;
    }

    .lesson-sidebar {
        position: relative;
        top: auto;

        margin-bottom: 30px;
    }

    .lesson-sidebar ul {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 4px;
    }

    .lesson-sidebar a {
        height: 100%;
    }

    .lesson-section {
        margin-bottom: 30px;
        padding: 25px 20px;

        border-radius: 16px;
    }

    .lesson-section h2 {
        font-size: 29px;
    }

    .lesson-section h3 {
        font-size: 19px;
    }

    .lesson-section p,
    .lesson-section ul,
    .lesson-section ol {
        font-size: 14px;
    }

    .code-example pre {
        padding: 17px;

        font-size: 13px;
    }

    .lesson-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .complete-button {
        width: 100%;
    }

    .lesson-navigation {
        flex-direction: column;
        align-items: stretch;
    }

    .lesson-navigation a {
        justify-content: center;
    }

}


/* =========================================================
   SMALL MOBILE
========================================================= */

@media (max-width: 430px) {

    .level-hero {
        padding: 55px 15px 45px;
    }

    .level-layout {
        padding-left: 12px;
        padding-right: 12px;
    }

    .lesson-sidebar ul {
        grid-template-columns: 1fr;
    }

    .lesson-section {
        padding: 22px 17px;
    }

    .lesson-section h2 {
        font-size: 26px;
    }

    .code-header {
        padding: 0 11px;
    }

    .code-example pre {
        padding: 15px;

        font-size: 12px;
    }

    .info-box,
    .practice-box,
    .challenge-box {
        padding: 18px;
    }

}
```css
/* =========================================================
   PYLEARN LESSON PAGE — PROFESSIONAL FORMATTING OVERRIDES
   Add this section at the END of lesson.css
========================================================= */


/* =========================================================
   PAGE FOUNDATION
========================================================= */

.lesson-page {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: #f7f9fc;
    color: #1f2937;
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
    line-height: 1.75;
}

.lesson-page * {
    box-sizing: border-box;
}


/* =========================================================
   TOP BAR
========================================================= */

.lesson-topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid #e5e7eb;
    backdrop-filter: blur(12px);
}

.lesson-topbar-inner {
    width: min(1440px, calc(100% - 48px));
    min-height: 72px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.lesson-brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: #111827;
    text-decoration: none;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.4px;
}

.lesson-brand-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: #3776ab;
    color: #ffffff;
    font-size: 1.3rem;
}

.lesson-top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lesson-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: 9px;
    color: #4b5563;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.lesson-nav-link:hover {
    background: #eef3f8;
    color: #111827;
}

.lesson-icon-btn {
    width: 40px;
    height: 40px;
    border: 1px solid #e5e7eb;
    border-radius: 9px;
    background: #ffffff;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lesson-icon-btn:hover {
    background: #f1f5f9;
    transform: translateY(-1px);
}


/* =========================================================
   MAIN LAYOUT
========================================================= */

.lesson-layout {
    width: min(1440px, calc(100% - 48px));
    margin: 0 auto;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 48px;
    align-items: start;
}


/* =========================================================
   SIDEBAR
========================================================= */

.lesson-sidebar {
    position: sticky;
    top: 96px;
    height: calc(100vh - 116px);
    padding: 32px 0;
    overflow-y: auto;
    scrollbar-width: thin;
}

.sidebar-label {
    margin-bottom: 6px;
    color: #3776ab;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

.sidebar-title {
    margin-bottom: 20px;
    color: #111827;
    font-size: 1.05rem;
    font-weight: 800;
}

.lesson-toc {
    margin: 0;
    padding: 0;
    list-style: none;
}

.lesson-toc li {
    margin: 2px 0;
}

.lesson-toc a {
    display: block;
    padding: 8px 12px;
    border-left: 2px solid transparent;
    border-radius: 0 7px 7px 0;
    color: #6b7280;
    text-decoration: none;
    font-size: 0.87rem;
    line-height: 1.4;
    transition: all 0.2s ease;
}

.lesson-toc a:hover {
    background: #eef4f9;
    color: #3776ab;
}

.lesson-toc a.active {
    border-left-color: #3776ab;
    background: #eaf2f8;
    color: #3776ab;
    font-weight: 700;
}


/* =========================================================
   CONTENT AREA
========================================================= */

.lesson-content {
    width: 100%;
    max-width: 920px;
    padding: 40px 0 80px;
}

.lesson-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
    margin-bottom: 26px;
    color: #9ca3af;
    font-size: 0.78rem;
}

.lesson-breadcrumb a {
    color: #3776ab;
    text-decoration: none;
    font-weight: 700;
}

.lesson-breadcrumb i {
    font-size: 0.62rem;
}


/* =========================================================
   LESSON HEADER
========================================================= */

.lesson-header {
    margin-bottom: 32px;
    padding-bottom: 30px;
    border-bottom: 1px solid #e5e7eb;
}

.lesson-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 13px;
    padding: 7px 11px;
    border: 1px solid #dbe8f2;
    border-radius: 7px;
    background: #edf5fa;
    color: #3776ab;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.lesson-header h1 {
    margin: 0 0 16px;
    color: #111827;
    font-size: clamp(2.3rem, 5vw, 4rem);
    font-weight: 850;
    line-height: 1.08;
    letter-spacing: -2px;
}

.lesson-intro {
    max-width: 780px;
    margin: 0 0 22px;
    color: #5b6472;
    font-size: 1.08rem;
    line-height: 1.8;
}

.lesson-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.lesson-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 11px;
    border: 1px solid #e5e7eb;
    border-radius: 7px;
    background: #ffffff;
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 600;
}

.lesson-meta-item i {
    color: #3776ab;
}


/* =========================================================
   READING PROGRESS
========================================================= */

.lesson-progress {
    margin: 0 0 34px;
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #ffffff;
}

.lesson-progress-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 9px;
}

.lesson-progress-label {
    color: #6b7280;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
}

.lesson-progress-value {
    color: #3776ab;
    font-size: 0.8rem;
    font-weight: 800;
}

.lesson-progress-track {
    width: 100%;
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: #e5e7eb;
}

.lesson-progress-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #3776ab;
    transition: width 0.3s ease;
}


/* =========================================================
   OBJECTIVES CARD
========================================================= */

.objectives-card {
    margin-bottom: 42px;
    padding: 28px;
    border: 1px solid #dce7ef;
    border-radius: 14px;
    background: #eef6fb;
}

.objectives-card h2 {
    margin: 0 0 20px;
    color: #172033;
    font-size: 1.35rem;
    line-height: 1.3;
}

.objectives-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px 24px;
}

.objective {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    color: #4b5563;
    font-size: 0.9rem;
    line-height: 1.6;
}

.objective i {
    flex: 0 0 auto;
    width: 21px;
    height: 21px;
    margin-top: 2px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #3776ab;
    color: #ffffff;
    font-size: 0.65rem;
}


/* =========================================================
   LESSON SECTIONS
========================================================= */

.lesson-section {
    margin: 0 0 54px;
    scroll-margin-top: 100px;
}

.lesson-section h2 {
    margin: 0 0 18px;
    color: #111827;
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.6px;
}

.lesson-section h3 {
    margin: 30px 0 10px;
    color: #1f2937;
    font-size: 1.18rem;
    font-weight: 750;
    line-height: 1.35;
}

.lesson-section p {
    margin: 0 0 17px;
    color: #4b5563;
    font-size: 0.98rem;
    line-height: 1.85;
}

.lesson-section ul,
.lesson-section ol {
    margin: 15px 0 22px;
    padding-left: 24px;
    color: #4b5563;
}

.lesson-section li {
    margin-bottom: 9px;
    padding-left: 4px;
    line-height: 1.75;
}

.lesson-section strong {
    color: #1f2937;
}

.lesson-section code:not(pre code) {
    padding: 2px 6px;
    border-radius: 5px;
    background: #eef2f6;
    color: #b42318;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 0.88em;
}


/* =========================================================
   INFO / WARNING / SUCCESS CARDS
========================================================= */

.info-card {
    margin: 24px 0;
    padding: 20px 22px;
    border-left: 4px solid #3776ab;
    border-radius: 0 10px 10px 0;
    background: #f0f6fa;
}

.info-card.warning {
    border-left-color: #d97706;
    background: #fff8eb;
}

.info-card.success {
    border-left-color: #16a34a;
    background: #f0fdf4;
}

.info-card-title {
    margin-bottom: 7px;
    color: #1f2937;
    font-size: 0.9rem;
    font-weight: 800;
}

.info-card p {
    margin: 0;
    font-size: 0.9rem;
}


/* =========================================================
   CODE BLOCKS
========================================================= */

.code-card {
    margin: 24px 0;
    overflow: hidden;
    border: 1px solid #263241;
    border-radius: 12px;
    background: #111827;
    box-shadow: 0 8px 25px rgba(15, 23, 42, 0.08);
}

.code-card-header {
    min-height: 42px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #263241;
    background: #182230;
}

.code-language {
    color: #94a3b8;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.copy-code {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 0;
    background: transparent;
    color: #cbd5e1;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    transition: color 0.2s ease;
}

.copy-code:hover {
    color: #ffffff;
}

.code-card pre {
    margin: 0;
    padding: 20px;
    overflow-x: auto;
    color: #e5e7eb;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 0.86rem;
    line-height: 1.7;
    tab-size: 4;
}

.code-card code {
    font-family: inherit;
}


/* =========================================================
   OUTPUT
========================================================= */

.output-card {
    margin: 20px 0 25px;
    overflow: hidden;
    border: 1px solid #dbe2e8;
    border-radius: 10px;
    background: #ffffff;
}

.output-header {
    padding: 9px 14px;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.output-body {
    padding: 16px;
    color: #1f2937;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 0.88rem;
    white-space: pre-wrap;
}


/* =========================================================
   TABLES
========================================================= */

.lesson-table-wrapper {
    width: 100%;
    margin: 25px 0;
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
}

.lesson-table {
    width: 100%;
    min-width: 580px;
    border-collapse: collapse;
}

.lesson-table th,
.lesson-table td {
    padding: 13px 15px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: top;
    font-size: 0.88rem;
}

.lesson-table th {
    background: #f8fafc;
    color: #334155;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.lesson-table td {
    color: #596474;
}

.lesson-table tbody tr:last-child td {
    border-bottom: 0;
}


/* =========================================================
   EXERCISE CARDS
========================================================= */

.exercise-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin: 25px 0;
}

.exercise-card {
    padding: 20px;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    background: #ffffff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.exercise-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
}

.exercise-number {
    margin-bottom: 10px;
    color: #3776ab;
    font-size: 0.73rem;
    font-weight: 800;
    letter-spacing: 0.7px;
    text-transform: uppercase;
}

.exercise-card p {
    margin: 0;
    font-size: 0.88rem;
}


/* =========================================================
   QUIZ
========================================================= */

.quiz-card {
    margin-top: 25px;
    padding: 24px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
}

.quiz-question {
    padding: 0 0 25px;
    margin-bottom: 25px;
    border-bottom: 1px solid #e5e7eb;
}

.quiz-question:last-child {
    padding-bottom: 0;
    margin-bottom: 0;
    border-bottom: 0;
}

.quiz-question > strong {
    display: block;
    margin-bottom: 15px;
    color: #1f2937;
    font-size: 0.96rem;
    line-height: 1.6;
}

.quiz-options {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.quiz-option {
    padding: 9px 14px;
    border: 1px solid #d7dee7;
    border-radius: 7px;
    background: #ffffff;
    color: #475569;
    font-size: 0.82rem;
    font-weight: 650;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quiz-option:hover {
    border-color: #3776ab;
    color: #3776ab;
    background: #f3f8fc;
}

.quiz-option.correct {
    border-color: #16a34a;
    background: #f0fdf4;
    color: #15803d;
}

.quiz-option.incorrect {
    border-color: #dc2626;
    background: #fef2f2;
    color: #b91c1c;
}


/* =========================================================
   COMPLETION
========================================================= */

.lesson-completion {
    margin: 65px 0 35px;
    padding: 35px;
    border: 1px solid #dbe5ed;
    border-radius: 14px;
    background: #eef5f9;
    text-align: center;
}

.lesson-completion h2 {
    margin: 0 0 8px;
    color: #172033;
    font-size: 1.55rem;
}

.lesson-completion p {
    max-width: 600px;
    margin: 0 auto 20px;
    color: #64748b;
    font-size: 0.9rem;
}

.complete-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    border: 0;
    border-radius: 8px;
    background: #3776ab;
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 750;
    cursor: pointer;
    transition: all 0.2s ease;
}

.complete-button:hover {
    transform: translateY(-1px);
    background: #2f6694;
    box-shadow: 0 6px 18px rgba(55, 118, 171, 0.2);
}

.complete-button.completed {
    background: #16a34a;
}


/* =========================================================
   PREVIOUS / NEXT
========================================================= */

.lesson-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 35px;
    padding-top: 28px;
    border-top: 1px solid #e5e7eb;
}

.lesson-next-link {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    padding: 17px 18px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
    color: #1f2937;
    text-decoration: none;
    transition: all 0.2s ease;
}

.lesson-next-link:hover {
    border-color: #b9ccdc;
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(15, 23, 42, 0.06);
}

.lesson-next-link.next {
    text-align: right;
    align-items: flex-end;
}

.lesson-next-label {
    color: #94a3b8;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.7px;
    text-transform: uppercase;
}

.lesson-next-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #3776ab;
    font-size: 0.88rem;
    font-weight: 750;
}


/* =========================================================
   DARK MODE
========================================================= */

body.dark-mode.lesson-page {
    background: #0f172a;
    color: #e5e7eb;
}

body.dark-mode .lesson-topbar {
    background: rgba(15, 23, 42, 0.96);
    border-color: #1e293b;
}

body.dark-mode .lesson-brand,
body.dark-mode .sidebar-title,
body.dark-mode .lesson-header h1,
body.dark-mode .lesson-section h2,
body.dark-mode .lesson-section h3,
body.dark-mode .lesson-section strong,
body.dark-mode .objectives-card h2,
body.dark-mode .lesson-completion h2,
body.dark-mode .quiz-question > strong {
    color: #f8fafc;
}

body.dark-mode .lesson-nav-link {
    color: #cbd5e1;
}

body.dark-mode .lesson-nav-link:hover,
body.dark-mode .lesson-toc a:hover {
    background: #172033;
    color: #ffffff;
}

body.dark-mode .lesson-icon-btn,
body.dark-mode .lesson-meta-item,
body.dark-mode .lesson-progress,
body.dark-mode .output-card,
body.dark-mode .lesson-table-wrapper,
body.dark-mode .exercise-card,
body.dark-mode .quiz-card,
body.dark-mode .quiz-option,
body.dark-mode .lesson-next-link {
    border-color: #263449;
    background: #172033;
}

body.dark-mode .lesson-intro,
body.dark-mode .lesson-section p,
body.dark-mode .lesson-section ul,
body.dark-mode .lesson-section ol,
body.dark-mode .objective,
body.dark-mode .lesson-table td,
body.dark-mode .exercise-card p,
body.dark-mode .lesson-completion p {
    color: #aeb9c8;
}

body.dark-mode .lesson-header,
body.dark-mode .lesson-navigation,
body.dark-mode .lesson-table td,
body.dark-mode .quiz-question {
    border-color: #263449;
}

body.dark-mode .lesson-meta-item {
    color: #aeb9c8;
}

body.dark-mode .objectives-card,
body.dark-mode .lesson-completion {
    border-color: #263b4e;
    background: #132536;
}

body.dark-mode .info-card {
    background: #142536;
}

body.dark-mode .info-card.warning {
    background: #2b2111;
}

body.dark-mode .info-card.success {
    background: #10251a;
}

body.dark-mode .output-header,
body.dark-mode .lesson-table th {
    background: #111827;
    color: #aeb9c8;
    border-color: #263449;
}

body.dark-mode .output-body {
    color: #e5e7eb;
}

body.dark-mode .lesson-table td {
    border-color: #263449;
}

body.dark-mode .quiz-option {
    color: #cbd5e1;
}

body.dark-mode .quiz-option:hover {
    background: #1c3044;
    color: #ffffff;
}

body.dark-mode .lesson-section code:not(pre code) {
    background: #1e293b;
    color: #fca5a5;
}


/* =========================================================
   RESPONSIVE — TABLET
========================================================= */

@media (max-width: 1050px) {

    .lesson-layout {
        grid-template-columns: 220px minmax(0, 1fr);
        gap: 30px;
    }

    .lesson-header h1 {
        font-size: 2.7rem;
    }

}


/* =========================================================
   RESPONSIVE — MOBILE
========================================================= */

@media (max-width: 800px) {

    .lesson-topbar-inner {
        width: min(100% - 28px, 700px);
        min-height: 64px;
    }

    .lesson-layout {
        width: min(100% - 28px, 700px);
        display: block;
    }

    .lesson-sidebar {
        position: relative;
        top: auto;
        height: auto;
        padding: 22px 0 0;
        overflow: visible;
    }

    .lesson-toc {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 4px;
    }

    .lesson-toc a {
        border-left: 0;
        border-radius: 7px;
        padding: 8px 10px;
        background: #ffffff;
        border: 1px solid #e5e7eb;
    }

    .lesson-content {
        max-width: none;
        padding-top: 28px;
    }

    .objectives-grid,
    .exercise-grid {
        grid-template-columns: 1fr;
    }

}


/* =========================================================
   RESPONSIVE — SMALL MOBILE
========================================================= */

@media (max-width: 560px) {

    .lesson-topbar-inner {
        width: calc(100% - 20px);
    }

    .lesson-brand {
        font-size: 1.15rem;
    }

    .lesson-brand-icon {
        width: 34px;
        height: 34px;
    }

    .lesson-nav-link {
        padding: 8px;
        font-size: 0;
    }

    .lesson-nav-link i {
        font-size: 0.9rem;
    }

    .lesson-layout {
        width: calc(100% - 20px);
    }

    .lesson-header h1 {
        font-size: 2.15rem;
        letter-spacing: -1px;
    }

    .lesson-intro {
        font-size: 0.95rem;
    }

    .lesson-meta {
        display: grid;
        grid-template-columns: 1fr;
    }

    .lesson-meta-item {
        width: 100%;
    }

    .lesson-toc {
        grid-template-columns: 1fr;
    }

    .objectives-card,
    .quiz-card,
    .lesson-completion {
        padding: 20px;
    }

    .lesson-section h2 {
        font-size: 1.45rem;
    }

    .lesson-section h3 {
        font-size: 1.08rem;
    }

    .lesson-section p {
        font-size: 0.93rem;
    }

    .lesson-navigation {
        grid-template-columns: 1fr;
    }

    .lesson-next-link.next {


/* Modern PyLearn visual refresh */
.lesson-page, .level-page { background: var(--bg); color: var(--text); }
.lesson-topbar, .top-navbar { background: rgba(255,255,255,.86); border-bottom: 1px solid var(--border); backdrop-filter: blur(18px); }
body.dark-mode .lesson-topbar, body.dark-mode .top-navbar { background: rgba(9,11,24,.88); }
.lesson-topbar-inner, .nav-container { max-width: 1180px; }
.lesson-brand, .top-navbar .brand { color: var(--heading); font-weight: 800; }
.lesson-brand-icon, .top-navbar .brand-icon { background: linear-gradient(135deg,#7c3aed,#06b6d4); box-shadow: 0 10px 25px rgba(109,40,217,.2); }
.lesson-nav-link, .desktop-navigation a { border-radius: 999px; transition: all .25s ease; }
.lesson-nav-link:hover, .desktop-navigation a:hover { color: #7c3aed; background: #f3e8ff; }
.lesson-icon-btn, .lesson-theme-toggle { border: 1px solid var(--border); background: var(--surface); color: var(--heading); border-radius: 50%; }
.lesson-sidebar { border-color: var(--border); box-shadow: var(--shadow-sm); border-radius: 20px; }
.lesson-sidebar a:hover { background: #f3e8ff; color: #7c3aed; }
.lesson-section { border-color: var(--border); border-radius: 22px; box-shadow: var(--shadow-sm); }
.lesson-section:hover { border-color: rgba(124,58,237,.3); box-shadow: var(--shadow); }
.lesson-section h2, .lesson-section h3, .level-hero h1 { color: var(--heading); }
.lesson-section h2 span, .level-hero h1 span { color: #7c3aed; }
.level-hero { background: linear-gradient(135deg,rgba(124,58,237,.08),rgba(6,182,212,.06)); }
.level-badge { background: linear-gradient(135deg,#7c3aed,#06b6d4); }
.progress-fill { background: linear-gradient(90deg,#7c3aed,#06b6d4); }
.code-card, .output-card, .quiz-card, .objectives-card, .info-card, .exercise-card { border-color: var(--border); box-shadow: var(--shadow-sm); border-radius: 18px; }
.code-card-header, .output-header { background: #10162a; }
.copy-code { background: #7c3aed; color: #fff; border-radius: 8px; }
.complete-button, .complete-lesson-button { background: linear-gradient(135deg,#7c3aed,#4f46e5); color:#fff; border-radius:999px; box-shadow:0 12px 28px rgba(109,40,217,.2); }
.lesson-navigation .lesson-nav-card { border-color: var(--border); border-radius: 18px; transition: transform .25s ease, box-shadow .25s ease; }
.lesson-navigation .lesson-nav-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
@media(max-width:760px){.lesson-sidebar{position:static}.lesson-section{padding:25px}.level-layout{grid-template-columns:1fr}.lesson-layout{display:block}.lesson-sidebar{margin-bottom:25px}}
