/* =========================================
   CSS Variables & Reset
   ========================================= */
:root {
    --topbar-h: 60px;
    --catbar-h: auto;
    --page-max: 1100px;
    --bg: #0d0d11;
    --bg-2: #13131a;
    --surface: rgba(255,255,255,0.05);
    --surface-hover: rgba(255,255,255,0.09);
    --border: rgba(255,255,255,0.08);
    --text: #f0f0f0;
    --text-muted: #777;
    --accent: #e74c3c;
    --radius: 10px;
    --radius-sm: 6px;
}

/* ---- 黄色仓库主题 ---- */
[data-theme="hsck"] {
    --bg: #0f0e09;
    --bg-2: #171510;
    --surface: rgba(255, 215, 0, 0.06);
    --surface-hover: rgba(255, 215, 0, 0.12);
    --border: rgba(255, 215, 0, 0.1);
    --accent: #f0a500;
}
[data-theme="hsck"] .logo span { color: #f0a500; }
[data-theme="hsck"] .topbar {
    background: rgba(15, 14, 9, 0.95);
}
[data-theme="hsck"] .section-divider {
    background: linear-gradient(180deg, #f0a500, #e6820a);
}
[data-theme="hsck"] .thumb-badge {
    background: rgba(240, 165, 0, 0.85);
    color: #000;
    font-weight: 600;
}

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

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

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

/* =========================================
   Topbar
   ========================================= */
.topbar {
    height: var(--topbar-h);
    background: rgba(13,13,17,0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
}

.topbar-inner {
    max-width: var(--page-max);
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1.5rem;
}

.logo {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    flex-shrink: 0;
}
.logo span { color: var(--accent); }

/* Search */
.search-form {
    flex: 1;
    max-width: 400px;
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    overflow: hidden;
    transition: border-color 0.2s;
}
.search-form:focus-within { border-color: rgba(255,255,255,0.25); }

.search-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text);
    outline: none;
    padding: 0.55rem 1.2rem;
    font-size: 0.9rem;
    min-width: 0;
}
.search-input::placeholder { color: var(--text-muted); }

.search-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.55rem 1rem;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}
.search-btn:hover { color: var(--text); }

/* =========================================
   Category Bar
   ========================================= */
.catbar {
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
}

.catbar-inner {
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.cat-item {
    padding: 0.35rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid transparent;
    transition: all 0.18s;
    white-space: nowrap;
}
.cat-item:hover {
    color: var(--text);
    background: var(--surface-hover);
}
.cat-item.active {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
}

/* =========================================
   Page Layout
   ========================================= */
.page-inner {
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.main-content {
    padding: 2rem 0;
}

/* =========================================
   Section Headers
   ========================================= */
.section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.section-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}
.section-divider {
    width: 3px;
    height: 18px;
    background: var(--accent);
    border-radius: 2px;
    flex-shrink: 0;
}

/* =========================================
   Video Grid
   ========================================= */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

.video-card {
    display: block;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.4);
}

.thumb-wrap {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #1a1a24;
    overflow: hidden;
}
.thumb-wrap img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.video-card:hover .thumb-wrap img { transform: scale(1.05); }

.thumb-badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 2px 7px;
    border-radius: 4px;
}

.card-body { padding: 0.85rem; }
.card-title {
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.5rem;
}
.card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* =========================================
   Player Page
   ========================================= */
.video-title-bar {
    margin-bottom: 1rem;
}
.video-title-bar h1 {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.6rem;
}
.video-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.video-tag {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 2px 10px;
    border-radius: 20px;
}

.player-wrap {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.player-wrap video,
.player-wrap iframe,
#dplayer {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* =========================================
   Pagination
   ========================================= */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding-bottom: 2rem;
    flex-wrap: wrap;
}
.page-btn {
    padding: 0.45rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.875rem;
    transition: background 0.2s;
}
.page-btn:hover { background: var(--surface-hover); }
.page-btn.current {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* =========================================
   Empty state
   ========================================= */
.empty-state {
    text-align: center;
    padding: 5rem 1rem;
    color: var(--text-muted);
}
.empty-state p { margin-top: 0.5rem; font-size: 0.9rem; }

/* =========================================
   Footer
   ========================================= */
.site-footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    margin-top: 1rem;
}

/* =========================================
   Mobile: <= 768px
   ========================================= */
@media (max-width: 768px) {
    .page-inner { padding: 0; }

    .main-content { padding: 1rem 0; }

    .catbar-inner { padding: 0.6rem 0.75rem; gap: 0.4rem; }

    .cat-item { font-size: 0.82rem; padding: 0.3rem 0.85rem; }

    .grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.75rem;
        padding: 0 0.75rem;
    }

    .section-header { padding: 0 0.75rem; }

    .pagination { padding: 0.5rem 0.75rem 2rem; }

    .player-wrap {
        border-radius: 0;
        margin-bottom: 1rem;
    }

    .video-title-bar {
        padding: 0 0.75rem;
        margin-bottom: 0.75rem;
    }
    .video-title-bar h1 { font-size: 1.1rem; }

    .topbar-inner { padding: 0 1rem; gap: 0.75rem; }
}
