body.guest .chat-container {
    display: none !important;
}

.chat-container {
    position: fixed;
    bottom: 12px;
    right: 12px;
    width: 300px;
    height: 40px;
    background: #1a1a2e;
    color: #ecf0f1;
    border: 1px solid var(--accent);
    border-radius: 12px 12px 0 0;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.5);
}

.chat-container.expanded {
    height: 450px;
    border-radius: 12px;
}

.chat-header {
    padding: 10px 15px;
    background: rgba(0, 255, 200, 0.1);
    border-bottom: 1px solid var(--accent);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    color: var(--accent);
    flex-shrink: 0;
}

.chat-tabs {
    display: flex;
    background: #0a0a12;
    border-bottom: 1px solid var(--accent);
    flex-shrink: 0;
}

.chat-tab {
    flex: 1;
    background: none;
    border: none;
    color: #888;
    padding: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    border-bottom: 2px solid transparent;
}

.chat-tab:hover {
    color: #fff;
}

.chat-tab.active {
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
    background: rgba(255, 255, 255, 0.05);
}

.tab-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.chat-body,
.news-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background: #0a0a12;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Custom Scrollbar for Chat */
.chat-body::-webkit-scrollbar,
.news-list::-webkit-scrollbar {
    width: 6px;
}

.chat-body::-webkit-scrollbar-track,
.news-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.chat-body::-webkit-scrollbar-thumb,
.news-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.4);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.chat-body:hover::-webkit-scrollbar-thumb,
.news-list:hover::-webkit-scrollbar-thumb {
    background: rgba(var(--accent-rgb, 0, 255, 200), 0.6);
}

.chat-body::-webkit-scrollbar-thumb:hover,
.news-list::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}


.chat-message {
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    word-wrap: break-word;
}

.chat-message.admin {
    border-left: 2px solid #9b59b6;
}

.chat-message.user {
    border-left: 2px solid var(--accent);
}

.news-item {
    background: rgba(0, 255, 200, 0.05);
    border: 1px solid rgba(0, 255, 200, 0.2);
    padding: 10px;
    border-radius: 6px;
    font-size: 12px;
}

.news-date {
    color: #888;
    font-size: 10px;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
}

.news-content {
    color: #ecf0f1;
    white-space: pre-wrap;
}

.chat-input-area {
    padding: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 5px;
    background: #1a1a2e;
    flex-shrink: 0;
}

.chat-input-area input {
    flex: 1;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid var(--accent);
    background: #0a0a12;
    color: #fff;
    font-size: 12px;
}

.chat-input-area button {
    background: var(--accent);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    padding: 0 10px;
}

.chat-online-count {
    font-size: 11px;
    background: #2ecc71;
    color: #000;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 10px;
}

.chat-img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    margin-top: 5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
}

.chat-preview-area {
    padding: 5px 10px;
    background: #0a0a12;
    border-top: 1px solid var(--accent);
    display: none;
    position: relative;
}

.chat-preview-thumb {
    height: 60px;
    border-radius: 4px;
    border: 1px solid var(--accent);
}

.chat-preview-close {
    position: absolute;
    left: 70px;
    top: 5px;
    background: none;
    border: none;
    color: #e74c3c;
    font-weight: bold;
    cursor: pointer;
}

.chat-attach-btn {
    background: none;
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: 4px;
    cursor: pointer;
    padding: 0 8px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-attach-btn:hover {
    background: rgba(0, 255, 200, 0.1);
}

.news-gallery {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 15px;
}

.news-gallery img {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid var(--accent);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.news-gallery img:hover {
    transform: scale(1.02);
    box-shadow: 0 0 15px var(--accent-glow);
}

/* USER CURSORS */
.user-cursor {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    pointer-events: none;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    transition: transform 0.1s linear;
    will-change: transform;
    min-width: 10px;
    min-height: 10px;
}

.user-cursor.readonly {
    opacity: 0.6;
    filter: grayscale(100%);
}

.user-cursor.readonly::after {
    content: '🚫';
    position: absolute;
    top: -8px;
    left: -8px;
    font-size: 14px;
    animation: none;
}

.user-cursor.readonly .cursor-label {
    border-color: #7f8c8d;
    color: #bdc3c7;
}

.user-cursor.readonly .cursor-icon {
    border-bottom-color: #7f8c8d;
}

.cursor-icon {
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 16px solid var(--accent);
    transform: rotate(-25deg);
    filter: drop-shadow(0 0 2px var(--accent-glow));
    transform-origin: center;
}

.cursor-label {
    background: var(--node);
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    margin-left: 8px;
    margin-top: 2px;
    white-space: nowrap;
    border: 1px solid var(--accent);
    opacity: 0.8;
}

.user-cursor.admin .cursor-icon {
    border-bottom-color: #9b59b6 !important;
}

.user-cursor.admin .cursor-label {
    color: #9b59b6 !important;
    border-color: #9b59b6 !important;
}

/* MOBILE CHAT OVERRIDES */
@media (max-width: 768px) {
    .chat-container:not(.expanded) {
        width: 50px !important;
        height: 50px !important;
        border-radius: 50% !important;
        right: 10px !important;
        left: auto !important;
        background: #000 !important;
        border: 2px solid var(--accent) !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        z-index: 2005 !important;
        bottom: 90px !important;
    }

    body.editing .chat-container:not(.expanded) {
        bottom: 240px !important;
    }

    .chat-container:not(.expanded) .chat-header span,
    .chat-container:not(.expanded) #chatToggleIcon {
        display: none !important;
    }

    .chat-container:not(.expanded) .chat-header::after {
        content: '💬';
        font-size: 24px;
        line-height: 1;
    }

    .chat-container:not(.expanded) .chat-header {
        width: 100% !important;
        height: 100% !important;
        padding: 0 !important;
        background: transparent !important;
        border: none !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }

    .chat-container.expanded {
        width: auto !important;
        left: 10px !important;
        right: 10px !important;
        bottom: 90px !important;
        height: 50vh !important;
        border-radius: 12px !important;
        background: #1a1a2e !important;
        display: flex !important;
        flex-direction: column !important;
        z-index: 2010 !important;
    }

    .chat-container.expanded .chat-body,
    .chat-container.expanded .chat-input-area,
    .chat-container.expanded .chat-tabs,
    .chat-container.expanded #onlineList {
        display: flex !important;
    }

    .chat-container.expanded .chat-header {
        justify-content: space-between !important;
        padding: 10px 15px !important;
        height: auto !important;
    }

    .chat-container.expanded .chat-header span {
        display: inline !important;
    }

    .chat-container.expanded .chat-header::after {
        content: '' !important;
    }
}

