:root {
    /* --- LIGHT THEME (Default) --- */
    --bg-app: linear-gradient(165deg, rgba(233, 245, 248, 1) 0%, rgba(255, 216, 192, 1) 69%, rgba(192, 156, 136, 1) 100%);
    --bg-sidebar: rgba(255, 255, 255, 0.6);
    --bg-chat: rgba(255, 255, 255, 0.4);
    --bg-input: rgba(255, 255, 255, 0.8);
    --bg-modal: rgba(255, 255, 255, 0.9);
    --text-primary: #2a4061;
    --text-secondary: #666;
    --msg-sent: #ff907c;
    --msg-text-sent: #fff;
    --msg-received: #ffffff;
    --msg-text-received: #2a4061;
    --border-color: rgba(255,255,255,0.5);
    --hover-color: rgba(255,255,255,0.5);
    --shadow: 0 5px 15px rgba(0,0,0,0.1);
    --icon-invert: 0;
    
    /* Zmienne dla bezpiecznych obszarów (notch/home bar na iPhone) */
    --safe-top: env(safe-area-inset-top, 20px);
    --safe-bottom: env(safe-area-inset-bottom, 20px);
}

[data-theme="dark"] {
    /* --- DARK THEME --- */
    --bg-app: #202225;
    --bg-sidebar: #2f3136;
    --bg-chat: #36393f;
    --bg-input: #40444b;
    --bg-modal: #36393f;
    --text-primary: #dcddde;
    --text-secondary: #b9bbbe;
    --msg-sent: #5865f2;
    --msg-text-sent: #fff;
    --msg-received: #2f3136;
    --msg-text-received: #dcddde;
    --border-color: #202225;
    --hover-color: #393c43;
    --shadow: 0 5px 15px rgba(0,0,0,0.5);
    --icon-invert: 1;
}

* { box-sizing: border-box; font-family: 'Lato', sans-serif; transition: background 0.3s, color 0.1s; }

body {
    margin: 0; padding: 0; 
    height: 100dvh; 
    width: 100vw;
    overflow: hidden;
    background: var(--bg-app); color: var(--text-primary);
    /* Zapobiega "gumowaniu" strony na iOS */
    overscroll-behavior: none;
}

.hidden { display: none !important; }

/* --- AUTH --- */
.center-form-container-parent { display: flex; justify-content: center; align-items: center; height: 100dvh; }
.center-form-container {
    padding: 40px; width: 100%; max-width: 450px;
    background: var(--bg-sidebar); backdrop-filter: blur(10px);
    border-radius: 20px; box-shadow: var(--shadow);
}
h1 { font-family: 'Sigmar', cursive; text-align: center; color: var(--text-primary); margin-bottom: 30px; }
.auth-input {
    width: 100%; padding: 12px; margin-bottom: 10px; border-radius: 8px; border: 1px solid #ccc;
    background: var(--bg-input); color: var(--text-primary);
}
.primary-btn {
    width: 100%; padding: 12px; background: var(--msg-sent); color: white; border: none;
    border-radius: 8px; font-weight: bold; cursor: pointer; transition: filter 0.2s; margin-bottom: 10px;
}
.primary-btn:hover { filter: brightness(1.1); }
.secondary { 
    width: 100%; background: transparent; border: 1px solid var(--border-color); color: var(--text-secondary); 
    padding: 12px; border-radius: 8px; cursor: pointer; text-align: center;
}
#auth-error { color: #ff4444; text-align: center; margin-top: 10px; }
#toggle-auth { text-align: center; margin-top: 15px; cursor: pointer; font-size: 0.9em; color: var(--text-secondary); }

/* --- LAYOUT --- */
#app-wrapper { display: flex; width: 100%; height: 100dvh; overflow: hidden; }

.sidebar {
    width: 320px; background: var(--bg-sidebar); border-right: 1px solid var(--border-color);
    display: flex; flex-direction: column; flex-shrink: 0;
    
    /* FIX: Margines na górze (pod zegarem) i na dole */
    padding-top: var(--safe-top); 
    padding-bottom: var(--safe-bottom);
}

.user-profile {
    padding: 15px; display: flex; align-items: center; gap: 10px; cursor: pointer;
    border-bottom: 1px solid var(--border-color);
}
.user-profile:hover { background: var(--hover-color); }
.avatar {
    width: 45px; height: 45px; border-radius: 50%; background-color: #ddd;
    background-size: cover; background-position: center; flex-shrink: 0;
}
.icon-btn { background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 1.2em; }
.icon-btn:hover { color: var(--msg-sent); }

/* Search & Tabs */
.search-input {
    width: 100%; padding: 10px; border-radius: 15px; border: none;
    background: var(--bg-input); color: var(--text-primary); outline: none;
}
#search-results {
    position: absolute; top: 60px; left: 15px; right: 15px;
    background: var(--bg-modal); border-radius: 10px; box-shadow: var(--shadow);
    z-index: 1000; max-height: 200px; overflow-y: auto;
}
.search-item { padding: 10px; border-bottom: 1px solid var(--border-color); cursor: pointer; display: flex; align-items: center; gap: 10px; }
.search-item:hover { background: var(--hover-color); }

.sidebar-tabs { display: flex; border-bottom: 1px solid var(--border-color); }
.tab-btn {
    flex: 1; background: transparent; border: none; padding: 12px;
    color: var(--text-secondary); cursor: pointer; font-weight: bold;
    border-bottom: 2px solid transparent;
}
.tab-btn:hover { background: var(--hover-color); }
.tab-btn.active { color: var(--msg-sent); border-bottom-color: var(--msg-sent); }

