/* YouTube 风格模板 - CSS变量 */
:root {
    --yt-primary: #FF0000;
    --yt-primary-dark: #CC0000;
    --yt-primary-light: #FF3333;
    --yt-bg: #FFFFFF;
    --yt-bg-hover: #F9F9F9;
    --yt-text: #0F0F0F;
    --yt-text-light: #606060;
    --yt-text-lighter: #AAAAAA;
    --yt-border: #E5E5E5;
    --yt-sidebar-width: 240px;
    --yt-header-height: 56px;
}

/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.yt-body {
    font-family: "Roboto", "Arial", sans-serif;
    background: var(--yt-bg);
    color: var(--yt-text);
    line-height: 1.5;
}

.yt-app {
    min-height: 100vh;
    display: flex;
}

/* 左侧导航栏 */
.yt-sidebar {
    position: fixed;
    left: 0;
    top: var(--yt-header-height);
    width: var(--yt-sidebar-width);
    height: calc(100vh - var(--yt-header-height));
    background: var(--yt-bg);
    border-right: 1px solid var(--yt-border);
    overflow-y: auto;
    z-index: 250;
}

.yt-sidebar-content {
    padding: 12px 0;
}

.yt-sidebar-section {
    margin-bottom: 8px;
}

.yt-sidebar-title {
    padding: 8px 24px;
    font-size: 14px;
    font-weight: 500;
    color: var(--yt-text-light);
    text-transform: uppercase;
}

.yt-sidebar-item {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 10px 24px;
    text-decoration: none;
    color: var(--yt-text);
    font-size: 14px;
    transition: background 0.2s;
}

.yt-sidebar-item:hover {
    background: var(--yt-bg-hover);
}

.yt-sidebar-item.is-active {
    background: var(--yt-bg-hover);
    font-weight: 500;
}

.yt-sidebar-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.yt-sidebar-text {
    flex: 1;
}

/* 主内容区域 */
.yt-main-wrapper {
    flex: 1;
    margin-left: var(--yt-sidebar-width);
    min-height: 100vh;
    overflow-x: hidden;
}

/* 顶部搜索栏 */
.yt-header {
    position: fixed;
    top: 0;
    left: var(--yt-sidebar-width);
    right: 0;
    height: var(--yt-header-height);
    background: var(--yt-bg);
    border-bottom: 1px solid var(--yt-border);
    z-index: 200;
}

.yt-header-container {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 16px;
    height: 100%;
    max-width: 100%;
}

.yt-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--yt-text);
}

.yt-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--yt-text);
    margin-right: 16px;
}

.yt-logo-icon {
    width: 90px;
    height: 20px;
    color: var(--yt-primary);
}

.yt-logo-text {
    font-size: 18px;
    font-weight: 500;
    color: #FF0000;
}

.yt-search {
    flex: 1;
    max-width: 640px;
    display: flex;
    align-items: center;
    border: 1px solid var(--yt-border);
    border-radius: 40px 0 0 40px;
    overflow: hidden;
}

.yt-search-input {
    flex: 1;
    padding: 10px 16px;
    border: none;
    outline: none;
    font-size: 16px;
    background: var(--yt-bg);
    color: var(--yt-text);
}

.yt-search-btn {
    padding: 8px 24px;
    border: none;
    background: var(--yt-bg-hover);
    border-left: 1px solid var(--yt-border);
    border-radius: 0 40px 40px 0;
    cursor: pointer;
    color: var(--yt-text-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.yt-search-btn:hover {
    background: var(--yt-border);
}

.yt-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.yt-header-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--yt-text);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.yt-header-icon:hover {
    background: var(--yt-bg-hover);
}

/* 分类标签栏 */
.yt-categories {
    position: sticky;
    top: var(--yt-header-height);
    background: var(--yt-bg);
    border-bottom: 1px solid var(--yt-border);
    z-index: 150;
    padding: 0 24px;
}

.yt-categories-container {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 12px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.yt-categories-container::-webkit-scrollbar {
    display: none;
}

.yt-category-tab {
    padding: 8px 12px;
    background: var(--yt-bg-hover);
    border-radius: 18px;
    text-decoration: none;
    color: var(--yt-text);
    font-size: 14px;
    white-space: nowrap;
    transition: background 0.2s;
}

.yt-category-tab:hover {
    background: var(--yt-border);
}

.yt-category-tab.is-active {
    background: var(--yt-text);
    color: var(--yt-bg);
}

/* 主内容 */
.yt-main {
    padding-top: var(--yt-header-height);
}

.yt-content {
    padding: 24px;
    max-width: 100%;
    padding-bottom: 80px;
}

/* 视频网格 */
.yt-video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.yt-video-card {
    cursor: pointer;
}

.yt-video-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.yt-video-thumbnail {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
}

.yt-video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}

.yt-video-card:hover .yt-video-thumbnail img {
    transform: scale(1.05);
}

.yt-video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.yt-video-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.2s;
}

