/**
 * FuelMe PWA/web ads — shared ad card (in-feed + bottom billboard).
 * Colors: #1E293B glass, #F8FAFC primary, #94A3B8 secondary, #22C55E CTA.
 */
html.fuelme-web-ads-shell {
    --fuelme-web-bottom-inset: 88px;
    --fuelme-bottom-nav-height: calc(
        5.75rem
        + max(env(safe-area-inset-bottom, 0px), var(--fuelme-native-bottom-inset, 0px))
        + var(--fuelme-web-bottom-inset, 0px)
    );
}

html.fuelme-web-ads-shell .fuelme-bottom-nav {
    bottom: var(--fuelme-web-bottom-inset, 0px);
}

html.fuelme-web-ads-shell body.fuelme-standalone .fuelme-bottom-nav {
    bottom: var(--fuelme-web-bottom-inset, 0px);
}

/* In-feed card — rounded (hybrid layout_native_ad_infeed.xml, 32dp radius) */
.fm-web-ad-card {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 2rem;
    padding: 8px 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    box-sizing: border-box;
    overflow: hidden;
}

.fm-web-ad-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    min-height: 20px;
    margin-bottom: 4px;
}

.fm-web-ad-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 15px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #475569;
    color: #f8fafc;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.02em;
}

.fm-web-ad-badge.is-ad {
    /* Phase 2: real AdSense attribution */
}

.fm-web-ad-choices {
    display: block;
    width: 48px;
    height: 20px;
    flex-shrink: 0;
}

.fm-web-ad-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
}

.fm-web-ad-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    flex-shrink: 0;
    object-fit: cover;
    background: #0f172a;
}

.fm-web-ad-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.fm-web-ad-headline {
    color: #f8fafc;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.fm-web-ad-body {
    color: #94a3b8;
    font-size: 12px;
    line-height: 1.3;
    margin-top: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: opacity 0.35s ease;
}

.fm-web-ad-body.is-fading {
    opacity: 0;
}

.fm-web-ad-cta {
    display: none;
    flex-shrink: 0;
    min-width: 72px;
    height: 32px;
    padding: 0 12px;
    border: none;
    border-radius: 6px;
    background: #22c55e;
    color: #0f172a;
    font-size: 11px;
    font-weight: 600;
    line-height: 32px;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.fm-web-ad-cta.is-visible {
    display: inline-block;
}

/* Bottom billboard — rectangular glass strip (hybrid bg_native_ad_glass.xml, no corner radius) */
.fm-web-billboard {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4990;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-sizing: border-box;
    background: #1e293b;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

html.fuelme-web-ads-shell body.fuelme-standalone .fm-web-billboard {
    left: 50%;
    right: auto;
    width: 100%;
    max-width: 450px;
    transform: translateX(-50%);
}

.fm-web-billboard-card {
    width: 100%;
    box-sizing: border-box;
    padding: 4px 8px;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.fm-web-billboard-card .fm-web-ad-top {
    min-height: 15px;
    margin-bottom: 2px;
}

.fm-web-billboard-card .fm-web-ad-row {
    gap: 8px;
    min-height: 36px;
}

.fm-web-billboard-card .fm-web-ad-icon {
    width: 36px;
    height: 36px;
}

.fm-web-billboard-card .fm-web-ad-headline {
    font-size: 13px;
    -webkit-line-clamp: 1;
    white-space: nowrap;
    text-overflow: ellipsis;
    display: block;
}

.fm-web-billboard-card .fm-web-ad-body {
    font-size: 11px;
    -webkit-line-clamp: 1;
    white-space: nowrap;
    text-overflow: ellipsis;
    display: block;
}

.fm-web-billboard-card .fm-web-ad-cta {
    min-width: 64px;
    height: 28px;
    line-height: 28px;
    padding: 0 10px;
}

.fm-web-ad-link {
    display: block;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.fm-web-ad-link:active .fm-web-ad-card,
.fm-web-ad-link:active .fm-web-billboard-card {
    opacity: 0.92;
}

.fm-web-infeed-slot .fm-web-ad-link {
    border-radius: 2rem;
}

/* In-feed grid slot */
.fm-web-infeed-slot {
    grid-column: 1 / -1;
}

@media (min-width: 768px) {
    .fm-web-infeed-slot {
        grid-column: span 1;
    }
}

/* Legacy alias — same as .fm-web-ad-card */
.fm-web-infeed-card {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 2rem;
    padding: 8px 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

/* Intro layer shell (phase 2) — hidden by default */
#fuelme-web-intro-root {
    position: fixed;
    inset: 0;
    z-index: 6200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.45s ease, visibility 0.45s ease;
}

#fuelme-web-intro-root.is-open {
    opacity: 1;
    visibility: visible;
}

#fuelme-web-intro-root .fm-web-intro-panel {
    width: 100%;
    max-width: 22rem;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
    padding: 1.25rem;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

#fuelme-web-intro-root .fm-web-intro-exit {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}
