/* ============================================================
   ECOM LEARN — REDESIGNED FRONTEND STYLESHEET
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
    --sidebar-width: 295px;
    --header-height: 66px;
    --bg: #F0F4FF;
    --surface: #FFFFFF;
    --border: #E4E9F2;
    --text: #0D1117;
    --muted: #6B7A99;
    --radius: 14px;
    --radius-sm: 8px;

    /* Brand gradients */
    --grad-blue:   linear-gradient(135deg, #3B82F6, #2563EB);
    --grad-purple: linear-gradient(135deg, #A855F7, #7C3AED);
    --grad-green:  linear-gradient(135deg, #10B981, #059669);
    --grad-red:    linear-gradient(135deg, #F87171, #DC2626);
    --grad-amber:  linear-gradient(135deg, #FBBF24, #D97706);
    --grad-cyan:   linear-gradient(135deg, #22D3EE, #0891B2);
    --grad-pink:   linear-gradient(135deg, #F472B6, #DB2777);
    --grad-hero:   linear-gradient(135deg, #EEF2FF 0%, #E0F2FE 50%, #F3E8FF 100%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    padding: 0 28px;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 200;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 12px rgba(0,0,0,0.06);
}

.site-header .logo {
    color: #0D1117;
    font-size: 21px;
    font-weight: 900;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.8px;
}
.logo-icon {
    width: 36px; height: 36px;
    background: var(--grad-blue);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px;
    box-shadow: 0 4px 12px rgba(37,99,235,0.4);
}
.logo-text em { color: #2563EB; font-style: normal; }

.header-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 16px;
}
.header-tagline {
    color: #94A3B8;
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: 0.2px;
}
@media (max-width: 768px) { .header-tagline, .header-divider { display: none; } }

.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.header-pill {
    color: #475569;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 7px 16px;
    border-radius: 50px;
    border: 1px solid var(--border);
    transition: all 0.2s;
    display: flex; align-items: center; gap: 6px;
}
.header-pill:hover {
    background: #EFF6FF;
    color: #2563EB;
    border-color: #BFDBFE;
}
.header-pill.active { background: #EFF6FF; color: #2563EB; border-color: #BFDBFE; }

.mobile-menu-btn {
    background: #F1F5F9;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: #475569;
    font-size: 20px;
    width: 38px; height: 38px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}
.mobile-menu-btn:hover { background: #E2E8F0; color: #1E293B; }

@media (max-width: 768px) {
    .mobile-menu-btn { display: flex; }
    .header-pill-hide-mobile { display: none; }
    .pill-text { display: none; }
    /* Contact pill: icon-only circle on mobile */
    .header-pill {
        padding: 8px;
        width: 38px; height: 38px;
        justify-content: center;
        border-radius: 8px;
    }
}

/* ============================================================
   USER ACCOUNT CHIP & DROPDOWN
   ============================================================ */
.uc-wrap { position: relative; }

.uc-btn {
    background: linear-gradient(135deg, #EFF6FF, #F5F3FF);
    color: #1E40AF !important;
    border-color: #BFDBFE !important;
    font-weight: 600;
}
.uc-btn:hover {
    background: linear-gradient(135deg, #DBEAFE, #EDE9FE) !important;
    color: #1D4ED8 !important;
    border-color: #93C5FD !important;
}

.uc-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: #fff;
    border: 1.5px solid #E4E9F2;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    z-index: 500;
    overflow: hidden;
    animation: ucDrop .18s ease;
}
.uc-menu.open { display: block; }
@keyframes ucDrop {
    from { opacity:0; transform:translateY(-6px) scale(.97); }
    to   { opacity:1; transform:translateY(0) scale(1); }
}

.uc-menu-header {
    padding: 14px 16px 10px;
    border-bottom: 1px solid #F1F5F9;
    background: linear-gradient(135deg, #F8FAFF, #F5F3FF);
}
.uc-menu-name  { font-size:13.5px; font-weight:800; color:#0F172A; }
.uc-menu-email { font-size:11.5px; color:#94A3B8; margin-top:2px; word-break:break-all; }

.uc-menu-stat {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 16px;
    background: #FFFBEB;
    border-bottom: 1px solid #FEF3C7;
    font-size: 12.5px; font-weight: 700; color: #92400E;
}
.uc-menu-stat i { color: #D97706; font-size: 13px; }

.uc-menu-link {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 16px;
    font-size: 13px; font-weight: 600; color: #374151;
    text-decoration: none;
    transition: background .12s, color .12s;
    border-bottom: 1px solid #F1F5F9;
}
.uc-menu-link:last-child { border-bottom: none; }
.uc-menu-link:hover { background: #F8FAFC; color: #1E293B; }
.uc-menu-link i { font-size: 14px; color: #64748B; }
.uc-menu-link-danger { color: #DC2626 !important; }
.uc-menu-link-danger:hover { background: #FEF2F2 !important; }
.uc-menu-link-danger i { color: #DC2626 !important; }

@media (max-width: 768px) {
    /* Hide chevron — icon-only on mobile */
    .uc-btn .bi-chevron-down { display: none; }
    /* Match the same square style as other pills, but keep the blue tint */
    .uc-btn {
        background: linear-gradient(135deg, #EFF6FF, #EDE9FE) !important;
        border-color: #BFDBFE !important;
    }
    /* Drop down opens flush to the right edge of the viewport */
    .uc-menu {
        position: fixed;
        top: calc(var(--header-height) + 6px);
        right: 12px;
        left: auto;
        min-width: 220px;
    }
}

/* ============================================================
   READING PROGRESS BAR
   ============================================================ */
#readingProgress {
    position: fixed;
    top: 0; left: 0;
    height: 3px;
    background: linear-gradient(90deg, #3B82F6, #A855F7, #F472B6);
    z-index: 300;
    transition: width 0.1s linear;
    width: 0;
    border-radius: 0 2px 2px 0;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.app-layout {
    display: flex;
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
}

/* ============================================================
   SIDEBAR — Clean learning hierarchy
   ============================================================ */
.sidebar {
    width: var(--sidebar-width);
    background: #FAFBFE;
    border-right: 1px solid var(--border);
    position: fixed;
    top: var(--header-height);
    bottom: 0; left: 0;
    overflow-y: auto;
    z-index: 150;
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    scrollbar-width: thin;
    scrollbar-color: #E2E8F0 transparent;
    display: flex;
    flex-direction: column;
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: #E2E8F0; border-radius: 4px; }

/* ── Header ──────────────────────────────────────────── */
.sb-header {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 13px 14px 12px;
    border-bottom: 1px solid var(--border);
    background: white;
    flex-shrink: 0;
}
.sb-header-icon {
    width: 26px; height: 26px;
    background: linear-gradient(135deg, #3B82F6, #2563EB);
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 11px;
    flex-shrink: 0;
}
.sb-header-title {
    font-size: 12px; font-weight: 800;
    color: #1E293B; letter-spacing: .02em;
    text-transform: uppercase;
}

/* ── Search ──────────────────────────────────────────── */
.sb-search {
    position: relative;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    background: white;
    flex-shrink: 0;
}
.sb-search-icon {
    position: absolute;
    left: 22px; top: 50%;
    transform: translateY(-50%);
    color: #CBD5E1; font-size: 11px;
    pointer-events: none;
}
.sb-search input {
    width: 100%;
    padding: 7px 10px 7px 28px;
    border: 1.5px solid #E9EEF5;
    border-radius: 8px;
    font-size: 12px; font-family: inherit;
    outline: none;
    background: #F8FAFD;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
.sb-search input::placeholder { color: #C4CADB; }
.sb-search input:focus {
    border-color: #93C5FD;
    background: white;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

/* ── Topic list shell ────────────────────────────────── */
.sb-list { flex: 1; padding-bottom: 20px; }

/* ── Topic accordion button ──────────────────────────── */
.sb-topic { border-bottom: 1px solid var(--border); }

.sb-topic-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px 10px 14px;
    background: none; border: none;
    text-align: left; cursor: pointer;
    font-family: inherit;
    border-left: 3px solid transparent;
    transition: background .13s, border-color .13s;
}
.sb-topic-btn:hover { background: #F0F4FB; }
.sb-topic-btn.is-open {
    border-left-color: var(--tc, #2563EB);
    background: #F5F8FF;
}

.sb-topic-ico {
    width: 28px; height: 28px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; color: white;
    flex-shrink: 0;
    opacity: .92;
    transition: opacity .15s, transform .15s;
}
.sb-topic-btn:hover .sb-topic-ico,
.sb-topic-btn.is-open .sb-topic-ico { opacity: 1; transform: scale(1.06); }

.sb-topic-name {
    flex: 1; min-width: 0;
    font-size: 13px; font-weight: 700;
    color: #1E293B; letter-spacing: -.2px;
    line-height: 1.3;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-topic-btn.is-open .sb-topic-name { color: #1D4ED8; }

.sb-topic-count {
    font-size: 10px; font-weight: 800;
    color: #94A3B8;
    background: #F1F5F9;
    border-radius: 20px;
    padding: 1px 7px;
    flex-shrink: 0;
    transition: background .13s, color .13s;
}
.sb-topic-btn.is-open .sb-topic-count { background: #DBEAFE; color: #2563EB; }

.sb-topic-chevron {
    font-size: 9px; color: #CBD5E1; flex-shrink: 0;
    transition: transform .22s cubic-bezier(.4,0,.2,1), color .13s;
}
.sb-topic-btn.is-open .sb-topic-chevron { transform: rotate(90deg); color: #3B82F6; }

/* ── Topic body ──────────────────────────────────────── */
.sb-topic-body { display: none; padding: 4px 0 6px; }
.sb-topic-body.is-open { display: block; }

/* ── Lesson row ──────────────────────────────────────── */
.sb-lesson {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 12px 7px 17px;
    text-decoration: none;
    border-left: 2.5px solid transparent;
    transition: background .12s, border-color .12s;
}
.sb-lesson-sub { padding-left: 28px; }
.sb-lesson:hover { background: #EEF4FF; }
.sb-lesson.is-active {
    background: linear-gradient(90deg, #EFF6FF 0%, transparent 100%);
    border-left-color: var(--lc, #2563EB);
}

.sb-lesson-num {
    width: 20px; height: 20px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 9.5px; font-weight: 900;
    color: #B0BCCE;
    background: #F1F5F9;
    border: 1.5px solid #E4E9F2;
    flex-shrink: 0;
    transition: all .12s;
    font-variant-numeric: tabular-nums;
}
.sb-lesson:hover .sb-lesson-num { background: #DBEAFE; color: #2563EB; border-color: #93C5FD; }

.sb-lesson-title {
    flex: 1; min-width: 0;
    font-size: 12.5px; font-weight: 500;
    color: #475569;
    line-height: 1.4;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    transition: color .12s;
}
.sb-lesson:hover .sb-lesson-title { color: #1E293B; }
.sb-lesson.is-active .sb-lesson-title { color: #1D4ED8; font-weight: 700; }

.sb-lesson-pip {
    width: 5px; height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
    opacity: .8;
}

/* ── Sub-topic divider ───────────────────────────────── */
.sb-subtopic-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    padding: 7px 12px 6px 17px;
    background: none; border: none;
    text-align: left; cursor: pointer;
    font-family: inherit;
    transition: background .12s;
}
.sb-subtopic-btn:hover { background: #F0F4FB; }

.sb-subtopic-name {
    flex: 1; min-width: 0;
    font-size: 10px; font-weight: 800;
    color: #94A3B8;
    text-transform: uppercase; letter-spacing: .07em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    transition: color .12s;
}
.sb-subtopic-btn.is-open .sb-subtopic-name { color: #64748B; }

.sb-subtopic-count {
    font-size: 9.5px; font-weight: 800;
    color: #CBD5E1;
    background: #F1F5F9;
    border-radius: 20px;
    padding: 1px 6px;
    flex-shrink: 0;
    transition: background .12s, color .12s;
}
.sb-subtopic-btn.is-open .sb-subtopic-count { background: #EEF2FF; color: #6366F1; }

.sb-subtopic-chevron {
    font-size: 8px; color: #E2E8F0; flex-shrink: 0;
    transition: transform .2s, color .12s;
}
.sb-subtopic-btn.is-open .sb-subtopic-chevron { transform: rotate(90deg); color: #94A3B8; }

.sb-subtopic-body { display: none; }
.sb-subtopic-body.is-open { display: block; }

/* ── Coming soon ─────────────────────────────────────── */
.sb-coming-soon {
    padding: 7px 14px 7px 28px;
    font-size: 11px; color: #CBD5E1;
    font-style: italic;
    display: flex; align-items: center; gap: 6px;
}

/* ── Mobile slide-in ─────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); box-shadow: none; }
    .sidebar.mobile-open { transform: translateX(0); box-shadow: 10px 0 40px rgba(0,0,0,0.18); }
}

/* Overlay */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(10,10,20,0.45);
    backdrop-filter: blur(3px);
    z-index: 140;
}
.sidebar-overlay.open { display: block; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-width: 0;
    padding: 36px 40px;
}
@media (max-width: 768px) {
    .main-content { margin-left: 0; padding: 20px 16px; }
}

/* ============================================================
   HOME — HERO  (two-column layout)
   ============================================================ */
.home-hero {
    background: linear-gradient(135deg, #FFFFFF 0%, #F8FAFC 100%);
    border-radius: 20px;
    padding: 52px 52px 44px;
    margin-bottom: 36px;
    position: relative;
    overflow: hidden;
    border: 1px solid #E2E8F0;
    display: flex;
    gap: 40px;
    align-items: center;
}
.home-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 80% 20%, rgba(59,130,246,0.05) 0%, transparent 50%),
        radial-gradient(circle at 10% 80%, rgba(148,113,233,0.04) 0%, transparent 50%);
    pointer-events: none;
}
/* Left: text content */
.home-hero-content { flex: 1 1 360px; position: relative; z-index: 1; }

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #EFF6FF, #F5F3FF);
    border: 1px solid #BFDBFE;
    border-radius: 50px;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 700;
    color: #1E40AF;
    letter-spacing: 0.3px;
    margin-bottom: 18px;
}
.hero-badge i { color: #F59E0B; }

.home-hero h1 {
    font-size: 40px;
    font-weight: 900;
    color: #0F172A;
    margin-bottom: 14px;
    line-height: 1.1;
    letter-spacing: -1.5px;
}
.home-hero h1 span { color: #2563EB; }

.home-hero > .home-hero-content > p,
.home-hero-content > p {
    font-size: 16px;
    color: #475569;
    max-width: 480px;
    line-height: 1.7;
    margin-bottom: 28px;
}

/* CTA buttons */
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.hero-cta-primary {
    display: inline-flex; align-items: center; gap: 8px;
    background: linear-gradient(135deg, #3B82F6, #2563EB);
    color: white; border-radius: 50px;
    padding: 13px 26px; font-size: 14px; font-weight: 700;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(37,99,235,0.3);
    transition: all 0.2s;
}
.hero-cta-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(37,99,235,0.4); }
.hero-cta-secondary {
    display: inline-flex; align-items: center; gap: 8px;
    background: white; color: #374151; border-radius: 50px;
    padding: 13px 24px; font-size: 14px; font-weight: 600;
    text-decoration: none; border: 1.5px solid #E2E8F0;
    transition: all 0.2s;
}
.hero-cta-secondary:hover { border-color: #93C5FD; color: #2563EB; background: #F8FBFF; }

/* Feature ticks */
.hero-features { display: flex; gap: 18px; flex-wrap: wrap; }
.hero-feature {
    display: flex; align-items: center; gap: 6px;
    font-size: 12.5px; font-weight: 600; color: #64748B;
}
.hero-feature i { color: #10B981; font-size: 13px; }

/* Right: visual panel */
.home-hero-visual { flex: 0 0 300px; position: relative; z-index: 1; }

/* 2×2 stat cards */
.hero-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}
.hero-stat-card {
    background: white;
    border: 1.5px solid #E4E9F2;
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: all 0.2s;
}
.hero-stat-card:hover {
    border-color: var(--c, #2563EB);
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    transform: translateY(-2px);
}
.hsc-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
}
.hsc-val {
    font-size: 24px; font-weight: 900; color: #0F172A; line-height: 1;
    letter-spacing: -0.5px;
}
.hsc-lbl { font-size: 11.5px; color: #94A3B8; font-weight: 600; }

/* Topic chips */
.hero-topic-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.hero-chip {
    display: inline-flex; align-items: center; gap: 5px;
    background: white; border: 1.5px solid #E4E9F2;
    border-radius: 50px; padding: 5px 12px;
    font-size: 12px; font-weight: 600; color: #374151;
    text-decoration: none; transition: all 0.2s;
}
.hero-chip:hover { border-color: var(--cc, #2563EB); color: var(--cc, #2563EB); background: #F8FBFF; }
.hero-chip i { font-size: 12px; }
.hero-chip-more {
    background: #F1F5F9; color: #64748B; border-color: transparent;
    cursor: default;
}

@media (max-width: 960px) { .home-hero-visual { display: none; } }
@media (max-width: 640px) {
    .home-hero { padding: 28px 20px 24px; flex-direction: column; gap: 0; border-radius: 14px; }
    .home-hero h1 { font-size: 26px; letter-spacing: -0.8px; }
    .home-hero-content > p { font-size: 14.5px; margin-bottom: 20px; }
    .hero-actions { gap: 10px; }
    .hero-cta-primary, .hero-cta-secondary { padding: 11px 20px; font-size: 13px; }
    .hero-features { gap: 12px; }
}

/* ============================================================
   SECTION HEADER
   ============================================================ */
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.section-head h2 {
    font-size: 19px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-head h2 .section-icon {
    width: 32px; height: 32px;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    color: #000000;
    flex-shrink: 0;
}
.section-count {
    font-size: 12px;
    font-weight: 600;
    color: #3B82F6;
    background: #EFF6FF;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid #DBEAFE;
}

/* ============================================================
   TOPIC CARDS
   ============================================================ */
.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.topic-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 22px 22px 18px;
    border: 1.5px solid var(--border);
    text-decoration: none;
    color: var(--text);
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
    position: relative;
    overflow: hidden;
}
.topic-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: var(--radius) var(--radius) 0 0;
    opacity: 0;
    transition: opacity 0.2s;
}
.topic-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.1);
    border-color: transparent;
}
.topic-card:hover::before { opacity: 1; }

.topic-icon-wrap {
    margin-bottom: 14px;
}
.topic-icon {
    width: 48px; height: 48px;
    border-radius: 13px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    color: #000000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
    position: relative;
    transition: transform 0.2s;
}
.topic-card:hover .topic-icon { transform: scale(1.1) rotate(-3deg); }

.topic-card h3 {
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 6px;
    letter-spacing: -0.3px;
    line-height: 1.3;
}
.topic-card p {
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.55;
    margin-bottom: 14px;
}
.topic-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.lesson-pill {
    font-size: 11.5px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.topic-arrow {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: #F1F5F9;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
    color: var(--muted);
    transition: all 0.2s;
}
.topic-card:hover .topic-arrow {
    background: #DBEAFE;
    color: #2563EB;
    transform: translateX(3px);
}

/* ============================================================
   LESSON PAGE
   ============================================================ */
.lesson-container { max-width: 840px; margin: 0 auto; }

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--muted);
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.breadcrumb a { color: #3B82F6; text-decoration: none; font-weight: 500; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { color: #CBD5E1; font-size: 10px; }

/* Lesson header card */
.lesson-header {
    background: white;
    border-radius: 18px;
    padding: 32px 36px;
    margin-bottom: 20px;
    border: 1.5px solid var(--border);
    position: relative;
    overflow: hidden;
}
.lesson-header::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    border-radius: 18px 18px 0 0;
}

.lesson-category-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 50px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: white;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.lesson-header h1 {
    font-size: 30px;
    font-weight: 900;
    line-height: 1.25;
    margin-bottom: 14px;
    letter-spacing: -0.8px;
    color: #0D1117;
}

.lesson-meta {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    font-size: 12.5px;
    color: var(--muted);
    font-weight: 500;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.lesson-meta-item { display: flex; align-items: center; gap: 5px; }
.lesson-meta-item i { font-size: 13px; }

.lesson-excerpt {
    font-size: 15.5px;
    color: #475569;
    line-height: 1.65;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

/* ============================================================
   CONTENT BLOCKS
   ============================================================ */
.content-block {
    background: white;
    border-radius: var(--radius);
    margin-bottom: 16px;
    border: 1.5px solid var(--border);
    overflow: hidden;
    transition: box-shadow 0.2s;
}
.content-block:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.06); }

/* TEXT BLOCK */
.block-text { padding: 30px 36px; }
.block-text h2 {
    font-size: 22px; font-weight: 800;
    margin: 28px 0 12px;
    color: #0D1117;
    letter-spacing: -0.5px;
    display: flex; align-items: center; gap: 10px;
}
.block-text h2::before {
    content: '';
    width: 4px; height: 22px;
    background: var(--grad-blue);
    border-radius: 3px;
    flex-shrink: 0;
}
.block-text h3 { font-size: 18px; font-weight: 700; margin: 22px 0 10px; color: #1E293B; }
.block-text p { font-size: 15.5px; line-height: 1.8; color: #374151; margin-bottom: 16px; word-break: break-word; overflow-wrap: break-word; }
.block-text ul, .block-text ol { padding-left: 22px; margin-bottom: 16px; }
.block-text li { font-size: 15.5px; line-height: 1.75; color: #374151; margin-bottom: 6px; word-break: break-word; overflow-wrap: break-word; }
.block-text strong { color: #0D1117; font-weight: 700; }
.block-text a { color: #2563EB; text-decoration: underline; text-underline-offset: 2px; }
.block-text img, .block-image img, .block-figure img { max-width: 100%; height: auto; }

/* IMAGE BLOCK */
.block-image { background: #F8FAFF; border-radius: 12px; overflow: hidden; }
.block-image img { width: 100%; max-height: 280px; aspect-ratio: auto; display: block; object-fit: cover; object-position: center; }
.img-caption {
    padding: 11px 24px;
    font-size: 12.5px;
    color: var(--muted);
    background: #F8FAFF;
    border-top: 1px solid var(--border);
    text-align: center;
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* VIDEO BLOCK */
.block-video .video-wrapper {
    position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;
    background: #F1F5F9;
}
.block-video iframe, .block-video video {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
}
.video-caption {
    padding: 11px 24px;
    font-size: 12.5px;
    color: var(--muted);
    border-top: 1px solid var(--border);
    background: #F8FAFF;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* CHART BLOCK */
.block-chart { padding: 28px 36px; }
.block-chart-title {
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #1E293B;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.chart-icon {
    width: 28px; height: 28px;
    background: var(--grad-green);
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 13px;
}
.block-chart canvas { max-height: 320px; }

/* NUMBER STAT BLOCK */
.block-number-stat {
    display: flex;
    align-items: center;
    gap: 0;
    overflow: hidden;
}
.stat-accent-bar {
    width: 5px;
    align-self: stretch;
    flex-shrink: 0;
}
.stat-content {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 28px 32px;
    flex: 1;
}
.stat-number-wrap {
    flex-shrink: 0;
    line-height: 1;
}
.stat-number {
    font-size: 52px;
    font-weight: 900;
    letter-spacing: -2px;
    line-height: 1;
}
.stat-suffix { font-size: 26px; font-weight: 800; letter-spacing: -1px; opacity: 0.8; }
.stat-info h3 { font-size: 16px; font-weight: 800; margin-bottom: 5px; color: #1E293B; }
.stat-info p { font-size: 13.5px; color: var(--muted); line-height: 1.55; }
.stat-visual {
    margin-left: auto;
    flex-shrink: 0;
    opacity: 0.07;
    font-size: 80px;
}

/* QUOTE BLOCK */
.block-quote {
    padding: 0;
    background: linear-gradient(135deg, #EFF6FF 0%, #F0F4FF 100%);
    border: none;
    border-left: 5px solid #3B82F6;
    border-radius: 0 var(--radius) var(--radius) 0;
    overflow: hidden;
}
.quote-inner { padding: 28px 36px; }
.quote-icon {
    width: 36px; height: 36px;
    background: var(--grad-blue);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 18px;
    margin-bottom: 14px;
    box-shadow: 0 3px 10px rgba(37,99,235,0.25);
}
.block-quote blockquote {
    font-size: 19px;
    font-weight: 700;
    line-height: 1.55;
    color: #1E3A8A;
    margin-bottom: 14px;
    letter-spacing: -0.3px;
}
.block-quote cite {
    font-size: 13px;
    color: #3B82F6;
    font-style: normal;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}
.block-quote cite::before { content: '—'; opacity: 0.5; }

/* FIGURE BLOCK */
.block-figure { padding: 24px 36px; text-align: center; }
.figure-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #F1F5F9;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}
.block-figure img { max-width: 100%; border-radius: 10px; border: 1.5px solid var(--border); margin-bottom: 12px; }
.block-figure figcaption { font-size: 13px; color: var(--muted); font-style: italic; }
.fig-placeholder {
    background: linear-gradient(135deg, #F8FAFF, #EFF4FF);
    border: 2px dashed #BFDBFE;
    border-radius: 12px;
    padding: 48px;
    color: #93C5FD;
    font-size: 14px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.fig-placeholder i { font-size: 36px; }

/* DIVIDER BLOCK */
.block-divider { padding: 6px 36px; border: none; background: transparent; box-shadow: none; }
.block-divider hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border) 20%, var(--border) 80%, transparent);
}

/* CALLOUT BLOCK */
.block-callout { padding: 0; border-radius: var(--radius); overflow: hidden; }
.callout-inner { padding: 20px 24px; }
.callout-head {
    font-size: 13.5px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 8px;
    letter-spacing: -0.1px;
}
.callout-body { font-size: 14.5px; line-height: 1.7; color: #374151; }

/* KEY POINTS BLOCK */
.block-key-points { padding: 0; overflow: hidden; }
.kp-inner { padding: 0; }
.kp-header {
    background: linear-gradient(135deg, #F0FDF4, #DCFCE7);
    border-bottom: 1px solid #BBF7D0;
    padding: 14px 24px;
    font-size: 14px;
    font-weight: 800;
    color: #15803D;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.2px;
}
.kp-list { list-style: none; padding: 14px 24px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.kp-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14.5px;
    color: #1E293B;
    line-height: 1.6;
    font-weight: 500;
}
.kp-item i { font-size: 16px; flex-shrink: 0; margin-top: 2px; }

/* CODE BLOCK */
.block-code { padding: 0; overflow: hidden; background: #F8FAFF; border: 1.5px solid #E4E9F2; }
.code-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #F1F5F9;
    border-bottom: 1.5px solid #E4E9F2;
}
.code-dots { display: flex; gap: 5px; }
.code-dots span { width: 10px; height: 10px; border-radius: 50%; }
.code-dots span:nth-child(1) { background: #EF4444; }
.code-dots span:nth-child(2) { background: #F59E0B; }
.code-dots span:nth-child(3) { background: #10B981; }
.code-lang {
    font-size: 10.5px;
    font-weight: 800;
    color: #7C3AED;
    background: #EDE9FE;
    padding: 2px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
    flex-shrink: 0;
}
.code-cap { font-size: 12px; color: #64748B; margin-left: auto; font-style: italic; }
.code-pre {
    margin: 0;
    padding: 20px 24px;
    overflow-x: auto;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 13.5px;
    line-height: 1.75;
    color: #1E293B;
    background: #F8FAFF;
    white-space: pre;
    border-top: none;
}
.code-pre code { background: none; padding: 0; color: inherit; }

/* TABLE BLOCK */
.block-table {
    padding: 0;
    overflow: hidden;
    border: 1px solid #DBEAFE;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(37,99,235,0.07);
}
.table-cap {
    padding: 14px 22px;
    font-size: 13px;
    color: #475569;
    background: linear-gradient(135deg, #EEF2FF, #E0F2FE);
    border-bottom: 1px solid #DBEAFE;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    letter-spacing: 0.1px;
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.content-table { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 400px; }
.content-table thead { background: linear-gradient(135deg, #EEF2FF, #EFF4FF); }
.content-table th {
    padding: 13px 20px;
    text-align: left;
    font-weight: 700;
    color: #2563EB;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 2px solid #BFDBFE;
    white-space: nowrap;
}
.content-table td {
    padding: 13px 20px;
    border-bottom: 1px solid #EEF2FF;
    color: #334155;
    vertical-align: middle;
    line-height: 1.6;
}
.content-table tbody tr:last-child td { border-bottom: none; }
.content-table tbody tr:nth-child(even) td { background: #FAFBFF; }
.content-table tbody tr:hover td { background: #EFF6FF; transition: background 0.15s; }

/* ============================================================
   PREV / NEXT NAV
   ============================================================ */
.lesson-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 28px;
    margin-bottom: 40px;
}
.lesson-nav a {
    background: white;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 22px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.lesson-nav a:hover {
    border-color: #3B82F6;
    box-shadow: 0 6px 20px rgba(59,130,246,0.12);
    transform: translateY(-2px);
}
.nav-dir { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; display: flex; align-items: center; gap: 5px; }
.nav-title { font-size: 14px; font-weight: 700; color: #2563EB; letter-spacing: -0.2px; }
.lesson-nav .nav-next { text-align: right; }
.lesson-nav .nav-next .nav-dir { justify-content: flex-end; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 80px 40px;
    color: var(--muted);
}
.empty-state-icon {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, #F1F5F9, #E2E8F0);
    border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 32px;
    color: #94A3B8;
    margin: 0 auto 20px;
}
.empty-state h2 { font-size: 20px; font-weight: 800; margin-bottom: 8px; color: #1E293B; }
.empty-state p { font-size: 14px; line-height: 1.6; }
.empty-state a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    background: var(--grad-blue);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(37,99,235,0.3);
    transition: all 0.2s;
}
.empty-state a:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(37,99,235,0.35); }

/* ============================================================
   LESSON PAGE — Two-column layout (content + right panel)
   ============================================================ */
.lesson-page-wrap {
    display: flex;
    gap: 24px;
    align-items: stretch;
}
.lesson-main {
    flex: 1;
    min-width: 0;
    width: 0;
    overflow-x: hidden;
}

/* ── POSITION BAR ─────────────────────────────────────────── */
.lesson-position-bar {
    background: white;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 12px 18px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.lpb-track {
    display: flex;
    align-items: center;
    gap: 4px;
}
.lpb-step {
    display: flex;
    align-items: center;
    position: relative;
    text-decoration: none;
}
.lpb-step::after {
    content: '';
    display: block;
    width: 16px;
    height: 2px;
    background: #E4E9F2;
    margin-left: 4px;
}
.lpb-step:last-child::after { display: none; }
.lpb-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: #E4E9F2;
    border: 2px solid white;
    box-shadow: 0 0 0 1.5px #E4E9F2;
    transition: all 0.15s;
}
.lpb-step-active .lpb-dot {
    width: 14px; height: 14px;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.lpb-step:hover .lpb-dot { background: #93C5FD; box-shadow: 0 0 0 2px rgba(59,130,246,0.2); }

.lpb-info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lpb-badge {
    font-size: 11.5px;
    font-weight: 800;
    color: white;
    padding: 3px 12px;
    border-radius: 20px;
    letter-spacing: 0.1px;
}
.lpb-context { font-size: 12px; color: #94A3B8; font-weight: 500; }
.lpb-context a { color: #3B82F6; text-decoration: none; font-weight: 600; }
.lpb-context a:hover { text-decoration: underline; }

/* ── SIBLINGS PANEL ───────────────────────────────────────── */
.lesson-siblings {
    background: white;
    border: 1.5px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    margin-top: 20px;
    margin-bottom: 4px;
}
.siblings-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: #FAFBFF;
}
.siblings-icon {
    width: 36px; height: 36px;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    flex-shrink: 0;
}
.siblings-title { font-size: 13.5px; color: #1E293B; font-weight: 600; }
.siblings-title strong { font-weight: 800; }
.siblings-sub { font-size: 11.5px; color: #94A3B8; margin-top: 1px; }

.siblings-list {}
.sibling-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--border);
    transition: all 0.15s;
    border-left: 3px solid transparent;
}
.sibling-item:last-child { border-bottom: none; }
.sibling-item:hover { background: #F8FAFF; }
.sibling-active {
    background: linear-gradient(90deg, #EFF6FF, #F8FBFF) !important;
    border-left-color: var(--sib-color, #2563EB);
}
.sibling-num {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: #F1F5F9;
    border: 1.5px solid #E2E8F0;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 900;
    color: #94A3B8;
    flex-shrink: 0;
    font-family: 'Inter', sans-serif;
}
.sibling-text { flex: 1; min-width: 0; }
.sibling-title {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sibling-active .sibling-title { color: #1D4ED8; font-weight: 800; }
.sibling-time { font-size: 11px; color: #94A3B8; font-weight: 500; display: flex; align-items: center; gap: 3px; margin-top: 2px; }
.sibling-current {
    font-size: 10px; font-weight: 800; color: white;
    padding: 2px 8px; border-radius: 10px;
    text-transform: uppercase; letter-spacing: 0.5px;
    flex-shrink: 0;
}
.sibling-arrow { color: #CBD5E1; font-size: 11px; flex-shrink: 0; }
.sibling-item:hover .sibling-arrow { color: #3B82F6; transform: translateX(2px); }

.siblings-overview-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 11px;
    font-size: 12.5px;
    font-weight: 700;
    color: #3B82F6;
    text-decoration: none;
    border-top: 1px solid var(--border);
    background: #F8FAFF;
    transition: all 0.15s;
}
.siblings-overview-link:hover { background: #EFF6FF; color: #1D4ED8; }

/* ── RIGHT PANEL (TOC + Ads) ──────────────────────────────── */
.lesson-toc {
    width: 240px;
    flex-shrink: 0;
}
.toc-sticky {
    position: sticky;
    top: calc(var(--header-height) + 24px);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.toc-inner {
    background: white;
    border: 1.5px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}
.toc-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: #FAFBFF;
    font-size: 11.5px;
    font-weight: 800;
    color: #1E293B;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}
.toc-nav {
    padding: 8px 0;
    max-height: 220px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #E2E8F0 transparent;
}
.toc-nav::-webkit-scrollbar { width: 3px; }
.toc-nav::-webkit-scrollbar-track { background: transparent; }
.toc-nav::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
.toc-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 14px;
    text-decoration: none;
    font-size: 12px;
    color: #64748B;
    font-weight: 500;
    line-height: 1.4;
    transition: all 0.15s;
    border-left: 2px solid transparent;
}
.toc-item:hover { color: #2563EB; background: #EFF6FF; border-left-color: #93C5FD; }
.toc-item.toc-active { color: #2563EB; border-left-color: #2563EB; font-weight: 700; background: linear-gradient(90deg, #EFF6FF, white); }
.toc-item-h3 { padding-left: 24px; font-size: 11.5px; }
.toc-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; margin-top: 5px; opacity: 0.4; }
.toc-item.toc-active .toc-dot { opacity: 1; }
.toc-empty { padding: 12px 14px; font-size: 12px; color: #CBD5E1; font-style: italic; }

.toc-progress-wrap {
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    background: #FAFBFF;
}
.toc-progress-label { font-size: 10.5px; font-weight: 700; color: #94A3B8; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.toc-progress-bar { height: 5px; background: #F1F5F9; border-radius: 10px; overflow: hidden; }
.toc-progress-fill { height: 100%; border-radius: 10px; transition: width 0.3s; width: 0%; }

/* ── AD SECTION ───────────────────────────────────────────── */
.ad-panel {
    background: white;
    border: 1.5px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}
.ad-panel-header {
    padding: 8px 12px;
    background: #FAFBFF;
    border-bottom: 1px solid var(--border);
    font-size: 9px;
    font-weight: 700;
    color: #CBD5E1;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
}
.ad-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    background: linear-gradient(135deg, #F8FAFF 0%, #EFF6FF 100%);
    border-bottom: 1px solid var(--border);
    color: #94A3B8;
    font-size: 11px;
    text-align: center;
    padding: 16px 12px;
    flex-direction: column;
    gap: 6px;
}
.ad-slot:last-child { border-bottom: none; }
.ad-slot i { font-size: 22px; opacity: 0.4; }
.ad-slot-label { font-size: 10px; font-weight: 600; color: #CBD5E1; }
.ad-slot-link { text-decoration: none; display: block; padding: 0; transition: opacity .15s; }
.ad-slot-link:hover { opacity: .85; }
.ad-slot-link img { border-radius: 0; }

/* ── IMAGE + TEXT BLOCK ───────────────────────────────────── */
.block-image-text {
    display: flex;
    align-items: stretch;
    background: white;
    border: 1.5px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.04);
    transition: box-shadow .22s, transform .22s;
}
.block-image-text:hover {
    box-shadow: 0 12px 40px rgba(0,0,0,0.11), 0 2px 8px rgba(0,0,0,0.05);
    transform: translateY(-3px);
}
.block-image-text.bit-flip { flex-direction: row-reverse; }

/* ── Media (image) side ─── */
.bit-media {
    flex: 0 0 42%;
    position: relative;
    overflow: hidden;
    background: #F1F5F9;
    min-height: 260px;
}
.bit-media img {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .5s cubic-bezier(.25,.46,.45,.94);
}
.block-image-text:hover .bit-media img { transform: scale(1.04); }

/* Caption overlay at bottom of image */
.bit-cap-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 32px 14px 12px;
    background: linear-gradient(to top, rgba(0,0,0,0.58) 0%, transparent 100%);
    color: rgba(255,255,255,0.92);
    font-size: 11.5px;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.4;
}
.bit-cap-overlay i { font-size: 10px; opacity: .75; flex-shrink: 0; }

/* Placeholder when no image */
.bit-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #CBD5E1;
    gap: 10px;
    font-size: 12px;
    background: linear-gradient(135deg, #F8FAFF, #EFF4FF);
}
.bit-placeholder i { font-size: 36px; }

/* ── Body (text) side ─── */
.bit-body {
    flex: 1;
    display: flex;
    align-items: center;
    min-width: 0;
    padding: 36px 38px;
    position: relative;
    background: white;
}

/* Decorative large open-quote */
.bit-body::before {
    content: '\201C';
    position: absolute;
    top: 6px; left: 24px;
    font-size: 96px;
    line-height: 1;
    font-family: Georgia, 'Times New Roman', serif;
    color: #EFF6FF;
    pointer-events: none;
    user-select: none;
}

.bit-body-inner {
    position: relative;
    z-index: 1;
    width: 100%;
}

/* Typography inside bit-body */
.bit-body-inner h2 {
    font-size: 20px; font-weight: 800;
    color: #0F172A; margin: 0 0 14px;
    letter-spacing: -.4px; line-height: 1.3;
}
.bit-body-inner h3 {
    font-size: 17px; font-weight: 700;
    color: #1E293B; margin: 0 0 12px;
    letter-spacing: -.3px;
}
.bit-body-inner p {
    font-size: 15px; line-height: 1.82;
    color: #374151; margin: 0 0 14px;
}
.bit-body-inner p:last-child { margin-bottom: 0; }
.bit-body-inner ul, .bit-body-inner ol {
    padding-left: 20px; margin: 0 0 14px;
}
.bit-body-inner li { font-size: 15px; line-height: 1.7; color: #374151; margin-bottom: 5px; }
.bit-body-inner strong { color: #0F172A; font-weight: 700; }
.bit-body-inner a { color: #2563EB; text-underline-offset: 2px; }

.bit-empty { color: #CBD5E1; font-style: italic; }

/* ── Mobile: stack vertically ─── */
@media (max-width: 680px) {
    .block-image-text,
    .block-image-text.bit-flip { flex-direction: column; transform: none !important; }
    .block-image-text:hover { transform: none; }
    .bit-media { flex: none; min-height: 200px; height: 220px; }
    .bit-body { padding: 22px 20px; }
    .bit-body::before { font-size: 64px; top: 2px; left: 14px; }
    .bit-body-inner h2 { font-size: 17px; }
    .bit-body-inner h3 { font-size: 15px; }
    .bit-body-inner p, .bit-body-inner li { font-size: 14px; }
}

/* ── MOBILE LESSON ASIDE (TOC + Sponsored) — hidden on wide screens ── */
.mobile-lesson-aside { display: none; margin-bottom: 20px; }

@media (max-width: 1100px) {
    .mobile-lesson-aside { display: block; }
}

.mobile-toc-details {
    background: white;
    border: 1.5px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 12px;
}
.mobile-toc-details[open] { margin-bottom: 12px; }
.mobile-toc-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    background: #FAFBFF;
    list-style: none;
    font-size: 11.5px;
    font-weight: 800;
    color: #1E293B;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-bottom: 1px solid transparent;
    transition: background 0.15s;
}
.mobile-toc-details[open] .mobile-toc-summary { border-bottom-color: var(--border); }
.mobile-toc-summary::-webkit-details-marker { display: none; }
.mobile-toc-summary:hover { background: #EFF6FF; }
.mobile-toc-label { display: flex; align-items: center; gap: 8px; }
.mobile-toc-chevron {
    font-size: 12px;
    color: #94A3B8;
    transition: transform 0.2s;
}
.mobile-toc-details[open] .mobile-toc-chevron { transform: rotate(180deg); }
.mobile-toc-nav {
    padding: 8px 0;
    max-height: 220px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #E2E8F0 transparent;
}
.mobile-toc-nav::-webkit-scrollbar { width: 3px; }
.mobile-toc-nav::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
.mobile-sponsored {
    background: white;
    border: 1.5px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}
.mobile-sponsored-header {
    padding: 6px 12px;
    background: #FAFBFF;
    border-bottom: 1px solid var(--border);
    font-size: 9px;
    font-weight: 700;
    color: #CBD5E1;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
}
.mobile-sponsored-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
}
.mobile-ad-item {
    flex: 1 1 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    background: linear-gradient(135deg, #F8FAFF, #EFF6FF);
    border: none;
    border-right: 1px solid var(--border);
    padding: 12px;
    flex-direction: column;
    gap: 5px;
    color: #94A3B8;
    font-size: 11px;
}
.mobile-ad-item:last-child { border-right: none; }
.mobile-ad-link { text-decoration: none; transition: opacity 0.15s; }
.mobile-ad-link:hover { opacity: 0.85; }
.mobile-ad-item img { width: 100%; height: auto; display: block; border-radius: 4px; }

/* Hide right panel on small screens */
@media (max-width: 1100px) { .lesson-toc { display: none; } }
@media (max-width: 768px) {
    .lesson-page-wrap { display: block; }
    /* width: 0 is set for flex shrink prevention — reset it for block layout */
    .lesson-main { width: 100%; max-width: 100%; overflow-x: visible; }
}

/* Adjust main-content padding for lesson page */
.lesson-page-wrap + * { margin-top: 20px; }

/* ============================================================
   SITE FOOTER
   ============================================================ */
.site-footer {
    margin-left: 0;
    background: #0F172A;
}
.site-footer.has-sidebar {
    margin-left: var(--sidebar-width);
}
@media (max-width: 768px) {
    .site-footer.has-sidebar { margin-left: 0; }
}

/* ── Accent line ── */
.footer-accent-line {
    height: 3px;
    background: linear-gradient(90deg, #3B82F6 0%, #8B5CF6 50%, #06B6D4 100%);
}

/* ── Body ── */
.footer-body {
    background: #0F172A;
    padding: 52px 0 36px;
}
.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.3fr;
    gap: 48px;
    align-items: start;
}

/* ── Brand column ── */
.footer-logo-wrap {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    margin-bottom: 14px;
}
.footer-logo-img { height: 30px; width: auto; }
.footer-logo-name {
    font-size: 16px;
    font-weight: 900;
    color: #F8FAFC;
    letter-spacing: -0.3px;
}
.footer-desc {
    font-size: 13px;
    line-height: 1.7;
    color: #94A3B8;
    margin-bottom: 18px;
    max-width: 270px;
}
.footer-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 18px;
}
.footer-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(59,130,246,0.1);
    border: 1px solid rgba(59,130,246,0.22);
    color: #93C5FD;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
}
.footer-pill i { font-size: 10px; }
.footer-social { display: flex; gap: 7px; }
.footer-soc-btn {
    width: 34px; height: 34px;
    border-radius: 9px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.09);
    color: #94A3B8;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s;
}
.footer-soc-btn:hover {
    background: rgba(59,130,246,0.18);
    border-color: rgba(59,130,246,0.35);
    color: #60A5FA;
    transform: translateY(-2px);
}

/* ── Nav columns ── */
.footer-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.footer-col-hd {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #F1F5F9;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
.footer-link {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: #94A3B8;
    text-decoration: none;
    padding: 5px 0;
    transition: color 0.15s;
}
.footer-link i { font-size: 11px; opacity: 0.55; transition: opacity 0.15s; }
.footer-link:hover { color: #60A5FA; }
.footer-link:hover i { opacity: 1; }
.footer-text {
    font-size: 12.5px;
    color: #475569;
    line-height: 1.6;
    padding: 3px 0;
}

/* ── Stats strip ── */
.footer-stats {
    background: #1E293B;
    border-top: 1px solid rgba(255,255,255,0.05);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    padding: 16px 40px;
}
.footer-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 36px;
}
.footer-stat-num {
    font-size: 24px;
    font-weight: 900;
    color: #F8FAFC;
    letter-spacing: -0.5px;
    line-height: 1;
}
.footer-stat-lbl {
    font-size: 11.5px;
    color: #64748B;
    font-weight: 500;
}
.footer-stat-sep {
    width: 1px;
    height: 40px;
    background: rgba(255,255,255,0.07);
    align-self: center;
}

/* ── Bottom bar ── */
.footer-bottom {
    background: #080E1A;
    padding: 13px 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}
.footer-copy {
    font-size: 12px;
    color: #475569;
}
.footer-bottom-dot { color: #1E293B; font-size: 16px; }
.footer-heart { display: inline-flex; align-items: center; gap: 4px; }
.footer-heart i { color: #EF4444; font-size: 11px; }

/* ── Footer responsive ── */
@media (max-width: 960px) {
    .footer-inner { grid-template-columns: 1fr 1fr; gap: 32px; }
    .footer-brand { grid-column: 1 / -1; }
    .footer-desc { max-width: 100%; }
}
@media (max-width: 600px) {
    .footer-body { padding: 32px 0 24px; }
    .footer-inner { padding: 0 20px; grid-template-columns: 1fr 1fr; gap: 20px; }
    .footer-brand { grid-column: 1 / -1; }
    .footer-stats { padding: 12px 20px; }
    .footer-stat-item { padding: 6px 16px; }
    .footer-stat-num { font-size: 20px; }
    .footer-bottom { padding: 12px 20px; }
}

/* ============================================================
   MOBILE — COMPREHENSIVE LESSON BLOCK FIXES  (≤ 640px)
   ============================================================ */
@media (max-width: 640px) {

    /* ── Layout ─────────────────────────── */
    .lesson-container { margin: 0; }

    /* tighten up lesson header */
    .lesson-header { padding: 18px 16px; border-radius: 12px; }
    .lesson-header h1 { font-size: 20px; letter-spacing: -0.4px; }
    .lesson-excerpt { font-size: 14px; }
    .lesson-meta { gap: 10px; font-size: 12px; }
    .breadcrumb { font-size: 11.5px; }

    /* position bar */
    .lesson-position-bar { padding: 10px 14px; gap: 10px; }
    .lpb-track { display: none; } /* too wide on small screens */

    /* ── All content blocks ─────────────── */
    .content-block { border-radius: 10px; margin-bottom: 12px; }

    /* TEXT block */
    .block-text { padding: 18px 16px; }
    .block-text h2 { font-size: 18px; margin: 20px 0 10px; }
    .block-text h2::before { height: 18px; }
    .block-text h3 { font-size: 16px; margin: 16px 0 8px; }
    .block-text p  { font-size: 14.5px; line-height: 1.75; margin-bottom: 14px; }
    .block-text ul,
    .block-text ol { padding-left: 18px; }
    .block-text li { font-size: 14.5px; }

    /* IMAGE block */
    .block-image img { max-height: 220px; }
    .img-caption { padding: 9px 14px; font-size: 12px; }

    /* VIDEO block */
    .video-caption { padding: 9px 14px; font-size: 12px; }

    /* CHART block */
    .block-chart { padding: 16px 14px; }
    .block-chart canvas { max-height: 220px !important; }
    .block-chart-title { font-size: 13px; margin-bottom: 14px; }

    /* NUMBER STAT block */
    .block-number-stat { flex-direction: column; }
    .stat-accent-bar { width: 100%; height: 4px; align-self: auto; }
    .stat-content {
        flex-direction: column;
        padding: 18px 16px;
        gap: 10px;
        text-align: center;
        align-items: center;
    }
    .stat-number-wrap { text-align: center; }
    .stat-number { font-size: 42px; letter-spacing: -1px; }
    .stat-suffix { font-size: 20px; }
    .stat-info h3 { font-size: 15px; }
    .stat-info p  { font-size: 13px; }
    .stat-visual  { display: none; }

    /* QUOTE block */
    .quote-inner { padding: 18px 16px; }
    .block-quote blockquote { font-size: 16px; }
    .quote-icon { width: 30px; height: 30px; font-size: 15px; margin-bottom: 10px; }

    /* CALLOUT block */
    .callout-inner { padding: 16px 14px; }
    .callout-body  { font-size: 14px; }

    /* KEY POINTS block */
    .kp-header { padding: 12px 16px; font-size: 13px; }
    .kp-list   { padding: 12px 14px; gap: 8px; }
    .kp-item   { font-size: 14px; gap: 8px; }

    /* CODE block */
    .code-header { padding: 8px 12px; }
    .code-pre {
        padding: 14px 14px;
        font-size: 12px;
        line-height: 1.65;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* TABLE block — stacked card layout on mobile */
    .block-table { border-radius: 10px; }
    .table-cap { padding: 11px 14px; font-size: 12px; }
    /* Switch to card-per-row layout */
    .table-scroll { overflow-x: visible; }
    .content-table { min-width: 0; font-size: 14px; }
    .content-table thead { display: none; }
    .content-table tbody tr {
        display: block;
        border: 1.5px solid #DBEAFE;
        border-radius: 10px;
        margin-bottom: 10px;
        overflow: hidden;
        background: white;
        box-shadow: 0 1px 6px rgba(37,99,235,0.06);
    }
    .content-table tbody tr:nth-child(even) td { background: white; }
    .content-table tbody tr:last-child { margin-bottom: 0; }
    .content-table td {
        display: flex;
        align-items: baseline;
        gap: 10px;
        padding: 9px 14px;
        border-bottom: 1px solid #EEF2FF;
        font-size: 13.5px;
        line-height: 1.5;
    }
    .content-table td:last-child { border-bottom: none; }
    .content-table tbody tr:last-child td { border-bottom: 1px solid #EEF2FF; }
    .content-table tbody tr:last-child td:last-child { border-bottom: none; }
    .content-table td::before {
        content: attr(data-label);
        font-size: 10.5px;
        font-weight: 800;
        color: #2563EB;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        flex-shrink: 0;
        min-width: 90px;
        padding-top: 2px;
    }

    /* FIGURE block */
    .block-figure { padding: 16px 14px; }
    .block-figure img { border-radius: 8px; }
    .fig-placeholder { padding: 32px 16px; font-size: 13px; }
    .fig-placeholder i { font-size: 28px; }

    /* DIVIDER block */
    .block-divider { padding: 4px 14px; }

    /* ── Prev/Next nav ──────────────────── */
    .lesson-nav { grid-template-columns: 1fr; gap: 10px; margin-bottom: 24px; }
    .lesson-nav .nav-next { text-align: left; }
    .lesson-nav .nav-next .nav-dir { justify-content: flex-start; }
    .lesson-nav a { padding: 14px 16px; }
    .nav-title { font-size: 13px; }

    /* ── Siblings panel ─────────────────── */
    .lesson-siblings { margin-top: 16px; }
    .siblings-header { padding: 12px 14px; gap: 10px; }
    .siblings-icon { width: 30px; height: 30px; font-size: 13px; }
    .sibling-item { padding: 10px 14px; gap: 10px; }
    .sibling-title { font-size: 12.5px; }

    /* ── Topic cards ────────────────────── */
    .topics-grid { grid-template-columns: 1fr; gap: 12px; }
    .topic-card { padding: 18px 16px 14px; }
    .home-hero { padding: 28px 18px; border-radius: 14px; }
    .home-hero h1 { font-size: 24px; }
    .home-hero p { font-size: 14.5px; margin-bottom: 24px; }
    .hero-stat { padding: 10px 16px; }
    .hero-stat strong { font-size: 18px; }
    .hero-stat span { font-size: 11px; }
}

/* ── 641–1100px scroll-hint on tables ────────────────── */
@media (min-width: 641px) and (max-width: 1100px) {
    .table-scroll {
        position: relative;
    }
    .table-scroll::after {
        content: '';
        position: absolute;
        top: 0; right: 0; bottom: 0;
        width: 36px;
        background: linear-gradient(to right, transparent, rgba(255,255,255,0.9));
        pointer-events: none;
        border-radius: 0 14px 14px 0;
    }
}

/* ── 641–900px (tablet mid-range) ────────────────────── */
@media (min-width: 641px) and (max-width: 900px) {
    .block-text   { padding: 24px 24px; }
    .block-chart  { padding: 22px 22px; }
    .quote-inner  { padding: 24px 22px; }
    .block-figure { padding: 20px 22px; }
    .callout-inner { padding: 18px 20px; }
    .kp-header     { padding: 13px 20px; }
    .kp-list       { padding: 12px 20px; }
    .code-pre      { padding: 16px 18px; font-size: 12.5px; }
    .block-number-stat .stat-content { padding: 20px 22px; }
    .stat-number   { font-size: 44px; }
    .lesson-header { padding: 24px 24px; }
    .lesson-header h1 { font-size: 24px; }
}
