/* 优化字体显示，减少布局偏移 */
body,
h1,
h2,
h3,
h4,
h5,
h6 {
    font-display: swap !important;
}

/* 固定背景图片样式 - 替代CSS背景优化LCP */
.fixed-background-img {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    z-index: -2;
    /* 确保在最底层 */
    pointer-events: none;
    /* 不阻挡点击事件 */
}

.bgOpacity {
    background: -webkit-linear-gradient(90deg, #1c1d21 20%, rgba(28, 29, 33, 0.8) 68%);
    width: 100vw;
    height: 100%;
    position: fixed;
    z-index: -1;
    /* 在背景图片之上，内容之下 */
}

.fg-series {
    color: rgba(0, 0, 0, 0.95);
    font-weight: 600;
    font-size: 1rem;
}

.bgOpacity {
    background: -webkit-linear-gradient(90deg, #1c1d21 20%, rgba(28, 29, 33, 0.8) 68%);
}


.movie-detail-main {
    padding-top: 0.5rem;
    padding-bottom: 3rem;
    z-index: 10;
    position: relative;
    /* 防止CLS - 隔离布局影响 */
    contain: layout style;
}

.main-content {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 2rem;
}

.main-content>.left {
    flex: 1;
    min-width: 0;
}

.main-content>.right {
    display: flex;
    flex-direction: column;
    width: 400px;
    flex-shrink: 0;
}

article {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

article .movie-type-badge {
    margin-bottom: 0;
}

.player-box {
    display: flex;
    position: relative;
    width: 100%;
    /* padding-top: 56.25%; */
    /* 16:9 宽高比 */
    aspect-ratio: 16/9;
    overflow: hidden;
    margin-right: 1rem;
}

.player-box iframe,
.player-box .mov-box {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

h1 {
    font-size: 1.8rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.98);
}

h1 .fg-main {
    color: #ffae00;
    text-shadow: 0 0 0.5px rgba(255, 174, 0, 0.3);
}

article h3 {
    font-size: 1.4rem !important;
}

h4 {
    font-size: 1.2rem !important;
}

.company-tag-box {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
}

.company-tag {
    font-size: 0.8rem;
    padding-top: 0.2rem;
    padding-bottom: 0.2rem;
    padding-left: 0.5rem;
    padding-right: 5rem;
    background-color: #ff3ba1;
    opacity: 0.7;
    border-radius: 0.3rem;
    position: relative;
}

.company-tag h4 {
    all: unset !important;
}

.company-tag:hover {
    cursor: pointer;
    opacity: 1;
}

.company-tag-abi {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 4rem;
    background-color: #808080;
    display: flex;
    justify-content: center;
    align-content: center;
    border-top-right-radius: 0.3rem;
    border-bottom-right-radius: 0.3rem;
    display: flex;
    flex-direction: column;
}

.keyword-container {
    overflow: hidden;
}

.keyword-item {
    margin-bottom: 0.25rem;
    font-size: 1.3rem !important;
}

.description-text {
    text-indent: 2em;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.6;
    cursor: pointer;
    transition: all 0.3s ease;
}

.description-text p {
    margin-bottom: 0.2rem;
}

.description-text:hover {
    opacity: 0.8;
}

.description-text.expanded {
    -webkit-line-clamp: unset;
}

.alike-grid-container {
    margin-top: 1.3rem;
    overflow: hidden;
}

/* 1200px以下隐藏右侧 */
@media(max-width: 1199px) {
    .main-content>.right {
        display: none;
    }
}

@media(max-width:575px) {
    .movie-detail-main {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        padding-top: 0.1rem;
    }

    h1 {
        font-size: 1.35rem;
    }

    h4 {
        font-size: 1.1rem;
    }

    .keyword-container {
        max-height: 5.5rem;
    }

    .keyword-item {
        font-size: 1.2rem;
    }

    .description-text {
        -webkit-line-clamp: 3;
    }
}

/* 修复小屏幕播放器控制按钮被切掉的问题 */
@media(max-width: 419px) {
    .player-box {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }
}

/* iPhone SE和极小屏幕专用 - 让播放器突破父容器限制 */
@media(max-width: 375px) {
    .player-box {
        margin: 0 !important;
        width: 100vw !important;
        position: relative;
        left: 50% !important;
        right: 50% !important;
        margin-left: -50vw !important;
        margin-right: -50vw !important;
    }

    /* 确保父容器不影响播放器 */
    .main-content>.left {
        overflow: visible !important;
    }

    .movie-detail-main {
        overflow-x: hidden !important;
        padding-top: 0.5rem;
        margin-top: 0 !important;
    }
}

@media(min-width: 576px) {
    .movie-detail-main {
        /* padding-left: 1.5rem;
        padding-right: 1.5rem; */
        padding-top: 1rem;
    }

    h1 {
        font-size: 1.5rem;
    }
}

@media(min-width: 768px) {
    .movie-detail-main {
        /* padding-left: 3rem;
        padding-right: 3rem;         */
    }

    h1 {
        font-size: 1.6rem;
    }

    .mobile-recommend-movies {
        display: none;
    }

}

@media(min-width: 1200px) {
    .movie-detail-main {
        /* padding-left: 5rem;
        padding-right: 5rem; */        
    }

    h1 {
        font-size: 1.6rem;
    }
}

@media(min-width: 1920px) {
    .movie-detail-main {
        /* padding-left: 10rem !important;
        padding-right: 10rem !important; */        
    }

    h1 {
        font-size: 1.6rem;
    }
}

@media(min-width: 2400px) {
    .movie-detail-main {
        /* padding-left: 5rem;
        padding-right: 5rem;         */
    }

    h1 {
        font-size: 1.8rem;
    }
}

.actor-swiper {
    width: calc(100% - 1rem);
    margin: 1rem 0.5rem;
}

.actor-swiper-item {
    width: 10rem!important;
    height: 13rem!important;
    overflow: hidden;
    border-radius: 0.3rem;
}

.movie-swiper {
    width: calc(100% - 1rem);
    margin: 1rem 0.5rem;
    height: 12rem;
    /* 预定义高度防止CLS */
    overflow: hidden;
    /* 隐藏溢出内容 */
}

.movie-swiper .swiper-wrapper {
    height: 12rem;
    /* 确保wrapper有固定高度 */
}

.movie-swiper-item {
    width: auto !important;
    min-width: 16rem;
    /* 防止图片加载时的布局偏移 */
    height: 12rem;
    overflow: hidden;
    border-radius: 0.3rem;
    text-align: center;
    background-color: rgba(0, 0, 0, 0.15);
}

.movie-swiper-item img {
    height: 100%;
    width: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.movie-swiper-item:hover img {
    transform: scale(1.05);
}

.carousel-container {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 10px;
}

.carousel-title {
    padding-left: calc(var(--bs-gutter-x) * .5);
}

.carousel-header {
    padding-left: 0;
    margin-bottom: 1rem;
}

.more-link {
    color: #ccc;
    font-size: 0.9rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: color 0.3s ease, transform 0.2s ease;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.more-link:hover {
    color: #ffae00;
    text-decoration: none;
    transform: translateX(2px);
}

.more-link:hover .arrow-svg {
    transform: translateX(3px);
}