/* =====================================================================
   X-ZITH Learning Hub — Stylesheet
   ===================================================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

        * { margin: 0; padding: 0; box-sizing: border-box; }
        
        :root {
            --bg: #f5f7fa;
            --bg-card: #ffffff;
            --text: #333;
            --text-light: #666;
            --border: #e0e0e0;
            --primary: #667eea;
            --primary-dark: #764ba2;
            --success: #2ecc71;
            --danger: #e74c3c;
            --warning: #f39c12;
        }
        
        body.dark-mode {
            --bg: #0b1428;
            --bg-card: #12203e;
            --text: #e8eefb;
            --text-light: #9fb1d3;
            --border: #243659;
        }
        
        body { 
            font-family: 'Segoe UI', sans-serif; 
            background-color: var(--bg);
            color: var(--text);
            transition: all 0.3s ease;
        }
        
        /* ===== LANDING NAVBAR ===== */
        .landing-navbar {
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
            padding: 15px 30px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            box-shadow: 0 4px 15px rgba(0,0,0,0.1);
            position: sticky;
            top: 0;
            z-index: 1000;
        }
        
        .landing-navbar-left { display: flex; align-items: center; gap: 20px; }
        .landing-logo { color: white; font-size: 24px; font-weight: 700; }
        
        .landing-navbar-right { display: flex; gap: 15px; }
        .landing-navbar-right button {
            background: rgba(255,255,255,0.2);
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 600;
            transition: all 0.3s;
        }
        
        .landing-navbar-right button:hover {
            background: rgba(255,255,255,0.3);
            transform: translateY(-2px);
        }
        
        .theme-toggle {
            background: rgba(255,255,255,0.2) !important;
            padding: 10px 15px !important;
        }
        
        /* ===== LANDING PAGE ===== */
        .landing-page {
            display: block;
        }
        
        .landing-page.hidden {
            display: none;
        }
        
        .hero-section {
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
            color: white;
            padding: 60px 30px;
            text-align: center;
            min-height: 60vh;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
        }
        
        .hero-section h1 {
            font-size: 48px;
            margin-bottom: 20px;
            font-weight: 700;
        }
        
        .hero-section p {
            font-size: 18px;
            margin-bottom: 30px;
            opacity: 0.95;
            max-width: 600px;
            margin-left: auto;
            margin-right: auto;
        }
        
        .hero-buttons {
            display: flex;
            gap: 20px;
            justify-content: center;
            flex-wrap: wrap;
            margin-bottom: 20px;
        }
        
        .hero-btn {
            padding: 14px 30px;
            border: none;
            border-radius: 10px;
            cursor: pointer;
            font-size: 16px;
            font-weight: 600;
            transition: all 0.3s;
            text-decoration: none;
            display: inline-block;
        }
        
        .hero-btn-primary {
            background: white;
            color: var(--primary);
        }
        
        .hero-btn-primary:hover {
            transform: translateY(-3px);
            box-shadow: 0 10px 30px rgba(0,0,0,0.2);
        }
        
        .hero-btn-secondary {
            background: rgba(255,255,255,0.2);
            color: white;
            border: 2px solid white;
        }
        
        .hero-btn-secondary:hover {
            background: rgba(255,255,255,0.3);
            transform: translateY(-3px);
        }
        
        .landing-content {
            padding: 60px 30px;
            max-width: 1200px;
            margin: 0 auto;
        }
        
        .info-section {
            margin: 50px 0;
        }
        
        .info-section h2 {
            color: var(--primary);
            font-size: 32px;
            margin-bottom: 20px;
            text-align: center;
        }
        
        .info-section p {
            font-size: 16px;
            line-height: 1.8;
            text-align: center;
            max-width: 800px;
            margin: 0 auto 20px;
        }
        
        .features-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 30px;
            margin: 40px 0;
        }
        
        .feature-box {
            background: var(--bg-card);
            padding: 30px;
            border-radius: 15px;
            border: 1px solid var(--border);
            text-align: center;
            transition: all 0.3s;
        }
        
        .feature-box:hover {
            transform: translateY(-10px);
            box-shadow: 0 10px 30px rgba(102,126,234,0.2);
        }
        
        .feature-box h3 {
            font-size: 22px;
            margin-bottom: 15px;
            color: var(--text);
        }
        
        .feature-box p {
            color: var(--text-light);
            line-height: 1.6;
        }
        
        .benefits-list {
            background: var(--bg-card);
            padding: 30px;
            border-radius: 15px;
            border: 1px solid var(--border);
            margin: 30px 0;
        }
        
        .benefits-list h3 {
            font-size: 24px;
            margin-bottom: 20px;
            color: var(--primary);
        }
        
        .benefits-list ul {
            list-style: none;
            margin: 0;
            padding: 0;
        }
        
        .benefits-list li {
            padding: 12px 0;
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            gap: 15px;
        }
        
        .benefits-list li:last-child {
            border-bottom: none;
        }
        
        .benefits-list li:before {
            content: "✓";
            color: var(--success);
            font-size: 20px;
            font-weight: 700;
        }
        
        /* ===== STATS STRIP ===== */
        .stats-strip {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
            gap: 20px;
            margin: 50px 0;
            padding: 36px 20px;
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: 18px;
        }
        .stat-box { text-align: center; }
        .stat-number { font-size: 32px; font-weight: 800; color: var(--primary); margin-bottom: 6px; }
        .stat-label { font-size: 14px; color: var(--text-light); font-weight: 600; }

        /* ===== TESTIMONIALS ===== */
        .testimonials-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 24px;
            margin: 40px 0;
        }
        .testimonial-card {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: 16px;
            padding: 26px;
            display: flex;
            flex-direction: column;
            gap: 14px;
            transition: all 0.3s;
        }
        .testimonial-card:hover { transform: translateY(-6px); box-shadow: 0 10px 26px rgba(102,126,234,0.15); }
        .testimonial-stars { font-size: 14px; letter-spacing: 2px; }
        .testimonial-text { color: var(--text); line-height: 1.7; font-size: 15px; font-style: italic; }
        .testimonial-author { display: flex; align-items: center; gap: 12px; margin-top: auto; }
        .testimonial-avatar {
            width: 42px; height: 42px; min-width: 42px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
            color: white;
            display: flex; align-items: center; justify-content: center;
            font-weight: 700; font-size: 14px;
        }
        .testimonial-name { font-weight: 700; color: var(--text); font-size: 14px; }
        .testimonial-role { font-size: 13px; color: var(--text-light); }

        /* ===== FAQ ===== */
        .faq-list { max-width: 760px; margin: 30px auto 0; }
        .faq-item {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: 12px;
            margin-bottom: 12px;
            overflow: hidden;
        }
        .faq-question {
            padding: 18px 22px;
            cursor: pointer;
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-weight: 600;
            color: var(--text);
            font-size: 15px;
            text-align: left;
        }
        .faq-toggle { font-size: 20px; color: var(--primary); transition: transform 0.25s; }
        .faq-item.open .faq-toggle { transform: rotate(45deg); }
        .faq-answer {
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.3s ease, padding 0.3s ease;
            padding: 0 22px;
            color: var(--text-light);
            line-height: 1.7;
            font-size: 14px;
            text-align: left;
        }
        .faq-item.open .faq-answer { max-height: 300px; padding: 0 22px 20px; }

        .cta-section {
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
            color: white;
            padding: 50px 30px;
            border-radius: 15px;
            text-align: center;
            margin: 50px 0;
        }
        
        .cta-section h2 {
            font-size: 32px;
            margin-bottom: 20px;
        }
        
        .cta-section p {
            font-size: 16px;
            margin-bottom: 30px;
            opacity: 0.95;
        }
        
        .landing-footer {
            background: var(--bg-card);
            padding: 30px;
            text-align: center;
            border-top: 1px solid var(--border);
            margin-top: 50px;
            color: var(--text-light);
        }
        
        .landing-footer p {
            margin: 10px 0;
        }
        
        .landing-footer strong {
            color: var(--text);
        }
        
        /* ===== APP NAVBAR ===== */
        .app-navbar { 
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); 
            padding: 15px 30px; 
            display: flex; 
            justify-content: space-between; 
            align-items: center; 
            box-shadow: 0 4px 15px rgba(0,0,0,0.1);
            position: sticky;
            top: 0;
            z-index: 1000;
        }
        
        .navbar-left { display: flex; align-items: center; gap: 20px; }
        .navbar-logo { color: white; font-size: 24px; font-weight: 700; }
        .navbar-user { color: white; font-size: 14px; }
        
        .navbar-right { display: flex; gap: 15px; align-items: center; position: relative; }
        
        .theme-toggle, .notification-btn { 
            background: rgba(255,255,255,0.2); 
            color: white; 
            border: none; 
            padding: 10px 15px; 
            border-radius: 8px; 
            cursor: pointer; 
            font-size: 16px;
            transition: all 0.3s;
        }
        
        .theme-toggle:hover, .notification-btn:hover { 
            background: rgba(255,255,255,0.3); 
        }
        
        .notification-badge {
            position: absolute;
            top: -5px;
            right: -5px;
            background: #e74c3c;
            color: white;
            border-radius: 50%;
            width: 20px;
            height: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
            font-weight: bold;
        }
        
        .notification-dropdown {
            position: absolute;
            top: 60px;
            right: 0;
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: 12px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.15);
            min-width: 350px;
            max-height: 400px;
            overflow-y: auto;
            display: none;
            z-index: 999;
        }
        
        .notification-dropdown.active { display: block; }
        
        .notification-header {
            padding: 15px;
            font-weight: 600;
            border-bottom: 1px solid var(--border);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .notification-header button {
            background: none;
            border: none;
            color: var(--primary);
            cursor: pointer;
            font-size: 12px;
            font-weight: 600;
        }
        
        .notification-item {
            padding: 15px;
            border-bottom: 1px solid var(--border);
            cursor: pointer;
            transition: background 0.3s;
        }
        
        .notification-item:hover { background: var(--primary); color: white; }
        .notification-item:last-child { border-bottom: none; }
        
        .navbar-menu { 
            display: flex; 
            gap: 5px; 
            list-style: none; 
            align-items: center;
        }
        
        .navbar-menu button { 
            background: rgba(255,255,255,0.2); 
            color: white; 
            border: none; 
            padding: 10px 16px; 
            border-radius: 8px; 
            cursor: pointer; 
            font-size: 14px;
            font-weight: 600;
            transition: all 0.3s;
        }
        
        .navbar-menu button:hover { background: rgba(255,255,255,0.3); }
        .navbar-menu button.active { background: rgba(255,255,255,0.4); }
        
        .logout-btn { background: #e74c3c !important; }
        .logout-btn:hover { background: #c0392b !important; }
        
        .menu-toggle { 
            background: none; 
            border: none; 
            color: white; 
            font-size: 28px; 
            cursor: pointer; 
            display: none;
            padding: 10px;
            transition: all 0.3s;
        }
        
        .menu-toggle:hover { transform: scale(1.1); }
        
        /* ===== AUTH PAGE ===== */
        .auth-page {
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
        }
        
        .auth-box {
            background: var(--bg-card);
            padding: 50px;
            border-radius: 20px;
            box-shadow: 0 10px 40px rgba(0,0,0,0.2);
            width: 100%;
            max-width: 450px;
        }
        
        .auth-box h1 { font-size: 32px; margin-bottom: 10px; text-align: center; }
        .auth-box p { color: var(--text-light); margin-bottom: 30px; text-align: center; }
        
        .auth-tabs { display: flex; gap: 10px; margin-bottom: 30px; border-bottom: 2px solid var(--border); }
        .auth-tabs button { flex: 1; padding: 15px; border: none; background: none; cursor: pointer; font-size: 16px; font-weight: 600; color: var(--text-light); border-bottom: 3px solid transparent; }
        .auth-tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
        
        .form-group { margin-bottom: 20px; }
        .form-group label { display: block; margin-bottom: 8px; font-weight: 600; }
        .form-group input { 
            width: 100%; 
            padding: 14px; 
            border: 2px solid var(--border); 
            border-radius: 10px; 
            font-size: 15px;
            background: var(--bg-card);
            color: var(--text);
            transition: border 0.3s;
        }
        .form-group input:focus { outline: none; border-color: var(--primary); }
        
        .btn-login { 
            width: 100%; 
            padding: 14px; 
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); 
            color: white; 
            border: none; 
            border-radius: 10px; 
            font-size: 16px; 
            font-weight: 600; 
            cursor: pointer; 
            margin-top: 10px; 
        }
        .btn-login:hover { transform: translateY(-2px); }
        
        .error-msg { font-size: 14px; display: none !important; }
        .error-msg.show { display: block !important; }
        
        .back-link {
            text-align: center;
            margin-top: 15px;
        }
        
        .back-link a {
            color: var(--primary);
            text-decoration: none;
            cursor: pointer;
            font-weight: 600;
        }
        
        .hidden { display: none !important; }
        
        /* ===== APP PAGES ===== */
        .app-container { display: flex; flex-direction: column; min-height: 100vh; }
        .main-content { flex: 1; padding: 30px; max-width: 1400px; margin: 0 auto; width: 100%; }
        
        .page { display: none; }
        .page.active { display: block; animation: fadeIn 0.3s ease-in; }
        
        @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
        
        .page h1 { font-size: 36px; margin-bottom: 30px; }
        .page h2 { font-size: 28px; color: var(--primary); margin-bottom: 20px; margin-top: 30px; }
        
        .metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 30px; }
        .metric-card { 
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); 
            color: white; 
            padding: 25px; 
            border-radius: 15px; 
            text-align: center;
        }
        .metric-card .label { font-size: 14px; opacity: 0.9; margin-bottom: 10px; }
        .metric-card .value { font-size: 40px; font-weight: 700; }
        
        .card { 
            background: var(--bg-card); 
            padding: 30px; 
            border-radius: 15px; 
            box-shadow: 0 2px 10px rgba(0,0,0,0.08); 
            margin-bottom: 20px;
            border: 1px solid var(--border);
        }
        
        .badge { 
            display: inline-block; 
            padding: 12px 20px; 
            background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%); 
            color: white; 
            border-radius: 20px; 
            font-weight: 600; 
            font-size: 14px;
            margin: 5px;
        }

        /* ===== NEW FEATURE STYLES ===== */
        
        /* VOICE BUTTON */
        .voice-btn {
            background: var(--success);
            color: white;
            border: none;
            padding: 10px 12px;
            border-radius: 50%;
            cursor: pointer;
            font-size: 16px;
            transition: all 0.3s;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 44px;
            height: 44px;
            min-width: 44px;
            margin-left: 8px;
        }
        
        .voice-btn:hover {
            transform: scale(1.1);
            box-shadow: 0 5px 15px rgba(46, 204, 113, 0.4);
        }
        
        .voice-btn:active {
            transform: scale(0.95);
        }

        /* TEXTBOOK JSS/SSS LAYOUT */
        .textbook-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px;
            margin-bottom: 20px;
        }

        .textbook-column {
            padding: 20px;
            background: var(--bg);
            border-radius: 12px;
        }

        .textbook-column h3 {
            color: var(--primary);
            margin-bottom: 15px;
            font-size: 18px;
            border-bottom: 3px solid var(--primary);
            padding-bottom: 10px;
        }

        .jss-sss-subjects {
            display: grid;
            grid-template-columns: 1fr;
            gap: 8px;
        }

        .subject-item {
            padding: 12px 15px;
            background: var(--bg-card);
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.3s;
            border-left: 4px solid var(--border);
            font-weight: 500;
            color: var(--text);
        }

        .subject-item:hover {
            background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(240, 147, 251, 0.1));
            border-left-color: var(--primary);
            transform: translateX(5px);
        }

        .subject-item.selected {
            background: linear-gradient(135deg, var(--primary), #764ba2);
            color: white;
            border-left-color: white;
            font-weight: 600;
        }

        /* QUESTION CORRECTIONS */
        .correction-box {
            background: rgba(46, 204, 113, 0.1);
            border-left: 4px solid var(--success);
            padding: 15px;
            border-radius: 8px;
            margin-top: 15px;
            font-size: 14px;
            color: var(--text);
            display: none;
        }

        .correction-box.show {
            display: block;
            animation: slideDown 0.3s ease;
        }

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

        .correction-box strong {
            color: var(--success);
            display: block;
            margin-bottom: 8px;
        }

        /* PROGRESS TRACKER */
        .question-progress {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 15px;
            padding: 15px;
            background: var(--bg);
            border-radius: 8px;
            border-left: 4px solid var(--primary);
        }

        .progress-bar {
            width: 100%;
            height: 8px;
            background: var(--border);
            border-radius: 10px;
            margin-top: 10px;
            overflow: hidden;
        }

        .progress-fill {
            height: 100%;
            background: linear-gradient(90deg, var(--primary), #764ba2);
            border-radius: 10px;
            transition: width 0.3s ease;
        }

        /* GENERATE MORE BUTTON */
        .btn-generate-more {
            width: 100%;
            margin-top: 20px;
            padding: 14px 24px;
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
            color: white;
            border: none;
            border-radius: 10px;
            cursor: pointer;
            font-weight: 600;
            font-size: 16px;
            transition: all 0.3s;
            display: none;
        }

        .btn-generate-more:hover {
            transform: translateY(-3px);
            box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
        }

        .btn-generate-more.show {
            display: block;
        }

        /* ===== FIXES & ADDITIONS ===== */
        /* Hides the landing page instantly on reload when a saved login exists (no flash) */
        html.has-session #landingPage { display: none !important; }

        /* Navbar order: logo | menu | theme + bell | hamburger */
        .navbar-left { order: 1; }
        .navbar-menu { order: 2; flex-wrap: wrap; justify-content: center; }
        .navbar-right { order: 3; }
        .menu-toggle { order: 4; }

        .notification-dropdown { max-width: 92vw; }
        .notification-item.read { opacity: 0.6; }

        select option { background: var(--bg-card); color: var(--text); }

        .pq-field {
            flex: 1;
            min-width: 150px;
            padding: 12px;
            border: 2px solid var(--border);
            border-radius: 10px;
            background: var(--bg-card);
            color: var(--text);
            font-weight: 600;
            font-size: 14px;
        }
        .pq-field:disabled { opacity: 0.6; cursor: not-allowed; }

        /* Textbook subject picker */
        .subject-group-title {
            font-size: 14px;
            font-weight: 700;
            color: var(--primary);
            margin: 16px 0 8px;
        }
        .subject-group-title:first-child { margin-top: 0; }
        .subject-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
            gap: 12px;
        }

        /* Formatted AI text (textbook, chat, search) */
        .rich h3 { font-size: 20px; color: var(--primary); margin: 18px 0 8px; }
        .rich h4 { font-size: 17px; margin: 14px 0 6px; }
        .rich p { margin: 0 0 12px; }
        .rich ul, .rich ol { margin: 0 0 12px 22px; }
        .rich li { margin-bottom: 4px; }
        .rich code { background: var(--border); padding: 1px 6px; border-radius: 4px; font-size: 0.92em; }
        .rich hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
        .rich > :last-child { margin-bottom: 0; }

        /* Past-question cards */
        .q-card {
            margin-top: 16px;
            padding: 15px;
            background: var(--bg);
            border-radius: 8px;
            border-left: 4px solid var(--primary);
            overflow-wrap: anywhere;
        }
        .q-option { display: inline-block; padding-left: 14px; }
        .q-answer { color: var(--success); font-weight: 700; }
        .q-expl { color: var(--text-light); font-size: 14px; }

        /* Toasts */
        #toastBox {
            position: fixed;
            bottom: 24px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 3000;
            display: flex;
            flex-direction: column;
            gap: 10px;
            align-items: center;
            width: calc(100% - 32px);
            max-width: 440px;
            pointer-events: none;
        }
        .toast {
            width: 100%;
            padding: 12px 16px;
            border-radius: 10px;
            color: white;
            font-size: 14px;
            font-weight: 600;
            box-shadow: 0 6px 20px rgba(0,0,0,0.25);
            animation: fadeIn 0.25s ease-in;
            pointer-events: auto;
        }
        .toast.info { background: var(--primary); }
        .toast.success { background: var(--success); }
        .toast.error { background: var(--danger); }

        button:disabled { cursor: not-allowed; }

        /* ===== RESPONSIVE ===== */
        @media (max-width: 1100px) {
            .navbar-menu { display: none; }
            .menu-toggle { display: block; }
        }

        @media (max-width: 768px) {
            .navbar-logo { font-size: 20px; }
            .main-content { padding: 20px; }
            .page h1 { font-size: 28px; }
            .hero-section h1 { font-size: 36px; }
            .hero-buttons { flex-direction: column; }
            .hero-btn { width: 100%; }
            .auth-box { padding: 30px 22px; margin: 16px; }
            .landing-navbar, .app-navbar { padding: 15px 16px; }
        }

        @media (max-width: 480px) {
            .navbar-user { display: none; }
        }

        /* ===== CHATGPT-STYLE AI CHAT (full-bleed, no boxed wrapper) ===== */
        .gpt-chat-page {
            display: flex;
            flex-direction: column;
            height: 80vh;
            min-height: 480px;
        }

        .gpt-chat-box {
            flex: 1;
            overflow-y: auto;
            padding: 10px 4px 20px;
            display: flex;
            flex-direction: column;
            gap: 22px;
            scroll-behavior: smooth;
        }
        .gpt-msg { display: flex; gap: 12px; max-width: 100%; }
        .gpt-msg-user { flex-direction: row-reverse; }
        .gpt-avatar {
            width: 34px; height: 34px; min-width: 34px;
            border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            font-size: 17px;
            color: white;
        }
        .gpt-avatar-ai { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); }
        .gpt-avatar-user { background: var(--success); }
        .gpt-bubble-col { display: flex; flex-direction: column; max-width: 78%; }
        .gpt-msg-user .gpt-bubble-col { align-items: flex-end; }
        .gpt-bubble {
            padding: 13px 16px;
            border-radius: 14px;
            line-height: 1.65;
            word-wrap: break-word;
            overflow-wrap: anywhere;
            font-size: 15px;
        }
        .gpt-msg-ai .gpt-bubble { background: var(--bg-card); border: 1px solid var(--border); color: var(--text); border-top-left-radius: 4px; }
        .gpt-msg-user .gpt-bubble { background: var(--primary); color: white; white-space: pre-wrap; border-top-right-radius: 4px; }
        .gpt-msg-error .gpt-bubble { background: rgba(231, 76, 60, 0.12); color: var(--danger); border: 1px solid rgba(231,76,60,0.3); }
        .gpt-msg-actions { display: flex; gap: 8px; margin-top: 6px; }
        .gpt-msg-actions button {
            background: none; border: none; cursor: pointer;
            color: var(--text-light); font-size: 13px;
            padding: 4px 8px; border-radius: 6px; transition: all 0.2s;
        }
        .gpt-msg-actions button:hover { background: var(--border); color: var(--text); }

        .gpt-chat-image { display: block; max-width: 220px; border-radius: 10px; margin-bottom: 8px; }

        .gpt-typing { display: inline-flex; align-items: center; gap: 4px; padding: 6px 2px; }
        .gpt-typing span {
            width: 7px; height: 7px; border-radius: 50%;
            background: var(--text-light);
            animation: gptTypingBounce 1.2s infinite ease-in-out;
        }
        .gpt-typing span:nth-child(2) { animation-delay: 0.15s; }
        .gpt-typing span:nth-child(3) { animation-delay: 0.3s; }
        @keyframes gptTypingBounce {
            0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
            30% { transform: translateY(-5px); opacity: 1; }
        }

        .gpt-image-preview {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 8px 10px;
            margin-bottom: 8px;
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: 10px;
            position: relative;
            width: fit-content;
        }
        .gpt-image-preview img { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; }
        .gpt-image-preview button {
            background: var(--danger); color: white; border: none;
            width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
            font-size: 12px; line-height: 1;
        }

        .gpt-input-bar {
            display: flex;
            align-items: flex-end;
            gap: 10px;
            padding: 14px 4px;
            border-top: 1px solid var(--border);
        }
        .gpt-input {
            flex: 1;
            resize: none;
            max-height: 160px;
            padding: 12px 16px;
            border: 2px solid var(--border);
            border-radius: 20px;
            background: var(--bg-card);
            color: var(--text);
            font-family: inherit;
            font-size: 15px;
            line-height: 1.5;
        }
        .gpt-input:focus { outline: none; border-color: var(--primary); }
        .gpt-send-btn {
            width: 46px; height: 46px; min-width: 46px;
            border-radius: 50%;
            border: none;
            background: var(--primary);
            color: white;
            font-size: 18px;
            cursor: pointer;
            display: flex; align-items: center; justify-content: center;
            transition: all 0.2s;
        }
        .gpt-send-btn:hover:not(:disabled) { transform: scale(1.08); background: var(--primary-dark); }
        .gpt-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

        .rich pre { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; overflow-x: auto; margin: 0 0 12px; }
        .rich pre code { background: none; padding: 0; font-size: 0.88em; }

        @media (max-width: 768px) {
            .gpt-chat-page { height: 84vh; }
            .gpt-bubble-col { max-width: 88%; }
        }

        /* ===== THEORY PRACTICE ===== */
        .theory-crumbs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; font-size: 14px; color: var(--text-light); }
        .theory-crumbs button {
            background: var(--bg); border: 1px solid var(--border); color: var(--text);
            padding: 6px 14px; border-radius: 20px; cursor: pointer; font-weight: 600; font-size: 13px;
            transition: all 0.2s;
        }
        .theory-crumbs button:hover { border-color: var(--primary); color: var(--primary); }

        .theory-board-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 20px;
        }
        .theory-board-card {
            background: var(--bg-card);
            border: 2px solid var(--border);
            border-radius: 16px;
            padding: 36px 24px;
            text-align: center;
            cursor: pointer;
            transition: all 0.25s;
        }
        .theory-board-card:hover {
            transform: translateY(-6px);
            border-color: var(--primary);
            box-shadow: 0 12px 30px rgba(102,126,234,0.2);
        }
        .theory-board-card .icon { font-size: 42px; margin-bottom: 12px; }
        .theory-board-card h3 { font-size: 22px; margin-bottom: 6px; color: var(--text); }
        .theory-board-card p { color: var(--text-light); font-size: 14px; }

        .theory-subject-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
            gap: 14px;
        }
        .theory-subject-card {
            display: flex;
            align-items: center;
            gap: 14px;
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: 14px;
            padding: 14px 16px;
            cursor: pointer;
            transition: all 0.2s;
        }
        .theory-subject-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(102,126,234,0.15); }
        .theory-subject-avatar {
            width: 44px; height: 44px; min-width: 44px;
            border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            color: white; font-weight: 700; font-size: 15px;
        }
        .theory-subject-info { flex: 1; min-width: 0; }
        .theory-subject-name { font-weight: 700; color: var(--text); margin-bottom: 4px; }
        .theory-subject-badge {
            display: inline-block;
            font-size: 12px;
            font-weight: 600;
            color: var(--primary);
            background: rgba(102, 126, 234, 0.12);
            padding: 2px 10px;
            border-radius: 20px;
        }
        .theory-subject-chevron { font-size: 22px; color: var(--text-light); }
        .theory-q-item .rich p { margin: 0; display: inline; }

        .theory-question-card {
            background: var(--bg);
            border-radius: 12px;
            border-left: 5px solid var(--primary);
            padding: 24px;
            line-height: 1.8;
            color: var(--text);
        }
        .theory-explain-box {
            margin-top: 18px;
            padding: 20px;
            background: rgba(46, 204, 113, 0.1);
            border-left: 5px solid var(--success);
            border-radius: 12px;
            display: none;
        }
        .theory-explain-box.show { display: block; animation: slideDown 0.3s ease; }
        .theory-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
        .theory-btn {
            padding: 12px 22px;
            border: none;
            border-radius: 10px;
            cursor: pointer;
            font-weight: 600;
            font-size: 14px;
            transition: all 0.3s;
        }
        .theory-btn-primary { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: white; }
        .theory-btn-secondary { background: var(--bg); color: var(--text); border: 2px solid var(--border) !important; }
        .theory-btn:hover { transform: translateY(-2px); }

        /* ===== QUIZ (Textbook > Learn > Take Quiz) ===== */
        .quiz-progress-row {
            display: flex;
            justify-content: space-between;
            font-size: 14px;
            font-weight: 600;
            color: var(--text-light);
            margin-bottom: 8px;
        }
        .quiz-timer-bar { width: 100%; height: 6px; background: var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 18px; }
        .quiz-timer-fill { height: 100%; background: linear-gradient(90deg, var(--success), var(--warning)); transition: width 1s linear; }
        .quiz-question-text { font-size: 18px; font-weight: 700; margin-bottom: 18px; line-height: 1.6; }
        .quiz-option {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px 16px;
            margin-bottom: 10px;
            background: var(--bg);
            border: 2px solid var(--border);
            border-radius: 10px;
            cursor: pointer;
            transition: all 0.2s;
        }
        .quiz-option:hover { border-color: var(--primary); }
        .option-badge {
            width: 28px; height: 28px; min-width: 28px;
            border-radius: 50%;
            background: var(--border);
            color: var(--text);
            display: flex; align-items: center; justify-content: center;
            font-weight: 700; font-size: 13px;
            transition: all 0.2s;
        }
        .option-text { flex: 1; }
        .quiz-option.correct { border-color: var(--success); background: rgba(46, 204, 113, 0.12); }
        .quiz-option.correct .option-badge { background: var(--success); color: white; }
        .quiz-option.incorrect { border-color: var(--danger); background: rgba(231, 76, 60, 0.12); }
        .quiz-option.incorrect .option-badge { background: var(--danger); color: white; }

        /* ===== DASHBOARD: DAILY GOAL & QUICK SUBJECTS ===== */
        .goal-option-btn {
            padding: 10px 22px;
            border: 2px solid var(--border);
            background: var(--bg);
            color: var(--text);
            border-radius: 10px;
            cursor: pointer;
            font-weight: 600;
            transition: all 0.2s;
        }
        .goal-option-btn:hover { border-color: var(--primary); }
        .goal-option-btn.active {
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
            color: white;
            border-color: transparent;
        }

        .quick-subjects-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
            gap: 14px;
        }
        .quick-subject-card {
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: 14px;
            padding: 18px 12px;
            text-align: center;
            cursor: pointer;
            transition: all 0.2s;
        }
        .quick-subject-card:hover { border-color: var(--primary); transform: translateY(-3px); box-shadow: 0 8px 18px rgba(102,126,234,0.15); }
        .quick-subject-avatar {
            width: 42px; height: 42px;
            border-radius: 50%;
            margin: 0 auto 10px;
            display: flex; align-items: center; justify-content: center;
            color: white; font-weight: 700; font-size: 14px;
        }
        .quick-subject-name { font-size: 13px; font-weight: 600; color: var(--text); }

        /* ===== STEP DOTS (Quiz Arena / Past Questions progress) ===== */
        .step-dots {
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 2px;
            margin-bottom: 16px;
        }
        .step-dot {
            width: 26px; height: 26px;
            border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            font-size: 11px; font-weight: 700;
            border: 2px solid var(--border);
            color: var(--text-light);
            background: var(--bg-card);
        }
        .step-dot.current { border-color: var(--primary); color: var(--primary); background: rgba(102,126,234,0.12); }
        .step-dot.correct { border-color: var(--success); background: var(--success); color: white; }
        .step-dot.wrong { border-color: var(--danger); background: var(--danger); color: white; }
        .step-dot-results { width: auto; padding: 0 10px; border-radius: 14px; font-size: 11px; }
        .step-chevron { color: var(--text-light); font-size: 13px; }

        /* ===== FORM FIELDS (Quiz Arena, minimal label+input pattern) ===== */
        .form-field { margin-bottom: 16px; }
        .form-label {
            display: block;
            font-size: 12px;
            font-weight: 700;
            letter-spacing: 0.5px;
            text-transform: uppercase;
            color: var(--text-light);
            margin-bottom: 6px;
        }
        .minimal-input {
            width: 100%;
            padding: 12px 14px;
            background: var(--bg);
            border: 2px solid var(--border);
            border-radius: 10px;
            color: var(--text);
            font-family: inherit;
            font-size: 15px;
        }
        .minimal-input:focus { outline: none; border-color: var(--primary); }

        /* ===== PAST QUESTIONS: EXAM TABS, STATS BAR, META ROW ===== */
        .pq-exam-tabs { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
        .pq-exam-tab {
            flex: 1;
            min-width: 100px;
            padding: 12px;
            border: 2px solid var(--border);
            background: var(--bg);
            color: var(--text);
            border-radius: 10px;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.2s;
        }
        .pq-exam-tab:hover { border-color: var(--primary); }
        .pq-exam-tab.active {
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
            color: white;
            border-color: transparent;
        }

        .pq-stats-bar {
            display: flex;
            gap: 18px;
            flex-wrap: wrap;
            align-items: center;
            padding: 10px 14px;
            background: var(--bg);
            border-radius: 10px;
            margin-bottom: 14px;
            font-size: 13px;
            font-weight: 600;
            color: var(--text);
        }
        .pq-stat { display: flex; align-items: center; gap: 6px; }
        .pq-stat-count { margin-left: auto; color: var(--text-light); }
        .pq-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
        .pq-dot-correct { background: var(--success); }
        .pq-dot-wrong { background: var(--danger); }
        .pq-meta-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }

        /* ===== DETAIL BADGES (Theory Bank question detail) ===== */
        .bank-detail-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
        .detail-badge {
            display: inline-block;
            padding: 4px 12px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 700;
        }
        .detail-badge-blue { background: rgba(102, 126, 234, 0.15); color: var(--primary); }
        .detail-badge-green { background: rgba(46, 204, 113, 0.15); color: var(--success); }
        .detail-badge-orange { background: rgba(243, 156, 18, 0.15); color: var(--warning); }
        .bank-detail-question { font-size: 17px; font-weight: 600; line-height: 1.7; margin-bottom: 6px; }

        /* ===== THEORY TOP TABS (Topic Lessons / WAEC-NECO Theory) ===== */
        .theory-top-tabs { display: flex; gap: 10px; margin-bottom: 20px; }
        .theory-top-tab {
            padding: 12px 20px;
            border: 2px solid var(--border);
            background: var(--bg-card);
            color: var(--text-light);
            border-radius: 10px;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.2s;
        }
        .theory-top-tab:hover { border-color: var(--primary); }
        .theory-top-tab.active {
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
            color: white;
            border-color: transparent;
        }

        /* ===== THEORY BANK: crumbs + list items ===== */
        .theory-bank-crumbs { font-size: 13px; color: var(--text-light); margin-bottom: 16px; }
        .theory-bank-crumbs span { cursor: pointer; }
        .theory-bank-crumbs span:hover { color: var(--primary); }
        .theory-bank-crumbs .chev { padding: 0 4px; cursor: default; }
        .theory-bank-crumbs .current { color: var(--text); cursor: default; font-weight: 600; }

        .theory-bank-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 16px 18px;
            margin-bottom: 10px;
            cursor: pointer;
            transition: all 0.2s;
        }
        .theory-bank-item:hover { border-color: var(--primary); transform: translateY(-2px); }
        .theory-bank-item-title { font-weight: 700; color: var(--text); margin-bottom: 4px; }
        .theory-bank-item-sub { font-size: 13px; color: var(--text-light); }

        /* ===== CURATED QUESTION BANK CARDS (Quiz Arena search) ===== */
        .bank-q-card {
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 16px;
            margin-bottom: 12px;
        }
        .bank-q-text { font-weight: 700; margin-bottom: 10px; }
        .bank-q-options { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text-light); margin-bottom: 12px; }
        .bank-q-answer { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }


