﻿:root {
    --bg-white: rgba(255, 255, 255, 0.78);
    --bg-strong: rgba(255, 255, 255, 0.9);
    --bg-soft: rgba(255, 255, 255, 0.64);
    --border-light: rgba(194, 208, 236, 0.42);
    --border-strong: rgba(173, 189, 225, 0.66);
    --text-primary: #1f2a44;
    --text-secondary: #5e6b86;
    --text-muted: #7d89a3;
    --brand-start: #5b6bf9;
    --brand-end: #7b4fe0;
    --brand-deep: #4450c7;
    --shadow-soft: 0 18px 44px rgba(73, 91, 173, 0.1);
    --shadow-hover: 0 24px 52px rgba(73, 91, 173, 0.16);
    --page-bg: #edf2f8;
    --hero-sheen: linear-gradient(140deg, rgba(91, 107, 249, 0.18), rgba(123, 79, 224, 0.1)),
        linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 62%);
    --background-overlay:
        radial-gradient(circle at top left, rgba(123, 79, 224, 0.16), transparent 38%),
        radial-gradient(circle at top right, rgba(91, 107, 249, 0.14), transparent 34%),
        linear-gradient(180deg, rgba(248, 250, 255, 0.76), rgba(236, 242, 250, 0.92));
    --radius-xl: 32px;
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 14px;
    --transition-base: 0.28s ease;
}

body[data-theme="dark"] {
    --bg-white: rgba(12, 16, 28, 0.82);
    --bg-strong: rgba(18, 24, 40, 0.92);
    --bg-soft: rgba(14, 19, 33, 0.76);
    --border-light: rgba(129, 145, 198, 0.2);
    --border-strong: rgba(170, 183, 227, 0.32);
    --text-primary: #f5f7ff;
    --text-secondary: #c7d2ea;
    --text-muted: #93a2c2;
    --brand-start: #8ea0ff;
    --brand-end: #bb97ff;
    --brand-deep: #dfe6ff;
    --shadow-soft: 0 24px 54px rgba(0, 0, 0, 0.46);
    --shadow-hover: 0 28px 72px rgba(0, 0, 0, 0.58);
    --page-bg: #04060a;
    --hero-sheen:
        linear-gradient(145deg, rgba(95, 108, 226, 0.24), rgba(158, 118, 228, 0.16)),
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 68%);
    --background-overlay:
        radial-gradient(circle at top left, rgba(74, 58, 130, 0.26), transparent 34%),
        radial-gradient(circle at top right, rgba(53, 79, 173, 0.18), transparent 30%),
        linear-gradient(180deg, rgba(4, 6, 10, 0.62), rgba(2, 3, 6, 0.9));
    color-scheme: dark;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    max-width: 100%;
}

html {
    scroll-behavior: smooth;
    width: 100%;
    overflow-x: hidden;
}

body {
    min-height: 100vh;
    font-family: "Manrope", "Noto Sans SC", "Microsoft YaHei", sans-serif;
    color: var(--text-primary);
    background: var(--page-bg);
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

button,
input,
select {
    font: inherit;
}

button {
    border: none;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.page-shell {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    width: 100%;
    max-width: 100vw;
}

.background-layer,
.background-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

.background-layer {
    background:
        linear-gradient(180deg, rgba(245, 249, 255, 0.1), rgba(241, 245, 255, 0.24)),
        url("./jianxiaoyun.jpg") center center / cover no-repeat;
    transform: scale(1.01);
}

.background-overlay {
    background: var(--background-overlay);
}

.page-content {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 20px 48px;
    display: grid;
    gap: 24px;
    width: min(100%, 1200px);
    min-width: 0;
}

.glass-panel {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0)),
        var(--bg-white);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-soft);
}

.hero {
    position: relative;
    overflow: hidden;
    border-radius: 36px;
    padding: 42px 26px 36px;
    text-align: center;
    isolation: isolate;
}

.theme-toggle {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 9px 6px 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.62);
    color: #5b57d8;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        0 12px 26px rgba(91, 107, 249, 0.16);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition:
        background 0.16s ease,
        border-color 0.16s ease,
        color 0.16s ease,
        transform 0.16s ease,
        box-shadow 0.16s ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.86),
        0 16px 30px rgba(91, 107, 249, 0.2);
}

.theme-toggle-track {
    position: relative;
    width: 38px;
    height: 22px;
    border-radius: 999px;
    background: linear-gradient(135deg, #dcd9ff, #ffffff);
    box-shadow:
        inset 0 1px 3px rgba(91, 107, 249, 0.22),
        0 6px 14px rgba(91, 107, 249, 0.12);
}

.theme-toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 4px 10px rgba(76, 81, 191, 0.28);
    transition:
        transform 0.18s cubic-bezier(0.22, 1, 0.36, 1),
        background 0.18s ease;
}

.theme-toggle-text {
    font-size: 0.76rem;
    font-weight: 800;
    line-height: 1;
}

body[data-theme="dark"] .theme-toggle {
    background: linear-gradient(135deg, rgba(20, 25, 42, 0.94), rgba(28, 35, 58, 0.9));
    border-color: rgba(150, 165, 214, 0.22);
    color: #f7f7ff;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 16px 30px rgba(0, 0, 0, 0.34);
}

body[data-theme="dark"] .theme-toggle-track {
    background: linear-gradient(135deg, #8f9eff, #d1c0ff);
}

body[data-theme="dark"] .theme-toggle-thumb {
    transform: translateX(16px);
    background: #0d1321;
}

body[data-theme="dark"] .background-layer {
    filter: brightness(0.22) saturate(0.74) contrast(0.96);
}

body[data-theme="dark"] .hero-badge,
body[data-theme="dark"] .section-tag {
    background: linear-gradient(135deg, rgba(24, 30, 50, 0.92), rgba(31, 39, 64, 0.9));
    border-color: rgba(145, 160, 214, 0.18);
    color: #dfe5ff;
}

body[data-theme="dark"] .hero-logo {
    background: linear-gradient(180deg, rgba(14, 19, 33, 0.96), rgba(21, 27, 44, 0.9));
    border-color: rgba(132, 151, 214, 0.28);
    box-shadow: 0 22px 44px rgba(0, 0, 0, 0.38);
}

body[data-theme="dark"] .hero,
body[data-theme="dark"] .files-header,
body[data-theme="dark"] .tabs-panel,
body[data-theme="dark"] .list-panel,
body[data-theme="dark"] .login-section,
body[data-theme="dark"] .admin-section,
body[data-theme="dark"] .footer {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0)),
        linear-gradient(145deg, rgba(14, 19, 33, 0.94), rgba(18, 24, 40, 0.88));
    border-color: rgba(126, 141, 190, 0.18);
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.42);
}

