:root {
    /* === Core palette === */
    --color-bg-base: #0a0e1a;
    --color-bg-surface: rgba(15, 23, 42, 0.55);
    --color-bg-elevated: rgba(15, 23, 42, 0.95);
    --color-bg-overlay: rgba(0, 0, 0, 0.7);
    
    /* === Accent colors === */
    --color-primary: #38bdf8;
    --color-primary-hover: #7dd3fc;
    --color-primary-muted: rgba(56, 189, 248, 0.15);
    --color-secondary: #818cf8;
    --color-accent-gold: #fbbf24;
    --color-accent-gold-hover: #fde68a;
    
    /* === Semantic colors === */
    --color-success: #34d399;
    --color-error: #f87171;
    --color-error-hover: #fca5a5;
    --color-warning: #fbbf24;
    
    /* === Text === */
    --color-text-primary: #f0f9ff;
    --color-text-secondary: #e2e8f0;
    --color-text-muted: #94a3b8;
    --color-text-faint: #64748b;
    
    /* === Borders === */
    --color-border-subtle: rgba(255, 255, 255, 0.06);
    --color-border-default: rgba(255, 255, 255, 0.1);
    --color-border-strong: rgba(255, 255, 255, 0.15);
    
    /* === Spacing & Radius === */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 28px;
    
    /* === Transitions === */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
    --duration-fast: 0.2s;
    --duration-normal: 0.3s;
    --duration-slow: 0.5s;
    
    /* === Typography === */
    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { background-color: var(--color-bg-base); scroll-behavior: smooth; }
body { font-family: var(--font-sans); min-height: 100vh; min-height: 100dvh; background-color: var(--color-bg-base); display: flex; align-items: center; justify-content: flex-start; padding: 96px 20px 32px; position: relative; overflow-x: hidden; flex-direction: column; gap: 28px; }

/* === ACCESSIBILITY: SKIP LINK === */
.skip-link {
    position: absolute;
    top: -100px;
    left: 20px;
    background: var(--color-primary);
    color: #070b14;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.9rem;
    z-index: 10000;
    text-decoration: none;
    transition: top var(--duration-fast) ease;
    box-shadow: 0 4px 20px rgba(56, 189, 248, 0.4);
}
.skip-link:focus {
    top: 20px;
}

/* === ACCESSIBILITY: UNIVERSAL FOCUS-VISIBLE INDICATOR === */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px var(--color-primary-muted);
}

