/* MagicDrop —— 视觉参考 TikTok 深色模式 */

/* 本地字体：把 TikTok Sans 字体文件放进 static/fonts/，服务器会自动以 "TikTok Sans Local" 引用 */

:root {
  --bg: #121212;
  --bar: #121212;
  --raise: #252525;
  --surface: rgba(255, 255, 255, .06);
  --surface-2: rgba(255, 255, 255, .1);
  --surface-3: rgba(255, 255, 255, .16);
  --line: rgba(255, 255, 255, .12);
  --line-2: rgba(255, 255, 255, .24);
  --text: #fff;
  --text-2: rgba(255, 255, 255, .75);
  --text-3: rgba(255, 255, 255, .5);
  --red: #fe2c55;
  --red-2: #e0234a;
  --cyan: #25f4ee;
  --font: "TikTok Sans Local", "TikTok Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Microsoft YaHei Mono", monospace;
  --top: 60px;
  --side: 240px;
  --tabbar: 0px;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; opacity: .4; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- 品牌字：青红错位 ---------- */
.brand {
  font-weight: 900;
  font-size: 24px;
  letter-spacing: -.01em;
  line-height: 1;
  text-shadow: -2px -1px 0 var(--cyan), 2px 1px 0 var(--red);
  white-space: nowrap;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 4px;
  font-weight: 600; font-size: 15px; white-space: nowrap;
  transition: background-color .15s;
}
.btn svg { flex: none; }
.btn.primary { background: var(--red); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--red-2); }
.btn.gray { background: var(--surface-2); }
.btn.gray:hover:not(:disabled) { background: var(--surface-3); }
.btn.outline { border: 1px solid var(--line); }
.btn.outline:hover { background: var(--surface); }
.btn.danger { color: var(--red); }
.btn.big { height: 44px; font-size: 16px; padding: 0 22px; }
.btn.block { width: 100%; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-grid; place-items: center; color: var(--text);
  transition: background-color .15s;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.on { background: var(--surface-2); }

/* ---------- 头像：名字首字 + 青红错位 ---------- */
.avatar {
  flex: none; width: 32px; height: 32px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: #2f2f2f; color: #fff; font-weight: 800; font-size: 15px; line-height: 1;
  text-shadow: -1px -1px 0 var(--cyan), 1px 1px 0 var(--red); user-select: none;
}
.avatar.sm { width: 26px; height: 26px; font-size: 12px; }
.avatar.xs { width: 26px; height: 26px; font-size: 12px; }
.avatar.xl { width: 112px; height: 112px; font-size: 48px; text-shadow: -3px -2px 0 var(--cyan), 3px 2px 0 var(--red); }
.avatar-btn { border-radius: 50%; padding: 4px; display: inline-grid; }

/* ---------- 顶栏 ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  height: var(--top); display: flex; align-items: center; gap: 24px;
  padding: 0 16px 0 20px; background: var(--bar);
  border-bottom: 1px solid var(--line);
}
.top .brand { width: calc(var(--side) - 44px); }
.search {
  flex: 0 1 520px; margin: 0 auto;
  height: 46px; display: flex; align-items: center;
  border-radius: 92px; background: var(--surface-2);
  border: 1px solid transparent; padding-left: 16px;
  transition: border-color .15s;
}
.search:focus-within { border-color: var(--line-2); }
.search input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: none;
  font-size: 16px; caret-color: var(--red);
}
.search input::placeholder { color: var(--text-3); }
.search input::-webkit-search-cancel-button { display: none; }
.search .sep { width: 1px; height: 28px; background: var(--line); }
.search .go { width: 52px; height: 100%; display: grid; place-items: center; color: var(--text-3); border-radius: 0 92px 92px 0; }
.search .go:hover { background: var(--surface); color: var(--text); }
.top-right { display: flex; align-items: center; gap: 8px; }

/* ---------- 侧栏 ---------- */
.layout { display: flex; min-height: calc(100vh - var(--top)); }
.side {
  position: sticky; top: var(--top); align-self: flex-start;
  width: var(--side); flex: none; height: calc(100vh - var(--top));
  padding: 16px 12px 20px; display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  height: 48px; padding: 0 10px; border-radius: 4px;
  font-size: 18px; font-weight: 700;
}
.nav-item:hover { background: var(--surface); }
.nav-item.on { color: var(--red); }
.nav-item .count { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--text-3); }
.side hr { border: 0; border-top: 1px solid var(--line); margin: 12px 10px; }
.side .label { font-size: 14px; color: var(--text-3); padding: 0 10px; font-weight: 600; }
.meter { padding: 8px 10px 0; }
.meter b { font-size: 17px; font-weight: 700; }
.meter .bar { height: 4px; border-radius: 2px; background: var(--surface-2); margin: 10px 0 8px; overflow: hidden; }
.meter .bar i { display: block; height: 100%; background: var(--cyan); border-radius: 2px; }
.meter small { color: var(--text-3); font-size: 13px; }

