* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: 'Poppins', sans-serif; 
}

:root {
    /* Color Palette & Gradients */
    --blue-main: #4da6ff;
    --blue-dark: #0056b3;
    --blue-gradient: linear-gradient(135deg, #4da6ff 0%, #0066ff 100%);
    --blue-hover: linear-gradient(135deg, #3388ff 0%, #004ecc 100%);
    --blue-glow: rgba(77, 166, 255, 0.4);
    
    /* Layout Colors */
    --bg-color: #f4f7fb;
    --card-bg: #ffffff;
    --text-main: #111111;
    --text-muted: #666666;
    
    /* Drop Shadows */
    --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 15px 35px var(--blue-glow);
}

body { 
    background: var(--bg-color); 
    color: var(--text-main); 
    overflow-x: hidden; 
}

/* =========================================
   HEADER
   ========================================= */
header { 
    background: var(--blue-gradient); 
    padding: 15px 20px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    color: white; 
    box-shadow: 0 4px 15px rgba(0, 102, 255, 0.2);
}

.header-btns button, 
.back-btn-top { 
    background: white; 
    color: var(--blue-main); 
    border: none; 
    width: 40px; 
    height: 40px; 
    border-radius: 50%; 
    font-size: 18px; 
    cursor: pointer; 
    transition: all 0.3s ease; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.header-btns button:hover, 
.back-btn-top:hover { 
    transform: translateY(-2px) scale(1.05); 
    box-shadow: 0 6px 15px rgba(0,0,0,0.15);
}

/* =========================================
   NEW MODERN UI (MC HUB STYLE)
   ========================================= */

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in { 
    opacity: 0; 
    animation: fadeInUp 0.8s cubic-bezier(0.25, 1, 0.5, 1) forwards; 
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }

.gallery { 
    padding: 40px 20px; 
    max-width: 1200px; 
    margin: auto; 
}

/* The Cool Hero Box */
.hero-box {
    background: var(--blue-gradient);
    border-radius: 24px;
    padding: 80px 40px;
    text-align: left;
    color: white;
    margin-bottom: 60px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.hero-box::after {
    content: '';
    position: absolute;
    top: -50%; 
    right: -20%;
    width: 600px; 
    height: 600px;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 60%);
    border-radius: 50%;
}

.hero-box h1 { 
    font-size: 3.5rem; 
    margin-bottom: 20px; 
    font-weight: 800; 
    line-height: 1.1; 
    position: relative; 
    z-index: 2; 
}

.hero-box h1 span { 
    color: #fff; 
    text-shadow: 0 0 20px rgba(255,255,255,0.6); 
}

.hero-box p { 
    font-size: 1.2rem; 
    opacity: 0.9; 
    max-width: 600px; 
    margin-bottom: 30px; 
    position: relative; 
    z-index: 2; 
}

.hero-btn { 
    display: inline-block; 
    background: white; 
    color: var(--blue-main); 
    padding: 15px 35px; 
    border-radius: 12px; 
    font-weight: 700; 
    text-decoration: none; 
    transition: transform 0.3s, box-shadow 0.3s; 
    position: relative; 
    z-index: 2; 
}

.hero-btn:hover { 
    transform: scale(1.05); 
    box-shadow: 0 10px 25px rgba(0,0,0,0.2); 
}

/* Category Headers */
.section-header { 
    display: flex; 
    align-items: center; 
    gap: 15px; 
    margin: 40px 0 20px 0; 
}

.section-icon { 
    width: 45px; 
    height: 45px; 
    background: rgba(77,166,255,0.1); 
    color: var(--blue-main); 
    border-radius: 12px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 20px; 
}

.section-header h2 { 
    font-size: 26px; 
    font-weight: 700; 
    margin: 0; 
    color: var(--text-main); 
}

/* Large Series Grid (For Homepage) */
.series-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); 
    gap: 30px; 
    margin-bottom: 60px; 
}

.series-card { 
    background: var(--card-bg); 
    border-radius: 20px; 
    padding: 25px; 
    display: block; 
    text-decoration: none; 
    color: var(--text-main); 
    box-shadow: var(--shadow-soft); 
    transition: all 0.3s ease; 
    border: 1px solid rgba(0,0,0,0.05); 
}

.series-card:hover { 
    transform: translateY(-8px); 
    box-shadow: var(--shadow-hover); 
    border-color: rgba(77, 166, 255, 0.3); 
}

.series-img-wrap { 
    aspect-ratio: 16/9; 
    background: #f8fafc; 
    border-radius: 12px; 
    margin-bottom: 20px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    overflow: hidden; 
    position: relative; 
}

.series-img-wrap img { 
    width: 100%;       /* Add this */
    height: 100%;      /* Add this */
    object-fit: cover; /* Change from 'contain' to 'cover' */
    transition: transform 0.5s ease; 
    z-index: 1; 
}

.series-card:hover .series-img-wrap img { 
    transform: scale(1.1); 
}

.series-info { 
    display: flex; 
    justify-content: space-between; 
    align-items: flex-start; 
}

.series-info h3 { 
    font-size: 22px; 
    font-weight: 700; 
    margin-bottom: 4px; 
    transition: color 0.3s ease; 
}

.series-card:hover .series-info h3 { 
    color: var(--blue-main); 
}

.series-info p { 
    font-size: 13px; 
    font-weight: 600; 
    color: #94a3b8; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
}

.series-icon { 
    width: 40px; 
    height: 40px; 
    border-radius: 50%; 
    border: 2px solid #e2e8f0; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    color: #94a3b8; 
    transition: all 0.3s ease; 
}

.series-card:hover .series-icon { 
    background: var(--blue-main); 
    border-color: var(--blue-main); 
    color: white; 
}

/* =========================================
   HOME GRID & EPISODES (Original Styles)
   ========================================= */

.series-block { 
    margin-bottom: 50px; 
}

.series-title { 
    font-size: 32px; 
    font-weight: 700;
    margin-bottom: 25px; 
    background: var(--blue-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.series-title::after {
    content: '';
    display: block;
    width: 60%;
    height: 4px;
    background: var(--blue-gradient);
    margin-top: 5px;
    border-radius: 2px;
}

.season-title { 
    color: var(--text-main); 
    font-size: 22px; 
    margin: 30px 0 15px 0; 
    padding-left: 12px; 
    border-left: 5px solid var(--blue-main); 
    border-radius: 2px;
}

.episodes-grid { 
    display: flex; 
    flex-wrap: nowrap;
    overflow-x: auto; 
    gap: 25px; 
    padding-bottom: 20px; 
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch; 
}

.episodes-grid::-webkit-scrollbar { 
    height: 8px; 
}
.episodes-grid::-webkit-scrollbar-track { 
    background: #f1f5f9; 
    border-radius: 4px; 
}
.episodes-grid::-webkit-scrollbar-thumb { 
    background: #cbd5e1; 
    border-radius: 4px; 
}
.episodes-grid::-webkit-scrollbar-thumb:hover { 
    background: #94a3b8; 
}

/* VIDEO CARDS */
.photo-card { 
    flex: 0 0 280px; 
    background: var(--card-bg); 
    padding: 15px; 
    border-radius: 16px; 
    text-decoration: none; 
    color: var(--text-main); 
    box-shadow: var(--shadow-soft); 
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); 
    display: block; 
    border: 1px solid rgba(255,255,255,0.5);
}

.photo-card:hover { 
    transform: translateY(-8px); 
    box-shadow: var(--shadow-hover); 
    border-color: rgba(77, 166, 255, 0.3);
}

.photo-card img { 
    width: 100%; 
    aspect-ratio: 16/9;
    border-radius: 10px; 
    margin-bottom: 12px; 
    object-fit: cover;
}

.photo-card h4 { 
    font-size: 16px; 
    margin-bottom: 5px; 
    line-height: 1.3; 
}

.photo-card p { 
    font-size: 13px; 
    color: var(--text-muted); 
}

/* =========================================
   EPISODE PAGE
   ========================================= */
.detail-container { 
    padding: 40px 20px; 
    max-width: 900px; 
    margin: auto; 
}

.video-container { 
    width: 100%; 
    border-radius: 16px; 
    overflow: hidden; 
    background: #000; 
    box-shadow: 0 15px 35px rgba(0,0,0,0.25); 
    margin-bottom: 30px; 
}

.chapters-menu { 
    display: flex; 
    justify-content: center; 
    gap: 12px; 
    padding: 15px; 
    background: #1a1a1a; 
    flex-wrap: wrap; 
}

.chapter-btn { 
    background: #333; 
    color: white; 
    border: 1px solid #444; 
    padding: 10px 20px; 
    border-radius: 8px; 
    cursor: pointer; 
    font-size: 14px; 
    font-weight: 600;
    transition: all 0.3s ease; 
}

.chapter-btn:hover { 
    background: #555; 
    border-color: #777; 
}

.chapter-btn.active-btn { 
    background: var(--blue-gradient); 
    border-color: transparent; 
    box-shadow: 0 4px 15px var(--blue-glow);
}

.plyr--video .plyr__control--overlaid, 
.plyr--video .plyr__control:hover { 
    background: var(--blue-gradient) !important; 
}

.detail-title { 
    font-size: 28px; 
    color: var(--text-main); 
    margin-bottom: 5px; 
    font-weight: 700; 
}

.detail-upload { 
    color: var(--text-muted); 
    font-size: 14px; 
    margin-bottom: 25px; 
}

.detail-desc { 
    margin: 15px 0 25px 0; 
    line-height: 1.8; 
    color: #444; 
    background: white; 
    padding: 20px; 
    border-radius: 12px; 
    box-shadow: var(--shadow-soft); 
}

.detail-info { 
    list-style: none; 
    margin: 15px 0 30px 0; 
    background: white; 
    padding: 15px 20px; 
    border-radius: 12px; 
    box-shadow: var(--shadow-soft); 
}

.detail-info li { 
    padding: 10px 0; 
    border-bottom: 1px solid #eee; 
    color: #555; 
}

.detail-info li:last-child { 
    border-bottom: none; 
}

/* EPISODE NAVIGATION */
.episode-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    gap: 15px;
}

.nav-btn {
    flex: 1;
    text-align: center;
    background: var(--blue-gradient);
    color: white !important;
    padding: 12px 20px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--blue-glow);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--blue-glow);
}