/* =====================================================================
   PROFESSIONAL PASS: SVG icons, drawer menu, daily challenge, tables
   ===================================================================== */
.icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; flex-shrink: 0; }
.icon-fill { fill: currentColor; stroke: none; }
.voice-btn .icon, .theme-toggle .icon, .notification-btn .icon, .menu-toggle .icon { width: 20px; height: 20px; vertical-align: middle; }
.gpt-send-btn .icon { width: 20px; height: 20px; vertical-align: middle; }
.gpt-msg-actions button { display: inline-flex; align-items: center; gap: 6px; }
.gpt-msg-actions .icon { width: 15px; height: 15px; }
.navbar-menu button { display: inline-flex; align-items: center; gap: 7px; }
.navbar-menu button .icon { width: 16px; height: 16px; }
.page-sub { color: var(--text-light); margin-bottom: 20px; }
.metric-hint { font-size: 11px; opacity: .85; margin-top: 6px; min-height: 14px; }
.stat-hint, #profileStreakHint { font-size: 11px; color: var(--text-light); margin-top: 4px; }
.testimonial-stars { display: flex; gap: 3px; color: var(--warning); }
.testimonial-stars .icon { width: 15px; height: 15px; }

/* ----- Drawer menu ----- */
.mobile-menu-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 1190; }
.mobile-menu-overlay.active { opacity: 1; pointer-events: auto; }
.mobile-menu { position: fixed; top: 0; right: 0; height: 100%; width: min(340px, 100%); background: #0f1f45; color: #fff; z-index: 1200;
  transform: translateX(100%); transition: transform .28s ease; display: flex; flex-direction: column; padding: 18px 16px 24px; overflow-y: auto; box-shadow: -10px 0 30px rgba(0,0,0,.35); }
