/* Player (desktop card, mobile mini-player + sheet, waveform).
   Consumes the design tokens from app.css; every rule is scoped to #player, .pl or .wf.
   Apple Music look: material surfaces, a solid mint play button, neutral shadows (tinted only by the real
   artwork's colour via --art-rgb + .has-art-tint), graphite placeholders in the logo's hue family. */

@property --pl-hue {
  syntax: '<number>';
  inherits: true;
  initial-value: 220;
}

.pl {
  --pl-hue: 220;
  /* placeholder tint: --ph-* set on .pl win; else the hashed --pl-hue is folded into the logo's family */
  --ph-h: calc(150 + var(--pl-hue) * 55 / 360);
  --ph-s: 24%;
  --ph-l: 28%;
  position: relative;
  color: var(--text);
  font-family: var(--font);
  transition: --pl-hue .8s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.pl [hidden] { display: none !important; }
.pl-audio { display: none; }
.pl .icon { width: 20px; height: 20px; flex: none; }

/* ---- buttons -------------------------------------------------------------------------- */

.pl-ibtn {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-dim);
  text-decoration: none;
  cursor: pointer;
  transition: color .15s, background-color .15s, transform .15s var(--ease);
}
.pl-ibtn:active { transform: scale(.9); }
.pl-ibtn[aria-pressed="true"],
.pl-ibtn[aria-expanded="true"] { color: var(--accent); }
.pl-ibtn:not([href])[data-bind="download"] { opacity: .4; pointer-events: none; }
a.pl-ibtn:hover,
a.pl-pill:hover { text-decoration: none; }

/* active modes get a small dot, so the state does not rely on colour alone */
.pl-ibtn--mode[aria-pressed="true"]::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 3px;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: currentColor;
}

.pl-ibtn--skip { width: 40px; height: 40px; color: var(--text); }
.pl-ibtn--skip .icon { width: 22px; height: 22px; }

.pl-link {
  display: inline-block;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  vertical-align: bottom;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

/* ---- play / pause (clip-path morph between two halves of a triangle and two bars) ------- */

.pl-play {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .35), inset 0 .5px 0 rgba(255, 255, 255, .4);
  transition: transform .18s var(--ease), background-color .18s var(--ease);
}
.pl-play:active { transform: scale(.94); background: var(--accent-strong); }

.pl-pp { position: relative; width: 20px; height: 20px; }
.pl-pp i {
  position: absolute;
  inset: 0;
  background: currentColor;
  transition: clip-path .24s var(--ease);
}
.pl-pp i:first-child { clip-path: polygon(20% 4%, 58% 27.3%, 58% 72.7%, 20% 96%); }
.pl-pp i:last-child { clip-path: polygon(57% 26.7%, 96% 50%, 96% 50%, 57% 73.3%); }
.pl.is-playing .pl-pp i:first-child { clip-path: polygon(17% 6%, 41% 6%, 41% 94%, 17% 94%); }
.pl.is-playing .pl-pp i:last-child { clip-path: polygon(59% 6%, 83% 6%, 83% 94%, 59% 94%); }

.pl-play__ring {
  position: absolute;
  inset: -5px;
  width: calc(100% + 10px);
  height: calc(100% + 10px);
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 34 110;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.pl.is-buffering .pl-play__ring { opacity: 1; animation: pl-spin .9s linear infinite; }

/* autoplay was blocked: invite a tap */
.pl-play::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  pointer-events: none;
}
.pl.is-blocked .pl-play::after { animation: pl-pulse 1.6s var(--ease) infinite; }

.pl-play--lg { width: 52px; height: 52px; }
.pl-play--xl { width: 76px; height: 76px; }
.pl-play--xl .pl-pp { width: 28px; height: 28px; }
.pl-play--mini { width: 44px; height: 44px; }
.pl-play--mini .pl-pp { width: 16px; height: 16px; }

/* ---- artwork -------------------------------------------------------------------------- */

