/* 彩舟云淡 - 个人文件云柜 */

:root {
  --bg: #f2f5f7;
  --surface: #ffffff;
  --surface-2: #eaf0f3;
  --surface-3: #f7fafb;
  --border: #dbe3e8;
  --border-strong: #c3d0d8;
  --text: #17232d;
  --muted: #5c6e7b;
  --faint: #8496a2;
  --accent: #0e7490;
  --accent-hover: #0b5f77;
  --accent-soft: #e2f2f6;
  --accent-text: #0a5f76;
  --coral: #d9542b;
  --danger: #b93a1c;
  --danger-soft: #fcece6;
  --ok: #15803d;
  --ok-soft: #e6f6ec;
  --shadow-sm: 0 1px 2px rgba(18, 38, 50, 0.06);
  --shadow-md: 0 10px 30px rgba(18, 38, 50, 0.14);
  --radius: 8px;
  --radius-sm: 6px;
  --sidebar-w: 252px;
  --topbar-h: 58px;
  --kind-image: #0e7490;
  --kind-video: #c2410c;
  --kind-audio: #a16207;
  --kind-document: #1d4ed8;
  --kind-archive: #7c5c2b;
  --kind-other: #64748b;
  --kind-folder: #0f766e;
}

html[data-theme="dark"] {
  --bg: #0e141b;
  --surface: #151d26;
  --surface-2: #1d2733;
  --surface-3: #111922;
  --border: #26313d;
  --border-strong: #364454;
  --text: #e7eef4;
  --muted: #97a7b5;
  --faint: #74848f;
  --accent: #2ba7c2;
  --accent-hover: #46bcd4;
  --accent-soft: #14313c;
  --accent-text: #8fd6e6;
  --coral: #e87850;
  --danger: #e2704d;
  --danger-soft: #341c16;
  --ok: #4ade80;
  --ok-soft: #14301f;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.5);
  --kind-image: #45b8cf;
  --kind-video: #e87850;
  --kind-audio: #d3a03c;
  --kind-document: #7ba2f7;
  --kind-archive: #c6a266;
  --kind-other: #93a3b3;
  --kind-folder: #4bc4ab;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

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

.icon-slot { display: inline-grid; place-items: center; }
.icon-slot svg { width: 100%; height: 100%; }

/* ---------- topbar ---------- */

.topbar {
  flex: none;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  flex: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.brand-mark svg { width: 20px; height: 20px; }

.brand-name {
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
}

.search {
  flex: 1 1 auto;
  max-width: 460px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-3);
  transition: border-color .15s, background .15s;
}

.search:focus-within {
  border-color: var(--accent);
  background: var(--surface);
}

.search-icon { width: 17px; height: 17px; color: var(--faint); flex: none; }

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 14px;
}

.search input::-webkit-search-cancel-button { display: none; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  margin-left: auto;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}

.btn svg { width: 17px; height: 17px; }
.btn:hover { background: var(--border); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { filter: brightness(1.08); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  flex: none;
  transition: background .15s, color .15s;
}

.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.has-key { color: var(--accent); }
.icon-btn.tiny { width: 28px; height: 28px; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.tiny svg { width: 16px; height: 16px; }

/* ---------- layout ---------- */

.layout {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
}

.sidebar {
  flex: none;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.side-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 10px 8px;
}

.side-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  text-align: left;
}

.side-item svg { width: 17px; height: 17px; flex: none; }
.side-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-item:hover { background: var(--surface-2); color: var(--text); }
.side-item.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px 6px 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--faint);
  letter-spacing: 0;
}

.tree {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 10px 12px;
}

.tree-empty { padding: 10px 10px 10px 12px; color: var(--faint); font-size: 13px; }

.tree-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  height: 32px;
  padding: 0 6px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-size: 13.5px;
}

