:root {
  --bg: #05070e;
  --surface: rgba(15, 20, 36, 0.66);
  --surface-border: rgba(255, 255, 255, 0.1);
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent-1: #60a5fa;
  --accent-2: #a78bfa;
  --accent-3: #34d399;
  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

html,
body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(95px);
  opacity: 0.4;
  will-change: transform;
}

.orb-1 {
  width: 520px;
  height: 520px;
  top: -140px;
  left: -120px;
  background: radial-gradient(circle, rgba(96, 165, 250, 0.75), transparent 70%);
  animation: floatOrb1 18s ease-in-out infinite alternate;
}

.orb-2 {
  width: 580px;
  height: 580px;
  bottom: -180px;
  right: -140px;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.7), transparent 70%);
  animation: floatOrb2 22s ease-in-out infinite alternate;
}

.orb-3 {
  width: 380px;
  height: 380px;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(52, 211, 153, 0.32), transparent 70%);
  animation: pulseOrb 14s ease-in-out infinite alternate;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 75% 70% at 50% 50%, #000 35%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 75% 70% at 50% 50%, #000 35%, transparent 100%);
}

.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  width: 100%;
  padding: clamp(16px, 3vw, 32px);
  display: flex;
  justify-content: center;
  align-items: center;
}

.stage-card {
  position: relative;
  width: 100%;
  max-width: 640px;
  padding: clamp(24px, 4vw, 40px);
  border-radius: 28px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  overflow: hidden;
}

.card-glow {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: radial-gradient(
    420px circle at var(--mx, 50%) var(--my, 20%),
    rgba(96, 165, 250, 0.14),
    transparent 65%
  );
  pointer-events: none;
}

.scene-wrap {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

.waiting-scene {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

/* Vector Man Sitting & Waiting Animations */
.aura-pulse {
  transform-origin: 260px 175px;
  animation: auraPulse 4s ease-in-out infinite alternate;
}

.wait-bubble {
  transform-origin: 350px 70px;
  animation: bubbleBob 3.6s ease-in-out infinite alternate;
}

.dot {
  animation: dotPulse 1.5s ease-in-out infinite;
}
.dot-1 { animation-delay: 0s; }
.dot-2 { animation-delay: 0.25s; }
.dot-3 { animation-delay: 0.5s; }

.steam {
  animation: steamRise 3s ease-in-out infinite;
}
.steam-2 {
  animation-delay: 1.3s;
}

.torso-group {
  transform-origin: 264px 212px;
  animation: torsoBreathe 3.8s ease-in-out infinite;
}

.head-group {
  transform-origin: 264px 104px;
  animation: headCheckTime 5.2s ease-in-out infinite;
}

.eyes {
  transform-origin: 269px 76px;
  animation: eyeBlink 4.6s ease-in-out infinite;
}

.watch-arm {
  transform-origin: 294px 128px;
  animation: checkWatch 5.2s ease-in-out infinite;
}

.watch-glow {
  animation: watchPulse 2s ease-in-out infinite;
}

.tapping-foot {
  transform-origin: 274px 294px;
  animation: footTap 0.9s ease-in-out infinite;
}

.divider {
  width: 100%;
  height: 1px;
  margin: 18px 0 22px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.14), transparent);
}

/* Countdown */
.countdown {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.time-box {
  flex: 1 1 0;
  max-width: 104px;
  min-width: 62px;
  padding: 14px 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.09);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.time-box:hover {
  transform: translateY(-3px);
  border-color: rgba(96, 165, 250, 0.45);
}

.time-value {
  font-family: var(--font-mono);
  font-size: clamp(1.35rem, 3.8vw, 2rem);
  font-weight: 600;
  line-height: 1;
  color: var(--text);
}

.time-value.tick {
  animation: tickPop 0.35s ease;
}

.time-label {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.time-sep {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  color: rgba(255, 255, 255, 0.28);
  padding-bottom: 14px;
}

.reveal {
  opacity: 0;
  transform: translateY(16px);
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--delay, 0s);
}

@keyframes fadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes floatOrb1 {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(65px, 45px) scale(1.12); }
}

@keyframes floatOrb2 {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-70px, -50px) scale(1.15); }
}

@keyframes pulseOrb {
  from { transform: translate(-50%, -50%) scale(0.92); opacity: 0.28; }
  to { transform: translate(-50%, -50%) scale(1.18); opacity: 0.46; }
}

@keyframes auraPulse {
  from { opacity: 0.72; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1.04); }
}

@keyframes bubbleBob {
  from { transform: translateY(0); }
  to { transform: translateY(-7px); }
}

@keyframes dotPulse {
  0%, 80%, 100% { transform: scale(0.75); opacity: 0.45; }
  40% { transform: scale(1.18); opacity: 1; }
}

@keyframes steamRise {
  0% { transform: translateY(4px); opacity: 0; }
  35% { opacity: 0.65; }
  100% { transform: translateY(-10px); opacity: 0; }
}

@keyframes torsoBreathe {
  0%, 100% { transform: translateY(0) scaleY(1); }
  50% { transform: translateY(-2px) scaleY(1.015); }
}

@keyframes headCheckTime {
  0%, 40%, 100% { transform: rotate(0deg); }
  55%, 78% { transform: rotate(9deg) translate(2px, 1px); }
}

@keyframes checkWatch {
  0%, 38%, 100% { transform: rotate(0deg); }
  52%, 78% { transform: rotate(-16deg) translate(-2px, -4px); }
}

@keyframes eyeBlink {
  0%, 44%, 48%, 92%, 96%, 100% { transform: scaleY(1); }
  46%, 94% { transform: scaleY(0.1); }
}

@keyframes watchPulse {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}

@keyframes footTap {
  0%, 100% { transform: rotate(0deg); }
  40% { transform: rotate(-11deg); }
}

@keyframes tickPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.08); color: var(--accent-1); }
  100% { transform: scale(1); }
}

@media (max-width: 480px) {
  .stage-card {
    padding: 20px 14px 24px;
    border-radius: 22px;
  }

  .countdown {
    gap: 6px;
  }

  .time-sep {
    display: none;
  }

  .time-box {
    padding: 11px 6px;
    border-radius: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