/* Conversation List */
#conversations-list { flex: 1; overflow-y: auto; overflow-x: hidden;}
.conv-item { padding: 12px 15px; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.conv-item:hover { background: var(--hover-color); }
.conv-item.active { background: var(--hover-color); border-left: 4px solid var(--msg-sent); }
/* --- NIEPRZECZYTANE WIADOMOŚCI --- */
.conv-item { 
    position: relative; 
}
.unread-dot {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px; /* Trochę większa */
    height: 14px;
    background-color: #f23f42; /* Discordowy czerwony */
    border-radius: 50%;
    display: none;
    box-shadow: 0 0 5px rgba(242, 63, 66, 0.8);
    z-index: 10;
}
.conv-item.unread .unread-dot { 
    display: block; 
}
.conv-item.unread { 
    font-weight: bold; 
    background: rgba(255, 144, 124, 0.1); 
}

.secondary-btn { 
    width: 100%; padding: 8px; border: 1px dashed var(--border-color); 
    background: transparent; color: var(--text-secondary); border-radius: 8px; cursor: pointer; margin-top: 10px;
}
.secondary-btn:hover { border-color: var(--msg-sent); color: var(--msg-sent); }

/* --- CHAT AREA --- */
.chat-area { 
    flex: 1; display: flex; flex-direction: column; 
    background: var(--bg-chat); position: relative; min-width: 0; 
    height: 100%;
}
#empty-state { display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%; color: var(--text-secondary); }
#active-chat { display: flex; flex-direction: column; height: 100%; overflow: hidden; }

.chat-header {
    /* Wysokość nagłówka + bezpieczny obszar */
    min-height: 60px;
    padding-top: calc(var(--safe-top) + 10px); 
    padding-bottom: 10px;
    padding-left: 20px; padding-right: 20px;
    
    display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid var(--border-color); font-weight: bold; background: var(--bg-sidebar);
    flex-shrink: 0;
}

#messages-container {
    flex: 1; 
    overflow-y: auto; 
    padding: 20px; 
    display: flex; 
    flex-direction: column; 
    gap: 0;
    min-height: 0; 
    /* DODANE ZABEZPIECZENIA NA MOBILE: */
    -webkit-overflow-scrolling: touch; /* Płynny scroll na iOS */
    overscroll-behavior-y: contain; /* Blokuje wyciąganie całego czatu poza krawędzie ekranu */
    overflow-anchor: auto; /* Natywna pomoc przeglądarki w utrzymaniu pozycji przy dopisywaniu na górze */
}

/* Messages */
.msg-row {
    display: flex; 
    align-items: flex-end; 
    position: relative; 
    width: 100%; 
    overflow: hidden;
}
.msg {
    max-width: 70%; 
    padding: 8px 12px; 
    border-radius: 18px; 
    font-size: 15px; 
    line-height: 1.4;
    position: relative; 
    word-wrap: break-word; 
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.msg-group.group-mine .msg-row { justify-content: flex-end; }
.msg-group.group-theirs .msg-row { justify-content: flex-start; }

.msg.mine { 
    background: var(--msg-sent); 
    color: var(--msg-text-sent); 
    border-bottom-right-radius: 4px; 
    /* Usunięto margin-left: auto */
}
.msg.theirs { 
    background: var(--msg-received); 
    color: var(--msg-text-received); 
    border-bottom-left-radius: 4px; 
    /* Usunięto margin-right: auto */
}

.msg img { 
    max-width: 400px; 
    max-height: 300px;
    width: auto;
    border-radius: 10px; 
    cursor: pointer; 
    
    -webkit-touch-callout: none; /* Ważne dla iOS */
    pointer-events: auto; /* Upewniamy się, że kliknięcia nadal działają */
    -webkit-touch-callout: none; /* iOS Safari */
      -webkit-user-select: none; /* Safari */
       -khtml-user-select: none; /* Konqueror HTML */
         -moz-user-select: none; /* Old versions of Firefox */
          -ms-user-select: none; /* Internet Explorer/Edge */
              user-select: none; /* Non-prefixed version, currently
                                    supported by Chrome, Edge, Opera and Firefox */
}
.msg-row{
    overflow: hidden;
}
/* File Attachment */
.file-attachment {
    display: flex; align-items: center; gap: 10px;
    text-decoration: none; color: inherit; 
    background: rgba(0,0,0,0.1); padding: 8px 12px;
    border-radius: 12px; transition: background 0.2s;
    border: 1px solid rgba(255,255,255,0.2);
}
.file-attachment:hover { background: rgba(0,0,0,0.2); }
.file-icon { font-size: 24px; }
.file-info { display: flex; flex-direction: column; overflow: hidden; flex: 1; min-width: 0; }
.file-name { font-weight: bold; font-size: 0.95em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.file-type { font-size: 0.75em; opacity: 0.8; text-transform: uppercase; }
.file-download-icon { font-size: 1.2em; opacity: 0.7; }
.msg.file-bubble { padding: 4px; }

/* Date Separator */
.date-separator {
    text-align: center; margin: 15px 0; position: relative; font-size: 0.8em; color: var(--text-secondary);
}
.date-separator::before {
    content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 1px;
    background: var(--border-color); z-index: -1;
}
.date-separator span { background: var(--bg-chat); padding: 0 10px; }

/* Reactions */
.reaction-btn-add { 
    opacity: 0; 
    cursor: pointer; font-size: 1.2em; margin: 0 5px; color: var(--text-secondary); 
    transition: 0.2s; 
    padding: 5px; 
}
.msg-group.group-mine .reactions-container { 
    justify-content: flex-end; 
}
.reactions-container { display: flex; gap: 4px; margin-top: -2px; margin-bottom: 2px; }
.msg.mine + .reactions-container { justify-content: flex-end; }
.reaction-pill {
    background: var(--bg-input); border: 1px solid var(--border-color); border-radius: 12px;
    padding: 2px 6px; font-size: 0.85em; cursor: pointer; display: flex; align-items: center; gap: 4px; user-select: none;
}
.reaction-pill:hover { border-color: var(--msg-sent); }
.reaction-pill.active { background: rgba(88, 101, 242, 0.15); border-color: var(--msg-sent); color: var(--msg-sent); }

/* Input & Drag Drop */
.input-wrapper {
    padding: 10px;
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    padding-bottom: calc(10px + var(--safe-bottom));
}
.input-wrapper.dragover { border: 2px dashed var(--msg-sent); background: rgba(255,255,255,0.8); }

.input-area {
    background: var(--bg-input); border-radius: 25px; padding: 5px 15px;
    display: flex; align-items: center; gap: 10px;
}
#message-input { flex: 1; background: transparent; border: none; color: var(--text-primary); outline: none; padding: 10px 0; }
.action-btn { background: none; border: none; font-size: 1.2em; color: var(--text-secondary); cursor: pointer; }
.action-btn:hover { color: var(--msg-sent); }
.send-icon { color: var(--msg-sent); font-size: 1.5em; }

/* GIF Picker & Preview */
#gif-picker {
    position: absolute; bottom: 80px; right: 20px; width: 320px; height: 400px;
    background: var(--bg-modal); border-radius: 10px; box-shadow: var(--shadow);
    padding: 10px; z-index: 500; display: flex; flex-direction: column;
}
.gif-header { font-weight: bold; margin-bottom: 10px; border-bottom: 1px solid var(--border-color); padding-bottom: 5px; display: flex;}
.gif-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; overflow-y: auto; }
.gif-item { width: 100%; height: 100px; object-fit: cover; cursor: pointer; border-radius: 5px; }
.gif-item:hover { transform: scale(1.02); }

