/* 清船独乐 —— 深色 Spotify 风格 · 移动优先 · 原创界面 */

:root {
  --bg: #121212;
  --bg-elevated: #181818;
  --bg-hover: #1f1f1f;
  --sidebar: #000000;
  --text: #ffffff;
  --text-2: #b3b3b3;
  --text-3: #6a6a6a;
  --accent: #1db954;
  --accent-hover: #1ed760;
  --radius: 8px;
  --tabbar-h: 56px;
  --mini-h: 56px;
  --sidebar-w: 240px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input { font-family: inherit; }
a { color: inherit; text-decoration: none; }
.icon { width: 20px; height: 20px; flex: none; display: block; }

/* ---------- 布局 ---------- */
#app { min-height: 100dvh; }
#sidebar { display: none; }
#main { padding: 0 16px calc(var(--mini-h) + var(--tabbar-h) + env(safe-area-inset-bottom) + 16px); }

/* 移动端顶栏 */
.mobile-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 4px 8px; position: sticky; top: 0; z-index: 10;
  background: linear-gradient(var(--bg) 82%, transparent);
}
.wordmark { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 18px; }
.logo-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #000; display: flex; align-items: center; justify-content: center; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #282828; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; }

/* ---------- 视图 ---------- */
.view-head { padding: 8px 0 18px; }
.view-head h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }

.searchbar { display: flex; align-items: center; gap: 8px; background: #242424; border-radius: 8px; padding: 11px 12px; margin-top: 12px; }
.searchbar .icon { color: var(--text-2); }
.searchbar input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 15px; min-width: 0; }
.searchbar input::placeholder { color: var(--text-3); }
.view-toggle { display: flex; gap: 8px; margin-top: 12px; }

