:root {
    --reel-width-desktop: 410px;
    --reel-aspect-ratio: 9 / 16;
    --clips-header-offset: 88px;
    --clips-top-gap: 0px;
    --clips-bottom-gap: 28px;
    /*--reel-max-height: min(760px, calc(100dvh - var(--clips-header-offset) - var(--clips-top-gap) - var(--clips-bottom-gap)));*/
    --reel-max-height: min(850px, calc(100dvh - var(--clips-header-offset) - var(--clips-top-gap) - var(--clips-bottom-gap)));
    --reel-radius: 28px;
    --clip-progress-height: 4px;
}

body {
    background: radial-gradient(circle at 50% 6%, rgba(229, 9, 20, 0.2), transparent 30%), radial-gradient(circle at 14% 70%, rgba(255, 255, 255, 0.06), transparent 22%), linear-gradient(180deg, #08090d 0%, #111217 46%, #090a0d 100%);
}

.clips-page {
    min-height: 100dvh;
    color: #fff;
}

.clips-topbar {
    background: linear-gradient(180deg, rgba(8, 9, 13, 0.88), rgba(8, 9, 13, 0.18));
}

.clips-main {
    min-height: calc(100dvh - var(--clips-header-offset));
    padding: calc(var(--clips-header-offset) + var(--clips-top-gap) + env(safe-area-inset-top, 0px)) 0 calc(var(--clips-bottom-gap) + env(safe-area-inset-bottom, 0px));
}

.clips-stage {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    place-items: start center;
    width: min(100% - 2rem, 1320px);
    min-height: calc(100dvh - var(--clips-header-offset) - var(--clips-top-gap) - var(--clips-bottom-gap));
    margin: 0 auto;
}

.clips-stage__ambient {
    position: absolute;
    inset: 8% 18% 6%;
    z-index: 0;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(229, 9, 20, 0.18), transparent 58%), linear-gradient(90deg, rgba(255, 255, 255, 0.05), transparent);
    filter: blur(30px);
    pointer-events: none;
}

.clips-viewer {
    position: relative;
    z-index: 1;
    display: grid;
    justify-items: center;
    min-width: 0;
}

.clips-feed {
    width: min(var(--reel-width-desktop), calc((var(--reel-max-height) * 9) / 16));
    max-width: 100%;
    height: var(--reel-max-height);
    max-height: var(--reel-max-height);
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    overscroll-behavior-y: contain;
    border-radius: var(--reel-radius);
    scrollbar-width: none;
}

    .clips-feed::-webkit-scrollbar {
        display: none;
    }

.clip-reel {
    position: relative;
    width: 100%;
    aspect-ratio: var(--reel-aspect-ratio);
    max-height: var(--reel-max-height);
    min-height: 100%;
    margin: 0 auto;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--reel-radius);
    background: #111217;
    box-shadow: 0 34px 90px rgba(0, 0, 0, 0.58), 0 0 0 1px rgba(229, 9, 20, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

    .clip-reel + .clip-reel {
        margin-top: 1rem;
    }

    .clip-reel.is-active {
        border-color: rgba(229, 9, 20, 0.34);
        box-shadow: 0 36px 98px rgba(0, 0, 0, 0.62), 0 0 52px rgba(229, 9, 20, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.18);
    }

.clip-reel__video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    background: transparent;
    opacity: 0;
    transition: opacity 0.32s ease;
    pointer-events: none;
}

.clip-reel.is-active .clip-reel__video,
.clip-reel.is-playing .clip-reel__video {
    opacity: 1;
}

.clip-reel__loader {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 6;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.78rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.48);
    color: rgba(255, 255, 255, 0.86);
    font-size: 0.78rem;
    font-weight: 700;
    transform: translate(-50%, -50%);
    backdrop-filter: blur(14px);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.22s ease;
}

.clip-reel.is-loading .clip-reel__loader {
    opacity: 1;
}

