:root {
  --bg: #07070c;
  --ink: rgba(255, 255, 255, 0.94);
  --muted: rgba(255, 255, 255, 0.62);
  --faint: rgba(255, 255, 255, 0.42);
  --line: rgba(255, 255, 255, 0.28);
  --pink: #fa2d48;
  --player-h: 28px;
  --sidebar: 248px;
  --radius: 28px;
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--ink);
  background: var(--bg);
  letter-spacing: -0.011em;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
h1, h2, h3, p { margin: 0; }

.ambient {
  position: fixed;
  width: 180px;
  height: 180px;
  left: 50%;
  top: 8%;
  background-size: cover;
  background-position: center;
  opacity: 0;
  z-index: 0;
  pointer-events: none;
  filter: blur(14px);
  transform: translateX(-50%) scale(5);
}
.ambient.is-on { opacity: 0.26; }

.glow {
  position: fixed;
  width: 46vw;
  height: 46vw;
  border-radius: 50%;
  z-index: 0;
  pointer-events: none;
}
.glow-a {
  top: -16vw;
  left: -10vw;
  background: radial-gradient(circle, rgba(250, 45, 72, 0.45), transparent 68%);
}
.glow-b {
  right: -12vw;
  bottom: -18vw;
  background: radial-gradient(circle, rgba(92, 140, 255, 0.35), transparent 68%);
}
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(6vw, 4vw, 0) scale(1.12); }
}

.grain { display: none; }

.glass {
  position: relative;
  background: rgba(16, 16, 22, 0.92);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.topbar,
.tabbar,
.stage-card {
  background: rgba(16, 16, 22, 0.72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.08) 32%, rgba(255, 255, 255, 0.22));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.shell {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  gap: 16px;
  min-height: 100vh;
  padding: 16px 16px calc(var(--player-h) + 32px);
}

.sidebar {
  position: sticky;
  top: 16px;
  align-self: start;
  height: calc(100vh - var(--player-h) - 48px);
  display: flex;
  flex-direction: column;
  padding: 18px 12px 16px;
  overflow: hidden;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 6px 10px 18px;
}
.brand strong { display: block; font-size: 20px; letter-spacing: -0.04em; }
.brand small { color: var(--muted); letter-spacing: 0.14em; text-transform: uppercase; font-size: 11px; }
.mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #1a0b10;
  background: linear-gradient(160deg, #fff, #ffd5dc 42%, var(--pink));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 10px 24px rgba(250, 45, 72, 0.28);
}
.mark svg { width: 18px; height: 18px; fill: currentColor; }

.sidenav, .tabbar { display: flex; flex-direction: column; gap: 4px; }
.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 14px;
  min-height: 44px;
  padding: 0 12px;
  text-align: left;
}
.nav-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-btn em {
  margin-left: auto;
  font-style: normal;
  font-size: 12px;
  min-width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  color: white;
}
.nav-btn.is-active {
  color: white;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.legal {
  margin-top: auto;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.45;
  padding: 12px;
}

.workspace { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.topbar {
  position: sticky;
  top: 16px;
  z-index: 5;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
#search-form { flex: 1; }
#search-form {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 8px 0 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
}
#search-form > svg {
  width: 18px;
  height: 18px;
  stroke: white;
  fill: none;
  stroke-width: 1.8;
  opacity: 0.7;
  flex: none;
}
#search {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 16px;
  padding: 12px 0;
}
#search::placeholder { color: rgba(255, 255, 255, 0.46); }
#search::-webkit-search-cancel-button { display: none; }

.icon-btn, .fab, .play-main, .pill, .ghost {
  border: 0;
  background: transparent;
  color: white;
}
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
}
.icon-btn svg, .fab svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn:hover, .ghost:hover { background: rgba(255, 255, 255, 0.1); }
.icon-btn[aria-pressed="true"] { color: var(--pink); }
.like svg, #icon-play, #icon-pause, .fab svg, .play-main svg { fill: currentColor; stroke: none; }
.like.is-on { color: var(--pink); }
.like:disabled { opacity: 0.35; }

