.youtube-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 56px;
    background-color: #212121;
    color: white;
    display: flex;
    align-items: center;
    padding: 0 24px;
    box-sizing: border-box;
    z-index: 1001;
    border-bottom: 1px solid #3d3d3d;
    font-family: 'Roboto', sans-serif;
    transform: translateY(-100%);
    transition: transform 0.3s ease-in-out;
}
.youtube-header.visible {
    transform: translateY(0);
}
.header-left {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.youtube-logo {
    height: 20px;
    width: auto;
    margin-right: 8px;
}
.youtube-text {
    font-size: 20px;
    letter-spacing: -1px;
    font-weight: bold;
}
.header-center {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    padding: 0 40px;
}
.search-bar {
    width: 100%;
    max-width: 500px;
    background-color: #121212;
    border: 1px solid #3d3d3d;
    border-radius: 40px;
    padding: 8px 16px;
    color: white;
    font-size: 16px;
}
.search-bar::placeholder {
    color: #aaaaaa;
}
.header-right {
    flex-shrink: 0;
}
/* --- Stream Container --- */
#youtube-stream-container {
    position: fixed;
    top: 56px; /* Position below the header */
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    display: grid;
    grid-template-columns: 1fr 400px; /* Main content and chat sidebar */
    grid-template-rows: 1fr auto; /* Allow stream info to size to its content */
    grid-template-areas:
        "main chat"
        "info chat";
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
    pointer-events: none; /* Only children are interactive */
}
#youtube-stream-container.visible {
    transform: translateY(0);
    pointer-events: none;
}
#game-viewport {
    grid-area: main;
    position: relative; /* This is the new positioning context for in-game UI */
    overflow: hidden; /* Ensures nothing spills out */
    pointer-events: all; /* Allow interaction within the game area */
}
#stream-info-container {
    grid-area: info;
    background: #0f0f0f;
    color: #fff;
    padding: 15px 20px;
    box-sizing: border-box;
    border-top: 1px solid #3f3f3f;
    font-family: 'Roboto', sans-serif;
    pointer-events: all;
    min-height: 90px;
}
#stream-title {
    font-size: 1.4rem;
    font-weight: 500;
    margin: 0 0 10px 0;
    line-height: 1.3;
}
#stream-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: #aaa;
}
#viewer-count-display {
    padding: 4px 10px;
    border-radius: 16px;
    border: 2px solid transparent;
    transition: all 0.3s ease-in-out;
}
#viewer-count-display.highlight {
    animation: viewer-highlight 2.5s ease-out;
}
@keyframes viewer-highlight {
    0% {
        border-color: transparent;
        box-shadow: none;
    }
    15%, 80% {
        border-color: #ff3333;
        box-shadow: 0 0 12px rgba(255, 51, 51, 0.7);
    }
    100% {
        border-color: transparent;
        box-shadow: none;
    }
}
.channel-info {
    display: flex;
    align-items: center;
}
.channel-name {
    font-weight: bold;
    color: #fff;
    margin-right: 10px;
    font-size: 1.1rem;
}
.live-indicator {
    background-color: #cc0000;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: bold;
}
.live-chat-container {
    grid-area: chat;
    height: 100%; /* Fill the full row height */
    background: #0f0f0f;
    border-left: 1px solid #3f3f3f;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    pointer-events: all;
}
.live-chat-header {
    padding: 15px;
    background: #0f0f0f;
    border-bottom: 1px solid #3f3f3f;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.live-chat-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 500;
}
.live-chat-messages {
    list-style: none;
    padding: 15px;
    margin: 0;
    flex: 1 1 0;
    min-height: 0; /* Allow flex item to shrink below content size */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.live-chat-messages li {
    color: #e0e0e0;
    font-size: 1rem;
    line-height: 1.4;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.live-chat-messages li.visible {
    opacity: 1;
    transform: translateX(0);
}
.live-chat-messages .username {
    font-weight: bold;
    color: #aaa;
    margin-right: 0px;
}
.live-chat-messages .chatbot-username {
    color: #00ff9f; /* Mint green color for ChatBot */
    font-weight: bold;
    margin-right: 0px;
}
.live-chat-messages .message {
    color: #f1f1f1;
}
/* Custom Scrollbar */
.live-chat-messages::-webkit-scrollbar {
    width: 8px;
}
.live-chat-messages::-webkit-scrollbar-track {
    background: #212121;
}
.live-chat-messages::-webkit-scrollbar-thumb {
    background-color: #555;
    border-radius: 4px;
}
/* Small desktop/laptop responsive design */
@media (max-width: 1366px) {
    .youtube-header {
        height: 50px;
        padding: 0 20px;
    }
    
    .youtube-text {
        font-size: 18px;
    }
    
    .youtube-logo {
        height: 18px;
    }
    
    .search-bar {
        max-width: 400px;
        padding: 6px 14px;
        font-size: 15px;
    }
    
    #youtube-stream-container {
        top: 50px;
        grid-template-columns: 1fr 360px;
    }
    
    #stream-title {
        font-size: 1.2rem;
        margin: 0 0 8px 0;
    }
    
    #stream-info-container {
        padding: 12px 16px;
        min-height: 80px;
    }
    
    .channel-name {
        font-size: 1rem;
    }
    
    .live-chat-header {
        padding: 12px;
    }
    
    .live-chat-header h3 {
        font-size: 1.1rem;
    }
    
    .live-chat-messages {
        padding: 12px;
        gap: 10px;
    }
    
    .live-chat-messages li {
        font-size: 0.9rem;
    }
}
@media (max-width: 1024px) {
    .youtube-header {
        height: 48px;
        padding: 0 16px;
    }
    
    .youtube-text {
        font-size: 16px;
    }
    
    .youtube-logo {
        height: 16px;
    }
    
    .search-bar {
        max-width: 350px;
        padding: 5px 12px;
        font-size: 14px;
    }
    
    #youtube-stream-container {
        top: 48px;
        grid-template-columns: 1fr 320px;
    }
    
    #stream-title {
        font-size: 1.1rem;
        margin: 0 0 6px 0;
        line-height: 1.2;
    }
    
    #stream-info-container {
        padding: 10px 14px;
        min-height: 70px;
    }
    
    #stream-meta {
        font-size: 0.85rem;
    }
    
    .channel-name {
        font-size: 0.95rem;
        margin-right: 8px;
    }
    
    .live-indicator {
        padding: 1px 5px;
        font-size: 0.75rem;
    }
    
    .live-chat-header {
        padding: 10px;
    }
    
    .live-chat-header h3 {
        font-size: 1rem;
    }
    
    .live-chat-messages {
        padding: 10px;
        gap: 8px;
    }
    
    .live-chat-messages li {
        font-size: 0.85rem;
        line-height: 1.3;
    }
}
@media (max-width: 768px) {
    .youtube-header {
        padding: 0 16px;
    }
    .header-center {
        display: none; /* Hide search on mobile */
    }
    #stream-info-container {
        display: none;
    }
    .live-chat-container {
        width: 100%;
        height: 50vh;
    }
}