body {
  --halfHeight: 0.72em;
  --borderRadius: 8px;
}

.flip-clock {
  text-align: center;
  perspective: 400px;
  margin: 0 auto;
}

.flip-clock__piece {
  display: inline-block;
  margin: 0 5px;
  position: relative;
}

.flip-clock__slot {
  font-size: 0.8rem;
  font-weight: 700;
  color: #ffffff;
  position: absolute;
  bottom: -25px;
  left: 50%;
  transform: translateX(-50%);
}

.flip::before, .flip::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0%;
  width: 5px;
  height: 5px;
  background: #000000;
  border-radius: 0 100px 100px 0;
  z-index: 9998;
}

.flip::after {
  left: auto;
  right: 0%;
  border-radius: 100px 0 0 100px;
  z-index: 12999;
}

.flip {
  position: relative;
}

.flip-clock__card {
  display: block;
  position: relative;
  padding-bottom: var(--halfHeight);
  font-size: 28px;
  line-height: 0.95;
  box-shadow: 0px 10px 8px #00000085;
  border-radius: var(--borderRadius);
}

.card__top, .card__bottom, .card__back::before, .card__back::after {
  display: block;
  height: var(--halfHeight);
  color: #efefef;
  background: #2e2e2e;
  padding: 0.25em 0.25em;
  border-radius: var(--borderRadius) var(--borderRadius) 0 0;
  backface-visiblity: hidden;
  transform-style: preserve-3d;
  width: 2em;
  transform: translateZ(0);
}

.card__bottom {
  color: #ffffff;
  position: absolute;
  top: 50%;
  left: 0;
  border-top: solid 2px rgba(25, 26, 36, 0.281);
  background: #474747;
  border-radius: 0 0 var(--borderRadius) var(--borderRadius);
  pointer-events: none;
  overflow: hidden;
}

.card__bottom::after {
  display: block;
  margin-top: calc(var(--halfHeight) * -1);
}

.card__back::before, .card__bottom::after {
  content: attr(data-value);
}

.card__back {
  position: absolute;
  top: 0;
  height: 100%;
  left: 0%;
  pointer-events: none;
}

.card__back::before {
  position: relative;
  z-index: -1;
  overflow: hidden;
}

.flip .card__back::before {
  animation: flipTop 0.3s cubic-bezier(0.37, 0.01, 0.94, 0.35);
  animation-fill-mode: both;
  transform-origin: center bottom;
}

.flip .card__back .card__bottom {
  transform-origin: center top;
  animation-fill-mode: both;
  animation: flipBottom 0.6s cubic-bezier(0.15, 0.45, 0.28, 1);
}

@keyframes flipTop {
  0% {
    transform: rotateX(0deg);
    z-index: 2;
  }
  0%, 99% {
    opacity: 0.99;
  }
  100% {
    transform: rotateX(-90deg);
    opacity: 0;
  }
}

@keyframes flipBottom {
  0%, 50% {
    z-index: -1;
    transform: rotateX(90deg);
    opacity: 0;
  }
  51% {
    opacity: 0.99;
  }
  100% {
    opacity: 0.99;
    transform: rotateX(0deg);
    z-index: 5;
  }
}

@media screen and (min-width: 768px) {
  .flip-clock__card {
    font-size: 3.6rem;
  }
}

@media screen and (min-width: 768px) {
  .flip::before, .flip::after {
    top: 46%;
    width: 8px;
    height: 10px;
  }
}

@media screen and (min-width: 768px) {
  .flip-clock__slot {
    letter-spacing: 2px;
    font-size: 1.2rem;
    bottom: -40px;
  }
}

