/* ============================================================
   CCDC Review App — app.css
   Extracted from index.html inline <style> blocks
   Load AFTER style.css for cascade priority
   ============================================================ */

/* ============================================================
   Block 1 — extracted from index.html <style> tag
   ============================================================ */
        /* -- Q&A accordion (refined) -- */
        .qa-answer {
            max-height: 0 !important;
            overflow: hidden !important;
            padding: 0 30px !important;
            transition: max-height 0.4s ease-out, padding 0.4s ease-out !important;
            border-top: 1px dashed var(--border);
            background: var(--gray-50);
        }
        .qa-item.open .qa-answer {
            max-height: 1000px !important;
            padding: 20px 30px !important;
        }

/* ============================================================
   Block 2 — extracted from index.html <style> tag
   ============================================================ */
        /* -- AIABC Custom Overrides -- */
        .preview-banner {
            position: fixed;
            top: 0;
            left: 300px;
            right: 0;
            z-index: 200;
            background: linear-gradient(90deg, #7c3aed 0%, #a78bfa 100%);
            color: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 16px;
            flex-wrap: wrap;
            padding: 11px 20px;
            font-family: "Source Sans 3", sans-serif;
            font-size: 14px;
            font-weight: 600;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
            transition: left 0.3s ease;
        }
        #main { padding-top: 46px; }
        .preview-banner .pb-cta {
            background: #fff;
            color: #7c3aed;
            border: none;
            border-radius: 6px;
            padding: 6px 16px;
            font-size: 13px;
            font-weight: 700;
            cursor: pointer;
            text-decoration: none;
            touch-action: manipulation;
            white-space: nowrap;
        }
        .nav-item.nav-locked {
            opacity: 0.38;
            cursor: pointer !important;
            pointer-events: auto !important;
        }
        .nav-item.nav-locked:hover {
            background: rgba(255, 255, 255, 0.08);
            color: rgba(255, 255, 255, 0.7);
        }
        .locked-badge {
            font-size: 10px;
            font-weight: 600;
            color: var(--accent-gold);
            letter-spacing: 0.5px;
            margin-left: 4px;
        }
        .locked-wrapper {
            position: relative;
            border-radius: 12px;
            overflow: hidden;
        }
        .locked-section {
            filter: blur(4px);
            pointer-events: none;
            user-select: none;
        }
        .locked-overlay {
            position: absolute;
            inset: 0;
            background: rgba(248, 250, 245, 0.5);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10;
            cursor: pointer;
            pointer-events: auto;
        }
        .locked-overlay-box {
            background: #1a1a3e;
            color: #fff;
            border-radius: 14px;
            padding: 24px 32px;
            text-align: center;
            max-width: 360px;
            box-shadow: 0 10px 40px rgba(26, 26, 62, 0.4);
        }
        .locked-overlay-box .lo-icon {
            font-size: 30px;
            margin-bottom: 10px;
        }
        .locked-overlay-box h3 {
            font-family: "Arial", serif;
            font-size: 20px;
            margin-bottom: 8px;
            font-weight: 700;
        }
        .locked-overlay-box p {
            font-size: 14px;
            opacity: 0.82;
            margin-bottom: 16px;
            line-height: 1.5;
        }
        .locked-overlay-box .lo-btn {
            background: linear-gradient(135deg, #7c3aed, #a78bfa);
            color: #fff;
            border: none;
            border-radius: 8px;
            padding: 10px 24px;
            font-size: 15px;
            font-weight: 700;
            cursor: pointer;
            touch-action: manipulation;
        }
        .modal-backdrop {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.55);
            z-index: 1000;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }
        .modal-backdrop.open {
            display: flex;
        }
        .modal-box {
            background: #fff;
            border-radius: 16px;
            padding: 40px 36px;
            max-width: 440px;
            width: 100%;
            text-align: center;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
            position: relative;
        }
        .modal-box .m-icon {
            font-size: 42px;
            margin-bottom: 14px;
        }
        .modal-box h2 {
            font-family: "Arial", serif;
            font-size: 26px;
            color: #1a1a3e;
            margin-bottom: 12px;
        }
        .modal-box p {
            font-size: 15px;
            color: #666;
            line-height: 1.6;
            margin-bottom: 28px;
        }
        .modal-box .m-buy {
            display: block;
            width: 100%;
            background: linear-gradient(135deg, #7c3aed, #a78bfa);
            color: #fff;
            border: none;
            border-radius: 10px;
            padding: 16px;
            font-size: 17px;
            font-weight: 700;
            cursor: pointer;
            margin-bottom: 12px;
            touch-action: manipulation;
        }
        .modal-box .m-close {
            background: none;
            border: none;
            color: #999;
            font-size: 14px;
            cursor: pointer;
            padding: 4px 8px;
        }
        .modal-x {
            position: absolute;
            top: 14px;
            right: 18px;
            background: none;
            border: none;
            font-size: 24px;
            cursor: pointer;
            color: #aaa;
            line-height: 1;
        }
        @media (max-width: 1000px) {
            .preview-banner {
                left: 260px;
            }
        }
        @media (max-width: 800px) {
            .locked-overlay-box {
                padding: 18px 20px;
            }
            .locked-overlay-box h3 {
                font-size: 17px;
            }
            .modal-box {
                padding: 32px 20px;
            }
            .preview-banner {
                top: 44px;
                left: 0;
                right: 0;
                z-index: 199;
                padding: 6px 12px;
                gap: 8px;
                font-size: 12px;
            }
            .preview-banner .pb-cta {
                padding: 4px 12px;
                font-size: 11px;
            }
            #main {
                padding-top: 80px !important;
            }
        }

        /* -- Banner watermark restyle ----------------------------------- */
        .top-banner::before {
            font-size: 110px !important;
            right: 20px !important;
            top: auto !important;
            bottom: 10px !important;
            letter-spacing: 12px !important;
            color: rgba(255, 255, 255, 0.04) !important;
            font-weight: 700 !important;
            transform: none !important;
        }
        @media (max-width: 1000px) {
            .top-banner::before {
                font-size: 80px !important;
                letter-spacing: 10px !important;
                right: 15px !important;
            }
        }
        @media (max-width: 800px) {
            .top-banner::before {
                font-size: 70px !important;
                letter-spacing: 8px !important;
                right: 10px !important;
                bottom: 6px !important;
            }
        }
        @media (max-width: 480px) {
            .top-banner::before {
                font-size: 50px !important;
                letter-spacing: 5px !important;
            }
        }

/* ============================================================
   Block 3 — extracted from index.html <style> tag
   ============================================================ */
        /* -- Collapsible section card (matches .objective-content styling) -- */
        .section-toggle.section-header {
            cursor: pointer;
            user-select: none;
            transition: background 0.2s, box-shadow 0.2s;
            background: var(--gray-200);
            /* Explicit border sides to avoid shorthand conflict */
            border-top: 1px solid var(--border);
            border-right: 1px solid var(--border);
            border-bottom: 1px solid var(--border);
            border-left: 6px solid var(--gray-500);
            border-radius: 0 var(--radius-md) 0 0;
            padding: 20px 26px;
            margin-bottom: 0;
            display: flex;
            align-items: center;
            gap: 16px;
        }
        .section-toggle.section-header:hover {
            background: #f8f8fc;
            box-shadow: var(--shadow-sm);
        }
        /* ── Unified Q&A Card ─────────────────────────────────────────── */
        .qa-unified-card {
            border: none;
            border-radius: 0 4px 4px 0;
            overflow: hidden;
            box-shadow: var(--shadow-sm);
            background: var(--white);
        }
        .qa-card-header {
            display: flex;
            align-items: center;
            gap: 18px;
            padding: 20px 26px;
            background: linear-gradient(90deg, rgba(124, 58, 237, 0.20) 0%, transparent 100%);
            border-left: 6px solid var(--accent-gold);
            border-bottom: 1px solid var(--border);
        }
        .qa-card-header-text h2 {
            font-family: "Helvetica", serif;
            font-size: 16px;
            font-weight: 700;
            color: var(--gray-900);
            margin: 0 0 4px 0;
            line-height: 1.25;
        }
        .qa-card-header-text .chop-ref {
            font-family: "Source Code Pro", monospace;
            font-size: 12px;
            color: var(--accent-gold);
            font-weight: 600;
            letter-spacing: 0.5px;
        }
        .qa-card-body {
            padding: 32px 36px;
            background: linear-gradient(135deg, #f0fdf4, #dcfce7);
            text-align: center;
        }
        .qa-card-body h2 {
            font-family: "Arial", serif;
            font-size: 22px;
            color: #1a1a3e;
            margin: 0 0 10px 0;
        }
        .qa-card-body p {
            color: #555;
            font-size: 14px;
            margin: 0 auto 24px auto;
            max-width: 580px;
            line-height: 1.6;
        }
        .qa-card-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            justify-content: center;
        }

        /* ── Retain for backward compat (other reviewers may still use) ── */
        .qa-section-title {
            background: var(--gray-200);
            border-left: 6px solid var(--accent-gold);
            border-top: 1px solid var(--border);
            border-right: 1px solid var(--border);
            border-bottom: 1px solid var(--border);
            border-radius: 0 var(--radius-md) 0 0;
            padding: 20px 26px;
            margin-bottom: 0;
            align-items: center;
            gap: 16px;
        }
        .section-toggle .toggle-arrow {
            display: inline-block;
            transition: transform 0.25s ease;
            font-size: 16px;
            margin-left: auto;
            color: var(--accent-gold);
            flex-shrink: 0;
        }
        .section-toggle.collapsed .toggle-arrow {
            transform: rotate(-90deg);
        }

        /* -- Collapsible content wrapper (card body) -- */
        .section-content {
            overflow: hidden;
            overflow-anchor: none;
            transition: max-height 0.35s ease, opacity 0.3s ease, padding 0.3s ease;
            max-height: 0;
            opacity: 0;
            padding: 0 26px;
            background: var(--gray-100);
            border-right: 1px solid var(--border);
            border-bottom: 1px solid var(--border);
            border-left: 1px solid var(--gray-500);
            border-top: none;
            border-radius: 0 0 var(--radius-md) var(--radius-md);
        }
        .section-content.expanded {
            max-height: 20000px;
            opacity: 1;
            padding: 8px 26px 26px;
        }

        /* Section header text when inside toggle card */
        .section-toggle .section-header-text h2 {
            font-size: 22px;
            margin-bottom: 2px;
        }
        .section-toggle .section-badge {
            margin-top: 0;
        }

        /* Collapse button at bottom of expanded sections — more prominent */
        .section-collapse-btn {
            display: block;
            width: 100%;
            padding: 12px 0 8px;
            text-align: center;
            background: transparent;
            border: none;
            border-top: 2px solid var(--border);
            color: black;
            font-size: 13px;
            cursor: pointer;
            transition: color 0.2s, background 0.2s, border-color 0.2s;
            letter-spacing: 1.5px;
            font-weight: 700;
            line-height: 1.4;
            margin-top: 8px;
            font-family: "Source Sans 3", sans-serif;
        }
        .section-collapse-btn:hover {
            color: var(--accent-gold);
            background: rgba(184, 134, 11, 0.04);
            border-top-color: var(--accent-gold);
        }
        .section-collapse-btn .collapse-icon {
            display: inline-block;
            transition: transform 0.25s ease;
            margin-right: 6px;
        }
        .section-collapse-btn:hover .collapse-icon {
            transform: translateY(-1px);
        }

        /* Tighten dividers between collapsible card sections */
        .divider {
            margin: 4px 0 !important;
        }

        @media (max-width: 800px) {
            .section-toggle {
                padding: 14px 16px !important;
                gap: 10px;
            }
            .section-toggle .section-header-text h2 {
                font-size: 18px;
            }
            .section-content {
                padding: 0 16px;
            }
            .section-content.expanded {
                padding: 6px 16px 18px;
            }
            .section-toggle .toggle-arrow {
                font-size: 14px;
            }
            .section-collapse-btn {
                font-size: 12px;
                padding: 10px 0 6px;
            }
        }
        @media (max-width: 480px) {
            .section-toggle {
                padding: 12px 12px !important;
                gap: 8px;
            }
            .section-toggle .section-header-text h2 {
                font-size: 16px;
            }
            .section-content.expanded {
                padding: 4px 12px 14px;
            }
            .section-collapse-btn {
                font-size: 11px;
                padding: 8px 0 4px;
            }
        }

/* ============================================================
   Block 4 — extracted from index.html <style> tag
   ============================================================ */
        /* Sidebar collapse button */
        #sidebar-collapse {
            position: absolute;
            top: 32px;
            right: 6px;
            background: none;
            border: none;
            cursor: pointer;
            z-index: 101;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 22px;
            letter-spacing: -3px;
            color: rgba(255, 255, 255, 0.6);
            transition: color 0.2s ease;
            line-height: 1;
            padding: 4px;
        }
        #sidebar-collapse:hover {
            color: rgba(255, 255, 255, 0.95);
        }
        /* When sidebar is collapsed */
        #sidebar.collapsed {
            transform: translateX(-100%);
        }
        #sidebar.collapsed~#sidebar-overlay {
            /* Desktop: no overlay when sidebar collapses via button */
        }
        /* Adjust main content when sidebar collapses */
        #main.sidebar-collapsed {
            margin-left: 0 !important;
        }
        /* Expand button (floating pill when sidebar is hidden) */
        #sidebar-expand {
            display: none;
            position: fixed;
            left: 12px;
            top: 50%;
            transform: translateY(-50%);
            z-index: 99;
            background: #fff;
            border: 2px solid #e5e7eb;
            border-radius: 0 12px 12px 0;
            padding: 10px 14px 10px 8px;
            font-size: 22px;
            cursor: pointer;
            color: #6b7280;
            transition: all 0.2s ease;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
            align-items: center;
            justify-content: center;
            gap: 6px;
            font-weight: 600;
            line-height: 1;
        }
        #sidebar-expand:hover {
            border-color: var(--accent-gold);
            color: var(--accent-gold);
            box-shadow: 0 4px 16px rgba(184, 134, 11, 0.2);
        }
        #sidebar-expand.show {
            display: flex;
        }
        /* -- Section grouping title -- */
        .rm-header {
            font-family: "Orbitron", sans-serif;
            font-size: 12px;
            font-weight: 700;
            color: var(--gray-700);
            text-transform: uppercase;
            letter-spacing: 3px;
            padding: 10px 0 10px 16px;
            margin: 8px 0 0 0;
            line-height: 1;
            border-left: 6px solid var(--accent-gold);
            background: linear-gradient(90deg, rgba(124, 58, 237, 0.20) 0%, transparent 100%);
            border-radius: 0 4px 4px 0;
        }
        /* Remove top padding on all sections so they sit flush */
        #section-1,
        #section-2,
        #section-3,
        #section-4,

        #glossary {
            padding-top: 0 !important;
        }
		
		#glossary-gap {
            padding-top: 0 !important;
			margin-top: 20px;
        }
        /* Show Q&A section header, hide individual Q&A sections behind locked prompt */
        #qa-t1,
        #qa-t2,
        #qa-t3,
        #qa-t4 {
            display: none !important;
        }

        @media (max-width: 800px) {
            #sidebar-collapse {
                display: none;
            }
            #sidebar-expand.show {
                display: none;
            }
            #main.sidebar-collapsed {
                margin-left: 0 !important;
            }
        }

        /* --- Lighter key-summary background --- */
        .key-summary {
            background: linear-gradient(135deg, #f0f2f5 0%, #e8ebf0 100%) !important;
            border: 1px solid #d0d5dd !important;
            box-shadow: var(--shadow-sm) !important;
        }
        .key-summary-header h3,
        .key-summary-header .ks-sub,
        .ks-point .kp-num,
        .ks-point .kp-fact,
        .ks-point .kp-tip,
        .ks-mnemonic .km-label,
        .ks-mnemonic .km-text {
            color: var(--gray-900) !important;
        }
        .ks-point {
            background: rgba(255, 255, 255, 0.7) !important;
            border: 1px solid rgba(0, 0, 0, 0.06) !important;
        }
        .ks-point:hover {
            background: rgba(255, 255, 255, 0.9) !important;
        }
        .ks-mnemonic {
            background: rgba(184, 134, 11, 0.08) !important;
            border: 1px solid rgba(184, 134, 11, 0.2) !important;
        }
        .ks-mnemonic .km-text strong {
            color: #8a6d0b !important;
        }
        .key-summary-header {
            border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
        }
        .key-summary-header .ks-sub {
            color: var(--gray-600) !important;
        }
        .ks-point .kp-tip {
            color: var(--gray-600) !important;
        }

/* ============================================================
   Block 5 — extracted from index.html <style> tag
   ============================================================ */
        .quiz-start-card {
            background: linear-gradient(135deg, #f0fdf4, #dcfce7);
            border: 2px solid #86efac;
            border-radius: 16px;
            padding: 32px 36px;
            margin-top: 40px;
            text-align: center;
        }
        .quiz-start-card h3 {
            font-family: "Arial", serif;
            font-size: 22px;
            color: #1a1a3e;
            margin-bottom: 8px;
        }
        .quiz-start-card p {
            color: #555;
            font-size: 14px;
            margin-bottom: 20px;
            line-height: 1.6;
        }
        .quiz-start-btn {
            background: linear-gradient(135deg, #1e293b, #334155);
            color: #fff;
            border: none;
            border-radius: 10px;
            padding: 14px 36px;
            font-size: 16px;
            font-weight: 700;
            cursor: pointer;
            transition: transform 0.2s, box-shadow 0.2s;
            touch-action: manipulation;
        }
        .quiz-start-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(30, 41, 59, 0.4);
        }
        .quiz-start-btn:active {
            transform: scale(0.96);
        }
        .quiz-start-btn.secondary {
            background: linear-gradient(135deg, #7c3aed, #a78bfa);
            box-shadow: 0 4px 14px rgba(124, 58, 237, 0.3);
        }
        .quiz-start-btn.secondary:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
        }
        .quiz-start-btn.secondary:active {
            transform: scale(0.96);
        }

        /* -- Quiz Unit Filter (like Flashcards) ---------------------------- */
        .qz-filter-row {
            display: flex;
            gap: 6px;
            justify-content: center;
            flex-wrap: wrap;
            margin-bottom: 18px;
        }
        .qz-filter-btn {
            padding: 5px 14px;
            border-radius: 20px;
            border: 1px solid var(--border, #d1d5db);
            background: #fff;
            font-size: 12px;
            font-weight: 600;
            color: var(--gray-mid, #6b7280);
            cursor: pointer;
            transition: all 0.2s;
            touch-action: manipulation;
        }
        .qz-filter-btn:hover {
            border-color: #1e293b;
            color: #1e293b;
        }
        .qz-filter-btn.active {
            background: #1e293b;
            color: #fff;
            border-color: #1e293b;
        }

        /* Trial upsell in results */
        /* Quiz setup overlay */
        .quiz-setup-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.55);
            z-index: 10000;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }
        .quiz-setup-overlay.open {
            display: flex;
        }
        .quiz-setup-box {
            background: #fff;
            border-radius: 18px;
            padding: 36px 32px;
            max-width: 420px;
            width: 100%;
            text-align: center;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
            position: relative;
        }
        .quiz-setup-box h2 {
            font-family: "Arial", serif;
            font-size: 24px;
            color: #1a1a3e;
            margin-bottom: 6px;
        }
        .quiz-setup-box .sub {
            color: #888;
            font-size: 14px;
            margin-bottom: 24px;
        }
        .quiz-setup-box .qty-options {
            display: flex;
            gap: 12px;
            justify-content: center;
            margin-bottom: 24px;
            flex-wrap: wrap;
        }
        .quiz-setup-box .qty-options button {
            width: 64px;
            height: 56px;
            border-radius: 12px;
            border: 2px solid #e5e7eb;
            background: #fff;
            font-size: 18px;
            font-weight: 700;
            color: #1a1a3e;
            cursor: pointer;
            transition: all 0.2s;
            touch-action: manipulation;
        }
        .quiz-setup-box .qty-options button:hover {
            border-color: #334155;
            background: #f1f5f9;
        }
        .quiz-setup-box .qty-options button.selected {
            border-color: #1e293b;
            background: #e2e8f0;
            box-shadow: 0 0 0 3px rgba(30, 41, 59, 0.2);
        }
        .quiz-setup-box .timer-options {
            display: flex;
            gap: 10px;
            justify-content: center;
            flex-wrap: wrap;
        }
        .quiz-setup-box .timer-options button {
            width: 72px;
            height: 44px;
            border-radius: 10px;
            border: 2px solid #e5e7eb;
            background: #fff;
            font-size: 15px;
            font-weight: 600;
            color: #1a1a3e;
            cursor: pointer;
            transition: all 0.2s;
            touch-action: manipulation;
        }
        .quiz-setup-box .timer-options button:hover {
            border-color: #7c3aed;
            background: #f5f3ff;
        }
        .quiz-setup-box .timer-options button.selected {
            border-color: #7c3aed;
            background: #ede9fe;
            box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
        }
        .quiz-setup-go {
            background: linear-gradient(135deg, #1e293b, #3f3f46);
            color: #fff;
            border: none;
            border-radius: 10px;
            padding: 14px 40px;
            font-size: 16px;
            font-weight: 700;
            cursor: pointer;
            width: 100%;
            transition: opacity 0.2s;
            touch-action: manipulation;
        }
        .quiz-setup-go:disabled {
            opacity: 0.4;
            cursor: not-allowed;
        }
        .quiz-setup-close {
            background: none;
            border: none;
            color: #999;
            font-size: 13px;
            cursor: pointer;
            margin-top: 14px;
        }

        /* -- Quiz subscribe prompt (inside setup overlay) ------------------ */
        .qz-subscribe-overlay {
            display: none;
            position: absolute;
            inset: 0;
            background: rgba(255, 255, 255, 0.92);
            backdrop-filter: blur(8px);
            z-index: 20;
            align-items: center;
            justify-content: center;
            border-radius: 20px;
            padding: 20px;
        }
        .qz-subscribe-overlay.open {
            display: flex;
        }
        .qz-subscribe-box {
            background: #fff;
            border-radius: 16px;
            padding: 36px 32px 32px;
            max-width: 380px;
            width: 100%;
            text-align: center;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
        }
        /* In-quiz subscribe overlay */
        .qz-inprogress-overlay {
            display: none;
            position: absolute;
            inset: 0;
            background: rgba(255, 255, 255, 0.92);
            backdrop-filter: blur(8px);
            z-index: 30;
            align-items: center;
            justify-content: center;
            border-radius: 20px;
            padding: 20px;
        }
        .qz-inprogress-overlay.open {
            display: flex;
        }
        .qz-inprogress-box {
            background: #fff;
            border-radius: 16px;
            padding: 36px 32px 32px;
            max-width: 380px;
            width: 100%;
            text-align: center;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
        }
        .qz-subscribe-box .qz-sub-icon {
            font-size: 40px;
            margin-bottom: 10px;
        }
        .qz-subscribe-box h3 {
            font-size: 20px;
            color: #1a1a3e;
            margin: 0 0 8px;
        }
        .qz-subscribe-box p {
            font-size: 14px;
            color: #4a4a6a;
            line-height: 1.5;
            margin: 0 0 20px;
        }
        .qz-subscribe-box .qz-sub-btn {
            display: inline-block;
            background: linear-gradient(135deg, #7c3aed, #a78bfa);
            color: #fff;
            border: none;
            border-radius: 10px;
            padding: 14px 32px;
            font-size: 16px;
            font-weight: 700;
            cursor: pointer;
            transition: transform 0.2s, box-shadow 0.2s;
        }
        .qz-subscribe-box .qz-sub-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
        }
        .qz-subscribe-box .qz-sub-close-btn {
            display: inline-block;
            background: transparent;
            color: #6b7280;
            border: 2px solid #d1d5db;
            border-radius: 10px;
            padding: 12px 28px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            margin-top: 10px;
            margin-left: 10px;
            transition: background 0.2s, border-color 0.2s;
        }
        .qz-subscribe-box .qz-sub-close-btn:hover {
            background: #f9fafb;
            border-color: #9ca3af;
        }
        /* In-quiz overlay box inner styles */
        .qz-inprogress-box h3 {
            font-size: 20px;
            color: #1a1a3e;
            margin: 0 0 8px;
        }
        .qz-inprogress-box p {
            font-size: 14px;
            color: #4a4a6a;
            line-height: 1.5;
            margin: 0 0 20px;
        }
        .qz-inprogress-box .qz-sub-btn {
            display: inline-block;
            background: linear-gradient(135deg, #7c3aed, #a78bfa);
            color: #fff;
            border: none;
            border-radius: 10px;
            padding: 14px 32px;
            font-size: 16px;
            font-weight: 700;
            cursor: pointer;
            transition: transform 0.2s, box-shadow 0.2s;
        }
        .qz-inprogress-box .qz-sub-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
        }
        .qz-inprogress-box .qz-sub-close-btn {
            display: inline-block;
            background: transparent;
            color: #6b7280;
            border: 2px solid #d1d5db;
            border-radius: 10px;
            padding: 12px 28px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            margin-top: 10px;
            margin-left: 10px;
            transition: background 0.2s, border-color 0.2s;
        }
        .qz-inprogress-box .qz-sub-close-btn:hover {
            background: #f9fafb;
            border-color: #9ca3af;
        }

        /* Quiz modal */
        .quiz-modal-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.7);
            z-index: 10001;
            align-items: center;
            justify-content: center;
            padding: 16px;
        }
        .quiz-modal-overlay.open {
            display: flex;
        }
        .quiz-modal-box {
            background: #fff;
            border-radius: 18px;
            width: 100%;
            max-width: 720px;
            max-height: 90vh;
            display: flex;
            flex-direction: column;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
            animation: quiz-in 0.3s ease;
        }
        @keyframes quiz-in {
            from {
                opacity: 0;
                transform: translateY(30px) scale(0.96);
            }
            to {
                opacity: 1;
                transform: translateY(0) scale(1);
            }
        }

        /* Quiz header */
        .quiz-modal-header {
            padding: 18px 24px;
            border-bottom: 1px solid #e5e7eb;
            display: flex;
            align-items: center;
            gap: 14px;
            flex-shrink: 0;
        }
        .quiz-modal-header .qh-info {
            flex: 1;
            min-width: 0;
        }
        .quiz-modal-header .qh-info .qh-title {
            font-weight: 700;
            font-size: 15px;
            color: #1a1a3e;
        }
        .quiz-modal-header .qh-info .qh-progress {
            font-size: 13px;
            color: #888;
        }
        .quiz-modal-header .qh-timer {
            background: #f0fdf4;
            border: 1px solid #86efac;
            border-radius: 8px;
            padding: 6px 14px;
            font-weight: 700;
            font-size: 16px;
            color: #16a34a;
            font-family: "Source Code Pro", monospace;
            white-space: nowrap;
        }
        .quiz-modal-header .qh-timer.warning {
            color: #dc2626;
            background: #fef2f2;
            border-color: #fecaca;
        }
        .quiz-modal-header .qh-close {
            background: none;
            border: none;
            font-size: 22px;
            color: #aaa;
            cursor: pointer;
            padding: 0 4px;
        }
        .quiz-modal-header .qh-close:hover {
            color: #666;
        }

        /* Progress bar */
        .quiz-progress-bar {
            height: 4px;
            background: #e5e7eb;
            flex-shrink: 0;
        }
        .quiz-progress-bar .qp-fill {
            height: 100%;
            background: linear-gradient(90deg, #22c55e, #16a34a);
            transition: width 0.4s ease;
            border-radius: 0 2px 2px 0;
        }

        /* Question body */
        .quiz-question-body {
            padding: 28px 32px;
            overflow-y: auto;
            flex: 1;
        }
        .quiz-question-body .qnum {
            display: inline-block;
            background: #f0fdf4;
            color: #16a34a;
            font-weight: 700;
            font-size: 12px;
            padding: 3px 10px;
            border-radius: 6px;
            margin-bottom: 12px;
        }
        .quiz-question-body .qtext {
            font-size: 17px;
            font-weight: 600;
            color: #1a1a3e;
            line-height: 1.5;
            margin-bottom: 24px;
        }
        .quiz-question-body .qunit {
            font-size: 12px;
            color: #aaa;
            margin-bottom: 4px;
        }

        /* Options */
        .quiz-options {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
        .quiz-options label {
            display: flex;
            align-items: flex-start;
            gap: 12px;
            padding: 14px 18px;
            border: 2px solid #e5e7eb;
            border-radius: 12px;
            cursor: pointer;
            transition: all 0.2s;
            font-size: 15px;
            line-height: 1.4;
            color: #333;
        }
        .quiz-options label:hover {
            border-color: #a7f3d0;
            background: #f0fdf4;
        }
        .quiz-options label input[type="radio"] {
            margin-top: 3px;
            flex-shrink: 0;
            accent-color: #16a34a;
            width: 18px;
            height: 18px;
            cursor: pointer;
        }
        .quiz-options label.selected {
            border-color: #16a34a;
            background: #dcfce7;
        }
        .quiz-options label .opt-letter {
            display: inline-block;
            width: 22px;
            height: 22px;
            border-radius: 50%;
            background: #f3f4f6;
            text-align: center;
            line-height: 22px;
            font-size: 12px;
            font-weight: 700;
            color: #666;
            flex-shrink: 0;
        }
        .quiz-options label.selected .opt-letter {
            background: #16a34a;
            color: #fff;
        }
        .quiz-options label .opt-text {
            flex: 1;
        }

        /* Quiz footer */
        .quiz-modal-footer {
            padding: 16px 24px;
            border-top: 1px solid #e5e7eb;
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-shrink: 0;
            gap: 12px;
        }
        .quiz-modal-footer .qf-left {
            font-size: 13px;
            color: #888;
        }
        .quiz-modal-footer .qf-right {
            display: flex;
            gap: 10px;
        }
        .quiz-nav-btn {
            padding: 10px 22px;
            border-radius: 10px;
            border: none;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            touch-action: manipulation;
        }
        .quiz-nav-btn.prev {
            background: #f3f4f6;
            color: #555;
        }
        .quiz-nav-btn.prev:hover {
            background: #e5e7eb;
        }
        .quiz-nav-btn.next {
            background: linear-gradient(135deg, #16a34a, #22c55e);
            color: #fff;
        }
        .quiz-nav-btn.next:hover {
            box-shadow: 0 4px 12px rgba(22, 163, 74, 0.35);
        }
        .quiz-nav-btn.next:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            box-shadow: none;
        }
        .quiz-nav-btn.submit {
            background: linear-gradient(135deg, #7c3aed, #a78bfa);
            color: #fff;
        }
        .quiz-nav-btn.submit:hover {
            box-shadow: 0 4px 12px rgba(124, 58, 237, 0.35);
        }

        /* Results modal */
        .quiz-results-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.7);
            z-index: 10002;
            align-items: center;
            justify-content: center;
            padding: 16px;
        }
        .quiz-results-overlay.open {
            display: flex;
        }
        .quiz-results-box {
            background: #fff;
            border-radius: 18px;
            width: 100%;
            max-width: 520px;
            max-height: 90vh;
            overflow-y: auto;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
            animation: quiz-in 0.3s ease;
            padding: 36px 32px;
        }
        .quiz-results-box .qr-icon {
            font-size: 52px;
            text-align: center;
            margin-bottom: 10px;
        }
        .quiz-results-box h2 {
            font-family: "Arial", serif;
            font-size: 26px;
            text-align: center;
            color: #1a1a3e;
            margin-bottom: 4px;
        }
        .quiz-results-box .qr-score {
            text-align: center;
            font-size: 48px;
            font-weight: 800;
            color: #16a34a;
            margin: 8px 0;
        }
        .quiz-results-box .qr-score.fail {
            color: #dc2626;
        }
        .quiz-results-box .qr-sub {
            text-align: center;
            color: #888;
            font-size: 14px;
            margin-bottom: 20px;
        }
        .quiz-results-box .qr-stats {
            display: flex;
            gap: 10px;
            margin-bottom: 20px;
            flex-wrap: wrap;
        }
        .quiz-results-box .qr-stats .stat {
            flex: 1;
            min-width: 80px;
            background: #f9fafb;
            border-radius: 10px;
            padding: 12px;
            text-align: center;
        }
        .quiz-results-box .qr-stats .stat .num {
            font-size: 22px;
            font-weight: 700;
        }
        .quiz-results-box .qr-stats .stat .lbl {
            font-size: 11px;
            color: #888;
            margin-top: 1px;
        }
        .qr-recommendation {
            background: #f0fdf4;
            border: 1px solid #86efac;
            border-radius: 12px;
            padding: 16px 18px;
            margin-bottom: 20px;
        }
        .qr-recommendation h4 {
            font-size: 14px;
            font-weight: 700;
            color: #16a34a;
            margin-bottom: 6px;
        }
        .qr-recommendation p {
            font-size: 13px;
            color: #555;
            line-height: 1.5;
        }
        .qr-recommendation.weak {
            background: #fef2f2;
            border-color: #fecaca;
        }
        .qr-recommendation.weak h4 {
            color: #dc2626;
        }
        .qr-breakdown {
            margin-bottom: 20px;
        }
        .qr-breakdown h4 {
            font-size: 14px;
            font-weight: 700;
            color: #1a1a3e;
            margin-bottom: 10px;
        }
        .qr-breakdown .bd-item {
            display: flex;
            justify-content: space-between;
            padding: 6px 0;
            border-bottom: 1px solid #f3f4f6;
            font-size: 13px;
        }
        .qr-breakdown .bd-item .bd-unit {
            color: #555;
        }
        .qr-breakdown .bd-item .bd-pct {
            font-weight: 600;
        }
        .qr-breakdown .bd-item .bd-pct.good {
            color: #16a34a;
        }
        .qr-breakdown .bd-item .bd-pct.ok {
            color: #ca8a04;
        }
        .qr-breakdown .bd-item .bd-pct.bad {
            color: #dc2626;
        }
        /* Quiz question review items */
        .qr-question-review {
            margin-top: 12px;
        }
        .qr-question-review .qr-review-item {
            display: flex;
            flex-direction: column;
            padding: 12px 0;
            border-bottom: 1px solid #f0f0f0;
        }
        .qr-question-review .qr-review-item:last-child {
            border-bottom: none;
        }
        .qr-question-review .qr-review-item .qr-q-text {
            font-size: 13px;
            font-weight: 600;
            color: #1a1a3e;
            margin-bottom: 6px;
            line-height: 1.4;
        }
        .qr-question-review .qr-review-item .qr-ans-line {
            font-size: 12px;
            margin-bottom: 2px;
        }
        .qr-question-review .qr-review-item .qr-explanation {
            font-size: 12px;
            color: #666;
            margin-top: 6px;
            padding: 6px 10px;
            background: #f8fafc;
            border-radius: 6px;
            border-left: 3px solid #7c3aed;
        }
        /* -- AI Explain button & result ---------------------------------- */
        .qr-ai-btn {
            background: none;
            border: 1.5px solid #c4b5fd;
            border-radius: 6px;
            padding: 4px 12px;
            font-size: 12px;
            font-weight: 600;
            color: #7c3aed;
            cursor: pointer;
            transition: all 0.2s ease;
            margin-top: 6px;
            touch-action: manipulation;
        }
        .qr-ai-btn:hover {
            background: #f5f3ff;
            border-color: #7c3aed;
        }
        .qr-ai-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }
        .qr-ai-box {
            margin-top: 8px;
            padding: 10px 12px;
            background: #f5f3ff;
            border-radius: 8px;
            border-left: 3px solid #7c3aed;
            font-size: 13px;
            color: #333;
            line-height: 1.5;
            display: none;
            animation: fadeIn 0.3s ease;
        }
        .qr-ai-box.show {
            display: block;
        }
        .qr-ai-box .qr-ai-loading {
            color: #7c3aed;
            font-size: 12px;
        }
        .qr-ai-box .qr-ai-loading::after {
            content: '...';
            animation: dots 1.2s steps(3) infinite;
        }
        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(-4px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        @keyframes dots {
            0% {
                content: '.';
            }
            33% {
                content: '..';
            }
            66% {
                content: '...';
            }
        }
        .quiz-results-box .qr-actions {
            display: flex;
            gap: 16px;
            margin-top: 24px;
        }
        .quiz-results-box .qr-actions button {
            flex: 1;
            padding: 14px 18px;
            border-radius: 12px;
            border: 2px solid transparent;
            font-size: 15px;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.2s ease;
            touch-action: manipulation;
            letter-spacing: 0.01em;
        }
        .quiz-results-box .qr-actions button.qr-retry {
            background: linear-gradient(135deg, #16a34a, #22c55e);
            color: #fff;
            border-color: transparent;
        }
        .quiz-results-box .qr-actions button.qr-retry:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(22, 163, 74, 0.4);
        }
        .quiz-results-box .qr-actions button.qr-retry:active {
            transform: scale(0.97);
        }
        .quiz-results-box .qr-actions button.qr-close {
            background: #fff;
            color: #555;
            border-color: #d1d5db;
        }
        .quiz-results-box .qr-actions button.qr-close:hover {
            background: #f9fafb;
            border-color: #9ca3af;
            color: #1f2937;
        }
        .quiz-results-box .qr-actions button.qr-close:active {
            transform: scale(0.97);
        }
        @media (max-width: 600px) {
            .quiz-setup-box {
                padding: 24px 18px;
            }
            .quiz-question-body {
                padding: 20px 16px;
            }
            .quiz-modal-header {
                padding: 14px 16px;
            }
            .quiz-modal-footer {
                padding: 14px 16px;
                flex-direction: column;
            }
            .quiz-results-box {
                padding: 24px 18px;
            }
            .quiz-options label {
                padding: 12px 14px;
                font-size: 14px;
            }
            .quiz-setup-box .qty-options button {
                width: 56px;
                height: 48px;
                font-size: 16px;
            }
        }

/* ============================================================
   Block 6 — extracted from index.html <style> tag
   ============================================================ */
	/* ----- Smoother shadows and rounded corners ----- */
		.fc-front, .fc-back {
		  border-radius: 20px;               /* was 16px – softer */
		  box-shadow: 0 8px 30px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.06);
		  background: #ffffff;
		  transition: box-shadow 0.3s ease;
		}

		.fc-card.fc-flipped .fc-front {
		  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
		}
		.fc-card.fc-flipped .fc-back {
		  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
		}

		/* ----- Larger, more readable question text ----- */
		.fc-q {
		  font-size: 20px;                  /* was 18px */
		  font-weight: 600;
		  line-height: 1.6;
		  padding: 6px 0;
		}

		/* ----- Better answer styling ----- */
		.fc-a {
		  font-size: 17px;                  /* was 16px */
		  line-height: 1.7;
		}

		.fc-a .correct-answer {
		  font-size: 16px;
		  padding: 12px 16px;
		  border-left-width: 4px;
		}

		.fc-a .explanation {
		  font-size: 15px;
		  margin-top: 10px;
		  padding: 10px 14px;
		  background: #f8fafc;
		  border-radius: 8px;
		}

		/* ----- Theme badge more subtle ----- */
		.fc-theme-badge {
		  font-size: 12px;                  /* was 11px */
		  letter-spacing: 0.08em;
		  color: var(--gray-500);
		  margin-bottom: 12px;
		}

		/* ----- Box indicator badge – better contrast ----- */
		.fc-box-badge {
		  font-size: 12px;
		  padding: 2px 12px;
		  border-radius: 20px;
		  background: #f1f5f9;
		  border-color: #d1d5db;
		  color: #334155;
		}

		/* ----- Rating buttons – bigger touch targets ----- */
		.fc-rate-btn {
		  padding: 8px 20px;                /* was 6px 16px */
		  font-size: 14px;
		  border-radius: 10px;
		  border-width: 2px;
		}

		/* ----- Bookmark star – better positioning ----- */
		.fc-bookmark-star {
		  top: 22px;
		  right: 24px;
		  font-size: 28px;
		}

		/* ----- Progress bar more prominent ----- */
		.fc-header .fc-progress {
		  font-size: 15px;
		  font-weight: 700;
		  min-width: 100px;
		}
		.fc-header .fc-progress-bar-wrap {
		  height: 8px;                       /* was 6px */
		  border-radius: 4px;
		}
		.fc-header .fc-progress-bar-wrap .fc-progress-fill {
		  border-radius: 4px;
		}

        .fc-btn {
            background: linear-gradient(135deg, #0d9488, #14b8a6);
            color: #fff;
            border: none;
            border-radius: 10px;
            padding: 14px 36px;
            font-size: 16px;
            font-weight: 700;
            cursor: pointer;
            transition: transform 0.2s, box-shadow 0.2s;
            touch-action: manipulation;
        }
        .fc-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(13, 148, 136, 0.4);
        }
        .fc-btn:active {
            transform: scale(0.96);
        }

        /* -- Flashcard Overlay ------------------------------------------- */
        .fc-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.7);
            z-index: 10001;
            align-items: center;
            justify-content: center;
            padding: 16px;
        }
        .fc-overlay.open {
            display: flex;
        }
        .fc-container {
            background: var(--white);
            border-radius: 20px;
            width: 100%;
            max-width: 640px;
            max-height: 94vh;
            display: flex;
            flex-direction: column;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
            animation: fc-in 0.3s ease;
            overflow: hidden;
        }
        @keyframes fc-in {
            from {
                opacity: 0;
                transform: translateY(30px) scale(0.96);
            }
            to {
                opacity: 1;
                transform: translateY(0) scale(1);
            }
        }
        .fc-header {
            padding: 16px 20px;
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            gap: 12px;
            flex-shrink: 0;
            background: #fafafa;
        }
        .fc-header .fc-progress {
            font-weight: 700;
            color: var(--gray-dark);
            min-width: 80px;
        }
        .fc-header .fc-progress-bar-wrap {
            flex: 1;
            height: 6px;
            background: var(--border);
            border-radius: 3px;
            overflow: hidden;
        }
        .fc-header .fc-progress-bar-wrap .fc-progress-fill {
            height: 100%;
            background: linear-gradient(90deg, #0d9488, #14b8a6);
            border-radius: 3px;
            transition: width 0.3s ease;
        }
        .fc-header .fc-close-btn {
            background: none;
            border: none;
            font-size: 28px;
            color: #aaa;
            cursor: pointer;
            padding: 0 4px;
            line-height: 1;
        }
        .fc-header .fc-close-btn:hover {
            color: #666;
        }

        /* -- Card Area (fills remaining space) --------------------------- */
        .fc-card-area {
            flex: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 30px 24px;
            background: #f0fdfa;
            cursor: pointer;
            min-height: 360px;
            max-height: 82vh;
            overflow-y: auto;
            position: relative;
            perspective: 1000px;
        }
        .fc-card-area .fc-hint {
            position: absolute;
            bottom: 12px;
            left: 50%;
            transform: translateX(-50%);
            font-size: 12px;
            color: #94a3b8;
            pointer-events: none;
            transition: opacity 0.3s;
        }

        /* -- 3D Flip Card (proper, no mirroring) -------------------------- */
        .fc-card {
            width: 100%;
            max-width: 560px;
            min-height: 300px;
            max-height: 76vh;
            position: relative;
            background: transparent;
            perspective: 1000px;
        }
        .fc-card-inner {
            position: relative;
            width: 100%;
            height: 100%;
            min-height: 300px;
            max-height: 76vh;
            display: flex;
            flex-direction: column;
            transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
            transform-style: preserve-3d;
        }
        .fc-card.fc-flipped .fc-card-inner {
            transform: rotateY(180deg);
        }

        .fc-front,
        .fc-back {
            position: absolute;
            inset: 0;
            padding: 32px 28px;
            display: flex;
            flex-direction: column;
            border: 1px solid var(--border);
            border-radius: 16px;
            background: var(--white);
            box-shadow: var(--shadow-lg);
            overflow: visible;
            -webkit-backface-visibility: hidden;
            backface-visibility: hidden;
        }
        .fc-back {
            background: var(--gray-wash);
            transform: rotateY(180deg);
        }

        .fc-theme-badge {
            font-size: 11px;
            font-weight: 700;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            color: var(--gray-mid);
            margin-bottom: 10px;
            flex-shrink: 0;
        }
        .fc-q {
            font-weight: 600;
            color: var(--text);
            line-height: 1.5;
            flex: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            text-align: center;
        }
        .fc-answer-body {
            flex: 1;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            justify-content: center;
        }
        .fc-a {
            color: var(--slate);
            line-height: 1.6;
        }
        .fc-a .correct-answer {
            background: #dcfce7;
            border-left: 1px solid #72ba8d;
            padding: 10px 14px;
            border-radius: 8px;
            margin-bottom: 10px;
            font-weight: 600;
            color: #166534;
            display: block;
        }
        .fc-a .explanation {
            font-size: 14px;
            color: #555;
            line-height: 1.5;
            margin-top: 8px;
            display: block;
        }

        .fc-footer {
            padding: 14px 20px;
            border-top: 1px solid var(--border);
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-shrink: 0;
            background: #fafafa;
        }
        .fc-footer .fc-nav {
            display: flex;
            gap: 10px;
        }
        .fc-footer .fc-nav button {
            padding: 10px 20px;
            border-radius: 10px;
            border: none;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
        }
        .fc-footer .fc-nav .fc-next {
            background: linear-gradient(135deg, #0d9488, #14b8a6);
            color: #fff;
        }
        .fc-footer .fc-nav .fc-next:hover {
            box-shadow: 0 4px 12px rgba(13, 148, 136, 0.35);
        }
        .fc-footer .fc-nav .fc-prev {
            background: #e2e8f0;
            color: #334155;
        }
        .fc-footer .fc-nav .fc-prev:hover {
            background: #cbd5e1;
        }
        .fc-footer .fc-nav .fc-prev:disabled {
            opacity: 0.35;
            cursor: not-allowed;
        }

        /* -- Filter tabs ------------------------------------------------ */
        .fc-filter-row {
            display: flex;
            gap: 6px;
            padding: 10px 20px;
            border-bottom: 1px solid var(--border);
            flex-shrink: 0;
            background: #fafafa;
            flex-wrap: wrap;
        }
        .fc-filter-btn {
            padding: 5px 14px;
            border-radius: 20px;
            border: 1px solid var(--border);
            background: #fff;
            font-size: 12px;
            font-weight: 600;
            color: var(--gray-mid);
            cursor: pointer;
            transition: all 0.2s;
            touch-action: manipulation;
        }
        .fc-filter-btn:hover {
            border-color: #0d9488;
            color: #0d9488;
        }
        .fc-filter-btn.active {
            background: #0d9488;
            color: #fff;
            border-color: #0d9488;
        }
        .fc-footer .fc-kbd-hint {
            font-size: 11px;
            color: #94a3b8;
        }
        .fc-footer .fc-kbd-hint kbd {
            display: inline-block;
            padding: 1px 5px;
            background: #f1f5f9;
            border: 1px solid #d1d5db;
            border-radius: 4px;
            font-family: 'Source Code Pro', monospace;
            font-size: 10px;
        }

        /* -- Spaced Repetition Rating Buttons --------------------------- */
        .fc-rating-row {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-top: 14px;
            padding-top: 12px;
            border-top: 1px solid #e5e7eb;
            flex-shrink: 0;
        }
        .fc-rating-hint {
            font-size: 11px;
            color: #94a3b8;
            margin-right: 4px;
        }
        .fc-rate-btn {
            padding: 6px 16px;
            border-radius: 8px;
            border: 2px solid #e5e7eb;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            touch-action: manipulation;
            background: #fff;
        }
        .fc-rate-btn:hover {
            transform: translateY(-1px);
        }
        .fc-rate-btn:active {
            transform: scale(0.95);
        }
        .fc-rate-btn.fc-rate-hard {
            color: #dc2626;
            border-color: #fecaca;
        }
        .fc-rate-btn.fc-rate-hard:hover {
            background: #fef2f2;
            border-color: #dc2626;
        }
        .fc-rate-btn.fc-rate-easy {
            color: #16a34a;
            border-color: #bbf7d0;
        }
        .fc-rate-btn.fc-rate-easy:hover {
            background: #f0fdf4;
            border-color: #16a34a;
        }
        /* Bookmark star */
        .fc-bookmark-star {
            position: absolute;
            top: 18px;
            right: 20px;
            font-size: 24px;
            cursor: pointer;
            z-index: 5;
            transition: transform 0.2s, color 0.2s;
            user-select: none;
            line-height: 1;
            color: #94a3b8;
        }
        .fc-bookmark-star:hover {
            transform: scale(1.3);
            color: #f59e0b;
        }
        /* Box indicator badge */
        .fc-box-badge {
            display: inline-block;
            padding: 2px 10px;
            border-radius: 6px;
            font-size: 11px;
            font-weight: 600;
            margin-left: 8px;
            border: 1px solid #e5e7eb;
            vertical-align: middle;
        }
        /* SR toggle button in header */
        .fc-sr-toggle {
            padding: 4px 12px;
            border-radius: 6px;
            border: 1px solid #d1d5db;
            background: #fff;
            font-size: 12px;
            font-weight: 600;
            cursor: pointer;
            color: #7c3aed;
            transition: all 0.2s;
            touch-action: manipulation;
            white-space: nowrap;
        }
        .fc-sr-toggle:hover {
            background: #f5f3ff;
            border-color: #7c3aed;
        }

		@media (max-width: 600px) {
		  .fc-card-area {
			padding: 20px 16px;
			min-height: 260px;
			max-height: 70vh;
		  }
		  .fc-card {
			min-height: 220px;
			max-height: 66vh;
		  }
		  .fc-card-inner {
			min-height: 220px;
			max-height: 66vh;
		  }
		  .fc-front, .fc-back {
			padding: 24px 18px;
		  }
            .fc-q {
                font-size: 15px;
            }
            .fc-a {
                font-size: 15px;
            }
            .fc-header {
                padding: 12px 14px;
            }
            .fc-footer {
                padding: 12px 14px;
                flex-wrap: wrap;
                gap: 8px;
            }
        }

        /* -- Flashcard subscribe prompt ------------------------------------ */
        .fc-subscribe-overlay {
            display: none;
            position: absolute;
            inset: 0;
            background: rgba(255, 255, 255, 0.85);
            backdrop-filter: blur(6px);
            z-index: 20;
            align-items: center;
            justify-content: center;
            border-radius: 16px;
        }
        .fc-subscribe-overlay.open {
            display: flex;
        }
        .fc-subscribe-box {
            background: #fff;
            border-radius: 16px;
            padding: 36px 32px 32px;
            max-width: 380px;
            width: 90%;
            text-align: center;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
        }
        .fc-subscribe-box .fc-sub-icon {
            font-size: 40px;
            margin-bottom: 10px;
        }
        .fc-subscribe-box h3 {
            font-size: 20px;
            color: #1a1a3e;
            margin: 0 0 8px;
        }
        .fc-subscribe-box p {
            font-size: 14px;
            color: #4a4a6a;
            line-height: 1.5;
            margin: 0 0 20px;
        }
        .fc-subscribe-box .fc-sub-btn {
            display: inline-block;
            background: linear-gradient(135deg, #7c3aed, #a78bfa);
            color: #fff;
            border: none;
            border-radius: 10px;
            padding: 14px 32px;
            font-size: 16px;
            font-weight: 700;
            cursor: pointer;
            transition: transform 0.2s, box-shadow 0.2s;
        }
        .fc-subscribe-box .fc-sub-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
        }
        .fc-subscribe-box .fc-sub-close-btn {
            display: inline-block;
            background: transparent;
            color: #6b7280;
            border: 2px solid #d1d5db;
            border-radius: 10px;
            padding: 12px 28px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            margin-top: 10px;
            margin-left: 10px;
            transition: background 0.2s, border-color 0.2s;
        }
        .fc-subscribe-box .fc-sub-close-btn:hover {
            background: #f9fafb;
            border-color: #9ca3af;
        }
		
/* ----- Subtle flip animation improvement ----- */
.fc-card-inner {
  transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1); /* smoother ease */
}

/* ----- Card hover lift on card area (not just the card) ----- */
.fc-card-area:hover .fc-front:not(.fc-flipped) {
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
  transform: scale(1.01);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* ----- Next/Prev buttons bigger and more tactile ----- */
.fc-footer .fc-nav button {
  padding: 12px 28px;
  font-size: 15px;
  border-radius: 12px;
  letter-spacing: 0.3px;
}

.fc-footer .fc-nav .fc-next {
  background: linear-gradient(135deg, #0d9488, #14b8a6);
  box-shadow: 0 4px 12px rgba(13,148,136,0.25);
}
.fc-footer .fc-nav .fc-next:hover {
  box-shadow: 0 6px 20px rgba(13,148,136,0.35);
  transform: translateY(-2px);
}
.fc-footer .fc-nav .fc-prev {
  background: #f1f5f9;
  color: #334155;
}
.fc-footer .fc-nav .fc-prev:hover {
  background: #e2e8f0;
}

/* ----- Keyboard hint smaller, more elegant ----- */
.fc-footer .fc-kbd-hint {
  font-size: 12px;
  color: #94a3b8;
}
.fc-footer .fc-kbd-hint kbd {
  font-size: 11px;
  padding: 2px 8px;
  background: #f1f5f9;
  border: 1px solid #d1d5db;
  border-radius: 4px;
}

/* ============================================================
   Block 7 — extracted from index.html <style> tag
   ============================================================ */
        /* Floating AI button */
        #ai-chat-button {
            position: fixed;
            bottom: 28px;
            right: 28px;
            z-index: 9999;
            width: 46px;
            height: 46px;
            border-radius: 50%;
            border: none;
            background: linear-gradient(135deg, #7c3aed, #a78bfa);
            color: #fff;
            cursor: pointer;
            box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4);
            transition: transform 0.2s ease, box-shadow 0.2s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            touch-action: manipulation;
        }
        #ai-chat-button:hover {
            transform: scale(1.06);
            box-shadow: 0 6px 22px rgba(124, 58, 237, 0.5);
        }
        #ai-chat-button:active {
            transform: scale(0.93);
        }
        #ai-chat-button .pulse-ring {
            position: absolute;
            inset: -4px;
            border-radius: 50%;
            border: 1.5px solid rgba(124, 58, 237, 0.25);
            animation: ai-pulse 3s ease-out infinite;
        }
        @keyframes ai-pulse {
            0% {
                transform: scale(1);
                opacity: 0.6;
            }
            70% {
                transform: scale(1.2);
                opacity: 0;
            }
            100% {
                transform: scale(1.2);
                opacity: 0;
            }
        }
        #ai-chat-button .badge-dot {
            position: absolute;
            top: 1px;
            right: 1px;
            width: 11px;
            height: 11px;
            background: #22c55e;
            border-radius: 50%;
            border: 2px solid #fff;
        }

        /* Chat modal backdrop */
        #ai-chat-modal {
            display: none;
            position: fixed;
            bottom: 100px;
            right: 28px;
            z-index: 9998;
            width: 380px;
            max-width: calc(100vw - 56px);
            height: 560px;
            max-height: calc(100vh - 140px);
            background: #fff;
            border-radius: 18px;
            box-shadow: 0 12px 50px rgba(0, 0, 0, 0.22);
            flex-direction: column;
            overflow: hidden;
            font-family: "Source Sans 3", sans-serif;
            animation: ai-slide-up 0.3s ease;
        }
        #ai-chat-modal.open {
            display: flex;
        }
        @keyframes ai-slide-up {
            from {
                opacity: 0;
                transform: translateY(24px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        /* Chat header */
        #ai-chat-header {
            background: linear-gradient(135deg, #1a1a3e, #2d2d6e);
            color: #fff;
            padding: 16px 18px;
            display: flex;
            align-items: center;
            gap: 12px;
            flex-shrink: 0;
        }
        #ai-chat-header .h-icon {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background: linear-gradient(135deg, #7c3aed, #a78bfa);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 18px;
            flex-shrink: 0;
        }
        #ai-chat-header .h-text {
            flex: 1;
            min-width: 0;
        }
        #ai-chat-header .h-title {
            font-weight: 700;
            font-size: 15px;
            line-height: 1.2;
        }
        #ai-chat-header .h-sub {
            font-size: 12px;
            opacity: 0.7;
        }
        #ai-chat-header .h-close {
            background: none;
            border: none;
            color: rgba(255, 255, 255, 0.7);
            font-size: 22px;
            cursor: pointer;
            padding: 0 4px;
            line-height: 1;
            touch-action: manipulation;
        }
        #ai-chat-header .h-close:hover {
            color: #fff;
        }

        /* Messages area */
        #ai-chat-messages {
            flex: 1;
            overflow-y: auto;
            padding: 16px;
            background: #f8fafc;
            display: flex;
            flex-direction: column;
            gap: 12px;
        }
        #ai-chat-messages .msg {
            max-width: 88%;
            padding: 10px 14px;
            border-radius: 14px;
            font-size: 14px;
            line-height: 1.55;
            word-wrap: break-word;
            white-space: pre-wrap;
            animation: ai-msg-in 0.2s ease;
        }
        @keyframes ai-msg-in {
            from {
                opacity: 0;
                transform: translateY(8px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        #ai-chat-messages .msg.user {
            align-self: flex-end;
            background: linear-gradient(135deg, #7c3aed, #a78bfa);
            color: #fff;
            border-bottom-right-radius: 4px;
        }
        #ai-chat-messages .msg.assistant {
            align-self: flex-start;
            background: #fff;
            color: #1a1a3e;
            border: 1px solid #e5e7eb;
            border-bottom-left-radius: 4px;
        }
        #ai-chat-messages .msg.assistant .msg-sources {
            margin-top: 8px;
            padding-top: 8px;
            border-top: 1px solid #e5e7eb;
            font-size: 11px;
            color: #888;
        }
        #ai-chat-messages .msg.assistant .msg-sources span {
            display: inline-block;
            background: #f3f0ff;
            color: #7c3aed;
            border-radius: 4px;
            padding: 1px 8px;
            margin: 2px 4px 2px 0;
            font-size: 10px;
            font-weight: 600;
        }
        #ai-chat-messages .msg.error {
            align-self: flex-start;
            background: #fef2f2;
            color: #dc2626;
            border: 1px solid #fecaca;
            border-bottom-left-radius: 4px;
        }
        #ai-chat-messages .msg.system {
            align-self: center;
            background: transparent;
            color: #888;
            font-size: 12px;
            padding: 4px 8px;
            text-align: center;
        }

        /* Typing indicator */
        #ai-typing {
            display: none;
            align-self: flex-start;
            background: #fff;
            border: 1px solid #e5e7eb;
            border-radius: 14px;
            border-bottom-left-radius: 4px;
            padding: 12px 18px;
            gap: 4px;
            align-items: center;
        }
        #ai-typing.show {
            display: flex;
        }
        #ai-typing .dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: #c4b5fd;
            animation: ai-bounce 1.4s infinite both;
        }
        #ai-typing .dot:nth-child(2) {
            animation-delay: 0.16s;
        }
        #ai-typing .dot:nth-child(3) {
            animation-delay: 0.32s;
        }
        @keyframes ai-bounce {
            0%,
            80%,
            100% {
                transform: scale(0.6);
                opacity: 0.4;
            }
            40% {
                transform: scale(1);
                opacity: 1;
            }
        }

        /* Input area */
        #ai-chat-input-area {
            display: flex;
            align-items: flex-end;
            gap: 8px;
            padding: 12px 16px 14px;
            border-top: 1px solid #e5e7eb;
            background: #fff;
            flex-shrink: 0;
        }
        #ai-chat-input-area textarea {
            flex: 1;
            border: 1px solid #d1d5db;
            border-radius: 10px;
            padding: 10px 12px;
            font-family: "Source Sans 3", sans-serif;
            font-size: 14px;
            resize: none;
            outline: none;
            min-height: 20px;
            max-height: 100px;
            line-height: 1.4;
            transition: border-color 0.2s;
        }
        #ai-chat-input-area textarea:focus {
            border-color: #7c3aed;
            box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
        }
        #ai-chat-input-area .send-btn {
            width: 42px;
            height: 42px;
            border-radius: 50%;
            border: none;
            background: linear-gradient(135deg, #7c3aed, #a78bfa);
            color: #fff;
            cursor: pointer;
            flex-shrink: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: transform 0.15s, opacity 0.15s;
            touch-action: manipulation;
        }
        #ai-chat-input-area .send-btn:active {
            transform: scale(0.9);
        }
        #ai-chat-input-area .send-btn:disabled {
            opacity: 0.4;
            cursor: not-allowed;
            transform: none;
        }
        #ai-chat-remaining {
            font-size: 11px;
            color: #aaa;
            text-align: right;
            padding: 2px 4px 0 0;
        }

        @media (max-width: 600px) {
            #ai-chat-modal {
                right: 8px;
                bottom: 80px;
                width: calc(100vw - 16px);
                max-height: calc(100vh - 100px);
                border-radius: 14px;
            }
            #ai-chat-button {
                bottom: 18px;
                right: 18px;
                width: 42px;
                height: 42px;
            }
        }

