/* Sihirli Havuz + Ejder Yuvası sahne v2 — canlı sahne + sinematik kutlama
   Eski video: ses_birlestirme.mp4 / ses_patlama.mp4 / cumle_loop.mp4 / cumle_patlama.mp4
   Geri almak: window.NovaPoolLegacyBg = true  (veya POOL_SCENE_V2 = false) */

/* Arka plan = Sıra Sende ile aynı döngü videosu. Karartma videonun üstünde. */
.birles-pool--scene .birles-pool__veil {
  display: none !important;
}

.birles-pool--scene .birles-pool__stagebox {
  background: #b7e4f5;
}
.birles-play--cumle.birles-pool--scene .birles-pool__stagebox {
  background: #c4a36a;
}

.birles-pool-scene,
.birles-pool-cheer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.birles-pool-scene {
  z-index: 1;
  contain: paint;
}
.birles-pool-cheer {
  z-index: 4;
  --cheer-y: 62%;
  opacity: 0;
  visibility: hidden;
}
/* Kutlama çizimi doğru cevap videosunun üstüne binmesin */
.birles-pool--scene .birles-pool-cheer {
  display: none !important;
}
.birles-play--cumle .birles-pool-cheer {
  --cheer-y: 66%;
}
.birles-play--pool.is-scene-cheer .birles-pool-cheer {
  opacity: 1;
  visibility: visible;
}

/* —— Arka plan: yavaş nefes + ışık —— */
.bps__artwrap {
  position: absolute;
  inset: -10%;
}
.bps__art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 46%;
  display: block;
  animation: bpsKen 22s ease-in-out infinite alternate;
  will-change: transform;
}
.birles-play--cumle .bps__art {
  object-position: center 58%;
  animation-duration: 26s;
}
@keyframes bpsKen {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-2.2%, 1.4%, 0) scale(1.08); }
}

.bps__rays {
  position: absolute;
  left: 50%;
  top: -8%;
  width: 120%;
  height: 72%;
  transform: translateX(-50%);
  background: repeating-conic-gradient(
    from 0deg at 50% 8%,
    transparent 0 18deg,
    rgba(255, 250, 220, 0.14) 18deg 21deg
  );
  animation: bpsRaysIdle 36s linear infinite;
  opacity: 0.7;
}
.birles-play--cumle .bps__rays {
  top: -4%;
  height: 58%;
  background: repeating-conic-gradient(
    from 0deg at 50% 6%,
    transparent 0 20deg,
    rgba(253, 230, 138, 0.2) 20deg 23deg
  );
}
@keyframes bpsRaysIdle {
  from { transform: translateX(-50%) rotate(0deg); }
  to { transform: translateX(-50%) rotate(360deg); }
}

.bps__shine {
  position: absolute;
  left: -35%;
  width: 42%;
  bottom: 8%;
  height: 38%;
  border-radius: 50%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.38), transparent);
  animation: bpsShineSweep 6.8s ease-in-out infinite;
}
.birles-play--cumle .bps__shine {
  bottom: 18%;
  height: 28%;
  background: linear-gradient(90deg, transparent, rgba(255, 236, 180, 0.32), transparent);
}
@keyframes bpsShineSweep {
  0% { transform: translate3d(0, 0, 0); opacity: 0; }
  18% { opacity: 0.75; }
  58% { transform: translate3d(210%, 6%, 0); opacity: 0.12; }
  100% { transform: translate3d(210%, 6%, 0); opacity: 0; }
}

.bps__caustic {
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 7%;
  height: 36%;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 28% 40%, rgba(255, 255, 255, 0.34) 0%, transparent 46%),
    radial-gradient(ellipse at 72% 58%, rgba(165, 243, 252, 0.28) 0%, transparent 50%);
  animation: bpsCaustic 7.2s ease-in-out infinite;
}
.birles-play--cumle .bps__caustic {
  bottom: 16%;
  height: 26%;
  background:
    radial-gradient(ellipse at 40% 30%, rgba(253, 224, 71, 0.22) 0%, transparent 55%),
    radial-gradient(ellipse at 60% 70%, rgba(255, 237, 180, 0.18) 0%, transparent 50%);
}
@keyframes bpsCaustic {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.55; }
  50% { transform: translate3d(4%, -3%, 0) scale(1.06); opacity: 0.9; }
}

