:root {
    --bg-main: #0f172a;
    --bg-panel: #1e293b;
    --bg-panel-soft: #172238;
    --bg-card: #1e293b;
    --border-soft: rgba(148, 163, 184, 0.18);
    --border-strong: rgba(56, 189, 248, 0.45);
    --text-main: #f8fafc;
    --text-muted: #cbd5e1;
    --text-soft: #94a3b8;
    --blue: #2563eb;
    --blue-light: #3b82f6;
    --cyan: #06b6d4;
    --green: #10b981;
    --red: #ef4444;
    --orange: #f59e0b;
    --radius-lg: 18px;
    --radius-md: 12px;
    --shadow-card: 0 18px 40px rgba(0, 0, 0, 0.24);
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: dark;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.14), transparent 35%),
        radial-gradient(circle at 85% 12%, rgba(6, 182, 212, 0.08), transparent 25%),
        linear-gradient(135deg, #0f172a 0%, #111827 45%, #020617 100%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.55;
}

body .container,
body .page-container,
body .main-wrap {
    width: 100%;
    padding: 32px clamp(20px, 3vw, 48px);
}

body h1 {
    margin: 0;
    color: var(--text-main);
    font-size: clamp(28px, 3vw, 34px);
    font-weight: 900;
    line-height: 1.25;
    letter-spacing: -0.02em;
    text-align: left;
}

body h2,
body h3 {
    color: var(--text-main);
}

body .page-top,
body .stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

body .current-path,
body .breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: min(72vw, 900px);
    padding: 10px 14px;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    background: rgba(30, 41, 59, 0.86);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.45;
    text-align: left;
    white-space: normal;
    backdrop-filter: blur(14px);
}

body .current-path a,
body .breadcrumb a {
    color: #dbeafe;
    text-decoration: none;
}

body .current-path a:hover,
body .breadcrumb a:hover {
    color: #93c5fd;
}

body .current-path .sep,
body .breadcrumb .sep {
    margin: 0 2px;
    color: #64748b;
}

button,
input[type="submit"],
.btn,
body .tool-btn,
body .nav-btn,
body .action-btn,
body .detail-btn,
body .directory-link,
body .folder-action-btn,
body .danger-btn,
body .confirm-btn,
body .cancel-btn,
body .submit-btn,
body .clear-btn {
    border: 0;
    border-radius: 10px;
    padding: 9px 14px;
    color: #fff;
    font-family: inherit;
    font-weight: 800;
    line-height: 1.35;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease, opacity 0.15s ease;
}

button:hover,
input[type="submit"]:hover,
.btn:hover,
body .tool-btn:hover,
body .action-btn:hover,
body .detail-btn:hover,
body .directory-link:hover,
body .folder-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
    filter: brightness(1.08);
}

body .tool-btn,
body .submit-btn,
body .detail-btn,
body .directory-link,
body .action-btn,
body .folder-action-btn,
body .btn-primary {
    background: linear-gradient(135deg, var(--blue-light), var(--blue));
}

body .danger-btn,
body .delete-btn,
body .folder-delete-btn,
body .batch-delete-btn,
body .action-btn.danger,
body .btn-danger {
    background: linear-gradient(135deg, #f43f5e, #dc2626);
    color: #fff;
}

body .confirm-btn,
body .btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
}

