:is(.dedicated-locations, .segmented-panels) {
    min-inline-size: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

:is(.dedicated-locations__switch, .segmented-panels__switch) {
    --switch-inset: 4px;

    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    box-sizing: border-box;
    width: min(100%, 28rem);
    margin-inline: auto;
    padding: var(--switch-inset);
    border: 1px solid var(--border-dark);
    border-radius: 99px;
    background: var(--surface-section-deep);
}

:is(.dedicated-locations__switch, .segmented-panels__switch)::before {
    position: absolute;
    inset: var(--switch-inset) auto var(--switch-inset) var(--switch-inset);
    width: calc(50% - var(--switch-inset));
    box-sizing: border-box;
    border: 1px solid #78a68e;
    border-radius: inherit;
    background:
        radial-gradient(ellipse at 50% 100%, #3c6653 0%, transparent 73%),
        var(--surface-button-secondary);
    box-shadow: 0 0 18px #75d6a62b;
    content: "";
    pointer-events: none;
}

.dedicated-locations__switch:has(#location-ua:checked)::before,
.segmented-panels__switch:has(input:last-of-type:checked)::before {
    transform: translateX(100%);
}

:is(.dedicated-locations__sr-only, .segmented-panels__sr-only) {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    margin: 0;
    overflow: hidden;
    clip-path: inset(50%);
}

:is(.dedicated-locations, .segmented-panels) label {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(6px, 1.2vw, 12px);
    min-block-size: 48px;
    padding-inline: 6px;
    border-radius: 99px;
    color: var(--text-on-dark-muted);
    font-size: clamp(0.875rem, 1.2vw, 1rem);
    font-weight: var(--type-control-weight);
    cursor: pointer;
}

:is(.dedicated-locations, .segmented-panels) input:checked + label {
    color: var(--text-on-dark);
}

@media (hover: hover) {
    :is(.dedicated-locations, .segmented-panels) label:hover {
        color: var(--text-on-dark);
    }

    :is(.dedicated-locations, .segmented-panels) input:not(:checked) + label:hover {
        background: color-mix(in srgb, var(--surface-button-secondary) 52%, transparent);
    }
}

:is(.dedicated-locations, .segmented-panels) input:focus-visible + label {
    outline: var(--focus-width) solid var(--color-focus);
    outline-offset: 2px;
}

:is(.dedicated-locations__stage, .segmented-panels__stage) {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    margin-block-start: var(--space-5);
    overflow: clip;
    overflow-clip-margin: 4px;
    touch-action: pan-y pinch-zoom;
}

:is(.dedicated-locations__panel, .segmented-panels__panel) {
    grid-area: 1 / 1;
    min-inline-size: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.dedicated-locations:has(#location-nl:checked) #servers-nl,
.dedicated-locations:has(#location-ua:checked) #servers-ua,
.segmented-panels:has(.segmented-panels__switch input:first-of-type:checked) .segmented-panels__panel:first-child,
.segmented-panels:has(.segmented-panels__switch input:last-of-type:checked) .segmented-panels__panel:last-child {
    z-index: 1;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    transition-delay: 0s;
}

@media (prefers-reduced-motion: no-preference) {
    :is(.dedicated-locations__switch, .segmented-panels__switch)::before {
        transition: transform 380ms cubic-bezier(.22, .75, .24, 1);
    }

    :is(.dedicated-locations, .segmented-panels)[data-motion-ready] :is(.dedicated-locations__panel, .segmented-panels__panel) {
        transform: translateX(var(--catalog-offset));
        transition:
            opacity 260ms cubic-bezier(.24, .62, .38, 1),
            transform 380ms cubic-bezier(.22, .75, .24, 1),
            visibility 0s linear 380ms;
    }

    #servers-nl,
    .segmented-panels__panel:first-child {
        --catalog-offset: clamp(-40px, -3vw, -20px);
    }

    #servers-ua,
    .segmented-panels__panel:last-child {
        --catalog-offset: clamp(20px, 3vw, 40px);
    }

    .dedicated-locations[data-motion-ready]:has(#location-nl:checked) #servers-nl,
    .dedicated-locations[data-motion-ready]:has(#location-ua:checked) #servers-ua,
    .segmented-panels[data-motion-ready]:has(.segmented-panels__switch input:first-of-type:checked) .segmented-panels__panel:first-child,
    .segmented-panels[data-motion-ready]:has(.segmented-panels__switch input:last-of-type:checked) .segmented-panels__panel:last-child {
        transition-delay: 65ms, 0s, 0s;
    }
}
