body {
margin: 0;
min-height: 100vh;
display: grid;
place-items: center;
background: #0e0f13;
color: #f3f3f5;
font: 15px/1.4 system-ui, sans-serif;
}
.player {
width: min(300px, 100% - 32px);
padding: 18px;
border: 1px solid #23252d;
border-radius: 22px;
background: #16171d;
box-shadow: 0 30px 60px -30px rgb(0 0 0 / 0.8);
}
.player__art {
position: relative;
aspect-ratio: 1;
overflow: hidden;
border-radius: 14px;
background:
radial-gradient(circle at 30% 25%, #ffb36b, transparent 45%),
radial-gradient(circle at 75% 70%, #ff4f8b, transparent 50%),
linear-gradient(160deg, #3a1d6e, #0f1b4d);
}
.eq {
position: absolute;
right: 12px;
bottom: 12px;
display: flex;
align-items: flex-end;
gap: 3px;
height: 18px;
}
.eq span {
width: 3px;
height: 30%;
border-radius: 2px;
background: #fff;
}
.player:has([aria-pressed="true"]) .eq span {
animation: eq 0.9s ease-in-out infinite alternate;
}
.eq span:nth-child(2) { animation-delay: -0.3s !important; }
.eq span:nth-child(3) { animation-delay: -0.6s !important; }
.eq span:nth-child(4) { animation-delay: -0.15s !important; }
@keyframes eq {
to { height: 100%; }
}
.player__meta {
margin: 14px 0 10px;
}
.player__title {
margin: 0;
font-size: 1.05rem;
}
.player__artist {
margin: 2px 0 0;
color: #9497a3;
font-size: 0.88rem;
}
.player__seek {
width: 100%;
height: 4px;
margin: 0;
border-radius: 99px;
background: linear-gradient(90deg, #fff var(--progress), #33353e var(--progress));
appearance: none;
cursor: pointer;
}
.player__seek::-webkit-slider-thumb {
width: 12px;
height: 12px;
border-radius: 50%;
background: #fff;
appearance: none;
}
.player__seek::-moz-range-thumb {
width: 12px;
height: 12px;
border: 0;
border-radius: 50%;
background: #fff;
}
.player__times {
display: flex;
justify-content: space-between;
margin-top: 6px;
color: #7d808c;
font-size: 0.75rem;
font-variant-numeric: tabular-nums;
}
.player__controls {
display: flex;
align-items: center;
justify-content: center;
gap: 22px;
margin-top: 8px;
}
.player__controls button {
display: grid;
place-items: center;
padding: 6px;
border: 0;
border-radius: 50%;
background: none;
color: #d9dae0;
cursor: pointer;
}
.player__controls button:focus-visible {
outline: 2px solid #fff;
}
.player__controls .player__play {
width: 54px;
height: 54px;
background: #fff;
color: #111;
}
.player__play .icon-pause,
.player__play[aria-pressed="true"] .icon-play {
display: none;
}
.player__play[aria-pressed="true"] .icon-pause {
display: block;
}
@media (prefers-reduced-motion: reduce) {
.eq span {
animation: none !important;
}
}Usage
Play and pause toggles
aria-pressed on the button; the equalizer only animates while it's pressed. The slider is a native <input type="range">, so it works with the keyboard. Its filled part is driven by --progress.