* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: pink;
    transition: all 0.4s ease;
}

body.dark {
    background: #000;
}
.toggle {
    position: relative;
    width: 300px;
    height: 130px;
    background: #fff;
    border-radius: 100px;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

.toggle::before {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 14px;
    height: 110px;
    width: 110px;
    background: pink;
    border-radius: 50%;
    transition: all 0.4s ease;
}

.toggle.active::before {
    left: calc(100% - 110px - 14px);
    background: #000;
}