.reels-title {
    margin-top: -30px;
    background: linear-gradient(180deg, #fff, #fefefe);
    width: fit-content;
}

.reels-title h1 {
    padding: 0;
    margin: 0;
    font-size: 24px;
    font-weight: 900;
    line-height: 56px;
}

.reels-content .view-reels-card {
    box-shadow: none;
    box-sizing: border-box;
    margin-bottom: 10px;
}

.reels-title span {
    color: var(--view-accent-400);
    font-family: inherit;
    font-size: 12px;
    line-height: 56px;
}

.reels-content {
    border: 1px solid #E9E9ED;
    border-radius: 32px;
    background: repeating-linear-gradient(to bottom, rgba(233, 233, 237, 0) 0%, rgba(233, 233, 237, .2) 10%, rgba(233, 233, 237, 0) 20%);
}

.reels-title, .view-reels-breadcrumb {
    margin-right: 16px;
}

/* ===== Card ===== */
.view-reels-card {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
}

.view-reels-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.view-reels-cover {
    position: relative;
    aspect-ratio: 9/16;
}

.view-reels-image, .view-reels-image-fallback {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.view-reels-image-fallback {
    background: linear-gradient(135deg, #2a2d3a, #1c1f2b);
}

.view-reels-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, .0) 30%, rgba(0, 0, 0, .55) 70%, rgba(0, 0, 0, .75) 100%);
    pointer-events: none;
}

.view-reels-time {
    position: absolute;
    top: 14px;
    color: #fff;
    padding: 6px 8px;
    border-radius: 8px;
    width: calc(100% - 16px);
    text-align: center;
}

.view-reels-body {
    position: absolute;
    bottom: 29px;
    color: #fff;
    inset-inline: 16px;
}

.view-reels-title {
    margin: 0 0 6px;
    font-weight: 900;
    font-size: 16px;
    line-height: 25px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.view-reels-subtitle {
    margin: 0 0 6px;
    font-weight: 500;
    font-size: 14px;
    color: #ffd27d;
}

.view-reels-excerpt {
    margin: 0;
    font-weight: 500;
    font-size: 14px;
    color: #dcdde1;
    opacity: .9;
    line-height: 20px;
}

.view-reels-card:hover .view-reels-image {
    transform: scale(1.02);
    transition: transform .35s ease;
}

/* ===== Overlay (یک نسخه‌ی واحد) ===== */
.reels-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(8, 8, 15, .65);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: .2s;
}

.reels-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.reels-host {
    position: relative;
}

/* ظرف میزبان (دسکتاپ) */
.reels-overlay .reels-host {
    max-width: 950px;
    width: 950px;
    height: 750px;
}

