/* ============================================
   CINEMATIC WELCOME POP-UP STYLES
   ============================================ */

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

/* Main Welcome Overlay */
#welcomeOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #000000;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  opacity: 1;
  transition: opacity 1s ease;
}

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

/* Lock body scroll when welcome is active */
body.welcome-active {
  overflow: hidden !important;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* Animated Canvas Background */
#galaxyCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Welcome Content Container */
.welcome-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 600px;
  padding: 40px;
  /* Use backwards fill mode so it doesn't lock opacity at the end */
  animation: fadeInContent 1.5s ease backwards 0.5s;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              filter 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.welcome-content.dimmed {
  opacity: 0.25;
  filter: blur(6px);
  transform: scale(0.96);
  pointer-events: none;
}

@keyframes fadeInContent {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

/* Typewriter Prompt */
.welcome-prompt {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.8rem;
  font-weight: 300;
  color: #ffffff;
  margin-bottom: 20px;
  letter-spacing: 2px;
  line-height: 1.6;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.typewriter-text {
  border-right: 3px solid rgba(255, 255, 255, 0.8);
  padding-right: 8px;
  animation: blink 0.8s step-end infinite;
  display: inline-block;
}

@keyframes blink {
  50% {
    border-color: transparent;
  }
}

/* Glowing Input Field */
.name-input-container {
  position: relative;
  margin: 40px auto;
  max-width: 450px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

#nameInput {
  width: 100%;
  padding: 20px 30px;
  font-size: 1.5rem;
  font-family: 'Poppins', sans-serif;
  font-weight: 400;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50px;
  outline: none;
  text-align: center;
  letter-spacing: 1px;
  transition: all 0.4s ease;
  backdrop-filter: blur(10px);
  box-shadow: 0 0 30px rgba(0, 150, 255, 0.2);
}

#nameInput::placeholder {
  color: rgba(255, 255, 255, 0.4);
  font-weight: 300;
}

#nameInput:focus {
  border-color: rgba(0, 200, 255, 0.8);
  box-shadow: 0 0 50px rgba(0, 150, 255, 0.6),
              0 0 100px rgba(0, 150, 255, 0.3),
              inset 0 0 20px rgba(0, 150, 255, 0.1);
  background: rgba(255, 255, 255, 0.08);
  transform: scale(1.02);
}

/* Submit Button */
.submit-name-btn {
  width: 100%;
  min-height: 48px;
  padding: 15px 30px;
  font-size: 1.2rem;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  color: #000000;
  background: linear-gradient(135deg, #00d4ff, #0099ff);
  border: none;
  border-radius: 50px;
  outline: none;
  cursor: pointer;
  letter-spacing: 2px;
  text-transform: uppercase;
  transition: all 0.3s ease;
  box-shadow: 0 0 30px rgba(0, 150, 255, 0.4);
}

.submit-name-btn:hover {
  background: linear-gradient(135deg, #00ffcc, #00d4ff);
  box-shadow: 0 0 50px rgba(0, 200, 255, 0.8);
  transform: translateY(-2px);
}

.submit-name-btn:active {
  transform: translateY(0);
}

/* Validation Hint */
.validation-hint {
  font-family: 'Poppins', sans-serif;
  font-size: 0.95rem;
  color: #ff6b6b;
  text-align: center;
  margin-top: -5px;
  letter-spacing: 0.5px;
  font-weight: 400;
  animation: shake 0.5s ease;
}

/* Anonymous Entry Button - Premium Golden/Black theme with glow */
.anonymous-btn {
  width: 100%;
  min-height: 42px;
  padding: 11px 30px;
  font-size: 0.88rem;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  color: #ffd700;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: 50px;
  outline: none;
  cursor: pointer;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  margin-top: -4px;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.anonymous-btn:hover {
  color: #0a0a0f;
  border-color: #ffd700;
  background: linear-gradient(135deg, #ffd700, #ffb300);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.5), 0 0 10px rgba(255, 255, 255, 0.2);
}

.anonymous-btn:active {
  transform: translateY(0) scale(1);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
  transition: all 0.1s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* VARAD Highlight */
.highlight-varad {
  background: #FFE066;
  color: #000;
  padding: 0 4px;
  border-radius: 3px;
  font-weight: 600;
}

/* Welcome Reveal Screen */
.welcome-reveal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 3;
  opacity: 0;
  pointer-events: none;
}

.welcome-reveal.active {
  opacity: 1;
  pointer-events: all;
}

.welcome-message {
  font-family: 'Montserrat', sans-serif;
  font-size: 2.5rem;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 20px;
  letter-spacing: 3px;
  opacity: 0;
  transform: translateY(30px);
}

.welcome-message.show {
  animation: slideUpFade 1s ease forwards;
}

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

.visitor-name {
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(1.8rem, 4.5vw, 4rem); /* Responsive fitting */
  font-weight: 900;
  max-width: 90vw; /* Keep inside safe container */
  line-height: 1.3; /* Balanced line wrapping */
  text-align: center;
  text-wrap: balance; /* Elegant wrapping */
  padding: 0 15px; /* Safe horizontal padding */
  
  /* Default Color */
  background: linear-gradient(135deg, #00d4ff, #0099ff, #00ffcc);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 2px; /* Controlled spacing to prevent overflow */
  text-transform: uppercase;
  opacity: 0;
  transform: scale(0.5);
  animation: nameExplosion 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards 0.3s,
             gradientShift 3s ease infinite;
  text-shadow: 0 0 80px rgba(0, 200, 255, 0.8);
  filter: drop-shadow(0 0 30px rgba(0, 200, 255, 0.6));
}

/* Emoji fixing inside visitor-name */
.visitor-name .emoji {
  -webkit-text-fill-color: initial;
  color: initial;
  text-shadow: none;
  filter: drop-shadow(0 0 15px rgba(255,255,255,0.2));
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  vertical-align: middle;
  line-height: 1;
  display: inline-block;
  transform: translateY(-5%);
}

/* ============================================
   EMOTIONAL PERSONALITY COLOR SYSTEM
   ============================================ */

/* Danger / Powerful: fiery red-orange glow, ember accents */
.visitor-name.personality-danger {
  background: linear-gradient(135deg, #ff4d00, #ff8c00, #ff2a00);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  text-shadow: 0 0 80px rgba(255, 77, 0, 0.6);
  filter: drop-shadow(0 0 30px rgba(255, 77, 0, 0.5));
}

/* Mystery / Unknown: dark purple-blue cinematic gradient */
.visitor-name.personality-mystery {
  background: linear-gradient(135deg, #8a2be2, #4b0082, #191970);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  text-shadow: 0 0 60px rgba(75, 0, 130, 0.8);
  filter: drop-shadow(0 0 20px rgba(75, 0, 130, 0.6));
}

/* Legend / Aura: gold-black luxury glow */
.visitor-name.personality-legend {
  background: linear-gradient(135deg, #ffd700, #ffb300, #ffdf00);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  text-shadow: 0 0 80px rgba(255, 215, 0, 0.5);
  filter: drop-shadow(0 0 25px rgba(255, 215, 0, 0.4));
}

/* Main Character: green-black cinematic energy */
.visitor-name.personality-main-character {
  background: linear-gradient(135deg, #00ff87, #00b050, #00ff87);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  text-shadow: 0 0 80px rgba(0, 255, 135, 0.6);
  filter: drop-shadow(0 0 30px rgba(0, 255, 135, 0.5));
}

/* Silent / Stealth: silver-white elegant tones */
.visitor-name.personality-silent {
  background: linear-gradient(135deg, #f0f0f0, #ffffff, #cccccc);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  text-shadow: 0 0 60px rgba(255, 255, 255, 0.5);
  filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.4));
}

/* Cool / Funny: cyan-purple smooth gradients */
.visitor-name.personality-cool {
  background: linear-gradient(135deg, #00f2fe, #4facfe, #8360c3);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  text-shadow: 0 0 80px rgba(79, 172, 254, 0.6);
  filter: drop-shadow(0 0 30px rgba(79, 172, 254, 0.5));
}

@keyframes nameExplosion {
  0% {
    opacity: 0;
    transform: scale(0.5) rotate(-5deg);
  }
  50% {
    transform: scale(1.15) rotate(2deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@keyframes gradientShift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.welcome-tagline {
  font-family: 'Poppins', sans-serif;
  font-size: 1.3rem;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 30px;
  letter-spacing: 2px;
  opacity: 0;
  animation: fadeInUp 1s ease forwards 1s;
}

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

/* Shockwave Effect */
.shockwave {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 50px;
  height: 50px;
  border: 3px solid rgba(0, 200, 255, 0.8);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  opacity: 1;
  pointer-events: none;
}

.shockwave.active {
  animation: shockwaveExpand 1.5s ease-out forwards;
}

@keyframes shockwaveExpand {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(30);
    opacity: 0;
  }
}

/* Particle Burst Effect */
.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #00d4ff;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 10px #00d4ff;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .welcome-content {
    padding: 20px;
    max-width: 90%;
  }

  .welcome-prompt {
    font-size: 1.3rem;
    min-height: 100px;
    letter-spacing: 1px;
  }

  #nameInput {
    font-size: 1.2rem;
    padding: 18px 25px;
  }

  .welcome-message {
    font-size: 1.8rem;
    letter-spacing: 2px;
  }

  .welcome-tagline {
    font-size: 1rem;
    letter-spacing: 1px;
  }
}

@media (max-width: 480px) {
  .welcome-prompt {
    font-size: 1.1rem;
    min-height: 90px;
  }

  #nameInput {
    font-size: 1rem;
    padding: 15px 20px;
  }

  .welcome-message {
    font-size: 1.4rem;
  }

  .welcome-tagline {
    font-size: 0.9rem;
  }

  .enter-instruction {
    font-size: 0.8rem;
  }
}

/* Loading State */
.loading-dots {
  display: inline-block;
  font-size: 2rem;
  letter-spacing: 5px;
}

.loading-dots span {
  animation: dotPulse 1.4s infinite;
  opacity: 0;
}

.loading-dots span:nth-child(1) {
  animation-delay: 0s;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

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

/* ============================================
   TASK 4: CINEMATIC LOGO INTRO ANIMATION
   ============================================ */
.logo-intro-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.logo-intro-overlay.active {
  opacity: 1;
}

.logo-intro-img {
  width: clamp(250px, 40vw, 550px);
  object-fit: contain;
  opacity: 0;
  transform: scale(0.8);
  filter: drop-shadow(0 0 0px rgba(255, 215, 0, 0));
}

.logo-intro-img.animate {
  animation: logoCinematic 1.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes logoCinematic {
  0% {
    opacity: 0;
    transform: scale(0.8);
    filter: drop-shadow(0 0 0px rgba(255, 215, 0, 0)) brightness(0.5);
  }
  30% {
    opacity: 1;
    transform: scale(1.05);
    filter: drop-shadow(0 0 30px rgba(255, 215, 0, 0.6)) brightness(1.2);
  }
  70% {
    opacity: 1;
    transform: scale(1.1);
    filter: drop-shadow(0 0 40px rgba(255, 215, 0, 0.8)) brightness(1.5);
  }
  100% {
    opacity: 0;
    transform: scale(1.5);
    filter: drop-shadow(0 0 50px rgba(255, 215, 0, 0)) brightness(2);
  }
}
