* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #e50914;
    --primary-hover: #ff1a24;
    --bg-color: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-card: #222;
    --text-primary: #fff;
    --text-secondary: #aaa;
    --text-muted: #666;
    --border-color: #333;
    --hover-bg: #333;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

img {
    max-width: 100%;
    display: block;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.main-content {
    padding-top: 60px;
}

/* Header Styles */
.header {
    background: linear-gradient(180deg, rgba(15, 15, 15, 0.95) 0%, rgba(15, 15, 15, 0.8) 100%);
    backdrop-filter: blur(10px);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    padding: 0 20px;
}

.logo a {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
    letter-spacing: 2px;
}

.logo a:hover {
    color: var(--primary-hover);
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-list a {
    color: var(--text-secondary);
    font-size: 15px;
    padding: 8px 0;
    position: relative;
    transition: var(--transition);
}

.nav-list a:hover,
.nav-list a.active {
    color: var(--text-primary);
}

.nav-list a.active::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border-radius: 25px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.search-input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 8px 15px;
    width: 200px;
    font-size: 14px;
    outline: none;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 8px 20px;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
}

.search-btn:hover {
    background: var(--primary-hover);
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 10px;
}

.menu-toggle span {
    width: 25px;
    height: 2px;
    background: var(--text-primary);
    transition: var(--transition);
}

/* Banner Section */
.banner {
    margin-top: 60px;
    height: 400px;
    overflow: hidden;
    position: relative;
}

.banner-item {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.banner-item.active {
    opacity: 1;
}

.banner-content {
    text-align: center;
    z-index: 2;
    padding: 20px;
}

.banner-content h2 {
    font-size: 42px;
    margin-bottom: 15px;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
}

.banner-content p {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 25px;
}

.banner-btn {
    display: inline-block;
    background: var(--primary-color);
    color: #fff;
    padding: 12px 35px;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 500;
    transition: var(--transition);
}

.banner-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

/* Section Styles */
.section {
    padding: 40px 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.section-title {
    font-size: 22px;
    color: var(--text-primary);
    position: relative;
    padding-left: 15px;
}

.section-title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 2px;
}

.section-more {
    color: var(--text-muted);
    font-size: 14px;
}

.section-more:hover {
    color: var(--primary-color);
}

/* Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
}

.video-card {
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
    transition: var(--transition);
}

.video-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
}

.video-thumb {
    position: relative;
    aspect-ratio: 2/3;
    overflow: hidden;
}

.video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-card:hover .video-thumb img {
    transform: scale(1.05);
}

.video-tag {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 12px;
}

.video-info {
    padding: 12px;
}

.video-title {
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
}

.video-desc {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-card:hover .video-title {
    color: var(--primary-color);
}

/* Ranking Styles */
.ranking-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    background: var(--bg-card);
    border-radius: 8px;
    transition: var(--transition);
    min-width: 0;
}

.ranking-item:hover {
    background: var(--hover-bg);
}

.ranking-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: bold;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.rank-1 {
    background: var(--primary-color);
    color: #fff;
}

.rank-2 {
    background: #ff6b35;
    color: #fff;
}

.rank-3 {
    background: #ffa500;
    color: #fff;
}

.ranking-info {
    flex: 1;
    min-width: 0;
}

.ranking-title {
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    margin-bottom: 4px;
    transition: var(--transition);
}

.ranking-item:hover .ranking-title {
    color: var(--primary-color);
}

.ranking-desc {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-tag {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 3px 10px;
    background: var(--bg-secondary);
    border-radius: 3px;
    flex-shrink: 0;
}

/* Footer Styles */
.footer {
    background: var(--bg-secondary);
    padding: 40px 0 20px;
    margin-top: 50px;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: space-between;
}

.footer-section {
    flex: 1;
    min-width: 200px;
}

.footer-section-title {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
    display: inline-block;
}

.friend-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
}

.friend-links a {
    color: var(--text-secondary);
    font-size: 13px;
    padding: 5px 10px;
    border-radius: 3px;
    transition: var(--transition);
}

.friend-links a:hover {
    color: var(--primary-color);
    background: var(--hover-bg);
}

.footer-about {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.8;
}

.sitemap-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
}