.pl-art {
  position: relative;
  display: block;
  flex: none;
  width: 88px;
  height: 88px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: none;
  color: inherit;
  isolation: isolate;
  cursor: pointer;
}
/* A soft neutral shadow under the artwork; tinted only by the real artwork's average colour */
.pl-art__glow {
  position: absolute;
  inset: 16% 10% -4%;
  z-index: -1;
  border-radius: inherit;
  background: #000;
  filter: blur(14px);
  opacity: .55;
  transition: opacity .4s, background-color .6s var(--ease);
  pointer-events: none;
}
.pl.has-art-tint .pl-art__glow { background: rgb(var(--art-rgb, 0 0 0)); opacity: .4; }
.pl-art__frame {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  background:
    radial-gradient(120% 90% at 25% 8%, hsl(var(--ph-h) var(--ph-s) calc(var(--ph-l) + 10%) / .42), transparent 62%),
    linear-gradient(160deg, hsl(var(--ph-h) var(--ph-s) var(--ph-l) / .55), hsl(var(--ph-h) var(--ph-s) var(--ph-l) / .12)),
    linear-gradient(180deg, #2c2c2e, #1c1c1e);
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .1);
  transition: transform .45s var(--ease);
}
.pl-art__ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--ph-glyph, rgba(255, 255, 255, .55));
}
.pl-art__ph .icon { width: 42%; height: 42%; stroke-width: 1.6; }
.pl-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .35s var(--ease);
}
.pl-art img.is-loaded { opacity: 1; }
/* Like Apple Music: the artwork settles back a little while paused and comes forward when playing
   (one transition, no endless animation). */
.pl:not(.is-playing) .pl-art--card .pl-art__frame { transform: scale(.94); }
.pl:not(.is-playing) .pl-art--card .pl-art__glow { opacity: .3; }

/* ---- equaliser indicator -------------------------------------------------------------- */

.pl-eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  width: 14px;
  height: 12px;
  flex: none;
  opacity: .55;
  transition: opacity .3s;
}
.pl-eq i {
  flex: 1;
  height: 100%;
  border-radius: 1px;
  background: var(--accent);
  transform-origin: 50% 100%;
  transform: scaleY(.34);
  transition: transform .3s var(--ease);
}
.pl.is-playing .pl-eq { opacity: 1; }
.pl.is-playing .pl-eq i { animation: pl-eq .9s ease-in-out infinite alternate; }
.pl.is-playing .pl-eq i:nth-child(2) { animation-duration: .7s; animation-delay: -.45s; }
.pl.is-playing .pl-eq i:nth-child(3) { animation-duration: 1.1s; animation-delay: -.2s; }
.pl.is-playing .pl-eq i:nth-child(4) { animation-duration: .8s; animation-delay: -.6s; }
.pl.is-buffering .pl-eq i { animation-play-state: paused; }

/* ---- text ----------------------------------------------------------------------------- */

