/* =========================
   CORE & FONTS
========================= */
@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@400;600;700&family=Orbitron:wght@500;700;900&display=swap');

* {
  box-sizing: border-box;
}

body, html {
  margin: 0;
  padding: 0;
  overflow: hidden;
  
  width: 100%;
  font-family: 'Rajdhani', sans-serif;
  /* Dark Blue Gradient Background */
  background: linear-gradient(135deg, #050a15 0%, #0a152e 100%);
  color: #fff;
}

canvas {
  display: block;
  outline: none;
}

/* =========================
   UI VARIABLES
========================= */
:root {
  --primary: #2979ff;       
  --secondary: #00e5ff;     
  --accent: #00b0ff;        
  
  --glass: rgba(10, 20, 40, 0.85);
  --glass-light: rgba(20, 35, 60, 0.7);
  
  --border: rgba(100, 200, 255, 0.2);
  --border-bright: rgba(0, 229, 255, 0.5);
  
  --glow-primary: 0 0 20px rgba(41, 121, 255, 0.6);
  --glow-cyan: 0 0 20px rgba(0, 229, 255, 0.6);
}
:root {
  --navbar-height: 20px;
}
:root {
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* =========================
   HUD (WASD & INFO)
========================= */
#hud {
  position: fixed;
  bottom: 20px;
  
  left: 40px;
  user-select: none;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  
  transition: opacity 0.3s;
  transform: translateZ(0);
}

.row {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.key {
  width: 55px;
  height: 55px;
  background: var(--glass);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 2px solid var(--border);
  border-bottom: 4px solid var(--primary);
  color: white;
  font-size: 1.3rem;
  font-weight: 700;
  font-family: 'Orbitron', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  box-shadow: 
    0 4px 15px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.1);
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  text-shadow: 0 0 8px var(--primary);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.key::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.key:hover::before {
  left: 100%;
}

.key.active, .key:active {
  transform: translateY(3px) scale(0.95);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #000;
  font-weight: 900;
  border-bottom: 1px solid var(--primary);
  box-shadow: 
    0 0 25px var(--primary),
    0 0 40px rgba(41, 121, 255, 0.4),
    inset 0 2px 8px rgba(0,0,0,0.3);
  text-shadow: 0 0 10px rgba(255,255,255,0.8);
}

/* =========================
   MINIMAP & TOP BAR
========================= */
#top-bar {
  /* Ensure clicks pass through empty space so we can look around in game */
  pointer-events: none; 
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
}

.minimap {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 3px solid var(--border-bright);
  box-shadow: 
    0 0 30px rgba(0, 229, 255, 0.3),
    0 8px 20px rgba(0,0,0,0.6),
    inset 0 0 15px rgba(0,0,0,0.5);
  overflow: hidden;
  position: fixed;
  right: 25px;
  top: 25px;
  background: #000;
  /* Enable clicking the minimap even if top-bar is pass-through */
  pointer-events: auto; 
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.minimap:hover {
  transform: scale(1.08) rotate(2deg);
  border-color: var(--primary);
  box-shadow: 
    0 0 40px var(--primary),
    0 12px 30px rgba(0,0,0,0.7);
}

/* =========================
   FULLMAP & CLOSE BUTTON (FIXED)
========================= */
#fullmap {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.97);
  display: none;
  z-index: 100000; /* Extremely high Z-Index */
  align-items: center;
  justify-content: center;
  pointer-events: auto; /* Ensure map is interactive */
}

#closeMapBtn {
  position: fixed;
  top: 30px;
  right: 30px;
  z-index: 100001; /* Must be higher than #fullmap */
  padding: 14px 30px;
  background: linear-gradient(135deg, #c00, #800);
  color: white;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  display: none;
  pointer-events: auto !important; /* Force clickable */
  box-shadow: 0 0 15px rgba(0,0,0,0.5);
}

#closeMapBtn:hover {
  background: linear-gradient(135deg, #e00, #a00);
  transform: scale(1.05);
}

/* =========================
   NAVBAR (FIXED & RESPONSIVE)
========================= */
.navbar {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  min-width: 340px;
  max-width: 90%;
  height: 64px;
  
  display: flex;
  align-items: center;
  justify-content: space-between;
  
  padding: 0 24px;
  z-index: 10001; /* Above map (1000) */
  
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(0,0,0,0.35));
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.18);
  
  box-shadow:
    0 20px 40px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.12);
    
  pointer-events: auto; /* Clickable */
  transition: all 0.3s ease;
}

