/* ==========================================================================
   Lumina · 拾光个人图库核心样式表
   Design Language: Obsidian & Paper Studio / Anti-slop / Functional Clarity
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 设计令牌 (CSS Custom Properties & Theme Variables)
   -------------------------------------------------------------------------- */
:root {
  /* 基础尺寸与间距 */
  --header-height: 60px;
  --sidebar-width: 250px;
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  /* 动效曲线 */
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s var(--ease-smooth);
  --transition-normal: 0.25s var(--ease-spring);
  --transition-slow: 0.4s var(--ease-spring);

  /* 默认：Obsidian 黑曜石暗色 */
  --bg-app: #0d0f12;
  --bg-sidebar: #13161c;
  --bg-surface: #181c23;
  --bg-surface-elevated: #20252f;
  --bg-hover: rgba(255, 255, 255, 0.06);
  --bg-active: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);

  --text-main: #f0f2f5;
  --text-muted: #8e94a0;
  --text-faint: #595e6a;

  --accent: #e5a95d;
  --accent-hover: #f3c68f;
  --accent-subtle: rgba(229, 169, 93, 0.15);
  --accent-text: #171004;

  --danger: #ef5350;
  --danger-bg: rgba(239, 83, 80, 0.12);
  --success: #3ecf8e;
  --success-bg: rgba(62, 207, 142, 0.12);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);

  --card-min-size: 260px;
}

/* 主题：Paper 暖白纸质 */
[data-theme="paper"] {
  --bg-app: #f7f6f2;
  --bg-sidebar: #f0eee9;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-hover: rgba(0, 0, 0, 0.04);
  --bg-active: rgba(0, 0, 0, 0.08);
  --border: rgba(0, 0, 0, 0.07);
  --border-strong: rgba(0, 0, 0, 0.15);

  --text-main: #1d2024;
  --text-muted: #6e727c;
  --text-faint: #a0a4ad;

  --accent: #2e6659;
  --accent-hover: #224d43;
  --accent-subtle: rgba(46, 102, 89, 0.12);
  --accent-text: #ffffff;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
}

/* 主题：OLED 极致纯黑 */
[data-theme="oled"] {
  --bg-app: #000000;
  --bg-sidebar: #080808;
  --bg-surface: #101010;
  --bg-surface-elevated: #161616;
  --bg-hover: rgba(255, 255, 255, 0.08);
  --bg-active: rgba(255, 255, 255, 0.14);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.22);

  --text-main: #ffffff;
  --text-muted: #888888;
  --text-faint: #444444;

  --accent: #ffffff;
  --accent-hover: #e0e0e0;
  --accent-subtle: rgba(255, 255, 255, 0.15);
  --accent-text: #000000;

  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.6);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.8);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.95);
}

/* 主题：Nordic Slate 北欧石板蓝灰 */
[data-theme="slate"] {
  --bg-app: #121820;
  --bg-sidebar: #18202b;
  --bg-surface: #1e2836;
  --bg-surface-elevated: #263345;
  --bg-hover: rgba(255, 255, 255, 0.06);
  --bg-active: rgba(255, 255, 255, 0.12);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);

  --text-main: #e8ecf2;
  --text-muted: #8da0b6;
  --text-faint: #56677a;

  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --accent-subtle: rgba(88, 166, 255, 0.16);
  --accent-text: #0b1c30;
}

/* --------------------------------------------------------------------------
   2. 全局基础重置与重绘
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 背景流动氛围光 (可选开关) */
.ambient-glow {
  position: fixed;
  inset: -20%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  filter: blur(120px);
  background: radial-gradient(circle at 20% 30%, rgba(229, 169, 93, 0.15) 0%, transparent 50%),
              radial-gradient(circle at 80% 20%, rgba(88, 166, 255, 0.12) 0%, transparent 50%),
              radial-gradient(circle at 50% 80%, rgba(62, 207, 142, 0.1) 0%, transparent 60%);
  transition: opacity 0.5s ease;
}
.ambient-glow.off {
  display: none;
}

