/* ---- Moved from index.html style block #1 ---- */
/* ================= Apple-Style Scrolling ================= */
        html, body {
            min-height: 100%;
            overflow-x: hidden;
        }
        
        html {
            scroll-behavior: auto !important;
        }

        body {
            -webkit-overflow-scrolling: touch;
            overscroll-behavior-y: contain;
        }
        
        /* Smooth scroll only where needed */
        .smooth-scroll {
            scroll-behavior: smooth;
        }

        /* Hide ugly scrollbars (Apple style) */
        ::-webkit-scrollbar {
            width: 0;
            height: 0;
        }
        
        /* Preload Guard - Disable animations on initial load */
        .preload * {
            animation: none !important;
            transition: none !important;
        }
        /* ========================================================= */

        /* Page Loader - INSTANT HIDE - Just Logo */
        #page-loader {
            display: none !important;
        }

        /* Premium Apple-Style Gradient Animation - Right to Left Sliding Effect */
        @keyframes gradientSlideRTL {
            0% {
                background-position: 200% center;
                opacity: 0.7;
            }
            50% {
                opacity: 0.9;
            }
            100% {
                background-position: 0% center;
                opacity: 1;
            }
        }

        /* Enhanced fade and scale animation for tabs */
        @keyframes tabColorFade {
            0% {
                transform: scale(0.98);
                opacity: 0.8;
            }
            100% {
                transform: scale(1);
                opacity: 1;
            }
        }

        .modal-header-gradient {
            background-size: 300% 100%;
            animation: gradientSlideRTL 1s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
            will-change: background-position;
        }
        
        /* Apply animation to tab transitions */
        .tab-active-animation {
            animation: tabColorFade 0.4s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
        }

        /* Text Overflow Prevention - Apply to all boxes, cards, and containers */
        button, a, div, span, p, h1, h2, h3, h4, h5, h6 {
            word-wrap: break-word;
            word-break: break-word;
            overflow-wrap: break-word;
            hyphens: auto;
        }
        
        /* Prevent text from escaping in modal content boxes */
        .modal-content-box, 
        [class*="rounded-"], 
        [class*="bg-white"],
        [class*="p-"] {
            overflow: hidden;
            text-overflow: ellipsis;
        }

        /* Styles for the component */
        .scroll-float {
            overflow: hidden;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        .scroll-float-text { display: inline-block; font-size: clamp(4rem, 15vw, 15rem); font-weight: 700; text-align: center; line-height: 1; }
        .char { display: inline-block; }
        html {
            /* NEW: Prevent horizontal scrolling */
            overflow-x: hidden;
            height: auto;
            overscroll-behavior-y: auto; /* Enable pull-to-refresh */
        }
        body {
            overflow-x: hidden;
            height: auto;
            overscroll-behavior-y: auto; /* Enable pull-to-refresh */
            /* FIX: Removed scroll-padding-top to prevent auto-scroll on layout shift */
            scroll-padding-top: 0 !important;
        }
        /* UPDATED: Apply new font styles */
        body, .body-font {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, Helvetica, Arial, sans-serif;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
            line-height: 1.6;
        }
        h1, h2, h3, h4, h5, h6 {
            font-family: 'Playfair Display', serif;
            font-feature-settings: 'liga' on, 'kern' on; /* Good for serif fonts */
        }

        .font-roboto {
            font-family: 'Roboto', sans-serif;
        }

        /* NEW: Utility class for Playfair Display font */
        .font-playfair {
            font-family: 'Playfair Display', serif;
        }

        /* NEW: Apply Playfair Display to the logo font class */
        .logo-font {
            font-family: 'Playfair Display', serif;
        }

        #navbarI .nav-brand-link {
            min-width: 0;
            max-width: calc(100% - 9rem);
        }

        #navbarI .nav-brand-link svg {
            flex-shrink: 0;
        }

        #navbarI .nav-brand-text {
            white-space: nowrap;
            word-break: normal;
            overflow-wrap: normal;
            hyphens: none;
            line-height: 1;
            font-size: clamp(1.15rem, 5vw, 1.5rem);
        }

        @media (max-width: 380px) {
            #navbarI .nav-brand-link {
                max-width: calc(100% - 8rem);
            }

            #navbarI .nav-brand-text {
                font-size: 1.05rem;
            }
        }

        /* NEW: Utility for slight vertical adjustment */
        .translate-y-0\.5 {
            transform: translateY(2px);
        }


        /* NEW: Grid-based expand/collapse for smoother animations */
        .expandable-grid-wrapper {
            overflow: hidden;
            transition: max-height 0.5s cubic-bezier(0.23, 1, 0.32, 1);
        }
        .expandable-grid-wrapper.expanded {
            max-height: 10000px !important; /* A large value to ensure it expands fully */
        }
        /* Initially hide the how-it-works steps */
        #how-it-works-steps-wrapper:not([data-expanded="true"]) {
            max-height: 0;
        }

        /* --- Apple-Style Expand/Collapse System --- */
        .expandable-content-wrapper {
            overflow: hidden;
            transition: max-height 0.5s cubic-bezier(0.23, 1, 0.32, 1); /* Apple-like easing */
            will-change: max-height;
        }
        #about-us-expandable-wrapper:not([data-expanded="true"]) {
            max-height: 0;
        }
        .rules-collapsible-button[aria-expanded="true"] svg {
            transform: rotate(180deg);
        }

        /* --- NEW: Generic Button Styles --- */
        .view-toggle-btn {
            display: inline-block;
            cursor: pointer;
            font-weight: 600;
            padding: 0.75rem 1.5rem;
            border-radius: 9999px; /* fully rounded */
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            border: 1px solid #e5e7eb; /* blue-100 */
            box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
        }
        .view-toggle-btn:not(.bg-black) {
            background-color: #f9fafb;
            color: #111827;
            border: 1px solid #e5e7eb;
        }
        .view-toggle-btn:not(.bg-black):hover {
            background-color: #e5e7eb;
            color: #000000;
        }

        .view-toggle-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
        }
         .view-toggle-btn:active {
            transform: translateY(-1px);
            box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
        }
        .view-toggle-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }

        /* --- "Trading, Simplified" Heading Animation --- */
        .animated-gradient-text {
          background: linear-gradient(90deg, #000000, #555555, #888888, #000000);
          background-size: 250% auto;
          color: transparent;
          background-clip: text;
          -webkit-background-clip: text;
          -webkit-text-fill-color: transparent;
          animation: gradient-flow 6s linear infinite;
        }
        
        /* Rules Panel Animation */
        .rules-panel {
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
            position: relative;
        }
        
        .rules-panel.expanded {
            max-height: 500px;
        }
        
        .rules-panel .close-button {
            position: absolute;
            top: 0.5rem;
            right: 0.5rem;
            padding: 0.5rem;
            border-radius: 9999px;
            transition: all 0.2s;
            background: transparent;
            border: none;
            cursor: pointer;
            color: #666;
        }
        
        .rules-panel .close-button:hover {
            background-color: rgba(0, 0, 0, 0.05);
            color: #000;
        }

        /* --- NEW: Join Us Accordion Styles --- */
        .role-accordion details {
            border: 1px solid #e5e7eb; /* gray-200 */
            border-radius: 1rem; /* rounded-2xl */
            transition: background-color 0.2s;
        }
        .role-accordion details[open] {
            background-color: #ffffff;
        }
        .role-accordion summary {
            padding: 1.5rem;
            font-size: 1.25rem; /* text-xl */
            font-weight: 700; /* font-bold */
            cursor: pointer;
        }
        /* --- NEW: Explosive Title Animation on Scroll --- */
        .explosive-title {
            position: relative;
            display: inline-block;
            transition: transform 0.3s ease-out;
        }
        .explosive-title.is-bursting {
            transform: scale(1.1);
        }
        .explosive-title.is-bursting::before,
        .explosive-title.is-bursting::after {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 250%; /* Increased size for more impact */
            height: 250%;
            border-radius: 50%;
            transform: translate(-50%, -50%) scale(0);
            animation: burst 0.8s ease-out forwards;
            z-index: -1; /* Place behind the text */
        }
        .explosive-title.is-bursting::before {
            background: radial-gradient(circle, rgba(255, 215, 0, 0.7), transparent 70%); /* UPDATED: Gold color */
            animation-delay: 0.1s; /* Slight delay for the second color */
        }
        .explosive-title.is-bursting::after {
            background: radial-gradient(circle, rgba(255, 105, 180, 0.7), transparent 70%); /* UPDATED: Pink color */
        }
        @keyframes burst {
            0% {
                transform: translate(-50%, -50%) scale(0);
                opacity: 1;
            }
            100% {
                transform: translate(-50%, -50%) scale(1.5);
                opacity: 0;
            }
        }

        @keyframes gradient-flow {
          0% { background-position: 0% 50%; }
          50% { background-position: 100% 50%; }
          100% { background-position: 0% 50%; }
        }
        
        /* --- General UI Enhancements --- */
        .glowing-blue-text {
            color: #60a5fa;
            text-shadow: 0 0 8px rgba(0, 0, 0, 0.7), 0 0 10px rgba(0, 0, 0, 0.5);
            transition: all 0.3s ease;
        }
        .glowing-blue-text:hover {
            text-shadow: 0 0 12px rgba(59, 130, 246, 1), 0 0 15px rgba(59, 130, 246, 0.8);
        }
        .no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
        .button-animation {
            transition: transform 0.1s ease-in-out;
            will-change: transform;
        }
        .button-animation:active {
            transform: scale(0.95);
        }
        
        /* NEW: Pulsing Glow Animation for Install Button */
        @keyframes pulse-glow {
            0%, 100% {
                box-shadow: 0 0 15px rgba(59, 130, 246, 0.4), 0 0 25px rgba(59, 130, 246, 0.3);
                transform: scale(1);
            }
            50% {
                box-shadow: 0 0 25px rgba(0, 0, 0, 0.7), 0 0 40px rgba(0, 0, 0, 0.5);
                transform: scale(1.02);
            }
        }
        .install-button-glow {
            animation: pulse-glow 2.5s infinite ease-in-out;
        }
        
        @keyframes electric-shine {
            0%, 100% { color: #2563eb; text-shadow: 0 0 5px rgba(59, 130, 246, 0.7), 0 0 8px rgba(59, 130, 246, 0.5); }
            50% { color: #60a5fa; text-shadow: 0 0 10px rgba(96, 165, 250, 1), 0 0 15px rgba(96, 165, 250, 0.8); }
        }
        .academyx-link {
            font-weight: bold;
            animation: electric-shine 4s infinite;
        }
        .mobile-academyx-glow { animation: electric-shine 6s infinite; }
        
        /* Counter Animation Styles */
        .counter-number {
            display: inline-block;
            font-weight: bold;
            transition: all 0.3s ease;
        }
        
        .scroll-reveal {
            opacity: 0;
            transform: translateY(30px);
            transition: opacity 0.6s ease-out, transform 0.6s ease-out;
            transition-delay: 0.2s;
        }
        .scroll-reveal.visible {
            opacity: 1;
            transform: translateY(0);
        }
        
        /* NEW Free Books UI styles */
        .claim-button {
            text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
            box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
        }
        .claim-button:hover {
            box-shadow: 0 6px 20px rgba(34, 197, 94, 0.5);
        }
        
        /* NEW Apple-Style AI Course Card */
        .ai-course-card-apple {
            background-color: rgba(255, 255, 255, 0.6);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 1.5rem; /* rounded-3xl */
            box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
            transition: transform 0.3s ease, box-shadow 0.3s ease;
            cursor: pointer;
        }
        .ai-course-card-apple:hover {
            transform: translateY(-4px);
            box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.15);
        }
        .ai-course-card-apple .details-panel {
            max-height: 0;
            opacity: 0;
            overflow: hidden;
            transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease-out, padding-top 0.5s ease, padding-bottom 0.5s ease;
            will-change: max-height, opacity;
            padding-top: 0;
            padding-bottom: 0;
        }
        .ai-course-card-apple.expanded .details-panel {
            opacity: 1;
            padding-top: 1rem;
            padding-bottom: 1.5rem;
        }
        /* NEW: Styles for the redesigned AI course card from your request */
        .course-card.expanded .course-details {
            max-height: 600px; /* A large value for expansion */
            padding-top: 0.5rem;
            padding-bottom: 1.25rem;
            opacity: 1;
        }
        .plus-icon {
            transition: transform 0.3s ease-in-out;
        }
        .course-card.expanded .plus-icon {
            transform: rotate(45deg);
        }
        .course-details {
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.5s ease-in-out, padding 0.5s ease-in-out, opacity 0.3s ease-out;
            padding-top: 0;
            padding-bottom: 0;
            opacity: 0;
        }
        
        /* --- UNIFIED MODAL SYSTEM (APPLE-STYLE NO JUMP) --- */
        body.modal-open {
            position: fixed;
            width: 100%;
            top: calc(-1 * var(--scroll-y, 0px));
        }
        .modal-overlay {
            position: fixed;
            inset: 0;
            z-index: 100;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 1rem; /* Padding for smaller screens */
            opacity: 0;
            visibility: hidden;
            transition: opacity 0.35s ease-out, visibility 0.35s ease-out;
            overscroll-behavior: contain; /* Prevent scroll chaining */
        }
        .modal-overlay.is-visible {
            opacity: 1;
            visibility: visible;
            transition-timing-function: ease-out;
        }
        .modal-backdrop {
            position: absolute;
            inset: 0;
            background-color: rgba(0, 0, 0, 0.5); /* Standard dark overlay */
            opacity: 0;
            transition: opacity 0.35s ease-out;
            will-change: opacity; /* Hardware acceleration hint */
        }
        .modal-content {
            position: relative;
            background-color: white;
            border-radius: 1.25rem;
            box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
            width: 100%;
            transform: scale(0.95) translateY(10px);
            opacity: 0;
            transition: transform 0.35s ease-out, opacity 0.3s ease-out;
            will-change: transform, opacity;
        }
        /* NEW: Remove padding from the overlay when it contains a fullscreen modal */
        .modal-overlay:has(.modal-content--fullscreen) {
            padding: 0;
        }

        /* NEW: Modifier for full-screen modals */
        .modal-content--fullscreen {
            width: 100vw;
            max-width: 100vw;
            height: 100dvh; /* FIX: Use dynamic viewport height to avoid being hidden by mobile browser UI */
            max-height: 100dvh;
            border-radius: 0;
            box-shadow: none;
            transform: translateY(100%); /* Start from bottom for slide-in animation */
            transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
            overflow: hidden; /* Prevent content overflow */
            display: flex;
            flex-direction: column;
        }
        
        /* Fix scrolling in content areas - Works on both mobile and laptop */
        .modal-content--fullscreen > div[id$="Content"] {
            flex: 1 1 auto;
            overflow-y: auto !important;
            overflow-x: hidden;
            min-height: 0; /* Important for flex scrolling */
            height: auto;
            -webkit-overflow-scrolling: touch;
        }
        
        /* Laptop specific fix */
        @media (min-width: 1024px) {
            .modal-content--fullscreen > div[id$="Content"] {
                max-height: calc(100vh - 80px);
            }
        }
        .modal-overlay.is-visible .modal-content--fullscreen {
            transform: translateY(0);
        }
        /* NEW: Ensure fullscreen modal aligns to top on all screen sizes */
        .modal-overlay:has(.modal-content--fullscreen) {
            align-items: flex-start;
            justify-content: flex-start;
        }
        
        /* Fix: Ensure modal headers stay within frame and close buttons don't overflow */
        .modal-content--fullscreen > div:first-child,
        .modal-content > div:first-child {
            min-height: 60px;
            box-sizing: border-box;
        }
        
        /* Ensure close buttons in modal headers are properly contained */
        .modal-content button[id^="close"],
        .modal-content--fullscreen button[id^="close"] {
            flex-shrink: 0;
            margin-left: auto;
        }

        /* --- Animation States --- */
        .modal-overlay.is-visible .modal-content {
            transform: scale(1);
            opacity: 1;
        }
        .modal-overlay.is-visible .modal-backdrop {
            opacity: 1;
        }

        /* NEW Apple-Style Segmented Control */
        .segmented-control {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
            padding: 0.25rem;
            background-color: #f3f4f6; /* gray-100 */
            border-radius: 0.75rem; /* rounded-xl */
            position: relative;
        }
        .segment {
            flex-grow: 1;
            text-align: center;
            padding: 0.5rem 0.25rem;
            border-radius: 0.5rem; /* rounded-lg */
            cursor: pointer;
            color: #4b5563; /* gray-600 */
            font-weight: 600;
            transition: all 0.3s ease;
            z-index: 10;
        }
        .segment.active {
            background-color: #2563eb; /* blue-600 */
            color: #ffffff; /* white */
            box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2), 0 2px 4px -1px rgba(37, 99, 235, 0.1);
        }
        
        /* === MODAL SCROLL ISOLATION === */
        /* Dashboard Modal - Scroll only inside */
        #profileDashboardModal {
            isolation: isolate;
        }
        #profileDashboardModal .modal-content {
            overflow: hidden;
        }
        #profileDashboardContent {
            overflow-y: auto;
            overflow-x: hidden;
            -webkit-overflow-scrolling: touch;
            max-height: 100%;
        }
        
        /* My Backpack Modal - Scroll only inside */
        #myBackpackModal {
            isolation: isolate;
        }
        #myBackpackModal .modal-content {
            overflow: hidden;
        }
        
        /* NEW "Trading, Simplified" Card */
        #trading-simplified-card {
            background-color: rgba(249, 250, 251, 0.8);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 20px;
            padding: 2rem;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.07);
        }
        #trading-simplified-card h2 {
            background: linear-gradient(90deg, #000000, #555555, #888888, #000000);
            background-size: 250% auto;
            color: #000;
            background-clip: text;
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            animation: gradient-flow 6s linear infinite;
        }
        #trading-simplified-overlay {
            position: fixed;
            inset: 0;
            z-index: 100;
            display: flex;
            align-items: center;
            justify-content: center;
            visibility: hidden;
            opacity: 0;
            transition: opacity 0.35s ease-out, visibility 0.35s ease-out;
        }
        #trading-simplified-overlay.visible { 
            opacity: 1;
            visibility: visible;
        }
        #trading-simplified-overlay .overlay-backdrop {
             position: absolute;
             inset: 0;
             background-color: rgba(0, 0, 0, 0.6);
             opacity: 0;
             transition: opacity 0.35s ease-out;
             will-change: opacity;
        }
        #trading-simplified-overlay .overlay-content {
            transform: scale(0.95) translateY(10px);
            opacity: 0;
            transition: transform 0.35s ease-out, opacity 0.3s ease-out;
            will-change: transform, opacity;
        }
        #trading-simplified-overlay.visible .overlay-content {
            transform: scale(1);
        }
        #trading-simplified-overlay.visible .overlay-backdrop {
            opacity: 1;
            opacity: 1;
        }
        
        /* NEW Apple-Style Step Boxes */
        .step-box-apple {
            background-color: rgba(255, 255, 255, 0.7);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            border: 1px solid rgba(255, 255, 255, 0.3);
            border-radius: 1.5rem;
            padding: 2rem;
            box-shadow: 0 4px 15px rgba(0,0,0,0.05);
        }

        /* --- MOBILE-ONLY STYLES (APPLE-LIKE AESTHETIC) --- */
        @media (max-width: 767px) {
            /* 1. Cutout Box Styling */
             .payment-info-section {
                padding-top: 3rem !important; /* Make space for the curve */
                margin-top: -30px;
                z-index: 10;
                position: relative;
                border-top-left-radius: 30px;
                border-top-right-radius: 30px;
                box-shadow: 0 -10px 20px rgba(0,0,0,0.05);
            }
            #top {
            }
            #top::after {
                content: '';
                position: absolute;
                bottom: 0;
                left: 0;
                right: 0;
                height: 40px;
                background: inherit;
                border-top-left-radius: 100%;
                border-top-right-radius: 100%;
                transform: translateY(50%);
                filter: drop-shadow(0 -10px 8px rgba(0,0,0,0.04));
                z-index: 5;
            }
            
            /* 4. Ensure Full Box Visibility before "View More" */
            #course-selection-container-wrapper:not([data-expanded="true"]) { max-height: 45rem; }
            #study-material-wrapper:not([data-expanded="true"]) { max-height: 52rem; }
            #platforms-wrapper:not([data-expanded="true"]) { max-height: 64rem; }
            #ai-courses-wrapper:not([data-expanded="true"]) { max-height: 42rem; }
            #universities-wrapper:not([data-expanded="true"]) { max-height: 28rem; }
            #subjects-wrapper:not([data-expanded="true"]) { max-height: 54rem; }
            .expandable-grid-wrapper:not([data-expanded="true"]) { max-height: 64rem; }
            
            /* DESKTOP FIX: EXACTLY 4 BOXES ON DESKTOP */
            @media (min-width: 1024px) {
                #course-selection-container-wrapper:not([data-expanded="true"]) { max-height: 36rem !important; } /* 2 Rows * 2 Cols */
                #study-material-wrapper:not([data-expanded="true"]) { max-height: 23rem !important; } /* 1 Row * 4 Cols */
                #platforms-wrapper:not([data-expanded="true"]) { max-height: 38rem !important; } /* 2 Rows * 3 Cols (up to 4 boxes) */
                #ai-courses-wrapper:not([data-expanded="true"]) { max-height: 38rem !important; } /* 2 Rows * 2 Cols */
                #universities-wrapper:not([data-expanded="true"]) { max-height: 17rem !important; } /* 1 Row * 5 Cols */
                #subjects-wrapper:not([data-expanded="true"]) { max-height: 18rem !important; } /* 1 Row * 4 Cols */
                .expandable-grid-wrapper:not([data-expanded="true"]) { max-height: 36rem !important; }
            }
            @media (min-width: 768px) and (max-width: 1023px) {
               	/* Tablet intermediate states */
                #course-selection-container-wrapper:not([data-expanded="true"]) { max-height: 36rem; }
                #study-material-wrapper:not([data-expanded="true"]) { max-height: 44rem; }
            }

            .expandable-content-wrapper[data-expanded="true"], .expandable-grid-wrapper[data-expanded="true"] {
                max-height: 10000px !important; /* A large value to ensure it expands fully */
            }

            /* Thinkly AI search bar fix */
            #thinkly-ai-hero .AgWCw {
                max-width: 100vw !important;
                width: 95% !important;
                pointer-events: auto !important; /* FIX: Stop click leak that causes page jump */
            }
            
            /* Large container fix */
            #thinkly-ai-hero .LmmD9,
            #thinkly-ai-hero .d4HWzd {
                max-width: 100vw !important;
            }
        }

        /* --- NEW FUTURISTIC MOBILE NAVIGATION BAR STYLES --- */
        :root {
            --ease-quart: cubic-bezier(0.76, 0, 0.24, 1);
            --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
        }
 
        .mobile-nav-container {
            position: fixed;
            bottom: 0.2rem;
            left: 50%;
            transform: translate(-50%, 20px) scale(0.98);
            filter: blur(10px);
            opacity: 0;
            width: calc(100% - 0.4rem); /* Made it narrower */
            max-width: 380px; /* Reduced max width */
            z-index: 50;
            animation: cinematic-reveal-mobile 1s var(--ease-out-quart) 0.5s forwards;
            will-change: transform, filter, opacity;
            transition: transform 0.4s var(--ease-quart), opacity 0.4s var(--ease-quart);
        }
 
        .mobile-nav-container.hidden {
            transform: translate(-50%, 150%); /* Slide down to hide */
            opacity: 0;
            pointer-events: none;
        }
 
        .mobile-nav-container.nav-hidden {
            transform: translate(-50%, 150%); /* Slide down to hide */
            opacity: 0;
            pointer-events: none;
        }
        @keyframes cinematic-reveal-mobile {
            100% {
                opacity: 1;
                transform: translate(-50%, 0) scale(1);
                filter: blur(0);
            }
        }
        
        .mobile-nav-bg {
            position: absolute;
            inset: 3px 0; /* Make it vertically thinner */
            border-radius: 3rem; /* Increased radius */
            background: rgba(255, 255, 255, 0.9);
            backdrop-filter: blur(24px) saturate(1.8);
            -webkit-backdrop-filter: blur(24px) saturate(1.8);
            border: 1px solid rgba(0, 0, 0, 0.08);
            box-shadow: 0 -4px 32px 0 rgba(0, 0, 0, 0.1);
            pointer-events: auto; /* Make the background block clicks to elements behind it */
        }
 
        .mobile-nav-item {
            transition: transform 0.2s var(--ease-out-quart);
        }
 
        .mobile-nav-item:active {
            transform: scale(0.9);
            /* pointer-events: auto; */ /* No longer needed as parent nav is clickable */
        }

        /* NEW: Prevent raised button from jumping on click */
        .nex-button-raised:active {
            transform: translateY(-13px) scale(0.95);
        }
 
        .mobile-nav-item .icon-wrapper {
            position: relative;
            /* pointer-events: none; */ /* Removed to allow clicks on icons */
        }
 
        .mobile-nav-item.active .icon-glow {
            opacity: 1;
            transform: scale(1);
        }
        
        .mobile-nav-item.active svg {
        }
 
        .icon-glow {
            position: absolute;
            inset: -8px;
            background: #000000; /* Glow color: vibrant blue */
            border-radius: 50%;
            opacity: 0;
            filter: blur(12px);
            transform: scale(0.5);
            transition: all 0.4s var(--ease-quart);
            z-index: -1;
        }
        
        /* NEW: Style for the raised NeX button */
        .nex-button-raised {
            transform: translateY(-13px);
            transition: transform 0.4s var(--ease-quart);
        }

        /* NEW: Mobile Bottom Nav Safe Area */
        @supports (padding-bottom: env(safe-area-inset-bottom)) {
            .pb-safe {
                padding-bottom: env(safe-area-inset-bottom);
            }
        }
        
        /* Ensure main content has bottom padding on mobile to not hide behind nav bar */
        @media (max-width: 300px) {
            body {
                padding-bottom: 50px; /* Space for mobile nav */
            }
            footer {
                margin-bottom: 0;
            }
        }
        
        #thinkly-ai-hero {
            --nvzc4: #ffffff;
            --nvzc9: #0a0a0a;
            --nvzc12: #56595e;
            --nvzc13: #0a0a0a;
            --nvzc19: #007aff;
            --aYn2S: #f0f2f5;
            --emphasized-curve: cubic-bezier(0.38, 0.72, 0, 1);
            min-height: 120px; /* Ensure minimum height for visibility */
        }
        #thinkly-ai-hero .AgWCw {
            display: flex;
            align-items: flex-end;
            pointer-events: auto !important; /* FIX: Enable pointer events to prevent click leak and page jump */
            position: relative; /* Changed from fixed to relative */
            z-index: 40 !important; /* Below navbar (50) to sit BEHIND the Navbar */
            isolation: isolate; /* Create new stacking context */
            will-change: height, margin, width, border-radius;
            transition: height .5s var(--emphasized-curve), margin .5s var(--emphasized-curve), width .5s var(--emphasized-curve), border-radius .5s var(--emphasized-curve);
            height: 56px;
            border-radius: 28px;
            margin: 0 auto; /* Center the bar */
            width: 100%;
            max-width: 720px;
            cursor: pointer;
            box-shadow: 0 4px 12px rgba(0,0,0,0.15), 0 1px 3px rgba(0,0,0,0.1); /* Enhanced shadow for better visibility */
            background: white; /* Ensure white background */
        }
        #thinkly-ai-hero .AgWCw > * {
            pointer-events: auto !important; /* Re-enable pointer events for direct children */
        }
        #thinkly-ai-hero .AgWCw:active {
            box-shadow: 0 2px 6px rgba(0,0,0,0.25), 0 1px 2px rgba(0,0,0,0.15), 0 0 0 3px rgba(0, 122, 255, 0.15);
        }
        #thinkly-ai-hero .AgWCw:focus-visible {
            outline: 2px solid #007aff;
            outline-offset: 2px;
        }
        #thinkly-ai-hero .UAbVe .AgWCw,
        #thinkly-ai-hero .is-chatting .AgWCw { cursor: default; }
        #thinkly-ai-hero .UAbVe .AgWCw { height: 120px; }
        #thinkly-ai-hero .is-chatting .AgWCw { height: 300px; border-radius: 24px; }
        #thinkly-ai-hero .LmmD9, #thinkly-ai-hero .d4HWzd { position: absolute; contain: paint; border-radius: inherit; inset: 0; transition: border-radius .5s var(--emphasized-curve); }
        
        /* 🔥 CRITICAL FIX: Make animation layers click-through so search bar is tappable */
        #thinkly-ai-hero .LmmD9,
        #thinkly-ai-hero .d4HWzd,
        #thinkly-ai-hero .LmmD9::before,
        #thinkly-ai-hero .LmmD9::after,
        #thinkly-ai-hero .d4HWzd::before {
            pointer-events: none !important;
        }
        
        /* 🔥 Ensure interactive elements receive clicks */
        #thinkly-ai-hero .AgWCw,
        #thinkly-ai-hero .esoFne,
        #thinkly-ai-hero #searchBarWrapper,
        #thinkly-ai-hero #searchBar,
        #thinkly-ai-hero #sendBtn,
        #thinkly-ai-hero #clearChatBtn,
        #thinkly-ai-hero #thinklyMenuButton,
        #thinkly-ai-hero #closeButton {
            pointer-events: auto !important;
        }
        
        #thinkly-ai-hero .LmmD9::after { border-radius: inherit; content: ""; position: absolute; inset: 0; background: var(--aYn2S); z-index: -1; pointer-events: none; }
        #thinkly-ai-hero .UAbVe .LmmD9::after { animation: color-pulse-on-expand .5s cubic-bezier(0.4, 0, 0.2, 1); }
        #thinkly-ai-hero .LmmD9::before { content: ""; position: absolute; opacity: 0; background: conic-gradient(rgba(52,168,82,0) 0deg,rgba(52,168,82,1) 38.9738deg,rgba(255,211,20,1) 62.3678deg,rgba(255,70,65,1) 87.0062deg,rgba(49,134,255,1) 107.428deg,rgba(49,134,255,0.5) 204.48deg,rgba(49,134,255,0) 308.88deg,rgba(52,168,82,0) 360deg) border-box; left: 50%; top: 50%; translate: -50% -50%; width: 1200px; height: 1200px; scale: 1 .4; pointer-events: none; transition: opacity .3s; filter: blur(35px); }
        #thinkly-ai-hero .UAbVe .LmmD9::before { animation: gradient-spin-expand 1.6s cubic-bezier(0.2, 0, 0, 1); }
        #thinkly-ai-hero .d4HWzd::before { content: ""; contain: paint; position: absolute; inset: 0; border-radius: inherit; transition: filter .3s, border-radius .5s var(--emphasized-curve); background: var(--nvzc4); border: 1px solid #dcdfe5; }
        #thinkly-ai-hero .UAbVe .d4HWzd::before { animation: plate-background-blur-on-expand .6s var(--emphasized-curve), color-pulse-on-expand .5s var(--emphasized-curve); }
        #thinkly-ai-hero .esoFne { display: flex; flex-direction: column; width: 100%; height: 100%; padding: 16px; z-index: 100; position: relative; transition: padding .5s var(--emphasized-curve); }
        #thinkly-ai-hero .UAbVe .esoFne { padding: 16px; }
        /* UPDATED: Adjust padding and flex for chatting state */
        #thinkly-ai-hero .is-chatting .esoFne {
            padding: 48px 8px 8px 8px;
            justify-content: flex-end; /* Push content to the bottom */
        }
        #thinkly-ai-hero #chatOutput { flex-grow: 1; overflow-y: auto; margin-bottom: 12px; display: flex; flex-direction: column; gap: 12px; scroll-behavior: auto; scrollbar-width: none; }
        #thinkly-ai-hero .chat-message { padding: 8px 14px; border-radius: 18px; max-width: 80%; word-wrap: break-word; overflow-wrap: break-word; }
        #thinkly-ai-hero .user-message { background-color: var(--nvzc19); color: white; align-self: flex-end; border-bottom-right-radius: 4px; }
        #thinkly-ai-hero .ai-message { background-color: #ffffff; color: #1d1d1f; align-self: flex-start; border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); border: 1px solid #e5e5ea; line-height: 1.65; }
        
        /* AI message markdown spacing — Gemini style */
        #thinkly-ai-hero .ai-message p,
        #thinkly-ai-hero .ai-message li {
            margin: 4px 0;
            line-height: 1.65;
        }
        #thinkly-ai-hero .input-area { display: flex; align-items: flex-end; gap: 8px; position: relative; opacity: 0; transform: translateY(20px); pointer-events: none; transition: opacity 0.4s var(--emphasized-curve), transform 0.4s var(--emphasized-curve); width: 100%; max-width: 100%; }
        #thinkly-ai-hero .UAbVe .input-area, #thinkly-ai-hero .is-chatting .input-area { opacity: 1; transform: translateY(0); pointer-events: auto; }
        /* Always show input-area inside expandedView regardless of parent classes */
        #thinkly-ai-hero #expandedView .input-area { opacity: 1 !important; transform: none !important; pointer-events: auto !important; }
        /* NEW: Styles for AI response pills */
        #thinkly-ai-hero .ai-response-pills {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-top: 8px;
        }
        #thinkly-ai-hero .ai-pill {
            background-color: rgba(0, 122, 255, 0.1);
            border: 1px solid rgba(0, 122, 255, 0.2);
            color: #007aff;
            padding: 8px 14px;
            border-radius: 16px;
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            transition: background-color 0.2s;
        }
        #thinkly-ai-hero .ai-pill:hover {
            background-color: rgba(0, 122, 255, 0.2);
        }
        
        /* 🔥 SUPER BOOST: Force searchBarWrapper to be on top and clickable */
        #thinkly-ai-hero #searchBarWrapper {
            position: relative;
            z-index: 42 !important; /* Below navbar (50) but above AgWCw (40) */
            pointer-events: auto !important;
            cursor: pointer;
            isolation: isolate; /* Create new stacking context */
        }
        
        /* 🔥 Make sure content area is also high z-index */
        #thinkly-ai-hero .esoFne {
            z-index: 43 !important; /* Below navbar but above searchBarWrapper */
            position: relative;
            pointer-events: auto !important;
        }
        
        #thinkly-ai-hero .textarea-wrapper { position: relative; flex-grow: 1; display: flex; background-color: #f0f2f5; border-radius: 20px; transition: background-color 0.3s; max-width: 95% !important; width: 95% !important; overflow: visible !important; }
        #thinkly-ai-hero .textarea-wrapper:focus-within { background-color: #e9ebf0; }
        #thinkly-ai-hero .ITIRGe { font-family: "Google Sans", Roboto, Arial, sans-serif; width: 100%; font-size: 16px; line-height: 22px; border: none; background: none; outline: none; padding: 12px 16px; resize: none; color: #000 !important; min-height: 48px; max-height: 84px; overflow-y: auto; overflow: visible !important; position: relative; z-index: 2; font-weight: 400 !important; font-style: normal !important; }
        
        /* Image attachment dropdown styles */
        #thinkly-ai-hero .attachment-dropdown {
            display: none;
            position: absolute;
            bottom: 60px;
            left: 0;
            background: white;
            border-radius: 12px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            padding: 8px;
            z-index: 2147483650;
            min-width: 160px;
        }
        #thinkly-ai-hero .attachment-dropdown.show {
            display: block;
        }
        #thinkly-ai-hero .attachment-option {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 10px 12px;
            border-radius: 8px;
            cursor: pointer;
            transition: background-color 0.2s;
            font-size: 14px;
            color: #0a0a0a;
        }
        #thinkly-ai-hero .attachment-option:hover {
            background-color: #f0f2f5;
        }
        #thinkly-ai-hero .attachment-option i {
            color: #007aff;
        }
        
        #thinkly-ai-hero .image-chip {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
            border: 1px solid rgba(33, 150, 243, 0.3);
            border-radius: 20px;
            padding: 6px 12px;
            font-size: 13px;
            color: #1976d2;
            font-weight: 500;
            box-shadow: 0 2px 4px rgba(33, 150, 243, 0.1);
            transition: all 0.2s ease;
        }
        #thinkly-ai-hero .image-chip:hover {
            background: linear-gradient(135deg, #bbdefb 0%, #90caf9 100%);
            box-shadow: 0 3px 6px rgba(33, 150, 243, 0.2);
        }
        #thinkly-ai-hero .image-chip .close-chip {
            width: 16px;
            height: 16px;
            border-radius: 50%;
            background: rgba(25, 118, 210, 0.2);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: background-color 0.2s;
        }
        #thinkly-ai-hero .image-chip .close-chip:hover {
            background: rgba(25, 118, 210, 0.4);
        }
        #thinkly-ai-hero .image-chip .close-chip svg {
            width: 10px;
            height: 10px;
            stroke: #1976d2;
            stroke-width: 2.5;
        }
        
        /* iOS style chip for image generation mode */
        /* High Intensity Shine Animation for Image Generation */
        @keyframes shine-move {
            0% { background-position: 200% 0; }
            100% { background-position: -200% 0; }
        }

        .animate-shine-intense {
            background: linear-gradient(
                110deg, 
                #ececec 8%, 
                #f5f5f5 18%, 
                #ffffff 33%, 
                #f5f5f5 48%, 
                #ececec 58%
            );
            background-size: 200% 100%;
            animation: shine-move 1.5s infinite linear;
        }

        .dark .animate-shine-intense {
            background: linear-gradient(
                110deg, 
                #2c2c2e 8%, 
                #3a3a3c 18%, 
                #505055 33%, 
                #3a3a3c 48%, 
                #2c2c2e 58%
            );
            background-size: 200% 100%;
        }
        
        /* Image generation container */
        #thinkly-ai-hero .image-gen-container {
            display: flex;
            flex-wrap: wrap;
            gap: 16px;
            justify-content: center;
            margin-top: 12px;
        }
        
        /* --- ULTIMATE FIX: Force Visible Frame --- */
        #thinkly-ai-hero .image-gen-card {
            display: block !important;
            position: relative !important;
            width: 100% !important;
            
            /* Ye line magic karegi - Box ko square rehne ke liye force karegi */
            aspect-ratio: 1 / 1 !important; 
            
            /* Agar aspect-ratio fail ho to ye backup height hai */
            min-height: 250px !important;   
            
            background-color: #e2e8f0 !important; /* Darker Gray taaki dikhe */
            border-radius: 16px;
            overflow: hidden;
            margin-top: 5px;
            z-index: 1;
            user-select: none !important; /* Text select hone se rokne ke liye */
            -webkit-user-select: none !important;
        }
        
        /* Removed empty hover rule for cleaner code */
        
        /* Loader Animation Background - FASTER & MORE INTENSE */
        #thinkly-ai-hero .animate-shine-intense {
            position: absolute;
            inset: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, 
                rgba(255,255,255,0) 0%, 
                rgba(255,255,255,0.8) 50%, 
                rgba(255,255,255,0) 100%);
            background-size: 200% 100%;
            animation: shimmer 0.8s infinite; /* Speed badhayi 1.5s se 0.8s */
            z-index: 5;
        }
        
        @keyframes shimmer {
            0% { transform: translateX(-100%); }
            100% { transform: translateX(100%); }
        }
        @keyframes shimmer-sweep {
            0%   { background-position: -200% center; }
            100% { background-position: 200% center; }
        }
        /* NeX Hero — Request Access premium button */
        .nex-request-btn {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 12px 32px;
            border-radius: 999px;
            border: 1.5px solid rgba(255,255,255,0.6);
            background: rgba(255,255,255,0.12);
            backdrop-filter: blur(14px);
            -webkit-backdrop-filter: blur(14px);
            box-shadow: 0 0 20px rgba(255,255,255,0.2), 0 4px 16px rgba(0,0,0,0.35);
            color: #fff;
            font-size: 0.8rem;
            font-weight: 800;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            cursor: pointer;
            overflow: hidden;
            position: relative;
            transition: box-shadow 0.3s ease, transform 0.2s ease, border-color 0.3s ease;
        }
        .nex-request-btn::after {
            content: '';
            position: absolute;
            inset: 0;
            background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,0.22) 50%, transparent 65%);
            background-size: 250% 100%;
            background-position: -200% center;
            transition: background-position 0.5s ease;
        }
        .nex-request-btn:hover::after,
        .nex-request-btn:active::after {
            background-position: 250% center;
        }
        .nex-request-btn:hover {
            box-shadow: 0 0 36px rgba(255,255,255,0.45), 0 6px 24px rgba(0,0,0,0.45);
            border-color: rgba(255,255,255,0.9);
            transform: scale(1.05);
        }
        .nex-request-btn:active { transform: scale(0.97); }
        
        /* Image Styling */
        #thinkly-ai-hero .image-gen-card img {
            position: absolute !important;
            inset: 0 !important;
            width: 100% !important;
            height: 100% !important;
            object-fit: cover !important;
            z-index: 10;
            opacity: 0;
            transition: opacity 0.3s ease;
            user-select: none !important;
            -webkit-user-select: none !important;
            pointer-events: auto !important; /* Click enable karne ke liye */
        }
        
        /* Chat bubble padding removal specifically for images */
        #thinkly-ai-hero .ai-message:has(.image-gen-card) {
            padding: 4px !important; /* Minimal padding for image message */
            background: transparent !important;
            border: none !important;
            box-shadow: none !important;
        }
        
        /* NEW: Global Download Button Style for Generated Images */
        .download-btn {
            position: absolute;
            bottom: 8px;
            right: 8px;
            z-index: 20;
            width: 40px;
            height: 40px;
            background: rgba(0,0,0,0.3);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px); /* Added for cross-browser compatibility */
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s ease;
            box-shadow: 0 2px 8px rgba(0,0,0,0.3);
            border: none;
            outline: none;
        }
        .download-btn * {
            pointer-events: none; /* Ensure clicks on SVG children bubble up to button */
        }
        .download-btn:hover {
            background: rgba(0,0,0,0.5);
            transform: scale(1.1);
        }
        .download-btn:active {
            transform: scale(0.95);
        }
        
        /* Image Lightbox */
        .image-lightbox {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.95);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            z-index: 99999;
            justify-content: center;
            align-items: center;
            animation: fadeIn 0.2s ease;
        }
        
        .image-lightbox.active {
            display: flex;
        }
        
        .image-lightbox img {
            max-width: 90%;
            max-height: 90vh;
            border-radius: 12px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
            animation: zoomIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
            object-fit: contain;
            transition: transform 0.3s ease;
        }
        
        .image-lightbox-close {
            position: absolute;
            top: 20px;
            right: 20px;
            width: 40px;
            height: 40px;
            background: rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(10px);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s ease;
            z-index: 100000;
        }
        
        .image-lightbox-close:hover {
            background: rgba(255, 255, 255, 0.2);
            transform: scale(1.1);
        }
        
        .image-lightbox-close svg {
            width: 24px;
            height: 24px;
            stroke: white;
        }
        
        @keyframes zoomIn {
            from {
                opacity: 0;
                transform: scale(0.8);
            }
            to {
                opacity: 1;
                transform: scale(1);
            }
        }
        
        #thinkly-ai-hero .image-chip-ios {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            background: rgba(59, 130, 246, 0.08);
            border: 1px solid rgba(209, 213, 219, 0.5);
            border-radius: 9999px;
            padding: 6px 10px 6px 12px;
            font-size: 11px;
            color: #1f2937;
            font-weight: 600;
            animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
        }
        
        #thinkly-ai-hero .image-chip-ios svg:first-child {
            width: 14px;
            height: 14px;
            flex-shrink: 0;
        }
        
        #thinkly-ai-hero .image-chip-ios span {
            color: #1f2937;
            font-weight: 600;
            line-height: 1;
        }
        
        #thinkly-ai-hero .image-chip-ios .close-btn {
            width: 16px;
            height: 16px;
            border-radius: 50%;
            background: transparent;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: background-color 0.15s ease;
            margin-left: 2px;
        }
        #thinkly-ai-hero .image-chip-ios .close-btn:hover {
            background: rgba(107, 114, 128, 0.1);
        }
        #thinkly-ai-hero .image-chip-ios .close-btn svg {
            stroke: #6b7280;
            width: 10px;
            height: 10px;
        }
        
        #thinkly-ai-hero #expandedImageChipsContainer {
            display: flex;
            align-items: center;
            gap: 8px;
            padding-bottom: 8px;
        }
        
        #thinkly-ai-hero .placeholder-text { position: absolute; top: 50%; left: 16px; transform: translateY(-50%); color: var(--nvzc12); pointer-events: none; opacity: 0; transition: opacity 0.4s ease 0.2s, transform 0.4s ease 0.2s; z-index: 1; font-weight: 300 !important; }
        #thinkly-ai-hero .UAbVe .placeholder-text { opacity: 1; }
        #thinkly-ai-hero .textarea-wrapper.has-content .placeholder-text { opacity: 0; transition-delay: 0s; }
        #thinkly-ai-hero .action-buttons { display: flex; align-items: center; gap: 4px; }
        #thinkly-ai-hero #fileButton { opacity: 0; transform: scale(0.8); pointer-events: none; transition: opacity .4s ease .2s, transform .4s var(--emphasized-curve) .2s; }
        #thinkly-ai-hero .UAbVe #fileButton, #thinkly-ai-hero .is-chatting #fileButton { opacity: 1; transform: scale(1); pointer-events: auto; }
        #thinkly-ai-hero .control-button, #thinkly-ai-hero .OEueve { cursor: pointer; border-radius: 9999px; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex-shrink: 0; transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.2s ease; }
        #thinkly-ai-hero .control-button:hover { background-color: rgba(0,0,0,0.05); }
        #thinkly-ai-hero .OEueve { background: radial-gradient(circle at 28% 24%, #e0f2fe 0%, #bae6fd 45%, #7dd3fc 100%); color: white; padding: 0; overflow: hidden; border: none; box-shadow: 0 4px 12px rgba(125,211,252,0.3); width: 52px; height: 52px; }
        #thinkly-ai-hero .OEueve:not(.disabled):hover { transform: scale(1.05); }
        #thinkly-ai-hero .OEueve.disabled { opacity: 0.7; pointer-events: auto; cursor: default; }
        
        /* EMO Send Button Styles */
        .emo-send-container {
            width: 100%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
            padding: 2px;
        }
        .emo-send-face {
            width: 65%;
            height: 45%;
            background: #0f1416;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: space-around;
            padding: 0 8%;
        }
        .emo-send-face .svg-full {
            width: 24px;
            height: 24px;
            min-width: 24px;
            min-height: 24px;
        }
        .emo-send-eye-group {
            transform-origin: 50% 50%;
            transition: all 350ms cubic-bezier(.2,.9,.2,1);
        }
        .emo-send-eye-group path {
            transition: d 350ms cubic-bezier(.2,.9,.2,1);
        }
        #thinkly-ai-hero #expandButton { position: absolute; top: 12px; left: 12px; z-index: 100 !important; width: 80px; height: 28px; border-radius: 14px; background-color: rgba(0, 122, 255, 0.1); border: 1px solid rgba(0, 122, 255, 0.2); backdrop-filter: blur(4px); color: var(--nvzc19); font-size: 13px; font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 4px; cursor: pointer; opacity: 0; pointer-events: none; transition: opacity 0.1s ease, background-color .2s ease; }
        #thinkly-ai-hero .is-chatting #expandButton, #thinkly-ai-hero .UAbVe #expandButton { opacity: 1 !important; pointer-events: auto !important; transition-delay: .2s; }
        #thinkly-ai-hero #expandButton:hover { background-color: rgba(0, 122, 255, 0.2); }
        #thinkly-ai-hero #clearChatButton { position: absolute; top: 16px; right: 16px; z-index: 100 !important; width: 32px; height: 32px; border-radius: 50%; background-color: rgba(128, 128, 128, 0.15); color: #666; display: flex; align-items: center; justify-content: center; cursor: pointer; opacity: 0; pointer-events: none; transition: opacity .4s ease .2s, background-color .2s ease; backdrop-filter: blur(4px); }
        #thinkly-ai-hero .is-chatting #clearChatButton, #thinkly-ai-hero .UAbVe #clearChatButton { opacity: 1; pointer-events: auto; }
        #thinkly-ai-hero #clearChatButton:hover { background-color: rgba(200, 200, 200, 0.9); }
        #thinkly-ai-hero .search-bar-title { color: var(--nvzc9); font-size: 1.5rem; font-weight: 500; text-align: left; opacity: 0.8; position: absolute; left: 24px; top: 50%; transform: translateY(-50%); pointer-events: none; transition: opacity .3s ease, transform .5s var(--emphasized-curve); }
        #thinkly-ai-hero .UAbVe .search-bar-title { opacity: 0; transform: translateY(-150%); }
        #thinkly-ai-hero .is-chatting .search-bar-title { opacity: 0; transform: translateY(-50%) translateY(-60px); }
        #thinkly-ai-hero .shine-colorful { background: conic-gradient(from 90deg at 40% -25%, #fff500, #ff8c00, #ff2d2d, #ff00a0, #ff2d2d, #ff8c00, #fff500); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 4s linear infinite; }
        /* NEW: Responsive fix for Thinkly AI on mobile */
        @media (max-width: 767px) {
            #thinkly-ai-hero .AgWCw {
                max-width: 100%; /* Allow it to fill the container on mobile */
                margin: 0 1rem; /* Use horizontal margin for consistent spacing */
            }
            #thinkly-ai-hero .AgWCw { width: 94%; bottom: 0px; }
            /* NEW: Fix for the fullscreen expanded view on mobile */
            #thinkly-ai-hero #expandedView {
                width: 100vw;
                height: 100dvh; /* Use dynamic viewport height to account for address bar */
                max-width: 100vw;
                max-height: 100dvh; /* Use dynamic viewport height */
                border-radius: 0; /* Remove rounded corners for a true fullscreen feel */
            }
        }
        #thinkly-ai-hero .thinking-shine { background: linear-gradient(120deg, #56595e 20%, #0a0a0a 40%, #0a0a0a 60%, #56595e 80%); background-size: 300% auto; color: transparent; -webkit-background-clip: text; background-clip: text; animation: shine 1s linear infinite; }
        #thinkly-ai-hero #middleTitle { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 10; font-size: 14px; font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .4s ease; }
        #thinkly-ai-hero .UAbVe:not(.is-chatting) #middleTitle, #thinkly-ai-hero .is-chatting #middleTitle { opacity: 1; }
        #thinkly-ai-hero #expandedView { 
            position: fixed; 
            inset: 0; 
            width: 100vw;
            height: 100dvh; /* Use dynamic viewport height for mobile */
            max-height: -webkit-fill-available; /* iOS Safari fix */
            z-index: 9999 !important; /* High z-index for fullscreen mode - above everything */
            background: #ffffff; 
            display: flex; 
            flex-direction: column; 
            border-radius: 0; /* No rounded corners for fullscreen */
            transform: scale(0.95); 
            opacity: 0; 
            pointer-events: none; 
            transition: transform .4s var(--emphasized-curve), opacity .4s var(--emphasized-curve);
            overflow: hidden; /* Prevent background scroll */
            padding-bottom: env(safe-area-inset-bottom, 0px); /* Safe area for notched devices */
        }
        #thinkly-ai-hero #expandedView.visible { transform: scale(1); opacity: 1; pointer-events: auto; }
        
        /* 🔥 FIX: Hide Thinkly AI when other modals are open */
        body.modal-open #thinkly-ai-hero #expandedView,
        #notesNavigationModal.active ~ * #thinkly-ai-hero #expandedView,
        #assignmentsNavigationModal.active ~ * #thinkly-ai-hero #expandedView,
        #practicalsNavigationModal.active ~ * #thinkly-ai-hero #expandedView {
            display: none !important;
            z-index: -1 !important;
        }
        
        #thinkly-ai-hero .expanded-header { padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #e5e5ea; flex-shrink: 0; position: sticky; top: 0; z-index: 2147483664 !important; background: white; }
        #thinkly-ai-hero .expanded-title { font-weight: 700; font-size: 1.1rem; }
        #thinkly-ai-hero #closeButton { 
            width: 32px; 
            height: 32px; 
            background: #e5e5ea; 
            color: #888; 
            z-index: 100000 !important; 
            position: relative; 
            pointer-events: auto !important;
            cursor: pointer !important;
        }
        /* NEW: Thinkly AI Sidebar Styles */
        #thinkly-ai-hero #thinklySidebarOverlay {
            position: absolute;
            inset: 0;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 9998 !important;
            opacity: 0;
            transition: opacity 0.3s ease-in-out;
            pointer-events: none;
        }
        #thinkly-ai-hero #thinklySidebarOverlay.visible {
            opacity: 1;
            pointer-events: auto;
        }
        #thinkly-ai-hero #thinklySidebar {
            position: absolute;
            top: 0;
            left: 0;
            height: 100%;
            min-height: var(--thinkly-visible-height, 100dvh);
            width: 280px;
            background: white;
            box-shadow: 4px 0 15px rgba(0,0,0,0.1);
            z-index: 9999 !important;
            transform: translateX(-100%);
            transition: transform 0.3s ease-in-out;
            overflow-y: auto;
        }
        #thinkly-ai-hero #thinklySidebar.visible {
            transform: translateX(0);
        }
        #thinkly-ai-hero #thinklySidebar:not(.-translate-x-full) {
            transform: translateX(0);
        }
        
        /* Ensure sidebar controls are always visible */
        #thinkly-ai-hero #thinklySidebar > div:first-of-type,
        #thinkly-ai-hero #thinklySidebar > div:nth-of-type(2) {
            position: relative;
            z-index: 10;
            background: white;
        }
        
        /* History container should not overlap controls */
        #thinklyHistoryContainer {
            position: relative;
            z-index: 1;
        }
        
        /* NEW: Fix for the expanded view's input area to make textarea take full width */
        #thinkly-ai-hero .expanded-input-area .input-area {
            width: 100%;
            max-width: 100%;
        }
        #thinkly-ai-hero .expanded-input-area .ITIRGe { flex-grow: 1; }
        #thinkly-ai-hero #expandedChatOutput { 
            flex: 1; /* Take remaining space */
            overflow-y: auto; /* Only chat output scrolls */
            overflow-x: hidden;
            padding: 16px; 
            display: flex; 
            flex-direction: column; 
            gap: 12px;
            -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        }
        #thinkly-ai-hero .expanded-input-area { 
            padding: 8px 16px 16px; 
            padding-bottom: max(16px, env(safe-area-inset-bottom)); /* Respect safe area on iOS */
            border-top: 1px solid #e5e5ea; 
            position: relative; 
            z-index: 20; 
            background: #ffffff;
            flex-shrink: 0; /* Never shrink - stays at bottom */
        }
        @keyframes takeoff { 0% { transform: translateX(0) scale(1); opacity: 1; } 100% { transform: translateX(40px) scale(0.6); opacity: 0; } }
        #thinkly-ai-hero .animate-takeoff { animation: takeoff 0.5s ease-out forwards; }
        
        /* FIX 4: Dropdown Styling */
        .plus-dropdown-menu {
            position: fixed;
            top: 80px;
            left: 50%;
            transform: translateX(-50%);
            background: white;
            border-radius: 12px;
            box-shadow: 0 10px 25px rgba(0,0,0,0.15);
            width: 180px;
            flex-direction: column;
            overflow: hidden;
            z-index: 2147483650;
            padding: 5px;
            border: 1px solid rgba(0,0,0,0.05);
        }
        
        .plus-dropdown-menu.active {
            display: flex;
            animation: slideDownFade 0.2s ease-out;
        }
        
        .dropdown-item {
            padding: 10px 12px;
            display: flex;
            align-items: center;
            gap: 10px;
            color: #333;
            font-size: 14px;
            border-radius: 8px;
            cursor: pointer;
            transition: background 0.2s;
        }
        
        .dropdown-item:hover {
            background-color: #f5f5f7;
        }
        
        .dropdown-item i {
            color: #007AFF;
        }
        
        @keyframes slideDownFade {
            from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
            to { opacity: 1; transform: translateX(-50%) translateY(0); }
        }
        /* Prevent body scroll when Thinkly AI is expanded — overflow only, no position:fixed */
        body.thinkly-expanded,
        html:has(#expandedView.visible) {
            overflow: hidden;
        }
        @keyframes shine { to { background-position: 200% center; } }
        @keyframes gradient-spin-expand { 0% { opacity: 0; transform: rotate(90deg); } 10% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; transform: rotate(250deg); } }
        @keyframes plate-background-blur-on-expand { 0% { filter: blur(0); } 11% { filter: blur(7px); } 100% { filter: blur(0); } }
        @keyframes color-pulse-on-expand { 11% { background: var(--nvzc4); } }

        /* 🔥 CRITICAL: Hide Thinkly AI when any modal is open */
        body.modal-open #thinkly-ai-hero {
            display: none !important;
            visibility: hidden !important;
            opacity: 0 !important;
            pointer-events: none !important;
        }

        /* 🔥 NEW: Smooth transition for Thinkly AI visibility */
        #thinkly-ai-hero {
            position: relative;
            z-index: 40 !important; /* Below navbar (50) to stay behind it when scrolling */
            transition: opacity 0.3s ease-out, visibility 0.3s ease-out;
            display: block !important; /* Force display */
            visibility: visible !important; /* Force visible */
            opacity: 1 !important; /* Force opacity */
        }
        
        /* Keep navbar behind sidebar when sidebar is open */
        #thinkly-ai-hero.active-mode ~ header#navbarI,
        body:has(#thinklySidebar:not(.-translate-x-full)) header#navbarI {
            z-index: 2147483659 !important;
        }

        /* Success Modal Styles */
        .success-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.6);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10000;
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }
        
        .success-modal.show {
            opacity: 1;
            visibility: visible;
            pointer-events: auto;
        }
        
        .success-modal-content {
            background: white;
            border-radius: 24px;
            padding: 48px 40px;
            text-align: center;
            max-width: 420px;
            width: 90%;
            position: relative;
            transform: scale(0.8) translateY(30px);
            transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
        }
        
        .success-modal.show .success-modal-content {
            transform: scale(1) translateY(0);
        }

        /* NEW: My Orders Status Tracker */
        .order-status-tracker {
            display: flex;
            align-items: center;
            justify-content: space-between;
            position: relative;
            margin: 2rem 0;
        }
        .order-status-tracker::before {
            content: '';
            position: absolute;
            top: 50%;
            left: 0;
            right: 0;
            height: 4px;
            transform: translateY(-50%);
            z-index: 1;
        }
        .status-step {
            position: relative;
            z-index: 2;
            text-align: center;
        }
        .status-dot {
            width: 24px;
            height: 24px;
            border-radius: 50%;
            border: 4px solid #fff;
            margin: 0 auto 0.5rem;
            transition: background-color 0.3s;
        }
        .status-step.active .status-dot {
            background-color: #000; /* blue-600 */
        }

        
        .success-icon {
            width: 80px;
            height: 80px;
            background: linear-gradient(135deg, #10b981, #059669);
            border-radius: 50%;
            margin: 0 auto 24px;
            display: flex;
            align-items: center;
            justify-content: center;
            animation: success-bounce 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
            box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3);
        }
        
        @keyframes success-bounce {
            0% { 
                transform: scale(0) rotate(0deg);
                opacity: 0;
            }
            50% { 
                transform: scale(1.2) rotate(180deg);
                opacity: 1;
            }
            100% { 
                transform: scale(1) rotate(360deg);
                opacity: 1;
            }
        }
        
        /* Toast Notification Styles */
        .toast {
            position: fixed;
            bottom: 100px;
            left: 50%;
            transform: translateX(-50%) translateY(100px);
            background: white;
            color: black;
            padding: 16px 24px;
            border-radius: 12px;
            font-weight: 500;
            z-index: 100025;
            opacity: 0;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            pointer-events: none; /* Prevent blocking clicks when hidden */
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
            backdrop-filter: blur(8px);
        }
        
        .toast.show {
            opacity: 1;
            transform: translateX(-50%) translateY(0);
            pointer-events: auto; /* Allow interaction when visible */
        }
        
        /* Loading Button Styles */
        .btn-loading {
            position: relative;
            cursor: wait;
            opacity: 0.7;
        }
        
        .btn-loading::after {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 20px;
            height: 20px;
            margin: -10px 0 0 -10px;
            border: 2px solid transparent;
            border-top: 2px solid currentColor;
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }
        
        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        
        /* UPDATED: Error toast style as per your request */
        .toast.error {
            background-color: white;
            color: #000; /* blue-600 */
        }

        /* NEW: Apple-Style Connection Alert */
        .connection-alert {
            position: fixed;
            bottom: 6rem; /* Moved up to avoid mobile nav */
            left: 50%;
            transform: translateX(-50%) translateY(20px);
            z-index: 10002; /* Above toast */
            display: flex;
            align-items: center;
            gap: 0.75rem; /* 12px */
            padding: 0.75rem 1.25rem; /* 12px 20px */
            border-radius: 9999px; /* pill shape */
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
            font-size: 0.9rem; /* 14.4px */
            font-weight: 500;
            color: rgba(0, 0, 0, 0.75);
            background: rgba(255, 255, 255, 0.7);
            backdrop-filter: blur(16px) saturate(1.8);
            -webkit-backdrop-filter: blur(16px) saturate(1.8);
            border: 1px solid rgba(0, 0, 0, 0.08);
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            opacity: 0;
            visibility: hidden;
            transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s;
            will-change: transform, opacity;
        }
        .connection-alert.show {
            transform: translateX(-50%) translateY(0);
            opacity: 1;
            visibility: visible;
        }

        /* EMO Pet Chatbot Styles */
        .emo-pet-container {
            position: fixed;
            bottom: 20px;
            right: 20px;
            z-index: 40; /* Below modals (100) but above normal content */
            width: 100px;
            height: 100px;
            pointer-events: auto;
        }
        
        @media (max-width: 767px) {
            .emo-pet-container {
                bottom: 100px; /* Above mobile nav */
                right: 15px;
                width: 80px;
                height: 80px;
            }
        }

        .emo-bot {
            width: 100%;
            height: 100%;
            border-radius: 50%;
            background: radial-gradient(circle at 28% 24%, #e0f2fe 0%, #bae6fd 45%, #7dd3fc 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 18px 40px rgba(125,211,252,0.25), inset 0 -6px 18px rgba(0,0,0,0.04);
            position: relative;
            transition: transform 520ms cubic-bezier(0.34, 1.56, 0.64, 1);
            animation: emo-minimal-bounce 3s ease-in-out infinite;
            cursor: pointer;
        }

        /* Minimal Bounce Animation */
        @keyframes emo-minimal-bounce {
            0%, 100% { 
                transform: translateY(0px); 
            }
            50% { 
                transform: translateY(-6px); 
            }
        }

        .emo-screen {
            width: 62%;
            height: 36%;
            background: #0f1416;
            border-radius: 28px;
            display: flex;
            align-items: center;
            justify-content: space-around;
            padding: 0 6%;
            filter: drop-shadow(0 6px 18px rgba(2,6,10,0.25));
        }

        .emo-eye-group {
            transform-origin: 50% 50%;
            transition: transform 700ms cubic-bezier(.2,.9,.2,1);
        }

        .emo-glow {
            filter: drop-shadow(0 8px 16px rgba(61,238,255,0.12));
        }

        .emo-hint {
            position: absolute;
            bottom: -30px;
            left: 50%;
            transform: translateX(-50%);
            font-size: 10px;
            color: #4b5563;
            opacity: 0;
            transition: opacity 0.3s;
            white-space: nowrap;
            pointer-events: none;
        }

        .emo-pet-container:hover .emo-hint {
            opacity: 0.6;
        }

        /* --- NEW: AcademyX Platform Card Styles --- */
        .card-apple-platform {
            background-color: #f9f9f9;
            border-radius: 24px;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
            box-shadow: 0 4px 6px rgba(0,0,0,0.05);
        }
        .card-apple-platform:hover {
            transform: translateY(-8px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .card-visual {
            height: 200px;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
            background-size: cover;
            background-position: center;
        }
        .card-visual::before { /* Gradient Overlay */
            content: '';
            position: absolute;
            top: 0; left: 0; right: 0; bottom: 0;
            z-index: 0;
        }
        .card-visual img, .card-visual svg, .card-visual span {
            position: relative;
            z-index: 1;
            filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
        }
        .card-content-platform {
            padding: 24px;
            flex-grow: 1;
            display: flex;
            flex-direction: column;
            background-color: #ffffff;
        }
        .card-link-platform {
            font-weight: 600;
            color: #14532d; /* green-900 — sufficient contrast on white bg */
            transition: transform 0.2s ease;
            display: inline-block;
        }
        .card-link-platform:hover {
           transform: translateX(4px);
        }

        /* Gradients Overlays - Reduced Opacity for Clearer Images */
        .gradient-google::before { background: linear-gradient(135deg, rgba(66, 133, 244, 0.65), rgba(52, 168, 83, 0.65)); }
        .gradient-ai::before { background: linear-gradient(135deg, rgba(95, 114, 190, 0.65), rgba(153, 33, 232, 0.65)); }
        .gradient-growth::before { background: linear-gradient(135deg, rgba(16, 185, 129, 0.65), rgba(52, 211, 153, 0.65)); }
        .gradient-stanford::before { background: linear-gradient(135deg, rgba(177, 4, 14, 0.65), rgba(140, 21, 21, 0.65)); }
        .gradient-amazon::before { background: linear-gradient(135deg, rgba(255, 153, 0, 0.65), rgba(35, 47, 62, 0.65)); }
        .gradient-business::before { background: linear-gradient(135deg, rgba(245, 208, 32, 0.65), rgba(245, 56, 3, 0.65)); }
        .gradient-design::before { background: linear-gradient(135deg, rgba(142, 45, 226, 0.65), rgba(74, 0, 224, 0.65)); }
        .gradient-cs::before { background: linear-gradient(135deg, rgba(0, 198, 255, 0.65), rgba(0, 114, 255, 0.65)); }
        .gradient-cfi::before { background: linear-gradient(135deg, rgba(0, 45, 98, 0.65), rgba(0, 66, 148, 0.65)); }
        .gradient-dm::before { background: linear-gradient(135deg, rgba(214, 41, 118, 0.65), rgba(250, 126, 30, 0.65)); }
        .gradient-pm::before { background: linear-gradient(135deg, rgba(237, 33, 58, 0.65), rgba(147, 41, 30, 0.65)); }

        /* === BUY BOOKS MODAL STYLES === */
        #buyBooksModal {
            position: fixed;
            inset: 0;
            z-index: 99999;
            background: white;
            transform: translateY(100%);
            transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
            overflow: hidden;
            isolation: isolate; /* Isolate the modal content */
        }
        #buyBooksModal.active {
            display: block;
            transform: translateY(0);
        }
        #buyBooksContainer {
            width: 100%;
            height: 100%;
            overflow: auto; /* Allow scrolling ONLY inside this container */
            overflow-x: hidden;
            position: relative;
            -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        }
        #buyBooksIframe {
            width: 100%;
            height: 100%;
            border: none;
            display: block;
        }
        /* Shopping Modal Loader */
        #shoppingLoader {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            z-index: 100000;
            pointer-events: none;
        }
        #shoppingLoader.hidden {
        }
        .shopping-spinner {
            width: 50px;
            height: 50px;
            animation: spin 1s linear infinite;
        }
        .shopping-spinner .path {
            stroke: #000000;
            stroke-linecap: round;
            animation: dash 1.5s ease-in-out infinite;
        }
        @keyframes dash {
            0% {
                stroke-dasharray: 1, 150;
                stroke-dashoffset: 0;
            }
            50% {
                stroke-dasharray: 90, 150;
                stroke-dashoffset: -35;
            }
            100% {
                stroke-dasharray: 90, 150;
                stroke-dashoffset: -124;
            }
        }
        /* Close button for buy books modal */
        #closeBuyBooksBtn {
            position: fixed;
            top: 1rem;
            right: 1rem;
            z-index: 100001;
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            border-radius: 9999px;
            padding: 0.5rem;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
            transition: all 0.2s;
            cursor: pointer;
            border: 1px solid rgba(0, 0, 0, 0.1);
        }
        #closeBuyBooksBtn:hover {
            background: rgba(243, 244, 246, 0.95);
            transform: scale(1.05);
            box-shadow: 0 6px 10px -2px rgba(0, 0, 0, 0.12);
        }
        #closeBuyBooksBtn svg {
            display: block;
            color: #374151;
            width: 20px;
            height: 20px;
        }

        /* ===== CRITICAL FIX: Prevent Thinkly AI page jump ===== */
        /* Smooth scroll removed globally to prevent reload jump */
        /* Use .smooth-scroll class on specific elements if needed */

        /* ===== SMOOTH SCROLL UTILITY CLASS (SAFE) ===== */
        /* Apply this class to specific elements that need smooth scrolling */
        .smooth-scroll {
            scroll-behavior: smooth;
        }

        /* ===== PROFESSIONAL AI TABLE STYLING ===== */
        .ai-table-wrapper {
            overflow-x: auto;
            margin-top: 8px;
            border-radius: 8px;
        }

        .ai-table {
            border-collapse: collapse;
            min-width: 600px;
            width: 100%;
            font-size: 14px;
        }

        .ai-table th,
        .ai-table td {
            border: 1px solid #e5e7eb;
            padding: 8px 12px;
            text-align: left;
        }

        .ai-table th {
            background: #f9fafb;
            font-weight: 600;
            color: #374151;
        }

        .ai-table tr:nth-child(even) {
            background: #fafafa;
        }

        .ai-table tr:hover {
            background: #f3f4f6;
        }

        /* 🔥 INSTANT OPEN - Skip home bar (zero flash) */
        #thinkly-ai-hero.skip-home .AgWCw {
            display: none !important;
            opacity: 0 !important;
            pointer-events: none !important;
        }

        /* Prevent auto-scroll on layout shift when Thinkly AI expands */
        #thinkly-ai-hero {
            scroll-margin-top: 0 !important;
        }

        /* ========================================
           HA
        
        /* Scrollbar styles for menu */
        #menu-nav::-webkit-scrollbar {
            width: 6px;
        }
        #menu-nav::-webkit-scrollbar-track {
            background: #f1f1f1;
            border-radius: 10px;
        }
        #menu-nav::-webkit-scrollbar-thumb {
            background: #d1d5db;
            border-radius: 10px;
        }
        #menu-nav::-webkit-scrollbar-thumb:hover {
            background: #9ca3af;
        }

        /* Apple-like Animated Hamburger Icon - UNCHANGED when menu opens */
        .hamburger-icon-apple {
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            width: 20px;
            height: 16px;
            position: relative;
            transform: rotate(0deg);
            transition: .2s ease-in-out;
            cursor: pointer;
        }

        .hamburger-icon-apple .line-apple {
            display: block;
            position: absolute;
            height: 2px;
            width: 100%;
            background: currentColor;
            border-radius: 9px;
            opacity: 1;
            left: 0;
            transform: rotate(0deg);
            transition: .25s ease-in-out;
        }

        .hamburger-icon-apple .line-apple.top {
            top: 0px;
        }
        .hamburger-icon-apple .line-apple.middle {
            top: 7px;
        }
        .hamburger-icon-apple .line-apple.bottom {
            top: 14px;
        }
        
        /* NO ANIMATION - hamburger icon stays the same when menu opens */

        /* Mobile Hamburger - UNCHANGED when menu opens */
        .hamburger-icon-apple-mobile {
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            width: 20px;
            height: 16px;
            position: relative;
            transform: rotate(0deg);
            transition: .2s ease-in-out;
            cursor: pointer;
        }

        .hamburger-icon-apple-mobile .line-apple {
            display: block;
            position: absolute;
            height: 2px;
            width: 100%;
            background: currentColor;
            border-radius: 9px;
            opacity: 1;
            left: 0;
            transform: rotate(0deg);
            transition: .25s ease-in-out;
        }

        .hamburger-icon-apple-mobile .line-apple.top {
            top: 0px;
        }
        .hamburger-icon-apple-mobile .line-apple.middle {
            top: 7px;
        }
        .hamburger-icon-apple-mobile .line-apple.bottom {
            top: 14px;
        }
        
        /* NO ANIMATION - hamburger icon stays the same when menu opens */

        /* 🔥 CRITICAL FIX: Completely hide Thinkly AI when any modal is open */
        body.modal-open #thinkly-ai-hero,
        body.modal-open .AgWCw,
        body.modal-open #searchBarWrapper {
            display: none !important;
            visibility: hidden !important;
            opacity: 0 !important;
            pointer-events: none !important;
            z-index: -1 !important;
        }

        /* --- THINKLY AI FULLSCREEN WITH WHATSAPP-STYLE KEYBOARD FIX --- */
        
        /* 1. Main Fullscreen Container - WhatsApp Lock */
        #thinkly-ai-hero #expandedView {
            position: fixed !important;
            top: 0;
            left: 0;
            right: 0;
            /* height uses CSS var so JS can shrink it when keyboard opens (visualViewport) */
            height: var(--thinkly-visible-height, 100dvh) !important;
            max-height: var(--thinkly-visible-height, 100dvh) !important;
            width: 100vw !important;
            max-width: 100vw !important;
            margin: 0 !important;
            padding: 0 !important;
            background-color: #ffffff;
            z-index: 2147483647 !important;
            display: flex;
            flex-direction: column;
            /* \ud83d\udd25 OPTIMIZED: Single GPU-accelerated animation */
            transform: translateY(8px) scale(0.98);
            opacity: 0;
            transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.35s ease;
            overflow: hidden;
            pointer-events: none;
        }

        /* Jab chat open ho */
        #thinkly-ai-hero #expandedView.visible {
            transform: translateY(0) scale(1);
            opacity: 1 !important;
            pointer-events: auto !important;
        }

        /* 2. Header (Fixed Top) - WhatsApp Never Moves */
        #thinkly-ai-hero .expanded-header {
            flex-shrink: 0;
            position: sticky;
            top: 0;
            z-index: 10;
            background: white;
            border-bottom: 1px solid #f0f0f0;
        }

        /* 3. Chat Area (Scrollable Middle) - WhatsApp Only Messages Scroll */
        #thinkly-ai-hero #expandedChatOutput {
            flex: 1 1 auto;
            overflow-y: auto;
            overflow-x: hidden;
            -webkit-overflow-scrolling: touch;
            padding: 16px;
            padding-bottom: 20px;
            scroll-behavior: auto !important;
            overscroll-behavior: contain;
            position: relative;
            z-index: 1;
        }

        /* 4. Input Area (Fixed to viewport bottom) - WhatsApp Lock */
        #thinkly-ai-hero .expanded-input-area {
            flex-shrink: 0;
            background: white;
            border-top: 1px solid #f0f0f0;
            padding: 10px 16px;
            padding-bottom: max(10px, env(safe-area-inset-bottom));
            width: 100%;
            position: relative;
            z-index: 20;
        }

        /* 5. GPU-Optimized Chat Bubbles - 60fps Performance */
        #thinkly-ai-hero .chat-message {
            contain: content;
            will-change: transform;
        }
        
        /* 6. Lock body scroll when chat is open — overflow only, no position:fixed (Android keyboard fix) */
        body:has(#expandedView.visible) {
            overflow: hidden !important;
        }

        /* Close Button ko ensure karein clickable hai */
        #thinkly-ai-hero #closeButton {
            cursor: pointer !important;
            pointer-events: auto !important;
            z-index: 2147483665 !important; /* Highest z-index */
            background: rgba(255, 255, 255, 0.7) !important;
            backdrop-filter: blur(10px) !important;
            -webkit-backdrop-filter: blur(10px) !important;
            border: 1px solid rgba(255, 255, 255, 0.3) !important;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
            width: 36px !important;
            height: 36px !important;
        }