/* ============================================================
   Progress Dashboard (Q&A card stats row)
   ============================================================ */
.qa-stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 20px 0 24px;
    padding: 14px 10px;
    background: rgba(255,255,255,0.65);
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.05);
}
.qa-stat {
    text-align: center;
    min-width: 64px;
    flex: 1 0 auto;
    padding: 4px 8px;
}
.qa-stat-num {
    display: block;
    font-family: "Orbitron", sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #1a1a3e;
    line-height: 1.2;
}
.qa-stat-num.zero { color: #94a3b8; }
.qa-stat-label {
    display: block;
    font-size: 10px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-top: 2px;
    font-family: "Source Sans 3", sans-serif;
}

/* ============================================================
   Full-Text Search Overlay
   ============================================================ */
#search-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 10003;
    align-items: flex-start;
    justify-content: center;
    padding: 80px 20px 20px;
}
#search-overlay.open { display: flex; }

.search-container {
    background: #fff;
    border-radius: 18px;
    width: 100%;
    max-width: 620px;
    max-height: 75vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
    animation: quiz-in 0.25s ease;
    overflow: hidden;
}
.search-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    background: #fafafa;
}
.search-header input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 10px 14px;
    font-family: "Source Sans 3", sans-serif;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}
.search-header input:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124,58,237,0.12);
}
.search-header .search-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #aaa;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.search-header .search-close:hover { color: #666; }
.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}
.search-results .sr-empty {
    padding: 40px 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 14px;
}
.search-results .sr-item {
    display: block;
    padding: 14px 20px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: inherit;
}
.search-results .sr-item:hover { background: #f8fafc; }
.search-results .sr-item .sr-section {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #7c3aed;
    margin-bottom: 4px;
    font-family: "Source Sans 3", sans-serif;
}
.search-results .sr-item .sr-title {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a3e;
    margin-bottom: 4px;
    line-height: 1.4;
}
.search-results .sr-item .sr-snippet {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.search-results .sr-item .sr-snippet mark {
    background: #fef3c7;
    color: #92400e;
    padding: 1px 2px;
    border-radius: 2px;
}
.search-footer {
    padding: 10px 20px;
    border-top: 1px solid #e5e7eb;
    font-size: 11px;
    color: #94a3b8;
    text-align: center;
    flex-shrink: 0;
    background: #fafafa;
}

/* Floating search button */
#search-float-btn {
    position: fixed;
    bottom: 28px;
    left: 28px;
    z-index: 9999;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    background: #fff;
    color: #1e293b;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    border: 1.5px solid #e5e7eb;
}
#search-float-btn:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 22px rgba(0,0,0,0.18);
    border-color: #7c3aed;
    color: #7c3aed;
}
#search-float-btn:active { transform: scale(0.93); }
@media (max-width: 600px) {
    #search-float-btn {
        bottom: 18px;
        left: 18px;
        width: 42px;
        height: 42px;
    }
}