/* 布局外壳 */
.app-layout {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

/* --------------------------------------------------------------------------
   3. 顶部主导航栏 (Topbar)
   -------------------------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 20px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  flex-shrink: 0;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}
.brand-mark {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-mark svg {
  width: 100%;
  height: 100%;
}
.brand-text {
  display: flex;
  flex-direction: column;
}
.brand-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.1;
}
.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* 顶部搜索框 */
.topbar-center {
  flex: 1;
  max-width: 460px;
  display: flex;
  justify-content: center;
}
.search-box {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0 12px 0 34px;
  height: 36px;
  transition: var(--transition-fast);
}
.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}
.search-icon {
  position: absolute;
  left: 10px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-box input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 13px;
}
.search-box input::placeholder {
  color: var(--text-faint);
}
.shortcut-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  color: var(--text-muted);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-left: 6px;
  user-select: none;
}
.search-clear-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
  margin-left: 4px;
}
.search-clear-btn:hover {
  color: var(--text-main);
}

/* 顶部右侧工具群组 */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 视图模式切换器 */
.view-mode-group {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.mode-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}
.mode-btn svg {
  width: 15px;
  height: 15px;
}
.mode-btn:hover {
  color: var(--text-main);
  background: var(--bg-hover);
}
.mode-btn.active {
  color: var(--accent);
  background: var(--bg-surface-elevated);
}

/* 缩放滑块 */
.density-slider-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  color: var(--text-faint);
}
.density-slider-wrap svg {
  width: 14px;
  height: 14px;
}
.density-slider-wrap input[type="range"] {
  width: 70px;
  height: 4px;
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-full);
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  cursor: pointer;
}
.density-slider-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: transform 0.1s ease;
}
.density-slider-wrap input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* 按钮通用 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}
.btn svg {
  width: 15px;
  height: 15px;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: transparent;
}
.btn-primary:hover {
  background: var(--accent-hover);
}
.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-main);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}
.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: transparent;
}
.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}
.btn-sm {
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
}
.full-width {
  width: 100%;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}
.icon-btn svg {
  width: 16px;
  height: 16px;
}
.icon-btn:hover {
  color: var(--text-main);
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.icon-btn-tiny {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
}
.icon-btn-tiny:hover {
  color: var(--text-main);
  border-color: var(--accent);
}

/* --------------------------------------------------------------------------
   4. 主体框架与侧边栏 (Main Body & Sidebar)
   -------------------------------------------------------------------------- */
.main-body {
  display: flex;
  flex: 1;
  height: calc(100% - var(--header-height));
  overflow: hidden;
}

/* 侧边栏 */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: margin-left var(--transition-normal);
}
.sidebar.collapsed {
  margin-left: calc(-1 * var(--sidebar-width));
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 自定义轻量滚动条 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* 侧边栏小节 */
.nav-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nav-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
}
.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  padding: 0 8px;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: var(--transition-fast);
}
.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.nav-item span:nth-child(2) {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}
.nav-item.active {
  background: var(--bg-surface);
  color: var(--text-main);
  font-weight: 500;
  box-shadow: inset 2px 0 0 var(--accent);
}

.badge {
  font-size: 11px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  padding: 1px 6px;
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-full);
}
.badge-accent {
  background: var(--accent-subtle);
  color: var(--accent);
}

/* 胶囊过滤器 (格式/比例) */
.pill-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 4px;
}
.pill-btn {
  padding: 3px 8px;
  font-size: 11px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}
.pill-btn:hover {
  color: var(--text-main);
  border-color: var(--border-strong);
}
.pill-btn.active {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  font-weight: 500;
}

/* 标签云 */
.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 0 4px;
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}
.tag-chip:hover {
  color: var(--text-main);
  background: var(--bg-hover);
}
.tag-chip.active {
  background: var(--accent-subtle);
  color: var(--accent);
  border-color: var(--accent);
}

