# Full-screen story viewer

> Tap an avatar and its story grows to fill the screen, with progress bars, side taps to skip and hold to pause.

- Category: [Overlays](https://library.aimran.es/components/overlays)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-ov-story-viewer
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

Stories are now a pattern of their own, and this overlay rebuilds the whole viewer. The card grows out of the tapped avatar, segmented bars fill over time, tapping the right or left side jumps forward or back, holding pauses and hides the interface, and swiping down closes it. Each scene is painted with CSS gradients. It fits social apps, product updates and event recaps.

The two colors paint the unseen ring around each avatar. Replace the scenes with images or video, keep two stories per person or extend the bars, and use the arrow keys, the pause button and Escape from the keyboard.

## Code

### HTML

```html
<div class="uvq13-sty"><div class="tray"><button type="button" class="av" style="--a:#f97316" aria-haspopup="dialog"><span class="rg"><b aria-hidden="true">L</b></span><small>Lucía</small></button><button type="button" class="av" style="--a:#0ea5e9" aria-haspopup="dialog"><span class="rg"><b aria-hidden="true">M</b></span><small>Marco</small></button><button type="button" class="av" style="--a:#a855f7" aria-haspopup="dialog"><span class="rg"><b aria-hidden="true">I</b></span><small>Inés</small></button><button type="button" class="av" style="--a:#22c55e" aria-haspopup="dialog"><span class="rg"><b aria-hidden="true">T</b></span><small>Teo</small></button></div><div class="fd" aria-hidden="true"><i class="ph"></i><i></i><i class="s"></i></div><div class="vw" role="dialog" aria-modal="true" aria-label="Stories"><div class="cd"><div class="sc" data-s="sun" style="--g1:#fb923c;--g2:#6d28d9"><p>Sunrise at the harbour</p></div><div class="sc" data-s="cup" style="--g1:#7c2d12;--g2:#f59e0b"><p>Eight o'clock coffee</p></div><div class="sc" data-s="hill" style="--g1:#0ea5e9;--g2:#16a34a"><p>Bike ride along the coast</p></div><div class="sc" data-s="dots" style="--g1:#db2777;--g2:#facc15"><p>New mural in the neighbourhood</p></div><div class="sc" data-s="sun" style="--g1:#92400e;--g2:#fde68a"><p>Freshly baked bread</p></div><div class="sc" data-s="wave" style="--g1:#0e7490;--g2:#67e8f9"><p>Last swim of the year</p></div><div class="sc" data-s="rain" style="--g1:#1e293b;--g2:#64748b"><p>Rain on the window</p></div><div class="sc" data-s="dots" style="--g1:#4c1d95;--g2:#f472b6"><p>Concert in the park</p></div><div class="bars" aria-hidden="true"><i><b></b></i><i><b></b></i></div><div class="hd"><span class="ua" aria-hidden="true"></span><b class="un"></b><small>2 h</small><button type="button" class="pz" aria-label="Pause" aria-pressed="false"><svg class="i1" viewBox="0 0 24 24" aria-hidden="true"><path d="M8 5.5v13l10.5-6.5z" fill="currentColor"/></svg><svg class="i2" viewBox="0 0 24 24" aria-hidden="true"><path d="M8 5v14M16 5v14" stroke="currentColor" stroke-width="3" stroke-linecap="round"/></svg></button><button type="button" class="x" aria-label="Close"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 7l10 10M17 7L7 17"/></svg></button></div><button type="button" class="nv pv" aria-label="Previous story"></button><button type="button" class="nv nx" aria-label="Next story"></button></div></div></div>
```

### CSS

```css
.uvq13-sty {
  --c1: #ec4899;
  --c2: #f59e0b;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq13-sty {
  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;
  position: relative;
  width: 22em;
  height: 19em;
  border-radius: 1.2em;
  overflow: hidden;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 9%,transparent);
}

.uvq13-sty .tray {
  display: flex;
  gap: .8em;
  padding: 1em 1.1em .7em;
  border-bottom: 1px solid color-mix(in srgb,var(--fg) 9%,transparent);
}

.uvq13-sty .av {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: grid;
  justify-items: center;
  gap: .3em;
  transition: transform calc(0.2s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq13-sty .av:active {
  transform: scale(.94);
}

.uvq13-sty .rg {
  display: grid;
  place-items: center;
  width: 3.3em;
  height: 3.3em;
  box-sizing: border-box;
  padding: .17em;
  border-radius: 50%;
  background: conic-gradient(from 210deg,var(--c1),var(--c2),var(--c1));
}

.uvq13-sty .av.seen .rg {
  background: color-mix(in srgb,var(--fg) 18%,transparent);
}

.uvq13-sty .rg b {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  font-weight: 800;
  color: #fff;
  background: var(--a);
  box-shadow: 0 0 0 .16em var(--bg);
}

.uvq13-sty .av small {
  font-size: .68em;
  font-weight: 600;
}

.uvq13-sty .av:focus-visible {
  outline: 0;
}

.uvq13-sty .av:focus-visible .rg {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq13-sty .fd {
  display: grid;
  gap: .55em;
  padding: 1em 1.1em;
}

.uvq13-sty .fd i {
  height: .6em;
  border-radius: 1em;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
}

.uvq13-sty .fd .ph {
  height: 6em;
  border-radius: .9em;
}

.uvq13-sty .fd .s {
  width: 60%;
}

.uvq13-sty .vw {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: rgba(8,8,12,.9);
  opacity: 0;
  pointer-events: none;
  transition: opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq13-sty.open .vw {
  opacity: 1;
  pointer-events: auto;
}

.uvq13-sty .cd {
  position: relative;
  width: 9.8em;
  height: 17.2em;
  border-radius: 1em;
  overflow: hidden;
  background: #111;
  transform: scale(.16);
  transition: transform calc(0.45s / var(--k)) cubic-bezier(.22,1,.36,1);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.uvq13-sty.open .cd {
  transform: none;
}

.uvq13-sty .cd.sw {
  animation: uvq13-sty-s calc(0.45s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq13-sty .sc {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: linear-gradient(165deg,var(--g1),var(--g2));
  opacity: 0;
  visibility: hidden;
  transition: opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1),visibility 0s linear calc(0.25s / var(--k));
}

.uvq13-sty .sc.on {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.uvq13-sty .sc::before,.uvq13-sty .sc::after {
  content: "";
  position: absolute;
}

.uvq13-sty .sc.on::before {
  animation: uvq13-sty-k calc(6s / var(--k)) ease-out both;
}

.uvq13-sty [data-s="sun"]::before {
  left: 40%;
  top: 20%;
  width: 5em;
  height: 5em;
  border-radius: 50%;
  background: radial-gradient(circle,#fff7d6,#fde68a 45%,transparent 70%);
}

.uvq13-sty [data-s="sun"]::after {
  left: 0;
  right: 0;
  bottom: 0;
  height: 42%;
  background: repeating-linear-gradient(180deg,rgba(255,255,255,.18) 0 .15em,transparent .15em .7em),linear-gradient(180deg,color-mix(in srgb,var(--g2) 70%,#000),#0b1023);
}

.uvq13-sty [data-s="cup"]::before {
  left: 50%;
  top: 40%;
  width: 6em;
  height: 6em;
  margin: -3em 0 0 -3em;
  border-radius: 50%;
  background: radial-gradient(circle,#c08457 0 30%,#7c3f1d 31% 52%,#f5f0e6 53% 62%,#e7dccb 63% 70%,transparent 71%);
  box-shadow: 0 .6em 1.2em rgba(0,0,0,.35);
}

.uvq13-sty [data-s="cup"]::after {
  left: calc(50% + 2.3em);
  top: calc(40% - .55em);
  width: 1.3em;
  height: 1.1em;
  box-sizing: border-box;
  border: .35em solid #f5f0e6;
  border-left: 0;
  border-radius: 0 1em 1em 0;
}

.uvq13-sty [data-s="hill"]::before {
  left: -30%;
  right: -30%;
  bottom: -25%;
  height: 60%;
  border-radius: 50% 50% 0 0;
  background: color-mix(in srgb,var(--g2) 75%,#000);
}

.uvq13-sty [data-s="hill"]::after {
  right: 18%;
  top: 18%;
  width: 2.2em;
  height: 2.2em;
  border-radius: 50%;
  background: #fef9c3;
  box-shadow: 0 0 1.5em #fef08a;
}

.uvq13-sty [data-s="dots"]::before {
  inset: 0;
  background: radial-gradient(circle,rgba(255,255,255,.35) 0 .25em,transparent .27em) 0 0/1.1em 1.1em;
}

.uvq13-sty [data-s="dots"]::after {
  left: 18%;
  top: 24%;
  width: 6em;
  height: 6em;
  border-radius: 50%;
  background: conic-gradient(from 30deg,#fde047,#fb7185,#38bdf8,#fde047);
  opacity: .85;
}

.uvq13-sty [data-s="wave"]::before {
  left: 0;
  right: 0;
  bottom: 0;
  height: 52%;
  background: radial-gradient(1.2em .9em at 50% 0,transparent 96%,rgba(255,255,255,.3) 100%) 0 0/2.4em 1.1em repeat,linear-gradient(180deg,color-mix(in srgb,var(--g1) 75%,#fff),var(--g1));
}

.uvq13-sty [data-s="wave"]::after {
  left: 30%;
  top: 16%;
  width: 3em;
  height: 3em;
  border-radius: 50%;
  background: #fefce8;
  opacity: .9;
}

.uvq13-sty [data-s="rain"]::before {
  left: 0;
  right: 0;
  top: -20%;
  bottom: 0;
  background: repeating-linear-gradient(105deg,transparent 0 .9em,rgba(255,255,255,.28) .9em 1em);
}

.uvq13-sty .sc.on[data-s="rain"]::before {
  animation: uvq13-sty-r calc(0.8s / var(--k)) linear infinite;
}

.uvq13-sty [data-s="rain"]::after {
  left: 14%;
  right: 14%;
  top: 12%;
  bottom: 30%;
  border: .35em solid rgba(255,255,255,.75);
  border-radius: .3em;
  background: linear-gradient(90deg,transparent calc(50% - .17em),rgba(255,255,255,.75) 0 calc(50% + .17em),transparent 0);
}

.uvq13-sty .sc p {
  position: absolute;
  left: .8em;
  right: .8em;
  bottom: 1.2em;
  z-index: 1;
  margin: 0;
  font-size: 1.1em;
  font-weight: 850;
  line-height: 1.05;
  letter-spacing: -.02em;
  color: #fff;
  text-shadow: 0 .1em .6em rgba(0,0,0,.4);
}

.uvq13-sty .bars {
  position: absolute;
  left: .55em;
  right: .55em;
  top: .55em;
  z-index: 3;
  display: flex;
  gap: .25em;
  transition: opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq13-sty .bars i {
  flex: 1;
  height: .17em;
  border-radius: 1em;
  background: rgba(255,255,255,.35);
  overflow: hidden;
}

.uvq13-sty .bars b {
  display: block;
  height: 100%;
  background: #fff;
  transform-origin: 0 50%;
  transform: scaleX(0);
}

.uvq13-sty .bars .done b {
  transform: none;
}

.uvq13-sty .bars .run b {
  animation: uvq13-sty-p calc(4.5s / var(--k)) linear forwards;
}

.uvq13-sty.pa .bars .run b,.uvq13-sty.hold .bars .run b {
  animation-play-state: paused;
}

.uvq13-sty .hd {
  position: absolute;
  left: .55em;
  right: .3em;
  top: 1em;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: .4em;
  font-size: .74em;
  color: #fff;
  transition: opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq13-sty.hold .hd,.uvq13-sty.hold .bars {
  opacity: 0;
}

.uvq13-sty .ua {
  display: grid;
  place-items: center;
  width: 1.9em;
  height: 1.9em;
  border-radius: 50%;
  font-weight: 800;
  font-size: .85em;
  background: var(--a,#888);
  box-shadow: 0 0 0 .12em #fff;
}

.uvq13-sty .hd small {
  margin-right: auto;
  opacity: .7;
}

.uvq13-sty .hd button {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: grid;
  place-items: center;
  width: 2em;
  height: 2em;
  border-radius: 50%;
  color: #fff;
}

.uvq13-sty .hd svg {
  width: 1.15em;
  height: 1.15em;
}

.uvq13-sty .pz .i1,.uvq13-sty.pa .pz .i2 {
  display: none;
}

.uvq13-sty.pa .pz .i1 {
  display: block;
}

.uvq13-sty .nv {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: absolute;
  top: 2.6em;
  bottom: 0;
  z-index: 2;
}

.uvq13-sty .pv {
  left: 0;
  width: 35%;
}

.uvq13-sty .nx {
  right: 0;
  width: 65%;
}

.uvq13-sty .nv:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -4px;
  border-radius: .8em;
}

.uvq13-sty .hd button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 1px;
}

@keyframes uvq13-sty-p {
  to {
    transform: none;
  }
}

@keyframes uvq13-sty-k {
  from {
    transform: scale(1.15);
  }
}

@keyframes uvq13-sty-r {
  to {
    transform: translateY(16%);
  }
}

@keyframes uvq13-sty-s {
  from {
    transform: perspective(40em) rotateY(-28deg) translateX(20%);
    opacity: .5;
  }
}

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

### JavaScript

```js
document.querySelectorAll(".uvq13-sty").forEach(el => {
  const tray=[...el.querySelectorAll(".av")],vw=el.querySelector(".vw"),cd=el.querySelector(".cd"),scs=[...el.querySelectorAll(".sc")],bars=[...el.querySelectorAll(".bars i")],ua=el.querySelector(".hd .ua"),un=el.querySelector(".hd .un"),pz=el.querySelector(".pz"),nv=[...el.querySelectorAll(".nv")];let u=0,s=0,from=null,tms=[],ht=0,held=false,sy=null;const later=(f,ms)=>tms.push(setTimeout(f,ms));
const isO=()=>el.classList.contains("open");
const setP=p=>{el.classList.toggle("pa",p);pz.setAttribute("aria-pressed",String(p))};
const show=(nu,ns,sw)=>{if(nu>=tray.length){close();return}if(sw&&nu!==u){cd.classList.remove("sw");void cd.offsetWidth;cd.classList.add("sw")}u=Math.max(0,nu);s=ns;tray[u].classList.add("seen");const k=u*2+s;scs.forEach((x,i)=>x.classList.toggle("on",i===k));bars.forEach((b,i)=>b.className=i<s?"done":"");void cd.offsetWidth;bars[s].className="run";ua.style.setProperty("--a",tray[u].style.getPropertyValue("--a"));ua.textContent=tray[u].querySelector("b").textContent;un.textContent=tray[u].querySelector("small").textContent};
const next=()=>s<1?show(u,1):show(u+1,0,true);const prev=()=>s>0?show(u,0):u>0?show(u-1,1,true):show(0,0);
bars.forEach(b=>b.addEventListener("animationend",()=>{if(b.classList.contains("run")&&isO())next()}));
const open=(i,src,f)=>{from=src;const r=src.querySelector(".rg");cd.style.transformOrigin=(r.offsetLeft+r.offsetWidth/2-cd.offsetLeft)+"px "+(r.offsetTop+r.offsetHeight/2-cd.offsetTop)+"px";el.classList.add("open");vw.inert=false;setP(false);show(i,0);f&&later(()=>el.querySelector(".nx").focus({preventScroll:true}),320)};
const close=()=>{if(!isO())return;el.classList.remove("open","hold");vw.inert=true;bars.forEach(b=>b.className="");(from||tray[0]).focus({preventScroll:true})};
pz.addEventListener("click",()=>setP(!el.classList.contains("pa")));el.querySelector(".hd .x").addEventListener("click",close);
tray.forEach((a,i)=>a.addEventListener("click",()=>open(i,a,true)));
nv.forEach(b=>{b.addEventListener("pointerdown",e=>{held=false;sy=e.clientY;clearTimeout(ht);ht=setTimeout(()=>{held=true;el.classList.add("hold")},220)});b.addEventListener("click",()=>{if(held){held=false;return}b.classList.contains("nx")?next():prev()})});
const rel=()=>{clearTimeout(ht);el.classList.remove("hold");sy=null};el.addEventListener("pointerup",rel);el.addEventListener("pointercancel",rel);
el.addEventListener("pointermove",e=>{if(sy!==null&&e.clientY-sy>60){rel();held=true;close()}});
el.addEventListener("keydown",e=>{if(!isO())return;if(e.key==="Escape"){e.preventDefault();close()}else if(e.key==="ArrowRight"){e.preventDefault();next()}else if(e.key==="ArrowLeft"){e.preventDefault();prev()}else if(e.key==="Tab"){const f=[...cd.querySelectorAll("button")],a=f[0],z=f[f.length-1],ac=document.activeElement;if(e.shiftKey&&(ac===a||!cd.contains(ac))){e.preventDefault();z.focus()}else if(!e.shiftKey&&(ac===z||!cd.contains(ac))){e.preventDefault();a.focus()}}});
vw.inert=true;later(()=>open(0,tray[0],false),600);return()=>{tms.forEach(clearTimeout);clearTimeout(ht)}
});
```

### 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 = `
.uvq13-sty {
  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;
  position: relative;
  width: 22em;
  height: 19em;
  border-radius: 1.2em;
  overflow: hidden;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 9%,transparent);
}

