.jelly-section {
  position: relative;
  width: 100%;
  min-height: 700px;
  overflow: hidden;
  pointer-events: none;
}

.jelly-stage {
  position: relative;
  width: min(1100px, 100%);
  height: 700px;
  margin: 0 auto;
}

.jelly {
  position: absolute;
  width: var(--size);
  aspect-ratio: 1 / 1.38;
  color: var(--jelly-color);
  opacity: var(--opacity, 1);
  pointer-events: auto;
  cursor: pointer;

  --base-x: 0px;
  --mouse-x: 0px;
  --mouse-y: 0px;
  --hover-scale: 1;

  transform:
    translateX(var(--base-x))
    translate3d(var(--mouse-x), var(--mouse-y), 0)
    scale(var(--hover-scale));

  translate: 0 0;

  filter:
    drop-shadow(0 16px 20px rgba(0, 50, 90, 0.18))
    drop-shadow(0 0 10px var(--jelly-glow));

  animation:
    jellyFloat var(--float-duration) ease-in-out infinite,
    jellyDrift var(--drift-duration) ease-in-out infinite;

  animation-delay: var(--delay);
  transition:
    transform 0.35s ease,
    filter 0.35s ease,
    opacity 0.35s ease;
}

.jelly::before {
  content: "";
  position: absolute;
  inset: 18% 16% 10% 16%;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(1, 80, 172, 0.16) 0%,
    rgba(0, 64, 182, 0.1) 35%,
    rgba(0, 79, 182, 0.03) 60%,
    transparent 75%
  );
  filter: blur(18px);
  z-index: -1;
  animation: waterGlow 5s ease-in-out infinite;
  pointer-events: none;
}

.jelly:hover {
  --hover-scale: 1.05;
  filter:
    drop-shadow(0 20px 24px rgba(0, 50, 90, 0.22))
    drop-shadow(0 0 18px var(--jelly-glow));
  opacity: 1;
}

.jelly svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.jelly-body {
  fill: transparent;
  stroke: currentColor;
  stroke-width: 3.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.jelly-line,
.jelly-smile {
  fill: transparent;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.8;
}

.jelly-bow {
  fill: transparent;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.95;
}

.jelly-bow-knot {
  fill: transparent;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.95;
}

.tentacle {
  fill: transparent;
  stroke: currentColor;
  stroke-width: 2.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.82;
  transform-origin: 50% 50%;
  animation: tentacleCuteMove 3.8s ease-in-out infinite;
}

.tentacle:nth-of-type(odd) {
  animation-delay: -1.1s;
}

.tentacle:nth-of-type(even) {
  animation-delay: -2s;
}

/* Main */
.jelly-main {
  --size: clamp(290px, 34vw, 440px);
  --jelly-color: #155eb3;
  --jelly-glow: rgba(0, 107, 161, 0.34);
  --float-duration: 7s;
  --drift-duration: 9.8s;
  --delay: -1s;
  --opacity: 1;

  left: 50%;
  top: 80px;
  --base-x: -50%;
  z-index: 5;
}

/* Small */
.jelly-1 {
  --size: clamp(110px, 13vw, 165px);
  --jelly-color: #155eb3;
  --jelly-glow: rgba(0, 119, 182, 0.28);
  --float-duration: 8s;
  --drift-duration: 10.5s;
  --delay: -2.5s;
  --opacity: 0.88;

  left: 75%;
  top: 90px;
  z-index: 3;
}

.jelly-2 {
  --size: clamp(95px, 11vw, 145px);
  --jelly-color: #155eb3;
  --jelly-glow: rgba(0, 91, 138, 0.28);
  --float-duration: 7.4s;
  --drift-duration: 9.8s;
  --delay: -3.2s;
  --opacity: 0.84;

  left: 16%;
  top: 150px;
  z-index: 2;
}

.jelly-3 {
  --size: clamp(120px, 15vw, 185px);
  --jelly-color: #155eb3;
  --jelly-glow: rgba(0, 131, 193, 0.26);
  --float-duration: 8.8s;
  --drift-duration: 11.5s;
  --delay: -4.2s;
  --opacity: 0.82;

  left: 21%;
  top: 445px;
  z-index: 3;
}

.jelly-4 {
  --size: clamp(80px, 10vw, 120px);
  --jelly-color: #155eb3;
  --jelly-glow: rgba(0, 96, 143, 0.24);
  --float-duration: 7.8s;
  --drift-duration: 10.8s;
  --delay: -1.8s;
  --opacity: 0.78;

  left: 70%;
  top: 500px;
  z-index: 1;
}

@keyframes jellyFloat {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -24px; }
}

@keyframes jellyDrift {
  0%, 100% { margin-left: 0; }
  50% { margin-left: 18px; }
}

@keyframes tentacleCuteMove {
  0%, 100% { transform: skewX(0deg) translateY(0); }
  50% { transform: skewX(4deg) translateY(5px); }
}

@keyframes waterGlow {
  0%, 100% {
    transform: scale(0.96);
    opacity: 0.65;
  }
  50% {
    transform: scale(1.06);
    opacity: 1;
  }
}

/* Tablet */
@media (max-width: 900px) {
  .jelly-section {
    min-height: 690px;
  }

  .jelly-stage {
    height: 690px;
  }

  .jelly-main {
    --size: clamp(270px, 48vw, 380px);
    left: 50%;
    top: 70px;
  }

  .jelly-1 {
    left: 77%;
    top: 105px;
  }

  .jelly-2 {
    left: 8%;
    top: 150px;
  }

  .jelly-3 {
    left: 14%;
    top: 480px;
  }

  .jelly-4 {
    left: 72%;
    top: 515px;
  }
}

/* Mobile */
@media (max-width: 600px) {
  .jelly-section {
    min-height: 760px;
  }

  .jelly-stage {
    height: 760px;
  }

  .jelly-main {
    --size: clamp(240px, 76vw, 315px);
    left: 50%;
    top: 35px;
    --base-x: -50%;
    z-index: 5;
  }

  /* پایین‌تر و با فاصله بیشتر از بزرگه */
  .jelly-1 {
    --size: 96px;
    left: 12%;
    top: 445px;
    z-index: 3;
  }

  .jelly-2 {
    --size: 82px;
    left: 42%;
    top: 490px;
    z-index: 3;
  }

  .jelly-3 {
    --size: 105px;
    left: 64%;
    top: 440px;
    z-index: 3;
  }

  .jelly-4 {
    --size: 76px;
    left: 35%;
    top: 610px;
    z-index: 3;
  }
}

@media (max-width: 380px) {
  .jelly-section {
    min-height: 740px;
  }

  .jelly-stage {
    height: 740px;
  }

  .jelly-main {
    --size: 235px;
    top: 35px;
  }

  .jelly-1 {
    --size: 84px;
    left: 10%;
    top: 425px;
  }

  .jelly-2 {
    --size: 74px;
    left: 42%;
    top: 470px;
  }

  .jelly-3 {
    --size: 92px;
    left: 65%;
    top: 420px;
  }

  .jelly-4 {
    --size: 70px;
    left: 34%;
    top: 585px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .jelly,
  .jelly::before,
  .tentacle {
    animation: none !important;
  }
}