.leaderboard {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    padding: 3.5rem 1.5rem 5rem;
    font-family: "Segoe UI", Roboto, sans-serif;
}

.leaderboard-title {
    margin: 0;
    font-size: clamp(2.5rem, 6vw, 4rem);
    text-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.leaderboard-subtitle {
    font-size: 1.45rem;
    font-weight: 700;
    margin-top: 2.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.45rem;
    color: #e8fdf4;
    text-shadow: 0 0 18px rgba(0, 255, 174, 0.12);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(0, 255, 174, 0.22);
    display: inline-block;
    width: min(100%, 26rem);
    position: relative;
}

.leaderboard-subtitle::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 7rem;
    height: 2px;
    background: linear-gradient(90deg, #00ffae, transparent);
    border-radius: 999px;
}

.leaderboard-subtitle::before {
    content: "";
    position: absolute;
    right: 0;
    bottom: -1px;
    width: 7rem;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00ffae);
    border-radius: 999px;
}

.leaderboard ul {
    width: min(100%, 70rem);
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 3rem;
    margin: 1rem auto 0;
    padding: 0;
    list-style-type: none;
}

.leaderboard .leaderboard-base {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    min-height: 350px;
    background: linear-gradient(145deg, var(--geo-surface), rgba(27, 43, 46, 0.88));
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
    border: 1px solid var(--geo-border);

    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease,
        border-color 0.25s;
}

.leaderboard .leaderboard-base:hover {
    transform: scale(1.015);
    box-shadow:
        0 14px 34px rgba(0, 0, 0, 0.35),
        0 0 22px rgba(0, 255, 174, 0.2);
    border-color: rgba(0, 255, 174, 0.55);
}

.leaderboard h3 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    color: #00ffae;
    letter-spacing: 1px;
}

.section-title {
    font-size: 1.9rem;
    margin-top: 4rem;
    margin-bottom: 1.5rem;
    color: #e9fffa;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.leaderboard .line {
    width: 100%;
    height: 2px;
    margin: 0.8rem 0;
    border-radius: 10px;
    background-color: #346354;
}

.leaderboard .list-container {
    height: 250px;
    margin-top: 1rem;
    padding: 0.5rem;
    border-radius: 12px;
    background-color: var(--geo-surface-strong);
    border: 1px solid rgba(255, 255, 255, 0.06);
    overflow-x: hidden;
    overflow-y: auto;
}

.leaderboard ol {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0;
    margin: 0;
    list-style-type: none;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: default;
    width: 100%;
    min-width: 0;
    min-height: 2.3rem;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.05);
    transition:
        background-color 0.2s,
        transform 0.2s;
    gap: 0.5rem;
}

.leaderboard-item:hover {
    background-color: rgba(0, 255, 174, 0.15);
    transform: translateX(2px);
}

.leaderboard-empty {
    min-height: 12rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 1.5rem;
    color: #d7e8e4;
    line-height: 1.4;
}

.leaderboard-empty-illustration {
    display: block;
    width: 8rem;
    height: 6rem;
    object-fit: contain;
    margin-bottom: 0.2rem;
}

.leaderboard-empty small {
    color: var(--geo-muted-green);
    font-size: 0.78rem;
}

.empty-icon {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    margin-bottom: 0.25rem;
    border: 1px solid rgba(0, 230, 160, 0.35);
    border-radius: 50%;
    color: var(--geo-accent);
    font-weight: 700;
}

.leaderboard-skeleton {
    pointer-events: none;
    background-color: rgba(255, 255, 255, 0.035);
}

.leaderboard-skeleton .shimmer {
    display: block;
    height: 0.8rem;
    border-radius: 999px;
}

.skeleton-rank {
    width: 1.25rem;
}

.skeleton-name {
    flex: 1;
    max-width: 8rem;
}

.skeleton-score {
    width: 3rem;
}

@media (max-width: 720px) {
    .leaderboard {
        padding-inline: 1rem;
    }

    .leaderboard ul {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .leaderboard .leaderboard-base {
        min-height: 0;
    }
}

.leaderboard-section,
.leaderboard-region {
    width: min(100%, 70rem);
    min-width: 0;
}

.leaderboard-section > div,
.leaderboard-region > ul {
    width: 100%;
}

@media (prefers-reduced-motion: reduce) {
    .leaderboard .leaderboard-base,
    .leaderboard-item {
        transition: none;
    }

    .shimmer::after {
        animation: none;
    }
}

.leaderboard-item .username {
    flex: 1;
    text-align: left;
    font-weight: 500;
    color: #f9f9f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 0.5rem;
}

.leaderboard-item .rank {
    font-weight: bold;
    color: #00ffae;
    width: 30px;
    text-align: left;
    position: relative;
}

.leaderboard-item .score {
    min-width: 60px;
    text-align: right;
    font-weight: bold;
    color: #ffd369;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-variant-numeric: tabular-nums;
}

.leaderboard-item:nth-child(1) .rank {
    color: #ffd700;
    font-size: 1.4rem;
    visibility: hidden;

    transition: background-color 0.2s;
}

.leaderboard-item:nth-child(1):hover {
    background-color: rgba(255, 211, 105, 0.15);
}

.leaderboard-item:nth-child(1) .rank::before {
    content: "";
    visibility: visible;
    position: absolute;
    left: 0;
    top: 50%;
    width: 1.6rem;
    height: 1.6rem;
    transform: translateY(-50%);
    background: url("/resources/images/leaderboard/crown.svg") center / contain no-repeat;
}

.leaderboard-item:nth-child(2) .rank {
    visibility: hidden;
    color: #c0c0c0;
    font-size: 1.3rem;

    transition: background-color 0.2s;
}

.leaderboard-item:nth-child(2):hover {
    background-color: rgba(192, 192, 192, 0.15);
}

.leaderboard-item:nth-child(2) .rank::before {
    content: "";
    visibility: visible;
    position: absolute;
    left: 0;
    top: 50%;
    width: 1.55rem;
    height: 1.55rem;
    transform: translateY(-50%);
    background: url("/resources/images/leaderboard/silver-medal.svg") center / contain no-repeat;
}

.leaderboard-item:nth-child(3) .rank {
    visibility: hidden;
    color: #cd7f32;
    font-size: 1.3rem;

    transition: background-color 0.2s;
}

.leaderboard-item:nth-child(3):hover {
    background-color: rgba(205, 127, 50, 0.15);
}

.leaderboard-item:nth-child(3) .rank::before {
    content: "";
    visibility: visible;
    position: absolute;
    left: 0;
    top: 50%;
    width: 1.55rem;
    height: 1.55rem;
    transform: translateY(-50%);
    background: url("/resources/images/leaderboard/bronze-medal.svg") center / contain no-repeat;
}

.leaderboard-item a.player-link,
.leaderboard-item a.player-link:visited {
    color: inherit;
    text-decoration: none;
}

.leaderboard-item a.player-link:hover,
.leaderboard-item a.player-link:focus-visible {
    color: #a8ffdf;
    text-decoration: underline;
}
