/* Shared Leaderboard glass segmented switch. */
.leaderboard-gender-toggle, .pill-switch {
    position: relative;
    isolation: isolate;
    display: inline-flex;
    width: min(100%, 280px);
    margin-top: 20px;
    padding: 4px;

    border-radius: 999px;
    background: rgba(255, 255, 255, .22);
    border: 1px solid rgba(255, 255, 255, .36);

    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55);
}

.leaderboard-gender-option, .pill-switch-option {
    -webkit-tap-highlight-color: transparent;
    flex: 1 1 0;
    min-width: 0;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 10px 18px;
    border-radius: 999px;

    font-size: 14px;
    font-weight: 850;
    text-decoration: none;
    color: rgba(20, 20, 20, .78);

    transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}

.leaderboard-gender-option:hover, .pill-switch-option:hover {
    background: rgba(255, 255, 255, .34);
}

.leaderboard-gender-option:focus-visible, .pill-switch-option:focus-visible {
    outline: 2px solid rgba(20, 20, 20, .72);
    outline-offset: 2px;
}

/* One shared glass surface follows the existing selection state. */
:is(.page-leaderboard .leaderboard-gender-toggle, .pill-switch)::before {
    content: "";
    position: absolute;
    z-index: -1;
    pointer-events: none;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc(50% - 4px);
    box-sizing: border-box;
    border-radius: inherit;
    background: rgba(225, 240, 252, .66);
    border: 1px solid rgba(255, 255, 255, .78);
    box-shadow: 0 3px 10px rgba(44, 73, 98, .12), inset 0 1px 0 rgba(255, 255, 255, .6);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    transform: translateX(0);
    transition: transform 200ms ease-out;
}

:is(.page-leaderboard #leaderboard-card[data-gender="women"] .leaderboard-gender-toggle, .pill-switch[data-selected-index="1"])::before {
    transform: translateX(100%);
}

:is(.page-leaderboard .leaderboard-gender-option, .pill-switch-option) {
    color: rgba(35, 51, 67, .64);
    transition: color 200ms ease-out;
}

:is(.page-leaderboard .leaderboard-gender-option, .pill-switch-option),
:is(.page-leaderboard .leaderboard-gender-option, .pill-switch-option):hover {
    background: transparent;
    box-shadow: none;
}

:is(.page-leaderboard .leaderboard-gender-option, .pill-switch-option).is-active,
:is(.page-leaderboard .leaderboard-gender-option, .pill-switch-option)[aria-current="page"] {
    color: #233e56;
}

/* Compact timeframe variant: full tap targets around a circular highlight. */
.pill-switch.pill-switch--circle {
    width: fit-content;
    max-width: 100%;
    margin: 0;
    gap: 0;
}

.pill-switch.pill-switch--circle .pill-switch-option {
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.pill-switch.pill-switch--circle::before {
    top: 6px;
    bottom: auto;
    left: 6px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transform: translateX(calc(var(--pill-circle-index, 0) * 44px));
}

@media (prefers-reduced-motion: reduce) {
    :is(.page-leaderboard .leaderboard-gender-toggle, .pill-switch)::before,
    :is(.page-leaderboard .leaderboard-gender-option, .pill-switch-option) {
        transition: none;
    }
}

