.d4-ad { margin: 1.5rem auto; max-width: 55rem; padding: 1rem; border: 1px solid #476184; border-radius: .8rem; text-align: start; }
.d4-ad[hidden], .d4-ad [hidden] { display: none !important; }
.d4-ad small { display: block; margin-bottom: .55rem; color: #afc4de; font-size: .8rem; }
.d4-ad a { color: #b7eaff; text-underline-offset: .18em; }
.d4-ad__title { font-weight: 700; }
.d4-ad img, .d4-ad iframe { display: block; max-width: 100%; margin: .5rem auto; border: 0; }
.d4-ad img { height: auto; }
.d4-ad button { min-height: 40px; margin-inline-end: .45rem; padding: .45rem .7rem; border: 1px solid #657c9e; border-radius: .45rem; background: #1b2942; color: #e8f0ff; }
.d4-ad :focus-visible { outline: 2px solid #8ce9e1; outline-offset: 3px; }
.d4-ad:where([data-kind="direct"][data-format="banner"]) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem 1rem;
  padding: .7rem 1rem;
  border-inline-start: 3px solid #7695b8;
  background: #111c32;
}
.d4-ad:where([data-kind="direct"][data-format="banner"]) small { margin: 0; }
.d4-ad:where([data-kind="direct"][data-format="banner"]) a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.d4-ad[data-kind="contextual"] {
  display: grid;
  gap: .4rem;
  padding: .75rem 1rem;
  border-inline-start: 3px solid #7695b8;
  background: #111c32;
}
.d4-ad[data-kind="contextual"] small { margin: 0; }
.d4-ad[data-kind="contextual"] a { justify-self: start; align-content: center; min-height: 44px; }
.d4-ad--graphic { display: block; }
.d4-ad--graphic > a { display: block; }
.d4-ad--graphic img { width: auto; max-width: 100%; height: auto; object-fit: contain; }
.d4-ad__close { display: none; }
.d4-ad[data-slot="leaderboard"] { padding-inline: 0; }
.d4-ad[data-slot="leaderboard"] > small { margin-inline: 1rem; }
.d4-ad-preferences { margin: 0 auto 1rem; max-width: 55rem; color: #afc4de; font-size: .85rem; }
.d4-ad-preferences a { color: #b7eaff; }
.d4-ad-preferences p { margin: .35rem 0 .55rem; }
.d4-ad-preferences form { display: flex; flex-wrap: wrap; gap: .5rem; }
.d4-ad-preferences button {
  padding: .45rem .7rem;
  min-height: 40px;
  background: #1b2942;
  color: #e8f0ff;
  border: 1px solid #657c9e;
  border-radius: .45rem;
}
.d4-ad-preferences summary { cursor: pointer; }
.d4-ad[data-kind="adsterra"] [data-adsterra-stage] { display: grid; justify-items: center; }
.d4-ad[data-kind="adsterra"][data-slot="leaderboard"] [data-adsterra-stage] { min-block-size: 90px; }
.d4-ad[data-kind="adsterra"][data-slot="between-sections"] [data-adsterra-stage] { min-block-size: 250px; }
.d4-ad[data-kind="adsterra"][data-slot="side-start"] [data-adsterra-stage] { min-block-size: 600px; }
.d4-ad[data-kind="adsterra"][data-slot="side-end"] [data-adsterra-stage] { min-block-size: 300px; }
.d4-ad[data-kind="adsterra"][data-slot="footer"] [data-adsterra-stage] { min-block-size: 50px; }
.d4-ad[data-kind="adsterra"] iframe { margin: 0; }

@media (max-width: 799px) { .d4-ad[data-slot="leaderboard"] { display: none; } }
@media (max-width: 1279px) { .d4-ad--rail { display: none; } }

@media (min-width: 1280px) {
  body:has(> .d4-ad--rail:not([hidden])) { position: relative; }
  body:has(> .d4-ad--rail:not([hidden])) > .wrap {
    max-width: min(1120px, calc(100% - 22.5rem));
  }
  .d4-ad--rail {
    position: absolute;
    inset-block-start: 8.5rem;
    inline-size: 172px;
    margin: 0;
    padding: .25rem;
    overflow-wrap: anywhere;
  }
  .d4-ad[data-slot="side-start"] { inset-inline-start: max(.25rem, calc((100% - 1120px) / 2 - 176px)); }
  .d4-ad[data-slot="side-end"] { inset-inline-end: max(.25rem, calc((100% - 1120px) / 2 - 176px)); }
}

@media (max-width: 767px) {
  .d4-ad[data-format="banner"][data-kind="network"] {
    --banner-box-width: min(22rem, calc(100vw - 12px));
    box-sizing: border-box;
    inline-size: var(--banner-box-width);
    max-inline-size: none;
    margin-inline: calc((100% - var(--banner-box-width)) / 2);
    padding-inline: 0;
  }
  .d4-ad[data-format="banner"][data-kind="network"] > small {
    margin-inline: .75rem;
  }
  .d4-ad[data-kind="adsterra"][data-slot="between-sections"] {
    --banner-box-width: min(22rem, calc(100vw - 12px));
    inline-size: var(--banner-box-width);
    margin-inline: calc((100% - var(--banner-box-width)) / 2);
    padding-inline: 0;
  }
  .d4-ad[data-kind="adsterra"][data-slot="between-sections"] > small { margin-inline: .75rem; }
  .d4-ad[data-kind="adsterra"][data-slot="footer"] {
    --banner-box-width: min(22rem, 100vw);
    inline-size: var(--banner-box-width);
    margin-inline: calc((100% - var(--banner-box-width)) / 2);
    padding-inline: 0;
  }
  .d4-ad--anchored[data-slot="bottom-anchor"] {
    position: relative;
    display: grid;
    align-items: center;
    gap: 0;
    margin: 1rem auto;
    padding: 0 0 .25rem;
    inline-size: min(22rem, 100%);
    background: #111c32;
  }
  .d4-ad--anchored[data-slot="bottom-anchor"] > small {
    margin: 0;
    padding-inline: .75rem 3.5rem;
    min-block-size: 44px;
    align-content: center;
  }
  .d4-ad--anchored > .d4-ad__close {
    position: absolute;
    inset-block-start: 0;
    inset-inline-end: 0;
    display: grid;
    place-items: center;
    inline-size: 44px;
    block-size: 44px;
    margin: 0;
    border: 0;
    background: transparent;
    font-size: 1.4rem;
  }
  .d4-ad--anchored .d4-ad__title { display: none; }
  .d4-ad--anchored :is(img, iframe) { margin: 0 auto; }
}

@media (max-width: 322px) {
  .d4-ad--anchored[data-slot="bottom-anchor"], .d4-ad[data-kind="adsterra"][data-slot="footer"] { border-inline: 0; }
}

@media (max-width: 767px) and (min-height: 420px) {
  body.d4-ad-anchor-ready:has(.d4-ad--anchored:not([hidden])) {
    padding-bottom: calc(154px + env(safe-area-inset-bottom, 0px));
  }
  .d4-ad-anchor-ready .d4-ad--anchored[data-slot="bottom-anchor"] {
    position: fixed;
    z-index: 15;
    inset-inline: 0;
    bottom: 0;
    margin-block: 0;
    padding-bottom: calc(.25rem + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 767px) { .d4-ad[data-device="desktop"] { display: none; } }
@media (min-width: 768px) { .d4-ad[data-device="mobile"] { display: none; } }
