# Floating accessibility panel

> A floating button opens text size, contrast, underline, spacing and reading guide settings that change the page instantly.

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

## Where to use it

Some sites need reading aids on the page itself, and this widget keeps them one tap away. The round button opens a panel with a text size stepper and switches for high contrast, underlined links, wider spacing, a reading guide that follows the pointer and paused animations. Every change applies live to the article behind it. It fits public services, schools, news sites and long reads.

The main color is the button and the active switches, the second one the reading guide band. Each switch toggles a class on the root, so you can hook your own styles to it, and the reset button puts everything back.

## Code

### HTML

```html
<div class="uvq13-a11y"><article class="art"><p class="kk">Urban garden</p><h4>Tomatoes on a balcony</h4><p class="tx">A two-metre balcony is enough to grow tomatoes, basil and strawberries if it gets six hours of sun a day.</p><a href="#">Read the full guide</a><i class="im" aria-hidden="true"></i></article><i class="rg" aria-hidden="true"></i><button type="button" class="fire" aria-haspopup="dialog" aria-label="Accessibility options"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="4.5" r="1.8"/><path d="M5 8.5l7 1.5 7-1.5M12 10v4.5M12 14.5l-3 6M12 14.5l3 6"/></svg></button><div class="pn" role="dialog" aria-modal="true" aria-labelledby="uvq13-a11y-t"><header><b id="uvq13-a11y-t">Accessibility</b><button type="button" class="x" aria-label="Close"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 7l10 10M17 7L7 17"/></svg></button></header><div class="row"><span>Text size</span><span class="stp"><button type="button" class="dn" aria-label="Decrease text">A−</button><output>100 %</output><button type="button" class="up" aria-label="Increase text">A+</button></span></div><button type="button" class="row sw" role="switch" aria-checked="false" data-k="hc"><span>High contrast</span><i></i></button><button type="button" class="row sw" role="switch" aria-checked="false" data-k="ul"><span>Underline links</span><i></i></button><button type="button" class="row sw" role="switch" aria-checked="false" data-k="sp"><span>Wider spacing</span><i></i></button><button type="button" class="row sw" role="switch" aria-checked="false" data-k="gd"><span>Reading guide</span><i></i></button><button type="button" class="row sw" role="switch" aria-checked="false" data-k="pa"><span>Pause animations</span><i></i></button><button type="button" class="rs">Reset</button></div></div>
```

### CSS

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

.uvq13-a11y {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  width: 22em;
  height: 20em;
  border-radius: 1.2em;
  overflow: hidden;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 9%,transparent);
  --ts: 1;
  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);
}

.uvq13-a11y .art {
  position: absolute;
  left: 1.2em;
  top: 1.2em;
  width: calc(7.3em / var(--ts));
  font-size: calc(var(--ts) * 1em);
  transition: font-size calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq13-a11y .kk {
  margin: 0;
  font-size: .6em;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--c1);
}

.uvq13-a11y h4 {
  margin: .25em 0 .4em;
  font-size: 1.1em;
  line-height: 1.1;
}

.uvq13-a11y .tx {
  margin: 0 0 .5em;
  font-size: .76em;
  line-height: 1.5;
  color: color-mix(in srgb,var(--fg) 75%,transparent);
  transition: letter-spacing calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),line-height calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),word-spacing calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq13-a11y .art a {
  font-size: .76em;
  font-weight: 700;
  color: var(--c1);
  text-decoration: none;
  text-underline-offset: .2em;
}

.uvq13-a11y .im {
  display: block;
  height: 3.4em;
  margin-top: .7em;
  border-radius: .6em;
  background: linear-gradient(120deg,#16a34a,#84cc16,#facc15,#16a34a) 0 0/300% 100%;
  animation: uvq13-a11y-g calc(6s / var(--k)) linear infinite;
}

.uvq13-a11y.hc {
  color: #fff;
  background: #000;
}

.uvq13-a11y.hc .tx {
  color: #fff;
}

.uvq13-a11y.hc .kk,.uvq13-a11y.hc .art a {
  color: #ffeb3b;
}

.uvq13-a11y.ul .art a {
  text-decoration: underline;
  text-decoration-thickness: .12em;
}

.uvq13-a11y.sp .tx {
  letter-spacing: .05em;
  word-spacing: .15em;
  line-height: 1.95;
}

.uvq13-a11y.pa .im {
  animation-play-state: paused;
}

.uvq13-a11y .rg {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--gy,7em);
  z-index: 2;
  display: none;
  height: 1.8em;
  margin-top: -.9em;
  pointer-events: none;
  background: color-mix(in srgb,var(--c2) 30%,transparent);
  box-shadow: 0 0 0 99em rgba(0,0,0,.35);
}

