.site-ad-dialog { width: min(360px, calc(100vw - 32px)); max-width: calc(100vw - 32px); max-height: calc(100dvh - 48px); padding: 0; border: 0; border-radius: 8px; color: #17232f; background: white; box-shadow: 0 18px 70px #07152455; overflow: auto; }
.site-ad-dialog::backdrop { background: #09162699; }
.site-ad-dialog > a { display: block; }
.site-ad-dialog img { display: block; width: 100%; height: auto; max-height: calc(100dvh - 100px); object-fit: contain; }
body:has(.site-ad-dialog[open]) { overflow: hidden; }

/* Opening creative scales by both available width and height, without cropping. */
.site-ad-dialog-opening {
  --ad-view-width: calc(100vw - 32px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
  --ad-art-height: max(1px, calc(100vh - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)));
  --ad-art-width: min(var(--ad-size-width, 92vw), var(--ad-view-width), calc(var(--ad-art-height) * var(--ad-aspect, 1)));
  width: var(--ad-art-width);
  max-width: var(--ad-view-width);
  max-height: var(--ad-art-height);
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}
@supports (height: 100dvh) {
  .site-ad-dialog-opening { --ad-art-height: max(1px, calc(100dvh - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))); }
}
.site-ad-dialog-close { position: absolute; z-index: 1; top: 4px; right: 4px; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #17232f; cursor: pointer; touch-action: manipulation; }
.site-ad-dialog-close::before { content: ""; position: absolute; inset: 6px; border: 1px solid #17232f14; border-radius: 50%; background: #fffffff5; box-shadow: 0 1px 6px #07152426; }
.site-ad-dialog-close svg { position: relative; width: 18px; height: 18px; pointer-events: none; }
.site-ad-dialog-close:hover::before { background: white; }
.site-ad-dialog-close:active::before { background: #e9eef2; }
.site-ad-dialog-close:focus-visible { outline: none; }
.site-ad-dialog-close:focus-visible::before { outline: 2px solid #3974a6; outline-offset: 2px; }
.site-ad-dialog-opening > a { width: var(--ad-art-width); max-width: 100%; margin-inline: auto; border-radius: 8px; overflow: hidden; box-shadow: 0 18px 70px #07152455; }
.site-ad-dialog-opening img { width: 100%; height: auto; max-height: none; }