/* --- FINAL: Thinkly AI Full Screen Fix --- */

/* 1. Jab Chat Active ho, use Screen par Chipka do (Fixed Position) */
#thinkly-ai-hero.active-mode {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2147483647 !important; /* Sabse Max Z-Index */
    background: transparent;
    pointer-events: none; /* Click pass hone do jab tak animation ho */
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* 2. Expanded View Styling */
#thinkly-ai-hero.active-mode #expandedView {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: translateY(0) !important; /* Slide Up complete */
    opacity: 1 !important;
    pointer-events: auto !important; /* Ab click enable karo */
    background: #ffffff;
}

/* 3. Buttons (Close & Menu) ko sabse upar rakho */
#thinklyMenuButton, #closeButton {
    position: relative;
    z-index: 2147483650 !important; /* View se bhi upar */
    cursor: pointer !important;
    pointer-events: auto !important;
}

/* --- FINAL BUTTONS FIX --- */
#thinkly-ai-hero #expandedView .expanded-header {
    position: relative !important;
    z-index: 2147483660 !important; /* Header ko sabse upar rakhein */
}

#thinklyMenuButton, #closeButton {
    position: relative !important;
    z-index: 2147483661 !important; /* Header se bhi upar */
    cursor: pointer !important;
    pointer-events: auto !important;
}