#close-gif-picker{
    padding: 3px 5px 5px 10px;
    font-weight: bold;
    cursor: pointer;
}

#image-preview { padding: 10px; background: var(--bg-input); margin-bottom: 10px; border-radius: 10px; display: inline-flex; align-items: center; gap: 10px; }
#preview-img { height: 80px; border-radius: 5px; }

/* --- MODALS & TOASTS --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); z-index: 1000; display: flex; justify-content: center; align-items: center;
}
.settings-modal {
    background: var(--bg-modal);
    width: 100%;
    max-width: 800px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: row;
    overflow: hidden;
    padding: 0;
    max-height: 80vh;
}

.settings-navigator {
    width: 230px;
    background: rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    padding: 20px;
    margin: 0;
    border-right: 1px solid var(--border-color);
}
[data-theme="dark"] .settings-navigator {
    background: rgba(255, 255, 255, 0.03);
}

.settings-navigator ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-navigator ul li {
    padding: 12px 15px;
    cursor: pointer;
    border-radius: 8px;
    font-weight: bold;
    color: var(--text-secondary);
    transition: background 0.2s, color 0.2s;
}

.settings-navigator ul li:hover {
    background: var(--hover-color);
    color: var(--text-primary);
}

.settings-content {
    flex: 1;
    padding: 30px;
    margin-left: 0;
    border-left: none;
    overflow-y: auto;
}
.settings-content{
    width: calc(100% - 10px);
    margin-left: 15px;
    border-left: 1px solid #00000045;
    padding:10px;
    padding-left: 15px;
    min-height:500px;
}
.settings-navigator{
    width: 200px;
    display: flex;
    justify-content: start;
    flex-direction: column;
    padding-left: 10px;
    align-items: flex-start;
    margin-bottom: auto;
    margin-top: 20px;
}
.settings-navigator ul{
    list-style: none;
    padding: 0;
    margin-top: 0;
}
.settings-navigator ul li{
    padding: 8px 0;
    cursor:pointer;
}
.settings-navigator ul li:hover{
    opacity: 0.5;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.setting-group { margin-bottom: 20px; }
.theme-options { display: flex; gap: 10px; margin-top: 5px; }
.theme-btn { flex: 1; padding: 10px; border: 1px solid var(--border-color); background: var(--bg-input); text-align: center; border-radius: 8px; cursor: pointer; }
.theme-btn.active { border-color: var(--msg-sent); color: var(--msg-sent); font-weight: bold; }

#toast-container { 
    position: fixed; 
    bottom: 110px; /* Przesunięte wyżej, nad pole wpisywania */
    right: 20px; 
    z-index: 9999; 
    display: flex; 
    flex-direction: column; 
    gap: 10px; 
}
.toast {
    background: var(--bg-sidebar); border-left: 4px solid var(--msg-sent);
    padding: 15px; width: 250px; border-radius: 5px; box-shadow: var(--shadow);
    color: var(--text-primary); transform: translateX(120%); transition: transform 0.3s ease;
    backdrop-filter: blur(10px);
}
.toast.show { transform: translateX(0); }

