:root {
  --bg: #e8e0d6;
  --ambient-1: #eccac2;
  --ambient-2: #d9d0b8;
  --surface-1: #fcfaf6;
  --surface-2: #f3ede6;
  --shell-border: rgba(255, 255, 255, 0.72);
  --shell-shadow: 0 42px 96px -52px rgba(70, 45, 35, 0.58), 0 2px 10px rgba(50, 35, 25, 0.07);
  --panel: rgba(255, 255, 255, 0.70);
  --panel-border: rgba(33, 30, 28, 0.08);
  --inset-hi: rgba(255, 255, 255, 0.72);
  --ink: #211e1c;
  --muted: #776f68;
  --faint: #b1a69c;
  --accent: #c2455c;
  --accent-2: #d9776f;
  --track: rgba(33, 30, 28, 0.10);
  --card: rgba(255, 255, 255, 0.62);
  --card-border: rgba(33, 30, 28, 0.10);
  --row-hover: rgba(33, 30, 28, 0.04);
  --row-current: rgba(194, 69, 92, 0.09);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  padding: 22px;
  color: var(--ink);
  background:
    radial-gradient(920px 620px at 10% -6%, var(--ambient-1) 0%, transparent 62%),
    radial-gradient(780px 540px at 94% 104%, var(--ambient-2) 0%, transparent 58%),
    var(--bg);
  font-family: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.audio { display: none; }

.app {
  position: relative;
  height: calc(100vh - 44px);
  height: calc(100dvh - 44px);
  max-width: 1180px;
  margin: 0 auto;
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(165deg, var(--surface-1), var(--surface-2));
  border: 1px solid var(--shell-border);
  box-shadow: var(--shell-shadow);
}
.drawer-backdrop { display: none; }

/* 歌词 + 控制区 */
.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 28px 46px calc(30px + env(safe-area-inset-bottom));
  background: radial-gradient(760px 460px at 0% 0%, color-mix(in srgb, var(--ambient-1) 26%, transparent) 0%, transparent 64%);
}
.stage__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  letter-spacing: 0.14em;
  color: var(--muted);
}
.brand__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}
.brand strong {
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.06em;
}
.brand__mode {
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-size: 10.5px;
  letter-spacing: 0.08em;
}
.brand__mode[hidden] { display: none; }

.queue-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  backdrop-filter: blur(8px);
}

.lyrics {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 16%, #000 84%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 16%, #000 84%, transparent 100%);
}
.lyrics,
.lyrics * {
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
  -webkit-user-drag: none !important;
}
.lyrics__inner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  text-align: center;
  transform: translateY(0);
  transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: transform;
}
.lyrics p {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 760px;
  margin: 0 auto 18px;
  max-height: 3.2em;
  font-size: 16px;
  line-height: 1.6;
  color: var(--faint);
  letter-spacing: 0.01em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.2s, font-size 0.2s;
}
.lyrics p:last-child { margin-bottom: 0; }
.lyrics p:hover { color: var(--muted); }
.lyrics p.is-active {
  color: var(--ink);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  text-shadow: 0 2px 24px color-mix(in srgb, var(--accent) 22%, transparent);
}
.lyrics p.lyrics__empty {
  font-size: 14px;
  color: var(--muted);
  cursor: default;
}

.controls {
  flex: none;
  padding-top: 6px;
}
.progress {
  display: flex;
  align-items: center;
  gap: 13px;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.progress__track {
  position: relative;
  flex: 1;
  height: 5px;
  border-radius: 999px;
  background: var(--track);
  cursor: pointer;
  touch-action: none;
}
.progress__track::before {
  content: "";
  position: absolute;
  inset: -18px 0;
}
.progress__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  pointer-events: none;
}
.progress__thumb {
  position: absolute;
  top: 50%;
  left: 0;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  pointer-events: none;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent),
              0 3px 10px rgba(0, 0, 0, 0.25);
}
.progress__now { color: var(--ink); }

