# Press and hold smart lock

> A smart lock card: hold the button, the ring fills, the shackle pops open and it locks itself again a few seconds later.

- Category: [Cards](https://library.aimran.es/components/cards)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-card-smart-lock
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

Unlocking a door should take a deliberate gesture, and press and hold is the classic answer. A ring around the lock fills while you hold with pointer, Space or Enter, releasing early rewinds it, and completing it pops the shackle with a springy curve before the ring drains as an auto-lock timer. Good for smart home apps, access control and any confirm action.

The main color is the progress ring and open state, the second the graphite card. Change the hold time in the CSS transition and the relock delay in the script.

## Code

### HTML

```html
<article class="uvq07-lck"><header><div><h3>Front door</h3><p class="st"><i></i><span aria-live="polite" data-a="Locked" data-b="Unlocked">Locked</span></p></div><span class="bt"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="7" width="16" height="10" rx="2"/><path d="M21 10.5v3"/><rect x="5" y="9" width="10" height="6" rx="1" fill="currentColor" stroke="none"/></svg>86 %</span></header><button type="button" class="hb" aria-label="Press and hold to unlock"><svg class="rg" viewBox="0 0 100 100" aria-hidden="true"><circle class="tr" cx="50" cy="50" r="46"/><circle class="pr" cx="50" cy="50" r="46" pathLength="1"/></svg><svg class="lk" viewBox="0 0 24 24" aria-hidden="true"><path class="sh" d="M8 11V7.5a4 4 0 0 1 8 0V11"/><rect x="5" y="11" width="14" height="10" rx="2.5"/><circle cx="12" cy="16" r="1.3"/></svg></button><p class="hn"><span class="h1">Press and hold to unlock</span><span class="h2">It will lock itself in a few seconds</span></p><footer>Last opened: Marta, 18:04</footer></article>
```

### CSS

```css
.uvq07-lck {
  --c1: #22c58b;
  --c2: #1d2126;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq07-lck {
  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;
  width: 16em;
  padding: 1.2em;
  border-radius: 1.6em;
  text-align: center;
  color: #eef1f4;
  background: radial-gradient(90% 60% at 50% 0%,rgba(255,255,255,.07),transparent 70%),var(--c2);
  box-shadow: 0 1.4em 2.4em -1.2em rgba(0,0,0,.7),inset 0 1px 0 rgba(255,255,255,.08),0 0 0 1px color-mix(in srgb,var(--fg) 8%,transparent);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.uvq07-lck header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  text-align: left;
}

.uvq07-lck h3 {
  margin: 0;
  font-size: .98em;
  font-weight: 700;
}

.uvq07-lck .st {
  display: flex;
  align-items: center;
  gap: .4em;
  margin: .25em 0 0;
  font-size: .76em;
  color: rgba(238,241,244,.65);
}

.uvq07-lck .st i {
  width: .5em;
  height: .5em;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 .5em #f59e0b;
}

.uvq07-lck.op .st i {
  background: var(--c1);
  box-shadow: 0 0 .5em var(--c1);
}

.uvq07-lck .bt {
  display: inline-flex;
  align-items: center;
  gap: .3em;
  font-size: .72em;
  color: rgba(238,241,244,.6);
}

.uvq07-lck .bt svg {
  width: 1.4em;
  height: 1.4em;
}

.uvq07-lck .hb {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  display: grid;
  place-items: center;
  width: 7.2em;
  height: 7.2em;
  margin: 1.3em auto .9em;
  border-radius: 50%;
  touch-action: none;
  color: #eef1f4;
  background: radial-gradient(circle at 50% 35%,rgba(255,255,255,.1),rgba(255,255,255,.02) 70%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
  transition: transform calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-lck .hb:hover {
  background: radial-gradient(circle at 50% 35%,rgba(255,255,255,.14),rgba(255,255,255,.03) 70%);
}

.uvq07-lck.hd .hb {
  transform: scale(.95);
}

.uvq07-lck .hb:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq07-lck .rg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.uvq07-lck .rg circle {
  fill: none;
  stroke-width: 4;
}

.uvq07-lck .tr {
  stroke: rgba(255,255,255,.08);
}

.uvq07-lck .pr {
  stroke: var(--c1);
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset calc(0.35s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-lck.hd .pr {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset calc(1.1s / var(--k)) linear;
}

.uvq07-lck.op .pr {
  stroke-dashoffset: 0;
  animation: uvq07-lck-d calc(5s / var(--k)) linear forwards;
}

.uvq07-lck .lk {
  width: 2.6em;
  height: 2.6em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: color calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-lck .lk circle {
  fill: currentColor;
  stroke: none;
}

.uvq07-lck .sh {
  transform-box: fill-box;
  transform-origin: 100% 100%;
  transition: transform calc(0.45s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq07-lck.op .hb {
  color: var(--c1);
  animation: uvq07-lck-p calc(0.5s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq07-lck.op .sh {
  transform: translateY(-2.5px) rotate(-18deg);
}

.uvq07-lck .hn {
  display: grid;
  margin: 0;
  font-size: .78em;
  color: rgba(238,241,244,.7);
}

.uvq07-lck .hn span {
  grid-area: 1/1;
  transition: opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-lck .h2,.uvq07-lck.op .h1 {
  opacity: 0;
}

.uvq07-lck.op .h2 {
  opacity: 1;
}

.uvq07-lck footer {
  margin-top: 1em;
  padding-top: .8em;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: .7em;
  color: rgba(238,241,244,.5);
}

@keyframes uvq07-lck-d {
  to {
    stroke-dashoffset: 1;
  }
}

@keyframes uvq07-lck-p {
  40% {
    transform: scale(1.07);
  }
}

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

### JavaScript

```js
document.querySelectorAll(".uvq07-lck").forEach(el => {
  const hb=el.querySelector(".hb"),pr=el.querySelector(".pr"),sv=el.querySelector(".st span");let tm=0;
const lock=()=>{el.classList.remove("op");sv.textContent=sv.dataset.a};
const start=()=>{if(!el.classList.contains("op"))el.classList.add("hd")};const stop=()=>el.classList.remove("hd");
pr.addEventListener("transitionend",()=>{if(!el.classList.contains("hd"))return;el.classList.remove("hd");el.classList.add("op");sv.textContent=sv.dataset.b;if(navigator.vibrate)navigator.vibrate(30);clearTimeout(tm);tm=setTimeout(lock,5000/(parseFloat(getComputedStyle(el).getPropertyValue("--k"))||1))});
hb.addEventListener("pointerdown",e=>{hb.setPointerCapture(e.pointerId);start()});["pointerup","pointercancel","lostpointercapture"].forEach(t=>hb.addEventListener(t,stop));
hb.addEventListener("keydown",e=>{if((e.key===" "||e.key==="Enter")&&!e.repeat){e.preventDefault();start()}});hb.addEventListener("keyup",e=>{if(e.key===" "||e.key==="Enter")stop()});
hb.addEventListener("contextmenu",e=>e.preventDefault());return()=>clearTimeout(tm)
});
```

### 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 = `
.uvq07-lck {
  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;
  width: 16em;
  padding: 1.2em;
  border-radius: 1.6em;
  text-align: center;
  color: #eef1f4;
  background: radial-gradient(90% 60% at 50% 0%,rgba(255,255,255,.07),transparent 70%),var(--c2);
  box-shadow: 0 1.4em 2.4em -1.2em rgba(0,0,0,.7),inset 0 1px 0 rgba(255,255,255,.08),0 0 0 1px color-mix(in srgb,var(--fg) 8%,transparent);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.uvq07-lck header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  text-align: left;
}

.uvq07-lck h3 {
  margin: 0;
  font-size: .98em;
  font-weight: 700;
}

.uvq07-lck .st {
  display: flex;
  align-items: center;
  gap: .4em;
  margin: .25em 0 0;
  font-size: .76em;
  color: rgba(238,241,244,.65);
}

.uvq07-lck .st i {
  width: .5em;
  height: .5em;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 .5em #f59e0b;
}

.uvq07-lck.op .st i {
  background: var(--c1);
  box-shadow: 0 0 .5em var(--c1);
}

.uvq07-lck .bt {
  display: inline-flex;
  align-items: center;
  gap: .3em;
  font-size: .72em;
  color: rgba(238,241,244,.6);
}

.uvq07-lck .bt svg {
  width: 1.4em;
  height: 1.4em;
}

.uvq07-lck .hb {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  display: grid;
  place-items: center;
  width: 7.2em;
  height: 7.2em;
  margin: 1.3em auto .9em;
  border-radius: 50%;
  touch-action: none;
  color: #eef1f4;
  background: radial-gradient(circle at 50% 35%,rgba(255,255,255,.1),rgba(255,255,255,.02) 70%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
  transition: transform calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-lck .hb:hover {
  background: radial-gradient(circle at 50% 35%,rgba(255,255,255,.14),rgba(255,255,255,.03) 70%);
}

.uvq07-lck.hd .hb {
  transform: scale(.95);
}

.uvq07-lck .hb:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq07-lck .rg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.uvq07-lck .rg circle {
  fill: none;
  stroke-width: 4;
}

.uvq07-lck .tr {
  stroke: rgba(255,255,255,.08);
}

.uvq07-lck .pr {
  stroke: var(--c1);
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset calc(0.35s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-lck.hd .pr {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset calc(1.1s / var(--k)) linear;
}

.uvq07-lck.op .pr {
  stroke-dashoffset: 0;
  animation: uvq07-lck-d calc(5s / var(--k)) linear forwards;
}

.uvq07-lck .lk {
  width: 2.6em;
  height: 2.6em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: color calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-lck .lk circle {
  fill: currentColor;
  stroke: none;
}

.uvq07-lck .sh {
  transform-box: fill-box;
  transform-origin: 100% 100%;
  transition: transform calc(0.45s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq07-lck.op .hb {
  color: var(--c1);
  animation: uvq07-lck-p calc(0.5s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq07-lck.op .sh {
  transform: translateY(-2.5px) rotate(-18deg);
}

.uvq07-lck .hn {
  display: grid;
  margin: 0;
  font-size: .78em;
  color: rgba(238,241,244,.7);
}

.uvq07-lck .hn span {
  grid-area: 1/1;
  transition: opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-lck .h2,.uvq07-lck.op .h1 {
  opacity: 0;
}

.uvq07-lck.op .h2 {
  opacity: 1;
}

.uvq07-lck footer {
  margin-top: 1em;
  padding-top: .8em;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: .7em;
  color: rgba(238,241,244,.5);
}

@keyframes uvq07-lck-d {
  to {
    stroke-dashoffset: 1;
  }
}

@keyframes uvq07-lck-p {
  40% {
    transform: scale(1.07);
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq07-lck,.uvq07-lck *,.uvq07-lck *::before,.uvq07-lck *::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 hb=el.querySelector(".hb"),pr=el.querySelector(".pr"),sv=el.querySelector(".st span");let tm=0;
const lock=()=>{el.classList.remove("op");sv.textContent=sv.dataset.a};
const start=()=>{if(!el.classList.contains("op"))el.classList.add("hd")};const stop=()=>el.classList.remove("hd");
pr.addEventListener("transitionend",()=>{if(!el.classList.contains("hd"))return;el.classList.remove("hd");el.classList.add("op");sv.textContent=sv.dataset.b;if(navigator.vibrate)navigator.vibrate(30);clearTimeout(tm);tm=setTimeout(lock,5000/(parseFloat(getComputedStyle(el).getPropertyValue("--k"))||1))});
hb.addEventListener("pointerdown",e=>{hb.setPointerCapture(e.pointerId);start()});["pointerup","pointercancel","lostpointercapture"].forEach(t=>hb.addEventListener(t,stop));
hb.addEventListener("keydown",e=>{if((e.key===" "||e.key==="Enter")&&!e.repeat){e.preventDefault();start()}});hb.addEventListener("keyup",e=>{if(e.key===" "||e.key==="Enter")stop()});
hb.addEventListener("contextmenu",e=>e.preventDefault());return()=>clearTimeout(tm)
}

export default function CardSmartLock() {
  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": "#22c58b",
          "--c2": "#1d2126",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <article className="uvq07-lck"><header><div><h3>Front door</h3><p className="st"><i></i><span aria-live="polite" data-a="Locked" data-b="Unlocked">Locked</span></p></div><span className="bt"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><rect x="3" y="7" width="16" height="10" rx="2" /><path d="M21 10.5v3" /><rect x="5" y="9" width="10" height="6" rx="1" fill="currentColor" stroke="none" /></svg>86 %</span></header><button type="button" className="hb" aria-label="Press and hold to unlock"><svg className="rg" viewBox="0 0 100 100" aria-hidden="true"><circle className="tr" cx="50" cy="50" r="46" /><circle className="pr" cx="50" cy="50" r="46" pathLength="1" /></svg><svg className="lk" viewBox="0 0 24 24" aria-hidden="true"><path className="sh" d="M8 11V7.5a4 4 0 0 1 8 0V11" /><rect x="5" y="11" width="14" height="10" rx="2.5" /><circle cx="12" cy="16" r="1.3" /></svg></button><p className="hn"><span className="h1">Press and hold to unlock</span><span className="h2">It will lock itself in a few seconds</span></p><footer>Last opened: Marta, 18:04</footer></article>
      </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 “Press and hold smart lock” block (Cards) from AIMRAN Library to my project.

## What it is
A smart lock card: hold the button, the ring fills, the shackle pops open and it locks itself again a few seconds later.

## Chosen settings
- Main color: #22c58b
- Secondary color: #1d2126
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Puerta principal"

## 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 = `
.uvq07-lck {
  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;
  width: 16em;
  padding: 1.2em;
  border-radius: 1.6em;
  text-align: center;
  color: #eef1f4;
  background: radial-gradient(90% 60% at 50% 0%,rgba(255,255,255,.07),transparent 70%),var(--c2);
  box-shadow: 0 1.4em 2.4em -1.2em rgba(0,0,0,.7),inset 0 1px 0 rgba(255,255,255,.08),0 0 0 1px color-mix(in srgb,var(--fg) 8%,transparent);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.uvq07-lck header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  text-align: left;
}

.uvq07-lck h3 {
  margin: 0;
  font-size: .98em;
  font-weight: 700;
}

.uvq07-lck .st {
  display: flex;
  align-items: center;
  gap: .4em;
  margin: .25em 0 0;
  font-size: .76em;
  color: rgba(238,241,244,.65);
}

.uvq07-lck .st i {
  width: .5em;
  height: .5em;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 .5em #f59e0b;
}

.uvq07-lck.op .st i {
  background: var(--c1);
  box-shadow: 0 0 .5em var(--c1);
}

.uvq07-lck .bt {
  display: inline-flex;
  align-items: center;
  gap: .3em;
  font-size: .72em;
  color: rgba(238,241,244,.6);
}

.uvq07-lck .bt svg {
  width: 1.4em;
  height: 1.4em;
}

.uvq07-lck .hb {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  display: grid;
  place-items: center;
  width: 7.2em;
  height: 7.2em;
  margin: 1.3em auto .9em;
  border-radius: 50%;
  touch-action: none;
  color: #eef1f4;
  background: radial-gradient(circle at 50% 35%,rgba(255,255,255,.1),rgba(255,255,255,.02) 70%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
  transition: transform calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-lck .hb:hover {
  background: radial-gradient(circle at 50% 35%,rgba(255,255,255,.14),rgba(255,255,255,.03) 70%);
}

.uvq07-lck.hd .hb {
  transform: scale(.95);
}

.uvq07-lck .hb:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq07-lck .rg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.uvq07-lck .rg circle {
  fill: none;
  stroke-width: 4;
}

.uvq07-lck .tr {
  stroke: rgba(255,255,255,.08);
}

.uvq07-lck .pr {
  stroke: var(--c1);
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset calc(0.35s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-lck.hd .pr {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset calc(1.1s / var(--k)) linear;
}

.uvq07-lck.op .pr {
  stroke-dashoffset: 0;
  animation: uvq07-lck-d calc(5s / var(--k)) linear forwards;
}

.uvq07-lck .lk {
  width: 2.6em;
  height: 2.6em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: color calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-lck .lk circle {
  fill: currentColor;
  stroke: none;
}

.uvq07-lck .sh {
  transform-box: fill-box;
  transform-origin: 100% 100%;
  transition: transform calc(0.45s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq07-lck.op .hb {
  color: var(--c1);
  animation: uvq07-lck-p calc(0.5s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq07-lck.op .sh {
  transform: translateY(-2.5px) rotate(-18deg);
}

.uvq07-lck .hn {
  display: grid;
  margin: 0;
  font-size: .78em;
  color: rgba(238,241,244,.7);
}

.uvq07-lck .hn span {
  grid-area: 1/1;
  transition: opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-lck .h2,.uvq07-lck.op .h1 {
  opacity: 0;
}

.uvq07-lck.op .h2 {
  opacity: 1;
}

.uvq07-lck footer {
  margin-top: 1em;
  padding-top: .8em;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: .7em;
  color: rgba(238,241,244,.5);
}

@keyframes uvq07-lck-d {
  to {
    stroke-dashoffset: 1;
  }
}

@keyframes uvq07-lck-p {
  40% {
    transform: scale(1.07);
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq07-lck,.uvq07-lck *,.uvq07-lck *::before,.uvq07-lck *::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 hb=el.querySelector(".hb"),pr=el.querySelector(".pr"),sv=el.querySelector(".st span");let tm=0;
const lock=()=>{el.classList.remove("op");sv.textContent=sv.dataset.a};
const start=()=>{if(!el.classList.contains("op"))el.classList.add("hd")};const stop=()=>el.classList.remove("hd");
pr.addEventListener("transitionend",()=>{if(!el.classList.contains("hd"))return;el.classList.remove("hd");el.classList.add("op");sv.textContent=sv.dataset.b;if(navigator.vibrate)navigator.vibrate(30);clearTimeout(tm);tm=setTimeout(lock,5000/(parseFloat(getComputedStyle(el).getPropertyValue("--k"))||1))});
hb.addEventListener("pointerdown",e=>{hb.setPointerCapture(e.pointerId);start()});["pointerup","pointercancel","lostpointercapture"].forEach(t=>hb.addEventListener(t,stop));
hb.addEventListener("keydown",e=>{if((e.key===" "||e.key==="Enter")&&!e.repeat){e.preventDefault();start()}});hb.addEventListener("keyup",e=>{if(e.key===" "||e.key==="Enter")stop()});
hb.addEventListener("contextmenu",e=>e.preventDefault());return()=>clearTimeout(tm)
}

export default function CardSmartLock() {
  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": "#22c58b",
          "--c2": "#1d2126",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <article className="uvq07-lck"><header><div><h3>Front door</h3><p className="st"><i></i><span aria-live="polite" data-a="Locked" data-b="Unlocked">Locked</span></p></div><span className="bt"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><rect x="3" y="7" width="16" height="10" rx="2" /><path d="M21 10.5v3" /><rect x="5" y="9" width="10" height="6" rx="1" fill="currentColor" stroke="none" /></svg>86 %</span></header><button type="button" className="hb" aria-label="Press and hold to unlock"><svg className="rg" viewBox="0 0 100 100" aria-hidden="true"><circle className="tr" cx="50" cy="50" r="46" /><circle className="pr" cx="50" cy="50" r="46" pathLength="1" /></svg><svg className="lk" viewBox="0 0 24 24" aria-hidden="true"><path className="sh" d="M8 11V7.5a4 4 0 0 1 8 0V11" /><rect x="5" y="11" width="14" height="10" rx="2.5" /><circle cx="12" cy="16" r="1.3" /></svg></button><p className="hn"><span className="h1">Press and hold to unlock</span><span className="h2">It will lock itself in a few seconds</span></p><footer>Last opened: Marta, 18:04</footer></article>
      </div>
    </>
  );
}
```

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