.sitemap-links a {
    color: var(--text-secondary);
    font-size: 13px;
    transition: var(--transition);
}

.sitemap-links a:hover {
    color: var(--primary-color);
}

.footer-copyright {
    width: 100%;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding-top: 20px;
    margin-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* Breadcrumb */
.breadcrumb {
    padding: 15px 0;
    color: var(--text-muted);
    font-size: 14px;
}

.breadcrumb a {
    color: var(--text-secondary);
}

.breadcrumb a:hover {
    color: var(--primary-color);
}

.breadcrumb .current {
    color: var(--text-primary);
}

/* Filter Bar */
.filter-bar {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.filter-item {
    display: flex;
    margin-bottom: 15px;
    align-items: flex-start;
}

.filter-item:last-child {
    margin-bottom: 0;
}

.filter-label {
    color: var(--text-secondary);
    min-width: 60px;
    font-size: 14px;
    padding-top: 5px;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    flex: 1;
}

.filter-options a {
    color: var(--text-secondary);
    padding: 5px 15px;
    border-radius: 3px;
    font-size: 13px;
    transition: var(--transition);
}

.filter-options a:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.filter-options a.active {
    background: var(--primary-color);
    color: #fff;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
    padding: 20px 0;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: var(--bg-card);
    color: var(--text-primary);
    border-radius: 5px;
    font-size: 14px;
    transition: var(--transition);
}

.page-btn:hover {
    background: var(--hover-bg);
}

.page-btn.active {
    background: var(--primary-color);
    color: #fff;
}

/* Play Page */
.play-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
}

/* 播放页顶部补偿（fixed header 60px） */
.play-page {
    margin-top: 60px;
}

.player-wrapper {
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
}

.player-container {
    position: relative;
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    cursor: pointer;
}

.player-placeholder {
    text-align: center;
    color: var(--text-secondary);
}

.play-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 15px;
    opacity: 0.8;
    transition: var(--transition);
}

.player-container:hover .play-icon {
    opacity: 1;
    transform: scale(1.1);
}

.player-placeholder p {
    font-size: 18px;
}

/* Episode List */
.episode-list-wrapper {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.episode-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.episode-header h3 {
    font-size: 18px;
}

.episode-sort {
    display: flex;
    gap: 10px;
}

.sort-btn {
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    padding: 5px 12px;
    border-radius: 3px;
    transition: var(--transition);
}

.sort-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.sort-btn.active {
    background: var(--primary-color);
    color: #fff;
}

.episode-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.episode-list::-webkit-scrollbar {
    width: 6px;
}

.episode-list::-webkit-scrollbar-track {
    background: var(--bg-card);
    border-radius: 3px;
}

.episode-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.episode-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 65px;
    padding: 8px 12px;
    background: var(--bg-card);
    color: var(--text-primary);
    border-radius: 4px;
    font-size: 13px;
    transition: var(--transition);
}

.episode-btn:hover {
    background: var(--hover-bg);
}

.episode-btn.active {
    background: var(--primary-color);
    color: #fff;
}

/* Video Detail */
.video-detail {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 25px;
}

.detail-header {
    display: flex;
    gap: 25px;
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
}

.detail-poster {
    width: 180px;
    border-radius: 8px;
    flex-shrink: 0;
}

.detail-title {
    font-size: 24px;
    margin-bottom: 15px;
}

.detail-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.meta-item {
    color: var(--text-secondary);
    font-size: 14px;
}

.meta-item em {
    color: var(--text-primary);
    font-style: normal;
}

.detail-desc h3 {
    font-size: 18px;
    margin-bottom: 12px;
}

.detail-desc p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.8;
}

/* Play Sidebar */
.play-sidebar {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 20px;
}

