body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.lobby-container {
    max-width: 100%;
    margin: 20px auto 0;
    padding: 0 20px;
}

.lobby-content {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.mode-sections-wrapper {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping to multiple rows */
    gap: 20px;
    scroll-behavior: smooth;
    flex: 1; /* Take remaining space */
}

/* Custom scrollbar styling */
.mode-sections-wrapper::-webkit-scrollbar {
    height: 8px;
}

.mode-sections-wrapper::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.mode-sections-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 4px;
}

.mode-sections-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.7);
}

/* Lobby header styles removed - using app-banner instead */

.mode-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    flex: 1; /* Equal flex growth, all 4 in row when space allows */
    min-width: 225px; /* 25% smaller than original 300px */
    display: flex;
    flex-direction: column;
}

.mode-header {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #333;
}

.rooms-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    flex: 1;
}

.room-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    position: relative;
}

.room-card:hover {
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.35);
    border-color: #667eea;
}

.room-card.banned {
    opacity: 0.6;
    cursor: not-allowed;
    background: #ffe0e0;
}

.room-card.banned:hover {
    transform: none;
    border-color: #dc3545;
}

.room-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.room-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #667eea;
}

.room-avatar-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 20px;
}

.room-info {
    flex: 1;
}

.room-name {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.room-users {
    font-size: 14px;
    color: #666;
}

.room-description {
    color: #666;
    font-size: 14px;
    margin-bottom: 12px;
    line-height: 1.4;
}

.room-status {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.private {
    background: #ffc107;
    color: #856404;
}

.status-badge.banned {
    background: #dc3545;
    color: white;
}

.status-badge.active {
    background: #28a745;
    color: white;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* Transition Overlay Animation */
.room-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.room-transition-overlay.active {
    opacity: 1;
}

.transition-content {
    text-align: center;
    color: white;
}

.transition-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.transition-text {
    font-size: 20px;
    font-weight: 500;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Daily Leaderboard Styles (RIGHT SIDEBAR) */
.daily-leaderboard {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    max-width: 300px;
    flex: 0 0 300px; /* Fixed width on right side */
    align-self: flex-start; /* Prevent stretching */
    position: sticky;
    top: 20px; /* Sticky positioning */
}

.daily-leaderboard .leaderboard-header {
    color: #2d3748;
    text-align: center;
    margin-bottom: 15px;
    font-size: 22px;
    font-weight: 600;
}

.daily-leaderboard .leaderboard-list {
    background-color: 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);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    border-radius: 8px;
    padding: 15px;
    max-height: 600px;
    overflow-y: auto;
}

.daily-leaderboard .leaderboard-entry {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.daily-leaderboard .leaderboard-entry:last-child {
    margin-bottom: 0;
}

.daily-leaderboard .leaderboard-entry:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.daily-leaderboard .leaderboard-entry .rank {
    min-width: 40px;
    font-weight: bold;
    font-size: 18px;
    color: #2d3748;
}

.daily-leaderboard .leaderboard-entry .username {
    flex: 1;
    font-weight: 600;
    color: #2d3748;
}

.daily-leaderboard .leaderboard-entry .score {
    color: #667eea;
    font-weight: bold;
}

.daily-leaderboard .no-scores {
    text-align: center;
    color: #666;
    padding: 20px;
}

/* Scrollbar for lobby leaderboard */
.daily-leaderboard .leaderboard-list::-webkit-scrollbar {
    width: 8px;
}

.daily-leaderboard .leaderboard-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.daily-leaderboard .leaderboard-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.daily-leaderboard .leaderboard-list::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}

/* Header Actions - Currency Display and Buy Button */
.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: flex-end;
    margin-bottom: 20px;
}

.currency-display {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: bold;
    color: white;
}

.currency-display .currency-icon {
    font-size: 24px;
}

.btn-buy-currency {
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(74, 222, 128, 0.3);
}

.btn-buy-currency:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(74, 222, 128, 0.4);
}

/* ===================== */
/* Mobile Responsive Layout */
/* ===================== */
@media (max-width: 768px) {
    /* CRITICAL: Override base.css overflow:hidden to enable scrolling */
    html {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        height: auto !important;
    }

    /* Ensure body is scrollable on mobile */
    body {
        padding: 10px 0;  /* Only vertical padding, zero horizontal for centering */
        min-height: 100vh;
        height: auto !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    /* Reduce container padding */
    .lobby-container {
        padding: 0;  /* Zero all padding for perfect edge-to-edge */
        width: 100%;
        box-sizing: border-box;
        height: auto;
        min-height: 100vh;
    }

    /* Header adjustments - removed, using app-banner */

    /* Header actions - stack currency and button */
    .header-actions {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
    }

    .currency-display {
        font-size: 16px;
        padding: 6px 12px;
    }

    .btn-buy-currency {
        font-size: 14px;
        padding: 8px 16px;
    }

    /* MAIN CHANGE: Vertical layout for mobile */
    .lobby-content {
        flex-direction: column;
        gap: 16px;
    }

    /* Leaderboard moves to top and becomes full width */
    .daily-leaderboard {
        order: -1; /* Move to top */
        max-width: 100%;
        flex: 0 0 auto;
        width: 100%;
        position: relative; /* Remove sticky on mobile */
        top: auto;
        margin-bottom: 16px;
        margin-left: 0;
        margin-right: 0;
        padding: 16px 8px;  /* Match mode-section minimal horizontal padding */
        box-sizing: border-box;
    }

    .daily-leaderboard .leaderboard-header {
        font-size: 18px;
        margin-bottom: 12px;
    }

    /* CRITICAL: Limit leaderboard to 3 entries on mobile */
    .daily-leaderboard .leaderboard-list {
        max-height: 300px; /* Reduced from 600px */
        padding: 12px;
    }

    /* Hide entries after the 3rd one */
    .daily-leaderboard .leaderboard-entry:nth-child(n+4) {
        display: none;
    }

    .daily-leaderboard .leaderboard-entry {
        padding: 10px;
        margin-bottom: 6px;
    }

    .daily-leaderboard .leaderboard-entry .rank {
        min-width: 35px;
        font-size: 16px;
    }

    .daily-leaderboard .leaderboard-entry .username {
        font-size: 14px;
    }

    .daily-leaderboard .leaderboard-entry .score {
        font-size: 14px;
    }

    /* Rooms section takes full width */
    .mode-sections-wrapper {
        width: 100%;
        flex-direction: column; /* Stack mode sections vertically */
        flex-wrap: nowrap;
        box-sizing: border-box;
    }

    /* Each mode section is full width */
    .mode-section {
        width: 100%;
        min-width: 0;
        padding: 12px 8px;  /* Minimal horizontal padding for breathing room */
        margin-bottom: 12px;
        margin-left: 0;
        margin-right: 0;
        box-sizing: border-box;
        margin: 0 auto;  /* Ensure centering */
    }

    .mode-header {
        font-size: 20px;
        margin-bottom: 12px;
        padding-left: 4px;
    }

    /* Room cards optimization for mobile */
    .rooms-grid {
        max-height: none; /* Allow natural height on mobile for page scroll */
        overflow-y: visible;
        gap: 10px;
        padding: 0;
        margin: 0;
        width: 100%;
        box-sizing: border-box;
    }

    .room-card {
        padding: 16px;
        margin-left: 0;
        margin-right: 0;
        width: 100%;
        box-sizing: border-box;
    }

    /* Optimize room header layout for mobile - avatar + name horizontal, users below */
    .room-header {
        display: flex;
        flex-wrap: wrap;  /* Allow wrapping to second row */
        gap: 4px 8px;  /* 4px vertical, 8px horizontal */
        align-items: flex-start;  /* Align items to top */
        margin-bottom: 8px;
    }

    .room-avatar,
    .room-avatar-placeholder {
        width: 40px;
        height: 40px;
        font-size: 18px;
        flex-shrink: 0;  /* Don't shrink avatar */
        align-self: flex-start;  /* Stay at top */
    }

    .room-info {
        flex: 1;  /* Take remaining space in first row */
        min-width: 0;  /* Allow shrinking if needed */
        display: flex;
        flex-direction: row;  /* Horizontal layout */
        flex-wrap: wrap;  /* Allow users to wrap below */
        gap: 4px;
        align-items: center;  /* Vertical center alignment for name */
    }

    .room-name {
        flex: 1;  /* Take available space */
        font-size: 15px;  /* Slightly reduce from 16px for better fit */
        line-height: 1.3;
        min-width: 0;  /* Allow text truncation if needed */
    }

    .room-users {
        flex-basis: 100%;  /* Force to new row - KEY CHANGE */
        font-size: 12px;  /* Slightly reduce from 13px */
        color: #666;
        margin-left: 0;
    }

    .room-description {
        font-size: 13px;
    }

    .status-badge {
        font-size: 11px;
        padding: 3px 10px;
    }
}

/* Old lobby header logo styles removed - using app-banner instead */