.bps__spark {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 10px rgba(255, 250, 220, 0.95);
  animation: bpsSpark 5.8s ease-in-out infinite;
}
.bps__spark--1 { left: 20%; bottom: 30%; }
.bps__spark--2 { left: 66%; bottom: 36%; width: 6px; height: 6px; animation-delay: 1.2s; }
.bps__spark--3 { left: 44%; bottom: 22%; animation-delay: 2.1s; }
.bps__spark--4 { left: 78%; bottom: 26%; width: 5px; height: 5px; animation-delay: 3.2s; }
.bps__spark--5 { left: 32%; bottom: 40%; width: 6px; height: 6px; animation-delay: 0.6s; }
.bps__spark--6 { left: 56%; bottom: 18%; animation-delay: 4s; }
.birles-play--cumle .bps__spark {
  background: #fde68a;
  box-shadow: 0 0 10px rgba(253, 224, 71, 0.85);
}
.birles-play--cumle .bps__spark--1 { left: 26%; bottom: 40%; }
.birles-play--cumle .bps__spark--2 { left: 64%; bottom: 46%; }
.birles-play--cumle .bps__spark--3 { left: 48%; bottom: 34%; }
.birles-play--cumle .bps__spark--4 { left: 74%; bottom: 38%; }
.birles-play--cumle .bps__spark--5 { left: 18%; bottom: 52%; }
.birles-play--cumle .bps__spark--6 { left: 58%; bottom: 28%; }
@keyframes bpsSpark {
  0%, 100% { transform: translate3d(0, 0, 0) scale(0.6); opacity: 0.2; }
  50% { transform: translate3d(0, -16px, 0) scale(1.15); opacity: 1; }
}

.bps__dim,
.birles-pool__dimcover,
.birles-sirala__dimcover {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: #000;
  opacity: 0.5;
  pointer-events: none;
  transition: none;
}
.birles-play--pool.is-scene-cheer .bps__dim,
.birles-play--pool.is-scene-revealed .bps__dim,
.birles-play--pool.is-scene-revealed .birles-pool__dimcover,
.birles-sirala.is-scene-revealed .birles-sirala__dimcover {
  opacity: 0;
  transition: opacity 2.8s ease;
}