.nav-logo {
  font-family: 'Orbitron', sans-serif;
  font-weight: 800;
  letter-spacing: 1px;
  font-size: 1.2rem;
  color: #fff;
  text-shadow: 0 0 10px var(--secondary);
  user-select: none;
  margin-right: 20px;
}

.nav-links {
  display: flex;
  gap: 15px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links button {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.6px;
  position: relative;
  padding: 8px 12px;
  color: rgba(255,255,255,0.85);
  transition: color 0.25s ease, transform 0.2s ease;
}

.nav-links button:hover {
  color: #ffffff;
  transform: translateY(-1px);
  text-shadow: 0 0 8px var(--secondary);
}

.nav-links button::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 0;
  height: 2px;
  background: var(--secondary);
  transform: translateX(-50%);
  transition: width 0.25s ease;
}

.nav-links button:hover::after {
  width: 60%;
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  width: 28px;
  background: none;
  border: none;
  padding: 0;
}

.hamburger span {
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,0.9);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.2s ease;
}

/* =========================
   LOADING SCREEN
========================= */
.progress-bar-container {
  position: fixed;
  inset: 0;
  background: #000;
  background-image: 
    radial-gradient(circle at 20% 80%, rgba(41, 121, 255, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(0, 229, 255, 0.15) 0%, transparent 50%),
    radial-gradient(circle at center, #050a15 0%, #000 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

label {
  color: var(--secondary);
  font-size: 2.5rem;
  font-weight: 700;
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 8px;
  margin-bottom: 30px;
  text-shadow: 
    0 0 20px var(--secondary),
    0 0 40px rgba(0, 229, 255, 0.5);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.02); }
}

#progress-bar {
  width: 400px;
  height: 8px;
  border: none;
  background: rgba(30, 40, 60, 0.5);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 
    inset 0 2px 8px rgba(0,0,0,0.5),
    0 0 15px rgba(0, 229, 255, 0.2);
}

#progress-bar::-webkit-progress-bar { 
  background: rgba(10, 20, 30, 0.8); 
  border-radius: 6px;
}

#progress-bar::-webkit-progress-value { 
  background: linear-gradient(90deg, var(--accent), var(--primary), var(--secondary));
  box-shadow: 
    0 0 15px var(--primary),
    0 0 25px rgba(41, 121, 255, 0.5);
  border-radius: 6px;
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
  100% { filter: brightness(1); }
}

/* =========================
   INTERACTION PROMPT
========================= */
#interactPrompt {
  
  position: fixed;
  bottom: 18%;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 2px solid var(--border-bright);
  color: var(--secondary);
  padding: 14px 32px;
  border-radius: 50px;
  font-size: 1.2rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  z-index: 2000;
  display: none;
  opacity: 0;
  animation: floatUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  box-shadow: 
    0 0 25px rgba(0, 229, 255, 0.4),
    0 8px 20px rgba(0,0,0,0.3);
}
@media (pointer: coarse) {
  #interactPrompt{
    width:150px !important;
  
  }
}

@keyframes floatUp {
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

b { 
  color: white; 
  text-shadow: 0 0 10px var(--secondary);
}

/* =========================
   POPUP / MODAL
========================= */
#missionPopupOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(12px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 3000;
  padding: 20px;
  cursor: auto;
  pointer-events: all;
  

  
}

#missionPopup {
  background: var(--glass);
  backdrop-filter: blur(25px);
  border: 2px solid var(--border);
  border-top: 5px solid var(--primary);
  border-radius: 16px;
  padding: 0;
  color: #fff;
  width: 100%;
  max-width: 950px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 
    0 25px 60px rgba(0,0,0,0.7),
    0 0 40px rgba(41, 121, 255, 0.2);
  animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@media (max-width: 768px) {
  #missionPopup {
    max-height: calc(100dvh - var(--navbar-height) - var(--safe-bottom));
  }

  #missionContent {
    padding-bottom: calc(30px + var(--safe-bottom));
  }
}


#missionTitle {
  margin: 0;
  padding: 25px 30px;
  background: linear-gradient(135deg, rgba(41, 121, 255, 0.15), rgba(0, 229, 255, 0.05));
  font-size: 2.3rem;
  font-family: 'Orbitron', sans-serif;
  color: var(--primary);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  text-shadow: 0 0 15px rgba(41, 121, 255, 0.5);
  letter-spacing: 3px;
}