.nav-btn.disabled {
    background: #e1e8ed;
    color: #a0aec0 !important;
    box-shadow: none;
    cursor: not-allowed;
    pointer-events: none;
    transform: none;
}

/* ALT BUTTONS & DOWNLOAD */
.alt-btn { 
    background: var(--blue-gradient); 
    display: block; 
    padding: 16px; 
    border-radius: 12px; 
    text-align: center; 
    color: white; 
    text-decoration: none; 
    font-weight: 700; 
    font-size: 16px;
    transition: all 0.3s ease; 
    box-shadow: 0 6px 20px var(--blue-glow);
}

.alt-btn:hover { 
    background: var(--blue-hover); 
    transform: translateY(-3px);
    box-shadow: 0 10px 25px var(--blue-glow);
}

/* =========================================
   FEEDBACK PAGE & ADMIN FORMS
   ========================================= */
.feedback-box { 
    background: var(--card-bg); 
    padding: 40px; 
    border-radius: 16px; 
    box-shadow: var(--shadow-soft); 
    max-width: 600px; 
    margin: 0 auto; 
    border-top: 5px solid var(--blue-main);
}

.feedback-box h2 { 
    color: var(--text-main); 
    font-size: 26px; 
    margin-bottom: 5px; 
}

.form-group { 
    margin-bottom: 20px; 
}

