/* ==========================================
   LOADING SCREEN & WELCOME UI
   ========================================== */
#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #0f172a;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s ease, visibility 0.8s;
  overflow: hidden;
}

/* 🔥 3D Faded Globe Network Background Container */
.loading-bg-network {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  z-index: -1; overflow: hidden;
  background: radial-gradient(circle at center, rgba(15, 23, 42, 0.4) 0%, #0f172a 70%);
  /* Smooths out the 3D tilt applied via JS */
  transition: transform 0.1s ease-out;
  will-change: transform;
}

/* Radiating Radar Grid Lines */
.loading-bg-network::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 150vw; height: 150vw;
  /* Centering reset so we can cleanly control it in the keyframes */
  margin-top: -75vw; margin-left: -75vw;
  
  background: repeating-conic-gradient(
    from 0deg,
    transparent 0deg, transparent 4deg,
    rgba(99, 102, 241, 0.15) 4deg, rgba(99, 102, 241, 0.15) 4.5deg
  );
  animation: rotateNetwork 150s linear infinite;
  
  /* The bright core (spotlight) tracks the mouse cursor by 15% */
  -webkit-mask-image: radial-gradient(circle at calc(50% + var(--mouse-x, 0) * 15%) calc(50% + var(--mouse-y, 0) * 15%), black 10%, transparent 45%);
  mask-image: radial-gradient(circle at calc(50% + var(--mouse-x, 0) * 15%) calc(50% + var(--mouse-y, 0) * 15%), black 10%, transparent 45%);
  
  will-change: transform;
}

/* By shifting the physical center of the grid towards the mouse, 
   the rays mechanically bend and point directly at the cursor! */
@keyframes rotateNetwork {
  0% { transform: translate(calc(var(--mouse-x, 0) * 60px), calc(var(--mouse-y, 0) * 60px)) rotate(0deg); }
  100% { transform: translate(calc(var(--mouse-x, 0) * 60px), calc(var(--mouse-y, 0) * 60px)) rotate(360deg); }
}

/* 3D Scene Wrapper */
.globe-container {
  perspective: 1200px;
  opacity: 0.3;
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  /* Smooth out the mouse tracking parallax */
  transition: transform 0.2s ease-out;
  will-change: transform;
}

.globe {
  position: relative;
  width: 90vw; max-width: 500px;
  aspect-ratio: 1 / 1;
  transform-style: preserve-3d;
  animation: spinGlobe 25s linear infinite;
  border-radius: 50%;
  box-shadow: inset 0 0 80px rgba(99, 102, 241, 0.6), 0 0 50px rgba(99, 102, 241, 0.2);
}

/* Inner Glowing Core */
.globe::after {
  content: ''; position: absolute;
  top: 50%; left: 50%; width: 50%; height: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(99, 102, 241, 0.3), transparent 70%);
  filter: blur(20px);
}

/* Vertical Lines (Meridians) */
.globe-meridian {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  border-radius: 50%; border: 1px solid rgba(99, 102, 241, 0.4);
}
.m1 { transform: rotateY(0deg); }
.m2 { transform: rotateY(30deg); }
.m3 { transform: rotateY(60deg); }
.m4 { transform: rotateY(90deg); }
.m5 { transform: rotateY(120deg); }
.m6 { transform: rotateY(150deg); }

/* Horizontal Lines (Equator & Latitudes) */
.globe-equator {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  border-radius: 50%; border: 2px solid rgba(99, 102, 241, 0.6);
  transform: rotateX(90deg);
}
.globe-lat-top {
  position: absolute; top: 15%; left: 15%; width: 70%; height: 70%;
  border-radius: 50%; border: 1px solid rgba(99, 102, 241, 0.4);
  transform: rotateX(90deg) translateZ(120px);
}
.globe-lat-bottom {
  position: absolute; top: 15%; left: 15%; width: 70%; height: 70%;
  border-radius: 50%; border: 1px solid rgba(99, 102, 241, 0.4);
  transform: rotateX(90deg) translateZ(-120px);
}

/* The tilt reveals the 3D depth as it rotates */
@keyframes spinGlobe {
  0% { transform: rotateX(20deg) rotateY(0deg); }
  100% { transform: rotateX(20deg) rotateY(360deg); }
}

.loading-logo {
  width: 180px;
  height: auto;
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.2));
  animation: pulseLogo 2s infinite alternate;
}

/* Welcome Text Box */
.welcome-text-container {
  text-align: center;
  max-width: 550px;
  margin: 0 1.5rem 2.5rem;
  opacity: 0;
  transform: translateY(10px);
  animation: fadeUpWelcome 1s ease 0.3s forwards;
}

.welcome-text-container h2 {
  color: #fff;
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.8);
}

.welcome-text-container p {
  color: #cbd5e1;
  font-size: 0.95rem;
  line-height: 1.6;
  text-shadow: 0 2px 10px rgba(0,0,0,0.8);
}

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

.loading-bar-container {
  width: 250px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  transition: opacity 0.4s ease;
}

.loading-bar-fill {
  height: 100%;
  width: 0%;
  background: #6366f1;
  transition: width 0.3s ease-out;
}

.enter-map-btn {
  margin-top: -6px;
  padding: 0.75rem 2rem;
  background: #6366f1;
  color: #fff;
  font-family: inherit;
  font-weight: 600;
  font-size: 1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
  transition: all 0.3s ease;
  opacity: 1;
  transform: translateY(0);
}

.enter-map-btn:hover {
  background: #4f46e5;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.enter-map-btn.hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  position: absolute;
}

