/* --- The player bar: glass ------------------------------------------------------------ */

.player {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.7fr) minmax(0, 1fr);
  grid-template-areas:
    "now star transport extras"
    "now star progress extras";
  align-items: center;
  column-gap: var(--space-3);
  height: calc(var(--bar-h) + var(--safe-b));
  padding: var(--space-2) clamp(.75rem, 2vw, 1.5rem) calc(var(--space-2) + var(--safe-b));
  /* Opaque first: a browser without backdrop-filter gets a solid bar. */
  background-color: var(--surface);
  /* The Sleeve wash: the playing album's tint, fading out behind the now-playing block
     (a 4px strip of it down the left edge read as a glitch). It is declared HERE, not
     on :root: a custom property substitutes var() where it is declared, so a :root
     definition would freeze the root's default tint and never follow the --tint that
     tint.js sets on this element. It is the tint itself, never brightened: tintFor
     keeps --fg-muted at 4.5:1 on any tint, and the glass keeps it on its own, so the
     wash keeps it at any strength (theme.test.mjs, the "wash" pairs). The 55% is
     taste, not contrast. */
  --tint-wash: color-mix(in oklab, var(--tint) 55%, transparent);
  background-image: linear-gradient(90deg, var(--tint-wash), transparent 34%);
  /* The top edge is a hairline drawn as a shadow, so the bar keeps its full height. */
  box-shadow: 0 -1px 0 var(--hairline);
  transition: --tint .2s var(--ease);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .player {
    /* --surface at --glass-alpha. The alpha is the smallest that keeps --fg-muted at
       4.5:1 even over a white cover (theme.test.mjs computes it). background-color,
       not the shorthand, which would reset the wash. */
    background-color: rgb(20 20 23 / var(--glass-alpha));
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    backdrop-filter: blur(24px) saturate(160%);
  }
}

.mini-progress { display: none; }

.player-expand {
  grid-area: now;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  padding: var(--space-1);
  background: none;
  border: 0;
  border-radius: var(--radius-control);
  color: inherit;
  text-align: left;
}
.player-expand:hover:not(:disabled) { background: rgba(255, 255, 255, .06); }
.player-expand:disabled { opacity: 1; cursor: default; }

/* Edged like every cover (cover.css), not shadowed: on the glass a shadow is invisible. */
.player-art {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
}
.player .title { display: grid; min-width: 0; }
.player .now,
.player .title .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player .now { font-weight: 500; }
.player .title .muted { font-size: var(--meta); }
.player[data-idle="true"] .now { color: var(--fg-muted); font-weight: 400; }

.player-star { grid-area: star; }

.transport {
  grid-area: transport;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}
.transport .icon-btn { color: var(--fg); }
.toggle { width: 2.75rem; height: 2.75rem; background: var(--fg); color: var(--bg); }
.toggle .icon { width: 1.375rem; height: 1.375rem; }
/* Must out-rank `.transport .icon-btn` and `.np-transport .icon-btn`, or the glyph
   is --fg on a --fg disc (audit U-02). */
.transport .icon-btn.toggle,
.np-transport .icon-btn.toggle { color: var(--bg); }
.icon-btn.toggle:hover:not(:disabled) { background: var(--fg); color: var(--bg); transform: scale(1.06); }

/* Idle (nothing loaded): no wash, the play disc an outline rather than a solid grey
   disc, and no dead 0:00 scrubber. The buttons stay, disabled; with the scrubber
   hidden the transport spans both rows, so the disc is centred on the bar rather than
   12px above the "Nothing playing" block. The disc rule must out-rank
   `.transport .icon-btn.toggle` above. */
.player[data-idle="true"] { background-image: none; }
.player[data-idle="true"] .transport { grid-row: 1 / -1; }
.player[data-idle="true"] .icon-btn.toggle {
  background: transparent;
  color: var(--fg-muted);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  opacity: 1;
}
.player[data-idle="true"] .progress { visibility: hidden; }

.player .progress {
  grid-area: progress;
}
.progress {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  color: var(--fg-muted);
  font-size: var(--text-xs);
}
.progress .seek { flex: 1; min-width: 0; }
.progress time { min-width: 4.5ch; text-align: center; }

.player-extras {
  grid-area: extras;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-1);
  min-width: 0;
}
.volume { width: min(7rem, 100%); }
.queue-toggle[aria-expanded="true"] { color: var(--accent); }

/* The scrubber's thumb shows while the progress row is hovered, the slider is focused
   or dragged; the filled track says where playback is the rest of the time. Only where
   the pointer can hover: on touch it stays, and the now-playing sheet (not in .player)
   keeps it everywhere. One rule per engine: an unknown pseudo-element drops a rule. */
@media (hover: hover) {
  .player .seek::-webkit-slider-thumb { opacity: 0; transition: opacity var(--motion-fast) var(--ease); }
  .player .seek::-moz-range-thumb { opacity: 0; transition: opacity var(--motion-fast) var(--ease); }
  .player .progress:hover .seek::-webkit-slider-thumb,
  .player .seek:focus-visible::-webkit-slider-thumb,
  .player .seek:active::-webkit-slider-thumb { opacity: 1; }
  .player .progress:hover .seek::-moz-range-thumb,
  .player .seek:focus-visible::-moz-range-thumb,
  .player .seek:active::-moz-range-thumb { opacity: 1; }
}