/* Thinkly AI Mobile Fixes */
#thinkly-ai-hero.active-mode {
    position: fixed !important;
    inset: 0 !important;
    z-index: 999999 !important;
    background: #fff !important;
    width: 100vw !important;
    height: 100vh !important; /* Fallback */
    height: 100dvh !important; /* Modern browsers */
    max-width: 100vw !important;
    margin: 0 !important;
    padding: 0 !important;
}

#thinkly-ai-hero.active-mode #expandedView {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    width: 100% !important;
    max-width: 100vw !important;
    position: absolute !important; /* Changed from fixed to absolute inside the fixed hero */
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 1. Header ko top par chipka ke rakho */
#thinkly-ai-hero .expanded-header {
    flex-shrink: 0 !important;
    position: sticky !important;
    top: 0 !important;
    height: 60px !important;
    background: white !important;
    z-index: 50 !important;
    border-bottom: 1px solid #f0f0f0;
}

/* 2. Chat area beech mein scroll karega */
#expandedChatOutput {
    flex-grow: 1 !important; /* Baaki jagah ye lega */
    height: 0 !important; /* Flex grow ko force karne ke liye */
    overflow-y: auto !important;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 20px !important; /* Extra space at bottom */
}

/* 3. Input area bottom par rahega - ALWAYS VISIBLE */
.expanded-input-area {
    flex-shrink: 0 !important;
    width: 100%;
    background: white;
    padding-bottom: env(safe-area-inset-bottom);
    position: relative;
    z-index: 10;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

/* Upload pill beside close icon (expanded header) */
.upload-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 9999px;
    background: linear-gradient(135deg, #0ea5e9, #6366f1);
    color: #ffffff;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.2px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.25);
    transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.upload-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(14, 165, 233, 0.30);
}

.upload-pill:active {
    transform: translateY(0px) scale(0.99);
}

.upload-indicator {
    width: 8px;
    height: 8px;
    border-radius: 9999px;
    background: #22d3ee;
    box-shadow: 0 0 0 6px rgba(34, 211, 238, 0.15);
}

/* Light variant for modal header upload pill */
.upload-pill-light {
    background: #ffffff;
    color: #000000;
}

/* Completely hide the College Essentials section */
#college-essentials {
    display: none !important;
}

