# RSVP with flying avatar

> Join and your avatar flies from the button to the front of the row while the others slide aside and the count rises.

- Category: [Microinteractions](https://library.aimran.es/components/microinteractions)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-mi27-rsvp-stack
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

Event pages show who is going with a stack of overlapping avatars, and this block makes joining that group visible. Press Count me in and a You avatar arcs out of the button into the first spot, the rest shift right with a spring, and the attendee number rolls up. Leaving reverses it: your avatar pops out and the gap closes.

The main color is the button and your own avatar, the secondary one the date tile. Avatars are plain list items with initials and a background color, so they are easy to swap for photos. It fits workshops, meetups, classes and private dinners.

## Code

### HTML

```html
<div class="uvq15-rsv"><div class="top"><div class="dt" aria-hidden="true"><small>SAT</small><b>14</b><small>NOV</small></div><div><b class="tl">Pottery workshop</b><small class="pl">Barro Studio, Valencia</small></div></div><div class="ft"><ul class="st" aria-hidden="true"><li style="--c:#f59e0b">AL</li><li style="--c:#10b981">JM</li><li style="--c:#6366f1">RC</li><li style="--c:#ec4899">SP</li><li class="mr">+12</li></ul><p class="ct"><b class="n">16</b><span>attendees</span></p></div><button type="button" class="bt" aria-pressed="false"><span class="a">Count me in</span><span class="b"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg>Going</span></button><p class="sr" aria-live="polite"></p></div>
```

### CSS

```css
.uvq15-rsv {
  --c1: #c2410c;
  --c2: #fde68a;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq15-rsv {
  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;
  border-radius: 1.3em;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 10%,transparent),0 1.4em 2.6em -1.8em rgba(0,0,0,.35);
  display: grid;
  gap: 1em;
  width: 18em;
  padding: 1.1em;
}

.uvq15-rsv .top {
  display: flex;
  align-items: center;
  gap: .8em;
}

.uvq15-rsv .dt {
  display: grid;
  justify-items: center;
  width: 3.4em;
  padding: .35em 0;
  border-radius: .7em;
  line-height: 1.05;
  color: #431407;
  background: var(--c2);
  box-shadow: inset 0 .35em 0 var(--c1);
}

.uvq15-rsv .dt small {
  font-size: .6em;
  font-weight: 800;
  letter-spacing: .1em;
}

.uvq15-rsv .dt small:first-child {
  margin-top: .5em;
}

.uvq15-rsv .dt b {
  font-size: 1.4em;
}

.uvq15-rsv .tl {
  display: block;
  font-size: 1em;
}

.uvq15-rsv .pl {
  font-size: .75em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq15-rsv .ft {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.uvq15-rsv .st {
  display: flex;
  margin: 0;
  padding: 0 0 0 .5em;
  list-style: none;
}

.uvq15-rsv .st li {
  display: grid;
  place-items: center;
  width: 2.3em;
  height: 2.3em;
  margin-left: -.4em;
  border-radius: 50%;
  font-size: .75em;
  font-weight: 800;
  color: #fff;
  background: var(--c);
  box-shadow: 0 0 0 .2em color-mix(in srgb,var(--fg) 3%,var(--bg));
}

.uvq15-rsv .st .mr {
  color: var(--fg);
  background: color-mix(in srgb,var(--fg) 6%,transparent);
  backdrop-filter: blur(4px);
}

.uvq15-rsv .st .me {
  position: relative;
  z-index: 1;
  background: var(--c1);
}

.uvq15-rsv .ct {
  display: flex;
  align-items: baseline;
  gap: .3em;
  margin: 0;
  font-size: .8em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq15-rsv .ct b {
  display: inline-block;
  font-size: 1.25em;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.uvq15-rsv .bt {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: grid;
  height: 2.9em;
  border-radius: .8em;
  font-weight: 800;
  color: #fff;
  background: var(--c1);
  overflow: hidden;
  transition: background calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),color calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),transform .15s cubic-bezier(.25,.1,.25,1);
}

.uvq15-rsv .bt:hover {
  filter: brightness(1.07);
}

.uvq15-rsv .bt:active {
  transform: scale(.97);
}

.uvq15-rsv .bt:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq15-rsv .bt>span {
  grid-area: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4em;
  transition: transform calc(0.4s / var(--k)) cubic-bezier(.22,1,.36,1),opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq15-rsv .bt svg {
  width: 1.1em;
  height: 1.1em;
}

.uvq15-rsv .b {
  transform: translateY(100%);
  opacity: 0;
}

.uvq15-rsv .bt[aria-pressed="true"] {
  color: var(--c1);
  background: color-mix(in srgb,var(--c1) 12%,transparent);
}

.uvq15-rsv .bt[aria-pressed="true"] .a {
  transform: translateY(-100%);
  opacity: 0;
}

.uvq15-rsv .bt[aria-pressed="true"] .b {
  transform: none;
  opacity: 1;
}

.uvq15-rsv .sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

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

### JavaScript

```js
document.querySelectorAll(".uvq15-rsv").forEach(el => {
  const k=parseFloat(getComputedStyle(el).getPropertyValue("--k"))||1,rm=matchMedia("(prefers-reduced-motion:reduce)").matches;const bt=el.querySelector(".bt"),st=el.querySelector(".st"),n=el.querySelector(".n"),sr=el.querySelector(".sr");let on=false,c=16;
const ez="cubic-bezier(.22,1,.36,1)",flip=fn=>{const a=[...st.children],r=new Map(a.map(x=>[x,x.getBoundingClientRect().left]));fn();if(rm)return;const sc=el.getBoundingClientRect().width/el.offsetWidth||1;a.forEach(x=>{if(!x.isConnected)return;const d=(r.get(x)-x.getBoundingClientRect().left)/sc;if(d)x.animate([{transform:"translateX("+d+"px)"},{transform:"none"}],{duration:450/k,easing:ez})})};
const count=()=>{n.textContent=String(c);if(!rm)n.animate([{transform:"translateY("+(on?"-.5em":".5em")+") scale(1.2)",opacity:0},{transform:"none",opacity:1}],{duration:400/k,easing:ez})};
bt.addEventListener("click",()=>{on=!on;bt.setAttribute("aria-pressed",String(on));c+=on?1:-1;
if(on){const me=document.createElement("li");me.className="me";me.textContent="You";flip(()=>st.prepend(me));if(!rm){const sc=el.getBoundingClientRect().width/el.offsetWidth||1,a=bt.getBoundingClientRect(),b=me.getBoundingClientRect(),dx=(a.left+a.width/2-b.left-b.width/2)/sc,dy=(a.top+a.height/2-b.top-b.height/2)/sc;
me.animate([{transform:"translate("+dx+"px,"+dy+"px) scale(.5)",opacity:0},{transform:"translate("+dx*.4+"px,"+(dy*.4-30)+"px) scale(1.15)",opacity:1,offset:.55},{transform:"none",opacity:1}],{duration:650/k,easing:ez})}sr.textContent="You’re going"}
else{const me=st.querySelector(".me");if(me){me.className="bye";const rmv=()=>flip(()=>me.remove());if(rm)rmv();else me.animate([{transform:"none",opacity:1},{transform:"translateY(-1em) scale(.3)",opacity:0}],{duration:280/k,easing:"ease-in",fill:"forwards"}).onfinish=rmv}sr.textContent="You’re no longer going"}count()})
});
```

### 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 = `
.uvq15-rsv {
  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;
  border-radius: 1.3em;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 10%,transparent),0 1.4em 2.6em -1.8em rgba(0,0,0,.35);
  display: grid;
  gap: 1em;
  width: 18em;
  padding: 1.1em;
}

