/* Leaderboard Modal Styles */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: flex-end; /* Mobile bottom sheet style */
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal.hidden {
    display: none;
}

.modal-content {
    width: 100%;
    max-width: 500px;
    height: 80%; /* Takes up most of screen */
    background: #1a1f26;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    border: 1px solid var(--neon-cyan);
    border-bottom: none;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -5px 30px rgba(0, 255, 255, 0.2);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: var(--neon-cyan);
    font-size: 1.2rem;
    margin: 0;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.close-modal {
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

.leaderboard-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 10px;
}

.leaderboard-titles {
    display: grid;
    grid-template-columns: 40px 1fr 60px 80px;
    padding: 10px;
    color: #888;
    font-size: 0.8rem;
    border-bottom: 1px solid #333;
}

#global-leaderboard-list {
    flex: 1;
    overflow-y: auto;
    list-style: none;
    padding: 0;
    margin: 0;
}

.lb-item {
    display: grid;
    grid-template-columns: 40px 1fr 60px 80px;
    padding: 12px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    align-items: center;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.lb-item:hover {
    background: rgba(255, 215, 0, 0.05);
}

.lb-rank {
    font-weight: bold;
    color: #666;
}

.lb-rank.top-1 { color: #ffd700; text-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
.lb-rank.top-2 { color: #c0c0c0; text-shadow: 0 0 10px rgba(192, 192, 192, 0.5); }
.lb-rank.top-3 { color: #cd7f32; text-shadow: 0 0 10px rgba(205, 127, 50, 0.5); }

.lb-name {
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-level {
    text-align: center;
    background: #000;
    border-radius: 4px;
    padding: 2px 5px;
    font-size: 0.8rem;
    color: #fff;
}

.lb-score {
    text-align: right;
    color: var(--neon-cyan);
    font-family: monospace;
}

.my-rank {
    background: rgba(0, 255, 255, 0.1);
    border-top: 1px solid var(--neon-cyan);
    padding: 15px;
    display: grid;
    grid-template-columns: 40px 1fr 60px 80px;
    align-items: center;
    color: #fff;
    font-weight: bold;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.5);
}

/* Titles Colors in CSS (optional fallback) */
.title-caylak { color: #95a5a6; }
.title-user { color: #2ecc71; }
.title-kurt { color: #3498db; }
.title-sef { color: #9b59b6; }
.title-baron { color: #e67e22; }
.title-efsane { color: #f1c40f; }
.title-imperator { 
    color: #e74c3c; 
    animation: pulseTitle 1.5s infinite;
    text-shadow: 0 0 5px #e74c3c;
}

@keyframes pulseTitle {
    0% { opacity: 1; text-shadow: 0 0 5px #e74c3c; }
    50% { opacity: 0.8; text-shadow: 0 0 20px #e74c3c; }
    100% { opacity: 1; text-shadow: 0 0 5px #e74c3c; }
}

@media (min-width: 600px) {
    .modal-content {
        height: auto;
        min-height: 500px;
        max-height: 80vh;
        border-radius: 20px;
        align-self: center; /* Center on desktop */
        margin-bottom: 0;
        animation: fadeInScale 0.3s ease;
    }
    
    .modal {
        align-items: center;
    }

    @keyframes fadeInScale {
        from { opacity: 0; transform: scale(0.9); }
        to { opacity: 1; transform: scale(1); }
    }
}
