:root {
  --boxColor: #0ff7;
  --rotateSpeed: 30s;
  --bounceSpeed: 1.6s;
}

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

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

@keyframes ballBounce {
  0%, 100% { bottom: 0.5em }
  50% { bottom: 3em; animation-timing-function: ease-in; }
}
.ball {
  position: absolute;
  left: -0.5em;
  bottom: 1em;
  width: 1em; height: 1em;
  border-radius: 50%;
  background-color: #fff;
  
  background-image: radial-gradient(
    circle at top,
    #fff, 40%, #000
  );
  
  animation: 
    ballBounce var(--bounceSpeed) infinite ease-out,
    sceneRotate var(--rotateSpeed) infinite linear reverse;
  
}

  @keyframes ballShadow {
    0%, 8%, 93.5%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(2); opacity: 0.5; animation-timing-function: ease-in; }
  }

.ballShadow {
  position: absolute;
  width: 100%; height: 100%;
  background-image: radial-gradient(#0007, #0000 50%);
  
  animation: ballShadow var(--bounceSpeed) infinite ease-out;
}


@keyframes cubeScale {
  0%, 100% { transform: scaleY(0.75) }
  8%, 93.5% { transform: scaleY(1) }}

.cube {
  --_size: 2em;
  transform-style: preserve-3d;
  position: absolute;
  bottom: -1em;
  left: -1em;
  width: var(--_size);
  height: var(--_size);
  
  animation: cubeScale var(--bounceSpeed) infinite ease-in-out;
  transform-origin: bottom;
  
  
  .left, .right, .front, .back, .top, .bottom {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: var(--boxColor);
    box-shadow: 0 0 0.5em #000a inset;
  }
  


  .top    { transform: translateY(-50%) rotateX(90deg) }
  .bottom { transform: translateY(50%) rotateX(90deg) }
  
  .front { transform: translateZ(calc(var(--_size) / 2)) }
  .back  { transform: translateZ(calc(var(--_size) / -2)) }
  
  .right { transform: rotateY(90deg) translateZ(calc(var(--_size) / 2)) }
  .left  { transform: rotateY(-90deg) translateZ(calc(var(--_size) / 2)) }
}

.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, 
      #111 0deg 90deg, 
      #222 90deg 180deg
    );
  background-size: 100%, 1em 1em;
}


/* @keyframes exampleAnimation {
  0% { transform: translateY(0) rotateX(0); }
  100% { transform: translateY(50%) rotateX(90deg); }
}

.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, #111 0deg 90deg, #222 90deg 180deg);
  background-size: 100%, 1em 1em;
  animation: exampleAnimation 2s infinite;
} */