/* ================================================
   薛老师编程网校 - Premium Design System
   ================================================ */

:root {
    /* Brand Colors */
    --brand-50: #eef2ff;
    --brand-100: #e0e7ff;
    --brand-200: #c7d2fe;
    --brand-300: #a5b4fc;
    --brand-400: #818cf8;
    --brand-500: #6366f1;
    --brand-600: #4f46e5;
    --brand-700: #4338ca;
    --brand-800: #3730a3;
    --brand-900: #312e81;

    /* Accent */
    --accent: #f43f5e;
    --accent2: #f59e0b;
    --accent3: #10b981;

    /* Surface */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-card-hover: rgba(30, 41, 59, 0.9);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --bg-glass-hover: rgba(255, 255, 255, 0.06);

    /* Text */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-code: #e2e8f0;

    /* Borders */
    --border-subtle: rgba(148, 163, 184, 0.1);
    --border-default: rgba(148, 163, 184, 0.2);
    --border-strong: rgba(148, 163, 184, 0.3);

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    /* Shadow */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.3), 0 0 40px rgba(99,102,241,0.05);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.4), 0 0 80px rgba(99,102,241,0.08);
    --shadow-glow: 0 0 30px rgba(99,102,241,0.15), 0 0 60px rgba(99,102,241,0.05);

    /* Transition */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ================================================
   1. Resets & Base
   ================================================ */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.7;
    overflow-x: hidden;
}

/* Animated background */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(244, 63, 94, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 40% 80%, rgba(16, 185, 129, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 70%, rgba(245, 158, 11, 0.04) 0%, transparent 50%);
    z-index: -1;
    animation: bgShift 20s ease-in-out infinite;
}

@keyframes bgShift {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(1%, -1%) rotate(1deg); }
    66% { transform: translate(-1%, 1%) rotate(-1deg); }
}

/* Floating particles */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background-image:
        radial-gradient(2px 2px at 20px 30px, rgba(99,102,241,0.3), transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(244,63,94,0.2), transparent),
        radial-gradient(1px 1px at 90px 40px, rgba(245,158,11,0.3), transparent),
        radial-gradient(2px 2px at 160px 120px, rgba(16,185,129,0.2), transparent),
        radial-gradient(1px 1px at 200px 80px, rgba(99,102,241,0.25), transparent),
        radial-gradient(2px 2px at 300px 200px, rgba(244,63,94,0.15), transparent);
    background-size: 400px 300px;
    animation: particles 15s linear infinite;
}

@keyframes particles {
    0% { background-position: 0 0; }
    100% { background-position: 400px 300px; }
}

a {
    color: var(--brand-400);
    text-decoration: none;
    transition: color 0.2s var(--ease-out);
}
a:hover { color: var(--brand-300); }

img {
    max-width: 100%;
    height: auto;
}

::selection {
    background: rgba(99, 102, 241, 0.4);
    color: #fff;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ================================================
   2. Typography
   ================================================ */

h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
    font-weight: 700;
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); }
h3 { font-size: 1.25rem; }

.gradient-text {
    background: linear-gradient(135deg, var(--brand-400) 0%, var(--accent) 50%, var(--accent2) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ================================================
   3. Layout & Container
   ================================================ */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ================================================
   4. Header & Navigation
   ================================================ */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-subtle);
    transition: all 0.3s var(--ease-out);
}

.site-header.scrolled {
    background: rgba(15, 23, 42, 0.9);
    box-shadow: 0 1px 20px rgba(0,0,0,0.1);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    transition: transform 0.2s var(--ease-out);
}
.header-logo:hover {
    transform: scale(1.02);
    color: var(--text-primary);
}

.header-logo-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--brand-600), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #fff;
    box-shadow: 0 4px 15px rgba(99,102,241,0.3);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
}

.nav-link {
    padding: 8px 18px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s var(--ease-out);
    position: relative;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-glass-hover);
}

.nav-link.active {
    color: var(--brand-400);
    background: rgba(99, 102, 241, 0.1);
}

