* {
    box-sizing: border-box;
}

body.dark-body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: #020617;
    color: #e5e7eb;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 16px;
}

.site-header {
    border-bottom: 1px solid #1f2937;
    background: #020617e6;
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.logo {
    font-weight: 600;
    font-size: 18px;
}

.nav-links {
    display: flex;
    gap: 16px;
}

.nav-link {
    font-size: 14px;
    color: #9ca3af;
    padding: 4px 8px;
    border-radius: 999px;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
    background: #111827;
    color: #e5e7eb;
}

.nav-link.active {
    background: #0ea5e9;
    color: #0b1120;
}

/* 分类导航栏 */
.category-nav {
    background: linear-gradient(180deg, #0f172a 0%, #0a0f1e 100%);
    border-bottom: 1px solid #1e293b;
    padding: 24px 0;
    position: sticky;
    top: 56px;
    z-index: 40;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.category-buttons {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.category-btn {
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    color: #9ca3af;
    background: linear-gradient(145deg, #1e293b, #1a2332);
    border: 1px solid #334155;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
}

.category-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.category-btn:hover::before {
    left: 100%;
}

.category-btn:hover {
    color: #f3f4f6;
    background: linear-gradient(145deg, #2d3748, #374151);
    border-color: #4b5563;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), 
                0 2px 8px rgba(14, 165, 233, 0.2);
    text-decoration: none;
}

.category-btn.active {
    color: #ffffff;
    background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
    border-color: #0ea5e9;
    box-shadow: 0 6px 24px rgba(14, 165, 233, 0.5),
                0 0 20px rgba(14, 165, 233, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateY(-2px) scale(1.05);
}

.category-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 50%;
    height: 3px;
    background: linear-gradient(90deg, transparent, #fff, transparent);
    border-radius: 2px;
}

.main-content {
    padding: 24px 16px 48px;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.hero-text.full {
    grid-column: 1 / -1;
}

.hero-text h1 {
    font-size: 32px;
    margin: 0 0 12px;
}

.hero-text p {
    margin: 0 0 16px;
    color: #9ca3af;
}

.hero-card {
    background: #020617;
    border-radius: 16px;
    border: 1px solid #1f2937;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.hero-cover img,
.hero-cover-placeholder {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
}

.hero-cover-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #020617;
    color: #4b5563;
}

.hero-info {
    padding: 16px;
}

.hero-info h2 {
    margin: 0 0 8px;
}

.section {
    margin-top: 32px;
}

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-header h2,
.section-header h1 {
    margin: 0;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.card {
    background: #020617;
    border-radius: 12px;
    border: 1px solid #1f2937;
    overflow: hidden;
}

.card-link {
    display: block;
}

.card-cover img,
.card-cover-placeholder {
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.card-cover-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #020617;
    color: #4b5563;
}

.card-body {
    padding: 12px 12px 14px;
}

.card-title {
    margin: 0 0 6px;
    font-size: 15px;
}

.card-text {
    margin: 0 0 8px;
    font-size: 13px;
}

.card-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: #0ea5e9;
    color: #0b1120;
    font-size: 12px;
}

.text-muted {
    color: #9ca3af;
}

.link-muted {
    font-size: 13px;
    color: #9ca3af;
}

.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 14px;
    border: none;
    cursor: pointer;
    text-decoration: none;
}

.btn-primary {
    background: #0ea5e9;
    color: #0b1120;
}

.btn-primary:hover {
    background: #38bdf8;
}

.btn-secondary {
    background: #111827;
    color: #e5e7eb;
}

.btn-secondary:hover {
    background: #1f2937;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.image-grid.large {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.image-item {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    border-radius: 8px;
    background: #111827;
}

.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s ease;
}

.image-item img:hover {
    transform: scale(1.05);
}

.image-lightbox {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(4px);
    z-index: 100;
}

.image-lightbox.is-open {
    display: flex;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 101;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.image-lightbox-content {
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.image-lightbox-content img {
    max-width: 95vw;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.image-lightbox-caption {
    text-align: center;
    font-size: 14px;
    color: #e5e7eb;
}

.lightbox-close {
    position: fixed;
    top: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    background: rgba(15, 23, 42, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #e5e7eb;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 101;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}

.lightbox-close:hover {
    background: rgba(239, 68, 68, 0.9);
    border-color: #ef4444;
    color: white;
    transform: rotate(90deg) scale(1.1);
}

.lightbox-close svg {
    width: 24px;
    height: 24px;
}

@media (max-width: 768px) {
    .lightbox-close {
        top: 16px;
        right: 16px;
        width: 40px;
        height: 40px;
    }
    
    .lightbox-close svg {
        width: 20px;
        height: 20px;
    }
}

.site-footer {
    border-top: 1px solid #1f2937;
    padding: 16px 0;
    margin-top: 32px;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

/* 视频详情 */
.video-detail {
    max-width: 960px;
    margin: 32px auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.video-player-wrapper {
    width: 100%;
    max-width: 960px;
    background: #020617;
    border-radius: 12px;
    border: 1px solid #1f2937;
    overflow: hidden;
    /* 让视频区域保持 16:9 比例并居中 */
    aspect-ratio: 16 / 9;
}

.video-player {
    width: 100%;
    height: 100%;
    outline: none;
}

.video-info h1 {
    margin-top: 0;
}

.video-stats {
    display: flex;
    gap: 16px;
    margin: 20px 0;
    padding: 16px 0;
    border-top: 1px solid #1f2937;
    border-bottom: 1px solid #1f2937;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #0f172a;
    border-radius: 8px;
    border: 1px solid #1e293b;
}

.stat-icon {
    font-size: 20px;
}

.stat-label {
    font-size: 14px;
    color: #9ca3af;
}

.stat-value {
    font-size: 16px;
    font-weight: 600;
    color: #e5e7eb;
}

.like-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.like-btn:hover {
    transform: scale(1.05);
}

.like-btn.liked .stat-icon {
    animation: heartBeat 0.5s ease;
}

.like-btn.liked .stat-value {
    color: #ef4444;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.3); }
    50% { transform: scale(1.1); }
    75% { transform: scale(1.2); }
}

/* 发布者信息 */
.author-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0 20px;
    padding: 12px;
    background: #0f172a;
    border-radius: 8px;
    border: 1px solid #1e293b;
}

.author-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.author-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0ea5e9, #22c55e);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
}

.author-details {
    flex: 1;
}

.author-name {
    font-size: 16px;
    font-weight: 600;
    color: #e5e7eb;
    margin-bottom: 4px;
}

.publish-time {
    font-size: 13px;
    color: #9ca3af;
}

.video-description {
    margin: 16px 0;
    padding: 16px;
    background: #0f172a;
    border-radius: 8px;
    border-left: 3px solid #0ea5e9;
}

.video-description p {
    margin: 0;
    color: #d1d5db;
    line-height: 1.6;
}

/* 评论区 */
.comments-section {
    margin-top: 32px;
    padding: 24px;
    background: #0f172a;
    border-radius: 12px;
    border: 1px solid #1e293b;
}

.comments-title {
    font-size: 20px;
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #1e293b;
}

.comment-form-wrapper {
    margin-bottom: 32px;
}

.comment-form-wrapper h3 {
    font-size: 16px;
    margin: 0 0 16px 0;
    color: #9ca3af;
}

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.comment-form .form-group {
    margin-bottom: 0;
}

.comment-form .btn-primary {
    align-self: flex-start;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.comment-item {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: #020617;
    border-radius: 8px;
    border: 1px solid #1e293b;
    transition: border-color 0.2s;
}

.comment-item:hover {
    border-color: #334155;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.comment-avatar .avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    font-size: 18px;
    font-weight: 600;
}

.comment-content {
    flex: 1;
    min-width: 0;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.comment-author {
    font-size: 14px;
    font-weight: 600;
    color: #e5e7eb;
}

.comment-time {
    font-size: 12px;
    color: #6b7280;
}

.comment-text {
    font-size: 14px;
    color: #d1d5db;
    line-height: 1.6;
    word-wrap: break-word;
}

/* 封面候选项样式 */
.cover-candidate-item {
    cursor: pointer;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid #1e293b;
    transition: all 0.2s;
    position: relative;
}

.cover-candidate-item:hover {
    border-color: #0ea5e9;
    transform: scale(1.02);
}

.cover-candidate-item.selected {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.3);
}

.cover-candidate-item img {
    width: 100%;
    height: 70px;
    object-fit: cover;
    display: block;
}

#cover-candidates::-webkit-scrollbar {
    width: 6px;
}

#cover-candidates::-webkit-scrollbar-track {
    background: #0f172a;
    border-radius: 3px;
}

#cover-candidates::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 3px;
}

#cover-candidates::-webkit-scrollbar-thumb:hover {
    background: #4b5563;
}

.cover-label {
    padding: 4px 8px;
    background: #0f172a;
    color: #9ca3af;
    font-size: 12px;
    text-align: center;
}

.cover-candidate-item.selected .cover-label {
    background: #0ea5e9;
    color: #fff;
    font-weight: 600;
}

.cover-time {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}

/* 上传与转码进度遮罩 */
.upload-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.upload-overlay-inner {
    width: 100%;
    max-width: 420px;
    padding: 24px 24px 20px;
    background: #020617;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
    border: 1px solid #1e293b;
}

.upload-overlay-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.upload-progress-bar {
    width: 100%;
    height: 8px;
    background: #0f172a;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 8px;
}

.upload-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #0ea5e9);
    width: 0;
    transition: width 0.4s ease-out;
}

.upload-progress-text {
    font-size: 13px;
    color: #9ca3af;
    text-align: right;
}

.upload-cancel-btn {
    margin-top: 20px;
    padding: 10px 24px;
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.upload-cancel-btn:hover {
    background: #dc2626;
}

.upload-overlay-tip {
    margin-top: 8px;
    font-size: 12px;
    color: #6b7280;
}

/* 后台通用 */
.admin-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    min-height: 100vh;
}

.admin-sidebar {
    background: #020617;
    border-right: 1px solid #111827;
    padding: 16px 12px;
}

.admin-sidebar-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.admin-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.admin-menu li {
    margin-bottom: 6px;
}

.admin-menu a {
    display: block;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 14px;
    color: #9ca3af;
}

.admin-menu a:hover,
.admin-menu a.active {
    background: #0ea5e9;
    color: #0b1120 !important;
}

.admin-menu a.home-link {
    color: #0ea5e9;
}

.admin-menu a.home-link:hover {
    background: #0ea5e9;
    color: #0b1120 !important;
}

.admin-main {
    padding: 16px 20px 32px;
}

.admin-main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.admin-main-header h1 {
    margin: 0;
    font-size: 20px;
}

.badge-muted {
    font-size: 13px;
    color: #9ca3af;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table th,
.table td {
    padding: 8px 8px;
    border-bottom: 1px solid #111827;
}

.table th {
    text-align: left;
    color: #9ca3af;
    font-weight: 500;
}

.table tbody tr:hover {
    background: #020617;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
}

.form-control,
.form-textarea,
.form-select {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #111827;
    background: #020617;
    color: #e5e7eb;
    font-size: 14px;
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-control:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: #0ea5e9;
}

.form-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

.alert-error {
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(220, 38, 38, 0.12);
    border: 1px solid rgba(220, 38, 38, 0.4);
    color: #fecaca;
    font-size: 13px;
    margin-bottom: 12px;
}

.alert-success {
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(22, 163, 74, 0.12);
    border: 1px solid rgba(22, 163, 74, 0.5);
    color: #bbf7d0;
    font-size: 13px;
    margin-bottom: 12px;
}

.text-sm {
    font-size: 13px;
}

/* 登录页 */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 360px;
    background: #020617;
    border-radius: 16px;
    border: 1px solid #111827;
    padding: 20px 18px 18px;
}

.login-card h1 {
    margin: 0 0 4px;
}

.login-card p {
    margin: 0 0 16px;
    color: #9ca3af;
}

.login-extra {
    margin-top: 12px;
    font-size: 12px;
    color: #6b7280;
}

@media (max-width: 768px) {
    .hero {
        grid-template-columns: minmax(0, 1fr);
    }

    .video-detail {
        margin: 16px auto;
    }

    .admin-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .admin-sidebar {
        display: none;
    }
}