.sidebar-title h3 {
    font-size: 18px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sidebar-item {
    display: flex;
    gap: 12px;
    padding: 10px;
    border-radius: 5px;
    transition: var(--transition);
}

.sidebar-item:hover {
    background: var(--hover-bg);
}

.sidebar-item img {
    width: 70px;
    height: 90px;
    object-fit: cover;
    border-radius: 5px;
}

.sidebar-item-info h4 {
    font-size: 14px;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.sidebar-item:hover h4 {
    color: var(--primary-color);
}

.sidebar-item-info p {
    font-size: 12px;
    color: var(--text-muted);
}

/* Search Page */
.search-header {
    margin-bottom: 30px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.search-title {
    font-size: 22px;
    margin-bottom: 8px;
}

.keyword-highlight {
    color: var(--primary-color);
}

.search-count {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .video-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 992px) {
    .video-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .play-layout {
        grid-template-columns: 1fr;
    }

    .play-sidebar {
        display: none;
    }

    .banner-content h2 {
        font-size: 32px;
    }
}

@media (max-width: 768px) {
    .header-inner {
        height: 55px;
    }

    .nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        padding: 15px;
        border-bottom: 1px solid var(--border-color);
    }

    .nav.active {
        display: block;
    }

    .nav-list {
        flex-direction: column;
        gap: 10px;
    }

    .menu-toggle {
        display: flex;
    }

    .search-box {
        display: none;
    }

    .search-box.active {
        display: flex;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        padding: 10px 20px;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-color);
    }

    .search-input {
        flex: 1;
        width: auto;
    }

    .banner {
        height: 300px;
        margin-top: 55px;
    }

    .banner-content h2 {
        font-size: 26px;
    }

    .banner-content p {
        font-size: 14px;
    }

    .section {
        padding: 25px 0;
    }

    .section-title {
        font-size: 18px;
    }

    .video-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    .detail-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .detail-poster {
        width: 150px;
    }

    .detail-meta {
        grid-template-columns: 1fr;
    }

    .filter-item {
        flex-direction: column;
    }

    .filter-label {
        margin-bottom: 8px;
    }

    .footer-content {
        flex-direction: column;
        gap: 25px;
    }

    .footer-section {
        min-width: 100%;
    }
}

@media (max-width: 480px) {
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .banner {
        height: 200px;
    }

    .banner-content h2 {
        font-size: 20px;
    }

    .banner-btn {
        padding: 10px 25px;
        font-size: 14px;
    }

    .episode-btn {
        min-width: 55px;
        padding: 6px 10px;
        font-size: 12px;
    }

    .pagination {
        gap: 5px;
    }

    .page-btn {
        min-width: 35px;
        height: 35px;
        font-size: 13px;
    }

    .friend-links {
        gap: 5px 10px;
    }

    .friend-links a {
        font-size: 12px;
        padding: 3px 8px;
    }
}

/* ===== 详情页补充样式（douya 服务端扩展，原始模板无 detail.html） ===== */
.detail-info {
    flex: 1;
    min-width: 0;
}

.detail-score {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.score-num {
    font-size: 32px;
    font-weight: bold;
    color: #ffc107;
}

.score-stars {
    display: flex;
    gap: 3px;
}

.star {
    width: 18px;
    height: 18px;
    background: #ffc107;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.star.empty {
    background: #444;
}

.detail-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.btn-play,
.btn-collect {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 28px;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.btn-play {
    background: var(--primary-color);
    color: #fff;
}

.btn-play:hover {
    background: var(--primary-hover);
}

.btn-collect {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-collect:hover {
    background: var(--hover-bg);
}

@media (max-width: 768px) {
    .detail-info {
        text-align: left;
        width: 100%;
    }
}

/* 平板/窄窗口下导航横向滚动，避免栏目名被压缩成竖排 */
@media (max-width: 1199px) {
    .nav-list {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap;
    }
    .nav-list::-webkit-scrollbar {
        display: none;
    }
    .nav-list a {
        white-space: nowrap;
    }
}