.form-control { 
    width: 100%; 
    padding: 16px; 
    border: 2px solid #e1e8ed; 
    border-radius: 10px; 
    font-size: 15px; 
    outline: none; 
    transition: all 0.3s ease; 
    background: #f8fafc; 
    color: var(--text-main);
}

.form-control:focus { 
    border-color: var(--blue-main); 
    background: #fff; 
    box-shadow: 0 0 0 4px var(--blue-glow);
}

.form-control::placeholder { 
    color: #a0aec0; 
}

select.form-control { 
    cursor: pointer; 
    appearance: auto; 
}

textarea.form-control { 
    resize: vertical; 
    min-height: 120px; 
}

.submit-btn { 
    width: 100%; 
    padding: 16px; 
    background: var(--blue-gradient); 
    color: white; 
    border: none; 
    border-radius: 10px; 
    font-size: 16px; 
    font-weight: 700; 
    cursor: pointer; 
    transition: all 0.3s ease; 
    box-shadow: 0 6px 20px var(--blue-glow);
    margin-top: 10px;
}

.submit-btn:hover { 
    background: var(--blue-hover); 
    transform: translateY(-2px);
    box-shadow: 0 10px 25px var(--blue-glow);
}

.submit-btn:disabled { 
    background: #a0aec0; 
    box-shadow: none;
    cursor: not-allowed; 
    transform: none;
}

