/* --- 1. ГЛОБАЛЬНАЯ ЗАЩИТА --- */
#matrix-chat-popup ul,
#matrix-chat-popup li,
#hydrogen-chat-container ul,
#hydrogen-chat-container li {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
}

/* --- 2. ПРАВИЛА ДЛЯ ОКНА (Когда оно открыто) --- */
#matrix-chat-popup {
    /* 🛑 УДАЛИЛИ display: flex !important */
    /* Теперь CSS не мешает скрипту делать .hide() и .show() */
    
    flex-direction: column !important;
    position: fixed !important;
    bottom: 20px;
    right: 20px;
    width: 350px;
    height: 500px;
    z-index: 999999 !important;
    background: #fff;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    border-radius: 8px;
    overflow: hidden;
}

#hydrogen-chat-container {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    width: 100% !important;
}

/* --- 3. МОБИЛЬНЫЙ ОВЕРЛЕЙ --- */
@media screen and (max-width: 768px) {
    #matrix-chat-popup {
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100dvh !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }

    #hydrogen-chat-container .MessageComposer {
        padding-bottom: env(safe-area-inset-bottom) !important;
    }
}