/* —— Ejder: idle göz kırpma; doğru cevapta kanat + sevinç —— */
.birles-play--pool:not(.birles-play--cumle) .bps__drake {
  display: none;
}
.bps__drake {
  position: absolute;
  left: 24%;
  bottom: 6%;
  width: 52%;
  max-width: 340px;
  aspect-ratio: 473 / 396;
  z-index: 2;
  transform-origin: 50% 88%;
  filter: drop-shadow(0 8px 8px rgba(40, 18, 4, 0.32));
}
.bps__drake-idle,
.bps__drake-flap {
  position: absolute;
  inset: 0;
}
.bps__drake-flap {
  opacity: 0;
  visibility: hidden;
}
.birles-play--cumle.is-scene-cheer .bps__drake-idle {
  opacity: 0;
  visibility: hidden;
}
.birles-play--cumle.is-scene-cheer .bps__drake-flap {
  opacity: 1;
  visibility: visible;
}
.bps__drake-f {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.bps__drake-f--open {
  animation: bpsBlinkOpen 3.6s step-end infinite;
}
.bps__drake-f--blink {
  animation: bpsBlinkShut 3.6s step-end infinite;
}
.birles-play--cumle.is-scene-cheer .bps__drake-f--open,
.birles-play--cumle.is-scene-cheer .bps__drake-f--blink {
  animation: none;
}
@keyframes bpsBlinkOpen {
  0%, 86%, 94%, 100% { opacity: 1; }
  88%, 92% { opacity: 0; }
}
@keyframes bpsBlinkShut {
  0%, 86%, 94%, 100% { opacity: 0; }
  88%, 92% { opacity: 1; }
}
.birles-play--cumle.is-scene-cheer .bps__drake {
  animation: bpsDrakeHop 1.15s cubic-bezier(0.22, 1.15, 0.36, 1) both;
}
.birles-play--cumle.is-scene-cheer .bps__drake-f--up {
  animation: bpsFlapA 0.14s steps(1) infinite;
}
.birles-play--cumle.is-scene-cheer .bps__drake-f--down {
  animation: bpsFlapB 0.14s steps(1) infinite;
}
@keyframes bpsFlapA {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
@keyframes bpsFlapB {
  0%, 49% { opacity: 0; }
  50%, 100% { opacity: 1; }
}
@keyframes bpsDrakeHop {
  0% { transform: translate3d(0, 0, 0) rotate(0deg); }
  14% { transform: translate3d(0, -22%, 0) rotate(-8deg); }
  30% { transform: translate3d(2%, -6%, 0) rotate(6deg); }
  46% { transform: translate3d(0, -26%, 0) rotate(-10deg); }
  64% { transform: translate3d(-2%, -8%, 0) rotate(8deg); }
  82% { transform: translate3d(0, -14%, 0) rotate(-4deg); }
  100% { transform: translate3d(0, 0, 0) rotate(0deg); }
}

/* —— Sinematik kutlama —— */
.bpc__flash,
.bpc__rays,
.bpc__glow,
.bpc__ring,
.bpc__star,
.bpc__bit {
  position: absolute;
  left: 50%;
  top: var(--cheer-y);
  pointer-events: none;
}
.bpc__flash {
  inset: 0;
  left: 0;
  top: 0;
  background: radial-gradient(
    circle at 50% 58%,
    rgba(255, 252, 235, 0.92) 0%,
    rgba(253, 224, 71, 0.42) 26%,
    transparent 64%
  );
  opacity: 0;
}
.birles-play--cumle .bpc__flash {
  background: radial-gradient(
    circle at 50% 68%,
    rgba(255, 248, 220, 0.9) 0%,
    rgba(251, 191, 36, 0.4) 28%,
    transparent 66%
  );
}
.bpc__rays {
  width: 160%;
  height: 160%;
  margin: -80% 0 0 -80%;
  background: repeating-conic-gradient(
    from 0deg,
    transparent 0 14deg,
    rgba(255, 236, 160, 0.55) 14deg 17deg
  );
  opacity: 0;
}
.bpc__glow {
  width: 58%;
  height: 38%;
  transform: translate(-50%, -50%) scale(0.5);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 250, 200, 0.85) 0%, rgba(125, 211, 252, 0.35) 42%, transparent 70%);
}
.birles-play--cumle .bpc__glow {
  background: radial-gradient(circle, rgba(254, 240, 138, 0.9) 0%, rgba(251, 191, 36, 0.4) 48%, transparent 72%);
}
.bpc__ring,
.bpc__ring--2,
.bpc__ring--3 {
  width: 120px;
  height: 120px;
  margin: -60px 0 0 -60px;
  border-radius: 50%;
  border: 6px solid rgba(255, 252, 240, 0.95);
  box-sizing: border-box;
  opacity: 0;
}
.bpc__ring--2 { border-color: rgba(125, 211, 252, 0.95); }
.bpc__ring--3 { border-color: rgba(253, 224, 71, 0.9); border-width: 5px; }
.birles-play--cumle .bpc__ring--2 { border-color: rgba(251, 191, 36, 0.95); }
.bpc__star {
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  background: #fde68a;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  opacity: 0;
}
.bpc__bit {
  width: 9px;
  height: 16px;
  margin: -8px 0 0 -4px;
  border-radius: 2px;
  background: #facc15;
  opacity: 0;
}

