/* ============================================
   全局变量与重置
   ============================================ */
:root {
    --primary-color: #ff6b35;
    --primary-hover: #ff8c5a;
    --bg-dark: #141414;
    --bg-card: #1f1f1f;
    --bg-header: rgba(20, 20, 20, 0.95);
    --bg-input: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #666666;
    --border-color: #333333;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.5);
    --radius: 8px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
        'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: var(--bg-dark);
    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;
}

ul, ol {
    list-style: none;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================
   头部导航
   ============================================ */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--bg-header);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    height: 64px;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--primary-color);
    border-radius: 6px;
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 30px;
}

.nav a {
    color: var(--text-secondary);
    font-size: 15px;
    padding: 8px 0;
    position: relative;
}

.nav a:hover,
.nav a.active {
    color: var(--primary-color);
}

.nav a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--primary-color);
    border-radius: 2px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 200px;
    height: 36px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 0 40px 0 15px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--primary-color);
    width: 240px;
}

.search-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
}

/* ============================================
   横幅轮播
   ============================================ */
.banner {
    margin-top: 64px;
    position: relative;
    height: 450px;
    overflow: hidden;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.banner-slider {
    display: flex;
    transition: transform 0.5s ease;
    height: 100%;
}

.banner-slide {
    min-width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.banner-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: brightness(0.4);
}

.banner-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 700px;
    padding: 0 20px;
}

.banner-badge {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    margin-bottom: 15px;
}

.banner-title {
    font-size: 42px;
    font-weight: bold;
    margin-bottom: 15px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.banner-desc {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 25px;
    line-height: 1.8;
}

.banner-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: white;
    border: 1px solid rgba(255,255,255,0.5);
}

.btn-outline:hover {
    background: rgba(255,255,255,0.1);
}

.banner-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
}

.banner-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    cursor: pointer;
    transition: var(--transition);
}

.banner-dot.active {
    background: var(--primary-color);
    width: 24px;
    border-radius: 5px;
}

.banner-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 60px;
    background: rgba(0,0,0,0.3);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 20px;
    z-index: 10;
    transition: var(--transition);
}

.banner-arrow:hover {
    background: rgba(0,0,0,0.5);
}

.banner-arrow.prev {
    left: 20px;
}

.banner-arrow.next {
    right: 20px;
}

/* ============================================
   内容区块
   ============================================ */
.section {
    padding: 40px 0;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.section-title {
    font-size: 24px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 22px;
    background: var(--primary-color);
    border-radius: 2px;
}

.section-more {
    color: var(--text-secondary);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.section-more:hover {
    color: var(--primary-color);
}

/* ============================================
   视频卡片网格
   ============================================ */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.video-card {
    display: block;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
}

.video-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.video-poster {
    position: relative;
    aspect-ratio: 2/3;
    overflow: hidden;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.video-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
    background: transparent;
}

.video-poster img:hover {
    transform: scale(1.05);
}

.video-poster img::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 40%);
    opacity: 0;
    transition: var(--transition);
}

.video-card:hover .video-poster img::after {
    opacity: 1;
}

.video-poster img[src=""],
.video-poster img:not([src]),
.video-poster img[src^="data:"] {
    display: none;
}

.video-poster::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 40%);
    opacity: 0;
    transition: var(--transition);
}

.video-card:hover .video-poster::after {
    opacity: 1;
}

.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 50px;
    height: 50px;
    background: rgba(255, 107, 53, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    z-index: 2;
}

.play-icon::after {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 10px 0 10px 18px;
    border-color: transparent transparent transparent white;
    margin-left: 4px;
}

.video-card:hover .play-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.video-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 2;
}

.video-score {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: #ffd700;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 2;
}

.video-info {
    padding: 12px;
}

.video-title {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 6px;
}

.video-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
}

/* ============================================
   排行榜
   ============================================ */
.rank-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
}

.rank-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
}

.rank-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.rank-title::before {
    content: '';
    width: 4px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 2px;
}

.rank-list {
    counter-reset: rank;
}

.rank-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    transition: var(--transition);
}

.rank-item:hover {
    background: rgba(255,255,255,0.03);
    margin: 0 -20px;
    padding-left: 20px;
    padding-right: 20px;
}

.rank-item:last-child {
    border-bottom: none;
}

.rank-num {
    counter-increment: rank;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-top: 2px;
}

.rank-item:nth-child(1) .rank-num {
    background: #ff4757;
    color: white;
    border-radius: 4px;
}

.rank-item:nth-child(2) .rank-num {
    background: #ff6b35;
    color: white;
    border-radius: 4px;
}

.rank-item:nth-child(3) .rank-num {
    background: #ffa502;
    color: white;
    border-radius: 4px;
}

.rank-info {
    flex: 1;
    min-width: 0;
}

.rank-name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.rank-name:hover {
    color: var(--primary-color);
}