/* ---------- 主区域 ---------- */
main { flex: 1; min-width: 0; padding: 20px 32px 120px; }
.head { margin: 4px 0 20px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; color: var(--text-3); font-size: 14px; font-weight: 600; margin-bottom: 6px; min-height: 22px; }
.crumbs button { padding: 2px 4px; border-radius: 4px; }
.crumbs button:hover { color: var(--text); background: var(--surface); }
.crumbs svg { opacity: .6; }
.profile { display: flex; align-items: center; gap: 24px; }
.profile .who { min-width: 0; }
.profile .title { margin-bottom: 2px; }
.handle { font-size: 18px; font-weight: 600; color: var(--text-2); margin-bottom: 12px; }
.title { font-size: 32px; font-weight: 800; line-height: 1.2; margin: 0 0 10px; letter-spacing: -.01em; word-break: break-all; }
.stats { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 16px; color: var(--text-3); }
.stats b { color: var(--text); font-weight: 700; margin-right: 6px; }
.actions { display: flex; align-items: center; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.actions .spacer { flex: 1; }
.sort-btn { display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 10px; border-radius: 4px; color: var(--text-2); font-weight: 600; }
.sort-btn:hover { background: var(--surface); color: var(--text); }

.selbar {
  position: sticky; top: calc(var(--top) + 8px); z-index: 10;
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  min-height: 56px; padding: 8px 8px 8px 16px; margin-top: 18px;
  background: var(--raise); border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .45);
}
.selbar .n { font-weight: 700; font-size: 16px; margin-right: auto; }
.selbar .btn { height: 36px; padding: 0 12px; }

.tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  position: relative; flex: none; height: 44px; padding: 0 22px;
  font-size: 17px; font-weight: 600; color: var(--text-3);
}
.tabs button:hover { color: var(--text-2); }
.tabs button.on { color: var(--text); }
.tabs button.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--text); }

.section-label { font-size: 15px; font-weight: 700; color: var(--text-2); margin: 0 0 12px; }

