body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  background: var(--grey-color-4);
}

*,
*::after,
*::before {
  box-sizing: border-box;
  transform-style: preserve-3d;
}

:root {
  --red-color: #ae2a4a;
  --grey-color-1: #979797;
  --grey-color-2: #959595;
  --grey-color-3: #e0dfe0;
  --grey-color-4: #dadada;
}

@mixin cube($width, $height, $depth) {
  &__front {
    @include cube-front($width, $height, $depth);
  }
  &__back {
    @include cube-back($width, $height, $depth);
  }
  &__right {
    @include cube-right($width, $height, $depth);
  }
  &__left {
    @include cube-left($width, $height, $depth);
  }
  &__top {
    @include cube-top($width, $height, $depth);
  }
  &__bottom {
    @include cube-bottom($width, $height, $depth);
  }
  .face {
    position: absolute;
    border-radius: 4px;
  }
}

@mixin cube-front($width, $height, $depth) {
  width: var($width);
  height: var($height);
  transform-origin: bottom left;
  transform: rotateX(-90deg)
    translateZ(calc(calc(var(#{$depth}) * 2) - var(#{$height})));
}

@mixin cube-back($width, $height, $depth) {
  width: var($width);
  height: var($height);
  transform-origin: top left;
  transform: rotateX(-90deg) rotateY(180deg)
    translateX(calc(var(#{$width}) * -1)) translateY(calc(var(#{$height}) * -1));
}

@mixin cube-right($width, $height, $depth) {
  width: calc(var(#{$depth}) * 2);
  height: var($height);
  transform-origin: top left;
  transform: rotateY(90deg) rotateZ(-90deg) translateZ(var(#{$width}))
    translateX(calc(var(#{$depth}) * -2)) translateY(calc(var(#{$height}) * -1));
}

@mixin cube-left($width, $height, $depth) {
  width: calc(var(#{$depth}) * 2);
  height: var($height);
  transform-origin: top left;
  transform: rotateY(-90deg) rotateZ(90deg)
    translateY(calc(var(#{$height}) * -1));
}

@mixin cube-top($width, $height, $depth) {
  width: var($width);
  height: calc(var(#{$depth}) * 2);
  transform-origin: top left;
  transform: translateZ(var($height));
}

@mixin cube-bottom($width, $height, $depth) {
  width: var($width);
  height: calc(var(#{$depth}) * 2);
  transform-origin: top left;
  transform: rotateY(180deg) translateX(calc(var(#{$width}) * -1));
}

.cube {
  --cube-width: 3rem;
  --cube-height: 1rem;
  --cube-depth: 1.5rem;

  @include cube(--cube-width, --cube-height, --cube-depth);
  width: 3rem;
  height: 1rem;

  &__front {
    background-color: var(--grey-color-1);
  }
  &__back {
    background-color: var(--grey-color-3);
  }
  &__right {
    background-color: var(--grey-color-1);
  }
  &__left {
    background-color: var(--grey-color-2);
  }
  &__top {
    background-color: var(--grey-color-3);
    overflow: hidden;
  }
  &__bottom {
    background-color: var(--grey-color-2);
  }
}

.camera {
  perspective: 300px;
  transform: scale(3);
}

.board {
  --board-row: 4;
  --board-col: 6;
  position: relative;
  display: grid;
  grid-template-rows: repeat(var(--board-row), 1fr);
  grid-template-columns: repeat(var(--board-col), 1fr);
  width: 18rem;
  height: 12rem;
  transform: rotateX(45deg);
}

.clip {
  position: relative;
  display: flex;
  flex-direction: column;
  font-size: 4rem;
  line-height: 1;
  color: var(--red-color);
  user-select: none;

  &-1 {
    text-align: right;
    left: 38%;
  }

  &-2 {
    right: 61%;
  }

  &-3 {
    text-align: right;
    left: 38%;
    bottom: 100%;
  }

  &-4 {
    right: 61%;
    bottom: 100%;
  }

  &-5 {
    text-align: right;
    left: 38%;
    bottom: 68%;
  }

  &-6 {
    right: 61%;
    bottom: 68%;
  }

  &-7 {
    text-align: right;
    left: 38%;
    bottom: 35%;
  }

  &-8 {
    right: 61%;
    bottom: 35%;
  }
}
