:root {
  --accent: #8b5cf6;
  --bg1: #1a1330;
  --bg2: #0c1b3a;
  --text: #f1f0f7;
  --muted: #9b98ad;
  --glass: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.12);
}
[data-theme='light'] {
  --bg1: #e8e4ff;
  --bg2: #dff1ff;
  --text: #1d1a2b;
  --muted: #6b6880;
  --glass: rgba(255, 255, 255, 0.55);
  --border: rgba(0, 0, 0, 0.08);
}
* { box-sizing: border-box; margin: 0; }
body {
  font-family: system-ui, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, var(--bg1), var(--bg2)) fixed;
  min-height: 100vh;
}
.glass {
  background: var(--glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.app { display: flex; min-height: 100vh; padding-bottom: 96px; }
.sidebar {
  width: 220px; margin: 16px; padding: 20px 14px;
  display: flex; flex-direction: column; gap: 8px;
  position: sticky; top: 16px; height: calc(100vh - 128px);
}
.logo { font-size: 22px; font-weight: 700; margin-bottom: 14px; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar nav a {
  color: var(--text); text-decoration: none; padding: 10px 12px;
  border-radius: 10px; transition: background 0.2s; white-space: nowrap;
}
.sidebar nav a:hover { background: rgba(255, 255, 255, 0.08); }
.sidebar nav a.active { background: var(--accent); color: #fff; }
.sidebar-bottom { display: flex; gap: 8px; align-items: center; }
main { flex: 1; padding: 24px; min-width: 0; }
h1 { margin-bottom: 16px; }
h2 { margin: 22px 0 12px; font-size: 17px; color: var(--muted); }
.muted { color: var(--muted); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.card { padding: 10px; transition: transform 0.2s, box-shadow 0.2s; cursor: pointer; }
.card:hover { transform: translateY(-4px); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25); }
.cover-wrap {
  position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden;
  background: rgba(127, 127, 127, 0.2);
  display: flex; align-items: center; justify-content: center; font-size: 40px;
}
.cover-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.play-overlay {
  position: absolute; right: 8px; bottom: 8px; width: 38px; height: 38px;
  border-radius: 50%; border: none; background: var(--accent); color: #fff;
  font-size: 15px; cursor: pointer; opacity: 0; transform: translateY(6px); transition: 0.2s;
}
.card:hover .play-overlay { opacity: 1; transform: none; }
.card-title { margin-top: 8px; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-artist { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-actions { display: flex; gap: 4px; margin-top: 4px; }

.list { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; padding: 8px 12px; cursor: pointer; transition: background 0.2s; }
.row:hover { background: rgba(255, 255, 255, 0.1); }
.row-cover {
  width: 44px; height: 44px; border-radius: 8px; overflow: hidden; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: rgba(127, 127, 127, 0.2); font-size: 20px;
}
.row-cover img { width: 100%; height: 100%; object-fit: cover; }
.row-main { flex: 1; min-width: 0; }
.row-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.searchbar { display: flex; gap: 8px; padding: 8px; max-width: 540px; margin-bottom: 18px; }
.searchbar input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 15px; padding: 6px 10px; }

.btn {
  background: var(--accent); color: #fff; border: none; border-radius: 999px;
  padding: 9px 18px; cursor: pointer; font-size: 14px; transition: filter 0.2s;
}
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn.big { font-size: 17px; padding: 14px 26px; }
.icon-btn {
  background: none; border: none; color: var(--text); font-size: 18px;
  cursor: pointer; padding: 6px 8px; border-radius: 50%; transition: background 0.2s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.12); }
.icon-btn.big { font-size: 26px; }
.icon-btn.small { font-size: 14px; padding: 4px 6px; }

#player-bar {
  position: fixed; left: 16px; right: 16px; bottom: 12px; z-index: 50;
  display: flex; align-items: center; gap: 18px; padding: 10px 18px;
}
.pb-left { display: flex; gap: 10px; align-items: center; width: 220px; min-width: 0; }
#pb-cover { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; background: rgba(127, 127, 127, 0.2); flex: none; }
#pb-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#pb-artist { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-center { flex: 1; display: flex; flex-direction: column; gap: 4px; align-items: center; min-width: 0; }
.pb-buttons { display: flex; gap: 10px; align-items: center; }
.pb-progress { display: flex; gap: 8px; width: 100%; max-width: 560px; align-items: center; font-size: 12px; color: var(--muted); }
.pb-right { display: flex; align-items: center; gap: 6px; }
input[type='range'] { flex: 1; accent-color: var(--accent); }
#volume { width: 90px; }

#fullscreen {
  position: fixed; inset: 0; z-index: 100;
  display: flex;
  background: #000;
}
#fullscreen.hidden { display: none; }
#fs-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; opacity: 0.85; }
#fs-close { position: absolute; top: 18px; left: 18px; z-index: 3; }

/* 流光背景容器 */
.fs-bg-glow-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}
.fs-bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.45;
  mix-blend-mode: screen;
  transition: background 1.8s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.glow-1 {
  width: 65vw;
  height: 65vw;
  left: -15vw;
  top: -15vw;
  background: var(--glow1, var(--accent));
  animation: float-glow1 35s ease-in-out infinite alternate;
}
.glow-2 {
  width: 70vw;
  height: 70vw;
  right: -20vw;
  bottom: -20vw;
  background: var(--glow2, #0c1b3a);
  animation: float-glow2 42s ease-in-out infinite alternate;
}
.glow-3 {
  width: 55vw;
  height: 55vw;
  left: 20vw;
  top: 30vw;
  background: var(--glow3, #1a1330);
  animation: float-glow3 50s ease-in-out infinite alternate;
}

@keyframes float-glow1 {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); }
  100% { transform: translate(12vw, 15vw) scale(1.2) rotate(120deg); }
}
@keyframes float-glow2 {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); }
  100% { transform: translate(-15vw, -10vw) scale(1.25) rotate(-180deg); }
}
@keyframes float-glow3 {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); }
  100% { transform: translate(-8vw, 8vw) scale(0.9) rotate(90deg); }
}

