@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
    --bg-deep: #020617;
    --bg-card: rgba(15, 23, 42, 0.6);
    --primary: #0ea5e9;
    --primary-glow: rgba(14, 165, 233, 0.5);
    --secondary: #38bdf8;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg-deep);
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

/* Hide scrollbar for Chrome, Safari and Opera */
::-webkit-scrollbar {
    display: none;
}

.ambient-background {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: 
        radial-gradient(circle at 15% 50%, rgba(14, 165, 233, 0.15), transparent 35%),
        radial-gradient(circle at 85% 30%, rgba(56, 189, 248, 0.1), transparent 35%);
    z-index: -1;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    background: rgba(2, 6, 23, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
}
@media (max-width: 768px) {
    .main-header { flex-direction: column; gap: 1rem; padding: 1rem; }
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-img {
    width: 48px; height: 48px;
    object-fit: contain;
}

.logo-area h1 {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(90deg, var(--secondary), var(--primary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 2px;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    transition: color 0.3s;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--text-main);
    text-shadow: 0 0 10px var(--primary-glow);
}

.search-area input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.8rem 1.5rem;
    border-radius: 99px;
    font-family: 'Outfit', sans-serif;
    outline: none;
    transition: 0.3s;
    width: 250px;
    font-size: 1rem;
}
@media (max-width: 768px) { .search-area input { width: 100%; } }

.search-area input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 25px var(--primary-glow), inset 0 0 10px rgba(14, 165, 233, 0.1);
    background: rgba(255, 255, 255, 0.12);
    width: 320px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
}

.categories-filter {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    padding: 1rem 0.5rem;
    margin-bottom: 2rem;
}

.category-pill {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 99px;
    padding: 0.75rem 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: 0.3s;
    white-space: nowrap;
    font-weight: 600;
    font-family: inherit;
    font-size: 1rem;
}

.category-pill img { width: 28px; height: 28px; }

.category-pill:hover, .category-pill.active {
    background: rgba(14, 165, 233, 0.2);
    border-color: var(--primary);
    color: var(--text-main);
    box-shadow: 0 0 30px var(--primary-glow), inset 0 0 10px rgba(14, 165, 233, 0.2);
    transform: translateY(-4px) scale(1.05);
}

.category-pill:active { transform: translateY(-2px) scale(0.98); }

.leaderboard {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.player-card {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 1.5rem 2rem;
    backdrop-filter: blur(10px);
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    z-index: 1;
    cursor: pointer;
    opacity: 0;
}

.animate-in {
    animation: fadeInUp 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.player-card:hover {
    transform: translateY(-5px);
    border-color: rgba(14, 165, 233, 0.4);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4), 0 0 25px rgba(14, 165, 233, 0.15);
}

.rank-bg {
    position: absolute;
    top: 0; left: 0;
    height: 100%;
    width: 250px;
    clip-path: polygon(0 0, 100% 0, 75% 100%, 0% 100%);
    z-index: -1;
    opacity: 0.9;
}

.rank-1 .rank-bg { 
    background: linear-gradient(to right, #0011ff, #8000ff); 
    animation: goldPulse 4s infinite alternate;
}
.rank-2 .rank-bg { background: linear-gradient(to right, #cfcfcf, #888888); }
.rank-3 .rank-bg { background: linear-gradient(to right, #c08535, #885317); }

@keyframes goldPulse {
    from { filter: brightness(1); }
    to { filter: brightness(1.3) contrast(1.2); }
}

@media (max-width: 768px) {
    .rank-bg { width: 100%; height: 120px; clip-path: polygon(0 0, 100% 0, 100% 70%, 0% 100%); }
}

.rank-badge {
    font-size: 3.5rem; font-weight: 800; font-style: italic; color: transparent;
    -webkit-text-stroke: 1px white; min-width: 80px; margin-right: 15px; text-shadow: 2px 2px 5px rgba(0,0,0,0.3);
}

.player-profile { display: flex; align-items: center; gap: 1.5rem; flex-grow: 1; }

.player-avatar {
    width: 90px; height: 90px; border-radius: 20px; background: rgba(0,0,0,0.3);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3); transition: 0.3s;
}
.player-card:hover .player-avatar { transform: scale(1.08) rotate(-4deg); box-shadow: 0 12px 30px rgba(14, 165, 233, 0.3); }

.player-info h2 { font-size: 1.8rem; font-weight: 800; margin-bottom: 0.25rem; letter-spacing: 0.5px; }
.player-points { color: var(--secondary); font-weight: 600; font-size: 1.2rem; display: block; }

.region-badge {
    display: inline-block; background: rgba(16, 185, 129, 0.15); color: #34d399;
    padding: 0.25rem 0.75rem; border-radius: 8px; font-size: 0.85rem; font-weight: 800;
    margin-top: 0.5rem; border: 1px solid rgba(52, 211, 153, 0.3);
}

.player-tiers { display: flex; gap: 1.25rem; flex-wrap: wrap; }
@media (max-width: 768px) {
    .player-tiers { width: 100%; border-top: 1px solid var(--glass-border); padding-top: 1.5rem; justify-content: flex-start; }
}

.tier-item {
    display: flex; flex-direction: column; align-items: center; gap: 0.3rem; 
}
.tier-icon-wrapper {
    width: 46px; height: 46px; border-radius: 50%;
    background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.1);
    display: flex; justify-content: center; align-items: center;
    transition: 0.3s; box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}
.tier-icon-wrapper img { width: 26px; height: 26px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.8)); }
.tier-label {
    font-size: 0.8rem; font-weight: 800; padding: 0.15rem 0.6rem; border-radius: 12px;
    background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.08);
}
.tier-label.ht3 { color: #f97316; } /* Orange */
.tier-label.ht1 { color: #facc15; } /* Yellow */
.tier-label.lt2 { color: #94a3b8; } /* Gray */
.tier-label.lt3 { color: #cbd5e1; } /* Lighter Gray */
.tier-label.ht2 { color: #f43f5e; } /* Rose */

/* MODAL STYLES */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(8px);
    z-index: 1000; display: flex; justify-content: center; align-items: center;
    opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal-card {
    background: #11141d; border-radius: 20px; width: 90%; max-width: 420px;
    padding: 2.5rem 2rem; position: relative; box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    border: 1px solid rgba(255,255,255,0.05); transform: translateY(40px) scale(0.9);
    transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.5s ease;
    opacity: 0;
}
.modal-overlay.active .modal-card { transform: translateY(0) scale(1); opacity: 1; }

.modal-close {
    position: absolute; top: 15px; right: 15px; background: rgba(255,255,255,0.05);
    border: none; color: #94a3b8; font-size: 1.5rem; width: 36px; height: 36px;
    border-radius: 50%; cursor: pointer; transition: 0.3s;
}
.modal-close:hover { background: rgba(255,255,255,0.15); color: white; }

/* Loader */
.modal-loader { display: flex; justify-content: center; align-items: center; height: 300px; }
.spinner {
    width: 50px; height: 50px; border: 4px solid rgba(255,255,255,0.05);
    border-top: 4px solid #facc15; border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes scaleIn { 0% { transform: scale(0.95); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* Modal Content Header */
.modal-header-info { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.modal-avatar-wrapper {
    width: 110px; height: 110px; border-radius: 50%; padding: 3px;
    background: linear-gradient(135deg, #facc15, #ca8a04); box-shadow: 0 0 20px rgba(250, 204, 21, 0.2);
}
.modal-avatar-wrapper img {
    width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: #1e293b;
}

#modalName { font-size: 2rem; font-weight: 800; color: white; margin-top: 10px; }

.modal-badge-master {
    background: rgba(250, 204, 21, 0.15); color: #fbd38d; padding: 0.4rem 1rem;
    border-radius: 20px; font-weight: 700; font-size: 0.9rem; border: 1px solid rgba(250, 204, 21, 0.3);
    margin: 5px 0;
}
#modalRegion { color: var(--text-muted); font-weight: 700; font-size: 1.1rem; }
.btn-namemc {
    background: rgba(0,0,0,0.4); color: #94a3b8; text-decoration: none;
    padding: 0.4rem 1rem; border-radius: 8px; display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.85rem; font-weight: 700; transition: 0.3s; border: 1px solid rgba(255,255,255,0.05);
    margin-top: 8px;
}
.btn-namemc:hover { background: rgba(255,255,255,0.1); color: white; }
.btn-namemc img { width: 14px; height: 14px; filter: grayscale(1); }

/* Modal Sections */
.modal-section { margin-top: 1.5rem; }
.section-title { color: var(--text-muted); font-size: 0.9rem; font-weight: 700; margin-bottom: 0.5rem; letter-spacing: 1px; }

.position-box {
    background: transparent; border: 1px solid rgba(255,255,255,0.08); border-radius: 12px;
    display: flex; align-items: stretch; overflow: hidden;
}
.pos-rank-bg {
    background: #facc15; padding: 0.8rem 1.5rem; position: relative;
    clip-path: polygon(0 0, 100% 0, 75% 100%, 0 100%); min-width: 90px;
    display: flex; align-items: center;
}
.pos-rank-bg span {
    color: transparent; -webkit-text-stroke: 1px rgba(255,255,255,0.9); font-size: 2rem;
    font-weight: 800; font-style: italic; line-height: 1; text-shadow: none;
}
.pos-info { display: flex; align-items: center; gap: 0.5rem; padding: 0.8rem 1rem; flex-grow: 1; }
.pos-overall { font-weight: 800; color: white; font-size: 1.1rem; display:flex; align-items:center; gap:0.4rem;}
.pos-points { color: var(--text-muted); font-size: 0.95rem; }

.tiers-box {
    background: rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.05);
    border-radius: 12px; padding: 1.25rem; display: flex; gap: 1rem; flex-wrap: wrap; justify-content: flex-start;
}

/* GAMEMODES BOARD (5 COLUMNS) */
.gamemode-board {
    display: none; /* Flex when activated via JS */
    gap: 1.5rem; justify-content: space-between;
    margin-top: 10px; width: 100%;
}
@media (max-width: 1000px) { .gamemode-board { flex-direction: column; } }

.tier-column {
    background: var(--bg-card); flex: 1; min-height: 400px;
    border: 1px solid var(--glass-border); border-radius: 16px;
    padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem;
    backdrop-filter: blur(10px);
}
.tier-col-header {
    text-align: center; font-size: 1.2rem; font-weight: 800;
    color: #facc15; text-transform: uppercase; letter-spacing: 1px;
    border-bottom: 1px solid var(--glass-border); padding-bottom: 1rem;
}
.gamemode-player-item {
    display: flex; align-items: center; gap: 0.8rem;
    background: rgba(0,0,0,0.3); padding: 0.5rem; border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.02);
    cursor: pointer; transition: 0.3s;
    border-left: 4px solid transparent;
    opacity: 0;
}

.gamemode-player-item:hover { 
    background: rgba(255, 255, 255, 0.08); 
    transform: translateX(8px) scale(1.02);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}
.gamemode-player-item img { width: 36px; height: 36px; border-radius: 8px; }
.gamemode-player-name { font-weight: 700; font-size: 0.95rem; }
.gmp-tier { font-size: 0.7rem; font-weight: 800; color: #94a3b8; }

/* Left border based on HT/LT or specific tier */
.border-tier-ht { border-left-color: #0ea5e9; }
.border-tier-lt { border-left-color: #f97316; }
