:root {
  color-scheme: dark;
  --bg: #080b10;
  --bg-deep: #05070a;
  --surface: rgba(17, 22, 30, .86);
  --surface-solid: #11161e;
  --surface-raised: #171e29;
  --surface-soft: #0d1118;
  --text: #f5f8fc;
  --text-soft: #c8d0dc;
  --muted: #929dac;
  --faint: #697383;
  --line: rgba(220, 232, 248, .11);
  --line-strong: rgba(220, 232, 248, .19);
  --accent: #8dc7ff;
  --accent-strong: #c3e2ff;
  --accent-ink: #06101a;
  --accent-soft: rgba(141, 199, 255, .11);
  --danger: #ff9eaa;
  --radius-xs: 10px;
  --radius-sm: 14px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --shadow-card: 0 24px 80px rgba(0, 0, 0, .32);
  --shadow-dock: 0 18px 54px rgba(0, 0, 0, .56);
  --focus: 0 0 0 3px rgba(141, 199, 255, .32);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 0; min-height: 100%; background: var(--bg); scrollbar-gutter: stable; }
body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 3%, rgba(68, 133, 199, .14), transparent 26rem),
    radial-gradient(circle at 92% 31%, rgba(70, 97, 143, .11), transparent 30rem),
    linear-gradient(155deg, var(--bg) 0%, var(--bg-deep) 72%);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 0;
  opacity: .22;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 74%);
}
button, input { color: inherit; font: inherit; }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:disabled { opacity: .42; cursor: not-allowed; }
svg { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 0; box-shadow: var(--focus); }
::selection { color: var(--text); background: rgba(141, 199, 255, .3); }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  height: calc(68px + env(safe-area-inset-top));
  display: grid;
  grid-template-columns: minmax(72px, 1fr) minmax(0, auto) minmax(72px, 1fr);
  align-items: end;
  gap: 12px;
  padding: env(safe-area-inset-top) clamp(16px, 3.5vw, 48px) 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 11, 16, .78);
  backdrop-filter: blur(20px) saturate(125%);
}
.back-link { width: fit-content; min-height: 44px; display: inline-flex; align-items: center; gap: 7px; color: var(--text-soft); text-decoration: none; font-size: 14px; }
.back-link svg { width: 19px; height: 19px; }
.topbar-title { min-width: 0; display: grid; align-self: center; justify-items: center; gap: 2px; }
.topbar-title strong { font-size: 15px; font-weight: 720; letter-spacing: .02em; }
.topbar-title span { max-width: min(42vw, 260px); overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.header-button { position: relative; justify-self: end; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.header-button span { position: absolute; top: -4px; right: -4px; min-width: 19px; height: 19px; padding: 0 5px; border: 2px solid var(--bg); border-radius: 10px; color: var(--accent-ink); background: var(--accent); font-size: 10px; font-weight: 800; line-height: 15px; }

.app-shell { width: min(100%, 1220px); margin: 0 auto; padding: clamp(20px, 4vw, 48px) clamp(14px, 4vw, 48px) 132px; }
.now-playing {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(220px, 340px) minmax(0, 1fr);
  grid-template-areas: "cover copy" "cover transport";
  align-items: end;
  gap: 20px 42px;
  padding: clamp(18px, 3vw, 30px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(23, 30, 41, .9), rgba(12, 16, 23, .82));
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(18px) saturate(118%);
}
.cover {
  grid-area: cover;
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  display: grid;
  place-items: end start;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, #26374d, #111722 58%, #325d83);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.035), 0 20px 50px rgba(0,0,0,.28);
}
.cover::before { content: ""; position: absolute; inset: 13%; border: 1px solid rgba(255,255,255,.17); border-radius: 50%; box-shadow: 0 0 0 34px rgba(255,255,255,.024), 0 0 0 72px rgba(255,255,255,.016); }
.cover::after { content: ""; position: absolute; width: 21%; aspect-ratio: 1; top: 39.5%; left: 39.5%; border-radius: 50%; background: var(--accent); box-shadow: 0 0 42px rgba(141,199,255,.38); }
.cover span { position: relative; z-index: 1; margin: 20px; color: rgba(255,255,255,.72); font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 11px; font-weight: 700; letter-spacing: .22em; }
.now-copy { grid-area: copy; min-width: 0; padding-top: 4px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 11px; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; }
.now-copy .eyebrow { display: flex; align-items: center; gap: 8px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px rgba(141,199,255,.08); }
.now-copy h1 { max-width: 100%; margin: 0; overflow: hidden; font-size: clamp(27px, 4vw, 43px); font-weight: 760; letter-spacing: -.035em; line-height: 1.12; text-overflow: ellipsis; white-space: nowrap; }
.now-copy > p:not(.eyebrow) { margin: 9px 0 0; overflow: hidden; color: var(--muted); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.favorite-current { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--text-soft); background: rgba(255,255,255,.025); cursor: pointer; }
.favorite-current svg { width: 17px; height: 17px; }
.favorite-current.active { color: #ffc3cc; border-color: rgba(255,158,170,.28); background: rgba(255,158,170,.08); }
.favorite-current.active svg { fill: currentColor; }

.transport { grid-area: transport; min-width: 0; }
.seek, .volume-row input { width: 100%; margin: 0; cursor: pointer; accent-color: var(--accent); }
.seek { display: block; height: 20px; }
.time-row { display: flex; justify-content: space-between; margin-top: -2px; color: var(--muted); font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 11px; font-variant-numeric: tabular-nums; }
.control-row { display: grid; grid-template-columns: minmax(52px, 1fr) 48px 64px 48px minmax(52px, 1fr); align-items: center; gap: 10px; margin-top: 14px; }
.control-row button { border: 0; cursor: pointer; }
.secondary-control { min-width: 0; height: 46px; display: grid; place-items: center; gap: 1px; border-radius: var(--radius-sm); color: var(--muted); background: transparent; font-size: 10px; }
.secondary-control svg { width: 19px; height: 19px; }
.secondary-control.active { color: var(--accent-strong); background: var(--accent-soft); }
.skip-button { width: 48px; height: 48px; display: grid; place-items: center; padding: 0; border-radius: 50%; background: var(--surface-raised); }
.play-button { width: 64px; height: 64px; display: grid; place-items: center; padding: 0; border-radius: 50%; color: var(--accent-ink); background: var(--accent); box-shadow: 0 12px 36px rgba(60,125,184,.28); }
.play-button svg { grid-area: 1 / 1; width: 27px; height: 27px; }
.play-button .icon-pause, .dock-play .icon-pause { display: none; }
.is-playing .play-button .icon-play, .is-playing .dock-play .icon-play { display: none; }
.is-playing .play-button .icon-pause, .is-playing .dock-play .icon-pause { display: block; }
.volume-row { display: flex; align-items: center; gap: 10px; margin-top: 16px; color: var(--muted); }
.volume-row svg { flex: 0 0 auto; width: 17px; height: 17px; }

.library { min-width: 0; margin-top: 38px; }
.library-heading { display: flex; align-items: end; justify-content: space-between; gap: 22px; }
.library-heading h2 { margin: 0; font-size: clamp(25px, 3vw, 32px); font-weight: 760; letter-spacing: -.025em; }
.search-box { width: min(430px, 50%); height: 46px; display: flex; align-items: center; gap: 10px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--muted); background: rgba(17,22,30,.72); }
.search-box:focus-within { border-color: rgba(141,199,255,.5); box-shadow: var(--focus); }
.search-box svg { flex: 0 0 auto; width: 18px; height: 18px; }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 14px; }
.search-box input::placeholder { color: var(--faint); }
.view-tabs { display: flex; gap: 6px; margin-top: 22px; padding-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.view-tabs::-webkit-scrollbar { display: none; }
.view-tabs button { flex: 0 0 auto; min-height: 44px; padding: 0 17px; border: 1px solid transparent; border-radius: 999px; color: var(--muted); background: transparent; cursor: pointer; }
.view-tabs button[aria-selected="true"] { color: var(--text); border-color: var(--line-strong); background: var(--surface-raised); }
.list-summary { min-height: 40px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.list-summary button { min-height: 40px; padding: 0 8px; border: 0; color: var(--muted); background: transparent; cursor: pointer; }
.library-content { min-height: 180px; border-top: 1px solid var(--line); }
.track-row { width: 100%; min-width: 0; display: grid; grid-template-columns: 46px minmax(0, 1fr) auto 44px; align-items: center; gap: 12px; padding: 10px 5px; border: 0; border-bottom: 1px solid var(--line); border-radius: var(--radius-xs); text-align: left; background: transparent; cursor: pointer; }
.track-row.active { background: var(--accent-soft); }
.track-number { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 12px; color: var(--muted); background: var(--surface-raised); font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 11px; font-variant-numeric: tabular-nums; }
.track-row.active .track-number { color: var(--accent-ink); background: var(--accent); }
.track-copy { min-width: 0; display: grid; gap: 4px; }
.track-copy strong, .track-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-copy strong { font-size: 14px; font-weight: 680; }
.track-copy small { color: var(--muted); font-size: 12px; }
.track-duration { color: var(--muted); font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 11px; font-variant-numeric: tabular-nums; }
.row-action { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 12px; color: var(--muted); background: transparent; cursor: pointer; }
.row-action svg { width: 18px; height: 18px; }
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 14px; padding-top: 16px; }
.album-card { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-md); color: var(--text); text-align: left; background: var(--surface); cursor: pointer; }
.album-art { aspect-ratio: 1; display: grid; place-items: center; margin-bottom: 14px; border: 1px solid rgba(255,255,255,.06); border-radius: var(--radius-sm); color: var(--accent-strong); background: linear-gradient(145deg, #26384e, #111721 72%); font-size: 30px; font-weight: 800; }
.album-card strong, .album-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.album-card strong { font-size: 14px; }
.album-card small { margin-top: 5px; color: var(--muted); font-size: 12px; }
.empty-state { min-height: 180px; display: grid; place-items: center; margin: 0; color: var(--muted); font-size: 13px; text-align: center; }
.error-state { color: var(--danger); }

.mobile-player-dock {
  position: fixed;
  z-index: 40;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 12px;
  min-width: 0;
  height: 72px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px 48px;
  align-items: center;
  gap: 3px;
  padding: 7px 7px 7px 8px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: rgba(15,20,28,.88);
  box-shadow: var(--shadow-dock);
  backdrop-filter: blur(24px) saturate(140%);
}
.dock-track { min-width: 0; height: 58px; display: grid; grid-template-columns: 48px minmax(0,1fr); align-items: center; gap: 10px; padding: 0; border: 0; text-align: left; background: transparent; cursor: pointer; }
.dock-art { width: 48px; height: 48px; border-radius: 13px; background: linear-gradient(145deg, #29405a, #111722); background-position: center; background-size: cover; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.dock-copy { min-width: 0; display: grid; gap: 3px; }
.dock-copy strong, .dock-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dock-copy strong { font-size: 13px; font-weight: 700; }
.dock-copy small { color: var(--muted); font-size: 11px; }
.dock-control { width: 46px; height: 46px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.dock-control svg { grid-area: 1 / 1; width: 21px; height: 21px; }
.dock-play { color: var(--accent-ink); background: var(--accent); }
.dock-progress { position: absolute; right: 0; bottom: 0; left: 0; height: 2px; transform: scaleX(0); transform-origin: left; background: var(--accent); }

.sheet { position: fixed; z-index: 70; inset: 0; display: grid; justify-items: end; }
.sheet-backdrop { position: absolute; inset: 0; width: 100%; border: 0; background: rgba(0,0,0,.62); backdrop-filter: blur(6px); }
.sheet-panel { position: relative; width: min(440px, 100%); height: 100%; padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom)); overflow-y: auto; border-left: 1px solid var(--line-strong); background: rgba(14,18,25,.97); box-shadow: -24px 0 70px rgba(0,0,0,.35); }
.sheet-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.sheet-header h2 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
.sheet-header > button { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-raised); cursor: pointer; }
.queue-actions { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 8px; color: var(--muted); font-size: 12px; }
.queue-actions button { min-height: 44px; display: flex; align-items: center; gap: 6px; padding: 0 8px; border: 0; color: var(--muted); background: transparent; cursor: pointer; }
.queue-actions svg { width: 16px; height: 16px; }
.queue-item { min-width: 0; display: grid; grid-template-columns: 24px minmax(0,1fr) 44px; align-items: center; gap: 9px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.queue-item > svg { width: 17px; color: var(--faint); }
.queue-item div { min-width: 0; display: grid; gap: 3px; }
.queue-item strong, .queue-item small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-item strong { font-size: 13px; }
.queue-item small { color: var(--muted); font-size: 11px; }
.queue-item button { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; color: var(--muted); background: transparent; cursor: pointer; }
.queue-item button svg { width: 16px; }
.timer-panel { height: auto; min-height: 470px; align-self: end; border-top: 1px solid var(--line-strong); border-left: 1px solid var(--line-strong); border-radius: 26px 0 0 0; }
.timer-status { margin: 20px 0; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--text-soft); background: var(--surface); font-size: 13px; }
.timer-presets { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 9px; }
.timer-presets button, .custom-timer button, .cancel-timer { min-height: 46px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-raised); cursor: pointer; }
.timer-presets .wide { grid-column: span 3; }
.custom-timer { display: grid; grid-template-columns: minmax(0,1fr) 82px; gap: 9px; margin-top: 12px; }
.custom-timer input { min-width: 0; height: 46px; padding: 0 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); outline: 0; color: var(--text); background: var(--surface); }
.custom-timer input:focus { border-color: rgba(141,199,255,.55); box-shadow: var(--focus); }
.custom-timer button { color: var(--accent-ink); border: 0; background: var(--accent); font-weight: 750; }
.cancel-timer { width: 100%; margin-top: 12px; color: var(--muted); background: transparent; }
.toast { position: fixed; z-index: 90; left: 50%; bottom: max(96px, calc(env(safe-area-inset-bottom) + 92px)); max-width: calc(100% - 32px); padding: 11px 15px; border: 1px solid var(--line-strong); border-radius: 999px; opacity: 0; transform: translate(-50%, 12px); color: var(--text); background: var(--surface-raised); box-shadow: 0 18px 42px rgba(0,0,0,.4); font-size: 12px; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (hover: hover) and (pointer: fine) {
  .back-link, .header-button, .favorite-current, .skip-button, .secondary-control, .view-tabs button, .track-row, .row-action, .album-card, .dock-control, .sheet-header button, .timer-presets button, .cancel-timer { transition: color .18s ease, border-color .18s ease, background-color .18s ease, transform .18s ease; }
  .back-link:hover { color: var(--text); }
  .header-button:hover, .favorite-current:hover, .skip-button:hover, .row-action:hover { border-color: var(--line-strong); background-color: var(--surface-raised); }
  .track-row:hover { background-color: rgba(255,255,255,.028); }
  .track-row.active:hover { background-color: rgba(141,199,255,.14); }
  .album-card:hover { transform: translateY(-2px); border-color: var(--line-strong); background-color: var(--surface-raised); }
  .play-button:hover, .dock-play:hover { transform: scale(1.035); }
}

@media (max-width: 767px) {
  .app-shell { padding-top: 18px; }
  .now-playing { grid-template-columns: 106px minmax(0,1fr); grid-template-areas: "cover copy" "transport transport"; gap: 16px; padding: 15px; border-radius: 22px; }
  .cover { border-radius: 16px; }
  .cover span { display: none; }
  .now-copy { align-self: center; padding: 0; }
  .now-copy h1 { font-size: clamp(22px, 7vw, 30px); }
  .favorite-current { min-height: 40px; margin-top: 11px; }
  .library { margin-top: 30px; }
  .library-heading { display: grid; align-items: stretch; gap: 15px; }
  .search-box { width: 100%; }
  .track-row { grid-template-columns: 44px minmax(0,1fr) 44px; gap: 10px; }
  .track-duration { display: none; }
  .album-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
}

@media (max-width: 430px) {
  .topbar { padding-inline: 12px; }
  .back-link span { display: none; }
  .app-shell { padding-inline: 12px; }
  .control-row { grid-template-columns: 44px 44px 60px 44px 44px; justify-content: space-between; gap: 3px; }
  .secondary-control { width: 44px; }
  .secondary-control span { display: none; }
  .skip-button { width: 44px; height: 44px; }
  .play-button { width: 60px; height: 60px; }
  .mobile-player-dock { right: 8px; left: 8px; }
  .sheet-panel { border-left: 0; }
  .timer-panel { width: 100%; border-radius: 24px 24px 0 0; }
}

@media (max-width: 374px) {
  .now-playing { grid-template-columns: 88px minmax(0,1fr); gap: 12px; padding: 12px; }
  .now-copy h1 { font-size: 21px; }
  .favorite-current { padding-inline: 11px; }
  .dock-control { width: 42px; height: 42px; }
  .mobile-player-dock { grid-template-columns: minmax(0,1fr) 44px 44px; }
}

@media (min-width: 768px) {
  .mobile-player-dock { right: 22px; left: 22px; max-width: 760px; margin-inline: auto; }
  .toast { bottom: 104px; }
}

@media (min-width: 1024px) {
  .app-shell { width: min(100%, 1320px); display: grid; grid-template-columns: minmax(330px, 410px) minmax(0,1fr); align-items: start; gap: clamp(32px, 4vw, 60px); padding-bottom: 72px; }
  .now-playing { position: sticky; top: 94px; grid-template-columns: minmax(0,1fr); grid-template-areas: "cover" "copy" "transport"; align-items: stretch; gap: 20px; }
  .now-copy h1 { font-size: clamp(28px, 3vw, 39px); }
  .library { margin-top: 0; }
  .mobile-player-dock { display: none; }
  .toast { bottom: 28px; }
}

@media (min-width: 1440px) {
  .app-shell { grid-template-columns: 430px minmax(0,1fr); gap: 68px; padding-inline: 0; }
  .now-playing { padding: 28px; }
  .library-heading h2 { font-size: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
