/* НЕА Хелоуин – украсата не пречи на кликовете по сайта (pointer-events: none),
   с изключение на паяците, тиквата и бутона за скриване. */

.nea-hw { pointer-events: none; z-index: 9990; }
.nea-hw * { box-sizing: border-box; }
.nea-hw-top { position: absolute; top: 0; left: 0; width: 100%; height: 0; overflow: visible; }
.nea-hw-fixed { position: fixed; inset: 0; overflow: hidden; }

/* ---------- паяжини ---------- */
.nea-web { position: absolute; top: 0; opacity: .95; filter: drop-shadow(0 0 1px rgba(40,40,60,.55)); }
.nea-web svg { display: block; }
.nea-web-l { left: 0; }
.nea-web-r { right: 0; transform: scaleX(-1); }

/* ---------- паяци ---------- */
.nea-spider {
  position: absolute; top: 0;
  width: var(--size); margin-left: calc(var(--size) / -2);
}
.nea-spider-drop {
  position: relative;
  transform: translateY(calc(var(--len) * -1 - 80px));
  animation:
    nea-drop 1.8s cubic-bezier(.25,1.35,.5,1) var(--delay) forwards,
    nea-bob var(--bob) ease-in-out calc(var(--delay) + 1.8s) infinite;
}
.nea-thread {
  position: absolute; left: 50%; bottom: calc(100% - 26%);
  width: 1px; height: 1600px; margin-left: -.5px;
  background: linear-gradient(to bottom, rgba(110,110,120,.2), rgba(110,110,120,.7));
}
.nea-spider-body {
  display: block; width: var(--size); height: var(--size);
  padding: 0; border: 0; background: none; cursor: pointer;
  pointer-events: auto;
  filter: drop-shadow(0 3px 3px rgba(0,0,0,.25));
  -webkit-tap-highlight-color: transparent;
}
.nea-spider-body svg { width: 100%; height: 100%; display: block; overflow: visible; }
.nea-legs-l, .nea-legs-r { transform-box: fill-box; }
.nea-legs-l { transform-origin: right center; }
.nea-legs-r { transform-origin: left center; }
.nea-flee .nea-legs-l { animation: nea-wiggle .12s ease-in-out infinite alternate; }
.nea-flee .nea-legs-r { animation: nea-wiggle .12s ease-in-out infinite alternate-reverse; }
.nea-flee .nea-spider-body { pointer-events: none; }

/* посочен паяк бяга нагоре по нишката, после се връща */
.nea-flee .nea-spider-drop { animation: nea-flee .7s cubic-bezier(.5,0,.8,.3) forwards; }

@keyframes nea-drop {
  from { transform: translateY(calc(var(--len) * -1 - 80px)); }
  to   { transform: translateY(var(--len)); }
}
@keyframes nea-bob {
  0%, 100% { transform: translateY(var(--len)) rotate(0deg); }
  50%      { transform: translateY(calc(var(--len) - 14px)) rotate(4deg); }
}
@keyframes nea-flee {
  from { transform: translateY(var(--len)); }
  to   { transform: translateY(calc(var(--len) * -1 - 80px)); }
}
@keyframes nea-wiggle { from { transform: rotate(-7deg); } to { transform: rotate(7deg); } }

/* ---------- паяци, които ходят ---------- */
.nea-walker {
  position: absolute; left: 0; top: 0;
  will-change: transform;
  filter: drop-shadow(0 3px 2px rgba(0,0,0,.28));
}
.nea-walker svg { width: 100%; height: 100%; display: block; overflow: visible; }
.nea-walker .nea-legs-l { animation: nea-step var(--step) ease-in-out infinite alternate; }
.nea-walker .nea-legs-r { animation: nea-step var(--step) ease-in-out infinite alternate-reverse; }
.nea-walker.nea-still .nea-legs-l, .nea-walker.nea-still .nea-legs-r { animation-play-state: paused; }
.nea-walker-big { filter: drop-shadow(0 5px 4px rgba(0,0,0,.3)); }
@keyframes nea-step { from { transform: rotate(-10deg) scaleY(.92); } to { transform: rotate(10deg) scaleY(1.05); } }