#mobile-back-btn { display: none; }

/* --- AVATAR EDITOR & CROPPER --- */
.avatar-edit-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    cursor: pointer;
    overflow: hidden;
    margin: 0 auto 20px;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow);
}
.avatar-edit-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: rgba(0,0,0,0.6);
    color: white;
    text-align: center;
    padding: 5px 0;
    font-size: 0.75em;
    opacity: 0;
    transition: opacity 0.2s;
    font-weight: bold;
}
.avatar-edit-wrapper:hover .avatar-edit-overlay {
    opacity: 1;
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {
    #app-wrapper { position: relative; overflow: hidden; }

    #panel-screen-btn {
        display: none !important;
    }

    .sidebar { 
        width: 100%; 
        display: flex; 
        height: 100%; 
        z-index: 10; /* GWARANCJA ŻE JEST NAD SCHOWANYM CZATEM */
        background: var(--bg-app); /* Twarde tło */
    }
    .chat-area { 
        display: flex; 
        position: absolute;
        top: 0; left: 0;
        width: 100%; height: 100%;
        z-index: 50;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
        background: var(--bg-app); /* Pełne tło, by lista pod spodem nie prześwitywała */
    }

    /* Zmiana: po wejściu w czat (guzikiem lub na start), okno wjeżdża płynnie */
    #app-wrapper.mobile-chat-active .chat-area { 
        transform: translateX(0); 
    }
    
    /* Sidebar zostaje pod spodem, nie usuwamy go z DOM, dzięki czemu animacja wyjazdu czatu odsłania od razu listę! */
    #app-wrapper.mobile-chat-active .sidebar { 
        display: flex; 
    }

    #mobile-back-btn { display: block; margin-right: 0; font-size: 1.2em; padding-left: 0;}
    
    .msg { max-width: 85%; }
    #gif-picker { width: 100%; right: 0; bottom: 0; height: 50vh; border-radius: 15px 15px 0 0; }

    /* Kiedy klikniesz w pole (wysunie się klawiatura) */
    .input-wrapper:focus-within {
        /* Klawiatura wchodzi od dołu, więc usuwamy margines 'safe-area' 
        zostawiając ładne, równe 15px odstępu na każdym telefonie */
        padding-bottom: 15px;
    }

    .input-area {
        background-color: #15181c;
    }
    main{
        background: var(--bg-app);
    }
    body{
        background: black;
    }
    #toast-container {
        top: calc(80px + var(--safe-top)); /* Pod górnym paskiem */
        bottom: auto; /* Anulujemy pozycjonowanie dolne z PC */
        left: 15px; 
        right: 15px;
        width: auto;
    }
    
    .toast {
        width: 100%;
        /* Zmiana animacji z wysuwania z boku, na zjeżdżanie z góry */
        transform: translateY(-150%); 
    }
    
    .toast.show { 
        transform: translateY(0); 
    }
    /* BLOKADA ZAZNACZANIA TYLKO NA TELEFONACH */
    .msg, .msg-row {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    .settings-modal {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%; /* Wymuszenie szerokości */
        max-width: 100vw; /* Zabezpieczenie przed rozpychaniem */
        max-height: 85dvh;
        flex-direction: column;
        border-radius: 20px 20px 0 0;
        margin: 0;
        overflow: hidden; /* Blokada wylewania się zawartości poza okno */
    }

    .settings-navigator {
        width: 100%;
        max-width: 100vw; /* Twardy limit szerokości */
        padding: 15px 0 0 0; /* Zdejmujemy boczne paddingi z kontenera... */
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        background: var(--bg-sidebar);
        flex-shrink: 0;
    }

    .settings-navigator ul {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 10px;
        padding: 0 15px 15px 15px; /* ...i dajemy je tutaj, żeby scroll był ładny na brzegach */
        margin: 0;
        width: 100%;
        scrollbar-width: none;
    }

    .settings-navigator ul::-webkit-scrollbar {
        display: none;
    }

    .settings-navigator ul li {
        white-space: nowrap;
        background: var(--bg-input);
        padding: 10px 15px;
        flex-shrink: 0; /* Zapobiega zwężaniu przycisków */
    }

    .settings-content {
        padding: 20px;
        padding-bottom: calc(20px + var(--safe-bottom));
        overflow-y: auto;
        flex: 1; 
        width: 100%;
        margin-left: 0;
        border-left: none;
    }
}

/* Animacja pojawiania się serduszka */
@keyframes popIn {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}
/* --- LIGHTBOX --- */
.lightbox-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9); z-index: 2000;
    display: flex; justify-content: center; align-items: center;
    cursor: zoom-out; opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
.lightbox-overlay:not(.hidden) { opacity: 1; pointer-events: auto; }
#lightbox-image {
    max-width: 90vw; max-height: 90vh; border-radius: 5px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5); cursor: default;
    transform: scale(0.95); transition: transform 0.2s ease;
}
.lightbox-overlay:not(.hidden) #lightbox-image { transform: scale(1); }
.lightbox-close {
    /* Przesuwamy przycisk zamykania poniżej notcha */
    position: absolute; top: calc(20px + var(--safe-top)); right: 30px;
    color: white; font-size: 40px; cursor: pointer; font-weight: bold;
    z-index: 2001; text-shadow: 0 0 10px black;
}
.lightbox-close:hover { color: var(--msg-sent); }
/* --- GROUP SIDEBAR --- */
.group-sidebar {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 280px;
    background: var(--bg-modal);
    border-left: 1px solid var(--border-color);
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    z-index: 100;
    display: flex; flex-direction: column;
    transform: translateX(0);
    transition: transform 0.3s ease-in-out;
    backdrop-filter: blur(10px);
}

