:root{
  color-scheme:dark;
  --bg:#0b0a17; --bg-el:#181230; --card:#100b22; --modal:#1a1a2e;
  --purple:#7c3aed; --purple-lt:#a78bfa; --purple-mut:#c4b5fd; --tab-in:#4c3a73;
  --gold:#e7c07b; --gold-br:#f3d79a; --text:#ece9f6; --muted:#a59cc0; --pink:#f43f5e;
  --sideW:230px; --barH:72px;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%}
body{background:var(--bg);color:var(--text);font-family:-apple-system,'Segoe UI',Roboto,sans-serif;font-size:15px;line-height:1.5}
a{color:inherit;text-decoration:none}
button{font:inherit;color:inherit;background:none;border:0;cursor:pointer}
:focus-visible{outline:2px solid var(--purple-lt);outline-offset:2px;border-radius:4px}

/* bar clearance lives on .pane, NOT .shell: shell padding would shrink the
   sticky sidebar's containment and shove it up at the end of the scroll. */
.shell{display:flex;min-height:100vh}
/* padding-bottom reserves the player bar's strip so the sign-in button
   (margin-top:auto) lands above the bar, not behind it; overflow-y lets a
   short window scroll the sidebar internally instead of the page. */
.side{width:var(--sideW);flex:none;background:#121022;border-right:1px solid rgba(124,58,237,.22);padding:22px 16px calc(var(--barH) + 14px);position:sticky;top:0;height:100vh;overflow-y:auto;display:flex;flex-direction:column;gap:4px}
.side .logo{font-size:20px;font-weight:800;margin-bottom:18px}
.side .logo b{color:var(--purple-lt)}
.nav-item{display:flex;align-items:center;gap:10px;padding:9px 12px;border-radius:9px;color:var(--muted);font-weight:600;font-size:14px}
.nav-item:hover{background:rgba(124,58,237,.12);color:var(--text)}
.nav-item.on{background:rgba(124,58,237,.2);color:var(--purple-mut)}
.side .signin{margin-top:auto;border:1px solid rgba(231,192,123,.55);color:var(--gold);border-radius:999px;padding:7px 12px;font-size:12.5px;text-align:center}
.side .signin:hover{background:rgba(231,192,123,.1)}
.search-in{background:rgba(255,255,255,.05);border:1px solid rgba(124,58,237,.25);border-radius:9px;color:var(--text);padding:8px 11px;width:100%;margin:6px 0 2px;font-size:13.5px}

.pane{flex:1;min-width:0;padding:26px 30px calc(40px + var(--barH))}
.view-title{font-size:12px;letter-spacing:.22em;text-transform:uppercase;color:var(--purple-lt);font-weight:800;margin:0 0 14px}
.arc-panel{background:var(--bg-el);border:1px solid rgba(124,58,237,.35);border-radius:14px;padding:16px 18px;margin-bottom:26px}
.arc-panel h3{margin:0 0 6px;font-size:12px;letter-spacing:.2em;text-transform:uppercase;color:var(--purple-lt)}
.arc-panel p{margin:0;color:var(--purple-mut);font-size:14px}
.artist-h{font-size:12px;letter-spacing:.22em;text-transform:uppercase;color:var(--gold);font-weight:800;margin:26px 0 12px}
.album-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(168px,1fr));gap:20px}
.album-card{display:block;border-radius:12px;padding:10px;background:transparent;transition:background .2s,transform .2s}
.album-card:hover{background:var(--card);transform:translateY(-3px)}
.album-cover{width:100%;aspect-ratio:1;object-fit:cover;border-radius:9px;box-shadow:0 10px 28px rgba(0,0,0,.5);display:block}
.album-card .t{font-weight:700;margin:9px 0 1px;font-size:14.5px}
.album-card .m{color:var(--muted);font-size:12.5px}