/* ============================================================
   Dark Mode — CSS Custom Properties
   ============================================================ */
[data-theme="dark"] {
  --gray-900: #f1f5f9;
  --gray-800: #e2e8f0;
  --gray-700: #cbd5e1;
  --gray-600: #94a3b8;
  --gray-500: #64748b;
  --gray-400: #475569;
  --gray-300: #334155;
  --gray-200: #1e293b;
  --gray-100: #1a1f2e;
  --gray-50:  #141d2b;

  --slate:    #0f172a;
  --slate-600: #94a3b8;
  --slate-500: #64748b;
  --slate-400: #475569;

  --text:         #f1f5f9;
  --text-mid:     #cbd5e1;
  --text-muted:   #94a3b8;

  --bg:       #0b1120;
  --white:    #1a2332;
  --card-bg:  #1a2332;

  --border:       #2d3a4f;
  --divider:      #2d3a4f;
  --border-light: #1a2332;

  --accent-gold:  #f59e0b;
  --accent-gold-light: #2d2000;
  --accent-blue:  #60a5fa;
  --accent-blue-light: #0c1929;
  --accent-green: #4ade80;
  --accent-green-light: #0a1f0f;
  --accent-purple: #a78bfa;
  --accent-purple-light: #1a1030;

  --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow:     0 2px 12px rgba(0, 0, 0, 0.45);
  --shadow-md:  0 4px 20px rgba(0, 0, 0, 0.5);
  --shadow-lg:  0 8px 40px rgba(0, 0, 0, 0.55);

  /* Scrollbar */
  scrollbar-color: #334155 transparent;
}

