/* ===== V24 Cyberpunk City Gateway — Root Variables ===== */
:root {
  --primary:   #ff00ff;
  --secondary: #00ffff;
  --accent:    #ffff00;
  --surface:   rgba(10, 5, 15, 0.85);
  --text:      #fdf4ff;
  --text-dim:  rgba(253, 244, 255, 0.55);
  --pink-glow:  rgba(255, 0, 255, 0.5);
  --cyan-glow:  rgba(0, 255, 255, 0.5);
  --yellow-glow: rgba(255, 255, 0, 0.5);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: radial-gradient(ellipse at center, #0d001a 0%, #050010 60%, #000005 100%);
  color: var(--text);
  font-family: 'Chakra Petch', sans-serif;
  height: 100vh;
  overflow: hidden;
}

/* ===== Three.js Canvas Container ===== */
#three-container {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
}

#three-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ===== CSS Rain Overlay (z-index: 1) ===== */
.rain-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

/* Individual rain drop — generated dynamically in script.js */
.rain-drop {
  position: absolute;
  top: -20px;
  width: 1px;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(0, 255, 255, 0.6),
    rgba(255, 0, 255, 0.3)
  );
  animation: fall linear infinite;
  animation-duration: var(--fall-dur, 1.4s);
  animation-delay: var(--fall-delay, 0s);
  left: var(--fall-x, 50%);
  height: var(--fall-height, 80px);
  opacity: 0.7;
}

@keyframes fall {
  0%   { transform: translateY(0); opacity: 0.7; }
  100% { transform: translateY(110vh); opacity: 0.2; }
}

/* ===== Gate Reveal Overlay (z-index: 2) ===== */
.gate-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 2;
  pointer-events: none;
  /* Vivid vertical gradient split — reveals from center outward */
  background: linear-gradient(
    180deg,
    rgba(255, 0, 255, 0.08) 0%,
    rgba(0, 255, 255, 0.08) 50%,
    rgba(255, 0, 255, 0.08) 100%
  );
  clip-path: inset(0 50%);
  transition: clip-path 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.gate-overlay.open {
  clip-path: inset(0 0%);
}

/* ===== Interface HUD Overlay (z-index: 3) ===== */
.interface-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 3;
  pointer-events: none;
}

/* ===== HUD Corner Boxes ===== */
.hud-box {
  position: absolute;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-family: 'Chakra Petch', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.hud-box.top-left  {
  left: 20px;
  border-left: 2px solid rgba(0, 255, 255, 0.4);
  padding-left: 10px;
}

.hud-box.top-right {
  right: 20px;
  border-right: 2px solid rgba(255, 0, 255, 0.4);
  padding-right: 10px;
  text-align: right;
}

.accent-cyan   { color: var(--secondary); text-shadow: 0 0 8px var(--cyan-glow); }
.accent-yellow { color: var(--accent);    text-shadow: 0 0 8px var(--yellow-glow); }
.accent-pink   { color: var(--primary);   text-shadow: 0 0 8px var(--pink-glow); }

/* ===== Center Stage ===== */
.center-stage {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 4;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
}

/* ===== Glass Panel (Glassmorphism) ===== */
.glass-panel {
  pointer-events: all;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 36px 44px;
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 0, 255, 0.3);
  border-radius: 4px;
  box-shadow:
    0 0 30px rgba(255, 0, 255, 0.12),
    0 0 60px rgba(0, 255, 255, 0.08),
    inset 0 0 40px rgba(10, 5, 15, 0.6);
  min-width: 320px;
  max-width: 440px;
  width: 90vw;
}

/* ===== Decorative Corner Brackets ===== */
.corner {
  position: absolute;
  width: 16px;
  height: 16px;
  display: block;
}

.corner.tl { top: 8px; left: 8px;   border-top: 2px solid var(--secondary); border-left: 2px solid var(--secondary); }
.corner.tr { top: 8px; right: 8px;  border-top: 2px solid var(--primary);   border-right: 2px solid var(--primary); }
.corner.bl { bottom: 8px; left: 8px;   border-bottom: 2px solid var(--primary);   border-left: 2px solid var(--primary); }
.corner.br { bottom: 8px; right: 8px;  border-bottom: 2px solid var(--secondary); border-right: 2px solid var(--secondary); }

