body {
    margin: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
label {
    width: 500px;
    height: 200px;
    position: relative;
    display: block;
    background: #ebebeb;
    border-radius: 200px;
    box-shadow: inset 0 5px 15px rgba(0,0,0,0.4), inset 0 -5px 0 rgba(255,0,255,0.1);
    cursor: pointer;
    transition: 1.2s;
}
label:after {
    content: "";
    width:180px;
    height: 180px;
    position: absolute;
    top:10px;
    left:10px;
    background: linear-gradient(180deg,#535dbc,#0c33f7);
    border-radius: 180px;
    box-shadow: 0px 5px 10px rgba(0,0,0,0.2);
    transition: 0.3s;
  }
input {
    width: 0;
    height: 0;
    visibility: hidden;
  }
input:checked + label {
    background: #242424;
    
}
input:checked + label:after {
    left: 490px;
    transform: translateX(-100%);
    background: linear-gradient(180deg, #4e3719,#86062a);
   
}
label:active:after {
    width: 250px;
}
.background {
    position: absolute;
    width: 100vw;
    height: 100vh;
    background: #fff;
    z-index: -1;
    transition: 0.8s;
}
input:checked + label + .background {
    background: #242424;
}
label svg {
   position: absolute;
   width: 120px;
   top: 40px;
   z-index: 100;
}
label svg.sun{
    left: 40px;
    fill: #ededed;
    transition: 0.3s;
}
label svg.moon{
    right: 40px;
    fill: #111;
    transition: 0.3s;
}
input:checked + label svg.sun{
    fill: #7e7e7e;

}
input:checked + label svg.moon{
    fill: #fff;

}