:root {
    --h: 20px;
    --speed: .3s
}

.toggle-hold {
    display: flex;
    position: relative;
    width: calc(var(--h) * 2);
    height: var(--h);
    overflow: hidden;
    border-radius: var(--h);
    outline: 4px solid #9991;
    animation: glow 4s infinite linear;
}

@keyframes glow {
    0% {
        outline: 4px solid #9991
    }

    25% {
        outline: 4.5px solid #9991
    }

    50% {
        outline: 5px solid #9992
    }

    75% {
        outline: 4.5px solid #9991
    }

    100% {
        outline: 4px solid #9991
    }
}

.toggle-hold::before {
    /* content: ''; */
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    background: conic-gradient(#fff 0%, #00c914 80%, #fff 100%);
    animation: spin linear 10s infinite;
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg)
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg)
    }
}

.toggle-hold label {
    width: 100%;
    height: 100%;
    position: relative;
    cursor: pointer;
    background: transparent;
    transition: .2s;
}

.toggle-hold .toggle-input:not(:checked)+label {
    background: #555
}

.toggle-hold input[type="checkbox"] {
    display: none;
}

.toggle-hold label::before {
    content: '';
    position: absolute;
    inset: 1px;
    background: linear-gradient(to bottom, #0009, #000b);
    backdrop-filter: blur(5px);
    border-radius: var(--h)
}

.toggle-hold label span {
    position: absolute;
    width: auto;
    height: 65%;
    aspect-ratio: 1;
    border-radius: var(--h);
    top: 50%;
    left: calc(var(--h) / 2);
    transform: translate(-50%, -50%);
    animation: slide-off var(--speed) forwards cubic-bezier(.5, 0, 0, 1)
}

.toggle-hold .toggle-input:checked+label span {
    animation: slide-on var(--speed) forwards cubic-bezier(.5, 0, 0, 1);
}

@keyframes slide-on {
    0% {
        left: calc(var(--h) / 2)
    }

    100% {
        left: calc(100% - var(--h) / 2)
    }
}

@keyframes slide-off {
    0% {
        left: calc(100% - var(--h) / 2)
    }

    100% {
        left: calc(var(--h) / 2)
    }
}

.toggle-hold label span::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translateX(-50%) translateY(-50%);
    width: 100%;
    height: 100%;
    background: #00c914;
    transition: .2s;
    border-radius: var(--h);
    animation:
        slide-off-w var(--speed) forwards cubic-bezier(.5, 0, .5, 1);
}

.toggle-hold .toggle-input:not(:checked)+label span::after {
    background: #b44
}

.toggle-hold .toggle-input:checked+label span::after {
    animation:
        slide-on-w var(--speed) forwards cubic-bezier(.5, 0, .5, 1);
}

@keyframes slide-on-w {
    0% {
        width: 100%
    }

    35% {
        width: 150%
    }

    50% {
        width: 130%
    }

    60% {
        width: 105%
    }

    100% {
        width: 100%
    }
}

@keyframes slide-off-w {
    0% {
        width: 100%
    }

    35% {
        width: 150%
    }

    50% {
        width: 130%
    }

    60% {
        width: 105%
    }

    100% {
        width: 100%
    }
}

.toggle-hold label span::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 100%;
    background: #00c914;
    transition: .2s;
    border-radius: var(--h);
    filter: blur(30px);
}

.toggle-hold .toggle-input:not(:checked)+label span::before {
    background: #0000
}