/* LearnCode Platform — Main Styles with Dark Mode */

:root {
    --bg: #f8fafc;
    --bg-alt: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --sidebar-bg: #ffffff;
    --code-bg: #282c34;
    --callout-note: #eff6ff;
    --callout-warning: #fef3c7;
    --callout-tip: #ecfdf5;
    --callout-important: #fef2f2;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --radius: 8px;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --bg-alt: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --sidebar-bg: #1e293b;
    --code-bg: #0d1117;
    --callout-note: #1e3a5f;
    --callout-warning: #422006;
    --callout-tip: #064e3b;
    --callout-important: #450a0a;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

/* Header */
.site-header {
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.main-nav a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
}

.main-nav a:hover { color: var(--primary); }

/* Header courses dropdown */
.nav-dropdown-wrap { position: relative; }

.nav-link-btn {
    background: none;
    border: none;
    color: var(--text);
    font-weight: 500;
    font-size: inherit;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.nav-link-btn:hover { color: var(--primary); }
.nav-caret { font-size: 0.65rem; opacity: 0.7; }

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    z-index: 200;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    min-width: 280px;
    max-height: 70vh;
    overflow-y: auto;
}

.nav-dropdown-menu.is-open { display: block; }

.courses-mega-menu {
    width: min(520px, 90vw);
    padding: 0.75rem;
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.5rem 1rem;
}

.courses-mega-menu.is-open { display: grid; }

.courses-menu-group { margin-bottom: 0.5rem; }

.courses-menu-cat {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    padding: 0.35rem 0.5rem;
}

.courses-menu-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.5rem;
    color: var(--text);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.88rem;
}

.courses-menu-item:hover { background: var(--bg); color: var(--primary); }

.courses-menu-all {
    grid-column: 1 / -1;
    display: block;
    padding: 0.6rem 0.5rem;
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    border-top: 1px solid var(--border);
    margin-top: 0.25rem;
}

/* Global search dropdown */
.global-search { position: relative; }

.global-search .search-form {
    position: relative;
    margin: 0;
}

.global-search input {
    width: 220px;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 0.88rem;
}

.global-search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    min-width: 360px;
    max-height: 420px;
    overflow-y: auto;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 300;
}

.gs-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.gs-item:last-child { border-bottom: none; }
.gs-item:hover, .gs-item.gs-active { background: var(--bg); }

.gs-item-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gs-item-icon img { object-fit: contain; }

.gs-item-body { flex: 1; min-width: 0; }

.gs-item-title {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
}

.gs-item-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 0.15rem;
}

.gs-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    background: var(--border);
}

