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

:root {
    --pink-50: #fff1f5;
    --pink-100: #ffe4ec;
    --pink-200: #ffc8dc;
    --pink-300: #ff9ec1;
    --pink-400: #ff7aae;
    --pink-500: #ff5a9b;
    --rose-600: #e83e8c;
    --rose-700: #b91c5c;
    --text-main: #4a2c3a;
    --text-soft: #8a5a72;
    --bg-glass: rgba(255, 255, 255, 0.78);
    --shadow-soft: 0 20px 60px rgba(232, 62, 140, 0.18);
    --shadow-hover: 0 24px 70px rgba(232, 62, 140, 0.32);
}

html, body {
    min-height: 100vh;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #ffe0ec 0%, #ffd1dc 25%, #ffc1d6 55%, #ffb3c8 100%);
    color: var(--text-main);
    padding: 24px 16px;
    overflow-x: hidden;
    position: relative;
}

/* 飘动的爱心背景 */
.bg-hearts {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}
.bg-hearts span {
    position: absolute;
    color: rgba(255, 255, 255, 0.55);
    font-size: 28px;
    animation: floatUp 18s linear infinite;
    text-shadow: 0 0 8px rgba(255, 154, 193, 0.5);
}
.bg-hearts span:nth-child(1)  { left: 5%;  font-size: 22px; animation-duration: 20s; animation-delay: 0s; }
.bg-hearts span:nth-child(2)  { left: 15%; font-size: 32px; animation-duration: 22s; animation-delay: 3s; }
.bg-hearts span:nth-child(3)  { left: 25%; font-size: 18px; animation-duration: 17s; animation-delay: 6s; }
.bg-hearts span:nth-child(4)  { left: 35%; font-size: 26px; animation-duration: 24s; animation-delay: 1s; }
.bg-hearts span:nth-child(5)  { left: 45%; font-size: 36px; animation-duration: 19s; animation-delay: 8s; }
.bg-hearts span:nth-child(6)  { left: 55%; font-size: 22px; animation-duration: 21s; animation-delay: 4s; }
.bg-hearts span:nth-child(7)  { left: 65%; font-size: 28px; animation-duration: 23s; animation-delay: 7s; }
.bg-hearts span:nth-child(8)  { left: 75%; font-size: 18px; animation-duration: 16s; animation-delay: 2s; }
.bg-hearts span:nth-child(9)  { left: 85%; font-size: 30px; animation-duration: 25s; animation-delay: 5s; }
.bg-hearts span:nth-child(10) { left: 92%; font-size: 24px; animation-duration: 18s; animation-delay: 9s; }

@keyframes floatUp {
    0%   { transform: translateY(110vh) rotate(0deg); opacity: 0; }
    10%  { opacity: 0.9; }
    90%  { opacity: 0.9; }
    100% { transform: translateY(-15vh) rotate(360deg); opacity: 0; }
}

.container {
    position: relative;
    z-index: 1;
    max-width: 1280px;
    margin: 0 auto;
    background: var(--bg-glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 28px;
    padding: 36px 32px;
    box-shadow: var(--shadow-soft);
}

/* 头部 */
header {
    margin-bottom: 28px;
    padding-bottom: 22px;
    border-bottom: 2px dashed var(--pink-200);
}
.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.title-block {
    flex: 1;
    text-align: center;
    min-width: 220px;
}
header h1 {
    font-size: 34px;
    font-weight: 800;
    background: linear-gradient(135deg, #ff5a9b, #b91c5c);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: 1px;
}
.subtitle {
    margin-top: 6px;
    color: var(--text-soft);
    font-size: 14px;
    letter-spacing: 0.5px;
}
.logout-btn {
    padding: 9px 20px;
    background: white;
    color: var(--rose-600);
    border: 1.5px solid var(--pink-200);
    border-radius: 999px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all .25s;
}
.logout-btn:hover {
    background: var(--pink-100);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(232, 62, 140, 0.18);
}

/* 面包屑 */
.breadcrumb {
    margin-bottom: 22px;
    padding: 12px 18px;
    background: linear-gradient(135deg, #fff5f9, #ffe9f2);
    border-radius: 14px;
    font-size: 14px;
    color: var(--text-soft);
    border: 1px solid rgba(255, 192, 213, 0.5);
}
.breadcrumb a {
    color: var(--rose-600);
    text-decoration: none;
    font-weight: 600;
    margin: 0 4px;
    transition: color .2s;
}
.breadcrumb a:hover { color: var(--rose-700); text-decoration: underline; }
.breadcrumb span { margin: 0 4px; color: #d99cb6; }

/* 工具栏 */
.toolbar {
    display: flex;
    gap: 14px;
    margin-bottom: 22px;
    flex-wrap: wrap;
    align-items: center;
}
.search-box {
    flex: 1;
    min-width: 240px;
    position: relative;
    display: flex;
    align-items: center;
}
.search-icon {
    position: absolute;
    left: 14px;
    width: 18px;
    height: 18px;
    color: var(--pink-400);
    pointer-events: none;
}
#search-input {
    width: 100%;
    padding: 13px 40px 13px 42px;
    border: 1.5px solid var(--pink-200);
    border-radius: 999px;
    font-size: 14px;
    background: white;
    color: var(--text-main);
    transition: all .25s;
}
#search-input:focus {
    outline: none;
    border-color: var(--pink-400);
    box-shadow: 0 0 0 4px rgba(255, 122, 174, 0.15);
}
.search-clear {
    position: absolute;
    right: 12px;
    background: var(--pink-200);
    color: white;
    border: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: none;
    line-height: 1;
}
.search-clear:hover { background: var(--pink-400); }

.view-toggle {
    display: flex;
    background: white;
    border: 1.5px solid var(--pink-200);
    border-radius: 999px;
    padding: 4px;
    gap: 2px;
}
.view-btn {
    border: none;
    background: transparent;
    color: var(--text-soft);
    padding: 8px 16px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 16px;
    transition: all .2s;
}
.view-btn.active {
    background: linear-gradient(135deg, var(--pink-400), var(--rose-600));
    color: white;
    box-shadow: 0 4px 12px rgba(232, 62, 140, 0.3);
}

/* 文件网格 */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 18px;
}
.file-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.file-list .file-item {
    flex-direction: row;
    align-items: center;
    padding: 12px 18px;
    text-align: left;
    gap: 16px;
}
.file-list .file-item .file-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}
.file-list .file-item .file-name {
    flex: 1;
    text-align: left;
    -webkit-line-clamp: 1;
}

