/* ══ Design Tokens ══ */
:root {
  --primary: #1a3a2a;
  --primary-dark: #0f2318;
  --primary-hover: #1f4a36;
  --primary-light: #eaf3ef;
  --primary-mid: #c5ddd4;
  --accent: #2d6a4f;

  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface-2: #faf9f7;
  --surface-offset: #f0ede8;
  --divider: #e2ddd7;
  --border: #d8d3cc;

  --text: #1a2922;
  --text-muted: #3d5246;
  --text-faint: #8aa396;

  --shadow-sm: 0 1px 3px rgba(20, 50, 36, 0.07), 0 1px 2px rgba(20, 50, 36, 0.04);
  --shadow-md: 0 4px 12px rgba(20, 50, 36, 0.1), 0 2px 6px rgba(20, 50, 36, 0.06);
  --shadow-lg: 0 12px 32px rgba(20, 50, 36, 0.13), 0 4px 12px rgba(20, 50, 36, 0.07);
  --shadow-xl: 0 24px 64px rgba(20, 50, 36, 0.17);

  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 300ms cubic-bezier(0.16, 1, 0.3, 1);

  --font-display: 'Noto Serif SC', Georgia, serif;
  --font-body: 'Noto Sans SC', 'Segoe UI', system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* 触摸高亮重置 */
html {
  -webkit-tap-highlight-color: transparent;
  tap-highlight-color: transparent;
}

/* 触摸友好的 active 反馈 */
@media (hover: none) and (pointer: coarse) {
  .cat-btn:active,
  .folder-card:active,
  .folder-pill:active,
  .hot-card:active,
  .file-card:active,
  .btn-dl:active,
  .btn-play:active,
  .btn-preview:active,
  .btn-queue:active,
  .btn-playlist-add:active,
  .btn-edit:active,
  .btn-del:active,
  .btn-view-all:active,
  .link-more:active,
  .hot-card-play:active,
  .pagination button:active,
  .fab:active {
    transform: scale(0.97) !important;
    transition: transform 0.08s ease !important;
  }
  .cat-btn:active {
    background: var(--primary-mid) !important;
  }
}
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  scroll-padding-top: 72px;
}
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  font-size: 1rem;
  line-height: 1.6;
}
img,
svg {
  display: block;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
a {
  text-decoration: none;
  color: inherit;
}
button {
  cursor: pointer;
  border: none;
  background: none;
}

/* ══ Header（首页模式：在移动端保持品牌可见）══ */
/* style.css section 10 在 ≤768px 时隐藏了 .logo-text（因为其他页面有居中标题），
   但首页没有居中标题，品牌本身就是标题。只在移动端隐藏副标题，保留品牌名。 */

/* ══ Hero ══ */
.hero {
  background: var(--primary-dark);
  color: white;
  padding: clamp(2.5rem, 6vw, 4rem) 2rem clamp(2rem, 5vw, 3.5rem);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.025'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: linear-gradient(to bottom, transparent, rgba(15, 35, 24, 0.18));
  pointer-events: none;
}
.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
}
.hero-eyebrow {
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.6;
  margin-bottom: 0.75rem;
  font-weight: 500;
}
.hero h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 600;
  margin-bottom: 0.6rem;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.hero-desc {
  font-family: var(--font-display);
  font-size: 0.92rem;
  opacity: 0.82;
  margin-bottom: 2rem;
  max-width: 44ch;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.75;
  font-weight: 400;
}

/* ══ Hero Search ══ */
.hero-search {
  position: relative;
  max-width: 480px;
  margin: 0 auto 2rem;
}

/* ══ 搜索建议下拉框 ══ */
.search-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 320px;
  overflow-y: auto;
  display: none;
  z-index: 50;
  animation: fadeInUp 0.15s ease both;
}
.search-suggestions.show {
  display: block;
}
.search-suggestions-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--divider);
}
.search-suggestions-item:last-child {
  border-bottom: none;
}
.search-suggestions-item:hover,
.search-suggestions-item.highlighted {
  background: var(--primary-light);
}
.search-suggestions-item .sug-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
}
.search-suggestions-item .sug-icon svg {
  width: 14px;
  height: 14px;
}
.search-suggestions-item .sug-body {
  flex: 1;
  min-width: 0;
}
.search-suggestions-item .sug-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-suggestions-item .sug-title em {
  font-style: normal;
  color: var(--accent);
  background: rgba(45, 106, 79, 0.12);
  padding: 0 2px;
  border-radius: 2px;
}
.search-suggestions-item .sug-meta {
  font-size: 0.72rem;
  color: var(--text-faint);
}

