/* desktop player bar (960 px and wider). Phones keep the mini capsule above the dock and never see this. */
#bar { display: none; }

@media (min-width: 960px) {
  #mini { display: none !important; }
  #main { padding-bottom: 132px; }

  #bar { position: fixed; z-index: 39; inset-inline: 264px 14px; bottom: 14px; height: 88px;
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 620px) minmax(0, 1fr); align-items: center; gap: 20px;
    padding: 0 18px; padding-inline-start: 12px; border-radius: 26px; overflow: hidden;
    background: rgba(29, 27, 40, .9);
    background: linear-gradient(90deg, color-mix(in srgb, rgb(var(--tint)) 14%, rgba(29, 27, 40, .92)), rgba(29, 27, 40, .92) 45%);
    backdrop-filter: blur(22px) saturate(1.3); -webkit-backdrop-filter: blur(22px) saturate(1.3);
    box-shadow: 0 18px 44px rgba(8, 6, 16, .55), inset 0 0 0 1px var(--line);
    transition: transform .5s var(--spring), opacity .3s; }
  [dir=rtl] #bar { background: rgba(29, 27, 40, .9);
    background: linear-gradient(270deg, color-mix(in srgb, rgb(var(--tint)) 14%, rgba(29, 27, 40, .92)), rgba(29, 27, 40, .92) 45%); }
  #bar.off { transform: translateY(140%); opacity: 0; pointer-events: none; }
  /* content scrolling under the bar fades out instead of showing a sliced row */
  body.has-bar::after { content: ''; position: fixed; z-index: 38; inset-inline: 250px 0; bottom: 0; height: 128px; pointer-events: none;
    background: linear-gradient(to top, var(--bg) 40%, rgba(21, 20, 29, 0)); }

  /* the song */
  #bar .b-now { display: flex; align-items: center; gap: 14px; min-width: 0; }
  #bar .b-art { position: relative; width: 64px; height: 64px; flex: none; border-radius: 14px; overflow: hidden; background: var(--s2);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .4); transition: transform .2s var(--ease); }
  #bar .b-art img { width: 100%; height: 100%; object-fit: cover; }
  #bar .b-art::after { content: ''; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(12, 10, 20, .45) no-repeat center / 22px
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M15 3h6v6M21 3l-7 7M9 21H3v-6M3 21l7-7'/%3E%3C/svg%3E");
    opacity: 0; transition: opacity .2s; }
  #bar .b-art:hover::after, #bar .b-art:focus-visible::after { opacity: 1; }
  #bar .b-art:hover { transform: translateY(-2px); }
  #bar .b-t { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  #bar .b-t b { font-weight: 600; font-size: 15px; line-height: 1.35; cursor: pointer; }
  #bar .b-t b:hover { text-decoration: underline; text-underline-offset: 3px; }
  #bar .b-t span { font-size: 13px; line-height: 1.35; color: var(--sub); }
  #bar .b-t span.link { cursor: pointer; }
  #bar .b-t span.link:hover { color: var(--txt); text-decoration: underline; text-underline-offset: 3px; }
  #bar .b-t b, #bar .b-t span { unicode-bidi: plaintext; text-align: start; }
  #bar .b-now .love { margin-inline-start: 2px; }

  /* controls + progress */
  #bar .b-mid { display: flex; flex-direction: column; align-items: stretch; gap: 4px; min-width: 0; }
  #bar .b-ctrl { display: flex; align-items: center; justify-content: center; gap: 10px; }
  #bar .b-ctrl .ibtn { color: var(--sub); }
  #bar .b-ctrl .ibtn:hover { color: var(--txt); }
  #bar .b-ctrl .ibtn.on { color: var(--sun); }
  #bar .b-ctrl .ibtn.on::after { content: ''; position: absolute; bottom: 3px; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
  #bar .b-ctrl .ibtn { position: relative; }
  #bar .b-ctrl [data-prev] svg, #bar .b-ctrl [data-next] svg { width: 20px; height: 20px; }
  [dir=rtl] #bar .b-ctrl [data-prev] svg, [dir=rtl] #bar .b-ctrl [data-next] svg { transform: scaleX(-1); }
  #bar .b-pp { position: relative; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; margin-inline: 6px;
    background: var(--txt); color: var(--bg); box-shadow: 0 6px 18px rgba(0, 0, 0, .35); transition: transform .15s var(--ease), background .2s; }
  #bar .b-pp svg { width: 20px; height: 20px; }
  #bar .b-pp:hover { transform: scale(1.06); background: #fff; }
  #bar .b-pp:active { transform: scale(.94); }
  #bar .b-pp.loading::before { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid transparent;
    border-top-color: var(--sun); border-inline-end-color: var(--ember); animation: spin .9s linear infinite; }

  #bar .b-prog { display: flex; align-items: center; gap: 10px; font-size: 11.5px; color: var(--mute); font-variant-numeric: tabular-nums; direction: ltr; }
  #bar .b-prog span { width: 38px; flex: none; text-align: center; }

  /* a line you can drag (song position, volume) */
  #bar .b-scrub { position: relative; flex: 1; height: 18px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
  #bar .b-scrub .tr { position: relative; width: 100%; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .12); transition: height .15s; }
  #bar .b-scrub .bf { position: absolute; inset-block: 0; left: 0; border-radius: inherit; background: rgba(255, 255, 255, .12); }
  #bar .b-scrub .fl { position: absolute; inset-block: 0; left: 0; border-radius: inherit; background: var(--txt); transition: background .2s; }
  #bar .b-scrub:hover .fl, #bar .b-scrub.drag .fl, #bar .b-scrub:focus-visible .fl { background: linear-gradient(90deg, var(--sun), var(--ember)); }
  #bar .b-scrub .th { position: absolute; top: 50%; left: 0; width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px; border-radius: 50%; background: #fff;
    transform: scale(0); transition: transform .15s; box-shadow: 0 2px 8px rgba(0, 0, 0, .45); }
  #bar .b-scrub:hover .tr, #bar .b-scrub.drag .tr { height: 6px; }
  #bar .b-scrub:hover .th, #bar .b-scrub.drag .th, #bar .b-scrub:focus-visible .th { transform: scale(1); }
  #bar .b-scrub:focus-visible { outline: none; }
  #bar .b-scrub:focus-visible .tr { box-shadow: 0 0 0 3px rgba(184, 166, 255, .35); }

  /* lyrics, queue, volume, open */
  #bar .b-end { display: flex; align-items: center; justify-content: flex-end; gap: 4px; min-width: 0; }
  #bar .b-end .ibtn { color: var(--sub); }
  #bar .b-end .ibtn:hover { color: var(--txt); }
  #bar .b-vol { display: flex; align-items: center; gap: 2px; direction: ltr; }
  #bar .b-vol .b-scrub { flex: none; width: 104px; }
}

