.fg40-ad-slot {
    box-sizing: border-box;
    width: min(100%, var(--fg40-ad-dw));
    max-width: var(--fg40-ad-dw);
    margin: 24px auto;
    text-align: center;
}

.fg40-ad-label {
    margin: 0 0 6px;
    font-size: 10px;
    line-height: 1.2;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #6b7280;
}

.fg40-ad-device {
    box-sizing: border-box;
    width: min(100%, var(--fg40-ad-dw));
    height: var(--fg40-ad-dh);
    min-height: var(--fg40-ad-dh);
    margin-inline: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

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

@media (min-width: 768px) {
    .fg40-ad-slot--no-desktop { display: none; }
}

.fg40-ad-creative {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    max-width: var(--fg40-ad-dw);
    text-decoration: none;
}

.fg40-ad-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    margin: 0 auto;
}

.fg40-ad-adsense { width: 100%; }

@media (max-width: 767px) {
    .fg40-ad-slot--no-mobile { display: none; }
    .fg40-ad-slot {
        width: min(100%, var(--fg40-ad-mw));
        max-width: var(--fg40-ad-mw);
        margin: 18px auto;
    }
    .fg40-ad-desktop { display: none; }
    .fg40-ad-mobile {
        display: flex;
        width: min(100%, var(--fg40-ad-mw));
        height: var(--fg40-ad-mh);
        min-height: var(--fg40-ad-mh);
    }
    .fg40-ad-creative { max-width: var(--fg40-ad-mw); }
}

/* Formato automático: preserva a proporção natural do criativo e não reserva
 * uma altura fixa. A largura continua limitada pelo inventário do slot. */
.fg40-ad-slot--desktop-auto .fg40-ad-desktop {
    width: 100%;
    height: auto;
    min-height: 0;
    overflow: visible;
}

.fg40-ad-slot--desktop-auto .fg40-ad-desktop .fg40-ad-creative {
    display: inline-flex;
    width: auto;
    height: auto;
    max-width: 100%;
}

.fg40-ad-slot--desktop-auto .fg40-ad-desktop .fg40-ad-image {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: none;
}

/* Responsive AdSense may choose a taller creative than a fixed inventory box.
 * Reserve the configured minimum for CLS, but never crop an ad served by Google. */
.fg40-ad-device--adsense {
    height: auto;
    min-height: var(--fg40-ad-dh);
    overflow: visible;
}
.fg40-ad-device--adsense .fg40-ad-adsense { min-height: var(--fg40-ad-dh); }
@media (max-width: 767px) {
    .fg40-ad-device--adsense {
        height: auto;
        min-height: var(--fg40-ad-mh);
    }
    .fg40-ad-device--adsense .fg40-ad-adsense { min-height: var(--fg40-ad-mh); }
}
