/* Marquee speed override */
.animate-marquee { animation-duration: 35s !important; }

/* ---- Moved from index.html style block #1 ---- */
/* ================= Apple-Style Scrolling ================= */
        html {
            min-height: 100%;
            scroll-behavior: auto;
            scrollbar-gutter: stable;
            -webkit-overflow-scrolling: touch;
        }

        body {
            min-height: 100%;
            overflow-x: hidden;
            -webkit-overflow-scrolling: touch;
            overscroll-behavior-y: none;
        }

        /* 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 {
            height: auto;
        }
        body {
            overflow-x: hidden;
            height: auto;
            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 {
            overflow: visible !important;
        }

        #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 */
        }
        /* Show only 4 cards by default across all sections, rest hidden until expanded */
        #course-selection-container-wrapper:not([data-expanded="true"]) > .grid > *:nth-child(n+5),
        .expandable-grid-wrapper:not([data-expanded="true"]) > .grid > *:nth-child(n+5),
        .expandable-content-wrapper:not([data-expanded="true"]) > .grid > *:nth-child(n+5) {
            display: none !important;
        }
        #about-us-expandable-wrapper:not([data-expanded="true"]) {
            max-height: 0;
        }
        .rules-collapsible-button[aria-expanded="true"] svg {
            transform: rotate(180deg);
        }

/* ========================================================= */
/* Scroll & Rendering Performance Optimizations */
/* ========================================================= */

/* Defer rendering of off-screen sections to free up main thread during load */
#free-books,
#browse-courses,
#college-essentials,
#academy-x,
#study-material,
#how-it-works,
#gamification,
#safety,
#join,
#about-us {
    content-visibility: auto;
    contain-intrinsic-size: auto 800px;
}

/* Promote fixed/sticky elements to their own compositor layer to avoid repaints during scroll */
#navbarI, .mobile-nav-container {
    will-change: transform;
    backface-visibility: hidden;
}