/* =========================================
   ADMIN CONSOLE TABS & CHECKBOXES
   ========================================= */
.tabs { 
    display: flex; 
    gap: 10px; 
    margin-bottom: 20px; 
    justify-content: center; 
}

.tab-btn { 
    padding: 12px 24px; 
    border: none; 
    border-radius: 12px; 
    font-weight: bold; 
    cursor: pointer; 
    background: #e2e8f0; 
    color: #475569; 
    transition: all 0.3s; 
}

.tab-btn.active { 
    background: var(--blue-gradient); 
    color: white; 
    box-shadow: 0 4px 15px var(--blue-glow); 
}

.tab-content { 
    display: none; 
}

.tab-content.active { 
    display: block; 
}

.checkbox-group { 
    display: flex; 
    gap: 20px; 
    align-items: center; 
    padding: 12px; 
    background: white; 
    border-radius: 8px; 
    border: 2px solid #e1e8ed; 
}

.checkbox-group label { 
    cursor: pointer; 
    font-weight: 600; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
}

/* =========================================
   FOOTER
   ========================================= */
.site-footer { 
    background: #0f172a; 
    color: #94a3b8; 
    padding: 50px 20px; 
    margin-top: 60px; 
    text-align: center;
}

.footer-brand { 
    font-size: 28px; 
    color: #fff; 
    font-weight: 800; 
    font-style: italic; 
    margin-bottom: 15px; 
    background: var(--blue-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.site-footer p { 
    margin: 8px 0; 
    font-size: 15px; 
}

.footer-socials { 
    display: flex; 
    justify-content: center; 
    gap: 15px; 
    margin-top: 25px; 
}

.footer-socials a { 
    width: 45px; 
    height: 45px; 
    border-radius: 50%; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    color: #fff; 
    text-decoration: none; 
    font-size: 20px; 
    transition: all 0.3s ease; 
    background: #1e293b;
}

.footer-socials a:hover { 
    transform: translateY(-4px) scale(1.1); 
    box-shadow: 0 10px 20px rgba(0,0,0,0.5); 
}

.soc-ig:hover { background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); }
.soc-fb:hover { background: linear-gradient(180deg, #1877F2 0%, #0056b3 100%); }
.soc-x:hover { background: #000; border: 1px solid #333; }
.soc-tg:hover { background: #0088cc; }
.soc-tt:hover { background: #000; border: 1px solid #333; }

/* =========================================
   MEDIA QUERIES (RESPONSIVE)
   ========================================= */
@media (max-width: 768px) {
    .hero-box { 
        padding: 40px 20px; 
    }
    .hero-box h1 { 
        font-size: 2.5rem; 
    }
    .series-header { 
        flex-direction: column; 
        padding: 20px; 
    }
}

@media (max-width: 600px) {
    .nav-btn {
        font-size: 13px;
        padding: 10px 15px;
    }

    /* --- HERO IMAGE SLIDER & BANNER OVERLAYS --- */
    .hero-slider-bg {
        position: absolute;
        top: 0; left: 0; width: 100%; height: 100%;
        z-index: 1;
    }

    .slide {
        position: absolute;
        top: 0; left: 0; width: 100%; height: 100%;
        background-size: cover;
        background-position: center top;
        opacity: 0;
        transition: opacity 1.5s ease-in-out;
    }

    .slide.active {
        opacity: 1;
    }

    .hero-overlay {
        position: absolute;
        top: 0; left: 0; width: 100%; height: 100%;
        /* Creates a dark blue gradient that fades out to the right */
        background: linear-gradient(to right, rgba(10, 25, 50, 0.95) 0%, rgba(77, 166, 255, 0.4) 100%);
        z-index: 2;
    }

    .hero-content {
        position: relative;
        z-index: 3;
    }

    /* Ensure Series Hero Text is crisp over images */
    .hero-content h1, .hero-content p {
        color: #ffffff;
        text-shadow: 0 2px 10px rgba(0,0,0,0.6);
    }
}

/* =========================================
   POPUP BANNER FEATURE
   ========================================= */
.popup-overlay {
    position: fixed;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    backdrop-filter: blur(0px);
}

.popup-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.popup-box {
    /* Prevents the image from tiling/repeating */
    background-repeat: no-repeat;
    /* Scales image to fill box; zoom is now controlled by padding below */
    background-size: cover;
    /* Shifts the image up slightly (20%) to show more of the top 'sky' area */
    background-position: center 20%; 
    width: 90%;
    max-width: 500px;
    /* Reduced vertical padding (40px) 'un-zooms' the image naturally */
    padding: 40px 30px; 
    border-radius: 24px;
    text-align: center;
    color: white;
    position: relative;
    box-shadow: 0 0 40px var(--blue-glow);
    transform: translateY(30px) scale(0.95);
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.popup-overlay.active .popup-box {
    transform: translateY(0) scale(1);
}

.popup-close-x {
    position: absolute;
    top: 15px; 
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none; 
    color: white;
    font-size: 20px; 
    width: 35px; 
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex; 
    justify-content: center; 
    align-items: center;
}

.popup-close-x:hover {
    background: #ef4444;
    transform: rotate(90deg);
}

.popup-box h2 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 15px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.popup-box p {
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 30px;
    color: #f1f5f9;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
    white-space: pre-line; 
}

.popup-action-btn {
    display: inline-block;
    background: var(--blue-gradient);
    color: white;
    padding: 14px 30px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 16px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 20px var(--blue-glow);
    transition: all 0.3s ease;
}

.popup-action-btn:hover {
    background: var(--blue-hover);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px var(--blue-glow);
}

/* =========================================
   HOMEPAGE HORIZONTAL SCROLL CARDS
   ========================================= */
.featured-movie-card {
    flex: 0 0 400px; /* Keeps the larger width for Movies/Songs/Specials */
}

/* Restricts the main Series cards so they scroll horizontally perfectly */
.home-series-card {
    flex: 0 0 400px; 
}

/* Ensure the text doesn't squash the arrow icon */
.featured-movie-card .movie-text-content {
    padding-right: 15px;
}
.featured-movie-card .series-icon {
    flex-shrink: 0;
}

/* Adjust text styling specifically for movies so long titles/dates look good */
.featured-movie-card .series-info h3 {
    font-size: 18px; 
    line-height: 1.4;
    margin-bottom: 6px;
}

.featured-movie-card .series-info p {
    font-size: 13px;
    text-transform: none; /* Removes ALL CAPS so standard sentences look normal */
    letter-spacing: normal;
    font-weight: 500;
    color: #64748b;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .featured-movie-card {
        flex: 0 0 360px;
    }
    .home-series-card {
        flex: 0 0 360px;
    }
}

/* =========================================
   YOUTUBE ENGINE & UNIFIED SUBTITLES
   ========================================= */
.yt-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    height: 0;
    background: #000;
    overflow: hidden;
}

#yt-player-element {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
}

/* --- UNIFIED SUBTITLE STYLING (Plyr & YouTube) --- */
#yt-subtitle-overlay {
    position: absolute;
    bottom: 12%;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 2147483647;
    pointer-events: none;
    display: flex;
    justify-content: center;
}

/* ADJUSTED SUBTITLE SIZES & OPACITY */
.subtitle-text, 
.plyr__captions .plyr__caption {
    background: rgba(0, 0, 0, 0.65) !important; 
    color: #ffffff !important;
    padding: 4px 10px !important; 
    border-radius: 6px !important; 
    
    /* Scaled down non-fullscreen size */
    font-size: clamp(13px, 1.5vw, 18px) !important; 
    
    font-family: 'Poppins', sans-serif !important;
    font-weight: 500 !important; 
    text-shadow: 0 1px 2px rgba(0,0,0,0.5) !important;
    max-width: 80% !important; 
    line-height: 1.4 !important;
    letter-spacing: 0.2px !important;
    display: inline-block;
}

/* TV-Friendly Subtitles ONLY when in Fullscreen */
#master-video-wrapper:fullscreen .subtitle-text,
#master-video-wrapper:fullscreen .plyr__captions .plyr__caption,
#master-video-wrapper:-webkit-full-screen .subtitle-text,
#master-video-wrapper:-webkit-full-screen .plyr__captions .plyr__caption {
    font-size: clamp(16px, 2.2vw, 26px) !important; 
    padding: 6px 14px !important;
}

/* --- SLEEK YOUTUBE CONTROLS (Bottom-Right Glass Pill) --- */
#yt-custom-controls, #iframe-custom-controls {
    position: absolute;
    bottom: 85px; 
    right: 20px;
    z-index: 2147483647;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(15, 23, 42, 0.75); 
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 8px 18px; 
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    
    /* Starts hidden, revealed by JS class */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px); 
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Move the Captionfy controls further left to prevent it from feeling cramped */
#iframe-custom-controls {
    right: 50px; 
}