.yt-video-card:hover .yt-video-play-overlay {
    opacity: 1;
}

.yt-video-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.yt-video-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.yt-video-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--yt-text);
    margin: 0;
    padding: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    flex: 1;
    min-width: 0;
}

.yt-video-channel {
    display: inline-block;
    font-size: 14px;
    color: var(--yt-text-light);
    margin: 0;
    padding: 0;
    white-space: nowrap;
}

.yt-video-stats {
    display: flex;
    gap: 8px;
    font-size: 13px;
    flex-wrap: wrap;
    align-items: center;
    margin: 0;
    padding: 0;
    align-self: flex-start;
    width: 100%;
}

.yt-video-views,
.yt-video-time {
    color: var(--yt-text-lighter);
}

.yt-video-likes,
.yt-video-score,
.yt-video-duration-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--yt-text-lighter);
}

.yt-video-likes svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: var(--yt-primary);
}

.yt-video-score {
    color: #FFD700;
}

.yt-video-score svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    fill: #FFD700;
}

.yt-video-duration-stat svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* 列表页 */
.yt-list-header {
    margin-bottom: 24px;
}

.yt-list-title {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 8px;
}

.yt-list-count {
    color: var(--yt-text-light);
    font-size: 14px;
}

/* 面包屑导航 */
.yt-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    font-size: 14px;
    color: var(--yt-text-light);
    margin-bottom: 16px;
}

.yt-breadcrumb a {
    color: var(--yt-text-light);
    text-decoration: none;
    transition: color 0.2s;
}

.yt-breadcrumb a:hover {
    color: var(--yt-primary);
}

.yt-breadcrumb-sep {
    color: var(--yt-text-lighter);
}

.yt-breadcrumb-current {
    color: var(--yt-text);
    font-weight: 500;
}

/* 详情页 */
.yt-detail-page {
    max-width: 1280px;
    margin: 0 auto;
}

.yt-detail-section {
    margin-bottom: 32px;
    background: var(--yt-bg);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.yt-detail-title {
    font-size: 24px;
    font-weight: 500;
    margin-bottom: 16px;
    color: var(--yt-text);
    line-height: 1.4;
}

.yt-detail-meta {
    margin-bottom: 16px;
}

.yt-detail-stats {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.yt-stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--yt-text-light);
}

.yt-stat-item svg {
    flex-shrink: 0;
}

.yt-detail-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.yt-tag {
    padding: 4px 12px;
    background: var(--yt-bg-hover);
    border-radius: 16px;
    font-size: 13px;
    color: var(--yt-text);
}

.yt-detail-header {
    margin-bottom: 24px;
}

.yt-detail-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
    padding: 16px;
    background: var(--yt-bg-hover);
    border-radius: 8px;
}

.yt-info-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 14px;
}

.yt-info-label {
    color: var(--yt-text-light);
    font-weight: 500;
    min-width: 50px;
}

.yt-info-value {
    color: var(--yt-text);
    flex: 1;
}

.yt-detail-description {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--yt-border);
}

.yt-description-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 12px;
    color: var(--yt-text);
}