body[data-theme="dark"] .tab-btn,
body[data-theme="dark"] .file-item,
body[data-theme="dark"] .category-browser-tree,
body[data-theme="dark"] .active-files-panel,
body[data-theme="dark"] .login-form,
body[data-theme="dark"] .upload-form,
body[data-theme="dark"] .manage-section,
body[data-theme="dark"] .search-result-card,
body[data-theme="dark"] .search-summary-card,
body[data-theme="dark"] .order-card,
body[data-theme="dark"] .order-sub-card,
body[data-theme="dark"] .delete-category-row,
body[data-theme="dark"] .download-toast {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0)),
        linear-gradient(145deg, rgba(11, 15, 25, 0.94), rgba(16, 21, 35, 0.9));
    border-color: rgba(124, 139, 186, 0.2);
    box-shadow: 0 18px 32px rgba(0, 0, 0, 0.38);
}

body[data-theme="dark"] .category-tabs {
    padding-bottom: 6px;
}

body[data-theme="dark"] .category-title,
body[data-theme="dark"] .sub-category-title {
    border-color: rgba(188, 202, 245, 0.2);
    color: var(--text-primary);
}

body[data-theme="dark"] .category-title[data-depth="1"],
body[data-theme="dark"] .sub-category-title[data-depth="1"] {
    background: linear-gradient(135deg, rgba(23, 32, 53, 0.98), rgba(32, 42, 68, 0.96));
}

body[data-theme="dark"] .category-title[data-depth="2"],
body[data-theme="dark"] .sub-category-title[data-depth="2"] {
    background: linear-gradient(135deg, rgba(32, 40, 63, 0.98), rgba(42, 50, 77, 0.96));
}

body[data-theme="dark"] .category-title[data-depth="3"],
body[data-theme="dark"] .sub-category-title[data-depth="3"] {
    background: linear-gradient(135deg, rgba(40, 48, 72, 0.99), rgba(52, 60, 88, 0.97));
}

body[data-theme="dark"] .category-title[data-depth="4"],
body[data-theme="dark"] .sub-category-title[data-depth="4"] {
    background: linear-gradient(135deg, rgba(49, 57, 80, 0.99), rgba(60, 69, 97, 0.97));
}

body[data-theme="dark"] .category-title[data-depth="5"],
body[data-theme="dark"] .sub-category-title[data-depth="5"] {
    background: linear-gradient(135deg, rgba(58, 66, 89, 0.99), rgba(70, 79, 106, 0.98));
}

body[data-theme="dark"] .category-title.is-active,
body[data-theme="dark"] .sub-category-title.is-active,
body[data-theme="dark"] .category-title.is-open,
body[data-theme="dark"] .sub-category-title.is-open {
    border-color: rgba(216, 226, 255, 0.4);
    box-shadow: 0 8px 18px rgba(5, 10, 22, 0.34);
}

body[data-theme="dark"] .toggle-icon {
    background: rgba(216, 226, 255, 0.1);
    color: #eef2ff;
}

body[data-theme="dark"] .hero h1,
body[data-theme="dark"] .section-heading h2,
body[data-theme="dark"] .tabs-title,
body[data-theme="dark"] .active-files-title,
body[data-theme="dark"] .file-name {
    color: #f7f9ff;
}

body[data-theme="dark"] .hero-subtitle,
body[data-theme="dark"] .hint,
body[data-theme="dark"] .footer p,
body[data-theme="dark"] .tabs-tip,
body[data-theme="dark"] .active-files-subtitle,
body[data-theme="dark"] .file-info {
    color: #c7d2ea;
}

body[data-theme="dark"] .form-group input[type="password"],
body[data-theme="dark"] .form-group input[type="text"],
body[data-theme="dark"] .form-group input[type="file"],
body[data-theme="dark"] .form-group select,
body[data-theme="dark"] .search-input,
body[data-theme="dark"] .mini-input,
body[data-theme="dark"] .delete-category-title {
    background:
        linear-gradient(135deg, rgba(24, 31, 52, 0.92), rgba(15, 20, 34, 0.9)),
        rgba(10, 14, 24, 0.96);
    border-color: rgba(135, 149, 196, 0.22);
    color: var(--text-primary);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 10px 22px rgba(0, 0, 0, 0.18);
}

body[data-theme="dark"] .form-group input::placeholder,
body[data-theme="dark"] .search-input::placeholder,
body[data-theme="dark"] .mini-input::placeholder {
    color: rgba(206, 216, 246, 0.52);
}

body[data-theme="dark"] .search-input:focus {
    border-color: rgba(150, 166, 255, 0.42);
    box-shadow:
        0 0 0 4px rgba(120, 136, 255, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 16px 28px rgba(0, 0, 0, 0.24);
}

body[data-theme="dark"] .btn-secondary,
body[data-theme="dark"] .file-link,
body[data-theme="dark"] .btn-file-action,
body[data-theme="dark"] .order-toggle-btn,
body[data-theme="dark"] .order-arrow-btn,
body[data-theme="dark"] .close-btn {
    background:
        linear-gradient(135deg, rgba(87, 102, 201, 0.26), rgba(156, 106, 214, 0.2)),
        rgba(14, 18, 29, 0.94);
    border-color: rgba(139, 154, 205, 0.26);
    color: #eff3ff;
}

body[data-theme="dark"] .btn-primary,
body[data-theme="dark"] #searchBtn,
body[data-theme="dark"] .tab-btn.active {
    color: #fefeff;
    background:
        linear-gradient(135deg, rgba(114, 126, 255, 0.98), rgba(178, 120, 242, 0.94));
    border-color: rgba(196, 177, 255, 0.22);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        0 16px 30px rgba(32, 24, 72, 0.34);
}

body[data-theme="dark"] .tab-btn {
    background: linear-gradient(135deg, rgba(18, 24, 39, 0.9), rgba(24, 30, 48, 0.88));
    border-color: rgba(124, 138, 184, 0.2);
    color: #dbe3fb;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body[data-theme="dark"] .tab-btn:hover,
body[data-theme="dark"] .tab-btn:focus-visible,
body[data-theme="dark"] .btn-secondary:hover,
body[data-theme="dark"] .file-link:hover,
body[data-theme="dark"] .btn-file-action:hover {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 16px 28px rgba(0, 0, 0, 0.26);
}

body[data-theme="dark"] .status-message.success {
    color: #c9f7df;
    background: rgba(20, 83, 45, 0.36);
    border-color: rgba(72, 187, 120, 0.28);
}

body[data-theme="dark"] .status-message.error {
    color: #ffd4d4;
    background: rgba(127, 29, 29, 0.36);
    border-color: rgba(245, 101, 101, 0.28);
}

body[data-theme="dark"] .modal {
    background: rgba(3, 5, 10, 0.76);
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--hero-sheen);
    z-index: -1;
}

.hero-badge,
.section-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.58);
    border: 1px solid rgba(255, 255, 255, 0.48);
    color: var(--brand-deep);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero-logo {
    width: 136px;
    height: 136px;
    margin: 22px auto 20px;
    border-radius: 50%;
    padding: 11px;
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid rgba(255, 255, 255, 0.62);
    box-shadow: 0 22px 42px rgba(76, 81, 191, 0.18);
    overflow: hidden;
}

