# Fogged car window

> Swipe through the condensation to see the snowy forest outside, and watch the glass slowly fog up again.

- Category: [Liquid Glass](https://library.aimran.es/components/liquid-glass)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-lg-fog-wipe
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

A winter car window full of condensation, made with two copies of the same scene: one sharp, one blurred behind a misty layer. A small canvas acts as the mask, so your finger clears the fog wherever it passes and a hidden greeting appears at the start. Use it for weather widgets, winter campaigns or playful empty states.

Write your own word in the text field and it is traced on the glass with a fingertip stroke. The defog button clears the window from the bottom up, and the colors repaint the sunrise and the pines.

## Code

### HTML

```html
<div class="uvq11-fog"><div class="sc"><svg viewBox="0 0 200 140" preserveAspectRatio="xMidYMid slice"><path class="h1" d="M0 96Q50 78 100 92T200 86V140H0Z"/><path class="tr" d="M0 83L12 115H-12ZM59 72L72 105H46ZM47 83L57 110H37ZM135 74L149 112H121ZM31 86L39 108H23ZM130 79L140 105H120ZM183 80L193 105H173ZM87 74L102 113H72ZM46 78L58 110H34ZM54 91L62 111H46ZM110 72L124 108H96Z"/><path class="h2" d="M0 118Q60 104 120 116T200 112V140H0Z"/></svg></div><div class="fg" aria-hidden="true"><div class="sc"><svg viewBox="0 0 200 140" preserveAspectRatio="xMidYMid slice"><path class="h1" d="M0 96Q50 78 100 92T200 86V140H0Z"/><path class="tr" d="M0 83L12 115H-12ZM59 72L72 105H46ZM47 83L57 110H37ZM135 74L149 112H121ZM31 86L39 108H23ZM130 79L140 105H120ZM183 80L193 105H173ZM87 74L102 113H72ZM46 78L58 110H34ZM54 91L62 111H46ZM110 72L124 108H96Z"/><path class="h2" d="M0 118Q60 104 120 116T200 112V140H0Z"/></svg></div></div><div class="gl" role="img" aria-label="Fogged glass: swipe your finger to clear it" data-t="Hello"></div><button type="button" class="ch"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 18h16M4 6h16"/><path d="M8 15c-1.2-1.2 1.2-2.8 0-4s1.2-2.8 0-4M12 15c-1.2-1.2 1.2-2.8 0-4s1.2-2.8 0-4M16 15c-1.2-1.2 1.2-2.8 0-4s1.2-2.8 0-4"/></svg>Defog</button></div>
```

### CSS

```css
.uvq11-fog {
  --c1: #ffb4a2;
  --c2: #2f4858;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq11-fog {
  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: 20em;
  height: 14em;
  border-radius: 1.6em;
  overflow: hidden;
  color: #fff;
  isolation: isolate;
  -webkit-user-select: none;
  user-select: none;
  background: #cfe0f5;
}

.uvq11-fog .sc {
  position: absolute;
  inset: 0;
  background: radial-gradient(9% 13% at 72% 64%,#fff6dc 30%,#ffd6a5 60%,transparent 72%),linear-gradient(180deg,#9fc3f4 0%,var(--c1) 58%,#ffe0bd 78%);
}

.uvq11-fog .sc svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.uvq11-fog .h1 {
  fill: #e5ebf5;
}

.uvq11-fog .h2 {
  fill: #f8fbff;
}

.uvq11-fog .tr {
  fill: var(--c2);
}

.uvq11-fog .fg {
  position: absolute;
  inset: 0;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}

.uvq11-fog .fg .sc {
  filter: blur(7px) brightness(1.06) saturate(.75);
  transform: scale(1.06);
}

.uvq11-fog .fg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 35%,rgba(255,255,255,.55) 0 .05em,transparent .09em) 0 0/.42em .42em,radial-gradient(circle at 70% 60%,rgba(255,255,255,.4) 0 .04em,transparent .08em) .2em .1em/.55em .55em,rgba(236,241,248,.5);
}

.uvq11-fog .gl {
  position: absolute;
  inset: 0;
  touch-action: none;
  cursor: pointer;
}

.uvq11-fog::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 .45em #1d2230,inset 0 0 0 .55em rgba(255,255,255,.18),inset 0 1.2em 1.4em -1em rgba(0,0,0,.35);
}

.uvq11-fog .ch {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4em;
  padding: .55em 1em;
  border-radius: 2em;
  font-size: .78em;
  font-weight: 650;
  line-height: 1;
  color: #fff;
  background: rgba(255,255,255,.16);
  -webkit-backdrop-filter: blur(10px) saturate(1.7);
  backdrop-filter: blur(10px) saturate(1.7);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55),inset 0 -1px 0 rgba(255,255,255,.1),inset 0 0 0 1px rgba(255,255,255,.24),0 .5em 1.2em -.5em rgba(0,0,0,.45);
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1),background calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq11-fog .ch:hover {
  background: rgba(255,255,255,.28);
}

.uvq11-fog .ch:active {
  transform: scale(.92);
}

.uvq11-fog .ch:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.uvq11-fog .ch svg {
  width: 1.15em;
  height: 1.15em;
}

.uvq11-fog .ch {
  position: absolute;
  right: 1em;
  bottom: 1em;
  z-index: 1;
  color: #1d2230;
  background: rgba(255,255,255,.55);
}

.uvq11-fog .ch:hover {
  background: rgba(255,255,255,.75);
}

.uvq11-fog .ch:focus-visible {
  outline-color: #1d2230;
}
```

### JavaScript

```js
document.querySelectorAll(".uvq11-fog").forEach(el => {
  const fg=el.querySelector(".fg"),gl=el.querySelector(".gl"),bt=el.querySelector(".ch"),c=document.createElement("canvas");c.width=160;c.height=112;const x=c.getContext("2d");
x.fillStyle="#000";x.fillRect(0,0,160,112);x.globalCompositeOperation="destination-out";x.font="italic 400 36px 'Segoe Print','Bradley Hand','Comic Sans MS',cursive";x.textAlign="center";x.textBaseline="middle";x.lineWidth=4.5;x.lineJoin="round";x.lineCap="round";x.strokeText(gl.dataset.t||"",80,50);
let dirty=true,lp=null,hold=Date.now()+5000,clr=-1,raf=0;
const paint=()=>{raf=0;if(!dirty)return;dirty=false;const u="url("+c.toDataURL()+")";fg.style.webkitMaskImage=u;fg.style.maskImage=u};
const ask=()=>{dirty=true;if(!raf)raf=requestAnimationFrame(paint)};
const pt=e=>{const r=gl.getBoundingClientRect();return[(e.clientX-r.left)/r.width*160,(e.clientY-r.top)/r.height*112]};
const wipe=(a,b)=>{x.globalCompositeOperation="destination-out";x.lineCap="round";x.lineWidth=13;x.beginPath();x.moveTo(a[0],a[1]);x.lineTo(b[0],b[1]);x.stroke();hold=Date.now()+1500;ask()};
gl.addEventListener("pointerdown",e=>{gl.setPointerCapture(e.pointerId);lp=pt(e);wipe(lp,lp)});
gl.addEventListener("pointermove",e=>{if(!lp)return;const p=pt(e);wipe(lp,p);lp=p});
const up=()=>{lp=null};gl.addEventListener("pointerup",up);gl.addEventListener("pointercancel",up);
const iv=setInterval(()=>{if(clr>=0){clr+=.06;const h=Math.min(1.2,clr)*112;x.globalCompositeOperation="destination-out";const g=x.createLinearGradient(0,112-h-24,0,112-h);g.addColorStop(0,"rgba(0,0,0,0)");g.addColorStop(1,"#000");x.fillStyle=g;x.fillRect(0,112-h-24,160,24);x.fillStyle="#000";x.fillRect(0,112-h,160,h);if(clr>=1.2){clr=-1;hold=Date.now()+2500}ask();return}
if(Date.now()<hold||lp)return;x.globalCompositeOperation="source-over";x.fillStyle="rgba(0,0,0,.007)";x.fillRect(0,0,160,112);ask()},60);
bt.addEventListener("click",()=>{clr=0});paint();
return()=>{clearInterval(iv);cancelAnimationFrame(raf)}
});
```

### React

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

const css = `
.uvq11-fog {
  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: 20em;
  height: 14em;
  border-radius: 1.6em;
  overflow: hidden;
  color: #fff;
  isolation: isolate;
  -webkit-user-select: none;
  user-select: none;
  background: #cfe0f5;
}

.uvq11-fog .sc {
  position: absolute;
  inset: 0;
  background: radial-gradient(9% 13% at 72% 64%,#fff6dc 30%,#ffd6a5 60%,transparent 72%),linear-gradient(180deg,#9fc3f4 0%,var(--c1) 58%,#ffe0bd 78%);
}

.uvq11-fog .sc svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.uvq11-fog .h1 {
  fill: #e5ebf5;
}

.uvq11-fog .h2 {
  fill: #f8fbff;
}

.uvq11-fog .tr {
  fill: var(--c2);
}

.uvq11-fog .fg {
  position: absolute;
  inset: 0;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}

.uvq11-fog .fg .sc {
  filter: blur(7px) brightness(1.06) saturate(.75);
  transform: scale(1.06);
}

.uvq11-fog .fg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 35%,rgba(255,255,255,.55) 0 .05em,transparent .09em) 0 0/.42em .42em,radial-gradient(circle at 70% 60%,rgba(255,255,255,.4) 0 .04em,transparent .08em) .2em .1em/.55em .55em,rgba(236,241,248,.5);
}

.uvq11-fog .gl {
  position: absolute;
  inset: 0;
  touch-action: none;
  cursor: pointer;
}

.uvq11-fog::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 .45em #1d2230,inset 0 0 0 .55em rgba(255,255,255,.18),inset 0 1.2em 1.4em -1em rgba(0,0,0,.35);
}

.uvq11-fog .ch {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4em;
  padding: .55em 1em;
  border-radius: 2em;
  font-size: .78em;
  font-weight: 650;
  line-height: 1;
  color: #fff;
  background: rgba(255,255,255,.16);
  -webkit-backdrop-filter: blur(10px) saturate(1.7);
  backdrop-filter: blur(10px) saturate(1.7);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55),inset 0 -1px 0 rgba(255,255,255,.1),inset 0 0 0 1px rgba(255,255,255,.24),0 .5em 1.2em -.5em rgba(0,0,0,.45);
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1),background calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq11-fog .ch:hover {
  background: rgba(255,255,255,.28);
}

.uvq11-fog .ch:active {
  transform: scale(.92);
}

.uvq11-fog .ch:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.uvq11-fog .ch svg {
  width: 1.15em;
  height: 1.15em;
}

.uvq11-fog .ch {
  position: absolute;
  right: 1em;
  bottom: 1em;
  z-index: 1;
  color: #1d2230;
  background: rgba(255,255,255,.55);
}

.uvq11-fog .ch:hover {
  background: rgba(255,255,255,.75);
}

.uvq11-fog .ch:focus-visible {
  outline-color: #1d2230;
}
`;

// 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 fg=el.querySelector(".fg"),gl=el.querySelector(".gl"),bt=el.querySelector(".ch"),c=document.createElement("canvas");c.width=160;c.height=112;const x=c.getContext("2d");
x.fillStyle="#000";x.fillRect(0,0,160,112);x.globalCompositeOperation="destination-out";x.font="italic 400 36px 'Segoe Print','Bradley Hand','Comic Sans MS',cursive";x.textAlign="center";x.textBaseline="middle";x.lineWidth=4.5;x.lineJoin="round";x.lineCap="round";x.strokeText(gl.dataset.t||"",80,50);
let dirty=true,lp=null,hold=Date.now()+5000,clr=-1,raf=0;
const paint=()=>{raf=0;if(!dirty)return;dirty=false;const u="url("+c.toDataURL()+")";fg.style.webkitMaskImage=u;fg.style.maskImage=u};
const ask=()=>{dirty=true;if(!raf)raf=requestAnimationFrame(paint)};
const pt=e=>{const r=gl.getBoundingClientRect();return[(e.clientX-r.left)/r.width*160,(e.clientY-r.top)/r.height*112]};
const wipe=(a,b)=>{x.globalCompositeOperation="destination-out";x.lineCap="round";x.lineWidth=13;x.beginPath();x.moveTo(a[0],a[1]);x.lineTo(b[0],b[1]);x.stroke();hold=Date.now()+1500;ask()};
gl.addEventListener("pointerdown",e=>{gl.setPointerCapture(e.pointerId);lp=pt(e);wipe(lp,lp)});
gl.addEventListener("pointermove",e=>{if(!lp)return;const p=pt(e);wipe(lp,p);lp=p});
const up=()=>{lp=null};gl.addEventListener("pointerup",up);gl.addEventListener("pointercancel",up);
const iv=setInterval(()=>{if(clr>=0){clr+=.06;const h=Math.min(1.2,clr)*112;x.globalCompositeOperation="destination-out";const g=x.createLinearGradient(0,112-h-24,0,112-h);g.addColorStop(0,"rgba(0,0,0,0)");g.addColorStop(1,"#000");x.fillStyle=g;x.fillRect(0,112-h-24,160,24);x.fillStyle="#000";x.fillRect(0,112-h,160,h);if(clr>=1.2){clr=-1;hold=Date.now()+2500}ask();return}
if(Date.now()<hold||lp)return;x.globalCompositeOperation="source-over";x.fillStyle="rgba(0,0,0,.007)";x.fillRect(0,0,160,112);ask()},60);
bt.addEventListener("click",()=>{clr=0});paint();
return()=>{clearInterval(iv);cancelAnimationFrame(raf)}
}