.uvq13-a11y.gd .rg {
  display: block;
}

.uvq13-a11y .fire {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: absolute;
  right: 1em;
  bottom: 1em;
  z-index: 6;
  display: grid;
  place-items: center;
  width: 2.8em;
  height: 2.8em;
  border-radius: 50%;
  color: #fff;
  background: var(--c1);
  box-shadow: 0 .5em 1em -.4em var(--c1);
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq13-a11y .fire:hover {
  transform: scale(1.07) rotate(-8deg);
}

.uvq13-a11y .fire svg {
  width: 1.5em;
  height: 1.5em;
}

.uvq13-a11y .pn {
  position: absolute;
  right: .9em;
  top: .9em;
  z-index: 5;
  width: 12.2em;
  padding: .6em .7em;
  box-sizing: border-box;
  border-radius: 1em;
  color: var(--fg);
  background: color-mix(in srgb,var(--fg) 2%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 9%,transparent),0 1.6em 3.2em -1.2em rgba(0,0,0,.5);
  background: var(--bg);
  transform-origin: 100% 100%;
  transform: scale(.85) translateY(1em);
  opacity: 0;
  pointer-events: none;
  transition: transform calc(0.35s / var(--k)) cubic-bezier(.34,1.56,.64,1),opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq13-a11y.hc .pn {
  --fg: #1d1d1f;
  --bg: #f5f5f7;
}

.uvq13-a11y.open .pn {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

.uvq13-a11y header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 .2em .35em;
}

.uvq13-a11y header b {
  font-size: .9em;
}

.uvq13-a11y .x {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: grid;
  place-items: center;
  width: 1.8em;
  height: 1.8em;
  border-radius: 50%;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
}

.uvq13-a11y .x svg {
  width: .9em;
  height: .9em;
}

.uvq13-a11y .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5em;
  box-sizing: border-box;
  width: 100%;
  padding: .36em .4em;
  white-space: nowrap;
  border-radius: .6em;
  font-size: .74em;
  text-align: left;
}

.uvq13-a11y button.row {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  font-size: .74em;
}

.uvq13-a11y button.row:hover {
  background: color-mix(in srgb,var(--fg) 6%,transparent);
}

.uvq13-a11y .sw i {
  position: relative;
  flex: none;
  width: 2.1em;
  height: 1.2em;
  border-radius: 1em;
  background: color-mix(in srgb,var(--fg) 18%,transparent);
  transition: background calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq13-a11y .sw i::before {
  content: "";
  position: absolute;
  left: .15em;
  top: .15em;
  width: .9em;
  height: .9em;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 .1em .2em rgba(0,0,0,.3);
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq13-a11y .sw[aria-checked="true"] i {
  background: var(--c1);
}

.uvq13-a11y .sw[aria-checked="true"] i::before {
  transform: translateX(.9em);
}

.uvq13-a11y .stp {
  display: flex;
  align-items: center;
  gap: .2em;
}

.uvq13-a11y .stp button {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  width: 2em;
  height: 1.8em;
  border-radius: .5em;
  font-weight: 800;
  font-size: .9em;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
}

.uvq13-a11y .stp button:active {
  transform: scale(.92);
}

.uvq13-a11y .stp output {
  min-width: 3em;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.uvq13-a11y .rs {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  width: 100%;
  margin-top: .35em;
  padding: .55em;
  border-radius: .6em;
  font-size: .72em;
  font-weight: 700;
  color: var(--c1);
  background: color-mix(in srgb,var(--c1) 10%,transparent);
}

.uvq13-a11y button:focus-visible,.uvq13-a11y a:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

@keyframes uvq13-a11y-g {
  to {
    background-position: 300% 0;
  }
}

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

### JavaScript

```js
document.querySelectorAll(".uvq13-a11y").forEach(el => {
  const fire=el.querySelector(".fire"),scr=el.querySelector(".scr"),pnl=el.querySelector(".pn");let tms=[];const later=(f,ms)=>tms.push(setTimeout(f,ms));
const foc=(t,ms)=>later(()=>{const n=typeof t==="string"?el.querySelector(t):t;n&&n.focus({preventScroll:true})},ms||0);
const isOpen=()=>el.classList.contains("open");
const open=u=>{if(isOpen())return;el.classList.add("open");pnl.inert=false;fire&&fire.setAttribute("aria-expanded","true");u&&foc('.pn .stp button',300)};
const close=()=>{if(!isOpen())return;el.classList.remove("open");pnl.inert=true;fire&&fire.setAttribute("aria-expanded","false");;fire&&fire.focus({preventScroll:true})};
fire&&fire.addEventListener("click",()=>isOpen()?close():open(true));scr&&scr.addEventListener("click",()=>close());
el.addEventListener("keydown",e=>{if(!isOpen())return;if(e.key==="Escape"){e.preventDefault();e.stopPropagation();close()}else if(e.key==="Tab"){const f=[...pnl.querySelectorAll('button:not([disabled]),input:not([disabled]),textarea,a[href],[tabindex="0"]')].filter(x=>x.getClientRects().length);if(!f.length){e.preventDefault();return}const a=f[0],z=f[f.length-1],ac=document.activeElement;if(e.shiftKey&&(ac===a||!pnl.contains(ac))){e.preventDefault();z.focus()}else if(!e.shiftKey&&(ac===z||!pnl.contains(ac))){e.preventDefault();a.focus()}}});
pnl.inert=true;later(()=>open(false),500);const out=el.querySelector(".stp output"),sws=[...el.querySelectorAll(".sw")];let ts=1;
const size=d=>{ts=Math.max(.85,Math.min(1.45,+(ts+d).toFixed(2)));el.style.setProperty("--ts",String(ts));out.textContent=Math.round(ts*100)+" %"};
el.querySelector(".stp .dn").addEventListener("click",()=>size(-.15));el.querySelector(".stp .up").addEventListener("click",()=>size(.15));
sws.forEach(b=>b.addEventListener("click",()=>{const on=b.getAttribute("aria-checked")!=="true";b.setAttribute("aria-checked",String(on));el.classList.toggle(b.dataset.k,on)}));
el.querySelector(".rs").addEventListener("click",()=>{ts=1;size(0);sws.forEach(b=>{b.setAttribute("aria-checked","false");el.classList.remove(b.dataset.k)})});
el.querySelector(".pn .x").addEventListener("click",close);el.querySelector(".art a").addEventListener("click",e=>e.preventDefault());
el.addEventListener("pointermove",e=>{if(!el.classList.contains("gd"))return;const s=el.getBoundingClientRect().width/el.offsetWidth||1;el.style.setProperty("--gy",(e.clientY-el.getBoundingClientRect().top)/s+"px")});return()=>tms.forEach(clearTimeout)
});
```

### React

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

const css = `
.uvq13-a11y {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  width: 22em;
  height: 20em;
  border-radius: 1.2em;
  overflow: hidden;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 9%,transparent);
  --ts: 1;
  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);
}

.uvq13-a11y .art {
  position: absolute;
  left: 1.2em;
  top: 1.2em;
  width: calc(7.3em / var(--ts));
  font-size: calc(var(--ts) * 1em);
  transition: font-size calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq13-a11y .kk {
  margin: 0;
  font-size: .6em;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--c1);
}

.uvq13-a11y h4 {
  margin: .25em 0 .4em;
  font-size: 1.1em;
  line-height: 1.1;
}

.uvq13-a11y .tx {
  margin: 0 0 .5em;
  font-size: .76em;
  line-height: 1.5;
  color: color-mix(in srgb,var(--fg) 75%,transparent);
  transition: letter-spacing calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),line-height calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),word-spacing calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq13-a11y .art a {
  font-size: .76em;
  font-weight: 700;
  color: var(--c1);
  text-decoration: none;
  text-underline-offset: .2em;
}

.uvq13-a11y .im {
  display: block;
  height: 3.4em;
  margin-top: .7em;
  border-radius: .6em;
  background: linear-gradient(120deg,#16a34a,#84cc16,#facc15,#16a34a) 0 0/300% 100%;
  animation: uvq13-a11y-g calc(6s / var(--k)) linear infinite;
}

.uvq13-a11y.hc {
  color: #fff;
  background: #000;
}

.uvq13-a11y.hc .tx {
  color: #fff;
}

.uvq13-a11y.hc .kk,.uvq13-a11y.hc .art a {
  color: #ffeb3b;
}

.uvq13-a11y.ul .art a {
  text-decoration: underline;
  text-decoration-thickness: .12em;
}

.uvq13-a11y.sp .tx {
  letter-spacing: .05em;
  word-spacing: .15em;
  line-height: 1.95;
}

.uvq13-a11y.pa .im {
  animation-play-state: paused;
}

.uvq13-a11y .rg {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--gy,7em);
  z-index: 2;
  display: none;
  height: 1.8em;
  margin-top: -.9em;
  pointer-events: none;
  background: color-mix(in srgb,var(--c2) 30%,transparent);
  box-shadow: 0 0 0 99em rgba(0,0,0,.35);
}

.uvq13-a11y.gd .rg {
  display: block;
}

.uvq13-a11y .fire {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: absolute;
  right: 1em;
  bottom: 1em;
  z-index: 6;
  display: grid;
  place-items: center;
  width: 2.8em;
  height: 2.8em;
  border-radius: 50%;
  color: #fff;
  background: var(--c1);
  box-shadow: 0 .5em 1em -.4em var(--c1);
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq13-a11y .fire:hover {
  transform: scale(1.07) rotate(-8deg);
}

.uvq13-a11y .fire svg {
  width: 1.5em;
  height: 1.5em;
}

.uvq13-a11y .pn {
  position: absolute;
  right: .9em;
  top: .9em;
  z-index: 5;
  width: 12.2em;
  padding: .6em .7em;
  box-sizing: border-box;
  border-radius: 1em;
  color: var(--fg);
  background: color-mix(in srgb,var(--fg) 2%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 9%,transparent),0 1.6em 3.2em -1.2em rgba(0,0,0,.5);
  background: var(--bg);
  transform-origin: 100% 100%;
  transform: scale(.85) translateY(1em);
  opacity: 0;
  pointer-events: none;
  transition: transform calc(0.35s / var(--k)) cubic-bezier(.34,1.56,.64,1),opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq13-a11y.hc .pn {
  --fg: #1d1d1f;
  --bg: #f5f5f7;
}

.uvq13-a11y.open .pn {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

.uvq13-a11y header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 .2em .35em;
}

.uvq13-a11y header b {
  font-size: .9em;
}

.uvq13-a11y .x {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: grid;
  place-items: center;
  width: 1.8em;
  height: 1.8em;
  border-radius: 50%;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
}

.uvq13-a11y .x svg {
  width: .9em;
  height: .9em;
}

.uvq13-a11y .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5em;
  box-sizing: border-box;
  width: 100%;
  padding: .36em .4em;
  white-space: nowrap;
  border-radius: .6em;
  font-size: .74em;
  text-align: left;
}

.uvq13-a11y button.row {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  font-size: .74em;
}

.uvq13-a11y button.row:hover {
  background: color-mix(in srgb,var(--fg) 6%,transparent);
}

.uvq13-a11y .sw i {
  position: relative;
  flex: none;
  width: 2.1em;
  height: 1.2em;
  border-radius: 1em;
  background: color-mix(in srgb,var(--fg) 18%,transparent);
  transition: background calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq13-a11y .sw i::before {
  content: "";
  position: absolute;
  left: .15em;
  top: .15em;
  width: .9em;
  height: .9em;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 .1em .2em rgba(0,0,0,.3);
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq13-a11y .sw[aria-checked="true"] i {
  background: var(--c1);
}

.uvq13-a11y .sw[aria-checked="true"] i::before {
  transform: translateX(.9em);
}

.uvq13-a11y .stp {
  display: flex;
  align-items: center;
  gap: .2em;
}

.uvq13-a11y .stp button {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  width: 2em;
  height: 1.8em;
  border-radius: .5em;
  font-weight: 800;
  font-size: .9em;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
}

.uvq13-a11y .stp button:active {
  transform: scale(.92);
}

.uvq13-a11y .stp output {
  min-width: 3em;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.uvq13-a11y .rs {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  width: 100%;
  margin-top: .35em;
  padding: .55em;
  border-radius: .6em;
  font-size: .72em;
  font-weight: 700;
  color: var(--c1);
  background: color-mix(in srgb,var(--c1) 10%,transparent);
}

.uvq13-a11y button:focus-visible,.uvq13-a11y a:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

@keyframes uvq13-a11y-g {
  to {
    background-position: 300% 0;
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq13-a11y,.uvq13-a11y *,.uvq13-a11y *::before,.uvq13-a11y *::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 fire=el.querySelector(".fire"),scr=el.querySelector(".scr"),pnl=el.querySelector(".pn");let tms=[];const later=(f,ms)=>tms.push(setTimeout(f,ms));
const foc=(t,ms)=>later(()=>{const n=typeof t==="string"?el.querySelector(t):t;n&&n.focus({preventScroll:true})},ms||0);
const isOpen=()=>el.classList.contains("open");
const open=u=>{if(isOpen())return;el.classList.add("open");pnl.inert=false;fire&&fire.setAttribute("aria-expanded","true");u&&foc('.pn .stp button',300)};
const close=()=>{if(!isOpen())return;el.classList.remove("open");pnl.inert=true;fire&&fire.setAttribute("aria-expanded","false");;fire&&fire.focus({preventScroll:true})};
fire&&fire.addEventListener("click",()=>isOpen()?close():open(true));scr&&scr.addEventListener("click",()=>close());
el.addEventListener("keydown",e=>{if(!isOpen())return;if(e.key==="Escape"){e.preventDefault();e.stopPropagation();close()}else if(e.key==="Tab"){const f=[...pnl.querySelectorAll('button:not([disabled]),input:not([disabled]),textarea,a[href],[tabindex="0"]')].filter(x=>x.getClientRects().length);if(!f.length){e.preventDefault();return}const a=f[0],z=f[f.length-1],ac=document.activeElement;if(e.shiftKey&&(ac===a||!pnl.contains(ac))){e.preventDefault();z.focus()}else if(!e.shiftKey&&(ac===z||!pnl.contains(ac))){e.preventDefault();a.focus()}}});
pnl.inert=true;later(()=>open(false),500);const out=el.querySelector(".stp output"),sws=[...el.querySelectorAll(".sw")];let ts=1;
const size=d=>{ts=Math.max(.85,Math.min(1.45,+(ts+d).toFixed(2)));el.style.setProperty("--ts",String(ts));out.textContent=Math.round(ts*100)+" %"};
el.querySelector(".stp .dn").addEventListener("click",()=>size(-.15));el.querySelector(".stp .up").addEventListener("click",()=>size(.15));
sws.forEach(b=>b.addEventListener("click",()=>{const on=b.getAttribute("aria-checked")!=="true";b.setAttribute("aria-checked",String(on));el.classList.toggle(b.dataset.k,on)}));
el.querySelector(".rs").addEventListener("click",()=>{ts=1;size(0);sws.forEach(b=>{b.setAttribute("aria-checked","false");el.classList.remove(b.dataset.k)})});
el.querySelector(".pn .x").addEventListener("click",close);el.querySelector(".art a").addEventListener("click",e=>e.preventDefault());
el.addEventListener("pointermove",e=>{if(!el.classList.contains("gd"))return;const s=el.getBoundingClientRect().width/el.offsetWidth||1;el.style.setProperty("--gy",(e.clientY-el.getBoundingClientRect().top)/s+"px")});return()=>tms.forEach(clearTimeout)
}

export default function OvA11yPanel() {
  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": "#0f766e",
          "--c2": "#fde047",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq13-a11y"><article className="art"><p className="kk">Urban garden</p><h4>Tomatoes on a balcony</h4><p className="tx">A two-metre balcony is enough to grow tomatoes, basil and strawberries if it gets six hours of sun a day.</p><a href="#">Read the full guide</a><i className="im" aria-hidden="true"></i></article><i className="rg" aria-hidden="true"></i><button type="button" className="fire" aria-haspopup="dialog" aria-label="Accessibility options"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><circle cx="12" cy="4.5" r="1.8" /><path d="M5 8.5l7 1.5 7-1.5M12 10v4.5M12 14.5l-3 6M12 14.5l3 6" /></svg></button><div className="pn" role="dialog" aria-modal="true" aria-labelledby="uvq13-a11y-t"><header><b id="uvq13-a11y-t">Accessibility</b><button type="button" className="x" aria-label="Close"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M7 7l10 10M17 7L7 17" /></svg></button></header><div className="row"><span>Text size</span><span className="stp"><button type="button" className="dn" aria-label="Decrease text">A−</button><output>100 %</output><button type="button" className="up" aria-label="Increase text">A+</button></span></div><button type="button" className="row sw" role="switch" aria-checked="false" data-k="hc"><span>High contrast</span><i></i></button><button type="button" className="row sw" role="switch" aria-checked="false" data-k="ul"><span>Underline links</span><i></i></button><button type="button" className="row sw" role="switch" aria-checked="false" data-k="sp"><span>Wider spacing</span><i></i></button><button type="button" className="row sw" role="switch" aria-checked="false" data-k="gd"><span>Reading guide</span><i></i></button><button type="button" className="row sw" role="switch" aria-checked="false" data-k="pa"><span>Pause animations</span><i></i></button><button type="button" className="rs">Reset</button></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 “Floating accessibility panel” block (Overlays) from AIMRAN Library to my project.

## What it is
A floating button opens text size, contrast, underline, spacing and reading guide settings that change the page instantly.

## Chosen settings
- Main color: #0f766e
- Secondary color: #fde047
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Accesibilidad"

## What I need
1. Add it to my project with the same look and animation as the reference code: same sizes, colours, radii, shadows, timings and easing.
2. It is built with plain HTML and CSS (the reference wraps it in a React component with its CSS). If my project uses something else (Vue, Svelte, Astro, plain HTML…), translate it without losing any behaviour. If I use Tailwind, turn the styles into classes; if not, keep the CSS in its own file.
3. Expose the settings above as props (or CSS variables) with those values as defaults.
4. Make it work well on phones: nothing that depends only on hover, touch targets of at least 44 px and no overflow on 320 px screens.
5. Make it look right in light and dark mode.
6. Keep it accessible: semantic HTML, roles and aria-* where needed, visible focus and keyboard support.
7. Respect prefers-reduced-motion: with reduced motion, no big animations but the same end result.

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

const css = `
.uvq13-a11y {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  width: 22em;
  height: 20em;
  border-radius: 1.2em;
  overflow: hidden;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 9%,transparent);
  --ts: 1;
  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);
}

.uvq13-a11y .art {
  position: absolute;
  left: 1.2em;
  top: 1.2em;
  width: calc(7.3em / var(--ts));
  font-size: calc(var(--ts) * 1em);
  transition: font-size calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq13-a11y .kk {
  margin: 0;
  font-size: .6em;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--c1);
}

.uvq13-a11y h4 {
  margin: .25em 0 .4em;
  font-size: 1.1em;
  line-height: 1.1;
}

.uvq13-a11y .tx {
  margin: 0 0 .5em;
  font-size: .76em;
  line-height: 1.5;
  color: color-mix(in srgb,var(--fg) 75%,transparent);
  transition: letter-spacing calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),line-height calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),word-spacing calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq13-a11y .art a {
  font-size: .76em;
  font-weight: 700;
  color: var(--c1);
  text-decoration: none;
  text-underline-offset: .2em;
}

.uvq13-a11y .im {
  display: block;
  height: 3.4em;
  margin-top: .7em;
  border-radius: .6em;
  background: linear-gradient(120deg,#16a34a,#84cc16,#facc15,#16a34a) 0 0/300% 100%;
  animation: uvq13-a11y-g calc(6s / var(--k)) linear infinite;
}

.uvq13-a11y.hc {
  color: #fff;
  background: #000;
}

.uvq13-a11y.hc .tx {
  color: #fff;
}

.uvq13-a11y.hc .kk,.uvq13-a11y.hc .art a {
  color: #ffeb3b;
}

.uvq13-a11y.ul .art a {
  text-decoration: underline;
  text-decoration-thickness: .12em;
}

.uvq13-a11y.sp .tx {
  letter-spacing: .05em;
  word-spacing: .15em;
  line-height: 1.95;
}

.uvq13-a11y.pa .im {
  animation-play-state: paused;
}

.uvq13-a11y .rg {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--gy,7em);
  z-index: 2;
  display: none;
  height: 1.8em;
  margin-top: -.9em;
  pointer-events: none;
  background: color-mix(in srgb,var(--c2) 30%,transparent);
  box-shadow: 0 0 0 99em rgba(0,0,0,.35);
}

.uvq13-a11y.gd .rg {
  display: block;
}

.uvq13-a11y .fire {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: absolute;
  right: 1em;
  bottom: 1em;
  z-index: 6;
  display: grid;
  place-items: center;
  width: 2.8em;
  height: 2.8em;
  border-radius: 50%;
  color: #fff;
  background: var(--c1);
  box-shadow: 0 .5em 1em -.4em var(--c1);
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq13-a11y .fire:hover {
  transform: scale(1.07) rotate(-8deg);
}

.uvq13-a11y .fire svg {
  width: 1.5em;
  height: 1.5em;
}

.uvq13-a11y .pn {
  position: absolute;
  right: .9em;
  top: .9em;
  z-index: 5;
  width: 12.2em;
  padding: .6em .7em;
  box-sizing: border-box;
  border-radius: 1em;
  color: var(--fg);
  background: color-mix(in srgb,var(--fg) 2%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 9%,transparent),0 1.6em 3.2em -1.2em rgba(0,0,0,.5);
  background: var(--bg);
  transform-origin: 100% 100%;
  transform: scale(.85) translateY(1em);
  opacity: 0;
  pointer-events: none;
  transition: transform calc(0.35s / var(--k)) cubic-bezier(.34,1.56,.64,1),opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq13-a11y.hc .pn {
  --fg: #1d1d1f;
  --bg: #f5f5f7;
}

.uvq13-a11y.open .pn {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

.uvq13-a11y header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 .2em .35em;
}

.uvq13-a11y header b {
  font-size: .9em;
}

.uvq13-a11y .x {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: grid;
  place-items: center;
  width: 1.8em;
  height: 1.8em;
  border-radius: 50%;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
}

.uvq13-a11y .x svg {
  width: .9em;
  height: .9em;
}

.uvq13-a11y .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5em;
  box-sizing: border-box;
  width: 100%;
  padding: .36em .4em;
  white-space: nowrap;
  border-radius: .6em;
  font-size: .74em;
  text-align: left;
}

.uvq13-a11y button.row {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  font-size: .74em;
}

.uvq13-a11y button.row:hover {
  background: color-mix(in srgb,var(--fg) 6%,transparent);
}

.uvq13-a11y .sw i {
  position: relative;
  flex: none;
  width: 2.1em;
  height: 1.2em;
  border-radius: 1em;
  background: color-mix(in srgb,var(--fg) 18%,transparent);
  transition: background calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq13-a11y .sw i::before {
  content: "";
  position: absolute;
  left: .15em;
  top: .15em;
  width: .9em;
  height: .9em;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 .1em .2em rgba(0,0,0,.3);
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq13-a11y .sw[aria-checked="true"] i {
  background: var(--c1);
}

.uvq13-a11y .sw[aria-checked="true"] i::before {
  transform: translateX(.9em);
}

.uvq13-a11y .stp {
  display: flex;
  align-items: center;
  gap: .2em;
}

.uvq13-a11y .stp button {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  width: 2em;
  height: 1.8em;
  border-radius: .5em;
  font-weight: 800;
  font-size: .9em;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
}

.uvq13-a11y .stp button:active {
  transform: scale(.92);
}

.uvq13-a11y .stp output {
  min-width: 3em;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.uvq13-a11y .rs {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  width: 100%;
  margin-top: .35em;
  padding: .55em;
  border-radius: .6em;
  font-size: .72em;
  font-weight: 700;
  color: var(--c1);
  background: color-mix(in srgb,var(--c1) 10%,transparent);
}

.uvq13-a11y button:focus-visible,.uvq13-a11y a:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

@keyframes uvq13-a11y-g {
  to {
    background-position: 300% 0;
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq13-a11y,.uvq13-a11y *,.uvq13-a11y *::before,.uvq13-a11y *::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 fire=el.querySelector(".fire"),scr=el.querySelector(".scr"),pnl=el.querySelector(".pn");let tms=[];const later=(f,ms)=>tms.push(setTimeout(f,ms));
const foc=(t,ms)=>later(()=>{const n=typeof t==="string"?el.querySelector(t):t;n&&n.focus({preventScroll:true})},ms||0);
const isOpen=()=>el.classList.contains("open");
const open=u=>{if(isOpen())return;el.classList.add("open");pnl.inert=false;fire&&fire.setAttribute("aria-expanded","true");u&&foc('.pn .stp button',300)};
const close=()=>{if(!isOpen())return;el.classList.remove("open");pnl.inert=true;fire&&fire.setAttribute("aria-expanded","false");;fire&&fire.focus({preventScroll:true})};
fire&&fire.addEventListener("click",()=>isOpen()?close():open(true));scr&&scr.addEventListener("click",()=>close());
el.addEventListener("keydown",e=>{if(!isOpen())return;if(e.key==="Escape"){e.preventDefault();e.stopPropagation();close()}else if(e.key==="Tab"){const f=[...pnl.querySelectorAll('button:not([disabled]),input:not([disabled]),textarea,a[href],[tabindex="0"]')].filter(x=>x.getClientRects().length);if(!f.length){e.preventDefault();return}const a=f[0],z=f[f.length-1],ac=document.activeElement;if(e.shiftKey&&(ac===a||!pnl.contains(ac))){e.preventDefault();z.focus()}else if(!e.shiftKey&&(ac===z||!pnl.contains(ac))){e.preventDefault();a.focus()}}});
pnl.inert=true;later(()=>open(false),500);const out=el.querySelector(".stp output"),sws=[...el.querySelectorAll(".sw")];let ts=1;
const size=d=>{ts=Math.max(.85,Math.min(1.45,+(ts+d).toFixed(2)));el.style.setProperty("--ts",String(ts));out.textContent=Math.round(ts*100)+" %"};
el.querySelector(".stp .dn").addEventListener("click",()=>size(-.15));el.querySelector(".stp .up").addEventListener("click",()=>size(.15));
sws.forEach(b=>b.addEventListener("click",()=>{const on=b.getAttribute("aria-checked")!=="true";b.setAttribute("aria-checked",String(on));el.classList.toggle(b.dataset.k,on)}));
el.querySelector(".rs").addEventListener("click",()=>{ts=1;size(0);sws.forEach(b=>{b.setAttribute("aria-checked","false");el.classList.remove(b.dataset.k)})});
el.querySelector(".pn .x").addEventListener("click",close);el.querySelector(".art a").addEventListener("click",e=>e.preventDefault());
el.addEventListener("pointermove",e=>{if(!el.classList.contains("gd"))return;const s=el.getBoundingClientRect().width/el.offsetWidth||1;el.style.setProperty("--gy",(e.clientY-el.getBoundingClientRect().top)/s+"px")});return()=>tms.forEach(clearTimeout)
}

export default function OvA11yPanel() {
  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": "#0f766e",
          "--c2": "#fde047",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq13-a11y"><article className="art"><p className="kk">Urban garden</p><h4>Tomatoes on a balcony</h4><p className="tx">A two-metre balcony is enough to grow tomatoes, basil and strawberries if it gets six hours of sun a day.</p><a href="#">Read the full guide</a><i className="im" aria-hidden="true"></i></article><i className="rg" aria-hidden="true"></i><button type="button" className="fire" aria-haspopup="dialog" aria-label="Accessibility options"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><circle cx="12" cy="4.5" r="1.8" /><path d="M5 8.5l7 1.5 7-1.5M12 10v4.5M12 14.5l-3 6M12 14.5l3 6" /></svg></button><div className="pn" role="dialog" aria-modal="true" aria-labelledby="uvq13-a11y-t"><header><b id="uvq13-a11y-t">Accessibility</b><button type="button" className="x" aria-label="Close"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M7 7l10 10M17 7L7 17" /></svg></button></header><div className="row"><span>Text size</span><span className="stp"><button type="button" className="dn" aria-label="Decrease text">A−</button><output>100 %</output><button type="button" className="up" aria-label="Increase text">A+</button></span></div><button type="button" className="row sw" role="switch" aria-checked="false" data-k="hc"><span>High contrast</span><i></i></button><button type="button" className="row sw" role="switch" aria-checked="false" data-k="ul"><span>Underline links</span><i></i></button><button type="button" className="row sw" role="switch" aria-checked="false" data-k="sp"><span>Wider spacing</span><i></i></button><button type="button" className="row sw" role="switch" aria-checked="false" data-k="gd"><span>Reading guide</span><i></i></button><button type="button" className="row sw" role="switch" aria-checked="false" data-k="pa"><span>Pause animations</span><i></i></button><button type="button" className="rs">Reset</button></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.
````