#thinklyMenuButton svg, #closeButton svg {
    pointer-events: none; /* Click sidha button par jaye, SVG par nahi */
}

/* 🔥 FIX: Force LTR direction for specific search inputs */
.force-ltr-input {
    direction: ltr !important;
    text-align: left !important;
    unicode-bidi: bidi-override !important;
    writing-mode: horizontal-tb !important;
}

/* Additional specific targeting for modal inputs */
#degreeFilter, #subjectFilter {
    direction: ltr !important;
    text-align: left !important;
    unicode-bidi: bidi-override !important;
    writing-mode: horizontal-tb !important;
}

/* Hide 3-dot menu button on mobile phones */
@media (max-width: 768px) {
    #thinklyHistoryContainer button[style*="z-index: 10"] {
        display: none !important;
    }
}

/* NEW: Fix for search input caret and text direction */
#academySearchInput, #searchInput, #expandedSearchInput {
    direction: ltr !important;
    text-align: left !important;
    unicode-bidi: plaintext !important;
}

/* === CHATBOT SIDEBAR & SETTINGS STYLE (Removed - merged into thinklySidebar) === */

/* Apple Toggle Switch */
.toggle-checkbox:checked {
    right: 0;
    border-color: #0071e3;
}
.toggle-checkbox:checked + .toggle-label {
    background-color: #0071e3;
}
.toggle-label {
    width: 50px;
    height: 30px;
    background-color: #e9e9ea;
    border-radius: 9999px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.3s;
}
.toggle-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 26px;
    height: 26px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.toggle-checkbox:checked + .toggle-label .toggle-knob {
    transform: translateX(20px);
}