.clip-reel__loader-dot {
    width: 0.48rem;
    height: 0.48rem;
    border-radius: 999px;
    background: var(--brand, #e50914);
    box-shadow: 0 0 16px rgba(229, 9, 20, 0.65);
    animation: clip-loader-pulse 0.9s ease-in-out infinite alternate;
}

.clip-reel.has-video-error .clip-reel__loader {
    opacity: 1;
}

    .clip-reel.has-video-error .clip-reel__loader span:last-child {
        font-size: 0;
    }

        .clip-reel.has-video-error .clip-reel__loader span:last-child::after {
            content: "Video could not load";
            font-size: 0.78rem;
        }

.clip-reel__shade {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.2) 0%, transparent 32%, rgba(0, 0, 0, 0.72) 100%), linear-gradient(90deg, rgba(0, 0, 0, 0.42) 0%, transparent 56%);
    pointer-events: none;
}

.clip-reel__top {
    position: absolute;
    top: max(1rem, env(safe-area-inset-top, 0px));
    left: 1rem;
    right: 1rem;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
}

.clip-reel__pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    padding: 0.48rem 0.72rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.34);
    color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(14px);
    font-size: 0.78rem;
    font-weight: 700;
}

    .clip-reel__pill i {
        color: var(--brand, #e50914);
    }

.clip-reel__sound-note {
    display: none;
}

.clip-reel__play-toggle {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.32);
    color: #fff;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.32);
    cursor: pointer;
}

    .clip-reel__play-toggle i {
        font-size: 1.1rem;
        line-height: 1;
    }

    .clip-reel__play-toggle:hover,
    .clip-reel__play-toggle:focus-visible {
        background: rgba(229, 9, 20, 0.28);
        border-color: rgba(229, 9, 20, 0.48);
    }

.clip-reel__content {
    position: absolute;
    left: clamp(1rem, 4vw, 1.35rem);
    right: 5.2rem;
    bottom: clamp(2.1rem, 5vw, 2.6rem);
    z-index: 3;
    min-width: 0;
}

