/* Player bar
   Same surface tone the theme uses on the menu card: page color mixed with a
   bit of the ink color, so a saturated p1 does not leave the bar flat. */
.bras-player {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1000;
  background: var(--pl-bg, #fff);
  border-bottom: 1px solid rgba(127, 127, 127, 0.28);
  /* Only shadow in the theme: lifts the fixed bar off the page content */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 8px 20px -12px rgba(0, 0, 0, 0.18);
}

@supports (background: color-mix(in oklch, red 50%, blue)) {
  .bras-player {
    border-bottom-color: color-mix(in oklch, var(--pl-bg, #fff) 78%, var(--pl-fg, #000) 22%);
  }
}

.bras-player-spacer { height: 64px; }

/* Container matches the theme .wrap so both edges line up */
.bras-player__bar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 64px;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 32px;
}

/* Cover */
.bras-player-background {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  background-color: rgba(127, 127, 127, 0.16);
  background-size: cover;
  background-position: center;
  border-radius: 50%;
}

/* Controls */
.bras-player__controls {
  position: relative;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
}

.fallplayer-play-pause {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  color: var(--pl-bg, #fff);
  background: var(--pl-accent, #d75531);
  border: 1px solid var(--pl-accent, #d75531);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}

.fallplayer-play-pause:hover { opacity: 0.88; }
.fallplayer-play-pause:active { transform: scale(0.94); }

/* Divider: fades at both ends, same treatment the theme lists use */
.bras-player__divider {
  flex-shrink: 0;
  align-self: stretch;
  width: 1px;
  margin: 12px 2px;
  background: linear-gradient(180deg, transparent 0%, rgba(127, 127, 127, 0.22) 16%, rgba(127, 127, 127, 0.22) 84%, transparent 100%);
}

.bras-player .active {
  display: grid !important;
  visibility: visible;
  z-index: 10;
}

.bras-player .inactive {
  display: none !important;
  visibility: hidden;
  z-index: 0;
}

/* Metadata */
.bras-playing-now {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  line-height: 1.25;
}

.rf-playing-label1 {
  display: block;
  overflow: hidden;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--pl-accent, #d75531);
}

.rf-playing-label2 {
  display: block;
  margin: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--pl-fg, #1d1f2e);
}

/* Volume */
.fallplayer-volume {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 6px 12px 6px 10px;
  color: var(--pl-fg, #1d1f2e);
  border: 1px solid rgba(127, 127, 127, 0.34);
  border-radius: 999px;
}

#volumeSlider {
  width: 92px;
  height: 5px;
  margin: 0;
  accent-color: var(--pl-accent, #d75531);
  background: rgba(127, 127, 127, 0.45);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

/* Tint both the track and the border with the ink color so they stay readable
   whatever p1 the client picked */
@supports (background: color-mix(in oklch, red 50%, blue)) {
  .fallplayer-volume {
    border-color: color-mix(in oklch, var(--pl-fg, #000) 26%, transparent);
  }

  #volumeSlider {
    background: color-mix(in oklch, var(--pl-fg, #000) 30%, transparent);
  }

  .bras-player__divider {
    --pl-line: color-mix(in oklch, var(--pl-fg, #000) 22%, transparent);
    background: linear-gradient(180deg, transparent 0%, var(--pl-line) 16%, var(--pl-line) 84%, transparent 100%);
  }
}

#volumeSlider::-webkit-slider-thumb {
  width: 15px;
  height: 15px;
  background: var(--pl-accent, #d75531);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

#volumeSlider::-moz-range-thumb {
  width: 15px;
  height: 15px;
  background: var(--pl-accent, #d75531);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.fallplayer-mute-unmute {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  padding: 0;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.15s;
}

.fallplayer-mute-unmute:hover { opacity: 1; }

.fallplayer-volume .vol-off,
.fallplayer-volume.is-muted .vol-on { display: none; }
.fallplayer-volume.is-muted .vol-off { display: block; }

.fallplayer-volume.is-muted #volumeSlider { accent-color: currentColor; }

/* App shortcuts: folded behind the dots button until asked for */

/* Cast button */
.bras-player__cast {
  position: relative;
  padding: 0;
  background: none;
  cursor: pointer;
}

.bras-player__cast[hidden] { display: none; }
.bras-player__cast .cast-on { display: none; }

/* Casting: filled and pulsing, so it reads as on from across the bar */
.bras-player.is-casting .bras-player__cast {
  color: var(--pl-bg, #fff);
  background: var(--pl-accent, #d75531);
  border-color: var(--pl-accent, #d75531);
}

.bras-player.is-casting .bras-player__cast::after {
  content: "";
  position: absolute;
  inset: -3px;
  border: 2px solid var(--pl-accent, #d75531);
  border-radius: 999px;
  animation: bras-cast-pulse 1.8s ease-out infinite;
  pointer-events: none;
}

.bras-player.is-casting .bras-player__cast .cast-off { display: none; }
.bras-player.is-casting .bras-player__cast .cast-on { display: block; }

@keyframes bras-cast-pulse {
  0% { transform: scale(0.9); opacity: 0.75; }
  70% { transform: scale(1.18); opacity: 0; }
  100% { transform: scale(1.18); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .bras-player.is-casting .bras-player__cast::after { animation: none; opacity: 0.5; }
}

.bras-player__extra {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

.bras-player__apps {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Desktop has room for the shortcuts: the dots button only shows on phones */
.bras-player__more {
  display: none;
  place-items: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--pl-fg, #1d1f2e);
  background: none;
  border: 1px solid rgba(127, 127, 127, 0.34);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.18s, border-color 0.18s;
}

.bras-player__more:hover { color: var(--pl-accent, #d75531); border-color: var(--pl-accent, #d75531); }

.bras-player__more .more-close,
.bras-player.is-apps .bras-player__more .more-dots { display: none; }
.bras-player.is-apps .bras-player__more .more-close { display: block; }

@supports (border-color: color-mix(in oklch, red 50%, blue)) {
  .bras-player__more { border-color: color-mix(in oklch, var(--pl-fg, #000) 26%, transparent); }
}

.bras-player__app {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  font-size: 16px;
  line-height: 1;
  color: var(--pl-fg, #1d1f2e);
  border: 1px solid rgba(127, 127, 127, 0.34);
  border-radius: 999px;
  transition: color 0.18s, border-color 0.18s;
}

.bras-player__app:hover {
  color: var(--pl-accent, #d75531);
  border-color: var(--pl-accent, #d75531);
}

@supports (border-color: color-mix(in oklch, red 50%, blue)) {
  .bras-player__app {
    border-color: color-mix(in oklch, var(--pl-fg, #000) 26%, transparent);
  }
}

/* Offline badge replaces cover, controls, volume and metadata */
.bras-player__offline {
  display: none;
  align-items: center;
  gap: 9px;
  padding: 8px 16px;
  color: var(--pl-accent, #d75531);
  border: 1px solid currentColor;
  border-radius: 999px;
}

.bras-player__offline i {
  flex-shrink: 0;
  font-size: 14px;
}

.bras-player__offline b {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.bras-player.is-offline .bras-player-background,
.bras-player.is-offline .bras-player__controls,
.bras-player.is-offline .fallplayer-volume,
.bras-player.is-offline .bras-player__divider,
.bras-player.is-offline .bras-playing-now { display: none; }

.bras-player.is-offline .bras-player__offline { display: flex; }

/* Skeleton */
.pl-skeleton {
  position: relative;
  overflow: hidden;
  color: transparent !important;
  background-color: rgba(127, 127, 127, 0.16);
  background-image: none !important;
  border-radius: 999px;
}

.rf-playing-label1.pl-skeleton { max-width: 90px; }
.rf-playing-label2.pl-skeleton { max-width: 220px; margin-top: 5px; }

.pl-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transform: translateX(-100%);
  animation: plSkeleton 1.4s ease-in-out infinite;
}

@keyframes plSkeleton {
  100% { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  .pl-skeleton::after { animation: none; }
}

/* Responsive */
@media (max-width: 760px) {
  .bras-player__bar { gap: 10px; padding: 0 16px; }
  .fallplayer-volume { display: none; }
  .bras-player__divider { margin: 16px 0; }

  /* Not enough room for the shortcuts: they fold behind the dots button */
  .bras-player__more { display: grid; }
  .bras-player__apps { display: none; }
  .bras-player.is-apps .bras-player__apps { display: flex; }

  .bras-player.is-apps .bras-playing-now,
  .bras-player.is-apps .bras-player__divider { display: none; }
}

@media (max-width: 380px) {
  .bras-player-background { width: 38px; height: 38px; }
  .rf-playing-label2 { font-size: 14px; }
}