.pl-title {
  overflow: hidden;
  color: var(--text);
  font-size: 17px;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -.01em;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.pl-line {
  margin-top: 3px;
  overflow: hidden;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.35;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.pl-line--dim { margin-top: 1px; color: var(--text-faint); font-size: 13px; }
.pl-line > span:empty { display: none; }
/* The identified track playing now, "Artist - Title" (player.js _npMini): the mini-player's second line,
   and the line under the set's title in place of album / year (the sheet; the desktop card only where
   its popover has no room). Long credits give way: the title keeps all but a few letters of the artist. */
.pl-np { display: flex; align-items: center; gap: 5px; min-width: 0; animation: pl-fade .25s var(--ease); }
.pl-np .icon { flex: none; width: 13px; height: 13px; color: var(--accent); }
.pl-np__track { display: flex; min-width: 0; }
.pl-np__artist, .pl-np__title { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pl-np__sep { flex: none; white-space: pre; }
.pl-np__title { flex: none; max-width: 100%; }
.pl-np__sep + .pl-np__title { max-width: calc(100% - 4.5em); }
.pl-card .pl-np { display: none; }

/* ---- waveform ------------------------------------------------------------------------- */

.wf {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-xs);
  cursor: pointer;
  outline: none;
  -webkit-user-select: none;
  user-select: none;
}
.wf[aria-disabled="true"] { cursor: default; }
.wf:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.wf__canvas { display: block; width: 100%; height: 100%; touch-action: none; }

.wf__head {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -1px;
  width: 1.5px;
  border-radius: 1px;
  background: linear-gradient(rgba(255, 255, 255, 0), #fff 12%, #fff 70%, rgba(255, 255, 255, 0));
  opacity: 0;
  pointer-events: none;
  will-change: transform;
  transition: opacity .25s;
}
.wf.has-head .wf__head { opacity: .9; }
.wf.is-loading .wf__head { opacity: .5; }

/* slim progress bar for formats without peaks: the head becomes a knob */
.wf--flat .wf__head { top: 50%; bottom: auto; left: 0; width: 0; height: 0; background: none; box-shadow: none; }
.wf--flat .wf__head::before {
  content: '';
  position: absolute;
  top: -7px;
  bottom: auto;
  left: 0;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .2), 0 2px 6px rgba(0, 0, 0, .45);
  opacity: 1;
  transform: scale(.6);
  transition: transform .15s var(--ease);
  animation: none !important;
}
.wf--flat.is-hover .wf__head::before,
.wf--flat.is-scrub .wf__head::before,
.wf--flat:focus-visible .wf__head::before { transform: scale(1); }

.wf__bubble {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 2;
  padding: 5px 8px;
  border: .5px solid var(--border-strong);
  border-radius: 8px;
  background: rgba(44, 44, 46, .96);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
  color: var(--text);
  font: 600 12px/1 var(--font);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s;
}
.wf.is-hover .wf__bubble,
.wf.is-scrub .wf__bubble { opacity: 1; }
.wf.is-scrub .wf__bubble { padding: 7px 11px; font-size: 14px; }

/* Identified tracks: small markers resting on the bottom edge (in the reflection), so the bars stay
   readable. Your own scans get the mint ring; covers when there are not too many of them. */
.wf__marks { position: absolute; left: 0; right: 0; bottom: 0; height: 0; z-index: 1; pointer-events: none; }
.wf__marks[hidden] { display: none; }
.wf__mark {
  position: absolute;
  bottom: 1px;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--graphite-cap);
  box-shadow: 0 0 0 1.5px rgba(11, 11, 12, .92), 0 2px 6px rgba(0, 0, 0, .4);
  overflow: hidden;
  opacity: .82;
  cursor: pointer;
  pointer-events: auto;
  transition: transform .15s var(--ease), opacity .15s var(--ease);
}
.wf__mark img { display: block; width: 100%; height: 100%; object-fit: cover; }
.wf__mark.is-mine { background: var(--accent); box-shadow: 0 0 0 1.5px rgba(11, 11, 12, .92), 0 0 0 3px var(--accent), 0 2px 6px rgba(0, 0, 0, .4); }
/* the track playing now ("Show tracks while playing"): a touch bigger and fully opaque, nothing more;
   above its neighbours in a dense set (hover, selected and dragged markers stay above it) */
.wf__mark.is-now { opacity: 1; transform: scale(1.2); z-index: 1; }
.wf__mark:hover { transform: translateY(-3px) scale(1.3); opacity: 1; z-index: 2; }
.wf.is-scrub .wf__mark { opacity: .35; }
.wf__marktip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 3;
  display: flex;
  gap: 8px;
  align-items: baseline;
  max-width: min(320px, 100%);
  padding: 6px 9px;
  border: .5px solid var(--border-strong);
  border-radius: 8px;
  background: rgba(44, 44, 46, .96);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
  color: var(--text);
  font: 500 12px/1.2 var(--font);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s;
}
.wf__marktip.is-on { opacity: 1; }
.wf__marktime { color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; }
.wf__marktext { overflow: hidden; text-overflow: ellipsis; }
.wf.has-marktip .wf__bubble { opacity: 0; }
.wf__mark.is-edit { cursor: grab; touch-action: none; }
.wf__mark.is-drag { cursor: grabbing; opacity: 1; transform: translateY(-3px) scale(1.3); transition: none; z-index: 3; }
.wf__mark.is-sel { opacity: 1; box-shadow: 0 0 0 1.5px rgba(11, 11, 12, .92), 0 0 0 3px #fff, 0 2px 6px rgba(0, 0, 0, .4); z-index: 2; }
/* The selected track's range (start to end, or to the next track while the end is open). */
.wf__range {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 0;
  border-left: 1px solid var(--accent);
  border-right: 1px solid var(--accent);
  background: rgba(109, 215, 202, .1);
  pointer-events: none;
}
.wf__range[hidden] { display: none; }
.wf__range.is-open { border-right-color: transparent; background: linear-gradient(90deg, rgba(109, 215, 202, .1) 70%, rgba(109, 215, 202, 0)); }
.wf__endh {
  position: absolute;
  bottom: 0;
  width: 8px;
  height: 22px;
  margin-left: -4px;
  border-radius: 4px;
  background: var(--accent);
  box-shadow: 0 0 0 1.5px rgba(11, 11, 12, .92), 0 2px 6px rgba(0, 0, 0, .4);
  cursor: ew-resize;
  touch-action: none;
  pointer-events: auto;
  z-index: 1;                  /* on the next marker (where an open end sits), also when that one plays */
}
.wf__endh[hidden] { display: none; }
.wf__endh:hover { transform: scaleY(1.12); }
@media (hover: none) and (pointer: coarse) { .wf__endh { width: 12px; margin-left: -6px; height: 28px; } }
@media (hover: none) and (pointer: coarse) { .wf__mark { width: 18px; height: 18px; margin-left: -9px; } }
@media (prefers-reduced-motion: reduce) { .wf__mark { transition: none; } .wf__mark:hover { transform: none; } }

.wf::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .1), rgba(255, 255, 255, 0)) no-repeat;
  background-size: 34% 90%;
  background-position: -60% 60%;
  transition: opacity .3s;
}
.wf.is-loading::after { opacity: 1; animation: pl-shimmer 1.5s linear infinite; }

