:root {
  --bg: #06090f;
  --panel: rgba(14, 18, 27, 0.72);
  --line: rgba(173, 202, 255, 0.18);
  --text: #eef4ff;
  --mute: #8ea0be;
  --accent: #4df1c6;
  --lyric-active-text: #ffffff;
  --lyric-fill-color: #5aa2ff;
  --lyric-font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Trebuchet MS", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 15% -10%, rgba(255, 255, 255, 0.07) 0%, rgba(7, 11, 20, 0) 58%),
    radial-gradient(1000px 560px at 90% 120%, rgba(255, 255, 255, 0.05) 0%, rgba(7, 11, 20, 0) 60%),
    linear-gradient(130deg, #020304 0%, #050608 35%, #08090b 70%, #020304 100%);
  background-size: 120% 120%, 120% 120%, 180% 180%;
  animation: bgDarkShift 26s ease-in-out infinite;
  overflow: hidden;
}
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  background-image: radial-gradient(rgba(255,255,255,.55) 0.4px, transparent 0.4px);
  background-size: 3px 3px;
}
.glow { position: fixed; width: 42vw; height: 42vw; border-radius: 50%; filter: blur(90px); pointer-events: none; }
.glow-a {
  left: -10vw;
  top: -14vw;
  background: rgba(255, 255, 255, 0.06);
  animation: orbA 22s ease-in-out infinite;
}
.glow-b {
  right: -12vw;
  bottom: -20vw;
  background: rgba(255, 255, 255, 0.05);
  animation: orbB 24s ease-in-out infinite;
}

.layout {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 320px 1fr 320px;
  grid-template-rows: 1fr 176px;
  gap: 14px;
  height: 100vh;
  padding: 14px 14px 0;
}
.panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 38px rgba(0,0,0,.35);
}
.left { padding: 16px; display: grid; grid-template-rows: auto auto auto auto; gap: 10px; align-content: start; }
.brand { letter-spacing: 0.22em; font-size: 0.78rem; color: #9eb4d9; }
.cover { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); }
h1 { margin: 4px 0 0; font-size: 1.25rem; }
#artist { display: none; }
.side-controls { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 6px; }
.mini-timeline {
  grid-column: 1 / 5;
  display: grid;
  grid-template-columns: 46px 1fr 46px;
  align-items: center;
  gap: 8px;
  color: var(--mute);
  font-size: .78rem;
}
#mini-progress { width: 100%; accent-color: var(--accent); }

.center { position: relative; overflow: hidden; }
#btn-full { position: absolute; top: 12px; right: 12px; z-index: 9; }
.lyric-settings {
  position: absolute;
  top: calc(12px + 42px + 8px);
  right: 12px;
  z-index: 9;
}
#btn-lyric-settings {
  position: absolute !important;
  top: calc(12px + 42px + 8px) !important;
  right: 12px !important;
  left: auto !important;
  z-index: 10 !important;
}
.lyrics-mask {
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-y: auto;
  overflow-x: hidden;
  mask-image: linear-gradient(to bottom, transparent 0%, #000 16%, #000 84%, transparent 100%);
  scrollbar-width: none;
}
.lyrics-mask::-webkit-scrollbar { width: 0; height: 0; display: none; }
#lyrics-stage.controls-hidden #btn-full,
#lyrics-stage.controls-hidden #btn-lyric-settings {
  opacity: 0;
  pointer-events: none;
}
#btn-full, #btn-lyric-settings {
  transition: opacity .2s ease;
}
#fullscreen-spectrum {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 88px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}
#lyrics {
  width: min(900px, 92%);
  text-align: center;
  transition: transform .24s ease;
  font-family: var(--lyric-font);
}
#lyrics p {
  margin: 14px 0;
  opacity: .18;
  transform: scale(.92);
  transition: all .16s ease;
  font-size: clamp(1rem, 2.35vw, 1.6rem);
  cursor: pointer;
}
#lyrics p.active {
  opacity: 1;
  transform: scale(1.22);
  filter: drop-shadow(0 0 10px rgba(255,255,255,0.24));
}
.lyric-line { position: relative; display: inline-block; }
.base { color: #8fa4c5; }
#lyrics p.active .base { color: var(--lyric-active-text); }
.fill {
  position: absolute;
  top: 0;
  left: 0;
  width: 0%;
  overflow: hidden;
  white-space: nowrap;
  color: var(--lyric-fill-color);
  text-shadow: 0 0 16px color-mix(in srgb, var(--lyric-fill-color) 55%, transparent);
  transition: width .08s linear;
}

.right { padding: 14px; display: flex; flex-direction: column; min-height: 0; }
.right-head { display: flex; justify-content: space-between; color: var(--mute); margin-bottom: 10px; }
#list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  min-height: 0;
  flex: 1;
}
#list li {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
  cursor: pointer;
}
#list li:hover { background: rgba(255,255,255,.07); border-color: var(--line); }
#list li.active { background: rgba(77,241,198,.2); border-color: rgba(77,241,198,.45); color: #dcfff4; }

