:root {
    --primary: #3b82f6;
    --primary-soft: rgba(59, 130, 246, 0.12);
    --bg: #f3f6fb;
    --card-bg: rgba(255, 255, 255, 0.86);
    --card-solid: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: rgba(148, 163, 184, 0.24);
    --shadow: 0 8px 30px rgba(15, 23, 42, 0.06);
    --radius: 16px;
}

html.dark {
    --primary: #60a5fa;
    --primary-soft: rgba(96, 165, 250, 0.15);
    --bg: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.84);
    --card-solid: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: rgba(148, 163, 184, 0.18);
    --shadow: 0 10px 34px rgba(0, 0, 0, 0.35);
}

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

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    background-image:
        radial-gradient(at 15% 10%, rgba(59, 130, 246, 0.10) 0, transparent 45%),
        radial-gradient(at 85% 20%, rgba(14, 165, 233, 0.09) 0, transparent 45%);
    color: var(--text);
    font-family: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.hidden {
    display: none !important;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--card-bg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    max-width: 1360px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.brand-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.05rem;
}

.brand-logo {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    display: inline-grid;
    place-items: center;
    background: linear-gradient(135deg, #3b82f6, #0ea5e9);
    color: #fff;
    font-size: 0.95rem;
}

.brand-badge {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.nav-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.nav-pill.ghost {
    color: var(--text);
    background: transparent;
    border-color: var(--border);
}

.nav-pill.ghost:hover {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: transparent;
}

.nav-pill.primary {
    background: linear-gradient(135deg, #3b82f6, #0ea5e9);
    color: #fff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.28);
}

.nav-pill.primary:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
}

.icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    display: inline-grid;
    place-items: center;
    font-size: 1rem;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.page-shell {
    max-width: 1360px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card-base {
    background: var(--card-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.hero-card {
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.hero-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.page-heading {
    display: flex;
    align-items: center;
    gap: 14px;
}

.page-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--primary-soft);
    display: grid;
    place-items: center;
    font-size: 1.45rem;
}

.page-heading h1 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
}

.page-heading p {
    margin: 2px 0 0;
    font-size: 0.87rem;
    color: var(--text-muted);
}

.hero-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.stat-chip {
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 600;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 0.88rem;
}

.crumb-btn {
    border: none;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    font-weight: 500;
}

.crumb-btn:hover {
    background: var(--primary-soft);
}

.crumb-current {
    color: var(--text);
    font-weight: 600;
    padding: 4px 6px;
}

.crumb-sep {
    color: var(--text-muted);
}

.controls-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.search-wrap {
    position: relative;
    flex: 1 1 280px;
}

.search-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
}

.search-wrap input {
    width: 100%;
    padding: 9px 14px 9px 36px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card-solid);
    color: var(--text);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-wrap input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.filter-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.segmented {
    display: inline-flex;
    padding: 3px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card-solid);
}

.seg-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 9px;
    font-size: 0.83rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s;
}

.seg-btn.active {
    background: var(--primary);
    color: #fff;
}

.sort-select {
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card-solid);
    color: var(--text);
    font-size: 0.84rem;
    outline: none;
}

.tag-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag-pill {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s;
}

.tag-pill:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.tag-pill.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.admin-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--primary-soft);
    border: 1px dashed rgba(59, 130, 246, 0.35);
}

.admin-toolbar-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.84rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}

.admin-toolbar-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card-solid);
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.18s;
}

.btn-sm:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-sm.primary {
    background: var(--primary);
    color: #fff;
    border-color: transparent;
}

.btn-sm.primary:hover {
    filter: brightness(1.08);
    color: #fff;
}

.btn-sm.warn {
    background: rgba(245, 158, 11, 0.14);
    color: #d97706;
    border-color: rgba(245, 158, 11, 0.35);
}

.btn-sm.danger {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 14px;
    padding: 0 4px;
}

.section-header h2 {
    margin: 0;
    font-size: 1.12rem;
    font-weight: 700;
}

.section-count {
    font-size: 0.83rem;
    color: var(--text-muted);
}

.albums-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.album-card {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: var(--card-solid);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.28s ease, box-shadow 0.28s ease;
}

.album-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.14);
}

