:root {
    --font-heading: "Outfit", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", "Courier New", monospace;
    --bg-base: #020617;
    --bg-card: #0d1324;
    --bg-card-hover: #131b31;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent-primary: #00f2ff;
    --accent-secondary: #0077ff;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --font-ui: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    
    --glass-bg: #080f2a;
    --glass-border: rgba(0, 242, 255, 0.1);
    
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(0, 242, 255, 0.12);
}

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

body {
    font-family: var(--font-heading);
    background-color: var(--bg-base);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

/* ================== NAVBAR ================== */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    height: 70px;
    background: var(--glass-bg);
    
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    z-index: 100;
}

.nav-brand {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon { display: none; }

.nav-links {
    display: flex;
    gap: 30px;
    list-style: none;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: var(--transition);
    position: relative;
    padding: 5px 0;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--accent-primary);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    transition: var(--transition);
    border-radius: 2px;
}

.nav-links a:hover::after, .nav-links a.active::after {
    width: 100%;
}

/* ================== HERO / CANVAS ================== */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.4;
    pointer-events: none;
}

.hero {
    height: 60vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 20px;
    margin-top: 70px;
    position: relative;
}

.hero h1 {
    font-size: 4rem;
    font-weight: 900;
    letter-spacing: -1.5px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    margin-bottom: 40px;
}

/* ================== LAYOUT & SECTIONS ================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 80px 40px;
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-label {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent-primary);
    margin-bottom: 12px;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -1px;
}

.section-desc {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 15px auto 0;
}

/* ================== FLASHCARDS ================== */
.flashcard-ctr {
    perspective: 1500px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.flashcard {
    width: 100%;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 40px;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.flashcard:hover {
    border-color: rgba(0, 242, 255, 0.4);
}

.card-back {
    display: none;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px dashed #334155;
}

.flashcard.flipped .card-back {
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.4s ease forwards;
}

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

.card-category {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 6px 16px;
    border-radius: 99px;
    background: rgba(0, 242, 255, 0.1);
    color: var(--accent-primary);
    align-self: flex-start;
    margin-bottom: 30px;
    border: 1px solid rgba(0, 242, 255, 0.2);
}

.card-text {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.5;
    flex: 1;
    display: flex;
    align-items: center;
}

.card-answer {
    font-size: 1.2rem;
    line-height: 1.7;
    color: var(--text-muted);
    flex: 1;
    overflow-y: auto;
}

.card-analogy {
    margin-top: 20px;
    padding: 16px 20px;
    background: rgba(245, 158, 11, 0.1);
    border-left: 4px solid var(--accent-warning);
    border-radius: 8px;
    font-size: 1rem;
    color: rgba(245, 158, 11, 0.9);
    font-style: italic;
}

.srs-controls {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    margin-top: 30px;
}

.srs-btn {
    padding: 15px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
}

.srs-btn:hover {
    transform: translateY(-2px);
}

.btn-hard { border-color: rgba(239, 68, 68, 0.3); color: var(--accent-danger); }
.btn-good { border-color: rgba(245, 158, 11, 0.3); color: var(--accent-warning); }
.btn-easy { border-color: rgba(16, 185, 129, 0.3); color: var(--accent-success); }
.btn-hard:hover { background: rgba(239, 68, 68, 0.1); }
.btn-good:hover { background: rgba(245, 158, 11, 0.1); }
.btn-easy:hover { background: rgba(16, 185, 129, 0.1); }

/* ================== ARCHITECTURE SANDBOX ================== */
.arch-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
    min-height: 600px;
}

.arch-palette {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    
}

.palette-title {
    font-size: 0.9rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 20px;
    letter-spacing: 1px;
}

.service-token {
    background: #1e293b;
    border: 1px solid #334155;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer; /* Changed from grab for touch pivot */
    transition: var(--transition);
}

.service-token:hover {
    background: #334155;
    transform: translateX(5px);
}

.arch-canvas {
    background: #0f172a;
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    position: relative;
    overflow: hidden;
}

.arch-canvas::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(#334155 1px, transparent 1px);
    background-size: 30px 30px;
    opacity: 0.3;
}

.drop-zone {
    position: absolute;
    inset: 20px;
    border: 2px dashed #334155;
    border-radius: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-content: flex-start;
    padding: 20px;
}

.drop-zone.drag-over {
    background: rgba(0, 242, 255, 0.05);
    border-color: var(--accent-primary);
}

.canvas-header {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    padding: 15px 20px;
    background: rgba(15, 23, 42, 0.9);
    
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    z-index: 10;
}

.canvas-problem {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.canvas-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ================== GENERIC CARDS ================== */
.scenario-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
}

.scenario-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 30px;
    transition: var(--transition);
}

.scenario-card:hover {
    transform: translateY(-5px);
    border-color: rgba(0, 242, 255, 0.3);
    box-shadow: var(--shadow-glow);
}

.scenario-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 99px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-success);
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.scenario-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 15px;
    line-height: 1.4;
}

.scenario-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 20px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    box-shadow: 0 4px 15px rgba(0, 242, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 242, 255, 0.4);
}

/* ================== EXAM ================== */
.exam-container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 50px;
}

.exam-status {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
}

.timer {
    font-family: monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.q-text {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 30px;
    line-height: 1.5;
}

.options-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.option-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 12px;
    text-align: left;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.option-btn:hover {
    background: rgba(0, 242, 255, 0.1);
    border-color: var(--accent-primary);
}

.option-btn.correct {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--accent-success);
}

.option-btn.wrong {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--accent-danger);
}


/* ================== LESSON ENGINE ================== */
.lesson-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 40px;
    align-items: start;
}

.lesson-sidebar {
    /* order: 2 removed for left-sidebar */

    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
}

.toc-link {
    display: block;
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.toc-link:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
}

.toc-link.active {
    background: rgba(0, 242, 255, 0.1);
    color: var(--accent-primary);
    border-left-color: var(--accent-primary);
}

.lesson-canvas {
    transition: opacity 0.3s ease;
    background: #0f172a;
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 50px;
    min-height: 600px;
}

.lesson-placeholder {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: var(--text-muted);
    font-style: italic;
    font-size: 1.2rem;
}

.lesson-title {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 40px;
    letter-spacing: -1px;
    color: #fff;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 20px;
}

.lesson-prose {
    font-size: 1.15rem;
    line-height: 1.8;
    color: #e2e8f0;
}

.lesson-h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin: 40px 0 20px;
}

.lesson-prose p {
    margin-bottom: 20px;
}

.lesson-prose ul {
    margin-bottom: 20px;
    padding-left: 20px;
}

.lesson-prose li {
    margin-bottom: 10px;
}

.lesson-alert {
    background: rgba(245, 158, 11, 0.1);
    border-left: 4px solid var(--accent-warning);
    padding: 20px;
    border-radius: 8px;
    margin: 40px 0;
    font-style: italic;
    color: rgba(245, 158, 11, 0.9);
}