.reels-close {
    position: absolute;
    top: -12px;
    left: -12px;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 0;
    background: #fff;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

body.reels-locked {
    overflow: hidden;
}

/* ===== Popup Layout ===== */
.reels-popup {
    width: 950px;
    height: 750px;
    border-radius: 32px;
    background: #fff;
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    position: relative;
    overflow-y: scroll;
    scrollbar-width: none !important;
}

.reels-video {
    width: 50%;
    background: url('./image/poster.png');
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
    background-color: #000; /* جلوگیری از سفیدی */
}

.reels-video-el {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background-color: #000;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.reels-popup .reels-comments {
    width: 50%;
    padding: 54px 24px 24px 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

.reels-popup .reels-comments-wrap {
    border: 1px solid #E9E9ED;
    width: 100%;
    height: 100%;
    border-radius: 24px;
    box-sizing: border-box;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.reels-comments-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    margin: -47px 0 0 0;
    background: #fff;
    width: fit-content;
}

.reels-comments-header h3 {
    font-weight: 900;
    font-style: Black;
    font-size: 18px;
    text-align: right;
    line-height: 35px;
    margin: 0 0 0 8px;
    padding: 0;
}

.reels-popup .comments-wrapper {
    width: 100%;
    height: 50%;
    box-sizing: border-box;
}

.reels-popup .comments-form-wrapper {
    background: radial-gradient(55.4% 186.63% at 38.42% 75.04%, #5B51D8 0%, #41399A 100%);
    width: 100%;
    height: 40%;
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border-radius: 18px;
    position: relative;
    z-index: 0;
    overflow: hidden;
}

.reels-popup .comments-form-wrapper::after {
    content: '';
    position: absolute;
    background: url('../image/form-bg-left.png');
    top: 0;
    left: 0;
    width: 166px;
    height: 100%;
    z-index: -1;
}

.comments-form-wrapper::before {
    content: '';
    position: absolute;
    background: url('../image/form-bg-right.png');
    top: 0;
    right: 0;
    width: 47px;
    height: 100%;
    z-index: -1;
}

.comments-form {
    width: 100%;
    height: 100%;
    background: #fff;
    border-radius: 10px;
    padding: 8px;
    box-sizing: border-box;
}

.comments-form span {
    font-weight: 500;
    font-size: 14px;
    text-align: right;
}

.comments-form input, .comments-form textarea {
    background: #F0F4F6;
    color: #BDBCC8;
    width: 100%;
    height: 33px;
    border-radius: 8px;
    padding: 4px 16px;
    font-size: 14px;
    font-weight: 400;
    font-family: inherit;
    border: none;
    outline: none;
    box-sizing: border-box;
}

.comments-form textarea {
    height: 83px;
}

.comments-form input::placeholder, .comments-form textarea::placeholder {
    color: #BDBCC8;
    font-size: 14px;
    font-weight: 400;
    font-family: inherit;
}

.comments-form button {
    color: #E1306C;
    font-weight: 700;
    font-size: 18px;
    line-height: 26px;
    background: transparent;
    width: fit-content;
    cursor: pointer;
    font-family: inherit;
    border: none;
    outline: none;
    margin-top: 8px;
}

.comments {
    box-sizing: border-box;
    width: 100%;
    height: 143px;
    border-radius: 16px;
    border: 1px solid #221F471A;
    background: #fff;
    position: relative;
    z-index: 0;
    overflow: hidden;
    padding: 12px 24px 12px 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.comments::after {
    content: '';
    position: absolute;
    background: url('../image/comments-left.png');
    top: 0;
    left: 0;
    width: 28px;
    height: 100%;
    z-index: -1;
}

.comments::before {
    content: '';
    position: absolute;
    background: url('../image/comments-right.png');
    top: 0;
    right: 0;
    width: 44px;
    height: 100%;
    z-index: -1;
}

.comments .avatar-wrap img {
    width: 36px;
    height: 36px;
    border-radius: 999px;
}

.comments .avatar-wrap {
    border: 2px solid #5B51D8;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-radius: 999px;
}

.comments .username {
    font-weight: 600;
    font-size: 14px;
    text-align: right;
    padding: 0;
    margin: 0;
}

.comments .userole {
    color: #64627E;
    font-weight: 300;
    font-size: 12px;
    text-align: right;
    padding: 0;
    margin: 0;
}

.comments p:not(.username) {
    color: #64627E;
    font-weight: 400;
    font-size: 14px;
    line-height: 21px;
    margin: 0;
    padding: 0 50px 0 32px;
}

.comments .date {
    margin: 0 50px 0 32px;
    color: #ADA8EB;
    font-weight: 500;
    font-size: 14px;
    line-height: 22px;
    text-align: center;
    border-top: 1px solid;
    border-image: linear-gradient(90deg, #F6FAFF 0%, #E6ECFD 100%);
    border-image-slice: 1;
    padding: 8px 0 0 0;
}

/* Controls */
.reels-controls {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 10px;
}

.reels-timecode {
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: .3px;
    background: rgba(0, 0, 0, .35);
    border-radius: 999px;
    padding: 4px 8px;
}

.reels-video {
    position: relative;
}

.reels-video-el {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.reels-ctrl.reels-fav.is-active {
    background: rgba(225, 48, 108, .85);
}

.reels-overlay.is-open .instagram-link {
    display: block;
}

/* top bar layout */
.reels-bar {
    position: absolute;
    top: 24px;
    left: 24px;
    right: 24px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    z-index: 1000;
    flex-direction: row-reverse;
}

.reels-bar-left {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-direction: row-reverse;
}

.reels-bar-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.reels-bar-right {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
    padding: 8px;
    background: #ffffff4d;
    border-radius: 32px;
    box-sizing: border-box;
}

.reels-ctrl {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #fff;
    cursor: pointer;
    padding: 0;
    margin: 0;
}

.reels-ctrl.reels-time {
    gap: 8px;
    height: 40px;
    padding: 0 12px;
    width: auto;
    border-radius: 20px;
    display: flex;
    flex-direction: row-reverse;
}

.reels-time-text {
    color: #fff;
    font-weight: 700;
}

/* instagram link */
.instagram-link {
    position: absolute;
    bottom: 32px;
    z-index: 2;
    width: 100%;
    text-align: center;
    display: none;
}

.instagram-link a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px 8px 8px;
    border-radius: 999px;
    color: rgba(255, 255, 255, .9);
    background: #E1306C;
    font-weight: 700;
    text-decoration: none;
    justify-content: space-between;
}

/* like button box */
.reels-ctrl.reels-fav .post-action-btn {
    background: transparent;
    border: 0;
    padding: 0;
    line-height: 0;
}

.post-action-like .like-svg--active {
    display: none;
}

.post-action-like.is-active .like-svg--active {
    display: block;
}

.post-action-like.is-active .like-svg--inactive {
    display: none;
}

.reels-comments {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
}

.reels-comments-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.reels-popup .comments-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 300px;
    padding: 8px;
    scrollbar-width: none;
    scrollbar-color: #ccc transparent;
}

.reels-content-wrapper div {
    box-sizing: border-box;
}

/* ====== ریسپانسیو ====== */
@media (max-width: 1024px) {
    .reels-content .view-reels-card {
        margin-bottom: 25px;
    }

    .reels-overlay {
        padding: 0;
    }

    .reels-overlay .reels-host {
        max-width: 100%;
        width: 100%;
        height: 100dvh;
    }

    .reels-popup {
        width: 100%;
        height: 100dvh;
        overflow-y: auto;
        border-radius: 0;
        flex-direction: column-reverse;
    }

    .reels-comments, .reels-popup .reels-comments {
        width: 100% !important;
        padding: 16px;
    }

    .reels-video {
        width: 100% !important;
        height: 56dvh;
        min-height: 320px;
    }

    .comments-wrapper {
        padding-right: 0;
        scrollbar-width: none;
    }

    .reels-overlay .reels-close {
        top: 8px;
        left: 8px;
        width: 36px;
        height: 36px;
        line-height: 36px;
    }

    .reels-comments-header {
        margin: 0;
    }
}


/* لایهٔ کلی پاپ‌آپ */
.reels-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(8, 8, 15, .65);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: .2s;
}

.reels-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.reels-host {
    position: relative;
}

.reels-overlay .reels-host {
    max-width: 950px;
    width: 950px;
    height: 750px;
}

.reels-close {
    position: absolute;
    top: -12px;
    left: -12px;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 0;
    background: #fff;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

body.reels-locked {
    overflow: hidden;
}

/* Popup دو ستونه دسکتاپ */
.reels-popup {
    width: 950px;
    height: 750px;
    border-radius: 32px;
    background: #fff;
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    position: relative;
    overflow-y: auto;
    scrollbar-width: none !important;
}

/* سمت ویدیو */
.reels-video {
    width: 50%;
    position: relative;
    background: #000 url('./image/poster.png') center center/cover no-repeat;
}

.reels-video::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 0;
    pointer-events: none; /* مهم: کلیک‌ها رو نگیره */
}

.reels-video-el {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background-color: #000;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* اوورلی Tap-to-Play */
.reels-tap-overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .35);
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    border: 0;
    cursor: pointer;
}

/* سمت کامنت‌ها (بدون تغییرات غیرضروری) */
.reels-popup .reels-comments {
    width: 50%;
    padding: 54px 24px 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

/* ... (بقیه‌ی CSSهای خودت برای عناوین/فرم/کامنت‌ها مثل قبل) ... */

/* نوار بالا */
.reels-bar {
    position: absolute;
    top: 24px;
    left: 24px;
    right: 24px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    z-index: 1000;
    flex-direction: row-reverse;
}

.reels-bar-left {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-direction: row-reverse;
}

.reels-bar-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.reels-bar-right {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
    padding: 8px;
    background: #ffffff4d;
    border-radius: 32px;
    box-sizing: border-box;
}



.reels-time-text {
    color: #fff;
    font-weight: 700;
}

.instagram-link {
    position: absolute;
    bottom: 32px;
    z-index: 2;
    width: 100%;
    text-align: center;
    display: none;
}

.reels-overlay.is-open .instagram-link {
    display: block;
}

/* ریسپانسیو موبایل */
@media (max-width: 1024px) {
    .reels-overlay {
        padding: 0;
    }

    .reels-bar{
        left: 75px;
    }

    .reels-overlay .reels-host {
        max-width: 100%;
        width: 100%;
        height: 100dvh;
    }

    .reels-popup {
        width: 100%;
        height: 100dvh;
        border-radius: 0;
        overflow-y: auto;
        flex-direction: column-reverse;
    }

    .reels-video {
        width: 100% !important;
        height: 56dvh;
        min-height: 320px;
    }

    .reels-popup .reels-comments {
        width: 100% !important;
        padding: 16px;
    }

    .reels-overlay .reels-close {
        top: 22px;
        left: 18px;
        width: 36px;
        height: 36px;
        line-height: 36px;
    }
}


/* از کشیده شدن صفحهٔ والد جلوگیری کن */
.reels-popup,
.reels-comments-wrap,
.comments-wrapper {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch; /* اسکرول نرم در iOS */
}

/* وقتی پاپ‌آپ باز شد، از حالت پایین شروع نکند */
.reels-popup {
    scroll-behavior: auto;
}