.nav-link.btn-login {
    background: linear-gradient(135deg, var(--brand-600), var(--brand-500));
    color: #fff;
    padding: 8px 22px;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 10px rgba(99,102,241,0.25);
}
.nav-link.btn-login:hover {
    box-shadow: 0 4px 20px rgba(99,102,241,0.4);
    transform: translateY(-1px);
    color: #fff;
}

.nav-link.btn-logout {
    color: var(--accent);
}

/* Mobile menu toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
}

@media (max-width: 768px) {
    .menu-toggle { display: block; }
    .nav-links {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: rgba(15,23,42,0.95);
        backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 16px;
        border-bottom: 1px solid var(--border-subtle);
    }
    .nav-links.open { display: flex; }
    .nav-link { width: 100%; text-align: center; padding: 12px; }
}

/* ================================================
   5. Hero Section
   ================================================ */

.hero {
    text-align: center;
    padding: 80px 24px 60px;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99,102,241,0.1), transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.hero-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(244,63,94,0.1));
    font-size: 2.2rem;
    margin-bottom: 28px;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.hero h1 {
    font-size: clamp(2rem, 6vw, 3.8rem);
    font-weight: 800;
    margin-bottom: 16px;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.hero p {
    max-width: 600px;
    margin: 0 auto 36px;
    color: var(--text-secondary);
    font-size: 1.15rem;
    line-height: 1.8;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 48px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.hero-stat {
    text-align: center;
}

.hero-stat-value {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--brand-400), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ================================================
   6. Course Grid & Cards
   ================================================ */

.section {
    padding: 40px 0 80px;
}

.section-header {
    text-align: center;
    margin-bottom: 48px;
}

.section-header h2 {
    margin-bottom: 12px;
}

.section-header p {
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto;
}

.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.course-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 32px;
    transition: all 0.35s var(--ease-out);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    display: block;
    color: inherit;
}

.course-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--brand-500), var(--accent), var(--accent2));
    opacity: 0;
    transition: opacity 0.35s var(--ease-out);
}

.course-card:hover::before { opacity: 1; }

.course-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
    background: radial-gradient(400px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(99,102,241,0.06), transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
}
.course-card:hover::after { opacity: 1; }

.course-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-lg);
    background: var(--bg-card-hover);
}

.course-card-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

/* Per-language icon colors */
.course-card-icon.python {
    background: linear-gradient(135deg, rgba(55,118,179,0.2), rgba(55,118,179,0.1));
    color: #4b8bbe;
}
.course-card-icon.javascript {
    background: linear-gradient(135deg, rgba(240,219,79,0.2), rgba(240,219,79,0.1));
    color: #f0db4f;
}
.course-card-icon.java {
    background: linear-gradient(135deg, rgba(237,139,0,0.2), rgba(237,139,0,0.1));
    color: #ed8b00;
}
.course-card-icon.c {
    background: linear-gradient(135deg, rgba(165,185,201,0.2), rgba(165,185,201,0.1));
    color: #a5b9c9;
}
.course-card-icon.go {
    background: linear-gradient(135deg, rgba(0,173,216,0.2), rgba(0,173,216,0.1));
    color: #00add8;
}
.course-card-icon.php {
    background: linear-gradient(135deg, rgba(119,123,180,0.2), rgba(119,123,180,0.1));
    color: #777bb4;
}

.course-card h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}

.course-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

.course-card-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
    position: relative;
    z-index: 1;
}

.course-card-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.course-card-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(16,185,129,0.1);
    color: var(--accent3);
    position: relative;
    z-index: 1;
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.course-card {
    animation: cardAppear 0.6s var(--ease-out) backwards;
}
.course-card:nth-child(1) { animation-delay: 0.05s; }
.course-card:nth-child(2) { animation-delay: 0.1s; }
.course-card:nth-child(3) { animation-delay: 0.15s; }
.course-card:nth-child(4) { animation-delay: 0.2s; }
.course-card:nth-child(5) { animation-delay: 0.25s; }