@keyframes pulseLogo {
  0% { transform: scale(0.95); opacity: 0.8; }
  100% { transform: scale(1.05); opacity: 1; }
}

/* ==========================================
   FLOATING UI COMPONENTS (Compass & Minimap)
   ========================================== */
.compass-btn {
  position: absolute;
  top: 2rem;
  left: 2rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 40;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.compass-btn svg {
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.compass-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.compass-btn:hover svg {
  transform: rotate(90deg);
}

#minimap {
  position: absolute;
  bottom: 2rem;
  left: 2rem;
  width: 200px;
  aspect-ratio: 16/9;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 20;
  cursor: grab;
  user-select: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#minimap:active {
  cursor: grabbing;
}

#minimap:hover {
  transform: scale(1.05);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7);
}

#minimap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
}

#minimap-rect {
  position: absolute;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.4);
  background: rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

/* ==========================================
   DONATION BUTTON & BADGES
   ========================================== */
.donation-btn {
  position: absolute;
  bottom: 2.2rem;
  left: calc(200px + 3.5rem);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border: 2px solid rgba(251, 191, 36, 0.6);
  color: #fbbf24;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), 0 0 15px rgba(251, 191, 36, 0.2);
  text-decoration: none;
}

.donation-btn::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent, rgba(251, 191, 36, 0.9), transparent 40%);
  animation: spinAura 3s linear infinite;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.donation-btn.pulsing::before,
.donation-btn:hover::before {
  opacity: 1;
}

.donation-btn:hover {
  transform: scale(1.1) translateY(-4px);
  background: rgba(30, 41, 59, 0.95);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6), 0 0 30px rgba(251, 191, 36, 0.5);
  border-color: #f59e0b;
  color: #fcd34d;
}

.donation-btn svg {
  width: 24px;
  height: 24px;
  transition: transform 0.4s ease;
}

.coffee-svg {
  width: 24px !important;
  height: 24px !important;
  color: #fbbf24;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
  transition: all 0.4s ease;
}

.donation-btn:hover .coffee-svg {
  color: #ffffff;
  transform: scale(1.1) rotate(-5deg);
  filter: drop-shadow(0 4px 12px rgba(255, 255, 255, 0.7));
}

.aroma-path-1,
.aroma-path-2,
.aroma-path-3 {
  opacity: 1;
  transform-origin: center center;
  animation: aroma-pulse 2s infinite ease-in-out;
}

.aroma-path-1 {
  animation-delay: 0s;
}

.aroma-path-2 {
  animation-delay: 0.3s;
}

.aroma-path-3 {
  animation-delay: 0.6s;
}

@keyframes aroma-pulse {
  0% {
    opacity: 0.1;
    transform: translateY(0px) scaleY(0.6);
  }

  50% {
    opacity: 1;
    transform: translateY(-5px) scaleY(1.1);
  }

  100% {
    opacity: 0.1;
    transform: translateY(-10px) scaleY(1.2);
  }
}

.donation-btn:hover svg {
  transform: rotate(-15deg) scale(1.1);
}

.donation-callout-card {
  position: absolute;
  bottom: calc(100% + 20px);
  left: 50%;
  transform: translateX(-20%) scale(0);
  transform-origin: bottom left;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 40%, #fbbf24 50%, #d97706 60%, #f59e0b 100%);
  background-size: 200% 200%;
  animation: cardShineBg 3s infinite linear;
  padding: 14px 20px;
  border-radius: 16px 16px 16px 4px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), 0 0 20px rgba(245, 158, 11, 0.4);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.donation-callout-card::after {
  content: '';
  position: absolute;
  bottom: -9px;
  left: 15%;
  border-width: 9px 9px 0 0;
  border-style: solid;
  border-color: #d97706 transparent transparent transparent;
}

.callout-title {
  font-size: 1.15rem;
  font-weight: 800;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.callout-subtitle {
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0.95;
}

/* 🔥 Ensure the card becomes clickable when shown */
.donation-callout-card.show,
.donation-btn:hover .donation-callout-card {
  transform: translateX(-20%) scale(1);
  opacity: 1;
  pointer-events: auto; 
}

@keyframes spinAura {
  100% {
    transform: rotate(360deg);
  }
}

@keyframes cardShineBg {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

.development-badge {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  padding: 0.4rem 1.5rem;
  border-radius: 0 0 12px 12px;
  font-size: 0.85rem;
  font-weight: 700;
  z-index: 9999;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-top: none;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.3s ease;
  display: flex;
  align-items: center;
}

.development-badge.hidden {
  opacity: 0;
  display: none;
}

.version-separator {
  margin: 0 8px;
  opacity: 0.6;
}

#version-text {
  font-family: monospace;
  letter-spacing: 0.5px;
  color: #fef08a;
}

.powered-by-badge {
  position: absolute;
  bottom: 2rem;
  right: 2rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.8rem;
  color: #94a3b8;
  z-index: 100;
  border: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: none;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.powered-by-badge strong {
  color: #249afb;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.loading-powered-by {
  right: auto;
  left: 50%;
  transform: translateX(-50%);
  bottom: 2rem;
  background: transparent;
  border: none;
  box-shadow: none;
  opacity: 0.7;
}

/* Ensure the 3D translation scales nicely on mobile */
@media (max-width: 768px) {
  .globe-lat-top { transform: rotateX(90deg) translateZ(80px); }
  .globe-lat-bottom { transform: rotateX(90deg) translateZ(-80px); }
}