.hero-logo img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: 50%;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

.hero-subtitle {
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: clamp(1rem, 2vw, 1.15rem);
}

.content-grid {
    display: block;
}

.files-stage,
.admin-anchor {
    display: grid;
    gap: 20px;
    min-width: 0;
}

.files-header,
.tabs-panel,
.list-panel,
.login-section,
.admin-section,
.footer {
    border-radius: var(--radius-xl);
    width: 100%;
    min-width: 0;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 26px rgba(91, 107, 249, 0.06);
}

.files-header,
.tabs-panel,
.login-section,
.admin-section,
.footer {
    padding: 24px;
}

.list-panel {
    padding: 12px;
}

.section-heading {
    display: grid;
    gap: 10px;
}

.section-heading.compact {
    gap: 8px;
}

.section-heading h2 {
    font-size: clamp(1.5rem, 3vw, 2.35rem);
    font-weight: 800;
    letter-spacing: -0.03em;
}

.files-header .section-heading h2 {
    font-size: clamp(1.34rem, 2.6vw, 2rem);
}

.login-section .section-heading h2 {
    font-size: clamp(1.26rem, 2.3vw, 1.82rem);
}

.section-heading p,
.tabs-note,
.detail-card p,
.footer p,
.hint {
    color: var(--text-secondary);
    line-height: 1.7;
}

.files-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
}

.header-actions {
    display: flex;
    justify-content: flex-end;
}

.tabs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
    min-width: 0;
}

.search-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

.search-input {
    width: 100%;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.52);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.42), rgba(123, 79, 224, 0.08)),
        rgba(255, 255, 255, 0.24);
    color: var(--text-primary);
    padding: 14px 20px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.72),
        0 10px 22px rgba(91, 107, 249, 0.08);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.search-input::placeholder {
    color: rgba(93, 104, 134, 0.82);
}

.search-input:focus {
    outline: none;
    border-color: rgba(91, 107, 249, 0.62);
    box-shadow:
        0 0 0 4px rgba(91, 107, 249, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.78),
        0 12px 24px rgba(91, 107, 249, 0.12);
}

.tabs-heading {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.tabs-title {
    font-size: clamp(1.22rem, 2vw, 1.42rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.tabs-tip {
    color: var(--text-secondary);
    font-size: 0.84rem;
    line-height: 1.5;
}

#searchBtn {
    min-height: 48px;
    padding: 12px 18px;
    border-radius: 999px;
    color: #5441b5;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(123, 79, 224, 0.18)),
        linear-gradient(135deg, rgba(91, 107, 249, 0.14), rgba(123, 79, 224, 0.12));
    border: 1px solid rgba(255, 255, 255, 0.58);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.75),
        0 12px 24px rgba(91, 107, 249, 0.12);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

#searchBtn:hover,
#searchBtn:focus-visible {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(123, 79, 224, 0.24)),
        linear-gradient(135deg, rgba(91, 107, 249, 0.18), rgba(123, 79, 224, 0.18));
    color: #4838a8;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.82),
        0 16px 28px rgba(91, 107, 249, 0.16);
}

.category-tabs {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
    width: 100%;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
}

.category-tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn,
.btn,
.file-link,
.category-title,
.sub-category-title,
.close-btn,
.file-item,
.detail-card,
.mini-pill,
.mini-btn,
.mini-input {
    transition:
        transform var(--transition-base),
        box-shadow var(--transition-base),
        border-color var(--transition-base),
        background var(--transition-base),
        color var(--transition-base),
        opacity var(--transition-base);
}

.tab-btn {
    white-space: nowrap;
    padding: 12px 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.58);
    border: 1px solid rgba(255, 255, 255, 0.45);
    color: var(--text-primary);
    font-weight: 700;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
    flex: 0 0 auto;
}

.tab-btn:hover,
.tab-btn:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 14px 24px rgba(91, 107, 249, 0.14);
    border-color: rgba(91, 107, 249, 0.3);
}

.tab-btn:active {
    transform: scale(0.98);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--brand-start), var(--brand-end));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 18px 34px rgba(91, 107, 249, 0.24);
}

.file-list {
    display: grid;
    gap: 18px;
}

.category-browser-shell {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.category-browser-tree,
.active-files-panel {
    background: #ffffff;
    border: 1px solid #e6ebf5;
    border-radius: 24px;
    padding: 18px;
    box-shadow: 0 1px 8px rgba(91, 107, 249, 0.04);
}

.category-browser-tree {
    display: grid;
    gap: 12px;
}

.active-files-panel {
    display: grid;
    gap: 16px;
    min-width: 0;
}

.active-files-header {
    display: grid;
    gap: 6px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eef2f8;
}

.active-files-title {
    font-size: 1.12rem;
    font-weight: 800;
    color: var(--text-primary);
    word-break: break-word;
}

.active-files-subtitle {
    color: var(--text-secondary);
    font-size: 0.94rem;
}

.active-files-list {
    display: grid;
    gap: 14px;
}

.mobile-category-browser {
    display: grid;
    gap: 12px;
}

.mobile-category-trail {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
}

.mobile-category-trail::-webkit-scrollbar {
    display: none;
}

.mobile-trail-chip {
    flex: 0 0 auto;
    padding: 9px 12px;
    border-radius: 999px;
    border: 1px solid rgba(136, 149, 197, 0.28);
    background: rgba(255, 255, 255, 0.86);
    color: var(--text-secondary);
    font-weight: 700;
}

.mobile-trail-chip.is-active {
    color: #fff;
    background: linear-gradient(135deg, var(--brand-start), var(--brand-end));
    border-color: transparent;
}

.mobile-category-list,
.mobile-category-children {
    display: grid;
    gap: 10px;
}

.mobile-category-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 20px;
    border: 1px solid rgba(136, 149, 197, 0.2);
    background: rgba(255, 255, 255, 0.92);
}

.mobile-category-summary-body {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.mobile-category-summary-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.mobile-category-summary-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
    word-break: break-word;
}

.mobile-category-back {
    flex: 0 0 auto;
    padding: 9px 12px;
    border-radius: 999px;
    border: 1px solid rgba(136, 149, 197, 0.24);
    background: rgba(246, 248, 255, 0.96);
    color: var(--brand-deep);
    font-weight: 700;
}

.mobile-category-children-title {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--text-secondary);
    padding: 0 2px;
}

.mobile-category-card {
    width: 100%;
    display: grid;
    grid-template-columns: 5px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 14px 14px;
    border-radius: 20px;
    border: 1px solid rgba(136, 149, 197, 0.24);
    background: rgba(255, 255, 255, 0.94);
    color: var(--text-primary);
    text-align: left;
}

