# Retro difficulty menu

> An 8-bit console screen with scanlines: a pixel cursor blinks next to the chosen difficulty.

- Category: [Radio buttons](https://library.aimran.es/components/radios)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-rd-pixel-menu
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

This radio group is the difficulty screen of an old home console, drawn on a curved CRT with scanlines, a slight flicker and a deep vignette. A stepped pixel arrow blinks beside the chosen level, its name glows yellow and a row of pink blocks shows how hard it is. It works for games, gamified courses, challenge levels and nostalgic landing pages.

The main color is the cursor and the chosen text, the secondary one the title and difficulty blocks. Keep the labels in capitals and under ten letters so they stay on one line, and change the blinking hint at the bottom to fit your controls.

## Code

### HTML

```html
<fieldset class="uvq04-px"><legend>Difficulty</legend><label><input type="radio" name="uvq04-px"><i class="cu" aria-hidden="true"></i><span class="tx">Easy</span><span class="pw" aria-hidden="true"><i class="on"></i><i></i><i></i><i></i></span></label><label><input type="radio" name="uvq04-px" checked><i class="cu" aria-hidden="true"></i><span class="tx">Normal</span><span class="pw" aria-hidden="true"><i class="on"></i><i class="on"></i><i></i><i></i></span></label><label><input type="radio" name="uvq04-px"><i class="cu" aria-hidden="true"></i><span class="tx">Hard</span><span class="pw" aria-hidden="true"><i class="on"></i><i class="on"></i><i class="on"></i><i></i></span></label><label><input type="radio" name="uvq04-px"><i class="cu" aria-hidden="true"></i><span class="tx">Nightmare</span><span class="pw" aria-hidden="true"><i class="on"></i><i class="on"></i><i class="on"></i><i class="on"></i></span></label><p class="pr" aria-hidden="true">Press space</p></fieldset>
```

### CSS

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

.uvq04-px {
  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;
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
  position: relative;
  width: 16em;
  padding: 1.2em 1.4em 1em;
  border-radius: 1.1em/1.5em;
  font-family: ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  color: #fff;
  background: radial-gradient(ellipse at 50% 40%,#1d1838,#08070f 85%);
  box-shadow: inset 0 0 2.2em rgba(0,0,0,.85),0 0 0 .45em #2b2b30,0 0 0 .6em #18181b,0 1.4em 2.4em -1em rgba(0,0,0,.7);
  overflow: hidden;
}

.uvq04-px::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(rgba(0,0,0,.28) 0 1px,transparent 1px 3px);
  pointer-events: none;
  animation: uvq04-px-fl calc(4s / var(--k)) steps(1) infinite;
}

.uvq04-px legend {
  float: left;
  width: 100%;
  padding: 0;
  margin-bottom: 1em;
  text-align: center;
  font-weight: 800;
  font-size: .95em;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--c2);
  text-shadow: .12em .12em 0 color-mix(in srgb,var(--c2) 35%,#000),0 0 .6em color-mix(in srgb,var(--c2) 60%,transparent);
}

.uvq04-px legend + label {
  clear: both;
}

.uvq04-px label {
  position: relative;
  display: flex;
  align-items: center;
  gap: .6em;
  padding: .32em .2em;
  cursor: pointer;
}

.uvq04-px input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.uvq04-px .cu {
  width: .6em;
  height: .7em;
  background: var(--c1);
  clip-path: polygon(0 0,33% 0,33% 14%,66% 14%,66% 28%,100% 28%,100% 72%,66% 72%,66% 86%,33% 86%,33% 100%,0 100%);
  visibility: hidden;
}

.uvq04-px .tx {
  flex: 1;
  font-weight: 800;
  font-size: .95em;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.5);
  text-shadow: .1em .1em 0 rgba(0,0,0,.6);
  transition: color calc(0.15s / var(--k)) steps(2);
}

.uvq04-px .pw {
  display: flex;
  gap: .15em;
}

.uvq04-px .pw i {
  width: .45em;
  height: .45em;
  background: rgba(255,255,255,.12);
}

.uvq04-px label:hover .tx {
  color: rgba(255,255,255,.85);
}

.uvq04-px label:active .tx {
  transform: translate(.1em,.1em);
}

.uvq04-px input:checked + .cu {
  visibility: visible;
  animation: uvq04-px-bl calc(0.8s / var(--k)) steps(1) infinite;
}

