* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background: #1a1a1a;
    color: #fff;
    line-height: 1.6;
}

html, body {
    text-rendering: optimizeSpeed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a.logo, .logo {
    white-space: nowrap;
    flex-shrink: 0;
}

.header {
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    border-bottom: 1px solid #333;
}

.nav-container h1 {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #00d4ff;
    text-decoration: none;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-tab {
    color: #ccc;
    text-decoration: none;
    transition: color 0.3s;
    font-size: 14px;
    white-space: nowrap;
}

.nav-tab:hover,
.nav-tab.active {
    color: #00d4ff;
}

.search-box {
    display: flex;
    align-items: center;
    background: #333;
    border-radius: 5px;
    padding: 8px 15px;
    width: 250px;
    min-width: 0;
    flex-shrink: 1;
}

.search-box input {
    background: none;
    border: none;
    color: #fff;
    outline: none;
    flex: 1;
    font-size: 14px;
}

.search-box input::placeholder {
    color: #999;
}

.search-box button {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 0 5px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
}

/* ===== 主内容 ===== */
.main-content {
    margin-top: 60px;
    min-height: calc(100vh - 60px);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== 分类筛选 ===== */
.category-filter {
    margin-bottom: 30px;
    text-align: center;
}

.category-tabs {
    display: inline-flex;
    background: #333;
    border-radius: 25px;
    padding: 5px;
    gap: 5px;
}

.category-tab {
    padding: 8px 20px;
    background: none;
    border: none;
    color: #ccc;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    font-size: 14px;
}

.category-tab:hover,
.category-tab.active {
    background: #00d4ff;
    color: #fff;
}

/* ===== 视频网格 ===== */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.video-card {
    background: #2a2a2a;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.video-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 212, 255, 0.3);
}

/* AdSense card */
.ad-card {
    cursor: default;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.ad-card:hover {
    transform: none;
    box-shadow: none;
}

.ad-label {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.1);
    color: #666;
    border-radius: 2px;
    font-size: 10px;
    z-index: 1;
    pointer-events: none;
}

.ad-container {
    width: 100%;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-poster {
    position: relative;
    aspect-ratio: 3/4;
    overflow: hidden;
    background: #222;
}

/* Skeleton shimmer while image loads */
.video-poster::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #1e1e1e 25%, #2a2a2a 50%, #1e1e1e 75%);
    background-size: 200% 100%;
    animation: shimmer 1.8s infinite ease-in-out;
    z-index: 0;
}

/* Hide skeleton once image loaded */
.video-poster.loaded::before {
    opacity: 0;
    animation: none;
    pointer-events: none;
}

.video-poster img {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.35s ease-in-out, transform 0.3s;
    background: #1a1a1a;
}

/* Fade-in when image loads */
.video-poster.loaded img {
    opacity: 1;
}

/* Stale / error placeholder — keep skeleton */
.video-poster.error::before {
    opacity: 1;
    animation: none;
    background: #1e1e1e;
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.video-card:hover .video-poster.loaded img {
    transform: scale(1.05);
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 50%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.video-card:hover .video-overlay {
    opacity: 1;
}

.play-btn {
    width: 50px;
    height: 50px;
    background: rgba(0, 212, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
}

/* 标签 */
.video-tag {
    position: absolute;
    top: 8px;
    right: 8px;
    color: white;
    padding: 0px 4px;
    border-radius: 2px;
    font-size: 12px;
    font-weight: bold;
}

.tag-new {
    background: #00AE83;
}

.tag-first {
    background: linear-gradient(135deg, #4478FC, #81A4FF);
}

.tag-history {
    background: rgba(0,0,0,0.6);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 2px;
    color: #ccc;
}

/* ===== History Section ===== */
.history-section {
    margin-bottom: 36px;
}

.history-section .section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #333;
}

.history-section .section-title h3 {
    font-size: 16px;
    font-weight: 500;
    color: #ccc;
    display: flex;
    align-items: center;
    gap: 6px;
}

.history-section .section-title h3 i {
    color: #00d4ff;
}

.clear-history-btn {
    background: none;
    border: 1px solid #444;
    color: #888;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

.clear-history-btn:hover {
    color: #ff4444;
    border-color: #ff4444;
}

.video-info {
    padding: 15px;
}

.video-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #999;
}

.category-badge {
    color: #00d4ff;
    border-radius: 10px;
    font-size: 12px;
}

.episode-count {
    font-size: 11px;
}

/* ===== 分页 ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 40px;
}

.pagination a,
.pagination span,
.page-btn {
    padding: 8px 12px;
    background: #333;
    color: #ccc;
    text-decoration: none;
    border-radius: 5px;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.pagination a:hover,
.pagination .current,
.page-btn:hover:not(:disabled) {
    background: #00d4ff;
    color: #fff;
}

.page-btn.active {
    background: #00d4ff;
    color: #fff;
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ===== 加载 & 空状态 ===== */
.loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

.loading i {
    font-size: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 20px;
    color: #444;
}

/* ===== 搜索页 ===== */
.search-header {
    margin-bottom: 30px;
}

.search-page-bar {
    margin-bottom: 24px;
}

.search-page-form {
    display: flex;
    align-items: center;
    background: #2a2a2a;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 12px 20px;
    transition: border-color 0.3s;
    max-width: 600px;
}

.search-page-form:focus-within {
    border-color: #00d4ff;
}

.search-page-form .search-icon {
    color: #999;
    font-size: 18px;
    margin-right: 12px;
}

.search-page-form input {
    flex: 1;
    background: none;
    border: none;
    color: #fff;
    font-size: 16px;
    outline: none;
}

.search-page-form input::placeholder {
    color: #666;
}

.search-page-form button {
    padding: 8px 24px;
    background: #00d4ff;
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    margin-left: 12px;
}

.search-page-form button:hover {
    background: #00b8e0;
}

.search-info {
    margin-bottom: 20px;
}

.search-info h2 {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 4px;
}

.search-info h2 span {
    color: #00d4ff;
}

.search-count {
    color: #999;
    font-size: 13px;
}

.search-hot h3 {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 14px;
    color: #ccc;
}

.hot-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hot-tag {
    display: inline-block;
    padding: 6px 16px;
    background: #2a2a2a;
    border: 1px solid #333;
    border-radius: 20px;
    color: #ccc;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
}

.hot-tag:hover {
    background: #00d4ff;
    border-color: #00d4ff;
    color: #fff;
}

.page-ellipsis {
    padding: 8px 4px;
    color: #666;
    font-size: 14px;
}

/* ===== 播放页 ===== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    margin-bottom: 16px;
    color: #999;
    font-size: 13px;
}

.breadcrumb a {
    color: #999;
    text-decoration: none;
    transition: color 0.3s;
}

.breadcrumb a:hover {
    color: #00d4ff;
}

.breadcrumb-current {
    color: #ccc;
}

.play-container {
    margin-bottom: 24px;
}

.player-wrapper {
    background: #2a2a2a;
    border-radius: 8px;
    overflow: hidden;
}

.player-video {
    width: 100%;
    background: #000;
}

.player-video video {
    width: 100%;
    max-height: 70vh;
    display: block;
    outline: none;
}

.player-meta {
    padding: 20px;
}

.player-meta h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.source-badge {
    display: inline-block;
    padding: 2px 8px;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: #fff;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    vertical-align: middle;
}

.player-episode {
    color: #00d4ff;
    font-size: 14px;
    margin-bottom: 12px;
}

.player-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.tag-item {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(0, 212, 255, 0.15);
    color: #00d4ff;
    border-radius: 3px;
    font-size: 12px;
}

.player-desc {
    color: #999;
    font-size: 14px;
    line-height: 1.8;
}

/* ===== 选集 ===== */
.episode-section {
    margin-bottom: 40px;
}

.episode-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #333;
}

.episode-header h3 {
    font-size: 15px;
    font-weight: 500;
    color: #ccc;
    display: flex;
    align-items: center;
    gap: 6px;
}

.episode-range {
    color: #999;
    font-size: 13px;
}

.episode-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
}

.episode-btn {
    height: 42px;
    padding: 0 4px;
    border: none;
    border-radius: 5px;
    background: #333;
    color: #ccc;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.episode-btn:hover {
    background: #00d4ff;
    color: #fff;
}

.episode-btn.active {
    background: #00d4ff;
    color: #fff;
    font-weight: 600;
}

/* ===== 推荐 & 相关 ===== */
.related-section {
    margin-bottom: 40px;
}

.section-title {
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #333;
}

.section-title h3 {
    font-size: 16px;
    font-weight: 500;
    color: #ccc;
    display: flex;
    align-items: center;
    gap: 6px;
}

.section-title h3 i {
    color: #00d4ff;
}

/* ===== 卡片链接修复 ===== */
a.video-card {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* ===== 页脚 ===== */
.footer {
    background-color: #1a1a1a;
    color: #888;
    text-align: center;
    margin-top: 40px;
}

.footer .copyright {
    font-size: 14px;
    line-height: 1.6;
}

.footer .copyright p {
    margin: 5px 0;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .nav-container {
        padding: 0 15px;
        gap: 10px;
    }

    .search-box {
        flex: 1;
        min-width: 0;
        max-width: 200px;
    }

    .logo {
        font-size: 20px;
        flex-shrink: 0;
    }

    .search-page-form input {
        font-size: 14px;
    }

    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .category-tabs {
        flex-wrap: wrap;
        justify-content: center;
    }

    .container {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 0 10px;
        height: 55px;
        gap: 8px;
    }

    .logo {
        font-size: 18px;
    }

    .search-box {
        padding: 6px 10px;
        width: auto;
        flex: 1;
    }

    .search-box input {
        font-size: 13px;
    }

    .search-page-form {
        padding: 10px 12px;
    }

    .search-page-form button {
        padding: 6px 14px;
        font-size: 13px;
        margin-left: 8px;
    }

    .search-page-form .search-icon {
        font-size: 16px;
        margin-right: 8px;
    }

    .video-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .episode-list {
        grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
        gap: 6px;
    }

    .episode-btn {
        height: 34px;
        font-size: 12px;
    }
}

@media (max-width: 360px) {
    .nav-container {
        padding: 0 8px;
        gap: 6px;
    }

    .logo {
        font-size: 14px;
    }
}

/* ===== 重试按钮 ===== */
.retry-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 12px;
    padding: 6px 16px;
    background: #00d4ff;
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    vertical-align: middle;
}
.retry-btn:hover {
    background: #00aacc;
}
.retry-btn i {
    font-size: 12px;
}

    .search-box {
        padding: 5px 8px;
        min-width: 0;
    }

    .search-box input {
        font-size: 12px;
    }

    .search-page-form {
        padding: 8px 10px;
    }

    .search-page-form button {
        padding: 5px 10px;
        font-size: 12px;
    }
}
