body {
    font-family: 'Inter', sans-serif;
    background-color: #080A0F;
    color: #F3F4F6;
    overflow-x: hidden;
}

[hidden] { display: none !important; }

.glass-header {
    background: rgba(8, 10, 15, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
.glass-card {
    background: rgba(19, 23, 34, 0.75);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.07);
}
.glass-panel {
    background: rgba(26, 31, 44, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #080A0F; }
::-webkit-scrollbar-thumb { background: #232A3B; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #E50914; }

.poster-card {
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.poster-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.9), 0 0 25px 2px rgba(229, 9, 20, 0.3);
}
.poster-card:hover .play-btn-overlay {
    opacity: 1;
    transform: scale(1);
}
.poster-card:hover .poster-img {
    transform: scale(1.08);
}

.glow-red {
    box-shadow: 0 0 25px rgba(229, 9, 20, 0.45);
}

input[type="range"] {
    accent-color: #E50914;
}

.skeleton {
    background: linear-gradient(90deg, #111827 0%, #1f2937 50%, #111827 100%);
    background-size: 200% 100%;
    animation: skeleton-move 1.2s ease-in-out infinite;
}
@keyframes skeleton-move {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Watch page: one vertical player for every screen (phone = full screen, desktop = centered 9:16 column) */
body.watch-page {
    margin: 0;
    overflow: hidden;
    background: #000;
}
body.watch-page #playerShell {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0 auto;
    width: min(100vw, 56.25vh);
    width: min(100vw, 56.25svh);
    height: 100vh;
    height: 100svh;
    z-index: 40;
}
@media (min-width: 640px) {
    body.watch-page #playerShell {
        border-left: 1px solid rgba(255, 255, 255, 0.06);
        border-right: 1px solid rgba(255, 255, 255, 0.06);
        box-shadow: 0 0 80px rgba(229, 9, 20, 0.08);
    }
}
body.watch-page #playerShell:fullscreen {
    width: 100vw;
    height: 100vh;
    border: 0;
}
body.watch-page #playerShell:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    border: 0;
}
body.watch-page #customSub {
    width: 76%;
    left: 46%;
}

#playerShell .player-chrome {
    transition: opacity 0.25s ease;
}
#playerShell button:focus:not(:focus-visible),
#playerShell a:focus:not(:focus-visible) {
    outline: none;
}
#playerShell.is-idle .player-chrome {
    opacity: 0;
    pointer-events: none;
}
#playerShell.is-idle {
    cursor: none;
}

/* Mobile: đưa khung thông báo quảng cáo từ mép trên xuống cuối màn hình.
   #sdfsQAwe23sdf = HilltopAds In-Page Push, sát đáy;
   iframe#container-… = Adsterra Social Bar, xếp ngay trên nó (--inpage-push-h do ads.js đo) để hai khung không đè nhau. */
@media (max-width: 639px) {
    #sdfsQAwe23sdf {
        top: auto !important;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 8px) !important;
    }
    iframe[id^="container-"] {
        top: auto !important;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 8px + var(--inpage-push-h, 0px)) !important;
    }
}

/* Vuốt lên/xuống để chuyển tập (thiết bị cảm ứng) */
html:has(> body.watch-page) {
    overscroll-behavior: none;
}
#playerShell.episode-swipe-active #vidPlayer {
    z-index: 14;
}
#episodeSwipePeeks {
    position: absolute;
    inset: 0;
    z-index: 16;
    pointer-events: none;
}
#playerShell.episode-swipe-active #episodeSwipePeeks {
    z-index: 22;
}
.episode-swipe-peek {
    position: absolute;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    opacity: 0;
    color: #fff;
    text-align: center;
    transition: opacity 0.06s linear;
}
.episode-swipe-peek.visible {
    opacity: 1;
}
.episode-swipe-peek--prev {
    top: 0;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 14px 16px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.45) 55%, transparent 100%);
}
.episode-swipe-peek--next {
    bottom: 0;
    flex-direction: column-reverse;
    padding: 16px 14px calc(8px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to top, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.45) 55%, transparent 100%);
}
.episode-swipe-arrow {
    font-size: 24px;
    line-height: 1;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
}
.episode-swipe-label {
    max-width: 78%;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.65);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.episode-swipe-peek.boundary .episode-swipe-label {
    opacity: 0.72;
}
#vidPlayer.episode-swipe-moving {
    transition: none;
    will-change: transform;
}
#vidPlayer.episode-swipe-animate {
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

#customSub {
    position: absolute;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 92%;
    text-align: center;
    font-weight: 700;
    line-height: 1.35;
    white-space: pre-line;
    pointer-events: none;
    z-index: 15;
}
.sub-color-white {
    color: #fff;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000, 0 0 6px rgba(0, 0, 0, 0.8);
}
.sub-color-black {
    color: #000;
    text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff;
}
.sub-color-yellow {
    color: #facc15;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000, 0 0 6px rgba(0, 0, 0, 0.8);
}

.spinner {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.15);
    border-top-color: #E50914;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
