# Voice note with waveform

> An audio message whose waveform bars fill in as it plays; tap or drag across the wave to jump, and change the speed.

- Category: [Cards](https://library.aimran.es/components/cards)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-card-voice-note
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

Voice messages are part of everyday chat, and their waveform is the whole interface. Here thirty-four bars with fixed heights fill with color as playback runs, a dot marks the position, and the wave works as an accessible slider with pointer drag and arrow keys. A speed pill cycles 1×, 1.5× and 2×. Good for chat UIs, support widgets and podcast snippets.

The main color is the bubble tint, the bars and the play button, the second color the avatar gradient. Set the real duration in the script and connect it to an audio element when you need sound.

## Code

### HTML

```html
<article class="uvq07-vn"><header><span class="av" aria-hidden="true">IS</span><div><h3>Irene Soler</h3><p>Voice note · 10:42</p></div></header><div class="bb"><button type="button" class="pl" aria-pressed="false" aria-label="Play"><svg class="py" viewBox="0 0 24 24" aria-hidden="true"><path d="M8 5.5v13l10.5-6.5z" fill="currentColor"/></svg><svg class="pa" viewBox="0 0 24 24" aria-hidden="true"><rect x="6.5" y="5.5" width="3.8" height="13" rx="1" fill="currentColor"/><rect x="13.7" y="5.5" width="3.8" height="13" rx="1" fill="currentColor"/></svg></button><div class="wv" role="slider" tabindex="0" aria-label="Audio position" aria-valuemin="0" aria-valuemax="24" aria-valuenow="0" aria-valuetext="0:00"><i style="--h:0.22"></i><i style="--h:0.48"></i><i style="--h:0.76"></i><i style="--h:0.74"></i><i style="--h:0.75"></i><i style="--h:0.65"></i><i style="--h:0.44"></i><i style="--h:0.53"></i><i style="--h:0.67"></i><i style="--h:0.98"></i><i style="--h:0.83"></i><i style="--h:0.36"></i><i style="--h:0.61"></i><i style="--h:0.59"></i><i style="--h:0.88"></i><i style="--h:0.77"></i><i style="--h:0.75"></i><i style="--h:0.33"></i><i style="--h:0.72"></i><i style="--h:0.63"></i><i style="--h:0.98"></i><i style="--h:0.70"></i><i style="--h:0.51"></i><i style="--h:0.54"></i><i style="--h:0.56"></i><i style="--h:0.75"></i><i style="--h:0.94"></i><i style="--h:0.65"></i><i style="--h:0.65"></i><i style="--h:0.57"></i><i style="--h:0.61"></i><i style="--h:0.87"></i><i style="--h:0.69"></i><i style="--h:0.67"></i></div><button type="button" class="sp" aria-label="Speed">1×</button></div><p class="tm"><span class="cu">0:00</span><span>0:24</span></p></article>
```

### CSS

```css
.uvq07-vn {
  --c1: #f0643c;
  --c2: #7c5cff;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq07-vn {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  width: 17em;
  padding: 1em;
  border-radius: 1.4em;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 8%,transparent),0 24px 48px -30px rgba(0,0,0,.45);
}

.uvq07-vn header {
  display: flex;
  align-items: center;
  gap: .6em;
  margin-bottom: .8em;
}

.uvq07-vn .av {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.4em;
  height: 2.4em;
  border-radius: 50%;
  font-size: .85em;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg,var(--c1),var(--c2));
}

.uvq07-vn h3 {
  margin: 0;
  font-size: .92em;
  font-weight: 700;
}

.uvq07-vn header p {
  margin: .1em 0 0;
  font-size: .72em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq07-vn .bb {
  display: flex;
  align-items: center;
  gap: .6em;
  padding: .6em .7em;
  border-radius: 1.2em 1.2em 1.2em .3em;
  background: color-mix(in srgb,var(--c1) 12%,var(--bg));
}

.uvq07-vn .pl {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex: none;
  display: grid;
  place-items: center;
  width: 2.4em;
  height: 2.4em;
  border-radius: 50%;
  color: #fff;
  background: var(--c1);
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq07-vn .pl svg {
  width: 1.1em;
  height: 1.1em;
}

.uvq07-vn .pl .pa,.uvq07-vn .pl[aria-pressed="true"] .py {
  display: none;
}

.uvq07-vn .pl[aria-pressed="true"] .pa {
  display: block;
}

.uvq07-vn .pl:hover {
  transform: scale(1.07);
}

.uvq07-vn .pl:active {
  transform: scale(.9);
}

.uvq07-vn button:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq07-vn .wv {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 2.2em;
  cursor: pointer;
  touch-action: none;
  outline: 0;
  border-radius: .3em;
}

.uvq07-vn .wv:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq07-vn .wv i {
  flex: 1;
  height: calc(var(--h) * 100%);
  min-height: 3px;
  border-radius: 2px;
  background: color-mix(in srgb,var(--fg) 25%,transparent);
  transition: background calc(0.15s / var(--k)) linear;
}

.uvq07-vn .wv i.on {
  background: var(--c1);
}

.uvq07-vn .wv::after {
  content: "";
  position: absolute;
  left: var(--p,0%);
  top: 50%;
  width: .7em;
  height: .7em;
  margin: -.35em 0 0 -.35em;
  border-radius: 50%;
  background: var(--c1);
  box-shadow: 0 0 0 .18em var(--bg);
}

.uvq07-vn .sp {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex: none;
  min-width: 2.7em;
  padding: .35em .45em;
  border-radius: 1em;
  font-size: .72em;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: color-mix(in srgb,var(--fg) 8%,transparent);
  transition: background calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),transform calc(0.2s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq07-vn .sp:hover {
  background: color-mix(in srgb,var(--fg) 14%,transparent);
}

.uvq07-vn .sp:active {
  transform: scale(.9);
}

.uvq07-vn .tm {
  display: flex;
  justify-content: space-between;
  margin: .45em 3.6em 0 3.7em;
  font-size: .7em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion:reduce) {
  .uvq07-vn,.uvq07-vn *,.uvq07-vn *::before,.uvq07-vn *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
```

### JavaScript

```js
document.querySelectorAll(".uvq07-vn").forEach(el => {
  const D=24,pl=el.querySelector(".pl"),wv=el.querySelector(".wv"),sp=el.querySelector(".sp"),cu=el.querySelector(".cu"),bs=[...wv.children];let t=0,on=false,raf=0,last=0,v=1,drag=false;
const fmt=s=>Math.floor(s/60)+":"+String(Math.floor(s%60)).padStart(2,"0");
const draw=()=>{const p=t/D,n=Math.round(p*bs.length);wv.style.setProperty("--p",(p*100).toFixed(2)+"%");bs.forEach((b,i)=>b.classList.toggle("on",i<n));cu.textContent=fmt(t);wv.setAttribute("aria-valuenow",String(Math.floor(t)));wv.setAttribute("aria-valuetext",fmt(t))};
const loop=now=>{t+=(now-last)/1000*v;last=now;if(t>=D){t=0;set(false)}draw();if(on)raf=requestAnimationFrame(loop)};
const set=s=>{on=s;pl.setAttribute("aria-pressed",String(s));pl.setAttribute("aria-label",s?"Pause":"Play");cancelAnimationFrame(raf);if(s){last=performance.now();raf=requestAnimationFrame(loop)}};
const clamp=x=>Math.max(0,Math.min(D-.01,x));const seek=e=>{const r=wv.getBoundingClientRect();t=clamp((e.clientX-r.left)/r.width*D);draw()};
pl.addEventListener("click",()=>set(!on));
wv.addEventListener("pointerdown",e=>{drag=true;wv.setPointerCapture(e.pointerId);seek(e)});wv.addEventListener("pointermove",e=>{if(drag)seek(e)});wv.addEventListener("pointerup",()=>{drag=false});
wv.addEventListener("keydown",e=>{const m={ArrowRight:2,ArrowUp:2,ArrowLeft:-2,ArrowDown:-2}[e.key];if(m){e.preventDefault();t=clamp(t+m);draw()}if(e.key==="Home"){e.preventDefault();t=0;draw()}});
sp.addEventListener("click",()=>{v=v===1?1.5:v===1.5?2:1;sp.textContent=String(v).replace(".",",")+"×"});
return()=>cancelAnimationFrame(raf)
});
```

### React

```tsx
// @ts-nocheck: setup() es JavaScript del DOM sin tipos, el mismo de la pestaña JS.
import { useEffect, useRef, type CSSProperties } from "react";

const css = `
.uvq07-vn {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  width: 17em;
  padding: 1em;
  border-radius: 1.4em;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 8%,transparent),0 24px 48px -30px rgba(0,0,0,.45);
}

