/* ============ 共享空间 · 样式 ============ */
:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f0f2f8;
  --text: #14161f;
  --text-2: #4a5063;
  --muted: #8b90a3;
  --border: #e6e8f0;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef0ff;
  --danger: #e5484d;
  --danger-soft: #fdecec;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 22, 31, .05), 0 8px 24px -12px rgba(20, 22, 31, .18);
  --shadow-lg: 0 24px 60px -20px rgba(20, 22, 31, .35);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input { font-family: inherit; font-size: inherit; }

/* ---------- 启动 ---------- */
.boot {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px; background: var(--bg);
}
.boot-mark {
  width: 64px; height: 64px; border-radius: 20px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), #7c74ff);
  color: #fff; font-size: 26px; font-weight: 700;
  box-shadow: var(--shadow);
}
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid var(--border); border-top-color: var(--primary);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 登录 ---------- */
.auth {
  min-height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 28px 18px 40px;
  background:
    radial-gradient(900px 460px at 12% -8%, #e8e9ff 0%, rgba(232,233,255,0) 62%),
    radial-gradient(720px 420px at 100% 4%, #e4f4ff 0%, rgba(228,244,255,0) 58%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 28px 24px 22px;
}
.auth-brand { text-align: center; margin-bottom: 22px; }
.brand-mark {
  width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 17px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), #7c74ff);
  color: #fff; font-size: 23px; font-weight: 700;
  box-shadow: 0 10px 22px -10px rgba(79, 70, 229, .75);
}
.auth-brand h1 { margin: 0 0 4px; font-size: 21px; letter-spacing: .5px; }
.auth-brand p { margin: 0; color: var(--muted); font-size: 13px; }

.line-tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 11px; margin-bottom: 18px; }
.line-tab {
  flex: 1; border: 0; background: transparent; color: var(--text-2);
  padding: 8px 0; border-radius: 8px; font-weight: 600; font-size: 14px;
  transition: .18s;
}
.line-tab.active { background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px rgba(20,22,31,.09); }

.auth-form { display: flex; flex-direction: column; gap: 13px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field input {
  width: 100%; padding: 11px 13px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fbfbfd; color: var(--text);
  outline: none; transition: .15s;
}
.field input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px var(--primary-soft); }
.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; }