.gs-badge-course { background: #dbeafe; color: #1e40af; }
.gs-badge-lesson { background: #dcfce7; color: #166534; }
.gs-badge-project { background: #fef3c7; color: #92400e; }
[data-theme="dark"] .gs-badge-course { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .gs-badge-lesson { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .gs-badge-project { background: #422006; color: #fcd34d; }

.gs-page { font-size: 0.75rem; color: var(--text-muted); }
.gs-desc { display: block; font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-go { color: var(--text-muted); font-size: 1rem; padding-top: 0.1rem; }
.gs-empty { padding: 1rem; color: var(--text-muted); font-size: 0.9rem; }

/* Tech logos on cards */
.course-logo, .tech-logo {
    object-fit: contain;
    display: block;
}

.course-icon, .course-icon-lg, .project-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.course-icon-lg img, .project-header-icon img {
    width: 72px;
    height: 72px;
    object-fit: contain;
}

.course-icon-emoji { font-size: 2rem; line-height: 1; }
.course-icon-lg .course-icon-emoji { font-size: 4rem; }

.project-header {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}

.search-form input {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    width: 200px;
}

/* Catalog filter bar */
.catalog-filter {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.catalog-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.filter-search-wrap { flex: 1; min-width: 220px; }

.filter-input,
.filter-select {
    width: 100%;
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 0.9rem;
}

.filter-select { min-width: 160px; width: auto; flex: 0 1 auto; }

.filter-clear { white-space: nowrap; }

.catalog-filter-meta {
    margin-top: 0.65rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.filter-empty-msg {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    background: var(--bg-alt);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.filterable-item.filter-hidden { pointer-events: none; }

.section-inner { margin-top: 2rem; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

@media (max-width: 768px) {
    .catalog-filter-row { flex-direction: column; align-items: stretch; }
    .filter-select { width: 100%; }
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.35rem 0.5rem;
    cursor: pointer;
    font-size: 1rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

/* Hero */
.hero {
    padding: 4rem 0;
    text-align: center;
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    color: #fff;
}

.hero h1 { font-size: 2.5rem; margin-bottom: 1rem; }
.hero-sub { font-size: 1.15rem; opacity: 0.9; margin-bottom: 2rem; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; }
.hero .btn-outline { border-color: #fff; color: #fff; }

/* Sections */
.section { padding: 3rem 0; }
.section-alt { background: var(--bg-alt); }
.section h2 { margin-bottom: 1.5rem; font-size: 1.75rem; }

/* Course Grid */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.course-card {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-decoration: none;
    color: var(--text);
    transition: box-shadow 0.2s, transform 0.2s;
}

.course-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.course-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.course-card h3 { margin-bottom: 0.5rem; }
.course-card p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 0.75rem; }
.course-meta { display: flex; gap: 0.5rem; align-items: center; font-size: 0.85rem; color: var(--text-muted); flex-wrap: wrap; }

.page-header { margin-bottom: 2rem; }
.page-subtitle { color: var(--text-muted); margin-top: 0.5rem; max-width: 640px; }

.badge-level { background: #e0e7ff; color: #3730a3; }
[data-theme="dark"] .badge-level { background: #312e81; color: #a5b4fc; }

.badge-link { text-decoration: none; color: inherit; }
.badge-link:hover { background: var(--primary); color: #fff; }

.project-features-preview {
    list-style: none;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.project-features-preview li::before { content: "• "; color: var(--primary); }
.project-features-preview .muted { font-style: italic; }

.project-page { padding: 2rem 0; max-width: 900px; }
.project-header { margin-bottom: 2rem; }
.project-intro { color: var(--text-muted); margin: 0.75rem 0 1rem; font-size: 1.1rem; }
.project-links { display: flex; gap: 0.75rem; margin-top: 1rem; }
.project-section { margin-bottom: 2.5rem; }
.project-section h2 { margin-bottom: 1rem; font-size: 1.5rem; }
.feature-list { padding-left: 1.5rem; }
.feature-list li { margin-bottom: 0.35rem; }
.project-steps { padding-left: 0; list-style: none; }
.project-steps > li {
    margin-bottom: 2rem;
    padding: 1.25rem;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.project-steps h3 { margin-bottom: 0.5rem; }
.step-type { font-size: 0.75rem; margin-bottom: 0.75rem; display: inline-block; }
.step-content { color: var(--text-muted); margin-bottom: 0.75rem; }
.command-block { margin-top: 0.75rem; }
.command-block p { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.25rem; }

.search-form-lg {
    display: flex;
    gap: 0.5rem;
    margin: 1.5rem 0;
    max-width: 560px;
}
.search-form-lg input {
    flex: 1;
    padding: 0.6rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-alt);
    color: var(--text);
}
.search-results { list-style: none; }
.search-results li { padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.search-results a { color: var(--text); text-decoration: none; font-weight: 500; }
.search-results a:hover { color: var(--primary); }
.result-type { margin-right: 0.5rem; font-size: 0.7rem; }
.search-meta { color: var(--text-muted); margin-bottom: 1rem; }

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--border);
    color: var(--text);
}

.badge-beginner { background: #dcfce7; color: #166534; }
.badge-intermediate { background: #fef9c3; color: #854d0e; }
.badge-advanced { background: #fee2e2; color: #991b1b; }
[data-theme="dark"] .badge-beginner { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .badge-intermediate { background: #422006; color: #fcd34d; }
[data-theme="dark"] .badge-advanced { background: #450a0a; color: #fca5a5; }

/* Breadcrumbs */
.breadcrumbs {
    padding: 0.75rem 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.breadcrumbs a { color: var(--primary); text-decoration: none; }
.breadcrumbs .sep { margin: 0 0.4rem; }
.breadcrumbs .current { color: var(--text); }

/* Progress */
.progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.progress-bar.lg { height: 10px; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 999px; transition: width 0.3s; }
.progress-text { font-size: 0.8rem; color: var(--text-muted); }

/* Lesson Blocks */
.lesson-block { margin-bottom: 2rem; }
.lesson-block h2, .lesson-block h3 { margin-bottom: 0.75rem; }

pre {
    background: var(--code-bg);
    color: #abb2bf;
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.5;
}

code { font-family: 'Fira Code', 'Consolas', monospace; }

.callout {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    border-left: 4px solid;
    margin: 1rem 0;
}

.callout-note { background: var(--callout-note); border-color: #3b82f6; }
.callout-warning { background: var(--callout-warning); border-color: #f59e0b; }
.callout-tip { background: var(--callout-tip); border-color: #10b981; }
.callout-important { background: var(--callout-important); border-color: #ef4444; }

/* Course Page */
.course-header {
    display: flex;
    gap: 2rem;
    padding: 2rem 0;
    align-items: flex-start;
}

.course-icon-lg { font-size: 4rem; }
.course-badges { display: flex; gap: 0.5rem; margin: 1rem 0; flex-wrap: wrap; }
.outline-module { margin-bottom: 2rem; }
.outline-topic { margin-left: 1rem; margin-bottom: 1rem; }
.lesson-list { list-style: none; }
.lesson-list a {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    color: var(--text);
    text-decoration: none;
    border-radius: var(--radius);
}

.lesson-list a:hover { background: var(--bg-alt); }
.lesson-time { color: var(--text-muted); font-size: 0.85rem; }

/* Course View */
.cv-hero {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(124, 58, 237, 0.08) 100%);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 0 2.5rem;
}
[data-theme="dark"] .cv-hero {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(124, 58, 237, 0.12) 100%);
}
.cv-hero .breadcrumbs { padding-left: 0; padding-right: 0; max-width: none; }
.cv-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 2.5rem;
    align-items: start;
    margin-top: 0.5rem;
}
.cv-hero-title-row { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.cv-hero-logo {
    flex-shrink: 0;
    width: 84px;
    height: 84px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
}
.cv-hero-logo img { width: 56px; height: 56px; object-fit: contain; }
.cv-eyebrow {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: 0.25rem;
}
.cv-title { font-size: clamp(1.75rem, 3.5vw, 2.5rem); line-height: 1.15; font-weight: 800; margin: 0; }
.cv-desc { color: var(--text-muted); font-size: 1.05rem; line-height: 1.7; max-width: 720px; }
.cv-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.25rem; }
.cv-actions .btn-outline { background: var(--bg-alt); }

.cv-hero-card {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}
.cv-progress-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.9rem; color: var(--text-muted); }
.cv-progress-head strong { font-size: 1.5rem; color: var(--primary); }
.cv-progress-sub { font-size: 0.85rem; color: var(--text-muted); margin: 0.25rem 0 1.25rem; }
.cv-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.cv-stat {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem;
    text-align: center;
}
.cv-stat strong { display: block; font-size: 1.35rem; font-weight: 800; color: var(--text); }
.cv-stat span { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.cv-note { font-size: 0.75rem; color: var(--text-muted); margin: 1rem 0 0; text-align: center; }

.cv-body { padding-top: 2rem; padding-bottom: 1rem; }
.cv-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 2rem;
    align-items: start;
}
.cv-section { margin-bottom: 2.5rem; }
.cv-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.cv-section-title { font-size: 1.4rem; font-weight: 700; margin: 0 0 1rem; }
.cv-section-head .cv-section-title { margin: 0; }
.cv-outline-tools { display: flex; gap: 0.5rem; }

.cv-modules { display: flex; flex-direction: column; gap: 0.75rem; }
.cv-module {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.2s, border-color 0.2s;
}
.cv-module[open] { border-color: var(--primary); box-shadow: 0 4px 16px rgba(37, 99, 235, 0.08); }
.cv-module-head {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.cv-module-head::-webkit-details-marker { display: none; }
.cv-module-head:hover { background: var(--bg); }
.cv-module-num {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}
.cv-module-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cv-module-title { font-weight: 700; font-size: 1.02rem; }
.cv-module-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.15rem; }
.cv-module-caret { color: var(--text-muted); transition: transform 0.2s; }
.cv-module[open] .cv-module-caret { transform: rotate(180deg); }
.cv-module-body { padding: 0 1.25rem 1.25rem; border-top: 1px solid var(--border); }
.cv-module-desc { color: var(--text-muted); font-size: 0.9rem; margin: 1rem 0 0; }
.cv-topic { margin-top: 1rem; }
.cv-topic-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 0 0 0.4rem;
}
.cv-lessons { list-style: none; margin: 0; padding: 0; }
.cv-lesson {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    transition: background 0.15s;
}
.cv-lesson:hover { background: var(--bg); color: var(--primary); }
.cv-lesson-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.cv-lesson.is-done .cv-lesson-icon { background: #10b981; border-color: #10b981; color: #fff; }
.cv-lesson-title { flex: 1; min-width: 0; }
.cv-lesson-time { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }

.cv-assignments { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.cv-assignment {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
}
.cv-assignment h3 { font-size: 1rem; margin: 0 0 0.5rem; }
.cv-assignment p { font-size: 0.9rem; color: var(--text-muted); margin: 0 0 0.75rem; }
.cv-assignment-meta { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.cv-assignment-meta span {
    font-size: 0.75rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.cv-sidebar { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 1rem; }
.cv-card {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
}
.cv-card-title { font-size: 1rem; font-weight: 700; margin: 0 0 0.75rem; }
.cv-includes { list-style: none; margin: 0; padding: 0; }
.cv-includes li { position: relative; padding: 0.35rem 0 0.35rem 1.5rem; font-size: 0.9rem; }
.cv-includes li::before { content: '✓'; position: absolute; left: 0; color: #10b981; font-weight: 700; }
.cv-project-list { list-style: none; margin: 0; padding: 0; }
.cv-project-list a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
}
.cv-project-list li:last-child a { border-bottom: none; }
.cv-project-list a:hover { color: var(--primary); }
.cv-jump { margin: 0; padding-left: 1.25rem; max-height: 320px; overflow-y: auto; }
.cv-jump li { padding: 0.25rem 0; font-size: 0.88rem; }
.cv-jump a { color: var(--text-muted); text-decoration: none; }
.cv-jump a:hover { color: var(--primary); }

.cv-hero-title-row > div { min-width: 0; }
.cv-title { overflow-wrap: anywhere; }

@media (max-width: 992px) {
    .cv-hero-grid, .cv-layout { grid-template-columns: minmax(0, 1fr); }
    .cv-sidebar { position: static; }
}
@media (max-width: 576px) {
    .cv-hero-title-row { align-items: flex-start; }
    .cv-hero-logo { width: 64px; height: 64px; border-radius: 14px; }
    .cv-hero-logo img { width: 42px; height: 42px; }
    .cv-actions .btn { flex: 1; text-align: center; }
    .cv-module-head { padding: 0.85rem 1rem; gap: 0.75rem; }
    .cv-module-body { padding: 0 1rem 1rem; }
    .cv-lesson-time { display: none; }
}

/* Legal pages */
.legal-page { max-width: 860px; padding-top: 2.5rem; padding-bottom: 2rem; }
.legal-page h1 { font-size: 2rem; font-weight: 800; margin-bottom: 0.5rem; }
.legal-updated { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 2rem; }
.legal-highlight {
    background: var(--callout-tip);
    border-left: 4px solid #10b981;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 2rem;
}
.legal-page h2 { font-size: 1.25rem; font-weight: 700; margin: 2rem 0 0.75rem; }
.legal-page p, .legal-page li { line-height: 1.75; color: var(--text); }
.legal-page ul { padding-left: 1.25rem; margin-bottom: 1rem; }
.legal-page table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.9rem; }
.legal-page th, .legal-page td { border: 1px solid var(--border); padding: 0.6rem 0.75rem; text-align: left; vertical-align: top; }
.legal-page th { background: var(--bg-alt); }
.legal-page code { background: var(--bg-alt); padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.85em; }

/* Dashboard */
.dashboard { padding: 2rem 0; }
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 2rem 0;
}

.stat-card {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
}

.stat-value { display: block; font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-label { color: var(--text-muted); font-size: 0.85rem; }
.progress-item { margin-bottom: 1rem; padding: 1rem; background: var(--bg-alt); border-radius: var(--radius); }

/* Auth */
.auth-page { display: flex; justify-content: center; padding: 4rem 0; }
.auth-form {
    background: var(--bg-alt);
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 400px;
}

.auth-form label { display: block; margin-bottom: 1rem; }
.auth-form input {
    display: block;
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
}

/* Footer */
.site-footer {
    background: var(--bg-alt);
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 3rem;
}
.site-footer p { margin: 0; }
.footer-disclaimer { max-width: 720px; margin: 0 auto 0.75rem !important; line-height: 1.6; }
.footer-links { display: flex; justify-content: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.footer-links a { color: var(--primary); text-decoration: none; font-weight: 600; }
.footer-links a:hover { text-decoration: underline; }
.footer-copy { font-size: 0.8rem; }

/* Lesson View */
.main-content:has(.lesson-layout) + #site-footer .site-footer { margin-top: 0; }

.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 1200;
    pointer-events: none;
}
.reading-progress span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--primary), #7c3aed);
    transition: width 0.1s linear;
}

.lesson-layout {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr) 250px;
    min-height: calc(100vh - 64px);
}

.lesson-sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    scrollbar-width: thin;
}
.lesson-sidebar-close { display: none; }
.lesson-backdrop { display: none; }

.lesson-sidebar .sidebar-header {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--sidebar-bg);
    padding: 1.1rem 1.1rem 0.9rem;
    border-bottom: 1px solid var(--border);
}
.sidebar-course-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    margin-bottom: 0.6rem;
}
.sidebar-course-title:hover { color: var(--primary); }
.sidebar-course-logo { width: 28px; height: 28px; object-fit: contain; border-radius: 6px; flex-shrink: 0; }
.lesson-sidebar .progress-text { font-size: 0.75rem; }

.course-nav { padding: 0.6rem 0.6rem 1.5rem; }
.nav-module { border-radius: 10px; margin-bottom: 0.25rem; }
.nav-module-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.5rem;
    cursor: pointer;
    list-style: none;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    user-select: none;
}
.nav-module-head::-webkit-details-marker { display: none; }
.nav-module-head::after {
    content: '\203A';
    margin-left: auto;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--text-muted);
    transition: transform 0.2s;
}
.nav-module[open] > .nav-module-head::after { transform: rotate(90deg); }
.nav-module-head:hover { background: var(--bg); }
.nav-module-num {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    display: grid;
    place-items: center;
    font-size: 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.nav-module[open] .nav-module-num { background: var(--primary); border-color: var(--primary); color: #fff; }
.nav-module-title { flex: 1; min-width: 0; line-height: 1.3; }
.nav-module-count { font-size: 0.72rem; font-weight: 500; color: var(--text-muted); }

.nav-lessons { list-style: none; margin: 0.15rem 0 0.5rem; padding: 0 0 0 1.4rem; border-left: 1px dashed var(--border); margin-left: 1.25rem; }
.nav-lesson {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.4rem 0.55rem;
    margin: 1px 0;
    font-size: 0.84rem;
    line-height: 1.35;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 7px;
}
.nav-lesson:hover { background: var(--bg); color: var(--text); }
.nav-lesson-dot {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin-top: 1px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    display: grid;
    place-items: center;
    font-size: 0.6rem;
    font-weight: 700;
    color: #fff;
}
.nav-lesson.is-done .nav-lesson-dot { background: #10b981; border-color: #10b981; }
.nav-lesson.active {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    font-weight: 600;
}
.nav-lesson.active .nav-lesson-dot { border-color: var(--primary); box-shadow: inset 0 0 0 3px var(--sidebar-bg), inset 0 0 0 8px var(--primary); }
.nav-lesson.active.is-done .nav-lesson-dot { box-shadow: none; }
[data-theme="dark"] .nav-lesson.active { background: rgba(59, 130, 246, 0.18); color: #93c5fd; }

.lesson-content {
    width: 100%;
    max-width: 880px;
    margin: 0 auto;
    padding: 1.25rem 2.5rem 3rem;
    min-width: 0;
}
.lesson-topbar { display: none; }
.lesson-content .breadcrumbs { padding: 0 0 0.75rem; max-width: none; overflow-wrap: anywhere; }

.lesson-hero {
    position: relative;
    padding: 1.75rem 1.75rem 1.5rem;
    margin-bottom: 1.75rem;
    border: 1px solid var(--border);
    border-radius: 16px;
    background:
        radial-gradient(circle at 100% 0%, rgba(124, 58, 237, 0.12), transparent 45%),
        radial-gradient(circle at 0% 100%, rgba(37, 99, 235, 0.10), transparent 50%),
        var(--bg-alt);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}
.lesson-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.9rem; }
.lv-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.7rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.lv-chip-primary { background: rgba(37, 99, 235, 0.1); border-color: rgba(37, 99, 235, 0.25); color: var(--primary); }
[data-theme="dark"] .lv-chip-primary { color: #93c5fd; }
.lesson-hero h1 { font-size: clamp(1.6rem, 3vw, 2.25rem); font-weight: 800; line-height: 1.2; margin: 0 0 0.6rem; overflow-wrap: anywhere; }
.lesson-intro { color: var(--text-muted); font-size: 1.02rem; line-height: 1.65; margin-bottom: 1.25rem; }
.lesson-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.lv-btn { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.6rem 1.1rem; border-radius: 10px; }
.lv-btn.btn-outline { background: var(--bg-alt); }
.lv-btn.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
#mark-complete.is-done, #mark-complete:disabled { background: #10b981; color: #fff; opacity: 1; }
#bookmark-lesson.is-saved { border-color: #f59e0b; color: #b45309; background: rgba(245, 158, 11, 0.1); }
[data-theme="dark"] #bookmark-lesson.is-saved { color: #fbbf24; }

.lesson-blocks { display: flex; flex-direction: column; gap: 2.25rem; }
.lesson-block { scroll-margin-top: 84px; min-width: 0; }
.lesson-block.is-anchor { display: none; }
.lesson-block p, .lesson-block li { line-height: 1.75; }
.block-heading { font-size: 1.6rem; font-weight: 800; margin: 0; }
.block-title {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0 0 0.9rem;
}
.block-icon {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 1rem;
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}
.block-common_mistakes .block-icon { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.block-best_practices .block-icon { background: rgba(16, 185, 129, 0.12); color: #10b981; }
.block-challenge .block-icon { background: rgba(245, 158, 11, 0.14); color: #d97706; }
.block-interview_questions .block-icon { background: rgba(124, 58, 237, 0.12); color: #7c3aed; }
.block-body { color: var(--text); font-size: 1rem; line-height: 1.75; }
.block-body p:last-child { margin-bottom: 0; }
.block-lead { color: var(--text-muted); margin-bottom: 0.9rem; }

.concept-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.concept-grid .lesson-block {
    padding: 1.25rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-alt);
    transition: border-color 0.2s, transform 0.2s;
}
.concept-grid .lesson-block:hover { border-color: rgba(37, 99, 235, 0.4); transform: translateY(-2px); }
.concept-grid .block-title { font-size: 1.05rem; flex-direction: column; align-items: flex-start; }
.concept-grid .block-body { font-size: 0.93rem; color: var(--text-muted); }

.code-card {
    border-radius: 12px;
    overflow: hidden;
    background: var(--code-bg);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}
.code-card + .code-card, .code-card + .output-card, .code-editor-panel + .output-card { margin-top: 0.9rem; }
.code-card-head, .output-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.9rem;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    font-size: 0.78rem;
    color: #94a3b8;
}
.code-card-label { font-weight: 600; color: #cbd5e1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.code-card-tools { display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; }
.code-lang { text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.7rem; color: #64748b; }
.code-copy {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: transparent;
    color: #cbd5e1;
    font-size: 0.75rem;
    cursor: pointer;
}
.code-copy:hover { background: rgba(255, 255, 255, 0.08); }
.code-copy.is-copied { border-color: #10b981; color: #34d399; }
.code-card pre, .output-card pre { margin: 0; padding: 0; border-radius: 0; background: transparent; }
.code-card pre code, .code-card pre code.hljs, .output-card pre code {
    display: block;
    padding: 1rem 1.1rem;
    background: transparent;
    font-size: 0.88rem;
    line-height: 1.65;
    white-space: pre;
}

.output-card {
    border-radius: 12px;
    overflow: hidden;
    background: #0b1220;
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.output-dots { display: inline-flex; gap: 5px; margin-right: auto; }
.output-dots i { width: 9px; height: 9px; border-radius: 50%; background: #ef4444; }
.output-dots i:nth-child(2) { background: #f59e0b; }
.output-dots i:nth-child(3) { background: #10b981; }
.output-card pre code { color: #86efac; }
.output-console { min-height: 48px; margin: 0; background: #0b1220; color: #86efac; border-radius: 0; }

.code-editor-panel { margin-top: 0.9rem; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.code-actions { padding: 0.5rem; display: flex; gap: 0.5rem; background: var(--bg-alt); }

.syntax-explanation {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-alt);
}
.syntax-part {
    display: grid;
    grid-template-columns: minmax(110px, 200px) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
}
.syntax-part:last-child { border-bottom: 0; }
.syntax-part:nth-child(even) { background: var(--bg); }
.syntax-part p { margin: 0; color: var(--text-muted); font-size: 0.93rem; }
.part-token {
    justify-self: start;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    font-weight: 600;
    font-size: 0.85rem;
    overflow-wrap: anywhere;
}
[data-theme="dark"] .part-token { color: #93c5fd; }

.info-card, .task-card {
    padding: 1.25rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-alt);
}
.info-card .code-card { margin: 0.9rem 0; }
.scenario { margin: 0; font-size: 0.98rem; }
.scenario-label {
    display: inline-block;
    margin-right: 0.5rem;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(16, 185, 129, 0.14);
    color: #059669;
    vertical-align: 2px;
}
.info-card-foot { margin: 0; color: var(--text-muted); font-size: 0.93rem; }

.mistake-grid { display: grid; gap: 0.85rem; }
.mistake-card {
    padding: 1rem 1.1rem;
    border: 1px solid var(--border);
    border-left: 4px solid #ef4444;
    border-radius: 12px;
    background: var(--bg-alt);
}
.mistake-head { display: flex; gap: 0.55rem; align-items: flex-start; }
.mistake-head i { color: #ef4444; margin-top: 2px; }
.mistake-card p { margin: 0.45rem 0 0; color: var(--text-muted); font-size: 0.93rem; }
.mistake-fix {
    display: flex;
    gap: 0.55rem;
    align-items: flex-start;
    margin-top: 0.7rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.1);
    font-size: 0.92rem;
}
.mistake-fix i { color: #10b981; margin-top: 2px; }

.check-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
.check-list li {
    position: relative;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-alt);
}
.check-list li::before {
    content: '\2713';
    position: absolute;
    left: 0.9rem;
    top: 0.8rem;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.7rem;
    font-weight: 700;
    background: #10b981;
    color: #fff;
}

.task-card { border-left: 4px solid var(--primary); }
.task-card-challenge { border-left-color: #f59e0b; }
.task-question { font-weight: 500; margin-bottom: 0.9rem; }
.task-card .task-question:last-child { margin-bottom: 0; }
.practice-editor {
    width: 100%;
    display: block;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.88rem;
    line-height: 1.6;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    background: var(--code-bg);
    color: #e2e8f0;
    resize: vertical;
    tab-size: 4;
}
.practice-editor:focus { outline: 2px solid rgba(37, 99, 235, 0.5); outline-offset: 1px; }
.task-actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.7rem; }
.task-hint { font-size: 0.8rem; color: var(--text-muted); }
.hint-box { border: 1px dashed var(--border); border-radius: 10px; padding: 0.6rem 0.9rem; background: var(--bg); }
.hint-box summary { cursor: pointer; font-weight: 600; color: #d97706; }
.hint-box ol { margin: 0.6rem 0 0.2rem; padding-left: 1.2rem; }

.interview-list { display: grid; gap: 0.6rem; }
.interview-q {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-alt);
    overflow: hidden;
}
.interview-q summary {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.9rem 1rem;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
}
.interview-q summary::-webkit-details-marker { display: none; }
.interview-q summary::after { content: '+'; margin-left: auto; font-size: 1.2rem; line-height: 1; color: var(--text-muted); }
.interview-q[open] summary::after { content: '\2212'; }
.interview-q[open] summary { border-bottom: 1px solid var(--border); }
.iq-num {
    flex-shrink: 0;
    padding: 0.1rem 0.45rem;
    border-radius: 6px;
    font-size: 0.75rem;
    background: rgba(124, 58, 237, 0.12);
    color: #7c3aed;
}
.interview-q .answer { padding: 0.9rem 1rem; color: var(--text-muted); line-height: 1.7; }

.callout strong { display: inline-flex; align-items: center; gap: 0.4rem; margin-bottom: 0.25rem; }

.lesson-finish {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 2.5rem;
    padding: 1.4rem 1.5rem;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    color: #fff;
}
.lesson-finish h3 { font-size: 1.15rem; margin: 0 0 0.25rem; }
.lesson-finish p { margin: 0; opacity: 0.9; font-size: 0.93rem; }
.lesson-finish .btn-primary { background: #fff; color: var(--primary); }
.lesson-finish .btn-primary:hover { background: #eef2ff; }

.lesson-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.25rem; }
.pager-card {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 1rem 1.2rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-alt);
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.2s, transform 0.2s;
    min-width: 0;
}
.pager-card:hover { border-color: var(--primary); transform: translateY(-2px); color: var(--text); }
.pager-next { text-align: right; align-items: flex-end; }
.pager-label { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); display: inline-flex; gap: 0.35rem; align-items: center; }
.pager-title { font-weight: 700; color: var(--primary); overflow-wrap: anywhere; }

.lesson-panel {
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow-y: auto;
    padding: 1.25rem 1rem;
    border-left: 1px solid var(--border);
    background: var(--sidebar-bg);
    scrollbar-width: thin;
}
.panel-card { margin-bottom: 1.5rem; }
.panel-card h4 {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
}
.panel-progress-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.82rem; color: var(--text-muted); }
.panel-progress-head strong { font-size: 1.2rem; color: var(--primary); }
.panel-sub { font-size: 0.75rem; color: var(--text-muted); }
.toc-list { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--border); }
.toc-list a {
    display: block;
    margin-left: -2px;
    padding: 0.35rem 0 0.35rem 0.85rem;
    border-left: 2px solid transparent;
    font-size: 0.83rem;
    line-height: 1.35;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s, border-color 0.15s;
}
.toc-list a:hover { color: var(--text); }
.toc-list a.active { color: var(--primary); border-left-color: var(--primary); font-weight: 600; }

@media (max-width: 1200px) {
    .lesson-layout { grid-template-columns: 270px minmax(0, 1fr); }
    .lesson-panel { display: none; }
}

@media (max-width: 900px) {
    .lesson-layout { grid-template-columns: minmax(0, 1fr); }
    .lesson-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        height: 100vh;
        width: min(330px, 86vw);
        z-index: 1300;
        transform: translateX(-105%);
        transition: transform 0.25s ease;
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.25);
    }
    .lesson-sidebar.is-open { transform: none; }
    .lesson-sidebar-close {
        display: grid;
        place-items: center;
        position: absolute;
        top: 0.8rem;
        right: 0.8rem;
        z-index: 3;
        width: 32px;
        height: 32px;
        border-radius: 8px;
        border: 1px solid var(--border);
        background: var(--bg-alt);
        color: var(--text);
    }
    .lesson-sidebar .sidebar-header { padding-right: 3.25rem; }
    body.lesson-menu-open .lesson-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1250;
        background: rgba(15, 23, 42, 0.5);
    }
    body.lesson-menu-open { overflow: hidden; }
    .lesson-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        margin-bottom: 0.9rem;
    }
    .lesson-menu-btn {
        display: inline-flex;
        align-items: center;
        gap: 0.45rem;
        padding: 0.5rem 0.85rem;
        border-radius: 10px;
        border: 1px solid var(--border);
        background: var(--bg-alt);
        color: var(--text);
        font-weight: 600;
        font-size: 0.88rem;
    }
    .lesson-topbar-count { font-size: 0.8rem; color: var(--text-muted); }
    .lesson-content { padding: 1rem 1.25rem 2.5rem; }
}

@media (max-width: 576px) {
    .lesson-content { padding: 0.9rem 0.9rem 2rem; }
    .lesson-hero { padding: 1.25rem 1.1rem; border-radius: 14px; }
    .lesson-actions .lv-btn { flex: 1 1 auto; justify-content: center; }
    .syntax-part { grid-template-columns: minmax(0, 1fr); gap: 0.4rem; }
    .lesson-pager { grid-template-columns: minmax(0, 1fr); }
    .pager-next { text-align: left; align-items: flex-start; }
    .lesson-finish { flex-direction: column; align-items: stretch; text-align: center; }
    .lesson-finish .btn { justify-content: center; }
    .code-lang { display: none; }
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 { font-size: 1.75rem; }
    .dashboard-stats { grid-template-columns: 1fr; }
    .main-nav { gap: 0.5rem; font-size: 0.85rem; flex-wrap: wrap; }
    .global-search input { width: 140px; }
    .global-search-dropdown { min-width: 280px; left: auto; right: 0; }
    .courses-mega-menu { width: min(320px, 95vw); grid-template-columns: 1fr; }
}