.uvq07-vn header {
  display: flex;
  align-items: center;
  gap: .6em;
  margin-bottom: .8em;
}

.uvq07-vn .av {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.4em;
  height: 2.4em;
  border-radius: 50%;
  font-size: .85em;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg,var(--c1),var(--c2));
}

.uvq07-vn h3 {
  margin: 0;
  font-size: .92em;
  font-weight: 700;
}

.uvq07-vn header p {
  margin: .1em 0 0;
  font-size: .72em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq07-vn .bb {
  display: flex;
  align-items: center;
  gap: .6em;
  padding: .6em .7em;
  border-radius: 1.2em 1.2em 1.2em .3em;
  background: color-mix(in srgb,var(--c1) 12%,var(--bg));
}

.uvq07-vn .pl {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex: none;
  display: grid;
  place-items: center;
  width: 2.4em;
  height: 2.4em;
  border-radius: 50%;
  color: #fff;
  background: var(--c1);
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq07-vn .pl svg {
  width: 1.1em;
  height: 1.1em;
}

.uvq07-vn .pl .pa,.uvq07-vn .pl[aria-pressed="true"] .py {
  display: none;
}

.uvq07-vn .pl[aria-pressed="true"] .pa {
  display: block;
}

.uvq07-vn .pl:hover {
  transform: scale(1.07);
}

.uvq07-vn .pl:active {
  transform: scale(.9);
}

.uvq07-vn button:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq07-vn .wv {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 2.2em;
  cursor: pointer;
  touch-action: none;
  outline: 0;
  border-radius: .3em;
}

.uvq07-vn .wv:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq07-vn .wv i {
  flex: 1;
  height: calc(var(--h) * 100%);
  min-height: 3px;
  border-radius: 2px;
  background: color-mix(in srgb,var(--fg) 25%,transparent);
  transition: background calc(0.15s / var(--k)) linear;
}

.uvq07-vn .wv i.on {
  background: var(--c1);
}

.uvq07-vn .wv::after {
  content: "";
  position: absolute;
  left: var(--p,0%);
  top: 50%;
  width: .7em;
  height: .7em;
  margin: -.35em 0 0 -.35em;
  border-radius: 50%;
  background: var(--c1);
  box-shadow: 0 0 0 .18em var(--bg);
}

.uvq07-vn .sp {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex: none;
  min-width: 2.7em;
  padding: .35em .45em;
  border-radius: 1em;
  font-size: .72em;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: color-mix(in srgb,var(--fg) 8%,transparent);
  transition: background calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),transform calc(0.2s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq07-vn .sp:hover {
  background: color-mix(in srgb,var(--fg) 14%,transparent);
}

.uvq07-vn .sp:active {
  transform: scale(.9);
}

.uvq07-vn .tm {
  display: flex;
  justify-content: space-between;
  margin: .45em 3.6em 0 3.7em;
  font-size: .7em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion:reduce) {
  .uvq07-vn,.uvq07-vn *,.uvq07-vn *::before,.uvq07-vn *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
`;

// Interacción en JavaScript del DOM: la misma que en la pestaña JS.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function setup(el: any) {
  const D=24,pl=el.querySelector(".pl"),wv=el.querySelector(".wv"),sp=el.querySelector(".sp"),cu=el.querySelector(".cu"),bs=[...wv.children];let t=0,on=false,raf=0,last=0,v=1,drag=false;
const fmt=s=>Math.floor(s/60)+":"+String(Math.floor(s%60)).padStart(2,"0");
const draw=()=>{const p=t/D,n=Math.round(p*bs.length);wv.style.setProperty("--p",(p*100).toFixed(2)+"%");bs.forEach((b,i)=>b.classList.toggle("on",i<n));cu.textContent=fmt(t);wv.setAttribute("aria-valuenow",String(Math.floor(t)));wv.setAttribute("aria-valuetext",fmt(t))};
const loop=now=>{t+=(now-last)/1000*v;last=now;if(t>=D){t=0;set(false)}draw();if(on)raf=requestAnimationFrame(loop)};
const set=s=>{on=s;pl.setAttribute("aria-pressed",String(s));pl.setAttribute("aria-label",s?"Pause":"Play");cancelAnimationFrame(raf);if(s){last=performance.now();raf=requestAnimationFrame(loop)}};
const clamp=x=>Math.max(0,Math.min(D-.01,x));const seek=e=>{const r=wv.getBoundingClientRect();t=clamp((e.clientX-r.left)/r.width*D);draw()};
pl.addEventListener("click",()=>set(!on));
wv.addEventListener("pointerdown",e=>{drag=true;wv.setPointerCapture(e.pointerId);seek(e)});wv.addEventListener("pointermove",e=>{if(drag)seek(e)});wv.addEventListener("pointerup",()=>{drag=false});
wv.addEventListener("keydown",e=>{const m={ArrowRight:2,ArrowUp:2,ArrowLeft:-2,ArrowDown:-2}[e.key];if(m){e.preventDefault();t=clamp(t+m);draw()}if(e.key==="Home"){e.preventDefault();t=0;draw()}});
sp.addEventListener("click",()=>{v=v===1?1.5:v===1.5?2:1;sp.textContent=String(v).replace(".",",")+"×"});
return()=>cancelAnimationFrame(raf)
}

export default function CardVoiceNote() {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current?.firstElementChild;
    return el ? setup(el) : undefined;
  }, []);

  return (
    <>
      <style>{css}</style>
      <div
        ref={ref} style={{
          "--c1": "#f0643c",
          "--c2": "#7c5cff",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <article className="uvq07-vn"><header><span className="av" aria-hidden="true">IS</span><div><h3>Irene Soler</h3><p>Voice note · 10:42</p></div></header><div className="bb"><button type="button" className="pl" aria-pressed="false" aria-label="Play"><svg className="py" viewBox="0 0 24 24" aria-hidden="true"><path d="M8 5.5v13l10.5-6.5z" fill="currentColor" /></svg><svg className="pa" viewBox="0 0 24 24" aria-hidden="true"><rect x="6.5" y="5.5" width="3.8" height="13" rx="1" fill="currentColor" /><rect x="13.7" y="5.5" width="3.8" height="13" rx="1" fill="currentColor" /></svg></button><div className="wv" role="slider" tabIndex={0} aria-label="Audio position" aria-valuemin="0" aria-valuemax="24" aria-valuenow="0" aria-valuetext="0:00"><i style={{ "--h": "0.22" } as CSSProperties}></i><i style={{ "--h": "0.48" } as CSSProperties}></i><i style={{ "--h": "0.76" } as CSSProperties}></i><i style={{ "--h": "0.74" } as CSSProperties}></i><i style={{ "--h": "0.75" } as CSSProperties}></i><i style={{ "--h": "0.65" } as CSSProperties}></i><i style={{ "--h": "0.44" } as CSSProperties}></i><i style={{ "--h": "0.53" } as CSSProperties}></i><i style={{ "--h": "0.67" } as CSSProperties}></i><i style={{ "--h": "0.98" } as CSSProperties}></i><i style={{ "--h": "0.83" } as CSSProperties}></i><i style={{ "--h": "0.36" } as CSSProperties}></i><i style={{ "--h": "0.61" } as CSSProperties}></i><i style={{ "--h": "0.59" } as CSSProperties}></i><i style={{ "--h": "0.88" } as CSSProperties}></i><i style={{ "--h": "0.77" } as CSSProperties}></i><i style={{ "--h": "0.75" } as CSSProperties}></i><i style={{ "--h": "0.33" } as CSSProperties}></i><i style={{ "--h": "0.72" } as CSSProperties}></i><i style={{ "--h": "0.63" } as CSSProperties}></i><i style={{ "--h": "0.98" } as CSSProperties}></i><i style={{ "--h": "0.70" } as CSSProperties}></i><i style={{ "--h": "0.51" } as CSSProperties}></i><i style={{ "--h": "0.54" } as CSSProperties}></i><i style={{ "--h": "0.56" } as CSSProperties}></i><i style={{ "--h": "0.75" } as CSSProperties}></i><i style={{ "--h": "0.94" } as CSSProperties}></i><i style={{ "--h": "0.65" } as CSSProperties}></i><i style={{ "--h": "0.65" } as CSSProperties}></i><i style={{ "--h": "0.57" } as CSSProperties}></i><i style={{ "--h": "0.61" } as CSSProperties}></i><i style={{ "--h": "0.87" } as CSSProperties}></i><i style={{ "--h": "0.69" } as CSSProperties}></i><i style={{ "--h": "0.67" } as CSSProperties}></i></div><button type="button" className="sp" aria-label="Speed">1×</button></div><p className="tm"><span className="cu">0:00</span><span>0:24</span></p></article>
      </div>
    </>
  );
}
```

## Prompt for AI assistants

Paste this into ChatGPT, Claude, Cursor, v0 or Lovable to adapt the block to your stack (Tailwind, Vue, Svelte…):

````text
I want to add the “Voice note with waveform” block (Cards) from AIMRAN Library to my project.

## What it is
An audio message whose waveform bars fill in as it plays; tap or drag across the wave to jump, and change the speed.

## Chosen settings
- Main color: #f0643c
- Secondary color: #7c5cff
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Irene Soler"

## What I need
1. Add it to my project with the same look and animation as the reference code: same sizes, colours, radii, shadows, timings and easing.
2. It is built with plain HTML and CSS (the reference wraps it in a React component with its CSS). If my project uses something else (Vue, Svelte, Astro, plain HTML…), translate it without losing any behaviour. If I use Tailwind, turn the styles into classes; if not, keep the CSS in its own file.
3. Expose the settings above as props (or CSS variables) with those values as defaults.
4. Make it work well on phones: nothing that depends only on hover, touch targets of at least 44 px and no overflow on 320 px screens.
5. Make it look right in light and dark mode.
6. Keep it accessible: semantic HTML, roles and aria-* where needed, visible focus and keyboard support.
7. Respect prefers-reduced-motion: with reduced motion, no big animations but the same end result.

## Reference code
```tsx
// @ts-nocheck: setup() es JavaScript del DOM sin tipos, el mismo de la pestaña JS.
import { useEffect, useRef, type CSSProperties } from "react";

const css = `
.uvq07-vn {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  width: 17em;
  padding: 1em;
  border-radius: 1.4em;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 8%,transparent),0 24px 48px -30px rgba(0,0,0,.45);
}

.uvq07-vn header {
  display: flex;
  align-items: center;
  gap: .6em;
  margin-bottom: .8em;
}

.uvq07-vn .av {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.4em;
  height: 2.4em;
  border-radius: 50%;
  font-size: .85em;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg,var(--c1),var(--c2));
}

.uvq07-vn h3 {
  margin: 0;
  font-size: .92em;
  font-weight: 700;
}

.uvq07-vn header p {
  margin: .1em 0 0;
  font-size: .72em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq07-vn .bb {
  display: flex;
  align-items: center;
  gap: .6em;
  padding: .6em .7em;
  border-radius: 1.2em 1.2em 1.2em .3em;
  background: color-mix(in srgb,var(--c1) 12%,var(--bg));
}

.uvq07-vn .pl {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex: none;
  display: grid;
  place-items: center;
  width: 2.4em;
  height: 2.4em;
  border-radius: 50%;
  color: #fff;
  background: var(--c1);
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq07-vn .pl svg {
  width: 1.1em;
  height: 1.1em;
}

.uvq07-vn .pl .pa,.uvq07-vn .pl[aria-pressed="true"] .py {
  display: none;
}

.uvq07-vn .pl[aria-pressed="true"] .pa {
  display: block;
}

.uvq07-vn .pl:hover {
  transform: scale(1.07);
}

.uvq07-vn .pl:active {
  transform: scale(.9);
}

.uvq07-vn button:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq07-vn .wv {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 2.2em;
  cursor: pointer;
  touch-action: none;
  outline: 0;
  border-radius: .3em;
}

.uvq07-vn .wv:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq07-vn .wv i {
  flex: 1;
  height: calc(var(--h) * 100%);
  min-height: 3px;
  border-radius: 2px;
  background: color-mix(in srgb,var(--fg) 25%,transparent);
  transition: background calc(0.15s / var(--k)) linear;
}

.uvq07-vn .wv i.on {
  background: var(--c1);
}

.uvq07-vn .wv::after {
  content: "";
  position: absolute;
  left: var(--p,0%);
  top: 50%;
  width: .7em;
  height: .7em;
  margin: -.35em 0 0 -.35em;
  border-radius: 50%;
  background: var(--c1);
  box-shadow: 0 0 0 .18em var(--bg);
}

.uvq07-vn .sp {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex: none;
  min-width: 2.7em;
  padding: .35em .45em;
  border-radius: 1em;
  font-size: .72em;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: color-mix(in srgb,var(--fg) 8%,transparent);
  transition: background calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),transform calc(0.2s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq07-vn .sp:hover {
  background: color-mix(in srgb,var(--fg) 14%,transparent);
}

.uvq07-vn .sp:active {
  transform: scale(.9);
}

.uvq07-vn .tm {
  display: flex;
  justify-content: space-between;
  margin: .45em 3.6em 0 3.7em;
  font-size: .7em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion:reduce) {
  .uvq07-vn,.uvq07-vn *,.uvq07-vn *::before,.uvq07-vn *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
`;

// Interacción en JavaScript del DOM: la misma que en la pestaña JS.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function setup(el: any) {
  const D=24,pl=el.querySelector(".pl"),wv=el.querySelector(".wv"),sp=el.querySelector(".sp"),cu=el.querySelector(".cu"),bs=[...wv.children];let t=0,on=false,raf=0,last=0,v=1,drag=false;
const fmt=s=>Math.floor(s/60)+":"+String(Math.floor(s%60)).padStart(2,"0");
const draw=()=>{const p=t/D,n=Math.round(p*bs.length);wv.style.setProperty("--p",(p*100).toFixed(2)+"%");bs.forEach((b,i)=>b.classList.toggle("on",i<n));cu.textContent=fmt(t);wv.setAttribute("aria-valuenow",String(Math.floor(t)));wv.setAttribute("aria-valuetext",fmt(t))};
const loop=now=>{t+=(now-last)/1000*v;last=now;if(t>=D){t=0;set(false)}draw();if(on)raf=requestAnimationFrame(loop)};
const set=s=>{on=s;pl.setAttribute("aria-pressed",String(s));pl.setAttribute("aria-label",s?"Pause":"Play");cancelAnimationFrame(raf);if(s){last=performance.now();raf=requestAnimationFrame(loop)}};
const clamp=x=>Math.max(0,Math.min(D-.01,x));const seek=e=>{const r=wv.getBoundingClientRect();t=clamp((e.clientX-r.left)/r.width*D);draw()};
pl.addEventListener("click",()=>set(!on));
wv.addEventListener("pointerdown",e=>{drag=true;wv.setPointerCapture(e.pointerId);seek(e)});wv.addEventListener("pointermove",e=>{if(drag)seek(e)});wv.addEventListener("pointerup",()=>{drag=false});
wv.addEventListener("keydown",e=>{const m={ArrowRight:2,ArrowUp:2,ArrowLeft:-2,ArrowDown:-2}[e.key];if(m){e.preventDefault();t=clamp(t+m);draw()}if(e.key==="Home"){e.preventDefault();t=0;draw()}});
sp.addEventListener("click",()=>{v=v===1?1.5:v===1.5?2:1;sp.textContent=String(v).replace(".",",")+"×"});
return()=>cancelAnimationFrame(raf)
}

export default function CardVoiceNote() {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current?.firstElementChild;
    return el ? setup(el) : undefined;
  }, []);

  return (
    <>
      <style>{css}</style>
      <div
        ref={ref} style={{
          "--c1": "#f0643c",
          "--c2": "#7c5cff",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <article className="uvq07-vn"><header><span className="av" aria-hidden="true">IS</span><div><h3>Irene Soler</h3><p>Voice note · 10:42</p></div></header><div className="bb"><button type="button" className="pl" aria-pressed="false" aria-label="Play"><svg className="py" viewBox="0 0 24 24" aria-hidden="true"><path d="M8 5.5v13l10.5-6.5z" fill="currentColor" /></svg><svg className="pa" viewBox="0 0 24 24" aria-hidden="true"><rect x="6.5" y="5.5" width="3.8" height="13" rx="1" fill="currentColor" /><rect x="13.7" y="5.5" width="3.8" height="13" rx="1" fill="currentColor" /></svg></button><div className="wv" role="slider" tabIndex={0} aria-label="Audio position" aria-valuemin="0" aria-valuemax="24" aria-valuenow="0" aria-valuetext="0:00"><i style={{ "--h": "0.22" } as CSSProperties}></i><i style={{ "--h": "0.48" } as CSSProperties}></i><i style={{ "--h": "0.76" } as CSSProperties}></i><i style={{ "--h": "0.74" } as CSSProperties}></i><i style={{ "--h": "0.75" } as CSSProperties}></i><i style={{ "--h": "0.65" } as CSSProperties}></i><i style={{ "--h": "0.44" } as CSSProperties}></i><i style={{ "--h": "0.53" } as CSSProperties}></i><i style={{ "--h": "0.67" } as CSSProperties}></i><i style={{ "--h": "0.98" } as CSSProperties}></i><i style={{ "--h": "0.83" } as CSSProperties}></i><i style={{ "--h": "0.36" } as CSSProperties}></i><i style={{ "--h": "0.61" } as CSSProperties}></i><i style={{ "--h": "0.59" } as CSSProperties}></i><i style={{ "--h": "0.88" } as CSSProperties}></i><i style={{ "--h": "0.77" } as CSSProperties}></i><i style={{ "--h": "0.75" } as CSSProperties}></i><i style={{ "--h": "0.33" } as CSSProperties}></i><i style={{ "--h": "0.72" } as CSSProperties}></i><i style={{ "--h": "0.63" } as CSSProperties}></i><i style={{ "--h": "0.98" } as CSSProperties}></i><i style={{ "--h": "0.70" } as CSSProperties}></i><i style={{ "--h": "0.51" } as CSSProperties}></i><i style={{ "--h": "0.54" } as CSSProperties}></i><i style={{ "--h": "0.56" } as CSSProperties}></i><i style={{ "--h": "0.75" } as CSSProperties}></i><i style={{ "--h": "0.94" } as CSSProperties}></i><i style={{ "--h": "0.65" } as CSSProperties}></i><i style={{ "--h": "0.65" } as CSSProperties}></i><i style={{ "--h": "0.57" } as CSSProperties}></i><i style={{ "--h": "0.61" } as CSSProperties}></i><i style={{ "--h": "0.87" } as CSSProperties}></i><i style={{ "--h": "0.69" } as CSSProperties}></i><i style={{ "--h": "0.67" } as CSSProperties}></i></div><button type="button" className="sp" aria-label="Speed">1×</button></div><p className="tm"><span className="cu">0:00</span><span>0:24</span></p></article>
      </div>
    </>
  );
}
```

Give me the complete final code, ready to paste, and tell me in one line where to put it in my project.
````
