# Vote arrows with rolling digits

> Upvote and downvote arrows: the arrow hops and only the digits that change roll up or down, like a mechanical counter.

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

## Where to use it

Community posts live and die by their vote count, so the number deserves a careful transition. Pressing an arrow fills it with color and makes it hop, and the score updates digit by digit: only the figures that actually change roll, upwards for a vote in favor and downwards for one against. Pressing the same arrow again removes the vote.

The main color marks upvotes and the secondary one downvotes, and the score takes the color of your vote. The post title is the editable text. Switching straight from down to up moves the score by two, as on most forums.

## Code

### HTML

```html
<div class="uvq15-vot"><div class="vb" role="group" aria-label="Votes"><button type="button" class="up" aria-pressed="false" aria-label="Upvote"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 4 4 13h5v7h6v-7h5z"/></svg></button><span class="n" aria-hidden="true">1.284</span><button type="button" class="dn" aria-pressed="false" aria-label="Downvote"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 20 4 11h5V4h6v7h5z"/></svg></button></div><div class="ps"><p class="mt"><span>Design community</span><span>4 h ago</span></p><b>Which typeface do you use for interfaces?</b><p class="tg"><span>Discussion</span><span>86 comments</span></p></div><p class="sr" aria-live="polite"></p></div>
```

### CSS

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

.uvq15-vot {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  border-radius: 1.3em;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 10%,transparent),0 1.4em 2.6em -1.8em rgba(0,0,0,.35);
  display: flex;
  gap: .9em;
  width: 20em;
  padding: 1em;
}

.uvq15-vot .vb {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .1em;
  padding: .3em;
  border-radius: 2em;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
}

.uvq15-vot .vb button {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: grid;
  place-items: center;
  width: 2.2em;
  height: 2.2em;
  border-radius: 50%;
  color: color-mix(in srgb,var(--fg) 55%,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);
}

.uvq15-vot .vb button:hover {
  background: color-mix(in srgb,var(--fg) 6%,transparent);
  color: var(--fg);
}

