/* Apply gradient background matching lobby page */
body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Prevent page scroll — chat scrolls internally */
}

/* Update header text color for visibility against gradient */
h1 {
    color: white;
    text-align: center;
    margin: 0; /* Remove margin to fix header height */
}

/* Add horizontal padding to container for spacing */
#container {
    flex: 1;
    padding-left: 10px !important;
    padding-right: 10px !important;
}

/* Keep panels with light backgrounds for good contrast */
#chat {
    background-color: rgb(255, 255, 255);
    flex: 1 1 auto; /* Take remaining space */
}

/* Leaderboard on RIGHT side with narrow width */
#leaderboardContainer {
    background-color: rgb(255, 255, 255);
    /* max-width: 200px !important; */
    flex: 0 0 200px !important; /* Don't grow, don't shrink, fixed at 200px */
}

/* Glassmorphism effect for messages area (shower glass with backlight) */
/* backdrop-filter lives on ::before so text children are not in a composited layer,
   preserving subpixel antialiasing on macOS */
div#messages.messages,
div#messages,
#messages {
    position: relative;
    isolation: isolate;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15) !important;
}

#messages::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: 5px;
    background: rgba(102, 126, 234, 0.15);
    backdrop-filter: blur(20px) brightness(1.1) saturate(1.3);
    -webkit-backdrop-filter: blur(20px) brightness(1.1) saturate(1.3);
}

/* Glassmorphism effect for leaderboard area (shower glass with backlight) */
div#leaderboard,
#leaderboard {
    position: relative;
    isolation: isolate;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15) !important;
    gap: 2px !important; /* Tighter spacing between entries */
}

#leaderboard::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: 5px;
    background: rgba(102, 126, 234, 0.15);
    backdrop-filter: blur(20px) brightness(1.1) saturate(1.3);
    -webkit-backdrop-filter: blur(20px) brightness(1.1) saturate(1.3);
}

/* Optimize leaderboard entries for narrow layout */
#leaderboard p {
    padding: 8px 8px !important; /* Reduced horizontal padding for narrow layout */
    margin: 0 !important; /* Remove default browser margin on <p> elements */
    font-size: 13px; /* Slightly smaller text for narrow layout */
}

/* Room header with avatar */
#roomTitle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.room-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Update footer to match gradient theme */
#footer {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

#footer p {
    color: white;
}