.album-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.45s ease;
}

.album-card:hover img {
    transform: scale(1.06);
}

.album-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(14, 165, 233, 0.15));
    font-size: 2.5rem;
}

.album-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.82) 0%, rgba(15, 23, 42, 0.18) 52%, transparent 100%);
    pointer-events: none;
}

.album-badge-count {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
}

.album-admin-edit {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 8px;
    border-radius: 8px;
    border: none;
    background: rgba(15, 23, 42, 0.65);
    color: #fff;
    font-size: 11px;
    cursor: pointer;
    z-index: 3;
}

.album-admin-edit:hover {
    background: var(--primary);
}

.album-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 14px;
    color: #fff;
}

.album-info h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.album-info p {
    margin: 3px 0 0;
    font-size: 0.76rem;
    color: rgba(255, 255, 255, 0.8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.masonry-grid {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.masonry-col {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.photo-card {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    background: var(--card-solid);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    cursor: zoom-in;
    transition: transform 0.24s ease, box-shadow 0.24s ease;
}

.photo-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
}

.photo-media-wrap {
    position: relative;
    width: 100%;
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.15), rgba(59, 130, 246, 0.08));
    overflow: hidden;
}

.photo-card img {
    width: 100%;
    height: auto;
    display: block;
    opacity: 0;
    transition: opacity 0.38s ease, transform 0.42s ease;
}

.photo-card img.loaded {
    opacity: 1;
}

.photo-card:hover img.loaded {
    transform: scale(1.04);
}

.photo-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 12px;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.76) 0%, transparent 55%);
    opacity: 0;
    transition: opacity 0.22s ease;
    color: #fff;
}

.photo-card:hover .photo-overlay {
    opacity: 1;
}

.photo-title {
    font-size: 0.83rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.photo-sub {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.78);
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.empty-state {
    padding: 56px 24px;
    text-align: center;
}

.empty-emoji {
    font-size: 2.8rem;
    margin-bottom: 10px;
}

.empty-state h3 {
    margin: 0 0 6px;
}

.empty-state p {
    margin: 0 0 18px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.empty-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.status-banner {
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.28);
    color: #ef4444;
    font-size: 0.88rem;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.lb-close, .lb-nav {
    position: fixed;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(15, 23, 42, 0.65);
    color: #fff;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    z-index: 210;
    display: grid;
    place-items: center;
}

.lb-close { top: 18px; right: 18px; font-size: 1rem; }
.lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 16px; top: 50%; transform: translateY(-50%); }

.lb-content {
    width: min(1160px, 95vw);
    max-height: 90vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 310px;
    background: var(--card-solid);
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.lb-stage {
    position: relative;
    background: #090d16;
    display: grid;
    place-items: center;
    min-height: 360px;
    max-height: 90vh;
    overflow: auto;
}

.lb-stage img {
    max-width: 100%;
    max-height: 88vh;
    object-fit: contain;
    transition: transform 0.2s ease;
    cursor: zoom-in;
}

.lb-stage img.zoomed {
    max-width: none;
    max-height: none;
    cursor: zoom-out;
}

.lb-loading {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
}

.lb-meta {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
}

.lb-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.lb-title-row h3 {
    margin: 0;
    font-size: 1.02rem;
    word-break: break-word;
}

.lb-tag-chip {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
    white-space: nowrap;
}

.lb-sub {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: pre-line;
}

.lb-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.lb-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.lb-admin-actions hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 8px 0 12px;
}

.lb-admin-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.dialog-card {
    width: min(540px, 94vw);
    max-height: 88vh;
    overflow-y: auto;
    padding: 20px 22px;
    background: var(--card-solid);
}

.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.dialog-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 13px;
}

.form-field label {
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-field input, .form-field textarea, .form-field select {
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
}

.dropzone {
    border: 2px dashed var(--border);
    border-radius: 14px;
    padding: 26px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.upload-log {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
    font-size: 0.82rem;
}

.toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 9px 16px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.9);
    color: #fff;
    font-size: 0.85rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
}

@media (max-width: 860px) {
    .lb-content {
        grid-template-columns: 1fr;
    }
    .lb-stage {
        max-height: 55vh;
    }
}
