.mobile-ad-overlay {
    display: none;
}

@media only screen and (max-width: 600px) {
    .mobile-ad-overlay {
        position: fixed;
        inset: 0;
        z-index: 10000;
        display: flex;
        justify-content: center;
        align-items: center;
        box-sizing: border-box;
        padding: 20px;
        background: rgba(0, 0, 0, .28);
        opacity: 0;
        transition: opacity 200ms ease;
    }

    .mobile-ad-overlay[hidden] {
        display: none;
    }

    .mobile-ad-overlay.is-visible {
        opacity: 1;
    }

    .mobile-ad {
        position: relative;
        width: min(88vw, 380px);
        max-height: 80vh;
        border: 1px solid rgba(255, 255, 255, .7);
        border-radius: 12px;
        background: rgba(255, 255, 255, .88);
        box-shadow: 0 14px 38px rgba(0, 0, 0, .3);
        backdrop-filter: blur(5px);
        -webkit-backdrop-filter: blur(5px);
    }

    .mobile-ad-link {
        display: block;
        padding: 16px;
        color: #1f2937;
        text-align: center;
        text-decoration: none;
    }

    .mobile-ad-image {
        display: block;
        max-width: 100%;
        max-height: 55vh;
        width: auto;
        height: auto;
        margin: 0 auto;
        border-radius: 8px;
        object-fit: contain;
    }

    .mobile-ad-description {
        display: block;
        margin-top: 12px;
        font-size: .95rem;
        font-weight: 700;
        line-height: 1.35;
    }

    .mobile-ad-close {
        position: absolute;
        top: -14px;
        right: -14px;
        z-index: 1;
        width: 36px;
        height: 36px;
        padding: 0;
        border: 2px solid #fff;
        border-radius: 50%;
        background: var(--header, #066);
        color: #fff;
        font: 700 27px/30px Arial, sans-serif;
        cursor: pointer;
        box-shadow: 0 3px 8px rgba(0, 0, 0, .28);
    }

    .mobile-ad-close:focus-visible {
        outline: 3px solid #fff;
        outline-offset: 2px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mobile-ad-overlay {
        transition: none;
    }
}
