html,
body {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  font-family: "Montserrat", sans-serif;
  overflow: hidden;
}
.die {
  width: 400px;
  height: 35px;
}
.cube {
  transform-style: preserve-3d;
  animation: rotateCube 4s infinite ease-in-out alternate;
}

.face {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  backface-visibility: hidden;
  line-height: 0; 
  letter-spacing: 0; 
  animation: colorChange 6s infinite linear, pulse 3s infinite ease-in-out,
    tilt 8s infinite ease-in-out alternate;
}
.face:nth-child(1) {
  transform: rotateY(0deg) translateZ(70px);
  font-size: 34px;
  animation: colorChange 4s infinite;
}
.face:nth-child(2) {
  transform: rotateY(120deg) translateZ(70px);
  font-size: 32px;
  animation: colorChange 4s infinite 1s;
}
.face:nth-child(3) {
  transform: rotateY(240deg) translateZ(70px);
  font-size: 30px;
  animation: colorChange 4s infinite 2s;
}
.die:nth-child(2) .cube {
  animation-delay: 0.1s;
}
.die:nth-child(3) .cube {
  animation-delay: 0.2s;
}
.die:nth-child(4) .cube {
  animation-delay: 0.3s;
}
.die:nth-child(5) .cube {
  animation-delay: 0.4s;
}
.die:nth-child(6) .cube {
  animation-delay: 0.5s;
}
.die:nth-child(7) .cube {
  animation-delay: 0.6s;
}
.die:nth-child(8) .cube {
  animation-delay: 0.7s;
}
.die:nth-child(9) .cube {
  animation-delay: 0.8s;
}
.die:nth-child(10) .cube {
  animation-delay: 0.9s;
}
.die:nth-child(11) .cube {
  animation-delay: 1s;
}
.die:nth-child(12) .cube {
  animation-delay: 1.1s;
}
.die:nth-child(13) .cube {
  animation-delay: 1.2s;
}
.die:nth-child(14) .cube {
  animation-delay: 1.3s;
}
.die:nth-child(15) .cube {
  animation-delay: 1.4s;
}
.die:nth-child(16) .cube {
  animation-delay: 1.5s;
}
.die:nth-child(17) .cube {
  animation-delay: 1.6s;
}
.die:nth-child(18) .cube {
  animation-delay: 1.7s;
}

.tray {
  animation: float 4s infinite ease-in-out alternate;
}
@keyframes rotateCube {
  0% {
    transform: rotateY(-180deg);
  }
  50% {
    transform: rotateY(0deg);
  }
  100% {
    transform: rotateY(180deg);
  }
}

@keyframes float {
  0% {
    transform: rotate(-10deg) translateY(-10px);
  }

  100% {
    transform: rotate(10deg) translateY(10px);
  }
}

@keyframes colorChange {
  0% {
    color: #3a0ca3;
  }
  33% {
    color: #7209b7;
  }
  66% {
    color: #f72585;
  }
  100% {
    color: #4361ee;
  }
}
@keyframes rotateCube {
  0% {
    transform: rotateY(-180deg);
  }
  50% {
    transform: rotateY(0deg);
  }
  100% {
    transform: rotateY(180deg);
  }
}

@keyframes float {
  0% {
    transform: translateY(-10px) rotate(-10deg);
  }
  100% {
    transform: translateY(10px) rotate(10deg);
  }
}

@keyframes colorChange {
  0% {
    color: #3a0ca3;
  }
  20% {
    color: #7209b7;
  }
  40% {
    color: #f72585;
  }
  60% {
    color: #4361ee;
  }
  80% {
    color: #4cc9f0;
  }
  100% {
    color: #3a0ca3;
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

@keyframes tilt {
  0% {
    transform: rotateX(0deg);
  }
  50% {
    transform: rotateX(15deg);
  }
  100% {
    transform: rotateX(0deg);
  }
}