.bottom {
  grid-column: 1 / 4;
  width: 100%;
  justify-self: center;
  padding: 10px 14px 0;
  border-bottom: none;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
#spectrum { width: 100%; opacity: .95; display: block; }
#volume { width: 100%; accent-color: var(--accent); }
.controls { display: grid; grid-template-columns: 1fr; gap: 8px; align-items: center; margin-top: 10px; }
.icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.07);
  color: var(--text);
  cursor: pointer;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.icon.primary { background: rgba(77,241,198,.24); border-color: rgba(77,241,198,.5); }
.icon::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(9,12,19,.95);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 4px 8px;
  white-space: nowrap;
  font-size: .78rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
}
.icon:hover::after { opacity: 1; }
.vol { justify-self: end; color: var(--mute); display: flex; align-items: center; gap: 8px; }
#status { margin: 8px 0 0; color: var(--mute); font-size: .88rem; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.modal.hidden { display: none; }
.modal-card {
  position: relative;
  width: min(320px, 90vw);
  background: rgba(12, 16, 24, 0.96);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}
.modal-card h3 { margin: 0 0 12px; font-size: 1rem; padding-right: 120px; }
.color-label {
  display: block;
  margin: 8px 0 4px;
  color: var(--mute);
  font-size: 0.86rem;
}
#lyric-text-color, #lyric-fill-color { width: 100%; height: 44px; border: 0; background: transparent; padding: 0; }
.modal-actions {
  position: absolute;
  top: 10px;
  right: 12px;
  display: flex;
  gap: 8px;
}
.text-btn { width: auto; padding: 0 14px; }
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(0, 0, 0, .84);
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-overlay.hidden { display: none; }
.auth-card {
  width: min(360px, 92vw);
  background: rgba(10, 14, 22, 0.96);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}
.auth-card h3 { margin: 0 0 10px; }
#auth-input {
  width: 100%;
  margin-bottom: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.05);
  color: var(--text);
  padding: 10px 12px;
}
#auth-msg {
  min-height: 20px;
  color: #ff9fa8;
  font-size: .82rem;
}

#lyrics-stage:fullscreen {
  background: radial-gradient(circle at 20% 0%, #15385d 0%, #0a111c 45%, #06090f 100%);
}
#lyrics-stage:fullscreen #lyrics { width: min(1220px, 94%); }
#lyrics-stage:fullscreen #fullscreen-spectrum { opacity: .95; }
#lyrics-stage.spectrum-dim #fullscreen-spectrum { opacity: .72 !important; }
#lyrics-stage:fullscreen #btn-full {
  top: 12px !important;
  right: 12px !important;
}
#lyrics-stage:fullscreen #btn-lyric-settings {
  top: calc(12px + 42px + 8px) !important;
  right: 12px !important;
  left: auto !important;
}

@media (max-width: 1100px) {
  body { overflow-y: auto; }
  .layout {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
  }
  .bottom { grid-column: auto; width: 100%; }
  .vol { justify-self: start; }
}

@keyframes bgDarkShift {
  0% { background-position: 0% 0%, 100% 100%, 0% 50%; }
  50% { background-position: 8% 4%, 92% 96%, 100% 50%; }
  100% { background-position: 0% 0%, 100% 100%, 0% 50%; }
}
@keyframes orbA {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(6vw, 5vh, 0) scale(1.08); }
  100% { transform: translate3d(0, 0, 0) scale(1); }
}
@keyframes orbB {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-7vw, -4vh, 0) scale(1.1); }
  100% { transform: translate3d(0, 0, 0) scale(1); }
}
