:root {
  --size: 32px;
  --duration: 800ms;
  --color: #0dcaf0;
  --colorRight: #0ba2c4; /* 15% darkened */
  --colorLeft: #0cbde1; /* 5% darkened */
  --shadow: #dbe3f4;
  /* --size: 32px;
  --duration: 800ms;
  --color: #5c8df6;
  --colorRight: #3e6cd3; 
  --colorLeft: #4f7ee8; 
  --shadow: #dbe3f4; */
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
.loading-box {
  background: rgba(255, 255, 255, 0.8);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 999;
}

.boxes {
  height: calc(var(--size) * 2);
  width: calc(var(--size) * 3);
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 9999;
  transform-style: preserve-3d;
  transform-origin: 50% 50%;
  margin-top: calc(var(--size) * 1.5 * -1);
  transform: rotateX(60deg) rotateZ(45deg) rotateY(0deg) translateZ(0px);
}

.box {
  width: var(--size);
  height: var(--size);
  top: 0;
  left: 0;
  position: absolute;
  transform-style: preserve-3d;
}

.box:nth-child(1) {
  transform: translate(100%, 0);
  animation: box1 var(--duration) linear infinite;
}
.box:nth-child(2) {
  transform: translate(0, 100%);
  animation: box2 var(--duration) linear infinite;
}
.box:nth-child(3) {
  transform: translate(100%, 100%);
  animation: box3 var(--duration) linear infinite;
}
.box:nth-child(4) {
  transform: translate(200%, 0);
  animation: box4 var(--duration) linear infinite;
}

.box > div {
  position: absolute;
  width: 100%;
  height: 100%;
  top: auto;
  right: auto;
  bottom: auto;
  left: auto;
  transform: rotateY(0deg) rotateX(0deg) translateZ(calc(var(--size) / 2));
  background: var(--color);
}

/* Side 1 (top face) */
.box > div:nth-child(1) {
  top: 0;
  left: 0;
  background: var(--color);
}

/* Side 2 (right face) */
.box > div:nth-child(2) {
  right: 0;
  transform: rotateY(90deg) translateZ(calc(var(--size) / 2));
  background: var(--colorRight);
}

/* Side 3 (bottom face) */
.box > div:nth-child(3) {
  transform: rotateX(-90deg) translateZ(calc(var(--size) / 2));
  background: var(--colorLeft);
}

/* Shadow face */
.box > div:nth-child(4) {
  top: 0;
  left: 0;
  transform: translateZ(calc(var(--size) * -3));
  background: var(--shadow);
}

/* Animations */
@keyframes box1 {
  0%,
  50% {
    transform: translate(100%, 0);
  }
  100% {
    transform: translate(200%, 0);
  }
}

@keyframes box2 {
  0% {
    transform: translate(0, 100%);
  }
  50% {
    transform: translate(0, 0);
  }
  100% {
    transform: translate(100%, 0);
  }
}

@keyframes box3 {
  0%,
  50% {
    transform: translate(100%, 100%);
  }
  100% {
    transform: translate(0, 100%);
  }
}

@keyframes box4 {
  0% {
    transform: translate(200%, 0);
  }
  50% {
    transform: translate(200%, 100%);
  }
  100% {
    transform: translate(100%, 100%);
  }
}