/* ---- empty state (desktop) ------------------------------------------------------------ */

.pl-empty {
  display: none;
  box-sizing: border-box;
  align-items: center;
  gap: 14px;
  height: 76px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(28, 28, 30, .9);
  -webkit-backdrop-filter: saturate(140%) blur(30px);
  backdrop-filter: saturate(140%) blur(30px);
  color: var(--text-dim);
}
.pl-empty__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}
.pl-empty__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 13px; line-height: 1.4; }
.pl-empty__text strong { color: var(--text); font-size: 15px; font-weight: 600; }

/* ---- desktop card --------------------------------------------------------------------- */

.pl-card,
.pl-mini,
.pl-sheet { display: none; }

.pl-card {
  grid-template-columns: 88px minmax(0, 1fr) auto;
  grid-template-areas:
    "art meta ctrls"
    "wave wave wave"
    "foot foot foot"
    "details details details";
  align-items: center;
  column-gap: 18px;
  padding: 16px 18px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  /* thicker than the bars: colourful artwork scrolling beneath must not bleed through as a glow */
  background: rgba(28, 28, 30, .9);
  -webkit-backdrop-filter: saturate(140%) blur(30px);
  backdrop-filter: saturate(140%) blur(30px);
  box-shadow: var(--shadow);
}
.pl-art--card { grid-area: art; }
.pl-meta { grid-area: meta; min-width: 0; }
.pl-ctrls { display: flex; align-items: center; gap: 4px; }
.pl-ctrls--card { grid-area: ctrls; }
.pl-wave--card { grid-area: wave; height: 64px; margin-top: 16px; }

.pl-foot {
  grid-area: foot;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-top: 6px;
}
.pl-time {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  font: 500 12.5px/1 var(--font);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pl-time .pl-eq { margin-right: 4px; }
.pl-time__sep { color: var(--text-faint); }
.pl-badge {
  padding: 4px 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--fill);
  color: var(--text-dim);
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: .05em;
  white-space: nowrap;
}
.pl-foot__gap { flex: 1; }
.pl-actions { display: flex; align-items: center; gap: 2px; }

.pl-vol { display: flex; align-items: center; gap: 2px; }
.pl-vol__range {
  --v: 100%;
  width: 92px;
  height: 24px;
  margin: 0 6px 0 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.pl-vol__range:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.pl-vol__range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--text-dim) var(--v), var(--fill-strong) var(--v));
}
.pl-vol__range::-webkit-slider-thumb {
  width: 12px;
  height: 12px;
  margin-top: -4px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .45);
  -webkit-appearance: none;
  appearance: none;
  transition: transform .15s var(--ease);
}
.pl-vol__range::-moz-range-track { height: 4px; border-radius: 4px; background: var(--fill-strong); }
.pl-vol__range::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--text-dim); }
.pl-vol__range::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .45); }

