* {
  box-sizing: border-box;
}

.countdown {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-40%, -30%);
  display: flex;
  gap: calc(0.03 * 80vw); /* distance between segments */
  font-family: 'Helvetica';
  width: 80vw; /* 80% of the visible width */
}

.time-section {
  text-align: center;
  font-size: calc(0.2 * 85vw); /* size of the time segments */
}

.time-group {
  display: flex;
  gap: calc(0.008 * 85vw); /* distance inside a time segment */
}

.time-segment {
  display: block;
  font-size: 1em;
  font-weight: normal;  /* normal lighter bold or numeric values */
}

.segment-display {
  position: relative;
  height: 100%;
}

.segment-display__top,
.segment-display__bottom {
  overflow: hidden;
  text-align: center;
  width: 100%;
  height: 50%;
  position: relative;
}

.segment-display__top {
  line-height: 0.9;
  color: #eee;
  background-color: #000000;
}

.segment-display__bottom {
  line-height: 0;
  color: #fff;
  background-color: #0f0f0f;
}

.segment-overlay {
  position: absolute;
  top: 0;
  perspective: calc(1 * 80vw); /* perspective grow, when flipping */
  height: 100%;
  width: 100%;
}

.segment-overlay__top,
.segment-overlay__bottom {
  position: absolute;
  overflow: hidden;
  text-align: center;
  width: 100%;
  height: 50%;
}

.segment-overlay__top {
  top: 0;
  line-height: 0.9;
  color: #fff;
  background-color: #000000;
  transform-origin: bottom;
}

.segment-overlay__bottom {
  bottom: 0;
  line-height: 0;
  color: #eee;
  background-color: #0f0f0f;
  border-top: 2px solid black;
  transform-origin: top;
}

.segment-overlay.flip .segment-overlay__top {
  animation: flip-top 0.6s linear;
}

.segment-overlay.flip .segment-overlay__bottom {
  animation: flip-bottom 0.6s linear;
}

@keyframes flip-top {
  0% {
    transform: rotateX(0deg);
  }
  50%,
  100% {
    transform: rotateX(-90deg);
  }
}

@keyframes flip-bottom {
  0%,
  50% {
    transform: rotateX(90deg);
  }
  100% {
    transform: rotateX(0deg);
  }
}
