:root {
  --bg: #0f1014;
  --bg-elev: #171922;
  --card: #1e202a;
  --text: #f3f4f6;
  --sub: #a1a7b3;
  --accent: #ff5a5f;
  --accent-2: #ff8a4c;
  --border: rgba(255,255,255,0.08);
  --hero-bg: linear-gradient(135deg, #2b1d22, #1a1c26 65%);
  --mini-bg: rgba(28,30,40,0.98);
  --shadow: 0 8px 24px rgba(0,0,0,0.35);
  --input-bg: #232634;
}
html[data-theme="light"] {
  --bg: #f6f7fb;
  --bg-elev: #ffffff;
  --card: #ffffff;
  --text: #1a1d24;
  --sub: #6b7280;
  --accent: #ff4d4f;
  --accent-2: #ff7a45;
  --border: rgba(0,0,0,0.08);
  --hero-bg: linear-gradient(135deg, #ffe9e6, #ffffff 65%);
  --mini-bg: rgba(255,255,255,0.98);
  --shadow: 0 8px 24px rgba(20,20,40,0.12);
  --input-bg: #eef0f5;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
  transition: background .25s ease, color .25s ease;
}
button, input { font: inherit; color: inherit; }
button { border: none; background: none; cursor: pointer; }
ul { list-style: none; }
svg { display: block; }

.app {
  height: 100dvh;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}
.top-bar {
  padding: calc(14px + env(safe-area-inset-top)) 16px 10px;
  background: var(--bg);
  flex-shrink: 0;
}
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.brand { min-width: 0; }
.top-title { font-size: 22px; font-weight: 700; line-height: 1.2; }
.top-sub { font-size: 12px; color: var(--sub); margin-top: 4px; }
.theme-btn {
  width: 38px; height: 38px; border-radius: 12px; background: var(--bg-elev);
  border: 1px solid var(--border); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.search-bar { display: flex; gap: 8px; }
.search-bar input {
  flex: 1; min-width: 0; height: 40px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--input-bg); padding: 0 12px; outline: none; color: var(--text);
}
.search-bar input::placeholder { color: var(--sub); }
.search-bar button {
  height: 40px; padding: 0 14px; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 600; flex-shrink: 0;
}

.content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 16px calc(140px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}
.hero {
  display: flex; gap: 14px; padding: 14px; border-radius: 16px;
  background: var(--hero-bg); border: 1px solid var(--border);
  margin-bottom: 18px; align-items: center;
}
.hero-cover {
  width: 108px; height: 108px; border-radius: 12px; background: #333 center/cover no-repeat; flex-shrink: 0;
}
.hero-info { flex: 1; min-width: 0; }
.hero-tag {
  display: inline-block; font-size: 11px; color: #fff; background: linear-gradient(90deg, var(--accent), var(--accent-2));
  padding: 3px 8px; border-radius: 999px; margin-bottom: 8px;
}
.hero-info h2 { font-size: 18px; line-height: 1.3; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-info p { color: var(--sub); font-size: 13px; margin-bottom: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.play-hero-btn { background: var(--text); color: var(--bg); font-weight: 600; font-size: 13px; padding: 7px 14px; border-radius: 999px; }

.section-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 10px; }
.section-head h3 { font-size: 17px; }
.section-tip { font-size: 12px; color: var(--sub); }
.status-msg { font-size: 13px; color: var(--sub); padding: 4px 4px 8px; min-height: 20px; }

.song-list { display: flex; flex-direction: column; gap: 4px; }
.song-item { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 12px; }
.song-item:active { background: var(--bg-elev); }
.song-item.active .song-title { color: var(--accent); }
.song-cover { width: 52px; height: 52px; border-radius: 10px; background: #444 center/cover no-repeat; flex-shrink: 0; }
.song-meta { flex: 1; min-width: 0; }
.song-title { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-artist { font-size: 12px; color: var(--sub); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-right { width: 20px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.playing-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.playing-bars span { width: 3px; background: var(--accent); border-radius: 2px; animation: bar 0.8s ease-in-out infinite; }
.playing-bars span:nth-child(2) { animation-delay: .15s; }
.playing-bars span:nth-child(3) { animation-delay: .3s; }
@keyframes bar { 0%,100% { height: 4px; } 50% { height: 12px; } }

.mini-player {
  position: fixed;
  left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom));
  background: var(--mini-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  z-index: 100;
}
.mini-progress { height: 2px; background: var(--border); }
.mini-progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .1s linear; }
.mini-body { display: flex; align-items: center; gap: 10px; padding: 8px 10px; height: 58px; }
.mini-cover { width: 42px; height: 42px; border-radius: 8px; background: #444 center/cover no-repeat; flex-shrink: 0; }
.mini-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.mini-title { font-size: 14px; font-weight: 500; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-artist { font-size: 11px; color: var(--sub); margin-top: 2px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; flex-shrink: 0; color: var(--text); }
.icon-btn:active { background: var(--border); }
.icon-btn.placeholder { visibility: hidden; }
.icon-wrap { display: inline-flex; align-items: center; justify-content: center; }

.full-player {
  position: fixed; inset: 0; z-index: 200; background: var(--bg);
  transform: translateY(0); opacity: 1;
  transition: transform .28s ease, opacity .28s ease;
}
.full-player.hidden { transform: translateY(100%); opacity: 0; pointer-events: none; }
.full-bg {
  position: absolute; inset: -40px; background: #222 center/cover no-repeat;
  filter: blur(50px) brightness(0.45); transform: scale(1.2);
}
html[data-theme="light"] .full-bg { filter: blur(50px) brightness(0.8) saturate(1.1); }
.full-inner {
  position: relative; height: 100%; display: flex; flex-direction: column;
  padding: calc(14px + env(safe-area-inset-top)) 20px calc(28px + env(safe-area-inset-bottom));
}
.full-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.full-header-title { font-size: 13px; color: var(--sub); }
.full-cover-wrap { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 8px 0; }
.full-cover {
  width: min(76vw, 320px); height: min(76vw, 320px); border-radius: 20px;
  background: #333 center/cover no-repeat; box-shadow: 0 20px 50px rgba(0,0,0,0.4);
}
.full-meta { margin: 8px 0 14px; min-height: 56px; }
.full-meta h2 { font-size: 22px; line-height: 1.3; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.full-meta p { color: var(--sub); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress-area { margin-bottom: 8px; }
#progressRange {
  width: 100%; height: 4px; -webkit-appearance: none; appearance: none;
  background: var(--border); border-radius: 2px; outline: none;
}
#progressRange::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--text); border: none;
}
#progressRange::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--text); border: none; }
.time-row { display: flex; justify-content: space-between; font-size: 11px; color: var(--sub); margin-top: 8px; }
.controls { display: flex; align-items: center; justify-content: center; gap: 34px; margin-top: 6px; }
.ctrl-btn { width: 54px; height: 54px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--text); }
.ctrl-btn.main { width: 68px; height: 68px; background: var(--text); color: var(--bg); }
.ctrl-btn:active { transform: scale(0.96); }
