:root {
    --bg: #0f172a;
    --card: #1e293b;
    --elevated: #273549;
    --border: #334155;
    --text: #f8fafc;
    --muted: #94a3b8;
    --accent: #ef4444;
    --accent-hover: #dc2626;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
}

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

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

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

.topbar {
    height: 60px;
    padding: 0 24px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-brand {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(239, 68, 68, 0.18);
    color: #fca5a5;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn {
    height: 36px;
    padding: 0 16px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.15s, opacity 0.15s;
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

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

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

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

.btn-danger:hover:not(:disabled) {
    background: var(--accent-hover);
}

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

.btn-ghost:hover:not(:disabled) {
    background: var(--border);
}

.btn-sm {
    height: 30px;
    padding: 0 10px;
    font-size: 12px;
}

/* 登录视图 */
.login-wrap {
    min-height: calc(100vh - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
}

.login-card h2 {
    font-size: 22px;
    margin-bottom: 6px;
}

.login-card p {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 24px;
}

/* 主面板 */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px;
    display: grid;
    grid-template-columns: 420px minmax(0, 1fr);
    gap: 24px;
}

.panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 22px;
}

.panel-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
}

textarea.form-control {
    min-height: 84px;
    resize: vertical;
}

.dropzone {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    background: rgba(15, 23, 42, 0.45);
    transition: border-color 0.2s, background 0.2s;
}

.dropzone.dragover {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.08);
}

.dropzone p {
    font-size: 13px;
    color: var(--muted);
}

.dropzone .file-name {
    margin-top: 8px;
    font-size: 13px;
    color: var(--success);
    word-break: break-all;
}

.thumb-preview-box {
    margin-top: 10px;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg);
    border: 1px solid var(--border);
    display: none;
}

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

.progress-wrap {
    margin: 14px 0;
    display: none;
}

.progress-bar-bg {
    width: 100%;
    height: 10px;
    background: var(--bg);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background: var(--primary);
    transition: width 0.15s;
}

.progress-text {
    font-size: 12px;
    color: var(--muted);
    margin-top: 6px;
    display: flex;
    justify-content: space-between;
}

.upload-queue {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 380px;
    overflow-y: auto;
    margin-top: 12px;
}

.queue-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
}

.queue-item-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.queue-title-input {
    flex: 1;
    min-width: 0;
    padding: 5px 8px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
}

.queue-size {
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
}

.queue-status-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--muted);
    margin-top: 5px;
}

.queue-status-row.done {
    color: var(--success);
}

.queue-status-row.skipped {
    color: #fbbf24;
}

.queue-status-row.error {
    color: #fca5a5;
}

.queue-link-row {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.queue-link-input {
    flex: 1;
    min-width: 0;
    padding: 4px 8px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: #93c5fd;
    font-size: 12px;
}

.alert {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 14px;
    display: none;
}

.alert.error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.alert.success {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

/* 视频管理列表 */
.video-table-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-video-item {
    display: flex;
    gap: 14px;
    padding: 12px;
    border-radius: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    align-items: center;
}

.admin-thumb {
    width: 136px;
    aspect-ratio: 16 / 9;
    border-radius: 6px;
    overflow: hidden;
    background: #000;
    flex-shrink: 0;
}

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

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

.admin-video-title {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.admin-video-meta {
    font-size: 12px;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.admin-video-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* 编辑弹窗 */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 200;
}

.modal-card {
    width: 100%;
    max-width: 460px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

@media (max-width: 960px) {
    .container {
        grid-template-columns: 1fr;
    }
    .admin-video-item {
        flex-direction: column;
        align-items: flex-start;
    }
    .admin-thumb {
        width: 100%;
    }
}
