.chat-button {
    position: fixed;
    bottom: 8rem;
    right: 1rem;
    background: linear-gradient(135deg, #3B82F6, #8B5CF6);
    color: white;
    width: auto; /* Adjust width to content */
    height: 50px;
    padding: 0 1.5rem; /* Horizontal padding for text */
    border-radius: 50px; /* Rounded corners for pill shape */
    display: inline-flex; /* Use inline-flex to wrap content */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    z-index: 10;
    gap: 0.5rem; /* Space between icon and text */
    font-weight: bold; /* Make "Chat" text bold */
    white-space: nowrap; /* Prevent text from wrapping */
}

.chat-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 8px rgba(59, 130, 246, 0.4);
}

.chat-button svg {
    width: 24px; /* Icon size */
    height: 24px;
}

@media (max-width: 768px) {
    .chat-button {
        bottom: 4rem; /* Adjusted for mobile to be closer to player */
        right: 0.75rem;
        height: 45px;
        padding: 0 1.2rem; /* Adjust padding for smaller screens */
        font-size: 0.9rem; /* Adjust font size for smaller screens */
    }

    .chat-button svg {
        width: 20px; /* Icon size for smaller screens */
        height: 20px; /* Icon size for smaller screens */
    }
}

@media (max-width: 480px) {
    .chat-button {
        bottom: 4rem; /* Adjusted for smaller mobile to be closer to player */
        right: 0.75rem; /* Further adjust padding for smaller screens */
        height: 40px;
        padding: 0 1rem; /* Further adjust padding for smaller screens */
        font-size: 0.8rem; /* Further adjust font size for smaller screens */
    }

    .chat-button svg {
        width: 18px; /* Icon size for even smaller screens */
        height: 18px; /* Icon size for even smaller screens */
    }
}

@media (max-width: 360px) {
    .chat-button {
        bottom: 4rem; /* Adjusted for smallest mobile to be closer to player */
    }
}

@media (max-width: 480px) and (orientation: portrait) {
    .chat-button {
        bottom: 4rem; /* Adjusted for portrait mobile to be closer to player */
    }
}

/* Dark mode adjustments if needed - adapting from styles.css */
body.dark-mode .chat-button {
    background: linear-gradient(135deg, #1E40AF, #6D28D9);
    box-shadow: 0 4px 6px rgba(31, 41, 55, 0.4);
}

body.dark-mode .chat-button:hover {
    box-shadow: 0 6px 8px rgba(31, 41, 55, 0.5);
}