/* ============================================================
   Dark Mode — Element Overrides (hardcoded colors → dark)
   ============================================================ */

/* ——— Boxes & Cards ——— */
[data-theme="dark"] .modal-box,
[data-theme="dark"] .quiz-setup-box,
[data-theme="dark"] .quiz-results-box,
[data-theme="dark"] .quiz-modal-box,
[data-theme="dark"] .qz-subscribe-box,
[data-theme="dark"] .qz-inprogress-box,
[data-theme="dark"] .fc-subscribe-box,
[data-theme="dark"] .search-container,
[data-theme="dark"] #ai-chat-modal,
[data-theme="dark"] .fc-front,
[data-theme="dark"] .fc-back {
  background: var(--card-bg);
}

/* ——— Heading colors on card backgrounds ——— */
[data-theme="dark"] .modal-box h2,
[data-theme="dark"] .quiz-setup-box h2,
[data-theme="dark"] .quiz-results-box h2,
[data-theme="dark"] .qz-subscribe-box h3,
[data-theme="dark"] .qz-inprogress-box h3,
[data-theme="dark"] .fc-subscribe-box h3,
[data-theme="dark"] .qa-card-body h2,
[data-theme="dark"] .quiz-start-card h3,
[data-theme="dark"] .quiz-options label,
[data-theme="dark"] .quiz-question-body .qtext,
[data-theme="dark"] .quiz-modal-header .qh-info .qh-title,
[data-theme="dark"] .qr-breakdown h4,
[data-theme="dark"] .qr-question-review .qr-review-item .qr-q-text,
[data-theme="dark"] .qa-stat-num,
[data-theme="dark"] .quiz-setup-box .qty-options button,
[data-theme="dark"] .quiz-setup-box .timer-options button,
[data-theme="dark"] .search-results .sr-item .sr-title {
  color: var(--text);
}