.file-item {
    background: white;
    border: 1.5px solid rgba(255, 200, 220, 0.6);
    border-radius: 18px;
    padding: 18px 14px;
    cursor: pointer;
    transition: all .28s cubic-bezier(.2,.8,.2,1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.file-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 60%, rgba(255, 122, 174, 0.08));
    opacity: 0;
    transition: opacity .3s;
    pointer-events: none;
}
.file-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--pink-300);
}
.file-item:hover::before { opacity: 1; }
.file-item.folder-item {
    background: linear-gradient(135deg, #fff5f9, #ffe4ec);
}

.file-icon {
    width: 72px;
    height: 72px;
    border-radius: 14px;
    background: linear-gradient(135deg, #fff0f6, #ffe1eb);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}
.file-item-has-thumb .file-icon {
    width: 100%;
    height: 130px;
    border-radius: 14px;
    background: #fdf2f8;
}
.file-list .file-item-has-thumb .file-icon {
    width: 64px;
    height: 64px;
}
.file-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.file-icon-inner { display: inline-block; }

.file-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.4;
    word-break: break-all;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.file-size {
    font-size: 11px;
    color: var(--text-soft);
    background: var(--pink-50);
    padding: 2px 8px;
    border-radius: 999px;
}

.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-soft);
    font-size: 15px;
}

/* 搜索结果 */
.search-result-count {
    grid-column: 1 / -1;
    color: var(--text-soft);
    font-size: 13px;
    padding: 4px 8px 8px;
}
.search-result-path {
    font-size: 11px;
    color: #c084a0;
    margin-top: 4px;
    font-weight: 400;
}

/* Footer */
.footer {
    margin-top: 36px;
    padding-top: 20px;
    border-top: 2px dashed var(--pink-200);
    text-align: center;
    color: var(--text-soft);
    font-size: 13px;
}
.heart-beat {
    color: var(--rose-600);
    display: inline-block;
    animation: heartbeat 1.4s ease-in-out infinite;
}
@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    25%      { transform: scale(1.2); }
    50%      { transform: scale(0.95); }
    75%      { transform: scale(1.15); }
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(70, 20, 45, 0.78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn .25s ease-out;
}
.modal[style*="block"] { display: flex !important; }
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.modal-content {
    position: relative;
    background: white;
    border-radius: 22px;
    padding: 24px;
    max-width: 92vw;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
    animation: popIn .3s cubic-bezier(.2,.8,.3,1.2);
}
@keyframes popIn {
    from { transform: scale(0.9); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
.close {
    position: absolute;
    top: 12px;
    right: 18px;
    font-size: 30px;
    color: var(--text-soft);
    cursor: pointer;
    line-height: 1;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
    z-index: 5;
}
.close:hover {
    background: var(--pink-100);
    color: var(--rose-600);
    transform: rotate(90deg);
}

.preview-zoom-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--pink-50);
    border-radius: 999px;
    font-size: 13px;
    color: var(--text-soft);
}
.preview-zoom-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: white;
    color: var(--rose-600);
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    transition: all .2s;
}
.preview-zoom-btn:hover:not(:disabled) {
    background: var(--pink-300);
    color: white;
}
.preview-zoom-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.preview-zoom-reset {
    width: auto;
    padding: 0 12px;
    font-size: 12px;
}
.preview-zoom-value {
    min-width: 48px;
    text-align: center;
    font-weight: 600;
}