/* 侧边栏底部存储卡片 */
.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
}
.storage-card {
  padding: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.storage-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}
.storage-title {
  color: var(--text-muted);
}
.storage-size {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text-main);
}
.storage-bar {
  width: 100%;
  height: 4px;
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.storage-bar-inner {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}
.storage-tip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-faint);
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.status-offline {
  background: var(--success);
}
.status-online {
  background: #3b82f6;
  box-shadow: 0 0 6px #3b82f6;
}

/* --------------------------------------------------------------------------
   5. 画廊主展示区 (Gallery Container & Grid Views)
   -------------------------------------------------------------------------- */
.gallery-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-app);
  position: relative;
  overflow: hidden;
}

/* 画廊副状态条 */
.gallery-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-app);
  flex-shrink: 0;
  gap: 16px;
}
.subbar-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.gallery-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-main);
}
.gallery-count {
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.filter-tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  background: var(--accent-subtle);
  border: 1px solid var(--accent);
  border-radius: var(--radius-full);
  font-size: 12px;
  color: var(--accent);
}
.filter-tag-badge button {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
}

.subbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 下拉菜单 */
.select-wrap select {
  height: 30px;
  padding: 0 24px 0 10px;
  font-size: 12px;
  color: var(--text-main);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e94a0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.select-wrap select:focus {
  border-color: var(--accent);
}

.gallery-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 60px;
}

/* --------------------------------------------------------------------------
   6. 图片流渲染（瀑布流 Masonry / 自适应行 Justified / 方格 Grid / 时间线 Timeline）
   -------------------------------------------------------------------------- */

/* 视图 A: 瀑布流 (Masonry) */
.gallery-grid.mode-masonry {
  column-width: var(--card-min-size);
  column-gap: 16px;
  width: 100%;
}
.gallery-grid.mode-masonry .gallery-card {
  break-inside: avoid;
  margin-bottom: 16px;
  display: block;
}

/* 视图 B: 自适应等高行 (Justified) */
.gallery-grid.mode-justified {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.gallery-grid.mode-justified .gallery-card {
  height: calc(var(--card-min-size) * 0.75);
  flex-grow: 1;
  width: auto;
}
.gallery-grid.mode-justified .gallery-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 视图 C: 方格网格 (Grid) */
.gallery-grid.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-min-size), 1fr));
  gap: 16px;
}
.gallery-grid.mode-grid .gallery-card {
  aspect-ratio: 1;
}
.gallery-grid.mode-grid .gallery-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 视图 D: 时间线模式 (Timeline) */
.gallery-grid.mode-timeline {
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.timeline-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.timeline-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-subtle);
}
.timeline-date {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}
.timeline-count {
  font-size: 12px;
  color: var(--text-faint);
}
.timeline-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-min-size), 1fr));
  gap: 14px;
}

/* --------------------------------------------------------------------------
   7. 照片卡片设计 (Photo Card & Micro-interactions)
   -------------------------------------------------------------------------- */
.gallery-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-fast);
  user-select: none;
}
.gallery-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}
.gallery-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 选中状态（多选模式） */
.gallery-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}
.gallery-card.selected::after {
  content: "✓";
  position: absolute;
  top: 10px;
  left: 10px;
  width: 24px;
  height: 24px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
  font-size: 13px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4;
}

.card-img-wrap {
  width: 100%;
  position: relative;
  overflow: hidden;
  background: var(--bg-surface-elevated);
}
.card-img-wrap img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  transition: transform 0.4s var(--ease-spring), filter 0.3s ease;
}
.gallery-card:hover .card-img-wrap img {
  transform: scale(1.025);
}

/* 卡片悬浮覆层 (Veil) */
.card-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.4) 0%, transparent 40%, rgba(0, 0, 0, 0.75) 100%);
  opacity: 0;
  transition: opacity var(--transition-fast);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px;
  pointer-events: none;
}
.gallery-card:hover .card-veil {
  opacity: 1;
}