.uvq15-vot .vb button:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq15-vot .vb svg {
  width: 1.25em;
  height: 1.25em;
  fill: transparent;
  transition: fill calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq15-vot .vb .up[aria-pressed="true"] {
  color: var(--c1);
}

.uvq15-vot .vb .dn[aria-pressed="true"] {
  color: var(--c2);
}

.uvq15-vot button[aria-pressed="true"] svg {
  fill: currentColor;
}

.uvq15-vot .up.go svg {
  animation: uvq15-vot-u calc(0.45s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq15-vot .dn.go svg {
  animation: uvq15-vot-d calc(0.45s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

@keyframes uvq15-vot-u {
  40% {
    transform: translateY(-.35em) scale(1.15);
  }
}

@keyframes uvq15-vot-d {
  40% {
    transform: translateY(.35em) scale(1.15);
  }
}

.uvq15-vot .n {
  display: flex;
  font-size: .85em;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  transition: color calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq15-vot.vu .n {
  color: var(--c1);
}

.uvq15-vot.vd .n {
  color: var(--c2);
}

.uvq15-vot .n .c {
  position: relative;
  display: block;
  height: 1.3em;
  overflow: hidden;
}

.uvq15-vot .n i {
  display: block;
  font-style: normal;
}

.uvq15-vot .n .o {
  position: absolute;
  left: 0;
  top: 0;
}

.uvq15-vot .n.u .nw {
  animation: uvq15-vot-iu calc(0.4s / var(--k)) cubic-bezier(.22,1,.36,1) both;
}

.uvq15-vot .n.u .o {
  animation: uvq15-vot-ou calc(0.4s / var(--k)) cubic-bezier(.22,1,.36,1) both;
}

.uvq15-vot .n.d .nw {
  animation: uvq15-vot-id calc(0.4s / var(--k)) cubic-bezier(.22,1,.36,1) both;
}

.uvq15-vot .n.d .o {
  animation: uvq15-vot-od calc(0.4s / var(--k)) cubic-bezier(.22,1,.36,1) both;
}

@keyframes uvq15-vot-iu {
  from {
    transform: translateY(100%);
  }
}

@keyframes uvq15-vot-ou {
  to {
    transform: translateY(-100%);
  }
}

@keyframes uvq15-vot-id {
  from {
    transform: translateY(-100%);
  }
}

@keyframes uvq15-vot-od {
  to {
    transform: translateY(100%);
  }
}

.uvq15-vot .ps {
  display: grid;
  align-content: center;
  gap: .4em;
  min-width: 0;
}

.uvq15-vot .mt,.uvq15-vot .tg {
  display: flex;
  flex-wrap: wrap;
  gap: .3em .7em;
  margin: 0;
  font-size: .72em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq15-vot .ps b {
  font-size: 1em;
  line-height: 1.3;
}

.uvq15-vot .tg span:first-child {
  padding: .15em .6em;
  border-radius: 1em;
  font-weight: 700;
  color: var(--c1);
  background: color-mix(in srgb,var(--c1) 14%,transparent);
}

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

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

### JavaScript

```js
document.querySelectorAll(".uvq15-vot").forEach(el => {
  const k=parseFloat(getComputedStyle(el).getPropertyValue("--k"))||1,rm=matchMedia("(prefers-reduced-motion:reduce)").matches;const up=el.querySelector(".up"),dn=el.querySelector(".dn"),n=el.querySelector(".n"),sr=el.querySelector(".sr"),base=1284;let s=0;const f=x=>x.toLocaleString("de-DE");
const draw=(o,v)=>{const a=f(o),b=f(v),L=Math.max(a.length,b.length),pa=a.padStart(L," "),pb=b.padStart(L," ");n.textContent="";n.className="n "+(v>=o?"u":"d");
for(let i=0;i<L;i++){if(pb[i]===" ")continue;const c=document.createElement("span"),ni=document.createElement("i");c.className="c";ni.textContent=pb[i];c.appendChild(ni);if(pa[i]!==pb[i]&&!rm){ni.className="nw";const oi=document.createElement("i");oi.className="or";oi.textContent=pa[i].trim();c.appendChild(oi)}n.appendChild(c)}};
const vote=d=>{const o=base+s;s=s===d?0:d;draw(o,base+s);up.setAttribute("aria-pressed",String(s===1));dn.setAttribute("aria-pressed",String(s===-1));el.classList.toggle("vu",s===1);el.classList.toggle("vd",s===-1);
const b=d>0?up:dn;b.classList.remove("go");void b.offsetWidth;if(s===d)b.classList.add("go");sr.textContent=f(base+s)};
up.addEventListener("click",()=>vote(1));dn.addEventListener("click",()=>vote(-1))
});
```

### 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-vot {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  border-radius: 1.3em;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 10%,transparent),0 1.4em 2.6em -1.8em rgba(0,0,0,.35);
  display: flex;
  gap: .9em;
  width: 20em;
  padding: 1em;
}

.uvq15-vot .vb {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .1em;
  padding: .3em;
  border-radius: 2em;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
}

.uvq15-vot .vb button {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: grid;
  place-items: center;
  width: 2.2em;
  height: 2.2em;
  border-radius: 50%;
  color: color-mix(in srgb,var(--fg) 55%,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);
}

.uvq15-vot .vb button:hover {
  background: color-mix(in srgb,var(--fg) 6%,transparent);
  color: var(--fg);
}

.uvq15-vot .vb button:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq15-vot .vb svg {
  width: 1.25em;
  height: 1.25em;
  fill: transparent;
  transition: fill calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq15-vot .vb .up[aria-pressed="true"] {
  color: var(--c1);
}

.uvq15-vot .vb .dn[aria-pressed="true"] {
  color: var(--c2);
}

.uvq15-vot button[aria-pressed="true"] svg {
  fill: currentColor;
}

.uvq15-vot .up.go svg {
  animation: uvq15-vot-u calc(0.45s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq15-vot .dn.go svg {
  animation: uvq15-vot-d calc(0.45s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

@keyframes uvq15-vot-u {
  40% {
    transform: translateY(-.35em) scale(1.15);
  }
}

@keyframes uvq15-vot-d {
  40% {
    transform: translateY(.35em) scale(1.15);
  }
}

.uvq15-vot .n {
  display: flex;
  font-size: .85em;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  transition: color calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq15-vot.vu .n {
  color: var(--c1);
}

.uvq15-vot.vd .n {
  color: var(--c2);
}

.uvq15-vot .n .c {
  position: relative;
  display: block;
  height: 1.3em;
  overflow: hidden;
}

.uvq15-vot .n i {
  display: block;
  font-style: normal;
}

.uvq15-vot .n .o {
  position: absolute;
  left: 0;
  top: 0;
}

.uvq15-vot .n.u .nw {
  animation: uvq15-vot-iu calc(0.4s / var(--k)) cubic-bezier(.22,1,.36,1) both;
}

.uvq15-vot .n.u .o {
  animation: uvq15-vot-ou calc(0.4s / var(--k)) cubic-bezier(.22,1,.36,1) both;
}

.uvq15-vot .n.d .nw {
  animation: uvq15-vot-id calc(0.4s / var(--k)) cubic-bezier(.22,1,.36,1) both;
}

.uvq15-vot .n.d .o {
  animation: uvq15-vot-od calc(0.4s / var(--k)) cubic-bezier(.22,1,.36,1) both;
}

@keyframes uvq15-vot-iu {
  from {
    transform: translateY(100%);
  }
}

@keyframes uvq15-vot-ou {
  to {
    transform: translateY(-100%);
  }
}

@keyframes uvq15-vot-id {
  from {
    transform: translateY(-100%);
  }
}

@keyframes uvq15-vot-od {
  to {
    transform: translateY(100%);
  }
}

.uvq15-vot .ps {
  display: grid;
  align-content: center;
  gap: .4em;
  min-width: 0;
}

.uvq15-vot .mt,.uvq15-vot .tg {
  display: flex;
  flex-wrap: wrap;
  gap: .3em .7em;
  margin: 0;
  font-size: .72em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq15-vot .ps b {
  font-size: 1em;
  line-height: 1.3;
}

.uvq15-vot .tg span:first-child {
  padding: .15em .6em;
  border-radius: 1em;
  font-weight: 700;
  color: var(--c1);
  background: color-mix(in srgb,var(--c1) 14%,transparent);
}

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

@media (prefers-reduced-motion:reduce) {
  .uvq15-vot,.uvq15-vot *,.uvq15-vot *::before,.uvq15-vot *::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 up=el.querySelector(".up"),dn=el.querySelector(".dn"),n=el.querySelector(".n"),sr=el.querySelector(".sr"),base=1284;let s=0;const f=x=>x.toLocaleString("de-DE");
const draw=(o,v)=>{const a=f(o),b=f(v),L=Math.max(a.length,b.length),pa=a.padStart(L," "),pb=b.padStart(L," ");n.textContent="";n.className="n "+(v>=o?"u":"d");
for(let i=0;i<L;i++){if(pb[i]===" ")continue;const c=document.createElement("span"),ni=document.createElement("i");c.className="c";ni.textContent=pb[i];c.appendChild(ni);if(pa[i]!==pb[i]&&!rm){ni.className="nw";const oi=document.createElement("i");oi.className="or";oi.textContent=pa[i].trim();c.appendChild(oi)}n.appendChild(c)}};
const vote=d=>{const o=base+s;s=s===d?0:d;draw(o,base+s);up.setAttribute("aria-pressed",String(s===1));dn.setAttribute("aria-pressed",String(s===-1));el.classList.toggle("vu",s===1);el.classList.toggle("vd",s===-1);
const b=d>0?up:dn;b.classList.remove("go");void b.offsetWidth;if(s===d)b.classList.add("go");sr.textContent=f(base+s)};
up.addEventListener("click",()=>vote(1));dn.addEventListener("click",()=>vote(-1))
}

export default function Mi27VoteRoll() {
  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": "#f97316",
          "--c2": "#6366f1",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq15-vot"><div className="vb" role="group" aria-label="Votes"><button type="button" className="up" aria-pressed="false" aria-label="Upvote"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.9" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M12 4 4 13h5v7h6v-7h5z" /></svg></button><span className="n" aria-hidden="true">1.284</span><button type="button" className="dn" aria-pressed="false" aria-label="Downvote"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.9" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M12 20 4 11h5V4h6v7h5z" /></svg></button></div><div className="ps"><p className="mt"><span>Design community</span><span>4 h ago</span></p><b>Which typeface do you use for interfaces?</b><p className="tg"><span>Discussion</span><span>86 comments</span></p></div><p className="sr" aria-live="polite"></p></div>
      </div>
    </>
  );
}
```

## Prompt for AI assistants

Paste this into ChatGPT, Claude, Cursor, v0 or Lovable to adapt the block to your stack (Tailwind, Vue, Svelte…):

````text
I want to add the “Vote arrows with rolling digits” block (Microinteractions) from AIMRAN Library to my project.

## What it is
Upvote and downvote arrows: the arrow hops and only the digits that change roll up or down, like a mechanical counter.

## Chosen settings
- Main color: #f97316
- Secondary color: #6366f1
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "¿Qué tipografía usáis para interfaces?"

## 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-vot {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  border-radius: 1.3em;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 10%,transparent),0 1.4em 2.6em -1.8em rgba(0,0,0,.35);
  display: flex;
  gap: .9em;
  width: 20em;
  padding: 1em;
}

.uvq15-vot .vb {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .1em;
  padding: .3em;
  border-radius: 2em;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
}

.uvq15-vot .vb button {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: grid;
  place-items: center;
  width: 2.2em;
  height: 2.2em;
  border-radius: 50%;
  color: color-mix(in srgb,var(--fg) 55%,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);
}

.uvq15-vot .vb button:hover {
  background: color-mix(in srgb,var(--fg) 6%,transparent);
  color: var(--fg);
}

.uvq15-vot .vb button:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq15-vot .vb svg {
  width: 1.25em;
  height: 1.25em;
  fill: transparent;
  transition: fill calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq15-vot .vb .up[aria-pressed="true"] {
  color: var(--c1);
}

.uvq15-vot .vb .dn[aria-pressed="true"] {
  color: var(--c2);
}

.uvq15-vot button[aria-pressed="true"] svg {
  fill: currentColor;
}

.uvq15-vot .up.go svg {
  animation: uvq15-vot-u calc(0.45s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq15-vot .dn.go svg {
  animation: uvq15-vot-d calc(0.45s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

@keyframes uvq15-vot-u {
  40% {
    transform: translateY(-.35em) scale(1.15);
  }
}

@keyframes uvq15-vot-d {
  40% {
    transform: translateY(.35em) scale(1.15);
  }
}

.uvq15-vot .n {
  display: flex;
  font-size: .85em;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  transition: color calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq15-vot.vu .n {
  color: var(--c1);
}

.uvq15-vot.vd .n {
  color: var(--c2);
}

.uvq15-vot .n .c {
  position: relative;
  display: block;
  height: 1.3em;
  overflow: hidden;
}

.uvq15-vot .n i {
  display: block;
  font-style: normal;
}

.uvq15-vot .n .o {
  position: absolute;
  left: 0;
  top: 0;
}

.uvq15-vot .n.u .nw {
  animation: uvq15-vot-iu calc(0.4s / var(--k)) cubic-bezier(.22,1,.36,1) both;
}

.uvq15-vot .n.u .o {
  animation: uvq15-vot-ou calc(0.4s / var(--k)) cubic-bezier(.22,1,.36,1) both;
}

.uvq15-vot .n.d .nw {
  animation: uvq15-vot-id calc(0.4s / var(--k)) cubic-bezier(.22,1,.36,1) both;
}

.uvq15-vot .n.d .o {
  animation: uvq15-vot-od calc(0.4s / var(--k)) cubic-bezier(.22,1,.36,1) both;
}

@keyframes uvq15-vot-iu {
  from {
    transform: translateY(100%);
  }
}

@keyframes uvq15-vot-ou {
  to {
    transform: translateY(-100%);
  }
}

@keyframes uvq15-vot-id {
  from {
    transform: translateY(-100%);
  }
}

@keyframes uvq15-vot-od {
  to {
    transform: translateY(100%);
  }
}

.uvq15-vot .ps {
  display: grid;
  align-content: center;
  gap: .4em;
  min-width: 0;
}

.uvq15-vot .mt,.uvq15-vot .tg {
  display: flex;
  flex-wrap: wrap;
  gap: .3em .7em;
  margin: 0;
  font-size: .72em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq15-vot .ps b {
  font-size: 1em;
  line-height: 1.3;
}

.uvq15-vot .tg span:first-child {
  padding: .15em .6em;
  border-radius: 1em;
  font-weight: 700;
  color: var(--c1);
  background: color-mix(in srgb,var(--c1) 14%,transparent);
}

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

@media (prefers-reduced-motion:reduce) {
  .uvq15-vot,.uvq15-vot *,.uvq15-vot *::before,.uvq15-vot *::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 up=el.querySelector(".up"),dn=el.querySelector(".dn"),n=el.querySelector(".n"),sr=el.querySelector(".sr"),base=1284;let s=0;const f=x=>x.toLocaleString("de-DE");
const draw=(o,v)=>{const a=f(o),b=f(v),L=Math.max(a.length,b.length),pa=a.padStart(L," "),pb=b.padStart(L," ");n.textContent="";n.className="n "+(v>=o?"u":"d");
for(let i=0;i<L;i++){if(pb[i]===" ")continue;const c=document.createElement("span"),ni=document.createElement("i");c.className="c";ni.textContent=pb[i];c.appendChild(ni);if(pa[i]!==pb[i]&&!rm){ni.className="nw";const oi=document.createElement("i");oi.className="or";oi.textContent=pa[i].trim();c.appendChild(oi)}n.appendChild(c)}};
const vote=d=>{const o=base+s;s=s===d?0:d;draw(o,base+s);up.setAttribute("aria-pressed",String(s===1));dn.setAttribute("aria-pressed",String(s===-1));el.classList.toggle("vu",s===1);el.classList.toggle("vd",s===-1);
const b=d>0?up:dn;b.classList.remove("go");void b.offsetWidth;if(s===d)b.classList.add("go");sr.textContent=f(base+s)};
up.addEventListener("click",()=>vote(1));dn.addEventListener("click",()=>vote(-1))
}

export default function Mi27VoteRoll() {
  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": "#f97316",
          "--c2": "#6366f1",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq15-vot"><div className="vb" role="group" aria-label="Votes"><button type="button" className="up" aria-pressed="false" aria-label="Upvote"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.9" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M12 4 4 13h5v7h6v-7h5z" /></svg></button><span className="n" aria-hidden="true">1.284</span><button type="button" className="dn" aria-pressed="false" aria-label="Downvote"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.9" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M12 20 4 11h5V4h6v7h5z" /></svg></button></div><div className="ps"><p className="mt"><span>Design community</span><span>4 h ago</span></p><b>Which typeface do you use for interfaces?</b><p className="tg"><span>Discussion</span><span>86 comments</span></p></div><p className="sr" aria-live="polite"></p></div>
      </div>
    </>
  );
}
```

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