.mobile-category-card-bar {
    align-self: stretch;
    border-radius: 999px;
    background: linear-gradient(180deg, #6d78ff, #8d5df1);
}

.mobile-category-card-body {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.mobile-category-card-name {
    font-weight: 800;
    word-break: break-word;
}

.mobile-category-card-meta {
    font-size: 0.84rem;
    color: var(--text-secondary);
}

.mobile-category-card-arrow {
    color: var(--brand-deep);
    font-weight: 900;
}

.mobile-category-card.is-active {
    border-color: rgba(109, 120, 255, 0.38);
    box-shadow: 0 8px 18px rgba(91, 107, 249, 0.1);
}

body[data-theme="dark"] .mobile-trail-chip {
    background: rgba(11, 15, 24, 0.88);
    border-color: rgba(110, 124, 170, 0.26);
    color: var(--text-secondary);
}

body[data-theme="dark"] .mobile-category-summary {
    background: rgba(11, 15, 24, 0.9);
    border-color: rgba(110, 124, 170, 0.22);
}

body[data-theme="dark"] .mobile-category-summary-label {
    color: var(--text-muted);
}

body[data-theme="dark"] .mobile-category-summary-title {
    color: var(--text-primary);
}

body[data-theme="dark"] .mobile-category-back {
    background: rgba(18, 24, 38, 0.96);
    border-color: rgba(110, 124, 170, 0.24);
    color: #eff3ff;
}

body[data-theme="dark"] .mobile-category-card {
    background: rgba(11, 15, 24, 0.9);
    border-color: rgba(110, 124, 170, 0.22);
    color: var(--text-primary);
}

body[data-theme="dark"] .mobile-category-card-meta,
body[data-theme="dark"] .mobile-category-children-title {
    color: var(--text-secondary);
}

.category-group,
.sub-category-group {
    display: grid;
    gap: 10px;
    width: 100%;
    min-width: 0;
}

.category-title,
.sub-category-title {
    width: 100%;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 17px 18px;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(242, 240, 255, 0.96), rgba(255, 255, 255, 0.88));
    border: 1px solid #d8d8f8;
    box-shadow: 0 4px 12px rgba(91, 107, 249, 0.05);
    transition: background 0.08s ease, border-color 0.08s ease, box-shadow 0.08s ease;
    user-select: none;
}

.category-title-text,
.sub-category-title-text {
    flex: 1;
    min-width: 0;
    font-weight: 800;
    font-size: 1.08rem;
    text-align: left;
    word-break: break-word;
}

.sub-category-group {
    margin-left: 14px;
    padding-left: 2px;
    border-left: 1px solid rgba(143, 155, 214, 0.18);
}

.sub-category-title-text {
    font-size: 0.98rem;
    font-weight: 700;
}

.category-title:hover,
.sub-category-title:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(91, 107, 249, 0.07);
}

.category-title:active,
.sub-category-title:active {
    transform: none;
}

.toggle-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-deep);
    background: rgba(91, 107, 249, 0.08);
    border-radius: 50%;
    font-size: 0.86rem;
    line-height: 1;
    font-weight: 900;
}

.toggle-icon {
    transition: color 0.12s ease;
}

.category-title.is-active,
.sub-category-title.is-active,
.category-title.is-open,
.sub-category-title.is-open {
    border-color: #b7a9ff;
    box-shadow: 0 2px 10px rgba(124, 108, 242, 0.08);
}

.category-title-bar,
.sub-category-title-bar {
    width: 5px;
    align-self: stretch;
    border-radius: 999px;
    background: linear-gradient(180deg, #6d78ff, #8d5df1);
    box-shadow: none;
    flex-shrink: 0;
}

.category-title[data-depth="1"],
.sub-category-title[data-depth="1"] {
    width: 100%;
    padding: 18px 20px;
    border-radius: 24px;
    background: linear-gradient(135deg, #f4f2ff, #eef4ff);
}

.category-title[data-depth="2"],
.sub-category-title[data-depth="2"] {
    width: 100%;
    padding: 16px 18px;
    border-radius: 21px;
    background: linear-gradient(135deg, #edeaff, #f4f0ff);
}

.category-title[data-depth="3"],
.sub-category-title[data-depth="3"] {
    width: 100%;
    padding: 14px 16px;
    border-radius: 18px;
    background: linear-gradient(135deg, #e8e3ff, #efe9ff);
}

.category-title[data-depth="4"],
.sub-category-title[data-depth="4"] {
    width: 100%;
    padding: 13px 15px;
    border-radius: 17px;
    background: linear-gradient(135deg, #dfd6ff, #ebe5ff);
}

.category-title[data-depth="5"],
.sub-category-title[data-depth="5"] {
    width: 100%;
    padding: 12px 14px;
    border-radius: 16px;
    background: linear-gradient(135deg, #d8ccff, #e5dcff);
}

.category-content,
.sub-category-content {
    display: grid;
    gap: 10px;
    overflow: visible;
    padding-top: 4px;
}

.category-content[hidden],
.sub-category-content[hidden] {
    display: none;
}

.category-content.collapsed,
.sub-category-content.collapsed {
    pointer-events: none;
}


/* ========== Toolbar Navigation ========== */
.toolbar-nav {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 0;
    flex-wrap: wrap;
    width: 100%;
}

.toolbar-tab {
    white-space: nowrap;
    padding: 14px 28px;
    border-radius: 999px;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.98rem;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    cursor: pointer;
    transition:
        transform 0.28s ease,
        box-shadow 0.28s ease,
        border-color 0.28s ease,
        background 0.28s ease,
        color 0.28s ease;
}

.toolbar-tab:hover,
.toolbar-tab:focus-visible {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(91, 107, 249, 0.36);
}

.toolbar-tab:active {
    transform: scale(0.97);
}

.toolbar-tab.active {
    background: linear-gradient(135deg, var(--brand-start), var(--brand-end));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 18px 34px rgba(91, 107, 249, 0.26);
}

.toolbar-tab.active:hover {
    box-shadow: 0 22px 40px rgba(91, 107, 249, 0.32);
}

body[data-theme="dark"] .toolbar-tab {
    background: rgba(18, 24, 40, 0.88);
    border-color: rgba(126, 141, 190, 0.2);
    color: #dbe3fb;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.32);
}

body[data-theme="dark"] .toolbar-tab:hover,
body[data-theme="dark"] .toolbar-tab:focus-visible {
    border-color: rgba(150, 166, 255, 0.36);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.4);
}

body[data-theme="dark"] .toolbar-tab.active {
    background: linear-gradient(135deg, rgba(114, 126, 255, 0.98), rgba(178, 120, 242, 0.94));
    color: #fefeff;
    border-color: rgba(196, 177, 255, 0.22);
    box-shadow: 0 18px 34px rgba(32, 24, 72, 0.36);
}

/* Mobile: prevent toolbar wrapping */
@media (max-width: 480px) {
    .toolbar-nav {
        gap: 6px;
        flex-wrap: nowrap;
        padding: 0 4px;
    }
    .toolbar-tab {
        padding: 8px 14px;
        font-size: 0.82rem;
        white-space: nowrap;
        flex-shrink: 1;
        min-width: 0;
    }
}

@media (max-width: 360px) {
    .toolbar-tab {
        padding: 7px 10px;
        font-size: 0.78rem;
    }
}

/* ========== Download Rank Modal ========== */
.rank-modal-content {
    width: min(700px, 100%);
}

.rank-result-list {
    display: grid;
    gap: 12px;
}

.rank-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border-radius: 22px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(123, 79, 224, 0.08)),
        rgba(255, 255, 255, 0.62);
    border: 1px solid rgba(136, 149, 197, 0.22);
    box-shadow: 0 8px 20px rgba(91, 107, 249, 0.06);
    transition:
        transform 0.22s ease,
        box-shadow 0.22s ease;
}

.rank-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(91, 107, 249, 0.12);
}

body[data-theme="dark"] .rank-item {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0)),
        linear-gradient(145deg, rgba(11, 15, 25, 0.94), rgba(16, 21, 35, 0.9));
    border-color: rgba(124, 139, 186, 0.22);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.32);
}