.group-sidebar.hidden {
    display: flex !important; /* Nadpisujemy klasę hidden dla animacji */
    transform: translateX(100%);
    pointer-events: none;
}

.group-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: center;
}

.group-members-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.member-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}

.member-info { flex: 1; font-size: 0.9em; overflow: hidden; text-overflow: ellipsis; }
.owner-badge { color: gold; margin-left: 5px; font-size: 0.8em; }

.kick-btn {
    background: none; border: none; color: #ff4444; 
    cursor: pointer; opacity: 0.7; font-size: 1.2em;
}
.kick-btn:hover { opacity: 1; }

/* Ukrywamy przycisk domyślnie na komputerach */
.mobile-close-btn { 
    display: none; 
}

@media (max-width: 768px) {
    .group-sidebar { width: 85%; }
    
    /* Pokazujemy przycisk zamykania tylko na telefonach */
    .mobile-close-btn { 
        display: block; 
    }
}
/* --- NEW MODERN VOICE UI --- */

/* Pasek statusu wewnątrz konkretnego czatu (na górze) */
.chat-voice-status {
    background: #43b581; /* Discord Green */
    color: white;
    padding: 8px 15px;
    font-size: 0.9em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideDown 0.3s ease;
    flex-shrink: 0;
}

@keyframes slideDown { from { transform: translateY(-100%); } to { transform: translateY(0); } }

/* Mały pasek na dole sidebara (zawsze widoczny podczas rozmowy) */
.mini-voice-bar {
    background: var(--bg-input);
    border-top: 1px solid var(--border-color);
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideUp 0.3s ease;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.voice-status-dot {
    width: 8px; height: 8px; background: #43b581; border-radius: 50%; margin-right: 8px;
    box-shadow: 0 0 5px #43b581;
}

.voice-info { display: flex; align-items: center; }
.voice-mini-actions { display: flex; gap: 10px; }

/* Styl wiadomości systemowej "Połączenie zakończone" */
.msg.call-log {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    font-style: italic;
    font-size: 0.85em;
    padding: 5px 15px;
    align-self: center; /* Wyśrodkowanie */
    margin: 10px auto;
    border-radius: 20px;
    max-width: 100%;
}
.msg-group:has(.call-log) { align-items: center; } /* Nowoczesny CSS do centrowania */

/* Powiadomienie o przychodzącym połączeniu (Toast z akcją) */
.toast-call-action {
    display: flex; gap: 10px; margin-top: 5px;
}
.toast-btn {
    flex: 1; padding: 5px; border: none; border-radius: 4px; cursor: pointer; color: white; font-weight: bold;
}
.btn-accept { background: #43b581; }
.btn-decline { background: #ff4444; }
.back-button-img{
    width:35px;
    margin-top:5px;
    filter: invert(var(--icon-invert));
}
/* Mobile adjustments */
@media (max-width: 768px) {
    .mini-voice-bar {
        position: fixed; bottom: 0; left: 0; right: 0;
        z-index: 2000;
        padding-bottom: calc(10px + var(--safe-bottom));
        border-top: 1px solid rgba(0,0,0,0.1);
    }
    #app-wrapper.mobile-chat-active .mini-voice-bar { display: none; } /* Ukryj mały pasek jak jesteśmy w czacie (tam jest górny pasek) */
}
/* --- Add/Replace in public/style.css --- */

/* Date Separator - Discord Style */
.date-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 24px 0 8px 0;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    user-select: none;
}

.date-separator::before,
.date-separator::after {
    content: "";
    flex: 1;
    height: 1px;
    background-color: var(--border-color);
    opacity: 0.5;
}

.date-separator span {
    background: transparent; /* Changed from variable to transparent */
    padding: 0 10px;
    color: var(--text-secondary);
}/* --- NOWOCZESNE WIADOMOŚCI & AVATARY --- */
.msg-group { 
    display: flex; 
    flex-direction: column; 
    width: 100%; 
    position: relative;
    padding: 0px 4px; /* Lekki odstęp wewnętrzny dla efektu hover */
    border-radius: 6px;
    transition: background-color 0.1s;
    
    /* Domyślny, większy odstęp od nowej osoby / nowej daty */
    margin-top: 12px; 
    margin-bottom: 0; /* Resetujemy margines dolny, by uniknąć kolizji */
}

/* Kiedy wiadomość jest połączona z poprzednią (ten sam autor) */
.msg-group.chained {
    margin-top: 2px; /* Robimy ładny, mały 2-pikselowy odstęp GÓRNY */
}

/* Nagłówek wiadomości (Awatar i Imię) */
.msg-author-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    margin-left: 10px; /* Lekkie odsunięcie, by dymek nie leżał na samej krawędzi */
}

.msg-author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-color: #ddd;
}

.msg-author-name {
    font-size: 0.85em;
    font-weight: 600;
    color: var(--text-primary);
}

.msg-time-small {
    font-size: 0.7em;
    color: var(--text-secondary);
    opacity: 0.7;
}