/* Ensure images decode off-thread and don't block the compositor during fast scroll */
img[loading="lazy"] {
    decoding: async;
}

        /* --- 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;
        }
        .mobile-academyx-glow { }
        
        /* Counter Animation Styles */
        .counter-number {
            display: inline-block;
            font-weight: bold;
            transition: all 0.3s ease;
        }
        
        .scroll-reveal {
            opacity: 0;
            transform: translateY(30px) translateZ(0);
            transition: opacity 0.6s ease-out, transform 0.6s ease-out;
            transition-delay: 0.2s;
            will-change: opacity, transform;
        }
        .scroll-reveal.visible {
            opacity: 1;
            transform: translateY(0) translateZ(0);
            will-change: auto;
        }
        
        /* 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;
            align-self: start;
        }
        .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;
        }
        .course-card {
            align-self: start;
        }
        .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 (NO JUMP) --- */
        body.modal-open {
            overflow: hidden !important;
            overscroll-behavior: none;
        }
        .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: 80rem; }
            #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 (2 rows * 2 cols) */
            @media (min-width: 1024px) {
                #course-selection-container-wrapper:not([data-expanded="true"]) { max-height: 36rem !important; }
                #study-material-wrapper:not([data-expanded="true"]) { max-height: 48rem !important; } /* 2 Rows (will show 8 but CSS nth-child restricts to 6 if we want, but height for 2 rows is ~48rem) */
                #platforms-wrapper:not([data-expanded="true"]) { max-height: 54rem !important; } /* 3 Rows * 3 Cols (up to 9 boxes height) */
                #ai-courses-wrapper:not([data-expanded="true"]) { max-height: 57rem !important; } /* 3 Rows * 2 Cols */
                #universities-wrapper:not([data-expanded="true"]) { max-height: 34rem !important; } /* 2 Rows * 5 Cols */
                #subjects-wrapper:not([data-expanded="true"]) { max-height: 36rem !important; } /* 2 Rows * 4 Cols */
                .expandable-grid-wrapper:not([data-expanded="true"]) { max-height: 54rem !important; }
                
                /* Hard limit to EXACTLY 4 cards visually on desktop */
                .expandable-content-wrapper:not([data-expanded="true"]) > .grid > *:nth-child(n+5),
                .expandable-grid-wrapper:not([data-expanded="true"]) > .grid > *:nth-child(n+5),
                #course-selection-container:not([data-expanded="true"]) > *:nth-child(n+5) {
                    display: none !important;
                    opacity: 0 !important;
                    visibility: hidden !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: 10px;
            left: 50%;
            transform: translateX(-50%);
            width: calc(100% - 16px);
            max-width: 420px;
            z-index: 50;
            background: rgba(253, 251, 246, 0.96);
            backdrop-filter: blur(22px) saturate(1.6);
            -webkit-backdrop-filter: blur(22px) saturate(1.6);
            border: 1px solid rgba(17, 17, 16, 0.08);
            border-radius: 28px;
            box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.9);
            opacity: 0;
            animation: cinematic-reveal-mobile 0.25s ease forwards;
            transition: bottom 0.25s cubic-bezier(0.22, 1, 0.36, 1);
        }

        .mobile-nav-container.hidden {
            opacity: 0 !important;
            pointer-events: none;
        }

        .mobile-nav-container.nav-hidden {
            opacity: 1 !important;
            pointer-events: auto;
        }

        @keyframes cinematic-reveal-mobile {
            to { opacity: 1; }
        }

        .mobile-nav-bg {
            display: none;
        }
 
        .mobile-nav-item {
            transition: transform 0.2s var(--ease-out-quart);
            -webkit-tap-highlight-color: transparent;
            outline: none;
        }

        .mobile-nav-item:active {
            transform: scale(0.9);
        }

        .nex-button-raised:active {
            transform: scale(0.92);
        }
 
        .mobile-nav-item .icon-wrapper {
            position: relative;
            -webkit-tap-highlight-color: transparent;
        }
        .mobile-nav-container, .mobile-nav-container * {
            -webkit-tap-highlight-color: transparent;
        }
 
        .mobile-nav-item:active .icon-glow {
            display: none;
        }
        
        .mobile-nav-item:active svg {
        }
 
        .icon-glow {
            display: none;
        }
        
        .nex-button-raised {
            transform: none;
            transition: transform 0.2s 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: 12px 16px; border-radius: 20px; max-width: 85%; width: fit-content; word-wrap: break-word; overflow-wrap: break-word; opacity: 1 !important; }
        #thinkly-ai-hero .user-message { background-color: #1a1a1a; color: white; align-self: flex-end; border-bottom-right-radius: 6px; max-width: min(85%, 32rem) !important; font-size: 0.95rem; }
        #thinkly-ai-hero .ai-message { background-color: #f9faff !important; background-image: repeating-linear-gradient(0deg, transparent 0px, transparent 24px, rgba(120,158,230,0.18) 24px, rgba(120,158,230,0.18) 25px) !important; background-position: 0 12px !important; color: #1d1d1f; align-self: flex-start; border-bottom-left-radius: 6px; border: none !important; border-left: 2px solid rgba(100,140,220,0.22) !important; box-shadow: none !important; line-height: 1.65; max-width: min(96%, 54rem) !important; padding: 12px 16px 12px 14px !important; font-size: 0.95rem; border-radius: 2px 18px 18px 2px !important; }
        #thinkly-ai-hero .ai-message::before { display: none !important; }
        
        /* 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: nowrap;
            gap: 8px;
            margin-top: 0;
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
            scrollbar-width: none;
        }
        #thinkly-ai-hero .ai-response-pills::-webkit-scrollbar { display: none; }
        #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;
            flex-shrink: 0;
            white-space: nowrap;
        }
        #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: #fbfbfa;
            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: none; flex-shrink: 0; position: sticky; top: 0; z-index: 2147483664 !important; background: #fbfbfa; }
        #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: fixed;
            inset: 0;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 2147483644 !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: fixed;
            top: 0;
            left: 0;
            height: 100dvh;
            min-height: 100dvh;
            max-height: 100dvh;
            width: 280px;
            background: #fdf6e8;
            box-shadow: 4px 0 24px rgba(0,0,0,0.12);
            z-index: 2147483645 !important;
            transform: translateX(-100%);
            transition: transform 0.3s ease-in-out;
            overflow-y: auto;
            border-radius: 0 20px 20px 0;
        }
        #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 #expandedView {
            isolation: isolate;
        }
        #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: none;
            position: relative;
            z-index: 2 !important;
            background: #fbfbfa;
            flex-shrink: 0; /* Never shrink - stays at bottom */
        }
        #thinkly-ai-hero .expanded-input-area .input-area,
        #thinkly-ai-hero .expanded-input-area .thinkly-input-bar {
            position: relative;
            z-index: 2 !important;
        }
        #thinkly-ai-hero.thinkly-sidebar-open .expanded-input-area,
        #thinkly-ai-hero.thinkly-sidebar-open .expanded-input-area .input-area,
        #thinkly-ai-hero.thinkly-sidebar-open .expanded-input-area .thinkly-input-bar,
        #thinkly-ai-hero.thinkly-sidebar-open #expandedQuickPills,
        #thinkly-ai-hero.thinkly-sidebar-open #expandedPremiumMenu,
        #thinkly-ai-hero.thinkly-sidebar-open #expandedChatOutput {
            z-index: 1 !important;
            transform: none !important;
        }
        @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); } }

        /* Hide Thinkly AI visually when any modal is open — no display:none to preserve flow */
        body.modal-open #thinkly-ai-hero {
            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: brightness(0) invert(1) 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 */

        /* Hide elements visually when modal is open — no display:none to preserve flow */
        body.modal-open #thinkly-ai-hero,
        body.modal-open .AgWCw,
        body.modal-open #searchBarWrapper {
            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: #fbfbfa;
            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) */
        #thinkly-ai-hero .expanded-header {
            flex-shrink: 0;
            position: sticky;
            top: 0;
            z-index: 10;
            background: #fbfbfa;
            border-bottom: none;
        }

        /* 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: calc(var(--thinkly-input-reserve, 118px) + env(safe-area-inset-bottom));
            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: #fbfbfa;
            border-top: none;
            padding: 10px 16px;
            padding-bottom: max(10px, env(safe-area-inset-bottom));
            width: 100%;
            position: fixed;
            left: 0;
            right: 0;
            bottom: var(--thinkly-keyboard-offset, 0px);
            z-index: 14 !important;
            pointer-events: auto;
        }

        /* 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;
        }

        html.thinkly-keyboard-open,
        body.thinkly-keyboard-open {
            overflow: hidden !important;
            overscroll-behavior: none !important;
        }

        body.thinkly-keyboard-open {
            touch-action: none;
        }

        body.thinkly-keyboard-open #expandedChatOutput {
            touch-action: pan-y;
        }

        /* 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: 100dvh;
    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: #fbfbfa;
}

/* 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: #fbfbfa !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: #fbfbfa !important;
    z-index: 50 !important;
    border-bottom: none !important;
}

/* 2. Chat area beech mein scroll karega */
#expandedChatOutput {
    flex-grow: 1 !important;
    height: 0 !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    padding: 20px 16px !important;
    padding-bottom: calc(var(--thinkly-input-reserve, 118px) + env(safe-area-inset-bottom) + 16px) !important;
    scroll-behavior: smooth;
}

/* 3. Input area bottom par rahega - ALWAYS VISIBLE */
.expanded-input-area {
    flex-shrink: 0 !important;
    width: 100%;
    background: #fbfbfa;
    padding-bottom: env(safe-area-inset-bottom);
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--thinkly-keyboard-offset, 0px);
    z-index: 14 !important;
    box-shadow: none;
}

/* 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 {
            display: none !important;
        }
        
        .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; }
        }

/* ============================================= */
/* 🔥 NEW THINKLY AI PREMIUM CHAT BAR STYLES    */
/* ============================================= */

/* Apple Springs & Easings */
#thinkly-ai-hero {
    --spring-gentle: 0.5s cubic-bezier(0.32, 0.72, 0, 1);
    --spring-bouncy: 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out: 0.3s cubic-bezier(0.21, 0.85, 0.32, 1);
    --menu-bg: #ffffff;
    --menu-text: #1d1d1f;
    --menu-icon: #86868b;
    --menu-icon-active: #000000;
    --menu-shadow: 0 12px 48px rgba(0, 0, 0, 0.3);
}

/* Feature Chips Area */
.thinkly-chip-track {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    align-items: stretch;
    z-index: 5;
    pointer-events: auto;
    margin-bottom: 8px;
}

.thinkly-chip-track:empty {
    min-height: 0;
    margin-bottom: 0;
}

.thinkly-premium-chip {
    align-self: flex-start;
    pointer-events: auto;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 99px;
    padding: 8px 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #111827;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: thinklyChipEnter 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    transform-origin: bottom left;
}