/* ========== Rank Period Tabs ========== */
.rank-tabs {
    display: flex;
    gap: 8px;
    padding: 0 24px 12px;
    border-bottom: 1px solid rgba(136, 149, 197, 0.12);
    margin-bottom: 8px;
}

.rank-tab {
    padding: 7px 18px;
    border-radius: 999px;
    background: rgba(136, 149, 197, 0.08);
    color: var(--text-secondary, #8895c5);
    font-size: 0.82rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.16s ease;
}

.rank-tab.active {
    background: var(--brand-deep, #5b57d8);
    color: #fff;
}

.rank-tab:hover:not(.active) {
    background: rgba(136, 149, 197, 0.16);
}

/* Dark mode: rank tab colors */
body[data-theme="dark"] .rank-number {
    background: #8b7cf0;
}

body[data-theme="dark"] .rank-download-btn {
    background: #8b7cf0;
}

body[data-theme="dark"] .rank-download-btn:hover {
    background: #a093f5;
}

body[data-theme="dark"] .rank-tab.active {
    background: #8b7cf0;
}

body[data-theme="dark"] .rank-category {
    color: #9d94d9;
}

/* Dark mode: modal background tweaks */
body[data-theme="dark"] .rank-modal-content {
    background: rgba(40, 38, 70, 0.95);
}

/* Mobile rank tabs */
@media (max-width: 480px) {
    .rank-tabs {
        padding: 0 16px 10px;
        gap: 6px;
    }
    .rank-tab {
        padding: 5px 14px;
        font-size: 0.75rem;
    }
}


body[data-theme="dark"] .rank-item:hover {
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.4);
}

.rank-badge {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-start), var(--brand-end));
    color: #fff;
    font-weight: 800;
    font-size: 0.9rem;
    flex-shrink: 0;
}

/* ========== Safari Hint ========== */
.safari-inline-hint {
    display: inline-block;
    margin-left: 12px;
    padding: 2px 12px;
    border-radius: 999px;
    background: rgba(91, 87, 216, 0.08);
    color: #5b57d8;
    font-size: 0.72rem;
    font-weight: 500;
    white-space: nowrap;
    vertical-align: middle;
}

@media (max-width: 600px) {
    .safari-inline-hint {
        display: block;
        margin-left: 0;
        margin-top: 6px;
        font-size: 0.68rem;
        text-align: center;
    }
}

/* ========== Rank List Items ========== */
.rank-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(136, 149, 197, 0.12);
    flex-wrap: wrap;
}

.rank-number {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--brand-deep, #5b57d8);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
}

.rank-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.rank-name {
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
    font-size: 0.92rem;
}

.rank-category {
    font-size: 0.72rem;
    color: var(--text-secondary, #8895c5);
    margin-top: 2px;
    word-break: break-all;
}

.rank-count {
    font-size: 0.82rem;
    color: var(--text-secondary, #8895c5);
    white-space: nowrap;
    flex-shrink: 0;
}

.rank-size {
    font-size: 0.78rem;
    color: var(--text-secondary, #8895c5);
    white-space: nowrap;
    flex-shrink: 0;
}

.rank-total-count {
    font-size: 0.75rem;
    color: var(--text-tertiary, #a0a8cc);
    white-space: nowrap;
    flex-shrink: 0;
}

.rank-download-btn {
    padding: 6px 16px;
    border-radius: 999px;
    background: var(--brand-deep, #5b57d8);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.16s ease, transform 0.16s ease;
}

.rank-download-btn:hover {
    background: #4a46c7;
    transform: scale(1.04);
}

.rank-download-btn:active {
    transform: scale(0.97);
}

/* Mobile adjustments for rank items */
@media (max-width: 600px) {
    .rank-item {
        gap: 8px;
        padding: 10px 12px;
    }
    .rank-number {
        width: 24px;
        height: 24px;
        font-size: 0.7rem;
    }
    .rank-name {
        font-size: 0.85rem;
    }
    .rank-count {
        font-size: 0.75rem;
    }
    .rank-total-count {
        font-size: 0.7rem;
    }
    .rank-download-btn {
        padding: 5px 12px;
        font-size: 0.75rem;
    }
}

@media (max-width: 380px) {
    .rank-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    .rank-number {
        align-self: flex-start;
    }
    .rank-download-btn {
        align-self: stretch;
        text-align: center;
    }
}


.rank-badge.top1 {
    background: linear-gradient(135deg, #f59e0b, #f97316);
    width: 42px;
    height: 42px;
    font-size: 1rem;
}

.rank-badge.top2 {
    background: linear-gradient(135deg, #94a3b8, #64748b);
}

.rank-badge.top3 {
    background: linear-gradient(135deg, #d97706, #b45309);
}

.rank-info {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.rank-file-name {
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-primary);
    word-break: break-word;
}

}

.rank-source {
    font-size: 0.84rem;
    color: var(--text-muted);
    word-break: break-word;
    margin-top: 2px;
}

.rank-download-count {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--brand-deep);
    margin-top: 2px;
}

body[data-theme="dark"] .rank-source {
    color: #93a2c2;
}

body[data-theme="dark"] .rank-download-count {
    color: #dfe6ff;
}

/* ========== Contact Modal ========== */
.contact-modal-content {
    width: min(460px, 100%);
}

.contact-modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 24px 24px;
    max-height: none;
    overflow-y: visible;
    text-align: center;
}

.contact-desc {
    font-size: 0.98rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.6;
}

.contact-qr-wrapper {
    display: block;
    margin: 0 auto;
    padding: 20px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(136, 149, 197, 0.22);
    box-shadow: 0 12px 30px rgba(91, 107, 249, 0.1);
    max-width: 320px;
    width: fit-content;
    width: -moz-fit-content;
}

.contact-qr-img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 16px;
}

@media (max-width: 480px) {
    .rank-file-name {
        font-size: 0.88rem;
    }

    .rank-source {
        font-size: 0.76rem;
    }

    .rank-download-count {
        font-size: 0.82rem;
    }

    .contact-modal-body {
        padding: 0 10px 10px;
    }

    .contact-qr-wrapper {
        max-width: 220px;
        padding: 14px;
    }
}

@media (max-width: 768px) {
    .rank-source {
        font-size: 0.8rem;
    }

    .contact-qr-wrapper {
        max-width: 260px;
    }

    .rank-modal-content,
    .contact-modal-content {
        width: min(98%, 100%);
    }
}
}

body[data-theme="dark"] .contact-modal-content {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0)),
        linear-gradient(145deg, rgba(14, 19, 33, 0.94), rgba(18, 24, 40, 0.88));
    border-color: rgba(126, 141, 190, 0.18);
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.42);
}