/* ================================================
   7. Buttons
   ================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.25s var(--ease-out);
    text-decoration: none;
    line-height: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand-600), var(--brand-500));
    color: #fff;
    box-shadow: 0 4px 15px rgba(99,102,241,0.3);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(99,102,241,0.45);
    color: #fff;
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), #e11d48);
    color: #fff;
    box-shadow: 0 4px 15px rgba(244,63,94,0.3);
}
.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(244,63,94,0.45);
    color: #fff;
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    position: relative;
}
.btn-outline::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: var(--radius-md);
    padding: 1px;
    background: linear-gradient(135deg, var(--brand-500), var(--accent));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.25s;
}
.btn-outline:hover::before { opacity: 1; }
.btn-outline:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
}

.btn-sm {
    padding: 8px 18px;
    font-size: 0.85rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-md);
}

/* ================================================
   8. Code Blocks with Line Numbers
   ================================================ */

.code-wrapper {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    background: #0d1117;
    margin: 24px 0;
    box-shadow: var(--shadow-md);
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: #161b22;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.8rem;
}

.code-lang {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.code-actions {
    display: flex;
    gap: 8px;
}

.code-actions button {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.code-actions button:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
}

.code-table-wrap {
    overflow-x: auto;
    padding: 16px 0;
    max-height: 600px;
    overflow-y: auto;
}

.code-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', 'Consolas', monospace;
    font-size: 0.88rem;
    line-height: 1.7;
}

.code-table tr {
    transition: background 0.15s;
}

.code-table tr:hover {
    background: rgba(99, 102, 241, 0.04);
}

.code-table .line-no {
    width: 1%;
    padding: 0 16px 0 20px;
    text-align: right;
    color: #484f58;
    user-select: none;
    white-space: nowrap;
    vertical-align: top;
    font-size: 0.8rem;
    border-right: 1px solid rgba(48, 54, 61, 0.5);
    transition: color 0.2s;
}

.code-table tr:hover .line-no {
    color: #8b949e;
}

.code-table .line-content {
    padding: 0 20px;
    white-space: pre;
    color: var(--text-code);
}

.code-table .line-content.hljs {
    background: transparent;
    display: block;
    padding: 0;
}

/* ================================================
   9. Syntax Highlighting (highlight.js) Dark Theme
   ================================================ */

