.switch {
  position: relative;
}

.switch input {
  height: 100%;
  width: 100%;
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  z-index: 100;
  cursor: pointer;
}

.switch label {
  height: 22px;
  width: 44px;
  background-color: #39315a;
  border-radius: 20px;
  display: block;
  box-shadow: inset 0 0 4px rgba(0,0,0,0.2), inset 0 0 1px -0.4px rgba(0,0,0,0.4);
}

.switch label .bulb {
  height: 18px;
  width: 18px;
  background-color: #4a426b;
  border-radius: 50%;
  position: relative;
  top: 2px;
  left: 2px;
  display: block;
  transition: 0.2s;
  box-shadow: inset 0 0 0.2px 0.6px #4a426b, inset 0 0 1.2px 1.6px #423963, 0 4px 6px -2px rgba(0,0,0,0.4);
}

.switch label .bulb .bulb-center {
  position: absolute;
  display: block;
  height: 7.2px;
  width: 7.2px;
  background-color: #5a527b;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transition: 0.7s;
  transform: translate(-50%, -50%);
  box-shadow: inset 0 0 0 0.8px #635a84;
}

.switch label .bulb .bulb-center:after {
  content: "";
  display: block;
  height: 2.8px;
  width: 2.8px;
  background-color: #7b7394;
  border-radius: 50%;
  position: absolute;
  transition: 0.7s;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0.4px 0.8px #524a73;
}

.sparks .spark1 {
  display: block;
  height: 0.2px;
  width: 0.2px;
  background-color: #d1b82b;
  position: absolute;
  right: -1px;
  border-radius: 50%;
  bottom: 4.6px;
  transition: 0.4s;
  opacity: 0;
}

.sparks .spark2 {
  display: block;
  height: 0.6px;
  width: 0.6px;
  background-color: #d1b82b;
  position: absolute;
  right: 4px;
  border-radius: 50%;
  bottom: 16px;
  transition: 0.4s;
  opacity: 0;
}

.sparks .spark3 {
  display: block;
  height: 0.6px;
  width: 0.6px;
  background-color: #d1b82b;
  position: absolute;
  left: 4px;
  border-radius: 50%;
  bottom: 16px;
  transition: 0.4s;
  opacity: 0;
}

.sparks .spark4 {
  display: block;
  height: 0.6px;
  width: 0.6px;
  background-color: #d1b82b;
  position: absolute;
  left: 4px;
  border-radius: 50%;
  bottom: 4px;
  transition: 0.4s;
  opacity: 0;
}

.switch input:checked ~ label {
  transition: background-color 0.3s ease-in-out;
  background-color: #f4f422;
}

.switch input:checked ~ label .bulb {
  left: 24px;
  background-color: #f5e50e;
  box-shadow: inset 0 0 0.2px 0.6px #f2e20c, inset 0 0 1.2px 1.6px #ebcd08, 0 4px 6px -2px rgba(0,0,0,0.4), 0 0 6px 10px rgba(253,184,67,0.1);
}

.switch input:checked ~ label .bulb > .bulb-center {
  background-color: #feed6b;
  box-shadow: inset 0 0 0 0.8px #fdec6a, 0 0 2.4px 2px #bca83c, 0 0 4px 2.8px #a1664a;
}

.switch input:checked ~ label .bulb > .bulb-center:after {
  background-color: #fef401;
  box-shadow: 0 0 0.4px 0.8px #fdb843;
}

.switch input:checked ~ label .bulb > .sparks .spark1 {
  height: 0.2px;
  width: 0.2px;
  -webkit-animation: spark1 2s ease-in-out;
  animation: spark1 2s ease-in-out;
  -webkit-animation-delay: 0.4s;
  animation-delay: 0.4s;
}

.switch input:checked ~ label .bulb > .sparks .spark2 {
  height: 0.2px;
  width: 0.2px;
  -webkit-animation: spark2 2.4s ease-in-out;
  animation: spark2 2.4s ease-in-out;
  -webkit-animation-delay: 0.4s;
  animation-delay: 0.4s;
}

.switch input:checked ~ label .bulb > .sparks .spark3 {
  height: 0.2px;
  width: 0.2px;
  -webkit-animation: spark3 2s ease-in-out;
  animation: spark3 2s ease-in-out;
  -webkit-animation-delay: 0.9s;
  animation-delay: 0.9s;
}

.switch input:checked ~ label .bulb > .sparks .spark4 {
  height: 0.2px;
  width: 0.2px;
  -webkit-animation: spark4 1.7s ease-in-out;
  animation: spark4 1.7s ease-in-out;
  -webkit-animation-delay: 0.9s;
  animation-delay: 0.9s;
}

@keyframes spark1 {
  0% {
    right: -1px;
    height: 0.2px;
    width: 0.2px;
    opacity: 0;
  }
  20% {
    height: 0.6px;
    width: 0.6px;
    right: 0px;
    opacity: 1;
  }
  30% {
    right: -1px;
    opacity: 1;
    height: 0.6px;
    width: 0.6px;
  }
  70% {
    height: 0.6px;
    width: 0.6px;
  }
  100% {
    right: -12px;
    bottom: 8px;
    opacity: 0;
  }
}

@keyframes spark2 {
  0% {
    height: 0.6px;
    width: 0.6px;
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  100% {
    right: -4px;
    bottom: 20px;
    opacity: 0;
  }
}

@keyframes spark3 {
  0% {
    opacity: 0;
  }
  30% {
    opacity: 1;
    height: 0.4px;
    width: 0.4px;
  }
  100% {
    left: 0px;
    bottom: 20px;
    opacity: 0;
    height: 0.6px;
    width: 0.6px;
  }
}

@keyframes spark4 {
  0% {
    opacity: 0;
  }
  30% {
    opacity: 1;
    height: 0.4px;
    width: 0.4px;
  }
  100% {
    left: -4px;
    bottom: -2px;
    opacity: 0;
    height: 0.6px;
    width: 0.6px;
  }
}