/* Styl dla linków do plików na czacie */
.chat-file-download {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--accent);
    border-radius: 6px;
    padding: 8px 12px;
    margin-top: 5px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s ease;
    max-width: fit-content;
}

.chat-file-download:hover {
    background: rgba(0, 255, 200, 0.1);
    box-shadow: 0 0 10px rgba(0, 255, 200, 0.2);
    transform: translateX(2px);
}

.file-icon {
    font-size: 20px;
    margin-right: 10px;
}

.file-name {
    font-weight: bold;
    font-size: 12px;
    margin-right: 15px;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--accent);
}

.file-action {
    font-size: 10px;
    color: #aaa;
    text-transform: uppercase;
}

/* Przycisk usuwania wiadomości */
.chat-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.msg-delete-btn {
    background: transparent;
    border: none;
    color: #666;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
    opacity: 0;
    /* Ukryty domyślnie */
    transition: all 0.2s;
}

.chat-message:hover .msg-delete-btn {
    opacity: 1;
    /* Pokaż po najechaniu na wiadomość */
}

.msg-delete-btn:hover {
    color: #e74c3c;
    /* Czerwony po najechaniu na krzyżyk */
    transform: scale(1.2);
}

/* Mobilne: zawsze pokazuj przycisk, bo nie ma hover */
@media (max-width: 768px) {
    .msg-delete-btn {
        opacity: 0.5;
    }
}

/* ======================================
   USER PROFILE MODAL
   ====================================== */

.chat-username-link {
    cursor: pointer;
    transition: opacity 0.15s;
}

.chat-username-link:hover {
    opacity: 0.75;
    text-decoration: underline;
}

.upm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9500;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    animation: upmFadeIn 0.2s ease;
}

.upm-overlay.active {
    display: flex;
}

@keyframes upmFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.upm-card {
    position: relative;
    background: rgba(15, 12, 30, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 30px 28px 26px;
    width: 320px;
    max-width: 92vw;
    box-shadow:
        0 0 0 1px rgba(var(--accent-rgb, 0, 255, 200), 0.15),
        0 20px 50px rgba(0, 0, 0, 0.7),
        0 0 60px rgba(var(--accent-rgb, 0, 255, 200), 0.05);
    animation: upmSlideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.upm-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.7;
}

@keyframes upmSlideUp {
    from {
        transform: translateY(30px) scale(0.95);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.upm-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #aaa;
    font-size: 20px;
    line-height: 1;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upm-close:hover {
    background: rgba(231, 76, 60, 0.25);
    color: #e74c3c;
    border-color: rgba(231, 76, 60, 0.4);
}

.upm-loading {
    text-align: center;
    padding: 30px 0;
    color: #888;
    font-size: 14px;
}

.upm-avatar-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
}

.upm-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent);
    box-shadow: 0 0 20px rgba(var(--accent-rgb, 0, 255, 200), 0.3);
}

.upm-avatar-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.07);
    border: 3px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
}

.upm-name {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
    letter-spacing: 0.3px;
}

.upm-login {
    text-align: center;
    font-size: 12px;
    color: #666;
    margin-bottom: 14px;
}

.upm-login span {
    color: #888;
}

.upm-role-badge {
    display: inline-block;
    margin: 0 auto 16px;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.upm-role-badge.admin {
    background: rgba(155, 89, 182, 0.2);
    color: #c39af7;
    border: 1px solid rgba(155, 89, 182, 0.4);
}

.upm-role-badge.streamer {
    background: rgba(52, 152, 219, 0.2);
    color: #7ec8f7;
    border: 1px solid rgba(52, 152, 219, 0.4);
}

.upm-role-badge.user {
    background: rgba(var(--accent-rgb, 0, 255, 200), 0.1);
    color: var(--accent);
    border: 1px solid rgba(var(--accent-rgb, 0, 255, 200), 0.3);
}

.upm-badge-row {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
}

.upm-divider {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    margin: 0 0 16px 0;
}

.upm-stats {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.upm-stat {
    flex: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 10px 8px;
    text-align: center;
}

.upm-stat-val {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}

.upm-stat-lbl {
    font-size: 10px;
    color: #666;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.upm-twitch {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(145, 70, 255, 0.08);
    border: 1px solid rgba(145, 70, 255, 0.25);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    text-decoration: none;
    color: #c8a7ff;
    transition: background 0.2s;
}

.upm-twitch:hover {
    background: rgba(145, 70, 255, 0.18);
}

.upm-twitch img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
}

.upm-twitch-name {
    font-size: 13px;
    font-weight: 600;
}

.upm-twitch-label {
    font-size: 11px;
    color: #9146ff;
    margin-bottom: 1px;
}