.uvq04-px input:checked ~ .tx {
  color: var(--c1);
  text-shadow: .1em .1em 0 color-mix(in srgb,var(--c1) 30%,#000),0 0 .6em color-mix(in srgb,var(--c1) 55%,transparent);
}

.uvq04-px input:checked ~ .pw i.on {
  background: var(--c2);
  box-shadow: 0 0 .35em var(--c2);
}

.uvq04-px input:focus-visible ~ .tx {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
  outline-offset: 2px;
}

.uvq04-px .pr {
  margin: .9em 0 0;
  text-align: center;
  font-size: .62em;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: rgba(255,255,255,.6);
  animation: uvq04-px-bl calc(1.4s / var(--k)) steps(1) infinite;
}

@keyframes uvq04-px-bl {
  50% {
    opacity: 0;
  }
}

@keyframes uvq04-px-fl {
  0%,100% {
    opacity: 1;
  }
  50% {
    opacity: .85;
  }
}

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

### React

```tsx
import type { CSSProperties } from "react";

const css = `
.uvq04-px {
  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;
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
  position: relative;
  width: 16em;
  padding: 1.2em 1.4em 1em;
  border-radius: 1.1em/1.5em;
  font-family: ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  color: #fff;
  background: radial-gradient(ellipse at 50% 40%,#1d1838,#08070f 85%);
  box-shadow: inset 0 0 2.2em rgba(0,0,0,.85),0 0 0 .45em #2b2b30,0 0 0 .6em #18181b,0 1.4em 2.4em -1em rgba(0,0,0,.7);
  overflow: hidden;
}

.uvq04-px::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(rgba(0,0,0,.28) 0 1px,transparent 1px 3px);
  pointer-events: none;
  animation: uvq04-px-fl calc(4s / var(--k)) steps(1) infinite;
}

.uvq04-px legend {
  float: left;
  width: 100%;
  padding: 0;
  margin-bottom: 1em;
  text-align: center;
  font-weight: 800;
  font-size: .95em;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--c2);
  text-shadow: .12em .12em 0 color-mix(in srgb,var(--c2) 35%,#000),0 0 .6em color-mix(in srgb,var(--c2) 60%,transparent);
}

.uvq04-px legend + label {
  clear: both;
}

.uvq04-px label {
  position: relative;
  display: flex;
  align-items: center;
  gap: .6em;
  padding: .32em .2em;
  cursor: pointer;
}

.uvq04-px input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.uvq04-px .cu {
  width: .6em;
  height: .7em;
  background: var(--c1);
  clip-path: polygon(0 0,33% 0,33% 14%,66% 14%,66% 28%,100% 28%,100% 72%,66% 72%,66% 86%,33% 86%,33% 100%,0 100%);
  visibility: hidden;
}

.uvq04-px .tx {
  flex: 1;
  font-weight: 800;
  font-size: .95em;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.5);
  text-shadow: .1em .1em 0 rgba(0,0,0,.6);
  transition: color calc(0.15s / var(--k)) steps(2);
}

.uvq04-px .pw {
  display: flex;
  gap: .15em;
}

.uvq04-px .pw i {
  width: .45em;
  height: .45em;
  background: rgba(255,255,255,.12);
}

.uvq04-px label:hover .tx {
  color: rgba(255,255,255,.85);
}

.uvq04-px label:active .tx {
  transform: translate(.1em,.1em);
}

.uvq04-px input:checked + .cu {
  visibility: visible;
  animation: uvq04-px-bl calc(0.8s / var(--k)) steps(1) infinite;
}

