/* Previous styles remain */
:root {
    --bg-main: #0a0e17;
    --bg-header: #0f141f;
    --accent-blue: #F59E0B;
    /* Now Gold/Amber */
    --accent-yellow: #fbbf24;
    --accent-glow: rgba(245, 158, 11, 0.3);

    --text-white: #ffffff;
    --text-gray: #9ca3af;

    --card-bg: #141b2d;
    --card-hover: #161e32;

    --gold: #FFD700;
    --silver: #C0C0C0;
    --bronze: #CD7F32;

    --font-head: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-white);
    font-family: var(--font-head);
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Navbar */
.navbar {
    background: transparent;
    padding: 1.5rem 0;
    display: flex;
    justify-content: center;
    position: relative;
    z-index: 50;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    position: relative;
}

.brand-group {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: transform 0.2s;
}

.logo:hover {
    transform: scale(1.05);
}

.logo-img {
    height: 48px;
    width: auto;
    object-fit: contain;
}

/* Centered Premium Nav Pill */
.nav-links {
    display: flex;
    gap: 0.5rem;
    background: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(12px);
    padding: 0.4rem 0.6rem;
    border-radius: 100px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.nav-links a {
    color: var(--text-gray);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.6rem 1rem;
    border-radius: 99px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    position: relative;
    overflow: hidden;
}

.nav-links a i {
    font-size: 0.9rem;
    transition: transform 0.3s ease;
}

.nav-links a:hover {
    color: var(--text-white);
    background: rgba(255, 255, 255, 0.05);
}

.nav-links a:hover i {
    transform: translateY(-2px);
    color: var(--accent-blue);
}

.nav-links a.active {
    color: #0f141f;
    background: var(--accent-blue);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
}

.nav-links a.active i {
    color: #0f141f;
}

.nav-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.btn-discord {
    background: var(--accent-blue);
    color: #0f141f;
    text-decoration: none;
    padding: 0.6rem 1.2rem;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s;
}

.btn-discord:hover {
    background: #d97706;
}

/* Header */
.page-header {
    margin-top: 2rem;
    margin-bottom: 1.5rem;
}

.header-grid {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.header-text h1 {
    font-size: 4rem;
    font-weight: 900;
    font-style: italic;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.header-text h1 .dot {
    color: var(--accent-blue);
}

.header-text p {
    color: var(--text-gray);
    max-width: 400px;
    font-size: 1rem;
}

.header-search {
    width: 240px;
    border-radius: 8px;
    /* Box style */
    position: relative;
    background: #111827;
    border: 1px solid #1f2937;
    padding: 0.4rem 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-gray);
}

.header-search input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-white);
    font-size: 0.8rem;
    outline: none;
}

.badgeq {
    font-size: 0.7rem;
    background: #1f2937;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

/* Gamemode Selector */
.gamemode-selector {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.8rem;
    margin-bottom: 2rem;
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 16px;
    border: 1px solid #1f2937;
    justify-content: flex-start;
}

/* Updated Button Styles for Icons */
.gm-btn {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 0.6rem 0.3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    cursor: pointer;
    color: var(--text-gray);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 65px;
    position: relative;
    overflow: hidden;
    flex: 1;
}

.gm-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-white);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.gm-btn.active {
    background: transparent;
    border: 1px solid transparent;
    border-bottom: 2px solid var(--accent-blue);
    border-radius: 0;
    color: var(--text-white);
    box-shadow: none;
    transform: none;
}

.gm-btn.active .gm-icon {
    background: transparent;
    border-radius: 0;
    width: auto;
    height: auto;
}

/* Specific Gamemode Colors (Icon Glow) */
.gm-btn[data-mode="overall"].active .gm-icon {
    color: #eab308;
    filter: drop-shadow(0 0 8px rgba(234, 179, 8, 0.6));
    background: transparent;
    box-shadow: none;
}

.gm-btn[data-mode="crystal"].active .gm-icon {
    color: #d946ef;
    filter: drop-shadow(0 0 8px rgba(217, 70, 239, 0.6));
    background: transparent;
    box-shadow: none;
}