.btn {
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 11px 16px; font-weight: 600; background: var(--surface-2); color: var(--text);
  transition: .16s; white-space: nowrap;
}
.btn:hover { filter: brightness(.97); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: #fff; box-shadow: 0 8px 18px -10px rgba(79,70,229,.9); }
.btn.primary:hover { background: var(--primary-dark); }
.btn.ghost { background: var(--primary-soft); color: var(--primary); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.block { width: 100%; padding: 12px; }
.btn.sm { padding: 10px 13px; font-size: 13.5px; }

.auth-links { display: flex; justify-content: space-between; margin-top: 2px; }
.link { border: 0; background: transparent; color: var(--primary); padding: 2px; font-size: 13px; }
.link:hover { text-decoration: underline; }

.form-error {
  margin: 0; padding: 9px 12px; border-radius: 9px;
  background: var(--danger-soft); color: var(--danger); font-size: 13px;
}
.auth-note {
  margin: 18px 0 0; padding-top: 15px; border-top: 1px dashed var(--border);
  color: var(--muted); font-size: 12.5px; text-align: center; line-height: 1.65;
}
.auth-note b { color: var(--text-2); }
.auth-foot { margin: 18px 0 0; color: var(--muted); font-size: 12.5px; text-align: center; }

/* ---------- 主应用 ---------- */
.app { display: flex; flex-direction: column; min-height: 100vh; padding-bottom: 96px; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand-mark.tiny { width: 30px; height: 30px; border-radius: 10px; font-size: 15px; margin: 0; box-shadow: none; }
.brand-text { font-weight: 700; font-size: 16px; letter-spacing: .3px; }
.topbar-right { display: flex; align-items: center; gap: 6px; min-width: 0; }
.who {
  color: var(--muted); font-size: 12.5px; max-width: 34vw;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); display: grid; place-items: center; font-size: 15px;
  transition: .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--primary); }

.segmented { display: flex; gap: 6px; padding: 12px 16px 6px; max-width: 1180px; width: 100%; margin: 0 auto; }
.seg {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  padding: 8px 20px; border-radius: 999px; font-weight: 600; font-size: 14px; transition: .16s;
}
.seg:hover { border-color: #d5d8e6; }
.seg.active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 6px 14px -8px rgba(79,70,229,.9); }

.catbar {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 16px 12px; overflow-x: auto; scrollbar-width: none;
  max-width: 1180px; width: 100%; margin: 0 auto;
}
.catbar::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); padding: 6px 14px; border-radius: 999px; font-size: 13.5px;
  white-space: nowrap; transition: .16s;
}
.chip:hover { border-color: #d5d8e6; }
.chip.active { background: var(--primary-soft); border-color: #cdd1ff; color: var(--primary); font-weight: 600; }
.chip.ghost { background: transparent; color: var(--muted); border-style: dashed; }
.chip.ghost:hover { color: var(--primary); border-color: #cdd1ff; }
/* 子分类（名字里带「/」）：淡底 + └ 前缀，跟大类区分开 */
.chip.sub { background: var(--surface-2); border-color: transparent; color: var(--text-2); font-size: 12.5px; }
.chip.sub::before { content: '└ '; color: var(--muted); }
.chip.sub:hover { border-color: #d5d8e6; }
.chip.sub.active { background: var(--primary-soft); border-color: #cdd1ff; color: var(--primary); }
/* 登录页的安卓安装包入口 */
.auth-app {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 14px; padding: 9px 16px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text-2);
  font-size: 13px; text-decoration: none; transition: .16s;
}
.auth-app:hover { border-color: #cdd1ff; color: var(--primary); background: var(--primary-soft); }
/* 「未分类」入口：暖色，和普通分类区分开 */
.chip.warn { border-color: #f0cf9a; background: #fff9ef; color: #a8690f; }
.chip.warn:hover { border-color: #e5b96f; }
.chip.warn.active { background: #fdf1da; border-color: #e0b164; color: #8f5306; font-weight: 600; }
.chip.warn .chip-n { background: rgba(168,105,15,.14); color: #a8690f; }
/* 相册格子上的「未分类」角标 */
.tile .tile-badge {
  position: absolute; top: 7px; left: 7px; z-index: 2;
  padding: 2px 7px; border-radius: 999px;
  background: rgba(176,111,22,.94); color: #fff;
  font-size: 11px; line-height: 1.5; font-weight: 600; letter-spacing: .2px;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
}
.selmode .tile-badge { display: none; }
/* 资料列表里的「未分类」小标 */
.row .row-badge {
  display: inline-block; margin-right: 6px; padding: 1px 6px;
  border-radius: 999px; background: #fdf1da; color: #8f5306;
  font-size: 11px; font-weight: 600; vertical-align: 1px;
}
/* 「未分类」视图顶部的提示条 */
.uncat-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap;                       /* 窄屏时按钮组整体换到下一行，不挤成一团 */
  margin: 0 0 12px; padding: 10px 12px;
  border: 1px solid #f0cf9a; background: #fffaf0; border-radius: 12px;
  font-size: 13px; color: #8a5a12; line-height: 1.6;
}
/* 提示条里的按钮总是靠右成组，别被 space-between 摊到中间去 */
.uncat-acts { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }

.content { flex: 1; padding: 0 16px 20px; max-width: 1180px; width: 100%; margin: 0 auto; }

/* 相册网格 */
.grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
@media (max-width: 520px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
}
.tile {
  position: relative; aspect-ratio: 1 / 1; border-radius: var(--radius);
  overflow: hidden; background: var(--surface-2); box-shadow: var(--shadow);
  cursor: zoom-in;
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s; }
.tile:hover img { transform: scale(1.045); }
.tile .tile-name {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 18px 9px 7px; font-size: 11.5px; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.62));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile .tile-menu {
  position: absolute; top: 7px; right: 7px;
  width: 28px; height: 28px; border-radius: 9px; border: 0;
  background: rgba(18,18,26,.5); color: #fff; backdrop-filter: blur(6px);
  display: grid; place-items: center; font-size: 15px; opacity: 0; transition: .16s;
}
.tile:hover .tile-menu, .tile .tile-menu:focus { opacity: 1; }
@media (hover: none) { .tile .tile-menu { opacity: .92; } }
.tile .tile-skel { width: 100%; height: 100%; background: linear-gradient(100deg, #eceef6 30%, #f6f7fb 50%, #eceef6 70%); background-size: 220% 100%; animation: sh 1.3s infinite; }
@keyframes sh { to { background-position: -220% 0; } }

/* 文件列表 */
.list { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 11px 13px; transition: .15s;
}
.row:hover { border-color: #d5d8e6; box-shadow: var(--shadow); }
.row-thumb {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 11px; overflow: hidden;
  background: var(--surface-2); display: grid; place-items: center; font-size: 19px;
}
.row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.row-main { flex: 1; min-width: 0; }
.row-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { color: var(--muted); font-size: 12px; margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; }
.row-actions { display: flex; gap: 4px; flex: 0 0 auto; }
.row-actions .icon-btn { width: 32px; height: 32px; font-size: 14px; }

/* 空状态 */
.empty { text-align: center; padding: 64px 20px; color: var(--muted); }
.empty-icon { font-size: 44px; margin-bottom: 12px; opacity: .5; }
.empty-title { font-weight: 700; color: var(--text-2); margin-bottom: 6px; font-size: 15px; }
.empty-desc { font-size: 13px; }

/* 上传按钮 */
.fab {
  position: fixed; right: 20px; bottom: 24px; z-index: 50;
  width: 58px; height: 58px; border-radius: 20px; border: 0;
  background: linear-gradient(135deg, var(--primary), #6f66ff); color: #fff;
  font-size: 27px; display: grid; place-items: center;
  box-shadow: 0 14px 30px -12px rgba(79,70,229,.95);
  transition: .18s;
}
.fab:hover { transform: translateY(-2px); }
.fab:active { transform: scale(.95); }
.fab-plus { line-height: 1; margin-top: -2px; }

.upload-toast {
  position: fixed; right: 20px; bottom: 94px; z-index: 60;
  width: min(280px, calc(100vw - 40px));
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow-lg);
}
.up-line { font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text-2); }
.up-bar { height: 5px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.up-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), #7c74ff); transition: width .25s; }

/* ---------- 灯箱 ---------- */
.lightbox { position: fixed; inset: 0; z-index: 120; background: rgba(12,13,18,.96); display: flex; flex-direction: column; overscroll-behavior: contain; }
.lb-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; color: #fff;
}
.lb-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .9; }
.lb-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.lb-btn {
  border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.08); color: #fff;
  border-radius: 9px; padding: 7px 13px; font-size: 13px; transition: .15s;
}
.lb-btn:hover { background: rgba(255,255,255,.18); }
.lb-btn.danger { border-color: rgba(255,120,120,.45); color: #ffb3b3; }
/* 图片查看区：交由 Pointer Events 接管手势，禁止页面跟着滚动 / 选中 / 回弹 */
.lb-stage {
  flex: 1; display: grid; place-items: center; padding: 0 16px 28px; min-height: 0;
  touch-action: none; user-select: none; -webkit-user-select: none;
  overscroll-behavior: contain;
  overflow: hidden; /* 放大后的图片裁在舞台内，别盖住顶部「地址/下载/删除/关闭」 */
}
.lb-stage img {
  max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px;
  transform-origin: center center; will-change: transform;
  -webkit-user-drag: none; user-drag: none;
}
/* 视频模式：把触摸手势还给原生播放器 */
.lightbox.vidmode .lb-stage { touch-action: auto; user-select: auto; -webkit-user-select: auto; }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 44px; height: 76px; border: 0; border-radius: 12px;
  background: rgba(255,255,255,.09); color: #fff; font-size: 30px; line-height: 1;
  display: grid; place-items: center; transition: .15s;
}
.lb-nav:hover { background: rgba(255,255,255,.2); }
.lb-nav.prev { left: 12px; }
.lb-nav.next { right: 12px; }
@media (max-width: 620px) {
  .lb-nav { width: 40px; height: 64px; font-size: 26px; }
  .lb-top { padding: 12px 12px calc(12px + env(safe-area-inset-top, 0px)); flex-wrap: wrap; }
  .lb-name { flex: 1 1 100%; }
  .lb-actions { gap: 6px; width: 100%; }
  .lb-btn { padding: 9px 12px; font-size: 13px; min-height: 40px; }
}

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 130; display: grid; place-items: center; padding: 18px; background: rgba(12,13,18,.42); backdrop-filter: blur(3px); }
.modal-card {
  width: 100%; max-width: 400px; background: var(--surface);
  border-radius: 18px; box-shadow: var(--shadow-lg); padding: 20px;
  max-height: 86vh; overflow: auto;
}
.modal-title { font-size: 16px; font-weight: 700; margin: 0 0 4px; }
.modal-sub { font-size: 12.5px; color: var(--muted); margin: 0 0 16px; }
.modal-body { display: flex; flex-direction: column; gap: 11px; }
.modal-actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 18px; }
.modal-actions .btn { min-width: 78px; }
.opt-list { display: flex; flex-direction: column; gap: 7px; max-height: 46vh; overflow: auto; }
.opt {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; background: #fbfbfd; text-align: left;
}
.opt.picked { border-color: var(--primary); background: var(--primary-soft); }
.opt-actions { display: flex; gap: 4px; }
.opt-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 条目详情 ---------- */
.info-thumb {
  border-radius: 13px; overflow: hidden; background: var(--surface-2);
  display: grid; place-items: center; min-height: 110px; max-height: 200px;
}
.info-thumb img { display: block; width: 100%; max-height: 200px; object-fit: contain; }
.info-list {
  display: flex; flex-direction: column; gap: 1px;
  background: var(--border); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden;
}
.info-row { display: flex; gap: 12px; padding: 9px 12px; background: var(--surface); font-size: 13px; }
.info-k { flex: 0 0 62px; color: var(--muted); }
.info-v { flex: 1; min-width: 0; word-break: break-all; }
.info-link {
  display: flex; flex-direction: column; gap: 8px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 12px; background: #fbfbfd;
}
.info-link-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 600; }
.info-tag { font-size: 11.5px; font-weight: 400; color: var(--muted); flex: 0 0 auto; }
.info-tip { margin: 0; font-size: 11.5px; color: var(--muted); line-height: 1.65; }
.info-url {
  width: 100%; border: 1px solid var(--border); border-radius: 9px;
  padding: 8px 10px; font-size: 12px; color: var(--text-2); background: var(--surface);
}
.info-btns { display: flex; gap: 8px; }
.info-btns .btn { flex: 0 0 auto; }

/* 分享链接定位到的那一行，短暂高亮 */
.row.hit {
  border-color: var(--primary);
  animation: row-hit 3s ease-out;
}
@keyframes row-hit {
  0% { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
  70% { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
  100% { background: var(--surface); box-shadow: inset 3px 0 0 transparent; }
}

/* ---------- 提示条 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 20px);
  z-index: 300; max-width: calc(100vw - 40px);
  background: #14161f; color: #fff; padding: 11px 17px; border-radius: 11px;
  font-size: 13.5px; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--danger); }

/* ---------- 上传方式选择 ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 175;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(20, 22, 31, .44);
  animation: cls-in .16s ease-out;
}
.sheet-card {
  width: 100%; max-width: 520px;
  background: var(--surface); border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  box-shadow: var(--shadow-lg);
  animation: cls-up .22s cubic-bezier(.2, .8, .3, 1);
}
.sheet-title { font-size: 15px; font-weight: 700; padding: 2px 4px 12px; }
.sheet-title span { color: var(--primary); }
.sheet-body { display: flex; flex-direction: column; gap: 8px; }
.src {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 11px 13px; border: 1px solid var(--border); border-radius: 13px;
  background: var(--surface); transition: .15s;
}
.src:hover { border-color: var(--primary); background: var(--primary-soft); }
.src-ico {
  flex: none; width: 38px; height: 38px; border-radius: 11px;
  background: var(--surface-2); display: grid; place-items: center; font-size: 19px;
}
.src-main { flex: 1; min-width: 0; }
.src-name { display: block; font-size: 14px; font-weight: 600; }
.src-desc { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.src-arrow { flex: none; color: var(--muted); font-size: 16px; }
.src.off { opacity: .5; cursor: not-allowed; }
.src.off .src-name { color: var(--muted); font-weight: 500; }
.src-hint {
  font-size: 11.5px; color: var(--muted); line-height: 1.65;
  padding: 11px 4px 12px; margin: 0;
}
.sheet #pickCancel { margin-top: 2px; }

/* 拖拽悬停提示 */
body.dropping::after {
  content: '松手即开始整理上传';
  position: fixed; inset: 12px; z-index: 200; pointer-events: none;
  border: 2px dashed var(--primary); border-radius: 18px;
  background: rgba(79, 70, 229, .06);
  display: grid; place-items: center;
  color: var(--primary); font-size: 15px; font-weight: 600;
}

/* ---------- 整理上传确认 ---------- */
.classify {
  position: fixed; inset: 0; z-index: 160;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(20, 22, 31, .44);
  animation: cls-in .18s ease-out;
}
@keyframes cls-in { from { opacity: 0 } to { opacity: 1 } }
.cls-sheet {
  width: 100%; max-width: 640px; max-height: 90vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: cls-up .22s cubic-bezier(.2, .8, .3, 1);
}
@keyframes cls-up { from { transform: translateY(14px); opacity: .6 } to { transform: none; opacity: 1 } }
.cls-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 18px 10px;
}
.cls-title { font-size: 16px; font-weight: 700; letter-spacing: .3px; }
.cls-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.cls-x {
  flex: none; width: 30px; height: 30px; border: 0; border-radius: 50%;
  background: var(--surface-2); color: var(--text-2); font-size: 13px; line-height: 1;
}
.cls-x:hover { background: var(--border); }

.cls-bars {
  display: flex; flex-direction: column; gap: 8px;
  padding: 2px 16px 10px; border-bottom: 1px solid var(--border);
}
.cls-bar { display: flex; align-items: center; gap: 10px; }
.cls-bar-label { flex: none; width: 56px; font-size: 12px; color: var(--muted); }
.cls-seg {
  display: inline-flex; gap: 2px; padding: 2px;
  background: var(--surface-2); border-radius: 10px;
}
.cls-seg button {
  border: 0; background: transparent; color: var(--text-2);
  font-size: 12.5px; padding: 6px 12px; border-radius: 8px; transition: .15s;
}
.cls-seg button.active {
  background: var(--surface); color: var(--primary); font-weight: 600;
  box-shadow: 0 1px 3px rgba(20, 22, 31, .13);
}
.cls-seg button:disabled { opacity: .4; cursor: not-allowed; }

.cls-list { flex: 1; overflow-y: auto; padding: 0 12px; -webkit-overflow-scrolling: touch; }

.cu { border-bottom: 1px solid var(--border); }
.cu:last-child { border-bottom: 0; }
.cu.busy { background: var(--primary-soft); }
.cu-row { display: flex; gap: 11px; align-items: flex-start; padding: 11px 6px; }
.cu-thumb {
  flex: none; width: 54px; height: 54px; border-radius: 10px; overflow: hidden;
  background: var(--surface-2); display: flex;
}
.cu-thumb img { width: 33.333%; height: 100%; object-fit: cover; display: block; }
.cu-thumb img:only-child { width: 100%; }
.cu-glyph { margin: auto; font-size: 19px; color: var(--muted); }
.cu-main { flex: 1; min-width: 0; }
.cu-title {
  font-size: 13.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cu-sub {
  font-size: 11.5px; color: var(--muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cu-badge {
  display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 6px;
  font-size: 10.5px; font-weight: 500; vertical-align: 1px;
  background: var(--primary-soft); color: var(--primary);
}
.cu-badge.file { background: #eaf6ec; color: #2f7d3a; }
.cu-badge.new { background: #fff4e5; color: #b45309; }

.cu-main select, .cu-frow select {
  margin-top: 7px; width: 100%; padding: 7px 26px 7px 9px;
  border: 1px solid var(--border); border-radius: 9px;
  background-color: #fbfbfd; color: var(--text); font-size: 13px;
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.cu-main select:focus, .cu-frow select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.cu-exp {
  flex: none; align-self: center; padding: 5px 9px;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); color: var(--text-2); font-size: 12px;
}
.cu-exp:hover { border-color: var(--primary); color: var(--primary); }

.cu-detail { padding: 4px 6px 10px 68px; background: #fbfbfd; }
.cu-frow { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.cu-frow select {
  margin: 0; flex: none; width: 138px; font-size: 12px;
  padding: 5px 22px 5px 8px;
  background-position: calc(100% - 12px) 12px, calc(100% - 7px) 12px;
}
.cu-frow select.picked { border-color: var(--primary); background-color: var(--primary-soft); color: var(--primary); }
.cu-fname {
  flex: 1; min-width: 0; font-size: 12px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cu-fname i { color: var(--muted); font-style: normal; }
.cu-more { font-size: 11.5px; color: var(--muted); padding: 5px 0 0; }

.cls-note {
  margin: 0; padding: 9px 18px 0; font-size: 11.5px; color: var(--muted); line-height: 1.6;
}
.cls-foot {
  display: flex; gap: 8px; align-items: center;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border); background: var(--surface);
}
.cls-foot .btn { flex: 1; white-space: nowrap; }
.cls-foot .btn.primary { flex: 1.5; }

/* ---------- 上传进度上的「停止」 ---------- */
.up-line { display: flex; align-items: center; gap: 10px; }
.up-line #upText { flex: 1; min-width: 0; }
.up-stop {
  flex: none; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text-2);
  font-size: 11.5px; padding: 3px 9px;
}
.up-stop:hover { border-color: var(--danger); color: var(--danger); }

/* ---------- 搜索 ---------- */
.searchbar {
  display: flex; gap: 8px; align-items: center;
  padding: 6px 16px 6px; max-width: 1180px; width: 100%; margin: 0 auto;
}
.search-box { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; }
.search-ico { position: absolute; left: 12px; font-size: 13px; opacity: .5; pointer-events: none; }
.search-box input {
  width: 100%; padding: 9px 36px 9px 33px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  color: var(--text); outline: none; transition: .15s;
}
.search-box input::placeholder { color: var(--muted); }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.search-clear {
  position: absolute; right: 6px; width: 24px; height: 24px; border: 0; border-radius: 50%;
  background: var(--surface-2); color: var(--text-2); font-size: 11px; line-height: 1;
  display: grid; place-items: center;
}
.search-clear:hover { background: var(--border); }

.search-seg {
  flex: 0 0 auto; display: inline-flex; gap: 2px; padding: 2px;
  background: var(--surface-2); border-radius: 999px;
}
.search-seg button {
  border: 0; background: transparent; color: var(--text-2);
  font-size: 12.5px; padding: 7px 12px; border-radius: 999px; transition: .15s; white-space: nowrap;
}
.search-seg button.active {
  background: var(--surface); color: var(--primary); font-weight: 600;
  box-shadow: 0 1px 3px rgba(20, 22, 31, .13);
}

.search-stat {
  display: flex; align-items: center; gap: 10px;
  width: calc(100% - 32px); max-width: 1148px; margin: 2px auto 10px;
  padding: 8px 12px; border: 1px solid #cdd1ff; background: var(--primary-soft);
  color: var(--primary); border-radius: var(--radius-sm); font-size: 12.5px;
}
.search-stat.err { border-color: #f6c9c9; background: var(--danger-soft); color: var(--danger); }
.ss-text { flex: 1; min-width: 0; line-height: 1.55; }
.ss-clear {
  flex: 0 0 auto; border: 1px solid currentColor; background: transparent; color: inherit;
  border-radius: 999px; font-size: 11.5px; padding: 3px 10px;
}
.ss-spin {
  display: inline-block; width: 11px; height: 11px; margin-right: 7px; vertical-align: -1px;
  border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* AI 识别结果（详情面板） */
.info-ai {
  border: 1px solid #cdd1ff; background: var(--primary-soft);
  border-radius: var(--radius-sm); padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.info-ai-head { font-size: 12.5px; font-weight: 600; color: var(--primary); }
.info-ai-desc { font-size: 12.5px; color: var(--text-2); line-height: 1.6; }
.info-ai-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.info-ai-tags span {
  background: var(--surface); border: 1px solid #cdd1ff; color: var(--primary);
  border-radius: 999px; padding: 2px 9px; font-size: 11.5px;
}

@media (min-width: 700px) {
  .classify, .sheet { align-items: center; padding: 26px; }
  .cls-sheet { border-radius: 18px; max-height: 80vh; }
  .sheet-card { border-radius: 18px; }
}

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

/* 分类条上的数量 */
.chip-n {
  font-style: normal; margin-left: 6px; padding: 1px 6px;
  font-size: 11.5px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
}
.chip.active .chip-n { background: rgba(79,70,229,.14); color: var(--primary); }
.chip.sub .chip-n { background: #fff; }

/* 相册格子上的选择圈 */
.tile .tile-check {
  position: absolute; top: 7px; left: 7px; z-index: 3;
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.92); background: rgba(18,18,26,.34);
  backdrop-filter: blur(4px);
  display: none; place-items: center;
  color: #fff; font-size: 12.5px; line-height: 1;
}
.selmode .tile .tile-check { display: grid; }
.selmode .tile .tile-menu { display: none; }
.selmode .tile { cursor: pointer; }
.tile.on .tile-check { background: var(--primary); border-color: #fff; }
.tile.on .tile-check::after { content: '✓'; }
.tile.on img { transform: scale(.93); }
.tile.on::after {
  content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  border: 3px solid var(--primary); border-radius: var(--radius);
}

/* 资料列表上的选择圈 */
.row .row-check {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--border); background: var(--surface);
  display: none; place-items: center; color: #fff; font-size: 12.5px; line-height: 1;
}
.selmode .row .row-check { display: grid; }
.selmode .row { cursor: pointer; }
.selmode .row-actions { display: none; }
.row.on { border-color: #cdd1ff; background: var(--primary-soft); }
.row.on .row-check { background: var(--primary); border-color: var(--primary); }
.row.on .row-check::after { content: '✓'; }

/* 底部多选操作条 */
.selbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(255,255,255,.96);
  backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -12px 30px -20px rgba(20,22,31,.5);
}
.selbar-info { display: flex; align-items: baseline; gap: 8px; max-width: 1180px; width: 100%; margin: 0 auto; }
.selbar-info b { font-size: 14px; }
.selbar-info span { color: var(--muted); font-size: 12.5px; }
.selbar-actions { display: flex; gap: 8px; flex-wrap: wrap; max-width: 1180px; width: 100%; margin: 0 auto; }
.selbar-actions .btn { flex: 1 1 auto; min-width: 74px; white-space: nowrap; }

/* 整理上传面板：自动归类没把握的那几张 */
.cu.need { border-color: #f0cf8d; background: #fffdf5; }
.cu-badge.warn { background: #fff2d3; color: #9a6400; }

/* ============ 资料页：电脑式文件夹浏览 ============ */
.catbar.pathbar { flex-direction: column; align-items: stretch; gap: 7px; overflow: visible; }
.crumbs { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; width: 100%; }
.crumb {
  border: 0; background: transparent; color: var(--text-2);
  padding: 4px 8px; border-radius: 8px; font-size: 13.5px;
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
}
.crumb:hover { background: var(--surface-2); }
.crumb.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.crumb-n { font-size: 11.5px; color: var(--muted); font-style: normal; }
.crumb.active .crumb-n { color: var(--primary); }
.crumb-sep { color: var(--muted); font-size: 13px; }
.path-acts { display: flex; gap: 8px; flex-wrap: wrap; }

.fm { display: flex; gap: 16px; align-items: flex-start; }
.fm-body { flex: 1; min-width: 0; }
.dir-tree {
  flex: 0 0 216px; max-height: calc(100vh - 250px); overflow: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px; position: sticky; top: 8px;
}
.dt-node {
  display: flex; align-items: center; gap: 6px; width: 100%; text-align: left;
  border: 0; background: transparent; color: var(--text-2);
  padding: 6px 9px; border-radius: var(--radius-sm); font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dt-node:hover { background: var(--surface-2); }
.dt-node.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.dt-n { margin-left: auto; font-size: 11.5px; color: var(--muted); font-style: normal; }

.fm-sec { font-size: 12px; color: var(--muted); font-weight: 600; padding: 14px 2px 8px; letter-spacing: .03em; }
.folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 8px; }
.folder {
  display: flex; align-items: center; gap: 8px; position: relative;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 11px 12px; cursor: pointer; transition: .15s;
}
.folder:hover { border-color: #cdd1ff; box-shadow: var(--shadow); }
.folder-ico { font-size: 17px; flex: 0 0 auto; }
.folder-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-n { margin-left: auto; font-size: 11.5px; color: var(--muted); flex: 0 0 auto; }
.folder-menu {
  position: absolute; right: 3px; top: 50%; transform: translateY(-50%);
  border: 0; background: var(--surface); color: var(--muted);
  width: 28px; height: 28px; border-radius: 8px; opacity: 0; transition: .15s;
}
.folder:hover .folder-menu, .folder-menu:focus { opacity: 1; }
@media (hover: none) { .folder-menu { opacity: .9; } .folder-n { display: none; } }
.fm-empty { color: var(--muted); font-size: 13px; padding: 18px 2px; }
.row-path { color: var(--muted); }

/* 相册里的视频 */
.tile { position: relative; }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; background: #0c0d12; }
/* 视频占位块：网格里不加载视频本体，只显示一块底色 + 体积标签，
   点开灯箱才真正去读视频（避免首页一次性拉几百 MB） */
.tile .tile-vph {
  width: 100%; height: 100%; display: grid; place-items: center;
  background:
    radial-gradient(circle at 30% 24%, rgba(255,255,255,.10), transparent 46%),
    linear-gradient(152deg, #2b3348 0%, #1a1f2d 56%, #0e1119 100%);
}
/* 体积标签放在播放按钮正下方，避开左上角的「未分类」徽标和底部的文件名 */
.tile .tile-vph-size {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, 26px);
  font-size: 10.5px; font-variant-numeric: tabular-nums; letter-spacing: .01em;
  color: rgba(255,255,255,.72); white-space: nowrap;
}
.tile .tile-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 40px; height: 40px; border-radius: 50%; padding-left: 3px;
  background: rgba(12, 13, 18, .5); color: #fff; font-size: 15px;
  display: grid; place-items: center; pointer-events: none;
}
.selmode .tile .tile-play { display: none; }
.lb-stage video { max-width: 100%; max-height: 100%; border-radius: 8px; background: #000; }

/* 确认归类面板 */
.review {
  position: fixed; inset: 0; z-index: 126; display: grid; place-items: center;
  padding: 14px; background: rgba(12, 13, 18, .42); backdrop-filter: blur(3px);
}
.rev-sheet {
  background: var(--surface); border-radius: 18px; width: 100%; max-width: 720px;
  max-height: 86vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
}
.rev-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 16px 10px; }
.rev-title { font-size: 16px; font-weight: 700; }
.rev-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.rev-list { flex: 1; overflow: auto; padding: 0 16px; display: flex; flex-direction: column; gap: 8px; }
.rev-row { display: flex; align-items: center; gap: 11px; background: var(--surface-2); border-radius: var(--radius); padding: 9px 11px; }
.rev-thumb {
  flex: 0 0 auto; width: 48px; height: 48px; border-radius: 10px; overflow: hidden;
  background: var(--surface); display: grid; place-items: center;
}
.rev-thumb img { width: 100%; height: 100%; object-fit: cover; }
.rev-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.rev-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rev-sel, .rev-new {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 7px 9px; background: var(--surface); color: var(--text); font-size: 13px;
}
.rev-foot { display: flex; gap: 9px; justify-content: flex-end; padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px)); }
.rev-foot .btn { min-width: 92px; }
@media (max-width: 560px) { .rev-sheet { max-height: 90vh; border-radius: 16px; } }

/* 危险操作区 */
.danger-zone { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--border); }
.danger-title { font-size: 12px; font-weight: 700; color: var(--danger); margin-bottom: 8px; letter-spacing: .03em; }
.danger-tip { font-size: 11.5px; color: var(--muted); margin: 8px 0 0; }

/* =====================================================================
 * 本机设置面板
 * ===================================================================== */
.set-sec { padding: 14px 0; border-bottom: 1px solid #eef0f6; }
.set-sec:first-child { padding-top: 4px; }
.set-sec:last-child { border-bottom: 0; padding-bottom: 0; }
.set-h { font-size: 13px; font-weight: 600; color: #2f3446; margin-bottom: 8px; }
.set-path {
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 12px; line-height: 1.5; color: #414659;
  background: #f4f5fa; border: 1px solid #e8eaf3; border-radius: 8px;
  padding: 8px 10px; margin-bottom: 8px; word-break: break-all;
}
.set-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }
.set-note { font-size: 12px; line-height: 1.65; color: #7b8095; margin-top: 4px; }
.set-drives { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 2px; }
.set-drives .chip {
  border: 1px solid #d9dcea; background: #fff; color: #414659;
  border-radius: 999px; padding: 4px 11px; font-size: 12px; cursor: pointer;
  font-family: ui-monospace, Consolas, monospace;
}
.set-drives .chip:hover { border-color: #b9bfd6; background: #f7f8fc; }

/* ============ 增量渲染：列表末尾的「加载更多」哨兵 ============
 * 条目按批渲染，DOM 里先插这个哨兵，滚动到它就再渲染下一批。
 * 它只用于触发加载，所以做得很轻（不占视觉重量）。
 * ---------------------------------------------------------- */
.render-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .02em;
  user-select: none;
}
.render-more::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--muted);
  border-radius: 50%;
  animation: render-more-spin .8s linear infinite;
}
@keyframes render-more-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .render-more::before { animation: none; }
}

/* ============ 移动端触摸优化（手指点得到、不被底栏吃掉） ============ */
/* 底部悬浮按钮与上传进度条避开手机浏览器的底栏 / 手势条 */
.fab { bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
.upload-toast { bottom: calc(94px + env(safe-area-inset-bottom, 0px)); }

/* 触摸设备（手机 / 平板）：把「更多」「下载」等小按钮放大到好点，
   并给文件夹的「⋯」留出位置，避免压住文件名 */
@media (hover: none), (pointer: coarse) {
  .icon-btn { width: 40px; height: 40px; font-size: 16px; }
  .tile .tile-menu { width: 34px; height: 34px; font-size: 17px; opacity: .94; }
  .folder-menu { width: 34px; height: 34px; font-size: 17px; opacity: .92; }
  .folder { padding-right: 46px; }
  .row-actions { gap: 6px; }
  .row-actions .icon-btn { width: 40px; height: 40px; font-size: 16px; }
  .selbar .btn { min-height: 42px; }
  /* 长按由脚本弹出「更多菜单」，这里关掉系统长按菜单，免得两个菜单打架 */
  .tile, .row, .folder, .tile img, .row-thumb img { -webkit-touch-callout: none; }
}