/* --- KAFELKOWA GALERIA ZDJĘĆ --- */
.msg-gallery {
    display: grid;
    gap: 3px;
    border-radius: 12px;
    overflow: hidden;
}

.gallery-1 {
    grid-template-columns: 1fr;
}
.gallery-1 .gallery-img {
    max-height: 350px;
    width: auto;
    max-width: 100%;
    /* DODANE ZABEZPIECZENIA: */
    min-height: 150px; /* Zanim obrazek się wczyta, ma już "wagę" i nie rozpycha czatu nagle */
    min-width: 150px;
    background-color: rgba(0,0,0,0.05); /* Szary placeholder w trakcie ładowania */
    border-radius: 10px;
}

.gallery-2 {
    grid-template-columns: 1fr 1fr;
}
.gallery-2 .gallery-img {
    aspect-ratio: 1 / 1;
    width: 100%;
    object-fit: cover;
}

.gallery-3 {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}
.gallery-3 .gallery-img {
    aspect-ratio: 1 / 1;
    width: 100%;
    object-fit: cover;
}

.gallery-img {
    cursor: zoom-in;
    display: block;
    transition: filter 0.2s;
}
.gallery-img:hover {
    filter: brightness(0.9);
}

/* Poprawka obszaru podglądu załączników przed wysłaniem */
#image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px;
    background: transparent;
}

.thumb-wrapper {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.preview-img-item {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-thumb {
    font-size: 0.6em;
    font-weight: bold;
    text-align: center;
    word-break: break-all;
    padding: 2px;
}

.remove-thumb {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

/* Strzałki w Lightboxie */
.lb-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    font-size: 40px;
    padding: 10px 20px;
    cursor: pointer;
    z-index: 2005;
    border-radius: 10px;
}
.lb-nav-btn:hover { background: rgba(0,0,0,0.8); }
#lb-prev { left: 20px; }
#lb-next { right: 20px; }
@media (max-width: 768px) {
    #lb-prev { left: 10px; padding: 5px 10px; }
    #lb-next { right: 10px; padding: 5px 10px; }
}
/* Gwarancja, że tekst nie "rozsadzi" ramki wiadomości, 
szczególnie przy połączonych wiadomościach i linkach */
.msg-text {
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* --- MSG ACTIONS & DROPDOWN --- */
.msg-actions-container {
    display: flex;
    align-items: center;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s;
    padding: 0 5px;
    pointer-events: none; /* Blokuje przypadkowe kliknięcia, gdy są niewidoczne */
}

/* Włączenie przycisków po najechaniu na CAŁĄ grupę */
.msg-group:hover .msg-actions-container { 
    opacity: 1; 
    pointer-events: auto; 
}

.action-icon-btn {
    cursor: pointer;
    font-size: 1.2em;
    color: var(--text-secondary);
    padding: 5px;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}
.action-icon-btn:hover { background: var(--hover-color); color: var(--msg-sent); }

/* Dropdown menu */
.msg-dropdown-menu {
    position: absolute;
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 120px;
    backdrop-filter: blur(10px);
}
.msg-dropdown-item {
    padding: 10px 15px;
    cursor: pointer;
    font-size: 0.9em;
    color: var(--text-primary);
}
.msg-dropdown-item:hover { background: var(--hover-color); }
.msg-dropdown-item.danger { color: #ff4444; }
.msg-dropdown-item.danger:hover { background: rgba(255, 68, 68, 0.1); }
.msg-group:hover{
    filter:brightness(1.1);
}
@media (max-width: 768px) {
    .msg-row.show-actions .msg-actions-container {
        display: flex;
        animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
}

/* Tło po najechaniu dla jasnego motywu */
.msg-group:hover { background-color: rgba(0, 0, 0, 0.04); }

/* Tło po najechaniu dla ciemnego motywu */
[data-theme="dark"] .msg-group:hover { background-color: rgba(255, 255, 255, 0.03); }

@media (max-width: 768px) {
    .msg-actions-container { 
        display: flex; /* Zamiast 'none', co zapobiega skakaniu wiadomości */
        opacity: 0;
        pointer-events: none;
    }
    
    /* Włączanie menu na telefonach przy dotknięciu lub aktywnej klasie */
    .msg-group:hover .msg-actions-container,
    .msg-group.show-actions .msg-actions-container,
    .msg-row.show-actions .msg-actions-container {
        opacity: 1;
        pointer-events: auto;
        animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
}

/* --- DISCORD-LIKE VOICE PANEL --- */
#voice-room-panel {
    background: var(--bg-modal);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 100;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.voice-room-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 20px; background: rgba(0,0,0,0.05); font-weight: bold; font-size: 0.9em;
}

.voice-controls { display: flex; gap: 10px; align-items: center;}
.panel-ctrl-btn { background: var(--bg-input); border-radius: 50%; padding: 8px; font-size: 1.1em;}
.decline-call-btn { background: #ff4444; color: white; border-radius: 15px; padding: 5px 15px; font-size: 0.9em; font-weight: bold; height:35px; }

.voice-peers-grid {
    display: flex; padding: 15px 20px; gap: 20px; overflow-x: auto;
    min-height: 90px; align-items: flex-start;
}

.voice-peer {
    display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 65px;
}

.voice-peer .avatar {
    width: 55px; height: 55px; border-radius: 50%;
    border: 3px solid transparent; transition: border-color 0.15s, transform 0.15s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* Wirtualny "Ring" podczas mówienia (Discord Style) */
.voice-peer.speaking .avatar {
    border-color: #43b581; /* Zielony Discord */
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(67, 181, 129, 0.6);
}

.voice-peer span {
    font-size: 0.75em; text-align: center; max-width: 75px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600;
}

/* Dostosowania dla telefonu (rozwijany panel) */
@media (max-width: 768px) {
    #voice-room-panel {
        position: absolute; top: 60px; left: 0; right: 0;
        box-shadow: 0 5px 15px rgba(0,0,0,0.3);
        transform: translateY(-100%);
        opacity: 0;
        pointer-events: none;
    }
    #voice-room-panel.mobile-expanded {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }
    #chat-voice-status-bar {
        cursor: pointer;
        text-align: center;
        justify-content: center;
    }
    #chat-voice-status-bar button { display: none; } /* Na telefonie ukrywamy rozłącz na belce - jest w panelu */
}

/* --- VIDEO STAGE (Ekran strumieniowania) --- */
#voice-video-stage {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 4px;
    background: #0a0a0a;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    max-height: 45vh;
    overflow-y: auto;
    transition: all 0.3s ease;
}

.screen-share-wrapper {
    position: relative;
    width: 100%;
    max-width: 800px;
    aspect-ratio: 16/9; /* GWARANCJA DUŻEGO OKNA 16:9 */
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.8);
    background: #000;
}

.screen-share-video {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* Film proporcjonalnie rozciąga się do brzegów */
    display: block;
}

/* NAPRAWA FULLSCREENA NA KOMPUTERZE */
.screen-share-wrapper:fullscreen { max-width: 100%; border-radius: 0; }
.screen-share-wrapper:fullscreen .screen-share-video { max-height: 100vh; }

/* Guziki overlay */
.video-controls-overlay {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    opacity: 0; 
    transition: opacity 0.2s;
    z-index: 20;
}

/* Zawsze pokazuj guziki na urządzeniach dotykowych, na PC tylko po najechaniu */
.screen-share-wrapper:hover .video-controls-overlay { opacity: 1; }
@media (hover: none) {
    .video-controls-overlay { opacity: 1; bottom: 5px; right: 5px; }
}

.vid-ctrl-btn {
    background: rgba(0,0,0,0.7);
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 5px;
    padding: 8px 12px;
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: background 0.2s;
    font-size: 0.9em;
}
.vid-ctrl-btn:hover { background: var(--msg-sent); }

.peer-name-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    pointer-events: none;
    font-weight: bold;
    z-index: 20;
}

/* Nowy guzik pokazujący ukryty strumień obok awatara */
.show-stream-badge {
    background: #43b581;
    color: white;
    font-size: 0.7em;
    padding: 4px 10px;
    border-radius: 12px;
    cursor: pointer;
    margin-top: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    text-align: center;
    font-weight: bold;
    animation: popIn 0.2s ease-out;
}

/* Zwijanie panelu (wspólne dla PC i Mobile) */
#voice-room-panel {
    transition: max-height 0.35s ease, opacity 0.35s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 1200px; 
    opacity: 1;
    background: var(--bg-modal);
    
    /* --- MAGIA IOS SAFARI: Wymuszenie renderowania zawartości --- */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    will-change: max-height, opacity;
}

#voice-room-panel.collapsed {
    max-height: 0 !important;
    opacity: 0 !important;
    pointer-events: none;
    border: none;
    margin: 0;
    padding: 0;
}