@keyframes thinklyChipEnter {
    0% {
        opacity: 0;
        transform: translateY(15px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.thinkly-premium-chip svg {
    width: 16px;
    height: 16px;
    color: #86868b;
}

.thinkly-chip-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #f3f4f6;
    cursor: pointer;
    transition: background 0.2s;
    margin-left: 2px;
    color: #111827;
}

@media (hover: hover) {
    .thinkly-chip-close:hover {
        background: #e5e7eb;
    }
}

.thinkly-chip-close:active {
    background: #d1d5db;
    transform: scale(0.95);
}

.thinkly-chip-close svg {
    width: 12px;
    height: 12px;
    stroke-width: 2.5;
    stroke: currentColor;
}

.thinkly-autofill-decoy {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    left: -9999px;
    top: auto;
}

.thinkly-autofill-decoy input {
    width: 1px;
    height: 1px;
    border: 0;
    padding: 0;
}

.thinkly-composer-preview {
    position: relative;
    width: 100%;
    max-width: 100%;
    animation: thinklyComposerPreviewEnter 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.thinkly-attachment-card {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    background: #ffffff;
    border: 1px solid rgba(203, 213, 225, 0.92);
    border-radius: 20px;
    padding: 12px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.thinkly-attachment-card.is-composer {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.thinkly-attachment-card.is-processing {
    border-color: rgba(96, 165, 250, 0.38);
    box-shadow: 0 12px 32px rgba(59, 130, 246, 0.12);
}

.thinkly-attachment-card.is-message {
    max-width: min(100%, 360px);
}

.thinkly-attachment-thumb {
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    border-radius: 16px;
    overflow: hidden;
    background: #e8f1ff;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.18);
}

.thinkly-attachment-card.is-message .thinkly-attachment-thumb {
    width: 88px;
    height: 88px;
    flex-basis: 88px;
}

.thinkly-attachment-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.thinkly-file-icon {
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
    color: #2563eb;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.thinkly-file-icon svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
}

.thinkly-attachment-copy {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.thinkly-attachment-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.thinkly-attachment-name {
    min-width: 0;
    font-size: 14px;
    line-height: 1.3;
    font-weight: 700;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thinkly-attachment-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: 12px;
    color: #64748b;
}

.thinkly-attachment-size {
    white-space: nowrap;
}

.thinkly-attachment-status {
    white-space: nowrap;
}

.thinkly-attachment-progress {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: rgba(191, 219, 254, 0.55);
    overflow: hidden;
}

.thinkly-attachment-progress span {
    display: block;
    width: 42%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.2) 0%, rgba(59, 130, 246, 0.95) 48%, rgba(96, 165, 250, 0.2) 100%);
    animation: thinklyAttachmentProgress 1.1s linear infinite;
}

.thinkly-attachment-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #111827;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.12);
}

.thinkly-attachment-remove svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2.4;
}

.thinkly-user-text {
    line-height: 1.45;
}

#thinkly-ai-hero .user-message:has(.thinkly-attachment-card) {
    background: transparent;
    padding: 0;
    box-shadow: none;
    border: none;
    max-width: min(92%, 24rem) !important;
}

#thinkly-ai-hero .user-message:has(.thinkly-attachment-card) .thinkly-user-text {
    margin-top: 10px;
    background: #007aff;
    color: #ffffff;
    padding: 10px 14px;
    border-radius: 16px;
    border-bottom-right-radius: 6px;
}

#thinkly-ai-hero .chat-message:has(.thinkly-attachment-card) {
    overflow: visible;
}

.thinkly-attachment-flight {
    margin: 0;
    z-index: 2147483647;
    pointer-events: none;
    transform-origin: top left;
}

