/* ============ 基础 ============ */
:root {
  --bg: #f7f7f9;
  --card: #ffffff;
  --text: #1a1a22;
  --text-2: #6e6e7a;
  --text-3: #9b9ba6;
  --line: #e9e9ef;
  --accent: #6c5ce7;
  --accent-weak: #efecff;
  --accent-2: #a29bfe;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(23, 20, 60, .08);
  --player-h: 78px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
ul { list-style: none; margin: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
img { display: block; }

/* ============ 顶栏 ============ */
.header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(247, 247, 249, .82);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  max-width: 780px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; gap: 20px;
}

.brand {
  display: flex; align-items: center; gap: 9px;
  font-size: 16px; font-weight: 700; letter-spacing: .2px; white-space: nowrap;
}

.brand-icon {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; display: grid; place-items: center;
  box-shadow: 0 4px 10px rgba(108, 92, 231, .35);
}

/* 搜索框 */
.search {
  flex: 1; max-width: 460px; position: relative;
  display: flex; align-items: center;
}

.search-icon {
  position: absolute; left: 13px; color: var(--text-3); pointer-events: none;
}

.search input {
  width: 100%; height: 40px; padding: 0 38px 0 38px;
  border: 1px solid var(--line); border-radius: 20px;
  background: var(--card); color: var(--text); outline: none;
  font: inherit; transition: border-color .15s, box-shadow .15s;
}

.search input::placeholder { color: var(--text-3); }

.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}

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

.search-clear {
  position: absolute; right: 8px;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; color: var(--text-3);
}
.search-clear:hover { background: var(--bg); color: var(--text); }