/* GWARANCJA ZIELONEGO PASKA NA WIERZCHU */
#chat-voice-status-bar {
    position: relative;
    z-index: 101;
    user-select: none;
}

/* TWARDE NADPISANIE STAREGO KODU MOBILE - ZABIJA BŁĄD PUSTEGO SZAREGO PASKA */
@media (max-width: 768px) {
    #voice-room-panel {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        transform: translateZ(0) !important; /* Musi być zachowane na mobile! */
        box-shadow: none !important;
        pointer-events: auto;
    }
}

/* --- TRYB KINOWY --- */
#voice-room-panel.theater-mode { max-height: 75vh; height: 75vh; }
#voice-room-panel.theater-mode #voice-video-stage { flex: 1; max-height: none; }
#voice-room-panel.theater-mode .screen-share-wrapper { max-width: 1200px; }
#voice-room-panel.theater-mode .voice-peers-grid { min-height: 0; padding: 10px 20px; background: var(--bg-modal); }
#voice-room-panel.theater-mode .voice-peer .avatar { width: 35px; height: 35px; }
#voice-room-panel.theater-mode .voice-peer span { font-size: 0.65em; }

.voice-stream-el{
    max-width: 100% !important;
    margin: 0;
}

.quality-selector-menu {
    position: fixed;
    bottom: 80px;
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    z-index: 10000;
}
.quality-option {
    padding: 8px 15px;
    cursor: pointer;
    border-radius: 4px;
}
.quality-option:hover:not(.disabled) {
    background: var(--hover-color);
}
.quality-option.disabled {
    color: var(--text-secondary);
    opacity: 0.5;
    cursor: default;
    display: flex;
    justify-content: space-between;
}
/* --- MENU WYBORU JAKOŚCI WIDEO --- */
.quality-selector-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 10000;
}
.quality-menu {
    position: absolute;
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    min-width: 200px;
    max-height: 250px; /* Nie pozwoli zająć całego ekranu telefonu */
    overflow-y: auto;
    backdrop-filter: blur(15px);
}
.quality-item {
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
    transition: background 0.2s;
    color: var(--text-primary);
}
.quality-item:hover:not(.disabled) { background: var(--hover-color); }
.quality-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- ANIMACJE STATUSU CALLA --- */
.calling-status {
    color: #ffffff !important;
    font-weight: bold;
    display: inline-block;
    padding: 2px 10px;
    animation: blink 1.5s infinite;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
.conv-name-text{
    font-size: 1em !important;
}
#my-username{
    font-size: 1em !important;
    font-weight: 400 !important;
}

