/* Preview player: round play buttons (progress ring) and the sticky mini-player. Shared by the site and the admin. */

.play {
  --size: 56px;
  --ring: #fff;
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--size);
  height: var(--size);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent, #d4a24c);
  color: var(--on-accent, #14110d);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.play:hover {
  transform: scale(1.07);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55), 0 0 0 6px rgba(var(--accent-rgb, 212, 162, 76), 0.22);
}

.play:active {
  transform: scale(0.95);
}

.play:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.play .icon {
  grid-area: 1 / 1;
  width: 42%;
  height: 42%;
}

.play__icon--play {
  transform: translateX(6%);
}

.play__icon--pause {
  display: none;
}

.play[aria-pressed='true'] .play__icon--play {
  display: none;
}

.play[aria-pressed='true'] .play__icon--pause {
  display: block;
}

/* Progress ring: --progress is 0-100, set by player.js on the active track only */
.play__ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: conic-gradient(var(--ring) calc(var(--progress, 0) * 1%), rgba(255, 255, 255, 0.22) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.play.is-active .play__ring {
  opacity: 1;
}

.play--large {
  --size: 76px;
}

.play--mini {
  --size: 44px;
  box-shadow: none;
}

.play--mini .play__ring {
  inset: -4px;
}

/* ---------- mini-player ---------- */

.miniplayer {
  position: fixed;
  z-index: 60;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto 36px;
  grid-template-areas:
    'cover meta toggle close'
    'seek seek seek seek';
  align-items: center;
  gap: 8px 12px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(22, 19, 16, 0.9);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: #f4efe8;
  animation: mini-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.miniplayer[hidden] {
  display: none;
}

@keyframes mini-in {
  from {
    transform: translateY(100%);
  }
}

.miniplayer__cover {
  grid-area: cover;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: #2a2520;
}

.miniplayer__meta {
  grid-area: meta;
  display: grid;
  min-width: 0;
  line-height: 1.25;
}

.miniplayer__title,
.miniplayer__artist {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.miniplayer__title {
  font-weight: 700;
  font-size: 0.95rem;
}

.miniplayer__artist {
  font-size: 0.8rem;
  color: #b4aa9c;
}

.miniplayer .play--mini {
  grid-area: toggle;
}

.miniplayer__seek {
  grid-area: seek;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.miniplayer__time {
  flex: none;
  min-width: 2.6em;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: #b4aa9c;
}

.miniplayer__time:last-child {
  text-align: right;
}

.miniplayer__close {
  grid-area: close;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #b4aa9c;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.miniplayer__close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.miniplayer__close:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

.miniplayer__close .icon {
  width: 18px;
  height: 18px;
}

/* Seek bar: native range input (keyboard and touch accessible) with a filled track */
.seek {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  min-width: 0;
  height: 28px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  touch-action: pan-y;
}

.seek::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(to right, var(--accent, #d4a24c) calc(var(--seek, 0) * 1%), rgba(255, 255, 255, 0.2) 0);
}

.seek::-moz-range-track {
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.2);
}

.seek::-moz-range-progress {
  height: 4px;
  border-radius: 4px;
  background: var(--accent, #d4a24c);
}

.seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
  transition: transform 0.15s;
}

.seek::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

.seek:active::-webkit-slider-thumb {
  transform: scale(1.25);
}

.seek:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
  border-radius: 6px;
}

@media (min-width: 760px) {
  .miniplayer {
    grid-template-columns: 56px minmax(140px, 1fr) auto minmax(220px, 2fr) 36px;
    grid-template-areas: 'cover meta toggle seek close';
    gap: 16px;
    padding: 10px max(24px, calc((100vw - 1200px) / 2)) calc(10px + env(safe-area-inset-bottom));
  }

  .miniplayer__cover {
    width: 56px;
    height: 56px;
  }
}

body.has-miniplayer {
  padding-bottom: calc(104px + env(safe-area-inset-bottom));
}

@media (min-width: 760px) {
  body.has-miniplayer {
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .play,
  .play__ring,
  .miniplayer {
    animation: none;
    transition: none;
  }
}