/* Apple Range Slider */
input[type=range].apple-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background: transparent;
    cursor: pointer;
}
input[type=range].apple-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: #d1d1d6;
    border-radius: 2px;
}
input[type=range].apple-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    margin-top: -8px;
}

/* Voice Overlay Styles */
#voice-overlay {
    opacity: 0;
    transition: opacity 0.3s ease;
}
#voice-overlay:not(.hidden) {
    opacity: 1;
}

/* Animation for modals */
@keyframes scale-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}
.animate-scale-in {
    animation: scale-in 0.2s ease-out;
}

/* Chat message fade-in */
@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.animate-fade-in {
    animation: fade-in 0.3s ease-out;
}

/* --- PERFORMANCE & UI OPTIMIZATIONS --- */

/* 1. Touch Latency Fix */
html, body, button, a, input, textarea {
    touch-action: manipulation; /* Removes 300ms tap delay */
}

/* 2. Instant tap for modal triggers and study material buttons */
#notesBtn,
#assignmentsBtn,
#pyqBtn,
#practicalsBtn,
#syllabusBtn,
#timeTableBtn,
.freebook-action-btn,
[onclick*="openStudyMaterialModal"],
[onclick*="openUnifiedModal"] {
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}

#expandedSendButton,
#sendBtn,
#expandedQuickPills,
#expandedQuickPills .ai-pill,
#study-material-grid button,
[onclick*="showProfileModalNEXBOOK"],
.leaderboard-switch-btn {
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent;
}