#missionContent {
  padding: 25px 30px;
  font-size: 1.15rem;
  line-height: 1.8;
  color: #e0e0e0;
  overflow-y: auto;
  flex: 1;
}
/* =========================
   MOBILE POPUP ALIGNMENT FIX
========================= */
@media (max-width: 768px) {
  #missionPopupOverlay {
    top: var(--navbar-height);
    height: calc(100vh - var(--navbar-height));
    padding-top: 10px;
  }

  #missionPopup {
    max-height: calc(100vh - var(--navbar-height) - 20px);
  }
}

/* =========================
   GALLERY (CAROUSEL)
========================= */
.hero-gallery {
  position: relative;
  width: 100%;
  height: 450px;
  background: linear-gradient(135deg, #050a15 0%, #0a1520 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-top: auto;
  border-top: 1px solid var(--border);
}

.gallery-track {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  perspective: 1200px;
}

.gallery-item {
  position: absolute;
  transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: 12px;
  overflow: hidden;

  box-shadow: 0 15px 40px rgba(0,0,0,0.6);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-item.hero {
  z-index: 10;
  transform: scale(1);
  opacity: 1;
  width: 65%;
  height: 85%;
  border: 3px solid var(--border-bright);
  box-shadow: 
    0 20px 50px rgba(0,0,0,0.7),
    0 0 30px rgba(0, 229, 255, 0.3);
}

.gallery-item.small {
  z-index: 5;
  transform: translateX(70%) scale(0.75) rotateY(-15deg);
  opacity: 0.179;
  width: 45%;
  height: 65%;
  filter: grayscale(80%) brightness(0.7);
  border: 2px solid rgba(255,255,255,0.1);
}

.gallery-item.small:first-child {
  transform: translateX(-70%) scale(0.75) rotateY(15deg);
}

.gallery-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: var(--glass-light);
  backdrop-filter: blur(10px);
  border: 2px solid var(--border);
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 20;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
}

.gallery-btn:hover { 
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-color: transparent;
  transform: translateY(-50%) scale(1.1);
  box-shadow: 
    0 8px 25px rgba(41, 121, 255, 0.4),
    0 0 20px var(--primary);
}

.gallery-btn.left { left: 20px; }
.gallery-btn.right { right: 20px; }
/* =========================
   EVENT LIST CONTAINER
========================= */
.event-list {
  display: flex;  
  position: absolute;
  /* flex-direction: row; */
  width: 85%;
  max-width: 700px;

  max-height: 90%;    
  margin: 20px auto;  
  
  
  

  border-radius: 14px;

  background: rgba(0, 20, 60, 0.6);

  border: 1px solid rgba(0, 240, 255, 0.35);

  box-shadow:
    0 0 15px rgba(0, 240, 255, 0.25);

  overflow-y: auto;   
  overflow-x: hidden;

  box-sizing: border-box;
}
.event-list {
  padding-bottom: calc(30px + var(--safe-bottom));
}

/* =========================
   LIST RESET
========================= */
.event-list ul {
  list-style: none;
  padding: 0;
  margin: 10px;
  margin-bottom:5px;
  margin-left: 15px;


}

/* =========================
   LIST ITEMS
========================= */
.event-list li {
  padding: 14px 18px;
  margin-bottom: 20px;
  margin-top:20px ;
  width: 320px;
  height: 350px;
  border-radius: 10px;
  


  background: linear-gradient(
    90deg,
    rgba(0, 60, 160, 0.8),
    rgba(0, 120, 255, 0.6)
  );

  border: 1px solid rgba(0, 240, 255, 0.5);

  color: #fff;
  font-weight: 600;
  letter-spacing: 1px;

  transition: all 0.25s ease;
  cursor: pointer;
}

/* Hover */
.event-list li:hover {
  transform: translateY(-3px);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.6);
  background: linear-gradient(
    90deg,
    rgba(0, 120, 255, 0.9),
    rgba(0, 240, 255, 0.7)
  );
}

/* =========================
   CLEAN SCROLLBAR
========================= */
.event-list::-webkit-scrollbar {
  width: 6px;
}

.event-list::-webkit-scrollbar-thumb {
  background: rgba(0, 240, 255, 0.6);
  border-radius: 10px;
}

