:root {
  --fondo: #0d0d0f;
  --texto: #ffffff;
  --texto-suave: #c9c9d1;
  --rojo: #d0021b;
  --rojo-presionado: #8f0012;
  --borde-foco: #ffd400;
  --ok: #3ddc84;
  --error: #ff6b6b;
  --panel: #1b1b20;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--fondo);
  color: var(--texto);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 18px;
  line-height: 1.4;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: 16px;
  gap: 16px;
}

.solo-lector {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- botón grande ---------- */
#hablar {
  flex: 1 1 auto;
  min-height: 62dvh;
  width: 100%;
  border: 0;
  border-radius: 28px;
  background: var(--rojo);
  color: #fff;
  font: inherit;
  font-size: clamp(2.5rem, 12vw, 6rem);
  font-weight: 800;
  letter-spacing: .04em;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  box-shadow: 0 10px 0 var(--rojo-presionado);
  transition: transform .06s, box-shadow .06s, background .2s;
}
#hablar:active, #hablar.enviando {
  background: var(--rojo-presionado);
  transform: translateY(6px);
  box-shadow: 0 4px 0 var(--rojo-presionado);
}
#hablar:focus-visible {
  outline: 6px solid var(--borde-foco);
  outline-offset: 4px;
}
#hablar small {
  display: block;
  font-size: clamp(1rem, 4.5vw, 1.4rem);
  font-weight: 500;
  letter-spacing: 0;
  margin-top: .5em;
  opacity: .9;
}

/* ---------- aviso del último resultado ---------- */
#aviso {
  min-height: 1.6em;
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
}
#aviso.ok { color: var(--ok); }
#aviso.error { color: var(--error); }

/* ---------- estado ---------- */
#estado {
  background: var(--panel);
  border-radius: 16px;
  padding: 12px 16px;
}
#estado h2 { font-size: 1.1rem; margin: 0 0 8px; }
#estado dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; }
#estado dt { color: var(--texto-suave); }
#estado dd { margin: 0; overflow-wrap: anywhere; }
.punto { display: inline-block; width: .7em; height: .7em; border-radius: 50%; margin-right: .4em; background: var(--error); }
.punto.si { background: var(--ok); }

footer { text-align: center; }
footer button, .boton-secundario {
  background: transparent;
  color: var(--texto-suave);
  border: 1px solid var(--texto-suave);
  border-radius: 10px;
  padding: 10px 18px;
  font: inherit;
}
footer button:focus-visible, .boton-secundario:focus-visible, input:focus-visible {
  outline: 4px solid var(--borde-foco);
  outline-offset: 2px;
}

/* ---------- login ---------- */
.login {
  margin: auto;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login h1 { margin: 0; font-size: 2rem; text-align: center; }
.login label { font-size: 1.2rem; font-weight: 600; }
.login input {
  font: inherit; font-size: 1.4rem;
  padding: 14px; border-radius: 12px;
  border: 2px solid var(--texto-suave);
  background: #000; color: var(--texto);
}
.login button[type=submit] {
  font: inherit; font-size: 1.5rem; font-weight: 800;
  padding: 18px; border: 0; border-radius: 14px;
  background: var(--rojo); color: #fff;
}
.login button[type=submit]:focus-visible { outline: 6px solid var(--borde-foco); outline-offset: 3px; }
#error-login { color: var(--error); font-weight: 700; min-height: 1.4em; margin: 0; }

@media (prefers-reduced-motion: reduce) {
  #hablar { transition: none; }
}
