/* Ad popup */

body.ad-pop-open {
  overflow: hidden;
}

.ad-pop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

.ad-pop--open {
  display: flex;
}

.ad-pop__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
}

.ad-pop__inner {
  position: relative;
  z-index: 1;
  display: flex;
  width: 100%;
  max-height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.ad-pop__media {
  display: flex;
  width: 100%;
  min-height: 0;
  align-items: center;
  justify-content: center;
}

.ad-pop__card {
  display: flex;
  max-width: min(400px, calc(100vw - 32px));
  max-height: calc(100vh - 118px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  max-height: calc(100dvh - 118px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.ad-pop__img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: inherit;
  display: block;
  object-fit: contain;
  background: var(--color-neutral-200);
}

.ad-pop__fallback {
  display: flex;
  width: min(320px, calc(100vw - 32px));
  min-height: 180px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  border-radius: 12px;
  background: #1b1d20;
  color: #fff;
  text-align: center;
}

.ad-pop__fallback span {
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
}

.ad-pop__close {
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-pop__close:hover {
  opacity: 0.85;
}

.ad-pop__close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.ad-pop__close-icon {
  display: block;
}

@media (max-width: 768px) {
  .ad-pop__card {
    max-width: min(320px, calc(100vw - 32px));
  }
}