/* 岛主入口 */
.owner-link {
  flex: none; display: flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 14px; border-radius: 20px;
  background: var(--card); border: 1px solid var(--line);
  font-size: 13.5px; font-weight: 600; color: var(--text-2);
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.owner-link:hover { color: var(--accent); border-color: var(--accent); }

/* ============ 主体 ============ */
.main {
  max-width: 780px; margin: 0 auto; padding: 26px 20px 60px;
  min-height: calc(100vh - 200px);
}

body.player-on .main { padding-bottom: calc(var(--player-h) + 70px); }

.section-head {
  display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px;
}

.section-head h2 { font-size: 17px; font-weight: 700; margin: 0; }

.section-count { font-size: 12.5px; color: var(--text-3); }

/* ============ 歌曲列表 ============ */
.track-list { display: flex; flex-direction: column; gap: 4px; }

.track {
  display: flex; align-items: center; gap: 13px;
  padding: 8px 10px; border-radius: var(--radius);
  cursor: pointer; transition: background .13s;
  user-select: none;
}

.track:hover { background: #efeff4; }
.track:active { background: #e9e9f0; }

.track.playing { background: var(--accent-weak); }
.track.playing:hover { background: #e7e2ff; }

.cover-wrap { position: relative; flex: none; }

.cover {
  width: 48px; height: 48px; border-radius: 9px; object-fit: cover;
  background: var(--line); box-shadow: 0 2px 6px rgba(0,0,0,.08);
}

.cover-fallback {
  width: 48px; height: 48px; border-radius: 9px; background: linear-gradient(135deg, #d6d1ff, #b3aaff);
  display: grid; place-items: center; color: #fff;
}

.hover-play {
  position: absolute; inset: 0; border-radius: 9px;
  background: rgba(15, 12, 40, .45); color: #fff;
  display: grid; place-items: center; opacity: 0; transition: opacity .13s;
}
.track:hover .hover-play { opacity: 1; }

.track-meta { flex: 1; min-width: 0; }

.track-title {
  display: flex; align-items: center; gap: 7px;
  font-weight: 600; font-size: 14.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.track.playing .track-title { color: var(--accent); }

.track-artist {
  font-size: 12.5px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.badge {
  flex: none; font-size: 10.5px; line-height: 1; padding: 4px 6px;
  border-radius: 5px; font-weight: 600; letter-spacing: .3px;
}
.badge.full { color: var(--accent); background: var(--accent-weak); }
.badge.clip { color: var(--text-2); background: #ececf1; }
.track.playing .badge.full { background: #ded8ff; }

.track-dur { flex: none; font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }

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

/* ============ 状态提示 ============ */
.state {
  text-align: center; padding: 70px 20px; color: var(--text-3); font-size: 13.5px;
}
.state .icon { font-size: 34px; margin-bottom: 12px; opacity: .7; }
.state .sub { margin-top: 6px; font-size: 12.5px; }

.state button.retry {
  margin-top: 16px; padding: 8px 22px; border-radius: 18px;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 13px;
}
.state button.retry:hover { filter: brightness(1.08); }

/* 骨架屏 */
.skeleton { pointer-events: none; }
.skeleton .cover { background: linear-gradient(100deg, #ececf1 40%, #f6f6f9 50%, #ececf1 60%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skeleton .bar { border-radius: 6px; background: linear-gradient(100deg, #ececf1 40%, #f6f6f9 50%, #ececf1 60%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skeleton .bar.t { width: 55%; height: 13px; margin-bottom: 8px; }
.skeleton .bar.a { width: 35%; height: 11px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ============ 底部播放条 ============ */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  transform: translateY(105%);
  transition: transform .28s cubic-bezier(.3, .8, .3, 1);
}
.player.show { transform: translateY(0); }

.player-inner {
  max-width: 900px; margin: 0 auto; height: var(--player-h);
  padding: 0 20px; display: flex; align-items: center; gap: 18px;
}

.np { display: flex; align-items: center; gap: 11px; width: 240px; flex: none; min-width: 0; }

.np-cover {
  width: 52px; height: 52px; border-radius: 9px; object-fit: cover;
  background: var(--line); box-shadow: 0 3px 10px rgba(0,0,0,.12);
}
.np-cover.spin { animation: spin 22s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.np-meta { min-width: 0; }
.np-title { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-artist { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.controls { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }

.buttons { display: flex; align-items: center; gap: 14px; }

.ctrl {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; color: var(--text-2);
  transition: color .12s, background .12s, transform .08s;
}
.ctrl:hover { color: var(--text); background: #f0f0f4; }
.ctrl:active { transform: scale(.92); }

.ctrl.play {
  width: 42px; height: 42px; background: var(--text); color: #fff;
}
.ctrl.play:hover { background: #000; }

/* 图标切换：用按钮上的 class 控制，避开 SVG 上 hidden 属性不生效的问题 */
.ctrl.play .ic-pause, #btnMute #volOff { display: none; }
.ctrl.play.playing .ic-play, #btnMute.muted #volOn { display: none; }
.ctrl.play.playing .ic-pause, #btnMute.muted #volOff { display: block; }

/* 缓冲中：转圈 */
.ctrl.play.loading .ic-play, .ctrl.play.loading .ic-pause { display: none; }
.ctrl.play.loading::after {
  content: ""; width: 17px; height: 17px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  animation: rot .8s linear infinite;
}
@keyframes rot { to { transform: rotate(360deg); } }

.progress { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 560px; }

.time { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; flex: none; min-width: 32px; text-align: center; }

/* 滑杆通用 */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  height: 4px; border-radius: 2px; outline: none; cursor: pointer;
  background:
    linear-gradient(var(--accent), var(--accent)) 0 / var(--fill, 0%) 100% no-repeat,
    #e6e6ec;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  transition: transform .12s;
}
input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.25); }
input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff;
  background: var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: #e6e6ec; }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }

#seekBar { flex: 1; }
#volBar { width: 92px; }

.volume { display: flex; align-items: center; gap: 4px; flex: none; }

/* ============ Toast ============ */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--player-h) + 18px); z-index: 40;
  transform: translateX(-50%);
  background: rgba(28, 25, 50, .92); color: #fff;
  padding: 9px 18px; border-radius: 20px; font-size: 13px;
  animation: toast-in .22s ease;
  max-width: 86vw; text-align: center;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ============ 页脚 ============ */
.footer {
  text-align: center; padding: 24px 20px 30px;
  font-size: 12px; color: var(--text-3);
}
.footer a { color: var(--text-2); }
.footer a:hover { color: var(--accent); }

/* ============ 响应式 ============ */
@media (max-width: 680px) {
  .header-inner { padding: 12px 14px; gap: 12px; }
  .brand span.brand-text { display: none; }
  .owner-link .owner-text { display: none; }
  .owner-link { padding: 0 11px; }
  .main { padding: 20px 14px 60px; }
  .player-inner { padding: 0 14px; gap: 10px; }
  .np { width: auto; flex: 1; }
  .volume { display: none; }
  .progress { max-width: none; }
  .np-meta .np-artist { display: none; }
  .track-dur { display: none; }
}