.uvq13-sty .tray {
  display: flex;
  gap: .8em;
  padding: 1em 1.1em .7em;
  border-bottom: 1px solid color-mix(in srgb,var(--fg) 9%,transparent);
}

.uvq13-sty .av {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: grid;
  justify-items: center;
  gap: .3em;
  transition: transform calc(0.2s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq13-sty .av:active {
  transform: scale(.94);
}

.uvq13-sty .rg {
  display: grid;
  place-items: center;
  width: 3.3em;
  height: 3.3em;
  box-sizing: border-box;
  padding: .17em;
  border-radius: 50%;
  background: conic-gradient(from 210deg,var(--c1),var(--c2),var(--c1));
}

.uvq13-sty .av.seen .rg {
  background: color-mix(in srgb,var(--fg) 18%,transparent);
}

.uvq13-sty .rg b {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  font-weight: 800;
  color: #fff;
  background: var(--a);
  box-shadow: 0 0 0 .16em var(--bg);
}

.uvq13-sty .av small {
  font-size: .68em;
  font-weight: 600;
}

.uvq13-sty .av:focus-visible {
  outline: 0;
}

.uvq13-sty .av:focus-visible .rg {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq13-sty .fd {
  display: grid;
  gap: .55em;
  padding: 1em 1.1em;
}

.uvq13-sty .fd i {
  height: .6em;
  border-radius: 1em;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
}

.uvq13-sty .fd .ph {
  height: 6em;
  border-radius: .9em;
}

.uvq13-sty .fd .s {
  width: 60%;
}

.uvq13-sty .vw {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: rgba(8,8,12,.9);
  opacity: 0;
  pointer-events: none;
  transition: opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq13-sty.open .vw {
  opacity: 1;
  pointer-events: auto;
}

.uvq13-sty .cd {
  position: relative;
  width: 9.8em;
  height: 17.2em;
  border-radius: 1em;
  overflow: hidden;
  background: #111;
  transform: scale(.16);
  transition: transform calc(0.45s / var(--k)) cubic-bezier(.22,1,.36,1);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.uvq13-sty.open .cd {
  transform: none;
}

.uvq13-sty .cd.sw {
  animation: uvq13-sty-s calc(0.45s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq13-sty .sc {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: linear-gradient(165deg,var(--g1),var(--g2));
  opacity: 0;
  visibility: hidden;
  transition: opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1),visibility 0s linear calc(0.25s / var(--k));
}

.uvq13-sty .sc.on {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.uvq13-sty .sc::before,.uvq13-sty .sc::after {
  content: "";
  position: absolute;
}

.uvq13-sty .sc.on::before {
  animation: uvq13-sty-k calc(6s / var(--k)) ease-out both;
}

.uvq13-sty [data-s="sun"]::before {
  left: 40%;
  top: 20%;
  width: 5em;
  height: 5em;
  border-radius: 50%;
  background: radial-gradient(circle,#fff7d6,#fde68a 45%,transparent 70%);
}

.uvq13-sty [data-s="sun"]::after {
  left: 0;
  right: 0;
  bottom: 0;
  height: 42%;
  background: repeating-linear-gradient(180deg,rgba(255,255,255,.18) 0 .15em,transparent .15em .7em),linear-gradient(180deg,color-mix(in srgb,var(--g2) 70%,#000),#0b1023);
}

.uvq13-sty [data-s="cup"]::before {
  left: 50%;
  top: 40%;
  width: 6em;
  height: 6em;
  margin: -3em 0 0 -3em;
  border-radius: 50%;
  background: radial-gradient(circle,#c08457 0 30%,#7c3f1d 31% 52%,#f5f0e6 53% 62%,#e7dccb 63% 70%,transparent 71%);
  box-shadow: 0 .6em 1.2em rgba(0,0,0,.35);
}

.uvq13-sty [data-s="cup"]::after {
  left: calc(50% + 2.3em);
  top: calc(40% - .55em);
  width: 1.3em;
  height: 1.1em;
  box-sizing: border-box;
  border: .35em solid #f5f0e6;
  border-left: 0;
  border-radius: 0 1em 1em 0;
}

.uvq13-sty [data-s="hill"]::before {
  left: -30%;
  right: -30%;
  bottom: -25%;
  height: 60%;
  border-radius: 50% 50% 0 0;
  background: color-mix(in srgb,var(--g2) 75%,#000);
}

.uvq13-sty [data-s="hill"]::after {
  right: 18%;
  top: 18%;
  width: 2.2em;
  height: 2.2em;
  border-radius: 50%;
  background: #fef9c3;
  box-shadow: 0 0 1.5em #fef08a;
}

.uvq13-sty [data-s="dots"]::before {
  inset: 0;
  background: radial-gradient(circle,rgba(255,255,255,.35) 0 .25em,transparent .27em) 0 0/1.1em 1.1em;
}

.uvq13-sty [data-s="dots"]::after {
  left: 18%;
  top: 24%;
  width: 6em;
  height: 6em;
  border-radius: 50%;
  background: conic-gradient(from 30deg,#fde047,#fb7185,#38bdf8,#fde047);
  opacity: .85;
}

.uvq13-sty [data-s="wave"]::before {
  left: 0;
  right: 0;
  bottom: 0;
  height: 52%;
  background: radial-gradient(1.2em .9em at 50% 0,transparent 96%,rgba(255,255,255,.3) 100%) 0 0/2.4em 1.1em repeat,linear-gradient(180deg,color-mix(in srgb,var(--g1) 75%,#fff),var(--g1));
}

.uvq13-sty [data-s="wave"]::after {
  left: 30%;
  top: 16%;
  width: 3em;
  height: 3em;
  border-radius: 50%;
  background: #fefce8;
  opacity: .9;
}

.uvq13-sty [data-s="rain"]::before {
  left: 0;
  right: 0;
  top: -20%;
  bottom: 0;
  background: repeating-linear-gradient(105deg,transparent 0 .9em,rgba(255,255,255,.28) .9em 1em);
}

.uvq13-sty .sc.on[data-s="rain"]::before {
  animation: uvq13-sty-r calc(0.8s / var(--k)) linear infinite;
}

.uvq13-sty [data-s="rain"]::after {
  left: 14%;
  right: 14%;
  top: 12%;
  bottom: 30%;
  border: .35em solid rgba(255,255,255,.75);
  border-radius: .3em;
  background: linear-gradient(90deg,transparent calc(50% - .17em),rgba(255,255,255,.75) 0 calc(50% + .17em),transparent 0);
}

.uvq13-sty .sc p {
  position: absolute;
  left: .8em;
  right: .8em;
  bottom: 1.2em;
  z-index: 1;
  margin: 0;
  font-size: 1.1em;
  font-weight: 850;
  line-height: 1.05;
  letter-spacing: -.02em;
  color: #fff;
  text-shadow: 0 .1em .6em rgba(0,0,0,.4);
}

.uvq13-sty .bars {
  position: absolute;
  left: .55em;
  right: .55em;
  top: .55em;
  z-index: 3;
  display: flex;
  gap: .25em;
  transition: opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq13-sty .bars i {
  flex: 1;
  height: .17em;
  border-radius: 1em;
  background: rgba(255,255,255,.35);
  overflow: hidden;
}

.uvq13-sty .bars b {
  display: block;
  height: 100%;
  background: #fff;
  transform-origin: 0 50%;
  transform: scaleX(0);
}

.uvq13-sty .bars .done b {
  transform: none;
}

.uvq13-sty .bars .run b {
  animation: uvq13-sty-p calc(4.5s / var(--k)) linear forwards;
}

.uvq13-sty.pa .bars .run b,.uvq13-sty.hold .bars .run b {
  animation-play-state: paused;
}

.uvq13-sty .hd {
  position: absolute;
  left: .55em;
  right: .3em;
  top: 1em;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: .4em;
  font-size: .74em;
  color: #fff;
  transition: opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq13-sty.hold .hd,.uvq13-sty.hold .bars {
  opacity: 0;
}

.uvq13-sty .ua {
  display: grid;
  place-items: center;
  width: 1.9em;
  height: 1.9em;
  border-radius: 50%;
  font-weight: 800;
  font-size: .85em;
  background: var(--a,#888);
  box-shadow: 0 0 0 .12em #fff;
}

.uvq13-sty .hd small {
  margin-right: auto;
  opacity: .7;
}

.uvq13-sty .hd button {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: grid;
  place-items: center;
  width: 2em;
  height: 2em;
  border-radius: 50%;
  color: #fff;
}

.uvq13-sty .hd svg {
  width: 1.15em;
  height: 1.15em;
}

.uvq13-sty .pz .i1,.uvq13-sty.pa .pz .i2 {
  display: none;
}

.uvq13-sty.pa .pz .i1 {
  display: block;
}

.uvq13-sty .nv {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: absolute;
  top: 2.6em;
  bottom: 0;
  z-index: 2;
}

.uvq13-sty .pv {
  left: 0;
  width: 35%;
}

.uvq13-sty .nx {
  right: 0;
  width: 65%;
}

.uvq13-sty .nv:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -4px;
  border-radius: .8em;
}

.uvq13-sty .hd button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 1px;
}

@keyframes uvq13-sty-p {
  to {
    transform: none;
  }
}

@keyframes uvq13-sty-k {
  from {
    transform: scale(1.15);
  }
}

@keyframes uvq13-sty-r {
  to {
    transform: translateY(16%);
  }
}

@keyframes uvq13-sty-s {
  from {
    transform: perspective(40em) rotateY(-28deg) translateX(20%);
    opacity: .5;
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq13-sty,.uvq13-sty *,.uvq13-sty *::before,.uvq13-sty *::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 tray=[...el.querySelectorAll(".av")],vw=el.querySelector(".vw"),cd=el.querySelector(".cd"),scs=[...el.querySelectorAll(".sc")],bars=[...el.querySelectorAll(".bars i")],ua=el.querySelector(".hd .ua"),un=el.querySelector(".hd .un"),pz=el.querySelector(".pz"),nv=[...el.querySelectorAll(".nv")];let u=0,s=0,from=null,tms=[],ht=0,held=false,sy=null;const later=(f,ms)=>tms.push(setTimeout(f,ms));
const isO=()=>el.classList.contains("open");
const setP=p=>{el.classList.toggle("pa",p);pz.setAttribute("aria-pressed",String(p))};
const show=(nu,ns,sw)=>{if(nu>=tray.length){close();return}if(sw&&nu!==u){cd.classList.remove("sw");void cd.offsetWidth;cd.classList.add("sw")}u=Math.max(0,nu);s=ns;tray[u].classList.add("seen");const k=u*2+s;scs.forEach((x,i)=>x.classList.toggle("on",i===k));bars.forEach((b,i)=>b.className=i<s?"done":"");void cd.offsetWidth;bars[s].className="run";ua.style.setProperty("--a",tray[u].style.getPropertyValue("--a"));ua.textContent=tray[u].querySelector("b").textContent;un.textContent=tray[u].querySelector("small").textContent};
const next=()=>s<1?show(u,1):show(u+1,0,true);const prev=()=>s>0?show(u,0):u>0?show(u-1,1,true):show(0,0);
bars.forEach(b=>b.addEventListener("animationend",()=>{if(b.classList.contains("run")&&isO())next()}));
const open=(i,src,f)=>{from=src;const r=src.querySelector(".rg");cd.style.transformOrigin=(r.offsetLeft+r.offsetWidth/2-cd.offsetLeft)+"px "+(r.offsetTop+r.offsetHeight/2-cd.offsetTop)+"px";el.classList.add("open");vw.inert=false;setP(false);show(i,0);f&&later(()=>el.querySelector(".nx").focus({preventScroll:true}),320)};
const close=()=>{if(!isO())return;el.classList.remove("open","hold");vw.inert=true;bars.forEach(b=>b.className="");(from||tray[0]).focus({preventScroll:true})};
pz.addEventListener("click",()=>setP(!el.classList.contains("pa")));el.querySelector(".hd .x").addEventListener("click",close);
tray.forEach((a,i)=>a.addEventListener("click",()=>open(i,a,true)));
nv.forEach(b=>{b.addEventListener("pointerdown",e=>{held=false;sy=e.clientY;clearTimeout(ht);ht=setTimeout(()=>{held=true;el.classList.add("hold")},220)});b.addEventListener("click",()=>{if(held){held=false;return}b.classList.contains("nx")?next():prev()})});
const rel=()=>{clearTimeout(ht);el.classList.remove("hold");sy=null};el.addEventListener("pointerup",rel);el.addEventListener("pointercancel",rel);
el.addEventListener("pointermove",e=>{if(sy!==null&&e.clientY-sy>60){rel();held=true;close()}});
el.addEventListener("keydown",e=>{if(!isO())return;if(e.key==="Escape"){e.preventDefault();close()}else if(e.key==="ArrowRight"){e.preventDefault();next()}else if(e.key==="ArrowLeft"){e.preventDefault();prev()}else if(e.key==="Tab"){const f=[...cd.querySelectorAll("button")],a=f[0],z=f[f.length-1],ac=document.activeElement;if(e.shiftKey&&(ac===a||!cd.contains(ac))){e.preventDefault();z.focus()}else if(!e.shiftKey&&(ac===z||!cd.contains(ac))){e.preventDefault();a.focus()}}});
vw.inert=true;later(()=>open(0,tray[0],false),600);return()=>{tms.forEach(clearTimeout);clearTimeout(ht)}
}

export default function OvStoryViewer() {
  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": "#ec4899",
          "--c2": "#f59e0b",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq13-sty"><div className="tray"><button type="button" className="av" style={{ "--a": "#f97316" } as CSSProperties} aria-haspopup="dialog"><span className="rg"><b aria-hidden="true">L</b></span><small>Lucía</small></button><button type="button" className="av" style={{ "--a": "#0ea5e9" } as CSSProperties} aria-haspopup="dialog"><span className="rg"><b aria-hidden="true">M</b></span><small>Marco</small></button><button type="button" className="av" style={{ "--a": "#a855f7" } as CSSProperties} aria-haspopup="dialog"><span className="rg"><b aria-hidden="true">I</b></span><small>Inés</small></button><button type="button" className="av" style={{ "--a": "#22c55e" } as CSSProperties} aria-haspopup="dialog"><span className="rg"><b aria-hidden="true">T</b></span><small>Teo</small></button></div><div className="fd" aria-hidden="true"><i className="ph"></i><i></i><i className="s"></i></div><div className="vw" role="dialog" aria-modal="true" aria-label="Stories"><div className="cd"><div className="sc" data-s="sun" style={{ "--g1": "#fb923c", "--g2": "#6d28d9" } as CSSProperties}><p>Sunrise at the harbour</p></div><div className="sc" data-s="cup" style={{ "--g1": "#7c2d12", "--g2": "#f59e0b" } as CSSProperties}><p>Eight o'clock coffee</p></div><div className="sc" data-s="hill" style={{ "--g1": "#0ea5e9", "--g2": "#16a34a" } as CSSProperties}><p>Bike ride along the coast</p></div><div className="sc" data-s="dots" style={{ "--g1": "#db2777", "--g2": "#facc15" } as CSSProperties}><p>New mural in the neighbourhood</p></div><div className="sc" data-s="sun" style={{ "--g1": "#92400e", "--g2": "#fde68a" } as CSSProperties}><p>Freshly baked bread</p></div><div className="sc" data-s="wave" style={{ "--g1": "#0e7490", "--g2": "#67e8f9" } as CSSProperties}><p>Last swim of the year</p></div><div className="sc" data-s="rain" style={{ "--g1": "#1e293b", "--g2": "#64748b" } as CSSProperties}><p>Rain on the window</p></div><div className="sc" data-s="dots" style={{ "--g1": "#4c1d95", "--g2": "#f472b6" } as CSSProperties}><p>Concert in the park</p></div><div className="bars" aria-hidden="true"><i><b></b></i><i><b></b></i></div><div className="hd"><span className="ua" aria-hidden="true"></span><b className="un"></b><small>2 h</small><button type="button" className="pz" aria-label="Pause" aria-pressed="false"><svg className="i1" viewBox="0 0 24 24" aria-hidden="true"><path d="M8 5.5v13l10.5-6.5z" fill="currentColor" /></svg><svg className="i2" viewBox="0 0 24 24" aria-hidden="true"><path d="M8 5v14M16 5v14" stroke="currentColor" strokeWidth="3" strokeLinecap="round" /></svg></button><button type="button" className="x" aria-label="Close"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M7 7l10 10M17 7L7 17" /></svg></button></div><button type="button" className="nv pv" aria-label="Previous story"></button><button type="button" className="nv nx" aria-label="Next story"></button></div></div></div>
      </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 “Full-screen story viewer” block (Overlays) from AIMRAN Library to my project.

## What it is
Tap an avatar and its story grows to fill the screen, with progress bars, side taps to skip and hold to pause.

## Chosen settings
- Main color: #ec4899
- Secondary color: #f59e0b
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Historias"

## 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 = `
.uvq13-sty {
  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;
  position: relative;
  width: 22em;
  height: 19em;
  border-radius: 1.2em;
  overflow: hidden;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 9%,transparent);
}

.uvq13-sty .tray {
  display: flex;
  gap: .8em;
  padding: 1em 1.1em .7em;
  border-bottom: 1px solid color-mix(in srgb,var(--fg) 9%,transparent);
}

.uvq13-sty .av {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: grid;
  justify-items: center;
  gap: .3em;
  transition: transform calc(0.2s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq13-sty .av:active {
  transform: scale(.94);
}

.uvq13-sty .rg {
  display: grid;
  place-items: center;
  width: 3.3em;
  height: 3.3em;
  box-sizing: border-box;
  padding: .17em;
  border-radius: 50%;
  background: conic-gradient(from 210deg,var(--c1),var(--c2),var(--c1));
}

.uvq13-sty .av.seen .rg {
  background: color-mix(in srgb,var(--fg) 18%,transparent);
}

.uvq13-sty .rg b {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  font-weight: 800;
  color: #fff;
  background: var(--a);
  box-shadow: 0 0 0 .16em var(--bg);
}

.uvq13-sty .av small {
  font-size: .68em;
  font-weight: 600;
}

.uvq13-sty .av:focus-visible {
  outline: 0;
}

.uvq13-sty .av:focus-visible .rg {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq13-sty .fd {
  display: grid;
  gap: .55em;
  padding: 1em 1.1em;
}

.uvq13-sty .fd i {
  height: .6em;
  border-radius: 1em;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
}

.uvq13-sty .fd .ph {
  height: 6em;
  border-radius: .9em;
}

.uvq13-sty .fd .s {
  width: 60%;
}

.uvq13-sty .vw {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: rgba(8,8,12,.9);
  opacity: 0;
  pointer-events: none;
  transition: opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq13-sty.open .vw {
  opacity: 1;
  pointer-events: auto;
}

.uvq13-sty .cd {
  position: relative;
  width: 9.8em;
  height: 17.2em;
  border-radius: 1em;
  overflow: hidden;
  background: #111;
  transform: scale(.16);
  transition: transform calc(0.45s / var(--k)) cubic-bezier(.22,1,.36,1);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.uvq13-sty.open .cd {
  transform: none;
}

.uvq13-sty .cd.sw {
  animation: uvq13-sty-s calc(0.45s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq13-sty .sc {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: linear-gradient(165deg,var(--g1),var(--g2));
  opacity: 0;
  visibility: hidden;
  transition: opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1),visibility 0s linear calc(0.25s / var(--k));
}

.uvq13-sty .sc.on {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.uvq13-sty .sc::before,.uvq13-sty .sc::after {
  content: "";
  position: absolute;
}

.uvq13-sty .sc.on::before {
  animation: uvq13-sty-k calc(6s / var(--k)) ease-out both;
}

.uvq13-sty [data-s="sun"]::before {
  left: 40%;
  top: 20%;
  width: 5em;
  height: 5em;
  border-radius: 50%;
  background: radial-gradient(circle,#fff7d6,#fde68a 45%,transparent 70%);
}

.uvq13-sty [data-s="sun"]::after {
  left: 0;
  right: 0;
  bottom: 0;
  height: 42%;
  background: repeating-linear-gradient(180deg,rgba(255,255,255,.18) 0 .15em,transparent .15em .7em),linear-gradient(180deg,color-mix(in srgb,var(--g2) 70%,#000),#0b1023);
}

.uvq13-sty [data-s="cup"]::before {
  left: 50%;
  top: 40%;
  width: 6em;
  height: 6em;
  margin: -3em 0 0 -3em;
  border-radius: 50%;
  background: radial-gradient(circle,#c08457 0 30%,#7c3f1d 31% 52%,#f5f0e6 53% 62%,#e7dccb 63% 70%,transparent 71%);
  box-shadow: 0 .6em 1.2em rgba(0,0,0,.35);
}

.uvq13-sty [data-s="cup"]::after {
  left: calc(50% + 2.3em);
  top: calc(40% - .55em);
  width: 1.3em;
  height: 1.1em;
  box-sizing: border-box;
  border: .35em solid #f5f0e6;
  border-left: 0;
  border-radius: 0 1em 1em 0;
}

.uvq13-sty [data-s="hill"]::before {
  left: -30%;
  right: -30%;
  bottom: -25%;
  height: 60%;
  border-radius: 50% 50% 0 0;
  background: color-mix(in srgb,var(--g2) 75%,#000);
}

.uvq13-sty [data-s="hill"]::after {
  right: 18%;
  top: 18%;
  width: 2.2em;
  height: 2.2em;
  border-radius: 50%;
  background: #fef9c3;
  box-shadow: 0 0 1.5em #fef08a;
}

.uvq13-sty [data-s="dots"]::before {
  inset: 0;
  background: radial-gradient(circle,rgba(255,255,255,.35) 0 .25em,transparent .27em) 0 0/1.1em 1.1em;
}

.uvq13-sty [data-s="dots"]::after {
  left: 18%;
  top: 24%;
  width: 6em;
  height: 6em;
  border-radius: 50%;
  background: conic-gradient(from 30deg,#fde047,#fb7185,#38bdf8,#fde047);
  opacity: .85;
}

.uvq13-sty [data-s="wave"]::before {
  left: 0;
  right: 0;
  bottom: 0;
  height: 52%;
  background: radial-gradient(1.2em .9em at 50% 0,transparent 96%,rgba(255,255,255,.3) 100%) 0 0/2.4em 1.1em repeat,linear-gradient(180deg,color-mix(in srgb,var(--g1) 75%,#fff),var(--g1));
}

.uvq13-sty [data-s="wave"]::after {
  left: 30%;
  top: 16%;
  width: 3em;
  height: 3em;
  border-radius: 50%;
  background: #fefce8;
  opacity: .9;
}

.uvq13-sty [data-s="rain"]::before {
  left: 0;
  right: 0;
  top: -20%;
  bottom: 0;
  background: repeating-linear-gradient(105deg,transparent 0 .9em,rgba(255,255,255,.28) .9em 1em);
}

.uvq13-sty .sc.on[data-s="rain"]::before {
  animation: uvq13-sty-r calc(0.8s / var(--k)) linear infinite;
}

.uvq13-sty [data-s="rain"]::after {
  left: 14%;
  right: 14%;
  top: 12%;
  bottom: 30%;
  border: .35em solid rgba(255,255,255,.75);
  border-radius: .3em;
  background: linear-gradient(90deg,transparent calc(50% - .17em),rgba(255,255,255,.75) 0 calc(50% + .17em),transparent 0);
}

.uvq13-sty .sc p {
  position: absolute;
  left: .8em;
  right: .8em;
  bottom: 1.2em;
  z-index: 1;
  margin: 0;
  font-size: 1.1em;
  font-weight: 850;
  line-height: 1.05;
  letter-spacing: -.02em;
  color: #fff;
  text-shadow: 0 .1em .6em rgba(0,0,0,.4);
}

.uvq13-sty .bars {
  position: absolute;
  left: .55em;
  right: .55em;
  top: .55em;
  z-index: 3;
  display: flex;
  gap: .25em;
  transition: opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq13-sty .bars i {
  flex: 1;
  height: .17em;
  border-radius: 1em;
  background: rgba(255,255,255,.35);
  overflow: hidden;
}

.uvq13-sty .bars b {
  display: block;
  height: 100%;
  background: #fff;
  transform-origin: 0 50%;
  transform: scaleX(0);
}

.uvq13-sty .bars .done b {
  transform: none;
}

.uvq13-sty .bars .run b {
  animation: uvq13-sty-p calc(4.5s / var(--k)) linear forwards;
}

.uvq13-sty.pa .bars .run b,.uvq13-sty.hold .bars .run b {
  animation-play-state: paused;
}

.uvq13-sty .hd {
  position: absolute;
  left: .55em;
  right: .3em;
  top: 1em;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: .4em;
  font-size: .74em;
  color: #fff;
  transition: opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq13-sty.hold .hd,.uvq13-sty.hold .bars {
  opacity: 0;
}

.uvq13-sty .ua {
  display: grid;
  place-items: center;
  width: 1.9em;
  height: 1.9em;
  border-radius: 50%;
  font-weight: 800;
  font-size: .85em;
  background: var(--a,#888);
  box-shadow: 0 0 0 .12em #fff;
}

.uvq13-sty .hd small {
  margin-right: auto;
  opacity: .7;
}

.uvq13-sty .hd button {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: grid;
  place-items: center;
  width: 2em;
  height: 2em;
  border-radius: 50%;
  color: #fff;
}

.uvq13-sty .hd svg {
  width: 1.15em;
  height: 1.15em;
}

.uvq13-sty .pz .i1,.uvq13-sty.pa .pz .i2 {
  display: none;
}

.uvq13-sty.pa .pz .i1 {
  display: block;
}

.uvq13-sty .nv {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: absolute;
  top: 2.6em;
  bottom: 0;
  z-index: 2;
}

.uvq13-sty .pv {
  left: 0;
  width: 35%;
}

.uvq13-sty .nx {
  right: 0;
  width: 65%;
}

.uvq13-sty .nv:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -4px;
  border-radius: .8em;
}

.uvq13-sty .hd button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 1px;
}

@keyframes uvq13-sty-p {
  to {
    transform: none;
  }
}

@keyframes uvq13-sty-k {
  from {
    transform: scale(1.15);
  }
}

@keyframes uvq13-sty-r {
  to {
    transform: translateY(16%);
  }
}

@keyframes uvq13-sty-s {
  from {
    transform: perspective(40em) rotateY(-28deg) translateX(20%);
    opacity: .5;
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq13-sty,.uvq13-sty *,.uvq13-sty *::before,.uvq13-sty *::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 tray=[...el.querySelectorAll(".av")],vw=el.querySelector(".vw"),cd=el.querySelector(".cd"),scs=[...el.querySelectorAll(".sc")],bars=[...el.querySelectorAll(".bars i")],ua=el.querySelector(".hd .ua"),un=el.querySelector(".hd .un"),pz=el.querySelector(".pz"),nv=[...el.querySelectorAll(".nv")];let u=0,s=0,from=null,tms=[],ht=0,held=false,sy=null;const later=(f,ms)=>tms.push(setTimeout(f,ms));
const isO=()=>el.classList.contains("open");
const setP=p=>{el.classList.toggle("pa",p);pz.setAttribute("aria-pressed",String(p))};
const show=(nu,ns,sw)=>{if(nu>=tray.length){close();return}if(sw&&nu!==u){cd.classList.remove("sw");void cd.offsetWidth;cd.classList.add("sw")}u=Math.max(0,nu);s=ns;tray[u].classList.add("seen");const k=u*2+s;scs.forEach((x,i)=>x.classList.toggle("on",i===k));bars.forEach((b,i)=>b.className=i<s?"done":"");void cd.offsetWidth;bars[s].className="run";ua.style.setProperty("--a",tray[u].style.getPropertyValue("--a"));ua.textContent=tray[u].querySelector("b").textContent;un.textContent=tray[u].querySelector("small").textContent};
const next=()=>s<1?show(u,1):show(u+1,0,true);const prev=()=>s>0?show(u,0):u>0?show(u-1,1,true):show(0,0);
bars.forEach(b=>b.addEventListener("animationend",()=>{if(b.classList.contains("run")&&isO())next()}));
const open=(i,src,f)=>{from=src;const r=src.querySelector(".rg");cd.style.transformOrigin=(r.offsetLeft+r.offsetWidth/2-cd.offsetLeft)+"px "+(r.offsetTop+r.offsetHeight/2-cd.offsetTop)+"px";el.classList.add("open");vw.inert=false;setP(false);show(i,0);f&&later(()=>el.querySelector(".nx").focus({preventScroll:true}),320)};
const close=()=>{if(!isO())return;el.classList.remove("open","hold");vw.inert=true;bars.forEach(b=>b.className="");(from||tray[0]).focus({preventScroll:true})};
pz.addEventListener("click",()=>setP(!el.classList.contains("pa")));el.querySelector(".hd .x").addEventListener("click",close);
tray.forEach((a,i)=>a.addEventListener("click",()=>open(i,a,true)));
nv.forEach(b=>{b.addEventListener("pointerdown",e=>{held=false;sy=e.clientY;clearTimeout(ht);ht=setTimeout(()=>{held=true;el.classList.add("hold")},220)});b.addEventListener("click",()=>{if(held){held=false;return}b.classList.contains("nx")?next():prev()})});
const rel=()=>{clearTimeout(ht);el.classList.remove("hold");sy=null};el.addEventListener("pointerup",rel);el.addEventListener("pointercancel",rel);
el.addEventListener("pointermove",e=>{if(sy!==null&&e.clientY-sy>60){rel();held=true;close()}});
el.addEventListener("keydown",e=>{if(!isO())return;if(e.key==="Escape"){e.preventDefault();close()}else if(e.key==="ArrowRight"){e.preventDefault();next()}else if(e.key==="ArrowLeft"){e.preventDefault();prev()}else if(e.key==="Tab"){const f=[...cd.querySelectorAll("button")],a=f[0],z=f[f.length-1],ac=document.activeElement;if(e.shiftKey&&(ac===a||!cd.contains(ac))){e.preventDefault();z.focus()}else if(!e.shiftKey&&(ac===z||!cd.contains(ac))){e.preventDefault();a.focus()}}});
vw.inert=true;later(()=>open(0,tray[0],false),600);return()=>{tms.forEach(clearTimeout);clearTimeout(ht)}
}

export default function OvStoryViewer() {
  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": "#ec4899",
          "--c2": "#f59e0b",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq13-sty"><div className="tray"><button type="button" className="av" style={{ "--a": "#f97316" } as CSSProperties} aria-haspopup="dialog"><span className="rg"><b aria-hidden="true">L</b></span><small>Lucía</small></button><button type="button" className="av" style={{ "--a": "#0ea5e9" } as CSSProperties} aria-haspopup="dialog"><span className="rg"><b aria-hidden="true">M</b></span><small>Marco</small></button><button type="button" className="av" style={{ "--a": "#a855f7" } as CSSProperties} aria-haspopup="dialog"><span className="rg"><b aria-hidden="true">I</b></span><small>Inés</small></button><button type="button" className="av" style={{ "--a": "#22c55e" } as CSSProperties} aria-haspopup="dialog"><span className="rg"><b aria-hidden="true">T</b></span><small>Teo</small></button></div><div className="fd" aria-hidden="true"><i className="ph"></i><i></i><i className="s"></i></div><div className="vw" role="dialog" aria-modal="true" aria-label="Stories"><div className="cd"><div className="sc" data-s="sun" style={{ "--g1": "#fb923c", "--g2": "#6d28d9" } as CSSProperties}><p>Sunrise at the harbour</p></div><div className="sc" data-s="cup" style={{ "--g1": "#7c2d12", "--g2": "#f59e0b" } as CSSProperties}><p>Eight o'clock coffee</p></div><div className="sc" data-s="hill" style={{ "--g1": "#0ea5e9", "--g2": "#16a34a" } as CSSProperties}><p>Bike ride along the coast</p></div><div className="sc" data-s="dots" style={{ "--g1": "#db2777", "--g2": "#facc15" } as CSSProperties}><p>New mural in the neighbourhood</p></div><div className="sc" data-s="sun" style={{ "--g1": "#92400e", "--g2": "#fde68a" } as CSSProperties}><p>Freshly baked bread</p></div><div className="sc" data-s="wave" style={{ "--g1": "#0e7490", "--g2": "#67e8f9" } as CSSProperties}><p>Last swim of the year</p></div><div className="sc" data-s="rain" style={{ "--g1": "#1e293b", "--g2": "#64748b" } as CSSProperties}><p>Rain on the window</p></div><div className="sc" data-s="dots" style={{ "--g1": "#4c1d95", "--g2": "#f472b6" } as CSSProperties}><p>Concert in the park</p></div><div className="bars" aria-hidden="true"><i><b></b></i><i><b></b></i></div><div className="hd"><span className="ua" aria-hidden="true"></span><b className="un"></b><small>2 h</small><button type="button" className="pz" aria-label="Pause" aria-pressed="false"><svg className="i1" viewBox="0 0 24 24" aria-hidden="true"><path d="M8 5.5v13l10.5-6.5z" fill="currentColor" /></svg><svg className="i2" viewBox="0 0 24 24" aria-hidden="true"><path d="M8 5v14M16 5v14" stroke="currentColor" strokeWidth="3" strokeLinecap="round" /></svg></button><button type="button" className="x" aria-label="Close"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M7 7l10 10M17 7L7 17" /></svg></button></div><button type="button" className="nv pv" aria-label="Previous story"></button><button type="button" className="nv nx" aria-label="Next story"></button></div></div></div>
      </div>
    </>
  );
}
```

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