.view { padding: 6px 8px 24px; }
.date { color: var(--muted); text-transform: capitalize; font-size: 13px; }
.lede { color: var(--muted); max-width: 46ch; line-height: 1.45; }
h1 {
  font-size: clamp(40px, 6vw, 68px);
  line-height: 0.95;
  letter-spacing: -0.055em;
  font-weight: 700;
}
h2 { font-size: 22px; letter-spacing: -0.03em; }

.hero {
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  padding: 22px;
  overflow: hidden;
}
.hero-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }
.hero-copy h1 { margin: 2px 0 6px; }
.kicker {
  color: var(--faint);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 11px;
}
.hero-art, .art img, .row img, #np-cover {
  object-fit: cover;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.04)),
    #1a1a22;
}
.hero-art {
  width: 156px;
  height: 156px;
  border-radius: 24px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}
.pill, .ghost {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 600;
}
.pill { background: white; color: #16161a; }
.ghost { background: rgba(255, 255, 255, 0.1); }

.shelf { margin-top: 28px; }
.shelf-head, .section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin-bottom: 12px;
}
.shelf-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 176px;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 2px 2px 10px;
}
.shelf-row .card { scroll-snap-align: start; }
.shelf-row::-webkit-scrollbar, .view::-webkit-scrollbar { height: 8px; }
.shelf-row::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.22); border-radius: 99px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 16px 14px;
}
.card {
  min-width: 0;
  padding: 8px 8px 12px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
  content-visibility: auto;
  contain-intrinsic-size: 240px;
}
.card.is-current { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.24); }
.art { position: relative; border-radius: 18px; overflow: hidden; }
.art img { width: 100%; aspect-ratio: 1; }
.fab {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--pink);
  color: white;
  opacity: 0;
  transform: translateY(6px);
  transition: 0.18s ease;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}
.card:hover .fab, .card.is-current .fab, .fab:focus-visible { opacity: 1; transform: none; }
.len {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  font-size: 11px;
}
.card-meta { padding: 10px 6px 0; }
.card-meta h3, .row strong, #np-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-meta p, .row small, #np-artist { color: var(--muted); font-size: 13px; }
.card-meta p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-actions { display: flex; gap: 2px; padding: 4px 2px 0; }
.card-actions .icon-btn { width: 32px; height: 32px; }

.list { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.05);
}
.row.is-current { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.22); }
.row > button {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
}
.row img { width: 52px; height: 52px; border-radius: 12px; }
.row span { min-width: 0; display: flex; flex-direction: column; }
.row em { color: var(--muted); font-style: normal; font-variant-numeric: tabular-nums; font-size: 13px; }

.empty, .error {
  padding: 28px;
  color: var(--muted);
  line-height: 1.5;
}
.error { color: white; }

.skel {
  height: 180px;
  border-radius: 24px;
  background: linear-gradient(90deg, rgba(255,255,255,0.05), rgba(255,255,255,0.12), rgba(255,255,255,0.05));
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
}
.skel.hero { height: 200px; }
.skel-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-top: 16px; }
@keyframes shimmer { to { background-position: -200% 0; } }

body.is-guest .shell,
body.is-guest .tabbar,
body.is-guest .stage,
body.is-guest .screen { display: none; }
body:not(.is-guest) .auth { display: none; }
body.has-stage { --player-h: 92px; }