.thinkly-attachment-arrive {
    animation: thinklyAttachmentArrive 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes thinklyComposerPreviewEnter {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes thinklyAttachmentProgress {
    0% {
        transform: translateX(-120%);
    }
    100% {
        transform: translateX(260%);
    }
}

@keyframes thinklyAttachmentArrive {
    0% {
        opacity: 0;
        transform: scale(0.96);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* The Main Input Bar */
.thinkly-input-bar {
    display: flex;
    align-items: center;
    background-color: #f4f4f5;
    border-radius: 32px;
    padding: 8px;
    position: relative;
    z-index: 10;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s cubic-bezier(0.21, 0.85, 0.32, 1);
    width: 100%;
}

.thinkly-plus-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background-color: #ffffff;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #374151;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.2s;
    flex-shrink: 0;
    position: relative;
}

@media (hover: hover) {
    .thinkly-plus-btn:hover {
        background-color: #f5f5f7;
    }
}

.thinkly-plus-btn:active {
    transform: scale(0.92);
    background-color: #e5e7eb;
}

.thinkly-plus-btn.active {
    transform: rotate(45deg);
    background-color: #e5e7eb;
    color: #000;
}

.thinkly-input-core {
    flex: 1;
    position: relative;
    min-height: 42px;
    height: auto;
    display: flex;
    align-items: flex-end;
    margin: 0 16px;
    overflow: visible;
}

.thinkly-chat-input {
    width: 100%;
    min-height: 22px;
    max-height: 120px;
    background: transparent;
    border: none;
    outline: none;
    padding: 10px 0;
    font-size: 16px !important;
    line-height: 22px;
    color: #111827;
    transition: opacity 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    resize: none;
    overflow-x: hidden;
    overflow-y: auto;
    appearance: none;
    -webkit-appearance: none;
    scrollbar-width: none;
}

.thinkly-chat-input::-webkit-scrollbar {
    display: none;
}

.thinkly-chat-input::-webkit-contacts-auto-fill-button,
.thinkly-chat-input::-webkit-credentials-auto-fill-button,
.thinkly-chat-input::-webkit-textfield-decoration-container,
.thinkly-chat-input::-webkit-search-decoration,
.thinkly-chat-input::-webkit-search-cancel-button {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.thinkly-chat-input::-ms-reveal,
.thinkly-chat-input::-ms-clear {
    display: none !important;
}

.thinkly-chat-input:-webkit-autofill,
.thinkly-chat-input:-webkit-autofill:hover,
.thinkly-chat-input:-webkit-autofill:focus,
.thinkly-chat-input:-webkit-autofill:active {
    -webkit-text-fill-color: #111827 !important;
    box-shadow: 0 0 0 1000px transparent inset !important;
    -webkit-box-shadow: 0 0 0 1000px transparent inset !important;
    transition: background-color 9999s ease-out 0s !important;
    caret-color: #111827;
}

.thinkly-chat-input::placeholder {
    color: #8e8e93;
    opacity: 1;
}

.thinkly-dictation-waves {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: all 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}

.thinkly-dictation-waves .thinkly-wave {
    width: 4px;
    border-radius: 2px;
    background: linear-gradient(180deg, #0a84ff 0%, #5e5ce6 100%);
    animation: thinklyWaveform 1.2s ease-in-out infinite;
}

.thinkly-dictation-waves .thinkly-wave:nth-child(1) { height: 16px; animation-delay: 0.0s; }
.thinkly-dictation-waves .thinkly-wave:nth-child(2) { height: 26px; animation-delay: 0.1s; }
.thinkly-dictation-waves .thinkly-wave:nth-child(3) { height: 36px; animation-delay: 0.2s; }
.thinkly-dictation-waves .thinkly-wave:nth-child(4) { height: 20px; animation-delay: 0.3s; }
.thinkly-dictation-waves .thinkly-wave:nth-child(5) { height: 30px; animation-delay: 0.4s; }
.thinkly-dictation-waves .thinkly-wave:nth-child(6) { height: 18px; animation-delay: 0.5s; }

@keyframes thinklyWaveform {
    0%, 100% {
        transform: scaleY(0.4);
        opacity: 0.7;
    }
    50% {
        transform: scaleY(1);
        opacity: 1;
    }
}

/* Listening State Classes */
.thinkly-input-core.listening .thinkly-chat-input {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

.thinkly-input-core.listening .thinkly-dictation-waves {
    opacity: 1;
    transform: translateY(0);
}

.thinkly-mic-btn {
    background: transparent;
    border: none;
    color: #86868b;
    cursor: pointer;
    margin-right: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: color 0.2s, transform 0.2s;
    flex-shrink: 0;
}

@media (hover: hover) {
    .thinkly-mic-btn:hover {
        color: #1d1d1f;
    }
}

.thinkly-mic-btn:active {
    transform: scale(0.9);
}

.thinkly-mic-btn.listening {
    color: #ff3b30;
    animation: thinklyPulseGlow 2s infinite ease-in-out;
}

@keyframes thinklyPulseGlow {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 0 0 rgba(255, 59, 48, 0));
    }
    50% {
        transform: scale(1.1);
        filter: drop-shadow(0 0 8px rgba(255, 59, 48, 0.6));
    }
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 0 rgba(255, 59, 48, 0));
    }
}

/* The Custom Send Button Wrapper */
.thinkly-send-btn-wrap {
    width: 42px;
    height: 42px;
    position: relative;
    flex-shrink: 0;
}

.thinkly-send-btn-wrap .OEueve {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: radial-gradient(circle at center, #c3ebff 0%, #90d8ff 100%);
    opacity: 0.5;
    transform: scale(0.95);
    box-shadow: none;
}

.thinkly-send-btn-wrap .emo-send-container {
    width: 24px;
    height: 14px;
    background-color: #111827;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s ease;
}

.thinkly-send-btn-wrap .emo-send-face {
    width: 14px;
    height: 10px;
}

/* State 2: Active when typing */
#thinkly-ai-hero .thinkly-send-btn-wrap.active .OEueve {
    opacity: 1 !important;
    transform: scale(1) !important;
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.4) !important;
    background: #007aff !important; /* Solid bright blue */
}

#thinkly-ai-hero .thinkly-send-btn-wrap.active .emo-send-eye-group path {
    stroke: #ffffff !important; /* White face when active */
}

#thinkly-ai-hero .thinkly-send-btn-wrap.active .emo-send-container {
    transform: scale(1.08);
}

@media (hover: hover) {
    #thinkly-ai-hero .thinkly-send-btn-wrap:hover .OEueve {
        transform: scale(1.05);
    }
}

#thinkly-ai-hero .thinkly-send-btn-wrap:active .OEueve {
    transform: scale(0.92);
}

/* Premium Action Menu */
#thinkly-ai-hero .premium-menu {
    position: absolute;
    bottom: 80px;
    left: 16px;
    background-color: #ffffff;
    border-radius: 24px;
    padding: 8px;
    width: 280px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.9);
    transform-origin: bottom left;
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 9999999 !important;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#thinkly-ai-hero .premium-menu.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

#thinkly-ai-hero .menu-action {
    background: transparent;
    border: none;
    width: 100%;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-radius: 16px;
    color: #1d1d1f;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

#thinkly-ai-hero .menu-action svg {
    color: #86868b;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: color 0.2s;
}

@media (hover: hover) {
    #thinkly-ai-hero .menu-action:hover {
        background-color: rgba(0, 0, 0, 0.04);
    }
    #thinkly-ai-hero .menu-action:hover svg {
        color: #000000;
    }
}

#thinkly-ai-hero .menu-action:active {
    background-color: rgba(0, 0, 0, 0.08);
    transform: scale(0.98);
}

/* Final Thinkly UI tuning */
#thinkly-ai-hero #expandedView .expanded-input-area {
    background: #fbfbfa !important;
    box-shadow: none !important;
    border-top: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
#thinkly-ai-hero #expandedView .expanded-input-area .input-area,
#thinkly-ai-hero #expandedView .thinkly-chip-track {
    background: transparent !important;
    box-shadow: none !important;
    border-top: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

#thinkly-ai-hero #expandedView .thinkly-chip-track {
    margin-bottom: 10px;
}

#thinkly-ai-hero .thinkly-premium-chip {
    background: #ffffff !important;
    box-shadow: none !important;
    filter: none !important;
}

#thinkly-ai-hero .thinkly-chip-close {
    box-shadow: none !important;
}

#thinkly-ai-hero .thinkly-input-bar {
    background: #ffffff;
    box-shadow: 0 0 0 1px rgba(209, 213, 219, 0.75), 0 8px 24px rgba(15, 23, 42, 0.04);
}

#thinkly-ai-hero .thinkly-send-btn-wrap .OEueve,
#thinkly-ai-hero #sendBtn,
#thinkly-ai-hero #expandedSendButton {
    background: radial-gradient(circle at 28% 24%, #f4fbff 0%, #d9f2ff 48%, #aee4ff 100%) !important;
    opacity: 1 !important;
    transform: none !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92), 0 0 0 1px rgba(125, 211, 252, 0.3) !important;
}