body .cancel-btn,
body .clear-btn,
body .secondary,
body .batch-clear-btn,
body .batch-cancel-btn,
body .btn-muted {
    background: linear-gradient(135deg, #64748b, #475569);
}

body .rename-btn,
body .action-btn.rename,
body .btn-warning {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
}

body .download-btn,
body .action-btn.download {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
}

body .asset-actions .prompt-btn,
body .asset-actions .download-btn,
body .asset-actions .edit-btn,
body .asset-actions .rename-btn,
body .asset-actions .tag-btn,
body .asset-actions .delete-btn,
body .asset-actions .history-btn {
    display: inline-flex;
    align-items: center;
    padding: 7px 11px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 9px;
    background: rgba(37, 99, 235, 0.18);
    color: #dbeafe;
    font-size: 14px;
    line-height: 1.3;
    text-decoration: none;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

body .asset-actions .download-btn {
    background: rgba(6, 182, 212, 0.18);
    color: #cffafe;
}

body .asset-actions .rename-btn,
body .asset-actions .edit-btn,
body .asset-actions .tag-btn {
    background: rgba(124, 58, 237, 0.18);
    color: #ede9fe;
}

body .asset-actions .delete-btn {
    background: rgba(239, 68, 68, 0.16);
    color: #fecaca;
}

body .asset-actions .prompt-btn:hover,
body .asset-actions .download-btn:hover,
body .asset-actions .edit-btn:hover,
body .asset-actions .rename-btn:hover,
body .asset-actions .tag-btn:hover,
body .asset-actions .delete-btn:hover,
body .asset-actions .history-btn:hover {
    transform: translateY(-1px);
    border-color: var(--border-strong);
    background: rgba(59, 130, 246, 0.28);
}

input[type="text"],
input[type="number"],
input[type="search"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 10px;
    outline: none;
    background: rgba(2, 6, 23, 0.7);
    color: var(--text-main);
    font: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
input[type="file"]:focus,
select:focus,
textarea:focus {
    border-color: #38bdf8;
    background: rgba(2, 6, 23, 0.9);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.14);
}

textarea {
    line-height: 1.55;
    resize: vertical;
}

body .cards,
body .grid,
body .asset-grid,
body .folder-grid,
body .file-grid,
body .result-grid,
body .preview-grid,
body .quick-grid,
body .recent-grid,
body .dashboard,
body .stats-grid,
body .version-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}

body .card,
body .folder-card,
body .asset-card,
body .file-card,
body .entry-card,
body .stat-card,
body .quick-card,
body .recent-card,
body .result-card,
body .version-card,
body .section-box,
body .search-panel,
body .global-search {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.95));
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

body .card:hover,
body .folder-card:hover,
body .asset-card:hover,
body .file-card:hover,
body .entry-card:hover,
body .quick-card:hover,
body .recent-card:hover,
body .result-card:hover,
body .version-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    box-shadow: 0 22px 46px rgba(0, 0, 0, 0.32);
}

body .card {
    display: flex;
    min-height: 96px;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
}

body .card h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 850;
}

body .toolbar,
body .default-toolbar-actions,
body .default-actions,
body .delete-actions,
body .batch-delete-actions,
body .file-actions,
body .asset-actions,
body .card-actions {
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

body .toolbar {
    margin-bottom: 22px;
}

body .add-box,
body .expand-box,
body .upload-box,
body .form-section,
body .description,
body .folder-description,
body .notice-box,
body .empty-tip {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    background: linear-gradient(145deg, rgba(23, 34, 56, 0.98), rgba(15, 23, 42, 0.94));
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.18);
}

body .folder-card,
body .file-card,
body .entry-card {
    overflow: hidden;
}

body .folder-main {
    min-height: 88px;
    display: flex;
    align-items: center;
}

body .file-name,
body .entry-name {
    color: var(--text-main);
    font-weight: 850;
}

body .file-meta,
body .meta,
body .hint,
body .upload-hint,
body .page-description,
body .count {
    color: var(--text-soft);
}

body .preview-panel {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    background: rgba(2, 6, 23, 0.84);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
}

body .preview-body {
    border: 1px solid var(--border-soft);
    background: rgba(15, 23, 42, 0.88);
}

body .preview-body pre,
body .preview-content,
body #promptText {
    font-size: 14px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

body .pdf-preview-frame,
body .pdf-frame {
    height: 70vh;
}

body .folder-checkbox,
body .asset-checkbox,
body .version-checkbox,
body .batch-check,
body .delete-check {
    width: 18px;
    height: 18px;
    accent-color: var(--red);
}