.event-list::-webkit-scrollbar-track {
  background: transparent;
}
.event-list::after{
  content: "";
  display: block;
  height: 20px;
} 
@media (pointer:coarse){
  .event-list{
    flex-direction: column;
    margin: 25px;
    width: 80vw;
    height: 95vh;
    gap: 20px;
    justify-content: space-around;
    align-items: center;
    
  }

  .event-list .ul{
    margin-left: 10px;
    
    
    
    list-style: none;
    padding: 0;
    flex-direction: column;
    
 
  }
  .event-list ul li{
    margin-left: 10px;
    margin-right: 10px;
    height: 38vh;
    width: 72vw;
    display: block;
    margin-bottom: 15px;

    margin-top: 5px;
    
  }
}

#closePopup {
  margin: 0px 30px 25px auto;
  padding: 12px 40px;
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s;
  
}
#closePopup {
  margin-bottom: calc(25px + var(--safe-bottom)) !important;
}


#closePopup:hover {
  background: var(--primary);
  color: #000;
  box-shadow: 
    0 0 25px var(--primary),
    0 8px 20px rgba(41, 121, 255, 0.3);
}

@media (pointer: coarse){
  .gallery-item.small{
    opacity: 0;
  }
  .gallery-item.hero{
    width: 95%;
    height: 95%;
  }
  .gallery-btn.left{
    left: 10px;
  }
  .gallery-btn.right{
    right:10px;
  }
}
/* =========================
   MOBILE CONTROLS (Joystick)
========================= */
/* =========================
   MOBILE CONTROLS (Strict Touch Logic)
========================= */
#mobile-controls { 
  display: none !important; /* HIDDEN BY DEFAULT */
  pointer-events: none;
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 1000;
}

#joystick {
  display: none !important; /* HIDDEN BY DEFAULT */
  width: 120px;
  height: 120px;
  background: var(--glass);
  border: 3px solid var(--border-bright);
  border-radius: 50%;
  touch-action: none;
  position: relative;
  pointer-events: auto;
}

.stick {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 50%;
  box-shadow: 0 0 10px var(--primary);
}

/* =========================
   RESPONSIVE LAYOUT
========================= */

/* --- GENERAL MOBILE UI ADJUSTMENTS (Applies to small screens regardless of input) --- */
@media (max-width: 768px) {
  /* Navbar & Map adjustments for small screens */
  #closeMapBtn {
    top: 20px !important;
    right: 20px !important;
    padding: 10px 20px !important;
    font-size: 14px !important;
    width: auto !important;
    display: none; 
  }
  
  .navbar {
    top: 15px;
    width: 90%;
    padding: 0 16px;
    z-index: 10001;
  }

  .hamburger {
    display: flex;
  }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    flex-direction: column;
    padding: 20px;
    gap: 16px;
    margin-top: 12px;
    background: rgba(20,20,25,0.95);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.15);
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
  }

  .nav-links.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
  }

  .nav-links button {
    width: 100%;
    text-align: center;
    padding: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }

  /* Hamburger Animation */
  .hamburger.active span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  .hamburger.active span:nth-child(2) { opacity: 0; }
  .hamburger.active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

  /* Move Minimap to avoid navbar overlap */
  .minimap {
    width: 100px;
    height: 100px;
    top: 90px; 
    right: 15px;
  }
}

/* --- STRICT INPUT-BASED VISIBILITY (The Fix) --- */

/* 1. TOUCH DEVICES (Strict Logic)
   Only show joystick if the pointer is COARSE (finger) AND screen is < 1024px */
@media (pointer: coarse)  {
  #hud {
    display: none !important; /* Hide WASD on touch */
  }
  
  #mobile-controls, #joystick {
    display: block !important; /* Show Joystick */
  }

  /* Move prompt up so joystick doesn't cover it */
  #interactPrompt {
    bottom: 140px; 
    font-size: 14px;
    padding: 10px 16px;
    width: 80%;
    text-align: center;
  }
}

/* 2. MOUSE/DESKTOP DEVICES (Strict Logic)
   If the pointer is FINE (mouse/trackpad), NEVER show joystick, even on small windows */
@media (pointer: fine) {
  #mobile-controls, #joystick {
    display: none !important; /* Kill joystick */
  }
  #hud {
    display: flex !important; /* Force WASD */
  }
}

/* Touch Device Safety (Ensure buttons are large enough for fingers) */
@media (hover: none) {
  button {
    min-height: 44px;
    min-width: 44px;
  }
}

.no-scroll {
  overflow: hidden;
  touch-action: none;
}