.gm-btn[data-mode="sword"].active .gm-icon {
    color: #3b82f6;
    filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.6));
    background: transparent;
    box-shadow: none;
}

.gm-btn[data-mode="smp"].active .gm-icon {
    color: #10b981;
    filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.6));
    background: transparent;
    box-shadow: none;
}

.gm-btn[data-mode="mace"].active .gm-icon {
    color: #a855f7;
    filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.6));
    background: transparent;
    box-shadow: none;
}

.gm-btn[data-mode="nethpot"].active .gm-icon {
    color: #db2777;
    filter: drop-shadow(0 0 8px rgba(219, 39, 119, 0.6));
    background: transparent;
    box-shadow: none;
}

.gm-btn[data-mode="axe"].active .gm-icon {
    color: #f97316;
    filter: drop-shadow(0 0 8px rgba(249, 115, 22, 0.6));
    background: transparent;
    box-shadow: none;
}

.gm-btn[data-mode="uhc"].active .gm-icon {
    color: #ef4444;
    filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.6));
    background: transparent;
    box-shadow: none;
}

.gm-icon {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-gray);
    font-size: 1.4rem;
    transition: all 0.3s;
}

.kit-svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    stroke: currentColor;
    transition: all 0.3s;
}

.perf-icon .kit-svg {
    width: 20px;
    height: 20px;
}

.gm-btn:hover .gm-icon {
    color: var(--text-white);
}

.gm-info {
    font-weight: 700;
    font-size: 0.65rem;
    letter-spacing: 0.05em;
    font-style: normal;
    text-transform: uppercase;
    opacity: 0.8;
}

/* Leaderboard */
.ranking-labels {
    display: grid;
    grid-template-columns: 200px 1fr 120px 70px;
    padding: 0;
    margin-bottom: 1.2rem;
    color: var(--text-gray);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    align-items: center;
}

.lbl-rank {
    padding-left: 1.2rem;
}

.lbl-score,
.lbl-info {
    text-align: center;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.lb-row {
    display: grid;
    grid-template-columns: 200px 1fr 120px 70px;
    align-items: center;
    background: var(--card-bg);
    padding: 0;
    border-radius: 10px;
    transition: transform 0.2s, border-color 0.2s;
    border: 1px solid #1f2937;
    cursor: pointer;
    overflow: hidden;
    height: 80px;
}

.lb-row:hover {
    transform: translateX(4px);
    background: var(--card-hover);
    border-color: #4b5563;
}

/* Rank Plate (Combined Rank + Avatar) */
.lb-plate {
    background: linear-gradient(145deg, #374151, #1f2937);
    color: #9ca3af;
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 1.2rem;
    gap: 15px;
    clip-path: polygon(0 0, 100% 0, 85% 100%, 0% 100%);
    z-index: 2;
    overflow: hidden;
}

.rank-num {
    font-size: 2rem;
    font-weight: 900;
    font-style: italic;
    color: inherit;
    z-index: 3;
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.25);
}

.plate-avatar {
    height: 115%;
    width: auto;
    position: absolute;
    right: 25px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.4));
    box-shadow: none;
    border-radius: 0;
}

/* Shine Effect for Plate */
.lb-plate::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100px;
    width: 30px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9), transparent);
    transform: skewX(-25deg);
    animation: shine-plate 4s infinite;
}

@keyframes shine-plate {
    0% {
        left: -50px;
        opacity: 0;
    }

    5% {
        opacity: 0.8;
    }

    50% {
        left: 200%;
        opacity: 0.8;
    }

    51% {
        opacity: 0;
    }

    100% {
        opacity: 0;
    }
}

/* Rank Colors - Richer Gradients */
.rank-1 .lb-plate {
    background: linear-gradient(135deg, #ffc107, #ffdb4d);
    color: #fff;
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.2);
}

.rank-1 .rank-num {
    text-shadow: 2px 2px 0 #b38800;
}