body[data-theme="dark"] .contact-desc {
    color: #c7d2ea;
}

body[data-theme="dark"] .contact-qr-wrapper {
    background: rgba(14, 19, 33, 0.94);
    border-color: rgba(135, 149, 196, 0.18);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.36);
}

body[data-theme="dark"] .rank-modal-content {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0)),
        linear-gradient(145deg, rgba(14, 19, 33, 0.94), rgba(18, 24, 40, 0.88));
    border-color: rgba(126, 141, 190, 0.18);
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.42);
}
@media (max-width: 900px) {
    .category-browser-shell {
        grid-template-columns: 1fr;
    }
}

.file-item {
    padding: 20px;
    border-radius: var(--radius-lg);
    background: #ffffff;
    border: 1px solid #e6ebf5;
    box-shadow: 0 1px 6px rgba(91, 107, 249, 0.025);
    width: 100%;
    min-width: 0;
    contain: layout paint style;
    content-visibility: auto;
    contain-intrinsic-size: 220px;
}

.file-card-footer {
    margin-top: 14px;
    display: flex;
    justify-content: flex-start;
}

.file-item:hover {
    transform: none;
    box-shadow: 0 1px 6px rgba(91, 107, 249, 0.025);
}

.file-name {
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.6;
    word-break: break-word;
}

.file-info {
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.file-info-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.file-extra-note {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(91, 107, 249, 0.1);
    color: var(--brand-deep);
    font-size: 0.78rem;
    font-weight: 700;
}

.file-link,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 16px;
    padding: 13px 20px;
    font-weight: 700;
    text-decoration: none;
}

.btn-primary,
.file-link {
    color: #fff;
    background: linear-gradient(135deg, var(--brand-start), var(--brand-end));
    box-shadow: 0 18px 30px rgba(91, 107, 249, 0.22);
}

.btn-secondary {
    color: var(--brand-deep);
    background: rgba(255, 255, 255, 0.64);
    border: 1px solid rgba(91, 107, 249, 0.16);
}

.btn-danger,
.btn-file-danger {
    color: #fff;
    background: linear-gradient(135deg, #f56565, #e53e3e);
    box-shadow: none;
}

.btn:hover,
.file-link:hover,
.btn-file-action:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: var(--shadow-hover);
}

.btn:active,
.file-link:active,
.btn-file-action:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.file-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.btn-file-action {
    padding: 10px 14px;
    border-radius: 14px;
    background: rgba(91, 107, 249, 0.12);
    color: var(--brand-deep);
    font-weight: 700;
    will-change: transform, box-shadow;
}

.btn-file-danger {
    box-shadow: none;
}

.mini-input,
.form-group input[type="password"],
.form-group input[type="text"],
.form-group input[type="file"],
.form-group select {
    width: 100%;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.48);
    background: rgba(255, 255, 255, 0.66);
    color: var(--text-primary);
    padding: 14px 16px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.form-group input::placeholder {
    color: #9aa6b2;
}

.form-group input:focus,
.form-group select:focus,
.mini-input:focus {
    outline: none;
    border-color: rgba(91, 107, 249, 0.62);
    box-shadow:
        0 0 0 4px rgba(91, 107, 249, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.login-form,
.upload-form {
    display: grid;
    gap: 18px;
    padding: 24px;
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.48);
    width: 100%;
    min-width: 0;
}

.upload-form h3 {
    font-size: 1.15rem;
    font-weight: 800;
}

.form-group {
    display: grid;
    gap: 10px;
}

.form-group label {
    font-weight: 700;
}

.sub-category-container,
.inline-group,
.admin-header,
.admin-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.sub-category-container > * {
    flex: 1 1 220px;
}

.category-path-selectors {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
}

.category-path-selectors select {
    flex: 1 1 220px;
}

.inline-group > input,
.inline-group > select {
    flex: 1 1 220px;
}

.inline-group > button {
    flex: 0 0 auto;
}

.admin-header {
    align-items: end;
    justify-content: space-between;
    margin-bottom: 20px;
}

.admin-buttons {
    justify-content: flex-end;
    margin-bottom: 20px;
}

.status-message {
    display: none;
    padding: 12px 14px;
    border-radius: 16px;
    font-weight: 700;
    line-height: 1.6;
}

.status-message.success {
    display: block;
    color: #22543d;
    background: rgba(198, 246, 213, 0.9);
    border: 1px solid rgba(72, 187, 120, 0.24);
}

.status-message.error {
    display: block;
    color: #742a2a;
    background: rgba(254, 215, 215, 0.9);
    border: 1px solid rgba(245, 101, 101, 0.24);
}

.loading {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-secondary);
}

.footer {
    text-align: center;
}

.download-toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 40;
    width: min(360px, calc(100vw - 28px));
    padding: 16px 18px;
    border-radius: 22px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(123, 79, 224, 0.14)),
        rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.56);
    box-shadow: 0 18px 40px rgba(91, 107, 249, 0.16);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition:
        opacity 0.24s ease,
        transform 0.24s ease;
}

.download-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.download-toast.error {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.84), rgba(245, 101, 101, 0.14)),
        rgba(255, 255, 255, 0.76);
}

.download-toast-title {
    font-size: 0.98rem;
    font-weight: 800;
    color: var(--text-primary);
}

.download-toast-message {
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    word-break: break-word;
}

.download-progress-track {
    margin-top: 12px;
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.5);
    box-shadow: inset 0 1px 3px rgba(91, 107, 249, 0.1);
}

.download-progress-bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--brand-start), var(--brand-end));
    box-shadow: 0 4px 14px rgba(91, 107, 249, 0.26);
    transition: width 0.2s ease;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 30;
    padding: 24px;
    background: rgba(224, 230, 243, 0.38);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.modal.show {
    display: grid;
    place-items: center;
}