.clip-reel__title {
    margin: 0 0 0.35rem;
    font-family: var(--font-display, "Plus Jakarta Sans", sans-serif);
    font-size: clamp(1.38rem, 5.4vw, 1.95rem);
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

.clip-reel__genres {
    margin: 0 0 0.5rem;
    color: rgba(255, 255, 255, 0.88);
    font-size: clamp(0.78rem, 2.4vw, 0.92rem);
    font-weight: 700;
    line-height: 1.45;
}

/*.clip-reel__description {
    display: -webkit-box;
    margin: 0;
    color: rgba(255, 255, 255, 0.82);
    font-size: clamp(0.78rem, 2.4vw, 0.9rem);
    line-height: 1.55;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
}*/

.clip-reel__description {
    display: block;
    margin: 0;
    color: rgba(255, 255, 255, 0.82);
    font-size: clamp(0.78rem, 2.4vw, 0.9rem);
    line-height: 1.55;
    overflow: visible;
}

.clip-reel.is-description-expanded .clip-reel__description {
    display: block;
    -webkit-line-clamp: unset;
}

/* After video starts playing */
.clip-reel.has-started-playing:not(.is-description-expanded) .clip-reel__description {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    overflow: hidden;
}

/* Show Read More after video starts */
.clip-reel.has-started-playing .clip-reel__description-toggle {
    display: inline-flex;
}

/* Expanded state */
.clip-reel.has-started-playing.is-description-expanded .clip-reel__description {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
}

.clip-reel__description-toggle {
    /*display: inline-flex;*/
    display: none;
    margin: 0.28rem 0 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #fff;
    font: inherit;
    font-size: clamp(0.78rem, 2.4vw, 0.9rem);
    font-weight: 800;
    line-height: 1.3;
}

    .clip-reel__description-toggle:hover,
    .clip-reel__description-toggle:focus-visible {
        color: #fff;
        text-decoration: underline;
    }

    .clip-reel__description-toggle[hidden] {
        display: none;
    }

/* Desktop only */
@media (min-width: 992px) {
    .clip-reel__title {
        font-size: 1.0rem;
    }

    .clip-reel__genres {
        margin: 0 0 0.5rem;
        color: rgba(255, 255, 255, 0.88);
        font-size: 0.7rem;
        font-weight: 700;
        line-height: 1.45;
    }

    .clip-reel__description {
        
        font-size: 0.7rem;
        line-height: 1.50;
        
    }

    .clip-reel__description-toggle {
        color: #ED1C24;
        font-size: 0.8rem;
        font-weight: 500;
        line-height: 1.3;
    }

    .clip-reel__play-toggle {
        margin-right: 12px;
    }
}

.clip-reel__actions {
    position: absolute;
    right: clamp(0.7rem, 3vw, 1rem);
    bottom: clamp(2.1rem, 5vw, 2.55rem);
    z-index: 4;
    display: grid;
    justify-items: center;
    gap: 0.85rem;
}

.clip-action {
    display: inline-grid;
    place-items: center;
    width: clamp(42px, 10vw, 50px);
    height: clamp(42px, 10vw, 50px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06)), rgba(0, 0, 0, 0.32);
    color: #fff;
    backdrop-filter: blur(16px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.16);
    transition: transform 0.22s ease, border-color 0.22s ease, background-color 0.22s ease, color 0.22s ease;
}


    .clip-action.is-active {
        border-color: rgba(255, 255, 255, 0.28);
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.08)), rgba(0, 0, 0, 0.36);
        color: #fff;
    }

    .clip-action:hover,
    .clip-action:focus-visible {
        transform: translateY(-2px) scale(1.04);
        border-color: rgba(229, 9, 20, 0.48);
        background-color: rgba(229, 9, 20, 0.18);
        color: #fff;
    }

    /*.clip-action.is-active {
        border-color: rgba(229, 9, 20, 0.68);
        background: linear-gradient(135deg, rgba(245, 20, 32, 0.92), rgba(119, 0, 8, 0.88));
    }*/

    

    .clip-action i {
        font-size: 1.2rem;
        line-height: 1;
    }

    .clip-action svg {
        width: 1.2rem;
        height: 1.2rem;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
        fill: none;
    }

.clip-action__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.clip-action {
    position: relative;
}

    .clip-action::after {
        content: attr(data-tooltip);
        position: absolute;
        right: calc(100% + 10px);
        top: 50%;
        transform: translateY(-50%) translateX(6px);
        padding: 7px 10px;
        border-radius: 999px;
        background: rgba(10, 10, 12, 0.92);
        color: #fff;
        font-size: 12px;
        font-weight: 700;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.18s ease, transform 0.18s ease;
        box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
        backdrop-filter: blur(12px);
    }

    .clip-action:hover::after,
    .clip-action:focus-visible::after {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }

/*.clip-reel__mini-poster {
    width: clamp(46px, 12vw, 58px);
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.72);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.42);
}*/

.clip-reel__mini-poster {
    width: clamp(46px, 12vw, 58px);
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.72);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

    /*.clip-reel__mini-poster img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }*/

    .clip-reel__mini-poster img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: center;
        display: block;
    }

.clip-reel__progress {
    position: absolute;
    left: clamp(1rem, 4vw, 1.35rem);
    right: clamp(1rem, 4vw, 1.35rem);
    bottom: clamp(0.8rem, 2.6vw, 1rem);
    z-index: 5;
    display: flex;
    align-items: center;
    height: 18px;
    cursor: pointer;
}

.clip-reel__progress-track {
    position: relative;
    width: 100%;
    height: var(--clip-progress-height);
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.45);
}

.clip-reel__progress-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--brand, #e50914), var(--brand-bright, #ff2c35));
    box-shadow: 0 0 16px rgba(229, 9, 20, 0.5);
}

.clips-share-toast {
    position: fixed;
    left: 50%;
    bottom: calc(1.4rem + env(safe-area-inset-bottom, 0px));
    z-index: 1060;
    width: min(360px, calc(100% - 2rem));
    padding: 0.9rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 18px;
    background: rgba(14, 15, 20, 0.92);
    color: #fff;
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.48);
    text-align: center;
    transform: translateX(-50%);
    backdrop-filter: blur(18px);
}