/* ——— Muted/dim text ——— */
[data-theme="dark"] .quiz-start-card p,
[data-theme="dark"] .qa-card-body p,
[data-theme="dark"] .qz-subscribe-box p,
[data-theme="dark"] .qz-inprogress-box p,
[data-theme="dark"] .fc-subscribe-box p,
[data-theme="dark"] .qr-recommendation p,
[data-theme="dark"] .qr-question-review .qr-review-item .qr-explanation,
[data-theme="dark"] .qr-breakdown .bd-item .bd-unit,
[data-theme="dark"] .quiz-nav-btn.prev,
[data-theme="dark"] .quiz-setup-box .sub,
[data-theme="dark"] .quiz-results-box .qr-sub,
[data-theme="dark"] .quiz-results-box .qr-stats .stat .lbl,
[data-theme="dark"] .quiz-modal-header .qh-info .qh-progress,
[data-theme="dark"] .quiz-modal-footer .qf-left,
[data-theme="dark"] .fc-a .explanation,
[data-theme="dark"] .qz-subscribe-box .qz-sub-close-btn,
[data-theme="dark"] .qz-inprogress-box .qz-sub-close-btn,
[data-theme="dark"] .fc-subscribe-box .fc-sub-close-btn,
[data-theme="dark"] .quiz-results-box .qr-actions button.qr-close,
[data-theme="dark"] .search-results .sr-item .sr-snippet,
[data-theme="dark"] .search-results .sr-empty,
[data-theme="dark"] .search-footer,
[data-theme="dark"] .fc-footer .fc-kbd-hint,
[data-theme="dark"] .fc-rating-hint,
[data-theme="dark"] .fc-card-area .fc-hint,
[data-theme="dark"] .qa-stat-label,
[data-theme="dark"] .quiz-setup-close,
[data-theme="dark"] .modal-box .m-close {
  color: #94a3b8;
}

