/* Buttons: a living 5×5 LED panel + a label whose letters light up one by one on hover.
   Base .pill is the light surface (secondary), .pill--blue is the primary action. */
.pill {
  --surface: var(--card);
  --surface-hover: var(--card);
  --label: var(--ink);
  --label-lit: var(--accent);
  --glow: rgba(47, 91, 255, 0.45);
  --led: var(--accent);
  --led-floor: 0.12;
  display: inline-flex; align-items: center; gap: 12px;
  height: 48px; padding: 0 22px 0 16px; border-radius: 999px;
  background: var(--surface); color: var(--label);
  box-shadow: inset 0 0 0 1px var(--line), 0 1px 2px rgba(0, 0, 0, 0.04);
  font-size: 15px; font-weight: 500;
  transition: background-color .5s var(--ease), transform .15s var(--ease);
}
.pill:hover { background: var(--surface-hover); }
.pill:active { transform: scale(0.98); }

.pill--blue {
  --surface: var(--accent);
  --surface-hover: #3a64ff;
  --label: var(--white);
  --label-lit: var(--white);
  --glow: rgba(255, 255, 255, 0.85);
  --led: var(--white);
  --led-floor: 0.22;
  box-shadow: none;
}

/* the panel */
.led { display: grid; grid-template-columns: repeat(5, 3px); gap: 1px; flex: none; }
.led i {
  width: 3px; height: 3px; border-radius: 1px; background: var(--led, var(--accent));
  opacity: calc(var(--led-floor, 0.14) + var(--b, 0) * (1 - var(--led-floor, 0.14)));
  box-shadow: 0 0 calc(var(--b, 0) * 5px) var(--led, var(--accent));
  transition: opacity .14s linear, box-shadow .14s linear;
}

/* the label: letters warm up in order, slowly, and cool down together */
.pill__label { white-space: pre; }
.lc { transition: color .7s var(--ease), text-shadow .9s var(--ease); }
.pill:hover .lc, .pill:focus-visible .lc {
  color: var(--label-lit);
  text-shadow: 0 0 2px var(--glow), 0 0 12px var(--glow);
  transition-delay: calc(var(--i, 0) * 45ms);
}

.pill:focus-visible, .sound:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* the closing dark screen */
.is-dark .pill { --label-lit: #8aa6ff; --glow: rgba(138, 166, 255, 0.5); }
.is-dark .pill--blue { --label-lit: var(--white); --glow: rgba(255, 255, 255, 0.85); }

@media (prefers-reduced-motion: reduce) {
  .lc { transition: none; }
}