#expandedQuickPills,
#expandedQuickPills .ai-pill,
#expandedSendButton,
#sendBtn {
    pointer-events: auto !important;
}

#expandedQuickPills {
    position: relative;
    z-index: 30;
}

/* ---- Moved from index.html style block #2 ---- */
@keyframes slideUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        /* Prevent zoom on mobile */
        * {
            touch-action: pan-x pan-y;
            -webkit-user-select: none;
            user-select: none;
            -webkit-touch-callout: none;
            -webkit-tap-highlight-color: transparent;
        }
        
        body {
            touch-action: pan-x pan-y;
            -webkit-text-size-adjust: 100%;
            -ms-text-size-adjust: 100%;
        }
        
        /* Prevent double-tap zoom */
        a, button, input, textarea, select {
            touch-action: manipulation;
        }
        
        input, textarea, select {
            font-size: 16px !important; /* Prevents zoom on iOS when focusing inputs */
        }

/* ---- Moved from index.html style block #4 ---- */
/* NEW: Skeleton Loader for Course Cards */
        @keyframes pulse {
            50% { opacity: .5; }
        }
        .skeleton-card {
            border-radius: 1rem; /* rounded-2xl */
            overflow: hidden;
            animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
        }
        .skeleton-img {
            height: 16rem; /* h-64 */
            background-color: #d1d5db; /* gray-300 */
        }