.album-hero{display:flex;gap:22px;align-items:flex-end;margin-bottom:22px;flex-wrap:wrap}
.album-hero img{width:190px;height:190px;border-radius:12px;object-fit:cover;box-shadow:0 16px 44px rgba(124,58,237,.35)}
.album-hero h1{margin:.2em 0;font-size:34px;font-weight:800;letter-spacing:-.01em}
.album-hero .stats{color:var(--muted);font-size:13.5px}
.btn-play{background:var(--purple);color:#fff;font-weight:800;border-radius:999px;padding:10px 26px;font-size:14px}
.btn-play:hover{background:#8b5cf6}
.btn-pill{border:1px solid rgba(231,192,123,.6);color:var(--gold);border-radius:999px;padding:9px 18px;font-size:13px;margin-left:8px}
.btn-pill:hover{background:rgba(231,192,123,.1)}
.crumb{color:var(--muted);font-size:13px;margin-bottom:14px;display:inline-block}
.crumb:hover{color:var(--purple-mut)}
.phase-h{font-size:12px;letter-spacing:.18em;text-transform:uppercase;color:var(--purple-lt);margin:22px 0 2px;font-weight:800}
.phase-sub{color:var(--muted);font-size:12.5px;font-style:italic;margin:0 0 8px}

.track-row{display:flex;align-items:center;gap:12px;padding:6px 12px;border-radius:9px;cursor:pointer}
.track-row:hover{background:rgba(124,58,237,.1)}
.track-row .tt{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600;font-size:14.5px}
.track-row .src{color:var(--muted);font-size:12px;margin-left:6px;font-weight:400}
.track-row.is-playing{background:rgba(124,58,237,.18)}
.track-row.is-playing .tt{color:var(--purple-mut)}
.heart{color:var(--tab-in);font-size:15px;padding:4px}
.heart.on{color:var(--pink)}

/* Composed icon-cell -- PG's album_template pattern, values verbatim:
     base = source-album art (cross-album lists) OR track number
     play = hover-only translucent play icon; pause icon on playing-hover
     dur  = bottom-right corner overlay (always visible; solid when playing)
     eq   = full-cover 5-bar white equalizer with dark wash when playing;
            paused rows show the play icon instead (resume affordance) */
.tcell{position:relative;width:48px;height:48px;flex:none;border-radius:6px;overflow:hidden;background:rgba(139,92,246,.10);display:block}
.tcell-art{display:block;width:100%;height:100%;object-fit:cover}
.tcell-num{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:.92rem;font-weight:600;opacity:.75;font-variant-numeric:tabular-nums;transition:opacity .12s;color:var(--muted)}
.tcell-play,.tcell-pause{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:1.1rem;color:#fff;background:rgba(0,0,0,.5);opacity:0;transition:opacity .12s;pointer-events:none}
.track-row:not(.is-playing):hover .tcell-play{opacity:1}
.track-row:hover .tcell-num{opacity:0}
.track-row.is-playing.is-paused .tcell-play{opacity:1}
.track-row.is-playing:not(.is-paused):hover .tcell-pause{opacity:1}
.tcell-dur{position:absolute;right:2px;bottom:2px;font-size:.58rem;line-height:1;color:#fff;background:rgba(0,0,0,.6);padding:1px 3px;border-radius:3px;font-variant-numeric:tabular-nums;opacity:.7;pointer-events:none}
.track-row.is-playing .tcell-dur{opacity:1}
.tcell-eq{position:absolute;inset:0;display:none;align-items:center;justify-content:center;gap:2px;background:rgba(0,0,0,.55)}
.track-row.is-playing:not(.is-paused):not(:hover) .tcell-eq{display:flex}
.tcell-eq i{width:3px;height:13px;background:#fff;border-radius:1px;animation:album-eqbar .9s ease-in-out infinite}
/* Diverging wave: center peaks first, inner pair next, outer bars last */
.tcell-eq i:nth-child(3){animation-delay:0s}
.tcell-eq i:nth-child(2),.tcell-eq i:nth-child(4){animation-delay:.18s}
.tcell-eq i:nth-child(1),.tcell-eq i:nth-child(5){animation-delay:.36s}
@keyframes album-eqbar{0%,100%{height:4px}50%{height:13px}}



.empty{color:var(--muted);padding:40px 0;text-align:center}
.toast{position:fixed;bottom:calc(var(--barH) + 14px);left:50%;transform:translateX(-50%);background:var(--bg-el);border:1px solid rgba(124,58,237,.5);border-radius:999px;padding:9px 18px;font-size:13.5px;z-index:60;opacity:0;transition:opacity .25s;pointer-events:none;white-space:nowrap}
.toast.in{opacity:1}
.plist-row{display:flex;align-items:center;gap:12px;padding:8px 12px;border-radius:10px;background:var(--card);margin-bottom:8px;cursor:pointer}
.plist-row:hover{background:rgba(124,58,237,.14)}
.plist-row .n{flex:1;min-width:0;font-weight:700;display:flex;flex-direction:column;gap:1px}
.plist-row .m{color:var(--muted);font-size:12.5px;font-weight:400}
.plist-art{width:48px;height:48px;flex:none;border-radius:6px;object-fit:cover;background:rgba(139,92,246,.10)}
.plist-art-empty{display:flex;align-items:center;justify-content:center;color:var(--purple-lt);font-size:20px}

@media(max-width:760px){
  :root{--barH:84px}
  .shell{flex-direction:column;padding-bottom:calc(var(--barH) + 52px)}
  /* Bottom tab bar scrolls horizontally when the tabs outgrow the screen
     (7 tabs now); scrollbar hidden, tabs stretch to fill when they fit. */
  .side{width:100%;height:auto;position:fixed;bottom:var(--barH);top:auto;flex-direction:row;align-items:center;padding:6px 8px;border-right:0;border-top:1px solid rgba(124,58,237,.22);z-index:45;gap:2px;
    overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none}
  .side::-webkit-scrollbar{display:none}
  .side .logo,.side .search-in{display:none}
  .side .signin{margin:0 2px 0 4px;flex:none;padding:6px 11px;font-size:10.5px;white-space:nowrap}
  .nav-item{flex:1 0 auto;min-width:58px;flex-direction:column;gap:2px;font-size:10.5px;padding:6px 2px;text-align:center}
  /* 16px+ keeps iOS Safari from auto-zooming the page on focus. */
  .search-in{font-size:16px}
  .pane{padding:18px 14px 30px}
  .album-grid{grid-template-columns:repeat(auto-fill,minmax(128px,1fr));gap:12px}
  .album-hero img{width:130px;height:130px}
  .album-hero h1{font-size:24px}
}

/* Queue tab (PG modal parity) + History (Recent / Most Played) */
.q-strip{display:flex;align-items:center;gap:8px;padding:7px 12px;margin:0 0 6px;border-radius:9px;
  background:rgba(124,58,237,.14);color:var(--purple-mut);font-size:12.5px;font-weight:700;letter-spacing:.04em}
.q-strip-end{margin:6px 0 0;background:none;color:var(--muted);font-weight:600;justify-content:center}
.btn-pill.is-confirming{border-color:var(--pink);color:var(--pink)}
.seg{display:inline-flex;border:1px solid rgba(167,139,250,.35);border-radius:999px;padding:3px;gap:3px;margin:0 0 10px}
.seg button{border:0;background:none;color:var(--muted);font-weight:700;font-size:13px;
  padding:6px 16px;border-radius:999px;cursor:pointer}
.seg button.on{background:rgba(124,58,237,.32);color:var(--purple-mut)}
.note{color:var(--muted);font-size:12.5px;margin:0 0 14px}
.plays{flex:none;color:var(--gold);font-size:12px;font-weight:700;white-space:nowrap}

/* PG track-listing buttons: fav MARK (indicator, shows only when hearted)
   + kebab that opens the song context popup. */
.fav-mark{flex:none;color:var(--pink);width:16px;display:none;align-items:center;justify-content:center}
.fav-mark.on{display:inline-flex}
.fav-mark svg{width:13px;height:13px}
.kebab{flex:none;border:0;background:none;color:var(--muted);padding:6px 4px;cursor:pointer;border-radius:6px}
.kebab:hover{color:var(--purple-mut);background:rgba(124,58,237,.18)}
.kebab svg{width:16px;height:16px;display:block}

/* Song context popup -- PG's openSongInfo shape: hero cover, title + close,
   gender/genre, action list, copyright. */
.ctx-pop{position:fixed;z-index:80;width:270px;max-height:min(72vh,560px);overflow-y:auto;border-radius:14px;
  background:#141127;border:1px solid rgba(167,139,250,.35);box-shadow:0 18px 44px rgba(0,0,0,.55)}
.ctx-hero{display:block;width:100%;border:0;padding:0;background:none;cursor:pointer}
.ctx-hero img{display:block;width:100%;aspect-ratio:1;object-fit:cover}
.ctx-head{display:flex;align-items:center;gap:8px;padding:10px 12px 2px}
.ctx-title{flex:1;min-width:0;font-weight:800;font-size:14.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ctx-close{flex:none;border:0;background:none;color:var(--muted);cursor:pointer;padding:4px;border-radius:6px}
.ctx-close:hover{color:var(--text)}
.ctx-close svg{width:13px;height:13px;display:block}
.ctx-gg{padding:0 12px;color:var(--muted);font-size:11.5px}
.ctx-items{padding:8px 6px 4px;display:flex;flex-direction:column}
.ctx-item{display:flex;align-items:center;gap:11px;width:100%;border:0;background:none;color:var(--text);
  padding:9px 10px;border-radius:9px;cursor:pointer;font-size:13.5px;font-weight:600;text-align:left}
.ctx-item:hover{background:rgba(124,58,237,.18)}
.ctx-item svg{width:15px;height:15px;flex:none;color:var(--purple-lt)}
.ctx-item-text{flex:1;min-width:0;display:flex;flex-direction:column;gap:1px}
.ctx-item-sub{color:var(--muted);font-size:11.5px;font-weight:400;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ctx-copy{padding:6px 12px 10px;color:var(--tab-in);font-size:10.5px}

/* Playing album card: PG's mm-card-glow halo + the small purple eq pulse
   next to the title. Freezes while paused. */
.album-card .mm-eq{display:none;align-items:flex-end;gap:2px;height:13px;margin-left:7px;vertical-align:-1px}
.album-card .mm-eq i{width:3px;background:var(--purple-lt);border-radius:1px;animation:album-eqbar .9s ease-in-out infinite}
.album-card .mm-eq i:nth-child(3){animation-delay:0s}
.album-card .mm-eq i:nth-child(2),.album-card .mm-eq i:nth-child(4){animation-delay:.18s}
.album-card .mm-eq i:nth-child(1),.album-card .mm-eq i:nth-child(5){animation-delay:.36s}
@keyframes mm-card-glow{0%,100%{box-shadow:0 0 0 0 rgba(167,139,250,0)}50%{box-shadow:0 0 16px 2px rgba(167,139,250,.6)}}
.album-card.active{animation:mm-card-glow 2s ease-in-out infinite}
.album-card.active .mm-eq{display:inline-flex}
.album-card.is-paused{animation-play-state:paused}
.album-card.is-paused .mm-eq i{animation-play-state:paused}

/* Albums head: sort select + grid/list toggle (PG mini-player Albums tab) */
.albums-head{display:flex;align-items:center;gap:10px;margin:0 0 16px;flex-wrap:wrap}
.albums-head .view-title{flex:1}
.album-sort{background:rgba(139,92,246,.14);color:var(--text);border:1px solid rgba(139,92,246,.3);
  border-radius:7px;font-size:12px;padding:4px 6px;cursor:pointer;max-width:150px}
.album-sort option{background:var(--bg-el);color:var(--text)}
.album-viewtoggle{width:30px;height:30px;flex:none;display:inline-flex;align-items:center;justify-content:center;
  border-radius:7px;color:var(--muted);cursor:pointer}
.album-viewtoggle:hover{color:var(--text);background:rgba(139,92,246,.16)}
.album-viewtoggle svg{width:16px;height:16px}

/* List view: play | cover | title | songs | length | genre (PG columns) */
:root{--alc:28px 40px minmax(0,1fr) 52px 64px 110px}
.album-listhead{display:grid;grid-template-columns:var(--alc);align-items:end;gap:8px;padding:2px 8px 5px;
  margin-bottom:3px;border-bottom:1px solid rgba(139,92,246,.25)}
.alh{background:none;border:0;color:var(--muted);font-size:10.5px;font-weight:700;text-transform:uppercase;
  letter-spacing:.04em;cursor:pointer;padding:0;display:inline-flex;align-items:center;gap:3px;white-space:nowrap;text-align:left}
.alh:hover{color:var(--text)}
.alh.is-sorted{color:var(--purple-lt)}
.alh.is-sorted.sort-asc::after{content:'\2191'}
.alh.is-sorted.sort-desc::after{content:'\2193'}
.alh-static{cursor:default}
.alh-static:hover{color:var(--muted)}
.album-lrow{display:grid;grid-template-columns:var(--alc);align-items:center;gap:8px;padding:5px 8px;
  border-radius:7px;cursor:pointer;border-bottom:1px solid rgba(255,255,255,.05)}
.album-lrow:hover{background:rgba(139,92,246,.1)}
.album-lrow.active{background:rgba(124,58,237,.24)}
.alr-cover{width:40px;height:40px;border-radius:5px;object-fit:cover;display:block}
.alr-play{width:26px;height:26px;border-radius:50%;background:rgba(124,58,237,.18);color:var(--purple-lt);
  display:inline-flex;align-items:center;justify-content:center;padding:0;transition:background .15s,color .15s,transform .15s}
.alr-play svg{width:12px;height:12px;margin-left:1px}
.album-lrow:hover .alr-play{background:rgba(124,58,237,.92);color:#fff}
.alr-play:hover{background:var(--purple)!important;color:#fff!important;transform:scale(1.08)}
.alr-t{min-width:0;font-weight:700;font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.alr-m{color:var(--muted);font-size:11.5px;font-weight:400;margin-left:8px}
.alr-num{color:var(--muted);font-size:12.5px;font-variant-numeric:tabular-nums;text-align:right}
.alr-g{color:var(--muted);font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
/* Playing list-row shows the same purple eq pulse as the cards. */
.album-lrow .mm-eq{display:none;align-items:flex-end;gap:2px;height:13px;margin-left:7px;vertical-align:-1px}
.album-lrow .mm-eq i{width:3px;background:var(--purple-lt);border-radius:1px;animation:album-eqbar .9s ease-in-out infinite}
.album-lrow .mm-eq i:nth-child(3){animation-delay:0s}
.album-lrow .mm-eq i:nth-child(2),.album-lrow .mm-eq i:nth-child(4){animation-delay:.18s}
.album-lrow .mm-eq i:nth-child(1),.album-lrow .mm-eq i:nth-child(5){animation-delay:.36s}
.album-lrow.active .mm-eq{display:inline-flex}
.album-lrow.is-paused .mm-eq i{animation-play-state:paused}
@media(max-width:600px){
  :root{--alc:28px 40px minmax(0,1fr) 44px}
  .album-listhead .alh:nth-child(5),.album-listhead .alh-static,
  .album-lrow .alr-num + .alr-num,.album-lrow .alr-g{display:none}
}

/* Playlists tab -- Albums-tab treatment (PG modal parity): grid cards with
   hover play + owner actions, list rows, drag-to-reorder your own. */
.plcard{position:relative;border-radius:12px;padding:10px;background:transparent;transition:background .2s,transform .2s;cursor:pointer}
.plcard:hover{background:var(--card);transform:translateY(-3px)}
.plc-cover{position:relative;width:100%;aspect-ratio:1;border-radius:9px;overflow:hidden;background:rgba(139,92,246,.10);box-shadow:0 10px 28px rgba(0,0,0,.5)}
.plc-cover img{width:100%;height:100%;object-fit:cover;display:block}
.plc-empty{display:flex;align-items:center;justify-content:center;width:100%;height:100%;color:var(--purple-lt);font-size:44px}
.plc-play{position:absolute;right:8px;bottom:8px;width:38px;height:38px;border-radius:50%;background:var(--purple);color:#fff;
  display:inline-flex;align-items:center;justify-content:center;opacity:0;transform:translateY(4px);transition:opacity .15s,transform .15s;box-shadow:0 6px 18px rgba(0,0,0,.45)}
.plc-play svg{width:16px;height:16px;margin-left:2px}
.plcard:hover .plc-play{opacity:1;transform:none}
.plcard .t{font-weight:700;margin:9px 0 1px;font-size:14.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.plcard .m{color:var(--muted);font-size:12.5px}
.plc-acts{position:absolute;top:14px;right:14px;display:flex;gap:4px;opacity:0;transition:opacity .15s}
.plcard:hover .plc-acts{opacity:1}
.plist-row .plc-acts{position:static;opacity:1;margin-left:auto}
.plist-row .n{flex:unset}
.plc-act{width:26px;height:26px;border-radius:50%;background:rgba(10,8,20,.75);color:var(--text);display:inline-flex;
  align-items:center;justify-content:center;font-size:13px;line-height:1;border:1px solid rgba(167,139,250,.35)}
.plc-act:hover{background:var(--purple);color:#fff}
.plist-art-wrap{width:48px;height:48px;flex:none;border-radius:6px;overflow:hidden;background:rgba(139,92,246,.10);display:block}
.plist-art-wrap img{width:100%;height:100%;object-fit:cover;display:block}
.plist-art-wrap .plc-empty{font-size:20px}
.pl-rows .plist-row{gap:10px}
.is-dragging{opacity:.45}
[draggable="true"]{cursor:grab}
[draggable="true"]:active{cursor:grabbing}

/* drag handle -- the ONLY draggable element (Safari won't click buttons
   inside draggable parents) */
.grip{flex:none;color:var(--tab-in);font-size:13px;letter-spacing:-3px;padding:4px 3px;user-select:none;-webkit-user-select:none;line-height:1}
.grip:hover{color:var(--purple-mut)}
.plc-acts .grip{width:26px;height:26px;display:inline-flex;align-items:center;justify-content:center;border-radius:50%;background:rgba(10,8,20,.75);border:1px solid rgba(167,139,250,.35);letter-spacing:-3px}