export default function LgFogWipe() {
  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": "#ffb4a2",
          "--c2": "#2f4858",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq11-fog"><div className="sc"><svg viewBox="0 0 200 140" preserveAspectRatio="xMidYMid slice"><path className="h1" d="M0 96Q50 78 100 92T200 86V140H0Z" /><path className="tr" d="M0 83L12 115H-12ZM59 72L72 105H46ZM47 83L57 110H37ZM135 74L149 112H121ZM31 86L39 108H23ZM130 79L140 105H120ZM183 80L193 105H173ZM87 74L102 113H72ZM46 78L58 110H34ZM54 91L62 111H46ZM110 72L124 108H96Z" /><path className="h2" d="M0 118Q60 104 120 116T200 112V140H0Z" /></svg></div><div className="fg" aria-hidden="true"><div className="sc"><svg viewBox="0 0 200 140" preserveAspectRatio="xMidYMid slice"><path className="h1" d="M0 96Q50 78 100 92T200 86V140H0Z" /><path className="tr" d="M0 83L12 115H-12ZM59 72L72 105H46ZM47 83L57 110H37ZM135 74L149 112H121ZM31 86L39 108H23ZM130 79L140 105H120ZM183 80L193 105H173ZM87 74L102 113H72ZM46 78L58 110H34ZM54 91L62 111H46ZM110 72L124 108H96Z" /><path className="h2" d="M0 118Q60 104 120 116T200 112V140H0Z" /></svg></div></div><div className="gl" role="img" aria-label="Fogged glass: swipe your finger to clear it" data-t="Hello"></div><button type="button" className="ch"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M4 18h16M4 6h16" /><path d="M8 15c-1.2-1.2 1.2-2.8 0-4s1.2-2.8 0-4M12 15c-1.2-1.2 1.2-2.8 0-4s1.2-2.8 0-4M16 15c-1.2-1.2 1.2-2.8 0-4s1.2-2.8 0-4" /></svg>Defog</button></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 “Fogged car window” block (Liquid Glass) from AIMRAN Library to my project.

## What it is
Swipe through the condensation to see the snowy forest outside, and watch the glass slowly fog up again.

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

## 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 = `
.uvq11-fog {
  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: 20em;
  height: 14em;
  border-radius: 1.6em;
  overflow: hidden;
  color: #fff;
  isolation: isolate;
  -webkit-user-select: none;
  user-select: none;
  background: #cfe0f5;
}

.uvq11-fog .sc {
  position: absolute;
  inset: 0;
  background: radial-gradient(9% 13% at 72% 64%,#fff6dc 30%,#ffd6a5 60%,transparent 72%),linear-gradient(180deg,#9fc3f4 0%,var(--c1) 58%,#ffe0bd 78%);
}

.uvq11-fog .sc svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.uvq11-fog .h1 {
  fill: #e5ebf5;
}

.uvq11-fog .h2 {
  fill: #f8fbff;
}

.uvq11-fog .tr {
  fill: var(--c2);
}

.uvq11-fog .fg {
  position: absolute;
  inset: 0;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}

.uvq11-fog .fg .sc {
  filter: blur(7px) brightness(1.06) saturate(.75);
  transform: scale(1.06);
}

.uvq11-fog .fg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 35%,rgba(255,255,255,.55) 0 .05em,transparent .09em) 0 0/.42em .42em,radial-gradient(circle at 70% 60%,rgba(255,255,255,.4) 0 .04em,transparent .08em) .2em .1em/.55em .55em,rgba(236,241,248,.5);
}

