:root {
    --shadow-light: rgba(0,0,0,0.1);
    --shadow-dark: rgba(0,0,0,0.2);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradientAnimation 15s ease infinite;
}

@keyframes gradientAnimation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#pageNotification { position: fixed; top: 20px; left: 20px; background: rgba(0, 0, 0, 0.85); color: white; padding: 12px; border-radius: 8px; z-index: 10000; width: 90%; max-width: 250px; box-shadow: 0 5px 20px rgba(0,0,0,0.4); border: 1px solid rgba(255, 255, 255, 0.1); backdrop-filter: blur(8px); opacity: 0; transform: translateX(-20px); transition: opacity 0.5s ease, transform 0.5s ease; pointer-events: none; }
#pageNotification.visible { opacity: 1; transform: translateX(0); pointer-events: auto; }
.notification-content { display: flex; align-items: center; gap: 10px; }
.notification-icon { font-size: 14px; font-weight: bold; background-color: #e74c3c; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notification-text p { font-size: 13px; margin-bottom: 10px; line-height: 1.4; }
.notification-buttons { display: flex; gap: 8px; }
.notification-btn { flex-grow: 1; padding: 7px; border: none; border-radius: 5px; font-weight: 600; cursor: pointer; font-size: 12px; transition: background-color 0.2s ease, transform 0.2s ease; }
.notification-btn:active { transform: scale(0.95); }
#notificationExitBtn { background-color: #555; color: white; }
#notificationContinueBtn { background-color: #27ae60; color: white; }

.container {
    max-width: 900px;
    width: 100%;
    margin: auto;
    background: #28756E;
    border-radius: 15px;
    box-shadow: 0 20px 40px var(--shadow-dark);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.container-single-video {
    flex-grow: 0;
}

.main-video-section {
    padding: 30px;
    background: #28756E;
}

.video-embed-container {
    position: relative;
    width: 100%;
    max-width: none;
    margin: 0 auto 10px auto; /* Reduced bottom margin */
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 30px var(--shadow-dark);
    background: #000;
    aspect-ratio: 16 / 9;
    cursor: pointer;
}

#mainVideoPlayer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 5; /* Pastikan di atas facade */
    display: none; /* Sembunyikan awal */
}

.video-title-container { display: flex; justify-content: space-between; align-items: center; max-width: none; margin: 0 auto 15px auto; flex-wrap: wrap; gap: 10px; }
.video-title { flex-grow: 1; text-align: left; margin: 0; font-size: 24px; color: #f0f0f0; font-weight: 600; }
.banner-ad-container.banner-single-video { max-width: 728px; margin: 20px auto; }
.sponsored-single-video-container { text-align: center; margin-top: 20px; }

/* ========== PERBAIKAN DI SINI (Masalah 1 - Quirks Mode) ========== */
/* Simplified overlay for better ad compatibility */
.ad-overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background-color: rgba(0, 0, 0, 0.9); 
    z-index: 11000;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0s 0.3s;
    overflow-y: auto;
    overflow-x: hidden;
}

.ad-overlay.visible { 
    visibility: visible;
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Simple centering without complex wrappers */
.ad-content { 
    position: relative; 
    background-color: #fff; 
    padding: 0;
    border-radius: 8px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); 
    margin: 50px auto;
    width: fit-content;
    min-width: 300px;
    min-height: 250px;
    max-width: 90vw;
}

#interstitialAdContainer { 
    display: block;
    text-align: center;
    padding: 20px;
    min-height: 300px;
}

/* Ensure JuicyAds elements display properly */
#interstitialAdContainer ins {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    text-decoration: none !important;
}

#interstitialAdContainer iframe {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    margin: 0 auto !important;
}

/* Ensure scripts can execute */
#interstitialAdContainer script {
    display: none !important;
}
/* ========== AKHIR DARI PERBAIKAN ========== */

.close-ad-btn { 
    position: absolute; 
    top: -10px; 
    right: -10px; 
    width: 30px; 
    height: 30px; 
    background-color: #333; 
    color: #fff; 
    border: 2px solid #fff; 
    border-radius: 50%; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    font-size: 20px; 
    line-height: 1; 
    cursor: pointer; 
    font-weight: bold;
    z-index: 11001;
}


/* ========== PERBAIKAN DI SINI (Masalah 2 - HP Terpotong) ========== */
/* Aturan Umum untuk Kontainer Iklan di Halaman */
.banner-ad-container,
.native-banner-container {
    display: block;
    margin: 20px auto;
    width: 100%;
    max-width: 100%;
    padding: 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    overflow: hidden;
    text-align: center;
}

/* Aturan spesifik untuk banner 300x250 */
.banner-ad-container {
    max-width: 300px;
    min-height: 250px;
}

/* Aturan spesifik untuk native 624x240 */
.native-banner-container {
    max-width: 624px;
    min-height: 240px;
}

.banner-ad-container:empty,
.native-banner-container:empty {
    display: none;
}

