body {
  background: #222;
  color: #eee;
  font-family: 'Courier New', Courier, monospace;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  margin: 0;
  padding: 20px;
}

h1 {
  margin-bottom: 30px;
  color: #aaa;
  text-transform: uppercase;
  font-size: 1.5em;
  letter-spacing: 2px;
}

.flip-clock {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
}

.flip {
  position: relative;
  width: 90px;
  height: 110px;
  perspective: 1000px;
}

.card {
  position: absolute;
  width: 100%;
  height: 50%;
  overflow: hidden;
  background: #333;
  color: #fff;
  border: 1px solid #555;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2em;
}

.card.top {
  border-bottom: 1px solid #111;
  border-radius: 5px 5px 0 0;
  z-index: 3;
}

.card.bottom {
  top: 50%;
  border-top: 1px solid #111;
  border-radius: 0 0 5px 5px;
  z-index: 1;
}

.flip-top {
  transform-origin: bottom;
  z-index: 4;
  backface-visibility: hidden;
}

.flip-bottom {
  top: 50%;
  transform-origin: top;
  z-index: 2;
  backface-visibility: hidden;
  transform: rotateX(180deg);
}

.flip-top.animate {
  animation: flipTopAnim 0.5s forwards;
}

.flip-bottom.animate {
  animation: flipBottomAnim 0.5s forwards;
}

@keyframes flipTopAnim {
  0% { transform: rotateX(0deg); }
  100% { transform: rotateX(-180deg); }
}

@keyframes flipBottomAnim {
  0% { transform: rotateX(180deg); }
  100% { transform: rotateX(0deg); }
}

.label {
  position: absolute;
  width: 100%;
  top: 100%;
  text-align: center;
  font-size: 0.8em;
  color: #ccc;
  margin-top: 5px;
  text-transform: uppercase;
}