/* 搜索建议键盘提示 */
.search-suggestions-hint {
  padding: 0.45rem 0.85rem;
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  border-top: 1px solid var(--divider);
  background: var(--surface-2);
  font-size: 0.72rem;
  color: var(--text-faint);
}
.search-suggestions-hint kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 5px;
  min-width: 18px;
  height: 18px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.68rem;
  font-family: inherit;
  font-weight: 600;
  line-height: 1;
}

.hero-search input:focus ~ .search-suggestions,
.hero-search .search-suggestions.show {
  display: block;
}

/* 手机端搜索建议 */
@media (max-width: 640px) {
  .search-suggestions {
    max-height: 260px;
  }
  .search-suggestions-item {
    padding: 0.5rem 0.75rem;
  }
  .search-suggestions-item .sug-title {
    font-size: 0.84rem;
  }
  .search-suggestions-hint {
    display: none;
  }
}
.hero-search input {
  width: 100%;
  padding: 0.85rem 2.8rem 0.85rem 3.1rem;
  border: none;
  border-radius: var(--radius-full);
  font-size: 0.97rem;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.13);
  color: white;
  backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  transition:
    background var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
  outline: none;
}
.hero-search input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}
.hero-search input:focus {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}
.hero-search-icon {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.55);
  pointer-events: none;
}
.hero-search-clear {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: white;
  border: none;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition);
}
.hero-search-clear.show {
  display: flex;
}
.hero-search-clear:hover {
  background: rgba(255, 255, 255, 0.3);
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: clamp(1.5rem, 5vw, 3.5rem);
  align-items: flex-start;
}
.stat {
  text-align: center;
}
.stat-num {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  font-weight: 700;
  display: block;
  line-height: 1.1;
}
.stat-lbl {
  font-size: 0.72rem;
  opacity: 0.65;
  margin-top: 4px;
  letter-spacing: 0.03em;
  display: block;
}
.stat-divider {
  width: 1px;
  background: rgba(255, 255, 255, 0.2);
  height: 2.2rem;
  align-self: center;
}

/* ══ Container ══ */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 4rem;
}

/* ══ Section Header ══ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.section-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.section-title svg {
  color: var(--accent);
}
.btn-view-all {
  font-size: 0.8rem;
  color: var(--accent);
  padding: 0.3rem 0.75rem;
  border: 1.5px solid var(--primary-mid);
  border-radius: var(--radius-full);
  background: var(--primary-light);
  transition: all var(--transition);
  font-weight: 500;
}
.btn-view-all:hover {
  background: var(--primary-mid);
  border-color: var(--accent);
}

/* ══ Folder Grid（首屏卡片） ══ */
.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr));
  gap: 0.85rem;
  margin-bottom: 2.5rem;
}
.folder-card {
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.1rem 1rem;
  cursor: pointer;
  transition:
    box-shadow var(--transition-slow),
    transform var(--transition-slow),
    border-color var(--transition);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.folder-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--primary-mid);
}
.folder-card:active {
  transform: translateY(0);
}
.folder-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}
.folder-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition);
}
.folder-card:hover .folder-card-icon {
  background: var(--primary-mid);
}
.folder-card-icon svg {
  color: var(--accent);
}
.folder-card-count {
  font-size: 0.72rem;
  color: var(--text-faint);
  background: var(--surface-offset);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 500;
  white-space: nowrap;
}
.folder-card-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.folder-card-desc {
  font-size: 0.77rem;
  color: var(--text-faint);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.folder-card-arrow {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-top: auto;
  transition:
    color var(--transition),
    gap var(--transition);
}
.folder-card:hover .folder-card-arrow {
  color: var(--accent);
  gap: 0.45rem;
}

/* ══ Folder skeleton ══ */
.folder-card-skeleton {
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* ══ Controls Bar（文件列表上方）══ */
.controls-bar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.sort-wrap {
  position: relative;
}
.sort-wrap select {
  appearance: none;
  padding: 0.6rem 2.2rem 0.6rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  background: var(--surface);
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
  white-space: nowrap;
}
.sort-wrap select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 58, 42, 0.09);
}
.sort-wrap::after {
  content: '';
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--text-faint);
  pointer-events: none;
}