/* Ensure JuicyAds elements are visible and properly sized */
.banner-ad-container ins,
.native-banner-container ins {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    text-decoration: none !important;
    max-width: 100% !important;
}

/* Force iframes to fit container */
.banner-ad-container iframe,
.native-banner-container iframe {
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
}

/* Specific styling for JuicyAds ins elements */
ins[id^="110"] {
    display: inline-block !important;
    text-decoration: none !important;
    margin: 0 auto !important;
}
/* ========== AKHIR DARI PERBAIKAN ========== */


.adsbox { opacity: 0; position: absolute; bottom: 0; left: 0; height: 1px; width: 1px; pointer-events: none; }
.adblock-content { background-color: white; color: #333; padding: 30px 40px; border-radius: 10px; text-align: center; max-width: 400px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.adblock-content h2 { color: #c03b; margin-bottom: 15px; }

.player-facade-element { position: absolute; top: 0; left: 0; width: 100%; height: 100%; transition: opacity 0.3s ease; }
#playerPreviewVideo { object-fit: cover; z-index: 1; }
#playerOverlay { background: linear-gradient(transparent 50%, rgba(0,0,0,0.7)); z-index: 2; }
#customPlayBtn { z-index: 3; background: none; border: none; width: 80px; height: 80px; margin: auto; top: 0; bottom: 0; left: 0; right: 0; padding: 0; }
#customPlayBtn svg { display: block; width: 100%; height: 100%; }
#customPlayBtn .play-btn-fill { fill: #212121; fill-opacity: 0.8; transition: fill-opacity 0.2s ease; }
#customPlayBtn .play-btn-icon { fill: #ffffff; }
#customPlayBtn:hover .play-btn-fill { fill-opacity: 1; }
.video-embed-container.player-active .player-facade-element { opacity: 0; pointer-events: none; }
.video-embed-container.player-active #mainVideoPlayer { opacity: 1; display: block; }

.fullscreen-btn { position: absolute; top: 10px; right: 10px; z-index: 10; background-color: rgba(0, 0, 0, 0.5); color: white; border: 1px solid rgba(255, 255, 255, 0.7); border-radius: 5px; width: 35px; height: 35px; font-size: 20px; cursor: pointer; display: flex; justify-content: center; align-items: center; line-height: 1; transition: background-color 0.2s ease; }
.fullscreen-btn:hover { background-color: rgba(0, 0, 0, 0.8); }

@keyframes animated-gradient { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
.sponsored-btn, .download-btn { padding: 12px 24px; border: none; border-radius: 8px; color: white; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; transition: all 0.3s ease; background-size: 300% 300%; animation: animated-gradient 10s ease infinite; font-size: 15px; margin: 5px; }
.sponsored-btn:hover, .download-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 15px rgba(0,0,0,0.2); }
.sponsored-btn { background-image: linear-gradient(to right, #e67e22, #d35400, #f39c12); }
.download-btn { background-image: linear-gradient(to right, #3498db, #2980b9, #1abc9c); }

.download-button-container {
    text-align: right;
    max-width: 800px; 
    margin: 0 auto;
}

/* --- KODE RESPONSIVE SELALU DI PALING AKHIR --- */
@media (max-width: 768px) { 
    body { padding: 5px; } 
    .container { border-radius: 10px; }
    .main-video-section { padding: 15px; } 
    .video-title { font-size: 18px; margin-bottom: 10px; } 
    .download-button-container { text-align: center; margin-top: 10px; }
    
    .video-embed-container {
        margin-bottom: 15px;
        border-radius: 8px;
    }
    
    /* ========== PERBAIKAN DI SINI (Masalah 2 - HP Terpotong) ========== */
    /* Mobile ad container fixes */
    .banner-ad-container,
    .native-banner-container {
        max-width: 100% !important;
        margin: 15px 0;
        padding: 0;
        min-height: 100px;
    }
    
    /* Scale down ads on very small screens */
    .banner-ad-container ins,
    .native-banner-container ins {
        transform-origin: top center;
        max-width: 100%;
    }
    
    /* Interstitial ad mobile adjustments */
    .ad-content {
        margin: 20px auto;
        max-width: 95vw;
        min-width: 280px;
    }
    
    #interstitialAdContainer {
        padding: 10px;
        min-height: 250px;
    }
}

@media (max-width: 480px) { 
    body { padding: 3px; }
    #pageNotification { 
        top: 5px; 
        left: 5px; 
        right: 5px;
        max-width: none;
        width: auto;
    }
    .main-video-section { padding: 10px; }
    .video-title { font-size: 16px; }
    
    .video-embed-container {
        margin-bottom: 10px;
        border-radius: 6px;
    }
    
    .sponsored-btn, .download-btn {
        padding: 10px 20px;
        font-size: 14px;
        margin: 3px;
    }
    
    .banner-ad-container,
    .native-banner-container {
        min-height: 50px;
        margin: 10px auto;
    }
}

/* Social Bar Ad Container */
.social-bar-ad-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px;
    text-align: center;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    backdrop-filter: blur(5px);
}

.social-bar-ad-container:empty {
    display: none;
}