/* ---------- прилепи ---------- */
.nea-bat {
  position: absolute; left: 0; width: var(--size);
  animation: nea-fly var(--fly) linear forwards;
}
.nea-bat-rtl { animation-name: nea-fly-rtl; }
.nea-bat-rtl .nea-bat-wave { transform: scaleX(-1); }
.nea-bat-wave { animation: nea-wave 1.6s ease-in-out infinite; }
.nea-bat svg { width: 100%; height: auto; display: block; overflow: visible; filter: drop-shadow(0 2px 2px rgba(0,0,0,.2)); }
.nea-wing { transform-box: fill-box; }
.nea-wing-l { transform-origin: right center; animation: nea-flap .22s ease-in-out infinite alternate; }
.nea-wing-r { transform-origin: left center; animation: nea-flap .22s ease-in-out infinite alternate; }

@keyframes nea-fly     { from { transform: translateX(-120px); } to { transform: translateX(calc(100vw + 120px)); } }
@keyframes nea-fly-rtl { from { transform: translateX(calc(100vw + 120px)); } to { transform: translateX(-120px); } }
@keyframes nea-wave    { 0%, 100% { translate: 0 0; } 50% { translate: 0 -22px; } }
@keyframes nea-flap    { from { transform: scaleY(1); } to { transform: scaleY(.3); } }

/* ---------- тиква и бутон ---------- */
.nea-corner {
  position: absolute;
  left: max(14px, env(safe-area-inset-left, 0px));
  bottom: max(14px, env(safe-area-inset-bottom, 0px));
  display: flex; align-items: flex-end; gap: 8px;
}
.nea-pumpkin {
  width: 58px; height: 54px; padding: 0; border: 0; background: none; cursor: pointer;
  pointer-events: auto;
  filter: drop-shadow(0 0 10px rgba(255,150,40,.55)) drop-shadow(0 4px 4px rgba(0,0,0,.2));
  transition: transform .2s;
  -webkit-tap-highlight-color: transparent;
}
.nea-pumpkin:hover { transform: translateY(-3px) rotate(-4deg); }
.nea-pumpkin svg { width: 100%; height: 100%; display: block; }
.nea-face { animation: nea-flicker 2.4s infinite; }
.nea-boo { animation: nea-boo .6s cubic-bezier(.3,1.6,.5,1); }
@keyframes nea-flicker {
  0%, 100% { opacity: 1; } 42% { opacity: .78; } 45% { opacity: 1; } 70% { opacity: .85; } 72% { opacity: 1; }
}
@keyframes nea-boo { 0% { transform: scale(1); } 40% { transform: scale(1.35) rotate(8deg); } 100% { transform: scale(1); } }

.nea-hw-hide {
  pointer-events: auto; cursor: pointer;
  font: 600 12px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #3b2a55; background: rgba(255,255,255,.88);
  border: 1px solid rgba(59,42,85,.25); border-radius: 999px;
  padding: 6px 10px; margin-bottom: 6px;
  opacity: .55; transition: opacity .2s;
}
.nea-hw-hide:hover, .nea-hw-hide:focus-visible { opacity: 1; }

/* ---------- шапка на вещица за роботчето НЕА AI ---------- */
.nea-hw-hat .bggpt-launcher { position: relative; overflow: visible; }
.nea-hw-hat .bggpt-launcher::before {
  content: ""; position: absolute; z-index: 2; pointer-events: none;
  width: 62%; aspect-ratio: 60 / 46; left: 19%; top: -21%;
  transform: rotate(-10deg);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 46'%3E%3Cellipse cx='30' cy='38' rx='29' ry='7' fill='%233b2a55'/%3E%3Cpath d='M13 37 L29 4 Q33 -2 38 4 Q35 4 34 8 L47 37 Z' fill='%234a3470'/%3E%3Crect x='14.5' y='29' width='31' height='6' rx='1' fill='%23f58b2a'/%3E%3Crect x='27' y='28' width='7' height='8' rx='1.2' fill='none' stroke='%23ffd34d' stroke-width='1.6'/%3E%3C/svg%3E") center / contain no-repeat;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.25));
}

@media (max-width: 700px) {
  .nea-pumpkin { width: 46px; height: 43px; }
}

@media (prefers-reduced-motion: reduce) {
  .nea-spider-drop { animation: none; transform: translateY(var(--len)); }
  .nea-flee .nea-spider-drop { animation: none; }
  .nea-face, .nea-wing-l, .nea-wing-r, .nea-bat-wave, .nea-flee .nea-legs-l, .nea-flee .nea-legs-r { animation: none; }
}

@media print { .nea-hw { display: none !important; } }
