:root {
  --boxColor: rgba(244, 175, 45, 0.7);
  --rotateSpeed: 30s;
  --bounceSpeed: 1.5s;
}

body {
  background-color: #000;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 75px;
  perspective: 10em;
  perspective-origin: 50% calc(50% - 2em);
}

.scene {
  position: relative;
  transform-style: preserve-3d;
  animation: sceneRotate var(--rotateSpeed) infinite linear;
}
@keyframes sceneRotate {
  to {
    transform: rotateY(360deg);
  }
}

.cube {
  width: 2em;
  height: 2em;
  transform-style: preserve-3d;
  position: absolute;
  bottom: -1em;
  left: -1em;
}
.cube * {
  transition: all 0.4s ease-in-out;
}
@keyframes topAnimate {
  0%, 100% {
    transform: translateY(-50%) rotateX(90deg);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%);
  }
  50% {
    transform: translateY(-36.5%) rotateX(90deg);
    clip-path: polygon(50% 50%, 50% 50%, 50% 50%, 50% 50%);
  }
  /*
  clip-path: polygon(10% 10%, 90% 10%, 90% 90%, 10% 90%);
  clip-path: polygon(20% 20%, 80% 20%, 80% 80%, 20% 80%);
  clip-path: polygon(30% 30%, 70% 30%, 70% 70%, 30% 70%);
  clip-path: polygon(40% 40%, 60% 40%, 60% 60%, 40% 60%);
  clip-path: polygon(50% 50%, 50% 50%, 50% 50%, 50% 50%);
  	*/
}
@keyframes leftAnimate {
  0%, 100% {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%);
    transform: rotateY(270deg) translateZ(1em) rotateX(0deg);
  }
  50% {
    clip-path: polygon(50% 0, 50% 0, 100% 100%, 0% 100%);
    transform: rotateY(270deg) translateZ(1em) rotateX(30deg);
  }
}
@keyframes rightAnimate {
  0%, 100% {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%);
    transform: rotateY(90deg) translateZ(1em) rotateX(0deg);
  }
  50% {
    clip-path: polygon(50% 0, 50% 0, 100% 100%, 0% 100%);
    transform: rotateY(90deg) translateZ(1em) rotateX(30deg);
  }
}
@keyframes frontAnimate {
  0%, 100% {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%);
    transform: translateZ(1em) rotateX(0deg);
  }
  50% {
    clip-path: polygon(50% 0, 50% 0, 100% 100%, 0% 100%);
    transform: translateZ(1em) rotateX(30deg);
  }
}
@keyframes backAnimate {
  0%, 100% {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%);
    transform: rotateY(180deg) translateZ(1em) rotateX(0deg);
  }
  50% {
    clip-path: polygon(50% 0, 50% 0, 100% 100%, 0% 100%);
    transform: rotateY(180deg) translateZ(1em) rotateX(30deg);
  }
}
.cube .left,
.cube .right,
.cube .front,
.cube .back {
  position: absolute;
  height: 100%;
  width: 100%;
  background: var(--boxColor);
  box-shadow: 0 0 0.5em #000a inset;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%);
  transform-origin: center bottom;
}
.cube .front {
  animation: frontAnimate 5s infinite;
  transform: translateZ(1em);
}
.cube .right {
  animation: rightAnimate 5s infinite;
  transform: rotateY(90deg) translateZ(1em);
}
.cube .back {
  animation: backAnimate 5s infinite;
  transform: rotateY(180deg) translateZ(1em);
}
.cube .left {
  animation: leftAnimate 5s infinite;
  transform: rotateY(270deg) translateZ(1em);
}
.cube .top {
  position: absolute;
  height: 2em;
  width: 2em;
  background: var(--boxColor);
  transform: translateY(-50%) rotateX(90deg);
  box-shadow: 0 0 0.5em #000a inset;
  transform-origin: center center;
  animation: topAnimate 5s infinite;
  animation-timing-function: ease;
}
.cube .bottom {
  position: absolute;
  bottom: 0;
  height: 2em;
  width: 2em;
  background: var(--boxColor);
  transform: translateY(50%) rotateX(90deg);
  box-shadow: 0 0 0.5em #000;
}

.floor {
  position: absolute;
  top: 1em;
  transform: translate(-50%, -50%) rotateX(90deg);
  width: 15em;
  height: 15em;
  background-image: radial-gradient(#0000, #000 75%), repeating-conic-gradient(from 45deg, #7CFFFF 0deg 90deg, #000 90deg 180deg);
  background-size: 100%, 1em 1em;
}