.sec { margin-top: 26px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sec-head h2 { font-size: 18px; font-weight: 700; }
.sec-more { color: var(--text-2); font-size: 13px; }
.count-badge { background: #282828; color: var(--text-2); font-size: 12px; border-radius: 999px; padding: 2px 10px; }

/* ---------- 曲目列表 ---------- */
.tracks { display: flex; flex-direction: column; }
.track {
  display: grid; grid-template-columns: 22px 44px 1fr auto; gap: 12px; align-items: center;
  padding: 8px; border-radius: 6px; cursor: pointer;
}
.track:hover { background: var(--bg-hover); }
.track.active .track-title, .track.active .track-idx { color: var(--accent); }
.track-idx { color: var(--text-2); font-size: 14px; text-align: center; font-variant-numeric: tabular-nums; }
.track-cover { display: flex; }
.track-main { min-width: 0; }
.track-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-artist { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-album { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-dur { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ---------- 封面 ---------- */
.cover {
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.9); font-weight: 800; border-radius: 6px; overflow: hidden; position: relative;
  text-shadow: 0 1px 6px rgba(0,0,0,.35); user-select: none; flex: none;
}
.cover.sm { width: 44px; height: 44px; font-size: 18px; }
.cover.md { width: 96px; height: 96px; font-size: 34px; }
.cover.lg { width: 100%; aspect-ratio: 1/1; font-size: 48px; border-radius: 8px; }
.cover.xlg { width: min(72vw, 320px); aspect-ratio: 1/1; font-size: 84px; border-radius: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.55); }
.cover.collage { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; width: 100%; aspect-ratio: 1/1; font-size: 20px; }
.cover.collage > div { display: flex; align-items: center; justify-content: center; }

/* ---------- 卡片 / 网格 / 横滑 ---------- */
.grid.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.card { cursor: pointer; min-width: 0; }
.card-cover { position: relative; }
.card-title { margin-top: 8px; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fab {
  position: absolute; right: 8px; bottom: 8px; width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent); color: #000; display: flex; align-items: center; justify-content: center;
  transition: .18s; box-shadow: 0 8px 18px rgba(0,0,0,.4);
}
.fab .icon { width: 19px; height: 19px; }

.hscroll { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 6px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { flex: 0 0 auto; }
.hscroll .card { width: 150px; }

.recent { width: 120px; cursor: pointer; }
.recent .cover { width: 120px; height: 120px; font-size: 40px; border-radius: 8px; }
.recent-info { margin-top: 8px; }
.recent-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-sub { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 空状态 ---------- */
.empty { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--text-3); padding: 48px 0; }
.empty .icon { width: 40px; height: 40px; opacity: .6; }
.empty p { font-size: 14px; }

/* ---------- 上传 ---------- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  border: 2px dashed #333; border-radius: 14px; padding: 36px 20px; text-align: center; cursor: pointer;
  color: var(--text-2); transition: .15s;
}
.dropzone:hover { border-color: var(--accent); color: var(--text); }
.dropzone .icon { width: 34px; height: 34px; color: var(--accent); }
.dz-title { font-size: 16px; font-weight: 600; color: var(--text); }
.dz-sub { font-size: 13px; }
#upload-queue { margin-top: 24px; }
.up-item { display: flex; align-items: center; gap: 12px; background: var(--bg-elevated); border-radius: 10px; padding: 12px; margin-top: 10px; }
.up-icon { width: 40px; height: 40px; border-radius: 8px; background: #242424; display: flex; align-items: center; justify-content: center; color: var(--text-2); flex: none; }
.up-main { flex: 1; min-width: 0; }
.up-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-sub { font-size: 12px; color: var(--text-2); }
.u-status { display: inline-block; font-size: 12px; color: var(--text-2); margin-top: 4px; }
.u-status.ok { color: var(--accent); }
.bar { height: 4px; background: #333; border-radius: 4px; margin-top: 6px; overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); border-radius: 4px; transition: width .18s; }

.edit-panel { background: var(--bg-elevated); border-radius: 12px; padding: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); margin-bottom: 12px; }
.field input { background: #242424; border: 1px solid transparent; border-radius: 8px; padding: 11px 12px; color: var(--text); font-size: 15px; outline: none; }
.field input:focus { border-color: var(--accent); }
.edit-row { display: flex; gap: 10px; margin-top: 4px; }

/* ---------- 按钮 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 999px; font-size: 15px; font-weight: 700; padding: 12px 22px; transition: .15s; }
.btn.primary { background: var(--accent); color: #000; }
.btn.primary:hover { background: var(--accent-hover); transform: scale(1.02); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid #444; }
.btn.ghost:hover { border-color: #fff; }
.btn.wide { width: 100%; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text-2); transition: .12s; flex: none; }
.icon-btn:hover { color: #fff; }
.icon-btn.on { color: var(--accent); }

/* ---------- Spotify ---------- */
.spotify-card { background: var(--bg-elevated); border-radius: 14px; padding: 26px 20px; text-align: center; display: flex; flex-direction: column; gap: 12px; }
.spotify-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: #000; display: flex; align-items: center; justify-content: center; margin: 0 auto; }
.spotify-icon .icon { width: 28px; height: 28px; }
.spotify-card h2 { font-size: 20px; }
.spotify-card p { font-size: 13px; color: var(--text-2); line-height: 1.7; }
.spotify-card .searchbar { margin-top: 0; }
.spotify-result { margin-top: 8px; background: #242424; border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.sr-q { font-size: 15px; font-weight: 600; word-break: break-all; }
.sr-hint { font-size: 12px; color: var(--text-2); }

/* ---------- 迷你播放器 ---------- */
#miniplayer {
  position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  height: var(--mini-h); background: #181818; border-top: 1px solid #222;
  display: none; align-items: center; gap: 10px; padding: 0 12px; z-index: 39;
}
#miniplayer.show { display: flex; }
.mp-progress { position: absolute; top: 0; left: 0; right: 0; height: 2px; }
.mp-progress > div { height: 100%; background: var(--accent); }
.mp-cover { flex: none; cursor: pointer; }
.mp-info { flex: 1; min-width: 0; cursor: pointer; }
.mp-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-artist { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-play { color: #fff; }

/* ---------- 底部导航 ---------- */
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: #000; border-top: 1px solid #1f1f1f; display: flex; z-index: 40;
}
#tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text-2); font-size: 11px; }
#tabbar button.active { color: #fff; }
#tabbar .icon { width: 22px; height: 22px; }

/* ---------- 正在播放 ---------- */
#nowplaying {
  position: fixed; inset: 0; z-index: 60; background: #181818;
  transform: translateY(100%); transition: transform .32s cubic-bezier(.32,.72,.24,1);
  display: flex; flex-direction: column; overflow: hidden;
}
#nowplaying.open { transform: translateY(0); }
.np-bg { position: absolute; inset: -40px; filter: blur(60px) saturate(1.2); opacity: .35; z-index: 0; }
.np-top { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: calc(env(safe-area-inset-top) + 10px) 16px 0; }
.np-label { font-size: 12px; color: var(--text-2); font-weight: 600; letter-spacing: .5px; }
.np-body {
  position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 24px; padding: 24px 24px calc(env(safe-area-inset-bottom) + 32px);
}
.np-meta { text-align: center; }
.np-title { font-size: 24px; font-weight: 800; }
.np-artist { font-size: 15px; color: var(--text-2); margin-top: 6px; }
.np-progress { width: 100%; max-width: 420px; }
.np-bar { position: relative; height: 6px; background: #3a3a3a; border-radius: 6px; cursor: pointer; }
.np-fill { position: absolute; left: 0; top: 0; bottom: 0; background: #fff; border-radius: 6px; }
.np-thumb { position: absolute; top: 50%; width: 14px; height: 14px; background: #fff; border-radius: 50%; transform: translate(-50%, -50%); box-shadow: 0 1px 6px rgba(0,0,0,.5); }
.np-times { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); margin-top: 8px; font-variant-numeric: tabular-nums; }
.np-controls { display: flex; align-items: center; justify-content: center; gap: 20px; }
.np-play { width: 64px; height: 64px; border-radius: 50%; background: #fff; color: #000; display: flex; align-items: center; justify-content: center; flex: none; }
.np-play .icon { width: 30px; height: 30px; }

/* ---------- 播放队列 ---------- */
#queue-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; background: #181818;
  border-radius: 16px 16px 0 0; max-height: 72vh; display: flex; flex-direction: column;
  transform: translateY(110%); transition: transform .28s cubic-bezier(.32,.72,.24,1);
}
#queue-sheet.open { transform: translateY(0); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 8px; }
.sheet-head h2 { font-size: 18px; }
.sheet-body { overflow-y: auto; padding: 0 12px 12px; }
.sheet-foot { padding: 8px 20px calc(env(safe-area-inset-bottom) + 16px); }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; top: 72px; transform: translate(-50%, -16px);
  background: #282828; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 100; box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 均衡器动画 ---------- */
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 13px; }
.eq i { width: 3px; background: var(--accent); border-radius: 1px; animation: eqb 1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: .2s; }
.eq i:nth-child(3) { animation-delay: .4s; }
@keyframes eqb { 0%, 100% { height: 4px; } 50% { height: 13px; } }

/* ---------- 侧边栏（桌面） ---------- */
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; padding: 6px 12px; }
#sidebar nav { display: flex; flex-direction: column; gap: 2px; }
#sidebar nav button, .side-item {
  display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: 6px;
  color: var(--text-2); font-size: 15px; font-weight: 600; text-align: left; width: 100%;
}
#sidebar nav button:hover, .side-item:hover { color: #fff; }
#sidebar nav button.active { color: #fff; background: #1f1f1f; }
.side-head { padding: 12px 12px 6px; font-size: 12px; letter-spacing: 1px; color: var(--text-3); font-weight: 700; }
#side-playlists { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.side-foot { margin-top: auto; padding: 12px; font-size: 12px; color: var(--text-3); }

/* ---------- 响应式 ---------- */
@media (max-width: 899px) {
  .track { grid-template-columns: 22px 44px 1fr auto; }
  .track-album { display: none; }
  .card .fab { opacity: 1; transform: none; }
}

@media (min-width: 900px) {
  #sidebar { display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; width: var(--sidebar-w); background: var(--sidebar); padding: 20px 10px; gap: 16px; z-index: 50; }
  .mobile-top { display: none; }
  #main { margin-left: var(--sidebar-w); padding: 20px 28px calc(var(--mini-h) + 20px); }
  #tabbar { display: none; }
  #miniplayer { left: var(--sidebar-w); bottom: 0; height: 84px; gap: 16px; padding: 0 20px; }
  #miniplayer .cover.sm { width: 56px; height: 56px; font-size: 22px; }
  .mp-title { font-size: 15px; }
  .track { grid-template-columns: 24px 44px minmax(0,1fr) minmax(0,1.2fr) auto; }
  .grid.cards { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 20px; }
  .hscroll { margin: 0; padding-left: 0; padding-right: 0; }
  .hscroll .card { width: 180px; }
  .recent { width: 180px; }
  .recent .cover { width: 180px; height: 180px; font-size: 56px; }
  .view-head h1 { font-size: 30px; }
  .cover.xlg { width: min(60vh, 360px); font-size: 96px; }
  #queue-sheet { left: var(--sidebar-w); }
}

/* ---------- 登录 / 封面图片 / 补充控件 ---------- */
#login { position: fixed; inset: 0; z-index: 90; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 24px; opacity: 0; pointer-events: none; transition: .25s; }
#login.show { opacity: 1; pointer-events: auto; }
.login-panel { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 14px; text-align: center; }
.login-logo .logo-mark { width: 56px; height: 56px; border-radius: 14px; margin: 0 auto; }
.login-panel h1 { font-size: 26px; font-weight: 800; }
.login-panel p { font-size: 14px; color: var(--text-2); }
.login-panel input { background: #242424; border: 1px solid transparent; border-radius: 8px; padding: 13px 14px; color: var(--text); font-size: 15px; outline: none; text-align: center; }
.login-panel input:focus { border-color: var(--accent); }
.login-error { min-height: 18px; font-size: 13px; color: #f14e4e; }
.link-btn { color: var(--text-2); font-size: 13px; margin-top: 6px; }
.link-btn:hover { color: #fff; text-decoration: underline; }

.btn.sm { padding: 8px 14px; font-size: 13px; }
.card-menu { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; display: flex; align-items: center; justify-content: center; opacity: 0; transition: .15s; }
.card-menu .icon { width: 16px; height: 16px; }
.card:hover .card-menu { opacity: 1; }

.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover.collage > div { overflow: hidden; }
.cover.collage img { width: 100%; height: 100%; object-fit: cover; }
.u-status.err { color: #f14e4e; }

@media (max-width: 899px) {
  .card-menu { opacity: 1; }
}