#thinkly-ai-hero .thinkly-send-btn-wrap .emo-send-container {
    width: 28px;
    height: 18px;
    border-radius: 999px;
    background: #1a1e24;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

#thinkly-ai-hero .thinkly-send-btn-wrap .emo-send-face {
    width: 16px;
    height: 10px;
}

#thinkly-ai-hero .thinkly-send-btn-wrap.active .OEueve,
#thinkly-ai-hero .thinkly-send-btn-wrap.active #sendBtn,
#thinkly-ai-hero .thinkly-send-btn-wrap.active #expandedSendButton {
    background: radial-gradient(circle at 28% 24%, #b7ebff 0%, #59c0ff 46%, #198fff 100%) !important;
    box-shadow: 0 10px 18px rgba(25, 143, 255, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.26) !important;
}

#thinkly-ai-hero .thinkly-send-btn-wrap.active .emo-send-eye-group path {
    stroke: #bffcff !important;
}

#thinkly-ai-hero .thinkly-send-btn-wrap.active .emo-send-container {
    transform: none !important;
}

#thinkly-ai-hero .thinkly-send-btn-wrap.processing .OEueve {
    opacity: 0.76 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92), 0 0 0 1px rgba(125, 211, 252, 0.24) !important;
}

#thinkly-ai-hero .OEueve.disabled {
    opacity: 1 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92), 0 0 0 1px rgba(125, 211, 252, 0.24) !important;
}

/* Thinkly production UX pass */
#thinkly-ai-hero #expandedView {
    background: linear-gradient(180deg, #fbfcff 0%, #f6f8fb 100%) !important;
    transform: translate3d(0, 0, 0) scale(0.985);
    will-change: height, transform, opacity;
}

#thinkly-ai-hero #expandedView.visible {
    transform: translate3d(0, 0, 0) scale(1) !important;
}

#thinkly-ai-hero #expandedView .expanded-header {
    display: grid !important;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 10px;
    width: calc(100% - 24px);
    margin: max(8px, env(safe-area-inset-top)) 12px 8px;
    padding: 8px;
    min-height: 58px;
    border: none !important;
    border-radius: 24px;
    background: #fbfbfa !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

#thinkly-ai-hero #expandedView .expanded-title {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 0 12px;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0;
}

#thinkly-ai-hero #expandedView .control-button,
#thinkly-ai-hero #expandedView #closeButton {
    width: 42px !important;
    height: 42px !important;
    border-radius: 18px !important;
    border: 1px solid rgba(209, 213, 219, 0.72) !important;
    background: #ffffff !important;
    color: #1f2937 !important;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.96) !important;
    transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.18s ease, box-shadow 0.18s ease !important;
}

@media (hover: hover) {
    #thinkly-ai-hero #expandedView .control-button:hover,
    #thinkly-ai-hero #expandedView #closeButton:hover {
        background: #f8fafc !important;
        box-shadow: 0 10px 22px rgba(15, 23, 42, 0.1), inset 0 1px 0 rgba(255, 255, 255, 1) !important;
        transform: translateY(-1px);
    }
}

#thinkly-ai-hero #expandedView .control-button:active,
#thinkly-ai-hero #expandedView #closeButton:active {
    transform: scale(0.94) !important;
}

#thinkly-ai-hero #expandedView .expanded-input-area {
    transform: translate3d(0, 0, 0) !important;
    will-change: bottom;
    contain: layout style;
}

html.thinkly-keyboard-open #thinkly-ai-hero #expandedView,
html.thinkly-keyboard-transitioning #thinkly-ai-hero #expandedView,
html.thinkly-keyboard-open #thinkly-ai-hero #expandedView .expanded-input-area,
html.thinkly-keyboard-transitioning #thinkly-ai-hero #expandedView .expanded-input-area {
    transition: none !important;
}

#thinkly-ai-hero #expandedQuickPills {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--thinkly-keyboard-offset, 0px) + 74px);
    z-index: 15;
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 6px 16px !important;
    margin: 0 !important;
    background: linear-gradient(to top, rgba(251,251,250,0.98), rgba(251,251,250,0));
}
#thinkly-ai-hero #expandedQuickPills::-webkit-scrollbar { display: none; }
#thinkly-ai-hero #expandedQuickPills .sq-welcome-label { display: none !important; }
#thinkly-ai-hero #expandedQuickPills .ai-pill { flex-shrink: 0; white-space: nowrap; }

#thinkly-ai-hero #expandedPremiumMenu,
#thinkly-ai-hero #premiumMenu,
#thinkly-ai-hero .premium-menu {
    isolation: isolate;
    overflow: hidden;
    background: #ffffff !important;
    background-color: #ffffff !important;
    border: 1px solid rgba(229, 231, 235, 0.98) !important;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.22), 0 0 0 1px rgba(255, 255, 255, 0.9) inset !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    mix-blend-mode: normal !important;
    z-index: 2147483646 !important;
}

#thinkly-ai-hero #expandedPremiumMenu.visible,
#thinkly-ai-hero #premiumMenu.visible,
#thinkly-ai-hero .premium-menu.visible {
    opacity: 1 !important;
    visibility: visible !important;
}

#thinkly-ai-hero #expandedPremiumMenu::before,
#thinkly-ai-hero #premiumMenu::before,
#thinkly-ai-hero .premium-menu::before {
    content: "";
    position: absolute;
    inset: 0;
    background: #ffffff;
    z-index: -1;
}

#thinkly-ai-hero .menu-action {
    background: #ffffff !important;
    opacity: 1 !important;
    color: #111827 !important;
    position: relative;
    z-index: 1;
}

@media (hover: hover) {
    #thinkly-ai-hero .menu-action:hover {
        background: #f3f6fa !important;
    }
}

#thinkly-ai-hero .menu-action:active {
    background: #eaf0f7 !important;
}

#thinkly-ai-hero .thinkly-tts-button {
    transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s ease;
}

#thinkly-ai-hero .thinkly-tts-button:active {
    transform: scale(0.9);
}

#thinkly-ai-hero #thinklySidebar {
    width: min(84vw, 318px) !important;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
    border-right: 1px solid rgba(226, 232, 240, 0.92);
    box-shadow: 18px 0 58px rgba(15, 23, 42, 0.16) !important;
    transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1) !important;
    z-index: 2147483663 !important;
}