.uvq11-fog .gl {
  position: absolute;
  inset: 0;
  touch-action: none;
  cursor: pointer;
}

.uvq11-fog::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 .45em #1d2230,inset 0 0 0 .55em rgba(255,255,255,.18),inset 0 1.2em 1.4em -1em rgba(0,0,0,.35);
}

.uvq11-fog .ch {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4em;
  padding: .55em 1em;
  border-radius: 2em;
  font-size: .78em;
  font-weight: 650;
  line-height: 1;
  color: #fff;
  background: rgba(255,255,255,.16);
  -webkit-backdrop-filter: blur(10px) saturate(1.7);
  backdrop-filter: blur(10px) saturate(1.7);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55),inset 0 -1px 0 rgba(255,255,255,.1),inset 0 0 0 1px rgba(255,255,255,.24),0 .5em 1.2em -.5em rgba(0,0,0,.45);
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1),background calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq11-fog .ch:hover {
  background: rgba(255,255,255,.28);
}

.uvq11-fog .ch:active {
  transform: scale(.92);
}

.uvq11-fog .ch:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.uvq11-fog .ch svg {
  width: 1.15em;
  height: 1.15em;
}

.uvq11-fog .ch {
  position: absolute;
  right: 1em;
  bottom: 1em;
  z-index: 1;
  color: #1d2230;
  background: rgba(255,255,255,.55);
}

