/* ===== 前台展示样式 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #4f46e5;
  --primary-light: #ede9fe;
  --bg: #f8fafc;
  --card: #fff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --header-h: 60px;
  --sidebar-w: 220px;
  --rank-sidebar-w: 200px;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(0,0,0,.08);
  --shadow-hover: 0 8px 24px rgba(79,70,229,.18);
  /* 自定义颜色（通过JS设置） */
  --custom-tag-color: var(--primary);
  --custom-tag-bg: var(--primary-light);
  --custom-tag-border: solid;
  --custom-tag-radius: 999px;
  --custom-tag-size: 10px;
  --custom-title-color: #1e293b;
  --custom-desc-color: #64748b;
  --custom-rank-title-color: #f59e0b;
  --custom-cat-color: #64748b;
}

body { font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif; background: var(--bg); color: var(--text); }

/* 顶部导航左对齐时，header 贴边 + 左边距由 padding 控制 */
.gallery-header.header-align-mode {
  margin-left: 0;
  margin-right: 0;
  max-width: 100%;
}

/* ===== 顶部导航 ===== */
.gallery-header {
  position: sticky; top: 0; z-index: 100;
  background: #fff; border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
  height: var(--header-h);
  max-width: 1600px; margin: 0 auto; padding: 0 24px;
}
.header-inner {
  height: 100%; display: flex; align-items: center; gap: 24px;
}
.site-title { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.site-logo { font-size: 24px; }
.site-name { font-size: 18px; font-weight: 700; color: var(--primary); }
.header-nav { flex: 1; display: flex; gap: 4px; overflow-x: auto; }
.nav-item {
  padding: 6px 14px; border-radius: 999px; font-size: 14px;
  cursor: pointer; white-space: nowrap; transition: all .2s;
  color: var(--text-muted); border: none; background: none;
}
.nav-item:hover { color: var(--primary); background: var(--primary-light); }
.nav-item.active { color: var(--primary); background: var(--primary-light); font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.pv-badge { font-size: 12px; color: var(--text-muted); }

/* ===== 顶部导航按钮 ===== */
.btn-theme, .btn-slideshow, .btn-compare, .btn-fav-toggle, .btn-sidebar-toggle, .btn-history, .btn-color-picker {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--border);
  cursor: pointer; font-size: 15px; transition: all .2s;
  display: flex; align-items: center; justify-content: center;
}
.btn-theme:hover, .btn-slideshow:hover, .btn-compare:hover, .btn-fav-toggle:hover,
.btn-sidebar-toggle:hover, .btn-history:hover, .btn-color-picker:hover,
.btn-theme.active, .btn-slideshow.active, .btn-compare.active, .btn-fav-toggle.active,
.btn-sidebar-toggle.active, .btn-history.active, .btn-color-picker.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.btn-fav-toggle.active { background: #ec4899; border-color: #ec4899; }
.btn-sidebar-toggle.active, .btn-history.active { background: var(--primary); border-color: var(--primary); }
.btn-history.active { background: #0891b2; border-color: #0891b2; }

.btn-admin {
  padding: 6px 14px; background: var(--primary); color: #fff;
  border-radius: 999px; font-size: 13px; text-decoration: none; transition: all .2s;
}
.btn-admin:hover { background: #3730a3; }

/* ===== 颜色选择器 ===== */
.color-picker-panel {
  position: fixed; top: calc(var(--header-h) + 10px); right: 80px;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; z-index: 200;
  box-shadow: 0 10px 40px rgba(0,0,0,.15);
  display: flex; flex-direction: column; gap: 12px;
  animation: slideDown .2s ease-out;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.color-picker-header {
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 600; font-size: 14px;
}
.color-picker-header button {
  background: none; border: none; font-size: 16px; cursor: pointer; color: var(--text-muted);
}
.color-presets { display: flex; flex-wrap: wrap; gap: 8px; max-width: 200px; }
.color-preset {
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; transition: all .2s;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: bold;
}
.color-preset:hover { transform: scale(1.1); }
.color-preset.active { border-color: #333; box-shadow: 0 0 0 3px #fff, 0 0 0 5px currentColor; }
.color-custom { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.color-custom input[type="color"] { width: 40px; height: 30px; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }

/* ===== 主布局 ===== */
.main-container {
  max-width: 1600px; margin: 0 auto; padding: 24px;
  display: flex; gap: 24px; min-height: calc(100vh - var(--header-h) - 60px);
}

/* ===== 左侧栏（可折叠）===== */
.cat-sidebar { width: var(--sidebar-w); flex-shrink: 0; transition: width .3s ease; }
.cat-sidebar.collapsed { width: 48px; }
.cat-sidebar-inner {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  position: sticky; top: calc(var(--header-h) + 16px);
  max-height: calc(100vh - var(--header-h) - 32px);
  overflow-y: auto;
  display: flex; flex-direction: column;
  transition: all .3s ease;
}
.cat-sidebar.collapsed .cat-sidebar-inner { width: 48px; }
.cat-sidebar.collapsed .stats-panel,
.cat-sidebar.collapsed .cat-divider,
.cat-sidebar.collapsed .cat-title,
.cat-sidebar.collapsed .cat-tree,
.cat-sidebar.collapsed .tag-filter-section { display: none; }
.cat-sidebar.collapsed .cat-sidebar-inner::before {
  content: '📂'; font-size: 24px; padding: 16px; display: flex;
  justify-content: center; cursor: pointer;
}

/* ===== 统计面板 ===== */
.stats-panel { background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%); color: #fff; }
.stats-title {
  padding: 10px 14px 6px; font-weight: 700; font-size: 13px; opacity: .9;
  border-bottom: 1px solid rgba(255,255,255,.2);
}
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; padding: 8px; gap: 6px; }
.stat-item { text-align: center; padding: 8px 4px; background: rgba(255,255,255,.15); border-radius: 8px; }
.stat-value { font-size: 20px; font-weight: 800; }
.stat-label { font-size: 10px; opacity: .8; margin-top: 2px; }
.cat-divider { height: 1px; background: var(--border); }

/* ===== 分类树 ===== */
.cat-title {
  padding: 12px 16px; font-weight: 700; font-size: 15px;
  border-bottom: 1px solid var(--border); background: var(--bg);
}
.cat-tree { list-style: none; padding: 8px 0; }
.cat-tree-item { cursor: pointer; }
.cat-tree-label {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px; font-size: 14px; color: var(--custom-cat-color);
  transition: all .2s; border-left: 3px solid transparent;
}
.cat-tree-label:hover { color: var(--primary); background: var(--primary-light); }
.cat-tree-label.active { color: var(--primary); background: var(--primary-light); border-left-color: var(--primary); font-weight: 600; }
.cat-tree-label .toggle { font-size: 12px; transition: transform .2s; }
.cat-tree-label.open .toggle { transform: rotate(90deg); }
.cat-toggle.open { transform: rotate(90deg); }
.cat-count { margin-left: auto; font-size: 11px; background: #e2e8f0; padding: 1px 6px; border-radius: 999px; }
.cat-subtree { list-style: none; display: none; }
.cat-subtree.open { display: block; }
.cat-subtree .cat-tree-label { padding-left: 32px; }

/* ===== 标签筛选 ===== */
.tag-filter-section { border-top: 1px solid var(--border); }
.tag-filter-title {
  padding: 10px 16px 6px; font-weight: 700; font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 6px;
}
.tag-filter-toggle-btn { font-size: 11px; color: var(--primary); cursor: pointer; font-weight: 400; margin-left: auto; white-space: nowrap; }
.tag-filter-toggle-btn:hover { text-decoration: underline; }
.tag-filter-list { padding: 0 12px 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip {
  padding: 3px 10px; border-radius: var(--custom-tag-radius); font-size: var(--custom-tag-size);
  background: var(--bg); border: 1px var(--custom-tag-border) var(--border);
  cursor: pointer; transition: all .2s; color: var(--text-muted);
}
.tag-chip:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.tag-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.tag-chip-toggle { color: var(--primary); border-color: var(--primary); font-size: 11px; }

/* ===== 排行榜侧边栏（可折叠） ===== */
.rank-sidebar { width: var(--rank-sidebar-w); flex-shrink: 0; position: relative; transition: width .3s ease; }
.rank-sidebar.collapsed { width: 50px; }
.rank-sidebar-inner {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  position: sticky; top: calc(var(--header-h) + 16px);
  max-height: calc(100vh - var(--header-h) - 32px);
  overflow: visible;
}

/* 折叠状态 */
.rank-sidebar-collapsed {
  display: flex; flex-direction: column; gap: 4px; padding: 8px;
  cursor: pointer; align-items: center;
}
.rank-sidebar:not(.collapsed) .rank-sidebar-collapsed { display: none; }
.rank-collapsed-title {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-align: center; padding: 6px 0;
  writing-mode: vertical-rl; letter-spacing: 2px;
}
.rank-collapsed-content { display: flex; flex-direction: column; gap: 6px; }
.rank-mini-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px; border-radius: 6px; cursor: pointer;
  background: var(--bg); transition: all .2s;
}
.rank-mini-item:hover { background: var(--primary-light); transform: scale(1.05); }
.rank-mini-medal { font-size: 12px; width: 16px; text-align: center; flex-shrink: 0; }
.rank-mini-thumb {
  width: 28px; height: 28px; border-radius: 4px; overflow: hidden;
  background: var(--border); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.rank-mini-thumb img { width: 100%; height: 100%; object-fit: cover; }
.rank-mini-thumb span { font-size: 14px; }
.rank-mini-info { font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 32px; text-align: center; }

/* 展开状态 */
.rank-sidebar-expanded { 
  display: block; 
  width: 100%;
  max-height: calc(100vh - var(--header-h) - 32px);
  overflow-y: auto;
}
.rank-sidebar.collapsed .rank-sidebar-expanded { display: none !important; }
.rank-sidebar:not(.collapsed) { width: var(--rank-sidebar-w); }
.rank-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--bg);
}
.rank-title { font-weight: 700; font-size: 14px; color: var(--custom-rank-title-color); }
.rank-collapse-btn {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--border);
  cursor: pointer; font-size: 12px; transition: all .2s;
  display: flex; align-items: center; justify-content: center;
}
.rank-collapse-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.rank-list { list-style: none; padding: 6px 0; max-height: calc(100vh - var(--header-h) - 150px); overflow-y: auto; }
.rank-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; cursor: pointer; transition: all .2s;
  border-bottom: 1px solid var(--border);
}
.rank-item:hover { background: var(--primary-light); }
.rank-item:last-child { border-bottom: none; }
.rank-medal { font-size: 16px; flex-shrink: 0; width: 24px; text-align: center; }
.rank-num { font-size: 12px; color: var(--text-muted); font-weight: 600; width: 24px; text-align: center; display: inline-block; }
.rank-thumb {
  width: 36px; height: 36px; border-radius: 6px; overflow: hidden;
  background: var(--bg); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.rank-thumb img { width: 100%; height: 100%; object-fit: cover; }
.rank-thumb span { font-size: 18px; }
.rank-info { flex: 1; min-width: 0; }
.rank-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.rank-views { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.rank-rating { font-size: 11px; color: #f59e0b; margin-top: 2px; }
.rank-empty { padding: 16px; text-align: center; font-size: 13px; color: var(--text-muted); }

/* ===== 浏览历史侧边栏 ===== */
.history-sidebar { width: 240px; flex-shrink: 0; }
.history-sidebar-inner {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  position: sticky; top: calc(var(--header-h) + 16px);
  max-height: calc(100vh - var(--header-h) - 32px);
  display: flex; flex-direction: column;
}
.history-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--bg);
}
.history-title { font-weight: 700; font-size: 14px; }
.history-close-btn {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--border);
  cursor: pointer; font-size: 12px; transition: all .2s;
  display: flex; align-items: center; justify-content: center;
}
.history-close-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.history-list { flex: 1; overflow-y: auto; padding: 8px 0; }
.history-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; cursor: pointer; transition: all .2s;
}
.history-item:hover { background: var(--primary-light); }
.history-thumb {
  width: 40px; height: 40px; border-radius: 6px; overflow: hidden;
  background: var(--bg); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.history-thumb img { width: 100%; height: 100%; object-fit: cover; }
.history-thumb span { font-size: 20px; }
.history-info { flex: 1; min-width: 0; }
.history-title { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.history-clear { padding: 8px 14px; border-top: 1px solid var(--border); }
.history-clear button {
  width: 100%; padding: 6px; background: none; border: 1px solid var(--border);
  border-radius: 6px; cursor: pointer; font-size: 12px; color: var(--text-muted);
  transition: all .2s;
}
.history-clear button:hover { background: #fee2e2; border-color: #dc2626; color: #dc2626; }
.history-empty { padding: 20px; text-align: center; font-size: 13px; color: var(--text-muted); }

/* ===== 活跃标签栏 ===== */
.active-tags-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px; padding: 8px 12px; background: var(--primary-light);
  border-radius: var(--radius); font-size: 13px;
}
.active-tags-label { font-weight: 600; color: var(--primary); flex-shrink: 0; }
.active-tags { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.active-tag {
  padding: 3px 10px; background: var(--primary); color: #fff;
  border-radius: 999px; font-size: 12px; cursor: pointer;
}
.active-tag:hover { background: #3730a3; }
.clear-tags-btn {
  padding: 3px 10px; background: none; border: 1px solid var(--primary);
  color: var(--primary); border-radius: 999px; font-size: 12px; cursor: pointer;
  transition: all .2s; flex-shrink: 0;
}
.clear-tags-btn:hover { background: var(--primary); color: #fff; }

/* ===== 图片计数栏 ===== */
.gallery-count-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; font-size: 13px; color: var(--text-muted); flex-wrap: wrap; gap: 8px;
}
.compare-count {
  background: var(--primary-light); color: var(--primary);
  padding: 3px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
}

/* ===== 图片区 ===== */
.gallery-main { flex: 1; min-width: 0; }
.gallery-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px; flex-wrap: wrap; gap: 10px;
}
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text-muted); }
.breadcrumb-item { cursor: pointer; }
.breadcrumb-item:hover { color: var(--primary); }
.breadcrumb-sep { color: var(--border); }
.breadcrumb-item.current { color: var(--text); font-weight: 600; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }
.sort-btns { display: flex; gap: 4px; }
.search-box {
  padding: 7px 14px; border: 1px solid var(--border); border-radius: 999px;
  font-size: 14px; outline: none; width: 200px; transition: all .2s;
}
.search-box:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.sort-btn {
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px;
  background: #fff; font-size: 13px; cursor: pointer; transition: all .2s; color: var(--text-muted);
}
.sort-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-random {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--border);
  cursor: pointer; font-size: 16px; transition: all .2s;
  display: flex; align-items: center; justify-content: center;
}
.btn-random:hover { background: #8b5cf6; color: #fff; border-color: #8b5cf6; animation: spin 0.5s; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ===== 图片网格 ===== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--img-w, 220px), 1fr));
  gap: 16px;
}
.gallery-card {
  background: var(--card); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  cursor: pointer; transition: all .25s;
  border: 2px solid transparent;
  position: relative;
}
.gallery-card:hover {
  transform: translateY(-4px); box-shadow: var(--shadow-hover);
  border-color: var(--primary);
}

.card-thumb-wrap {
  overflow: hidden; position: relative;
  background: #f1f5f9; height: var(--img-h, 220px);
}
.card-thumb {
  width: 100%; height: 100%; object-fit: cover;
  display: block; transition: transform .3s;
}
.card-thumb.card-no-url {
  object-fit: contain;
  background: #f1f5f9;
}
.gallery-card:hover .card-thumb { transform: scale(1.05); }
.card-no-img {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 48px; color: #cbd5e1;
}
.card-views {
  position: absolute; bottom: 6px; right: 8px;
  background: rgba(0,0,0,.5); color: #fff; font-size: 11px;
  padding: 2px 7px; border-radius: 999px;
}
.card-link-badge {
  position: absolute; top: 6px; right: 8px;
  background: rgba(79,70,229,.85); color: #fff;
  font-size: 14px; padding: 3px 6px; border-radius: 6px;
}
.card-fav-badge {
  position: absolute; top: 6px; left: 8px;
  background: rgba(236,72,153,.85); color: #fff;
  font-size: 14px; padding: 3px 6px; border-radius: 6px;
}

/* ===== 卡片悬浮操作按钮 ===== */
.card-overlay-actions {
  position: absolute; bottom: 36px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; opacity: 0; transition: opacity .2s;
  background: rgba(0,0,0,.6); padding: 4px 8px; border-radius: 999px;
}
.gallery-card:hover .card-overlay-actions { opacity: 1; }
.card-action-btn {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255,255,255,.9); border: none;
  cursor: pointer; font-size: 13px; transition: all .15s;
  display: flex; align-items: center; justify-content: center;
}
.card-action-btn:hover { background: var(--primary); color: #fff; transform: scale(1.1); }

/* ===== 卡片标签 ===== */
.card-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.card-tag {
  padding: 1px 6px; background: var(--custom-tag-bg);
  color: var(--custom-tag-color); border-radius: var(--custom-tag-radius); font-size: var(--custom-tag-size);
  font-weight: 600; border: 1px var(--custom-tag-border) transparent;
}
.card-tag.card-tag-more { opacity: 0.7; font-size: calc(var(--custom-tag-size) - 1px); }
/* 卡片标签深色模式 - 使用自定义颜色 */
body.dark-mode .card-tag {
  background: rgba(99, 102, 241, 0.3);
  color: #c7d2fe;
  border: 1px solid rgba(165, 180, 252, 0.4);
}
.card-rating { font-size: 11px; color: #f59e0b; margin-top: 3px; }

.card-body { padding: 10px 12px; }
.card-title { font-weight: 600; font-size: 13px; color: var(--custom-title-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-desc { font-size: 12px; color: var(--custom-desc-color); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== 加载更多 / 空状态 ===== */
.load-more { text-align: center; padding: 24px; }
.btn-loadmore {
  padding: 10px 32px; border: 1px solid var(--primary); color: var(--primary);
  border-radius: 999px; background: #fff; cursor: pointer; font-size: 14px; transition: all .2s;
}
.btn-loadmore:hover { background: var(--primary); color: #fff; }
.empty-state { text-align: center; padding: 80px 20px; color: var(--text-muted); }
.empty-icon { font-size: 64px; margin-bottom: 16px; }
.empty-state p { font-size: 16px; }

/* ===== 底部 ===== */
.gallery-footer {
  text-align: center; padding: 16px 20px; color: var(--text-muted);
  font-size: 13px; border-top: 1px solid var(--border); background: #fff; margin-top: 20px;
}
.shortcut-hint { font-size: 11px; margin-top: 4px; opacity: .6; }
.shortcut-hint kbd {
  background: var(--bg); border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 5px; font-size: 10px; font-family: inherit;
}

/* ===== 灯箱 ===== */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.9);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; animation: fadeIn .2s;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

.lb-content {
  display: flex; gap: 0; max-width: 90vw; max-height: 90vh;
  background: #fff; border-radius: 12px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
  animation: lbIn .25s;
}
@keyframes lbIn { from { transform: scale(.9); opacity: 0 } to { transform: scale(1); opacity: 1 } }

#lb-img {
  max-width: 70vw; max-height: 90vh; display: block; object-fit: contain;
  background: #f8fafc; cursor: zoom-in;
}
.lb-info {
  width: 300px; padding: 20px; display: flex; flex-direction: column;
  gap: 10px; overflow-y: auto; flex-shrink: 0;
  max-height: 90vh;
}
.lb-info h3 { font-size: 18px; font-weight: 700; }
.lb-info p { color: var(--text-muted); font-size: 14px; line-height: 1.6; }
.lb-meta { display: flex; flex-direction: column; gap: 6px; }
.lb-meta span { font-size: 12px; color: var(--text-muted); }
.lb-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.lb-tags-list { display: flex; flex-wrap: wrap; gap: 4px; }
.lb-tag {
  padding: 2px 8px; background: var(--primary-light);
  color: var(--primary); border-radius: 999px; font-size: 12px;
}
.lb-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.lb-btn {
  padding: 8px 16px; border-radius: 999px; font-size: 13px;
  cursor: pointer; border: 1px solid var(--border); background: #fff;
  transition: all .2s; text-decoration: none; color: var(--text);
  display: inline-flex; align-items: center; gap: 4px;
}
.lb-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.lb-btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== 评分 ===== */
.lb-rating {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0; border-top: 1px solid var(--border);
}
.rating-label { font-size: 12px; color: var(--text-muted); }
.rating-stars { display: flex; gap: 2px; }
.star { font-size: 18px; cursor: pointer; color: #d1d5db; transition: all .15s; }
.star:hover { transform: scale(1.2); color: #f59e0b; }
.star.filled, .star.half { color: #f59e0b; }
.rating-count { font-size: 11px; color: var(--text-muted); }

.lb-close {
  position: fixed; top: 20px; right: 24px;
  background: rgba(255,255,255,.15); color: #fff; border: none;
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  font-size: 20px; transition: all .2s; z-index: 10;
}
.lb-close:hover { background: rgba(255,255,255,.3); }
.lb-prev, .lb-next {
  position: fixed; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,.15); color: #fff; border: none;
  width: 48px; height: 48px; border-radius: 50%; cursor: pointer;
  font-size: 28px; transition: all .2s; z-index: 10;
  display: flex; align-items: center; justify-content: center;
}
.lb-prev { left: 20px; }
.lb-next { right: 20px; }
.lb-prev:hover, .lb-next:hover { background: rgba(255,255,255,.3); }

/* ===== 灯箱工具栏 ===== */
.lb-tools {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--border);
}
.lb-tool-btn {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--border);
  cursor: pointer; font-size: 16px; transition: all .2s;
  display: flex; align-items: center; justify-content: center;
}
.lb-tool-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== 悬浮预览卡片 ===== */
.hover-preview {
  position: fixed; z-index: 500;
  background: #fff; border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,.2);
  overflow: hidden; max-width: 320px;
  display: flex; flex-direction: column;
  pointer-events: none;
  animation: hpIn .15s ease-out;
}
@keyframes hpIn { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: scale(1); } }
.hp-img { height: 160px; overflow: hidden; background: #f1f5f9; display: flex; align-items: center; justify-content: center; }
.hp-img img { width: 100%; height: 100%; object-fit: cover; }
.hp-info { padding: 12px; }
.hp-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.hp-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.hp-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 11px; color: var(--text-muted); }
.hp-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.hp-tag { padding: 1px 6px; background: var(--custom-tag-bg); color: var(--custom-tag-color); border-radius: var(--custom-tag-radius); font-size: var(--custom-tag-size); font-weight: 600; border: 1px var(--custom-tag-border) transparent; }
.hp-actions { display: flex; gap: 6px; margin-top: 8px; }
.hp-action-btn {
  flex: 1; padding: 4px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; cursor: pointer; font-size: 12px; transition: all .2s;
}
.hp-action-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== 分享弹窗 ===== */
.share-modal {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,.5); display: flex;
  align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.share-modal-inner {
  background: #fff; border-radius: var(--radius);
  max-width: 480px; width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,.3);
  animation: lbIn .2s;
}
.share-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.share-modal-header h3 { font-size: 16px; font-weight: 700; color: var(--primary); }
.share-modal-header button { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted); }
.share-preview {
  padding: 16px; display: flex; justify-content: center;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.share-preview img { max-width: 200px; max-height: 150px; object-fit: contain; border-radius: 8px; }
.share-no-img { padding: 40px; font-size: 48px; color: #cbd5e1; }
.share-links { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.share-link-item label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; display: block; }
.share-link-input { display: flex; gap: 8px; }
.share-link-input input {
  flex: 1; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 12px; outline: none;
}
.share-link-input input:focus { border-color: var(--primary); }
.share-link-input button {
  padding: 8px 16px; background: var(--primary); color: #fff;
  border: none; border-radius: 6px; cursor: pointer; font-size: 12px;
  transition: all .2s;
}
.share-link-input button:hover { background: #3730a3; }

/* ===== 对比模式 ===== */
.compare-overlay {
  position: fixed; inset: 0; z-index: 1500;
  background: var(--bg); display: flex; flex-direction: column;
  overflow-y: auto;
}
.compare-header {
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 16px 24px; display: flex; align-items: center;
  gap: 20px; flex-wrap: wrap;
  position: sticky; top: 0; z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.compare-header h2 { font-size: 18px; font-weight: 700; color: var(--primary); }
.compare-slots { display: flex; align-items: center; gap: 12px; flex: 1; }
.compare-slot {
  flex: 1; max-width: 200px; height: 60px; border: 2px dashed var(--border);
  border-radius: var(--radius); cursor: pointer; transition: all .2s;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); font-size: 12px; color: var(--text-muted);
  overflow: hidden; position: relative;
}
.compare-slot:hover { border-color: var(--primary); background: var(--primary-light); }
.compare-slot.has-img { border-style: solid; }
.compare-slot img { width: 100%; height: 100%; object-fit: cover; }
.compare-slot .slot-hint { text-align: center; padding: 0 8px; }
.compare-vs { font-size: 16px; font-weight: 800; color: var(--primary); }
.btn-close-compare {
  padding: 6px 16px; background: var(--primary); color: #fff;
  border: none; border-radius: 999px; cursor: pointer; font-size: 13px;
  transition: all .2s;
}
.btn-close-compare:hover { background: #3730a3; }

.compare-body {
  flex: 1; padding: 24px;
  display: flex; gap: 24px; align-items: flex-start;
  max-width: 1200px; margin: 0 auto; width: 100%;
}
.compare-img-wrap { flex: 1; }
.compare-img {
  width: 100%; max-height: 60vh; object-fit: contain;
  border-radius: var(--radius); background: var(--bg);
  box-shadow: var(--shadow);
}
.compare-img-title { text-align: center; font-weight: 600; margin-top: 8px; font-size: 14px; }
.compare-rating { text-align: center; font-size: 13px; color: #f59e0b; margin-top: 4px; }
.compare-empty {
  text-align: center; padding: 80px 20px; color: var(--text-muted);
  font-size: 16px; width: 100%;
}

.compare-info {
  max-width: 1200px; margin: 0 auto; width: 100%;
  display: flex; gap: 24px; padding: 0 24px 24px;
}
.compare-info-item {
  flex: 1; background: #fff; border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
  border: 1px solid var(--border);
}
.ci-item { display: flex; gap: 12px; font-size: 13px; }
.ci-label { font-weight: 600; color: var(--text-muted); min-width: 50px; }

/* ===== 图片选择器 ===== */
.compare-picker {
  position: fixed; inset: 0; z-index: 1600;
  background: rgba(0,0,0,.6); display: flex;
  align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.compare-picker-header {
  background: #fff; padding: 16px 20px; display: flex;
  align-items: center; justify-content: space-between;
  border-radius: var(--radius) var(--radius) 0 0;
  font-weight: 600; font-size: 14px; border-bottom: 1px solid var(--border);
}
.compare-picker-header button {
  background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted);
}
.compare-picker-header button:hover { color: var(--text); }
.compare-picker-grid {
  background: #fff; width: 80vw; max-width: 900px; max-height: 70vh;
  overflow-y: auto; padding: 16px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px; border-radius: 0 0 var(--radius) var(--radius);
}
.picker-item {
  border-radius: 8px; overflow: hidden; cursor: pointer;
  border: 2px solid transparent; transition: all .2s;
  position: relative; background: var(--bg);
}
.picker-item:hover { border-color: var(--primary); transform: scale(1.02); }
.picker-item.selected { border-color: var(--primary); }
.picker-item img { width: 100%; height: 100px; object-fit: cover; display: block; }
.picker-no-img { width: 100%; height: 100px; display: flex; align-items: center; justify-content: center; font-size: 32px; color: #cbd5e1; }
.picker-title { padding: 6px 8px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-checked {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}

/* ===== 快捷键帮助 ===== */
.shortcut-help {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(0,0,0,.5); display: flex;
  align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.shortcut-help-inner {
  background: #fff; border-radius: 16px; padding: 0;
  max-width: 480px; width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,.3);
  animation: lbIn .2s;
}
.shortcut-help-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.shortcut-help-header h3 { font-size: 18px; font-weight: 700; color: var(--primary); }
.shortcut-help-header button {
  background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted);
}
.shortcut-grid { padding: 20px 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.shortcut-item { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.shortcut-item kbd {
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  padding: 3px 8px; font-size: 12px; font-family: inherit; min-width: 28px;
  text-align: center; box-shadow: 0 1px 2px rgba(0,0,0,.1);
}
.shortcut-item span { color: var(--text-muted); }

/* ===== 轮播条 ===== */
.slide-bar {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.75); color: #fff; padding: 10px 20px;
  border-radius: 999px; display: flex; align-items: center; gap: 12px;
  z-index: 500; font-size: 14px;
}
.slide-bar button { background: rgba(255,255,255,.2); border: none; color: #fff; padding: 4px 12px; border-radius: 999px; cursor: pointer; }

/* ===== 幻灯片全屏 ===== */
.slideshow-overlay {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  animation: fadeIn .3s;
}
.slideshow-bg { position: absolute; inset: 0; background: #000; }
.ss-close {
  position: fixed; top: 20px; right: 24px;
  background: rgba(255,255,255,.15); color: #fff; border: none;
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
  font-size: 20px; z-index: 10; transition: all .2s;
}
.ss-close:hover { background: rgba(255,255,255,.3); }
.ss-prev, .ss-next {
  position: fixed; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,.15); color: #fff; border: none;
  width: 56px; height: 56px; border-radius: 50%; cursor: pointer;
  font-size: 32px; z-index: 10; transition: all .2s;
  display: flex; align-items: center; justify-content: center;
}
.ss-prev { left: 24px; }
.ss-next { right: 24px; }
.ss-prev:hover, .ss-next:hover { background: rgba(255,255,255,.3); }
.ss-img {
  position: relative; z-index: 5; max-width: 90vw; max-height: 75vh;
  object-fit: contain; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.ss-info {
  position: relative; z-index: 5; margin-top: 16px;
  display: flex; align-items: center; gap: 20px;
  color: #fff;
}
#ss-title { font-size: 16px; font-weight: 600; }
#ss-counter { font-size: 14px; opacity: .7; }
.ss-controls {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 10; display: flex; align-items: center; gap: 12px;
  background: rgba(0,0,0,.5); padding: 8px 16px; border-radius: 999px;
}
#ss-pause-btn {
  background: rgba(255,255,255,.2); border: none; color: #fff;
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 14px;
}
#ss-progress {
  width: 200px; height: 4px; -webkit-appearance: none; appearance: none;
  background: rgba(255,255,255,.3); border-radius: 999px; cursor: pointer; outline: none;
}
#ss-progress::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px;
  border-radius: 50%; background: #fff; cursor: pointer;
}

/* ===== 瀑布流 ===== */
.masonry-grid { display: block; column-count: 5; column-gap: 16px; }
.masonry-grid .gallery-card { break-inside: avoid; margin-bottom: 16px; display: block; }
@media (max-width: 1400px) { .masonry-grid { column-count: 4; } }
@media (max-width: 1100px) { .masonry-grid { column-count: 3; } }
@media (max-width: 800px) { .masonry-grid { column-count: 2; } }
@media (max-width: 500px) { .masonry-grid { column-count: 1; } }
.masonry-grid .card-thumb-wrap { height: auto; }

/* ===== 加载动画 ===== */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInScale { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.anim-fadein { animation: fadeIn 0.4s ease-out both; }
.anim-slideup { animation: fadeInUp 0.4s ease-out both; }
.anim-scale { animation: fadeInScale 0.4s ease-out both; }

/* ===== 水印 ===== */
.img-watermark {
  position: absolute; z-index: 2; pointer-events: none;
  font-weight: 600; font-family: sans-serif; text-shadow: 0 1px 3px rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
}
.wm-bottom-right { bottom: 0; right: 0; }
.wm-bottom-left { bottom: 0; left: 0; }
.wm-top-right { top: 0; right: 0; }
.wm-top-left { top: 0; left: 0; }
.wm-center { top: 50%; left: 50%; transform: translate(-50%, -50%); }

/* ===== 响应式 ===== */
@media (max-width: 1200px) {
  .history-sidebar { display: none; }
}
@media (max-width: 900px) {
  .cat-sidebar { display: none; }
  .rank-sidebar { display: none !important; }
  .main-container { padding: 16px; }
  .header-nav { display: none; }
  .lb-content { flex-direction: column; max-height: 95vh; }
  #lb-img { max-width: 100%; max-height: 60vh; }
  .lb-info { width: auto; }
  .compare-grid { grid-template-columns: 1fr; }
  .shortcut-grid { grid-template-columns: 1fr; }
  .color-picker-panel { right: 10px; }
}
@media (max-width: 600px) {
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .search-box { width: 140px; }
  .compare-slots { flex-direction: column; }
  .compare-slot { max-width: 100%; width: 100%; }
}

/* ===== 深色模式 ===== */
body.dark-mode {
  --bg: #0f172a;
  --card: #1e293b;
  --border: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --primary-light: #312e81;
}
body.dark-mode .gallery-header { background: #1e293b; border-color: var(--border); }
body.dark-mode .btn-admin { background: var(--primary); }
body.dark-mode .btn-admin:hover { background: #6366f1; }
body.dark-mode .search-box { background: var(--card); border-color: var(--border); color: var(--text); }
body.dark-mode .search-box:focus { border-color: var(--primary); }
body.dark-mode .sort-btn { background: var(--card); color: var(--text-muted); border-color: var(--border); }
body.dark-mode .sort-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
body.dark-mode .gallery-footer { background: var(--card); color: var(--text-muted); border-color: var(--border); }
body.dark-mode .cat-sidebar-inner { background: var(--card); border-color: var(--border); }
body.dark-mode .cat-title { background: #1e293b; color: var(--text); border-color: var(--border); }
body.dark-mode .cat-count { background: #334155; color: #94a3b8; }
body.dark-mode .gallery-card { background: var(--card); }
body.dark-mode .lightbox { background: rgba(0,0,0,.95); }
body.dark-mode .lb-content { background: #1e293b; }
body.dark-mode .lb-info h3 { color: #f1f5f9; }
body.dark-mode .lb-info p { color: #94a3b8; }
body.dark-mode .lb-btn { background: #334155; color: #f1f5f9; border-color: #475569; }
body.dark-mode .lb-btn:hover { background: var(--primary); border-color: var(--primary); }
body.dark-mode .lb-btn.primary { background: var(--primary); border-color: var(--primary); }
body.dark-mode .rank-sidebar-inner { background: var(--card); border-color: var(--border); }
body.dark-mode .rank-title { background: #1e293b; color: var(--text); border-color: var(--border); }
body.dark-mode .rank-item { border-color: var(--border); }
body.dark-mode .rank-name { color: var(--text); }
body.dark-mode .rank-views { color: var(--text-muted); }
body.dark-mode .rank-empty { color: var(--text-muted); }
body.dark-mode .rank-mini-item { background: #1e293b; }
body.dark-mode .rank-mini-item:hover { background: var(--primary-light); }
body.dark-mode .empty-state { color: var(--text-muted); }
body.dark-mode .tag-chip { background: var(--card); border-color: var(--border); color: var(--text-muted); }
body.dark-mode .tag-chip:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
body.dark-mode .stats-panel { background: linear-gradient(135deg, #312e81 0%, #4c1d95 100%); }
body.dark-mode .compare-header { background: #1e293b; border-color: var(--border); }
body.dark-mode .compare-header h2 { color: var(--primary); }
body.dark-mode .compare-slot { background: var(--card); border-color: var(--border); color: var(--text-muted); }
body.dark-mode .compare-slot:hover { background: var(--primary-light); border-color: var(--primary); }
body.dark-mode .compare-body { background: var(--bg); }
body.dark-mode .compare-img-wrap { background: var(--card); border-radius: var(--radius); padding: 12px; }
body.dark-mode .compare-img-title { color: var(--text); }
body.dark-mode .compare-info-item { background: var(--card); border-color: var(--border); }
body.dark-mode .compare-info-item .ci-label { color: var(--text-muted); }
body.dark-mode .compare-picker { background: rgba(0,0,0,.7); }
body.dark-mode .compare-picker-header { background: #1e293b; color: var(--text); border-color: var(--border); }
body.dark-mode .compare-picker-grid { background: #1e293b; }
body.dark-mode .picker-item { background: var(--card); }
body.dark-mode .picker-title { color: var(--text); }
body.dark-mode .shortcut-help { background: rgba(0,0,0,.7); }
body.dark-mode .shortcut-help-inner { background: #1e293b; }
body.dark-mode .shortcut-help-header { border-color: var(--border); }
body.dark-mode .shortcut-help-header h3 { color: var(--primary); }
body.dark-mode .shortcut-help-header button { color: var(--text-muted); }
body.dark-mode .shortcut-item span { color: var(--text-muted); }
body.dark-mode .shortcut-item kbd { background: var(--card); border-color: var(--border); color: var(--text); }
body.dark-mode .lb-tool-btn { background: var(--card); border-color: var(--border); }
body.dark-mode .lb-tools { border-color: var(--border); }
body.dark-mode .lb-tags { }
body.dark-mode .lb-tag { background: var(--primary-light); color: #a5b4fc; }
body.dark-mode .lb-rating { border-color: var(--border); }
body.dark-mode .rating-label { color: var(--text-muted); }
body.dark-mode .card-action-btn { background: rgba(255,255,255,.9); }
body.dark-mode .card-overlay-actions { background: rgba(0,0,0,.7); }
body.dark-mode .hover-preview { background: var(--card); }
body.dark-mode .hp-title { color: var(--text); }
body.dark-mode .hp-tag { background: var(--primary-light); color: #a5b4fc; }
body.dark-mode .hp-action-btn { background: var(--card); border-color: var(--border); }
body.dark-mode .active-tags-bar { background: var(--primary-light); }
body.dark-mode .gallery-count-bar { color: var(--text-muted); }
body.dark-mode .compare-count { background: var(--primary-light); color: #a5b4fc; }
body.dark-mode .btn-close-compare { background: var(--primary); }
body.dark-mode .history-sidebar-inner { background: var(--card); border-color: var(--border); }
body.dark-mode .history-header { background: #1e293b; border-color: var(--border); }
body.dark-mode .history-item:hover { background: var(--primary-light); }
body.dark-mode .history-thumb { background: var(--border); }
body.dark-mode .history-clear { border-color: var(--border); }
body.dark-mode .color-picker-panel { background: var(--card); }
body.dark-mode .share-modal-inner { background: var(--card); }
body.dark-mode .share-modal-header { border-color: var(--border); }
body.dark-mode .share-preview { background: var(--bg); border-color: var(--border); }
body.dark-mode .share-link-item label { color: var(--text-muted); }
body.dark-mode .share-link-input input { background: var(--card); border-color: var(--border); color: var(--text); }

/* ===== 新增功能样式 ===== */

/* 顶部导航按钮增强 */
.btn-calendar, .btn-stats, .btn-focus, .btn-batch, .btn-favorites {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--border);
  cursor: pointer; font-size: 15px; transition: all .2s;
  display: flex; align-items: center; justify-content: center;
}
.btn-calendar:hover, .btn-stats:hover, .btn-focus:hover, .btn-batch:hover, .btn-favorites:hover,
.btn-calendar.active, .btn-stats.active, .btn-focus.active, .btn-batch.active, .btn-favorites.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.btn-batch.active { background: #f59e0b; border-color: #f59e0b; }
.btn-calendar.active { background: #0891b2; border-color: #0891b2; }
.btn-focus.active { background: #7c3aed; border-color: #7c3aed; }
.btn-favorites.active { background: #ec4899; border-color: #ec4899; }

/* 批量选择工具栏 */
.batch-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border-radius: var(--radius); margin-bottom: 12px; flex-wrap: wrap;
  animation: slideDown .2s ease-out;
}
.batch-toolbar .batch-action-btn {
  padding: 6px 14px; background: rgba(255,255,255,.2); color: #fff;
  border: none; border-radius: 6px; cursor: pointer; font-size: 13px;
  transition: all .2s; display: flex; align-items: center; gap: 4px;
}
.batch-toolbar .batch-action-btn:hover { background: rgba(255,255,255,.3); }
.batch-toolbar .batch-action-btn.btn-exit { background: rgba(0,0,0,.2); }
.batch-toolbar .batch-divider { width: 1px; height: 24px; background: rgba(255,255,255,.3); }
.batch-count {
  background: rgba(255,255,255,.2); color: #fff;
  padding: 3px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
}

/* 批量选择状态 */
.gallery-card.batch-selected { border-color: #f59e0b !important; box-shadow: 0 0 0 3px rgba(245,158,11,.3) !important; }
.batch-checkbox {
  position: absolute; top: 8px; right: 8px; z-index: 5;
  font-size: 18px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5));
}

/* 日历视图面板 */
.calendar-panel {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: #fff; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
  z-index: 2000; width: 90vw; max-width: 700px; max-height: 85vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.calendar-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border); background: var(--bg);
}
.calendar-panel-header h3 { font-size: 16px; font-weight: 700; color: var(--primary); }
.calendar-panel-header button {
  background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted);
}
.calendar-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: var(--bg); border-bottom: 1px solid var(--border);
}
.calendar-nav button {
  padding: 6px 12px; background: var(--primary); color: #fff;
  border: none; border-radius: 6px; cursor: pointer; font-size: 14px;
}
.calendar-nav button:hover { background: #3730a3; }
.calendar-nav span { font-size: 16px; font-weight: 600; }
.calendar-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
  padding: 12px; background: var(--bg);
}
.calendar-weekday {
  text-align: center; font-size: 12px; font-weight: 600;
  color: var(--text-muted); padding: 6px 0;
}
.calendar-day {
  aspect-ratio: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  border-radius: 8px; cursor: pointer; transition: all .2s;
  font-size: 13px; position: relative; min-height: 44px;
}
.calendar-day.empty { background: transparent; cursor: default; }
.calendar-day:not(.empty):hover { background: var(--primary-light); }
.calendar-day.today { background: var(--primary-light); color: var(--primary); font-weight: 700; }
.calendar-day.selected { background: var(--primary); color: #fff; }
.calendar-day.has-images::after {
  content: ''; position: absolute; bottom: 4px;
  width: 6px; height: 6px; background: var(--primary);
  border-radius: 50%;
}
.calendar-day.selected.has-images::after { background: #fff; }
.day-num { font-size: 14px; }
.day-count { font-size: 10px; color: var(--text-muted); }
.calendar-day.selected .day-count { color: rgba(255,255,255,.8); }
.calendar-images {
  flex: 1; overflow-y: auto; padding: 12px;
}
.calendar-images-header {
  font-size: 14px; font-weight: 600; margin-bottom: 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.calendar-images-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
}
.calendar-img-item {
  border-radius: 8px; overflow: hidden; cursor: pointer;
  border: 2px solid transparent; transition: all .2s;
}
.calendar-img-item:hover { border-color: var(--primary); transform: scale(1.03); }
.calendar-img-item img { width: 100%; height: 80px; object-fit: cover; display: block; }
.calendar-img-title { padding: 4px 6px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calendar-no-images { text-align: center; padding: 20px; color: var(--text-muted); font-size: 13px; }

/* 详细统计面板 */
.stats-panel-full {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: #fff; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
  z-index: 2000; width: 90vw; max-width: 600px; max-height: 85vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.stats-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border); background: var(--bg);
}
.stats-panel-header h3 { font-size: 16px; font-weight: 700; color: var(--primary); }
.stats-panel-header button {
  background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted);
}
.stats-content { flex: 1; overflow-y: auto; padding: 16px 20px; }
.stats-section { margin-bottom: 20px; }
.stats-section h4 { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.stats-grid-full { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-card {
  background: var(--bg); border-radius: 8px; padding: 12px;
  text-align: center; border: 1px solid var(--border);
}
.stat-card-value { font-size: 22px; font-weight: 800; color: var(--primary); }
.stat-card-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.stats-list { display: flex; flex-direction: column; gap: 6px; }
.stats-list-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; background: var(--bg); border-radius: 6px;
  font-size: 13px;
}
.stats-rank { font-weight: 700; color: var(--primary); min-width: 20px; }
.stats-name { flex: 1; }
.stats-count { color: var(--text-muted); font-size: 12px; }
.stats-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.stats-tag {
  padding: 4px 10px; background: var(--primary-light); color: var(--primary);
  border-radius: 999px; font-size: 12px; cursor: pointer; transition: all .2s;
}
.stats-tag:hover { background: var(--primary); color: #fff; }
.stats-highlight { font-size: 14px; color: var(--primary); font-weight: 600; padding: 8px; background: var(--primary-light); border-radius: 8px; }
.stats-top-images { display: flex; flex-direction: column; gap: 8px; }
.stats-top-img {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; background: var(--bg); border-radius: 8px;
  cursor: pointer; transition: all .2s;
}
.stats-top-img:hover { background: var(--primary-light); }
.stats-top-rank { font-size: 16px; font-weight: 800; color: var(--primary); min-width: 24px; }
.stats-top-img img { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; }
.stats-top-info { flex: 1; }
.stats-top-title { font-size: 13px; font-weight: 600; }
.stats-top-views { font-size: 11px; color: var(--text-muted); }

/* 批注样式 */
.lb-note {
  margin: 8px 0; padding: 10px; background: #fef9c3;
  border-radius: 8px; border: 1px solid #fde047;
}
body.dark-mode .lb-note { background: #422006; border-color: #f59e0b; }
.lb-note-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.lb-note-title { font-size: 13px; font-weight: 600; color: #854d0e; }
body.dark-mode .lb-note-title { color: #fbbf24; }
.lb-note-btn {
  padding: 2px 8px; background: none; border: 1px solid #f59e0b;
  color: #b45309; border-radius: 4px; cursor: pointer; font-size: 11px;
  transition: all .2s;
}
.lb-note-btn:hover { background: #f59e0b; color: #fff; }
.lb-note-content { font-size: 12px; color: #713f12; line-height: 1.6; min-height: 20px; }
body.dark-mode .lb-note-content { color: #fde68a; }
.lb-note-edit textarea {
  width: 100%; min-height: 60px; padding: 8px;
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 12px; resize: vertical; outline: none;
}
.lb-note-edit textarea:focus { border-color: var(--primary); }
.lb-note-actions { display: flex; gap: 8px; margin-top: 8px; }
.lb-note-actions button {
  padding: 4px 12px; border-radius: 6px; cursor: pointer; font-size: 12px;
  border: none; transition: all .2s;
}
.lb-note-actions .btn-cancel { background: #e5e7eb; color: var(--text); }
.lb-note-actions .btn-save { background: var(--primary); color: #fff; }
.lb-note-actions button:hover { opacity: .85; }

/* EXIF信息样式 */
.lb-exif {
  margin: 8px 0; padding: 10px; background: var(--bg);
  border-radius: 8px; border: 1px solid var(--border);
}
.lb-exif-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.lb-exif-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.exif-item { display: flex; justify-content: space-between; font-size: 11px; padding: 3px 6px; background: #fff; border-radius: 4px; }
body.dark-mode .exif-item { background: var(--card); }
.exif-label { color: var(--text-muted); }
.exif-value { color: var(--text); font-weight: 500; }
.exif-no-data { font-size: 12px; color: var(--text-muted); text-align: center; padding: 8px; }
.exif-hint { font-size: 10px; color: var(--text-muted); text-align: center; margin-top: 4px; }
.lb-tool-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 下载对话框 */
.download-dialog {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(0,0,0,.5); display: flex;
  align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.download-dialog-inner {
  background: #fff; border-radius: 16px;
  max-width: 400px; width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,.3);
  animation: lbIn .2s;
}
.download-dialog-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.download-dialog-header h3 { font-size: 16px; font-weight: 700; color: var(--primary); }
.download-dialog-header button {
  background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted);
}
.download-dialog-body { padding: 16px 20px; }
.download-preview {
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: 16px;
}
.download-preview img { max-width: 200px; max-height: 150px; object-fit: contain; border-radius: 8px; }
.download-img-title { font-size: 12px; color: var(--text-muted); margin-top: 8px; text-align: center; }
.download-options { margin-bottom: 16px; }
.download-option-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.download-size-options { display: flex; flex-direction: column; gap: 6px; }
.size-option {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; background: var(--bg); border-radius: 6px;
  cursor: pointer; transition: all .2s; border: 1px solid transparent;
}
.size-option:hover { background: var(--primary-light); border-color: var(--primary); }
.size-name { font-size: 13px; font-weight: 500; }
.size-dims { font-size: 11px; color: var(--text-muted); }
.download-actions { display: flex; flex-direction: column; gap: 8px; }
.btn-download-original {
  width: 100%; padding: 10px; background: var(--primary); color: #fff;
  border: none; border-radius: 8px; cursor: pointer; font-size: 14px;
  transition: all .2s;
}
.btn-download-original:hover { background: #3730a3; }
.btn-download-custom {
  width: 100%; padding: 8px; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 13px;
}
.custom-size-input {
  display: flex; gap: 8px; align-items: center; margin-top: 8px;
}
.custom-size-input input {
  flex: 1; padding: 8px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 13px; text-align: center;
}
.custom-size-input button {
  padding: 8px 16px; background: var(--primary); color: #fff;
  border: none; border-radius: 6px; cursor: pointer; font-size: 13px;
}

/* 批量下载对话框 */
.batch-download-info { margin-bottom: 16px; }
.batch-download-info p { font-size: 14px; margin-bottom: 12px; }
.download-format-select { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.download-format-select select {
  flex: 1; padding: 8px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 13px;
}

/* 专注模式 */
.focus-overlay {
  position: fixed; inset: 0; z-index: 2500;
  background: #000; display: flex;
  align-items: center; justify-content: center;
  cursor: none;
}
.focus-overlay:hover { cursor: default; }
.focus-img {
  max-width: 95vw; max-height: 95vh; object-fit: contain;
}
.focus-exit-btn {
  position: fixed; top: 20px; right: 24px;
  background: rgba(255,255,255,.15); color: #fff; border: none;
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  font-size: 18px; transition: all .2s; z-index: 10;
  display: flex; align-items: center; justify-content: center;
}
.focus-exit-btn:hover { background: rgba(255,255,255,.3); }
.focus-nav-btn {
  position: fixed; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,.15); color: #fff; border: none;
  width: 56px; height: 56px; border-radius: 50%; cursor: pointer;
  font-size: 32px; transition: all .2s; z-index: 10;
  display: flex; align-items: center; justify-content: center;
}
.focus-nav-btn:hover { background: rgba(255,255,255,.3); }
.focus-prev { left: 24px; }
.focus-next { right: 24px; }
.focus-info {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 20px;
  background: rgba(0,0,0,.6); padding: 10px 24px;
  border-radius: 999px; z-index: 10;
  color: #fff;
}
#focus-title { font-size: 14px; font-weight: 600; }
#focus-counter { font-size: 13px; opacity: .7; }

/* 深色模式增强 */
body.dark-mode .calendar-panel, body.dark-mode .stats-panel-full,
body.dark-mode .download-dialog-inner {
  background: var(--card); color: var(--text);
}
body.dark-mode .calendar-panel-header, body.dark-mode .calendar-nav,
body.dark-mode .stats-panel-header, body.dark-mode .download-dialog-header {
  background: #1e293b; border-color: var(--border);
}
body.dark-mode .calendar-grid { background: var(--bg); }
body.dark-mode .calendar-day:not(.empty) { background: var(--card); }
body.dark-mode .calendar-day.today { background: var(--primary-light); color: #a5b4fc; }
body.dark-mode .download-preview img { background: var(--bg); }
body.dark-mode .size-option { background: var(--card); }
body.dark-mode .download-format-select select { background: var(--card); border-color: var(--border); color: var(--text); }
body.dark-mode .lb-tool-btn { background: var(--card); border-color: var(--border); }
body.dark-mode .lb-tool-btn:hover, body.dark-mode .lb-tool-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
body.dark-mode .lb-tool-btn.active { background: var(--primary); color: #fff; }

/* 批量工具栏深色模式 */
body.dark-mode .batch-toolbar { background: linear-gradient(135deg, #b45309 0%, #92400e 100%); }

/* PV计数样式 */
.pv-count {
  font-size: 12px; color: var(--text-muted);
  background: var(--bg); padding: 4px 10px;
  border-radius: 999px; border: 1px solid var(--border);
}

/* ===== 收藏夹管理面板 ===== */
.favorites-panel {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: #fff; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
  z-index: 2000; width: 90vw; max-width: 600px; max-height: 80vh;
  display: flex; flex-direction: column; overflow: hidden;
  animation: slideDown .2s ease-out;
}
.favorites-panel-inner {
  display: flex; flex-direction: column; height: 100%;
}
.favorites-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border); background: var(--bg);
}
.favorites-panel-header h3 { font-size: 16px; font-weight: 700; color: #ec4899; }
.favorites-actions { display: flex; gap: 8px; }
.favorites-actions button {
  background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted);
  width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.favorites-actions button:hover { background: var(--bg); color: var(--text); }
.btn-clear-favs:hover { background: #fee2e2 !important; color: #dc2626 !important; }
.favorites-stats {
  padding: 12px 20px; border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--text-muted);
}
.favorites-grid {
  flex: 1; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.fav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; background: var(--bg); border-radius: 10px;
  cursor: pointer; transition: all .2s; position: relative;
}
.fav-item:hover { background: var(--primary-light); transform: translateX(4px); }
.fav-thumb {
  width: 50px; height: 50px; border-radius: 8px; overflow: hidden;
  background: var(--border); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.fav-thumb img { width: 100%; height: 100%; object-fit: cover; }
.fav-thumb span { font-size: 20px; }
.fav-info { flex: 1; min-width: 0; }
.fav-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fav-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.fav-remove {
  position: absolute; top: 8px; right: 8px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,.1); border: none; cursor: pointer;
  font-size: 12px; color: var(--text-muted); opacity: 0;
  transition: all .2s; display: flex; align-items: center; justify-content: center;
}
.fav-item:hover .fav-remove { opacity: 1; }
.fav-remove:hover { background: #dc2626; color: #fff; }
.favorites-empty {
  text-align: center; padding: 40px 20px; color: var(--text-muted);
  font-size: 14px;
}
.favorites-empty::before { content: '💔'; font-size: 48px; display: block; margin-bottom: 12px; }

/* 深色模式收藏夹 */
body.dark-mode .favorites-panel { background: var(--card); color: var(--text); }
body.dark-mode .favorites-panel-header, body.dark-mode .favorites-stats { background: #1e293b; border-color: var(--border); }
body.dark-mode .favorites-panel-header h3 { color: #f472b6; }
body.dark-mode .fav-item { background: var(--bg); }
body.dark-mode .fav-item:hover { background: var(--primary-light); }
body.dark-mode .fav-remove { background: rgba(255,255,255,.1); color: var(--text-muted); }
body.dark-mode .fav-remove:hover { background: #dc2626; color: #fff; }

/* ===== 批量操作增强 ===== */
.batch-action-btn.export-btn {
  background: #10b981;
}
.batch-action-btn.export-btn:hover {
  background: #059669;
}
.batch-action-btn.random-btn {
  background: #8b5cf6;
}
.batch-action-btn.random-btn:hover {
  background: #7c3aed;
}

/* ===== 访问密码弹窗 ===== */
.access-gate {
  position: fixed; inset: 0; z-index: 99999;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  animation: accessFadeIn .3s ease;
}
@keyframes accessFadeIn { from { opacity: 0; } to { opacity: 1; } }

.access-gate-box {
  background: #fff; border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0,0,0,.4);
  padding: 40px 36px; width: 90vw; max-width: 380px;
  text-align: center;
  animation: accessSlideUp .3s ease;
}
@keyframes accessSlideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.access-gate-icon { font-size: 48px; margin-bottom: 12px; }
.access-gate-title { font-size: 22px; font-weight: 700; color: #1e293b; margin-bottom: 8px; }
.access-gate-subtitle { font-size: 13px; color: #64748b; margin-bottom: 24px; line-height: 1.6; }

.access-pwd-input {
  width: 100%; padding: 12px 16px; border: 2px solid #e2e8f0;
  border-radius: 10px; font-size: 16px; letter-spacing: 2px;
  outline: none; transition: border-color .2s; text-align: center;
  margin-bottom: 12px; box-sizing: border-box;
}
.access-pwd-input:focus { border-color: var(--primary); }

.access-verify-btn {
  width: 100%; padding: 13px; background: var(--primary);
  color: #fff; border: none; border-radius: 10px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background .2s;
}
.access-verify-btn:hover { background: #3730a3; }

.access-cancel-btn {
  width: 100%; padding: 10px; background: transparent;
  color: #94a3b8; border: 1px solid #e2e8f0; border-radius: 10px;
  font-size: 14px; cursor: pointer; margin-top: 8px;
  transition: all .2s;
}
.access-cancel-btn:hover { border-color: #cbd5e1; color: #64748b; }

/* 有单图密码时，卡片右上角显示锁图标 */
.card-img-lock-badge {
  position: absolute; top: 6px; left: 6px;
  background: rgba(0,0,0,.55); color: #fff; border-radius: 6px;
  padding: 2px 6px; font-size: 12px; line-height: 1.6;
  pointer-events: none; z-index: 3;
}

/* 深色模式取消按钮 */
body.dark-mode .access-cancel-btn {
  border-color: #334155; color: #64748b;
}

.access-error {
  margin-top: 12px; color: #ef4444; font-size: 13px;
  background: #fef2f2; padding: 8px 12px; border-radius: 8px;
  border: 1px solid #fecaca;
}

/* 深色模式下的访问密码弹窗 */
body.dark-mode .access-gate-box {
  background: #1e293b; color: var(--text);
}
body.dark-mode .access-gate-title { color: #f1f5f9; }
body.dark-mode .access-pwd-input {
  background: #0f172a; border-color: #334155; color: #f1f5f9;
}
body.dark-mode .access-pwd-input:focus { border-color: var(--primary); }

/* 无URL图片的卡片缩略图高度为0 */
.card-thumb-wrap[style*="height:0"] { min-height: 0 !important; }

/* ===== 头部功能按钮折叠 ===== */
/* 所有按钮统一过渡动画 */
.header-actions > button,
.header-actions > .btn-admin {
  transition: max-width .3s ease, opacity .3s ease, padding .3s ease, border-width .3s ease, margin .3s ease;
  flex-shrink: 0;
  overflow: hidden;
  white-space: nowrap;
}

/* pv-count 不需要过渡（始终可见） */
.header-actions > .pv-count {
  transition: none;
  overflow: visible;
}

/* 折叠态：隐藏所有功能按钮，只留pv-count */
.gallery-header:not(:hover) .header-actions > button:not(.pv-count),
.gallery-header:not(:hover) .header-actions > .btn-admin {
  max-width: 0;
  opacity: 0;
  padding-left: 0;
  padding-right: 0;
  border-width: 0;
  margin: 0;
}

/* pv-count 在折叠态仍完全可见 */
.gallery-header:not(:hover) .header-actions > .pv-count {
  max-width: 120px;
  opacity: 1;
}

/* 展开态 */
.gallery-header:hover .header-actions > button,
.gallery-header:hover .header-actions > .btn-admin {
  max-width: 34px;
  opacity: 1;
  padding-left: 0;
  padding-right: 0;
  border-width: 1px;
  margin: 0;
}
.gallery-header:hover .header-actions > .btn-admin {
  max-width: 80px;
  padding: 6px 14px;
}
.gallery-header:hover .header-actions > .pv-count {
  max-width: 120px;
}