.uvq15-rsv .top {
  display: flex;
  align-items: center;
  gap: .8em;
}

.uvq15-rsv .dt {
  display: grid;
  justify-items: center;
  width: 3.4em;
  padding: .35em 0;
  border-radius: .7em;
  line-height: 1.05;
  color: #431407;
  background: var(--c2);
  box-shadow: inset 0 .35em 0 var(--c1);
}

.uvq15-rsv .dt small {
  font-size: .6em;
  font-weight: 800;
  letter-spacing: .1em;
}

.uvq15-rsv .dt small:first-child {
  margin-top: .5em;
}

.uvq15-rsv .dt b {
  font-size: 1.4em;
}

.uvq15-rsv .tl {
  display: block;
  font-size: 1em;
}

.uvq15-rsv .pl {
  font-size: .75em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq15-rsv .ft {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.uvq15-rsv .st {
  display: flex;
  margin: 0;
  padding: 0 0 0 .5em;
  list-style: none;
}

.uvq15-rsv .st li {
  display: grid;
  place-items: center;
  width: 2.3em;
  height: 2.3em;
  margin-left: -.4em;
  border-radius: 50%;
  font-size: .75em;
  font-weight: 800;
  color: #fff;
  background: var(--c);
  box-shadow: 0 0 0 .2em color-mix(in srgb,var(--fg) 3%,var(--bg));
}

.uvq15-rsv .st .mr {
  color: var(--fg);
  background: color-mix(in srgb,var(--fg) 6%,transparent);
  backdrop-filter: blur(4px);
}

.uvq15-rsv .st .me {
  position: relative;
  z-index: 1;
  background: var(--c1);
}

.uvq15-rsv .ct {
  display: flex;
  align-items: baseline;
  gap: .3em;
  margin: 0;
  font-size: .8em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq15-rsv .ct b {
  display: inline-block;
  font-size: 1.25em;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.uvq15-rsv .bt {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: grid;
  height: 2.9em;
  border-radius: .8em;
  font-weight: 800;
  color: #fff;
  background: var(--c1);
  overflow: hidden;
  transition: background calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),color calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),transform .15s cubic-bezier(.25,.1,.25,1);
}

.uvq15-rsv .bt:hover {
  filter: brightness(1.07);
}

.uvq15-rsv .bt:active {
  transform: scale(.97);
}

.uvq15-rsv .bt:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq15-rsv .bt>span {
  grid-area: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4em;
  transition: transform calc(0.4s / var(--k)) cubic-bezier(.22,1,.36,1),opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq15-rsv .bt svg {
  width: 1.1em;
  height: 1.1em;
}

.uvq15-rsv .b {
  transform: translateY(100%);
  opacity: 0;
}

.uvq15-rsv .bt[aria-pressed="true"] {
  color: var(--c1);
  background: color-mix(in srgb,var(--c1) 12%,transparent);
}

.uvq15-rsv .bt[aria-pressed="true"] .a {
  transform: translateY(-100%);
  opacity: 0;
}

.uvq15-rsv .bt[aria-pressed="true"] .b {
  transform: none;
  opacity: 1;
}

.uvq15-rsv .sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (prefers-reduced-motion:reduce) {
  .uvq15-rsv,.uvq15-rsv *,.uvq15-rsv *::before,.uvq15-rsv *::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 k=parseFloat(getComputedStyle(el).getPropertyValue("--k"))||1,rm=matchMedia("(prefers-reduced-motion:reduce)").matches;const bt=el.querySelector(".bt"),st=el.querySelector(".st"),n=el.querySelector(".n"),sr=el.querySelector(".sr");let on=false,c=16;
const ez="cubic-bezier(.22,1,.36,1)",flip=fn=>{const a=[...st.children],r=new Map(a.map(x=>[x,x.getBoundingClientRect().left]));fn();if(rm)return;const sc=el.getBoundingClientRect().width/el.offsetWidth||1;a.forEach(x=>{if(!x.isConnected)return;const d=(r.get(x)-x.getBoundingClientRect().left)/sc;if(d)x.animate([{transform:"translateX("+d+"px)"},{transform:"none"}],{duration:450/k,easing:ez})})};
const count=()=>{n.textContent=String(c);if(!rm)n.animate([{transform:"translateY("+(on?"-.5em":".5em")+") scale(1.2)",opacity:0},{transform:"none",opacity:1}],{duration:400/k,easing:ez})};
bt.addEventListener("click",()=>{on=!on;bt.setAttribute("aria-pressed",String(on));c+=on?1:-1;
if(on){const me=document.createElement("li");me.className="me";me.textContent="You";flip(()=>st.prepend(me));if(!rm){const sc=el.getBoundingClientRect().width/el.offsetWidth||1,a=bt.getBoundingClientRect(),b=me.getBoundingClientRect(),dx=(a.left+a.width/2-b.left-b.width/2)/sc,dy=(a.top+a.height/2-b.top-b.height/2)/sc;
me.animate([{transform:"translate("+dx+"px,"+dy+"px) scale(.5)",opacity:0},{transform:"translate("+dx*.4+"px,"+(dy*.4-30)+"px) scale(1.15)",opacity:1,offset:.55},{transform:"none",opacity:1}],{duration:650/k,easing:ez})}sr.textContent="You’re going"}
else{const me=st.querySelector(".me");if(me){me.className="bye";const rmv=()=>flip(()=>me.remove());if(rm)rmv();else me.animate([{transform:"none",opacity:1},{transform:"translateY(-1em) scale(.3)",opacity:0}],{duration:280/k,easing:"ease-in",fill:"forwards"}).onfinish=rmv}sr.textContent="You’re no longer going"}count()})
}

export default function Mi27RsvpStack() {
  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": "#c2410c",
          "--c2": "#fde68a",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq15-rsv"><div className="top"><div className="dt" aria-hidden="true"><small>SAT</small><b>14</b><small>NOV</small></div><div><b className="tl">Pottery workshop</b><small className="pl">Barro Studio, Valencia</small></div></div><div className="ft"><ul className="st" aria-hidden="true"><li style={{ "--c": "#f59e0b" } as CSSProperties}>AL</li><li style={{ "--c": "#10b981" } as CSSProperties}>JM</li><li style={{ "--c": "#6366f1" } as CSSProperties}>RC</li><li style={{ "--c": "#ec4899" } as CSSProperties}>SP</li><li className="mr">+12</li></ul><p className="ct"><b className="n">16</b><span>attendees</span></p></div><button type="button" className="bt" aria-pressed="false"><span className="a">Count me in</span><span className="b"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.6" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5" /></svg>Going</span></button><p className="sr" aria-live="polite"></p></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 “RSVP with flying avatar” block (Microinteractions) from AIMRAN Library to my project.

## What it is
Join and your avatar flies from the button to the front of the row while the others slide aside and the count rises.

## Chosen settings
- Main color: #c2410c
- Secondary color: #fde68a
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Me apunto"

## 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 = `
.uvq15-rsv {
  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;
  border-radius: 1.3em;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 10%,transparent),0 1.4em 2.6em -1.8em rgba(0,0,0,.35);
  display: grid;
  gap: 1em;
  width: 18em;
  padding: 1.1em;
}

.uvq15-rsv .top {
  display: flex;
  align-items: center;
  gap: .8em;
}

.uvq15-rsv .dt {
  display: grid;
  justify-items: center;
  width: 3.4em;
  padding: .35em 0;
  border-radius: .7em;
  line-height: 1.05;
  color: #431407;
  background: var(--c2);
  box-shadow: inset 0 .35em 0 var(--c1);
}

.uvq15-rsv .dt small {
  font-size: .6em;
  font-weight: 800;
  letter-spacing: .1em;
}

.uvq15-rsv .dt small:first-child {
  margin-top: .5em;
}

.uvq15-rsv .dt b {
  font-size: 1.4em;
}

.uvq15-rsv .tl {
  display: block;
  font-size: 1em;
}

.uvq15-rsv .pl {
  font-size: .75em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq15-rsv .ft {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.uvq15-rsv .st {
  display: flex;
  margin: 0;
  padding: 0 0 0 .5em;
  list-style: none;
}

.uvq15-rsv .st li {
  display: grid;
  place-items: center;
  width: 2.3em;
  height: 2.3em;
  margin-left: -.4em;
  border-radius: 50%;
  font-size: .75em;
  font-weight: 800;
  color: #fff;
  background: var(--c);
  box-shadow: 0 0 0 .2em color-mix(in srgb,var(--fg) 3%,var(--bg));
}

.uvq15-rsv .st .mr {
  color: var(--fg);
  background: color-mix(in srgb,var(--fg) 6%,transparent);
  backdrop-filter: blur(4px);
}

.uvq15-rsv .st .me {
  position: relative;
  z-index: 1;
  background: var(--c1);
}

.uvq15-rsv .ct {
  display: flex;
  align-items: baseline;
  gap: .3em;
  margin: 0;
  font-size: .8em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq15-rsv .ct b {
  display: inline-block;
  font-size: 1.25em;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.uvq15-rsv .bt {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: grid;
  height: 2.9em;
  border-radius: .8em;
  font-weight: 800;
  color: #fff;
  background: var(--c1);
  overflow: hidden;
  transition: background calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),color calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),transform .15s cubic-bezier(.25,.1,.25,1);
}

.uvq15-rsv .bt:hover {
  filter: brightness(1.07);
}

.uvq15-rsv .bt:active {
  transform: scale(.97);
}

.uvq15-rsv .bt:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq15-rsv .bt>span {
  grid-area: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4em;
  transition: transform calc(0.4s / var(--k)) cubic-bezier(.22,1,.36,1),opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq15-rsv .bt svg {
  width: 1.1em;
  height: 1.1em;
}

.uvq15-rsv .b {
  transform: translateY(100%);
  opacity: 0;
}

.uvq15-rsv .bt[aria-pressed="true"] {
  color: var(--c1);
  background: color-mix(in srgb,var(--c1) 12%,transparent);
}

.uvq15-rsv .bt[aria-pressed="true"] .a {
  transform: translateY(-100%);
  opacity: 0;
}

.uvq15-rsv .bt[aria-pressed="true"] .b {
  transform: none;
  opacity: 1;
}

.uvq15-rsv .sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (prefers-reduced-motion:reduce) {
  .uvq15-rsv,.uvq15-rsv *,.uvq15-rsv *::before,.uvq15-rsv *::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 k=parseFloat(getComputedStyle(el).getPropertyValue("--k"))||1,rm=matchMedia("(prefers-reduced-motion:reduce)").matches;const bt=el.querySelector(".bt"),st=el.querySelector(".st"),n=el.querySelector(".n"),sr=el.querySelector(".sr");let on=false,c=16;
const ez="cubic-bezier(.22,1,.36,1)",flip=fn=>{const a=[...st.children],r=new Map(a.map(x=>[x,x.getBoundingClientRect().left]));fn();if(rm)return;const sc=el.getBoundingClientRect().width/el.offsetWidth||1;a.forEach(x=>{if(!x.isConnected)return;const d=(r.get(x)-x.getBoundingClientRect().left)/sc;if(d)x.animate([{transform:"translateX("+d+"px)"},{transform:"none"}],{duration:450/k,easing:ez})})};
const count=()=>{n.textContent=String(c);if(!rm)n.animate([{transform:"translateY("+(on?"-.5em":".5em")+") scale(1.2)",opacity:0},{transform:"none",opacity:1}],{duration:400/k,easing:ez})};
bt.addEventListener("click",()=>{on=!on;bt.setAttribute("aria-pressed",String(on));c+=on?1:-1;
if(on){const me=document.createElement("li");me.className="me";me.textContent="You";flip(()=>st.prepend(me));if(!rm){const sc=el.getBoundingClientRect().width/el.offsetWidth||1,a=bt.getBoundingClientRect(),b=me.getBoundingClientRect(),dx=(a.left+a.width/2-b.left-b.width/2)/sc,dy=(a.top+a.height/2-b.top-b.height/2)/sc;
me.animate([{transform:"translate("+dx+"px,"+dy+"px) scale(.5)",opacity:0},{transform:"translate("+dx*.4+"px,"+(dy*.4-30)+"px) scale(1.15)",opacity:1,offset:.55},{transform:"none",opacity:1}],{duration:650/k,easing:ez})}sr.textContent="You’re going"}
else{const me=st.querySelector(".me");if(me){me.className="bye";const rmv=()=>flip(()=>me.remove());if(rm)rmv();else me.animate([{transform:"none",opacity:1},{transform:"translateY(-1em) scale(.3)",opacity:0}],{duration:280/k,easing:"ease-in",fill:"forwards"}).onfinish=rmv}sr.textContent="You’re no longer going"}count()})
}

export default function Mi27RsvpStack() {
  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": "#c2410c",
          "--c2": "#fde68a",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq15-rsv"><div className="top"><div className="dt" aria-hidden="true"><small>SAT</small><b>14</b><small>NOV</small></div><div><b className="tl">Pottery workshop</b><small className="pl">Barro Studio, Valencia</small></div></div><div className="ft"><ul className="st" aria-hidden="true"><li style={{ "--c": "#f59e0b" } as CSSProperties}>AL</li><li style={{ "--c": "#10b981" } as CSSProperties}>JM</li><li style={{ "--c": "#6366f1" } as CSSProperties}>RC</li><li style={{ "--c": "#ec4899" } as CSSProperties}>SP</li><li className="mr">+12</li></ul><p className="ct"><b className="n">16</b><span>attendees</span></p></div><button type="button" className="bt" aria-pressed="false"><span className="a">Count me in</span><span className="b"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.6" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5" /></svg>Going</span></button><p className="sr" aria-live="polite"></p></div>
      </div>
    </>
  );
}
```

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