.yt-detail-description p {
    margin: 0;
    font-size: 14px;
    line-height: 1.8;
    color: var(--yt-text);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.yt-tag-score {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: white;
}

/* 播放器 */
.yt-player-container,
.yt-player-box {
    margin-bottom: 0;
}

.yt-player-wrapper {
    position: relative;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.yt-player-container .yt-player-wrapper {
    background: #000;
}

/* 限制广告层在播放器容器内 */
.yt-player-wrapper .player-ad-layer {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    z-index: 10 !important;
    overflow: hidden !important;
}

.yt-player-wrapper .player-ad-content {
    max-width: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
}

.yt-player-wrapper .player-ad-content :where(img, iframe, video) {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
}

/* 播放列表 */
.yt-episode-list,
.yt-play-sources {
    margin-top: 24px;
}

.yt-episode-group {
    margin-bottom: 32px;
    padding: 20px;
    background: var(--yt-bg-hover);
    border-radius: 8px;
}

.yt-episode-group-title {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 16px;
    color: var(--yt-text);
}

.yt-episode-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.yt-episode-item,
.yt-episode-btn {
    padding: 10px 18px;
    background: var(--yt-bg);
    border: 1px solid var(--yt-border);
    border-radius: 6px;
    text-decoration: none;
    color: var(--yt-text);
    font-size: 14px;
    transition: all 0.2s;
    display: inline-block;
}

.yt-episode-item:hover {
    background: var(--yt-bg-hover);
    border-color: var(--yt-primary);
    color: var(--yt-primary);
}

.yt-episode-item.is-active,
.yt-episode-btn.is-active {
    background: var(--yt-primary);
    border-color: var(--yt-primary);
    color: white;
}

.yt-episode-btn {
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.yt-episode-section {
    margin-top: 20px;
}

/* 播放页 */
.yt-play-page {
    max-width: 1280px;
    margin: 0 auto;
}

.yt-play-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.yt-play-back {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--yt-text);
    font-size: 14px;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.yt-play-back:hover {
    background: var(--yt-bg-hover);
}

.yt-play-title {
    font-size: 18px;
    font-weight: 500;
}

.yt-episode-nav {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.yt-episode-nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--yt-bg-hover);
    border-radius: 4px;
    text-decoration: none;
    color: var(--yt-text);
    font-size: 14px;
    transition: background 0.2s;
}

.yt-episode-nav-btn:hover:not(.yt-episode-nav-disabled) {
    background: var(--yt-border);
}

.yt-episode-nav-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 分页 */
.yt-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
}

.yt-pagination-btn {
    padding: 8px 16px;
    background: var(--yt-bg-hover);
    border-radius: 4px;
    text-decoration: none;
    color: var(--yt-text);
    font-size: 14px;
    transition: background 0.2s;
}

.yt-pagination-btn:hover {
    background: var(--yt-border);
}

.yt-pagination-btn.is-active {
    background: var(--yt-primary);
    color: white;
}

/* 空状态 */
.yt-empty {
    text-align: center;
    padding: 48px;
    color: var(--yt-text-light);
}

/* 区块标题 */
.yt-section {
    margin-bottom: 40px;
}

.yt-section {
    margin-bottom: 40px;
}

.yt-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.yt-section-title {
    font-size: 20px;
    font-weight: 500;
    color: var(--yt-text);
}

.yt-section-more {
    font-size: 14px;
    color: var(--yt-text-light);
    text-decoration: none;
    transition: color 0.2s;
}

.yt-section-more:hover {
    color: var(--yt-primary);
}

/* 排序按钮 */
.yt-sort-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--yt-bg-hover);
    border: 1px solid var(--yt-border);
    border-radius: 6px;
    color: var(--yt-text);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.yt-sort-btn:hover {
    background: var(--yt-border);
    border-color: var(--yt-primary);
    color: var(--yt-primary);
}

.yt-sort-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.yt-sort-btn[data-sort="desc"] svg {
    transform: rotate(180deg);
}

/* 移动端遮罩层 */
.yt-mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.yt-mobile-overlay.is-open {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* 只在移动端显示遮罩层 */
@media (min-width: 1025px) {
    .yt-mobile-overlay {
        display: none !important;
    }
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .yt-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
        z-index: 250;
    }

    .yt-sidebar.is-open {
        transform: translateX(0);
        z-index: 250;
    }

    .yt-main-wrapper {
        margin-left: 0;
    }

    .yt-header {
        left: 0;
    }

    .yt-menu-toggle {
        display: block;
    }

    .yt-video-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 12px;
    }
}

@media (max-width: 768px) {
    .yt-content {
        padding: 16px;
    }

    .yt-video-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 8px;
    }

    .yt-video-title {
        font-size: 14px;
    }

    .yt-video-meta {
        font-size: 12px;
    }

    .yt-categories {
        padding: 0 16px;
    }

    .yt-search {
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    .yt-video-grid {
        grid-template-columns: 1fr;
    }

    .yt-header-container {
        padding: 0 8px;
    }

    .yt-logo-text {
        display: none;
    }
}

/* Footer 链接滚动 */
.yt-footer-links {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid var(--yt-border);
    padding: 8px 0;
    z-index: 100;
    overflow: hidden;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
}

.yt-footer-links-container {
    display: flex;
    gap: 16px;
    white-space: nowrap;
    animation: yt-footer-scroll 30s linear infinite;
    will-change: transform;
}

.yt-footer-links-container:hover {
    animation-play-state: paused;
}

.yt-footer-link {
    display: inline-block;
    padding: 4px 12px;
    color: var(--yt-text-light);
    text-decoration: none;
    font-size: 12px;
    transition: color 0.2s;
    flex-shrink: 0;
    border-radius: 4px;
}

.yt-footer-link:hover {
    color: var(--yt-primary);
    background: var(--yt-bg-hover);
}

@keyframes yt-footer-scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(var(--scroll-distance, -50%));
    }
}

/* 移动端 Footer 链接 */
@media (max-width: 768px) {
    .yt-footer-links {
        padding: 6px 0;
    }

    .yt-footer-link {
        font-size: 11px;
        padding: 3px 10px;
    }
}

