:root {
    --toggle-width: 40px;
}

.toggle {
    position: relative;
    width: var(--toggle-width);
    height: 1.3em;
    border-radius: 50px;
    overflow: hidden;
    user-select: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 1.1em;
}

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

.toggle span {
    position: absolute;
    font-size: 0.7em;
    font-weight: bold;
    line-height: 1;
    -webkit-transition: 0.2s ease-out;
    transition: 0.2s ease-out;
    padding-top: 0.3em;
}

.toggle span:nth-of-type(1) {
    right: 5px;
    color: rgba(0, 0, 0, 0.175);
}

.toggle span:nth-of-type(2) {
    left: 7px;
    color: #fff;
    letter-spacing: 2px;
}

.toggle:before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50px;
    display: block;
    background: #e9e9eb;
    -webkit-transition: 0.2s ease-out;
    transition: 0.2s ease-out;
}

.toggle:after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: calc(var(--toggle-width) / 2);
    height: calc(100% - 6px);
    display: block;
    border-radius: 50px;
    background: #fff;
    box-shadow: 0 9px 28px -6px rgba(0, 0, 0, 0.3);
    -webkit-transition: 0.2s ease-out;
    transition: 0.2s ease-out;
}

.toggle:has(input[type=checkbox]:checked)::before {
    background: #35c759;
}

.toggle:has(input[type=checkbox]:checked)::after {
    left: calc(var(--toggle-width) / 2 - 3px);
    box-shadow: 0 9px 28px -6px rgba(0, 0, 0, 0.5);
}