/* ══ Breadcrumbs ══ */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-bottom: 0.6rem;
  padding-left: 0.1rem;
  min-height: 1.5rem;
}
.breadcrumbs span {
  cursor: pointer;
  padding: 0.1rem 0.3rem;
  border-radius: 999px;
  transition:
    background var(--transition),
    color var(--transition);
}
.breadcrumbs span:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.breadcrumbs span.current {
  color: var(--text-muted);
  font-weight: 600;
  cursor: default;
}
.breadcrumbs span.current:hover {
  background: none;
  color: var(--text-muted);
}
.breadcrumbs .sep {
  cursor: default;
  padding: 0;
  opacity: 0.45;
}
.breadcrumbs .sep:hover {
  background: none;
}

/* ══ Sub-folder pills（在文件夹内时展示子目录）══ */
.sub-folders {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1rem;
}
.folder-pill {
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
  max-width: 100%;
  cursor: pointer;
  transition: all var(--transition);
}
.folder-pill:hover {
  border-color: var(--primary-mid);
  color: var(--primary);
  background: var(--primary-light);
  box-shadow: var(--shadow-md);
}
.folder-pill.back-pill {
  border-style: dashed;
  color: var(--text-faint);
}
.folder-pill.back-pill:hover {
  color: var(--primary);
}
.folder-pill-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ══ Categories ══ */
.categories {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.cat-btn {
  padding: 0.35rem 0.95rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text-muted);
  font-weight: 500;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.cat-btn:hover {
  border-color: var(--primary-mid);
  color: var(--primary);
  background: var(--primary-light);
  box-shadow: var(--shadow-md);
}
.cat-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 2px 10px rgba(26, 58, 42, 0.25);
  font-weight: 600;
}

.results-meta {
  font-size: 0.82rem;
  color: var(--text-faint);
  margin-bottom: 0.9rem;
  padding-left: 0.1rem;
  min-height: 1.2rem;
}

/* ══ File List ══ */
.file-list {
  display: grid;
  gap: 0.75rem;
  contain: layout style paint;
}

.file-card {
  content-visibility: auto;
  contain-intrinsic-size: 130px;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  cursor: default;
  transition:
    box-shadow var(--transition-slow),
    transform var(--transition-slow),
    border-color var(--transition);
}
.file-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: var(--primary-mid);
}

.file-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition);
}
.file-card:hover .file-icon {
  background: var(--primary-mid);
}
.file-icon svg {
  color: var(--accent);
}

.file-body {
  flex: 1;
  min-width: 0;
}
.file-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
  flex-wrap: wrap;
}
.file-body h3 {
  font-size: 0.96rem;
  font-weight: 600;
  white-space: normal;
  overflow: hidden;
  flex: 1;
  min-width: 0;
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: break-word;
}
.file-meta {
  font-size: 0.77rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}
.file-meta-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.file-meta-item svg {
  flex-shrink: 0;
}
.file-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.file-uploader {
  font-size: 0.73rem;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.25rem;
}

.file-tags {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}
.file-tag {
  font-size: 0.68rem;
  background: var(--primary-light);
  color: var(--accent);
  border-radius: 4px;
  padding: 2px 7px;
  font-weight: 500;
}

.file-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  flex-shrink: 0;
}
.btn-dl {
  padding: 0.45rem 1.05rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.83rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  font-family: inherit;
  font-weight: 600;
  box-shadow: 0 2px 7px rgba(26, 58, 42, 0.2);
  transition: all var(--transition);
}
.btn-dl:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(26, 58, 42, 0.28);
}
.btn-play {
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  box-shadow: none;
}
.btn-play:hover {
  background: var(--primary-light);
  border-color: var(--primary-mid);
  color: var(--primary);
}

.btn-preview {
  padding: 0.38rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.77rem;
  color: var(--text-muted);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all var(--transition);
}
.btn-preview:hover {
  background: var(--primary-light);
  border-color: var(--primary-mid);
  color: var(--primary);
}

.btn-edit {
  padding: 0.3rem 0.65rem;
  font-size: 0.74rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  color: var(--primary);
  font-family: inherit;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}
.btn-edit:hover {
  background: var(--primary-light);
  border-color: var(--primary-mid);
}
.btn-del {
  padding: 0.3rem 0.65rem;
  font-size: 0.74rem;
  border: 1.5px solid #fca5a5;
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  color: #ef4444;
  font-family: inherit;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}
.btn-del:hover {
  background: #fef2f2;
  border-color: #ef4444;
}
.btn-queue,
.btn-playlist-add {
  padding: 0.3rem 0.6rem;
  font-size: 0.72rem;
  border: 1.5px solid var(--primary-mid);
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  cursor: pointer;
  color: var(--accent);
  font-family: inherit;
  font-weight: 500;
  white-space: nowrap;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}
