:root {
  --player-h: 6.5rem;
}

.has-player {
  scroll-padding-bottom: var(--player-h);
}

.has-player body {
  padding-bottom: var(--player-h);
}

.player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 110;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas:
    "timeline timeline close"
    "info controls controls";
  align-items: center;
  gap: 0.3rem 1rem;
  padding: 0.55rem var(--gutter) calc(0.75rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: rgba(5, 7, 11, 0.9);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  visibility: hidden;
  transform: translateY(110%);
  transition: transform 0.6s var(--ease-out), visibility 0s linear 0.6s;
}

.player::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-500), transparent);
  opacity: 0.7;
}

.player.is-active {
  visibility: visible;
  transform: none;
  transition: transform 0.6s var(--ease-out), visibility 0s;
}

@media (min-width: 60rem) {
  :root {
    --player-h: 5.5rem;
  }

  .player {
    grid-template-columns: auto minmax(10rem, 1fr) minmax(16rem, 2fr) auto auto;
    grid-template-areas: "controls info timeline volume close";
    gap: 2rem;
    padding-block: 0.85rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
  }
}

.player__controls {
  grid-area: controls;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.player__btn {
  display: grid;
  place-items: center;
  width: 2.5rem;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text);
  cursor: pointer;
  transition: color 0.3s, background-color 0.3s;
}

.player__btn:hover {
  background-color: rgba(224, 191, 122, 0.1);
  color: var(--gold-200);
}

.player__btn:disabled {
  background: none;
  opacity: 0.3;
  cursor: default;
}

.player__btn svg {
  width: 1.15rem;
  height: 1.15rem;
}

.player__toggle {
  width: 3rem;
  border: 1px solid var(--gold-500);
  box-shadow: 0 0 18px rgba(201, 163, 92, 0.2);
  color: var(--gold-200);
}

.player.is-playing .player__toggle {
  background-color: var(--gold-400);
  color: var(--night-950);
}

.player__close {
  grid-area: close;
  width: 2rem;
  margin-block: -0.375rem;
  color: var(--text-muted);
}

.player__close svg {
  width: 1rem;
  height: 1rem;
}

.player__info {
  grid-area: info;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.player__cover {
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--line);
  object-fit: cover;
}

.player__text {
  display: grid;
  min-width: 0;
}

.player__number {
  overflow: hidden;
  color: var(--gold-500);
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

@media (max-width: 23.5rem) {
  .player__cover {
    display: none;
  }

  .player__number {
    letter-spacing: 0.16em;
  }
}

.player__title {
  overflow: hidden;
  color: var(--parchment);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player__title:hover {
  color: var(--gold-200);
}

.player__timeline {
  grid-area: timeline;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.player__time {
  min-width: 2.6rem;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}

.player__time--current {
  text-align: right;
}

.player__volume {
  grid-area: volume;
  display: none;
  align-items: center;
  gap: 0.25rem;
}

.player__volume .range {
  flex: none;
  width: 6rem;
}

@media (min-width: 60rem) {
  .player__volume {
    display: flex;
  }
}

.range {
  --fill: 0%;
  flex: 1;
  min-width: 0;
  height: 1.25rem;
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.range:disabled {
  cursor: default;
  opacity: 0.4;
}

.range::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--gold-400) var(--fill), rgba(236, 228, 210, 0.16) var(--fill));
}

.range::-webkit-slider-thumb {
  width: 12px;
  height: 12px;
  margin-top: -4.5px;
  border: 0;
  border-radius: 50%;
  background: var(--gold-200);
  box-shadow: 0 0 10px rgba(239, 216, 155, 0.6);
  -webkit-appearance: none;
  appearance: none;
  transition: transform 0.2s;
}

.range:hover::-webkit-slider-thumb {
  transform: scale(1.25);
}

.range::-moz-range-track {
  height: 3px;
  border-radius: 2px;
  background: rgba(236, 228, 210, 0.16);
}

.range::-moz-range-progress {
  height: 3px;
  border-radius: 2px;
  background: var(--gold-400);
}

.range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 50%;
  background: var(--gold-200);
  box-shadow: 0 0 10px rgba(239, 216, 155, 0.6);
}

.icon-pause,
.icon-muted {
  display: none;
}

.is-playing .icon-play,
.is-muted .icon-volume {
  display: none;
}

.is-playing .icon-pause,
.is-muted .icon-muted {
  display: block;
}