#thinkly-ai-hero #thinklySidebarOverlay {
    background: rgba(15, 23, 42, 0.36) !important;
    backdrop-filter: blur(12px) saturate(1.05);
    -webkit-backdrop-filter: blur(12px) saturate(1.05);
    transition: opacity 0.28s ease !important;
    z-index: 2147483662 !important;
}

#thinkly-ai-hero #thinklySidebar > div:first-of-type,
#thinkly-ai-hero #thinklySidebar > div:nth-of-type(2) {
    background: rgba(255, 255, 255, 0.92) !important;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

#thinkly-ai-hero #thinklySidebar button {
    border-radius: 16px !important;
    transition: transform 0.18s ease, background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease !important;
}

#thinkly-ai-hero #thinklySidebar button svg {
    stroke-width: 2.15;
}

@media (hover: hover) {
    #thinkly-ai-hero #thinklySidebar button:hover {
        transform: translateY(-1px);
        box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
    }
}

#thinkly-ai-hero #thinklySidebar button:active {
    transform: scale(0.97);
}

#thinklyHistoryContainer > div {
    border-radius: 18px !important;
    background: rgba(212,160,23,0.08);
    border: 1px solid rgba(212,160,23,0.15) !important;
    box-shadow: 0 4px 16px rgba(212,160,23,0.06);
    transition: transform 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease !important;
}

@media (hover: hover) {
    #thinklyHistoryContainer > div:hover {
        background: rgba(212,160,23,0.14);
        transform: translateY(-1px);
        box-shadow: 0 8px 20px rgba(212,160,23,0.1);
    }
}

#thinkly-ai-hero #thinklyAboutBtn {
    margin: 10px;
    border-radius: 22px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

#thinklyAnalyzerSheetHost {
    position: fixed;
    inset: 0;
    z-index: 2147483667;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease;
}

#thinklyAnalyzerSheetHost.is-open {
    opacity: 1;
    pointer-events: auto;
}

#thinklyAnalyzerSheetHost .thinkly-analyzer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.34);
    backdrop-filter: blur(14px) saturate(1.05);
    -webkit-backdrop-filter: blur(14px) saturate(1.05);
}

#thinklyAnalyzerSheetHost .thinkly-analyzer-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: min(94dvh, 820px);
    max-height: 94dvh;
    background: #f5f5f7;
    border-radius: 30px 30px 0 0;
    overflow: hidden;
    box-shadow: 0 -24px 70px rgba(15, 23, 42, 0.26);
    transform: translate3d(0, 105%, 0);
    transition: transform 0.42s cubic-bezier(0.22, 1.12, 0.32, 1), border-radius 0.3s ease;
    will-change: transform;
}

#thinklyAnalyzerSheetHost.is-open .thinkly-analyzer-panel {
    transform: translate3d(0, 0, 0);
}

#thinklyAnalyzerSheetHost iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: #f5f5f7;
}

#thinklyAnalyzerSheetHost .thinkly-analyzer-close {
    position: absolute;
    top: max(12px, env(safe-area-inset-top));
    right: 14px;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(209, 213, 219, 0.82);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    color: #1d1d1f;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    transition: transform 0.18s ease, background-color 0.18s ease;
}

#thinklyAnalyzerSheetHost .thinkly-analyzer-close svg {
    width: 18px;
    height: 18px;
}

#thinklyAnalyzerSheetHost .thinkly-analyzer-close:active {
    transform: scale(0.92);
}

body.thinkly-analyzer-open {
    overflow: hidden !important;
}

/* Thinkly mobile stability fixes */
#thinkly-ai-hero #expandedView {
    height: var(--thinkly-visible-height, 100dvh) !important;
    min-height: var(--thinkly-visible-height, 100dvh) !important;
    max-height: var(--thinkly-visible-height, 100dvh) !important;
    width: 100vw !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

#thinkly-ai-hero #expandedView .expanded-header {
    flex-shrink: 0 !important;
    position: sticky !important;
    top: 0 !important;
    opacity: 1 !important;
    visibility: visible !important;
}

#thinkly-ai-hero #expandedView #expandedChatOutput {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 16px !important; /* input is not fixed inside expandedView — no reserve needed */
}

/* Hide chat output in welcome mode (when welcome hero is visible) */
#thinklyWelcomeHero:not([style*="display: none"]):not([style*="display:none"]) ~ #expandedChatOutput {
    display: none !important;
    height: 0 !important;
    overflow: hidden !important;
    padding: 0 !important;
}

#thinkly-ai-hero #expandedView .expanded-input-area {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 100% !important;
    flex-shrink: 0 !important;
    padding-bottom: max(8px, env(safe-area-inset-bottom)) !important;
}

#thinkly-ai-hero #expandedView .expanded-input-area .thinkly-input-bar,
#thinkly-ai-hero #expandedView .expanded-input-area .thinkly-input-core {
    width: 100% !important;
}

@media (min-width: 720px) {
    #thinklyAnalyzerSheetHost .thinkly-analyzer-panel {
        width: min(640px, calc(100vw - 32px));
        left: 50%;
        right: auto;
        transform: translate3d(-50%, 105%, 0);
        border-radius: 32px 32px 0 0;
    }

    #thinklyAnalyzerSheetHost.is-open .thinkly-analyzer-panel {
        transform: translate3d(-50%, 0, 0);
    }
}

@media (max-width: 767px) {
    .mobile-nav-container {
        animation: none !important;
        filter: none !important;
        opacity: 1 !important;
        transform: translate(-50%, 0) scale(1) !important;
        transition: transform 0.18s ease, opacity 0.18s ease !important;
        will-change: auto !important;
    }

    .mobile-nav-bg {
        background: rgba(255, 255, 255, 0.97) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        box-shadow: 0 10px 26px rgba(15, 23, 42, 0.12) !important;
    }

    #thinkly-ai-hero #expandedView {
        transform: none !important;
        will-change: auto !important;
    }

    #thinkly-ai-hero #expandedView .expanded-header {
        width: calc(100% - 20px) !important;
        margin: max(6px, env(safe-area-inset-top)) 10px 6px !important;
        padding: 6px 8px !important;
        min-height: 50px !important;
        border-radius: 20px !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        background: #fbfbfa !important;
        box-shadow: none !important;
        border: none !important;
    }

    #thinkly-ai-hero #expandedView .expanded-title {
        padding: 0 6px !important;
        font-size: 0.94rem !important;
    }

    #thinkly-ai-hero #expandedView .control-button,
    #thinkly-ai-hero #expandedView #closeButton {
        width: 36px !important;
        height: 36px !important;
        border-radius: 14px !important;
        box-shadow: none !important;
    }

    #thinklyMenuButton svg,
    #closeButton svg {
        width: 18px !important;
        height: 18px !important;
    }

    #thinkly-ai-hero #thinklySidebar {
        transition: transform 0.16s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
        box-shadow: 12px 0 30px rgba(15, 23, 42, 0.14) !important;
    }

    #thinkly-ai-hero #thinklySidebarOverlay {
        background: rgba(15, 23, 42, 0.28) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        transition: opacity 0.16s ease !important;
    }
}