.btn-queue:hover,
.btn-playlist-add:hover {
  background: var(--primary-mid);
  border-color: var(--accent);
}

/* ══ Pagination ══ */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}
.pagination button {
  padding: 0.4rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: all var(--transition);
  min-width: 36px;
  text-align: center;
}
.pagination button:hover {
  border-color: var(--primary-mid);
  color: var(--primary);
}
.pagination button.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(26, 58, 42, 0.22);
}
.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ══ Empty State ══ */
.empty {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}
.empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.empty-icon svg {
  color: var(--accent);
  opacity: 0.6;
}
.empty h3 {
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 0.4rem;
}
.empty p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* ══ FAB ══ */
.fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--primary);
  color: white;
  padding: 0.75rem 1.3rem;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(26, 58, 42, 0.38);
  display: none;
  align-items: center;
  gap: 0.45rem;
  transition: all var(--transition);
  font-family: inherit;
  border: none;
  cursor: pointer;
  z-index: 250;
}
.fab:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(26, 58, 42, 0.44);
}
body.has-player .fab {
  bottom: calc(1.5rem + var(--player-h, 52px) + env(safe-area-inset-bottom, 0px));
}

/* ══ Modal ══ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
}
.modal-overlay.show {
  display: flex;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 1.8rem;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.modal-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.4rem;
}
.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}
.modal .form-group {
  margin-bottom: 1rem;
}
.modal label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.modal input,
.modal select,
.modal textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.93rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}
.modal input:focus,
.modal select:focus,
.modal textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 58, 42, 0.09);
}
.modal-footer {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}
.btn-cancel {
  padding: 0.55rem 1.2rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--text-muted);
  transition: all var(--transition);
}
.btn-cancel:hover {
  background: var(--surface-offset);
  border-color: var(--text-faint);
}
.btn-save {
  padding: 0.55rem 1.4rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(26, 58, 42, 0.18);
}
.btn-save:hover {
  background: var(--primary-hover);
}
.btn-save:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.modal-alert {
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-top: 0.8rem;
  display: none;
}
.modal-alert.error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fca5a5;
  display: block;
}
.modal-alert.success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
  display: block;
}

/* ══ Search result highlight zone ══ */
#searchResultZone {
  display: none;
}
#searchResultZone.show {
  display: block;
}

/* ══ 热门推荐 - 简洁卡片样式 ══ */
.hot-file-grid {
  display: grid;
  gap: 0.65rem;
}

/* 热门卡片 - 水平布局，左侧大图标，右侧标题+元数据 */
.hot-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: var(--radius-lg);
  padding: 0.6rem 1rem;
  box-shadow: var(--shadow-sm);
  transition:
    box-shadow var(--transition),
    transform var(--transition),
    border-color var(--transition);
  animation: fadeInUp 0.35s ease both;
}
.hot-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: var(--primary-mid);
}

/* 大播放按钮 */
.hot-card-play {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--primary-light);
  border: 1px solid var(--primary-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--primary);
}
.hot-card-play:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 2px 10px rgba(26, 58, 42, 0.2);
}
.hot-card-play svg {
  display: block;
}

/* 卡片内容 */
.hot-card-body {
  flex: 1;
  min-width: 0;
}
.hot-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  display: block;
  white-space: normal;
  overflow: hidden;
  flex: 1;
  min-width: 0;
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: break-word;
  transition: color var(--transition);
}
.hot-card-title:hover {
  color: var(--primary);
}
.hot-card-meta {
  font-size: 0.77rem;
  color: var(--text-faint);
  display: flex;
  gap: 0.5rem;
  margin-top: 0.15rem;
}
.hot-card-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}
.hot-card-actions .btn-play,
.hot-card-actions .btn-download {
  padding: 0.42rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
}

/* 查看更多链接 */
.link-more {
  font-size: 0.8rem;
  color: var(--accent);
  padding: 0.3rem 0.75rem;
  border: 1.5px solid var(--primary-mid);
  border-radius: var(--radius-full);
  background: var(--primary-light);
  transition: all var(--transition);
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}
.link-more:hover {
  background: var(--primary-mid);
  border-color: var(--accent);
}
.link-more:active {
  transform: scale(0.97);
}

