:root {
    color-scheme: light;
    --bg: #f5f6fb;
    --surface: #ffffff;
    --surface-soft: #f9faff;
    --text: #141a2a;
    --muted: #687086;
    --line: #e5e8f2;
    --primary: #5446ee;
    --primary-dark: #3f32d6;
    --cyan: #28d2df;
    --danger: #d7355d;
    --shadow: 0 18px 45px rgba(45, 51, 92, .10);
    --shadow-soft: 0 9px 24px rgba(45, 51, 92, .08);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 15px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% 4%, rgba(84, 70, 238, .09), transparent 27rem),
        radial-gradient(circle at 92% 38%, rgba(40, 210, 223, .06), transparent 24rem),
        var(--bg);
    color: var(--text);
    font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

button, select, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.shell { width: min(1420px, calc(100% - 48px)); margin: 0 auto; }

.site-header {
    position: sticky;
    z-index: 30;
    top: 0;
    background: rgba(255, 255, 255, .88);
    border-bottom: 1px solid rgba(222, 226, 240, .85);
    backdrop-filter: blur(18px);
}

.header-inner { height: 78px; display: flex; align-items: center; gap: 20px; }
.brand { color: var(--primary); font-size: 30px; font-weight: 900; letter-spacing: -.06em; text-decoration: none; }
.brand-divider { width: 1px; height: 26px; background: #cfd4e3; }
.header-inner p { margin: 0; color: #394157; font-size: 17px; font-weight: 600; letter-spacing: .04em; }

.page-shell { padding: 24px 0 150px; }

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.02fr) minmax(430px, .98fr);
    align-items: center;
    gap: 46px;
    padding: 20px 30px;
    background: rgba(255, 255, 255, .9);
    border: 1px solid rgba(226, 229, 241, .92);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}

.hero-copy { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 0; }
.eyebrow, .section-kicker { margin: 0 0 10px; color: var(--primary); font-size: 12px; font-weight: 900; letter-spacing: .18em; }
h1 { margin: 0; font-size: clamp(40px, 3.5vw, 52px); line-height: 1.05; letter-spacing: -.05em; }
.hero-subtitle { margin: 16px 0 0; color: var(--muted); font-size: 18px; line-height: 1.6; }
.hero-visual { flex: 0 0 190px; width: 190px; height: 136px; overflow: hidden; }
.hero-visual img { width: 100%; height: 100%; display: block; object-fit: contain; }

