:root {
  --fondo: #f3f6f8;
  --tarjeta: #ffffff;
  --tinta: #13222e;
  --tenue: #5b6b78;
  --linea: #d3dde4;
  --marca: #0f2a3d;
  --acento: #0b7a75;
  --acento-texto: #ffffff;
  --peligro: #b3261e;
  --peligro-fondo: #fdecea;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #0d1820;
    --tarjeta: #15232e;
    --tinta: #e6edf2;
    --tenue: #9fb0bd;
    --linea: #2a3d4b;
    --marca: #0a1c29;
    --acento: #2bb3a9;
    --acento-texto: #06201e;
    --peligro: #ff8a80;
    --peligro-fondo: #3a1714;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--fondo);
  color: var(--tinta);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

[hidden] { display: none !important; }

.barra {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: var(--marca);
  color: #fff;
  font-weight: 600;
  letter-spacing: .01em;
}

main { max-width: 560px; margin: 0 auto; padding: 16px; }

.tarjeta {
  background: var(--tarjeta);
  border: 1px solid var(--linea);
  border-radius: 14px;
  padding: 20px 16px;
}

.centro { text-align: center; }

h1 { font-size: 1.4rem; margin: 0 0 6px; line-height: 1.25; overflow-wrap: anywhere; }

.tenue { color: var(--tenue); margin: 0 0 12px; }
.chico { font-size: .875rem; }

.campo { margin: 18px 0 0; }
.campo.fijo { font-weight: 600; }

label, .etiqueta { display: block; font-weight: 600; margin-bottom: 6px; }

select, textarea {
  width: 100%;
  font: inherit;
  color: var(--tinta);
  background: var(--tarjeta);
  border: 1px solid var(--linea);
  border-radius: 10px;
  padding: 12px;
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--tenue) 50%), linear-gradient(135deg, var(--tenue) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  padding-right: 36px;
}

textarea { resize: vertical; min-height: 120px; }

select:focus, textarea:focus, .boton:focus-visible { outline: 3px solid var(--acento); outline-offset: 1px; }

.botones { display: flex; gap: 10px; flex-wrap: wrap; }

.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid var(--acento);
  background: var(--acento);
  color: var(--acento-texto);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  margin: 0;
}

.boton.secundario { background: transparent; color: var(--acento); flex: 1 1 0; }
.boton.grande { width: 100%; margin-top: 20px; min-height: 54px; font-size: 1.05rem; }
.boton[disabled] { opacity: .55; cursor: default; }

.lista { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.lista:empty { display: none; }

.lista li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--linea);
  border-radius: 10px;
  padding: 8px 8px 8px 12px;
}

.lista .nombre { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lista .peso { color: var(--tenue); font-size: .85rem; }
.lista audio { grid-column: 1 / -1; width: 100%; height: 36px; }

.quitar {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--linea);
  background: transparent;
  color: var(--tenue);
  font-size: 1.2rem;
  cursor: pointer;
}

.grabando {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--peligro-fondo);
}

.grabando .boton { margin-left: auto; background: var(--peligro); border-color: var(--peligro); color: #fff; }
.grabando .tenue { margin: 0; }
#reloj { font-variant-numeric: tabular-nums; font-weight: 600; }

.punto { width: 12px; height: 12px; border-radius: 50%; background: var(--peligro); animation: latido 1.2s ease-in-out infinite; }

@keyframes latido { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .punto { animation: none; } }

.aviso {
  margin: 18px 0 0;
  padding: 12px;
  border-radius: 10px;
  background: var(--peligro-fondo);
  color: var(--peligro);
  font-weight: 600;
}

.progreso { margin-top: 18px; height: 8px; border-radius: 4px; background: var(--linea); overflow: hidden; }
#barra-progreso { height: 100%; width: 0; background: var(--acento); transition: width .2s; }

.palomita {
  width: 64px;
  height: 64px;
  margin: 4px auto 12px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--acento);
  color: var(--acento-texto);
  font-size: 2rem;
  font-weight: 700;
}

.folio { font-size: 2rem; font-weight: 700; letter-spacing: .04em; margin: 0 0 12px; font-variant-numeric: tabular-nums; }