/* Activated by JS when mouse moves */
#yt-custom-controls.show-controls, #iframe-custom-controls.show-controls {
    opacity: 1; 
    visibility: visible;
    transform: translateY(0);
}

.yt-ctrl-btn {
    background: transparent;
    color: #f8fafc;
    border: none;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    transition: all 0.3s ease;
    padding: 0;
}

.yt-ctrl-btn:hover { 
    color: var(--blue-main); 
    transform: scale(1.05);
}

/* --- CUSTOM LIQUID GLASS DROPDOWN --- */
/* Standard styling */
.yt-select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 5px; /* Reduced default padding */
    cursor: pointer;
    transition: color 0.3s ease;
}

/* Only show the divider line IF there is a button next to it (YouTube style) */
#yt-custom-controls .yt-select-wrapper {
    border-right: 1px solid rgba(255,255,255,0.3);
    padding-right: 15px;
    margin-right: 5px;
}

#yt-current-sub-label,
#iframe-current-sub-label {
    color: #f8fafc;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    transition: color 0.3s ease;
}

.yt-select-wrapper i {
    color: #f8fafc;
    font-size: 14px;
    transition: color 0.3s ease;
}

.yt-select-wrapper:hover i,
.yt-select-wrapper:hover #yt-current-sub-label,
.yt-select-wrapper:hover #iframe-current-sub-label {
    color: var(--blue-main);
}