.birles-play--pool.is-scene-cheer .bpc__flash {
  animation: bpcFlash 0.5s ease-out both;
}
.birles-play--pool.is-scene-cheer .bpc__rays {
  animation: bpcRays 1.15s ease-out both;
}
.birles-play--pool.is-scene-cheer .bpc__glow {
  animation: bpcGlow 1.2s ease-out both;
}
.birles-play--pool.is-scene-cheer .bpc__ring {
  animation: bpcRing 1.05s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.birles-play--pool.is-scene-cheer .bpc__ring--2 {
  animation: bpcRing 1.05s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}
.birles-play--pool.is-scene-cheer .bpc__ring--3 {
  animation: bpcRing 1.15s cubic-bezier(0.22, 1, 0.36, 1) 0.18s both;
}
.birles-play--pool.is-scene-cheer .bpc__star--1 { animation: bpcStar 1s ease-out both; --dx: -92px; --dy: -64px; }
.birles-play--pool.is-scene-cheer .bpc__star--2 { animation: bpcStar 1s ease-out 0.04s both; --dx: 98px; --dy: -52px; }
.birles-play--pool.is-scene-cheer .bpc__star--3 { animation: bpcStar 1s ease-out 0.07s both; --dx: -54px; --dy: 70px; }
.birles-play--pool.is-scene-cheer .bpc__star--4 { animation: bpcStar 1s ease-out 0.02s both; --dx: 62px; --dy: 76px; }
.birles-play--pool.is-scene-cheer .bpc__star--5 { animation: bpcStar 1s ease-out 0.09s both; --dx: 0px; --dy: -96px; }
.birles-play--pool.is-scene-cheer .bpc__star--6 { animation: bpcStar 1s ease-out 0.05s both; --dx: -110px; --dy: 8px; }
.birles-play--pool.is-scene-cheer .bpc__star--7 { animation: bpcStar 1s ease-out 0.11s both; --dx: 112px; --dy: 18px; }
.birles-play--pool.is-scene-cheer .bpc__star--8 { animation: bpcStar 1s ease-out 0.06s both; --dx: 24px; --dy: -78px; }
.birles-play--pool.is-scene-cheer .bpc__bit--1 { animation: bpcBit 1.1s ease-out both; --dx: -70px; --dy: -88px; --rot: 140deg; background: #fff; }
.birles-play--pool.is-scene-cheer .bpc__bit--2 { animation: bpcBit 1.1s ease-out 0.05s both; --dx: 84px; --dy: -70px; --rot: -160deg; background: #7dd3fc; }
.birles-play--pool.is-scene-cheer .bpc__bit--3 { animation: bpcBit 1.1s ease-out 0.08s both; --dx: -100px; --dy: 36px; --rot: 90deg; background: #fde68a; }
.birles-play--pool.is-scene-cheer .bpc__bit--4 { animation: bpcBit 1.1s ease-out 0.03s both; --dx: 96px; --dy: 48px; --rot: -110deg; background: #f472b6; }
.birles-play--pool.is-scene-cheer .bpc__bit--5 { animation: bpcBit 1.1s ease-out 0.1s both; --dx: -28px; --dy: 92px; --rot: 200deg; background: #fff; }
.birles-play--pool.is-scene-cheer .bpc__bit--6 { animation: bpcBit 1.1s ease-out 0.06s both; --dx: 40px; --dy: -100px; --rot: -80deg; background: #86efac; }
.birles-play--pool.is-scene-cheer .bpc__bit--7 { animation: bpcBit 1.1s ease-out 0.12s both; --dx: -118px; --dy: -20px; --rot: 70deg; background: #facc15; }
.birles-play--pool.is-scene-cheer .bpc__bit--8 { animation: bpcBit 1.1s ease-out 0.04s both; --dx: 120px; --dy: -12px; --rot: -200deg; background: #a5f3fc; }
.birles-play--cumle.is-scene-cheer .bpc__bit--2,
.birles-play--cumle.is-scene-cheer .bpc__bit--8 { background: #fbbf24; }
.birles-play--cumle.is-scene-cheer .bpc__bit--4 { background: #fb923c; }

@keyframes bpcFlash {
  0% { opacity: 0; }
  16% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes bpcRays {
  0% { transform: rotate(0deg) scale(0.35); opacity: 0; }
  18% { opacity: 0.9; }
  100% { transform: rotate(48deg) scale(1.2); opacity: 0; }
}
@keyframes bpcGlow {
  0% { transform: translate(-50%, -50%) scale(0.35); opacity: 0; }
  28% { opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.85); opacity: 0; }
}
@keyframes bpcRing {
  0% { transform: scale(0.28); opacity: 1; }
  100% { transform: scale(2.4); opacity: 0; }
}
@keyframes bpcStar {
  0% { transform: translate(0, 0) scale(0.3) rotate(0deg); opacity: 0; }
  22% { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1.15) rotate(140deg); opacity: 0; }
}
@keyframes bpcBit {
  0% { transform: translate(0, 0) rotate(0deg) scale(0.4); opacity: 0; }
  16% { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(1); opacity: 0; }
}

@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  .bps__rays { display: none; }
  .bps__spark--5,
  .bps__spark--6,
  .bpc__star--7,
  .bpc__star--8,
  .bpc__bit--6,
  .bpc__bit--7,
  .bpc__bit--8 { display: none; }
  .bps__art { animation-duration: 28s; }
  .bps__drake { filter: none; }
}

@media (prefers-reduced-motion: reduce) {
  .birles-pool-scene *,
  .birles-pool-cheer * {
    animation: none !important;
  }
  .bps__drake-f--open { opacity: 1 !important; }
  .bps__drake-f--blink,
  .bps__drake-flap { opacity: 0 !important; visibility: hidden !important; }
  .birles-play--pool.is-scene-cheer .bpc__glow,
  .birles-play--pool.is-scene-cheer .bpc__ring {
    opacity: 0.75;
  }
}