.uvq11-fog .ch:hover {
  background: rgba(255,255,255,.75);
}

.uvq11-fog .ch:focus-visible {
  outline-color: #1d2230;
}
`;

// 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 fg=el.querySelector(".fg"),gl=el.querySelector(".gl"),bt=el.querySelector(".ch"),c=document.createElement("canvas");c.width=160;c.height=112;const x=c.getContext("2d");
x.fillStyle="#000";x.fillRect(0,0,160,112);x.globalCompositeOperation="destination-out";x.font="italic 400 36px 'Segoe Print','Bradley Hand','Comic Sans MS',cursive";x.textAlign="center";x.textBaseline="middle";x.lineWidth=4.5;x.lineJoin="round";x.lineCap="round";x.strokeText(gl.dataset.t||"",80,50);
let dirty=true,lp=null,hold=Date.now()+5000,clr=-1,raf=0;
const paint=()=>{raf=0;if(!dirty)return;dirty=false;const u="url("+c.toDataURL()+")";fg.style.webkitMaskImage=u;fg.style.maskImage=u};
const ask=()=>{dirty=true;if(!raf)raf=requestAnimationFrame(paint)};
const pt=e=>{const r=gl.getBoundingClientRect();return[(e.clientX-r.left)/r.width*160,(e.clientY-r.top)/r.height*112]};
const wipe=(a,b)=>{x.globalCompositeOperation="destination-out";x.lineCap="round";x.lineWidth=13;x.beginPath();x.moveTo(a[0],a[1]);x.lineTo(b[0],b[1]);x.stroke();hold=Date.now()+1500;ask()};
gl.addEventListener("pointerdown",e=>{gl.setPointerCapture(e.pointerId);lp=pt(e);wipe(lp,lp)});
gl.addEventListener("pointermove",e=>{if(!lp)return;const p=pt(e);wipe(lp,p);lp=p});
const up=()=>{lp=null};gl.addEventListener("pointerup",up);gl.addEventListener("pointercancel",up);
const iv=setInterval(()=>{if(clr>=0){clr+=.06;const h=Math.min(1.2,clr)*112;x.globalCompositeOperation="destination-out";const g=x.createLinearGradient(0,112-h-24,0,112-h);g.addColorStop(0,"rgba(0,0,0,0)");g.addColorStop(1,"#000");x.fillStyle=g;x.fillRect(0,112-h-24,160,24);x.fillStyle="#000";x.fillRect(0,112-h,160,h);if(clr>=1.2){clr=-1;hold=Date.now()+2500}ask();return}
if(Date.now()<hold||lp)return;x.globalCompositeOperation="source-over";x.fillStyle="rgba(0,0,0,.007)";x.fillRect(0,0,160,112);ask()},60);
bt.addEventListener("click",()=>{clr=0});paint();
return()=>{clearInterval(iv);cancelAnimationFrame(raf)}
}

export default function LgFogWipe() {
  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": "#ffb4a2",
          "--c2": "#2f4858",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq11-fog"><div className="sc"><svg viewBox="0 0 200 140" preserveAspectRatio="xMidYMid slice"><path className="h1" d="M0 96Q50 78 100 92T200 86V140H0Z" /><path className="tr" d="M0 83L12 115H-12ZM59 72L72 105H46ZM47 83L57 110H37ZM135 74L149 112H121ZM31 86L39 108H23ZM130 79L140 105H120ZM183 80L193 105H173ZM87 74L102 113H72ZM46 78L58 110H34ZM54 91L62 111H46ZM110 72L124 108H96Z" /><path className="h2" d="M0 118Q60 104 120 116T200 112V140H0Z" /></svg></div><div className="fg" aria-hidden="true"><div className="sc"><svg viewBox="0 0 200 140" preserveAspectRatio="xMidYMid slice"><path className="h1" d="M0 96Q50 78 100 92T200 86V140H0Z" /><path className="tr" d="M0 83L12 115H-12ZM59 72L72 105H46ZM47 83L57 110H37ZM135 74L149 112H121ZM31 86L39 108H23ZM130 79L140 105H120ZM183 80L193 105H173ZM87 74L102 113H72ZM46 78L58 110H34ZM54 91L62 111H46ZM110 72L124 108H96Z" /><path className="h2" d="M0 118Q60 104 120 116T200 112V140H0Z" /></svg></div></div><div className="gl" role="img" aria-label="Fogged glass: swipe your finger to clear it" data-t="Hello"></div><button type="button" className="ch"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M4 18h16M4 6h16" /><path d="M8 15c-1.2-1.2 1.2-2.8 0-4s1.2-2.8 0-4M12 15c-1.2-1.2 1.2-2.8 0-4s1.2-2.8 0-4M16 15c-1.2-1.2 1.2-2.8 0-4s1.2-2.8 0-4" /></svg>Defog</button></div>
      </div>
    </>
  );
}
```

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