:root {
  --bg: #0f1012;
  --bar: #15161a;
  --surface: #1c1d21;
  --text: #f3f3f4;
  --muted: #a3a6ad;
  --line: #2a2c31;
  --accent: #8fd3c1;
  --placeholder: linear-gradient(135deg, #2a2c33, #383b44);
  --radius: 12px;
  --gap: 12px;
  --gutter: clamp(16px, 1.2vw, 24px);
  --topbar: 76px;
  --foot: 56px;
  --player: 76px;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body.has-player { padding-bottom: var(--player); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img { display: block; }
h1, h2 { margin: 0; font-weight: 700; }
main { flex: 1; width: 100%; }
:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* Top bar */
.topbar {
  height: var(--topbar);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 calc(var(--gutter) + 12px);
  background: var(--bar);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; }
.back { display: none; width: 28px; height: 28px; margin-right: -8px; color: var(--muted); }
.back svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2; }
.search {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1f2024;
  border: 1px solid #34363c;
  border-radius: 999px;
  padding: 0 18px;
  width: min(340px, 42vw);
}
.search:focus-within { border-color: #6b6e76; }
.search svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; }
.search input { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--text); font: inherit; font-size: 16px; padding: 10px 0; }
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; }

/* Play button and icons */
.play {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  color: #111;
  font-weight: 700;
  font-size: 18px;
  border: 0;
  border-radius: 999px;
  padding: 8px 30px 8px 24px;
  cursor: pointer;
  position: relative;
  z-index: 2;
}
.play:hover { background: #e9e9e9; }
.play-icon { width: 0; height: 0; border-left: 13px solid currentColor; border-top: 8px solid transparent; border-bottom: 8px solid transparent; }
.play.playing .play-icon { width: 12px; height: 15px; border: 0; border-left: 4px solid currentColor; border-right: 4px solid currentColor; }

/* Tiles: art fills the tile, text over a dark fade */
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--placeholder);
  isolation: isolate;
  min-height: 0;
}
.tile-link { position: absolute; inset: 0; z-index: 1; }
.tile-media { position: absolute; inset: 0; z-index: -1; background: var(--placeholder); }
.tile-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.tile:hover .tile-media img { transform: scale(1.04); }
.tile::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.25) 40%, transparent 62%);
}
.tile-body { position: relative; z-index: 1; pointer-events: none; display: flex; flex-direction: column; align-items: flex-start; padding: 20px 24px; color: #fff; min-width: 0; max-width: 100%; }
.tile-body .play { pointer-events: auto; }
.tile-kicker { font-size: 15px; font-weight: 600; }
.tile-title { font-size: clamp(22px, 2vw, 34px); font-weight: 800; line-height: 1.2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-desc { font-size: 19px; margin-top: 6px; opacity: 0.95; }
.tile-meta { font-size: 16px; margin-top: 4px; opacity: 0.92; font-variant-numeric: tabular-nums; }
.tile.current::after {
  content: "正在播放";
  position: absolute;
  top: 14px;
  left: 16px;
  z-index: 1;
  font-size: 13px;
  background: rgba(20, 21, 25, 0.75);
  border-radius: 999px;
  padding: 2px 12px;
}

/* First screen: one big tile and four small ones */
.poster {
  height: calc(100svh - var(--topbar) - var(--foot));
  min-height: 520px;
  max-height: 1000px;
  display: grid;
  grid-template-columns: 2.55fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: var(--gap);
  padding: var(--gap) var(--gutter) 0;
}
body.has-player .poster { height: calc(100svh - var(--topbar) - var(--foot) - var(--player)); }
/* The hero blurs its own cover as a backdrop and shows the square art in front, like a record sleeve. */
.poster .hero { grid-row: span 2; flex-direction: row; align-items: flex-end; }
.poster .hero .tile-media { filter: blur(40px) saturate(1.2) brightness(0.55); transform: scale(1.25); }
.poster .hero:hover .tile-media img { transform: none; }
.poster .hero::before { background: linear-gradient(90deg, rgba(0, 0, 0, 0.35), transparent 70%), linear-gradient(0deg, rgba(0, 0, 0, 0.5), transparent 50%); }
.hero-art {
  position: relative;
  z-index: 1;
  pointer-events: none;
  flex: none;
  align-self: center;
  height: min(64%, 52vh);
  aspect-ratio: 1;
  margin-left: clamp(24px, 3.4vw, 64px);
  border-radius: 10px;
  overflow: hidden;
  background: var(--placeholder);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45);
}
.hero-art img { width: 100%; height: 100%; object-fit: cover; }
.poster .hero .tile-body { flex: 1; padding: 0 clamp(24px, 3vw, 48px) clamp(28px, 3.4vw, 56px); }
.poster .hero .tile-title { font-size: clamp(32px, 3vw, 56px); white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.poster .hero .tile-kicker { font-size: 18px; margin-bottom: 4px; }
.poster .hero .play { margin-top: 22px; }
.poster-foot {
  height: var(--foot);
  margin-top: var(--gap);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 calc(var(--gutter) + 16px);
  background: var(--bar);
  color: #cfd1d6;
}
.poster-foot .copyright { font-size: 14px; }
.more { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; }
.more svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; transition: transform 0.2s; }
.more:hover svg { transform: translateY(3px); }

.soon {
  height: calc(100svh - var(--topbar) - var(--gap) * 2 - 60px);
  min-height: 360px;
  margin: var(--gap) var(--gutter) 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 16px;
  text-align: center;
  border-radius: var(--radius);
  background: var(--placeholder);
}
.soon p { margin: 0; }
.soon-title { font-size: clamp(28px, 4vw, 48px); font-weight: 600; }
.soon-note { color: var(--muted); font-size: 16px; }

/* All songs: a list, because songs are listened to in order */
.all, .albums { padding: 40px calc(var(--gutter) + 4px) 8px; scroll-margin-top: calc(var(--topbar) + 8px); }
.filters { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; margin-bottom: 14px; }
.all h2, .albums h2 { font-size: 28px; }
.albums h2 { margin-bottom: 18px; }
.chips { display: flex; gap: 10px; flex-wrap: wrap; }
.chip { background: #1f2024; border: 1px solid #34363c; border-radius: 999px; padding: 5px 20px; cursor: pointer; }
.chip:hover { border-color: #6b6e76; }
.chip[aria-pressed="true"] { background: #fff; color: #111; border-color: #fff; }

.tracks { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 40px; }
.row {
  break-inside: avoid;
  display: grid;
  grid-template-columns: 32px 52px minmax(0, 1fr) auto 52px;
  align-items: center;
  gap: 14px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.row:hover, .row:focus-visible { background: var(--surface); }
.row-num { position: relative; display: grid; place-items: center; color: var(--muted); font-size: 15px; height: 24px; }
.row-num .play-icon, .row-num .eq { display: none; }
.row:hover .row-num .row-index, .row:focus-visible .row-num .row-index { display: none; }
.row:hover .row-num .play-icon, .row:focus-visible .row-num .play-icon { display: block; color: var(--text); border-left-width: 11px; border-top-width: 7px; border-bottom-width: 7px; }
.row.current .row-index { color: var(--accent); }
.row.playing .row-num .row-index, .row.playing:hover .row-num .play-icon { display: none; }
.row.playing .row-num .eq { display: flex; }
.row-cover { width: 52px; height: 52px; border-radius: 6px; overflow: hidden; background: var(--placeholder); }
.row-cover img { width: 100%; height: 100%; object-fit: cover; }
.row-text { display: flex; flex-direction: column; min-width: 0; }
.row-title { font-size: 17px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-title:hover { text-decoration: underline; }
.row.current .row-title { color: var(--accent); }
.row-sub, .row-date { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-time { color: var(--muted); font-size: 15px; text-align: right; }

.eq { align-items: flex-end; gap: 2px; height: 14px; }
.eq i { width: 3px; background: var(--accent); border-radius: 1px; animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -0.3s; }
.eq i:nth-child(3) { animation-delay: -0.6s; }
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 14px; } }
@media (prefers-reduced-motion: reduce) { .eq i { animation: none; height: 10px; } }

.album-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--gap); }
.album-grid .tile { aspect-ratio: 1; }
.album-grid .tile-title { font-size: 21px; }
.album-grid .tile-meta { font-size: 14px; }
.empty { color: var(--muted); text-align: center; padding: 48px 0; }
.empty a { text-decoration: underline; }

.footer { color: var(--muted); font-size: 14px; text-align: center; padding: 28px var(--gutter) 28px; }
body[data-view="home"] .footer { display: none; }

/* Album and song pages */
.detail {
  display: flex;
  align-items: flex-end;
  gap: clamp(24px, 3vw, 48px);
  padding: 32px calc(var(--gutter) + 12px) 28px;
  background: linear-gradient(180deg, var(--bar), var(--bg));
}
.detail-cover { flex: none; width: clamp(200px, 22vw, 320px); aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--placeholder); box-shadow: 0 24px 50px rgba(0, 0, 0, 0.4); }
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.detail-info { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.detail-kicker { font-size: 16px; font-weight: 600; color: #d4d6db; }
a.detail-kicker:hover { text-decoration: underline; }
.detail-title { font-size: clamp(34px, 4vw, 64px); line-height: 1.15; }
.detail-meta { margin: 0; color: #d4d6db; font-size: 17px; font-variant-numeric: tabular-nums; }
.detail-desc { margin: 6px 0 0; max-width: 60ch; color: #e4e5e8; font-size: 17px; }
.detail .play { margin-top: 16px; }
body[data-view="album"] .tracks { columns: 1; padding: 8px calc(var(--gutter) + 2px); max-width: 1100px; }

.song-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 32%); gap: 40px; padding: 8px calc(var(--gutter) + 12px) 0; align-items: start; }
.lyrics-block h2, .side-head .side-label { font-size: 20px; font-weight: 700; }
.lyrics {
  position: relative;
  list-style: none;
  margin: 12px 0 0;
  padding: 8px 0 40vh;
  max-height: 62vh;
  overflow-y: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 10%, #000 80%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 10%, #000 80%, transparent);
}
.lyric { font-size: 22px; font-weight: 600; line-height: 1.5; padding: 7px 0; color: #6f727a; transition: color 0.25s, transform 0.25s; transform-origin: left center; }
.lyric.timed { cursor: pointer; }
.lyric.timed:hover { color: #b5b8be; }
.lyric.active { color: #fff; transform: scale(1.04); }
.lyrics:not(:has(.timed)) .lyric { color: #d4d6db; font-weight: 500; font-size: 18px; padding: 3px 0; }
.lyrics:not(:has(.timed)) { padding-bottom: 8px; mask-image: none; -webkit-mask-image: none; max-height: none; }
.lyric-none { color: var(--muted); font-size: 17px; }
.side { display: flex; flex-direction: column; gap: 8px; }
.side-head { display: flex; align-items: baseline; gap: 12px; }
.side-head a { color: var(--muted); }
.side-head a:hover { color: var(--text); }
.side .tracks { columns: 1; }
.side .row { grid-template-columns: 28px 44px minmax(0, 1fr) 48px; }
.side .row-cover { width: 44px; height: 44px; }
.side .row-date { display: none; }

/* Player bar, always at the bottom once a song is loaded */
.player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  height: var(--player);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  padding: 0 calc(var(--gutter) + 12px);
  background: rgba(21, 22, 26, 0.94);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.progress { position: absolute; left: 0; right: 0; top: -6px; height: 12px; cursor: pointer; touch-action: none; }
.progress::before { content: ""; position: absolute; left: 0; right: 0; top: 5px; height: 2px; background: var(--line); }
.progress-fill { position: absolute; left: 0; right: 0; top: 5px; height: 2px; background: var(--accent); transform-origin: left; transform: scaleX(0); }
.progress:hover::before, .progress:hover .progress-fill { top: 4px; height: 4px; }
.now { display: flex; align-items: center; gap: 14px; min-width: 0; }
.now-cover { flex: none; width: 52px; height: 52px; border-radius: 6px; overflow: hidden; background: var(--placeholder); }
.now-img, .now-img img { width: 100%; height: 100%; object-fit: cover; }
.now-text { display: flex; flex-direction: column; min-width: 0; }
.now-title { font-size: 16px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now:hover .now-title { text-decoration: underline; }
.controls { display: flex; align-items: center; gap: 14px; }
.ctl { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: none; cursor: pointer; color: #d4d6db; }
.ctl:hover { color: #fff; }
.ctl svg { width: 22px; height: 22px; fill: currentColor; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.ctl-main { width: 48px; height: 48px; background: #fff; color: #111; }
.ctl-main:hover { color: #111; background: #e9e9e9; }
.ctl-main svg { width: 22px; height: 22px; }
.ctl-main .i-pause { display: none; fill: none; stroke-width: 3; }
body.is-playing .ctl-main .i-play { display: none; }
body.is-playing .ctl-main .i-pause { display: block; }
.time { justify-self: end; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; display: flex; gap: 4px; }
.volume { position: absolute; right: calc(var(--gutter) + 130px); top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 8px; color: var(--muted); }
.volume svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }
.volume input { width: 96px; accent-color: #fff; }

/* Tablet */
@media (max-width: 1100px) {
  .poster { grid-template-columns: 1fr 1fr; grid-template-rows: auto; height: auto !important; max-height: none; }
  .poster .hero { grid-column: span 2; grid-row: auto; aspect-ratio: 16 / 9; }
  .poster .tile:not(.hero) { aspect-ratio: 4 / 3; }
  .tracks { columns: 1; }
  .album-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .song-body { grid-template-columns: minmax(0, 1fr); }
  .volume { display: none; }
}

/* Phone */
@media (max-width: 720px) {
  :root { --topbar: 60px; --gap: 10px; --gutter: 12px; --player: 68px; }
  .topbar { gap: 12px; padding: 0 16px; }
  .brand { font-size: 24px; }
  body:not([data-view="home"]) .back { display: block; }
  .search { flex: 1; width: auto; max-width: 210px; padding: 0 14px; }
  .search input { font-size: 15px; padding: 8px 0; }
  .poster .hero { aspect-ratio: 4 / 5; flex-direction: column; align-items: stretch; justify-content: flex-end; }
  .hero-art { height: auto; width: 58%; align-self: center; margin: 28px 0 4px; }
  .poster .hero .tile-body { padding: 12px 20px 22px; }
  .poster .hero .tile-title { font-size: 30px; }
  .poster .hero .tile-kicker { font-size: 14px; }
  .tile-desc { font-size: 15px; }
  .tile-meta { font-size: 13px; }
  .play { font-size: 16px; padding: 6px 24px 6px 20px; }
  .poster .hero .play { margin-top: 14px; }
  .poster .tile:not(.hero) { aspect-ratio: 1 / 1; }
  .tile-body { padding: 12px 14px; }
  .tile-title { font-size: 19px; }
  .poster-foot { grid-template-columns: 1fr; justify-items: center; height: auto; padding: 14px 16px 0; background: transparent; margin-top: 0; }
  .poster-foot .copyright { display: none; }
  body[data-view="home"] .footer { display: block; }
  .all, .albums { padding: 20px 6px 4px; }
  .all h2, .albums h2 { font-size: 22px; }
  .filters { gap: 12px; padding: 0 6px; }
  .filters h2 { width: 100%; }
  .albums h2 { padding: 0 6px; margin-bottom: 12px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -12px; padding: 0 12px 4px; scrollbar-width: none; }
  .chip { white-space: nowrap; padding: 4px 16px; }
  .row { grid-template-columns: 22px 46px minmax(0, 1fr) 44px; gap: 10px; padding: 6px; }
  .row-cover { width: 46px; height: 46px; }
  .row-date { display: none; }
  .row-title { font-size: 16px; }
  .album-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0 6px; }
  .album-grid .tile-title { font-size: 17px; }
  .detail { flex-direction: column; align-items: center; text-align: center; padding: 20px 20px 16px; }
  .detail-info { align-items: center; }
  .detail-cover { width: 68%; }
  .detail-title { font-size: 30px; }
  .detail-meta, .detail-desc { font-size: 15px; }
  body[data-view="album"] .tracks { padding: 4px 6px; }
  .song-body { padding: 8px 16px 0; gap: 24px; }
  .lyric { font-size: 19px; }
  .lyrics { max-height: 50vh; }
  .player { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 0 12px; }
  .now-cover { width: 46px; height: 46px; }
  .controls { gap: 2px; }
  #prev { display: none; }
  .ctl-main { width: 42px; height: 42px; }
  .time { display: none; }
}