/* ——— Light backgrounds → dark ——— */
[data-theme="dark"] .lock-section-bg,
[data-theme="dark"] .section-toggle.section-header:hover,
[data-theme="dark"] .qa-card-body,
[data-theme="dark"] .quiz-start-card,
[data-theme="dark"] .quiz-modal-header .qh-timer,
[data-theme="dark"] .quiz-question-body .qnum,
[data-theme="dark"] .quiz-options label:hover,
[data-theme="dark"] .quiz-options label.selected,
[data-theme="dark"] .qr-recommendation,
[data-theme="dark"] .qr-recommendation.weak,
[data-theme="dark"] .fc-card-area,
[data-theme="dark"] .fc-header,
[data-theme="dark"] .fc-filter-row,
[data-theme="dark"] .fc-footer,
[data-theme="dark"] .fc-a .correct-answer,
[data-theme="dark"] .fc-a .explanation,
[data-theme="dark"] .fc-rate-btn.fc-rate-hard:hover,
[data-theme="dark"] .fc-rate-btn.fc-rate-easy:hover,
[data-theme="dark"] .qz-subscribe-box .qz-sub-close-btn:hover,
[data-theme="dark"] .qz-inprogress-box .qz-sub-close-btn:hover,
[data-theme="dark"] .fc-subscribe-box .fc-sub-close-btn:hover,
[data-theme="dark"] .quiz-setup-box .timer-options button:hover,
[data-theme="dark"] .quiz-results-box .qr-stats .stat,
[data-theme="dark"] .qr-question-review .qr-review-item .qr-explanation,
[data-theme="dark"] .search-header,
[data-theme="dark"] .search-footer,
[data-theme="dark"] .search-results .sr-item:hover,
[data-theme="dark"] #ai-chat-messages,
[data-theme="dark"] #ai-chat-input-area,
[data-theme="dark"] #ai-typing,
[data-theme="dark"] #ai-chat-messages .msg.assistant,
[data-theme="dark"] .fc-rate-btn,
[data-theme="dark"] .fc-filter-btn,
[data-theme="dark"] .fc-sr-toggle,
[data-theme="dark"] .fc-box-badge,
[data-theme="dark"] .qz-filter-btn,
[data-theme="dark"] .quiz-options label,
[data-theme="dark"] .quiz-results-box .qr-actions button.qr-close,
[data-theme="dark"] .quiz-nav-btn.prev,
[data-theme="dark"] .quiz-setup-box .qty-options button,
[data-theme="dark"] .quiz-setup-box .timer-options button,
[data-theme="dark"] .fc-footer .fc-nav .fc-prev,
[data-theme="dark"] .fc-footer .fc-kbd-hint kbd,
[data-theme="dark"] .quiz-setup-box .qty-options button.selected,
[data-theme="dark"] .search-results .sr-item,
[data-theme="dark"] .section-content,
[data-theme="dark"] .qa-card-header,
[data-theme="dark"] .qa-section-title,
[data-theme="dark"] .section-toggle.section-header {
  background: var(--gray-100);
}

