.adsense-container {
    width: 100%;
    margin: 16px 0;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    overflow: visible;
    height: auto;
    display: block;
    position: relative;
}

/* Hide empty ad containers */
.adsense-container.ad-empty {
    display: none !important;
}

/* Allow GPT to size slots naturally */
.adsense-container > * {
    height: auto;
    max-height: none;
}

.ad-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    text-align: center;
}

.feed-ad {
    max-width: 600px;
    margin: 20px auto;
    min-height: 0;
}

/* Make feed ad container smaller when ad is small */
.feed-ad:has(ins[data-ad-status="filled"]) {
    padding: 8px;
    min-height: auto;
}

.mods-ad {
    max-width: 720px;
    margin: 16px auto;
    min-height: 0;
    padding: 0;
}

.mods-ad ins {
    min-height: 0;
    max-height: none;
    display: block;
}

.guides-ad {
    max-width: 350px;
    margin: 20px auto;
    min-height: 0;
}

.guides-ad ins {
    min-height: 0;
    max-height: none;
    display: block;
}

.sidebar-ad {
    position: sticky;
    top: 80px;
    margin-bottom: 20px;
}

.bottom-ad {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    border-radius: 0;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    max-height: 150px;
    padding: 8px 12px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.bottom-ad iframe {
    background: transparent !important;
    border: 0 !important;
}

.ad-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.9);
    font-size: 20px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    font-weight: bold;
    line-height: 1;
    padding: 0;
}

.ad-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.adsense-container ins {
    display: block !important; /* Force block display */
    min-height: 90px !important; /* Prevent collapse */
    width: 100% !important; /* Fill container width */
    height: auto !important; /* Override AdSense */
    position: relative !important; /* Stable positioning */
    overflow: visible !important; /* Prevent clipping */
}

.feed-ad ins {
    min-height: 90px !important;
    max-height: 400px !important;
    display: block !important;
    height: auto !important;
}

.bottom-ad ins {
    min-height: 50px;
    max-height: 100px;
    display: block !important;
}

@media (max-width: 768px) {
    .sidebar-ad {
        display: none;
    }
    
    .feed-ad {
        margin: 16px 0;
    }
    
    .bottom-ad {
        max-height: 120px;
        padding: 6px 8px;
    }
    
    .bottom-ad .ad-label {
        font-size: 8px;
        margin-bottom: 4px;
    }
}



/* CRITICAL: Override any AdSense-injected styles that cause flickering */
.adsense-container[style*="height: auto"] {
    height: auto !important;
    min-height: 100px !important;
}

.adsense-container ins[style*="height: auto"] {
    height: auto !important;
    min-height: 90px !important;
}

/* Prevent AdSense from detecting scroll containers */
body, html, .main_content, .feed_container, .feed {
    overflow: visible !important;
}

/* Force stable rendering for all ad iframes */
.adsense-container iframe {
    position: relative !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Prevent any transitions that could cause flickering */
.adsense-container,
.adsense-container *,
.adsense-container ins,
.adsense-container iframe {
    transition: none !important;
    animation: none !important;
}

/* GPU acceleration for smooth rendering */
.adsense-container {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}
