* { box-sizing: border-box; }
html { background: #fff; color: #111; font-family: Arial, Helvetica, sans-serif; }
body { margin: 0; min-height: 100vh; min-height: 100svh; display: grid; place-items: center; }
main { position: relative; z-index: 1; width: min(100%, 1060px); padding: 64px 24px; text-align: center; }
h1 { font-size: clamp(1.75rem, 3.4vw, 3.375rem); line-height: 1.15; margin: 0 0 clamp(44px, 6vw, 90px); font-weight: 700; }
p { font-size: clamp(1.25rem, 2.6vw, 2.375rem); line-height: 1.35; margin: clamp(40px, 5vw, 68px) 0 0; }
.countdown { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(8px, 2vw, 28px); }
.countdown { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.countdown:focus-visible { outline: 2px solid #777; outline-offset: 12px; border-radius: 4px; }
.unit { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.digits {
  --card-gap: clamp(2px, .35vw, 5px);
  display: flex; justify-content: center; gap: var(--card-gap); width: 100%;
  container-type: inline-size;
}
/* Equal slots reserve the day capacity across all four columns. */
.card {
  --card-size: min(78px, calc((100cqw - (var(--places, 3) - 1) * var(--card-gap)) / var(--places, 3)));
  position: relative; display: grid; place-items: center; flex: none;
  width: var(--card-size); aspect-ratio: 2 / 3;
  border: 1px solid #666; border-radius: clamp(4px, .7vw, 12px);
  background: #222; color: #fff; font-weight: 700; font-variant-numeric: tabular-nums;
  font-size: calc(var(--card-size) * 1.2);
  line-height: 1; box-shadow: 0 1px 1px #0002; perspective: 500px;
}
.face, .flap { position: absolute; inset: 0; display: grid; place-items: center; border-radius: inherit; background: #222; backface-visibility: hidden; }
.flap { transform-origin: center; }
.old-bottom { clip-path: inset(50% 0 0); animation: release-bottom 180ms step-end forwards; }
.flip-top { clip-path: inset(0 0 50%); animation: fold-top 180ms ease-in forwards; }
.flip-bottom { clip-path: inset(50% 0 0); transform: rotateX(90deg); animation: unfold-bottom 180ms 180ms ease-out forwards; }
@keyframes fold-top { to { transform: rotateX(-90deg); } }
@keyframes unfold-bottom { to { transform: rotateX(0); } }
@keyframes release-bottom { to { visibility: hidden; } }
.card::after { content: ''; position: absolute; z-index: 2; top: 50%; left: -1px; right: -1px; height: 2px; background: #666b; pointer-events: none; }
.unit > span { display: block; width: 100%; font-size: clamp(.6875rem, 2.1vw, 2rem); font-weight: 700; text-transform: uppercase; line-height: 1.25; overflow-wrap: anywhere; }
.wall { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.wall i {
  position: absolute; top: 5%; left: -30%; width: 108vw; height: 120vh; min-width: 552px;
  background: radial-gradient(ellipse at 48% 20%, #394047 0%, transparent 42%), radial-gradient(ellipse at 52% 70%, #394047 0%, transparent 65%);
  filter: blur(85px); opacity: 0; animation: passing 30.714s ease-in-out infinite;
  animation-delay: -12s;
}
.wall i + i { top: 25%; height: 96vh; width: 84vw; animation-name: passing-back; animation-duration: 40.714s; animation-delay: -27s; }
.wall i:nth-child(3) { top: -10%; height: 132vh; width: 96vw; animation-name: passing-back; animation-duration: 35s; animation-delay: -8s; }
@keyframes passing {
  0% { transform: translateX(-20vw) rotate(-8deg); opacity: 0; }
  25%, 65% { opacity: .12; }
  100% { transform: translateX(150vw) rotate(12deg); opacity: 0; }
}
@keyframes passing-back {
  0% { transform: translateX(150vw) rotate(10deg); opacity: 0; }
  30%, 60% { opacity: .12; }
  100% { transform: translateX(-20vw) rotate(-5deg); opacity: 0; }
}
[hidden] { display: none !important; }
@media (max-width: 400px) {
  main { padding: 40px 20px; }
  .unit { gap: 12px; }
  .countdown { gap: 6px; }
  .card { border-width: 1px; }
}
@media (max-width: 600px) {
  .wall i { min-width: 0; width: 60vw; filter: blur(28px); }
  .wall i + i { width: 50.4vw; }
  .wall i:nth-child(3) { width: 55.2vw; }
}
/* Keep one row through tablet widths; use compact pairs only on narrow phones. */
@media (max-width: 24rem) {
  .countdown { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 16px; }
  .digits { max-width: 104px; }
  .unit > span { font-size: .8125rem; }
}
@media (prefers-reduced-motion: reduce) {
  .wall, .flap { display: none; }
}