[data-theme="dark"] .search-container,
[data-theme="dark"] .quiz-modal-box {
  background: var(--card-bg);
}

/* ——— Green accent backgrounds ——— */
[data-theme="dark"] .qa-card-body {
  background: linear-gradient(135deg, #0a1f0f, #0d2818);
}
[data-theme="dark"] .quiz-start-card {
  background: linear-gradient(135deg, #0a1f0f, #0d2818);
}
[data-theme="dark"] .quiz-modal-header .qh-timer {
  background: #0a1f0f;
}
[data-theme="dark"] .quiz-question-body .qnum {
  background: #0a1f0f;
}
[data-theme="dark"] .fc-card-area {
  background: #0d1f1a;
}
[data-theme="dark"] .fc-a .correct-answer {
  background: #0a1f0f;
  color: #4ade80;
}
[data-theme="dark"] .qr-recommendation {
  background: #0a1f0f;
}
[data-theme="dark"] .qr-recommendation.weak {
  background: #2d0a0a;
}
[data-theme="dark"] .quiz-options label:hover {
  background: #0a1f0f;
}
[data-theme="dark"] .quiz-options label.selected {
  background: #0a1f0f;
}

/* ——— Purple accent backgrounds ——— */
[data-theme="dark"] .qr-ai-btn:hover,
[data-theme="dark"] .qr-ai-box,
[data-theme="dark"] .fc-sr-toggle:hover,
[data-theme="dark"] .quiz-setup-box .timer-options button.selected {
  background: #1a1030;
}
[data-theme="dark"] .quiz-setup-box .timer-options button:hover {
  background: #1a1030;
}

/* ——— Red tint backgrounds ——— */
[data-theme="dark"] .quiz-modal-header .qh-timer.warning {
  background: #2d0a0a;
}
[data-theme="dark"] .fc-rate-btn.fc-rate-hard:hover {
  background: #2d0a0a;
}
[data-theme="dark"] #ai-chat-messages .msg.error {
  background: #2d0a0a;
}

/* ——— Borders ——— */
[data-theme="dark"] .quiz-modal-header,
[data-theme="dark"] .quiz-modal-footer,
[data-theme="dark"] .search-header,
[data-theme="dark"] .search-footer,
[data-theme="dark"] .search-results .sr-item,
[data-theme="dark"] #ai-chat-input-area,
[data-theme="dark"] .fc-header,
[data-theme="dark"] .fc-filter-row,
[data-theme="dark"] .fc-footer,
[data-theme="dark"] .fc-rating-row,
[data-theme="dark"] .qr-breakdown .bd-item,
[data-theme="dark"] #ai-chat-messages .msg.assistant,
[data-theme="dark"] #ai-chat-messages .msg.assistant .msg-sources,
[data-theme="dark"] .qa-card-header,
[data-theme="dark"] .section-collapse-btn,
[data-theme="dark"] .quiz-progress-bar,
[data-theme="dark"] .quiz-options label,
[data-theme="dark"] .qz-filter-btn,
[data-theme="dark"] .fc-rate-btn,
[data-theme="dark"] .fc-filter-btn,
[data-theme="dark"] .fc-sr-toggle,
[data-theme="dark"] .fc-box-badge,
[data-theme="dark"] .quiz-setup-box .qty-options button,
[data-theme="dark"] .quiz-setup-box .timer-options button,
[data-theme="dark"] .fc-footer .fc-kbd-hint kbd,
[data-theme="dark"] .search-header input,
[data-theme="dark"] #ai-chat-input-area textarea,
[data-theme="dark"] .quiz-results-box .qr-actions button.qr-close,
[data-theme="dark"] .qz-subscribe-box .qz-sub-close-btn,
[data-theme="dark"] .qz-inprogress-box .qz-sub-close-btn,
[data-theme="dark"] .fc-subscribe-box .fc-sub-close-btn {
  border-color: #2d3a4f;
}

/* ——— Header/footer bars ——— */
[data-theme="dark"] .fc-header,
[data-theme="dark"] .fc-filter-row,
[data-theme="dark"] .fc-footer {
  background: #141d2b;
}
[data-theme="dark"] .search-header,
[data-theme="dark"] .search-footer {
  background: #141d2b;
}

/* ——— AI Chat specific ——— */
[data-theme="dark"] #ai-chat-messages {
  background: #141d2b;
}
[data-theme="dark"] #ai-chat-messages .msg.assistant {
  background: #1a2332;
  color: #e2e8f0;
}
[data-theme="dark"] #ai-chat-input-area {
  background: #1a2332;
}
[data-theme="dark"] #ai-typing {
  background: #1a2332;
}