.lesson-alert code {
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

.scenario-card.revealed .scenario-reveal {
    display: block !important;
    animation: fadeIn 0.4s ease forwards;
}

.scenario-card:hover .scenario-challenge {
    color: var(--accent-primary) !important;
    transition: var(--transition);
}

/* Course TOC Styles */
.toc-module {
    margin-bottom: 15px;
}
.toc-module-header {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    padding-left: 10px;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}
.toc-topics {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.toc-topics .toc-link {
    padding-left: 30px;
}
.topic-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}
.nav-btn {
    background: var(--surface-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}
.nav-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}
.module-eyebrow {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}


/* --- PREMIUM LIBRARY TYPOGRAPHY & LAYOUT --- */
.lesson-content-wrapper {
    max-width: 750px;
    margin: 0 auto;
    padding-bottom: 80px;
}

.lesson-title {
    font-size: 3rem;
    font-weight: 900;
    margin-top: 15px;
    margin-bottom: 40px;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.1;
}

.module-eyebrow {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(0, 242, 255, 0.1);
    color: var(--accent-primary);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    border: 1px solid rgba(0, 242, 255, 0.2);
}

.lesson-prose {
    font-size: 1.18rem;
    line-height: 1.85;
    color: #cbd5e1;
    font-weight: 400;
}

/* Premium Editorial Drop Cap for the very first paragraph */
.lesson-prose > p:first-of-type::first-letter {
    float: left;
    font-size: 4rem;
    line-height: 0.8;
    margin-right: 0.15em;
    margin-bottom: -0.1em;
    color: var(--accent-primary);
    font-weight: 900;
    text-shadow: 0 4px 12px rgba(0, 242, 255, 0.3);
}

.lesson-prose p {
    margin-bottom: 1.5em;
}

.lesson-h3 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
    margin: 50px 0 25px;
    position: relative;
    padding-left: 20px;
}

.lesson-h3::before {
    content: '';
    position: absolute;
    left: 0;
    top: 5px;
    bottom: 5px;
    width: 4px;
    background: var(--accent-primary);
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.5);
}

.lesson-prose ul {
    margin-bottom: 2em;
    padding-left: 0;
    list-style: none;
}

.lesson-prose li {
    margin-bottom: 12px;
    position: relative;
    padding-left: 30px;
}

.lesson-prose li::before {
    content: '▹';
    position: absolute;
    left: 0;
    color: var(--accent-primary);
    font-size: 1.2rem;
    line-height: 1.4;
}

/* Premium Navigation Footer */
.topic-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid var(--glass-border);
}

.nav-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.nav-btn.next-btn {
    background: var(--accent-primary);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(0, 242, 255, 0.4);
}

.nav-btn.next-btn:hover {
    background: #0284c7;
    box-shadow: 0 6px 20px rgba(0, 242, 255, 0.6);
}



/* --- The Anchor Analogy --- */
.lesson-analogy {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-left: 4px solid var(--accent-success);
    padding: 24px;
    border-radius: 12px;
    margin: 40px 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.lesson-analogy-header {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--accent-success);
    font-weight: 800;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.lesson-analogy-header svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.lesson-analogy-body {
    color: #e2e8f0;
    font-size: 1.15rem;
    line-height: 1.7;
    font-style: italic;
}


/* --- MOBILE RESPONSIVENESS --- */

@media (max-width: 900px) {
    /* Layouts collapse from grid to stack */
    .lesson-layout, .arch-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* Library Sidebar Collapsible */
    #mobile-toc-toggle {
        display: flex !important;
    }
    
    .lesson-sidebar {
        display: none;
        position: static;
        max-height: none;
        order: -1; /* Ensure sidebar is on top */
        padding: 15px;
    }
    
    .lesson-sidebar.mobile-open {
        display: block;
    }
    
    .lesson-canvas {
    transition: opacity 0.3s ease;
        padding: 20px;
    }

    /* Typography Scaling */
    .lesson-title {
        font-size: 2.2rem;
    }

    .lesson-prose > p:first-of-type::first-letter {
        font-size: 3.2rem;
    }
    
    .lesson-h3 {
        font-size: 1.4rem;
        margin: 30px 0 15px;
    }

    /* Navbar */
    .navbar {
        padding: 10px 20px;
        flex-direction: column;
        gap: 10px;
    }

    .nav-links {
        gap: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Analytics grid in index.html */
    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .flashcard {
        height: 250px;
    }
    
    .topic-nav {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 500px) {
    /* Extreme Mobile Adjustments */
    body {
        font-size: 14px;
    }
    
    .lesson-prose {
        font-size: 1.05rem;
    }

    .lesson-title {
        font-size: 1.8rem;
    }

    .hero-title {
        font-size: 2.5rem;
    }
    
    .lesson-analogy {
        padding: 15px;
        margin: 20px 0;
    }
    
    .lesson-analogy-body {
        font-size: 1rem;
    }
}

/* ═══════════════════════════════════════════════════
   COMPREHENSIVE MOBILE RESPONSIVENESS
   Covers: navbar, daily page, library, exam, gym
═══════════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* ── Navbar: hamburger-friendly stack ── */
    .navbar {
        height: auto;
        flex-direction: column;
        padding: 12px 20px;
        gap: 10px;
    }
    .nav-links {
        gap: 6px;
        flex-wrap: wrap;
        justify-content: center;
    }
    .nav-links a {
        font-size: 0.82rem;
        padding: 5px 10px;
    }

    /* All pages: account for taller mobile nav */
    .daily-hero,
    .library-layout,
    .exam-layout,
    .arch-layout {
        padding-top: 110px !important;
    }

    /* ── Daily Flash Page ── */
    .daily-hero {
        padding: 110px 16px 40px !important;
    }
    .daily-header {
        flex-wrap: wrap;
        gap: 10px;
    }
    .concept-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    .concept-icon {
        font-size: 2.2rem;
    }
    .concept-title-block h1 {
        font-size: 1.5rem;
    }
    .slide-card {
        padding: 20px 18px;
    }
    .slide-card h2 {
        font-size: 1.2rem;
    }
    .slide-body, .slide-card p {
        font-size: 0.97rem;
    }
    .daily-btn {
        padding: 10px 20px;
        font-size: 0.92rem;
    }
    .completion-actions {
        flex-direction: column;
    }
    .completion-screen h2 {
        font-size: 1.5rem;
    }
    .completion-score {
        font-size: 2.5rem;
    }
    .phase-pills {
        flex-wrap: wrap;
    }

    /* ── Exam Arena ── */
    .q-text {
        font-size: 1rem;
        line-height: 1.6;
    }
    .option-btn {
        font-size: 0.95rem;
        padding: 12px 16px;
    }
    .exam-status {
        flex-direction: column;
        gap: 4px;
    }

    /* ── Library course switcher ── */
    .library-tabs { display: block; }
    .course-menu-trigger { width: 100%; min-width: 0; }
    .course-menu-panel { width: 100%; }

    /* ── Flashcards ── */
    .flashcard {
        width: 100% !important;
        min-height: 220px;
    }

    /* Note: gym.html and sprint.html carry their own page-specific mobile rules
       inline (Architecture Lab and Kanban Board layouts respectively). */

    /* ── Scrum Kanban ── */
    .war-room-container {
        flex-direction: column;
        height: auto;
        padding: 10px;
    }
    .kanban-board {
        flex-direction: column;
        overflow-x: unset;
    }
}



.toc-link.active-topic {
    background: rgba(0, 242, 255, 0.1);
    color: var(--accent-primary) !important;
    border-left-color: var(--accent-primary) !important;
}

/* --- PREMIUM UI OVERHAUL (HUB, GYM, ARENA) --- */

/* 1. Hub Dashboard Cards */
.zone-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 30px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.zone-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 242, 255, 0.15);
    border-color: rgba(0, 242, 255, 0.4);
}