.preview-image-wrap {
    max-width: 84vw;
    max-height: 70vh;
    overflow: auto;
    border-radius: 14px;
    background: #fdf2f8;
    cursor: grab;
}
.preview-image-wrap.preview-panning { cursor: grabbing; }
#preview-image {
    display: block;
    max-width: 84vw;
    max-height: 70vh;
    user-select: none;
}

.preview-caption {
    font-size: 14px;
    color: var(--text-soft);
    text-align: center;
    word-break: break-all;
    max-width: 80vw;
}
.preview-download-btn {
    padding: 11px 28px;
    background: linear-gradient(135deg, var(--pink-400), var(--rose-600));
    color: white;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(232, 62, 140, 0.35);
    transition: all .25s;
}
.preview-download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(232, 62, 140, 0.5);
}

/* 视频（Worker 流式 <video>） */
.video-modal-content {
    padding: 16px;
    width: min(900px, 92vw);
}
#video-player {
    width: 100%;
    max-height: 72vh;
    border-radius: 12px;
    background: #000;
}

/* 音频（Worker 流式 <audio>） */
.audio-modal-content { padding: 28px 32px; min-width: 320px; }
.audio-cover {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--pink-300), var(--rose-600));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
    color: white;
    box-shadow: 0 10px 30px rgba(232, 62, 140, 0.35);
    animation: spin 8s linear infinite;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
#audio-player {
    width: 100%;
    max-width: 420px;
}

/* 视频缩略图上的播放按钮 */
.video-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
    background: rgba(0, 0, 0, 0.25);
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    transition: background .25s;
}
.file-item:hover .video-overlay {
    background: rgba(232, 62, 140, 0.35);
}

/* 登录遮罩 */
.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: linear-gradient(135deg, rgba(255, 192, 213, 0.95), rgba(232, 62, 140, 0.85));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    align-items: center;
    justify-content: center;
    padding: 20px;
    display: flex;
}
.login-box {
    background: white;
    border-radius: 24px;
    padding: 40px 36px;
    width: 100%;
    max-width: 380px;
    text-align: center;
    box-shadow: 0 30px 80px rgba(232, 62, 140, 0.4);
    animation: popIn .4s cubic-bezier(.2,.8,.3,1.2);
}
.login-heart {
    font-size: 56px;
    margin-bottom: 8px;
    animation: heartbeat 1.4s ease-in-out infinite;
}
.login-box h2 {
    font-size: 26px;
    background: linear-gradient(135deg, #ff5a9b, #b91c5c);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 6px;
}
.login-hint {
    color: var(--text-soft);
    font-size: 13px;
    margin-bottom: 22px;
}
.login-box input {
    width: 100%;
    padding: 13px 18px;
    border: 1.5px solid var(--pink-200);
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 12px;
    background: var(--pink-50);
    color: var(--text-main);
    transition: all .25s;
}
.login-box input:focus {
    outline: none;
    border-color: var(--pink-400);
    background: white;
    box-shadow: 0 0 0 4px rgba(255, 122, 174, 0.15);
}
.login-error {
    color: #e11d48;
    font-size: 12px;
    min-height: 16px;
    margin-bottom: 8px;
}
.login-btn {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, var(--pink-400), var(--rose-600));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 6px;
    box-shadow: 0 8px 22px rgba(232, 62, 140, 0.35);
    transition: all .25s;
}
.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(232, 62, 140, 0.5);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 13px 26px;
    border-radius: 999px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    animation: toastIn .35s cubic-bezier(.2,.8,.3,1.2);
}
@keyframes toastIn {
    from { transform: translate(-50%, 30px); opacity: 0; }
    to   { transform: translate(-50%, 0); opacity: 1; }
}
.toast-success { background: linear-gradient(135deg, #34d399, #059669); }
.toast-error   { background: linear-gradient(135deg, #fb7185, #e11d48); }
.toast-warning { background: linear-gradient(135deg, #fbbf24, #d97706); }
.toast-info    { background: linear-gradient(135deg, #ff7aae, #e83e8c); }

/* 移动端 */
@media (max-width: 640px) {
    body { padding: 12px 8px; }
    .container { padding: 22px 16px; border-radius: 22px; }
    header h1 { font-size: 26px; }
    .file-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
    .file-icon { width: 60px; height: 60px; font-size: 30px; }
    .file-item-has-thumb .file-icon { height: 110px; }
    .modal-content { padding: 16px; max-width: 96vw; }
    .audio-modal-content { padding: 24px 20px; }
}