/* ---- Moved from index.html style block #5 ---- */
.masked-text {
            font-size: clamp(2.5rem, 8vw, 4rem); /* Responsive font size */
            font-weight: 900;
            color: transparent;
            background-image: url('https://images.unsplash.com/photo-1732535725600-f805d8b33c9c?q=80&w=1470&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D');
            background-size: 200%; /* Enlarged for smooth animation */
            background-position: 0 50%;
            background-clip: text;
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            animation: animate-background 5s infinite alternate linear;
        }

        @keyframes animate-background {
            0% { background-position: 0% 50%; }
            100% { background-position: 100% 50%; }
        }
        
        /* Leaderboard Styles */
        .glass-card {
            background: rgba(255, 255, 255, 0.6); 
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            border: 1px solid rgba(0, 0, 0, 0.05);
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
        }
        
        /* Leaderboard Switch Buttons */
        .leaderboard-switch-btn {
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }
        
        .leaderboard-switch-btn:hover {
            transform: translateY(-2px);
        }
        
        .leaderboard-switch-active {
            background: linear-gradient(135deg, #000000 0%, #000000 100%);
            border-color: #000;
            color: white;
            box-shadow: 0 10px 25px rgba(37, 99, 235, 0.3);
        }
        
        .leaderboard-container {
            transition: opacity 0.3s ease, transform 0.3s ease;
        }
        
        .leaderboard-container.hidden {
            opacity: 0;
            transform: translateY(10px);
        }
        
        .font-playfair {
            font-family: 'Playfair Display', serif;
        }
        
        .drop-shadow-gold {
            filter: drop-shadow(0 0 20px rgba(250, 204, 21, 0.7));
        }
        
        .drop-shadow-silver {
            filter: drop-shadow(0 0 20px rgba(156, 163, 175, 0.7));
        }
        
        .drop-shadow-bronze {
            filter: drop-shadow(0 0 20px rgba(202, 138, 4, 0.7));
        }
        
        .drop-shadow-blue {
            filter: drop-shadow(0 0 15px rgba(59, 130, 246, 0.4));
        }
        
        .sparkline-path-nexbook {
            stroke-dasharray: var(--path-length);
            stroke-dashoffset: 0;
        }
        
        .card-in-view-nexbook .sparkline-path-nexbook {
            stroke-dashoffset: 0;
        }
        
        @keyframes draw-sparkline-nexbook {
            to {
                stroke-dashoffset: 0;
            }
        }
        
        :root {
            --brand-emperor: #a16207; /* was #facc15 (1.3:1) → amber-700 (4.7:1 WCAG AA) */
            --brand-king: #6b7280;    /* was #9ca3af (2.4:1) → gray-500  (4.6:1 WCAG AA) */
            --brand-prince: #92400e;  /* was #ca8a04 (3.2:1) → amber-800 (5.2:1 WCAG AA) */
        }
        
        .border-brand-emperor {
            border-color: var(--brand-emperor);
        }
        
        .border-brand-emperor\/50 {
            border-color: rgba(250, 204, 21, 0.5);
        }
        
        .border-brand-king {
            border-color: var(--brand-king);
        }
        
        .border-brand-king\/50 {
            border-color: rgba(156, 163, 175, 0.5);
        }
        
        .border-brand-prince {
            border-color: var(--brand-prince);
        }
        
        .border-brand-prince\/50 {
            border-color: rgba(202, 138, 4, 0.5);
        }
        
        .text-brand-emperor {
            color: var(--brand-emperor);
        }
        
        .text-brand-king {
            color: var(--brand-king);
        }
        
        .text-brand-prince {
            color: var(--brand-prince);
        }
        
        .hover\:shadow-brand-emperor\/20:hover {
            box-shadow: 0 25px 50px -12px rgba(250, 204, 21, 0.2);
        }
        
        .hover\:shadow-brand-king\/20:hover {
            box-shadow: 0 25px 50px -12px rgba(156, 163, 175, 0.2);
        }
        
        .hover\:shadow-brand-prince\/20:hover {
            box-shadow: 0 25px 50px -12px rgba(202, 138, 4, 0.2);
        }
        
        .hover\:shadow-blue {
            box-shadow: 0 10px 30px rgba(59, 130, 246, 0.2);
        }
        
        .border-brand-king\/80 {
            border-color: rgba(156, 163, 175, 0.8);
        }
        
        .border-brand-emperor\/80 {
            border-color: rgba(250, 204, 21, 0.8);
        }
        
        .border-brand-prince\/80 {
            border-color: rgba(202, 138, 4, 0.8);
        }
        
        /* Gamification Section Styles */
        #gamification {
            min-height: 100vh;
            position: relative;
        }
        
        #full-donor-list-nexbook {
            position: relative !important;
            transform: none !important;
            left: auto !important;
            margin-top: 0 !important;
        }
        
        /* Modal Styles for Leaderboard */
        .modal-container-nexbook {
            position: fixed;
            inset: 0;
            z-index: 99999; 
            opacity: 0;
            visibility: hidden;
            transition: opacity 0.3s ease, visibility 0.3s ease;
            pointer-events: none; 
        }
        
        .modal-backdrop-nexbook {
            position: absolute;
            inset: 0;
            background-color: rgba(0, 0, 0, 0.3);
            backdrop-filter: blur(4px); 
            -webkit-backdrop-filter: blur(4px);
            z-index: 10;
        }
        
        .modal-content-nexbook {
            position: fixed;
            top: 50%;
            left: 50%;
            z-index: 20;
            background: #ffffff;
            color: #0f172a;
            border: 1px solid #e5e7eb;
            border-radius: 1rem; 
            box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); 
            width: 91.666667%; 
            max-width: 32rem; 
            max-height: 90vh;
            opacity: 0;
            visibility: hidden;
            transform: translate(-50%, -50%) scale(0.95);
            transition: all 0.3s ease;
            overflow: hidden;
        }
        
        .body-no-scroll-nexbook {
            overflow: hidden !important;
            position: fixed;
            width: 100%;
            height: 100%;
        }
        
        .modal-visible-nexbook {
            opacity: 1;
            visibility: visible;
            pointer-events: auto;
            background: rgba(0, 0, 0, 0.45); /* Darken backdrop so modal doesn't appear white */
        }
        
        .modal-visible-nexbook .modal-content-nexbook {
            opacity: 1;
            visibility: visible;
            transform: translate(-50%, -50%) scale(1);
        }
        
        .history-li-nexbook {
            opacity: 0;
            transform: translateY(10px);
        }
        
        .modal-visible-nexbook .history-li-nexbook {
            animation: fadeInUpNexbook 0.5s ease-out forwards;
        }
        
        @keyframes fadeInUpNexbook {
            from {
                opacity: 0;
                transform: translateY(10px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        /* Loader for Avatar Upload */
        .loader-nexbook {
            border: 3px solid rgba(156, 163, 175, 0.3); 
            border-top-color: #000; 
            border-radius: 50%;
            width: 24px;
            height: 24px;
            animation: spin-nexbook 1s linear infinite;
            position: absolute;
            top: 50%;
            left: 50%;
            margin-top: -12px;
            margin-left: -12px;
            z-index: 10;
        }
        
        @keyframes spin-nexbook {
            to { transform: rotate(360deg); }
        }
        
        .loader-hidden-nexbook {
        }
        
        .uploading-image-nexbook {
            opacity: 0.5; 
        }

/* ---- Moved from index.html style block #6 ---- */
/* Custom Utilities */
        body {
            background-color: #000;
            color: #fff;
            overflow-x: hidden;
        }
        /* Updated Navbar to be Transparent */
        .glass-nav {
            background: transparent;
            backdrop-filter: none;
            -webkit-backdrop-filter: none;
            border-bottom: none;
        }
        /* Smooth reveal transition */
        #hidden-content {
            transition: opacity 1s ease-in-out;
        }

/* ---- Moved from index.html style block #7 ---- */
/* 1. Chat Window ko thoda neeche karein taaki Lightbox upar aa sake */
    #thinkly-ai-hero #expandedView {
        z-index: 2000000000 !important; /* Reduced from Max Int */
    }

    /* 2. Lightbox ko Sabse Upar karein */
    .image-lightbox {
        z-index: 2147483647 !important; /* Max Safe Integer */
        background: rgba(0, 0, 0, 0.95) !important;
        justify-content: center;
        align-items: center;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    .image-lightbox.active {
        display: flex;
        opacity: 1;
    }

    /* 3. IMAGE LOCK (NO BLUR) */
    #thinkly-ai-hero .image-gen-card {
        pointer-events: none !important; /* Default: Locked */
        cursor: wait !important;
        opacity: 0.7; /* Thoda transparent taaki pata chale loading hai */
        transition: opacity 0.3s ease;
        position: relative;
        filter: none !important; /* Blur hata diya gaya hai */
        z-index: 10;
    }

    /* Jab Load Ho Jaye */
    #thinkly-ai-hero .image-gen-card.ready {
        pointer-events: auto !important; /* Unlocked */
        cursor: pointer !important;
        opacity: 1; /* Full Visible */
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        transform: scale(1);
    }

    #thinkly-ai-hero .image-gen-card.ready:active {
        transform: scale(0.98);
    }

    /* 4. MENU & DROPDOWN FIXES */

    /* 3-Dot Menu Always Visible */
    .history-menu-btn {
        opacity: 1 !important; /* Hamesha dikhega */
        background-color: #f3f4f6; /* Thoda highlight */
        padding: 6px;
        border-radius: 6px;
    }

    /* Dropdown / Attachment Menu - Force Open UPWARDS */
    #thinkly-ai-hero .attachment-dropdown {
        display: none;
        bottom: 100% !important; /* Input ke upar */
        top: auto !important;
        margin-bottom: 12px;
        left: 0;
        z-index: 2147483647 !important; /* Sabse upar */
        background: white;
        border-radius: 12px;
        box-shadow: 0 -5px 20px rgba(0,0,0,0.15); /* Shadow upar ki taraf */
    }

    /* Image Settings Dropdown (Chip Menu) */
    #expandedImageSettingsDropdown {
        position: absolute;
        bottom: 100%;
        left: 0;
        margin-bottom: 8px;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        border: 1px solid #e5e7eb;
        box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
        border-radius: 16px;
        padding: 12px;
        width: 260px;
        z-index: 2147483650 !important; /* Chip ke upar */
    }

    #thinkly-ai-hero .attachment-dropdown.show {
        display: block !important;
        animation: slideUpFade 0.2s ease-out;
    }

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

