/* ============================================================
   MediaVault — 设计令牌
   ============================================================ */
:root {
  --bg: #0b0c0f;
  --bg-elev: #121419;
  --bg-elev-2: #171a21;
  --bg-hover: #1d212a;
  --line: #232732;
  --line-soft: #1a1e26;
  --text: #eceef3;
  --text-dim: #9aa1af;
  --text-faint: #656d7d;
  --accent: #ff7a52;
  --accent-2: #ff9b7a;
  --accent-soft: rgba(255, 122, 82, 0.13);
  --ok: #4ade80;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-lg: 0 24px 70px -20px rgba(0, 0, 0, 0.9);
  --shadow-sm: 0 6px 20px -10px rgba(0, 0, 0, 0.8);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

/* 关键：确保 hidden 属性优先于任何 display 声明 */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

body.no-scroll { overflow: hidden; }

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: #16100c; }

/* 滚动条 */
* { scrollbar-width: thin; scrollbar-color: #2c3140 transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb {
  background: #2c3140; border-radius: 99px; border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: #3b4152; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   布局
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  height: 100dvh;
}

/* ---------- 侧栏 ---------- */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  padding: 18px 12px 12px;
  border-right: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #0e1015 0%, #0b0c0f 100%);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px 16px;
}
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--accent), #d9532f);
  color: #1a0d07;
  box-shadow: 0 6px 18px -8px rgba(255, 122, 82, 0.9);
  flex: none;
}
.brand-text { min-width: 0; flex: 1; }
.brand-text h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.2px;
}
.brand-text p {
  margin: 1px 0 0;
  font-size: 11.5px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 主导航 */
.nav { display: flex; flex-direction: column; gap: 1px; margin-bottom: 14px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 13.5px;
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
  text-align: left;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item .ico { display: grid; place-items: center; width: 18px; opacity: 0.85; flex: none; }
.nav-item .label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item .n {
  font-size: 11.5px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  padding: 1px 6px;
  border-radius: 99px;
  background: #1a1e27;
  min-width: 22px;
  text-align: center;
}
.nav-item.active {
  background: var(--accent-soft);
  color: #ffd9cc;
  font-weight: 550;
}
.nav-item.active .ico { color: var(--accent); opacity: 1; }
.nav-item.active .n { background: rgba(255, 122, 82, 0.2); color: var(--accent-2); }

/* 分区 */
.side-section { padding: 12px 0 4px; border-top: 1px solid var(--line-soft); }
.side-section h2 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px;
  padding: 0 10px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--text-faint);
}
.side-section h2 span { font-weight: 400; letter-spacing: 0; opacity: 0.7; }

.add-btn {
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  color: var(--text-faint);
  transition: background 0.13s, color 0.13s;
}
.add-btn:hover { background: var(--accent-soft); color: var(--accent); }