.rank-desc {
    font-size: 12px;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================
   列表页
   ============================================ */
.page-header {
    margin-top: 64px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 40px 0;
    text-align: center;
}

.page-title {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 10px;
}

.breadcrumb {
    color: var(--text-secondary);
    font-size: 14px;
}

.breadcrumb a {
    color: var(--text-secondary);
}

.breadcrumb a:hover {
    color: var(--primary-color);
}

.filter-section {
    padding: 30px 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}

.filter-group {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 15px;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-label {
    width: 60px;
    flex-shrink: 0;
    color: var(--text-secondary);
    font-size: 14px;
    padding-top: 8px;
}

.filter-options {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-option {
    padding: 6px 16px;
    background: var(--bg-input);
    border-radius: 4px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.filter-option:hover,
.filter-option.active {
    background: var(--primary-color);
    color: white;
}

/* ============================================
   详情页
   ============================================ */
.detail-hero {
    margin-top: 64px;
    padding: 40px 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.detail-content {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.detail-poster {
    width: 240px;
    flex-shrink: 0;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-hover);
}

.detail-poster img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
}

.detail-info {
    flex: 1;
}

.detail-title {
    font-size: 36px;
    font-weight: bold;
    margin-bottom: 15px;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

.detail-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.detail-score {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.score-num {
    font-size: 42px;
    font-weight: bold;
    color: #ffd700;
}

.score-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.detail-desc {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.8;
    margin-bottom: 25px;
    max-width: 600px;
}

.detail-actions {
    display: flex;
    gap: 15px;
}

/* 集数选择 */
.episodes-section {
    padding: 40px 0;
}

.episodes-header {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.episodes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
}

.episode-btn {
    padding: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    text-align: center;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.episode-btn:hover,
.episode-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

/* ============================================
   播放页
   ============================================ */
.player-section {
    margin-top: 64px;
}

.player-wrapper {
    background: #000;
    aspect-ratio: 16/9;
    max-height: 600px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-placeholder {
    text-align: center;
    color: var(--text-secondary);
}

.player-big-btn {
    width: 80px;
    height: 80px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    cursor: pointer;
    transition: var(--transition);
}

.player-big-btn:hover {
    transform: scale(1.1);
    background: var(--primary-hover);
}

.player-big-btn::after {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 18px 0 18px 30px;
    border-color: transparent transparent transparent white;
    margin-left: 6px;
}

.player-info {
    padding: 25px 0;
    border-bottom: 1px solid var(--border-color);
}

.player-title {
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 10px;
}

.player-episode {
    color: var(--text-secondary);
    font-size: 14px;
}

/* 播放页侧边栏 */
.player-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 30px;
    padding: 30px 0;
}

.player-sidebar {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    height: fit-content;
}

.sidebar-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

/* ============================================
   底部
   ============================================ */
.footer {
    background: var(--bg-card);
    padding: 40px 0 30px;
    margin-top: 50px;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    margin-bottom: 30px;
}

.footer-links {
    flex: 1;
    min-width: 200px;
}

.footer-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.footer-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.footer-list a {
    color: var(--text-secondary);
    font-size: 14px;
}

.footer-list a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 13px;
}

/* ============================================
   移动端菜单
   ============================================ */
.mobile-nav {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-dark);
    z-index: 999;
    padding: 20px;
    flex-direction: column;
    gap: 0;
}

.mobile-nav.show {
    display: flex;
}

.mobile-nav a {
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 16px;
    color: var(--text-primary);
}

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 1024px) {
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .player-layout {
        grid-template-columns: 1fr;
    }
    
    .player-sidebar {
        order: -1;
    }
}

@media (max-width: 768px) {
    .nav {
        display: none;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .search-input {
        width: 140px;
    }
    
    .banner {
        height: 300px;
    }
    
    .banner-title {
        font-size: 28px;
    }
    
    .banner-desc {
        font-size: 14px;
    }
    
    .banner-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 12px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .rank-section {
        grid-template-columns: 1fr;
    }
    
    .detail-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .detail-poster {
        width: 180px;
    }
    
    .detail-meta {
        justify-content: center;
    }
    
    .detail-actions {
        justify-content: center;
    }
    
    .detail-desc {
        max-width: 100%;
    }
    
    .episodes-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }
    
    .footer-content {
        flex-direction: column;
        gap: 25px;
    }
}

@media (max-width: 480px) {
    .header-inner {
        padding: 0 15px;
    }
    
    .logo {
        font-size: 20px;
    }
    
    .logo-icon {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
    
    .search-box {
        display: none;
    }
    
    .banner {
        height: 250px;
    }
    
    .banner-title {
        font-size: 22px;
    }
    
    .video-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    .video-info {
        padding: 8px;
    }
    
    .video-title {
        font-size: 12px;
    }
    
    .video-meta {
        font-size: 11px;
    }
    
    .section {
        padding: 25px 0;
    }
    
    .section-title {
        font-size: 18px;
    }
    
    .page-title {
        font-size: 24px;
    }
    
    .detail-title {
        font-size: 24px;
    }
    
    .score-num {
        font-size: 32px;
    }
}

/* ============================================
   加载动画
   ============================================ */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 50px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   滚动条
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   工具类
   ============================================ */
.text-primary { color: var(--primary-color); }
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.hidden { display: none; }

/* 平板/窄窗口下导航横向滚动，避免栏目名被压缩成竖排 */
@media (max-width: 1199px) {
    .nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap;
    }
    .nav::-webkit-scrollbar {
        display: none;
    }
    .nav a {
        white-space: nowrap;
    }
}