.pl-details { animation: pl-fade .2s var(--ease); }
.pl-details--card {
  grid-area: details;
  margin: 8px 0 6px;
  padding-top: 10px;
  border-top: 1px solid var(--separator);
}
.pl-dl { display: grid; margin: 0; }
.pl-dl__row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--separator);
  font-size: 14px;
  line-height: 1.4;
}
.pl-dl__row:first-child { border-top: 0; }
.pl-dl dt { color: var(--text-faint); }
.pl-dl dd { margin: 0; color: var(--text); overflow-wrap: anywhere; -webkit-user-select: text; user-select: text; }
.pl-details--card .pl-dl { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); grid-auto-flow: row dense; column-gap: 28px; }
.pl-details--card .pl-dl__row--wide { grid-column: span 2; }
.pl-details--card .pl-dl__row { grid-template-columns: 72px minmax(0, 1fr); padding: 4px 0; border: 0; font-size: 13px; }
.pl-skel {
  display: inline-block;
  width: 60%;
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(90deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .14), rgba(255, 255, 255, .06));
  background-size: 200% 100%;
  animation: pl-skel 1.2s linear infinite;
}

@media (min-width: 900px) {
  /* The idle card is 76px and the loaded card 236px tall at every desktop width: app.css reserves exactly
     that space (--player-empty-h / --player-h) before this module mounts. Keep them in sync. */
  .pl-card { display: grid; }
  .pl-empty { display: flex; }
  .pl.is-empty .pl-card,
  .pl:not(.is-empty) .pl-empty { display: none; }
}

@media (min-width: 900px) and (max-width: 1040px) {
  .pl-vol__range { width: 72px; }
}

/* Too short for the now-playing popover below the player (player.js TALL_MQ): the card names the track */
@media (min-width: 900px) and (max-height: 539.98px) {
  .pl-card .pl-np { display: flex; margin-top: 1px; font-size: 13px; }
  .pl-card .pl-np:not([hidden]) + .pl-line--dim { display: none; }
  .pl.has-points .pl-card .pl-line--dim { min-height: 1.35em; }
}

/* Short laptop screens (1366x768, 1280x720): a compact card leaves more of the list visible (UXUI-07).
   app.css reserves the same heights (--player-h / --player-empty-h); keep them in sync. */
@media (min-width: 900px) and (max-height: 820px) {
  .pl-card { grid-template-columns: 64px minmax(0, 1fr) auto; column-gap: 16px; padding: 12px 16px 6px; }
  .pl-art--card { width: 64px; height: 64px; border-radius: 10px; }
  .pl-wave--card { height: 48px; margin-top: 12px; }
  .pl-empty { height: 64px; }
  .pl-empty__icon { width: 36px; height: 36px; }
  .pl-details--card { max-height: 30vh; overflow-y: auto; overscroll-behavior: contain; }
}

/* ---- mobile: mini-player + sheet ------------------------------------------------------- */