/* ===== Neon Title Text ===== */
.neon-text {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(28px, 7vw, 44px);
  font-weight: 700;
  letter-spacing: 6px;
  text-align: center;
  color: var(--primary);
  /* Triple neon text-shadow */
  text-shadow:
    0 0 10px #ff00ff,
    0 0 40px #ff00ff,
    0 0 80px #ff00ff;
  line-height: 1.15;
  animation: neon-flicker 4s ease-in-out infinite;
}

/* Subtle neon flicker animation */
@keyframes neon-flicker {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
    text-shadow:
      0 0 10px #ff00ff,
      0 0 40px #ff00ff,
      0 0 80px #ff00ff;
    opacity: 1;
  }
  20%, 24%, 55% {
    text-shadow: none;
    opacity: 0.8;
  }
}

/* Brightened state after gate open */
.neon-text.bright {
  text-shadow:
    0 0 10px #ff00ff,
    0 0 40px #ff00ff,
    0 0 80px #ff00ff,
    0 0 120px #ff00ff,
    0 0 200px #ff00ff;
  animation: none;
}

/* ===== Status Text ===== */
.status-text {
  font-family: 'Chakra Petch', sans-serif;
  font-size: clamp(11px, 2.5vw, 13px);
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--secondary);
  text-transform: uppercase;
  text-shadow: 0 0 8px var(--cyan-glow);
  text-align: center;
  min-height: 20px;
  transition: color 0.4s ease, text-shadow 0.4s ease;
}

.status-text.loading {
  color: var(--accent);
  text-shadow: 0 0 8px var(--yellow-glow);
  animation: status-blink 0.7s steps(1) infinite;
}

.status-text.success {
  color: var(--primary);
  text-shadow:
    0 0 8px var(--pink-glow),
    0 0 20px var(--pink-glow);
  animation: none;
}

@keyframes status-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ===== Access Button ===== */
.access-btn {
  position: relative;
  overflow: hidden;
  font-family: 'Chakra Petch', sans-serif;
  font-size: clamp(14px, 3.5vw, 16px);
  font-weight: 700;
  letter-spacing: 4px;
  color: #0a050f;
  background: linear-gradient(135deg, #ff00ff 0%, #cc00cc 50%, #ff00ff 100%);
  border: none;
  padding: 16px 44px;
  border-radius: 2px;
  cursor: pointer;
  min-width: 220px;
  min-height: 52px; /* touch target ≥ 44px */
  text-transform: uppercase;
  transition:
    transform 0.2s cubic-bezier(0.68, -0.55, 0.265, 1.55),
    box-shadow 0.2s ease;
  box-shadow:
    0 0 20px var(--pink-glow),
    0 4px 24px rgba(255, 0, 255, 0.35);
}

.access-btn:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.04);
  box-shadow:
    0 0 30px var(--pink-glow),
    0 8px 40px rgba(255, 0, 255, 0.5);
}

.access-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.access-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Button scan-line shine sweep */
.access-btn::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
  animation: btn-scan 2.4s ease-in-out infinite;
}

@keyframes btn-scan {
  0%   { left: -100%; }
  100% { left: 200%; }
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
  .glass-panel {
    padding: 28px 22px;
    gap: 20px;
    border-radius: 3px;
  }

  .hud-box { display: none; }

  .access-btn {
    padding: 16px 30px;
    min-width: 180px;
    letter-spacing: 2px;
  }
}

/* ===== Reduced Motion Fallback ===== */
@media (prefers-reduced-motion: reduce) {
  .neon-text,
  .neon-text.bright,
  .status-text,
  .status-text.loading,
  .access-btn::after,
  .rain-drop,
  .gate-overlay {
    animation: none !important;
    transition: none !important;
  }

  .gate-overlay.open {
    clip-path: inset(0 0%) !important;
  }

  .access-btn:hover:not(:disabled) { transform: none; }
}