.zone-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.zone-card h3 {
    font-size: 1.6rem;
    margin: 0 0 10px;
    color: #fff;
}

.zone-card p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 25px;
    flex-grow: 1;
}

.zone-action {
    color: var(--accent-primary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
}

/* 2. Arena: Sleek Exam Rows */
.options-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.option-btn {
    width: 100%;
    text-align: left;
    padding: 18px 24px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.5;
    cursor: pointer;
    transition: all 0.2s ease;
}

.option-btn:hover:not(:disabled) {
    background: rgba(0, 242, 255, 0.1);
    border-color: var(--accent-primary);
    transform: translateX(5px);
}

.option-btn.correct {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--accent-success);
    color: var(--accent-success);
}

.option-btn.wrong {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--accent-danger);
    color: var(--accent-danger);
    opacity: 0.6;
}

/* 3. Gym: Sandbox IDE Styling */
.arch-sandbox {
    background: var(--surface-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.arch-problem-statement {
    background: rgba(0, 0, 0, 0.2);
    border-left: 4px solid var(--accent-secondary);
    padding: 20px;
    border-radius: 0 8px 8px 0;
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 30px;
}

.arch-canvas {
    background: rgba(0,0,0,0.3);
    border: 2px dashed rgba(255,255,255,0.1);
    border-radius: 12px;
    min-height: 300px;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    padding: 20px;
    gap: 15px;
}

/* Flashcard Polish */
.flashcard {
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    border-radius: 16px;
}
.card-front h3 {
    font-size: 1.3rem;
    line-height: 1.5;
}
.card-back {
    font-size: 1.15rem;
    line-height: 1.7;
}

/* Tactical Scenarios (Arena) */
.scenario-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    transition: var(--transition);
}
.scenario-card:hover {
    border-color: rgba(255,255,255,0.2);
}


/* Sandbox Zone Styling */
.arch-zone {
    background: rgba(0,0,0,0.2);
    border: 2px dashed rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    min-height: 80px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.arch-zone-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    pointer-events: none;
}
.arch-zone.active {
    border-color: var(--accent-primary);
    background: rgba(0, 242, 255, 0.05);
    box-shadow: inset 0 0 15px rgba(0, 242, 255, 0.1);
}
.service-token.in-zone {
    font-size: 0.9rem;
    padding: 6px 12px;
}

.service-token.selected-token {
    border-color: var(--accent-primary);
    background: rgba(0, 242, 255, 0.2);
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.4);
    transform: scale(1.05);
}

/* --- 3-Column Library Layout --- */
.lesson-intelligence {
    width: 300px;
    flex-shrink: 0;
    position: sticky;
    top: 100px;
    height: calc(100vh - 120px);
    overflow-y: auto;
    padding-right: 10px;
}

.intel-widget {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.intel-widget h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-secondary);
    margin: 0 0 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 8px;
}

.intel-widget p {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-primary);
    margin: 0;
}

.intel-takeaway-label {
    display: inline-block;
    font-family: var(--font-mono, monospace);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--accent-primary);
    background: rgba(0, 242, 255, 0.08);
    border-radius: 6px;
    padding: 3px 8px;
    margin-bottom: 8px;
}

.intel-flashcard {
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(0, 242, 255, 0.2);
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.intel-flashcard:hover {
    border-color: var(--accent-primary);
    background: rgba(0, 242, 255, 0.05);
}

.intel-fc-front {
    font-weight: 500;
    font-size: 0.9rem;
    color: #fff;
    margin-bottom: 10px;
}

.intel-fc-back {
    font-size: 0.85rem;
    color: var(--accent-success);
    display: none;
    border-top: 1px dashed rgba(255,255,255,0.1);
    padding-top: 10px;
    margin-top: 10px;
}

.intel-flashcard.revealed .intel-fc-back {
    display: block;
}

/* Mobile Stacking for Intelligence Panel */
@media (max-width: 1200px) {
    .lesson-intelligence {
        display: none !important; /* Hide on small screens where space is tight */
    }
}

/* Override lesson layout for 3 columns on large screens. The TOC and
   intelligence sidebars stay fixed-width (they're not designed to stretch);
   the reading column is the one that grows to fill whatever room the wider
   .container below gives it, instead of being hard-capped at 750px and
   leaving the rest of the page as empty side margin. */
@media (min-width: 1200px) {
    .lesson-layout {
        display: grid !important;
        grid-template-columns: 260px minmax(0, 1fr) 300px;
        gap: 40px;
        align-items: start;
    }
}

/* The Library's 3-column reading layout wants more room than the 1200px
   .container default (sized for shorter, centered marketing sections) — give
   it its own wider ceiling instead of floating in empty side margins. */
.container:has(.lesson-layout) {
    max-width: 1500px;
}

/* ================== LIBRARY COURSE SWITCHER ================== */
/* A single compact trigger that opens a searchable, category-grouped panel —
   replaces both the original fixed-width pill bar (built for 3-4 tabs) and
   a later wrapping-chip attempt (fine for 7, still a wall at 100+). This
   never grows the page no matter how many courses the catalog holds. */
.library-tabs {
    position: relative;
    display: inline-block;
    margin-bottom: 25px;
}

.course-menu-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 3px solid var(--tab-color, var(--accent-primary));
    color: #fff;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    min-width: 260px;
    transition: all 0.2s ease;
}

.course-menu-trigger:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
}

.course-menu-trigger-icon { font-size: 1.3rem; }

.course-menu-trigger-text {
    flex: 1;
    text-align: left;
    font-weight: 800;
    font-size: 0.98rem;
}

