:root {
  --light-color: #f5f5f5;
  --dark-color: #333232
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--light-color);
  color: var(--dark-color);
  font-weight: 400;
  font-style: normal;
  transition: background 1s ease, color 1s ease;
}

html.dark {
  --light-color: #333232;
  --dark-color: #f5f5f5
}

.wrapper {
  width: 100vw;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

main {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
}

#clock {
  font-size: 48px;
  font-family: "Black Ops One", system-ui;
  display: flex;
  justify-content: center;
  gap: 16px;
  position: relative;
}

#date {
  width: 100%;
  font-size: min(10vw, 60px);
  text-align: center;
  margin-bottom: 1rem;
  position: absolute;
  top: 0;
  transform: translateY(-150%);
  color: var(--dark-color);
}

.ampm {
  position: absolute;
  left: 8%;
  font-size: min(4vw, 20px);
  color: var(--light-color);
  bottom: 25%;
}

.item {
  width: 25vw;
  height: 25vw;
  max-width: 150px;
  max-height: 150px;
  border-radius: 1rem;
  position: relative;
}

.item>div {
  width: 100%;
  height: 50%;
  text-align: center;
  font-size: min(13vw, 80px);
  overflow: hidden;
  background: var(--dark-color);
  color: var(--light-color);
}

.top {
  line-height: min(25vw, 150px);
  border-radius: 1rem 1rem 0 0;
  border-bottom: 1px solid var(--light-color);
}

.bottom {
  line-height: 0;
  border-radius: 0 0 1rem 1rem;
  border-top: 1px solid var(--light-color);
  position: relative;
}

.top.before {
  position: absolute;
  top: 0;
  transform-origin: bottom center;
  transform: rotateX(0deg) skewX(0deg);
}

.bottom.after {
  position: absolute;
  bottom: 0;
  transform-origin: top center;
  transform: rotateX(180deg) skewX(0deg);
  z-index: -1;
}

#setting {
  position: fixed;
  right: 5vw;
  bottom: 10vw;
  font-size: 28px;
  cursor: pointer;
}

footer {
  width: 100%;
  font-size: 12px;
  color: #999
}

@keyframes topRotate {
  0% {
    transform: rotateX(0deg) skewX(0deg);
    z-index: 2;
  }

  50% {
    transform: rotateX(90deg) skewX(15deg);
    z-index: 2;
  }

  51% {
    z-index: 1
  }

  95%, 100% {
    transform: rotateX(180deg) skewX(0deg);
    z-index: 1;
  }
}

@keyframes bottomRotate {
  0% {
    transform: rotateX(180deg) skewX(0deg);
    z-index: 1;
  }

  50% {
    transform: rotateX(90deg) skewX(-15deg);
    z-index: 1;
  }

  51% {
    z-index: 2
  }


  95%, 100% {
    transform: rotateX(0deg) skewX(0deg);
    z-index: 2;
  }
}

@media (min-width: 576px) {
  #setting {
    bottom: 5vw;
    font-size: 40px;
  }
  footer {
    font-size: 14px;
  }
}