/* ——— Locked overlay ——— */
[data-theme="dark"] .locked-overlay {
  background: rgba(15, 23, 42, 0.65);
}

/* ——— Subscribe overlays (blur bg) ——— */
[data-theme="dark"] .qz-subscribe-overlay,
[data-theme="dark"] .qz-inprogress-overlay,
[data-theme="dark"] .fc-subscribe-overlay {
  background: rgba(15, 23, 42, 0.85);
}

/* ——— Section header hover ——— */
[data-theme="dark"] .section-toggle.section-header:hover {
  background: #1a2332;
}

/* ——— Key summary ——— */
[data-theme="dark"] .key-summary {
  background: linear-gradient(135deg, #1a1f2e 0%, #141d2b 100%) !important;
  border-color: #2d3a4f !important;
}
[data-theme="dark"] .key-summary-header h3,
[data-theme="dark"] .key-summary-header .ks-sub,
[data-theme="dark"] .ks-point .kp-num,
[data-theme="dark"] .ks-point .kp-fact,
[data-theme="dark"] .ks-point .kp-tip,
[data-theme="dark"] .ks-mnemonic .km-label,
[data-theme="dark"] .ks-mnemonic .km-text {
  color: var(--text) !important;
}
[data-theme="dark"] .ks-point {
  background: rgba(255,255,255,0.04) !important;
  border-color: rgba(255,255,255,0.06) !important;
}
[data-theme="dark"] .ks-point:hover {
  background: rgba(255,255,255,0.07) !important;
}
[data-theme="dark"] .ks-mnemonic {
  background: rgba(245,158,11,0.08) !important;
  border-color: rgba(245,158,11,0.15) !important;
}
[data-theme="dark"] .ks-mnemonic .km-text strong {
  color: #f59e0b !important;
}
[data-theme="dark"] .key-summary-header {
  border-bottom-color: rgba(255,255,255,0.08) !important;
}

/* ——— Progress dashboard stats row ——— */
[data-theme="dark"] .qa-stats-row {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.05);
}

/* ——— Search highlight ——— */
[data-theme="dark"] .search-results .sr-item .sr-snippet mark {
  background: #5c3d00;
  color: #fbbf24;
}

/* ——— Scrollbar ——— */
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #334155;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* ——— Sidebar expand button ——— */
[data-theme="dark"] #sidebar-expand {
  background: #1a2332;
  border-color: #2d3a4f;
  color: #94a3b8;
}
[data-theme="dark"] #sidebar-expand:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

/* ——— Search float button ——— */
[data-theme="dark"] #search-float-btn {
  background: #1a2332;
  color: #e2e8f0;
  border-color: #2d3a4f;
}
[data-theme="dark"] #search-float-btn:hover {
  border-color: #7c3aed;
  color: #a78bfa;
}

/* ——— AI chat messages source pills ——— */
[data-theme="dark"] #ai-chat-messages .msg.assistant .msg-sources span {
  background: #1a1030;
}

/* ——— Option letter circles ——— */
[data-theme="dark"] .quiz-options label .opt-letter {
  background: #1e293b;
  color: #94a3b8;
}

/* ——— Quiz setup box qty button selected ——— */
[data-theme="dark"] .quiz-setup-box .qty-options button.selected {
  border-color: #e2e8f0;
  background: #1e293b;
}

/* ——— Footer prev button ——— */
[data-theme="dark"] .fc-footer .fc-nav .fc-prev {
  background: #1e293b;
  color: #cbd5e1;
}
[data-theme="dark"] .fc-footer .fc-nav .fc-prev:hover {
  background: #2d3a4f;
}

/* ——— Reading Materials header ——— */
[data-theme="dark"] .rm-header {
  background: linear-gradient(90deg, rgba(124,58,237,0.08) 0%, transparent 100%);
}

/* ——— Quiz close/setup-close buttons ——— */
[data-theme="dark"] .quiz-modal-header .qh-close,
[data-theme="dark"] .search-header .search-close,
[data-theme="dark"] .modal-x {
  color: #64748b;
}
[data-theme="dark"] .quiz-modal-header .qh-close:hover,
[data-theme="dark"] .search-header .search-close:hover {
  color: #cbd5e1;
}

/* ——— AI badge dot border ——— */
[data-theme="dark"] #ai-chat-button .badge-dot {
  border-color: #1a2332;
}

/* ——— FC card area hover ——— */
[data-theme="dark"] .fc-card-area:hover .fc-front:not(.fc-flipped) {
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}

/* ============================================================
   Theme Toggle Button
   ============================================================ */
#theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 20px;
  margin: 4px 0;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  color: rgba(255,255,255,0.65);
  font-family: "Source Sans 3", sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  touch-action: manipulation;
}
#theme-toggle-btn:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.9);
}
#theme-toggle-btn .tt-icon {
  font-size: 16px;
  line-height: 1;
}
#theme-toggle-btn .tt-label {
  flex: 1;
  text-align: left;
}
