body {
    background-color: #0f0f11;

    color: #fff;

    font-family: Arial, sans-serif;

    display: flex;

    flex-direction: column; /* Stacks the video and chat top-to-bottom */

    align-items: center; /* Keeps desktop view centered horizontally */

    min-height: 100vh;

    margin: 0;
}

/* 16:9 Responsive Video Box */
.stream-wrapper {
    width: 90%;
    max-width: 1200px;
    aspect-ratio: 16 / 9; /* This automatically handles the height based on the width */
    background-color: #000;
    border: 2px solid #222;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    flex-shrink: 0; /* Prevents the video from being squished by the chat box */
    margin-top: 0px; /* Slight spacing at the top for desktop */
}

#player-container {
width: 100%;
height: 100%;
}

#player-container iframe,
#player-container video {
width: 100%;
height: 100%;
border: none;
outline: none;
}

.loading-msg {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    font-size: 1.5rem;
    color: #888;
    background-color: #111;
}

/* Chat Box Styling Container */
.chat-container {
    width: 90%;
    max-width: 1200px;
    flex-grow: 1;
    min-height: 250px; /* ADD THIS LINE: Accounts for the 150px window + header + input box */
    background-color: #1a1a1c;
    margin-top: 0px;
    margin-bottom: 20px;
    border-radius: 8px;
    border: 1px solid #333;
}
.chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.95rem;
    font-weight: 600;
    color: #6B7280;
}

.status-dot {
    height: 8px;
    width: 8px;
    background-color: #10B981;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.input-area {
    padding: 12px;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    gap: 10px;
    z-index: 10;
}

.chat-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #d1d5db;
    border-radius: 30px;
    outline: none;
    font-family: inherit;
    color: #1F2937;
    background: #ffffff;
    font-size: 16px;
}

.chat-input:focus {
    border-color: #10B981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.send-btn {
    background: #10B981;
    color: white;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.send-btn:hover { background: #047857; }

#chat-window {
flex: 1;
overflow-y: auto; /* This handles the scrolling */
min-height: 150px; /* ADD THIS LINE: Forces the message area to be at least 150px tall */
max-height: 375px;
padding: 15px;
background-color: #ffffff;
background-image: radial-gradient(#e5e7eb 1px, transparent 1px);
background-size: 20px 20px;
display: flex;
flex-direction: column;
gap: 15px;
}

.message-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}

.avatar {
    width: 35px;
    height: 35px;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
    text-transform: uppercase;
}

.bubble {
    background: #F3F4F6;
    padding: 10px 14px;
    border-radius: 0 12px 12px 12px;
    max-width: 85%;
}

.bubble-name {
    font-size: 0.75rem;
    font-weight: 700;
    display: block;
    margin-bottom: 4px;
}

.bubble-name a {
    color: inherit;
    text-decoration: none;
}

.bubble-text {
    color: #1F2937;
    line-height: 1.4;
    font-size: 0.9rem;
    word-break: break-word;
}

#chat-window::-webkit-scrollbar { width: 6px; }
#chat-window::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* Dynamic Alerts Block */
.alert-message {
    max-width: 1400px;
    margin: 0 auto 15px;
    padding: 15px;
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #f87171;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    width: calc(100% - 30px);
}

/* --- MOBILE SPECIFIC FIXES --- */
@media (max-width: 768px) {
    .stream-wrapper {
        width: 100%;
        margin-top: 0;
        border: none;
        border-radius: 0;
        border-bottom: 2px solid #222;
    }

    .chat-container {
        width: 100%;
        margin-top: 0;
        margin-bottom: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
        /* ADD THESE TWO LINES: */
        max-height: 50vh; /* Forces the chat to take up max 50% of the screen */
        flex-shrink: 1; /* Allows it to shrink if the keyboard opens */
    }
}
