.stats-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.stats-shell {
    flex: 1 0 auto;
    width: min(1280px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 56px;
}

.stats-page .site-footer {
    margin-top: auto;
}

.stats-back-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid rgba(116, 222, 255, 0.24);
    background: rgba(11, 18, 36, 0.72);
    color: var(--text-primary);
    text-decoration: none;
    box-shadow: 0 12px 28px rgba(3, 8, 22, 0.25);
    backdrop-filter: blur(12px);
    transition: var(--transition);
}

.stats-back-link:hover,
.stats-back-link:focus-visible {
    border-color: rgba(116, 222, 255, 0.52);
    transform: translateY(-1px);
    box-shadow: 0 16px 32px rgba(3, 8, 22, 0.34), 0 0 24px rgba(0, 212, 255, 0.14);
    outline: none;
}

.stats-hero,
.stats-panel,
.stats-error,
.stats-loading {
    position: relative;
    overflow: hidden;
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(145deg, rgba(16, 22, 45, 0.92), rgba(26, 15, 52, 0.88));
    box-shadow: 0 22px 60px rgba(4, 8, 24, 0.34), 0 0 28px rgba(0, 212, 255, 0.08);
    backdrop-filter: blur(18px);
}

.stats-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 24px;
    margin-top: 20px;
    padding: 34px 36px;
}

.stats-hero::before,
.stats-panel::before,
.stats-error::before,
.stats-loading::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top left, rgba(0, 212, 255, 0.18), transparent 38%),
        radial-gradient(circle at bottom right, rgba(190, 149, 255, 0.18), transparent 42%);
    pointer-events: none;
}

.stats-hero__copy,
.stats-panel>*,
.stats-error>*,
.stats-loading>* {
    position: relative;
    z-index: 1;
}

.stats-eyebrow {
    margin-bottom: 10px;
    color: #9ce8ff;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.78rem;
    font-weight: 700;
}

.stats-hero h1 {
    margin: 0;
    font-family: "Carter One", display;
    font-size: clamp(2rem, 4vw, 3.8rem);
    line-height: 1.05;
    text-shadow: 0 0 28px rgba(0, 212, 255, 0.22);
}

.stats-hero__text {
    max-width: 680px;
    margin-top: 14px;
    color: var(--text-secondary);
    font-size: 1rem;
}

.stats-hero__badge {
    width: 92px;
    height: 92px;
    display: grid;
    place-items: center;
    border-radius: 26px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.16), rgba(255, 108, 66, 0.16));
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #9ce8ff;
    font-size: 2rem;
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.16);
}

.stats-section {
    margin-top: 26px;
}

.stats-section__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 16px;
}

.stats-section__header h2 {
    font-family: "Space Grotesk", sans-serif;
    font-size: 1.35rem;
}

.stats-section__header h3 {
    font-family: "Space Grotesk", sans-serif;
    font-size: 1.05rem;
}

.stats-section__header--subsection {
    margin: 22px 0 12px;
}

.stats-section__hint {
    color: rgba(255, 255, 255, 0.66);
    font-size: 0.9rem;
}

.stats-overview-grid,
.stats-breakdown-grid,
.leaderboard-grid,
.stats-highlights {
    display: grid;
    gap: 16px;
}