/* 文件夹行：默认显示数量，悬浮时换成重命名按钮 */
.side-row { position: relative; display: flex; }
.side-row .side-item { flex: 1; }
.side-row .n { transition: opacity 0.12s; }
.side-row .edit-btn {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.12s, background 0.12s, color 0.12s;
}
.side-row:hover .edit-btn,
.side-row .edit-btn:focus-visible { opacity: 1; }
.side-row:hover .n { opacity: 0; }
.side-row .edit-btn:hover { background: #2a303c; color: var(--text); }

.folder-input {
  width: 100%;
  margin: 2px 0;
  padding: 5px 9px;
  border-radius: 8px;
  border: 1px solid rgba(255, 122, 82, 0.55);
  background: #0e1117;
  color: var(--text);
  font-size: 13px;
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.folder-input::placeholder { color: var(--text-faint); }

.side-list { display: flex; flex-direction: column; gap: 1px; max-height: 42vh; overflow-y: auto; }

.side-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 13px;
  text-align: left;
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
}
.side-item:hover { background: var(--bg-hover); color: var(--text); }
.side-item.active { background: #1e222c; color: var(--text); font-weight: 550; }
.side-item .folder-ico { flex: none; opacity: 0.5; display: grid; place-items: center; }
.side-item.active .folder-ico { opacity: 1; color: var(--accent); }
.side-item .name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-item .n { font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 10px 4px; }
.tag-chip {
  padding: 3px 9px;
  border-radius: 99px;
  background: #1a1e27;
  border: 1px solid transparent;
  color: var(--text-dim);
  font-size: 12px;
  transition: all 0.14s var(--ease);
  white-space: nowrap;
}
.tag-chip:hover { background: #232833; color: var(--text); }
.tag-chip.active {
  background: var(--accent-soft);
  border-color: rgba(255, 122, 82, 0.4);
  color: var(--accent-2);
}
.tag-chip .n { opacity: 0.55; margin-left: 3px; font-size: 10.5px; }
.tag-empty { padding: 2px 10px 6px; color: var(--text-faint); font-size: 12px; }

/* 底部按钮 */
.side-footer {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: auto;
  padding-top: 14px;
}
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--accent);
  color: #1a0d07;
  font-size: 13px;
  font-weight: 600;
  transition: filter 0.14s var(--ease), transform 0.1s var(--ease);
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(0.985); }
.btn.ghost {
  background: #181c24;
  color: var(--text-dim);
  font-weight: 500;
  border: 1px solid var(--line);
}
.btn.ghost:hover { background: #1e232d; color: var(--text); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

/* ---------- 主区 ---------- */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(11, 12, 15, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  flex: none;
  min-width: 0;
  z-index: 20;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 520px;
}
.search-ico {
  position: absolute;
  left: 12px;
  color: var(--text-faint);
  pointer-events: none;
}
.search input {
  width: 100%;
  padding: 9px 44px 9px 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #14171e;
  color: var(--text);
  outline: none;
  font-size: 13.5px;
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease), box-shadow 0.16s;
}
.search input::placeholder { color: var(--text-faint); }
.search input:focus {
  border-color: rgba(255, 122, 82, 0.55);
  background: #171b23;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search input::-webkit-search-cancel-button { display: none; }
.search-kbd {
  position: absolute;
  right: 10px;
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: #0e1015;
  color: var(--text-faint);
  font-size: 11px;
  font-family: ui-monospace, monospace;
  pointer-events: none;
}
.search input:focus + .search-kbd,
.search.filled .search-kbd { opacity: 0; }

.select {
  padding: 9px 30px 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #14171e url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa1af' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center / 14px;
  color: var(--text-dim);
  font-size: 13px;
  outline: none;
  appearance: none;
  cursor: pointer;
  flex: none;
  transition: border-color 0.16s;
}
.select:hover { border-color: #2f3542; color: var(--text); }
.select:focus { border-color: rgba(255, 122, 82, 0.55); }
.select option { background: #14171e; color: var(--text); }

.result-count {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  color: var(--text-dim);
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
  flex: none;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }

/* 筛选条 */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding: 10px 22px 0;
  flex: none;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  border-radius: 99px;
  background: #1b1f28;
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 12px;
}
.filter-chip b { font-weight: 600; color: var(--text); }
.filter-chip button {
  display: grid; place-items: center;
  width: 16px; height: 16px;
  border-radius: 50%;
  color: var(--text-faint);
  font-size: 11px;
  line-height: 1;
}
.filter-chip button:hover { background: #2a303c; color: var(--text); }
.filter-clear { font-size: 12px; color: var(--text-faint); padding: 4px 6px; }
.filter-clear:hover { color: var(--accent); }

/* ============================================================
   网格
   ============================================================ */
.grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  padding: 18px 22px 48px;
  align-content: start;
  scroll-behavior: smooth;
}

.card {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #14171e;
  cursor: zoom-in;
  contain: paint;
  transition: transform 0.24s var(--ease), box-shadow 0.24s var(--ease);
  animation: card-in 0.34s var(--ease) both;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(9px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.card img,
.card canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s var(--ease), filter 0.2s;
}
.card:hover img { transform: scale(1.045); }

/* 占位骨架 */
.card .ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(115deg, #14171e 20%, #1a1f28 40%, #14171e 60%);
  background-size: 220% 100%;
  animation: shimmer 1.5s linear infinite;
  color: var(--text-faint);
}
@keyframes shimmer {
  from { background-position: 130% 0; }
  to   { background-position: -70% 0; }
}

.card .badge {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(8, 9, 12, 0.72);
  backdrop-filter: blur(6px);
  color: #e9ecf2;
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2px;
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity 0.18s, transform 0.18s;
}
.card:hover .badge,
.card:focus-visible .badge { opacity: 1; transform: none; }

.card .fav-mark {
  position: absolute;
  top: 8px;
  left: 8px;
  color: var(--accent);
  font-size: 15px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

.card .cap {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 22px 10px 9px;
  background: linear-gradient(to top, rgba(6, 7, 10, 0.94) 0%, rgba(6, 7, 10, 0.55) 55%, transparent 100%);
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.card:hover .cap,
.card:focus-visible .cap { opacity: 1; transform: none; }
.card .cap .nm {
  font-size: 12px;
  font-weight: 550;
  color: #f2f4f7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card .cap .sb {
  font-size: 10.5px;
  color: #a9b1be;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 空状态 / 加载 */
.empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px;
  color: var(--text-faint);
  text-align: center;
}
.empty svg { opacity: 0.35; }
.empty h3 { margin: 4px 0 0; font-size: 15px; color: var(--text-dim); font-weight: 550; }
.empty p { margin: 0; font-size: 13px; max-width: 380px; }
.empty code {
  padding: 1px 5px;
  border-radius: 4px;
  background: #1b1f28;
  color: var(--accent-2);
  font-size: 12px;
  font-family: ui-monospace, monospace;
}

.sentinel { height: 1px; flex: none; }
.loading-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 18px;
  color: var(--text-faint);
  font-size: 12.5px;
}
.spinner {
  width: 15px; height: 15px;
  border: 2px solid #2a303c;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.only-mobile { display: none !important; }

/* ============================================================
   灯箱
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 7, 10, 0.95);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  animation: fade 0.18s var(--ease);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.lb-stage {
  position: absolute;
  inset: 0 0 74px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 76px;
  overflow: hidden;
}
.lb-stage img,
.lb-stage video {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  object-fit: contain;
  transition: transform 0.22s var(--ease);
}
.lb-stage img { cursor: zoom-in; }
.lb-stage img.zoomed {
  cursor: zoom-out;
  transform: scale(2);
  max-height: none;
}
.lb-stage video { background: #000; max-height: calc(100dvh - 130px); }

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(20, 23, 30, 0.8);
  border: 1px solid var(--line);
  color: var(--text-dim);
  backdrop-filter: blur(8px);
  transition: all 0.15s var(--ease);
  z-index: 2;
}
.lb-nav:hover { background: rgba(38, 43, 54, 0.95); color: #fff; }
.lb-nav.prev { left: 16px; }
.lb-nav.next { right: 16px; }
.lb-nav[disabled] { opacity: 0.22; pointer-events: none; }

.lb-close {
  position: absolute;
  top: 14px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(20, 23, 30, 0.8);
  border: 1px solid var(--line);
  color: var(--text-dim);
  backdrop-filter: blur(8px);
  transition: all 0.15s var(--ease);
  z-index: 3;
}
.lb-close:hover { background: #2a2f3a; color: #fff; }

.lb-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: linear-gradient(to top, rgba(8, 9, 12, 0.98), rgba(8, 9, 12, 0.72));
  border-top: 1px solid rgba(35, 39, 50, 0.7);
  z-index: 2;
}
.lb-meta { min-width: 0; flex: 1; }
.lb-title {
  font-size: 13.5px;
  font-weight: 550;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-sub {
  font-size: 11.5px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.lb-tags { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; max-width: 44%; }
.lb-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px 2px 8px;
  border-radius: 99px;
  background: #1c212b;
  font-size: 11.5px;
  color: #c3cad6;
}
.lb-tag button { color: var(--text-faint); font-size: 12px; line-height: 1; padding: 0 3px; }
.lb-tag button:hover { color: var(--accent); }
.lb-tag-add {
  width: 74px;
  padding: 3px 7px;
  border-radius: 99px;
  border: 1px dashed #333a48;
  background: transparent;
  color: var(--text);
  font-size: 11.5px;
  outline: none;
  transition: border-color 0.15s, width 0.2s var(--ease);
}
.lb-tag-add::placeholder { color: var(--text-faint); }
.lb-tag-add:focus { border-color: var(--accent); border-style: solid; width: 110px; }

.lb-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.fav-btn { font-size: 17px; line-height: 1; }
.fav-btn.on { color: var(--accent); }

.lb-index {
  position: absolute;
  top: 16px;
  left: 20px;
  font-size: 12px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  z-index: 2;
}

/* ============================================================
   解锁页
   ============================================================ */
.auth {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 480px at 50% -10%, rgba(255, 122, 82, 0.14), transparent 70%),
    #08090c;
  animation: fade 0.2s var(--ease);
}

.auth-card {
  width: 100%;
  max-width: 356px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 30px 26px 22px;
  border-radius: 18px;
  background: linear-gradient(180deg, #14171e, #101319);
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.95);
}

.auth-logo {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 6px;
  border-radius: 13px;
  background: linear-gradient(145deg, var(--accent), #d9532f);
  color: #1a0d07;
  box-shadow: 0 10px 24px -12px rgba(255, 122, 82, 0.95);
}

.auth-card h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0.2px;
}

.auth-desc {
  margin: -4px 0 10px;
  font-size: 12.5px;
  color: var(--text-faint);
  line-height: 1.55;
}

.auth-input {
  width: 100%;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0e1117;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}
.auth-input::placeholder { color: var(--text-faint); }
.auth-input:focus {
  border-color: rgba(255, 122, 82, 0.6);
  background: #12161d;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.auth-input.bad {
  border-color: rgba(248, 113, 113, 0.65);
  animation: shake 0.32s var(--ease);
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.auth-err {
  min-height: 16px;
  font-size: 12px;
  color: #f87171;
  line-height: 1.4;
}

.auth-submit {
  width: 100%;
  padding: 11px;
  font-size: 14px;
  margin-top: 2px;
}
.auth-submit[disabled] { opacity: 0.6; }

.auth-hint {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-faint);
  text-align: center;
}
.auth-hint code {
  padding: 1px 4px;
  border-radius: 4px;
  background: #1b1f28;
  color: #b9c0cc;
  font-family: ui-monospace, monospace;
}

/* ============================================================
   多选
   ============================================================ */
.icon-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.card .check {
  position: absolute;
  left: 7px;
  bottom: 7px;
  display: none;
  place-items: center;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: rgba(10, 11, 14, 0.55);
  color: transparent;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  backdrop-filter: blur(4px);
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  pointer-events: none;
  z-index: 2;
}
body.selecting .card .check { display: grid; }
body.selecting .card { cursor: pointer; }
.card.sel .check {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a0d07;
}
.card.sel img { filter: brightness(0.68); }
.card.sel { box-shadow: 0 0 0 2px var(--accent) inset; }
.card.sel:hover img { transform: none; }

body.selecting .card:not(.sel)::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(8, 9, 12, 0.28);
  pointer-events: none;
}

.selbar {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(22, 26, 33, 0.94);
  border: 1px solid var(--line);
  box-shadow: 0 18px 48px -16px rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(16px);
  animation: selbar-in 0.22s var(--ease);
}
@keyframes selbar-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
}
.sel-count {
  padding: 0 8px 0 4px;
  font-size: 12.5px;
  color: var(--text-dim);
  white-space: nowrap;
}
.sel-count b { color: var(--text); font-weight: 650; }
.sel-btn {
  padding: 6px 13px;
  border-radius: 999px;
  background: #262c37;
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 500;
  transition: background 0.13s, color 0.13s;
  white-space: nowrap;
}
.sel-btn:hover { background: #333a48; color: var(--text); }
.sel-btn.danger { background: #e5484d; color: #fff; font-weight: 600; }
.sel-btn.danger:hover { filter: brightness(1.1); }
.sel-btn.danger[disabled] { opacity: 0.45; pointer-events: none; }

/* 多选时给底部工具条留位置 */
body.selecting .grid { padding-bottom: 96px; }

/* ============================================================
   回收站
   ============================================================ */
.trash-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 2px 2px 12px;
}
.trash-header .th-info { display: flex; flex-direction: column; gap: 3px; }
.trash-header strong { font-size: 14.5px; font-weight: 650; }
.trash-header span { font-size: 12px; color: var(--text-faint); }

.card.trash-card { cursor: default; }
.card.trash-card .cap { display: none; }
.card.trash-card .badge {
  opacity: 1;
  transform: none;
  background: rgba(8, 9, 12, 0.78);
}

.trash-acts {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 6px;
  padding: 22px 8px 8px;
  background: linear-gradient(to top, rgba(6, 7, 10, 0.96) 30%, transparent);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.16s var(--ease), transform 0.16s var(--ease);
}
.card.trash-card:hover .trash-acts,
.card.trash-card:focus-within .trash-acts {
  opacity: 1;
  transform: none;
}
.ta-btn {
  flex: 1;
  padding: 5px 4px;
  border-radius: 7px;
  background: #2c323e;
  color: #dfe4ec;
  font-size: 11.5px;
  white-space: nowrap;
  transition: background 0.13s, color 0.13s;
}
.ta-btn:hover { background: #3a4252; color: #fff; }
.ta-btn.danger { background: rgba(229, 72, 77, 0.92); color: #fff; }
.ta-btn.danger:hover { filter: brightness(1.1); }

/* 触屏没有 hover，操作条常驻 */
@media (hover: none) {
  .trash-acts { opacity: 1; transform: none; }
}

@media (max-width: 430px) {
  body.trash-mode .grid {
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 8px;
  }
}

/* ============================================================
   确认弹窗
   ============================================================ */
.confirm {
  position: fixed;
  inset: 0;
  z-index: 350;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(6, 7, 10, 0.72);
  backdrop-filter: blur(6px);
  animation: fade 0.15s var(--ease);
}
.confirm-card {
  width: 100%;
  max-width: 330px;
  padding: 20px 20px 16px;
  border-radius: 16px;
  background: linear-gradient(180deg, #171b22, #12151b);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  animation: pop 0.18s var(--ease);
}
.confirm-card h3 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 650;
  color: var(--text);
}
.confirm-card p {
  margin: 0 0 18px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-dim);
}
.confirm-actions { display: flex; gap: 8px; }
.confirm-actions .btn { flex: 1; padding: 9px 12px; }

.btn.danger {
  background: #e5484d;
  color: #fff;
}
.btn.danger:hover { filter: brightness(1.1); }

.del-btn:hover { background: rgba(229, 72, 77, 0.16); color: #ff6b70; }

/* ============================================================
   拖拽上传 / Toast
   ============================================================ */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(11, 12, 15, 0.86);
  backdrop-filter: blur(6px);
}
.drop-overlay.on { display: flex; }
.drop-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 52px 68px;
  border-radius: 20px;
  border: 2px dashed rgba(255, 122, 82, 0.55);
  background: rgba(255, 122, 82, 0.06);
  color: var(--accent-2);
  text-align: center;
  animation: pop 0.2s var(--ease);
}
@keyframes pop { from { transform: scale(0.96); opacity: 0; } }
.drop-inner strong { font-size: 16px; }
.drop-inner span { font-size: 12.5px; color: var(--text-dim); }

.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #1b202a;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  font-size: 12.5px;
  color: var(--text);
  animation: toast-in 0.26s var(--ease);
  max-width: 340px;
}
.toast.out { animation: toast-out 0.22s var(--ease) forwards; }
.toast.err { border-color: rgba(248, 113, 113, 0.4); }
.toast.err .dot { background: #f87171; }
.toast .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex: none; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s var(--ease);
  z-index: 35;
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .lb-tags { display: none; }
}

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .only-mobile { display: grid !important; }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 274px;
    transform: translateX(-102%);
    transition: transform 0.26s var(--ease);
    box-shadow: var(--shadow-lg);
    border-right: 1px solid var(--line);
  }
  .sidebar.open { transform: none; }
  .scrim.on { opacity: 1; pointer-events: auto; }

  .topbar { padding: 10px 12px; gap: 8px; }
  .search input { padding-left: 34px; }
  .search-kbd { display: none; }
  .result-count { display: none; }
  .select { max-width: 118px; padding-left: 9px; }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(106px, 1fr));
    gap: 6px;
    padding: 10px 10px 40px;
  }
  .lb-stage { padding: 12px 8px; inset: 0 0 96px 0; }
  .lb-nav { width: 38px; height: 38px; }
  .lb-nav.prev { left: 6px; }
  .lb-nav.next { right: 6px; }
  .lb-bar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 9px 12px;
  }
  .lb-meta { flex: 1 1 100%; }
  .lb-tags { max-width: 100%; flex: 1; }
  .lb-index { top: 12px; left: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* 手机：一屏能看到更多缩略图 */
@media (max-width: 430px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 4px;
    padding: 8px 8px 36px;
  }
  .card { border-radius: 6px; }
  .card .cap { display: none; }
  .card .badge { top: 4px; right: 4px; padding: 2px 4px; font-size: 9px; }
  .card .fav-mark { top: 4px; left: 5px; font-size: 12px; }
  .topbar { padding: 8px 10px; gap: 6px; }
  .select { max-width: 104px; font-size: 12px; padding: 8px 26px 8px 8px; }
  .search input { padding: 8px 10px 8px 32px; font-size: 13px; }
  .side-section h2 { margin-bottom: 4px; }
}