/* ================= PREMIUM DESIGN POLISH ================= */

/* Eyebrow label above section titles */
.section-eyebrow {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #9ca3af;
    margin-bottom: 0.85rem;
}

/* Tighter, editorial letter-spacing on the big section titles */
#browse-courses h2,
#college-essentials h2,
#academy-x h2,
#study-material h2,
#free-books h2,
#how-it-works h2 {
    letter-spacing: -0.03em;
}

#academy-x-content h3 {
    letter-spacing: -0.02em;
}

/* Premium dark highlight box (AcademyX hero card) */
.premium-highlight-box {
    background:
        radial-gradient(120% 160% at 85% 0%, rgba(99, 102, 241, 0.22) 0%, rgba(99, 102, 241, 0) 45%),
        radial-gradient(120% 160% at 0% 100%, rgba(56, 189, 248, 0.14) 0%, rgba(56, 189, 248, 0) 45%),
        linear-gradient(135deg, #0b0b10 0%, #15151d 60%, #0b0b10 100%);
    border: 1px solid rgba(255, 255, 255, 0.09);
    box-shadow: 0 24px 48px -20px rgba(0, 0, 0, 0.45), 0 4px 12px rgba(0, 0, 0, 0.12);
}

.premium-highlight-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 32px 60px -20px rgba(0, 0, 0, 0.5), 0 6px 16px rgba(0, 0, 0, 0.14);
}

/* Refined card treatment: soft layered shadows, gentle lift (no cheap scale-pop) */
.course-card {
    border: 1px solid rgba(17, 24, 39, 0.06);
    border-radius: 1rem;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
}

.course-card:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 16px 32px -12px rgba(16, 24, 40, 0.14), 0 4px 8px rgba(16, 24, 40, 0.05) !important;
}

.course-major-item > div {
    border-radius: 1.25rem;
    box-shadow: 0 2px 4px rgba(16, 24, 40, 0.05), 0 8px 20px -8px rgba(16, 24, 40, 0.1);
}

.course-major-item:hover > div {
    box-shadow: 0 20px 40px -16px rgba(16, 24, 40, 0.22), 0 6px 12px rgba(16, 24, 40, 0.06);
}

#study-material-grid > * {
    box-shadow: 0 2px 4px rgba(16, 24, 40, 0.05), 0 8px 20px -8px rgba(16, 24, 40, 0.1);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#study-material-grid > *:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px -16px rgba(16, 24, 40, 0.22), 0 6px 12px rgba(16, 24, 40, 0.06);
}

/* View more buttons: clean white pill, quiet and expensive */
.view-toggle-btn:not(.bg-black) {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}

.view-toggle-btn:not(.bg-black):hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
    color: #000;
}