.tree-row:hover { background: var(--surface-2); color: var(--text); }
.tree-row.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.tree-row.drop-target { background: var(--accent-soft); outline: 1px dashed var(--accent); color: var(--accent-text); }

.tree-caret {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  color: var(--faint);
  flex: none;
}

.tree-caret svg { width: 14px; height: 14px; transition: transform .15s; }
.tree-caret.open svg { transform: rotate(90deg); }
.tree-caret.leaf { visibility: hidden; }

.tree-icon { width: 16px; height: 16px; flex: none; color: var(--kind-folder); }
.tree-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-count { font-size: 12px; color: var(--faint); flex: none; }

.tree-children { margin-left: 14px; border-left: 1px solid var(--border); padding-left: 2px; }

.side-foot {
  flex: none;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--faint);
}

.scrim {
  position: fixed;
  inset: var(--topbar-h) 0 0 0;
  background: rgba(10, 20, 28, 0.45);
  z-index: 40;
}

/* ---------- main ---------- */

.main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.crumbs {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 20px 0;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}

.crumbs::-webkit-scrollbar { display: none; }

.crumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.crumb:hover { background: var(--surface-2); color: var(--text); }
.crumb.current { color: var(--text); font-weight: 600; }
.crumb.drop-target { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.crumb svg { width: 15px; height: 15px; }

.crumb-sep { color: var(--faint); display: grid; place-items: center; }
.crumb-sep svg { width: 14px; height: 14px; }

.toolbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px 12px;
  flex-wrap: wrap;
}

.view-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.view-title h1 { font-size: 19px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view-count { font-size: 13px; color: var(--faint); white-space: nowrap; }

.tools { display: flex; align-items: center; gap: 8px; }

.select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 8px 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
}

.select-wrap svg { width: 15px; height: 15px; flex: none; }
.select-wrap select {
  border: 0;
  background: transparent;
  outline: none;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  gap: 2px;
}

.seg-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 26px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
}

.seg-btn svg { width: 16px; height: 16px; }
.seg-btn:hover { background: var(--surface-2); color: var(--text); }
.seg-btn.active { background: var(--accent-soft); color: var(--accent-text); }

/* ---------- file area ---------- */

.file-area {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 4px 20px 40px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 12px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.card.dragging { opacity: .5; }

.thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb .kind-icon { width: 40px; height: 40px; }

.card-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 11px 10px;
  min-width: 0;
}

.card-name {
  font-size: 13.5px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-meta {
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: var(--faint);
  min-width: 0;
}

.card-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 2px;
  padding: 2px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transition: opacity .12s;
}

.card:hover .card-actions,
.card:focus-within .card-actions { opacity: 1; }

.card-actions .icon-btn { width: 28px; height: 28px; }
.card-actions .icon-btn svg { width: 15px; height: 15px; }

.kind-icon { color: var(--kind-other); }
.kind-icon.kind-image { color: var(--kind-image); }
.kind-icon.kind-video { color: var(--kind-video); }
.kind-icon.kind-audio { color: var(--kind-audio); }
.kind-icon.kind-document { color: var(--kind-document); }
.kind-icon.kind-archive { color: var(--kind-archive); }
.kind-icon.kind-folder { color: var(--kind-folder); }

/* list view */

.list { display: flex; flex-direction: column; }

.list-head,
.row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 110px 140px 150px 100px;
  align-items: center;
  gap: 10px;
}

.list-head {
  padding: 0 12px 8px;
  color: var(--faint);
  font-size: 12.5px;
}