/* ══ Footer ══ */
footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-faint);
  font-size: 0.8rem;
  border-top: 1px solid var(--divider);
  margin-top: 2rem;
  letter-spacing: 0.02em;
}

/* ══ 热门卡片水平滑动（移动端） ══ */
@media (hover: none) and (pointer: coarse) {
  .hot-file-grid {
    display: flex;
    gap: 0.65rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 4px;
    margin-bottom: -4px;
  }
  .hot-file-grid::-webkit-scrollbar {
    display: none;
  }
  .hot-file-grid .hot-card {
    min-width: 85vw;
    max-width: 85vw;
    flex-shrink: 0;
    scroll-snap-align: start;
  }
}

/* ══ Mobile (≤640px) ══ */
@media (max-width: 640px) {
  .hero {
    padding: 2rem 1rem 1.8rem;
  }
  .hero-stats {
    gap: 1.5rem;
  }
  .hero h2 {
    font-size: 1.35rem;
  }
  .hero-desc {
    font-size: 0.85rem;
  }
  .hero-search input {
    font-size: 16px; /* 防止 iOS 自动缩放 */
    padding: 0.65rem 2.5rem 0.65rem 2.8rem;
  }
  .hero-search-icon {
    left: 0.9rem;
  }
  .hero-search-clear {
    right: 0.75rem;
    width: 26px;
    height: 26px;
  }
  .folder-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr));
    gap: 0.65rem;
  }
  .file-card {
    padding: 0.75rem 0.85rem;
    flex-wrap: wrap;
  }
  .file-icon {
    width: 38px;
    height: 38px;
    border-radius: 9px;
  }
  .file-body {
    flex: 1;
    min-width: 0;
  }
  .file-body h3 {
    white-space: normal;
  }
  .file-actions {
    flex-direction: row;
    flex-wrap: wrap;
    flex-basis: 100%;
    justify-content: flex-end;
    border-top: 1px solid var(--divider);
    padding-top: 0.6rem;
    margin-top: 0.25rem;
  }
  .fab {
    bottom: 1rem;
    right: 1rem;
    padding: 0.65rem 1.1rem;
    font-size: 0.83rem;
  }
  body.has-player .fab {
    bottom: calc(1rem + var(--player-h, 52px) + env(safe-area-inset-bottom, 0px));
  }
  .controls-bar {
    gap: 0.5rem;
  }
  .sort-wrap {
    width: 100%;
  }
  .sort-wrap select {
    width: 100%;
  }
  .file-card-title {
    word-break: break-word;
    overflow-wrap: break-word;
  }
}

/* ══ Tablet (768px) ══ */
@media (max-width: 768px) {
  .hero-inner {
    max-width: 100%;
  }
}

/* ══ Small Mobile (≤480px) ══ */
@media (max-width: 480px) {
  .hero-stats {
    flex-wrap: wrap;
  }

  .folder-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .btn-add-playlist,
  .btn-queue {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
  }
  /* 触摸友好：操作按钮最小尺寸 */
  .file-actions .btn-dl,
  .file-actions .btn-play,
  .file-actions .btn-preview {
    min-height: 36px;
    padding: 0.5rem 0.85rem;
  }
  .file-actions .btn-queue,
  .file-actions .btn-playlist-add,
  .file-actions .btn-edit,
  .file-actions .btn-del {
    min-height: 34px;
    padding: 0.4rem 0.7rem;
  }
  .cat-btn {
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
    min-height: 36px;
  }
  /* 手机端热门卡片更紧凑 */
  .hot-card {
    padding: 0.5rem 0.75rem;
    gap: 0.55rem;
  }
  .hot-card-play {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }
  .hot-card-play svg {
    width: 20px;
    height: 20px;
  }
  .hot-card-actions {
    flex-direction: column;
    gap: 0.3rem;
  }
  .hot-card-actions .btn-play,
  .hot-card-actions .btn-download {
    padding: 0.35rem 0.7rem;
    font-size: 0.75rem;
  }
}

/* ══ Ultra Small (≤375px) ══ */
@media (max-width: 375px) {
  html {
    font-size: 14px;
  }
  .hero h2 {
    font-size: 1.2rem;
  }
}

/* ══ Skeleton ══ */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}
.skeleton {
  background: linear-gradient(90deg, var(--surface-offset) 25%, var(--divider) 50%, var(--surface-offset) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
  will-change: background-position; /* GPU 加速 */
}
.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  display: flex;
  gap: 1rem;
  align-items: center;
}
.skeleton-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  flex-shrink: 0;
}
.skeleton-lines {
  flex: 1;
}
.skeleton-line {
  height: 14px;
  margin-bottom: 8px;
}
.skeleton-line:nth-child(2) {
  width: 60%;
}
.skeleton-line:nth-child(3) {
  width: 40%;
}