.now { margin-top: 18px; }
.song__title {
  margin: 0 0 5px;
  font-size: 27px;
  font-weight: 600;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.song__artist {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  margin-top: 20px;
}
.btn {
  display: grid;
  place-items: center;
  border: 1px solid var(--card-border);
  border-radius: 50%;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
  backdrop-filter: blur(10px);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.progress__track[aria-disabled="true"] { cursor: default; }
.btn--side { width: 46px; height: 46px; }
.btn--play {
  width: 62px;
  height: 62px;
  border: none;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 16px 34px -14px color-mix(in srgb, var(--accent) 85%, transparent);
}
.btn svg { width: 18px; height: 18px; }
.btn--play svg { width: 21px; height: 21px; }
.btn--play .icon-pause { display: none; }
.btn--play.is-playing .icon-play { display: none; }
.btn--play.is-playing .icon-pause { display: block; }

/* 右下角：播放列表 / 精选音乐 */
.playlist {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 15;
  width: 340px;
  max-height: min(52vh, 460px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  overflow: hidden;
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: inset 0 1px 0 var(--inset-hi), 0 24px 60px -30px rgba(0, 0, 0, 0.55);
}
.playlist__handle { display: none; }
.playlist__tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px;
  flex: none;
}
.playlist__tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  white-space: nowrap;
  cursor: pointer;
}
.playlist__tab span {
  font-size: 10.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.playlist__tab:hover { color: var(--ink); background: var(--row-hover); }
.playlist__tab.is-active {
  background: var(--row-current);
  color: var(--accent);
  font-weight: 600;
}
.playlist__tab.is-active span { color: var(--accent); }
.playlist__close {
  flex: none;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.playlist__close:hover { background: var(--row-hover); color: var(--ink); }
.playlist__body {
  display: none;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 8px 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--track) transparent;
}
.playlist.is-open .playlist__body { display: block; }
.playlist:not(.is-open) .playlist__close { display: none; }

.queue__list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.queue__item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 11px;
  cursor: pointer;
}
.queue__item + .queue__item { margin-top: 1px; }
.queue__item:hover { background: var(--row-hover); }
.queue__item.is-current { background: var(--row-current); }
.queue__empty {
  padding: 26px 10px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
}

.queue__thumb {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--tint, var(--accent));
  color: rgba(255, 255, 255, 0.92);
  font-size: 14px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}
.queue__main { min-width: 0; }
.queue__title {
  display: block;
  font-size: 14px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue__item.is-current .queue__title { font-weight: 600; }
.queue__artist {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue__time {
  font-size: 11px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

/* 移动端：单栏 + 底部抽屉 */
@media (max-width: 960px) {
  body { padding: 8px; }
  .app {
    height: calc(100vh - 16px);
    height: calc(100dvh - 16px);
    border-radius: 18px;
  }
  .stage { padding: 20px 18px calc(26px + env(safe-area-inset-bottom)); }
  .queue-toggle { display: inline-flex; }

  .drawer-backdrop {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 10;
    background: rgba(8, 6, 6, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s;
  }
  .app.is-drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }

  .playlist {
    inset: auto 0 0 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-height: 74%;
    z-index: 20;
    border: none;
    border-top: 1px solid var(--panel-border);
    border-radius: 20px 20px 0 0;
    background: var(--surface-1);
    box-shadow: 0 -24px 60px -24px rgba(0, 0, 0, 0.6);
    transform: translateY(104%);
    transition: transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
  }
  .app.is-drawer-open .playlist { transform: translateY(0); }
  .playlist__handle {
    display: block;
    flex: none;
    width: 38px;
    height: 4px;
    margin: 10px auto 4px;
    border-radius: 999px;
    background: var(--track);
  }
  .playlist__tabs { padding: 4px 10px 8px; }
  .playlist__body { display: block; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .playlist__close { display: none; }

  .lyrics p { font-size: 14.5px; margin-bottom: 14px; max-width: 100%; }
  .lyrics p.is-active { font-size: clamp(19px, 5.8vw, 22px); }
  .song__title { font-size: 22px; }
  .buttons { gap: 24px; margin-top: 16px; }
  .btn--play { width: 58px; height: 58px; }
}

/* 横屏或矮窗口：压缩纵向占用 */
@media (max-height: 560px) {
  body { padding: 6px; }
  .app {
    height: calc(100vh - 12px);
    height: calc(100dvh - 12px);
    border-radius: 16px;
  }
  .stage { padding: 14px 22px calc(14px + env(safe-area-inset-bottom)); }
  .lyrics p { font-size: 12.5px; margin-bottom: 7px; }
  .lyrics p.is-active { font-size: 18px; }
  .now { margin-top: 10px; }
  .song__title { font-size: 19px; margin-bottom: 2px; }
  .song__artist { font-size: 12px; }
  .buttons { gap: 22px; margin-top: 10px; }
  .btn--side { width: 40px; height: 40px; }
  .btn--play { width: 50px; height: 50px; }
  .btn svg { width: 16px; height: 16px; }
  .btn--play svg { width: 18px; height: 18px; }
  .progress { font-size: 10.5px; }
  .playlist { max-height: 66%; }
}
