# Chat message that flies up

> The text leaves the input and turns into a bubble, then goes from sent to delivered and read before the other person replies.

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

## Where to use it

Sending a chat message feels better when you can see it travel. Here the text slides out of the input and settles as a bubble in the thread, the receipt changes from Sent to Delivered and Read with a second tick, and a typing indicator leads into a reply. It works with Enter or the round send button.

The main color paints your bubbles and the send button, the secondary one marks read receipts. The first message is the editable text, and the replies rotate through a short list in the script. Use it for support widgets, booking assistants or messaging mockups.

## Code

### HTML

```html
<div class="uvq15-cht"><header><span class="av" aria-hidden="true">L</span><div><b>Lola</b><small class="ty">online</small></div></header><ol class="ls" aria-live="polite"><li class="in"><span class="tx">So are we meeting on Saturday?</span></li><li class="in"><span class="tx">I can make it in the afternoon</span></li></ol><form class="cp"><input type="text" value="Great, at eight?" placeholder="Type a message" aria-label="Message" autocomplete="off" enterkeyhint="send"><button type="submit" class="sd" aria-label="Send"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 19V5M5 12l7-7 7 7"/></svg></button></form></div>
```

### CSS

```css
.uvq15-cht {
  --c1: #0d9488;
  --c2: #38bdf8;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq15-cht {
  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);
  width: 19em;
  overflow: hidden;
}

.uvq15-cht header {
  display: flex;
  align-items: center;
  gap: .6em;
  padding: .8em 1em;
  box-shadow: 0 1px 0 color-mix(in srgb,var(--fg) 10%,transparent);
}

.uvq15-cht .av {
  display: grid;
  place-items: center;
  width: 2.2em;
  height: 2.2em;
  border-radius: 50%;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg,#f472b6,#f59e0b);
}

.uvq15-cht header b {
  display: block;
  font-size: .9em;
}

.uvq15-cht .ty {
  display: block;
  font-size: .7em;
  color: var(--c1);
}

.uvq15-cht .ls {
  display: flex;
  flex-direction: column;
  gap: .35em;
  height: 11.5em;
  margin: 0;
  padding: .8em;
  overflow-y: auto;
  list-style: none;
  box-sizing: border-box;
  scrollbar-width: none;
}

.uvq15-cht li {
  max-width: 78%;
  display: grid;
}

.uvq15-cht .tx {
  display: block;
  padding: .5em .8em;
  border-radius: 1.1em;
  font-size: .85em;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.uvq15-cht li:first-child {
  margin-top: auto;
}

.uvq15-cht .in .tx {
  border-bottom-left-radius: .3em;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
}

.uvq15-cht .out {
  align-self: flex-end;
  justify-items: end;
}

.uvq15-cht .out .tx {
  border-bottom-right-radius: .3em;
  color: #fff;
  background: var(--c1);
}

.uvq15-cht .rc {
  display: flex;
  align-items: center;
  gap: .2em;
  margin-top: .2em;
  font-size: .65em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq15-cht .rc svg {
  width: 1.4em;
  height: 1.4em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.uvq15-cht .rc .t2 {
  opacity: 0;
  transition: opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq15-cht .rc.dl .t2 {
  opacity: 1;
}

.uvq15-cht .rc.rd {
  color: var(--c2);
}

.uvq15-cht .typ {
  display: flex;
  gap: .25em;
  padding: .65em .8em;
  border-radius: 1.1em;
  border-bottom-left-radius: .3em;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
}

.uvq15-cht .typ i {
  width: .4em;
  height: .4em;
  border-radius: 50%;
  background: color-mix(in srgb,var(--fg) 55%,transparent);
  animation: uvq15-cht-d calc(1s / var(--k)) ease-in-out infinite;
}

.uvq15-cht .typ i:nth-child(2) {
  animation-delay: calc(0.15s / var(--k));
}

.uvq15-cht .typ i:nth-child(3) {
  animation-delay: calc(0.3s / var(--k));
}

@keyframes uvq15-cht-d {
  30% {
    transform: translateY(-.3em);
    opacity: .5;
  }
}

.uvq15-cht .in:not(.typ):last-child {
  animation: uvq15-cht-i calc(0.4s / var(--k)) cubic-bezier(.22,1,.36,1);
}

@keyframes uvq15-cht-i {
  from {
    opacity: 0;
    transform: translateY(.5em) scale(.9);
  }
}

.uvq15-cht .cp {
  display: flex;
  gap: .5em;
  align-items: center;
  padding: .6em .7em .7em;
  box-shadow: 0 -1px 0 color-mix(in srgb,var(--fg) 10%,transparent);
}

.uvq15-cht input {
  flex: 1;
  min-width: 0;
  height: 2.5em;
  padding: 0 1em;
  border: 0;
  border-radius: 2em;
  font: inherit;
  font-size: .85em;
  color: inherit;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
  outline: 0;
}

.uvq15-cht input:focus-visible {
  box-shadow: 0 0 0 2px var(--c1);
}

.uvq15-cht input::placeholder {
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq15-cht .sd {
  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.3em;
  height: 2.3em;
  border-radius: 50%;
  color: #fff;
  background: var(--c1);
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1),opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq15-cht .sd svg {
  width: 1.15em;
  height: 1.15em;
}

.uvq15-cht .sd:disabled {
  opacity: .35;
  transform: scale(.85);
  cursor: default;
}

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

.uvq15-cht .sd.go svg {
  animation: uvq15-cht-g calc(0.45s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

@keyframes uvq15-cht-g {
  45% {
    transform: translateY(-1.4em);
    opacity: 0;
  }
  46% {
    transform: translateY(1.2em);
    opacity: 0;
  }
}

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

### JavaScript

```js
document.querySelectorAll(".uvq15-cht").forEach(el => {
  const k=parseFloat(getComputedStyle(el).getPropertyValue("--k"))||1,rm=matchMedia("(prefers-reduced-motion:reduce)").matches;const ls=el.querySelector(".ls"),f=el.querySelector("form"),inp=f.querySelector("input"),sd=f.querySelector(".sd"),ty=el.querySelector(".ty");const RE=["Perfect, I’ll be there","OK, I’ll book a table","Great, see you later"];let ri=0,tms=[];
const clr=()=>{tms.forEach(t=>clearTimeout(t));tms=[]},later=(fn,ms)=>{tms.push(setTimeout(fn,ms/k))};
const upd=()=>{sd.disabled=!inp.value.trim()};inp.addEventListener("input",upd);upd();
const fit=()=>{while(ls.children.length>6)ls.firstElementChild.remove();ls.scrollTop=ls.scrollHeight};
const bubble=(c,t)=>{const li=document.createElement("li"),s=document.createElement("span");li.className=c;s.className="tx";s.textContent=t;li.appendChild(s);ls.appendChild(li);fit();return li};
const drop=()=>{ls.querySelectorAll(".typ").forEach(x=>x.remove());ty.textContent="online"};
f.addEventListener("submit",e=>{e.preventDefault();const v=inp.value.trim();if(!v)return;clr();drop();ls.querySelectorAll(".rc").forEach(x=>x.remove());
const li=bubble("out",v),tx=li.firstChild,rc=document.createElement("small");rc.className="rc";rc.innerHTML='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M2 13l4 4 9-10"/><path class="t2" d="M9 15l2 2 9-10"/></svg><span>Sent</span>';li.appendChild(rc);fit();
if(!rm){const sc=el.getBoundingClientRect().width/el.offsetWidth||1,a=inp.getBoundingClientRect(),b=tx.getBoundingClientRect();tx.animate([{transform:"translate("+((a.left-b.left)/sc)+"px,"+((a.top+a.height/2-b.top-b.height/2)/sc)+"px) scale(.92)",opacity:.5,borderBottomRightRadius:"1.1em"},{transform:"none",opacity:1}],{duration:520/k,easing:"cubic-bezier(.22,1,.36,1)"})}
inp.value="";upd();sd.classList.remove("go");void sd.offsetWidth;sd.classList.add("go");const st=rc.lastChild;
later(()=>{rc.classList.add("dl");st.textContent="Delivered"},700);later(()=>{rc.classList.add("rd");st.textContent="Read"},1500);
later(()=>{ty.textContent="typing…";const t=document.createElement("li");t.className="in typ";t.setAttribute("aria-hidden","true");t.innerHTML="<i></i><i></i><i></i>";ls.appendChild(t);fit()},2000);
later(()=>{drop();bubble("in",RE[ri++%RE.length])},3400)});return clr
});
```

### 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-cht {
  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);
  width: 19em;
  overflow: hidden;
}

.uvq15-cht header {
  display: flex;
  align-items: center;
  gap: .6em;
  padding: .8em 1em;
  box-shadow: 0 1px 0 color-mix(in srgb,var(--fg) 10%,transparent);
}

.uvq15-cht .av {
  display: grid;
  place-items: center;
  width: 2.2em;
  height: 2.2em;
  border-radius: 50%;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg,#f472b6,#f59e0b);
}

.uvq15-cht header b {
  display: block;
  font-size: .9em;
}

.uvq15-cht .ty {
  display: block;
  font-size: .7em;
  color: var(--c1);
}

.uvq15-cht .ls {
  display: flex;
  flex-direction: column;
  gap: .35em;
  height: 11.5em;
  margin: 0;
  padding: .8em;
  overflow-y: auto;
  list-style: none;
  box-sizing: border-box;
  scrollbar-width: none;
}

.uvq15-cht li {
  max-width: 78%;
  display: grid;
}

.uvq15-cht .tx {
  display: block;
  padding: .5em .8em;
  border-radius: 1.1em;
  font-size: .85em;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.uvq15-cht li:first-child {
  margin-top: auto;
}

.uvq15-cht .in .tx {
  border-bottom-left-radius: .3em;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
}

.uvq15-cht .out {
  align-self: flex-end;
  justify-items: end;
}

.uvq15-cht .out .tx {
  border-bottom-right-radius: .3em;
  color: #fff;
  background: var(--c1);
}

.uvq15-cht .rc {
  display: flex;
  align-items: center;
  gap: .2em;
  margin-top: .2em;
  font-size: .65em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq15-cht .rc svg {
  width: 1.4em;
  height: 1.4em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.uvq15-cht .rc .t2 {
  opacity: 0;
  transition: opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq15-cht .rc.dl .t2 {
  opacity: 1;
}

.uvq15-cht .rc.rd {
  color: var(--c2);
}

.uvq15-cht .typ {
  display: flex;
  gap: .25em;
  padding: .65em .8em;
  border-radius: 1.1em;
  border-bottom-left-radius: .3em;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
}

.uvq15-cht .typ i {
  width: .4em;
  height: .4em;
  border-radius: 50%;
  background: color-mix(in srgb,var(--fg) 55%,transparent);
  animation: uvq15-cht-d calc(1s / var(--k)) ease-in-out infinite;
}

.uvq15-cht .typ i:nth-child(2) {
  animation-delay: calc(0.15s / var(--k));
}

.uvq15-cht .typ i:nth-child(3) {
  animation-delay: calc(0.3s / var(--k));
}

@keyframes uvq15-cht-d {
  30% {
    transform: translateY(-.3em);
    opacity: .5;
  }
}

.uvq15-cht .in:not(.typ):last-child {
  animation: uvq15-cht-i calc(0.4s / var(--k)) cubic-bezier(.22,1,.36,1);
}

@keyframes uvq15-cht-i {
  from {
    opacity: 0;
    transform: translateY(.5em) scale(.9);
  }
}

.uvq15-cht .cp {
  display: flex;
  gap: .5em;
  align-items: center;
  padding: .6em .7em .7em;
  box-shadow: 0 -1px 0 color-mix(in srgb,var(--fg) 10%,transparent);
}

.uvq15-cht input {
  flex: 1;
  min-width: 0;
  height: 2.5em;
  padding: 0 1em;
  border: 0;
  border-radius: 2em;
  font: inherit;
  font-size: .85em;
  color: inherit;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
  outline: 0;
}

.uvq15-cht input:focus-visible {
  box-shadow: 0 0 0 2px var(--c1);
}

.uvq15-cht input::placeholder {
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq15-cht .sd {
  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.3em;
  height: 2.3em;
  border-radius: 50%;
  color: #fff;
  background: var(--c1);
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1),opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq15-cht .sd svg {
  width: 1.15em;
  height: 1.15em;
}

.uvq15-cht .sd:disabled {
  opacity: .35;
  transform: scale(.85);
  cursor: default;
}

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

.uvq15-cht .sd.go svg {
  animation: uvq15-cht-g calc(0.45s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

@keyframes uvq15-cht-g {
  45% {
    transform: translateY(-1.4em);
    opacity: 0;
  }
  46% {
    transform: translateY(1.2em);
    opacity: 0;
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq15-cht,.uvq15-cht *,.uvq15-cht *::before,.uvq15-cht *::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 ls=el.querySelector(".ls"),f=el.querySelector("form"),inp=f.querySelector("input"),sd=f.querySelector(".sd"),ty=el.querySelector(".ty");const RE=["Perfect, I’ll be there","OK, I’ll book a table","Great, see you later"];let ri=0,tms=[];
const clr=()=>{tms.forEach(t=>clearTimeout(t));tms=[]},later=(fn,ms)=>{tms.push(setTimeout(fn,ms/k))};
const upd=()=>{sd.disabled=!inp.value.trim()};inp.addEventListener("input",upd);upd();
const fit=()=>{while(ls.children.length>6)ls.firstElementChild.remove();ls.scrollTop=ls.scrollHeight};
const bubble=(c,t)=>{const li=document.createElement("li"),s=document.createElement("span");li.className=c;s.className="tx";s.textContent=t;li.appendChild(s);ls.appendChild(li);fit();return li};
const drop=()=>{ls.querySelectorAll(".typ").forEach(x=>x.remove());ty.textContent="online"};
f.addEventListener("submit",e=>{e.preventDefault();const v=inp.value.trim();if(!v)return;clr();drop();ls.querySelectorAll(".rc").forEach(x=>x.remove());
const li=bubble("out",v),tx=li.firstChild,rc=document.createElement("small");rc.className="rc";rc.innerHTML='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M2 13l4 4 9-10"/><path class="t2" d="M9 15l2 2 9-10"/></svg><span>Sent</span>';li.appendChild(rc);fit();
if(!rm){const sc=el.getBoundingClientRect().width/el.offsetWidth||1,a=inp.getBoundingClientRect(),b=tx.getBoundingClientRect();tx.animate([{transform:"translate("+((a.left-b.left)/sc)+"px,"+((a.top+a.height/2-b.top-b.height/2)/sc)+"px) scale(.92)",opacity:.5,borderBottomRightRadius:"1.1em"},{transform:"none",opacity:1}],{duration:520/k,easing:"cubic-bezier(.22,1,.36,1)"})}
inp.value="";upd();sd.classList.remove("go");void sd.offsetWidth;sd.classList.add("go");const st=rc.lastChild;
later(()=>{rc.classList.add("dl");st.textContent="Delivered"},700);later(()=>{rc.classList.add("rd");st.textContent="Read"},1500);
later(()=>{ty.textContent="typing…";const t=document.createElement("li");t.className="in typ";t.setAttribute("aria-hidden","true");t.innerHTML="<i></i><i></i><i></i>";ls.appendChild(t);fit()},2000);
later(()=>{drop();bubble("in",RE[ri++%RE.length])},3400)});return clr
}

export default function Mi27ChatSend() {
  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": "#0d9488",
          "--c2": "#38bdf8",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq15-cht"><header><span className="av" aria-hidden="true">L</span><div><b>Lola</b><small className="ty">online</small></div></header><ol className="ls" aria-live="polite"><li className="in"><span className="tx">So are we meeting on Saturday?</span></li><li className="in"><span className="tx">I can make it in the afternoon</span></li></ol><form className="cp"><input type="text" value="Great, at eight?" placeholder="Type a message" aria-label="Message" autoComplete="off" enterKeyHint="send" /><button type="submit" className="sd" aria-label="Send"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M12 19V5M5 12l7-7 7 7" /></svg></button></form></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 “Chat message that flies up” block (Microinteractions) from AIMRAN Library to my project.

## What it is
The text leaves the input and turns into a bubble, then goes from sent to delivered and read before the other person replies.

## Chosen settings
- Main color: #0d9488
- Secondary color: #38bdf8
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Perfecto, ¿a las ocho?"

## 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-cht {
  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);
  width: 19em;
  overflow: hidden;
}

.uvq15-cht header {
  display: flex;
  align-items: center;
  gap: .6em;
  padding: .8em 1em;
  box-shadow: 0 1px 0 color-mix(in srgb,var(--fg) 10%,transparent);
}

.uvq15-cht .av {
  display: grid;
  place-items: center;
  width: 2.2em;
  height: 2.2em;
  border-radius: 50%;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg,#f472b6,#f59e0b);
}

.uvq15-cht header b {
  display: block;
  font-size: .9em;
}

.uvq15-cht .ty {
  display: block;
  font-size: .7em;
  color: var(--c1);
}

.uvq15-cht .ls {
  display: flex;
  flex-direction: column;
  gap: .35em;
  height: 11.5em;
  margin: 0;
  padding: .8em;
  overflow-y: auto;
  list-style: none;
  box-sizing: border-box;
  scrollbar-width: none;
}

.uvq15-cht li {
  max-width: 78%;
  display: grid;
}

.uvq15-cht .tx {
  display: block;
  padding: .5em .8em;
  border-radius: 1.1em;
  font-size: .85em;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.uvq15-cht li:first-child {
  margin-top: auto;
}

.uvq15-cht .in .tx {
  border-bottom-left-radius: .3em;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
}

.uvq15-cht .out {
  align-self: flex-end;
  justify-items: end;
}

.uvq15-cht .out .tx {
  border-bottom-right-radius: .3em;
  color: #fff;
  background: var(--c1);
}

.uvq15-cht .rc {
  display: flex;
  align-items: center;
  gap: .2em;
  margin-top: .2em;
  font-size: .65em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq15-cht .rc svg {
  width: 1.4em;
  height: 1.4em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.uvq15-cht .rc .t2 {
  opacity: 0;
  transition: opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq15-cht .rc.dl .t2 {
  opacity: 1;
}

.uvq15-cht .rc.rd {
  color: var(--c2);
}

.uvq15-cht .typ {
  display: flex;
  gap: .25em;
  padding: .65em .8em;
  border-radius: 1.1em;
  border-bottom-left-radius: .3em;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
}

.uvq15-cht .typ i {
  width: .4em;
  height: .4em;
  border-radius: 50%;
  background: color-mix(in srgb,var(--fg) 55%,transparent);
  animation: uvq15-cht-d calc(1s / var(--k)) ease-in-out infinite;
}

.uvq15-cht .typ i:nth-child(2) {
  animation-delay: calc(0.15s / var(--k));
}

.uvq15-cht .typ i:nth-child(3) {
  animation-delay: calc(0.3s / var(--k));
}

@keyframes uvq15-cht-d {
  30% {
    transform: translateY(-.3em);
    opacity: .5;
  }
}

.uvq15-cht .in:not(.typ):last-child {
  animation: uvq15-cht-i calc(0.4s / var(--k)) cubic-bezier(.22,1,.36,1);
}

@keyframes uvq15-cht-i {
  from {
    opacity: 0;
    transform: translateY(.5em) scale(.9);
  }
}

.uvq15-cht .cp {
  display: flex;
  gap: .5em;
  align-items: center;
  padding: .6em .7em .7em;
  box-shadow: 0 -1px 0 color-mix(in srgb,var(--fg) 10%,transparent);
}

.uvq15-cht input {
  flex: 1;
  min-width: 0;
  height: 2.5em;
  padding: 0 1em;
  border: 0;
  border-radius: 2em;
  font: inherit;
  font-size: .85em;
  color: inherit;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
  outline: 0;
}

.uvq15-cht input:focus-visible {
  box-shadow: 0 0 0 2px var(--c1);
}

.uvq15-cht input::placeholder {
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq15-cht .sd {
  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.3em;
  height: 2.3em;
  border-radius: 50%;
  color: #fff;
  background: var(--c1);
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1),opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq15-cht .sd svg {
  width: 1.15em;
  height: 1.15em;
}

.uvq15-cht .sd:disabled {
  opacity: .35;
  transform: scale(.85);
  cursor: default;
}

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

.uvq15-cht .sd.go svg {
  animation: uvq15-cht-g calc(0.45s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

@keyframes uvq15-cht-g {
  45% {
    transform: translateY(-1.4em);
    opacity: 0;
  }
  46% {
    transform: translateY(1.2em);
    opacity: 0;
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq15-cht,.uvq15-cht *,.uvq15-cht *::before,.uvq15-cht *::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 ls=el.querySelector(".ls"),f=el.querySelector("form"),inp=f.querySelector("input"),sd=f.querySelector(".sd"),ty=el.querySelector(".ty");const RE=["Perfect, I’ll be there","OK, I’ll book a table","Great, see you later"];let ri=0,tms=[];
const clr=()=>{tms.forEach(t=>clearTimeout(t));tms=[]},later=(fn,ms)=>{tms.push(setTimeout(fn,ms/k))};
const upd=()=>{sd.disabled=!inp.value.trim()};inp.addEventListener("input",upd);upd();
const fit=()=>{while(ls.children.length>6)ls.firstElementChild.remove();ls.scrollTop=ls.scrollHeight};
const bubble=(c,t)=>{const li=document.createElement("li"),s=document.createElement("span");li.className=c;s.className="tx";s.textContent=t;li.appendChild(s);ls.appendChild(li);fit();return li};
const drop=()=>{ls.querySelectorAll(".typ").forEach(x=>x.remove());ty.textContent="online"};
f.addEventListener("submit",e=>{e.preventDefault();const v=inp.value.trim();if(!v)return;clr();drop();ls.querySelectorAll(".rc").forEach(x=>x.remove());
const li=bubble("out",v),tx=li.firstChild,rc=document.createElement("small");rc.className="rc";rc.innerHTML='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M2 13l4 4 9-10"/><path class="t2" d="M9 15l2 2 9-10"/></svg><span>Sent</span>';li.appendChild(rc);fit();
if(!rm){const sc=el.getBoundingClientRect().width/el.offsetWidth||1,a=inp.getBoundingClientRect(),b=tx.getBoundingClientRect();tx.animate([{transform:"translate("+((a.left-b.left)/sc)+"px,"+((a.top+a.height/2-b.top-b.height/2)/sc)+"px) scale(.92)",opacity:.5,borderBottomRightRadius:"1.1em"},{transform:"none",opacity:1}],{duration:520/k,easing:"cubic-bezier(.22,1,.36,1)"})}
inp.value="";upd();sd.classList.remove("go");void sd.offsetWidth;sd.classList.add("go");const st=rc.lastChild;
later(()=>{rc.classList.add("dl");st.textContent="Delivered"},700);later(()=>{rc.classList.add("rd");st.textContent="Read"},1500);
later(()=>{ty.textContent="typing…";const t=document.createElement("li");t.className="in typ";t.setAttribute("aria-hidden","true");t.innerHTML="<i></i><i></i><i></i>";ls.appendChild(t);fit()},2000);
later(()=>{drop();bubble("in",RE[ri++%RE.length])},3400)});return clr
}

export default function Mi27ChatSend() {
  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": "#0d9488",
          "--c2": "#38bdf8",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq15-cht"><header><span className="av" aria-hidden="true">L</span><div><b>Lola</b><small className="ty">online</small></div></header><ol className="ls" aria-live="polite"><li className="in"><span className="tx">So are we meeting on Saturday?</span></li><li className="in"><span className="tx">I can make it in the afternoon</span></li></ol><form className="cp"><input type="text" value="Great, at eight?" placeholder="Type a message" aria-label="Message" autoComplete="off" enterKeyHint="send" /><button type="submit" className="sd" aria-label="Send"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M12 19V5M5 12l7-7 7 7" /></svg></button></form></div>
      </div>
    </>
  );
}
```

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