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

:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-hover: #f8fafc;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --accent: #4f6ef7;
    --accent-hover: #3b5bdb;
    --accent-glow: rgba(79, 110, 247, 0.18);
    --error: #e03131;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 4px 24px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    font-size: 16px;
}

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.bg-pattern {
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(ellipse 80% 60% at 50% -20%, rgba(79, 110, 247, 0.1), transparent),
        radial-gradient(ellipse 60% 50% at 80% 80%, rgba(139, 108, 255, 0.06), transparent),
        radial-gradient(ellipse 50% 40% at 10% 60%, rgba(56, 189, 248, 0.05), transparent);
    pointer-events: none;
}

.container {
    position: relative;
    z-index: 1;
    max-width: 860px;
    margin: 0 auto;
    padding: 48px 24px 32px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
}

.logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--accent), #6c5ce7);
    border-radius: 18px;
    color: #fff;
    margin-bottom: 20px;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 300;
}

/* Card */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    animation: fadeUp 0.5s ease both;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Password Card */
.password-card {
    padding: 48px 40px;
    text-align: center;
    max-width: 420px;
    margin: 0 auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.lock-icon {
    color: var(--accent);
    margin-bottom: 24px;
    opacity: 0.9;
}

.password-card h2 {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.hint {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 28px;
}

.alert {
    width: 100%;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-bottom: 20px;
}

.alert-error {
    background: #fff5f5;
    border: 1px solid #ffc9c9;
    color: var(--error);
}

.password-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-group input {
    width: 100%;
    padding: 14px 18px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    text-align: center;
    letter-spacing: 0.15em;
}

.input-group input::placeholder {
    color: var(--text-muted);
    letter-spacing: normal;
}

.input-group input:focus {
    background: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #6c5ce7);
    color: #fff;
    box-shadow: 0 2px 8px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--accent-hover), #5b4cdb);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--accent-glow);
}

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

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
    text-decoration: none;
}

.btn-icon:hover {
    color: var(--accent);
    background: var(--accent-glow);
}

/* Files Card */
.files-card {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
    flex-wrap: wrap;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.file-count,
.selected-count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.selected-count {
    color: var(--accent);
    font-weight: 500;
}

/* Checkbox */
.checkbox-all,
.file-row {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.checkbox-all input,
.file-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    flex-shrink: 0;
    position: relative;
    transition: all var(--transition);
    background: #fff;
}

.checkbox-all input:checked ~ .checkmark,
.file-checkbox:checked ~ .checkmark {
    background: var(--accent);
    border-color: var(--accent);
}

.checkbox-all input:checked ~ .checkmark::after,
.file-checkbox:checked ~ .checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-all span:last-child {
    font-size: 0.875rem;
    font-weight: 500;
}

/* File List */
.file-list {
    list-style: none;
    overflow-y: auto;
    max-height: 60vh;
}

.file-item {
    border-bottom: 1px solid var(--border);
}

.file-item:last-child {
    border-bottom: none;
}

.file-row {
    padding: 14px 20px;
    transition: background var(--transition);
    position: relative;
}

.file-row:hover {
    background: var(--surface-hover);
}

.file-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
    width: 32px;
    text-align: center;
}

.file-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.file-name {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-path {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.file-size,
.file-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-shrink: 0;
    min-width: 70px;
    text-align: right;
}

.file-date {
    min-width: 120px;
    display: none;
}

@media (min-width: 640px) {
    .file-date {
        display: block;
    }
}

/* Empty State */
.empty-state {
    padding: 64px 24px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state svg {
    margin-bottom: 16px;
    opacity: 0.4;
}

/* Footer */
.footer {
    text-align: center;
    padding-top: 32px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(244, 246, 251, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.loading-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 48px;
    text-align: center;
    box-shadow: var(--shadow);
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-box p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 32px 16px 24px;
    }

    .password-card {
        padding: 36px 24px;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-left,
    .toolbar-right {
        justify-content: space-between;
    }

    .file-size {
        display: none;
    }

    .file-row {
        padding: 12px 16px;
        gap: 10px;
    }
}