.auth {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card { width: min(420px, 100%); padding: 28px; display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
.auth-card h1 { font-size: 48px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { color: var(--muted); font-size: 13px; }
.field input {
  border: 0;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.22);
  padding: 14px 16px;
  outline: none;
}
.auth-error { min-height: 1.3em; color: #ffb4c0; font-size: 14px; }
.account {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 8px 0;
}
#account-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }

.stage {
  position: fixed;
  z-index: 24;
  left: calc(var(--sidebar) + 12px);
  right: 12px;
  bottom: 12px;
}
.stage[hidden] { display: none !important; }
.stage-card {
  --bar: rgba(22, 22, 28, 0.9);
  --bar-accent: #ffffff;
  display: grid;
  grid-template-columns: 48px minmax(96px, 180px) auto minmax(80px, 1fr) auto auto;
  grid-template-areas: "art meta cur seek dur controls";
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 16px;
  background: var(--bar);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.art-btn {
  grid-area: art;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}
#audio-art {
  width: 48px;
  height: 48px;
  object-fit: cover;
  display: block;
}
.np-meta { grid-area: meta; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
#np-title, #np-artist { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#np-title { font-size: 14px; }
#np-artist { color: var(--muted); font-size: 12px; }
#time-cur { grid-area: cur; }
#time-dur { grid-area: dur; }
#time-cur, #time-dur { color: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
#audio { display: none; }
.bar-controls { position: relative; z-index: 2; }
.play-main {
  position: relative;
  z-index: 3;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--bar-accent);
  color: #111;
}
.play-main svg { pointer-events: none; }
.play-main .icon-pause { display: none; }
.play-main.is-playing .icon-play { display: none; }
.play-main.is-playing .icon-pause { display: block; }
.play-main svg { width: 18px; height: 18px; margin-left: 2px; }
.play-main.is-playing svg { margin-left: 0; }
.seek {
  grid-area: seek;
  position: relative;
  height: 20px;
  display: flex;
  align-items: center;
  touch-action: none;
  cursor: pointer;
}
#seek-fill {
  position: absolute;
  left: 0;
  height: 3px;
  width: 0%;
  border-radius: 99px;
  background: var(--bar-accent);
}
.seek::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.28);
}
.bar-controls {
  grid-area: controls;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  min-width: 0;
}
.bar-controls .icon-btn { width: 34px; height: 34px; }
.slider {
  position: relative;
  flex: 1;
  height: 20px;
  display: flex;
  align-items: center;
  touch-action: none;
}
.requests { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 8px 12px; }
.requests[hidden] { display: none !important; }
.request {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
}
.request span { font-size: 14px; }
.request .pill { min-height: 32px; }
.person { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 16px; background: rgba(255, 255, 255, 0.05); }
.person + .person { margin-top: 8px; }
.pager { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 8px; }
.page-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: white;
}
.page-btn.is-on { background: white; color: #16161a; }
.card.is-long { opacity: 0.55; }
.friend-form { display: flex; gap: 8px; margin: 8px 0 18px; }
.friend-form input {
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 16px;
}
.subhead { margin: 18px 0 8px; font-size: 18px; }
#search { font-size: 16px; }
.slider::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.16);
}
.slider-fill {
  position: absolute;
  left: 0;
  height: 4px;
  width: 0%;
  border-radius: 99px;
  background: white;
}
.slider.vol { width: 92px; flex: none; }
#repeat-btn[data-mode="one"] { position: relative; }
#repeat-btn[data-mode="one"]::after {
  content: "1";
  position: absolute;
  right: 4px;
  bottom: 4px;
  font-size: 9px;
  font-weight: 700;
}