.glass-dropdown {
    position: absolute;
    bottom: calc(100% + 15px); /* Opens upwards above the pill */
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(15, 23, 42, 0.85); /* Slightly darker glass for readability */
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    list-style: none;
    padding: 6px 0;
    margin: 0;
    min-width: 130px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 100;
}

.glass-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.glass-dropdown li {
    padding: 10px 16px;
    color: #e2e8f0;
    font-size: 13px;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.glass-dropdown li:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.glass-dropdown li.active {
    color: var(--blue-main);
    font-weight: 700;
    background: rgba(77, 166, 255, 0.1);
}

/* =========================================
   CUSTOM MASTER LOADING STATE (SEGMENT TRANSITIONS)
   ========================================= */
#master-video-wrapper {
    /* Locks the container size so controls don't jump to the top during loads */
    aspect-ratio: 16 / 9; 
    background: #000;
    border-radius: 16px; /* Smooth corners for the main player */
    overflow: hidden;
}

#master-video-wrapper.segment-loading .plyr__control--overlaid,
#master-video-wrapper.segment-loading iframe,
#master-video-wrapper.segment-loading video,
#master-video-wrapper.segment-loading .yt-wrapper {
    opacity: 0 !important;
    pointer-events: none !important;
}

#master-video-wrapper.segment-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    margin: -22px 0 0 -22px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--blue-main);
    border-radius: 50%;
    animation: segment-spin 0.8s linear infinite;
    z-index: 2147483647;
}

@keyframes segment-spin {
    to { transform: rotate(360deg); }
}

/* =========================================
   FULLSCREEN OVERRIDES (Fixes Mobile Black Bars & Corners)
   ========================================= */

/* 1. Stop mobile browsers from flashing blue/white when tapping the screen */
html, body, #master-video-wrapper, #master-video-wrapper * {
    -webkit-tap-highlight-color: transparent !important;
    outline: none !important;
}

/* -----------------------------------------
   2. PC & STANDARD BROWSERS
   ----------------------------------------- */
#master-video-wrapper:fullscreen {
    border-radius: 0 !important; 
    aspect-ratio: auto !important; 
    width: 100% !important;
    height: 100% !important;
    background-color: #000 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
