# Fortune cookie toast

> A fortune cookie rocks while it waits; tap it and it splits in two, crumbs fly and the paper slip slides out.

- Category: [Toasts](https://library.aimran.es/components/toasts)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-toast-fortune-cookie
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

Daily tips and small rewards land better with a little ritual. This toast shows a golden cookie drawn with layered radial gradients that rocks now and then; pressing it pulls the two halves apart, scatters crumbs and unrolls a paper slip with the message and lucky numbers. It suits learning apps, daily streaks, restaurant loyalty programs and playful onboarding.

The main color bakes the cookie and the second inks the message. The slip stays hidden from screen readers until it opens, then the status region reads it; write short sentences so the slip keeps to two lines.

## Code

### HTML

```html
<div class="uvq09-ftn"><button type="button" class="fire">Another cookie</button><div class="tt" role="status"><small class="lb">Your tip of the day</small><button type="button" class="ck" aria-label="Open the cookie" aria-expanded="false"><i class="h1" aria-hidden="true"><svg viewBox="0 0 52 40"><path class="lo" d="M52 6C34 0 10 6 3 26C1 33 8 38 16 34C28 28 40 29 52 37Z"/><path class="fo" d="M52 37C42 30 30 29 19 33C30 24 42 20 52 21Z"/><path class="hl" d="M13 15C21 8 33 6 44 8"/></svg></i><i class="h2" aria-hidden="true"><svg viewBox="0 0 52 40"><path class="lo" d="M52 6C34 0 10 6 3 26C1 33 8 38 16 34C28 28 40 29 52 37Z"/><path class="fo" d="M52 37C42 30 30 29 19 33C30 24 42 20 52 21Z"/><path class="hl" d="M13 15C21 8 33 6 44 8"/></svg></i><span class="cr" aria-hidden="true"><i style="--x:-4.5em;--y:-0.0em"></i><i style="--x:2.7em;--y:-0.2em"></i><i style="--x:2.7em;--y:2.3em"></i><i style="--x:-0.7em;--y:-0.3em"></i><i style="--x:-3.5em;--y:0.6em"></i><i style="--x:-0.4em;--y:1.4em"></i><i style="--x:-0.2em;--y:0.3em"></i><i style="--x:-0.2em;--y:1.7em"></i><i style="--x:-4.1em;--y:-0.4em"></i></span></button><p class="sl"><span>Today is a good day to launch that idea</span><small>Numbers: 7 · 14 · 23</small></p><small class="hn">Tap the cookie to open it</small></div></div>
```

### CSS

```css
.uvq09-ftn {
  --c1: #d97706;
  --c2: #b91c1c;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq09-ftn {
  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: 21em;
  height: 15em;
}

.uvq09-ftn .fire {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: absolute;
  left: 50%;
  top: 1.2em;
  translate: -50% 0;
  padding: .6em 1.1em;
  border-radius: 2em;
  font-size: .82em;
  font-weight: 650;
  white-space: nowrap;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
  background: color-mix(in srgb,var(--fg) 6%,transparent);
  transition: color calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),background calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),scale calc(0.15s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq09-ftn .fire:hover {
  color: var(--fg);
  background: color-mix(in srgb,var(--fg) 10%,transparent);
}

.uvq09-ftn .fire:active {
  scale: .96;
}

.uvq09-ftn .fire:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq09-ftn .tt {
  position: absolute;
  left: 50%;
  bottom: 1em;
  width: 19em;
  translate: -50% 0;
  border-radius: 1.1em;
  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.2em 2.4em -1em rgba(0,0,0,.45);
  height: 8.8em;
  padding: .85em 1em;
  text-align: center;
  transform: translateY(130%) scale(.92);
  opacity: 0;
  transition: transform calc(0.55s / var(--k)) cubic-bezier(.22,1,.36,1),opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq09-ftn .tt.in {
  transform: none;
  opacity: 1;
}

.uvq09-ftn .lb {
  display: block;
  font-size: .66em;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: color-mix(in srgb,var(--c1) 60%,var(--fg));
}

.uvq09-ftn .ck {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: absolute;
  left: 50%;
  top: 2.25em;
  width: 5.6em;
  height: 3.4em;
  translate: -50% 0;
  border-radius: 45%;
}

.uvq09-ftn .ck:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq09-ftn .tt.in:not(.op) .ck {
  animation: uvq09-ftn-w calc(2.6s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(1s / var(--k)) infinite;
}

.uvq09-ftn .h1,.uvq09-ftn .h2 {
  position: absolute;
  top: .5em;
  width: 2.85em;
  height: 2.2em;
  filter: drop-shadow(0 .3em .25em rgba(0,0,0,.22));
  transition: transform calc(0.7s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq09-ftn .h1 {
  left: 0;
  transform-origin: 100% 70%;
}

.uvq09-ftn .h2 {
  right: 0;
  transform-origin: 0 70%;
}

.uvq09-ftn .h2 svg {
  scale: -1 1;
}

.uvq09-ftn .ck svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.uvq09-ftn .lo {
  fill: color-mix(in srgb,var(--c1) 70%,#fbbf24);
}

.uvq09-ftn .fo {
  fill: color-mix(in srgb,var(--c1) 75%,#7c2d12);
}

.uvq09-ftn .hl {
  fill: none;
  stroke: #fff3c9;
  stroke-width: 3;
  stroke-linecap: round;
  opacity: .65;
}

.uvq09-ftn .ck:hover .h1 {
  transform: translateX(-.15em) rotate(-5deg);
}

.uvq09-ftn .ck:hover .h2 {
  transform: translateX(.15em) rotate(5deg);
}

.uvq09-ftn .tt.op .ck {
  pointer-events: none;
}

.uvq09-ftn .tt.op .h1 {
  transform: translate(-5.2em,.5em) rotate(-30deg);
}

.uvq09-ftn .tt.op .h2 {
  transform: translate(5.2em,.5em) rotate(30deg);
}

.uvq09-ftn .cr {
  position: absolute;
  left: 50%;
  top: 50%;
}

.uvq09-ftn .cr i {
  position: absolute;
  width: .26em;
  height: .26em;
  border-radius: 40%;
  background: color-mix(in srgb,var(--c1) 60%,#fbbf24);
  opacity: 0;
}

.uvq09-ftn .tt.op .cr i {
  animation: uvq09-ftn-c calc(0.8s / var(--k)) cubic-bezier(.25,.1,.25,1) forwards;
}

.uvq09-ftn .sl {
  position: absolute;
  left: 50%;
  top: 2.85em;
  z-index: 1;
  width: 13em;
  margin: 0;
  padding: .5em .7em;
  translate: -50% 0;
  color: var(--c2);
  background: #fffdf7;
  box-shadow: 0 .15em .4em rgba(0,0,0,.2);
  visibility: hidden;
  opacity: 0;
  transform: scaleX(.05);
  transition: transform calc(0.6s / var(--k)) cubic-bezier(.22,1,.36,1),opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),visibility 0s calc(0.6s / var(--k));
}

.uvq09-ftn .sl span {
  display: block;
  font: 600 .84em/1.3 Georgia,"Times New Roman",serif;
}

.uvq09-ftn .sl small {
  display: block;
  margin-top: .3em;
  font: 600 .62em/1 ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  color: #78716c;
}

.uvq09-ftn .tt.op .sl {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition: transform calc(0.6s / var(--k)) cubic-bezier(.22,1,.36,1) calc(0.15s / var(--k)),opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(0.15s / var(--k)),visibility 0s;
}

.uvq09-ftn .hn {
  position: absolute;
  left: 0;
  right: 0;
  bottom: .85em;
  font-size: .7em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
  transition: opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq09-ftn .tt.op .hn {
  opacity: 0;
}

@keyframes uvq09-ftn-w {
  0%,62%,100% {
    rotate: 0deg;
  }
  70% {
    rotate: -7deg;
  }
  78% {
    rotate: 6deg;
  }
  86% {
    rotate: -3deg;
  }
  93% {
    rotate: 1deg;
  }
}

@keyframes uvq09-ftn-c {
  0% {
    opacity: 1;
    transform: none;
  }
  100% {
    opacity: 0;
    transform: translate(var(--x),var(--y)) rotate(160deg);
  }
}

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

### JavaScript

```js
document.querySelectorAll(".uvq09-ftn").forEach(el => {
  const t=el.querySelector(".tt"),f=el.querySelector(".fire");let tm=[];const clr=()=>{tm.forEach(clearTimeout);tm=[]};const later=(fn,ms)=>tm.push(setTimeout(fn,ms));
const show=()=>{clr();t.classList.remove("in","out");void t.offsetWidth;later(()=>{t.classList.add("in");t.classList.remove('op');c.setAttribute('aria-expanded','false')},60)};
const hide=()=>{t.classList.remove("in");t.classList.add("out")};f.addEventListener("click",show);show();const c=t.querySelector(".ck");c.addEventListener("click",()=>{t.classList.add("op");c.setAttribute("aria-expanded","true")});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 = `
.uvq09-ftn {
  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: 21em;
  height: 15em;
}

.uvq09-ftn .fire {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: absolute;
  left: 50%;
  top: 1.2em;
  translate: -50% 0;
  padding: .6em 1.1em;
  border-radius: 2em;
  font-size: .82em;
  font-weight: 650;
  white-space: nowrap;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
  background: color-mix(in srgb,var(--fg) 6%,transparent);
  transition: color calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),background calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),scale calc(0.15s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq09-ftn .fire:hover {
  color: var(--fg);
  background: color-mix(in srgb,var(--fg) 10%,transparent);
}

.uvq09-ftn .fire:active {
  scale: .96;
}

.uvq09-ftn .fire:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq09-ftn .tt {
  position: absolute;
  left: 50%;
  bottom: 1em;
  width: 19em;
  translate: -50% 0;
  border-radius: 1.1em;
  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.2em 2.4em -1em rgba(0,0,0,.45);
  height: 8.8em;
  padding: .85em 1em;
  text-align: center;
  transform: translateY(130%) scale(.92);
  opacity: 0;
  transition: transform calc(0.55s / var(--k)) cubic-bezier(.22,1,.36,1),opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq09-ftn .tt.in {
  transform: none;
  opacity: 1;
}

.uvq09-ftn .lb {
  display: block;
  font-size: .66em;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: color-mix(in srgb,var(--c1) 60%,var(--fg));
}

.uvq09-ftn .ck {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: absolute;
  left: 50%;
  top: 2.25em;
  width: 5.6em;
  height: 3.4em;
  translate: -50% 0;
  border-radius: 45%;
}

.uvq09-ftn .ck:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq09-ftn .tt.in:not(.op) .ck {
  animation: uvq09-ftn-w calc(2.6s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(1s / var(--k)) infinite;
}

.uvq09-ftn .h1,.uvq09-ftn .h2 {
  position: absolute;
  top: .5em;
  width: 2.85em;
  height: 2.2em;
  filter: drop-shadow(0 .3em .25em rgba(0,0,0,.22));
  transition: transform calc(0.7s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq09-ftn .h1 {
  left: 0;
  transform-origin: 100% 70%;
}

.uvq09-ftn .h2 {
  right: 0;
  transform-origin: 0 70%;
}

.uvq09-ftn .h2 svg {
  scale: -1 1;
}

.uvq09-ftn .ck svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.uvq09-ftn .lo {
  fill: color-mix(in srgb,var(--c1) 70%,#fbbf24);
}

.uvq09-ftn .fo {
  fill: color-mix(in srgb,var(--c1) 75%,#7c2d12);
}

.uvq09-ftn .hl {
  fill: none;
  stroke: #fff3c9;
  stroke-width: 3;
  stroke-linecap: round;
  opacity: .65;
}

.uvq09-ftn .ck:hover .h1 {
  transform: translateX(-.15em) rotate(-5deg);
}

.uvq09-ftn .ck:hover .h2 {
  transform: translateX(.15em) rotate(5deg);
}

.uvq09-ftn .tt.op .ck {
  pointer-events: none;
}

.uvq09-ftn .tt.op .h1 {
  transform: translate(-5.2em,.5em) rotate(-30deg);
}

.uvq09-ftn .tt.op .h2 {
  transform: translate(5.2em,.5em) rotate(30deg);
}

.uvq09-ftn .cr {
  position: absolute;
  left: 50%;
  top: 50%;
}

.uvq09-ftn .cr i {
  position: absolute;
  width: .26em;
  height: .26em;
  border-radius: 40%;
  background: color-mix(in srgb,var(--c1) 60%,#fbbf24);
  opacity: 0;
}

.uvq09-ftn .tt.op .cr i {
  animation: uvq09-ftn-c calc(0.8s / var(--k)) cubic-bezier(.25,.1,.25,1) forwards;
}

.uvq09-ftn .sl {
  position: absolute;
  left: 50%;
  top: 2.85em;
  z-index: 1;
  width: 13em;
  margin: 0;
  padding: .5em .7em;
  translate: -50% 0;
  color: var(--c2);
  background: #fffdf7;
  box-shadow: 0 .15em .4em rgba(0,0,0,.2);
  visibility: hidden;
  opacity: 0;
  transform: scaleX(.05);
  transition: transform calc(0.6s / var(--k)) cubic-bezier(.22,1,.36,1),opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),visibility 0s calc(0.6s / var(--k));
}

.uvq09-ftn .sl span {
  display: block;
  font: 600 .84em/1.3 Georgia,"Times New Roman",serif;
}

.uvq09-ftn .sl small {
  display: block;
  margin-top: .3em;
  font: 600 .62em/1 ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  color: #78716c;
}

.uvq09-ftn .tt.op .sl {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition: transform calc(0.6s / var(--k)) cubic-bezier(.22,1,.36,1) calc(0.15s / var(--k)),opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(0.15s / var(--k)),visibility 0s;
}

.uvq09-ftn .hn {
  position: absolute;
  left: 0;
  right: 0;
  bottom: .85em;
  font-size: .7em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
  transition: opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq09-ftn .tt.op .hn {
  opacity: 0;
}

@keyframes uvq09-ftn-w {
  0%,62%,100% {
    rotate: 0deg;
  }
  70% {
    rotate: -7deg;
  }
  78% {
    rotate: 6deg;
  }
  86% {
    rotate: -3deg;
  }
  93% {
    rotate: 1deg;
  }
}

@keyframes uvq09-ftn-c {
  0% {
    opacity: 1;
    transform: none;
  }
  100% {
    opacity: 0;
    transform: translate(var(--x),var(--y)) rotate(160deg);
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq09-ftn,.uvq09-ftn *,.uvq09-ftn *::before,.uvq09-ftn *::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 t=el.querySelector(".tt"),f=el.querySelector(".fire");let tm=[];const clr=()=>{tm.forEach(clearTimeout);tm=[]};const later=(fn,ms)=>tm.push(setTimeout(fn,ms));
const show=()=>{clr();t.classList.remove("in","out");void t.offsetWidth;later(()=>{t.classList.add("in");t.classList.remove('op');c.setAttribute('aria-expanded','false')},60)};
const hide=()=>{t.classList.remove("in");t.classList.add("out")};f.addEventListener("click",show);show();const c=t.querySelector(".ck");c.addEventListener("click",()=>{t.classList.add("op");c.setAttribute("aria-expanded","true")});return clr
}

export default function ToastFortuneCookie() {
  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": "#d97706",
          "--c2": "#b91c1c",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq09-ftn"><button type="button" className="fire">Another cookie</button><div className="tt" role="status"><small className="lb">Your tip of the day</small><button type="button" className="ck" aria-label="Open the cookie" aria-expanded="false"><i className="h1" aria-hidden="true"><svg viewBox="0 0 52 40"><path className="lo" d="M52 6C34 0 10 6 3 26C1 33 8 38 16 34C28 28 40 29 52 37Z" /><path className="fo" d="M52 37C42 30 30 29 19 33C30 24 42 20 52 21Z" /><path className="hl" d="M13 15C21 8 33 6 44 8" /></svg></i><i className="h2" aria-hidden="true"><svg viewBox="0 0 52 40"><path className="lo" d="M52 6C34 0 10 6 3 26C1 33 8 38 16 34C28 28 40 29 52 37Z" /><path className="fo" d="M52 37C42 30 30 29 19 33C30 24 42 20 52 21Z" /><path className="hl" d="M13 15C21 8 33 6 44 8" /></svg></i><span className="cr" aria-hidden="true"><i style={{ "--x": "-4.5em", "--y": "-0.0em" } as CSSProperties}></i><i style={{ "--x": "2.7em", "--y": "-0.2em" } as CSSProperties}></i><i style={{ "--x": "2.7em", "--y": "2.3em" } as CSSProperties}></i><i style={{ "--x": "-0.7em", "--y": "-0.3em" } as CSSProperties}></i><i style={{ "--x": "-3.5em", "--y": "0.6em" } as CSSProperties}></i><i style={{ "--x": "-0.4em", "--y": "1.4em" } as CSSProperties}></i><i style={{ "--x": "-0.2em", "--y": "0.3em" } as CSSProperties}></i><i style={{ "--x": "-0.2em", "--y": "1.7em" } as CSSProperties}></i><i style={{ "--x": "-4.1em", "--y": "-0.4em" } as CSSProperties}></i></span></button><p className="sl"><span>Today is a good day to launch that idea</span><small>Numbers: 7 · 14 · 23</small></p><small className="hn">Tap the cookie to open it</small></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 “Fortune cookie toast” block (Toasts) from AIMRAN Library to my project.

## What it is
A fortune cookie rocks while it waits; tap it and it splits in two, crumbs fly and the paper slip slides out.

## Chosen settings
- Main color: #d97706
- Secondary color: #b91c1c
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Hoy es buen día para lanzar esa idea"

## 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 = `
.uvq09-ftn {
  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: 21em;
  height: 15em;
}

.uvq09-ftn .fire {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: absolute;
  left: 50%;
  top: 1.2em;
  translate: -50% 0;
  padding: .6em 1.1em;
  border-radius: 2em;
  font-size: .82em;
  font-weight: 650;
  white-space: nowrap;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
  background: color-mix(in srgb,var(--fg) 6%,transparent);
  transition: color calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),background calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),scale calc(0.15s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq09-ftn .fire:hover {
  color: var(--fg);
  background: color-mix(in srgb,var(--fg) 10%,transparent);
}

.uvq09-ftn .fire:active {
  scale: .96;
}

.uvq09-ftn .fire:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq09-ftn .tt {
  position: absolute;
  left: 50%;
  bottom: 1em;
  width: 19em;
  translate: -50% 0;
  border-radius: 1.1em;
  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.2em 2.4em -1em rgba(0,0,0,.45);
  height: 8.8em;
  padding: .85em 1em;
  text-align: center;
  transform: translateY(130%) scale(.92);
  opacity: 0;
  transition: transform calc(0.55s / var(--k)) cubic-bezier(.22,1,.36,1),opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq09-ftn .tt.in {
  transform: none;
  opacity: 1;
}

.uvq09-ftn .lb {
  display: block;
  font-size: .66em;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: color-mix(in srgb,var(--c1) 60%,var(--fg));
}

.uvq09-ftn .ck {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: absolute;
  left: 50%;
  top: 2.25em;
  width: 5.6em;
  height: 3.4em;
  translate: -50% 0;
  border-radius: 45%;
}

.uvq09-ftn .ck:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq09-ftn .tt.in:not(.op) .ck {
  animation: uvq09-ftn-w calc(2.6s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(1s / var(--k)) infinite;
}

.uvq09-ftn .h1,.uvq09-ftn .h2 {
  position: absolute;
  top: .5em;
  width: 2.85em;
  height: 2.2em;
  filter: drop-shadow(0 .3em .25em rgba(0,0,0,.22));
  transition: transform calc(0.7s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq09-ftn .h1 {
  left: 0;
  transform-origin: 100% 70%;
}

.uvq09-ftn .h2 {
  right: 0;
  transform-origin: 0 70%;
}

.uvq09-ftn .h2 svg {
  scale: -1 1;
}

.uvq09-ftn .ck svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.uvq09-ftn .lo {
  fill: color-mix(in srgb,var(--c1) 70%,#fbbf24);
}

.uvq09-ftn .fo {
  fill: color-mix(in srgb,var(--c1) 75%,#7c2d12);
}

.uvq09-ftn .hl {
  fill: none;
  stroke: #fff3c9;
  stroke-width: 3;
  stroke-linecap: round;
  opacity: .65;
}

.uvq09-ftn .ck:hover .h1 {
  transform: translateX(-.15em) rotate(-5deg);
}

.uvq09-ftn .ck:hover .h2 {
  transform: translateX(.15em) rotate(5deg);
}

.uvq09-ftn .tt.op .ck {
  pointer-events: none;
}

.uvq09-ftn .tt.op .h1 {
  transform: translate(-5.2em,.5em) rotate(-30deg);
}

.uvq09-ftn .tt.op .h2 {
  transform: translate(5.2em,.5em) rotate(30deg);
}

.uvq09-ftn .cr {
  position: absolute;
  left: 50%;
  top: 50%;
}

.uvq09-ftn .cr i {
  position: absolute;
  width: .26em;
  height: .26em;
  border-radius: 40%;
  background: color-mix(in srgb,var(--c1) 60%,#fbbf24);
  opacity: 0;
}

.uvq09-ftn .tt.op .cr i {
  animation: uvq09-ftn-c calc(0.8s / var(--k)) cubic-bezier(.25,.1,.25,1) forwards;
}

.uvq09-ftn .sl {
  position: absolute;
  left: 50%;
  top: 2.85em;
  z-index: 1;
  width: 13em;
  margin: 0;
  padding: .5em .7em;
  translate: -50% 0;
  color: var(--c2);
  background: #fffdf7;
  box-shadow: 0 .15em .4em rgba(0,0,0,.2);
  visibility: hidden;
  opacity: 0;
  transform: scaleX(.05);
  transition: transform calc(0.6s / var(--k)) cubic-bezier(.22,1,.36,1),opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),visibility 0s calc(0.6s / var(--k));
}

.uvq09-ftn .sl span {
  display: block;
  font: 600 .84em/1.3 Georgia,"Times New Roman",serif;
}

.uvq09-ftn .sl small {
  display: block;
  margin-top: .3em;
  font: 600 .62em/1 ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  color: #78716c;
}

.uvq09-ftn .tt.op .sl {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition: transform calc(0.6s / var(--k)) cubic-bezier(.22,1,.36,1) calc(0.15s / var(--k)),opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(0.15s / var(--k)),visibility 0s;
}

.uvq09-ftn .hn {
  position: absolute;
  left: 0;
  right: 0;
  bottom: .85em;
  font-size: .7em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
  transition: opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq09-ftn .tt.op .hn {
  opacity: 0;
}

@keyframes uvq09-ftn-w {
  0%,62%,100% {
    rotate: 0deg;
  }
  70% {
    rotate: -7deg;
  }
  78% {
    rotate: 6deg;
  }
  86% {
    rotate: -3deg;
  }
  93% {
    rotate: 1deg;
  }
}

@keyframes uvq09-ftn-c {
  0% {
    opacity: 1;
    transform: none;
  }
  100% {
    opacity: 0;
    transform: translate(var(--x),var(--y)) rotate(160deg);
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq09-ftn,.uvq09-ftn *,.uvq09-ftn *::before,.uvq09-ftn *::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 t=el.querySelector(".tt"),f=el.querySelector(".fire");let tm=[];const clr=()=>{tm.forEach(clearTimeout);tm=[]};const later=(fn,ms)=>tm.push(setTimeout(fn,ms));
const show=()=>{clr();t.classList.remove("in","out");void t.offsetWidth;later(()=>{t.classList.add("in");t.classList.remove('op');c.setAttribute('aria-expanded','false')},60)};
const hide=()=>{t.classList.remove("in");t.classList.add("out")};f.addEventListener("click",show);show();const c=t.querySelector(".ck");c.addEventListener("click",()=>{t.classList.add("op");c.setAttribute("aria-expanded","true")});return clr
}

export default function ToastFortuneCookie() {
  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": "#d97706",
          "--c2": "#b91c1c",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq09-ftn"><button type="button" className="fire">Another cookie</button><div className="tt" role="status"><small className="lb">Your tip of the day</small><button type="button" className="ck" aria-label="Open the cookie" aria-expanded="false"><i className="h1" aria-hidden="true"><svg viewBox="0 0 52 40"><path className="lo" d="M52 6C34 0 10 6 3 26C1 33 8 38 16 34C28 28 40 29 52 37Z" /><path className="fo" d="M52 37C42 30 30 29 19 33C30 24 42 20 52 21Z" /><path className="hl" d="M13 15C21 8 33 6 44 8" /></svg></i><i className="h2" aria-hidden="true"><svg viewBox="0 0 52 40"><path className="lo" d="M52 6C34 0 10 6 3 26C1 33 8 38 16 34C28 28 40 29 52 37Z" /><path className="fo" d="M52 37C42 30 30 29 19 33C30 24 42 20 52 21Z" /><path className="hl" d="M13 15C21 8 33 6 44 8" /></svg></i><span className="cr" aria-hidden="true"><i style={{ "--x": "-4.5em", "--y": "-0.0em" } as CSSProperties}></i><i style={{ "--x": "2.7em", "--y": "-0.2em" } as CSSProperties}></i><i style={{ "--x": "2.7em", "--y": "2.3em" } as CSSProperties}></i><i style={{ "--x": "-0.7em", "--y": "-0.3em" } as CSSProperties}></i><i style={{ "--x": "-3.5em", "--y": "0.6em" } as CSSProperties}></i><i style={{ "--x": "-0.4em", "--y": "1.4em" } as CSSProperties}></i><i style={{ "--x": "-0.2em", "--y": "0.3em" } as CSSProperties}></i><i style={{ "--x": "-0.2em", "--y": "1.7em" } as CSSProperties}></i><i style={{ "--x": "-4.1em", "--y": "-0.4em" } as CSSProperties}></i></span></button><p className="sl"><span>Today is a good day to launch that idea</span><small>Numbers: 7 · 14 · 23</small></p><small className="hn">Tap the cookie to open it</small></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.
````