.row {
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.row + .row { border-top-color: var(--border); border-top-left-radius: 0; border-top-right-radius: 0; }
.row:hover { background: var(--surface); border-color: var(--border); }
.row.dragging { opacity: .5; }

.row-name { display: flex; align-items: center; gap: 9px; min-width: 0; }
.row-name .icon-wrap { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 5px; background: var(--surface-2); flex: none; }
.row-name .icon-wrap svg { width: 15px; height: 15px; }
.row-name .thumb-mini { width: 26px; height: 26px; border-radius: 5px; object-fit: cover; background: var(--surface-2); flex: none; }
.row-text { min-width: 0; }
.row-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.row-sub { font-size: 12px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-cell { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; opacity: 0; }
.row:hover .row-actions, .row:focus-within .row-actions { opacity: 1; }
.row-actions .icon-btn { width: 28px; height: 28px; }
.row-actions .icon-btn svg { width: 15px; height: 15px; }

/* ---------- empty / loading / drop ---------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 320px;
  color: var(--muted);
  text-align: center;
  padding: 40px 20px;
}

.empty svg { width: 42px; height: 42px; color: var(--faint); }
.empty p { font-size: 14px; }

.loading {
  position: absolute;
  top: 12px;
  right: 24px;
}

.spinner {
  display: block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.drop-overlay {
  position: absolute;
  inset: 8px;
  display: grid;
  place-items: center;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent-soft) 82%, transparent);
  pointer-events: none;
  z-index: 20;
}

.drop-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 26px 34px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  color: var(--accent-text);
  font-weight: 600;
}

.drop-card svg { width: 34px; height: 34px; }

/* ---------- upload tray ---------- */

.upload-tray {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  width: min(340px, calc(100vw - 32px));
  padding: 12px 14px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.tray-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.tray-title { font-size: 13.5px; font-weight: 600; }
.progress { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress-bar { height: 100%; width: 0; border-radius: 999px; background: var(--accent); transition: width .2s; }
.tray-meta { margin-top: 7px; font-size: 12px; color: var(--faint); }

/* ---------- floating menu ---------- */

.menu {
  position: fixed;
  z-index: 80;
  min-width: 176px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  text-align: left;
}

.menu-item svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.menu-item:hover { background: var(--surface-2); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger svg { color: var(--danger); }
.menu-sep { height: 1px; margin: 5px 4px; background: var(--border); }

/* ---------- toasts ---------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(440px, calc(100vw - 40px));
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  font-size: 13.5px;
  animation: toast-in .18s ease-out;
}

.toast svg { width: 17px; height: 17px; flex: none; }
.toast.ok svg { color: var(--ok); }
.toast.error svg { color: var(--danger); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- modals ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(10, 20, 28, 0.5);
  backdrop-filter: blur(2px);
}

.modal {
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  max-height: calc(100vh - 44px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.modal.small { width: min(420px, 100%); }

.modal-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-head h2 { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-title { flex: 1; min-width: 0; }
.modal-sub { font-size: 12.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-actions { display: flex; gap: 2px; margin-left: auto; flex: none; }

.modal-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.modal-foot {
  flex: none;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.input {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  outline: none;
}

.input:focus { border-color: var(--accent); background: var(--surface); }

.form-error { margin-top: 8px; font-size: 12.5px; color: var(--danger); }
.confirm-text { font-size: 14px; color: var(--muted); line-height: 1.6; }

.preview-modal { width: min(1120px, 100%); height: min(88vh, 100%); }
.preview-modal .modal-body { padding: 0; background: var(--surface-3); display: grid; place-items: center; }

.preview-modal .modal-body.preview-body-text { display: block; padding: 0; }
.preview-modal .modal-body.preview-body-media { padding: 16px; }

.file-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius-sm); background: var(--surface-2); flex: none; }
.file-icon svg { width: 19px; height: 19px; }

.preview-image { max-width: 100%; max-height: 100%; object-fit: contain; }
.preview-video { max-width: 100%; max-height: 100%; background: #000; border-radius: var(--radius-sm); }
.preview-audio { width: min(520px, 92%); }
.preview-frame { width: 100%; height: 100%; border: 0; background: #fff; }

.preview-text {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 16px 18px;
  overflow: auto;
  background: var(--surface-3);
  color: var(--text);
  font-family: "Cascadia Mono", Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  tab-size: 2;
}

.preview-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  text-align: center;
}

.preview-fallback svg { width: 44px; height: 44px; color: var(--faint); }

.move-list { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow: auto; }

.move-item {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 13.5px;
}

.move-item svg { width: 16px; height: 16px; color: var(--kind-folder); flex: none; }
.move-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.move-item:hover { background: var(--surface-2); }
.move-item.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.move-item:disabled { opacity: .45; cursor: not-allowed; }
.move-path { font-size: 12px; color: var(--faint); margin-left: 6px; }

/* ---------- 媒体卡片 ---------- */

.thumb-gen { position: absolute; inset: 0; }
.thumb .thumb-gen { width: 100%; height: 100%; object-fit: cover; }

.media-badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(10, 20, 28, 0.66);
  color: #fff;
}

.media-badge svg { width: 14px; height: 14px; }

.duration-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 0 6px;
  border-radius: 4px;
  background: rgba(10, 20, 28, 0.66);
  color: #fff;
  font-size: 11.5px;
  line-height: 18px;
  font-variant-numeric: tabular-nums;
}

.duration-badge:not(.has-duration) { display: none; }

.row-duration { color: var(--faint); font-variant-numeric: tabular-nums; }
.row-duration:not(.has-duration) { display: none; }

/* ---------- 播放器 ---------- */

.preview-modal .modal-body.preview-body-player {
  display: block;
  padding: 0;
  overflow: hidden;
}

.player {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 320px;
  background: #0b0f14;
}

.player-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.player-media {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.player-audio .player-media {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.player-art {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 24px;
  color: #cfe3ea;
  text-align: center;
}

.player-art .icon-slot { width: 76px; height: 76px; }
.player-art p { font-size: 15px; word-break: break-all; max-width: 70%; }

.player-big {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #101820;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.38);
  transition: transform .12s, opacity .12s;
}

.player-big:hover { transform: translate(-50%, -50%) scale(1.05); }
.player-big svg { width: 30px; height: 30px; margin-left: 3px; }

.player-hint {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.66);
  color: #fff;
  font-size: 13px;
}

.player-chip {
  position: absolute;
  left: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: rgba(12, 20, 28, 0.88);
  color: #eaf4f8;
  font-size: 13px;
}

.player-chip b { color: #fff; font-variant-numeric: tabular-nums; }

.player-fail {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  background: rgba(9, 14, 20, 0.94);
  color: #d7e3ea;
  text-align: center;
}

.player-fail svg { width: 44px; height: 44px; color: #8fa3b0; }
.player-failed .player-bar { opacity: .4; pointer-events: none; }

.btn.small { height: 30px; padding: 0 11px; font-size: 13px; }

.player-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 10px;
  background: linear-gradient(180deg, rgba(11, 15, 20, 0.86), rgba(11, 15, 20, 0.98));
  color: #e6eef3;
  transition: opacity .2s, transform .2s;
}

.player-idle { cursor: none; }
.player-idle .player-bar { opacity: 0; transform: translateY(6px); pointer-events: none; }

.pbtn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  flex: none;
}

.pbtn:hover { background: rgba(255, 255, 255, 0.14); }
.pbtn:disabled { opacity: .32; cursor: default; }
.pbtn:disabled:hover { background: transparent; }
.pbtn svg { width: 18px; height: 18px; }
.pbtn.prate { width: 44px; font-size: 12.5px; font-variant-numeric: tabular-nums; }

.ptime {
  min-width: 44px;
  text-align: center;
  font-size: 12.5px;
  color: #c8d6de;
  font-variant-numeric: tabular-nums;
}

.pseek {
  position: relative;
  flex: 1;
  height: 18px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}

.pseek::before,
.pvol::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.22);
}

.pseek .pbuf,
.pseek .pplayed {
  position: absolute;
  left: 0;
  width: 0;
  height: 4px;
  border-radius: 2px;
}

.pseek .pbuf { background: rgba(255, 255, 255, 0.38); }
.pseek .pplayed { background: var(--accent); }

.pseek .pknob {
  position: absolute;
  left: 0;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity .15s;
}

.pseek:hover .pknob,
.pseek:active .pknob { opacity: 1; }

.pvol {
  position: relative;
  width: 72px;
  height: 18px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
  flex: none;
}

.pvol-fill {
  position: absolute;
  left: 0;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: #e6eef3;
}

.pvol-knob {
  position: absolute;
  left: 100%;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  background: #fff;
}

.player:fullscreen { width: 100vw; height: 100vh; }

/* ---------- 手机 / 触屏播放器 ---------- */

@media (max-width: 720px), (pointer: coarse) {
  /* 两行布局：第一行 时间 + 进度条，第二行 按钮 + 音量 */
  .player-bar { gap: 6px; row-gap: 2px; padding: 6px 8px 8px; flex-wrap: wrap; }
  #pNow { order: 1; }
  .pseek { order: 2; flex: 1 1 auto; }
  #pTotal { order: 3; }
  .player-bar::after { content: ''; order: 4; flex-basis: 100%; height: 0; }
  #pPlay { order: 5; }
  #pPrev { order: 6; }
  #pNext { order: 7; }
  #pMute { order: 8; }
  #pVol { order: 9; flex: 1 1 80px; max-width: 220px; }
  #pRate { order: 10; }
  #pPip { order: 11; }
  #pFull { order: 12; margin-left: auto; }

  .pbtn { width: 40px; height: 40px; }
  .pbtn svg { width: 20px; height: 20px; }
  .pbtn.prate { width: 46px; font-size: 13px; }
  .ptime { min-width: 42px; font-size: 12px; }
  .pseek { height: 26px; }
  .pseek .pknob { width: 14px; height: 14px; margin-left: -7px; opacity: 1; }
  .pvol { height: 26px; }
  .pvol-knob { width: 14px; height: 14px; margin-left: -7px; }
  .player { min-height: 240px; }
  .player-big { width: 58px; height: 58px; }
  .player-big svg { width: 26px; height: 26px; }
  .player-chip { left: 10px; bottom: 10px; padding: 6px 10px; font-size: 12.5px; }
  .player-hint { top: 10px; font-size: 12px; }
}

@media (max-width: 720px) {
  #previewModal { padding: 0; }
  #previewModal .modal {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border: 0;
    border-radius: 0;
  }

  #previewModal .modal-head { padding: 10px 12px; gap: 8px; }
  #previewModal .file-icon { width: 30px; height: 30px; }
  #previewModal .modal-actions .icon-btn { width: 34px; height: 34px; }
}

/* ---------- responsive ---------- */

@media (max-width: 960px) {
  .only-mobile { display: inline-grid !important; }

  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    bottom: 0;
    left: 0;
    z-index: 50;
    width: min(300px, 84vw);
    transform: translateX(-102%);
    transition: transform .2s ease-out;
    box-shadow: var(--shadow-md);
  }

  .sidebar.open { transform: none; }
  .brand-name { display: none; }
  .search { max-width: none; }
  .toolbar { flex-wrap: nowrap; }
}

@media (max-width: 720px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .topbar-actions #themeBtn { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: 10px; }
  .file-area { padding: 4px 14px 36px; }
  .crumbs { padding: 10px 14px 0; }
  .toolbar { padding: 8px 14px 10px; }
  .view-title h1 { font-size: 17px; }
  .list-head { display: none; }
  .row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 2px; }
  .row-cell { display: none; }
  .row-actions { opacity: 1; }
}

@media (max-width: 460px) {
  .search { height: 34px; }
  .btn.primary span { display: none; }
  .btn.primary { width: 38px; padding: 0; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-actions { opacity: 1; }
  .upload-tray { right: 12px; bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