@media (max-width: 899.98px) {
  #player {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: var(--z-player);
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0 calc(10px + env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) calc(10px + env(safe-area-inset-left));
    border: 0;
    background: none;
    box-shadow: none;
    transform: none;
    filter: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    pointer-events: none;
  }
  body:not(.has-player) #player { display: none; }

  .pl-mini {
    position: relative;
    display: flex;
    align-items: center;
    gap: 2px;
    max-width: 640px;
    height: var(--mini-h);
    margin: 0 auto;
    padding: 0 6px 0 12px;
    overflow: hidden;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: rgba(28, 28, 30, .9);
    -webkit-backdrop-filter: saturate(140%) blur(30px);
    backdrop-filter: saturate(140%) blur(30px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
    pointer-events: auto;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    transition: opacity .25s var(--ease), transform .25s var(--ease);
  }
  .pl.is-empty .pl-mini { display: none; }
  .pl.is-sheet .pl-mini { opacity: 0; transform: translateY(12px); }

  .pl-mini__bar {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 2px;
    background: var(--fill);
    pointer-events: none;
  }
  .pl-mini__bar i {
    display: block;
    height: 100%;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: 0 50%;
  }
  .pl.is-buffering .pl-mini__bar { animation: pl-barpulse 1.2s ease-in-out infinite; }

  .pl-mini__open {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 12px;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
  }
  .pl-art--mini { width: 44px; height: 44px; border-radius: 8px; }
  .pl-art--mini .pl-art__glow { display: none; }
  .pl-mini__meta { display: flex; flex-direction: column; min-width: 0; }
  .pl-mini .pl-title { font-size: 15px; }
  .pl-mini .pl-line { margin-top: 1px; font-size: 13px; }
  .pl-ibtn--mini { width: 44px; height: 44px; color: var(--text); }
  .pl-ibtn--mini .icon { width: 22px; height: 22px; }
  .pl-play--mini { margin-right: 2px; }

  .pl-sheet {
    position: fixed;
    inset: 0;
    z-index: var(--z-sheet);
    display: flex;
    flex-direction: column;
    background: var(--bg);
    -webkit-user-select: none;
    user-select: none;
    pointer-events: auto;
    visibility: hidden;
    transform: translate3d(0, 100%, 0);
    transition: transform .25s var(--ease), visibility 0s linear .25s;
  }
  .pl.is-sheet .pl-sheet { visibility: visible; transform: none; transition: transform .25s var(--ease), visibility 0s; }
  .pl.is-dragging .pl-sheet { visibility: visible; transition: none; }
  /* the closed sheet stays laid out for its slide-in; its animations need not tick meanwhile */
  .pl:not(.is-sheet):not(.is-dragging) .pl-sheet *,
  .pl:not(.is-sheet):not(.is-dragging) .pl-sheet *::before,
  .pl:not(.is-sheet):not(.is-dragging) .pl-sheet *::after { animation-play-state: paused; }

  .pl-sheet__bg {
    position: absolute;
    inset: 0;
    background:
      radial-gradient(130% 70% at 50% -10%, hsl(var(--ph-h) var(--ph-s) var(--ph-l) / .5), transparent 70%),
      linear-gradient(180deg, #161618, var(--bg) 60%);
    pointer-events: none;
  }
  /* The real artwork's colour (kept dark by player.js) washes the top of the sheet, like Apple Music */
  .pl.has-art-tint .pl-sheet__bg {
    background:
      radial-gradient(130% 70% at 50% -10%, rgb(var(--art-rgb, 0 0 0) / .55), transparent 72%),
      linear-gradient(180deg, #161618, var(--bg) 60%);
  }
  .pl-sheet__scroll {
    position: relative;
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .pl-sheet__inner {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    width: min(540px, 100%);
    min-height: 100%;
    margin: 0 auto;
    padding: calc(env(safe-area-inset-top) + 6px) calc(20px + env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 28px) calc(20px + env(safe-area-inset-left));
  }
  .pl-sheet__head {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 8px;
    min-height: 56px;
    margin: 0 -8px;
  }
  .pl-ibtn--head { width: 44px; height: 44px; color: var(--text); }
  .pl-ibtn--head .icon { width: 24px; height: 24px; }
  .pl-sheet__from { display: flex; flex-direction: column; align-items: center; min-width: 0; text-align: center; }
  .pl-sheet__kicker {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text-dim);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
  }
  .pl-sheet__kicker .pl-eq { width: 12px; height: 10px; }
  .pl:not(.is-playing) .pl-sheet__kicker .pl-eq { display: none; }
  .pl-sheet:focus { outline: none; }
  .pl-sheet__from .pl-link { margin-top: 2px; color: var(--text); font-size: 13px; font-weight: 600; text-align: center; }

  .pl-sheet__stage { display: flex; justify-content: center; padding: 18px 0 24px; }
  .pl-art--xl {
    width: min(100%, calc(100vh - 470px), 460px);
    min-width: 180px;
    height: auto;
    aspect-ratio: 1 / 1;
    border-radius: 18px;
    cursor: grab;
    touch-action: pan-y;
    transition: transform .22s var(--ease), opacity .22s var(--ease);
  }
  @supports (height: 100svh) {
    .pl-art--xl { width: min(100%, calc(100svh - 470px), 460px); }
  }
  .pl-art--xl.is-swiping { transition: none; }
  .pl-art--xl .pl-art__glow { inset: 12% 8% -2%; filter: blur(28px); opacity: .6; }
  .pl-art--xl .pl-art__frame { box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .1); }
  .pl:not(.is-playing) .pl-art--xl .pl-art__frame { transform: scale(.88); }
  .pl:not(.is-playing) .pl-art--xl .pl-art__glow { opacity: .25; }

  .pl-sheet__titles { display: flex; align-items: center; gap: 12px; }
  .pl-sheet__text { flex: 1; min-width: 0; }
  /* the one place meant to show the whole set: up to two lines (UXUI-10) */
  .pl-sheet .pl-title {
    margin: 0; font-size: 22px; font-weight: 700; line-height: 1.25; letter-spacing: -.02em;
    white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
    overflow-wrap: anywhere;
  }
  .pl-sheet .pl-line { margin-top: 4px; font-size: 15px; }
  .pl-sheet .pl-line--dim { margin-top: 2px; font-size: 14px; }
  /* the playing track on the sheet's first screen (its card is further down): album / year's place and
     size, a place kept even where that line is empty (untagged sets), so nothing below moves as tracks
     come and go */
  .pl-sheet .pl-np { margin-top: 2px; font-size: 14px; }
  .pl-sheet .pl-np:not([hidden]) + .pl-line--dim { display: none; }
  .pl.has-points .pl-sheet .pl-line--dim { min-height: 1.35em; }
  .pl-sheet__titles > :last-child { margin-right: -8px; }

  .pl-wave--sheet { height: 96px; margin-top: 22px; }
  .pl-sheet__times {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
    color: var(--text-dim);
    font: 500 12.5px/1 var(--font);
    font-variant-numeric: tabular-nums;
  }
  .pl-sheet__remain {
    min-height: 32px;
    padding: 0 0 0 16px;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
  }

  .pl-ctrls--sheet { justify-content: space-between; width: 100%; max-width: 380px; margin: 10px auto 0; }
  .pl-ctrls--sheet .pl-ibtn--mode { width: 48px; height: 48px; }
  .pl-ctrls--sheet .pl-ibtn--mode .icon { width: 22px; height: 22px; }
  .pl-ctrls--sheet .pl-ibtn--skip { width: 60px; height: 60px; }
  .pl-ctrls--sheet .pl-ibtn--skip .icon { width: 30px; height: 30px; }

  .pl-sheet__actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin-top: 24px; }
  .pl-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px;
    border: 0;
    border-radius: 999px;
    background: var(--fill);
    color: var(--text);
    font: 600 14px/1 var(--font);
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s, transform .15s var(--ease);
  }
  .pl-pill:active { transform: scale(.96); }
  .pl-pill .icon { width: 18px; height: 18px; color: var(--text-dim); }
  .pl-pill:not([href])[data-bind="download"] { display: none; }

  .pl-upnext {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
    margin-top: 22px;
    padding: 13px 15px;
    border: 0;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, .06);
    font-size: 14px;
  }
  .pl-upnext__k { flex: none; color: var(--text-dim); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
  .pl-upnext__t { overflow: hidden; color: var(--text-dim); white-space: nowrap; text-overflow: ellipsis; }

  .pl-details--sheet {
    margin-top: 14px;
    padding: 13px 16px 7px;
    border: 0;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .06);
  }
  .pl-details__h { margin: 0 0 4px; color: var(--text-dim); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
}

