/* —— 首页 —— */
.home-page {
    padding-bottom: 0.5rem;
}

/* 首屏：轮播与排行榜各占一半（PC） */
.home-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 1.15rem;
    align-items: stretch;
    margin-bottom: 1.75rem;
}

.home-hero .hero-carousel.carousel {
    margin-bottom: 0;
    height: 430px;
    min-height: 430px;
    max-height: 430px;
    background: linear-gradient(145deg, #e8fdf6 0%, #d4f5ea 100%);
}

/* 右侧：Tab 切换榜单 */
.rank-side {
    display: flex;
    flex-direction: column;
    height: 430px;
    min-height: 430px;
    max-height: 430px;
    min-width: 0;
}

.rank-tabs {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    background: var(--secondary);
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.07);
    border: 1px solid rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.rank-tabs-nav {
    display: flex;
    flex-shrink: 0;
    gap: 0;
    padding: 0.35rem 0.35rem 0;
    background: linear-gradient(180deg, rgba(136, 239, 203, 0.14) 0%, transparent 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}

.rank-tab {
    flex: 1;
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.98rem;
    font-weight: 600;
    font-family: inherit;
    padding: 0.45rem 0.35rem 0.55rem;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: background 0.2s, color 0.2s;
}

.rank-tab:hover {
    color: var(--text-primary);
    background: rgba(136, 239, 203, 0.12);
}

.rank-tab:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.rank-tab[aria-selected="true"] {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 -1px 0 0 rgba(0, 0, 0, 0.06);
}

.rank-tabs-panels {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.rank-tab-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.rank-tab-panel[hidden] {
    display: none;
}

.rank-panel__list {
    list-style: none;
    margin: 0;
    padding: 0.35rem 0.45rem 0.5rem;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.rank-item {
    display: block;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.rank-item:hover,
.rank-item.is-expanded {
    background: rgba(136, 239, 203, 0.1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* 展开：封面 + 详情 + 统计 */
.rank-item__expanded {
    display: none;
    align-items: stretch;
    gap: 0.55rem;
    padding: 0.4rem 0.35rem;
}

.rank-item.is-expanded .rank-item__expanded {
    display: flex;
}

.rank-item.is-expanded .rank-item__compact {
    display: none;
}

.rank-item__media {
    position: relative;
    flex-shrink: 0;
    width: 52px;
    aspect-ratio: 2 / 3;
    border-radius: 8px;
    overflow: hidden;
    background: #e8ecf0;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.rank-item__cover {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rank-item__num {
    position: absolute;
    left: 0;
    top: 0;
    min-width: 1.15rem;
    padding: 0.1rem 0.28rem 0.12rem;
    border-radius: 0 0 6px 0;
    font-size: 0.62rem;
    font-weight: 800;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(40, 44, 52, 0.88);
    color: #fff;
    z-index: 1;
}

.rank-tab-panel .rank-panel__list li:nth-child(1) .rank-item__num {
    background: linear-gradient(145deg, #ff9a3d, #e85d2c);
    color: #fff;
}

.rank-tab-panel .rank-panel__list li:nth-child(2) .rank-item__num {
    background: linear-gradient(145deg, #b8c0cc, #7a8494);
    color: #fff;
}

.rank-tab-panel .rank-panel__list li:nth-child(3) .rank-item__num {
    background: linear-gradient(145deg, #e8a882, #b8734a);
    color: #fff;
}

.rank-item__detail {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    justify-content: center;
    padding: 0.05rem 0;
}

.rank-item__title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.rank-item__stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.25rem 0.5rem;
}

.rank-item__stat {
    font-size: 0.92rem;
    color: var(--text-secondary);
}

.rank-item__stat strong {
    color: var(--text-primary);
    font-weight: 600;
    padding: 0;
}

.rank-item__stat time {
    font-weight: 600;
    color: var(--text-primary);
}

/* 收起：仅标题 + 日期一行 */
.rank-item__compact {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
    padding: 0.42rem 0.45rem;
    min-height: 2rem;
}

.rank-item:not(.is-expanded) .rank-item__compact {
    display: flex;
}

.rank-item:not(.is-expanded) .rank-item__expanded {
    display: none !important;
}

.rank-item__title-compact {
    flex: 1;
    min-width: 0;
    font-size: 1.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.rank-item__time {
    flex-shrink: 0;
    font-size: 0.65rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* 焦点轮播 */
.hero-carousel.carousel {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.carousel-inner {
    display: flex;
    transition: transform 0.45s cubic-bezier(0.33, 1, 0.68, 1);
    height: 100%;
}

.carousel-item {
    flex: 0 0 100%;
    height: 100%;
    width: 100%;
    overflow: hidden;
    display: block;
    position: relative;
    color: var(--secondary);
}

.carousel-item::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.82) 0%,
        rgba(0, 0, 0, 0.35) 38%,
        transparent 68%
    );
}

.carousel-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background-color: #c2fee7;
}

.carousel-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-position: center;
    transition: transform 0.4s ease;
}

.carousel-item:hover .carousel-image img {
    transform: scale(1.04);
}

.banner-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    padding: 1.25rem 1.5rem 1.5rem;
    max-width: none;
}

.banner-info__title {
    font-size: clamp(1.15rem, 2.8vw, 1.85rem);
    font-weight: 700;
    margin: 0 0 0.35rem;
    line-height: 1.25;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.banner-info__desc {
    margin: 0;
    font-size: clamp(0.82rem, 1.5vw, 0.98rem);
    line-height: 1.45;
    opacity: 0.92;
    max-width: 42rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.95);
}

/* 轮播箭头 */
.carousel-controls {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    z-index: 3;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0.35rem;
    transform: translateY(-50%);
    pointer-events: none;
}

.carousel-prev,
.carousel-next {
    pointer-events: auto;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #1a1a1a;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transition: background 0.2s, transform 0.2s;
}

.carousel-prev:hover,
.carousel-next:hover {
    background: var(--secondary);
    transform: scale(1.06);
}

.carousel-prev:active,
.carousel-next:active {
    transform: scale(0.96);
}

/* 指示点 */
.carousel-dots {
    position: absolute;
    bottom: 0.85rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    display: flex;
    gap: 0.45rem;
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
}

.carousel-dot {
    width: 7px;
    height: 7px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.carousel-dot.is-active {
    background: var(--secondary);
    transform: scale(1.25);
}

/* 区块标题 */
.section-head {
    margin-bottom: 1.15rem;
}

.section-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.section-title::before {
    content: "";
    width: 4px;
    height: 1.15em;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--primary), rgba(136, 239, 203, 0.35));
    flex-shrink: 0;
}

/* 视频网格 */
.latest-section {
    margin: 2.25rem 0 2.5rem;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.25rem;
    margin: 10px 0;
}

.video-card {
    color: var(--text-primary);
    text-decoration: none;
    background: var(--secondary);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.28s ease, box-shadow 0.28s ease;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.07);
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

.video-card:hover {
    color: var(--text-primary);
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

.video-card__media {
    position: relative;
    height: 280px;
    overflow: hidden;
    background: #eef2f4;
}

.video-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.video-card:hover .video-card__media img {
    transform: scale(1.05);
}

/* 播放量 / 评分：叠在封面底部 */
.video-card__stats {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0.5rem 0.6rem 0.55rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.25) 55%, transparent 100%);
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.video-card__stat {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.video-card__body {
    padding: 0.85rem 1rem 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.video-card__body h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.65em;
}

.views {
    margin: 0;
    margin-top: auto;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.video-meta {
    padding: 1rem;
}

/* 友情链接 */
.friend-links {
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    padding: 2rem 0 1rem;
    margin-top: 1rem;
}

.friend-links__title {
    text-align: center;
    color: var(--text-primary);
    margin: 0 0 1.1rem;
    font-size: 1.05rem;
    font-weight: 600;
}

.friend-links__grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 0.75rem;
    justify-content: center;
    align-items: center;
}

.friend-links__grid a {
    color: var(--primary);
    text-decoration: none;
    padding: 0.45rem 1rem;
    border: 1px solid rgba(136, 239, 203, 0.65);
    border-radius: 999px;
    font-size: 0.88rem;
    background: rgba(136, 239, 203, 0.08);
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.friend-links__grid a:hover {
    background: var(--primary);
    color: var(--secondary);
    border-color: var(--primary);
}

@keyframes homeFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.latest-section {
    animation: homeFadeIn 0.55s ease-out both;
}

/* —— 响应式：≤991px 为移动端，仅轮播，隐藏排行榜 —— */
@media (max-width: 991px) {
    .home-hero {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .rank-side {
        display: none;
    }

    .home-hero .hero-carousel.carousel {
        height: auto;
        min-height: clamp(220px, 55vw, 400px);
        max-height: min(58vh, 480px);
    }

    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .home-hero {
        margin-bottom: 1.35rem;
    }

    .home-hero .hero-carousel.carousel {
        border-radius: 12px;
        min-height: clamp(220px, 48vw, 320px);
        max-height: min(52vh, 380px);
    }

    .banner-info {
        padding: 0.85rem 1rem 1rem;
    }

    .carousel-prev,
    .carousel-next {
        width: 38px;
        height: 38px;
        font-size: 1.35rem;
    }

    .carousel-dots {
        bottom: 0.65rem;
        gap: 0.35rem;
    }

    .section-title {
        font-size: 1.15rem;
    }

    .latest-section {
        margin: 1.5rem 0 1.75rem;
    }

    .video-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem 0.65rem;
    }

    .video-card__body {
        padding: 0.55rem 0.6rem 0.7rem;
    }

    .video-card__body h3 {
        font-size: 0.82rem;
        min-height: auto;
        -webkit-line-clamp: 2;
    }

    .video-card__stats {
        font-size: 0.65rem;
        padding: 0.38rem 0.45rem 0.42rem;
    }

    .views {
        font-size: 0.72rem;
    }

    .friend-links {
        padding: 1.35rem 0 0.25rem;
    }

    .friend-links__grid a {
        padding: 0.4rem 0.85rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .home-hero .hero-carousel.carousel {
        border-radius: 10px;
        min-height: 200px;
        max-height: min(46vh, 280px);
    }

    .carousel-controls {
        padding: 0 0.15rem;
    }

    .carousel-prev,
    .carousel-next {
        width: 34px;
        height: 34px;
        font-size: 1.2rem;
        background: rgba(255, 255, 255, 0.88);
    }

    .banner-info__title {
        -webkit-line-clamp: 2;
    }

    .banner-info__desc {
        -webkit-line-clamp: 1;
        font-size: 0.78rem;
    }

    .video-grid {
        gap: 0.55rem 0.45rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .carousel-inner,
    .carousel-image img,
    .video-card,
    .video-card__media img {
        transition: none;
    }

    .latest-section {
        animation: none;
    }
}