.stats-overview-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stats-card,
.stats-breakdown-card,
.leaderboard-card,
.stats-highlight-card {
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(9, 14, 31, 0.62);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.stats-card {
    padding: 18px 18px 16px;
}

.stats-card__label {
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.stats-card__value {
    margin-top: 8px;
    font-family: "Space Grotesk", sans-serif;
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    font-weight: 700;
    line-height: 1;
}

.stats-card__meta {
    margin-top: 8px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.92rem;
}

.stats-layout-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
    gap: 20px;
    margin-top: 20px;
}

.stats-panel {
    padding: 24px;
}

.stats-bars {
    display: grid;
    gap: 12px;
}

.stats-subsection {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.stats-bar {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
}

.stats-bar__label,
.stats-bar__value {
    font-family: "Space Grotesk", sans-serif;
    font-weight: 700;
}

.stats-bar__track {
    position: relative;
    height: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
}

.stats-bar__fill {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #00d4ff, #be95ff, #ff8e53);
    box-shadow: 0 0 18px rgba(0, 212, 255, 0.22);
}

.stats-breakdown-grid,
.leaderboard-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.stats-breakdown-card,
.leaderboard-card,
.stats-highlight-card {
    padding: 18px;
}

.stats-breakdown-card h3,
.leaderboard-card h3,
.stats-highlight-card h3 {
    margin-bottom: 14px;
    font-family: "Space Grotesk", sans-serif;
    font-size: 1rem;
}

.stats-breakdown-list,
.leaderboard-list,
.stats-highlight-list {
    display: grid;
    gap: 10px;
}

.stats-breakdown-item,
.leaderboard-item,
.stats-highlight-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.035);
}

.stats-breakdown-item strong,
.leaderboard-item strong,
.stats-highlight-item strong {
    font-family: "Space Grotesk", sans-serif;
}

.leaderboard-item__rank {
    width: 26px;
    height: 26px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(0, 212, 255, 0.14);
    color: #9ce8ff;
    font-size: 0.84rem;
    font-weight: 700;
    flex-shrink: 0;
}

.leaderboard-item--top-1,
.leaderboard-item--top-2,
.leaderboard-item--top-3 {
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.leaderboard-item--top-1 {
    background: linear-gradient(90deg, rgba(255, 196, 0, 0.14), rgba(255, 255, 255, 0.035));
}

.leaderboard-item--top-2 {
    background: linear-gradient(90deg, rgba(166, 197, 214, 0.14), rgba(255, 255, 255, 0.035));
}

.leaderboard-item--top-3 {
    background: linear-gradient(90deg, rgba(255, 142, 83, 0.14), rgba(255, 255, 255, 0.035));
}

.leaderboard-item__rank--1 {
    background: rgba(255, 196, 0, 0.2);
    color: #ffe58c;
    box-shadow: 0 0 16px rgba(255, 196, 0, 0.18);
}

.leaderboard-item__rank--2 {
    background: rgba(166, 197, 214, 0.18);
    color: #d8eef8;
    box-shadow: 0 0 16px rgba(166, 197, 214, 0.14);
}

.leaderboard-item__rank--3 {
    background: rgba(255, 142, 83, 0.2);
    color: #ffd4bd;
    box-shadow: 0 0 16px rgba(255, 142, 83, 0.16);
}

.leaderboard-item__name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leaderboard-item__value,
.stats-breakdown-item__value,
.stats-highlight-item__value {
    color: #dffcff;
}

.stats-error,
.stats-loading {
    margin-top: 24px;
    padding: 24px;
}

.stats-error {
    color: #ffd4d4;
    border-color: rgba(255, 108, 66, 0.3);
}

.stats-loading {
    display: grid;
    place-items: center;
    gap: 14px;
    min-height: 220px;
    text-align: center;
}

.stats-loading__spinner {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.12);
    border-top-color: #00d4ff;
    animation: statsSpin 0.9s linear infinite;
}

.stats-empty {
    color: rgba(255, 255, 255, 0.6);
}

@keyframes statsSpin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 900px) {
    .stats-shell {
        width: min(100% - 24px, 1280px);
        padding-top: 22px;
    }

    .stats-hero {
        grid-template-columns: 1fr;
        padding: 24px;
    }

    .stats-hero__badge {
        width: 76px;
        height: 76px;
        border-radius: 22px;
    }

    .stats-layout-grid {
        grid-template-columns: 1fr;
    }

    .stats-section__header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 640px) {
    .stats-bar {
        grid-template-columns: 36px minmax(0, 1fr);
    }

    .stats-bar__value {
        grid-column: 2;
        justify-self: end;
    }

    .stats-breakdown-grid,
    .leaderboard-grid,
    .stats-overview-grid {
        grid-template-columns: 1fr;
    }

    .stats-panel {
        padding: 18px;
    }
}
