.popup-ad-layer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
}

.popup-ad-overlay {
  position: absolute;
  inset: 0;
  background: rgba(3, 10, 14, 0.58);
  backdrop-filter: blur(5px);
  pointer-events: auto;
}

.popup-ad {
  position: fixed;
  pointer-events: auto;
  width: min(420px, calc(100vw - 28px));
  border-radius: 20px;
  background: #050b12;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.36), 0 0 0 1px rgba(64, 214, 255, 0.2);
  overflow: hidden;
  animation: popup-ad-in 0.26s ease both;
}

.popup-ad.is-center {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.popup-ad.is-left {
  left: 18px;
  top: 50%;
  width: min(300px, calc(100vw - 28px));
  transform: translateY(-50%);
}

.popup-ad.is-right {
  right: 18px;
  top: 50%;
  width: min(300px, calc(100vw - 28px));
  transform: translateY(-50%);
}

.popup-ad.is-bottom {
  left: 50%;
  bottom: 16px;
  width: min(728px, calc(100vw - 28px));
  transform: translateX(-50%);
}

.popup-ad a {
  display: block;
  line-height: 0;
}

.popup-ad img {
  display: block;
  width: 100%;
  max-height: min(82vh, 760px);
  height: auto;
  object-fit: contain;
  background: #050b12;
}

.popup-ad.is-bottom img {
  max-height: 180px;
}

.popup-ad-close {
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: #10251f;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.popup-ad-close:hover {
  background: #dff44d;
}

@keyframes popup-ad-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@media (max-width: 760px) {
  .popup-ad.is-left,
  .popup-ad.is-right,
  .popup-ad.is-center {
    left: 50%;
    right: auto;
    top: 50%;
    width: min(430px, calc(100vw - 22px));
    transform: translate(-50%, -50%);
  }

  .popup-ad.is-bottom {
    bottom: 10px;
    width: calc(100vw - 18px);
  }

  .popup-ad img {
    max-height: 82vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .popup-ad {
    animation: none;
  }
}