/* --- MULTILINE INPUT (TEXTAREA) NAPRAWA IOS/ANDROID --- */
#message-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    outline: none;
    padding: 10px 5px;
    resize: none;
    min-height: 40px; 
    max-height: 120px; 
    overflow-y: auto;
    line-height: 20px;
    font-size: 16px; /* 16px zapobiega przybliżaniu na iOS */
    font-family: inherit;
    text-align: left; /* KLUCZOWE: Zapobiega centrowaniu na telefonach (Zrzut #3) */
    -webkit-appearance: none; /* Reset stylów iOS */
    scrollbar-width: none;
}
#message-input::-webkit-scrollbar {
    display: none;
}
.input-area {
    display: flex;
    align-items: flex-end; /* Trzyma ikony na dole, gdy pole rośnie */
    padding: 5px 15px;
    background: var(--bg-input);
    border-radius: 20px;
}
.action-btn {
    padding-bottom: 8px; /* Wyrównanie ikonek z dolną linijką tekstu */
}

/* --- MEDIA PICKER (Emoji / GIF / Naklejki) --- */
#media-picker {
    background: var(--bg-modal);
    border-radius: 10px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    overflow: hidden;
    z-index: 500;
}
.media-tabs {
    display: flex;
    background: rgba(0,0,0,0.03);
    border-bottom: 1px solid var(--border-color);
}
[data-theme="dark"] .media-tabs { background: rgba(255,255,255,0.03); }
.media-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 12px 5px;
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: bold;
    border-bottom: 2px solid transparent;
    transition: 0.2s;
}
.media-tab.active {
    color: var(--msg-sent);
    border-bottom-color: var(--msg-sent);
}
.close-picker {
    padding: 12px 15px;
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: bold;
}
.media-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* WERSJA PC (Popup lewa strona) */
@media (min-width: 769px) {
    #media-picker {
        position: fixed; 
        width: 350px;
        height: 400px;
    }
}

/* WERSJA MOBILE (Poniżej czatu, na klawiaturze) */
@media (max-width: 768px) {
    /* Kompaktowy pasek na dole z przywróconym czarnym tłem */
    .input-wrapper {
        display: flex;
        flex-direction: column;
        padding: 10px; 
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        background: #000 !important; /* Wymuszenie czarnego tła */
        height: auto !important;
    }

    .input-wrapper:focus-within {
        padding-bottom: 10px; /* Reset safe-area */
    }

    /* Subtelniejszy, chudszy panel zakładek */
    .media-tabs {
        background: transparent;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    .media-tab {
        padding: 8px 5px; /* Zmniejszone marginesy - mniej rozlazłe */
        font-size: 0.85em; /* Mniejszy tekst */
    }
    .close-picker {
        padding: 8px 15px; /* Zmniejszone marginesy */
    }

    /* Wyższy picker rozciągnięty na całą szerokość */
    #media-picker {
        position: static;
        width: calc(100% + 20px);
        height: 380px; /* ZWIĘKSZONO WYSOKOŚĆ z 250/300px na 380px! */
        margin-top: 10px;
        margin-left: -10px;
        margin-right: -10px;
        margin-bottom: calc(-10px - env(safe-area-inset-bottom, 0px));
        border-radius: 0;
        border: none;
        box-shadow: none;
        /*background: var(--bg-modal);*/
        background: transparent !important;
    }
}
/* --- EMOJI PICKER STYLING --- */
emoji-picker {
    --background: transparent; /* Tło z naszego kontenera */
    --border-color: transparent; /* Brak brzydkich ramek */
    --input-border-radius: 20px;
    --input-padding: 5px 10px;
    --indicator-color: var(--msg-sent);
    --num-columns: 8; /* Więcej emoji w rzędzie na telefonach */
    --emoji-size: 1.6rem;
    width: 100%;
    height: 100%;
}

/* Ukrycie dolnego paska z podglądem i nazwą emoji */
emoji-picker::part(preview) {
    display: none;
}

/* Ukrycie górnego paska z ikonami kategorii (favorites, zwierzęta itp.) */
emoji-picker::part(tab-bar) {
    display: none;
}
div.favorites.onscreen.emoji-menu{
    display: none !important;
}
.tabpanel{
    overflow-x:hidden;
}

.sc-item { position: relative; background: var(--bg-input); padding: 5px; border-radius: 8px; text-align: center; }
.sc-item img { width: 100%; height: 60px; object-fit: contain; }
.sc-emoji-input { width: 100%; text-align: center; margin-top: 5px; padding: 5px !important; }
.sortable-ghost { opacity: 0.4; }
.sticker-picker-item { width: 100%; aspect-ratio: 1; object-fit: contain; cursor: pointer; padding: 5px; transition: transform 0.1s; }
.sticker-picker-item:active { transform: scale(0.9); }
.sticker-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    overflow-y: auto;
}