/* ============================================
   FIREWORKS COUNTDOWN - STYLES
   ============================================ */

/* --- RESET & BASE --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'Be Vietnam Pro', sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* --- CANVAS --- */
#fireworks-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

/* ============================================
   ORIENTATION GATE (Mobile Portrait)
   ============================================ */
#orientation-gate {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* Show gate only on mobile portrait */
@media (orientation: portrait) and (max-width: 932px) {
  #orientation-gate {
    display: flex !important;
  }

  #tap-to-start,
  #countdown-overlay,
  #replay-btn {
    display: none !important;
  }
}

.gate-content {
  text-align: center;
  color: #fff;
}

.phone-icon-wrap {
  display: inline-block;
  animation: tilt-phone 2.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes tilt-phone {
  0%, 100% { transform: rotate(0deg); }
  30%, 70% { transform: rotate(90deg); }
}

.gate-text {
  margin-top: 2rem;
  font-size: 1.1rem;
  font-weight: 300;
  letter-spacing: 3px;
  text-transform: uppercase;
  opacity: 0.7;
}

.gate-arrow {
  margin-top: 1rem;
  font-size: 2rem;
  color: #FFD700;
  animation: fade-pulse 2s ease-in-out infinite;
}

@keyframes fade-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* ============================================
   TAP TO START
   ============================================ */
#tap-to-start {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: radial-gradient(ellipse at center, rgba(5, 5, 20, 0.9) 0%, rgba(0, 0, 0, 0.97) 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: opacity 0.6s ease;
}

#tap-to-start.hidden {
  opacity: 0;
  pointer-events: none;
}

.start-content {
  text-align: center;
  position: relative;
}

.start-text {
  color: #FFD700;
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  font-weight: 900;
  letter-spacing: 6px;
  position: relative;
  z-index: 2;
  text-shadow:
    0 0 20px rgba(255, 215, 0, 0.5),
    0 0 60px rgba(255, 215, 0, 0.2);
}

.start-sub {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.85rem;
  font-weight: 300;
  letter-spacing: 2px;
  margin-top: 1rem;
  position: relative;
  z-index: 2;
}

.pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100px;
  height: 100px;
  border: 1.5px solid rgba(255, 215, 0, 0.3);
  border-radius: 50%;
  animation: ring-expand 3s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.pulse-ring.ring-2 {
  animation-delay: 1.5s;
}

@keyframes ring-expand {
  0% {
    transform: translate(-50%, -50%) scale(0.6);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(3);
    opacity: 0;
  }
}

/* ============================================
   COUNTDOWN OVERLAY
   ============================================ */
#countdown-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

#countdown-overlay.active {
  opacity: 1;
}

#countdown-number {
  font-size: clamp(20vw, 30vw, 40vh);
  font-weight: 900;
  color: #FFD700;
  line-height: 1;
  text-shadow:
    0 0 30px rgba(255, 215, 0, 0.9),
    0 0 80px rgba(255, 215, 0, 0.5),
    0 0 120px rgba(255, 140, 0, 0.4),
    0 0 200px rgba(255, 80, 0, 0.2);
  opacity: 0;
  transform: scale(0.5);
}

#countdown-number.animate-in {
  animation: num-enter 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

#countdown-number.animate-out {
  animation: num-exit 0.5s cubic-bezier(0.55, 0, 1, 0.45) forwards;
}

@keyframes num-enter {
  0% {
    opacity: 0;
    transform: scale(0.3);
    filter: blur(10px);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
}

@keyframes num-exit {
  0% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
  100% {
    opacity: 0;
    transform: scale(2.5);
    filter: blur(8px);
  }
}

/* ============================================
   REPLAY BUTTON
   ============================================ */
#replay-btn {
  position: fixed;
  bottom: clamp(20px, 5vh, 50px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: rgba(255, 215, 0, 0.08);
  border: 1px solid rgba(255, 215, 0, 0.25);
  color: #FFD700;
  padding: 14px 36px;
  font-size: 0.95rem;
  font-family: 'Be Vietnam Pro', sans-serif;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 60px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease, background 0.3s ease, transform 0.3s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

#replay-btn.visible {
  opacity: 1;
  pointer-events: auto;
}

#replay-btn:hover {
  background: rgba(255, 215, 0, 0.2);
  transform: translateX(-50%) scale(1.05);
}

#replay-btn:active {
  transform: translateX(-50%) scale(0.97);
}

.replay-icon {
  display: inline-block;
  transition: transform 0.4s ease;
}

#replay-btn:hover .replay-icon {
  transform: rotate(-360deg);
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  .phone-icon-wrap,
  .gate-arrow,
  .pulse-ring,
  #countdown-number {
    animation: none !important;
  }

  #countdown-number.animate-in {
    opacity: 1;
    transform: scale(1);
    filter: none;
  }
}