.modal-content {
    width: min(760px, 100%);
    max-height: min(88vh, 920px);
    max-width: 100%;
    overflow: hidden;
    border-radius: 30px;
}

.modal-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 16px;
    padding: 24px 24px 18px;
}

.modal-header h2 {
    margin-top: 10px;
    font-size: 1.6rem;
    font-weight: 800;
}

.close-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.72);
    color: var(--brand-deep);
    font-size: 1.8rem;
    line-height: 1;
}

.modal-body {
    padding: 0 24px 24px;
    max-height: calc(88vh - 96px);
    overflow-y: auto;
    display: grid;
    gap: 18px;
}

.modal-actions,
.search-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.move-modal-content,
.search-modal-content {
    width: min(860px, 100%);
}

.search-summary-card,
.search-result-card {
    display: grid;
    gap: 14px;
    padding: 20px;
    border-radius: 24px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(123, 79, 224, 0.14)),
        rgba(255, 255, 255, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 16px 34px rgba(91, 107, 249, 0.1);
}

.search-summary-card {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

.search-summary-title {
    font-size: 1.08rem;
    font-weight: 800;
}

.search-summary-subtitle,
.search-page-info {
    color: var(--text-secondary);
}

.search-result-list {
    display: grid;
    gap: 14px;
}

.search-result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.search-result-score {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 110px;
    padding: 8px 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(91, 107, 249, 0.22), rgba(123, 79, 224, 0.22));
    color: var(--brand-deep);
    font-weight: 800;
}

.search-result-source {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.52);
    color: var(--text-secondary);
    font-size: 0.84rem;
}

.manage-section {
    padding: 20px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.48);
}

.manage-section h3 {
    margin-bottom: 14px;
    font-size: 1.08rem;
    font-weight: 800;
}

.sort-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.category-order-list {
    display: grid;
    gap: 12px;
}

.order-card,
.order-sub-card {
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.64);
    border: 1px solid rgba(255, 255, 255, 0.52);
    box-shadow: 0 12px 24px rgba(91, 107, 249, 0.08);
    transition:
        transform 0.16s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.16s ease,
        opacity 0.16s ease;
    will-change: transform, box-shadow;
}

.order-card {
    padding: 14px 16px;
}

.order-card:hover,
.order-sub-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 28px rgba(91, 107, 249, 0.12);
}

.order-sub-list {
    display: grid;
    gap: 10px;
    margin: -2px 0 4px 22px;
    animation: fadeSlideIn 0.18s ease;
}

.order-sub-card {
    padding: 10px 12px;
}

.order-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.order-row-sub {
    min-height: 44px;
}

.order-row-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.order-row-title {
    font-weight: 800;
    color: var(--text-primary);
    word-break: break-word;
}

.order-toggle-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid rgba(255, 255, 255, 0.62);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.76);
    color: var(--brand-deep);
    flex-shrink: 0;
}

.order-toggle-btn:disabled {
    opacity: 0.72;
    cursor: default;
}

.order-toggle-icon {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1;
}

.order-toggle-icon-empty {
    font-size: 0.92rem;
}

.order-controls {
    display: inline-flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.order-arrow-btn {
    width: 34px;
    height: 34px;
    border-radius: 14px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(123, 79, 224, 0.18)),
        rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.58);
    color: #5b57d8;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.78),
        0 10px 18px rgba(91, 107, 249, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-size: 0.86rem;
}

