@font-face {
  font-family: "Inter Variable";
  src: url("./fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  font-style: normal;
}

:root {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  background: #000;
  color: #fff;
}

body {
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "SF Pro Display",
    "SF Pro Text",
    "Inter Variable",
    sans-serif;
  font-feature-settings: "kern" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: #fff;
  color: #000;
}

.stage {
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 8vh 4vw 10vh;
}

.clock {
  display: flex;
  align-items: baseline;
  justify-content: center;
  font-size: clamp(4.5rem, 18vw, 16rem);
  font-weight: 400;
  font-variation-settings: "wght" 420, "opsz" 32;
  letter-spacing: -0.04em;
  line-height: 0.9;
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1, "kern" 1;
  user-select: none;
  cursor: default;
  outline: none;
}

.clock.is-running {
  cursor: pointer;
}

.clock:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 12px;
}

.slot {
  position: relative;
  display: inline-block;
  width: 0.62em;
  height: 0.92em;
  overflow: hidden;
}

.glyph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 260ms var(--ease-out),
    transform 260ms var(--ease-out);
}

.glyph.is-enter {
  opacity: 0;
  transform: translateY(22%);
  transition: none;
}

.glyph.is-exit {
  opacity: 0;
  transform: translateY(-22%);
}

.colon {
  display: inline-block;
  width: 0.32em;
  text-align: center;
  transform: translateY(-0.04em);
}

.starter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.75rem;
  width: min(28rem, 92vw);
  margin-top: clamp(2.5rem, 8vh, 5.5rem);
  transition: opacity 220ms var(--ease-out);
}

.starter.is-hidden {
  opacity: 0;
  pointer-events: none;
  margin-top: 0;
  height: 0;
  overflow: hidden;
  visibility: hidden;
}

.wheels {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
  width: 100%;
}

.wheel-col {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.65rem;
}

.wheel-label {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a8a8a;
}

.wheel-frame {
  position: relative;
}

.wheel-mark {
  pointer-events: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 4.5rem;
  height: 2.25rem;
  border-radius: 8px;
  background: #141414;
}

.wheel {
  position: relative;
  height: 11.25rem;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    #000 22%,
    #000 78%,
    transparent 100%
  );
}

.wheel::-webkit-scrollbar {
  display: none;
}

.wheel-pad,
.wheel-item {
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wheel-item {
  scroll-snap-align: center;
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: #5c5c5c;
  transition: color 160ms var(--ease-out);
}

.wheel-item.is-active {
  color: #fff;
}

.start {
  appearance: none;
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  padding: 0.7rem 1.4rem;
  cursor: pointer;
  border-radius: 999px;
}

.start:hover {
  background: #141414;
}

.start:active {
  transform: scale(0.97);
  transition: transform 120ms var(--ease-out);
}

.start:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.start:disabled {
  color: #3a3a3a;
  cursor: default;
  background: transparent;
}

@media (max-width: 640px) {
  .stage {
    padding-bottom: 7vh;
  }

  .clock {
    font-size: min(19.5vw, 18vh);
  }

  .starter {
    margin-top: 2.25rem;
  }

  .wheels {
    gap: 0.35rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .starter,
  .wheel-item,
  .start,
  .glyph {
    transition: none;
  }

  .glyph.is-enter,
  .glyph.is-exit {
    transform: none;
  }
}
