.stats-layout {
    max-width: 1400px;
    width: 92%;
    position: relative;
    z-index: 10;
    display: grid;
    grid-template-columns: minmax(560px, 1fr) minmax(320px, 420px);
    gap: 24px;
    align-items: start;
}

.stats-panel,
.leaderboard-panel {
    background: rgba(15, 20, 40, 0.85);
    backdrop-filter: blur(10px);
    padding: 32px;
    border-radius: 16px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        inset 0 0 0 1px rgba(0, 255, 157, 0.1);
}

.stats-title {
    margin: 20px 0 0;
    font-size: 46px;
    text-align: left;
}

.stats-panel h3 {
    color: rgba(255, 255, 255, 0.72);
}

.inner-section {
    margin-top: 12px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.stat-card {
    background: rgba(0, 20, 40, 0.6);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(0, 255, 157, 0.3);
    text-align: center;
    transition: all 0.25s ease;
}

.stat-card:hover {
    background: rgba(0, 255, 157, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 255, 157, 0.2);
}

.stat-number {
    font-size: 38px;
    font-weight: 700;
    color: #00ff9d;
    margin: 10px 0;
    line-height: 1.1;
}

.stat-label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cache-note {
    margin-top: 24px;
    padding: 12px;
    background: rgba(0, 200, 255, 0.1);
    border: 1px solid rgba(0, 200, 255, 0.3);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 13px;
    text-align: center;
}

.leaderboard-panel h2 {
    margin: 0 0 16px;
    color: #00ff9d;
    font-size: 20px;
    background: linear-gradient(135deg, #00ff9d, #00c8ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.leaderboard-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 16px;
    padding: 4px;
    border-radius: 12px;
    background: rgba(0, 20, 40, 0.5);
    border: 1px solid rgba(0, 255, 157, 0.14);
}

.leaderboard-tab {
    min-width: 0;
    border: 1px solid transparent;
    background: transparent;
    color: rgba(255, 255, 255, 0.86);
    border-radius: 8px;
    padding: 9px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
    font-weight: 600;
    white-space: normal;
    line-height: 1.2;
    word-break: break-word;
}

.leaderboard-tab:hover {
    border-color: rgba(0, 255, 157, 0.45);
    background: rgba(0, 255, 157, 0.06);
    color: #ffffff;
}

.leaderboard-tab.is-active {
    border-color: rgba(0, 255, 157, 0.55);
    background: rgba(0, 255, 157, 0.14);
    color: #00ff9d;
}

.leaderboard-content {
    background: rgba(0, 20, 40, 0.45);
    border: 1px solid rgba(0, 255, 157, 0.2);
    border-radius: 12px;
    padding: 12px;
    min-height: 260px;
    color: rgba(255, 255, 255, 0.88);
}

.leaderboard-note {
    color: rgba(255, 255, 255, 0.76);
    font-size: 12px;
    margin-bottom: 12px;
    line-height: 1.5;
}

.leaderboard-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    counter-reset: leaderboard-rank;
}

.leaderboard-item {
    counter-increment: leaderboard-rank;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(0, 255, 157, 0.12);
}

.leaderboard-item::before {
    content: counter(leaderboard-rank) ".";
    color: rgba(255, 255, 255, 0.65);
    font-size: 13px;
    font-weight: 700;
    min-width: 20px;
    text-align: right;
}

.leaderboard-user {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.leaderboard-name {
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leaderboard-secondary {
    color: rgba(255, 255, 255, 0.68);
    font-size: 12px;
}

.leaderboard-metric {
    color: #00ff9d;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.leaderboard-empty {
    color: rgba(255, 255, 255, 0.76);
    font-size: 14px;
    line-height: 1.5;
    margin-top: 8px;
    padding: 8px 4px;
}

@media (max-width: 1200px) {
    .stats-layout {
        grid-template-columns: 1fr;
        max-width: 760px;
    }

    .stats-title {
        font-size: 38px;
    }

    .leaderboard-content {
        min-height: 280px;
    }
}

@media (max-width: 700px) {
    .stats-layout {
        width: 94%;
        gap: 16px;
    }

    .stats-panel,
    .leaderboard-panel {
        padding: 22px;
    }

    .stat-number {
        font-size: 30px;
    }

    .leaderboard-tabs {
        grid-template-columns: 1fr;
    }

    .leaderboard-tab {
        min-height: 36px;
    }
}