body.select-mode .card-wrap,
body.select-mode .file-card,
body.delete-mode .folder-card,
body.delete-mode .file-card,
body.delete-mode .entry-card {
    border-color: rgba(56, 189, 248, 0.62);
    outline: 2px dashed rgba(56, 189, 248, 0.5);
    outline-offset: 3px;
}

body .card-wrap:has(input:checked) .card,
body .file-card:has(input:checked),
body .folder-card:has(input:checked),
body .entry-card:has(input:checked),
body .version-wrap:has(input:checked) .version-card {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18), var(--shadow-card);
}

body .tag-pill,
body .card-tag,
body .library-tag {
    display: inline-flex;
    align-items: center;
    margin: 3px;
    padding: 5px 9px;
    border: 1px solid rgba(56, 189, 248, 0.24);
    border-radius: 999px;
    background: rgba(14, 116, 144, 0.2);
    color: #bae6fd;
    font-size: 12px;
    font-weight: 750;
}

body .file-type-badge {
    display: inline-flex;
    align-items: center;
    width: max-content;
    margin-bottom: 10px;
    padding: 4px 8px;
    border: 1px solid rgba(34, 211, 238, 0.32);
    border-radius: 999px;
    background: rgba(6, 182, 212, 0.12);
    color: #67e8f9;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

body .file-meta span:first-child,
body .meta span:first-child {
    display: inline-flex;
    align-items: center;
    width: max-content;
    padding: 4px 8px;
    border: 1px solid rgba(34, 211, 238, 0.32);
    border-radius: 999px;
    background: rgba(6, 182, 212, 0.12);
    color: #67e8f9;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

body .preview-grid {
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    align-items: start;
}

body .preview-grid .file-card {
    padding: 18px;
}

body .preview-grid .file-card img,
body .asset-image {
    display: block;
    width: 100%;
    height: 300px;
    object-fit: contain;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: #020617;
}

body .asset-actions {
    padding-top: 12px;
    border-top: 1px solid var(--border-soft);
}

body .import-form {
    width: min(980px, 100%);
    max-width: 980px;
    margin: 0 auto;
}

body .import-form .form-section {
    padding: 22px;
    margin-bottom: 18px;
}

body .import-form .form-section h2 {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 850;
}

body .novel-textarea { height: 320px; }
body .script-textarea { height: 280px; }
body .handoff-textarea { height: 240px; }
body .asset-prompt-textarea { height: 260px; }
body .storyboard-textarea { height: 280px; }

body .success-notice,
body .success-box {
    padding: 18px;
    border: 1px solid rgba(16, 185, 129, 0.45);
    border-radius: 16px;
    background: rgba(16, 185, 129, 0.12);
    color: #d1fae5;
    box-shadow: 0 16px 36px rgba(5, 150, 105, 0.1);
}

body .error-notice,
body .error-box {
    padding: 18px;
    border: 1px solid rgba(239, 68, 68, 0.45);
    border-radius: 16px;
    background: rgba(239, 68, 68, 0.12);
    color: #fee2e2;
}

body .modal {
    backdrop-filter: blur(8px);
}

body .modal-box,
body #promptPopup {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    background: linear-gradient(145deg, #1e293b, #0f172a);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.48);
}

@media (max-width: 768px) {
    body .container,
    body .page-container,
    body .main-wrap {
        padding: 18px;
    }

    body .page-top,
    body .stats-header {
        align-items: flex-start;
        flex-direction: column;
    }

    body .current-path,
    body .breadcrumb {
        max-width: 100%;
        border-radius: var(--radius-md);
    }

    body .cards,
    body .grid,
    body .asset-grid,
    body .folder-grid,
    body .file-grid,
    body .result-grid,
    body .preview-grid,
    body .quick-grid,
    body .recent-grid,
    body .dashboard,
    body .stats-grid,
    body .version-grid {
        grid-template-columns: 1fr;
    }

    body .toolbar,
    body .default-toolbar-actions,
    body .default-actions,
    body .delete-actions,
    body .batch-delete-actions {
        width: 100%;
    }

    body .preview-grid .file-card img,
    body .asset-image {
        height: 240px;
    }
}