/* === TEXT OVERFLOW & BOUNDARY RESILIENCE === */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.break-text {
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

/* === DEEP SPACE BACKGROUND === */
body::before {
    content: ''; position: fixed; inset: 0; z-index: -2;
    background: 
        radial-gradient(ellipse at top, rgba(56, 189, 248, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at bottom-left, rgba(139, 92, 246, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at bottom-right, rgba(6, 182, 212, 0.1) 0%, transparent 50%),
        linear-gradient(180deg, #0a0e1a 0%, #171036 50%, #0a0e1a 100%);
    animation: bgPulse 8s ease-in-out infinite;
}
@keyframes bgPulse {
    0%, 100% { opacity: 0.9; }
    50% { opacity: 1; }
}
        
        /* === MOUSE FOLLOW GLOW EFFECT === */
        body::after {
            content: ''; position: fixed; inset: 0; z-index: -1; opacity: 0.5;
            background: 
                radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), 
                    rgba(56, 189, 248, 0.12), transparent 45%),
                radial-gradient(400px circle at 20% 80%, 
                    rgba(139, 92, 246, 0.08), transparent 40%),
                radial-gradient(350px circle at 80% 20%, 
                    rgba(6, 182, 212, 0.07), transparent 40%),
                radial-gradient(250px circle at 50% 50%, 
                    rgba(251, 191, 36, 0.05), transparent 35%);
            transition: opacity 0.3s ease;
        }

        /* === DYNAMIC FLOATING PARTICLES === */
        .particle {
            position: fixed;
            border-radius: 50%;
            pointer-events: none;
            z-index: -1;
            animation: float linear infinite;
            opacity: 0;
            box-shadow: 0 0 20px currentColor;
        }
        
        /* Different particle sizes and speeds */
        .particle.small {
            width: 4px; height: 4px;
            background: rgba(56, 189, 248, 0.4);
            color: rgba(56, 189, 248, 0.4);
            animation-duration: 15s;
        }
        
        .particle.medium {
            width: 8px; height: 8px;
            background: rgba(139, 92, 246, 0.5);
            color: rgba(139, 92, 246, 0.5);
            animation-duration: 20s;
        }
        
        .particle.large {
            width: 12px; height: 12px;
            background: rgba(6, 182, 212, 0.4);
            color: rgba(6, 182, 212, 0.4);
            animation-duration: 25s;
        }
        
        @keyframes float {
            0% { 
                opacity: 0; 
                transform: translateY(100vh) scale(0) rotate(0deg); 
            }
            10% { opacity: 0.8; }
            50% { transform: translateY(50vh) scale(1.2) rotate(180deg); }
            90% { opacity: 0.8; }
            100% { 
                opacity: 0; 
                transform: translateY(-10vh) scale(0) rotate(360deg); 
            }
        }

        /* === NAVBAR === */
        .navbar {
            position: fixed; top: 0; left: 0; right: 0; z-index: 100;
            background: rgba(10, 14, 26, 0.88);
            backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
            border-bottom: 1px solid var(--color-border-subtle);
            padding: 0 24px;
            height: 56px;
            display: flex; align-items: center; justify-content: space-between;
            box-shadow: 0 4px 24px rgba(0,0,0,0.4);
        }
        .navbar-brand {
            display: flex; align-items: center; gap: 10px;
            font-weight: 700; font-size: 1.05rem; color: var(--color-text-primary);
            letter-spacing: -0.02em; flex-shrink: 0;
        }
        .navbar-brand-icon {
            width: 30px; height: 30px; border-radius: var(--radius-sm);
            object-fit: contain;
        }
        .navbar-links {
            display: flex; align-items: center; gap: 4px;
        }
        .nav-icon {
            width: 15px; height: 15px; flex-shrink: 0;
            stroke: currentColor; fill: none;
            stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
        }
        .nav-link {
            background: transparent; border: none; cursor: pointer;
            padding: 7px 14px; border-radius: 10px;
            font-family: var(--font-sans); font-size: 0.8rem; font-weight: 600;
            color: var(--color-text-muted); transition: all var(--duration-fast) var(--ease-out-expo);
            display: inline-flex; align-items: center; gap: 6px;
            white-space: nowrap; position: relative;
        }
        .nav-link:hover { background: rgba(255, 255, 255, 0.07); color: var(--color-text-secondary); }
        .nav-link.active {
            background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%); color: white;
            box-shadow: 0 2px 12px rgba(56, 189, 248, 0.25);
        }
        .nav-link.active .nav-icon { stroke: white; }
        .nav-link .nav-badge {
            font-size: 0.55rem; padding: 2px 5px; border-radius: 5px;
            background: rgba(52, 211, 153, 0.15); color: var(--color-success);
            font-weight: 700; letter-spacing: 0.04em; line-height: 1;
        }
        .nav-link.active .nav-badge { background: rgba(255, 255, 255, 0.25); color: #ffffff; }

        /* Hamburger toggle (hidden on desktop) */
        .navbar-toggle {
            display: none; background: none; border: none; cursor: pointer;
            padding: 8px; border-radius: 10px; color: var(--color-text-muted);
            transition: all var(--duration-fast);
        }
        .navbar-toggle:hover { background: rgba(255,255,255,0.07); color: var(--color-text-primary); }
        .navbar-toggle svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; }

        /* === AUTH & GOOGLE BUTTONS === */
        .auth-section {
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .btn-google-login {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            background: rgba(255, 255, 255, 0.08);
            border: 1px solid rgba(255, 255, 255, 0.15);
            color: var(--color-text-primary);
            padding: 7px 14px;
            border-radius: var(--radius-md);
            font-family: var(--font-sans);
            font-size: 0.82rem;
            font-weight: 600;
            cursor: pointer;
            transition: all var(--duration-fast) var(--ease-out-expo);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
            white-space: nowrap;
        }
        .btn-google-login:hover {
            background: rgba(255, 255, 255, 0.14);
            border-color: rgba(56, 189, 248, 0.4);
            box-shadow: 0 4px 14px rgba(56, 189, 248, 0.18);
        }
        .btn-google-login .btn-login-text-short { display: none; }

        .btn-google-login-mobile {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            width: 100%;
            background: linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(129, 140, 248, 0.18));
            border: 1px solid rgba(56, 189, 248, 0.35);
            color: #f0f9ff;
            padding: 12px 18px;
            border-radius: var(--radius-md);
            font-family: var(--font-sans);
            font-size: 0.92rem;
            font-weight: 700;
            cursor: pointer;
            transition: all var(--duration-fast) var(--ease-out-expo);
            box-shadow: 0 4px 16px rgba(56, 189, 248, 0.15);
        }
        .btn-google-login-mobile:hover {
            background: linear-gradient(135deg, rgba(56, 189, 248, 0.28), rgba(129, 140, 248, 0.28));
            border-color: rgba(56, 189, 248, 0.55);
        }

        .auth-section-mobile {
            width: 100%;
            padding: 4px 0 8px;
        }
        .mobile-nav-divider {
            height: 1px;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
            margin: 4px 0 8px;
        }

        /* User Menu & Avatar */
        .user-menu {
            position: relative;
            display: flex;
            align-items: center;
        }
        .user-btn {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(255, 255, 255, 0.1);
            padding: 3px 8px 3px 3px;
            border-radius: 100px;
            cursor: pointer;
            transition: all var(--duration-fast);
        }
        .user-btn:hover {
            background: rgba(255, 255, 255, 0.1);
            border-color: rgba(56, 189, 248, 0.3);
        }
        .user-avatar {
            width: 30px;
            height: 30px;
            border-radius: 50%;
            object-fit: cover;
            border: 1px solid rgba(56, 189, 248, 0.4);
        }
        .dropdown-icon {
            width: 13px;
            height: 13px;
            stroke: var(--color-text-muted);
            fill: none;
            stroke-width: 2;
        }

        .user-dropdown {
            position: absolute;
            top: calc(100% + 10px);
            right: 0;
            min-width: 220px;
            background: rgba(15, 23, 42, 0.98);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            border: 1px solid rgba(56, 189, 248, 0.2);
            border-radius: var(--radius-lg);
            padding: 8px;
            box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
            display: none;
            flex-direction: column;
            gap: 4px;
            z-index: 1000;
        }
        .user-dropdown.open {
            display: flex;
            animation: navSlideDown 0.2s ease both;
        }
        .dropdown-header {
            padding: 10px 12px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.06);
            margin-bottom: 4px;
        }
        .user-name { font-weight: 700; font-size: 0.88rem; color: #f8fafc; }
        .user-email { font-size: 0.75rem; color: #94a3b8; margin-top: 2px; }
        .user-plan { font-size: 0.72rem; color: var(--color-primary); font-weight: 600; margin-top: 2px; }

        .dropdown-item {
            display: flex;
            align-items: center;
            gap: 8px;
            width: 100%;
            padding: 10px 12px;
            background: transparent;
            border: none;
            border-radius: var(--radius-sm);
            color: var(--color-text-secondary);
            font-family: var(--font-sans);
            font-size: 0.84rem;
            font-weight: 500;
            cursor: pointer;
            transition: all var(--duration-fast);
        }
        .dropdown-item:hover {
            background: rgba(56, 189, 248, 0.1);
            color: var(--color-primary);
        }
        .dropdown-item svg {
            width: 16px;
            height: 16px;
            stroke: currentColor;
            fill: none;
            stroke-width: 2;
        }
        .dropdown-item.text-danger {
            color: #f87171;
        }
        .dropdown-item.text-danger:hover {
            background: rgba(248, 113, 113, 0.12);
            color: #fca5a5;
        }

        /* Mobile dropdown panel */
        .navbar-mobile-panel {
            display: none;
            position: fixed; top: 56px; left: 0; right: 0; z-index: 99;
            background: rgba(10, 14, 26, 0.98);
            backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px);
            border-bottom: 1px solid var(--color-border-subtle);
            padding: 14px 16px 36px;
            flex-direction: column; gap: 6px;
            box-shadow: 0 16px 48px rgba(0,0,0,0.6);
            animation: navSlideDown var(--duration-normal) var(--ease-out-expo) both;
            max-height: calc(100dvh - 56px);
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
        }
        .navbar-mobile-panel.open { display: flex; }
        @keyframes navSlideDown {
            from { opacity: 0; transform: translateY(-12px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .navbar-mobile-panel .nav-link {
            width: 100%; justify-content: flex-start;
            padding: 12px 16px; border-radius: var(--radius-md); font-size: 0.88rem;
        }
        .navbar-mobile-panel .nav-link .nav-badge { display: inline-flex; }

        @keyframes dropzonePulse {
            0% { transform: scale(1); box-shadow: 0 0 0 rgba(56, 189, 248, 0); }
            50% { transform: scale(1.02); box-shadow: 0 0 35px rgba(56, 189, 248, 0.45); border-color: rgba(56, 189, 248, 0.85); }
            100% { transform: scale(1); box-shadow: 0 0 0 rgba(56, 189, 248, 0); }
        }
        .dropzone-pulse {
            animation: dropzonePulse 1.2s ease-out;
        }

        @media (max-width: 860px) {
            .navbar { padding: 0 14px; gap: 8px; }
            .navbar-links { display: none; }
            .navbar-toggle { display: flex; align-items: center; justify-content: center; }
            .auth-section { display: flex !important; margin-left: auto; }
            .btn-google-login .btn-login-text { display: none; }
            .btn-google-login .btn-login-text-short { display: inline; }
            .btn-google-login { padding: 6px 12px; font-size: 0.78rem; gap: 6px; }
        }
        @media (min-width: 861px) {
            .navbar-mobile-panel { display: none !important; }
        }

        /* === VIEW SWITCHING === */
        .view { display: none; flex-direction: column; align-items: center; gap: 28px; width: 100%; }
        .view.active { display: flex; }

/* === PREMIUM GLASS CARD === */
        .container {
            background: rgba(15, 23, 42, 0.7);
            backdrop-filter: blur(32px) saturate(180%);
            -webkit-backdrop-filter: blur(32px) saturate(180%);
            border-radius: 32px;
            padding: 56px 48px;
            width: 100%;
            max-width: 600px;
            border: 1px solid rgba(255, 255, 255, 0.1);
            box-shadow: 
                0 0 0 1px rgba(255,255,255,0.04),
                0 24px 80px rgba(0, 0, 0, 0.6),
                0 0 140px rgba(56, 189, 248, 0.06),
                inset 0 0 40px rgba(56, 189, 248, 0.03);
            text-align: center;
            position: relative;
            animation: cardAppear 1s cubic-bezier(0.16, 1, 0.3, 1) both;
            overflow: hidden;
        }
        
        /* Subtle gradient overlay for depth */
        .container::before {
            content: '';
            position: absolute;
            inset: 0;
            border-radius: 32px;
            padding: 1px;
            background: linear-gradient(
                135deg,
                rgba(56, 189, 248, 0.2),
                rgba(139, 92, 246, 0.15),
                rgba(56, 189, 248, 0.2)
            );
            background-size: 300% 300%;
            animation: borderFlow 6s ease infinite;
            -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
            -webkit-mask-composite: xor;
            mask-composite: exclude;
            pointer-events: none;
        }
        
        /* Shine effect on hover */
        .container::after {
            content: '';
            position: absolute;
            top: -100%;
            left: -100%;
            width: 300%;
            height: 300%;
            background: linear-gradient(
                45deg,
                transparent,
                rgba(255, 255, 255, 0.03),
                transparent
            );
            transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
            pointer-events: none;
        }
        
        .container:hover::after {
            top: 0;
            left: 0;
        }
        
        @keyframes cardAppear {
            from { 
                opacity: 0; 
                transform: translateY(40px) scale(0.95); 
            }
            to { 
                opacity: 1; 
                transform: translateY(0) scale(1); 
            }
        }
        
        @keyframes borderFlow {
            0%, 100% { background-position: 0% 50%; }
            50% { background-position: 100% 50%; }
        }

/* === ENHANCED LOGO & TITLE === */
        .logo-wrapper { margin-bottom: 8px; }
        .logo-icon {
            width: 64px; height: 64px; margin: 0 auto 20px;
            background: rgba(15, 23, 42, 0.5);
            border: 2px solid rgba(56, 189, 248, 0.3);
            border-radius: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 
                0 12px 32px rgba(0, 0, 0, 0.3),
                0 0 40px rgba(56, 189, 248, 0.2),
                inset 0 2px 8px rgba(56, 189, 248, 0.1);
            animation: logoPulse 4s ease-in-out infinite, logoFloat 6s ease-in-out infinite;
            transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
            position: relative;
        }
        
        /* Glow ring around logo */
        .logo-icon::before {
            content: '';
            position: absolute;
            inset: -8px;
            border-radius: 24px;
            border: 2px solid rgba(56, 189, 248, 0.15);
            animation: ripple 3s ease-in-out infinite;
            pointer-events: none;
        }
        
        .logo-icon:hover {
            transform: scale(1.1) translateY(-4px);
            border-color: rgba(56, 189, 248, 0.5);
            box-shadow: 
                0 16px 48px rgba(0, 0, 0, 0.4),
                0 0 60px rgba(56, 189, 248, 0.3),
                inset 0 2px 12px rgba(56, 189, 248, 0.15);
        }
        
        @keyframes logoPulse {
            0%, 100% { 
                border-color: rgba(56, 189, 248, 0.3);
                box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3), 0 0 40px rgba(56, 189, 248, 0.2); 
            }
            50% { 
                border-color: rgba(56, 189, 248, 0.5);
                box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4), 0 0 60px rgba(56, 189, 248, 0.3); 
            }
        }
        
        @keyframes logoFloat {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-6px); }
        }
        
        @keyframes ripple {
            0%, 100% { 
                opacity: 0.3;
                transform: scale(1); 
            }
            50% { 
                opacity: 0.6;
                transform: scale(1.05); 
            }
        }

        /* === MAIN LOGO IMAGE === */
        .logo-img-main {
            width: 42px;
            height: 42px;
            object-fit: contain;
            mix-blend-mode: screen;
            border-radius: 50%;
        }
        .btn-icon {
            width: 16px;
            height: 16px;
            stroke: currentColor;
            stroke-width: 2.5;
            flex-shrink: 0;
            display: inline-block;
        }
        .notice-icon-svg {
            width: 13px;
            height: 13px;
            stroke: currentColor;
            stroke-width: 2.5;
            vertical-align: -2px;
            margin-right: 6px;
            display: inline-block;
        }
        .success-check-svg {
            width: 30px;
            height: 30px;
            stroke: var(--color-success);
            stroke-width: 2.5;
            display: inline-block;
        }
        h1 {
            font-size: 2.4rem;
            font-weight: 800;
            letter-spacing: -0.03em;
            margin-bottom: 12px;
            background: linear-gradient(135deg, 
                #ffffff 0%, 
                var(--color-text-primary) 25%, 
                var(--color-primary) 50%, 
                var(--color-secondary) 75%, 
                #a78bfa 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            text-shadow: none;
            animation: titleGlow 6s ease-in-out infinite;
            position: relative;
        }
        
        /* Subtle shimmer effect on title */
        h1::after {
            content: '';
            position: absolute;
            bottom: -8px;
            left: 50%;
            transform: translateX(-50%);
            transform-origin: center;
            width: 80%;
            height: 3px;
            background: linear-gradient(90deg, 
                transparent, 
                var(--color-primary), 
                var(--color-secondary), 
                #a78bfa, 
                transparent);
            border-radius: 2px;
            opacity: 0.4;
            animation: titleLinePulse 4s ease-in-out infinite;
        }
        
        @keyframes titleGlow {
            0%, 100% { filter: brightness(1); }
            50% { filter: brightness(1.1); }
        }
        
        @keyframes titleLinePulse {
            0%, 100% { 
                opacity: 0.4;
                transform: translateX(-50%) scaleX(1);
            }
            50% { 
                opacity: 0.7;
                transform: translateX(-50%) scaleX(0.75);
            }
        }
        
        .subtitle { 
            color: var(--color-text-muted); 
            font-size: 0.92rem; 
            line-height: 1.7; 
            margin-bottom: 36px; 
            font-weight: 400;
            max-width: 520px;
        }

        /* === DROP ZONE === */
        .drop-zone {
            border: 2px dashed rgba(148, 163, 184, 0.2); border-radius: var(--radius-xl);
            padding: 44px 24px; cursor: pointer; transition: all 0.4s var(--ease-out-expo);
            background: rgba(255, 255, 255, 0.02); position: relative; overflow: hidden;
        }
        .drop-zone::before {
            content: ''; position: absolute; inset: 0; border-radius: 18px; opacity: 0; transition: opacity 0.4s;
            background: linear-gradient(135deg, rgba(56, 189, 248, 0.06), rgba(129, 140, 248, 0.06));
        }
        .drop-zone:hover, .drop-zone.dragover { border-color: var(--color-primary); transform: scale(1.01); }
        .drop-zone:hover::before, .drop-zone.dragover::before { opacity: 1; }
        .drop-zone input[type="file"] { display: none; }
        .upload-icon {
            width: 48px; height: 48px; margin: 0 auto 14px; border-radius: 14px;
            background: var(--color-primary-muted); display: flex; align-items: center; justify-content: center;
            font-size: 1.4rem; transition: transform var(--duration-normal);
        }
        .drop-zone:hover .upload-icon { transform: translateY(-3px); }
        .drop-zone p { color: var(--color-text-muted); font-size: 0.88rem; position: relative; z-index: 1; }
        .drop-zone p strong { color: var(--color-primary); }
        #file-name { margin-top: 14px; font-size: 0.85rem; color: var(--color-success); font-weight: 600; }

        /* === NOTICE === */
        .notice {
            margin-top: 16px; padding: 12px 16px; border-radius: var(--radius-md);
            background: rgba(251, 191, 36, 0.06); border: 1px solid rgba(251, 191, 36, 0.15);
            color: #fcd34d; /* WCAG: Improved from #fbbf24 for 5.2:1 contrast ratio */
            font-size: 0.75rem; line-height: 1.5; text-align: left;
        }

        /* === BUTTON === */
        .btn {
            display: inline-flex; align-items: center; justify-content: center; gap: 8px;
            background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
            border: none; padding: 14px 36px; border-radius: 14px; color: white;
            font-weight: 600; font-size: 0.95rem; cursor: pointer; margin-top: 24px;
            width: 100%; transition: all var(--duration-normal) var(--ease-out-expo);
            box-shadow: 0 4px 16px rgba(56, 189, 248, 0.25); text-decoration: none;
        }
        .btn:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(56, 189, 248, 0.35); }
        /* Feedback tattile "fisico" al click (effetto premium Stripe/Linear) */
        .btn:active { transform: scale(0.97); box-shadow: 0 2px 10px rgba(56, 189, 248, 0.25); }
        .btn-secondary {
            background: transparent; border: 1px solid rgba(148, 163, 184, 0.2);
            margin-top: 12px; box-shadow: none; color: var(--color-text-muted);
        }
        .btn-secondary:hover { background: rgba(255,255,255,0.04); box-shadow: none; transform: none; }
        .btn-success-feedback {
            background: rgba(52, 211, 153, 0.15) !important;
            border-color: var(--color-success) !important;
            color: var(--color-success) !important;
            box-shadow: 0 0 12px rgba(52, 211, 153, 0.25) !important;
            transition: all var(--duration-normal) var(--ease-out-expo);
        }
        /* Azioni SECONDARIE (Quiz/Mappa dopo il riassunto): neutre, così non competono
           con il colore della CTA primaria. */
        .btn-addon {
            background: rgba(148, 163, 184, 0.06);
            border: 1px solid rgba(148, 163, 184, 0.22);
            margin-top: 0; box-shadow: none; color: #cbd5e1;
            font-size: 0.82rem; padding: 12px 16px;
            transition: all var(--duration-normal) var(--ease-out-expo);
        }
        .btn-addon:hover {
            background: rgba(148, 163, 184, 0.12);
            border-color: rgba(148, 163, 184, 0.4);
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
            transform: translateY(-2px);
            color: #f1f5f9;
        }
        .btn-addon:disabled {
            opacity: 0.6; cursor: not-allowed;
            transform: none !important; box-shadow: none !important;
        }
        .btn-addon .spinner {
            display: inline-block; width: 14px; height: 14px;
            border: 2px solid rgba(165, 180, 252, 0.3);
            border-top-color: #a5b4fc; border-radius: 50%;
            animation: spin 0.6s linear infinite;
        }
        @keyframes spin { to { transform: rotate(360deg); } }

        /* === PROGRESS === */
        .progress-container { display: none; margin-top: 10px; animation: fadeIn var(--duration-slow); }
        .progress-bar-bg { background: rgba(255,255,255,0.08); border-radius: var(--radius-xl); height: 8px; overflow: hidden; margin-bottom: 16px; }
        .progress-bar-fill {
            background: linear-gradient(90deg, var(--color-primary), var(--color-secondary)); width: 0%; height: 100%;
            transition: width var(--duration-slow) ease-out; border-radius: var(--radius-xl);
            box-shadow: 0 0 16px rgba(56, 189, 248, 0.4);
        }
        .progress-percentage {
            font-size: 2.8rem; font-weight: 700; margin-bottom: 4px; letter-spacing: -0.03em;
            background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
            -webkit-background-clip: text; -webkit-text-fill-color: transparent;
        }
        .progress-status { color: var(--color-text-muted); font-size: 0.88rem; margin-bottom: 4px; }
        .progress-eta { color: var(--color-text-faint); font-size: 0.78rem; margin-bottom: 24px; }
        .progress-warning {
            color: var(--color-text-faint); font-size: 0.72rem; padding: 14px 18px;
            background: rgba(255,255,255,0.02); border-radius: var(--radius-md);
            border: 1px solid rgba(255,255,255,0.05); line-height: 1.6;
        }

        /* === SUCCESS === */
        #success-screen { display: none; animation: fadeIn 0.6s var(--ease-out-expo); margin-top: 16px; }
        @keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
        .success-check {
            width: 72px; height: 72px; margin: 0 auto 20px; border-radius: 50%;
            background: linear-gradient(135deg, rgba(52, 211, 153, 0.15), rgba(52, 211, 153, 0.05));
            border: 2px solid rgba(52, 211, 153, 0.3); display: flex; align-items: center; justify-content: center;
            font-size: 2rem; animation: successPop 0.6s var(--ease-out-expo);
        }
        @keyframes successPop { from { transform: scale(0); } to { transform: scale(1); } }
        .success-title { color: var(--color-success); font-size: 1.4rem; font-weight: 700; margin-bottom: 8px; }
        .success-subtitle { color: var(--color-text-muted); font-size: 0.88rem; margin-bottom: 28px; }
        .cost-badge {
            display: inline-flex; align-items: center; gap: 6px; margin-top: 20px;
            padding: 10px 20px; background: rgba(52, 211, 153, 0.06);
            border: 1px solid rgba(52, 211, 153, 0.15); border-radius: var(--radius-md);
            color: var(--color-success); font-size: 0.8rem;
        }
        .cost-badge .cost-value { font-size: 1.1rem; font-weight: 700; }

        /* === FOOTER === */
        .footer-text {
            margin-top: 28px; color: #475569; font-size: 0.68rem; letter-spacing: 0.02em;
        }
        .footer-text a { color: #64748b; text-decoration: none; }

        /* === APP LAYOUT SYSTEM === */
        .app-layout {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 28px;
            width: 100%;
            max-width: 680px;
        }
        .main-content {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 28px;
            width: 100%;
            order: 1; /* Lo strumento principale va SEMPRE in cima in colonna */
        }
        .sidebar-left {
            order: 2; /* Audible & Kindle sotto allo strumento */
        }
        .sidebar-right {
            order: 3; /* Music & Prime sotto a tutto il resto */
        }
        .sidebar {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 12px;
            width: 100%;
            animation: cardAppear 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.4s both;
        }

        /* === STUDENT KIT SECTION === */
        .kit-header {
            text-align: center; margin-top: 10px; margin-bottom: -10px;
            animation: cardAppear 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
        }
        .kit-title {
            font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em;
            background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
            -webkit-background-clip: text; -webkit-text-fill-color: transparent;
            margin-bottom: 4px;
        }
        .kit-subtitle {
            color: #64748b; font-size: 0.75rem; font-weight: 400;
        }

        /* Featured card grid & cards */
        .kit-featured-grid {
            display: flex;
            flex-direction: column;
            gap: 20px;
            width: 100%;
            max-width: 520px;
            animation: cardAppear 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
        }
        .kit-featured {
            background: rgba(15, 23, 42, 0.55);
            backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
            border-radius: 18px; padding: 28px 28px 24px;
            border: 1px solid rgba(251, 191, 36, 0.18);
            box-shadow: 0 4px 24px rgba(0,0,0,0.2), 0 0 60px rgba(251, 191, 36, 0.04);
            position: relative; overflow: hidden;
            transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
            width: 100%;
            text-align: left;
        }
        .kit-featured::before {
            content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
            background: linear-gradient(90deg, #fbbf24, #f59e0b, #fbbf24);
            border-radius: 18px 18px 0 0;
        }
        .kit-featured:hover {
            transform: translateY(-3px);
            border-color: rgba(251, 191, 36, 0.35);
            box-shadow: 0 8px 32px rgba(0,0,0,0.3), 0 0 80px rgba(251, 191, 36, 0.08);
        }
        .kit-featured-badge {
            display: inline-flex; align-items: center; gap: 5px;
            background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(245, 158, 11, 0.1));
            border: 1px solid rgba(251, 191, 36, 0.2);
            padding: 4px 12px; border-radius: 20px;
            font-size: 0.65rem; font-weight: 600; color: #fbbf24;
            text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 14px;
        }
        .kit-featured-row {
            display: flex; align-items: flex-start; gap: 18px;
        }
        .kit-featured-icon {
            width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
            background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.1));
            display: flex; align-items: center; justify-content: center; font-size: 1.5rem;
        }
        .kit-featured-info { flex: 1; }
        .kit-featured-name {
            color: #f0f9ff; font-size: 1.05rem; font-weight: 700; margin-bottom: 3px;
        }
        .kit-featured-offer {
            color: #fbbf24; font-size: 0.78rem; font-weight: 600; margin-bottom: 6px;
        }
        .kit-featured-desc {
            color: #94a3b8; font-size: 0.78rem; line-height: 1.5; margin-bottom: 14px;
        }
        .kit-featured-cta {
            display: inline-flex; align-items: center; gap: 6px;
            background: linear-gradient(135deg, #fbbf24, #f59e0b);
            border: none; padding: 10px 22px; border-radius: 10px;
            color: #0f172a; font-weight: 700; font-size: 0.82rem;
            cursor: pointer; text-decoration: none;
            transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
            box-shadow: 0 4px 14px rgba(251, 191, 36, 0.25);
        }
        .kit-featured-cta:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(251, 191, 36, 0.4);
        }


        .kit-card {
            background: rgba(15, 23, 42, 0.5);
            backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
            border-radius: 14px; padding: 20px 18px;
            border: 1px solid rgba(255, 255, 255, 0.06);
            box-shadow: 0 2px 12px rgba(0,0,0,0.15);
            transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
            position: relative; overflow: hidden;
            text-decoration: none; display: block;
            text-align: left;
        }
        .kit-card::before {
            content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
            border-radius: 14px 14px 0 0; opacity: 0.8;
        }
        .kit-card:hover {
            transform: translateY(-3px);
            box-shadow: 0 8px 28px rgba(0,0,0,0.25);
        }

        /* Card color themes */
        .kit-card--audible { border-color: rgba(249, 115, 22, 0.12); }
        .kit-card--audible::before { background: linear-gradient(90deg, #f97316, #fb923c); }
        .kit-card--audible:hover { border-color: rgba(249, 115, 22, 0.3); box-shadow: 0 8px 28px rgba(0,0,0,0.25), 0 0 40px rgba(249, 115, 22, 0.06); }
        .kit-card--audible .kit-card-icon { background: rgba(249, 115, 22, 0.12); }
        .kit-card--audible .kit-card-offer { color: #fb923c; }
        .kit-card--audible .kit-card-btn { background: linear-gradient(135deg, #f97316, #fb923c); }

        .kit-card--kindle { border-color: rgba(20, 184, 166, 0.12); }
        .kit-card--kindle::before { background: linear-gradient(90deg, #14b8a6, #2dd4bf); }
        .kit-card--kindle:hover { border-color: rgba(20, 184, 166, 0.3); box-shadow: 0 8px 28px rgba(0,0,0,0.25), 0 0 40px rgba(20, 184, 166, 0.06); }
        .kit-card--kindle .kit-card-icon { background: rgba(20, 184, 166, 0.12); }
        .kit-card--kindle .kit-card-offer { color: #2dd4bf; }
        .kit-card--kindle .kit-card-btn { background: linear-gradient(135deg, #14b8a6, #2dd4bf); }

        .kit-card--music { border-color: rgba(56, 189, 248, 0.12); }
        .kit-card--music::before { background: linear-gradient(90deg, #38bdf8, #7dd3fc); }
        .kit-card--music:hover { border-color: rgba(56, 189, 248, 0.3); box-shadow: 0 8px 28px rgba(0,0,0,0.25), 0 0 40px rgba(56, 189, 248, 0.06); }
        .kit-card--music .kit-card-icon { background: rgba(56, 189, 248, 0.12); }
        .kit-card--music .kit-card-offer { color: #7dd3fc; }
        .kit-card--music .kit-card-btn { background: linear-gradient(135deg, #38bdf8, #7dd3fc); }

        .kit-card--prime { border-color: rgba(129, 140, 248, 0.12); }
        .kit-card--prime::before { background: linear-gradient(90deg, #818cf8, #a5b4fc); }
        .kit-card--prime:hover { border-color: rgba(129, 140, 248, 0.3); box-shadow: 0 8px 28px rgba(0,0,0,0.25), 0 0 40px rgba(129, 140, 248, 0.06); }
        .kit-card--prime .kit-card-icon { background: rgba(129, 140, 248, 0.12); }
        .kit-card--prime .kit-card-offer { color: #a5b4fc; }
        .kit-card--prime .kit-card-btn { background: linear-gradient(135deg, #818cf8, #a5b4fc); }

        .kit-card-logo-wrapper {
            margin-bottom: 12px;
            display: flex;
            justify-content: flex-start;
            align-items: center;
            height: 48px;
        }
        .kit-card-logo-img {
            height: 100%;
            width: auto;
            max-width: 140px;
            object-fit: contain;
            filter: invert(1) brightness(0.95);
            mix-blend-mode: screen;
            opacity: 0.8;
            transition: all 0.3s ease;
            transform-origin: left center;
        }

        .kit-card--kindle .kit-card-logo-img,
        .kit-card--prime .kit-card-logo-img {
            height: 70%;
        }

        .kit-card--audible .kit-card-logo-img {
            transform: scale(1.8);
        }
        .kit-card--music .kit-card-logo-img {
            transform: scale(2.6);
        }

        .kit-card:hover .kit-card-logo-img {
            opacity: 1;
            filter: invert(1) brightness(1) drop-shadow(0 0 6px rgba(255, 255, 255, 0.25));
        }

        .kit-featured-logo-wrapper {
            margin-bottom: 12px;
            display: flex;
            justify-content: flex-start;
            align-items: center;
            height: 60px;
        }
        .kit-featured-logo-img {
            height: 100%;
            width: auto;
            max-width: 220px;
            object-fit: contain;
            filter: invert(1) brightness(0.95);
            mix-blend-mode: screen;
            opacity: 0.95;
            transition: all 0.3s ease;
            transform-origin: left center;
            transform: scale(2.4);
        }
        .kit-featured:hover .kit-featured-logo-img {
            opacity: 1;
            filter: invert(1) brightness(1) drop-shadow(0 0 8px rgba(255, 255, 255, 0.25));
        }

        .kit-card-icon {
            width: 40px; height: 40px; border-radius: 11px;
            display: flex; align-items: center; justify-content: center;
            font-size: 1.15rem; margin-bottom: 12px;
        }
        .kit-card-name {
            color: #e2e8f0; font-size: 0.88rem; font-weight: 700; margin-bottom: 2px;
        }
        .kit-card-offer {
            font-size: 0.7rem; font-weight: 600; margin-bottom: 6px;
        }
        .kit-card-desc {
            color: #94a3b8; font-size: 0.72rem; line-height: 1.45; margin-bottom: 14px;
        }
        .kit-card-btn {
            display: inline-flex; align-items: center; gap: 5px;
            border: none; padding: 7px 16px; border-radius: 8px;
            color: #0f172a; font-weight: 700; font-size: 0.72rem;
            cursor: pointer; text-decoration: none;
            transition: all 0.3s ease;
            box-shadow: 0 2px 8px rgba(0,0,0,0.15);
        }
        .kit-card-btn:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 14px rgba(0,0,0,0.25);
        }

        .kit-footer {
            text-align: center; margin-top: 28px;
            color: #475569; font-size: 0.68rem; letter-spacing: 0.02em;
            width: 100%; max-width: 680px;
        }

        /* === CRO TEASER LINK === */
        .kit-teaser-link {
            margin-top: 18px;
            padding: 12px 16px;
            background: rgba(15, 23, 42, 0.6);
            backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
            border-radius: 12px;
            font-size: 0.72rem;
            text-align: center;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
            isolation: isolate;
            border: 1px solid rgba(255, 255, 255, 0.04);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
            animation: teaserGlow 3s ease-in-out infinite;
        }
        .kit-teaser-link::before {
            content: '';
            position: absolute;
            top: 0; left: -100%; width: 100%; height: 100%;
            background: linear-gradient(90deg, transparent 0%, rgba(251, 191, 36, 0.12) 40%, rgba(255, 255, 255, 0.18) 50%, rgba(251, 191, 36, 0.12) 60%, transparent 100%);
            animation: shimmerSlide 3s ease-in-out infinite;
            z-index: 1;
            pointer-events: none;
        }
        .kit-teaser-link::after {
            content: '';
            position: absolute;
            inset: 0;
            border-radius: 12px;
            padding: 1px;
            background: linear-gradient(90deg, #fbbf24, #f97316, #ec4899, #a855f6, #38bdf8, #fbbf24);
            background-size: 300% 100%;
            -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
            -webkit-mask-composite: xor;
            mask-composite: exclude;
            animation: borderFlow 4s linear infinite;
            z-index: 2;
            pointer-events: none;
            opacity: 0.8;
        }
        .kit-teaser-link > * {
            position: relative;
            z-index: 3;
        }
        .kit-teaser-link:hover {
            background: rgba(251, 191, 36, 0.1);
            border-color: rgba(251, 191, 36, 0.3);
            box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.4), 0 0 20px rgba(251, 191, 36, 0.12), 0 4px 16px rgba(0,0,0,0.2);
            transform: translateY(-1px);
        }
        .kit-teaser-link:hover::after {
            opacity: 1;
        }
        .kit-teaser-link a {
            color: #fbbf24;
            text-decoration: none;
            font-weight: 700;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            width: 100%;
            text-shadow: 0 0 12px rgba(251, 191, 36, 0.3);
        }
        .kit-teaser-link a span {
            color: #94a3b8;
            font-weight: 400;
            text-shadow: none;
        }
        @keyframes shimmerSlide {
            0% { left: -100%; }
            50% { left: 100%; }
            100% { left: 100%; }
        }
        @keyframes borderFlow {
            0% { background-position: 0% 50%; }
            100% { background-position: 300% 50%; }
        }
        @keyframes teaserGlow {
            0%, 100% { box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.2), 0 0 12px rgba(251, 191, 36, 0.06); }
            50% { box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.35), 0 0 20px rgba(251, 191, 36, 0.1), 0 0 40px rgba(249, 115, 22, 0.04); }
        }

        /* === DIVIDER SECTION === */
        .divider-container {
            background: rgba(15, 23, 42, 0.6);
            backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
            border-radius: 28px; padding: 44px 40px; width: 100%; max-width: 680px;
            border: 1px solid rgba(255, 255, 255, 0.08);
            box-shadow: 0 0 0 1px rgba(255,255,255,0.03), 0 20px 60px rgba(0, 0, 0, 0.5);
            text-align: center; position: relative;
            animation: cardAppear 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
        }
        .divider-container h1 {
            background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
            -webkit-background-clip: text; -webkit-text-fill-color: transparent;
            font-size: 1.7rem; margin-bottom: 8px;
        }
        .divider-info {
            margin-top: 16px; padding: 14px 16px; border-radius: var(--radius-md);
            background: rgba(56, 189, 248, 0.06); border: 1px solid rgba(56, 189, 248, 0.15);
            color: var(--color-primary-hover); font-size: 0.75rem; line-height: 1.6; text-align: left;
        }

        /* === PARTS GRID === */
        .parts-result { display: none; margin-top: 24px; animation: fadeIn var(--duration-slow); }
        .parts-summary {
            color: var(--color-success); font-size: 0.9rem; margin-bottom: 16px; font-weight: 600;
        }
        .parts-grid {
            display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
            gap: 10px;
        }
        .part-card {
            background: rgba(255, 255, 255, 0.04);
            border: 1px solid var(--color-border-subtle);
            border-radius: var(--radius-md); padding: 12px 10px;
            display: flex; flex-direction: column; gap: 8px;
            transition: all var(--duration-fast) ease;
            text-align: left;
        }
        .part-card:hover { border-color: rgba(56, 189, 248, 0.3); transform: translateY(-2px); }
        .part-card-title {
            color: var(--color-text-primary); font-size: 0.82rem; font-weight: 700;
        }
        .part-card-meta {
            color: var(--color-text-muted); font-size: 0.68rem;
        }
        .part-card-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
        .part-btn {
            border: none; border-radius: var(--radius-sm); padding: 7px 10px;
            font-family: var(--font-sans); font-size: 0.7rem; font-weight: 700;
            cursor: pointer; transition: all var(--duration-fast) ease;
            display: inline-flex; align-items: center; justify-content: center; gap: 4px;
            text-decoration: none;
        }
        .part-btn-download {
            background: rgba(148, 163, 184, 0.12); color: #cbd5e1;
            border: 1px solid rgba(148, 163, 184, 0.18);
        }
        .part-btn-download:hover { background: rgba(148, 163, 184, 0.2); }
        .part-btn-ai {
            background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
            color: white; box-shadow: 0 2px 8px rgba(56, 189, 248, 0.2);
        }
        .part-btn-ai:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(56, 189, 248, 0.35); }

        /* === MODALS === */
        .modal-overlay {
            position: fixed; inset: 0; z-index: 1000;
            background: var(--color-bg-overlay);
            backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
            display: none; align-items: center; justify-content: center;
            padding: 20px; animation: fadeIn var(--duration-fast) ease;
        }
        .modal-overlay.active { display: flex; }
        .modal {
            background: var(--color-bg-elevated);
            border: 1px solid var(--color-border-default);
            border-radius: 22px; padding: 36px 32px;
            max-width: 460px; width: 100%;
            text-align: center; position: relative;
            animation: cardAppear 0.4s var(--ease-out-expo) both;
            box-shadow: 0 30px 80px rgba(0,0,0,0.6);
            max-height: 90vh; overflow-y: auto;
        }
        .modal-close {
            position: absolute; top: 14px; right: 14px;
            background: rgba(255,255,255,0.06); border: none;
            width: 32px; height: 32px; border-radius: 10px;
            cursor: pointer; color: var(--color-text-muted); font-size: 1.1rem;
            display: flex; align-items: center; justify-content: center;
            transition: all var(--duration-fast) ease;
        }
        .modal-close:hover { background: rgba(255,255,255,0.12); color: var(--color-text-primary); }
        .modal-icon {
            width: 64px; height: 64px; margin: 0 auto 16px;
            border-radius: 18px; display: flex; align-items: center; justify-content: center;
            font-size: 1.8rem;
        }
        .modal-icon.warning {
            background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.1));
            border: 1px solid rgba(251, 191, 36, 0.3);
        }
        .modal-icon.heart {
            background: linear-gradient(135deg, rgba(244, 114, 182, 0.2), rgba(236, 72, 153, 0.1));
            border: 1px solid rgba(244, 114, 182, 0.3);
        }
        .modal-title {
            color: var(--color-text-primary); font-size: 1.25rem; font-weight: 700; margin-bottom: 8px;
        }
        .modal-text {
            color: var(--color-text-muted); font-size: 0.88rem; line-height: 1.6; margin-bottom: 22px;
        }
        .modal-btn {
            display: inline-flex; align-items: center; justify-content: center; gap: 6px;
            background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
            border: none; padding: 12px 24px; border-radius: var(--radius-md);
            color: white; font-weight: 700; font-size: 0.88rem;
            cursor: pointer; text-decoration: none;
            transition: all var(--duration-fast) ease; width: 100%;
            box-shadow: 0 4px 16px rgba(56, 189, 248, 0.25);
        }
        .modal-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(56, 189, 248, 0.4); }
        .modal-btn-secondary {
            background: transparent; color: var(--color-text-muted);
            border: 1px solid rgba(148, 163, 184, 0.2);
            box-shadow: none; margin-top: 10px;
        }
        .modal-btn-secondary:hover { background: rgba(255,255,255,0.04); box-shadow: none; }

        /* === PREMIUM CELEBRATION MODAL === */
        .premium-success-modal {
            max-width: 440px; text-align: center; padding: 40px 32px 32px;
            background: linear-gradient(160deg, #0f172a 0%, #1a1040 50%, #0f172a 100%);
            border: 1px solid rgba(250, 204, 21, 0.3);
            box-shadow: 0 0 60px rgba(250, 204, 21, 0.15), 0 0 120px rgba(139, 92, 246, 0.1);
            position: relative; overflow: hidden;
        }
        .premium-success-modal::before {
            content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
            background: conic-gradient(from 0deg, transparent, rgba(250, 204, 21, 0.05), transparent, rgba(139, 92, 246, 0.05), transparent);
            animation: premiumRotate 6s linear infinite;
        }
        @keyframes premiumRotate { to { transform: rotate(360deg); } }
        .premium-success-logo { 
            width: 80px; height: 80px; margin-bottom: 16px; position: relative; z-index: 1;
            animation: premiumLogoPulse 2s ease-in-out infinite alternate;
            filter: drop-shadow(0 0 15px rgba(56,189,248,0.6)) drop-shadow(0 0 30px rgba(139,92,246,0.4));
        }
        @keyframes premiumLogoPulse { 
            0% { transform: scale(1); filter: drop-shadow(0 0 15px rgba(56,189,248,0.6)) drop-shadow(0 0 30px rgba(139,92,246,0.4)); } 
            100% { transform: scale(1.1); filter: drop-shadow(0 0 25px rgba(56,189,248,0.9)) drop-shadow(0 0 45px rgba(139,92,246,0.7)); } 
        }
        .premium-success-title {
            font-size: 1.6rem; font-weight: 800; position: relative; z-index: 1;
            background: linear-gradient(135deg, #facc15, #f59e0b, #fbbf24);
            -webkit-background-clip: text; -webkit-text-fill-color: transparent;
            margin-bottom: 8px;
        }
        .premium-success-subtitle {
            color: #cbd5e1; font-size: 0.95rem; line-height: 1.6; position: relative; z-index: 1; margin-bottom: 24px;
        }
        .premium-features-grid {
            display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 24px; position: relative; z-index: 1;
        }
        .premium-feature-chip {
            display: flex; align-items: center; gap: 8px; padding: 10px 14px;
            background: rgba(250, 204, 21, 0.06); border: 1px solid rgba(250, 204, 21, 0.15);
            border-radius: 10px; font-size: 0.82rem; color: #e2e8f0;
        }
        .premium-feature-chip span:first-child { font-size: 1.1rem; }
        .premium-btn-start {
            width: 100%; padding: 14px; border: none; border-radius: 12px; cursor: pointer;
            font-size: 1rem; font-weight: 700; color: #0f172a; position: relative; z-index: 1;
            background: linear-gradient(135deg, #facc15, #f59e0b);
            box-shadow: 0 4px 20px rgba(250, 204, 21, 0.3);
            transition: all 0.3s ease;
        }
        .premium-btn-start:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(250, 204, 21, 0.45); }
        /* Confetti */
        .confetti-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; overflow: hidden; z-index: 0; }
        .confetti-piece {
            position: absolute; width: 8px; height: 8px; top: -10px;
            animation: confettiFall 3s ease-in forwards;
            border-radius: 2px;
        }
        @keyframes confettiFall {
            0% { transform: translateY(0) rotate(0deg); opacity: 1; }
            100% { transform: translateY(500px) rotate(720deg); opacity: 0; }
        }

        /* === SUPPORT MODAL === */
        .support-grid {
            display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px;
        }
        .support-link {
            display: flex; flex-direction: column; align-items: center; gap: 6px;
            padding: 16px 10px; border-radius: 12px; text-decoration: none;
            background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08);
            color: #e2e8f0; font-size: 0.78rem; font-weight: 600;
            transition: all 0.25s ease;
        }
        .support-link:hover { transform: translateY(-2px); border-color: rgba(244, 114, 182, 0.3); background: rgba(244, 114, 182, 0.06); }
        .support-link-icon { font-size: 1.4rem; }

        /* === RESPONSIVE LAYOUTS === */

        /* --- PHONE (< 600px) --- */
        @media (max-width: 600px) {
            body { padding: 66px 10px 24px; gap: 16px; }
            .container { padding: 24px 16px; border-radius: 18px; max-width: 100%; }
            h1 { font-size: 1.35rem; }
            .subtitle { font-size: 0.78rem; margin-bottom: 16px; }
            .drop-zone { padding: 24px 10px; border-radius: 14px; }
            .upload-icon { width: 40px; height: 40px; font-size: 1.1rem; margin-bottom: 10px; }
            .drop-zone p { font-size: 0.82rem; }
            .notice { padding: 10px 12px; font-size: 0.72rem; border-radius: 10px; }
            .plan-hint { padding: 8px 12px !important; font-size: 0.76rem !important; border-radius: 8px !important; }
            .btn { padding: 15px 20px; font-size: 0.9rem; border-radius: 12px; margin-top: 16px; min-height: 48px; }
            .sidebar { grid-template-columns: 1fr; gap: 10px; }
            .kit-featured-row { flex-direction: column; align-items: center; text-align: center; }
            .kit-featured { padding: 20px 16px 18px; border-radius: 14px; }
            .kit-featured-logo-wrapper { height: 36px !important; justify-content: center !important; }
            .kit-card { padding: 16px 14px; border-radius: 12px; }
            .kit-card-logo-wrapper { height: 38px; }
            .kit-card-desc { font-size: 0.7rem; margin-bottom: 10px; }
            .kit-teaser-link { padding: 10px 10px; font-size: 0.68rem; border-radius: 10px; }
            .kit-header { margin-top: 4px; margin-bottom: -6px; }
            .kit-title { font-size: 1rem; }
            .kit-featured-grid { max-width: 100%; }
            .footer-text, .kit-footer { font-size: 0.62rem; }
            .logo-icon { width: 44px; height: 44px; border-radius: 12px; }
            .logo-img-main { width: 34px; height: 34px; }
            .progress-percentage { font-size: 2.2rem; }
            .divider-container { padding: 24px 16px; border-radius: 18px; }
            .divider-container h1 { font-size: 1.3rem; }
            .faq-section { padding: 0 4px; }

            /* Premium: centra il contenuto senza sidebar */
            body.is-premium .app-layout { max-width: 100%; }
            body.is-premium .main-content { max-width: 100%; }
        }

        /* --- TABLET PORTRAIT / IPAD (601px - 999px) --- */
        @media (min-width: 601px) and (max-width: 999px) {
            body { padding: 80px 20px 32px; gap: 20px; }
            .container { padding: 36px 28px; border-radius: 24px; max-width: 540px; }
            h1 { font-size: 1.7rem; }
            .app-layout { max-width: 600px; }
            .sidebar { 
                grid-template-columns: repeat(2, 1fr); 
                max-width: 540px; 
                gap: 12px;
            }
            .kit-featured-grid { max-width: 540px; }
            .kit-featured { padding: 22px 20px 18px; }
            .kit-card { padding: 18px 16px; }
            .faq-section { max-width: 540px; }
            .divider-container { max-width: 540px; padding: 36px 28px; }

            /* Premium: centra e allarga il contenuto */
            body.is-premium .app-layout { max-width: 600px; }
            body.is-premium .container { max-width: 580px; }
        }

        /* === DESKTOP & IPAD LANDSCAPE 3-COLUMN SYMMETRIC LAYOUT === */
        @media (min-width: 1000px) {
            body {
                overflow-y: auto;
                padding: 100px 20px 40px;
                align-items: center;
            }
            .container {
                width: 100%;
                max-width: 520px;
            }
            .app-layout {
                flex-direction: row;
                align-items: flex-start;
                justify-content: center;
                gap: 2%;
                max-width: 1240px;
                width: 100%;
            }
            .main-content {
                width: 46%;
                max-width: 520px;
                flex-shrink: 1;
                gap: 28px;
                order: 0;
            }
            .sidebar {
                display: flex;
                flex-direction: column;
                gap: 20px;
                width: 25%;
                max-width: 310px;
                flex-shrink: 1;
                margin-top: 50px;
            }
            .sidebar-left {
                order: 0;
                animation: slideRight 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
            }
            .sidebar-right {
                order: 0;
                animation: slideLeft 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
            }
            @keyframes slideRight {
                from { opacity: 0; transform: translateX(-40px); }
                to { opacity: 1; transform: translateX(0); }
            }
            @keyframes slideLeft {
                from { opacity: 0; transform: translateX(40px); }
                to { opacity: 1; transform: translateX(0); }
            }

            .kit-featured-grid {
                flex-direction: row !important;
                gap: 16px !important;
            }
            .kit-featured {
                flex: 1 !important;
                padding: 22px 18px 20px !important;
            }
            .kit-featured-row {
                flex-direction: column !important;
                align-items: flex-start !important;
            }
            .kit-featured-logo-wrapper {
                height: 42px !important;
                margin-bottom: 8px !important;
            }

            /* Premium desktop: no sidebars, center and expand main content */
            body.is-premium .app-layout {
                justify-content: center;
            }
            body.is-premium .main-content {
                width: 100%;
                max-width: 580px;
            }
        }
        /* === FAQ ACCORDION === */
        .faq-section {
            width: 100%;
            max-width: 760px;
            margin: 0 auto;
            text-align: center;
            animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
        }
        .faq-container {
            display: flex;
            flex-direction: column;
            gap: 12px;
            text-align: left;
            margin-top: 20px;
        }
        .faq-item {
            background: rgba(15, 23, 42, 0.4);
            backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
            border-radius: 16px;
            border: 1px solid rgba(255, 255, 255, 0.06);
            overflow: hidden;
            transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        }
        .faq-item:hover {
            border-color: rgba(56, 189, 248, 0.25);
            background: rgba(15, 23, 42, 0.5);
            box-shadow: 0 4px 20px rgba(56, 189, 248, 0.03);
        }
        .faq-item.active {
            border-color: rgba(56, 189, 248, 0.4);
            box-shadow: 0 4px 24px rgba(56, 189, 248, 0.06);
        }
        .faq-question {
            width: 100%;
            padding: 20px 24px;
            background: transparent;
            border: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: space-between;
            color: var(--color-text-primary);
            font-family: var(--font-sans);
            font-size: 0.96rem;
            font-weight: 600;
            text-align: left;
            gap: 16px;
            transition: color var(--duration-fast);
        }
        .faq-question:hover {
            color: var(--color-primary);
        }
        .faq-chevron {
            width: 18px;
            height: 18px;
            stroke: var(--color-text-muted);
            transition: transform var(--duration-normal) var(--ease-out-expo), stroke var(--duration-normal);
            flex-shrink: 0;
        }
        .faq-item.active .faq-chevron {
            transform: rotate(180deg);
            stroke: var(--color-primary);
        }
        .faq-answer {
            max-height: 0;
            overflow: hidden;
            opacity: 0;
            transition: max-height 0.35s var(--ease-out-expo), opacity 0.25s ease;
        }
        .faq-item.active .faq-answer {
            max-height: 1200px;
            opacity: 1;
        }
        .faq-answer p {
            padding: 0 24px 20px;
            color: var(--color-text-secondary);  /* WCAG: Improved from #94a3b8 for 6.1:1 contrast ratio */
            font-size: 0.86rem;
            line-height: 1.6;
        }
        .faq-answer strong {
            color: var(--color-primary);
        }

        /* === AUTH UI === */
        .auth-section { display: flex; align-items: center; gap: 8px; margin-left: 8px; }
        .btn-google-login {
            display: flex; align-items: center; gap: 8px;
            background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
            padding: 7px 16px; border-radius: 10px; cursor: pointer;
            font-family: var(--font-sans); font-size: 0.8rem; font-weight: 600;
            color: #e0f2fe; transition: all var(--duration-fast);
        }
        .btn-google-login:hover { background: rgba(255,255,255,0.12); border-color: rgba(56,189,248,0.4); }
        .btn-google-login svg { width: 16px; height: 16px; flex-shrink: 0; }
        .user-menu { position: relative; display: flex; align-items: center; gap: 8px; cursor: pointer; }
        .user-btn {
            background: transparent; border: none; cursor: pointer; padding: 0;
            display: flex; align-items: center; gap: 8px;
        }
        .dropdown-icon {
            width: 18px; height: 18px; stroke: var(--color-text-muted); fill: none;
            stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
        }
        .credits-badge {
            display: inline-flex; align-items: center; gap: 4px;
            background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(56, 189, 248, 0.05));
            border: 1px solid rgba(56, 189, 248, 0.3);
            color: var(--color-primary);
            font-size: 0.75rem; font-weight: 700; padding: 4px 12px; border-radius: 20px;
            cursor: pointer; transition: all var(--duration-fast) ease; white-space: nowrap; margin-right: 8px;
            box-shadow: 0 0 10px rgba(56, 189, 248, 0.05);
        }
        .credits-badge:hover {
            background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(56, 189, 248, 0.15));
            border-color: rgba(56, 189, 248, 0.5);
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(56, 189, 248, 0.15);
        }
        /* === SHOP TABS === */
        .shop-tabs {
            display: flex; gap: 8px; justify-content: center; margin-bottom: 24px;
            background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06);
            padding: 4px; border-radius: var(--radius-md);
        }
        .shop-tab-btn {
            flex: 1; padding: 10px 16px; border: none; border-radius: var(--radius-sm);
            background: transparent; color: var(--color-text-muted); font-family: var(--font-sans);
            font-size: 0.85rem; font-weight: 700; cursor: pointer; transition: all var(--duration-fast);
            display: flex; align-items: center; justify-content: center; gap: 6px;
        }
        .shop-tab-btn:hover { color: var(--color-text-secondary); background: rgba(255,255,255,0.02); }
        .shop-tab-btn.active {
            background: var(--color-primary-muted); border: 1px solid rgba(56, 189, 248, 0.25);
            color: var(--color-primary);
        }
        /* Ricariche Crediti card layout */
        .pricing-grid-credits { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-bottom: 24px; }
        @media (max-width: 650px) { .pricing-grid-credits { grid-template-columns: 1fr; } }
        /* Bottone Premium nella navbar (accanto all'avatar) */
        .navbar-upgrade-btn {
            display: inline-flex; align-items: center; gap: 5px;
            background: linear-gradient(135deg, rgba(250,204,21,0.12), rgba(245,158,11,0.08));
            border: 1px solid rgba(250,204,21,0.25);
            padding: 5px 12px; border-radius: 20px; cursor: pointer;
            font-family: var(--font-sans); font-size: 0.7rem; font-weight: 700;
            color: var(--color-accent-gold); transition: all 0.25s ease; white-space: nowrap;
        }
        .navbar-upgrade-btn:hover {
            background: linear-gradient(135deg, rgba(250,204,21,0.2), rgba(245,158,11,0.15));
            border-color: rgba(250,204,21,0.45);
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(250,204,21,0.15);
        }

        /* === COOKIE BANNER === */
        .cookie-banner {
            position: fixed; bottom: 24px; right: 24px; max-width: 420px; width: calc(100% - 48px);
            background: rgba(15,23,42,0.95); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
            border: 1px solid rgba(255,255,255,0.15); border-radius: 16px; padding: 20px;
            box-shadow: 0 20px 48px rgba(0,0,0,0.5), 0 0 30px rgba(56,189,248,0.1);
            z-index: 9999; display: none; flex-direction: column; gap: 14px;
            animation: slideUpCookie 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
        }
        @keyframes slideUpCookie {
            from { transform: translateY(40px); opacity: 0; }
            to { transform: translateY(0); opacity: 1; }
        }
        .cookie-banner-text { font-size: 0.8rem; color: #cbd5e1; line-height: 1.45; margin: 0; }
        .cookie-banner-text a { color: #38bdf8; text-decoration: underline; font-weight: 500; }
        .cookie-banner-text a:hover { color: #818cf8; }
        .cookie-banner-buttons { display: flex; gap: 10px; align-items: center; justify-content: flex-end; }
        .btn-cookie-accept {
            background: linear-gradient(135deg, #38bdf8, #818cf8); color: #fff;
            border: none; border-radius: 8px; padding: 8px 18px; font-weight: 700;
            font-size: 0.82rem; cursor: pointer; transition: all 0.2s;
            box-shadow: 0 4px 12px rgba(56,189,248,0.25);
        }
        .btn-cookie-accept:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(56,189,248,0.35); }
        .btn-cookie-details {
            background: rgba(255,255,255,0.06); color: #e0f2fe;
            border: 1px solid rgba(255,255,255,0.1); border-radius: 8px;
            padding: 8px 14px; font-weight: 600; font-size: 0.82rem;
            cursor: pointer; transition: all 0.2s;
        }
        .btn-cookie-details:hover { background: rgba(255,255,255,0.1); }

        /* === TOAST NOTIFICATION === */
        .toast-container {
            position: fixed; top: 24px; right: 24px; z-index: 99999;
            display: flex; flex-direction: column; gap: 10px;
            pointer-events: none; max-width: 420px; width: calc(100% - 48px);
        }
        .toast {
            pointer-events: auto;
            display: flex; align-items: flex-start; gap: 12px;
            background: rgba(15,23,42,0.92); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
            border: 1px solid rgba(255,255,255,0.12); border-radius: 14px;
            padding: 16px 18px; box-shadow: 0 16px 48px rgba(0,0,0,0.5), 0 0 20px rgba(56,189,248,0.08);
            animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
            position: relative; overflow: hidden;
        }
        .toast.toast-out {
            animation: toastOut 0.35s cubic-bezier(0.4, 0, 1, 1) forwards;
        }
        .toast-icon {
            font-size: 1.3rem; flex-shrink: 0; margin-top: 1px;
        }
        .toast-body { flex: 1; min-width: 0; }
        .toast-title {
            font-size: 0.85rem; font-weight: 700; color: #f0f9ff;
            margin-bottom: 3px; line-height: 1.3;
        }
        .toast-msg {
            font-size: 0.78rem; color: #94a3b8; line-height: 1.45;
        }
        .toast-close {
            flex-shrink: 0; background: none; border: none; color: #475569;
            cursor: pointer; font-size: 1.1rem; padding: 0; line-height: 1;
            transition: color 0.2s;
        }
        .toast-close:hover { color: #f87171; }
        .toast-progress {
            position: absolute; bottom: 0; left: 0; height: 3px;
            border-radius: 0 0 14px 14px;
            animation: toastProgress var(--toast-duration, 5s) linear forwards;
        }
        .toast.toast-error { border-color: rgba(239,68,68,0.25); }
        .toast.toast-error .toast-progress { background: linear-gradient(90deg, #ef4444, #f97316); }
        .toast.toast-error .toast-title { color: #fca5a5; }
        .toast.toast-success { border-color: rgba(52,211,153,0.25); }
        .toast.toast-success .toast-progress { background: linear-gradient(90deg, #34d399, #38bdf8); }
        .toast.toast-success .toast-title { color: #a7f3d0; }
        .toast.toast-info { border-color: rgba(56,189,248,0.25); }
        .toast.toast-info .toast-progress { background: linear-gradient(90deg, #38bdf8, #818cf8); }
        .toast.toast-info .toast-title { color: #bae6fd; }
        .toast.toast-warning { border-color: rgba(250,204,21,0.25); }
        .toast.toast-warning .toast-progress { background: linear-gradient(90deg, #facc15, #f59e0b); }
        .toast.toast-warning .toast-title { color: #fef08a; }
        @keyframes toastIn {
            from { opacity: 0; transform: translateX(40px) scale(0.95); }
            to { opacity: 1; transform: translateX(0) scale(1); }
        }
        @keyframes toastOut {
            from { opacity: 1; transform: translateX(0) scale(1); }
            to { opacity: 0; transform: translateX(40px) scale(0.92); }
        }
        @keyframes toastProgress {
            from { width: 100%; }
            to { width: 0%; }
        }
        @media (max-width: 600px) {
            .toast-container { top: 12px; right: 12px; width: calc(100% - 24px); max-width: none; }
            
            /* === MOBILE MODAL FIXES === */
            .modal-overlay { padding: 8px; }
            .modal { padding: 20px 16px; border-radius: 16px; max-width: 100%; }
            /* Bersaglio tap più comodo per la X di chiusura (≥44px Apple HIG) */
            .modal-close { width: 44px; height: 44px; font-size: 1.35rem; }
            .modal-box { 
                max-width: 100%; width: 100%; border-radius: 16px; 
                padding: 20px 14px; max-height: 88vh; 
            }
            .modal-title { font-size: 1.05rem; }
            .modal-subtitle { font-size: 0.8rem; margin-bottom: 16px; }
            .modal-text { font-size: 0.82rem; }
            .modal-btn { padding: 11px 14px; font-size: 0.84rem; }
            
            /* Premium / Credits success modal mobile */
            .premium-success-modal { 
                padding: 24px 16px 20px; max-width: 100%; 
                border-radius: 16px; 
            }
            .premium-success-logo { width: 56px; height: 56px; margin-bottom: 10px; }
            .premium-success-title { font-size: 1.2rem; }
            .premium-success-subtitle { font-size: 0.82rem; margin-bottom: 14px; }
            .premium-features-grid { 
                grid-template-columns: 1fr; gap: 6px; margin-bottom: 14px; 
            }
            .premium-feature-chip { padding: 7px 10px; font-size: 0.75rem; }
            .premium-btn-start { padding: 11px; font-size: 0.88rem; border-radius: 10px; }
            
            /* Paywall / Shop modal mobile */
            .pricing-grid { grid-template-columns: 1fr !important; gap: 10px; }
            .pricing-grid-credits { grid-template-columns: 1fr !important; gap: 10px; }
            .pricing-card { padding: 16px 14px; border-radius: 14px; }
            .pricing-card-title { font-size: 0.95rem; }
            .pricing-card .price-row { font-size: 1.1rem; }
            .pricing-card .feature-item { font-size: 0.75rem; }
            .pricing-features li { font-size: 0.78rem; padding: 4px 0; }
            .pricing-card .btn { padding: 10px 12px; font-size: 0.82rem; }
            .btn-pricing { padding: 10px; font-size: 0.84rem; }
            .compare-table { font-size: 0.72rem; }
            .compare-table th, .compare-table td { padding: 6px 8px; }
            .shop-tab-btn { font-size: 0.82rem; padding: 10px 16px; }
            .pricing-badge { font-size: 0.58rem; padding: 3px 9px; top: -8px; right: 12px; }
            .pricing-disclaimer { font-size: 0.68rem; }
            .paywall-tabs { gap: 4px; }
            .paywall-tab { padding: 8px 12px; font-size: 0.78rem; }
            
            /* Account modal mobile */
            .account-avatar-wrapper { width: 64px; height: 64px; margin-bottom: 8px; }
            .account-name { font-size: 1.2rem; }
            .account-email { font-size: 0.8rem; padding: 3px 10px; }
            .account-stats { grid-template-columns: 1fr; gap: 10px; }
            .stat-card { padding: 14px 12px; }
            .stat-value { font-size: 1.5rem; }
            .account-plan-card { padding: 12px 14px; gap: 12px; }
            
            /* Legal modal mobile */
            .legal-content-container { max-height: 50vh; }
            .legal-tabs { gap: 4px; }
            .legal-tab-btn { padding: 6px 10px; font-size: 0.75rem; }
        }

        /* Tablet modal adjustments */
        @media (min-width: 601px) and (max-width: 999px) {
            .modal-box { max-width: 90%; padding: 28px 24px; }
            .pricing-grid { gap: 12px; }
            .pricing-card { padding: 20px 18px; }
            .compare-table { font-size: 0.75rem; }
        }

        /* === LEGAL MODAL TABS === */
        .legal-tabs {
            display: flex; gap: 8px; border-bottom: 1px solid rgba(255,255,255,0.1);
            margin-bottom: 20px; padding-bottom: 8px; overflow-x: auto;
        }
        .legal-tab-btn {
            background: none; border: none; padding: 8px 16px; color: #94a3b8;
            font-size: 0.85rem; font-weight: 600; cursor: pointer; border-radius: 8px;
            white-space: nowrap; transition: all 0.2s;
        }
        .legal-tab-btn:hover { color: #f0f9ff; background: rgba(255,255,255,0.04); }
        .legal-tab-btn.active {
            color: #38bdf8; background: rgba(56,189,248,0.1);
            border: 1px solid rgba(56,189,248,0.25);
        }
        .legal-content-container {
            max-height: 420px; overflow-y: auto; text-align: left;
            padding-right: 8px; font-size: 0.82rem; color: #cbd5e1; line-height: 1.6;
        }
        .legal-content-container::-webkit-scrollbar { width: 6px; }
        .legal-content-container::-webkit-scrollbar-track { background: rgba(255,255,255,0.02); border-radius: 4px; }
        .legal-content-container::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }
        .legal-content-container::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

        .legal-section { display: none; }
        .legal-section.active { display: block; }
        .legal-section h4 { color: #e0f2fe; font-size: 0.95rem; margin-top: 20px; margin-bottom: 8px; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 4px; }
        .legal-section h4:first-of-type { margin-top: 0; }
        .legal-section p { margin-bottom: 12px; color: #cbd5e1; }
        .legal-section ul { margin-bottom: 16px; padding-left: 20px; list-style-type: disc; color: #cbd5e1; }
        .legal-section ul li { margin-bottom: 6px; }
        .legal-highlight { color: var(--color-accent-gold); font-weight: 600; }
        .legal-disclaimer-box {
            background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.2);
            border-radius: 10px; padding: 12px; margin: 16px 0; color: #fef08a; font-size: 0.78rem;
        }
        .pricing-disclaimer {
            font-size: 0.72rem; color: var(--color-text-faint); line-height: 1.4; margin-top: 14px; text-align: left;
        }

        /* === MODAL BOX (shared) === */
        .modal-box {
            background: var(--color-bg-elevated); backdrop-filter: blur(24px);
            border: 1px solid var(--color-border-default); border-radius: 20px;
            padding: 32px; max-width: 720px; width: 100%; position: relative;
            box-shadow: 0 24px 64px rgba(0,0,0,0.5);
            animation: modalIn var(--duration-normal) ease-out;
            max-height: 90vh; overflow-y: auto;
        }
        .modal-box::-webkit-scrollbar { width: 6px; }
        .modal-box::-webkit-scrollbar-track { background: transparent; }
        .modal-box::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }
        .modal-box::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }
        @keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
        .modal-close {
            position: sticky; top: 0; float: right;
            background: rgba(15,23,42,0.95); border: 1px solid rgba(255,255,255,0.15);
            border-radius: 10px; width: 36px; height: 36px;
            display: flex; align-items: center; justify-content: center;
            cursor: pointer; color: var(--color-text-muted); font-size: 1.2rem; transition: all var(--duration-fast);
            z-index: 10;
        }
        .modal-close:hover { background: rgba(239,68,68,0.2); color: var(--color-error); }
        .modal-title {
            font-size: 1.4rem; font-weight: 700; color: var(--color-text-primary);
            margin-bottom: 8px; display: flex; align-items: center; gap: 10px;
        }
        .modal-subtitle { color: var(--color-text-muted); font-size: 0.88rem; margin-bottom: 24px; line-height: 1.5; }

        /* === PAYWALL MODAL === */
        .pricing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
        @media (max-width: 900px) { 
            .pricing-grid { 
                grid-template-columns: 1fr; 
                max-width: 400px;
                margin: 0 auto 24px auto;
            } 
        }
        .pricing-card {
            background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08);
            border-radius: var(--radius-lg); padding: 24px; position: relative; transition: all var(--duration-normal);
        }
        .pricing-card:hover { border-color: rgba(56,189,248,0.3); transform: translateY(-2px); }
        .pricing-card.featured {
            border-color: rgba(56,189,248,0.4);
            box-shadow: 0 0 30px rgba(56,189,248,0.1), 0 0 60px rgba(139,92,246,0.05);
        }
        .pricing-badge {
            position: absolute; top: -10px; right: 16px;
            font-size: 0.65rem; font-weight: 800; padding: 4px 12px;
            border-radius: 20px; text-transform: uppercase; letter-spacing: 0.05em;
        }
        .pricing-badge.launch { background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff; }
        .pricing-badge.popular { background: linear-gradient(135deg, var(--color-primary), var(--color-secondary)); color: #fff; }
        .pricing-badge.offer { background: linear-gradient(135deg, #facc15, #f59e0b); color: #1e1b4b; }
        .pricing-card-title { font-size: 1rem; font-weight: 700; color: #e0f2fe; margin-bottom: 12px; }
        .price-row { margin-bottom: 16px; }
        .price-old { font-size: 1.1rem; color: var(--color-text-faint); text-decoration: line-through; margin-right: 8px; }
        .price-new { font-size: 2rem; font-weight: 800; color: var(--color-primary); }
        .price-period { font-size: 0.85rem; color: var(--color-text-muted); }
        .pricing-features { list-style: none; padding: 0; margin-bottom: 20px; }
        .pricing-features li {
            padding: 6px 0; font-size: 0.82rem; color: var(--color-text-secondary);  /* WCAG: Improved from #cbd5e1 for 5.8:1 contrast ratio */
            display: flex; align-items: center; gap: 8px;
        }
        .pricing-features li::before { content: '\2713'; color: var(--color-success); font-weight: 700; font-size: 0.9rem; }
        .btn-pricing {
            width: 100%; padding: 12px; border: none; border-radius: var(--radius-md);
            font-family: var(--font-sans); font-size: 0.9rem; font-weight: 700;
            cursor: pointer; transition: all var(--duration-normal);
        }
        /* PREMIUM = scuro + oro. L'oro è riservato SOLO alle azioni di acquisto, così
           "premium" sembra un livello superiore rispetto al cyan delle azioni gratuite. */
        .btn-pricing.primary {
            background: linear-gradient(135deg, #F5C451, #E0A82E);
            color: #1a1407; box-shadow: 0 4px 16px rgba(224,168,46,0.32);
        }
        .btn-pricing.primary:hover { transform: translateY(-1px); box-shadow: 0 6px 22px rgba(224,168,46,0.45); }
        .btn-pricing.primary:active { transform: scale(0.98); box-shadow: 0 2px 10px rgba(224,168,46,0.3); }
        .btn-pricing.secondary {
            background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.15);
            color: #e0f2fe;
        }
        .btn-pricing.secondary:hover { background: rgba(255,255,255,0.1); }

        .pricing-disclaimer {
            text-align: center; color: var(--color-text-faint); font-size: 0.78rem;
            margin-top: 16px; padding: 0 16px; line-height: 1.5;
        }

        /* Tabella comparativa */
        .compare-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
        .compare-table th, .compare-table td {
            padding: 8px 12px; text-align: left;
            border-bottom: 1px solid var(--color-border-subtle);
        }
        .compare-table th { color: var(--color-text-muted); font-weight: 600; text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.05em; }
        .compare-table td { color: #cbd5e1; }
        .compare-table td:last-child { color: var(--color-primary); font-weight: 600; }

        /* === LOGIN REQUIRED MODAL === */
        .login-modal-icon { font-size: 3rem; text-align: center; margin-bottom: 16px; }
        .btn-google-big {
            display: flex; align-items: center; justify-content: center; gap: 10px;
            width: 100%; padding: 14px; border-radius: var(--radius-md); border: none;
            background: #fff; color: #333; font-family: var(--font-sans);
            font-size: 0.95rem; font-weight: 700; cursor: pointer;
            transition: all var(--duration-fast); margin-bottom: 12px;
        }
        .btn-google-big:hover { background: #f1f5f9; transform: translateY(-1px); }
        .btn-google-big svg { width: 20px; height: 20px; }
        .btn-link-premium {
            display: block; text-align: center; color: var(--color-primary);
            font-size: 0.85rem; font-weight: 600; cursor: pointer;
            background: none; border: none; font-family: var(--font-sans);
            text-decoration: underline; text-underline-offset: 3px;
        }
        .btn-link-premium:hover { color: var(--color-primary-hover); }

        /* === ACCOUNT MODAL === */
        .account-info { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 24px; position: relative; }
        .account-avatar-wrapper { position: relative; width: 80px; height: 80px; margin-bottom: 10px; }
        .account-avatar { width: 100%; height: 100%; border-radius: 50%; border: 3px solid rgba(56,189,248,0.6); object-fit: cover; box-shadow: 0 0 20px rgba(56,189,248,0.3); }
        .account-avatar-fallback { width: 100%; height: 100%; border-radius: 50%; background: linear-gradient(135deg, #a855f7, #3b82f6); display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 800; color: white; border: 3px solid rgba(168,85,247,0.6); box-shadow: 0 0 20px rgba(168,85,247,0.3); }
        .account-name { font-size: 1.4rem; font-weight: 800; color: var(--color-text-primary); letter-spacing: -0.5px; }
        .account-email { font-size: 0.9rem; color: var(--color-text-muted); background: rgba(255,255,255,0.05); padding: 4px 12px; border-radius: 20px; margin-top: 4px; border: 1px solid rgba(255,255,255,0.05); }
        
        .account-stats {
            display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px;
        }
        .stat-card {
            background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08);
            border-radius: var(--radius-lg); padding: 20px 16px; text-align: center;
            box-shadow: inset 0 2px 10px rgba(255,255,255,0.02);
            transition: transform var(--duration-fast), background var(--duration-fast);
        }
        .stat-card:hover { transform: translateY(-2px); background: rgba(255,255,255,0.05); }
        .stat-value { font-size: 1.8rem; font-weight: 900; color: var(--color-primary); text-shadow: 0 2px 10px rgba(56,189,248,0.3); }
        .stat-label { font-size: 0.8rem; font-weight: 600; color: var(--color-text-muted); margin-top: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
        .stat-value.unlimited { color: var(--color-success); text-shadow: 0 2px 10px rgba(52,211,153,0.3); }

        /* Account Plan Section */
        .account-plan-section { margin-bottom: 24px; }
        .account-plan-card {
            display: flex; align-items: center; gap: 16px;
            background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08);
            border-radius: var(--radius-lg); padding: 16px 20px;
            transition: all var(--duration-normal) ease; box-shadow: 0 4px 15px rgba(0,0,0,0.2);
        }
        .account-plan-card.plan-premium {
            border-color: rgba(250,204,21,0.35);
            background: linear-gradient(135deg, rgba(250,204,21,0.06), rgba(56,189,248,0.04));
        }
        .account-plan-icon { font-size: 1.8rem; flex-shrink: 0; }
        .account-plan-name { font-size: 0.95rem; font-weight: 700; color: var(--color-text-primary); margin-bottom: 2px; }
        .account-plan-desc { font-size: 0.78rem; color: var(--color-text-muted); line-height: 1.4; }

        /* Logout Button in Account Modal */
        .btn-account-logout {
            display: flex; align-items: center; justify-content: center; gap: 8px;
            width: 100%; margin-top: 12px; padding: 10px 0;
            background: transparent; border: 1px solid rgba(239,68,68,0.25);
            border-radius: 10px; color: var(--color-error); font-size: 0.85rem; font-weight: 600;
            cursor: pointer; transition: all 0.25s ease;
        }
        .btn-account-logout:hover {
            background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.5);
            color: var(--color-error-hover);
        }
        .btn-account-logout svg { stroke: currentColor; }

        /* Manage Subscription Button */
        .btn-account-manage {
            display: flex; align-items: center; justify-content: center; gap: 8px;
            width: 100%; margin-top: 12px; padding: 10px 0;
            background: transparent; border: 1px solid rgba(250, 204, 21, 0.25);
            border-radius: 10px; color: #facc15; font-size: 0.85rem; font-weight: 600;
            cursor: pointer; transition: all 0.25s ease;
        }
        .btn-account-manage:hover {
            background: rgba(250, 204, 21, 0.1); border-color: rgba(250, 204, 21, 0.5);
            color: #fde68a;
        }
        .btn-account-manage svg { stroke: currentColor; }

        /* Mobile auth adjustments */
        @media (max-width: 768px) {
            .auth-section { margin-left: 0; }
            .user-name { display: none; }
            .navbar-mobile-panel .auth-section-mobile { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,0.06); }
        }
        
        /* === HIDE SUGGESTIONS FOR PREMIUM === */
        body.is-premium .content-block {
            display: none !important;
        }

        /* ============================================ */
        /* ACCESSIBILITY & UX IMPROVEMENTS */
        /* ============================================ */

        /* WCAG: Focus indicators for keyboard navigation */
        *:focus-visible {
            outline: 2px solid rgba(96, 165, 250, 0.8);
            outline-offset: 2px;
            border-radius: 4px;
        }

        /* Remove default outline but keep focus-visible */
        button:focus:not(:focus-visible),
        a:focus:not(:focus-visible),
        input:focus:not(:focus-visible) {
            outline: none;
        }

        /* Enhanced focus for interactive elements */
        .btn:focus-visible,
        .nav-link:focus-visible,
        .faq-question:focus-visible {
            outline: 3px solid rgba(96, 165, 250, 0.9);
            outline-offset: 3px;
        }

        /* Disabled button states */
        .btn:disabled,
        .btn[disabled],
        button:disabled,
        button[disabled] {
            opacity: 0.5;
            cursor: not-allowed;
            pointer-events: none;
        }

        /* Hover state for enabled buttons only */
        .btn:not(:disabled):hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 25px rgba(56, 189, 248, 0.35);
        }

        /* Loading skeleton animation */
        .skeleton {
            background: linear-gradient(
                90deg,
                rgba(255, 255, 255, 0.05) 25%,
                rgba(255, 255, 255, 0.1) 50%,
                rgba(255, 255, 255, 0.05) 75%
            );
            background-size: 200% 100%;
            animation: shimmer 1.5s infinite;
            border-radius: 8px;
        }

        @keyframes shimmer {
            0% { background-position: 200% 0; }
            100% { background-position: -200% 0; }
        }

        /* Skip to content link for screen readers */
        .skip-to-content {
            position: absolute;
            top: -40px;
            left: 0;
            background: #38bdf8;
            color: #0f172a;
            padding: 8px 16px;
            text-decoration: none;
            border-radius: 0 0 8px 0;
            font-weight: 600;
            z-index: 10000;
        }

        .skip-to-content:focus {
            top: 0;
        }

        /* Improved error state styling */
        .error-state {
            color: #fca5a5;
            background: rgba(239, 68, 68, 0.1);
            border: 1px solid rgba(239, 68, 68, 0.3);
            padding: 12px 16px;
            border-radius: 12px;
            margin-top: 12px;
            font-size: 0.85rem;
        }

        /* Success state styling */
        .success-state {
            color: #86efac;
            background: rgba(34, 197, 94, 0.1);
            border: 1px solid rgba(34, 197, 94, 0.3);
            padding: 12px 16px;
            border-radius: 12px;
            margin-top: 12px;
            font-size: 0.85rem;
        }

        /* Ensure modals are accessible */
        .modal-overlay[aria-hidden="true"] {
            display: none;
        }

        .modal-overlay[aria-hidden="false"] {
            display: flex;
        }/* ============================================================
   TOP-TIER USER DROPDOWN - Glassmorphism redesign
   ============================================================ */
.user-dropdown {
    display: block;
    position: absolute;
    top: 48px;
    right: 0;
    z-index: 200;
    min-width: 248px;
    padding: 8px;
    background: rgba(10, 17, 35, 0.97);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    backdrop-filter: blur(24px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.55), 0 8px 24px -8px rgba(0, 0, 0, 0.4), inset 0 1px 0 0 rgba(255, 255, 255, 0.06);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px) scale(0.97);
    transform-origin: top right;
    transition: opacity 0.22s cubic-bezier(0.22, 1, 0.36, 1), transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.22s;
}
.user-dropdown.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}
.dropdown-header {
    padding: 14px 13px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.user-name {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #f8fafc;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-email {
    font-size: 0.74rem;
    color: #94a3b8;
    margin-top: 3px;
    max-width: 210px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-plan {
    font-size: 0.68rem;
    font-weight: 600;
    color: #7dd3fc;
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.dropdown-item, .user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 11px 13px;
    margin: 1px 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #cbd5e1;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}
.dropdown-item:hover, .user-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    transform: translateX(4px);
}
.dropdown-item svg, .user-dropdown-item svg {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 2px;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.85;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.dropdown-item:hover svg, .user-dropdown-item:hover svg {
    opacity: 1;
    color: #38bdf8;
}
.dropdown-item.text-danger { color: #f87171; }
.dropdown-item.text-danger:hover { background: rgba(239, 68, 68, 0.12); color: #fecaca; }
.user-dropdown-item.premium-item { color: #fbbf24; }
.user-dropdown-item.premium-item:hover { background: rgba(251, 191, 36, 0.1); color: #fde68a; }
.premium-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #422006;
    background: linear-gradient(135deg, #fde68a 0%, #f59e0b 55%, #d97706 100%);
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    white-space: nowrap;
}
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(56, 189, 248, 0.55);
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.25);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.user-btn:hover .user-avatar {
    border-color: #38bdf8;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.6), 0 0 16px rgba(56, 189, 248, 0.4);
}

/* === BUTTON MICRO-INTERACTIONS === */
.btn:active,
.part-btn:active,
.modal-btn:active,
.btn-pricing:active,
.navbar-upgrade-btn:active,
.shop-tab-btn:active {
    transform: scale(0.98);
}

/* === CHAT CON PDF INTERFACE === */
.chat-recent-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border-radius: var(--radius-md); cursor: pointer;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(56, 189, 248, 0.15);
    transition: all var(--duration-fast); text-align: left;
}
.chat-recent-item:hover { background: rgba(56, 189, 248, 0.08); border-color: rgba(56,189,248,0.4); transform: translateX(3px); }
.chat-recent-item .cri-icon { color: var(--color-primary); flex-shrink: 0; }
.chat-recent-item .cri-title { font-size: 0.88rem; color: var(--color-text-primary); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-recent-item .cri-meta { font-size: 0.72rem; color: var(--color-text-muted); margin-top: 2px; }
.chat-recent-item .cri-resume { margin-left: auto; flex-shrink: 0; font-size: 0.75rem; font-weight: 700; color: var(--color-primary); }

#chat-fullscreen {
    position: fixed; inset: 0; z-index: 5000;
    background: var(--color-bg-base); color: var(--color-text-primary);
    display: none; flex-direction: column;
    font-family: var(--font-sans);
}
#chat-fullscreen.open { display: flex; }
body.chat-open { overflow: hidden; }

.cf-topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 16px; background: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid rgba(56, 189, 248, 0.18); flex-shrink: 0;
}
.cf-file { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 600; min-width: 0; }
.cf-file span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw; }
.cf-session { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.cf-progress { display: flex; flex-direction: column; gap: 4px; font-size: 0.75rem; color: var(--color-text-muted); min-width: 120px; }
.cf-progress strong { color: var(--color-primary); }
.cf-progress-bar { height: 5px; border-radius: 4px; background: rgba(255,255,255,0.08); overflow: hidden; }
.cf-progress-fill { height: 100%; width: 0%; border-radius: 4px; background: linear-gradient(90deg, var(--color-primary), var(--color-secondary)); transition: width var(--duration-normal); }
.cf-btn-end {
    background: transparent; border: 1px solid rgba(244, 63, 94, 0.5); color: #f43f5e;
    border-radius: var(--radius-sm); padding: 7px 14px; font-weight: 600; font-size: 0.78rem; cursor: pointer; transition: all var(--duration-fast); white-space: nowrap;
}
.cf-btn-end:hover { background: rgba(244, 63, 94, 0.12); }

.cf-body { display: flex; flex: 1; min-height: 0; }

.cf-pdf-pane {
    flex: 1; min-width: 0; position: relative;
    background: #11182a; border-right: 1px solid rgba(56, 189, 248, 0.18);
    display: flex; flex-direction: column;
}
.cf-pdf-scroll { flex: 1; overflow: auto; padding: 18px; -webkit-overflow-scrolling: touch; }
.cf-pageWrap { position: relative; margin: 0 auto 14px; box-shadow: 0 4px 18px rgba(0,0,0,0.5); background: #fff; }
.cf-pageWrap canvas { display: block; }
.cf-pdf-loading { color: var(--color-text-muted); text-align: center; padding: 40px 12px; font-size: 0.9rem; }

.textLayer {
  position: absolute; inset: 0; overflow: hidden;
  line-height: 1; opacity: 1;
  -webkit-user-select: none; -moz-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.textLayer > span, .textLayer span {
  color: transparent; position: absolute; white-space: pre;
  transform-origin: 0 0; cursor: text;
  -webkit-user-select: text; -moz-user-select: text; user-select: text;
  overflow: hidden; padding: 0; margin: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: default;
}
.textLayer::selection,
.textLayer *:not(span)::selection { background: transparent; color: transparent; }
.textLayer::-moz-selection,
.textLayer *:not(span)::-moz-selection { background: transparent; color: transparent; }
.textLayer span::selection { background: rgba(66, 133, 244, 0.22); color: transparent; }
.textLayer span::-moz-selection { background: rgba(66, 133, 244, 0.22); color: transparent; }

.cf-ctxmenu {
    position: absolute; z-index: 60;
    background: #1e293b; border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: var(--radius-sm); box-shadow: 0 10px 25px rgba(0,0,0,0.55);
    display: flex; align-items: center; padding: 4px; gap: 2px;
}
.cf-ctxmenu::after {
    content: ''; position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%);
    border-width: 6px 6px 0; border-style: solid;
    border-color: #1e293b transparent transparent transparent;
}
.cf-ctxmenu.below::after {
    bottom: auto; top: -6px; border-width: 0 6px 6px;
    border-color: transparent transparent #1e293b transparent;
}
.cf-ctx-btn {
    background: transparent; border: none; color: var(--color-text-primary);
    font-size: 0.8rem; font-weight: 500; padding: 7px 12px; border-radius: 7px;
    cursor: pointer; transition: all var(--duration-fast); white-space: nowrap;
}
.cf-ctx-btn:hover { background: rgba(56, 189, 248, 0.18); color: var(--color-primary); }

.cf-chat-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--color-bg-base); }
.cf-chat-header { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid rgba(255,255,255,0.06); flex-shrink: 0; }
.cf-badge { background: linear-gradient(135deg, var(--color-primary), var(--color-secondary)); color:#fff; font-size:0.68rem; font-weight:700; padding:3px 9px; border-radius:20px; letter-spacing:0.5px; }
.cf-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 18px; -webkit-overflow-scrolling: touch; }

.cf-msg { display: flex; gap: 12px; max-width: 92%; }
.cf-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.cf-msg.ai { align-self: flex-start; }
.cf-avatar { width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0; display:flex; align-items:center; justify-content:center; }
.cf-avatar svg { width: 18px; height: 18px; stroke: #fff; fill: none; stroke-width: 2; }
.cf-msg.user .cf-avatar { background: #475569; }
.cf-msg.ai .cf-avatar { background: transparent; }
.cf-bubble { padding: 12px 16px; border-radius: 14px; font-size: 0.92rem; line-height: 1.6; word-break: normal; overflow-wrap: break-word; hyphens: none; }
.cf-msg.user .cf-bubble { background: #1e293b; border: 1px solid rgba(255,255,255,0.06); border-top-right-radius: 4px; }
.cf-msg.ai .cf-bubble { background: rgba(56, 189, 248, 0.08); border: 1px solid rgba(56, 189, 248, 0.2); border-top-left-radius: 4px; }
.cf-bubble p { margin: 0 0 8px; } .cf-bubble p:last-child { margin-bottom: 0; }
.cf-bubble ul { margin: 6px 0; padding-left: 20px; } .cf-bubble li { margin-bottom: 4px; }
.cf-bubble strong { color: var(--color-text-secondary); }
.cf-bubble .cf-cite { display:inline-block; background: rgba(56,189,248,0.2); color: var(--color-primary-hover); font-size:0.7rem; font-weight:700; padding:1px 6px; border-radius:4px; margin: 0 2px; }

.cf-suggested { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.cf-sugg-btn {
    background: rgba(15, 23, 42, 0.6); border: 1px solid rgba(56, 189, 248, 0.3); color: var(--color-primary);
    padding: 9px 13px; border-radius: var(--radius-sm); text-align: left; cursor: pointer; transition: all var(--duration-fast); font-size: 0.84rem; font-family: var(--font-sans);
}
.cf-sugg-btn:hover { background: rgba(56, 189, 248, 0.1); transform: translateX(3px); }

.cf-typing { display: inline-flex; gap: 4px; align-items: center; padding: 4px 2px; }
.cf-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--color-primary); opacity: 0.5; animation: cfBlink 1.2s infinite; }
.cf-typing span:nth-child(2){ animation-delay: 0.2s; } .cf-typing span:nth-child(3){ animation-delay: 0.4s; }
@keyframes cfBlink { 0%,60%,100%{ opacity:0.25; transform: translateY(0);} 30%{ opacity:1; transform: translateY(-3px);} }

.cf-input-wrap { padding: 14px 18px 16px; border-top: 1px solid rgba(255,255,255,0.06); flex-shrink: 0; background: var(--color-bg-base); }
.cf-input-box { display: flex; align-items: flex-end; gap: 8px; background: #1e293b; border: 1px solid rgba(56, 189, 248, 0.3); border-radius: 14px; padding: 6px 8px 6px 14px; transition: border-color var(--duration-fast); }
.cf-input-box:focus-within { border-color: var(--color-primary); }
.cf-input-box textarea { flex: 1; background: transparent; border: none; color: #fff; font-family: var(--font-sans); font-size: 0.95rem; padding: 8px 0; resize: none; outline: none; max-height: 140px; min-height: 22px; }
.cf-input-box textarea::placeholder { color: var(--color-text-muted); }
.cf-send { background: linear-gradient(135deg, var(--color-primary), var(--color-secondary)); border: none; width: 40px; height: 40px; border-radius: 11px; display:flex; align-items:center; justify-content:center; cursor: pointer; flex-shrink: 0; transition: transform var(--duration-fast), opacity var(--duration-fast); }
.cf-send:hover { transform: scale(1.05); }
.cf-send:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.cf-send svg { width: 19px; height: 19px; stroke: #fff; fill: none; stroke-width: 2.5; margin-left: -2px; }
.cf-hint { text-align: center; font-size: 0.7rem; color: var(--color-text-muted); margin-top: 8px; }

.cf-mobile-toggle { display: none; }

@media (max-width: 860px) {
    .cf-file span { max-width: 38vw; }
    .cf-progress { min-width: 90px; }
    .cf-pdf-pane, .cf-chat-pane { display: none; }
    #chat-fullscreen.mobile-doc .cf-pdf-pane { display: flex; flex: 1; }
    #chat-fullscreen.mobile-chat .cf-chat-pane { display: flex; flex: 1; }
    .cf-body { padding-bottom: 56px; }
    .cf-mobile-toggle {
        display: flex; position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%);
        background: #1e293b; border: 1px solid rgba(56,189,248,0.3); border-radius: 30px; padding: 4px; gap: 4px; z-index: 6000;
        box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    }
    .cf-tab { background: transparent; border: none; color: var(--color-text-muted); font-family: var(--font-sans); font-size: 0.82rem; font-weight: 600; padding: 10px 20px; min-height: 44px; border-radius: 26px; cursor: pointer; }
    .cf-tab.active { background: linear-gradient(135deg, var(--color-primary), var(--color-secondary)); color: #fff; }
    .cf-msg { max-width: 96%; }
}
@media (max-width: 480px) {
    .cf-topbar { gap: 8px; padding: 10px 12px; }
    .cf-session { gap: 8px; }
    .cf-progress { min-width: 60px; }
    .cf-progress span { font-size: 0.7rem; }
    .cf-btn-end { padding: 7px 10px; font-size: 0.74rem; min-height: 36px; }
    .cf-file span { max-width: 30vw; }
}

@media (max-width: 400px) {
    .trust-row { font-size: 0.72rem !important; gap: 6px 10px !important; }
}

/* === ACCESSIBILITY: PREFERS REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    body::before { animation: none !important; }
    .particle { display: none !important; }
    .kit-teaser-link::before,
    .kit-teaser-link::after { animation: none !important; }
}
