:root {
  --bg-0: #02040b;
  --bg-1: #060a18;
  --cyan: #5fe9ff;
  --cyan-soft: #9af1ff;
  --cyan-dim: rgba(95, 233, 255, 0.18);
  --pink: #ff8fb6;
  --text: #eaf6ff;
  --text-dim: rgba(216, 234, 255, 0.62);
  --panel-bg: rgba(8, 16, 32, 0.42);
  --panel-border: rgba(120, 210, 255, 0.22);
  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, monospace;
}

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

html,
body {
  height: 100%;
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(120% 90% at 50% 8%, #0a1530 0%, var(--bg-1) 42%, var(--bg-0) 100%);
  color: var(--text);
  font-family: var(--font-display);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#globe-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  touch-action: none;
}

/* A soft vignette + glow that sits above the canvas but below the UI */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(75% 60% at 50% 45%, transparent 40%, rgba(2, 4, 11, 0.55) 100%);
}

/* ---------- Loader ---------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1.1rem;
  background: var(--bg-0);
  transition: opacity 0.8s ease;
}

.loader--hidden {
  opacity: 0;
  pointer-events: none;
}

.loader__ring {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid rgba(95, 233, 255, 0.18);
  border-top-color: var(--cyan);
  animation: spin 0.9s linear infinite;
}

.loader__text {
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Overlay / panel ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: clamp(1rem, 4vw, 2.5rem);
  padding-top: max(clamp(1rem, 4vw, 2.5rem), env(safe-area-inset-top));
  padding-bottom: max(clamp(1.2rem, 4vw, 2.5rem), env(safe-area-inset-bottom));
  pointer-events: none;
}

/* Flight status pill floating above the globe */
.status-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--cyan-soft);
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--cyan-dim);
  border-radius: 999px;
  background: rgba(8, 16, 32, 0.5);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  box-shadow:
    0 12px 32px -14px rgba(0, 0, 0, 0.85),
    0 0 34px -14px rgba(95, 233, 255, 0.55);
  animation: rise 1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.panel {
  pointer-events: auto;
  width: min(680px, 100%);
  padding: clamp(1.4rem, 3.5vw, 2.6rem);
  border-radius: 28px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow:
    0 30px 80px -30px rgba(0, 0, 0, 0.85),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 60px -20px rgba(95, 233, 255, 0.35);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  text-align: center;
  animation: rise 1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.985);
  }
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px 1px var(--cyan);
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.35;
    transform: scale(0.8);
  }
}

.panel__title {
  margin-top: 0;
  font-size: clamp(1.5rem, 5vw, 2.4rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.panel__title-accent {
  color: var(--cyan);
  text-shadow: 0 0 24px rgba(95, 233, 255, 0.55);
}

.panel__title-heart {
  display: inline-block;
  color: #d6213c;
  text-shadow: 0 0 18px rgba(214, 33, 60, 0.5);
  animation: heartbeat 1.6s ease-in-out infinite;
}

@keyframes heartbeat {
  0%,
  100% {
    transform: scale(1);
  }
  15% {
    transform: scale(1.22);
  }
  30% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.14);
  }
}

/* ---------- Countdown ---------- */
.countdown {
  margin-top: clamp(1.4rem, 4vw, 2rem);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(0.5rem, 2vw, 1rem);
}

.unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: clamp(0.7rem, 2.4vw, 1.1rem) 0.4rem;
  border-radius: 18px;
  background: linear-gradient(
    180deg,
    rgba(95, 233, 255, 0.08),
    rgba(95, 233, 255, 0.02)
  );
  border: 1px solid rgba(120, 210, 255, 0.14);
}

.unit__value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(1.9rem, 8vw, 3.4rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-shadow: 0 0 22px rgba(95, 233, 255, 0.45);
}

.unit__label {
  font-size: clamp(0.6rem, 2vw, 0.72rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ---------- Arrival state ---------- */
.arrival {
  margin-top: clamp(1.2rem, 4vw, 1.8rem);
  animation: rise 0.8s ease both;
}

.arrival__title {
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 700;
  color: var(--pink);
  text-shadow: 0 0 30px rgba(255, 143, 182, 0.55);
}

.arrival__subtitle {
  margin-top: 0.4rem;
  color: var(--text-dim);
  font-size: 1rem;
}

/* ---------- Arrival date (ETA) ---------- */
.eta {
  margin-top: clamp(1.5rem, 4vw, 2.1rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.eta__date {
  font-weight: 700;
  font-size: clamp(1.7rem, 6.5vw, 2.4rem);
  line-height: 1.08;
  color: var(--cyan);
  text-shadow: 0 0 26px rgba(95, 233, 255, 0.5);
}

.eta__date sup {
  font-size: 0.5em;
  vertical-align: super;
  margin-left: 0.04em;
}

.eta__time {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(1.2rem, 4.6vw, 1.7rem);
  letter-spacing: 0.02em;
  color: var(--text);
  text-shadow: 0 0 18px rgba(95, 233, 255, 0.3);
}

/* ---------- Responsive ---------- */
@media (max-width: 540px) {
  /* Keep all four units on a single row; scale them down to fit. */
  .countdown {
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(0.3rem, 1.4vw, 0.55rem);
  }

  .unit {
    padding: clamp(0.45rem, 2vw, 0.9rem) 0.2rem;
    border-radius: 12px;
    gap: 0.35rem;
  }

  .unit__value {
    font-size: clamp(1.15rem, 6.4vw, 2rem);
  }

  .unit__label {
    font-size: clamp(0.48rem, 1.9vw, 0.62rem);
    letter-spacing: 0.04em;
  }

  .panel {
    border-radius: 22px;
    padding-left: clamp(1rem, 4.5vw, 1.6rem);
    padding-right: clamp(1rem, 4.5vw, 1.6rem);
  }
}

/* Landscape phones: keep the panel compact so the globe stays visible */
@media (max-height: 480px) and (orientation: landscape) {
  .countdown {
    grid-template-columns: repeat(4, 1fr);
  }
  .panel {
    padding: 1rem 1.4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .status-dot,
  .loader__ring,
  .panel__title-heart {
    animation: none;
  }
  .panel,
  .arrival {
    animation: none;
  }
}