/* 文件夹块 */
.folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 28px; }
.folder {
  position: relative; display: flex; align-items: center; gap: 12px;
  height: 64px; padding: 0 12px 0 14px; border-radius: 8px;
  background: var(--surface); cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: background-color .15s;
}
.folder:hover { background: var(--surface-2); }
.folder .fi { flex: none; color: var(--text); }
.folder .txt { min-width: 0; flex: 1; }
.folder .nm { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder .ct { font-size: 13px; color: var(--text-3); }
.folder .ck { position: static; flex: none; }

/* 竖版网格（TikTok 主页视频墙） */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 16px 12px; }
.card {
  position: relative; aspect-ratio: 3 / 4; border-radius: 4px; overflow: hidden;
  background: var(--surface); cursor: pointer; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.card .thumb { position: absolute; inset: 0; display: flex; }
.card .thumb img, .card .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.card .shade { position: absolute; left: 0; right: 0; bottom: 0; height: 45%; background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, .7)); pointer-events: none; }
.card .cap { position: absolute; left: 10px; right: 10px; bottom: 9px; pointer-events: none; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.card .cap .nm { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .cap .mt { display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, .9); margin-top: 1px; }
.card .play { position: absolute; top: 10px; left: 10px; color: #fff; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .6)); }
.badge { position: absolute; inset: 0; padding: 14px 12px; display: flex; flex-direction: column; }
.badge .ext { font-size: 30px; font-weight: 900; letter-spacing: -.02em; line-height: 1; word-break: break-all; }
.badge .kind { font-size: 13px; color: var(--text-3); font-weight: 600; margin-top: 6px; }
.card.k-pdf .badge .ext, .row .ic.k-pdf { color: #ff6b81; }
.card.k-archive .badge .ext { color: #ffd166; }
.card.k-audio .badge .ext { color: var(--cyan); }

/* 选择圈 */
.ck {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  border: 2px solid rgba(255, 255, 255, .9); background: rgba(0, 0, 0, .25); color: transparent;
  opacity: 0; transition: opacity .12s;
  pointer-events: auto;
}
.card:hover .ck, .folder:hover .ck, .row:hover .ck, .selecting .ck, .ck:focus-visible { opacity: 1; }
.sel .ck { background: var(--cyan); border-color: var(--cyan); color: #000; opacity: 1; }
.card.sel::after, .folder.sel::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: inset 0 0 0 3px var(--cyan); pointer-events: none;
}
.card.sel .thumb { opacity: .82; }

/* 列表视图 */
.list { border-top: 1px solid var(--line); }
.row {
  position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr) 110px 130px 40px;
  align-items: center; gap: 12px; min-height: 58px; padding: 0 8px;
  border-bottom: 1px solid var(--line); cursor: pointer; user-select: none;
}
.row:hover { background: var(--surface); }
.row.sel { background: rgba(37, 244, 238, .08); }
.row.hdr { min-height: 40px; cursor: default; color: var(--text-3); font-size: 13px; font-weight: 600; }
.row.hdr:hover { background: none; }
.row.hdr button { text-align: left; display: inline-flex; align-items: center; gap: 2px; }
.row.hdr button:hover { color: var(--text); }
.row .ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 4px; background: var(--surface-2); font-size: 10px; font-weight: 900; overflow: hidden; }
.row .ic img { width: 100%; height: 100%; object-fit: cover; }
.row .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub { font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .c { color: var(--text-2); font-size: 14px; white-space: nowrap; }
.row .ck { position: absolute; left: 13px; top: 50%; margin-top: -13px; }
.row.wide { grid-template-columns: 40px minmax(0, 1fr) auto; }
.row .row-actions { display: flex; gap: 6px; align-items: center; }
.row .row-actions .btn { height: 32px; padding: 0 12px; font-size: 14px; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 6px; border-radius: 2px; background: var(--surface-2); color: var(--text-2); margin-left: 8px; vertical-align: 1px; }
.tag.red { background: rgba(254, 44, 85, .15); color: #ff6b81; }

/* 空状态 / 加载 */
.empty { text-align: center; padding: 72px 16px; color: var(--text-3); }
.empty .big { font-size: 22px; font-weight: 700; color: var(--text); margin: 16px 0 8px; }
.empty .btn { margin-top: 20px; }
.empty svg { color: var(--text-3); }
.skel { background: var(--surface); border-radius: 4px; aspect-ratio: 3 / 4; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.err-box { padding: 16px; border-radius: 8px; background: rgba(254, 44, 85, .1); color: #ff8098; display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }

/* ---------- 拖拽上传遮罩 ---------- */
.drop {
  position: fixed; inset: 0; z-index: 60; display: none;
  flex-direction: column; align-items: center; justify-content: center; text-align: center;
  background: rgba(0, 0, 0, .86); pointer-events: none; padding: 24px;
}
.drop.on { display: flex; }
.drop::before { content: ""; position: absolute; inset: 16px; border: 2px dashed var(--line-2); border-radius: 12px; }
.drop .big {
  font-size: clamp(44px, 9vw, 112px); font-weight: 900; line-height: 1.05; letter-spacing: -.02em;
  text-shadow: -4px -2px 0 var(--cyan), 4px 2px 0 var(--red);
  animation: jitter .9s steps(2) infinite;
}
.drop .sub { margin-top: 20px; font-size: 18px; color: var(--text-2); font-weight: 600; }
@keyframes jitter {
  50% { text-shadow: -5px -1px 0 var(--cyan), 5px 1px 0 var(--red); }
}

/* ---------- 上传面板 ---------- */
.up-panel {
  position: fixed; right: 24px; bottom: 24px; z-index: 40;
  width: 380px; max-width: calc(100vw - 16px);
  background: var(--raise); border-radius: 8px; overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .55);
}
.up-head { display: flex; align-items: center; gap: 4px; height: 54px; padding: 0 8px 0 16px; }
.up-head .t { flex: 1; font-weight: 700; font-size: 16px; }
.up-total { height: 2px; background: var(--surface-2); }
.up-total i { display: block; height: 100%; background: var(--cyan); transition: width .2s; }
.up-list { max-height: 300px; overflow-y: auto; }
.up-panel.min .up-list { display: none; }
.up-item { display: grid; grid-template-columns: minmax(0, 1fr) 32px; gap: 4px 8px; align-items: center; padding: 10px 8px 10px 16px; border-top: 1px solid var(--line); }
.up-item .nm { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-item .st { font-size: 12px; color: var(--text-3); grid-column: 1; }
.up-item .st.err { color: #ff6b81; }
.up-item .st.ok { color: var(--cyan); }
.up-item .bar { grid-column: 1; height: 3px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.up-item .bar i { display: block; height: 100%; background: var(--cyan); }
.up-item .act { grid-row: 1 / span 3; grid-column: 2; }
.up-item .act .icon-btn { width: 32px; height: 32px; color: var(--text-2); }

/* ---------- 全屏预览（TikTok 播放页） ---------- */
.viewer { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; }
.viewer .stage { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 0 168px; touch-action: pan-x pinch-zoom; }
.viewer .stage > img, .viewer .stage > video { max-width: 100%; max-height: 100vh; max-height: 100dvh; object-fit: contain; display: block; }
.viewer .stage > iframe { width: 100%; height: 100vh; border: 0; background: #fff; }
.viewer .stage .textview {
  width: min(880px, 100%); height: calc(100vh - 140px); overflow: auto; margin: 0;
  padding: 20px 24px; border-radius: 8px; background: #181818; color: #eaeaea;
  font-family: var(--mono); font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
  touch-action: pan-y;
}
.viewer .stage .audio { display: flex; flex-direction: column; align-items: center; gap: 28px; width: min(420px, 100%); }
.disc { width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, #121212 0 18%, #2a2a2a 19% 21%, #1a1a1a 22% 100%); display: grid; place-items: center; animation: spin 8s linear infinite; box-shadow: 0 0 0 6px #222; }
.disc::after { content: ""; width: 36px; height: 36px; border-radius: 50%; background: var(--red); box-shadow: -3px 0 0 var(--cyan); }
.viewer .audio audio { width: 100%; }
@keyframes spin { to { transform: rotate(360deg); } }
.viewer .noprev { text-align: center; }
.viewer .noprev .ext { font-size: 72px; font-weight: 900; text-shadow: -3px -2px 0 var(--cyan), 3px 2px 0 var(--red); line-height: 1; }
.viewer .noprev p { color: var(--text-2); margin: 20px 0 24px; font-size: 16px; }
.viewer .x { position: absolute; top: 20px; left: 20px; z-index: 3; width: 44px; height: 44px; background: rgba(255, 255, 255, .12); }
.viewer .x:hover { background: rgba(255, 255, 255, .2); }
.viewer .caption {
  position: absolute; left: 24px; bottom: 24px; z-index: 2; max-width: min(560px, calc(100% - 140px));
  text-shadow: 0 1px 3px rgba(0, 0, 0, .7); pointer-events: none;
}
.viewer .caption h2 { margin: 0 0 4px; font-size: 18px; font-weight: 700; word-break: break-all; }
.viewer .caption p { margin: 0; font-size: 14px; color: var(--text-2); display: flex; gap: 14px; flex-wrap: wrap; }
.viewer .rail { position: absolute; right: 92px; bottom: 40px; z-index: 2; display: flex; flex-direction: column; gap: 16px; align-items: center; }
.rail-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.rail-btn span:first-child { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .12); color: #fff; transition: background-color .15s; }
.rail-btn:hover span:first-child { background: rgba(255, 255, 255, .22); }
.rail-btn.danger span:first-child { color: var(--red); }
.viewer .nav { position: absolute; right: 20px; top: 50%; transform: translateY(-50%); z-index: 2; display: flex; flex-direction: column; gap: 16px; }
.viewer .nav .icon-btn { width: 48px; height: 48px; background: rgba(255, 255, 255, .12); }
.viewer .nav .icon-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .22); }

/* ---------- 弹窗 ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .6); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal {
  position: relative; width: min(420px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--raise); border-radius: 8px; padding: 32px 24px 24px;
  animation: pop .16s ease-out;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.modal h2 { margin: 0 0 6px; font-size: 22px; font-weight: 700; text-align: center; }
.modal .lead { margin: 0 0 20px; text-align: center; color: var(--text-3); font-size: 15px; word-break: break-all; }
.modal .x { position: absolute; top: 12px; right: 12px; }
.modal .row-btns { display: flex; gap: 12px; margin-top: 24px; }
.modal .row-btns .btn { flex: 1; height: 44px; font-size: 16px; }
.input {
  width: 100%; height: 46px; padding: 0 14px; border-radius: 4px;
  background: var(--surface-2); border: 1px solid transparent; outline: none; font-size: 16px; caret-color: var(--red);
}
.input:focus { border-color: var(--line-2); }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 14px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.form-err { color: #ff6b81; font-size: 14px; min-height: 20px; margin-top: 8px; }
.picker { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.picker .where { display: flex; align-items: center; gap: 4px; padding: 10px 12px; font-size: 14px; font-weight: 600; color: var(--text-2); border-bottom: 1px solid var(--line); min-height: 44px; flex-wrap: wrap; }
.picker .where button:hover { color: var(--text); }
.picker ul { list-style: none; margin: 0; padding: 4px 0; height: 240px; overflow-y: auto; }
.picker li button { width: 100%; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 12px; text-align: left; font-weight: 600; }
.picker li button:hover { background: var(--surface); }
.picker li button span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker .none { color: var(--text-3); padding: 16px 12px; font-size: 14px; }

/* ---------- 菜单 ---------- */
.menu {
  position: fixed; z-index: 80; min-width: 210px; padding: 8px 0;
  background: var(--raise); border-radius: 8px; box-shadow: 0 10px 36px rgba(0, 0, 0, .55);
  animation: pop .12s ease-out;
}
.menu button { width: 100%; display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 16px; font-size: 15px; font-weight: 600; text-align: left; }
.menu button:hover, .menu button:focus-visible { background: var(--surface); outline: none; }
.menu .danger { color: var(--red); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.sheet-bg { position: fixed; inset: 0; z-index: 79; background: rgba(0, 0, 0, .5); }

/* ---------- 提示 ---------- */
.toasts { position: fixed; left: 50%; top: 76px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 16px;
  padding: 12px 18px; border-radius: 4px; background: #333; color: #fff;
  font-size: 15px; font-weight: 600; box-shadow: 0 6px 20px rgba(0, 0, 0, .4);
  animation: pop .16s ease-out; max-width: calc(100vw - 32px);
}
.toast button { color: var(--cyan); font-weight: 700; }
.toast.err { background: #3a1c22; }

/* ---------- 登录 ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login form { width: min(360px, 100%); }
.login .brand { display: block; text-align: center; font-size: clamp(44px, 14vw, 64px); letter-spacing: -.02em; text-shadow: -4px -2px 0 var(--cyan), 4px 2px 0 var(--red); margin-bottom: 18px; }
.login .lead { text-align: center; color: var(--text-3); margin: 0 0 32px; font-size: 16px; }
.login .input { height: 50px; }
.login .btn { margin-top: 12px; height: 50px; font-size: 17px; }
.recent-names { margin-top: 32px; text-align: center; }
.recent-names .label { display: block; font-size: 14px; color: var(--text-3); font-weight: 600; margin-bottom: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px 0 7px; border-radius: 20px; background: var(--surface-2); font-weight: 600; max-width: 100%; }
.chip span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip:hover { background: var(--surface-3); }
.login .hint { text-align: center; color: var(--text-3); font-size: 13px; margin: 28px 0 0; }

/* ---------- 手机底栏 ---------- */
.tabbar { display: none; }
.plus { position: relative; width: 46px; height: 30px; display: block; }
.plus::before, .plus::after { content: ""; position: absolute; top: 0; bottom: 0; width: 38px; border-radius: 8px; }
.plus::before { left: 0; background: var(--cyan); }
.plus::after { right: 0; background: var(--red); }
.plus i { position: absolute; z-index: 1; left: 4px; right: 4px; top: 0; bottom: 0; border-radius: 8px; background: #fff; color: #000; display: grid; place-items: center; }

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  :root { --side: 200px; }
  .nav-item { font-size: 16px; }
  .top { gap: 16px; }
}
@media (max-width: 767px) {
  :root { --top: 56px; --tabbar: calc(56px + env(safe-area-inset-bottom)); }
  .top { gap: 12px; padding: 0 12px; }
  .top .brand { width: auto; font-size: 22px; }
  .search { height: 40px; margin: 0; flex: 1; }
  .search .go { width: 44px; }
  .top-right { display: none; }
  .side { display: none; }
  main { padding: 12px 12px calc(var(--tabbar) + 100px); }
  .title { font-size: 26px; }
  .avatar.xl { width: 76px; height: 76px; font-size: 32px; text-shadow: -2px -1px 0 var(--cyan), 2px 1px 0 var(--red); }
  .profile { gap: 16px; }
  .handle { font-size: 15px; margin-bottom: 8px; }
  .actions { margin-top: 12px; }
  .stats { font-size: 15px; gap: 4px 16px; }
  .actions .btn.gray .lbl, .sort-btn .lbl { display: none; }
  .actions { gap: 6px; }
  .actions .icon-btn.on { display: none; } /* 只留另一种视图的按钮，点一下切换 */
  .selbar { top: calc(var(--top) + 6px); padding-left: 12px; }
  .selbar .btn .lbl { display: none; }
  .tabs button { padding: 0 14px; font-size: 16px; }
  .folders { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
  .folder { height: 58px; gap: 10px; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; margin: 0 -12px; }
  .card { border-radius: 0; }
  .card .cap { left: 6px; right: 6px; bottom: 5px; }
  .card .cap .nm { font-size: 12px; }
  .card .cap .mt { font-size: 12px; }
  .badge { padding: 10px 8px; }
  .badge .ext { font-size: 22px; }
  .ck { opacity: 0; width: 24px; height: 24px; top: 6px; right: 6px; }
  .card:hover .ck, .folder:hover .ck, .row:hover .ck { opacity: 0; }
  .selecting .ck, .sel .ck { opacity: 1 !important; }
  .row { grid-template-columns: 40px minmax(0, 1fr) 40px; }
  .row .c { display: none; }
  .row.hdr { display: none; }
  .row.wide { grid-template-columns: 40px minmax(0, 1fr); }
  .row.wide .row-actions { grid-column: 2; padding-bottom: 10px; }
  .up-panel { right: 8px; left: 8px; width: auto; bottom: calc(var(--tabbar) + 8px); }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: var(--tabbar); padding-bottom: env(safe-area-inset-bottom);
    background: #000; border-top: 1px solid var(--line);
  }
  .tabbar > button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10px; font-weight: 600; color: var(--text-3); }
  .tabbar > button.on { color: var(--text); }
  .viewer .stage { padding: 0; }
  .viewer .stage .textview { height: calc(100vh - 200px); border-radius: 0; }
  .viewer .x { top: calc(12px + env(safe-area-inset-top)); left: 12px; }
  .viewer .nav { display: none; }
  .viewer .rail { right: 10px; bottom: 120px; gap: 14px; }
  .viewer .caption { left: 14px; bottom: calc(20px + env(safe-area-inset-bottom)); max-width: calc(100% - 90px); }
  .toasts { top: auto; bottom: calc(var(--tabbar) + 24px); }
  .menu.sheet { left: 0 !important; right: 0; top: auto !important; bottom: 0; border-radius: 12px 12px 0 0; padding-bottom: calc(8px + env(safe-area-inset-bottom)); animation: up .18s ease-out; }
  .menu.sheet button { height: 52px; font-size: 16px; }
  @keyframes up { from { transform: translateY(100%); } }
  .modal-bg { align-items: flex-end; padding: 0; }
  .modal { width: 100%; border-radius: 12px 12px 0 0; padding-bottom: calc(24px + env(safe-area-inset-bottom)); animation: up .18s ease-out; }
  .drop .big { animation: none; }
}
@media (hover: none) {
  .ck { opacity: 0; }
  .card:hover .ck, .folder:hover .ck, .row:hover .ck { opacity: 0; }
  .selecting .ck, .sel .ck { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