.course-menu-trigger-label {
    display: block;
    font-family: var(--font-mono, monospace);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.course-menu-caret {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Prominence pass (Oct 18, 2026): bigger trigger tinted with the active track's
   color, a "7 tracks" count, and a row of one-tap icon badges beneath it, so it's
   obvious every track lives in the Library, not just the one on screen. */
.course-menu-trigger {
    min-width: 340px;
    padding: 16px 20px;
    background: linear-gradient(90deg, color-mix(in srgb, var(--tab-color, #00f2ff) 14%, transparent), rgba(255, 255, 255, 0.03));
    border-color: color-mix(in srgb, var(--tab-color, #00f2ff) 40%, transparent);
    box-shadow: 0 0 24px color-mix(in srgb, var(--tab-color, #00f2ff) 15%, transparent);
}
.course-menu-trigger-icon { font-size: 1.7rem; }
.course-menu-trigger-text { font-size: 1.12rem; }
.course-menu-trigger-sub {
    display: block;
    font-family: var(--font-mono, monospace);
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 2px;
}
.course-menu-count {
    font-family: var(--font-mono, monospace);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-main, #f8fafc);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    padding: 5px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.course-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.course-badge {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    color: var(--text-muted);
    opacity: 0.65;
    transition: all 0.15s ease;
}
.course-badge:hover { opacity: 1; border-color: var(--tab-color, var(--accent-primary)); transform: translateY(-1px); }
.course-badge.active {
    opacity: 1;
    border-color: var(--tab-color, var(--accent-primary));
    background: color-mix(in srgb, var(--tab-color, #00f2ff) 18%, transparent);
    box-shadow: 0 0 0 1px var(--tab-color, var(--accent-primary));
}
.course-badge.more { font-family: var(--font-mono, monospace); font-size: 0.75rem; font-weight: 700; }
/* Restated here because the min-width above comes later than the mobile block. */
@media (max-width: 768px) {
    .course-menu-trigger { min-width: 0; padding: 14px 16px; }
    .course-badges { gap: 6px; }
    .course-badge { width: 36px; height: 36px; font-size: 1rem; }
}

.course-menu-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 40;
    width: min(380px, 90vw);
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    background: #0d1324;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

/* The [hidden] attribute is how app.js opens/closes this panel, but the
   display:flex above has equal specificity to the browser's built-in
   [hidden]{display:none} rule and, being an author rule, wins the tie —
   so without this the panel would render open by default. */
.course-menu-panel[hidden] {
    display: none;
}

.course-menu-search {
    margin: 10px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    font-family: inherit;
    font-size: 0.9rem;
}

.course-menu-search:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.course-menu-list {
    overflow-y: auto;
    padding: 0 10px 10px;
}

.course-menu-group-label {
    font-family: var(--font-mono, monospace);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 10px 8px 6px;
}

.course-menu-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: transparent;
    border: none;
    border-left: 2px solid transparent;
    color: var(--text-muted);
    padding: 9px 8px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background 0.15s ease;
}

.course-menu-row:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }

.course-menu-row.active {
    background: rgba(255, 255, 255, 0.06);
    border-left-color: var(--tab-color, var(--accent-primary));
    color: #fff;
    font-weight: 700;
}

.course-menu-icon { font-size: 1.1rem; }
.course-menu-name { flex: 1; font-size: 0.9rem; }
.course-menu-sub {
    font-family: var(--font-mono, monospace);
    font-size: 0.68rem;
    color: var(--text-muted);
}
.course-menu-check { color: var(--tab-color, var(--accent-primary)); font-weight: 800; }

/* Same author-vs-UA-stylesheet tie as .course-menu-panel above — this rule's
   own display:flex would otherwise beat the browser's [hidden]{display:none}
   when app.js's search filter hides a non-matching row. */
.course-menu-row[hidden] {
    display: none;
}

/* ================== UX OVERHAUL TOC ================== */
.toc-module {
    margin-bottom: 10px;
}

.toc-module-header {
    font-weight: 700;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toc-module-header:hover {
    background: rgba(0, 242, 255, 0.1);
    border-color: rgba(0, 242, 255, 0.2);
}

.toc-module-header .mod-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toc-module-header .chevron {
    transition: transform 0.3s ease;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.toc-module.active .toc-module-header {
    background: rgba(0, 242, 255, 0.15);
    border-color: var(--accent-primary);
}

.toc-module.active .chevron {
    transform: rotate(180deg);
    color: var(--accent-primary);
}

.toc-topics {
    display: none; /* hidden by default */
    flex-direction: column;
    padding-left: 20px;
    margin-top: 5px;
    margin-left: 20px;
    border-left: 2px solid rgba(255, 255, 255, 0.1);
}

.toc-module.active .toc-topics {
    display: flex; /* shown when parent is active */
    animation: fadeIn 0.3s ease;
}

.toc-topics .toc-link {
    padding: 8px 12px;
    margin-bottom: 4px;
    position: relative;
    border: none; /* remove old border */
}

/* Tree line connecting branch to item */
.toc-topics .toc-link::before {
    content: "";
    position: absolute;
    left: -20px;
    top: 50%;
    width: 15px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
}

.toc-topics .toc-link.active-topic {
    background: rgba(0, 242, 255, 0.1);
    color: var(--accent-primary);
    font-weight: 800;
}

.toc-topics .toc-link.active-topic::before {
    background: var(--accent-primary);
    box-shadow: 0 0 8px rgba(0, 242, 255, 0.8);
}


/* ===================================================
   ENHANCEMENT STYLES — Added 2026-09-01
=================================================== */

/* -- Library Mini-Quiz -- */
.lesson-quiz {
    margin-top: 40px;
    padding: 28px 32px;
    background: rgba(0, 242, 255,0.04);
    border: 1px solid rgba(0, 242, 255,0.15);
    border-radius: 16px;
    border-top: 4px solid var(--accent-primary);
}
.quiz-header { margin-bottom: 20px; }
.quiz-eyebrow {
    display: block;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent-primary);
    font-weight: 700;
    margin-bottom: 4px;
}
.quiz-subtitle { font-size: 0.9rem; color: var(--text-muted); }
.quiz-q-block { margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.quiz-q-block:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.quiz-q-text { font-size: 1rem; font-weight: 600; color: var(--text-primary); margin-bottom: 12px; line-height: 1.6; }
.quiz-opts { display: flex; flex-direction: column; gap: 8px; }
.quiz-opt-btn {
    text-align: left;
    padding: 10px 16px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    line-height: 1.5;
}
.quiz-opt-btn:hover:not(:disabled) { border-color: var(--accent-primary); background: rgba(0, 242, 255,0.08); }
.quiz-opt-btn:disabled { cursor: default; opacity: 0.9; }
.quiz-opt-btn.qopt-correct { border-color: #22c55e !important; background: rgba(34,197,94,0.12) !important; color: #22c55e !important; }
.quiz-opt-btn.qopt-wrong   { border-color: #ef4444 !important; background: rgba(239,68,68,0.1) !important; color: #ef4444 !important; }
.quiz-exp {
    margin-top: 10px;
    padding: 10px 14px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-secondary, #cbd5e1);
}

/* -- Related Modules -- */
.related-modules {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.07);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
.related-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    font-weight: 700;
    margin-right: 4px;
}
.related-link {
    padding: 6px 14px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 999px;
    background: rgba(255,255,255,0.04);
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}
.related-link:hover { border-color: var(--accent-primary); color: var(--accent-primary); background: rgba(0, 242, 255,0.08); }

/* -- Explain it Differently -- */
.alt-analogy-wrap { margin-top: 20px; }
.alt-analogy-btn {
    padding: 8px 18px;
    border: 1px dashed rgba(255,255,255,0.2);
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}
.alt-analogy-btn:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
.alt-analogy-block {
    margin-top: 12px;
    padding: 16px 20px;
    background: rgba(139,92,246,0.08);
    border-left: 3px solid #8b5cf6;
    border-radius: 0 10px 10px 0;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-secondary, #cbd5e1);
}

/* -- Flashcard Mastery -- */
.fc-mastery-row {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px dashed rgba(255,255,255,0.08);
}
.fc-mastery-btn {
    flex: 1;
    padding: 9px 0;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.1);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}
.fc-btn-got { background: rgba(34,197,94,0.1); color: #22c55e; border-color: rgba(34,197,94,0.3); }
.fc-btn-got:hover { background: rgba(34,197,94,0.2); }
.fc-btn-still { background: rgba(239,68,68,0.08); color: #ef4444; border-color: rgba(239,68,68,0.25); }
.fc-btn-still:hover { background: rgba(239,68,68,0.15); }
.fc-mastery-counter { font-size: 0.78rem; color: var(--text-muted); text-align: center; margin-top: 8px; }
.fc-mastery-bar { height: 3px; background: rgba(255,255,255,0.06); border-radius: 999px; margin-top: 6px; overflow: hidden; }
.fc-mastery-fill { height: 100%; background: linear-gradient(90deg, #22c55e, #00f2ff); border-radius: 999px; transition: width 0.5s ease; }

/* -- Progress Dashboard (Homepage) -- */
.progress-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    max-width: 1100px;
    margin: 0 auto 40px;
}
.progress-stat {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 14px;
    padding: 20px 24px;
    text-align: center;
}
.progress-stat-value { font-size: 2rem; font-weight: 800; color: var(--text-primary); line-height: 1; margin-bottom: 4px; }
.progress-stat-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-muted); font-weight: 600; }
.progress-stat.highlight .progress-stat-value { color: var(--accent-primary); }

/* -- Achievement Toast -- */
#achievement-toast {
    position: fixed;
    bottom: -120px;
    right: 24px;
    z-index: 9999;
    background: rgba(15,15,20,0.95);
    border: 1px solid rgba(255,255,255,0.12);
    border-left: 4px solid #FF9900;
    border-radius: 14px;
    padding: 16px 20px;
    max-width: 320px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    transition: bottom 0.4s cubic-bezier(0.34,1.56,0.64,1);
    backdrop-filter: blur(16px);
}
#achievement-toast.toast-visible { bottom: 24px; }
.achievement-glow { position: absolute; inset: 0; border-radius: 14px; background: radial-gradient(ellipse at top right, rgba(255,153,0,0.08), transparent 70%); pointer-events: none; }
.achievement-inner { display: flex; align-items: center; gap: 14px; }
.achievement-icon { font-size: 2.2rem; line-height: 1; }
.achievement-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 1.5px; color: #FF9900; font-weight: 700; margin-bottom: 2px; }
.achievement-title { font-size: 1rem; font-weight: 800; color: var(--text-primary); }
.achievement-desc { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }

/* -- Badge Wall -- */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 14px; }
.badge-item { padding: 16px 12px; border-radius: 12px; text-align: center; border: 1px solid rgba(255,255,255,0.07); transition: all 0.2s ease; }
.badge-earned { background: rgba(255,153,0,0.08); border-color: rgba(255,153,0,0.3); }
.badge-locked { background: rgba(255,255,255,0.02); opacity: 0.4; filter: grayscale(1); }
.badge-icon { font-size: 2rem; margin-bottom: 8px; }
.badge-name { font-size: 0.8rem; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.badge-desc { font-size: 0.72rem; color: var(--text-muted); line-height: 1.4; }

/* -- Exam Timer -- */
.exam-timer {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    margin-bottom: 20px;
}
.exam-timer.timer-warning { color: #f59e0b; border-color: rgba(245,158,11,0.4); background: rgba(245,158,11,0.08); }
.exam-timer.timer-danger  { color: #ef4444; border-color: rgba(239,68,68,0.4); background: rgba(239,68,68,0.08); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.7} }

@media (max-width: 768px) {
    .progress-dashboard { grid-template-columns: repeat(2, 1fr); }
    .lesson-quiz { padding: 20px 16px; }
    .badge-grid { grid-template-columns: repeat(3, 1fr); }
}
.section-label, .quiz-eyebrow, .related-label, .fc-mastery-counter, .achievement-label, .exam-timer, .progress-stat-label { font-family: var(--font-mono); }

/* -- Mammoth Academy Footer -- */
.mammoth-footer {
  margin-top: 60px;
  padding: 24px 40px;
  border-top: 1px solid rgba(0, 242, 255, 0.08);
  background: rgba(2, 6, 23, 0.8);
}
.mammoth-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: rgba(255,255,255,0.3);
  letter-spacing: 1px;
}
.mammoth-footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: rgba(255,255,255,0.5);
  font-weight: 700;
  letter-spacing: 2px;
  transition: color 0.2s ease;
}
.mammoth-footer-brand:hover { color: #00f2ff; }
.mammoth-footer-link {
  color: #00f2ff;
  text-decoration: none;
  transition: opacity 0.2s ease;
}
.mammoth-footer-link:hover { opacity: 0.7; }
.mammoth-footer-divider { opacity: 0.3; }
/* ================== SYNC & BACKUP MODAL (sync.js) ================== */
.sync-open, .sync-open body { overflow: hidden; }
.sync-backdrop { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; background: rgba(2, 6, 23, 0.82); backdrop-filter: blur(8px); overflow-y: auto; }
.sync-backdrop[hidden] { display: none; }
.sync-dialog { width: min(640px, 100%); background: var(--bg-card, #0d1324); border: 1px solid rgba(0, 242, 255, 0.25); border-radius: 16px; padding: 22px 24px 24px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); color: var(--text-main); }
.sync-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sync-head h2 { margin: 0; font-family: var(--font-heading); font-size: 1.35rem; }
.sync-x { width: 36px; height: 36px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.05); color: var(--text-muted); font-size: 1rem; cursor: pointer; }
.sync-lead { color: var(--text-muted); font-size: 0.88rem; line-height: 1.55; margin: 10px 0 16px; }
.sync-tabs { display: flex; gap: 6px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); margin-bottom: 16px; }
.sync-tabs button { font-family: inherit; font-size: 0.9rem; font-weight: 700; padding: 9px 14px; border: none; border-bottom: 2px solid transparent; background: none; color: var(--text-muted); cursor: pointer; }
.sync-tabs button[aria-selected="true"] { color: var(--accent-primary); border-bottom-color: var(--accent-primary); }
.sync-pane[hidden] { display: none; }
.sync-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.sync-btn { font-family: inherit; font-size: 0.9rem; font-weight: 700; padding: 11px 16px; border-radius: 10px; cursor: pointer; color: var(--text-main); background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.16); display: inline-flex; align-items: center; }
.sync-btn.primary { background: var(--accent-primary); border-color: var(--accent-primary); color: #020617; }
.sync-btn:disabled { opacity: 0.5; cursor: wait; }
.sync-btn[hidden] { display: none; }
.sync-file { cursor: pointer; }
.sync-label { display: block; font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin: 6px 0; }
.sync-code { width: 100%; box-sizing: border-box; font-family: var(--font-mono); font-size: 0.75rem; line-height: 1.4; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(0, 0, 0, 0.3); color: var(--text-main); resize: vertical; word-break: break-all; }
.sync-code:focus { outline: none; border-color: var(--accent-primary); }
.sync-or { text-align: center; font-size: 0.75rem; color: var(--text-muted); margin: 10px 0; }
.sync-msg { min-height: 1.3em; margin-top: 10px; font-size: 0.86rem; line-height: 1.5; color: var(--text-muted); }
.sync-msg.good { color: var(--accent-success); }
.sync-msg.bad { color: var(--accent-danger); font-weight: 600; }
.sync-native-note { font-size: 0.82rem; color: var(--text-muted); line-height: 1.5; }
.sync-native-note[hidden] { display: none; }
.sync-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; margin: 6px 0 4px; }
.sync-table th, .sync-table td { padding: 6px 6px; text-align: center; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.sync-table thead th { font-family: var(--font-mono); font-size: 0.62rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
.sync-table tbody th { text-align: left; font-weight: 700; white-space: nowrap; }
.sync-table tbody tr:last-child td, .sync-table tbody tr:last-child th { color: var(--accent-primary); }
.sync-preview[hidden], .sync-undo[hidden], .sync-confirm[hidden] { display: none; }
.sync-ok { color: var(--accent-success); font-size: 0.86rem; margin: 14px 0 8px; }
.sync-modes { border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 10px; padding: 10px 14px; margin: 14px 0 8px; display: flex; flex-direction: column; gap: 10px; }
.sync-modes legend { font-size: 0.78rem; color: var(--text-muted); padding: 0 6px; }
.sync-modes label, .sync-confirm { font-size: 0.85rem; line-height: 1.5; display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.sync-modes input, .sync-confirm input { margin-top: 4px; accent-color: var(--accent-primary); }
.sync-confirm { color: var(--accent-warning); }
.sync-undo { margin-top: 14px; padding-top: 12px; border-top: 1px dashed rgba(255, 255, 255, 0.1); font-size: 0.82rem; color: var(--text-muted); }
.sync-link { font: inherit; color: var(--accent-primary); background: none; border: none; padding: 0; text-decoration: underline; cursor: pointer; }
@media (max-width: 600px) {
    .sync-backdrop { padding: 12px; }
    .sync-dialog { padding: 18px 16px 20px; }
    .sync-table { font-size: 0.7rem; }
    .sync-table thead th { font-size: 0.55rem; }
}

/* ================== COMPTIA PBQ LAB (pbq.js, gym.html) ================== */
.pbq-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.pbq-pill { font-family: inherit; font-size: 0.82rem; font-weight: 600; padding: 7px 14px; border-radius: 999px; cursor: pointer; color: var(--text-muted); background: transparent; border: 1px solid rgba(255, 255, 255, 0.15); }
.pbq-pill.active { color: #020617; background: var(--accent-primary); border-color: var(--accent-primary); }
.pbq-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.pbq-card { display: flex; flex-direction: column; gap: 8px; text-align: left; padding: 16px; border-radius: 12px; cursor: pointer; font-family: inherit; color: var(--text-main); background: rgba(255, 255, 255, 0.02); border: 1px solid rgba(255, 255, 255, 0.08); border-left: 4px solid var(--track-color, var(--accent-primary)); transition: background 0.15s ease, transform 0.15s ease; }
.pbq-card:hover { background: rgba(255, 255, 255, 0.05); transform: translateY(-1px); }
.pbq-card-track { font-family: var(--font-mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); }
.pbq-card-title { font-weight: 800; font-size: 1rem; line-height: 1.35; }
.pbq-card-foot { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: auto; }
.pbq-kind { font-family: var(--font-mono); font-size: 0.62rem; padding: 2px 7px; border-radius: 4px; background: rgba(255, 255, 255, 0.06); color: var(--text-muted); }
.pbq-badge { margin-left: auto; font-family: var(--font-mono); font-size: 0.66rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.pbq-badge.new { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }
.pbq-badge.full { background: rgba(16, 185, 129, 0.18); color: var(--accent-success); }
.pbq-badge.pass { background: rgba(0, 242, 255, 0.14); color: var(--accent-primary); }
.pbq-badge.low { background: rgba(245, 158, 11, 0.15); color: var(--accent-warning); }

.pbq-back { font-family: inherit; font-size: 0.85rem; color: var(--text-muted); background: none; border: none; cursor: pointer; padding: 0; margin-bottom: 12px; }
.pbq-back:hover { color: var(--accent-primary); }
.pbq-head { border-left: 4px solid var(--track-color, var(--accent-primary)); padding-left: 14px; margin-bottom: 16px; }
.pbq-head h3 { margin: 6px 0 10px; font-size: 1.4rem; }
.pbq-brief { color: var(--text-main); line-height: 1.6; font-size: 0.95rem; }
.pbq-brief ul { margin: 8px 0; padding-left: 20px; }
.pbq-context { margin: 0 0 18px; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 10px; overflow: hidden; }
.pbq-context-title { font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); padding: 8px 12px; background: rgba(255, 255, 255, 0.04); }
.pbq-context pre, .pbq-detail { margin: 0; padding: 12px; font-family: var(--font-mono); font-size: 0.76rem; line-height: 1.5; color: #cbd5e1; background: #050a18; overflow-x: auto; white-space: pre; }
.pbq-detail { margin-top: 8px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.06); }
.pbq-part { margin: 18px 0; }
.pbq-part h4 { margin: 0 0 10px; font-size: 1rem; color: var(--accent-primary); }

.pbq-grid { display: flex; flex-direction: column; gap: 8px; }
.pbq-grid-head, .pbq-row { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(var(--cols), minmax(0, 1fr)); gap: 10px; align-items: start; }
.pbq-grid-head { font-family: var(--font-mono); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); padding: 0 10px; }
.pbq-row { padding: 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.02); border: 1px solid rgba(255, 255, 255, 0.06); }
.pbq-row.ok { border-color: rgba(16, 185, 129, 0.45); }
.pbq-row.bad { border-color: rgba(239, 68, 68, 0.45); }
.pbq-row-label { font-size: 0.9rem; line-height: 1.45; min-width: 0; }
.pbq-row-fb { grid-column: 1 / -1; font-size: 0.82rem; line-height: 1.5; color: var(--accent-danger); padding-top: 4px; }
.pbq-row-fb.good { color: var(--text-muted); }
.pbq-row-fb strong { color: var(--text-main); }
.pbq-select, .pbq-input { width: 100%; min-width: 0; font-family: inherit; font-size: 0.85rem; padding: 8px 10px; border-radius: 8px; color: var(--text-main); background: #0a1122; border: 1px solid rgba(255, 255, 255, 0.16); }
.pbq-input { font-family: var(--font-mono); }
.pbq-select:focus, .pbq-input:focus { outline: none; border-color: var(--accent-primary); }
.pbq-select.ok, .pbq-input.ok { border-color: var(--accent-success); }
.pbq-select.bad, .pbq-input.bad { border-color: var(--accent-danger); }

.pbq-order { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; max-width: 460px; }
.pbq-order li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.08); }
.pbq-order li.ok { border-color: rgba(16, 185, 129, 0.5); }
.pbq-order li.bad { border-color: rgba(239, 68, 68, 0.5); }
.pbq-order-n { font-family: var(--font-mono); font-weight: 700; color: var(--text-muted); width: 18px; }
.pbq-order-text { flex: 1; font-weight: 600; }
.pbq-mini { width: 30px; height: 30px; border-radius: 6px; cursor: pointer; font-size: 0.7rem; color: var(--text-main); background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.15); }
.pbq-mini:disabled { opacity: 0.3; cursor: default; }

.pbq-acl { display: flex; flex-direction: column; gap: 6px; }
.pbq-acl-head, .pbq-acl-row { display: grid; grid-template-columns: 28px 0.9fr 0.8fr 1.2fr 1.2fr 0.8fr 70px; gap: 6px; align-items: center; }
.pbq-acl-head { font-family: var(--font-mono); font-size: 0.64rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); padding: 0 6px; }
.pbq-acl-row { padding: 6px; border-radius: 8px; background: rgba(255, 255, 255, 0.02); border: 1px solid rgba(255, 255, 255, 0.06); }
.pbq-acl-row.off { opacity: 0.5; }
.pbq-acl-row.implicit { background: rgba(239, 68, 68, 0.06); border-style: dashed; }
.pbq-acl-n { font-family: var(--font-mono); font-weight: 700; text-align: center; color: var(--text-muted); }
.pbq-acl-implicit { grid-column: 2 / -1; font-size: 0.82rem; color: var(--text-muted); }
.pbq-acl-move { display: flex; gap: 4px; }
.pbq-flows { margin-top: 14px; display: flex; flex-direction: column; gap: 4px; }
.pbq-flows-title { font-weight: 700; margin-bottom: 4px; }
.pbq-flow { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 0.84rem; padding: 6px 10px; border-radius: 6px; }
.pbq-flow.ok { background: rgba(16, 185, 129, 0.08); }
.pbq-flow.bad { background: rgba(239, 68, 68, 0.1); }
.pbq-flow.bad span:first-child { color: var(--accent-danger); font-weight: 700; }

.pbq-actions { display: flex; gap: 10px; margin: 20px 0 10px; }
.pbq-btn { font-family: inherit; font-size: 0.92rem; font-weight: 700; padding: 11px 20px; border-radius: 10px; cursor: pointer; color: var(--text-main); background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.16); }
.pbq-btn.primary { background: var(--accent-primary); border-color: var(--accent-primary); color: #020617; }
.pbq-result { border-radius: 12px; padding: 16px 18px; border: 1px solid; margin-top: 6px; }
.pbq-result.full { border-color: rgba(16, 185, 129, 0.5); background: rgba(16, 185, 129, 0.07); }
.pbq-result.pass { border-color: rgba(0, 242, 255, 0.45); background: rgba(0, 242, 255, 0.05); }
.pbq-result.low { border-color: rgba(245, 158, 11, 0.5); background: rgba(245, 158, 11, 0.06); }
.pbq-score { font-family: var(--font-heading); font-size: 2.2rem; font-weight: 900; }
.pbq-score span { display: block; font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500; color: var(--text-muted); }
.pbq-verdict { margin: 6px 0 10px; font-size: 0.9rem; }
.pbq-solution { font-size: 0.88rem; line-height: 1.6; color: var(--text-main); }
.pbq-solution code, .pbq-brief code { font-family: var(--font-mono); font-size: 0.8em; padding: 1px 5px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); }

@media (max-width: 760px) {
    .pbq-grid-head, .pbq-acl-head { display: none; }
    .pbq-row { grid-template-columns: 1fr; }
    /* Two columns on phones: "Rule N" heading row, then action/proto, source/destination, port/order. */
    .pbq-acl-row { grid-template-columns: 1fr 1fr; }
    .pbq-acl-n { grid-column: 1 / -1; text-align: left; font-size: 0.72rem; }
    .pbq-acl-n::before { content: "Rule "; }
    .pbq-acl-row.implicit .pbq-acl-n::before { content: ""; }
    .pbq-acl-move { justify-content: flex-end; }
    .pbq-acl-implicit { grid-column: 1 / -1; }
    .pbq-context pre, .pbq-detail { font-size: 0.68rem; }
}

/* ================== CRAM SHEETS DRAWER (cram.js; library + gym) ================== */
.cram-fab { position: fixed; right: 18px; bottom: 18px; z-index: 900; display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 0.82rem; font-weight: 700; letter-spacing: 0.5px; padding: 11px 16px; border-radius: 999px; cursor: pointer; color: #020617; background: var(--accent-primary); border: none; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(0, 242, 255, 0.4); }
.cram-fab:hover { filter: brightness(1.08); }
.cram-on .cram-fab { display: none; }
.cram-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 1500; width: min(640px, 100%); display: flex; flex-direction: column; background: var(--bg-card, #0d1324); border-left: 1px solid rgba(0, 242, 255, 0.25); box-shadow: -20px 0 60px rgba(0, 0, 0, 0.5); color: var(--text-main); }
.cram-drawer[hidden] { display: none; }
.cram-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 8px; }
.cram-top h2 { margin: 0; font-size: 1.25rem; font-family: var(--font-heading); }
.cram-x { width: 36px; height: 36px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.05); color: var(--text-muted); cursor: pointer; }
.cram-search { margin: 4px 18px 10px; padding: 10px 14px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(0, 0, 0, 0.3); color: var(--text-main); font-family: inherit; font-size: 0.92rem; }
.cram-search:focus { outline: none; border-color: var(--accent-primary); }
.cram-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 0 18px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.cram-tab { flex: 0 0 auto; font-family: inherit; font-size: 0.8rem; font-weight: 700; padding: 7px 12px; border-radius: 999px; cursor: pointer; color: var(--text-muted); background: transparent; border: 1px solid rgba(255, 255, 255, 0.14); white-space: nowrap; }
.cram-tab[aria-selected="true"] { color: #020617; background: var(--accent-primary); border-color: var(--accent-primary); }
.cram-body { flex: 1; overflow-y: auto; padding: 10px 18px 28px; }
.cram-exams { font-family: var(--font-mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 8px; }
.cram-h { margin: 18px 0 8px; font-size: 0.95rem; color: var(--accent-primary); }
.cram-note { font-size: 0.82rem; color: var(--text-muted); line-height: 1.5; margin: 4px 0 8px; }
.cram-table-wrap { overflow-x: auto; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 10px; }
.cram-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.cram-table th { position: sticky; top: 0; text-align: left; font-family: var(--font-mono); font-size: 0.64rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); background: #0a1122; padding: 8px 10px; }
.cram-table td { padding: 7px 10px; border-top: 1px solid rgba(255, 255, 255, 0.06); vertical-align: top; line-height: 1.4; }
.cram-table td.cram-key { font-family: var(--font-mono); font-weight: 700; color: var(--accent-primary); white-space: nowrap; }
.cram-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
.cram-steps { margin: 0; padding-left: 24px; font-size: 0.86rem; line-height: 1.6; }
.cram-steps li::marker { font-family: var(--font-mono); font-weight: 700; color: var(--accent-primary); }
.cram-steps li.hit { color: var(--accent-warning); }
.cram-elsewhere { font-size: 0.8rem; color: var(--text-muted); margin: 0 0 8px; }
.cram-jump { font: inherit; font-size: 0.78rem; padding: 3px 9px; margin: 2px; border-radius: 999px; cursor: pointer; color: var(--text-main); background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.14); }
.cram-empty { color: var(--text-muted); font-style: italic; }
@media (max-width: 760px) {
    .cram-drawer { top: auto; height: 86vh; width: 100%; border-left: none; border-top: 1px solid rgba(0, 242, 255, 0.25); border-radius: 16px 16px 0 0; }
    .cram-fab { right: 12px; bottom: 12px; padding: 10px 14px; }
}

/* ================== INLINE DIAGRAMS (diagrams.js) ================== */
.lesson-diagram { margin: 26px 0; padding: 14px; border-radius: 14px; background: #060c1d; border: 1px solid rgba(0, 242, 255, 0.15); }
.lesson-diagram { position: relative; padding-top: 46px; }   /* top strip keeps the Expand button off the drawing */
.dg-expand { position: absolute; top: 10px; right: 10px; z-index: 1; font-family: var(--font-mono); font-size: 0.7rem; font-weight: 700; padding: 5px 9px; border-radius: 8px; cursor: pointer; color: var(--text-main); background: rgba(2, 6, 23, 0.85); border: 1px solid rgba(0, 242, 255, 0.35); }
.dg-lightbox { position: fixed; inset: 0; z-index: 2100; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(2, 6, 23, 0.95); }
.dg-lightbox[hidden] { display: none; }
.dg-lightbox-inner { position: relative; width: min(1180px, 100%); max-height: 100%; overflow: auto; padding: 18px; border-radius: 16px; background: #060c1d; border: 1px solid rgba(0, 242, 255, 0.25); }
.dg-lightbox-inner p { margin: 10px 0 0; text-align: center; color: var(--text-muted); font-size: 0.9rem; }
.dg-close { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 10px; cursor: pointer; color: var(--text-main); background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.15); }
.lesson-diagram figcaption { margin-top: 10px; font-size: 0.84rem; color: var(--text-muted); line-height: 1.5; text-align: center; }
.dg { width: 100%; height: auto; display: block; font-family: var(--font-ui, system-ui, sans-serif); }
.dg-t { fill: var(--text-main, #f8fafc); font-size: 13px; }
.dg-b { font-weight: 700; font-size: 13.5px; }
.dg-s { fill: var(--text-muted, #94a3b8); font-size: 12px; }
.dg-label { fill: var(--text-muted, #94a3b8); font-family: var(--font-mono, monospace); font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.dg-big { font-family: var(--font-heading, inherit); font-size: 20px; font-weight: 800; fill: var(--accent-primary, #00f2ff); }
.dg-pdu { fill: var(--accent-warning, #f59e0b); font-size: 12.5px; font-weight: 700; }
.dg-node { fill: #0d1730; stroke: rgba(148, 163, 184, 0.45); stroke-width: 1.2; }
.dg-ext { fill: #12182b; stroke: rgba(148, 163, 184, 0.6); stroke-dasharray: 4 3; }
.dg-gw { fill: rgba(0, 242, 255, 0.12); stroke: var(--accent-primary, #00f2ff); stroke-width: 1.5; }
.dg-src { fill: rgba(245, 158, 11, 0.08); stroke: rgba(245, 158, 11, 0.5); }
.dg-region { fill: none; stroke: rgba(148, 163, 184, 0.35); stroke-dasharray: 6 4; }
.dg-vpc { fill: rgba(0, 119, 255, 0.05); stroke: rgba(0, 119, 255, 0.6); stroke-width: 1.5; }
.dg-public { fill: rgba(16, 185, 129, 0.07); stroke: rgba(16, 185, 129, 0.55); }
.dg-private { fill: rgba(59, 130, 246, 0.07); stroke: rgba(59, 130, 246, 0.55); }
.dg-pubt { fill: #34d399; }
.dg-privt { fill: #60a5fa; }
.dg-ctrl { fill: rgba(245, 158, 11, 0.05); stroke: rgba(245, 158, 11, 0.4); }
.dg-data { fill: rgba(16, 185, 129, 0.05); stroke: rgba(16, 185, 129, 0.4); }
.dg-pdp { fill: rgba(245, 158, 11, 0.08); stroke: rgba(245, 158, 11, 0.7); stroke-width: 1.5; }
.dg-trustzone { fill: rgba(16, 185, 129, 0.06); stroke: rgba(16, 185, 129, 0.6); stroke-dasharray: 5 4; }
.dg-row { stroke: rgba(255, 255, 255, 0.08); }
.dg-upper { fill: rgba(139, 92, 246, 0.10); }
.dg-mid { fill: rgba(0, 242, 255, 0.10); }
.dg-lower { fill: rgba(59, 130, 246, 0.10); }
.dg-arrow { stroke: rgba(226, 232, 240, 0.75); stroke-width: 1.8; }
.dg-out { stroke: #fbbf24; stroke-dasharray: 6 4; }
.dg-priv { stroke: #34d399; }
.dg-good-arrow { stroke: #34d399; }
.dg-headfill { fill: rgba(226, 232, 240, 0.9); }
.dg-axis { stroke: rgba(148, 163, 184, 0.4); }
.dg-line { fill: none; stroke-width: 3; }
.dg-good-line { stroke: #34d399; }
.dg-warn-line { stroke: #f59e0b; }
.dg-good-dot { fill: #34d399; }
.dg-warn-dot { fill: #f59e0b; }
.dg-good { fill: #34d399; }
.dg-warn { fill: #f59e0b; }

/* ================== AUDIO LECTURE BAR (lecture.js) ================== */
/* The lesson column is a grid item: without min-width:0 it grows to its widest unbreakable content (the bar's
   one-line section label, a wide diagram) and pushes the page wider than a phone screen. */
.lesson-canvas, .lesson-content-wrapper { min-width: 0; }
.lecture-bar { min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; margin: 0 0 22px; padding: 10px 12px; border-radius: 14px; background: rgba(0, 242, 255, 0.05); border: 1px solid rgba(0, 242, 255, 0.22); }
.lecture-bar.playing { border-color: var(--accent-primary); box-shadow: 0 0 18px rgba(0, 242, 255, 0.15); }
.lec-btn { flex: 0 0 auto; min-width: 38px; height: 38px; padding: 0 10px; border-radius: 10px; cursor: pointer; font-family: var(--font-mono); font-size: 0.85rem; font-weight: 700; color: var(--text-main); background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.16); }
.lec-play { min-width: 46px; color: #020617; background: var(--accent-primary); border-color: var(--accent-primary); font-size: 1rem; }
.lec-info { flex: 1 1 220px; min-width: 0; }
.lec-mode { font-family: var(--font-mono); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 1px; color: var(--accent-primary); }
.lec-section { font-size: 0.85rem; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 2px 0 5px; }
.lec-progress { height: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.lec-progress span { display: block; height: 100%; width: 0; background: var(--accent-primary); transition: width 0.3s ease; }
.lec-auto { display: inline-flex; align-items: center; gap: 5px; font-size: 0.78rem; color: var(--text-muted); cursor: pointer; }
.lec-auto input { accent-color: var(--accent-primary); }
.lec-voice { flex: 0 1 auto; max-width: 190px; height: 38px; padding: 0 8px; border-radius: 10px; font-size: 0.78rem; color: var(--text-main); background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.16); }
.lec-voice option { color: #111; background: #fff; }
.lec-modes { display: flex; gap: 6px; flex-wrap: wrap; flex-basis: 100%; }
.lec-chip { font-family: inherit; font-size: 0.76rem; font-weight: 700; padding: 5px 10px; border-radius: 999px; cursor: pointer; color: var(--text-muted); background: transparent; border: 1px solid rgba(255, 255, 255, 0.16); }
.lec-chip.on { color: #020617; background: var(--accent-primary); border-color: var(--accent-primary); }
.lec-warn { flex-basis: 100%; font-size: 0.78rem; color: var(--accent-warning); }
.lecture-on { background: rgba(0, 242, 255, 0.08); box-shadow: -3px 0 0 var(--accent-primary); border-radius: 4px; transition: background 0.3s ease; }
