/* Fixed app promotion popup */
.app-ad-popup {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 9000;
  width: min(360px, calc(100vw - 40px));
  overflow: hidden;
  color: #24201d;
  background: #fff;
  border: 1px solid rgba(36, 32, 29, 0.12);
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(20, 16, 13, 0.24), 0 3px 10px rgba(20, 16, 13, 0.12);
  font-family: Manrope, Arial, sans-serif;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 220ms ease, transform 220ms ease;
  isolation: isolate;
}

.app-ad-popup[hidden] { display: none !important; }

.app-ad-popup.app-ad-popup--entering {
  opacity: 0;
  transform: translateY(14px);
}

.app-ad-popup__link {
  display: block;
  color: inherit;
  text-decoration: none;
  background: #fff;
}

.app-ad-popup__media {
  position: relative;
  height: 214px;
  overflow: hidden;
  background: #eee9e4;
}

.app-ad-popup__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 1;
  transform: scale(1);
  transition: opacity 180ms ease, transform 360ms ease;
}

.app-ad-popup__image.app-ad-popup__image--changing {
  opacity: 0;
  transform: scale(1.015);
}

.app-ad-popup__sponsor {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 5px 9px;
  color: #fff;
  background: rgba(18, 16, 15, 0.7);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  backdrop-filter: blur(5px);
}

.app-ad-popup__footer {
  display: flex;
  align-items: center;
  min-height: 58px;
  padding: 10px 54px 10px 15px;
  gap: 12px;
}

.app-ad-popup__copy { min-width: 0; flex: 1; }

.app-ad-popup__name {
  display: block;
  overflow: hidden;
  color: #24201d;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-ad-popup__dots {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
}

.app-ad-popup__dot {
  width: 5px;
  height: 5px;
  padding: 0;
  background: #d7d0ca;
  border: 0;
  border-radius: 50%;
}

.app-ad-popup__dot[aria-current="true"] {
  width: 13px;
  background: #c97b5c;
  border-radius: 5px;
}

.app-ad-popup__close {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  color: #514943;
  background: #f4f1ee;
  border: 1px solid rgba(36, 32, 29, 0.1);
  border-radius: 12px;
  font: 400 22px/1 Arial, sans-serif;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.app-ad-popup__close:hover { color: #211d1a; background: #e9e4df; }
.app-ad-popup__close:active { transform: scale(0.95); }

.app-ad-popup__link:focus-visible,
.app-ad-popup__close:focus-visible {
  outline: 3px solid #2b6ee7;
  outline-offset: -3px;
}

@media (max-width: 600px) {
  .app-ad-popup {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    width: calc(100vw - max(24px, env(safe-area-inset-right) + 12px));
    max-width: 360px;
    border-radius: 16px;
  }

  .app-ad-popup__media { height: clamp(142px, 45vw, 184px); }
  .app-ad-popup__footer { min-height: 56px; padding-left: 13px; }
  .app-ad-popup__close { width: 40px; height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .app-ad-popup,
  .app-ad-popup__image,
  .app-ad-popup__close { transition: none; }
}
