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

:root {
  --bg: #fafafa;
  --text: #1a1a1a;
  --muted: #777;
  --border: #e8e8e8;
  --radius: 12px;
  --max-w: 960px;
}

html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text);
  line-height: 1.6; -webkit-font-smoothing: antialiased;
  padding-bottom: 100px;
}
a { color: var(--text); text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* Header */
header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(250,250,250,0.88);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border); padding: 0 24px;
}
header .inner {
  max-width: var(--max-w); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; height: 52px;
}
header .logo { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; }
header nav { display: flex; gap: 24px; }
header nav a {
  font-size: 14px; color: var(--muted); transition: color 0.2s;
  padding: 4px 0; border-bottom: 2px solid transparent;
}
header nav a:hover, header nav a.active { color: var(--text); border-bottom-color: #1db954; }

.container { max-width: var(--max-w); margin: 0 auto; padding: 32px 24px; }

/* Category Grid */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.cat-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px 18px; text-align: center; cursor: pointer;
  transition: all 0.2s;
}
.cat-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.06); transform: translateY(-2px); }
.cat-card .icon { font-size: 32px; margin-bottom: 10px; }
.cat-card .name { font-size: 16px; font-weight: 600; margin-bottom: 2px; }
.cat-card .count { font-size: 13px; color: var(--muted); }

/* Page titles */
.page-title { font-size: 26px; font-weight: 700; margin-bottom: 4px; }
.page-desc { color: var(--muted); font-size: 15px; margin-bottom: 24px; }

/* Music list */
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--muted); margin-bottom: 18px; text-decoration: none; }
.back-link:hover { color: var(--text); }

.search-bar { margin-bottom: 16px; }
.search-bar input {
  width: 100%; padding: 10px 16px; font-size: 14px;
  border: 1px solid var(--border); border-radius: 10px;
  background: #fff; outline: none;
}
.search-bar input:focus { border-color: #aaa; }

.music-list { display: flex; flex-direction: column; gap: 6px; }
.music-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; background: #fff;
  border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer; transition: all 0.15s;
}
.music-item:hover { border-color: #ccc; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.music-item .idx { width: 24px; text-align: center; font-size: 14px; color: var(--muted); }
.music-item .cover { width: 40px; height: 40px; border-radius: 6px; background: #f0f0f0; flex-shrink: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; font-size: 20px; }
.music-item .cover img { width: 100%; height: 100%; object-fit: cover; }
.music-item .info { flex: 1; min-width: 0; }
.music-item .info .title { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.music-item .info .meta { font-size: 12px; color: var(--muted); }
.music-item .btn-sm {
  padding: 5px 14px; font-size: 13px; border-radius: 6px;
  border: 1px solid var(--border); background: #fff; cursor: pointer;
  transition: all 0.15s; color: var(--text); font-family: inherit;
}
.music-item .btn-sm:hover { background: #f5f5f5; }
.music-item .btn-play-sm { background: #1db954; color: #fff; border-color: #1db954; }
.music-item .btn-play-sm:hover { background: #1ed760; }

/* Player bar */
.player-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  background: #fff; border-top: 1px solid var(--border);
  padding: 10px 24px; box-shadow: 0 -2px 12px rgba(0,0,0,0.04);
}
.player-bar .inner { max-width: var(--max-w); margin: 0 auto; display: flex; align-items: center; gap: 14px; }
.player-bar .now-playing { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.player-bar .now-cov { width: 40px; height: 40px; border-radius: 6px; background: #f0f0f0; flex-shrink: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; font-size: 20px; }
.player-bar .now-cov img { width: 100%; height: 100%; object-fit: cover; }
.player-bar .now-info { min-width: 0; }
.player-bar .now-info .t { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-bar .now-info .a { font-size: 12px; color: var(--muted); }
.player-bar .ctls { display: flex; align-items: center; gap: 10px; }
.player-bar .bicon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #f5f5f5; font-size: 14px; cursor: pointer; color: var(--text); }
.player-bar .bicon:hover { background: #e8e8e8; }
.player-bar .bplay { width: 40px; height: 40px; border-radius: 50%; background: #1db954; color: #fff; font-size: 16px; display: flex; align-items: center; justify-content: center; }
.player-bar .bplay:hover { background: #1ed760; }
.player-bar .prog-wrap { flex: 1; display: flex; align-items: center; gap: 8px; }
.player-bar .prog-bar { flex: 1; height: 4px; background: #e8e8e8; border-radius: 2px; cursor: pointer; }
.player-bar .prog-bar .filled { height: 100%; background: #1db954; border-radius: 2px; width: 0%; }
.player-bar .tm { font-size: 11px; color: var(--muted); min-width: 32px; }

/* Empty state */
.empty-state { text-align: center; padding: 80px 20px; color: var(--muted); }
.empty-state .icon { font-size: 44px; margin-bottom: 12px; }

/* Pagination */
.pager {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 16px 0 8px; margin-top: 4px;
}
.pager-btn {
  padding: 7px 18px; font-size: 14px; border-radius: 8px;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.pager-btn:hover:not([disabled]) { background: #f5f5f5; border-color: #ccc; }
.pager-btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.pager-info { font-size: 13px; color: var(--muted); white-space: nowrap; }

/* Upload form */
.upload-form { max-width: 560px; margin: 0 auto; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.form-group input[type="text"], .form-group textarea, .form-group select {
  width: 100%; padding: 10px 14px; font-size: 15px;
  border: 1px solid var(--border); border-radius: 10px;
  background: #fff; outline: none;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: #aaa; }
.form-group .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

.file-upload-area {
  border: 2px dashed var(--border); border-radius: 10px;
  padding: 24px; text-align: center; cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.file-upload-area:hover { border-color: #aaa; background: #fafafa; }
.file-upload-area .icon { font-size: 28px; margin-bottom: 6px; }
.file-upload-area .text { font-size: 14px; color: var(--muted); }
.file-upload-area .filename { font-size: 13px; color: #1db954; font-weight: 500; margin-top: 4px; display: none; }
.file-upload-area.has-file { border-style: solid; border-color: #1db954; background: #f6fdf8; }
.file-upload-area.has-file .filename { display: block; }
.file-upload-area.has-file .text { display: none; }

.btn {
  padding: 10px 24px; font-size: 15px; font-weight: 500;
  border-radius: 10px; transition: all 0.2s;
}
.btn-primary { background: #1db954; color: #fff; }
.btn-primary:hover { background: #1ed760; }
.btn-primary:disabled { background: #ccc; cursor: not-allowed; }
.btn-block { width: 100%; }

.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  padding: 12px 24px; border-radius: 10px; font-size: 14px; z-index: 300;
  animation: toastIn 0.3s ease; box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.toast.success { background: #e8f5e9; color: #2e7d32; }
.toast.error { background: #fce4ec; color: #c62828; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.bottom-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }
.toggle-label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.toggle-label input[type="checkbox"] { margin: 0; }
.toggle-label span { font-size: 14px; color: var(--muted); }

@media (max-width: 600px) {
  .category-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .bottom-row { flex-direction: column; align-items: stretch; }
  .player-bar .prog-wrap { display: none; }
  .player-bar { padding: 8px 14px; }
}
