* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    min-width: 0;
    min-height: 0;
}

html {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    overflow: hidden;
    overflow-x: hidden;
    background: #000;
    width: 100%;
    max-width: 100vw;
    margin: 0;
    padding: 0;
    position: relative;
}

/* Force all content to respect viewport bounds */
body>* {
    max-width: 100vw;
}

.reels-container {
    width: 100%;
    max-width: 100vw;
    height: calc(100vh);
    height: calc(100dvh);
    /* height: calc(100vh - 50px);
    height: calc(100dvh - 50px); */
    overflow-y: scroll;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.reels-container::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.reels-container {
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

.reel {
    width: 100%;
    max-width: 100%;
    height: 100%;
    scroll-snap-align: start;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #000;
}

.reel-content {
    width: 100%;
    max-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

/* HTML Reel */
.reel-html {
    width: 100%;
    max-width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.reel-html iframe {
    width: 100%;
    max-width: 100%;
    height: 100%;
    border: none;
    display: block;
    overflow: hidden;
}

/* Image Reel */
.reel-image {
    width: 100%;
    max-width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.reel-image img {
    width: 100%;
    max-width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Video Reel */
.reel-video {
    width: 100%;
    max-width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.video-script-container {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
}

.video-script-container iframe {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    border: none;
    pointer-events: none;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}

/* Stream Reel (Cloudflare Stream) */
.reel-stream {
    width: 100%;
    max-width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background: #000;
}

.stream-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.stream-mute-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 10;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Sound overlay (tap to enable sound) */
.sound-overlay {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 15px;
    cursor: pointer;
    z-index: 10;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    backdrop-filter: blur(10px);
    white-space: nowrap;
    animation: soundOverlayIn 0.3s ease;
}

@keyframes soundOverlayIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* VAST Ad */
.vast-ad-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 5;
    display: none;
    background: #000;
}

.vast-countdown {
    position: absolute;
    bottom: 20px;
    left: 20px;
    color: #fff;
    background: rgba(0, 0, 0, 0.7);
    padding: 6px 14px;
    border-radius: 15px;
    font-size: 13px;
    z-index: 6;
    display: none;
    backdrop-filter: blur(10px);
}

.vast-skip-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    color: #fff;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 16px;
    border-radius: 15px;
    font-size: 13px;
    cursor: pointer;
    z-index: 6;
    display: none;
    backdrop-filter: blur(10px);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Video controls */
.video-controls {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1100;
    display: none;
    gap: 10px;
}

.reel.active .video-controls {
    display: flex;
}

.video-control-btn {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.8);
    color: white;
    font-size: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-control-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.video-control-btn:active {
    transform: scale(0.95);
}

/* Progress indicator */
.progress-indicator {
    position: fixed;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transition: all 0.3s;
    cursor: pointer;
}

.progress-dot.active {
    background: white;
    height: 20px;
    border-radius: 4px;
}

/* Ad Reel */
.reel-ad .reel-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Close button */
.close-btn {
    position: fixed;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 22px;
    line-height: 36px;
    text-align: center;
    text-decoration: none;
    z-index: 1100;
    cursor: pointer;
    backdrop-filter: blur(10px);
}

/* Info overlay */
.info-overlay {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    backdrop-filter: blur(10px);
    color: white;
}

/* Loading indicator */
.loading-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 1001;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    color: white;
}

.loading-indicator.visible {
    opacity: 1;
    pointer-events: all;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

/* Controls */
.controls {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    z-index: 1000;
}

.control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 24px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Responsive */
@media (max-width: 768px) {
    .progress-indicator {
        right: 5px;
        gap: 6px;
    }

    .progress-dot {
        width: 6px;
        height: 6px;
    }

    .progress-dot.active {
        height: 16px;
    }

    .controls {
        bottom: 20px;
    }

    .control-btn {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }

    .video-controls {
        top: 50%;
    }

    .video-control-btn {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
}

/* ===== Card Reel (type 5) ===== */

@keyframes cardZoomOut {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.12);
    }
}

@keyframes cardFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes cardSlideUp {
    from {
        transform: translateY(40px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.reel-card {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #111;
}

.card-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
    /* animation started by JS in playCardReel */
}

.card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.2) 50%, transparent 100%);
    z-index: 1;
    pointer-events: none;
}

.card-body {
    position: absolute;
    bottom: 160px;
    left: 0;
    right: 0;
    padding: 0 24px;
    z-index: 2;
}

.card-title {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
    font-size: 32px;
    font-weight: bold;
    color: #fff;
    line-height: 1.2;
    margin-bottom: 10px;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
    /* no animation – always visible */
}

.card-desc {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.88);
    line-height: 1.5;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
    animation: cardFadeIn 1s ease both;
    animation-delay: 0.3s;
}

.card-cta {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    display: inline-block;
    padding: 11px 36px;
    background: #fff;
    color: #111;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    border-radius: 30px;
    white-space: nowrap;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.4);
    height: 45px;
}

/* (animate-zoom-out class removed — animation set via JS) */

/* Ad countdown overlay */
.ad-countdown-overlay {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 10px 22px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    z-index: 10;
    white-space: nowrap;
    backdrop-filter: blur(8px);
    pointer-events: none;
    animation: adCountdownIn 0.3s ease;
}

@keyframes adCountdownIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Previous page trigger reel */
.reel-prev-page {
    height: 120px !important;
    min-height: 120px;
    max-height: 120px;
    margin-bottom: 0 !important;
    background: #000;
    cursor: pointer;
}

.prev-page-trigger {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    animation: prevPagePulse 2s ease-in-out infinite;
}

.prev-page-arrow {
    font-size: 32px;
    margin-bottom: 4px;
}

.prev-page-text {
    font-size: 14px;
}

@keyframes prevPagePulse {

    0%,
    100% {
        opacity: 0.5;
        transform: translateY(0);
    }

    50% {
        opacity: 1;
        transform: translateY(-5px);
    }
}

.reel-next-page {
    background: #000;
    cursor: pointer;
}

.next-page-trigger {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    animation: nextPagePulse 2s ease-in-out infinite;
}

.next-page-arrow {
    font-size: 32px;
    margin-bottom: 4px;
}

.next-page-text {
    font-size: 14px;
}

@keyframes nextPagePulse {

    0%,
    100% {
        opacity: 0.5;
        transform: translateY(0);
    }

    50% {
        opacity: 1;
        transform: translateY(5px);
    }
}

/* Touch gestures */
@media (hover: none) {
    .control-btn:active {
        transform: scale(0.95);
    }
}