   #sloth-chat-wrapper {
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: 350px;
        z-index: 9999;
        font-family: 'Inter', sans-serif;
        transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        
        /* NEW: Let clicks pass right through the invisible box */
        pointer-events: none; 
    }
    /* Trigger Pill */
    .chat-trigger {
        background: #5a9bd5;
        color: #000;
        padding: 12px 20px;
        border-radius: 25px;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 10px;
        font-weight: 800;
        box-shadow: 0 4px 15px rgba(0,0,0,0.4);
        float: right;
        
        /* NEW: Make sure the button itself remains clickable! */
        pointer-events: auto; 
    }

   /* Chat Window Styles */
    .chat-window {
        background: #1a1d24;
        border: 2px solid #404040;
        border-radius: 8px;
        display: flex;
        flex-direction: column;
        height: 450px;
        margin-bottom: 15px;
        overflow: hidden;
        box-shadow: 0 10px 30px rgba(0,0,0,0.5);
        opacity: 0;
        visibility: hidden;
        transform: translateY(20px);
        transition: all 0.3s ease;
        
        /* NEW: Make the window clickable only when it is open */
        pointer-events: auto; 
    }

    /* State: Open */
    #sloth-chat-wrapper.chat-open .chat-window {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .chat-header {
        background: #2a2a2a;
        padding: 15px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid #404040;
        color: #fff;
        font-weight: bold;
    }

    .close-btn { background: none; border: none; color: #888; font-size: 20px; cursor: pointer; }

    .chat-content {
        flex: 1;
        overflow-y: auto;
        padding: 15px;
        display: flex;
        flex-direction: column;
        gap: 10px;
        background: #0f1115;
    }

    /* Modern Message Bubbles */
    .chat-bubble {
        background: #1a1d24;
        padding: 10px;
        border-radius: 8px;
        font-size: 0.9rem;
        border: 1px solid #2a2e39;
    }
    .chat-bubble strong { color: #ff981f; display: block; font-size: 0.75rem; margin-bottom: 2px; }

    .chat-input-container {
        padding: 10px;
        background: #2a2a2a;
        display: flex;
        gap: 10px;
    }

    #chat-input-field {
        flex: 1;
        background: #1a1d24;
        border: 1px solid #404040;
        padding: 8px 12px;
        color: #fff;
        border-radius: 4px;
    }

    .chat-input-container button {
        background: #ff981f;
        border: none;
        color: #000;
        border-radius: 4px;
        padding: 0 15px;
        cursor: pointer;
        font-weight: bold;
    }

    .chat-login-prompt { padding: 15px; text-align: center; color: #888; font-size: 0.8rem; }
    .chat-login-prompt a { color: #ff981f; text-decoration: none; font-weight: bold; }

    .hidden { display: none; }
/* =========================================
       📱 MOBILE CHAT WIDGET OPTIMIZATION
       ========================================= */
    @media (max-width: 600px) {
        /* 1. When closed, let it shrink to the pill size and hug the corner */
        #sloth-chat-wrapper {
            bottom: 15px;
            right: 15px;
            width: auto; 
        }

        /* 2. When open, take over the screen so the keyboard doesn't break the layout */
        #sloth-chat-wrapper.chat-open {
            pointer-events: auto;
        }

        /* 3. Snap the chat window to the edges */
        #sloth-chat-wrapper.chat-open .chat-window {
            height: 100%;
            margin-bottom: 0;
            border-radius: 0;
            border: none;
            border-top: 2px solid #5a9bd5; /* Match your trigger pill accent */
        }

        /* 4. Hide the floating trigger pill when the chat is open to save space */
        #sloth-chat-wrapper.chat-open .chat-trigger {
            display: none;
        }

        /* 5. Mobile Input Fixes */
        .chat-input-container {
            padding: 12px;
            padding-bottom: env(safe-area-inset-bottom, 12px); /* iPhone notch/home bar support */
        }

        #chat-input-field {
            padding: 12px 15px;
            font-size: 16px; /* CRITICAL: Prevents iOS from auto-zooming the page when typing */
        }
        
        .chat-input-container button {
            padding: 0 20px; /* Slightly wider for easier thumb tapping */
        }
    }