.veil-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: auto;
}
.veil-bottom {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}
.card-title {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-meta {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.75);
  display: flex;
  gap: 8px;
}

/* 收藏图标按钮 */
.card-fav-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition-fast), color var(--transition-fast);
}
.card-fav-btn svg {
  width: 14px;
  height: 14px;
}
.card-fav-btn:hover {
  transform: scale(1.15);
}
.card-fav-btn.active {
  color: #ff4757;
  background: rgba(255, 255, 255, 0.95);
}

/* 卡片右上角徽章 (格式/长宽) */
.card-badge {
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  color: #ffffff;
  border-radius: var(--radius-xs);
}

/* --------------------------------------------------------------------------
   8. 批量操作浮动底栏 (Multi-select Dock)
   -------------------------------------------------------------------------- */
.batch-dock {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  animation: slideUp 0.25s var(--ease-spring);
}
@keyframes slideUp {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.batch-dock-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
}
.batch-info {
  font-size: 13px;
  color: var(--text-main);
  padding-left: 4px;
}
.batch-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   9. 空状态 (Empty State)
   -------------------------------------------------------------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  gap: 12px;
}
.empty-icon {
  width: 64px;
  height: 64px;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.empty-icon svg {
  width: 100%;
  height: 100%;
}
.empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
}
.empty-desc {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 360px;
}

/* --------------------------------------------------------------------------
   10. 专业看图器 (Lumina Lightbox / Stage)
   -------------------------------------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(5, 6, 8, 0.94);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.2s ease;
}
.lightbox[hidden] {
  display: none !important;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lb-header {
  height: 56px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(12, 14, 18, 0.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  z-index: 10;
}
.lb-header-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
  max-width: 40%;
  overflow: hidden;
}
.lb-index {
  font-size: 12px;
  color: #8e94a0;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.lb-filename {
  font-size: 14px;
  font-weight: 500;
  color: #f0f2f5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.lb-sep {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 4px;
}
.lb-zoom-level {
  font-size: 12px;
  color: #8e94a0;
  font-variant-numeric: tabular-nums;
  min-width: 44px;
  text-align: center;
}

.lb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: #c0c4cc;
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
}
.lb-btn svg {
  width: 18px;
  height: 18px;
}
.lb-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}
.lb-btn.active {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}
.lb-btn-close:hover {
  background: var(--danger);
  color: #ffffff;
}

/* 舞台区 */
.lb-stage {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  user-select: none;
  width: 100%;
  height: calc(100vh - 56px);
}
.lb-img-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  transform-origin: center center;
  will-change: transform;
}
.lb-img-wrap.grabbing {
  cursor: grabbing;
}
.lb-img-wrap img {
  max-width: 82vw;
  max-height: 80vh;
  object-fit: contain;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  pointer-events: none;
  background: var(--bg-surface);
}

/* 上下翻页按钮 */
.lb-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 80px;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 36px;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  z-index: 5;
}
.lb-prev {
  left: 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.lb-next {
  right: 0;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}
.lb-nav-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

/* 幻灯片进度条 */
.lb-progress-bar {
  position: absolute;
  top: 56px;
  left: 0;
  height: 2px;
  background: var(--accent);
  width: 0%;
  z-index: 12;
  transition: width 0.1s linear;
}

/* 右侧详情抽屉 */
.lb-drawer {
  position: absolute;
  top: 56px;
  right: 0;
  bottom: 0;
  width: 320px;
  background: rgba(18, 22, 28, 0.95);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  z-index: 20;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-normal);
}
.lb-drawer.open {
  transform: translateX(0);
}
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.drawer-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: #f0f2f5;
}
.drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.meta-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.meta-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8e94a0;
}
.meta-desc {
  font-size: 12px;
  color: #6a7180;
}

