:root {
  --bg: #030303; --s1: #121212; --s2: #1f1f1f; --s3: #2c2c2c;
  --text: #fff; --muted: #aaaaaa; --accent: #ff4d6d;
  --navh: 60px; --minih: 64px; --safe-b: env(safe-area-inset-bottom);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased;
}
body { padding-top: env(safe-area-inset-top); padding-bottom: calc(var(--navh) + var(--safe-b) + 24px); }
body.has-player { padding-bottom: calc(var(--navh) + var(--minih) + var(--safe-b) + 160px); }
body.np-open { overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:disabled { opacity: .35; cursor: default; }
svg { width: 24px; height: 24px; fill: currentColor; display: block; }
img { display: block; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

#app { max-width: 720px; margin: 0 auto; }
.appbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 4px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 20px; letter-spacing: -.3px; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }

.ibtn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.ibtn:active { background: var(--s3); }
.ibtn.sm { width: 34px; height: 34px; color: var(--muted); }
.ibtn.sm svg { width: 20px; height: 20px; }
.ibtn.on { color: var(--accent); }

#view { padding: 0 16px; }
.greet, .page-title { font-size: 26px; font-weight: 700; letter-spacing: -.4px; }
.greet { margin: 8px 0 12px; }

.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 4px; padding: 0 16px 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar, .cards::-webkit-scrollbar, .picks::-webkit-scrollbar { display: none; }
.chips button { white-space: nowrap; padding: 8px 14px; border-radius: 8px; background: rgba(255,255,255,.1); font-size: 14px; }
.chips button:active { background: rgba(255,255,255,.2); }

.sec { margin-top: 10px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 20px 0 10px; }
.sec-head h2 { font-size: 20px; font-weight: 700; letter-spacing: -.3px; }
.link { font-size: 13px; padding: 6px 12px; border: 1px solid var(--s3); border-radius: 999px; }

.picks {
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(4, auto); grid-auto-columns: 86%;
  column-gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 16px; margin: 0 -16px; padding: 0 16px; scrollbar-width: none;
}
.picks .trow { scroll-snap-align: start; }
.cards { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 16px; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
.card { width: 150px; flex-shrink: 0; scroll-snap-align: start; cursor: pointer; }
.cover { position: relative; width: 150px; height: 150px; border-radius: 8px; overflow: hidden; background: var(--s2); }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-label {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 28px 10px 9px; font-weight: 700; font-size: 15px; line-height: 1.2;
  background: linear-gradient(transparent, rgba(0,0,0,.85));
}
.ct { font-size: 14px; font-weight: 600; margin-top: 8px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cs { font-size: 13px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.collage { display: grid; grid-template-columns: 1fr 1fr; width: 100%; height: 100%; }
.collage img { width: 100%; height: 100%; object-fit: cover; }
.collage.one { display: block; }
.collage.empty { display: grid; grid-template-columns: 1fr; place-items: center; background: linear-gradient(135deg, #ff4d6d, #7b2ff7); }
.collage.empty svg { width: 40%; height: 40%; }

.trow { display: flex; align-items: center; gap: 12px; padding: 7px 0; cursor: pointer; min-width: 0; }
.tnum { width: 18px; text-align: center; color: var(--muted); font-size: 14px; }
.tthumb { position: relative; width: 52px; height: 52px; border-radius: 6px; overflow: hidden; flex-shrink: 0; background: var(--s2); }
.tthumb img { width: 100%; height: 100%; object-fit: cover; }
.tmeta { flex: 1; min-width: 0; }
.tt { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ts { font-size: 13px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow.playing .tt { color: var(--accent); }
.eq { position: absolute; inset: 0; background: rgba(0,0,0,.55); display: none; align-items: flex-end; justify-content: center; gap: 3px; padding-bottom: 16px; }
.trow.playing .eq { display: flex; }
.eq i { width: 4px; height: 18px; background: #fff; border-radius: 2px; transform-origin: bottom; animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.4s; }
.eq i:nth-child(3) { animation-delay: -.7s; }
body.paused .eq i { animation-play-state: paused; }
@keyframes eq { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }

.searchbar { position: sticky; top: 0; z-index: 4; display: flex; align-items: center; gap: 6px; background: var(--s2); border-radius: 999px; padding: 0 4px 0 14px; margin: 8px 0 8px; }
.searchbar .sicon { color: var(--muted); }
.searchbar input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--text); font-size: 16px; padding: 12px 4px; }
.searchbar input::-webkit-search-cancel-button { display: none; }
.suggest { background: var(--s1); border-radius: 12px; margin-bottom: 8px; overflow: hidden; }
.sg, .srow { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 14px; text-align: left; font-size: 15px; }
.srow { padding: 12px 0; }
.sg span, .srow span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg svg, .srow svg { color: var(--muted); width: 20px; height: 20px; flex-shrink: 0; }
.sg:active, .srow:active { background: var(--s2); }
.top-result { display: flex; align-items: center; gap: 14px; background: var(--s1); border-radius: 12px; padding: 12px; cursor: pointer; }
.top-result img { width: 84px; height: 84px; border-radius: 8px; object-fit: cover; }
.top-result .tt { font-size: 17px; font-weight: 700; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.top-result.playing .tt { color: var(--accent); }
.play-fab { width: 44px; height: 44px; border-radius: 50%; background: #fff; color: #000; display: grid; place-items: center; flex-shrink: 0; }
.status { color: var(--muted); font-size: 14px; padding: 24px 0; text-align: center; line-height: 1.5; }
.hero-empty { text-align: center; padding: 44px 20px; }
.hero-empty svg { width: 56px; height: 56px; margin: 0 auto 14px; color: var(--muted); }
.hero-empty p { font-size: 16px; font-weight: 600; }
.hero-empty p.muted { font-size: 14px; font-weight: 400; margin-top: 6px; line-height: 1.5; }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 7px 12px 7px 8px; border-radius: 999px; background: var(--s2); font-size: 13px; font-weight: 600; }
.pill svg { width: 18px; height: 18px; }
.lrow { display: flex; align-items: center; gap: 14px; padding: 8px 0; cursor: pointer; }
.lcover { width: 56px; height: 56px; border-radius: 6px; overflow: hidden; flex-shrink: 0; background: var(--s2); }

.lhead { text-align: center; padding: 4px 0 8px; position: relative; }
.lhead [data-back] { position: absolute; left: -8px; top: 0; }
.lhero { width: 200px; height: 200px; margin: 8px auto 16px; border-radius: 10px; overflow: hidden; background: var(--s2); box-shadow: 0 12px 40px rgba(0,0,0,.6); }
.lhero.artist { border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #333, #111); }
.lhero.artist svg { width: 50%; height: 50%; color: var(--muted); }
.lhead h1 { font-size: 24px; font-weight: 700; letter-spacing: -.3px; }
.lhead p { font-size: 14px; margin-top: 4px; }
.lbtns { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 16px; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 20px; border-radius: 999px; background: var(--s2); font-weight: 600; font-size: 15px; }
.btn svg { width: 20px; height: 20px; }
.btn.primary { background: #fff; color: #000; }
.tlist { margin-top: 10px; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 12; display: flex;
  height: calc(var(--navh) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(3,3,3,.96); border-top: 1px solid #1c1c1c;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.nav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: var(--muted); }
.nav button.active { color: var(--text); }

.mini {
  position: fixed; left: 8px; right: 8px; bottom: calc(var(--navh) + var(--safe-b) + 6px); z-index: 11;
  max-width: 704px; margin: 0 auto; height: var(--minih);
  display: flex; align-items: center; gap: 10px; padding: 0 6px 0 9px;
  background: var(--s2); border-radius: 12px; overflow: hidden; cursor: pointer; box-shadow: 0 6px 24px rgba(0,0,0,.5);
}
.mini > img { width: 46px; height: 46px; border-radius: 6px; object-fit: cover; }
.mini-prog { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: rgba(255,255,255,.12); }
.mini-prog i { display: block; height: 100%; width: 0; background: #fff; }

.yt-box { position: fixed; z-index: 40; background: #000; overflow: hidden; }
.yt-box iframe, #yt { width: 100%; height: 100%; border: 0; display: block; }
.yt-box.off { left: -2000px; top: 0; width: 320px; height: 180px; opacity: 0; pointer-events: none; }
.yt-box.mini-v {
  right: 12px; bottom: calc(var(--navh) + var(--minih) + var(--safe-b) + 14px);
  width: min(46vw, 240px); aspect-ratio: 16 / 9; border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.6);
}
.yt-box.big { border-radius: 12px; }

.np {
  position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top); padding-bottom: var(--safe-b);
  background: linear-gradient(180deg, #2b1824 0%, #030303 65%); animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.np-top { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; }
.seg { display: flex; background: rgba(255,255,255,.08); border-radius: 999px; padding: 3px; }
.seg button { padding: 6px 16px; border-radius: 999px; font-size: 14px; color: var(--muted); }
.seg button.active { background: rgba(255,255,255,.16); color: var(--text); font-weight: 600; }
.np-slot { width: min(calc(100% - 40px), 680px); margin: 8px auto 0; aspect-ratio: 16 / 9; flex-shrink: 0; border-radius: 12px; background: #000; }
.np-song, .np-next { flex: 1; min-height: 0; overflow-y: auto; width: 100%; max-width: 720px; margin: 0 auto; padding: 0 20px 16px; }
.np-song { display: flex; flex-direction: column; justify-content: space-evenly; gap: 12px; }
.np-info { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.np-title { font-size: 22px; font-weight: 700; letter-spacing: -.3px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.np-artist { display: block; font-size: 16px; color: var(--muted); margin-top: 4px; max-width: 100%; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seek {
  -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 2px; outline: none;
  background: linear-gradient(to right, #fff var(--p, 0%), rgba(255,255,255,.2) var(--p, 0%));
}
.seek::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; }
.seek::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; }
.times { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 8px; font-variant-numeric: tabular-nums; }
.np-ctrl { display: flex; align-items: center; justify-content: space-between; }
.np-ctrl .ibtn { width: 48px; height: 48px; }
.np-ctrl .ibtn.lg svg { width: 36px; height: 36px; }
.np-ctrl .ibtn.play { width: 72px; height: 72px; background: #fff; color: #000; }
.np-ctrl .ibtn.play svg { width: 36px; height: 36px; }
.np-actions { display: flex; justify-content: space-around; }
.np-actions button { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 6px 10px; border-radius: 10px; }
.np-actions button:active { background: rgba(255,255,255,.08); }
.np-actions button.on { color: var(--accent); }
.np-actions svg { width: 22px; height: 22px; }
.np-note { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); line-height: 1.5; padding: 16px 0 8px; }
.np-note svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; }
.sheet-body {
  width: 100%; max-width: 720px; max-height: 85vh; overflow: auto; background: var(--s1);
  border-radius: 16px 16px 0 0; padding: 8px 8px calc(12px + var(--safe-b)); animation: up .2s ease;
}
@keyframes up { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 14px; border-bottom: 1px solid var(--s2); margin-bottom: 6px; }
.sheet-head img { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; }
.sheet-title { font-weight: 700; font-size: 16px; padding: 10px 12px 12px; }
.sbtn { display: flex; align-items: center; gap: 16px; width: 100%; padding: 14px 12px; border-radius: 10px; font-size: 15px; text-align: left; }
.sbtn svg { width: 22px; height: 22px; color: var(--muted); flex-shrink: 0; }
.sbtn:active { background: var(--s2); }
.sbtn.primary { background: var(--accent); color: #fff; justify-content: center; font-weight: 600; margin: 6px 0; }
.sbtn.danger, .sbtn.danger svg { color: #ff6b6b; }
.field { display: grid; gap: 8px; padding: 6px 12px; font-size: 14px; color: var(--muted); }
.field input { padding: 12px; border-radius: 10px; border: 1px solid var(--s3); background: var(--bg); color: var(--text); font-size: 16px; outline: none; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.5; padding: 4px 12px 8px; }

.toast {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 12px); transform: translateX(-50%); z-index: 60;
  background: #f1f1f1; color: #111; padding: 10px 16px; border-radius: 8px; font-size: 14px;
  max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0,0,0,.4); animation: fade .2s;
}

@media (min-width: 720px) { .picks { grid-auto-columns: 48%; } }

.yt-box.mini-v { --w: min(46vw, 240px); width: var(--w); height: calc(var(--w) * 9 / 16); aspect-ratio: auto; cursor: pointer; }
.yt-box.mini-v iframe { pointer-events: none; }
