/* ═══════════════════════════════════════════════════════════════
   FREECAST PATAGONIA — OPTICAL RIFLE SCOPE & RECOIL PRELOADER
   ═══════════════════════════════════════════════════════════════ */

#preloader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #040604;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: crosshair;
  overflow: hidden;
  padding: 1rem;
  user-select: none;
}

/* Background outside scope - dark ambient forest */
#stag-bg {
  position: absolute;
  inset: 0;
  background: url('img/real_stag_live.jpg') center 35%/cover no-repeat;
  filter: brightness(0.14) blur(6px);
  transform: scale(1.08);
}

/* Scope SVG Container */
#scope-svg {
  position: relative;
  z-index: 2;
  width: min(440px, 86vw);
  height: min(440px, 86vw);
  filter: drop-shadow(0 0 60px rgba(0, 0, 0, 0.95));
  transition: transform 0.1s ease-out;
}

/* Reticle crosshair pulse animation */
#reticle-group {
  animation: reticlePulse 3s infinite ease-in-out;
}

@keyframes reticlePulse {
  0%, 100% { opacity: 0.95; }
  50% { opacity: 0.8; }
}

/* RECOIL / SCREEN SHAKE ANIMATION */
@keyframes recoilShake {
  0% { transform: scale(1) translate(0, 0) rotate(0deg); }
  12% { transform: scale(1.12) translate(-6px, -24px) rotate(-2deg); }
  28% { transform: scale(1.06) translate(5px, 12px) rotate(1.5deg); }
  45% { transform: scale(1.03) translate(-3px, -6px) rotate(-1deg); }
  65% { transform: scale(1.01) translate(2px, 3px) rotate(0.5deg); }
  85% { transform: scale(1.005) translate(-1px, -1px); }
  100% { transform: scale(1) translate(0, 0) rotate(0deg); }
}

.recoil-active {
  animation: recoilShake 0.5s cubic-bezier(0.2, 0.9, 0.3, 1) forwards !important;
}

/* Muzzle flash */
#muzzle-flash {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: radial-gradient(circle at center, rgba(255, 240, 160, 0.98) 0%, rgba(240, 90, 20, 0.75) 30%, rgba(180, 40, 10, 0.4) 55%, transparent 75%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.08s ease-out;
}

/* Hit marker cross */
#hit-marker {
  position: absolute;
  z-index: 11;
  width: 70px;
  height: 70px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.3);
  opacity: 0;
  pointer-events: none;
  transition: all 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#hit-marker::before,
#hit-marker::after {
  content: '';
  position: absolute;
  background: #ff3322;
  box-shadow: 0 0 10px #ff3322;
}

#hit-marker::before {
  width: 3px;
  height: 100%;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
}

#hit-marker::after {
  height: 3px;
  width: 100%;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
}

/* Scope hint and trigger button */
.scope-controls {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  margin-top: 1.5rem;
}

#fire-btn {
  font-family: 'Inter', sans-serif;
  font-size: clamp(0.78rem, 2.2vw, 0.88rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent-gold, #c29b62);
  background: rgba(18, 24, 20, 0.9);
  border: 1px solid var(--accent-gold, #c29b62);
  padding: 14px 36px;
  border-radius: 4px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: all 0.25s ease;
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  gap: 10px;
}

#fire-btn:hover {
  background: var(--accent-gold, #c29b62);
  color: #0a0d0a;
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(194, 155, 98, 0.45);
}

#scope-hint {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

/* Brand header in preloader */
#preloader-brand {
  position: absolute;
  top: 1.8rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

#preloader-logo {
  height: clamp(34px, 5vw, 44px);
  width: auto;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.8));
}

#preloader-brand-text {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  color: #fff;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
}

#preloader-brand-text em {
  font-family: 'Cormorant Garamond', serif;
  color: var(--accent-gold, #c29b62);
  font-style: italic;
  text-transform: none;
  margin-left: 4px;
}