/* ---- Moved from index.html style block #8 ---- */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.animate-fadeIn {
  animation: fadeIn 0.25s ease-out;
}

/* ---- Moved from index.html style block #9 ---- */
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.85) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* --- GLOBAL INSTANT TAP FIX --- */
button, a, .freebook-action-btn, [id$="Btn"] {
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
}
/* ========================================== */
/* 🔐 AUTH MODAL - Always on top              */
/* ========================================== */
#authModal {
    z-index: 100020 !important;
}

/* 📋 Dashboard Sub-modals stack above dashboard */
#myOrdersModal,
#myBackpackModal,
#settingsModal,
#feedbackModal,
#joinUsModal {
    z-index: 100015 !important;
}

/* ✏️ Edit Profile modal - always on top */
#editProfileModal {
    z-index: 100015 !important;
}

/* ========================================== */
/* 💬 AI Message Content — Gemini Style       */
/* ========================================== */
.ai-message-content {
    line-height: 1.65;
    color: #374151;
    word-break: break-word;
}
.ai-message-content strong, .ai-message-content b {
    font-weight: 700;
}
.ai-message-content em, .ai-message-content i { font-style: italic; }
.ai-message-content h1,.ai-message-content h2,.ai-message-content h3 {
}
.ai-message-content h1 { font-size: 1.25em; }
.ai-message-content h2 { font-size: 1.1em; }
.ai-message-content h3 { font-size: 1em; }
.ai-message-content ul {
    list-style-type: disc;
    margin: 0.4em 0 0.4em 1.4rem;
    padding: 0;
}
.ai-message-content ol {
    list-style-type: decimal;
    margin: 0.4em 0 0.4em 1.4rem;
    padding: 0;
}
.ai-message-content li { margin-bottom: 0.2em; }
.ai-message-content p { margin: 0.5em 0; }
.ai-message-content code {
    font-family: 'Courier New', monospace;
    background: #f3f4f6;
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 0.88em;
    color: #1d4ed8;
}
.ai-message-content pre {
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 10px;
    padding: 14px 16px;
    overflow-x: auto;
    font-size: 0.84em;
    margin: 0.6em 0;
}
.ai-message-content pre code {
    background: none;
    color: inherit;
    padding: 0;
    font-size: inherit;
}
.ai-message-content blockquote {
    border-left: 3px solid #000000;
    padding-left: 12px;
    color: #6b7280;
    margin: 0.5em 0;
    font-style: italic;
}
/* Gemini-style scrollable table */
.ai-message-content .ai-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0.75em 0;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
}
.ai-message-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    min-width: 420px;
}
.ai-message-content th, .ai-message-content td {
    border: 1px solid #d1d5db;
    padding: 8px 12px;
    text-align: left;
    white-space: nowrap;
}
.ai-message-content th {
    background: #f3f4f6;
    font-weight: 700;
    position: sticky;
    top: 0;
}
}
        .font-display {
            font-family: 'Space Grotesk', sans-serif;
        }
        
        /* Auto Morphing Liquid Orbs */
        @keyframes morph {
            0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
            50% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
        }
        .animate-morph {
            animation: morph 6s ease-in-out infinite alternate;
        }

        /* Continuous Text Gradient Flow */
        @keyframes text-shine {
            to { background-position: 200% center; }
        }
        .animate-text-shine {
            background-size: 200% auto;
            animation: text-shine 3s linear infinite;
        }

        /* Auto Glare Sweep for Mobile */
        @keyframes auto-glare {
            0%, 20% { left: -100%; opacity: 0; }
            50% { opacity: 1; }
            80%, 100% { left: 200%; opacity: 0; }
        }
        .glare-effect {
            position: absolute;
            top: 0; left: -100%;
            width: 50%; height: 100%;
            background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.6) 50%, rgba(255,255,255,0) 100%);
            transform: skewX(-20deg);
            animation: auto-glare 5s ease-in-out infinite;
        }

        /* Gentle Float for Mobile */
        @keyframes gentle-float {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-4px); }
        }
        .animate-float-mobile {
            animation: gentle-float 6s ease-in-out infinite;
        }

        /* Tiny Stars Twinkle */
        @keyframes twinkle {
            0%, 100% { transform: scale(0.3) rotate(0deg) translateY(0); opacity: 0; }
            50% { transform: scale(1) rotate(15deg) translateY(-4px); opacity: 1; }
        }
        .animate-twinkle { animation: twinkle 2.5s ease-in-out infinite; }
        .animate-twinkle-delay-1 { animation: twinkle 3s ease-in-out infinite 0.7s; }
        .animate-twinkle-delay-2 { animation: twinkle 2.8s ease-in-out infinite 1.4s; }

        /* 3D Transform Utilities for Desktop */
        @media (hover: hover) and (pointer: fine) {
            .preserve-3d { transform-style: preserve-3d; }
            .translate-z-50 { transform: translateZ(25px); }
            .translate-z-30 { transform: translateZ(15px); }
            .translate-z-20 { transform: translateZ(10px); }
            .animate-float-mobile { animation: none; }
        }
        .font-display {
            font-family: 'Space Grotesk', sans-serif;
        }
        
        /* Auto Morphing Liquid Orbs */
        @keyframes morph {
            0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
            50% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
        }
        .animate-morph {
            animation: morph 6s ease-in-out infinite alternate;
        }

        /* Continuous Text Gradient Flow */
        @keyframes text-shine {
            to { background-position: 200% center; }
        }
        .animate-text-shine {
            background-size: 200% auto;
            animation: text-shine 3s linear infinite;
        }

        /* Auto Glare Sweep for Mobile */
        @keyframes auto-glare {
            0%, 20% { left: -100%; opacity: 0; }
            50% { opacity: 1; }
            80%, 100% { left: 200%; opacity: 0; }
        }
        .glare-effect {
            position: absolute;
            top: 0; left: -100%;
            width: 50%; height: 100%;
            background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.6) 50%, rgba(255,255,255,0) 100%);
            transform: skewX(-20deg);
            animation: auto-glare 5s ease-in-out infinite;
        }

        /* Gentle Float for Mobile */
        @keyframes gentle-float {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-4px); }
        }
        .animate-float-mobile {
            animation: gentle-float 6s ease-in-out infinite;
        }

        /* Tiny Stars Twinkle */
        @keyframes twinkle {
            0%, 100% { transform: scale(0.3) rotate(0deg) translateY(0); opacity: 0; }
            50% { transform: scale(1) rotate(15deg) translateY(-4px); opacity: 1; }
        }
        .animate-twinkle { animation: twinkle 2.5s ease-in-out infinite; }
        .animate-twinkle-delay-1 { animation: twinkle 3s ease-in-out infinite 0.7s; }
        .animate-twinkle-delay-2 { animation: twinkle 2.8s ease-in-out infinite 1.4s; }

        /* 3D Transform Utilities for Desktop */
        @media (hover: hover) and (pointer: fine) {
            .preserve-3d { transform-style: preserve-3d; }
            .translate-z-50 { transform: translateZ(25px); }
            .translate-z-30 { transform: translateZ(15px); }
            .translate-z-20 { transform: translateZ(10px); }
            .animate-float-mobile { animation: none; }
        }
