:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #181818;
    --bg-elevated: #272727;
    --bg-hover: #3f3f3f;
    --text-primary: #f1f1f1;
    --text-secondary: #aaaaaa;
    --border-color: #2c2c2c;
    --accent: #ff0033;
    --accent-hover: #d9002b;
    --chip-bg: #272727;
    --chip-active-bg: #f1f1f1;
    --chip-active-text: #0f0f0f;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
}

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f9f9f9;
    --bg-elevated: #f2f2f2;
    --bg-hover: #e5e5e5;
    --text-primary: #0f0f0f;
    --text-secondary: #606060;
    --border-color: #e5e5e5;
    --chip-bg: #f2f2f2;
    --chip-active-bg: #0f0f0f;
    --chip-active-text: #ffffff;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Roboto", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

/* 顶部导航栏 */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: 60px;
    padding: 0 24px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
    flex-shrink: 0;
}

.brand-icon {
    width: 32px;
    height: 22px;
    background: var(--accent);
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.brand-icon::after {
    content: "";
    border-style: solid;
    border-width: 5px 0 5px 9px;
    border-color: transparent transparent transparent #fff;
    margin-left: 2px;
}

.search-form {
    flex: 1;
    max-width: 560px;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    height: 40px;
    padding: 0 16px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-right: none;
    border-radius: 20px 0 0 20px;
    font-size: 14px;
    outline: none;
}

.search-input:focus {
    border-color: #1c62b9;
}

.search-btn {
    height: 40px;
    padding: 0 20px;
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 0 20px 20px 0;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.15s;
}

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

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.btn-ghost,
.btn-primary {
    height: 36px;
    padding: 0 14px;
    border-radius: 18px;
    border: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s;
}

.btn-ghost {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

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

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

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

/* 分类标签栏 */
.category-bar {
    position: sticky;
    top: 60px;
    z-index: 90;
    background: var(--bg-primary);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border-color);
}

.category-chip {
    padding: 6px 14px;
    border-radius: 8px;
    background: var(--chip-bg);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.category-chip:hover {
    background: var(--bg-hover);
}

.category-chip.active {
    background: var(--chip-active-bg);
    color: var(--chip-active-text);
}

/* 主体容器与视频卡片网格 */
.main-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 24px 16px;
}

.video-card {
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.thumb-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background: #181818;
}

.thumb-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.25s ease;
}

.video-card:hover .thumb-wrapper img {
    transform: scale(1.04);
}

.duration-badge {
    position: absolute;
    right: 8px;
    bottom: 8px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.82);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.card-body {
    display: flex;
    gap: 12px;
    padding-top: 12px;
}

.channel-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff0033, #ff6b6b);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.card-meta {
    flex: 1;
    min-width: 0;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}

.card-sub {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

/* 播放页布局 */
.watch-layout {
    max-width: 1480px;
    margin: 0 auto;
    padding: 24px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 24px;
}

.player-box {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.player-box video {
    width: 100%;
    height: 100%;
    display: block;
    background: #000;
}

.watch-title {
    font-size: 20px;
    font-weight: 700;
    margin: 16px 0 10px;
}

.watch-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
}

.watch-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-secondary);
}

.category-tag {
    padding: 3px 10px;
    border-radius: 12px;
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 12px;
}

.description-box {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--bg-elevated);
    font-size: 14px;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-primary);
}

.sidebar-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 14px;
}

.related-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.related-card {
    display: flex;
    gap: 10px;
    cursor: pointer;
    border-radius: 8px;
    padding: 4px;
    transition: background 0.15s;
}

.related-card:hover {
    background: var(--bg-elevated);
}

.related-thumb {
    position: relative;
    width: 168px;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    background: #181818;
    flex-shrink: 0;
}

.related-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.related-info {
    flex: 1;
    min-width: 0;
}

.related-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
}

.related-sub {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 空状态与提示 */
.state-box {
    text-align: center;
    padding: 64px 20px;
    color: var(--text-secondary);
}

.state-box h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

@media (max-width: 1024px) {
    .watch-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .navbar {
        padding: 0 12px;
    }
    .brand-text {
        display: none;
    }
    .main-container,
    .watch-layout {
        padding: 16px 12px;
    }
    .category-bar {
        padding: 10px 12px;
    }
}