.rank-2 .lb-plate {
    background: linear-gradient(135deg, #bdc3c7, #ecf0f1);
    color: #fff;
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.2);
}

.rank-2 .rank-num {
    text-shadow: 2px 2px 0 #7f8c8d;
}

.rank-3 .lb-plate {
    background: linear-gradient(135deg, #d35400, #e67e22);
    color: #fff;
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.2);
}

.rank-3 .rank-num {
    text-shadow: 2px 2px 0 #873600;
}



/* Player Name Style */
/* Player Name Style - Enhanced Middle Section */
.lb-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-left: 1.5rem;
    position: relative;
    /* Clean vertical divider */
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    /* No background, just the line */
    background: transparent;
    overflow: hidden;
}

/* Restored Dramatic Curly Vine Line Overlay - Enhanced */
.lb-info::before {
    display: block;
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 100%;
    transform: translateY(-50%);
    /* Elegant Curly Line with Organic Leaves - Flowing Left to Right */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 60' preserveAspectRatio='none' fill='none'%3E%3Cpath d='M0,30 C60,5, 140,55, 220,15 C280,-15, 340,45, 400,30' stroke='rgba(255,255,255,0.08)' stroke-width='1.5' vector-effect='non-scaling-stroke' stroke-linecap='round'/%3E%3Cpath d='M80,18 Q90,5, 100,18 Z' fill='rgba(255,255,255,0.06)'/%3E%3Cpath d='M180,35 Q190,50, 200,35 Z' fill='rgba(255,255,255,0.06)'/%3E%3Cpath d='M280,10 Q290,-5, 300,10 Z' fill='rgba(255,255,255,0.06)'/%3E%3Cpath d='M30,30 Q40,45, 50,30 Z' fill='rgba(255,255,255,0.06)'/%3E%3Cpath d='M350,25 Q360,40, 370,25 Z' fill='rgba(255,255,255,0.06)'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: 100% 100%;
    pointer-events: none;
    z-index: 0;
}

.lb-info .username {
    font-weight: 800;
    font-size: 1.15rem;
    /* Slightly larger */
    color: #fff;
    letter-spacing: 0.02em;
    position: relative;
    padding-bottom: 4px;
    margin-bottom: 2px;
    z-index: 1;
    /* Above pattern */
    width: fit-content;
}

/* Cool Underline Accent */
.lb-info .username::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    /* Full width of name or fixed? gradient handles fade */
    height: 2px;
    background: linear-gradient(90deg, var(--accent-blue), transparent);
    border-radius: 2px;
    opacity: 0.7;
}

.region-tag {
    position: relative;
    z-index: 1;
    /* keep existing styles but ensure z-index */
    font-size: 0.65rem;
    background: rgba(255, 255, 255, 0.1);
    color: #d1d5db;
    padding: 2px 8px;
    /* Slightly wider */
    border-radius: 4px;
    margin-top: 4px;
    font-weight: 700;
    text-transform: uppercase;
    width: fit-content;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}



.region-tag {
    font-size: 0.65rem;
    background: rgba(255, 255, 255, 0.1);
    color: #d1d5db;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 4px;
    font-weight: 700;
    text-transform: uppercase;
    width: fit-content;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.lb-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}


.score-val {
    font-weight: 800;
    font-size: 1.4rem;
    color: #fff;
}

.score-lbl {
    font-size: 0.7rem;
    color: var(--text-gray);
    margin-top: 2px;
    text-transform: uppercase;
    font-weight: 600;
}

.lb-action {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-right: 1rem;
}

.btn-icon {
    background: #1f2937;
    border: none;
    color: var(--text-gray);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: #fbbf24;
    color: #111827;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.5);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    /* Hidden by default */
    align-items: center;
    justify-content: center;
    will-change: opacity;
    /* Optimization */
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    /* Dark blur */
    backdrop-filter: blur(5px);
}

.modal-content {
    background: #0f141f;
    width: 900px;
    max-width: 95%;
    height: 600px;
    will-change: transform, opacity;
    border-radius: 16px;
    position: relative;
    border: 1px solid #1f2937;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    display: flex;
    overflow: hidden;
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    font-size: 0.9rem;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.2);
}