.hljs { color: #c9d1d9; background: transparent; }

.hljs-keyword    { color: #ff7b72; }
.hljs-type        { color: #ffa657; }
.hljs-built_in    { color: #ffa657; }
.hljs-title       { color: #d2a8ff; }
.hljs-title.function_ { color: #d2a8ff; }
.hljs-title.class_ { color: #d2a8ff; }
.hljs-string      { color: #a5d6ff; }
.hljs-number      { color: #79c0ff; }
.hljs-literal     { color: #79c0ff; }
.hljs-comment     { color: #8b949e; font-style: italic; }
.hljs-meta        { color: #8b949e; }
.hljs-attr        { color: #79c0ff; }
.hljs-attribute   { color: #79c0ff; }
.hljs-variable    { color: #ffa657; }
.hljs-variable.language_ { color: #ff7b72; }
.hljs-params      { color: #c9d1d9; }
.hljs-operator    { color: #ff7b72; }
.hljs-punctuation { color: #c9d1d9; }
.hljs-property    { color: #79c0ff; }
.hljs-regexp      { color: #a5d6ff; }
.hljs-selector-class { color: #d2a8ff; }
.hljs-selector-id { color: #d2a8ff; }
.hljs-selector-tag { color: #ff7b72; }
.hljs-subst       { color: #c9d1d9; }
.hljs-symbol      { color: #79c0ff; }
.hljs-tag         { color: #ff7b72; }
.hljs-name        { color: #ff7b72; }
.hljs-template-tag     { color: #ff7b72; }
.hljs-template-variable { color: #ffa657; }

.hljs-addition { color: #7ee787; }
.hljs-deletion { color: #ff7b72; }
.hljs-emphasis  { font-style: italic; }
.hljs-strong    { font-weight: 700; }

/* ================================================
   10. Lesson Page
   ================================================ */

.lesson-page {
    display: grid;
    grid-template-columns: 300px 1fr;
    min-height: calc(100vh - 64px);
}

.lesson-sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    padding: 24px 0;
    overflow-y: auto;
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
}

.lesson-sidebar-header {
    padding: 0 20px 16px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 8px;
}

.lesson-sidebar-header h3 {
    font-size: 1rem;
    color: var(--text-primary);
}

.lesson-sidebar-header .back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    transition: color 0.2s;
}
.lesson-sidebar-header .back-link:hover { color: var(--brand-400); }

.chapter-list { list-style: none; }

.chapter-item { }

.chapter-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text-secondary);
    font-size: 0.88rem;
    transition: all 0.2s;
    text-decoration: none;
    border-left: 3px solid transparent;
}

.chapter-item a:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
}

.chapter-item a.active {
    background: rgba(99,102,241,0.08);
    color: var(--brand-400);
    border-left-color: var(--brand-500);
    font-weight: 500;
}

.chapter-item .chapter-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    flex-shrink: 0;
}

.chapter-item a.active .chapter-num {
    background: rgba(99,102,241,0.15);
}

.lesson-content {
    padding: 40px 48px;
    max-width: 900px;
}

.lesson-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 24px;
}

.lesson-breadcrumb a { color: var(--text-muted); }
.lesson-breadcrumb a:hover { color: var(--brand-400); }
.lesson-breadcrumb .sep { color: var(--border-strong); }

.lesson-title-section {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.lesson-title-section h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.lesson-title-section .lesson-number {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 100px;
    background: rgba(99,102,241,0.1);
    color: var(--brand-400);
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.lesson-body h2 {
    font-size: 1.4rem;
    margin: 32px 0 16px;
}

.lesson-body h3 {
    font-size: 1.15rem;
    margin: 24px 0 12px;
    color: var(--text-secondary);
}

.lesson-body p {
    margin-bottom: 16px;
    color: var(--text-secondary);
    line-height: 1.8;
}

.lesson-body ul, .lesson-body ol {
    margin: 12px 0 16px 24px;
    color: var(--text-secondary);
}

.lesson-body li {
    margin-bottom: 6px;
    line-height: 1.7;
}

.lesson-body blockquote {
    border-left: 3px solid var(--brand-600);
    padding: 12px 20px;
    margin: 20px 0;
    background: rgba(99,102,241,0.05);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--text-secondary);
    font-style: italic;
}

.lesson-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border-subtle);
}

.lesson-nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
    color: var(--text-secondary);
    text-decoration: none;
}

.lesson-nav a:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
}

.lesson-nav .prev { }
.lesson-nav .next { }

@media (max-width: 900px) {
    .lesson-page {
        grid-template-columns: 1fr;
    }
    .lesson-sidebar {
        position: relative;
        top: 0;
        height: auto;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
    }
    .lesson-content {
        padding: 24px 20px;
    }
}

/* ================================================
   11. Playground / Code Editor
   ================================================ */

.playground-page {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 64px);
}

.playground-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    flex-wrap: wrap;
    gap: 12px;
}

.playground-toolbar select {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 8px 16px;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    font-family: inherit;
}

.playground-toolbar select:focus {
    border-color: var(--brand-500);
}

.playground-actions {
    display: flex;
    gap: 8px;
}

.playground-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    flex: 1;
    min-height: 0;
}

.playground-editor-pane,
.playground-output-pane {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.playground-editor-pane {
    border-right: 1px solid var(--border-subtle);
}

.playground-pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: #161b22;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.playground-editor-wrapper {
    flex: 1;
    min-height: 0;
    position: relative;
}

.playground-textarea {
    width: 100%;
    height: 100%;
    min-height: 400px;
    background: #0d1117;
    color: var(--text-code);
    border: none;
    padding: 20px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', 'Consolas', monospace;
    font-size: 0.88rem;
    line-height: 1.7;
    resize: none;
    outline: none;
    tab-size: 4;
}

.playground-output {
    flex: 1;
    background: #0d1117;
    padding: 20px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', 'Consolas', monospace;
    font-size: 0.85rem;
    color: var(--text-code);
    white-space: pre-wrap;
    overflow: auto;
    min-height: 200px;
}

.playground-output.error {
    color: var(--accent);
}

.playground-output.success {
    color: var(--accent3);
}

@media (max-width: 900px) {
    .playground-main {
        grid-template-columns: 1fr;
    }
    .playground-editor-pane {
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
        height: 50vh;
    }
    .playground-textarea {
        min-height: 300px;
    }
}

/* ================================================
   12. Course Detail Page
   ================================================ */

.course-hero {
    text-align: center;
    padding: 60px 24px 40px;
}

.course-hero-icon {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
    margin-bottom: 24px;
}

.course-hero h1 {
    font-size: 2.2rem;
    margin-bottom: 12px;
}

.course-hero p {
    max-width: 600px;
    margin: 0 auto;
    color: var(--text-secondary);
    line-height: 1.8;
}

.chapter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 24px 80px;
}

.chapter-grid-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    transition: all 0.3s var(--ease-out);
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 16px;
}

.chapter-grid-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
    background: var(--bg-glass-hover);
}

.chapter-num-badge {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: rgba(99,102,241,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: var(--brand-400);
    flex-shrink: 0;
}

.chapter-grid-card h3 {
    font-size: 0.95rem;
    margin: 0;
}

/* ================================================
   13. Empty State
   ================================================ */

.empty-state {
    text-align: center;
    padding: 60px 24px;
}

.empty-state .empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.6;
}

.empty-state h3 {
    font-size: 1.3rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ================================================
   14. Install Page
   ================================================ */

.install-container {
    max-width: 600px;
    margin: 80px auto;
    padding: 0 24px;
}

.install-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 48px;
    text-align: center;
}

.install-card h1 {
    font-size: 1.8rem;
    margin-bottom: 12px;
}

.install-card .status {
    margin: 24px 0;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    line-height: 1.6;
}

.install-card .status.success {
    background: rgba(16,185,129,0.1);
    border: 1px solid rgba(16,185,129,0.2);
    color: var(--accent3);
}

.install-card .status.error {
    background: rgba(244,63,94,0.1);
    border: 1px solid rgba(244,63,94,0.2);
    color: var(--accent);
}

.install-card .status.info {
    background: rgba(99,102,241,0.1);
    border: 1px solid rgba(99,102,241,0.2);
    color: var(--brand-400);
}

/* ================================================
   15. Footer
   ================================================ */

.site-footer {
    text-align: center;
    padding: 40px 24px;
    border-top: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ================================================
   16. Toast / Notifications
   ================================================ */

.toast {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 9999;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-lg);
    font-size: 0.9rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s var(--ease-out);
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success { border-color: var(--accent3); color: var(--accent3); }
.toast.error { border-color: var(--accent); color: var(--accent); }

/* ================================================
   17. Utility & Animations
   ================================================ */

.fade-in {
    animation: fadeIn 0.5s var(--ease-out);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.slide-up {
    animation: slideUp 0.5s var(--ease-out);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Copy button feedback */
.copied-tooltip {
    position: fixed;
    padding: 8px 16px;
    background: var(--accent3);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 9999;
    pointer-events: none;
    animation: tooltipUp 0.3s var(--ease-out) forwards;
}

@keyframes tooltipUp {
    0% { opacity: 0; transform: translateY(10px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Loading spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-default);
    border-top-color: var(--brand-500);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Badge styles */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-primary {
    background: rgba(99,102,241,0.1);
    color: var(--brand-400);
}

.badge-success {
    background: rgba(16,185,129,0.1);
    color: var(--accent3);
}

.badge-warning {
    background: rgba(245,158,11,0.1);
    color: var(--accent2);
}

/* ================================================
   18. Print
   ================================================ */

@media print {
    body { background: #fff; color: #000; }
    .site-header, .lesson-sidebar, .lesson-nav, .site-footer { display: none; }
    .lesson-content { padding: 0; }
    .code-wrapper { border: 1px solid #ccc; }
}
