.newtons-cradle {
  --uib-size: 80px;
  --uib-speed: 0.9s;
  --dot-color-1: #3498db; /* Blue */
  --dot-color-2: #f39c12; /* Yellow */
  --dot-color-3: #e74c3c; /* Red */
  --dot-color-4: #000000; /* Black */
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--uib-size);
  height: var(--uib-size);
}

.newtons-cradle__dot {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
  width: 100%;
  transform-origin: center top;
}

.newtons-cradle__dot::after {
  content: '';
  display: block;
  width: 100%;
  height: 25%;
  border-radius: 60%;
  background-color: var(--dot-color-1); /* Blue for the first circle */
}

.newtons-cradle__dot:first-child::after {
  background-color: var(--dot-color-1); /* Blue for the first circle */
}

.newtons-cradle__dot:nth-child(2)::after {
  background-color: var(--dot-color-2); /* Yellow for the second circle */
}

.newtons-cradle__dot:nth-child(3)::after {
  background-color: var(--dot-color-3); /* Red for the third circle */
}

.newtons-cradle__dot:last-child::after {
  background-color: var(--dot-color-4); /* Black for the last circle */
}

.newtons-cradle__dot:first-child {
  animation: swing var(--uib-speed) linear infinite;
}

.newtons-cradle__dot:last-child {
  animation: swing2 var(--uib-speed) linear infinite;
}

@keyframes swing {
  0% {
    transform: rotate(0deg);
    animation-timing-function: ease-out;
  }

  25% {
    transform: rotate(70deg);
    animation-timing-function: ease-in;
  }

  50% {
    transform: rotate(0deg);
    animation-timing-function: linear;
  }
}

@keyframes swing2 {
  0% {
    transform: rotate(0deg);
    animation-timing-function: linear;
  }

  50% {
    transform: rotate(0deg);
    animation-timing-function: ease-out;
  }

  75% {
    transform: rotate(-70deg);
    animation-timing-function: ease-in;
  }
}