/* ══ Playlist Modal (inside global player) ══ */
#playlistModal {
  position: fixed;
  bottom: 56px;
  right: 1rem;
  width: 320px;
  max-height: 60vh;
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  display: none;
  flex-direction: column;
  z-index: 210;
  overflow: hidden;
  animation: slideUp 0.2s ease;
}
#playlistModal.show {
  display: flex;
}
.pl-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--divider);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 0.85rem;
}
.pl-header select {
  font-size: 0.78rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  max-width: 140px;
}
.pl-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem 0;
}
.pl-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.8rem;
  cursor: pointer;
  font-size: 0.82rem;
  transition: background 0.12s;
}
.pl-item:hover {
  background: var(--primary-light);
}
.pl-item.active {
  background: var(--primary);
  color: white;
}
.pl-item-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pl-item-remove {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 2px 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.pl-item:hover .pl-item-remove {
  opacity: 1;
}
.pl-item-remove:hover {
  color: #dc2626;
}
.pl-empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.82rem;
}

/* ══ File Card Title Animation ══ */
.file-card-title {
  position: relative;
  cursor: pointer;
  color: var(--text);
  transition: color 0.2s;
  display: block;
  white-space: normal;
  overflow: hidden;
  flex: 1;
  min-width: 0;
  max-width: 100%;
  font-size: 0.96rem;
  font-weight: 600;
  word-break: break-word;
  overflow-wrap: break-word;
}
.file-card-title::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.file-card-title:hover {
  color: var(--accent);
}
.file-card-title:hover::after {
  width: 100%;
}
.file-card-title svg {
  display: inline;
  margin-left: 3px;
  opacity: 0.45;
  vertical-align: middle;
}

/* ── 文件卡片入场动画 ── */
@keyframes cardSlideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.file-card {
  animation: cardSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.file-card:nth-child(1) {
  animation-delay: 0.05s;
}
.file-card:nth-child(2) {
  animation-delay: 0.1s;
}
.file-card:nth-child(3) {
  animation-delay: 0.15s;
}
.file-card:nth-child(4) {
  animation-delay: 0.2s;
}
.file-card:nth-child(5) {
  animation-delay: 0.25s;
}
.file-card:nth-child(6) {
  animation-delay: 0.3s;
}
.file-card:nth-child(7) {
  animation-delay: 0.35s;
}
.file-card:nth-child(8) {
  animation-delay: 0.4s;
}
.file-card:nth-child(9) {
  animation-delay: 0.45s;
}
.file-card:nth-child(10) {
  animation-delay: 0.5s;
}
.file-card:nth-child(n + 11) {
  animation-delay: 0.55s;
}

/* ══ 歌词文本预览（恢复原版大小，居中在 70vw 容器内）══ */
.lyric-text {
  white-space: pre-wrap;
  font-size: 1rem;
  line-height: 1.8;
  padding: 1.2rem;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  color: var(--text);
  max-width: 520px;
  margin: 0 auto;
}

/* ── 预览弹窗 ── */
/* 桌面端：更宽的预览框 */
#previewOverlay .modal {
  max-width: 70vw;
  width: 90%;
}

/* 预览内容填满宽度 */
#previewContent {
  width: 100%;
}
#previewContent img {
  max-width: 100%;
  height: auto;
}

/* ── 预览弹窗：标题与内容区紧凑间距 ── */
#previewOverlay .modal-header {
  margin-bottom: 0.35rem;
}
#previewContent {
  margin-top: 0 !important;
}

/* ── 手机端预览全屏 ── */
@media (max-width: 640px) {
  #previewOverlay.modal-overlay {
    padding: 0;
    align-items: flex-start;
    padding-top: env(safe-area-inset-top, 0px);
  }
  #previewOverlay .modal {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: 0.75rem;
    max-width: none;
    width: 100%;
    margin-top: 0;
  }
}

/* ── Lazy Loading / Infinite Scroll ── */
.sentinel {
  width: 100%;
  height: 2px;
}

@keyframes skeleton-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

.skeleton-card {
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

img[loading='lazy'] {
  background: var(--skeleton, #eef2ef);
  min-height: 40px;
}

img[loading='lazy']:not([src]) {
  visibility: hidden;
}