.tabbar { display: none; }
.toast {
  position: fixed;
  z-index: 40;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 16px;
  border-radius: 16px;
  max-width: min(520px, calc(100vw - 32px));
}
.toast[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  body.has-stage { --player-h: 156px; }
  .sidebar { display: none; }
  .shell { grid-template-columns: 1fr; padding: 12px 12px calc(var(--player-h) + 84px + env(safe-area-inset-bottom)); }
  .hero { grid-template-columns: 96px 1fr; padding: 16px; }
  .hero-art { width: 96px; height: 96px; border-radius: 18px; }
  h1 { font-size: 36px; }
  .stage { left: 8px; right: 8px; bottom: calc(64px + env(safe-area-inset-bottom)); }
  .stage-card {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    grid-template-areas:
      "art meta meta"
      "cur seek dur"
      "controls controls controls";
    gap: 6px 8px;
    padding: 8px;
  }
  .bar-controls { justify-content: space-between; gap: 0; }
  .bar-controls .vol { display: none; }
  .bar-controls .icon-btn { width: 32px; height: 32px; flex-basis: 32px; }
  .play-main { width: 36px; height: 36px; }
  .tabbar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    z-index: 25;
    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    padding: 4px;
    border-radius: 20px;
  }
  .tabbar .nav-btn { position: relative; justify-content: center; min-height: 40px; font-size: 12px; padding: 6px 2px; }
  .tabbar .nav-btn em { position: absolute; top: 2px; right: 8px; margin: 0; }
  .skel-row { grid-template-columns: repeat(3, 1fr); }
  .fab { opacity: 1; transform: none; }
}
@media (max-width: 390px) {
  .bar-controls .icon-btn { width: 26px; height: 32px; flex-basis: 26px; }
  .bar-controls .icon-btn svg { width: 16px; height: 16px; }
  .play-main { width: 30px; height: 30px; flex-basis: 30px; }
}

.plist-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 2px 2px 12px;
}
.plist {
  flex: 0 0 148px;
  scroll-snap-align: start;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}
.plist img, .plist-art {
  width: 148px;
  height: 148px;
  border-radius: 14px;
  object-fit: cover;
  background: #16161c;
  display: block;
}
.plist strong, .plist small {
  display: block;
  margin-top: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.plist small { color: var(--muted); font-size: 12px; margin-top: 2px; }
.track-list { display: flex; flex-direction: column; gap: 6px; }
.track {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 14px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
}
.track.is-current { background: rgba(255, 255, 255, 0.12); }
.track img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: #111; }
.track span { min-width: 0; display: flex; flex-direction: column; }
.track strong, .track small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track small, .track em { color: var(--muted); font-style: normal; font-size: 13px; }

.screen {
  position: fixed;
  inset: 0;
  z-index: 32;
  display: grid;
  place-items: end center;
  padding: 18px 16px 28px;
}
.screen[hidden] { display: none !important; }
.screen-bg {
  position: absolute;
  width: 180px;
  height: 180px;
  left: 50%;
  top: 18%;
  background-size: cover;
  background-position: center;
  filter: blur(18px);
  transform: translateX(-50%) scale(6);
  opacity: 0.55;
}
.screen-card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.screen-close { align-self: flex-start; }
.screen-card > img {
  width: min(280px, 70vw);
  aspect-ratio: 1;
  border-radius: 18px;
  object-fit: cover;
  background: #111;
}
.screen-copy { width: 100%; min-width: 0; text-align: center; }
.screen-copy strong, .screen-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.screen-copy span { color: var(--muted); margin-top: 4px; }
.screen-seek-row, .screen-transport { width: 100%; display: flex; align-items: center; gap: 10px; }
.screen-transport { justify-content: center; }
.screen-seek-row .seek { flex: 1; }
.lyrics {
  width: 100%;
  max-height: 30vh;
  overflow: auto;
  text-align: center;
}
.lyrics p { margin: 10px 0; color: rgba(255, 255, 255, 0.42); }
.lyrics p.is-on { color: white; }
.lyrics a { color: white; }

body.is-phone .plist { flex-basis: 132px; }
body.is-phone .plist img, body.is-phone .plist-art { width: 132px; height: 132px; }
body.is-phone .screen { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
body.is-phone .screen-card > img { width: min(240px, 64vw); }
body.is-phone .tabbar .nav-btn { font-size: 11px; }

@media (prefers-reduced-motion: reduce) {
  .glow-a, .glow-b, .eq i, .skel { animation: none; }
  .ambient, .fab { transition: none; }
}
