/*
  One screen at a time, thumb first.

  Blocking rules baked in here:
    - base type 20px, nothing on screen under 18px,
    - every tappable thing at least 56px tall (48px absolute floor),
    - primary actions in the lower half of the screen,
    - no horizontal scroll at 320px,
    - contrast at least AA against both palettes,
    - colour is never the only signal: state also shows as a mark, a border or a word.
*/

:root {
  --fondo: #fbf7f0;
  --fondo-tarjeta: #ffffff;
  --texto: #1f1b16;
  --texto-suave: #4a423a;
  --borde: #8a7c68;   /* 3.8:1 on the page and 4.1:1 on a card: WCAG 1.4.11 for the button edge */
  --acento: #2f5d50;
  --acento-texto: #ffffff;
  --marcado: #234a40;
  --alerta: #8c2f18;
  --sombra: rgba(31, 27, 22, 0.12);
  --radio: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #17140f;
    --fondo-tarjeta: #211d17;
    --texto: #f6f0e6;
    --texto-suave: #d8cfc1;
    --borde: #7d7261;   /* 3.9:1 on the page and 3.6:1 on a card: the same 1.4.11 floor as the light palette */
    --acento: #8fd3bd;
    --acento-texto: #10221c;
    --marcado: #a8e2ce;
    --alerta: #ffab8f;
    --sombra: rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding: 0;
  background: var(--fondo);
  color: var(--texto);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 20px;
  line-height: 1.5;
  min-height: 100dvh;
  overflow-x: hidden;
}

.saltar {
  position: absolute;
  left: -9999px;
}
.saltar:focus {
  left: 12px;
  top: 12px;
  z-index: 10;
  background: var(--acento);
  color: var(--acento-texto);
  padding: 12px 16px;
  border-radius: var(--radio);
}

.pantalla {
  max-width: 30rem;
  margin: 0 auto;
  padding: 20px 16px 104px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.cargando,
.aviso-sin-js {
  font-size: 20px;
  color: var(--texto-suave);
  padding: 24px 16px;
  max-width: 30rem;
  margin: 0 auto;
}

h1 {
  font-size: 28px;
  line-height: 1.25;
  margin: 8px 0 16px;
}

h2.pregunta-texto {
  font-size: 24px;
  line-height: 1.35;
  font-weight: 600;
  margin: 4px 0 20px;
}

p { margin: 0 0 14px; }

.parrafo { font-size: 20px; }

.ayuda,
.grupo,
.nota {
  font-size: 18px;
  color: var(--texto-suave);
}

.grupo {
  text-transform: none;
  letter-spacing: 0.01em;
  margin: 0 0 6px;
}

.firma {
  font-size: 18px;
  color: var(--texto-suave);
  margin-top: 4px;
}

/* Progress: dots, plus a readable label for a screen reader. Never a countdown. */
.puntos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}
.punto {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--borde);
  background: transparent;
}
.punto.hecho {
  background: var(--acento);
  border-color: var(--acento);
}
.punto.actual {
  width: 18px;
  height: 18px;
  border-color: var(--texto);
  border-width: 3px;
  margin-top: -3px;
}

.acciones {
  /* The confirm button follows her down a long list instead of hiding below it. */
  margin-top: auto;
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: var(--fondo);
  padding: 10px 0 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.opciones {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 0 24px;
}

button,
.boton {
  font: inherit;
  font-size: 20px;
  min-height: 56px;
  padding: 14px 18px;
  border-radius: var(--radio);
  border: 2px solid var(--borde);
  background: var(--fondo-tarjeta);
  color: var(--texto);
  text-align: left;
  width: 100%;
  cursor: pointer;
  box-shadow: 0 1px 2px var(--sombra);
}

button:focus-visible {
  outline: 3px solid var(--texto);
  outline-offset: 2px;
}

button:active { transform: translateY(1px); }

.boton-principal {
  background: var(--acento);
  color: var(--acento-texto);
  border-color: var(--acento);
  text-align: center;
  font-weight: 600;
}

.boton-secundario {
  background: transparent;
  border: 2px solid var(--borde);
  color: var(--texto-suave);
  font-weight: 400;
  text-align: center;
}

.boton-fijo {
  background: transparent;
  border-style: dashed;
  color: var(--texto-suave);
  min-height: 52px;
}

.opcion[aria-pressed="true"] {
  border-color: var(--marcado);
  border-width: 3px;
  background: var(--fondo-tarjeta);
  font-weight: 600;
}
.opcion[aria-pressed="true"]::before {
  content: "✓ ";
  color: var(--marcado);
  font-weight: 700;
}
.opcion[aria-pressed="false"]::before {
  content: "";
}

.fijas {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--borde);
}

input[type="text"],
input[type="number"],
input[type="tel"],
textarea,
select {
  font: inherit;
  font-size: 20px;
  min-height: 56px;
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radio);
  border: 2px solid var(--borde);
  background: var(--fondo-tarjeta);
  color: var(--texto);
}

textarea { min-height: 120px; line-height: 1.4; }

label {
  display: block;
  font-size: 18px;
  color: var(--texto-suave);
  margin: 12px 0 6px;
}

.casilla {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  font-size: 20px;
  color: var(--texto);
}
.casilla .etiqueta-casilla { margin: 0; }
.casilla input {
  width: 28px;
  height: 28px;
  min-height: 28px;
}

.barra-inferior {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--fondo-tarjeta);
  border-top: 2px solid var(--borde);
  box-shadow: 0 -2px 10px var(--sombra);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 5;
}
.barra-inferior .mensaje {
  /* What she must read first is that it was saved; undoing is the quiet option. */
  flex: 1;
  font-size: 20px;
  font-weight: 600;
  color: var(--texto);
}
.barra-inferior .mensaje::before {
  content: "✓ ";
  color: var(--acento);
}
.barra-inferior button {
  width: auto;
  min-width: 128px;
  text-align: center;
}

.aviso {
  font-size: 18px;
  color: var(--alerta);
  border: 2px solid var(--alerta);
  border-radius: var(--radio);
  padding: 12px 14px;
  margin: 0 0 16px;
}

.grabador {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 8px 0 20px;
}
.grabando {
  font-size: 20px;
  font-weight: 600;
  color: var(--alerta);
}
audio { width: 100%; }

.cierre {
  font-size: 22px;
  line-height: 1.45;
  margin: 24px 0;
}

@media (max-width: 340px) {
  body { font-size: 19px; }
  h1 { font-size: 25px; }
  h2.pregunta-texto { font-size: 22px; }
}

@media (min-width: 700px) {
  .pantalla { max-width: 34rem; padding-top: 40px; }
  h1 { font-size: 32px; }
  h2.pregunta-texto { font-size: 27px; }
  .barra-inferior { justify-content: center; }
  .barra-inferior .mensaje { flex: 0 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
