/* Keep the activity card and its existing close button centered as one group.
   Scoped overrides intentionally follow the legacy !important popup rules. */
#adPopup.ad-popup {
  position: fixed !important;
  inset: 0 !important;
  box-sizing: border-box !important;
  width: 100% !important;
  height: 100% !important;
  height: 100dvh !important;
  display: none !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 16px !important;
  padding-top: max(16px, env(safe-area-inset-top, 0px)) !important;
  padding-right: max(16px, env(safe-area-inset-right, 0px)) !important;
  padding-bottom: max(16px, env(safe-area-inset-bottom, 0px)) !important;
  padding-left: max(16px, env(safe-area-inset-left, 0px)) !important;
  overflow: hidden !important;
}

#adPopup.ad-popup.show {
  display: flex !important;
}

#adPopup .ad-card {
  box-sizing: border-box !important;
  flex: 0 1 auto !important;
  min-height: 0 !important;
  width: 100% !important;
  max-width: 360px !important;
  max-height: calc(100vh - 88px) !important;
  max-height: calc(100dvh - 88px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
  overflow: auto !important;
  overflow-wrap: anywhere;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

#adPopup .ad-close {
  position: static !important;
  flex: 0 0 40px !important;
  transform: none !important;
  margin: 12px 0 0 !important;
}