.profile-grid {
    display: flex;
    width: 100%;
    height: 100%;
}

.profile-left {
    width: 40%;
    background: radial-gradient(circle at center, #1a2336 0%, #0f141f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-right: 1px solid #1f2937;
}

.skin-viewer img {
    height: 400px;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.5));
    will-change: transform;
    transform: translateZ(0);
}

.profile-right {
    width: 60%;
    padding: 3rem;
    overflow-y: auto;
}

.profile-header {
    margin-bottom: 2rem;
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

.profile-header h1 {
    font-size: 2.5rem;
    font-style: italic;
    font-weight: 900;
}

.region-tag {
    background: #1f2937;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-gray);
}

.stats-overview {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-box {
    background: #141b2d;
    border: 1px solid #1f2937;
    border-radius: 12px;
    padding: 1.5rem;
    flex: 1;
    position: relative;
    overflow: hidden;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--accent-blue);
    font-weight: 700;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    font-style: italic;
    line-height: 1;
}

.bg-icon {
    position: absolute;
    right: -10px;
    bottom: -10px;
    font-size: 5rem;
    opacity: 0.05;
    transform: rotate(-15deg);
}

.performance-section h3 {
    font-size: 0.8rem;
    color: var(--text-gray);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.performance-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.perf-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #141b2d;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #1f2937;
}

.perf-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.perf-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-blue);
    /* Gold bg */
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #0f141f;
    /* Dark icon */
}

.perf-name {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.p-name {
    font-weight: 700;
    font-size: 1rem;
}

.p-tier {
    font-size: 0.7rem;
    background: #1f2937;
    color: var(--text-gray);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    display: inline-block;
    margin-top: 2px;
}

.perf-score {
    text-align: right;
    position: relative;
}

.p-val {
    font-size: 1.2rem;
    font-weight: 800;
    display: block;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    user-select: none;
}

.p-val:hover {
    color: var(--accent-blue);
    transform: scale(1.08);
    text-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}

/* Custom Premium Tooltip for Tier Points */
.p-val::before {
    content: attr(data-tier-full);
    position: absolute;
    bottom: calc(100% + 16px);
    right: 0;
    background: linear-gradient(135deg, #1a2332 0%, #0f1419 100%);
    color: #ffffff;
    padding: 0.75rem 1.2rem;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(0.95);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    z-index: 1000;
    border: 1.5px solid rgba(59, 130, 246, 0.4);
    box-shadow:
        0 12px 24px rgba(0, 0, 0, 0.6),
        0 0 20px rgba(59, 130, 246, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-family: 'Inter', sans-serif;
}

/* Tooltip Arrow with Enhanced Style */
.p-val::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 8px);
    right: 24px;
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 9px solid #1a2332;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(0.95);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    z-index: 1000;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}

/* Hover Animation - Smooth Bounce */
.p-val:hover::before,
.p-val:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Add subtle glow effect on tooltip */
.p-val:hover::before {
    animation: tooltipGlow 2s ease-in-out infinite;
}

@keyframes tooltipGlow {

    0%,
    100% {
        box-shadow:
            0 12px 24px rgba(0, 0, 0, 0.6),
            0 0 20px rgba(59, 130, 246, 0.15),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }

    50% {
        box-shadow:
            0 12px 24px rgba(0, 0, 0, 0.6),
            0 0 30px rgba(59, 130, 246, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.15);
    }
}

.p-lbl {
    font-size: 0.6rem;
    color: var(--text-gray);
}

@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        position: relative;
        left: auto;
        transform: none;
        width: 100%;
        justify-content: center;
        overflow-x: auto;
    }

    .modal-content {
        flex-direction: column;
        height: auto;
        max-height: 90vh;
        overflow-y: auto;
    }

    .profile-left {
        width: 100%;
        height: 200px;
    }

    .skin-viewer img {
        height: 180px;
    }

    .profile-right {
        width: 100%;
        padding: 1.5rem;
    }
}