.fs-content {
  position: relative; z-index: 2; margin: auto; display: flex; gap: 60px;
  align-items: center; max-width: 960px; width: 100%; padding: 40px;
}
.fs-left { text-align: center; flex: 0.9; }
#fs-cover {
  width: 280px; height: 280px; border-radius: 50%; object-fit: cover;
  background: rgba(127, 127, 127, 0.2);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
  border: 6px solid rgba(255, 255, 255, 0.12);
  transition: transform 0.5s ease;
}
.rotating { animation: spin 30s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#fs-title { font-size: 22px; font-weight: 700; margin-top: 20px; text-shadow: 0 2px 10px rgba(0,0,0,0.5); }
#fs-artist { color: var(--muted); margin: 6px 0 16px; text-shadow: 0 1px 5px rgba(0,0,0,0.5); }

/* 歌词右侧包装 */
.fs-right {
  flex: 1.3;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 68vh;
  position: relative;
  min-width: 0;
}
.lyrics-control {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  z-index: 3;
}
.lyrics-control .btn {
  padding: 4px 12px;
  font-size: 11px;
}
.lyrics-control span {
  font-size: 12px;
  min-width: 90px;
  text-align: center;
}
.fs-lyrics {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: none;
  mask-image: linear-gradient(to bottom, transparent 0%, white 20%, white 80%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, white 20%, white 80%, transparent 100%);
  padding: 24vh 0; /* 留白让上下歌词都能滚到中间 */
}
.fs-lyrics::-webkit-scrollbar { display: none; }
.fs-lyrics p {
  padding: 14px 0;
  color: var(--text);
  opacity: 0.35;
  cursor: pointer;
  transition: opacity 0.35s ease, transform 0.35s ease, color 0.35s ease;
  font-size: 18px;
  font-weight: 500;
  text-align: left;
  transform-origin: left center;
  line-height: 1.4;
}
.fs-lyrics p.active {
  color: #fff;
  opacity: 1;
  font-weight: 700;
  transform: scale(1.08);
  text-shadow: 0 0 20px rgba(255,255,255,0.4);
}

dialog.glass {
  border: 1px solid var(--border); padding: 26px; width: min(92vw, 380px);
  color: var(--text); background: var(--bg1); border-radius: 18px;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); }
