.sp-reader-promo {
    max-width: 780px;
    margin: 0 auto;
}

.wuwu-ad-slot.wuwu-reader-floating {
    display: none !important;
}

body { --reader-footer-height: 0px; }

/* The optional global navigation is injected after the reader has loaded. */
body:has(.global-navbar:not([hidden])) { --reader-footer-height: 48px; }

@media (min-width: 768px) {
    .wuwu-ad-slot.wuwu-reader-floating {
        /* Leave room for the upper rail and the corner's separate close button. */
        height: min(250px, calc((100dvh - var(--reader-footer-height)) / 2 - 80px));
        width: 300px;
        right: 18px;
    }

}

.wuwu-ad-slot[data-ad-slot="pc_reader_corner_popup"] {
    width: 300px;
    height: 250px;
    right: 18px;
}

.wuwu-ad-slot[data-ad-slot="pc_reader_corner_popup"].is-ready:not([hidden]) {
    animation: wuwu-reader-corner-enter .9s cubic-bezier(.16, 1, .3, 1) both;
    bottom: calc(18px + var(--reader-footer-height));
    display: block !important;
    height: 250px;
    z-index: 36;
}

.wuwu-ad-slot[data-ad-slot="pc_reader_corner_popup"] .wuwu-ad-frame {
    border: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .55);
    overflow: visible;
}

.wuwu-ad-slot[data-ad-slot="pc_reader_corner_popup"] .wuwu-ad-content {
    border-radius: 8px;
    height: 250px;
    overflow: hidden;
    transform: scale(var(--reader-popup-scale, 1));
    transform-origin: top left;
    width: 300px;
}

.wuwu-ad-slot[data-ad-slot="pc_reader_corner_popup"] .wuwu-ad-close {
    border-radius: 4px;
    font-size: 30px;
    height: 34px;
    right: 0;
    top: -38px;
    width: 34px;
}

@media (min-width: 1140px) {
    .wuwu-ad-slot[data-ad-slot="pc_reader_right_rail"].is-ready:not([hidden]) {
        bottom: auto;
        display: block !important;
        top: 80px;
    }
}

@media (max-width: 767px) {
    .wuwu-ad-slot[data-ad-slot="pc_reader_corner_popup"] {
        /* Fit narrow/landscape screens and safe areas, including an unscaled 44px close control. */
        width: min(300px,
            calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)),
            calc((100dvh - var(--reader-footer-height) - 72px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) * 1.2));
        aspect-ratio: 6 / 5;
        height: auto;
        right: calc(12px + env(safe-area-inset-right, 0px));
    }

    .wuwu-ad-slot[data-ad-slot="pc_reader_corner_popup"].is-ready:not([hidden]) {
        bottom: calc(12px + var(--reader-footer-height) + env(safe-area-inset-bottom, 0px));
        height: auto;
        z-index: 101;
    }

    .wuwu-ad-slot[data-ad-slot="pc_reader_corner_popup"] .wuwu-ad-close {
        height: 44px;
        top: -48px;
        width: 44px;
    }
}

@keyframes wuwu-reader-corner-enter {
    0% { opacity: 0; transform: translateX(calc(-100vw - 100%)); }
    80% { opacity: 1; transform: translateX(8px); }
    100% { opacity: 1; transform: translateX(0); }
}

/* Two fixed ads plus controls/footer need 702px; never shrink the 300x250 popup. */
@media (min-width: 1140px) and (max-height: 701px) {
    body:has([data-ad-slot="pc_reader_corner_popup"].is-ready:not([hidden]))
    .wuwu-ad-slot[data-ad-slot="pc_reader_right_rail"].is-ready:not([hidden]) {
        display: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wuwu-ad-slot[data-ad-slot="pc_reader_corner_popup"].is-ready:not([hidden]) {
        animation: none;
    }
}

.wuwu-ad-modal-open .wuwu-ad-slot.wuwu-reader-floating.is-ready:not([hidden]) {
    display: none !important;
}