/* desktop shelves: a page of the row always holds whole cards (4, 5 or 6 by width), no card is ever cut at the edge;
   the arrows in the shelf header turn the page */
.shelf-nav { display: none; }
@media (min-width: 960px) {
  .shelf { --n: 4; --g: 18px; }
  .rail { display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - (var(--n) - 1) * var(--g)) / var(--n)); gap: var(--g);
    margin-inline: 0; padding-inline: 0; scroll-padding-inline: 0; scrollbar-width: none; scroll-behavior: smooth; }
  .rail::-webkit-scrollbar, .chart-cols::-webkit-scrollbar { display: none; }
  .rail > .card, .rail > .card.round { width: auto; min-width: 0; }
  .chart-cols { --c: 2; grid-auto-columns: calc((100% - (var(--c) - 1) * var(--g)) / var(--c)); gap: 0 var(--g); margin-inline: 0; padding-inline: 0; scroll-behavior: smooth; }
  .chart-cols > * { min-width: 0; }
  .shelf-h .more { margin-inline-start: auto; }
  .shelf-nav { display: flex; gap: 6px; flex: none; }
  .shelf-nav.none { display: none; }
  .shelf-nav .ibtn { background: var(--s1); box-shadow: inset 0 0 0 1px var(--line); color: var(--txt); }
  .shelf-nav .ibtn:hover:not(:disabled) { background: var(--s2); }
  .shelf-nav .ibtn:disabled { opacity: .35; cursor: default; }
  [dir=rtl] .shelf-nav svg { transform: scaleX(-1); }
}
@media (min-width: 1100px) { .shelf { --n: 5; } }
@media (min-width: 1280px) { .shelf { --n: 6; } .chart-cols { --c: 3; } }

/* a narrower desktop: the side text gets the room it needs, the volume line gets shorter */
@media (min-width: 960px) and (max-width: 1180px) {
  #bar { grid-template-columns: minmax(0, 1fr) minmax(300px, 1.3fr) auto; gap: 14px; }
  #bar .b-vol .b-scrub { width: 72px; }
  #bar .b-end [data-open] { display: none; }
}