/* ─── Thinkly Welcome Hero ─── */
#expandedView #thinklyWelcomeHero ~ .nb-tw,
#expandedView #thinklyWelcomeHero ~ .nb-empty-emo,
#expandedView #thinklyWelcomeHero ~ .nb-suggest { display: none !important; }
#thinklyWelcomeHero { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.taw { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 28px; }
.taw__top { display: flex; align-items: center; gap: 16px; }
.taw__text { flex: 1; min-width: 0; }
.taw__h { font: 800 clamp(1.6rem, 4vw, 2.4rem)/1.15 var(--font-display, 'Playfair Display', serif); color: #111110; margin: 0 0 10px; }
.taw__sub { font: 400 clamp(0.85rem, 1.8vw, 1rem)/1.5 var(--font-ui, Inter, system-ui); color: #6b6b6b; margin: 0; }
.taw__illust { flex-shrink: 0; width: clamp(160px, 30vw, 280px); }
.taw__svg { width: 100%; height: auto; }
.taw__img { width: 100%; height: auto; border-radius: 16px; object-fit: cover; }

.taw__cats { background: #fdf8ef; border: 1px solid rgba(226,182,75,0.2); border-radius: 20px; padding: 20px; }
.taw__cats-h { font: 700 0.85rem/1 var(--font-ui, Inter, system-ui); color: #333; margin: 0 0 16px; padding-left: 2px; }
.taw__cats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
button.taw__cat { cursor: pointer; -webkit-appearance: none; appearance: none; font-family: inherit; }
.taw__cat { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 14px 6px 12px; background: white; border: 1px solid rgba(226,182,75,0.18); border-radius: 16px; transition: transform 0.2s, box-shadow 0.2s; }
.taw__cat:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(212,160,23,0.12); }
.taw__cat:active { transform: scale(0.96); }
.taw__cat-icon { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; background: #fef9ec; border-radius: 12px; }
.taw__cat strong { font: 700 0.78rem/1.2 var(--font-ui, Inter, system-ui); color: #111; }
.taw__cat span { font: 400 0.65rem/1.3 var(--font-ui, Inter, system-ui); color: #888; }

.taw__suggest { display: none !important; }
.taw__suggest-h { font: 700 0.85rem/1 var(--font-ui, Inter, system-ui); color: #333; margin: 0 0 12px; }
.taw__pills { display: flex; flex-wrap: wrap; gap: 8px; }
.taw__pills .ai-pill { background: #f5f5f5; border: 1px solid #e5e5e5; border-radius: 20px; padding: 8px 16px; font: 500 0.78rem/1 var(--font-ui, Inter, system-ui); color: #444; cursor: pointer; transition: background 0.2s, border-color 0.2s; }
.taw__pills .ai-pill:hover { background: #eee; border-color: #d4a017; }

@media (max-width: 640px) {
    .taw { padding: 12px 16px 0; gap: 16px; }
    .taw__top { flex-direction: column; text-align: center; }
    .taw__illust { width: 200px; order: -1; }
    .taw__img { width: 100%; height: auto; border-radius: 16px; }
    .taw__cats { padding: 14px; border-radius: 16px; }
    .taw__cats-h { margin-bottom: 10px; font-size: 0.8rem; }
    .taw__cats-grid { display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 4px; }
    .taw__cats-grid::-webkit-scrollbar { display: none; }
    .taw__cat { min-width: 100px; flex-shrink: 0; padding: 10px 8px 8px; border-radius: 14px; }
    .taw__cat-icon { width: 36px; height: 36px; border-radius: 10px; }
    .taw__cat-icon svg { width: 22px; height: 22px; }
    .taw__cat strong { font-size: 0.72rem; }
    .taw__cat span { font-size: 0.6rem; }
    .taw__pills { gap: 6px; }
    .taw__pills .ai-pill { padding: 6px 12px; font-size: 0.72rem; }
}

@media (max-width: 380px) {
    .taw__cats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Subjects Hero Section */
.subjects-hero-section {
    position: relative;
    border-radius: 28px;
    overflow: hidden;
    margin-top: 2rem;
}
/* Left + right fade masks — cards appear to continue under a warm veil at the edges */
.subjects-hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
    background:
        linear-gradient(to right,  rgba(248,244,232,0.94) 0%, rgba(248,244,232,0.55) 22px, transparent 58px),
        linear-gradient(to left,   rgba(248,244,232,0.94) 0%, rgba(248,244,232,0.55) 22px, transparent 58px);
}
.subjects-hero-section::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
    background:
        radial-gradient(ellipse 110px 80px at top left, rgba(253,251,246,0.48) 0%, transparent 60%),
        radial-gradient(ellipse 110px 80px at top right, rgba(253,251,246,0.48) 0%, transparent 60%),
        radial-gradient(ellipse 100px 70px at bottom left, rgba(253,251,246,0.38) 0%, transparent 60%),
        radial-gradient(ellipse 100px 70px at bottom right, rgba(253,251,246,0.38) 0%, transparent 60%);
}
.subjects-hero-bg {
    position: absolute;
    inset: 0;
}
.subjects-hero-bg-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.subjects-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(253,248,238,0.08) 0%, rgba(253,248,238,0.02) 40%, rgba(253,248,238,0.06) 100%);
}
.subjects-hero-content {
    position: relative;
    z-index: 2;
    padding: 40px 24px 36px;
}
.subjects-hero-title {
    font: 800 2rem/1.15 var(--font-display, 'Playfair Display', serif);
    color: #111110;
    text-align: center;
    margin: 0 0 8px;
}
.subjects-hero-title::after {
    content: '';
    display: block;
    width: 48px;
    height: 3px;
    background: #d4a017;
    border-radius: 2px;
    margin: 10px auto 20px;
}
.subjects-carousel-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    /* Escape content padding (24px) + section's own padding (20px) = 44px per side */
    margin-left: -44px;
    margin-right: -44px;
    width: calc(100% + 88px);
}
.subjects-carousel-wrap::-webkit-scrollbar { display: none; }
.subjects-carousel {
    display: flex;
    flex-wrap: nowrap;
    gap: 14px;
    /* Small side pad so first/last card clears the section's 28px border-radius corner */
    padding: 10px 8px 14px 8px;
    /* Prevent self-scrolling — wrap is the sole scroller */
    overflow: visible !important;
}
.subjects-card {
    flex: 0 0 234px;
    background: rgba(253,251,246,0.97);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(212,160,23,0.11);
    box-shadow:
        0 3px 18px rgba(17,17,16,0.07),
        0 1px 4px rgba(17,17,16,0.04),
        inset 0 1px 0 rgba(255,255,255,0.95),
        inset 1px 0 0 rgba(255,255,255,0.55),
        inset -1px 0 0 rgba(255,255,255,0.55),
        inset 0 -1px 0 rgba(255,255,255,0.28);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.subjects-card:hover {
    transform: translateY(-5px);
    box-shadow:
        0 14px 38px rgba(17,17,16,0.12),
        0 4px 10px rgba(17,17,16,0.05),
        inset 0 1px 0 rgba(255,255,255,0.98),
        inset 1px 0 0 rgba(255,255,255,0.65),
        inset -1px 0 0 rgba(255,255,255,0.65),
        inset 0 -1px 0 rgba(255,255,255,0.35);
}
.subjects-card-img {
    width: 100%;
    height: 148px;
    object-fit: cover;
    display: block;
    border-bottom: 1px solid rgba(212,160,23,0.07);
}
.subjects-card-body {
    padding: 15px 17px 17px;
}
.subjects-card-name {
    font: 700 1.05rem/1.3 var(--font-display, 'Playfair Display', serif);
    color: #111110;
    margin: 0 0 5px;
}
.subjects-card-desc {
    font: 400 0.78rem/1.52 var(--font-ui, Inter, system-ui);
    color: rgba(17,17,16,0.50);
    margin: 0 0 13px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.subjects-card-btn {
    display: inline-block;
    color: #fdfbf6;
    background: #111110;
    font: 600 0.74rem/1 var(--font-ui, Inter, system-ui);
    padding: 8px 18px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    letter-spacing: 0.015em;
    transition: opacity 0.2s, transform 0.2s;
}
.subjects-card-btn:hover { opacity: 0.87; transform: translateY(-1px); }
.subjects-hero-actions {
    text-align: center;
    margin-top: 24px;
}
.subjects-view-all-btn {
    display: inline-block;
    background: rgba(253,251,246,0.95);
    color: #111110;
    font: 700 0.9rem/1 var(--font-ui, Inter, system-ui);
    padding: 12px 28px;
    border-radius: 12px;
    border: 1px solid rgba(212,160,23,0.2);
    text-decoration: none;
    transition: background 0.2s, transform 0.2s;
}
.subjects-view-all-btn:hover {
    background: rgba(253,251,246,1);
    transform: translateY(-1px);
}
@media (max-width: 640px) {
    .subjects-hero-content { padding: 28px 12px 24px; }
    .subjects-hero-title { font-size: 1.5rem; }
    /* Escape content padding (12px) + section's own padding (20px) = 32px per side on mobile */
    .subjects-carousel-wrap {
        margin-left: -32px;
        margin-right: -32px;
        width: calc(100% + 64px);
    }
    .subjects-carousel { padding: 8px 6px 12px 6px; }
    .subjects-card { flex: 0 0 205px; }
    .subjects-card-img { height: 120px; }
}