.mobile-menu.active { transform: translateX(0); }
body.menu-open { overflow: hidden; }
.mobile-menu-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.mobile-menu-brand { font-size: 22px; font-weight: 700; letter-spacing: .3px; }
.mobile-menu-brand .accent { color: #6ea8ff; }
.mobile-menu-close { background: none; border: none; color: #fff; cursor: pointer; padding: 6px; border-radius: 8px; }
.mobile-menu-close:hover { background: rgba(255,255,255,.1); }
.mobile-menu-stats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.menu-stat-pill { padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); font-size: 12px; color: #c9d6f2; }
.menu-stat-pill strong { color: #fff; margin-left: 4px; }
.mobile-menu-list { display: flex; flex-direction: column; gap: 10px; }
.mobile-menu-list button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; background: rgba(255,255,255,.07); color: #fff;
  border: 1px solid rgba(255,255,255,.1); border-radius: 12px; font-size: 15px; font-weight: 500; text-align: left; cursor: pointer; transition: background .2s, border-color .2s; }
.mobile-menu-list button:hover { background: rgba(255,255,255,.13); }
.mobile-menu-list button.active { background: #2557d6; border-color: #2557d6; }
.mobile-menu-list button.logout-btn { margin-top: 6px; background: rgba(231,76,60,.08) !important; border-color: rgba(231,76,60,.5); color: #ff8a80; }
.mobile-menu-list button.logout-btn:hover { background: rgba(231,76,60,.16) !important; }

/* ----- Textbook subject rows ----- */
.subject-row-list { display: flex; flex-direction: column; }
.subject-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 4px; border-bottom: 1px solid var(--border); }
.subject-row:last-child { border-bottom: none; }
.subject-row-name { font-weight: 600; }
.subject-row-actions { display: flex; gap: 8px; }
.subject-act { padding: 8px 18px; font-size: 13px; }

/* ----- Quiz Arena ----- */
.arena-header { margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.arena-title { font-size: 20px; font-weight: 700; }
.arena-sub { color: var(--text-light); font-size: 14px; margin-top: 4px; }
.arena-result { text-align: center; padding: 20px 0; }
.arena-result-score { font-size: 44px; font-weight: 800; color: var(--primary); }
.arena-result h3 { margin: 6px 0; }
.arena-result-sub, .arena-result-points { color: var(--text-light); margin-bottom: 14px; }

/* ----- Daily Challenge (one question a day) ----- */
.dc-card { border-left: 4px solid var(--primary); }
.dc-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.dc-label { font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--text-3, var(--text-light)); }
.dc-date { font-size: 12px; color: var(--text-3, var(--text-light)); }
.dc-subject { display: inline-block; padding: 4px 12px; border-radius: 999px; background: rgba(102,126,234,.15); color: var(--primary); font-size: 12px; font-weight: 700; margin-bottom: 12px; }
.dc-question { font-weight: 700; font-size: 15px; margin-bottom: 12px; line-height: 1.6; }
.dc-option { display: flex; align-items: center; gap: 12px; padding: 12px; margin: 8px 0; background: var(--bg-2, var(--bg)); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; transition: all .2s; }
.dc-option:hover { border-color: var(--primary); }
.dc-letter { width: 26px; height: 26px; min-width: 26px; border-radius: 50%; background: var(--border); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.dc-option.correct { background: rgba(46,204,113,.12); border-color: var(--success); color: var(--success); font-weight: 700; cursor: default; }
.dc-option.wrong { background: rgba(231,76,60,.12); border-color: var(--danger); color: var(--danger); font-weight: 700; cursor: default; }
.dc-option.correct .dc-letter { background: var(--success); color: #fff; }
.dc-option.wrong .dc-letter { background: var(--danger); color: #fff; }
.dc-result { margin-top: 12px; font-weight: 700; }
.dc-result.ok { color: var(--success); }
.dc-result.bad { color: var(--danger); }
.dc-explain { margin-top: 10px; padding: 12px; background: rgba(46,204,113,.1); border-left: 4px solid var(--success); border-radius: 8px; font-size: 13px; line-height: 1.6; }
.dc-note { margin-top: 10px; font-size: 12px; color: var(--text-3, var(--text-light)); }
.dc-loading { text-align: center; color: var(--text-3, var(--text-light)); padding: 20px; }

/* ----- Markdown tables in AI explanations ----- */
.md-table-wrap { overflow-x: auto; }
.md-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 14px; }
.md-table th, .md-table td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.md-table th { background: var(--bg-2, var(--bg)); font-weight: 700; }

/* ----- Theory ----- */
.year-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.year-chip { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; transition: all .2s; }
.year-chip:hover { border-color: var(--primary); }
.year-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.theory-q-card { margin-top: 14px; }
.theory-q-head { margin-bottom: 10px; }
.theory-q-text { font-size: 16px; line-height: 1.7; margin-bottom: 14px; white-space: pre-wrap; }
.theory-explain-panel { display: none; margin-top: 14px; padding: 16px; background: var(--bg); border-left: 4px solid var(--success); border-radius: 10px; }
.theory-explain-panel.open { display: block; }
.theory-explain-panel .rich h3 { color: var(--primary); }

/* ----- Smart Search ----- */
.search-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.search-row .minimal-input { flex: 1; min-width: 180px; border-radius: 999px; }
.quick-search { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.quick-label { font-size: 12px; font-weight: 700; color: var(--text-light); }
.quick-pill { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--text-light); font-size: 13px; cursor: pointer; transition: all .2s; }
.quick-pill:hover { border-color: var(--primary); color: var(--primary); }
.yt-card { border-color: rgba(220,38,38,.35); }
.yt-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.yt-icon { width: 40px; height: 40px; border-radius: 10px; background: rgba(220,38,38,.12); color: #dc2626; display: flex; align-items: center; justify-content: center; }
.yt-title { color: #dc2626; font-weight: 700; }
.yt-sub { font-size: 13px; color: var(--text-light); }
.yt-btn { background: #dc2626; color: #fff; }

/* ----- Activity list (Profile) ----- */
.activity-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; background: var(--bg); border-radius: 8px; margin-bottom: 8px; }
.activity-tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; margin-right: 6px; }
.activity-tag.quiz { background: rgba(102,126,234,.15); color: var(--primary); }
.activity-tag.study { background: rgba(46,204,113,.15); color: var(--success); }


/* =====================================================================
   NAVY DARK MODE
   ===================================================================== */
body.dark-mode .landing-navbar, body.dark-mode .app-navbar { background: linear-gradient(135deg, #0d1f45 0%, #10295c 100%); }
body.dark-mode .navbar-menu button { background: rgba(255,255,255,.08); }
body.dark-mode .navbar-menu button.active { background: rgba(110,168,255,.28); }

/* =====================================================================
   AI CHAT: no box, plain AI text, outlined composer
   ===================================================================== */
.chat-page { display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 460px; }
.chat-box { flex: 1; overflow-y: auto; padding: 8px 2px 18px; display: flex; flex-direction: column; gap: 28px; scroll-behavior: smooth; }
.chat-row { display: flex; flex-direction: column; }
.chat-row-user { flex-direction: row; justify-content: flex-end; align-items: flex-start; gap: 10px; }
.chat-user-bubble { max-width: 78%; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: #fff; padding: 12px 16px;
  border-radius: 16px 16px 4px 16px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }
.chat-user-avatar { width: 34px; height: 34px; min-width: 34px; border-radius: 50%; background: rgba(102,126,234,.2); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.chat-row-user .chat-time { align-self: center; order: 0; }
.chat-time { font-size: 11px; color: var(--text-light); margin-top: 6px; }
.chat-row-user .chat-time { margin-top: 0; }
.chat-ai-text { font-size: 15.5px; line-height: 1.85; color: var(--text); overflow-wrap: anywhere; }
.chat-ai-text.chat-error { color: var(--danger); }
.chat-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.chat-actions button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: transparent; color: var(--text-light); font-size: 13px; cursor: pointer; transition: all .2s; }
.chat-actions button:hover { border-color: var(--primary); color: var(--primary); }
.chat-actions .icon { width: 14px; height: 14px; }

.chat-composer { border-top: 1px solid var(--border); padding: 12px 0 2px; }
.chat-input-wrap { display: flex; align-items: flex-end; gap: 4px; border: 1.5px solid var(--primary); border-radius: 28px; padding: 6px 8px; background: var(--bg-card); }
.chat-icon-btn { background: none; border: none; color: var(--text-light); width: 38px; height: 38px; min-width: 38px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all .2s; }
.chat-icon-btn:hover { color: var(--primary); background: rgba(102,126,234,.1); }
.chat-icon-btn.listening { color: #fff; background: var(--danger); animation: micPulse 1.2s infinite; }
@keyframes micPulse { 0% { box-shadow: 0 0 0 0 rgba(231,76,60,.5); } 70% { box-shadow: 0 0 0 10px rgba(231,76,60,0); } 100% { box-shadow: 0 0 0 0 rgba(231,76,60,0); } }
.chat-input { flex: 1; resize: none; border: none; background: transparent; color: var(--text); font-family: inherit; font-size: 15px; line-height: 1.5;
  padding: 9px 4px; max-height: 140px; outline: none; }
.chat-send-btn { width: 42px; height: 42px; min-width: 42px; border-radius: 50%; border: none; background: var(--primary); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all .2s; }
.chat-send-btn:hover:not(:disabled) { background: var(--primary-dark); transform: scale(1.05); }
.chat-send-btn:disabled { opacity: .5; cursor: not-allowed; }
.chat-foot { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-light); padding: 8px 12px 0; }
.chat-foot .over { color: var(--danger); font-weight: 700; }

/* =====================================================================
   QUIZ ARENA FORM
   ===================================================================== */
.arena-start { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin-top: 6px; }

/* =====================================================================
   THEORY: collapsed cards, actions appear when tapped
   ===================================================================== */
.theory-q-tap { cursor: pointer; }
.theory-q-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.theory-q-chev { color: var(--text-light); transition: transform .2s; display: inline-flex; }
.theory-q-card.expanded .theory-q-chev { transform: rotate(180deg); }
.theory-q-card:not(.expanded) .theory-q-text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 0; }
.theory-q-actions { display: none; gap: 10px; flex-wrap: wrap; margin: 4px 0 0; }
.theory-q-card.expanded .theory-q-actions { display: flex; }
.theory-q-card:not(.expanded) .theory-explain-panel { display: none; }
.theory-q-actions .theory-btn { display: inline-flex; align-items: center; gap: 8px; }

/* =====================================================================
   COPY BOXES (tables, diagrams, examples)
   ===================================================================== */
.copy-box { border: 1px solid var(--border); border-radius: 10px; margin: 12px 0; overflow: hidden; background: var(--bg); }
.copy-box-bar { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; background: rgba(127,127,127,.14); font-size: 12px; color: var(--text-light); }
.copy-box-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: transparent; color: var(--text); padding: 4px 10px; border-radius: 6px; font-size: 12px; cursor: pointer; }
.copy-box-btn:hover { border-color: var(--primary); color: var(--primary); }
.copy-box-btn .icon { width: 13px; height: 13px; }
.copy-box pre { margin: 0 !important; border: none !important; border-radius: 0 !important; }
.copy-box .md-table { margin: 0; }

/* =====================================================================
   SUBJECT ICONS
   ===================================================================== */
.subject-row-name { display: flex; align-items: center; gap: 12px; }
.subject-row-icon { width: 36px; height: 36px; min-width: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.subject-row-icon .icon, .quick-subject-avatar .icon, .theory-subject-avatar .icon { width: 20px; height: 20px; stroke: #fff; }

/* =====================================================================
   LANDING: ICONS ON EVERY INFORMATION ITEM
   ===================================================================== */
.feature-icon, .stat-icon { width: 46px; height: 46px; border-radius: 12px; background: rgba(102,126,234,.14); color: var(--primary);
  display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.feature-icon .icon, .stat-icon .icon { width: 24px; height: 24px; }
.stat-icon { margin-left: auto; margin-right: auto; }
.icon-list ul { list-style: none; padding-left: 0; }
.icon-list li { display: flex; align-items: flex-start; gap: 12px; padding-left: 0 !important; }
.icon-list li:before { display: none !important; content: none !important; }
.li-icon { color: var(--primary); flex-shrink: 0; margin-top: 2px; display: inline-flex; }


/* ----- Show / hide password ----- */
.password-field { position: relative; }
.password-field input { padding-right: 48px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border: none; background: none;
  color: var(--text-light); cursor: pointer; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.pw-toggle:hover { color: var(--primary); background: rgba(102,126,234,.1); }
.pw-toggle .icon { width: 20px; height: 20px; }


/* ----- Fixes found in browser testing ----- */
.mobile-menu { box-shadow: none; }
.mobile-menu.active { box-shadow: -10px 0 30px rgba(0,0,0,.35); }
.chat-input { min-height: 42px; }
#leaderboard .card { overflow-x: auto; }
#leaderboard table { width: 100%; }
#leaderboard th, #leaderboard td { padding: 12px 8px !important; }
.subject-row-name { flex: 1; min-width: 0; }
.subject-row-actions { flex-shrink: 0; }
.subject-act { min-width: 68px; text-align: center; }

/* ----- Phone layout polish ----- */
.quick-subjects-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
@media (max-width: 480px) {
  #leaderboard .card { padding: 10px; }
  #leaderboard th, #leaderboard td { padding: 10px 4px !important; font-size: 13px; }
}
@media (max-width: 480px) { #leaderboard th { font-size: 12px !important; letter-spacing: 0 !important; padding-left: 2px !important; padding-right: 2px !important; } }