/* phones in landscape: artwork left, everything else right */
@media (max-width: 899.98px) and (orientation: landscape) and (max-height: 540px) {
  .pl-sheet__inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-content: start;
    column-gap: 28px;
    width: min(880px, 100%);
  }
  .pl-sheet__inner > * { grid-column: 2; }
  .pl-sheet__head { grid-column: 1 / -1; }
  .pl-sheet__stage { grid-column: 1; grid-row: 2 / span 6; align-self: start; padding: 4px 0 0; }
  .pl-art--xl { width: min(38vw, calc(100vh - 96px)); }
  .pl-wave--sheet { height: 72px; margin-top: 12px; }
  .pl-sheet__actions { justify-content: flex-start; margin-top: 16px; }
}

/* hover feedback only where hovering exists, so states do not stick after a tap */
@media (hover: hover) {
  .pl-ibtn:hover { color: var(--text); background: var(--press); }
  .pl-link:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-strong); }
  .pl-play:hover { transform: scale(1.05); background: #86e0d5; }
  .pl-vol__range:hover::-webkit-slider-thumb { transform: scale(1.2); }
  .pl-pill:hover { background: var(--fill-strong); }
}

/* touch devices (and iOS in general) control volume with hardware buttons */
.pl--fixed-volume .pl-vol { display: none; }
@media (hover: none) and (pointer: coarse) {
  .pl-vol { display: none; }
}

/* ---- motion --------------------------------------------------------------------------- */

@keyframes pl-spin { to { transform: rotate(360deg); } }
@keyframes pl-pulse {
  0% { opacity: .85; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.55); }
}
@keyframes pl-eq {
  0% { transform: scaleY(.22); }
  100% { transform: scaleY(1); }
}
@keyframes pl-shimmer {
  from { background-position: -60% 60%; }
  to { background-position: 160% 60%; }
}
@keyframes pl-skel {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}
@keyframes pl-barpulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}
@keyframes pl-fade {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .pl,
  .pl *,
  .pl *::before,
  .pl *::after {
    animation: none !important;
    transition: none !important;
  }
}
