

#chatContainer,
#onlineUsersContainer {
    position: fixed;
    bottom: 20px;
    background: rgba(110, 115, 110, 0.35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
    padding: 12px;
    max-width: 280px;
    width: 90%;
    color: var(--base-text-color);
    z-index: 1000;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 1;
    transform: translateY(0);
    overflow-wrap: break-word;
    
    border: 0;
    outline: none;
    background-clip: padding-box;
}

#chatContainer {
    right: 20px;
    height: 50vh; 
    max-height: 450px; 
    display: flex;
    flex-direction: column;
    bottom: 20px; 
}

#onlineUsersContainer {
    left: 20px;
    height: 50vh; 
    max-height: 450px; 
    display: flex; 
    flex-direction: column; 
    bottom: 20px; 
}

#chatContainer.hidden,
#onlineUsersContainer.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

#chatMessages {
    flex-grow: 1; 
    overflow-y: auto; 
    margin-bottom: 10px; 
    padding-right: 5px; 
    
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.chat-message {
    margin-bottom: 6px; 
    padding: 5px 7px; 
    background: rgba(210, 210, 210, 0.06); 
    border-radius: 4px; 
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
    position: relative;
}

.guest-mod-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.guest-mod-actions-inline {
    margin-top: 0;
    margin-left: 4px;
}

.guest-mod-btn {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.35);
    color: rgba(255, 255, 255, 0.85);
    font-size: 10px;
    line-height: 1;
    padding: 3px 5px;
    border-radius: 3px;
    cursor: pointer;
}

.guest-mod-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.guest-mod-btn-danger:hover {
    background: rgba(180, 50, 50, 0.55);
    border-color: rgba(255, 120, 120, 0.45);
}

.chat-message .header {
    display: flex;
    flex-direction: column;
    margin-bottom: 2px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7em; 
    color: rgba(255, 255, 255, 0.7); 
    margin-bottom: 2px;
}

.header-bottom {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.chat-message .chat-user {
    font-weight: bold;
}

.chat-message .chat-text {
    margin-top: 4px;
    font-size: 0.9em; 
    color: rgba(255, 255, 255, 0.9); 
}

#chatInputArea {
    display: flex;
    gap: 10px; 
    margin-top: 10px; 
    flex-shrink: 0; 
}

#chatInput {
    flex-grow: 1;
    padding: 7px; 
    background: rgba(210, 210, 210, 0.06); 
    border: 1px solid rgba(50, 50, 50, 0.15); 
    border-radius: 4px; 
    color: #fff; 
    font-size: 1em; 
    line-height: 1.4;
    min-width: 0; 
}

#chatInput::placeholder {
    color: rgba(255, 255, 255, 0.5); 
}

#chatSend {
    flex-shrink: 0;
    padding: 7px 10px; 
    background: rgba(210, 210, 210, 0.06); 
    border: 1px solid rgba(50, 50, 50, 0.15); 
    color: #ccc; 
    border-radius: 4px; 
    font-size: 1em; 
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

#chatSend:hover {
    background-color: rgba(255, 255, 255, 0.12); 
    border-color: rgba(50, 50, 50, 0.25); 
    color: #fff; 
}

#onlineUsersContainer h3 {
    margin: 0 0 8px 0; 
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid var(--border-color); 
    font-size: 1.2em; 
    text-align: center;
    font-weight: normal;
    flex-shrink: 0; 
    color: var(--base-text-color); 
}

#onlineUsersList {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto; 
    flex-grow: 1; 
    
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

#onlineUsersList li {
    padding: 5px; 
    margin-bottom: 4px; 
    background: rgba(210, 210, 210, 0.06); 
    border-radius: 4px; 
    transition: background 0.2s ease;
    font-size: 1em; 
    display: flex;
    align-items: center;
    gap: 4px; 
    white-space: nowrap;
    overflow: hidden; 
    text-overflow: ellipsis; 
    cursor: default; 
    color: var(--base-text-color); 
}

#onlineUsersList li:hover {
    background: rgba(255, 255, 255, 0.12); 
}

.badge {
    width: 37px; 
    height: 37px;
    margin-left: 4px; 
    vertical-align: middle;
    flex-shrink: 0;
}

.stamp-image {
    width: 32px; 
    height: auto;
    display: inline-block;
    vertical-align: middle;
    margin-left: 4px; 
    transition: transform 0.2s ease;
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
}

.stamp-image:hover {
    transform: scale(1.1);
}

.stamp-preview {
    position: fixed;
    width: 128px;
    height: 128px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    z-index: 1010;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
    border-radius: 4px 4px 0 0; 
    background-color: rgba(50, 55, 50, 0.3); 
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    pointer-events: none;
    display: none;
    justify-content: center;
    align-items: center;
}

.stamp-caption {
    position: fixed;
    width: 128px;
    padding: 8px;
    min-height: 18px;
    background-color: rgba(50, 55, 50, 0.5); 
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #ddd; 
    font-size: 11px;
    text-align: center;
    border-radius: 0 0 4px 4px; 
    z-index: 1010;
    pointer-events: none;
    display: none;
    word-wrap: break-word;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    max-height: 80px;
    overflow-y: auto;
}

.chat-emote {
    display: inline-block; 
    max-height: 24px; 
    vertical-align: middle;
    margin: 0 2px;
}

@media (hover: none) and (pointer: coarse) {
    #chatContainer,
    #onlineUsersContainer {
        
        opacity: 0;
        transform: translateY(20px);
        pointer-events: none;
    }
    
    #chatContainer.mobile-visible,
    #onlineUsersContainer.mobile-visible {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }
}

@media (max-width: 768px) {
    #chatContainer,
    #onlineUsersContainer {
        max-width: 280px;
        width: 280px;
        bottom: 60px;
        height: auto;
        max-height: 40vh;
        padding: 10px;
        font-size: 0.9em;
    }
    
    #onlineUsersContainer {
        left: 10px;
        right: auto;
    }
    
    #chatContainer {
        right: 10px;
        left: auto;
    }
    
    .badge,
    .stamp-image {
        width: 28px;
        height: 28px;
    }
    
    #chatInput {
        font-size: 16px; 
        padding: 8px;
    }
    
    #chatSend {
        padding: 8px 12px;
        font-size: 0.9em;
    }
    
    .chat-message {
        font-size: 0.85em;
        padding: 4px 6px;
    }
    
    #onlineUsersList li {
        font-size: 0.9em;
        padding: 4px;
    }
}

@media (max-width: 480px) {
    #chatContainer,
    #onlineUsersContainer {
        max-width: calc(100vw - 20px);
        width: calc(100vw - 20px);
        left: 10px;
        right: 10px;
        bottom: 60px;
        max-height: 35vh;
    }
    
    .badge,
    .stamp-image {
        width: 24px;
        height: 24px;
    }
}

.hidden {
    display: none !important;
}