.meta-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.meta-label {
  color: #8e94a0;
}
.meta-val {
  color: #f0f2f5;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.badge-pill {
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  font-size: 10px;
  text-transform: uppercase;
}

/* 调色板色卡 */
.color-palette {
  display: flex;
  gap: 6px;
  height: 44px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.palette-color {
  flex: 1;
  height: 100%;
  cursor: pointer;
  position: relative;
  transition: flex-grow 0.2s ease;
}
.palette-color:hover {
  flex-grow: 1.8;
}

/* 标签列表 */
.meta-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.add-tag-box input {
  width: 100%;
  height: 30px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xs);
  padding: 0 10px;
  font-size: 12px;
  color: #ffffff;
  outline: none;
}
.add-tag-box input:focus {
  border-color: var(--accent);
}

.drawer-action-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   11. 模态对话框 (Modal Dialogs)
   -------------------------------------------------------------------------- */
.modal-dialog {
  border: none;
  background: transparent;
  padding: 0;
  margin: auto;
  max-width: 90vw;
}
.modal-dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
}
.modal-box {
  width: 520px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalIn 0.2s var(--ease-spring);
}
.modal-box-sm {
  width: 380px;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
}
.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
}
.modal-close-btn:hover {
  color: var(--text-main);
}
.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* 拖拽上传区 */
.drop-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 32px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  transition: var(--transition-fast);
}
.drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-subtle);
}
.drop-icon {
  width: 44px;
  height: 44px;
  color: var(--accent);
  margin-bottom: 4px;
}
.drop-icon svg {
  width: 100%;
  height: 100%;
}
.drop-main-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
}
.drop-sub-text {
  font-size: 12px;
  color: var(--text-muted);
}
.drop-buttons {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.import-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
}
.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.option-row select, .option-row input {
  flex: 1;
  height: 32px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0 10px;
  color: var(--text-main);
}

.upload-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.upload-progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

/* 设置项 */
.settings-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.settings-section h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}
.settings-row select {
  height: 30px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-main);
  padding: 0 8px;
}
.settings-tip {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}
.settings-btn-grid {
  display: flex;
  gap: 10px;
}

/* Switch 开关组件 */
.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  transition: 0.2s;
  border-radius: 20px;
}
.slider::before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-muted);
  transition: 0.2s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--accent);
  border-color: var(--accent);
}
input:checked + .slider::before {
  transform: translateX(18px);
  background-color: var(--accent-text);
}

/* --------------------------------------------------------------------------
   12. 拖拽指示与 Toast 提示
   -------------------------------------------------------------------------- */
.drag-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  display: none;
  place-items: center;
  pointer-events: none;
}
.drag-overlay.active {
  display: grid;
}
.drag-card {
  padding: 40px;
  border: 2px dashed var(--accent);
  border-radius: var(--radius-lg);
  background: rgba(20, 24, 32, 0.9);
  text-align: center;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.drag-card svg {
  width: 56px;
  height: 56px;
  color: var(--accent);
}

/* Toast 提示容器 */
.toast-hub {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 8px 16px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  border-radius: var(--radius-full);
  font-size: 13px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.2s var(--ease-spring);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   13. 响应式布局优化 (Responsive Design)
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .topbar {
    padding: 0 12px;
  }
  .sidebar {
    position: absolute;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    z-index: 50;
    box-shadow: var(--shadow-lg);
  }
  .topbar-center {
    max-width: 260px;
  }
  .density-slider-wrap {
    display: none;
  }
}

@media (max-width: 640px) {
  .brand-sub {
    display: none;
  }
  .topbar-center {
    flex: 1;
    max-width: none;
  }
  .view-mode-group button:nth-child(2),
  .view-mode-group button:nth-child(4) {
    display: none;
  }
  .gallery-subbar {
    padding: 10px 14px;
  }
  .gallery-scroll-area {
    padding: 12px 14px 60px;
  }
  .lb-drawer {
    width: 100%;
  }
}