dialog form { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
dialog input {
  background: rgba(127, 127, 127, 0.15); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; color: var(--text); outline: none;
}
.picker-form { flex-direction: column; }
.picker-item {
  display: block; width: 100%; text-align: left; padding: 10px 12px;
  background: none; border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); cursor: pointer; margin-bottom: 8px; font-size: 14px;
}
.picker-item:hover { background: rgba(255, 255, 255, 0.08); }
.error { color: #ff7a7a; font-size: 13px; min-height: 16px; }

.toast {
  position: fixed; bottom: 110px; left: 50%; transform: translateX(-50%);
  padding: 10px 20px; z-index: 200; animation: fadein 0.25s;
}
@keyframes fadein { from { opacity: 0; transform: translate(-50%, 8px); } }

.skeleton { height: 220px; position: relative; overflow: hidden; }
.skeleton::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.recognize { padding: 40px; text-align: center; display: flex; flex-direction: column; gap: 18px; align-items: center; max-width: 540px; }
.rec-out { min-height: 40px; }
.rec-result { display: flex; gap: 14px; align-items: center; }
.rec-result img { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; }

.src-form { display: flex; flex-direction: column; gap: 10px; padding: 18px; max-width: 560px; }
.src-form input {
  background: rgba(127, 127, 127, 0.15); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; color: var(--text); outline: none; font-size: 14px;
}

/* 均衡器面板 */
.eq-panel {
  position: absolute; right: 20px; top: 80px; z-index: 2;
  padding: 16px; width: 320px; max-height: 60vh; overflow-y: auto;
}
.eq-panel.hidden { display: none; }
.eq-header { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.eq-header select { padding: 4px 10px; }
.eq-bands { display: flex; gap: 16px; align-items: flex-end; height: 140px; }
.eq-band { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; }
.eq-band label { font-size: 11px; color: var(--muted); }
.eq-band input[type='range'] {
  writing-mode: vertical-lr; direction: rtl; /* 竖滑条 */
  height: 100px; width: 20px;
}

/* 播放队列抽屉 */
.queue-drawer {
  position: fixed;
  right: -360px; /* 默认隐藏在右边 */
  top: 16px;
  bottom: 84px;
  width: 320px;
  z-index: 90;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: right 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: -10px 0 30px rgba(0,0,0,0.3);
}
.queue-drawer.show {
  right: 16px;
}
.queue-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.queue-header h3 {
  font-size: 15px;
  font-weight: 700;
}
.queue-list {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.queue-list::-webkit-scrollbar { display: none; }
.queue-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}
.queue-item:hover {
  background: rgba(255, 255, 255, 0.06);
}
.queue-item.active {
  background: rgba(255, 255, 255, 0.08);
  border-left: 3px solid var(--accent);
}
.queue-item.active .queue-title {
  color: var(--accent);
  font-weight: 600;
}
.queue-item-main {
  flex: 1;
  min-width: 0;
}
.queue-title {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue-artist {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 760px) {
  .app { flex-direction: column; padding-bottom: 140px; }
  .sidebar { width: auto; height: auto; position: static; flex-direction: row; align-items: center; margin: 10px; padding: 10px; }
  .sidebar nav { flex-direction: row; overflow-x: auto; }
  .logo { margin: 0 8px 0 0; font-size: 18px; }
  .sidebar-bottom { flex: none; }
  main { padding: 14px; }
  .fs-content { flex-direction: column; gap: 24px; overflow-y: auto; padding: 70px 20px 30px; }
  #fs-cover { width: 180px; height: 180px; }
  .pb-left { width: auto; }
  .pb-right { display: flex; align-items: center; gap: 4px; }
  .pb-right input[type='range'] { display: none; }
  .queue-drawer {
    bottom: 140px;
    width: calc(100vw - 32px);
  }
}