.order-arrow-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.order-card.is-moving-up,
.order-sub-card.is-moving-up {
    animation: orderMoveUp 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

.order-card.is-moving-down,
.order-sub-card.is-moving-down {
    animation: orderMoveDown 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

.delete-category-tree {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.delete-category-card {
    display: grid;
    gap: 10px;
    min-width: 0;
    contain: layout paint style;
    content-visibility: auto;
    contain-intrinsic-size: 54px;
}

.delete-category-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 22px;
    background: #ffffff;
    border: 1px solid #e6ebf5;
    box-shadow: 0 1px 6px rgba(91, 107, 249, 0.025);
    transform: translate3d(0, 0, 0);
    contain: layout paint style;
}

.delete-category-title {
    min-width: 0;
    padding: 10px 12px;
    border-radius: 16px;
    background: #f5f7fc;
    color: var(--text-primary);
    font-weight: 800;
    text-align: left;
    overflow-wrap: anywhere;
}

.delete-category-action {
    padding: 10px 14px;
}

.delete-category-children {
    display: grid;
    gap: 10px;
    margin-left: 22px;
    overflow: clip;
    contain: layout paint;
    content-visibility: auto;
    contain-intrinsic-size: 48px 180px;
}

.delete-category-children[hidden] {
    display: none;
}

.delete-category-children.collapsed {
    pointer-events: none;
}

@keyframes orderMoveUp {
    0% {
        transform: translateY(8px);
        opacity: 0.92;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes orderMoveDown {
    0% {
        transform: translateY(-8px);
        opacity: 0.92;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-6px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.warning {
    color: #c53030;
    font-weight: 700;
}

:focus-visible {
    outline: 2px solid rgba(91, 107, 249, 0.42);
    outline-offset: 3px;
}

@media (max-width: 768px) {
    .background-layer,
    .background-overlay {
        position: absolute;
    }

    html,
    body,
    .page-shell,
    .page-content,
    .content-grid,
    .files-stage,
    .admin-anchor,
    .files-header,
    .tabs-panel,
    .list-panel,
    .login-section,
    .admin-section,
    .footer,
    .login-form,
    .upload-form,
    .category-group,
    .sub-category-group,
    .file-item,
    .category-title,
    .sub-category-title,
    .modal-content,
    .manage-section {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .page-content {
        padding: 18px 14px 28px;
        gap: 16px;
        width: 100%;
    }

    .category-browser-shell {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .category-browser-tree,
    .active-files-panel {
        padding: 14px;
        border-radius: 20px;
    }

    .hero,
    .files-header,
    .tabs-panel,
    .login-section,
    .admin-section,
    .footer {
        padding: 18px;
        border-radius: 24px;
    }

    .hero {
        padding-top: 56px;
    }

    .list-panel {
        padding: 8px;
        border-radius: 24px;
    }

    .hero-logo {
        width: 104px;
        height: 104px;
        margin: 18px auto 16px;
    }

    .hero-badge,
    .section-tag {
        max-width: 100%;
        font-size: 0.74rem;
        letter-spacing: 0.05em;
        white-space: normal;
        text-align: center;
    }

    .hero h1 {
        font-size: clamp(1.8rem, 9vw, 2.5rem);
        word-break: break-word;
    }

    .hero-subtitle {
        font-size: 0.98rem;
        line-height: 1.6;
    }

    .section-heading h2 {
        font-size: clamp(1.45rem, 7vw, 2rem);
    }

    .files-header,
    .tabs-header,
    .admin-header,
    .admin-buttons {
        align-items: stretch;
        justify-content: flex-start;
        flex-direction: column;
    }

    .header-actions,
    .admin-buttons {
        width: 100%;
    }

    .tabs-header {
        margin-bottom: 12px;
    }

    .search-bar,
    .search-summary-card {
        grid-template-columns: 1fr;
    }

    .tabs-tip {
        font-size: 0.84rem;
    }

    #searchBtn {
        min-height: 46px;
        width: 100%;
    }

    .header-actions .btn,
    .admin-buttons .btn,
    .login-form .btn,
    .upload-form .btn,
    .inline-group .btn {
        width: 100%;
    }

    .btn,
    .file-link {
        padding: 12px 16px;
    }

    .tab-btn {
        padding: 11px 16px;
        font-size: 0.96rem;
    }

    .category-title > span:first-child,
    .sub-category-title > span:first-child,
    .file-name,
    .file-info,
    .hero-subtitle,
    .tabs-title,
    .hint,
    .footer p {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .category-title,
    .sub-category-title,
    .file-item,
    .login-form,
    .upload-form,
    .manage-section {
        border-radius: 20px;
    }

    .sub-category-group {
        margin-left: 8px;
        padding-left: 8px;
    }

    .category-title,
    .sub-category-title {
        min-height: 54px;
        padding-left: 14px;
        padding-right: 14px;
    }

    .file-actions {
        flex-direction: column;
    }

    .file-actions .btn-file-action {
        width: 100%;
    }

    .sort-section-header {
        flex-direction: column;
    }

    .sort-section-header .btn {
        width: 100%;
    }

    .modal-actions,
    .search-pagination {
        flex-direction: column;
        align-items: stretch;
    }

    .search-result-head {
        align-items: flex-start;
    }

    .modal {
        padding: 14px;
    }

    .download-toast {
        right: 14px;
        left: 14px;
        bottom: 14px;
        width: auto;
    }

    .modal-content {
        border-radius: 24px;
    }

    .modal-header,
    .modal-body {
        padding-left: 18px;
        padding-right: 18px;
    }

    .background-layer {
        background-position: center top;
        background-size: cover;
        transform: none;
    }

    .theme-toggle,
    .search-input,
    #searchBtn,
    .category-title,
    .sub-category-title,
    .category-browser-tree,
    .active-files-panel,
    .file-item {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .category-title,
    .sub-category-title,
    .file-item,
    .category-browser-tree,
    .active-files-panel {
        box-shadow: none;
    }

    .category-title,
    .sub-category-title {
        background: rgba(255, 255, 255, 0.96);
        transition: background 0.08s ease, border-color 0.08s ease;
    }
}

@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
    .tab-btn,
    .btn,
    .file-link,
    .category-title,
    .sub-category-title,
    .close-btn,
    .file-item,
    .detail-card,
    .mini-pill,
    .mini-btn,
    .mini-input {
        transition: none;
    }
}

@media (max-width: 480px) {
    :root {
        --radius-xl: 24px;
        --radius-lg: 18px;
    }

    .page-content {
        padding:
            12px
            10px
            22px;
        gap: 12px;
    }

    .hero,
    .files-header,
    .tabs-panel,
    .login-section,
    .admin-section,
    .footer {
        padding: 16px 14px;
        border-radius: 20px;
    }

    .list-panel,
    .login-form,
    .upload-form,
    .manage-section,
    .modal-content {
        border-radius: 18px;
    }

    .hero {
        padding-top: 64px;
        padding-bottom: 24px;
    }

    .theme-toggle {
        top: max(10px, env(safe-area-inset-top));
        right: max(10px, env(safe-area-inset-right));
        padding: 5px 7px 5px 6px;
    }

    .theme-toggle-track {
        width: 34px;
        height: 20px;
    }

    .theme-toggle-thumb {
        width: 14px;
        height: 14px;
    }

    body[data-theme="dark"] .theme-toggle-thumb {
        transform: translateX(14px);
    }

    .theme-toggle-text {
        font-size: 0.7rem;
    }

    .hero-logo {
        width: 88px;
        height: 88px;
        margin: 14px auto 14px;
        padding: 8px;
    }

    .hero-badge,
    .section-tag {
        padding: 7px 12px;
        font-size: 0.68rem;
    }

    .hero h1 {
        font-size: clamp(1.6rem, 10vw, 2.2rem);
        line-height: 1.2;
    }

    .hero-subtitle {
        margin-top: 10px;
        font-size: 0.92rem;
    }

    .section-heading h2 {
        font-size: 1.9rem;
    }

    .files-header,
    .tabs-header,
    .admin-header {
        gap: 12px;
    }

    .tabs-panel {
        padding-bottom: 14px;
    }

    .tabs-title {
        font-size: 1rem;
    }

    .tabs-tip {
        font-size: 0.8rem;
    }

    .category-tabs {
        gap: 10px;
        padding-inline: 2px;
    }

    .search-input {
        padding: 13px 16px;
        font-size: 16px;
    }

    #searchBtn {
        min-height: 44px;
        padding: 11px 16px;
        font-size: 0.92rem;
    }

    .tab-btn {
        padding: 10px 14px;
        font-size: 0.92rem;
    }

    .category-title,
    .sub-category-title {
        padding: 14px 14px;
        gap: 10px;
        border-radius: 18px;
    }

    .category-title > span:first-child,
    .sub-category-title > span:first-child {
        font-size: 1rem;
    }

    .toggle-icon {
        width: 24px;
        height: 24px;
        font-size: 0.82rem;
    }

    .file-item {
        padding: 16px 14px;
    }

    .file-name {
        font-size: 1rem;
        line-height: 1.5;
    }

    .file-info {
        font-size: 0.88rem;
    }

    .btn,
    .file-link,
    .btn-file-action {
        font-size: 0.94rem;
    }

    .sub-category-container,
    .inline-group {
        flex-direction: column;
    }

    .sub-category-container > *,
    .inline-group > input,
    .inline-group > select,
    .inline-group > button {
        flex: 1 1 auto;
        min-width: 0;
        width: 100%;
    }

    .form-group input[type="password"],
    .form-group input[type="text"],
    .form-group input[type="file"],
    .form-group select {
        padding: 13px 14px;
        font-size: 16px;
    }

    .modal {
        padding: 10px;
    }

    .modal-header {
        padding: 16px 16px 12px;
    }

    .modal-body {
        padding: 0 16px 16px;
    }

    .close-btn {
        width: 40px;
        height: 40px;
    }
}



@media (min-width: 2000px) {
    .page-content {
        max-width: 1440px;
        padding-top: 44px;
        padding-bottom: 60px;
    }

    .hero {
        padding-top: 56px;
        padding-bottom: 52px;
    }

    .hero-logo {
        width: 152px;
        height: 152px;
    }

    .section-heading h2 {
        font-size: 2.7rem;
    }

    .file-name {
        font-size: 1.15rem;
    }
}