#master-video-wrapper:fullscreen #plyr-container,
#master-video-wrapper:fullscreen #youtube-engine-container,
#master-video-wrapper:fullscreen #iframe-outer-container {
    height: 100% !important;
    width: 100% !important;
    background-color: #000 !important;
}
#master-video-wrapper:fullscreen .plyr,
#master-video-wrapper:fullscreen video,
#master-video-wrapper:fullscreen iframe,
#master-video-wrapper:fullscreen .yt-wrapper {
    border-radius: 0 !important;
    height: 100% !important;
    width: 100% !important;
}
#master-video-wrapper:fullscreen .yt-wrapper,
#master-video-wrapper:fullscreen #iframe-main-wrapper {
    padding-bottom: 0 !important;
}

/* -----------------------------------------
   3. MOBILE & SAFARI (Webkit)
   ----------------------------------------- */
#master-video-wrapper:-webkit-full-screen {
    border-radius: 0 !important; 
    aspect-ratio: auto !important; 
    width: 100% !important;
    height: 100% !important;
    background-color: #000 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
#master-video-wrapper:-webkit-full-screen #plyr-container,
#master-video-wrapper:-webkit-full-screen #youtube-engine-container,
#master-video-wrapper:-webkit-full-screen #iframe-outer-container {
    height: 100% !important;
    width: 100% !important;
    background-color: #000 !important;
}
#master-video-wrapper:-webkit-full-screen .plyr,
#master-video-wrapper:-webkit-full-screen video,
#master-video-wrapper:-webkit-full-screen iframe,
#master-video-wrapper:-webkit-full-screen .yt-wrapper {
    border-radius: 0 !important;
    height: 100% !important;
    width: 100% !important;
}
#master-video-wrapper:-webkit-full-screen .yt-wrapper,
#master-video-wrapper:-webkit-full-screen #iframe-main-wrapper {
    padding-bottom: 0 !important;
}

/* =========================================
   SERIES PAGE MEDIA TABS
   ========================================= */
.media-tabs {
    display: flex;
    gap: 15px;
    margin: -20px auto 30px auto;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 1200px;
    padding: 0 20px;
    position: relative;
    z-index: 10;
}

.media-tab-btn {
    padding: 14px 28px;
    border: none;
    border-radius: 50px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    background: var(--card-bg);
    color: var(--text-muted);
    box-shadow: var(--shadow-soft);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.media-tab-btn:hover {
    transform: translateY(-3px);
    color: var(--blue-main);
}

.media-tab-btn.active {
    background: var(--blue-gradient);
    color: white;
    box-shadow: 0 8px 25px var(--blue-glow);
}

/* Animations for tab switching */
.tab-content { display: none; opacity: 0; }
.tab-content.active { 
    display: block; 
    animation: fadeInTab 0.4s ease forwards; 
}

@keyframes fadeInTab {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   VIDEO WATERMARK
   ========================================= */
.ts-watermark {
    position: absolute;
    top: 23px;
    left: 20px;
    color: rgba(255, 255, 255, 0.9); /* White with slight transparency to look natural */
    font-family: 'Helvetica', Arial, sans-serif;
    font-size: clamp(30px, 3vw, 37px); /* Responsive sizing based on screen */
    font-weight: 720;
    letter-spacing: 1.5px;
    
    /* Security & Interaction */
    user-select: none; 
    -webkit-user-select: none;
    pointer-events: none; /* Clicks pass right through it */
    z-index: 2147483647; /* Forces it above all video engines */
    
    /* Make it visible even on bright video scenes */
    text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.6), 0px 0px 10px rgba(0, 0, 0, 0.4); 
    
    opacity: 0;
    transition: opacity 0.4s ease;
}

.ts-watermark.show-watermark {
    opacity: 1;
}

/* Adjust scale when the master wrapper goes fullscreen */
#master-video-wrapper:fullscreen .ts-watermark,
#master-video-wrapper:-webkit-full-screen .ts-watermark {
    top: 40px;
    left: 30px;
    font-size: clamp(45px, 3vw, 50px);
}

/* =========================================
   INVISIBLE WAKE SHIELD FOR IFRAMES
   ========================================= */
#wake-shield {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 50; /* Sits above the video but below the custom controls */
    background: transparent;
    pointer-events: none; /* Defaults to allowing clicks through to the video */
}