@media (min-width: 1500px) {
    :root {
        --reel-width-desktop: 430px;
        --clips-header-offset: 92px;
        --reel-max-height: min(790px, calc(100dvh - var(--clips-header-offset) - var(--clips-top-gap) - var(--clips-bottom-gap)));
    }
}

@media (max-width: 1199.98px) {
    .clips-stage {
        width: min(100% - 1.5rem, 820px);
    }
}

@media (max-width: 767.98px) {
    :root {
        --clips-header-offset: 78px;
        --clips-top-gap: 14px;
        --clips-bottom-gap: 16px;
        --reel-width-desktop: min(94vw, 430px);
        --reel-max-height: min(calc((94vw * 16) / 9), calc(100dvh - var(--clips-header-offset) - var(--clips-top-gap) - var(--clips-bottom-gap)));
        --reel-radius: 24px;
    }

    .clips-stage {
        width: min(100% - 0.85rem, 620px);
        min-height: calc(100dvh - var(--clips-header-offset) - var(--clips-top-gap) - var(--clips-bottom-gap));
    }

    .clip-reel__content {
        right: 4.65rem;
    }
}

@media (max-width: 390px) {
    :root {
        --reel-width-desktop: min(96vw, 390px);
        --reel-max-height: min(calc((96vw * 16) / 9), calc(100dvh - var(--clips-header-offset) - var(--clips-top-gap) - var(--clips-bottom-gap)));
        --reel-radius: 22px;
    }

    .clip-reel__description {
        -webkit-line-clamp: 2;
    }
}

@media (max-width: 340px) {
    :root {
        --reel-width-desktop: 96vw;
        --reel-max-height: min(calc((96vw * 16) / 9), calc(100dvh - var(--clips-header-offset) - var(--clips-top-gap) - var(--clips-bottom-gap)));
    }

    .clip-reel__content {
        right: 4.15rem;
    }

    .clip-reel__actions {
        gap: 0.65rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .clips-feed {
        scroll-behavior: auto;
    }

    .clip-action,
    .clip-reel__progress-fill {
        transition: none;
    }
}

@keyframes clip-loader-pulse {
    from {
        opacity: 0.45;
        transform: scale(0.85);
    }

    to {
        opacity: 1;
        transform: scale(1.12);
    }
}


/*toggle inactivity of controllers*/
.clip-reel__top,
.clip-reel__content,
.clip-reel__actions,
.clip-reel__progress {
    transition: opacity 0.28s ease, transform 0.28s ease;
}

.clips-feed.is-ui-hidden .clip-reel__top,
.clips-feed.is-ui-hidden .clip-reel__content,
.clips-feed.is-ui-hidden .clip-reel__actions,
.clips-feed.is-ui-hidden .clip-reel__progress {
    opacity: 0;
    pointer-events: none;
}

.clips-feed.is-ui-hidden .clip-reel__content {
    transform: translateY(14px);
}

.clips-feed.is-ui-hidden .clip-reel__actions {
    transform: translateX(14px);
}

#clipsFeed {
    scroll-padding-top: 90px; /* adjust based on navbar height */
}

/* Desktop/tablet only: resize and align right action buttons */
@media (min-width: 768px) {

    .clip-reel__actions {
        right: 1rem;
        bottom: 2.55rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-end;
        gap: 0.65rem;
    }

    .clip-action {
        width: 38px;
        height: 38px;
    }

        .clip-action i {
            font-size: 1.05rem;
        }

        .clip-action svg {
            width: 1.05rem;
            height: 1.05rem;
        }

    .clip-reel__mini-poster {
        width: clamp(46px, 12vw, 58px);
        height: auto;
        margin-top: 0.05rem;
    }
}

/* Mobile: do not reduce button size, only keep alignment clean */
@media (max-width: 767.98px) {

    .clip-reel__actions {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-end;
    }
}