.upload-zone {
    min-height: 155px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 11px;
    padding: 20px;
    color: var(--muted);
    background: linear-gradient(180deg, rgba(246, 247, 255, .92), rgba(251, 252, 255, .96));
    border: 2px dashed #a9afff;
    border-radius: 24px;
    transition: .2s ease;
    outline: none;
}
.upload-zone:hover, .upload-zone:focus-visible, .upload-zone.dragover { border-color: var(--primary); background: #f4f4ff; transform: translateY(-2px); }
.upload-zone strong { color: var(--text); font-size: 20px; }
.upload-zone > span { font-size: 14px; }
.upload-zone small { font-size: 14px; text-align: center; }
.upload-icon { color: var(--primary); font-size: 45px; }

.primary-button, .download-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 52px;
    padding: 0 25px;
    color: #fff;
    background: linear-gradient(135deg, #6659ff, #4434df);
    border: 0;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(84, 70, 238, .28);
    font-weight: 800;
    white-space: nowrap;
}
.primary-button:hover, .download-button:hover { background: linear-gradient(135deg, #594bf1, #392dc7); }

.upload-progress { margin-top: 20px; padding: 18px 20px; background: #f8f9ff; border: 1px solid #e0e3f1; border-radius: 16px; }
.upload-progress { grid-column: 1 / -1; }
.progress-head { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 12px; color: #353d54; }
.progress-head span { display: flex; align-items: center; gap: 8px; }
.progress-track { height: 9px; overflow: hidden; background: #e2e5f1; border-radius: 99px; }
.progress-track span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--primary), var(--cyan)); border-radius: inherit; transition: width .15s linear; }

.gallery-section { padding-top: 30px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 28px; margin-bottom: 22px; }
.section-head h2 { margin: 0; font-size: 34px; letter-spacing: -.04em; }
.filters { display: flex; gap: 12px; }
.filters label { position: relative; }
.filters label::after { content: ""; position: absolute; right: 17px; top: 50%; width: 8px; height: 8px; border-right: 2px solid #485068; border-bottom: 2px solid #485068; transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.filters select { min-width: 175px; height: 48px; padding: 0 45px 0 17px; color: var(--text); background: var(--surface); border: 1px solid #dce0ec; border-radius: 13px; appearance: none; outline: none; font-weight: 650; }
.filters select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(84, 70, 238, .10); }

.gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.image-card { position: relative; overflow: hidden; background: var(--surface); border: 2px solid transparent; border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); transition: .2s ease; }
.image-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.image-card.selected { border-color: var(--primary); box-shadow: 0 12px 28px rgba(84, 70, 238, .16); }
.image-preview { display: block; width: 100%; padding: 0; background: #eef0f7; border: 0; aspect-ratio: 4 / 3; overflow: hidden; }
.image-preview img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .3s ease; }
.image-card:hover .image-preview img { transform: scale(1.025); }
.select-control { position: absolute; z-index: 3; top: 12px; right: 12px; width: 38px; height: 38px; display: grid; place-items: center; padding: 0; color: transparent; background: rgba(255, 255, 255, .92); border: 3px solid rgba(85, 94, 118, .72); border-radius: 50%; box-shadow: 0 3px 12px rgba(0, 0, 0, .14); }
.select-control i { font-size: 24px; }
.selected .select-control { color: #fff; background: var(--primary); border-color: #fff; }
.card-body { padding: 15px 16px 16px; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-title-row h3 { min-width: 0; margin: 0; overflow: hidden; color: #1d2435; font-size: 16px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.single-download { flex: 0 0 auto; display: grid; place-items: center; width: 36px; height: 36px; color: var(--primary); background: #f0efff; border-radius: 10px; text-decoration: none; }
.single-download:hover { color: #fff; background: var(--primary); }
.metadata { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 9px; color: var(--muted); font-size: 13px; }
.metadata > span { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }

.empty-state, .loading-state { min-height: 330px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); text-align: center; }
.empty-icon { display: grid; place-items: center; width: 84px; height: 84px; margin-bottom: 15px; color: var(--primary); background: #ebeaff; border-radius: 26px; }
.empty-icon i { font-size: 42px; }
.empty-state h3 { margin: 0; color: var(--text); font-size: 24px; }
.empty-state p { margin: 10px 0 18px; }
.secondary-button { min-height: 44px; padding: 0 19px; color: var(--primary); background: #eeedff; border: 0; border-radius: 12px; font-weight: 800; }
.loading-state { flex-direction: row; gap: 10px; min-height: 220px; }

.selection-bar { position: fixed; z-index: 50; left: 0; right: 0; bottom: 18px; padding: 0 18px env(safe-area-inset-bottom); }
.selection-inner { min-height: 86px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 18px 14px 24px; background: rgba(255, 255, 255, .96); border: 1px solid #e1e4ee; border-radius: 22px; box-shadow: 0 16px 45px rgba(32, 37, 65, .20); backdrop-filter: blur(18px); }
.selection-count { display: flex; align-items: center; gap: 13px; font-size: 18px; font-weight: 750; }
.selection-count > i { color: var(--primary); font-size: 30px; }
.selection-count strong { color: var(--primary); font-size: 24px; }
.selection-actions { display: flex; align-items: center; gap: 14px; }
.text-button { min-height: 44px; padding: 0 14px; color: var(--primary); background: transparent; border: 0; font-weight: 750; }
.download-button { min-height: 54px; }

.toast-stack { position: fixed; z-index: 80; top: 92px; left: 50%; display: grid; gap: 10px; width: min(420px, calc(100% - 32px)); transform: translateX(-50%); pointer-events: none; }
.toast { padding: 14px 18px; color: #fff; background: #232a3b; border-radius: 13px; box-shadow: var(--shadow); font-weight: 650; text-align: center; animation: toast-in .25s ease; }
.toast.error { background: var(--danger); }

.spin { display: inline-block; animation: spin 1s linear infinite; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

@media (max-width: 1080px) {
    .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .hero { display: block; }
    .hero-copy { margin-bottom: 24px; }
}

@media (max-width: 760px) {
    .shell { width: min(100% - 28px, 620px); }
    .site-header { position: relative; padding-top: env(safe-area-inset-top); }
    .header-inner { height: 70px; gap: 14px; }
    .brand { font-size: 27px; }
    .brand-divider { height: 22px; }
    .header-inner p { font-size: 15px; }
    .page-shell { padding-top: 18px; padding-bottom: 145px; }
    .hero { padding: 23px 20px 20px; border-radius: 22px; }
    .hero-copy { align-items: flex-start; gap: 10px; margin-bottom: 20px; }
    .eyebrow { display: none; }
    h1 { font-size: clamp(34px, 10vw, 44px); }
    .hero-subtitle { margin-top: 12px; font-size: 16px; line-height: 1.55; }
    .hero-visual { flex-basis: 92px; width: 92px; height: 78px; }
    .upload-zone { min-height: 210px; padding: 22px 14px; border-radius: 18px; }
    .upload-zone strong, .upload-zone > span { display: none; }
    .upload-zone small { max-width: 285px; line-height: 1.55; }
    .upload-icon { font-size: 40px; }
    .primary-button { width: min(100%, 270px); }
    .gallery-section { padding-top: 30px; }
    .section-head { display: block; margin-bottom: 18px; }
    .section-kicker { display: none; }
    .section-head h2 { font-size: 29px; }
    .filters { margin-top: 16px; }
    .filters label { flex: 1; }
    .filters select { width: 100%; min-width: 0; height: 48px; font-size: 14px; }
    .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .image-card { border-radius: 16px; }
    .select-control { top: 8px; right: 8px; width: 34px; height: 34px; }
    .card-body { padding: 11px 11px 12px; }
    .card-title-row h3 { font-size: 14px; }
    .single-download { width: 32px; height: 32px; border-radius: 9px; }
    .metadata { display: grid; justify-content: stretch; gap: 4px; font-size: 12px; }
    .selection-bar { bottom: 0; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(245, 246, 251, .96) 28%); }
    .selection-inner { width: 100%; min-height: 78px; padding: 10px 10px 10px 14px; border-radius: 18px; }
    .selection-count { gap: 8px; font-size: 14px; }
    .selection-count > i { display: none; }
    .selection-count span { white-space: nowrap; }
    .selection-count span::after { content: ""; }
    .selection-count strong { font-size: 22px; }
    .selection-actions { gap: 4px; }
    .text-button { padding: 0 8px; font-size: 13px; }
    .download-button { min-height: 50px; padding: 0 15px; font-size: 14px; border-radius: 13px; }
}

@media (max-width: 420px) {
    .header-inner p { font-size: 14px; }
    .hero-visual { display: none; }
    .filters { gap: 8px; }
    .selection-count span { font-size: 0; }
    .selection-count span::before { content: "已选 "; font-size: 14px; }
    .selection-count span::after { content: " 张"; font-size: 14px; }
    .text-button { display: none; }
    .selection-actions { margin-left: auto; }
    .download-button { padding-inline: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