.uvq04-px input:checked ~ .tx {
  color: var(--c1);
  text-shadow: .1em .1em 0 color-mix(in srgb,var(--c1) 30%,#000),0 0 .6em color-mix(in srgb,var(--c1) 55%,transparent);
}

.uvq04-px input:checked ~ .pw i.on {
  background: var(--c2);
  box-shadow: 0 0 .35em var(--c2);
}

.uvq04-px input:focus-visible ~ .tx {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
  outline-offset: 2px;
}

.uvq04-px .pr {
  margin: .9em 0 0;
  text-align: center;
  font-size: .62em;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: rgba(255,255,255,.6);
  animation: uvq04-px-bl calc(1.4s / var(--k)) steps(1) infinite;
}

@keyframes uvq04-px-bl {
  50% {
    opacity: 0;
  }
}

@keyframes uvq04-px-fl {
  0%,100% {
    opacity: 1;
  }
  50% {
    opacity: .85;
  }
}

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

export default function RdPixelMenu() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#ffd84a",
          "--c2": "#ff3d7f",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <fieldset className="uvq04-px"><legend>Difficulty</legend><label><input type="radio" name="uvq04-px" /><i className="cu" aria-hidden="true"></i><span className="tx">Easy</span><span className="pw" aria-hidden="true"><i className="on"></i><i></i><i></i><i></i></span></label><label><input type="radio" name="uvq04-px" checked={true} /><i className="cu" aria-hidden="true"></i><span className="tx">Normal</span><span className="pw" aria-hidden="true"><i className="on"></i><i className="on"></i><i></i><i></i></span></label><label><input type="radio" name="uvq04-px" /><i className="cu" aria-hidden="true"></i><span className="tx">Hard</span><span className="pw" aria-hidden="true"><i className="on"></i><i className="on"></i><i className="on"></i><i></i></span></label><label><input type="radio" name="uvq04-px" /><i className="cu" aria-hidden="true"></i><span className="tx">Nightmare</span><span className="pw" aria-hidden="true"><i className="on"></i><i className="on"></i><i className="on"></i><i className="on"></i></span></label><p className="pr" aria-hidden="true">Press space</p></fieldset>
      </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 “Retro difficulty menu” block (Radio buttons) from AIMRAN Library to my project.

## What it is
An 8-bit console screen with scanlines: a pixel cursor blinks next to the chosen difficulty.

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

## 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
import type { CSSProperties } from "react";

const css = `
.uvq04-px {
  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;
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
  position: relative;
  width: 16em;
  padding: 1.2em 1.4em 1em;
  border-radius: 1.1em/1.5em;
  font-family: ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  color: #fff;
  background: radial-gradient(ellipse at 50% 40%,#1d1838,#08070f 85%);
  box-shadow: inset 0 0 2.2em rgba(0,0,0,.85),0 0 0 .45em #2b2b30,0 0 0 .6em #18181b,0 1.4em 2.4em -1em rgba(0,0,0,.7);
  overflow: hidden;
}

.uvq04-px::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(rgba(0,0,0,.28) 0 1px,transparent 1px 3px);
  pointer-events: none;
  animation: uvq04-px-fl calc(4s / var(--k)) steps(1) infinite;
}

.uvq04-px legend {
  float: left;
  width: 100%;
  padding: 0;
  margin-bottom: 1em;
  text-align: center;
  font-weight: 800;
  font-size: .95em;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--c2);
  text-shadow: .12em .12em 0 color-mix(in srgb,var(--c2) 35%,#000),0 0 .6em color-mix(in srgb,var(--c2) 60%,transparent);
}

.uvq04-px legend + label {
  clear: both;
}

.uvq04-px label {
  position: relative;
  display: flex;
  align-items: center;
  gap: .6em;
  padding: .32em .2em;
  cursor: pointer;
}

.uvq04-px input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.uvq04-px .cu {
  width: .6em;
  height: .7em;
  background: var(--c1);
  clip-path: polygon(0 0,33% 0,33% 14%,66% 14%,66% 28%,100% 28%,100% 72%,66% 72%,66% 86%,33% 86%,33% 100%,0 100%);
  visibility: hidden;
}

.uvq04-px .tx {
  flex: 1;
  font-weight: 800;
  font-size: .95em;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.5);
  text-shadow: .1em .1em 0 rgba(0,0,0,.6);
  transition: color calc(0.15s / var(--k)) steps(2);
}

.uvq04-px .pw {
  display: flex;
  gap: .15em;
}

.uvq04-px .pw i {
  width: .45em;
  height: .45em;
  background: rgba(255,255,255,.12);
}

.uvq04-px label:hover .tx {
  color: rgba(255,255,255,.85);
}

.uvq04-px label:active .tx {
  transform: translate(.1em,.1em);
}

.uvq04-px input:checked + .cu {
  visibility: visible;
  animation: uvq04-px-bl calc(0.8s / var(--k)) steps(1) infinite;
}

.uvq04-px input:checked ~ .tx {
  color: var(--c1);
  text-shadow: .1em .1em 0 color-mix(in srgb,var(--c1) 30%,#000),0 0 .6em color-mix(in srgb,var(--c1) 55%,transparent);
}

.uvq04-px input:checked ~ .pw i.on {
  background: var(--c2);
  box-shadow: 0 0 .35em var(--c2);
}

.uvq04-px input:focus-visible ~ .tx {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
  outline-offset: 2px;
}

.uvq04-px .pr {
  margin: .9em 0 0;
  text-align: center;
  font-size: .62em;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: rgba(255,255,255,.6);
  animation: uvq04-px-bl calc(1.4s / var(--k)) steps(1) infinite;
}

@keyframes uvq04-px-bl {
  50% {
    opacity: 0;
  }
}

@keyframes uvq04-px-fl {
  0%,100% {
    opacity: 1;
  }
  50% {
    opacity: .85;
  }
}

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

export default function RdPixelMenu() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#ffd84a",
          "--c2": "#ff3d7f",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <fieldset className="uvq04-px"><legend>Difficulty</legend><label><input type="radio" name="uvq04-px" /><i className="cu" aria-hidden="true"></i><span className="tx">Easy</span><span className="pw" aria-hidden="true"><i className="on"></i><i></i><i></i><i></i></span></label><label><input type="radio" name="uvq04-px" checked={true} /><i className="cu" aria-hidden="true"></i><span className="tx">Normal</span><span className="pw" aria-hidden="true"><i className="on"></i><i className="on"></i><i></i><i></i></span></label><label><input type="radio" name="uvq04-px" /><i className="cu" aria-hidden="true"></i><span className="tx">Hard</span><span className="pw" aria-hidden="true"><i className="on"></i><i className="on"></i><i className="on"></i><i></i></span></label><label><input type="radio" name="uvq04-px" /><i className="cu" aria-hidden="true"></i><span className="tx">Nightmare</span><span className="pw" aria-hidden="true"><i className="on"></i><i className="on"></i><i className="on"></i><i className="on"></i></span></label><p className="pr" aria-hidden="true">Press space</p></fieldset>
      </div>
    </>
  );
}
```

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