/* ========================================= */
/* MAIN MENU LEADERBOARD (MEGABONK STYLE)    */
/* ========================================= */

#main-menu-leaderboard {
    position: absolute;
    right: 20px;
    top: 90px;
    bottom: 40px;
    width: 360px;
    background: linear-gradient(180deg, rgba(18, 18, 26, 0.85) 0%, rgba(10, 10, 15, 0.98) 100%);
    border: 1px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: 8px;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(0, 217, 255, 0.05);
    display: flex;
    flex-direction: column;
    z-index: 100;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    
    /* Hidden by default */
    opacity: 0;
    pointer-events: none;
    transform: translateX(400px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

body:not(.boot-state) #main-menu-leaderboard {
    opacity: 0 !important;
    display: none !important;
    pointer-events: none !important;
    transform: translateX(400px) !important;
}

body:not(.boot-state) #global-leaderboard-btn{
    opacity: 0 !important;
    display: none !important;
}

body.boot-state #main-menu-leaderboard.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

.lb-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: linear-gradient(90deg, rgba(0, 217, 255, 0.15), transparent);
    border-bottom: 1px solid rgba(0, 217, 255, 0.2);
}

.lb-title {
    font-family: 'Orbitron', monospace;
    font-size: 1rem;
    font-weight: 900;
    color: var(--accent);
    letter-spacing: 3px;
    text-transform: uppercase;
    text-shadow: 0 0 10px var(--accent-glow);
    margin: 0;
}

.lb-tabs {
    display: flex;
    gap: 5px;
}

.lb-tab {
    background: transparent;
    border: none;
    color: #666;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    font-weight: bold;
    padding: 4px 8px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.lb-tab:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
}

.lb-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    text-shadow: 0 0 10px var(--accent-glow);
}

.lb-columns-header {
    display: flex;
    padding: 8px 10px;
    color: #889;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    border-bottom: 2px solid var(--border);
    background: rgba(0, 0, 0, 0.6);
    text-transform: uppercase;
    align-items: center;
}

.lb-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lb-list::-webkit-scrollbar { width: 6px; }
.lb-list::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.3); }
.lb-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.lb-list::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* Compact Rows */
.lb-row {
    display: flex;
    align-items: center;
    padding: 2px 0px;
    background: rgba(255, 255, 255, 0.02);
    border-left: 3px solid #333;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.lb-row:hover {
    background: rgba(0, 217, 255, 0.05);
    border-left-color: var(--accent);
    transform: translateX(3px);
}

/* Grid Specifics */
.col-rank { width: 35px; text-align: center; font-family: 'Courier New', monospace; font-weight: bold; color: #888; }
.col-avatar { width: 42px; display: flex; justify-content: center; align-items: center; }
.col-name { flex: 1; padding-left: 10px; color: #ccc; font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-time { width: 60px; text-align: right; color: #888; font-family: monospace; font-size: 0.9em; padding-right: 10px; }
.col-score { width: 45px; text-align: center; color: var(--accent); font-family: 'Orbitron', monospace; font-weight: 900; text-shadow: 0 0 5px var(--accent-glow); }

/* Ranks */
.lb-row.rank-1 { border-left-color: #ffd700; background: linear-gradient(90deg, rgba(255, 215, 0, 0.1), transparent); }
.lb-row.rank-1 .col-rank { color: #ffd700; text-shadow: 0 0 10px rgba(255, 215, 0, 0.8); }
.lb-row.rank-1 .col-name { color: #fff; }

.lb-row.rank-2 { border-left-color: #c0c0c0; background: linear-gradient(90deg, rgba(192, 192, 192, 0.1), transparent); }
.lb-row.rank-2 .col-rank { color: #c0c0c0; text-shadow: 0 0 10px rgba(192, 192, 192, 0.8); font-size: 1.1rem; }
.lb-row.rank-2 .col-name { color: #fff; }

.lb-row.rank-3 { border-left-color: #cd7f32; background: linear-gradient(90deg, rgba(205, 127, 50, 0.1), transparent); }
.lb-row.rank-3 .col-rank { color: #cd7f32; text-shadow: 0 0 10px rgba(205, 127, 50, 0.8); font-size: 1.05rem; }
.lb-row.rank-3 .col-name { color: #fff; }

/* Sticky User Row */
.lb-user-sticky {
    border-top: 2px solid var(--accent);
    background: rgba(10, 10, 15, 0.98);
    padding: 10px;
    box-shadow: 0 -10px 20px rgba(0, 0, 0, 0.6);
    z-index: 10;
    flex-shrink: 0;
}

.lb-user-sticky .lb-row {
    background: rgba(0, 217, 255, 0.05);
    border-left-color: var(--accent);
    box-shadow: inset 0 0 10px rgba(0, 217, 255, 0.1);
}

.lb-user-sticky .lb-row:hover {
    transform: none; 
    background: rgba(0, 217, 255, 0.1);
}

body.boot-state:has(#main-menu-leaderboard.active) #virtual-keyboard {
    opacity: 0 !important;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#virtual-keyboard {
    transition: opacity 0.3s ease;
}