:root {
  --tinta: #1F2A44;
  --tinta-2: #2B3A5C;
  --tinta-3: #33426A;
  --papel: #F4EBD9;
  --mostaza: #F2B134;
  --mostaza-osc: #B9801A;
  --verde: #2A9D8F;
  --tomate: #E9573F;
  --texto: #F4EBD9;
  --suave: #A9B3C9;
  --linea: #4A5A80;
  --fuente: "Bricolage Grotesque", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: inherit; }
[hidden] { display: none !important; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin: 0; min-height: 100vh;
  background: radial-gradient(circle at 50% 0%, var(--tinta-2) 0, var(--tinta) 70%) fixed;
  background-color: var(--tinta);
  color: var(--texto); font-family: var(--fuente);
  font-size: 1.05rem; line-height: 1.5;
}
.contenedor { max-width: 760px; margin: 0 auto; padding: 1.5rem 1.1rem 3rem; }
h1 { font-size: clamp(1.6rem, 4.5vw, 2.4rem); font-weight: 800; line-height: 1.1; letter-spacing: -.02em; margin: 0 0 1.25rem; }
h2 { font-size: 1.25rem; font-weight: 800; margin: 0 0 .75rem; }
p { margin: 0 0 1rem; }
.suave { color: var(--suave); }
a { color: var(--mostaza); }

button, .boton {
  font: inherit; font-weight: 800; cursor: pointer; border: 0; border-radius: 12px;
  padding: .6rem 1.1rem; text-decoration: none; display: inline-block;
}
button:focus-visible, .boton:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--mostaza); outline-offset: 2px;
}
.principal { background: var(--mostaza); color: var(--tinta); box-shadow: 0 4px 0 var(--mostaza-osc); }
.principal:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--mostaza-osc); }
.principal:disabled { opacity: .55; cursor: not-allowed; }
.sec { background: transparent; color: var(--texto); font-weight: 500; border: 2px solid var(--linea); padding: .4rem .8rem; }
.sec:hover { border-color: var(--suave); }
.peligro { color: #FFB3A3; }

input[type=text], input[type=password], textarea {
  font: inherit; width: 100%; padding: .6rem .8rem;
  background: rgba(0,0,0,.15); color: var(--texto);
  border: 2px solid var(--linea); border-radius: 10px;
}
textarea { resize: vertical; min-height: 4.5rem; }
select, input[type=number], input[type=search] {
  font: inherit; padding: .55rem .8rem;
  background: rgba(0,0,0,.15); color: var(--texto);
  border: 2px solid var(--linea); border-radius: 10px;
}
input[type=search] { width: 100%; }
select option { background: var(--tinta-2); color: var(--texto); }
select:disabled { opacity: .6; }
label { font-weight: 500; }
.aviso { color: #FFB3A3; min-height: 1.4em; margin: .5rem 0; }
.ok { color: #9EE6C9; }

.tarjeta { background: var(--tinta-2); border-radius: 16px; padding: 1.25rem; }

/* Opciones de voto */
.opciones { display: grid; gap: .7rem; }
.opcion {
  display: flex; align-items: center; gap: .9rem; width: 100%; text-align: left;
  background: var(--tinta-2); color: var(--texto); font-weight: 500; font-size: 1.15rem;
  padding: 1rem 1.1rem; border: 2px solid var(--tinta-3); border-radius: 14px;
  transition: border-color .15s, background .15s;
}
.opcion:hover:not(:disabled) { border-color: var(--mostaza); }
.opcion[aria-pressed="true"] { border-color: var(--mostaza); background: #3A4870; }
.letra {
  flex: none; width: 2.2rem; height: 2.2rem; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800;
  background: var(--papel); color: var(--tinta);
}

/* Resultados */
.barras { display: grid; gap: 1rem; }
.barra-fila { display: grid; gap: .3rem; }
.barra-cab { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.barra-texto { font-weight: 500; display: flex; gap: .55rem; align-items: center; }
.barra-texto .letra { width: 1.8rem; height: 1.8rem; font-size: .95rem; }
.barra-num { font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.barra-pista { height: 1.6rem; background: rgba(0,0,0,.2); border-radius: 8px; overflow: hidden; }
.barra-relleno { height: 100%; width: 0; background: var(--mostaza); border-radius: 8px; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.barra-fila.mia .barra-texto::after { content: "tu voto"; font-size: .8rem; font-weight: 800; background: var(--papel); color: var(--tinta); border-radius: 999px; padding: 0 .5rem; }
.barra-fila.correcta .barra-relleno { background: var(--verde); }
.barra-fila.correcta .letra { background: var(--verde); color: #fff; }
.barra-fila.correcta .barra-texto::before { content: "✓"; color: #9EE6C9; font-weight: 800; }
.total { margin-top: 1rem; color: var(--suave); }

/* Votación de lista: marcar uno o varios */
.opcion[hidden] { display: none; }
.opciones.cands { gap: .5rem; }
.opcion.cand { padding: .75rem 1rem; font-size: 1.08rem; }
.caja {
  flex: none; width: 1.6rem; height: 1.6rem; border-radius: 7px;
  border: 2px solid var(--suave); display: grid; place-items: center;
}
.opcion[aria-pressed="true"] .caja { background: var(--mostaza); border-color: var(--mostaza); }
.opcion[aria-pressed="true"] .caja::after { content: "✓"; color: var(--tinta); font-weight: 800; font-size: 1rem; line-height: 1; }
.buscar { margin: 0 0 .8rem; }
.pie-voto {
  position: sticky; bottom: 0; z-index: 2;
  margin: .75rem -1.1rem 0; padding: 1.2rem 1.1rem calc(env(safe-area-inset-bottom, 0px) + .9rem);
  background: linear-gradient(to bottom, rgba(31,42,68,0), var(--tinta) 1.1rem);
  display: flex; flex-wrap: wrap; gap: .6rem; align-items: center;
}
.pie-voto .contador { margin: 0; font-weight: 800; flex: 1 1 100%; font-variant-numeric: tabular-nums; }
.pie-voto .aviso { flex: 1 1 100%; margin: 0; min-height: 0; }
.pie-voto .aviso:empty { display: none; }

/* Clasificación */
.pos {
  flex: none; min-width: 2.5rem; height: 1.8rem; padding: 0 .45rem; border-radius: 999px;
  display: grid; place-items: center; font-weight: 800; font-size: .92rem;
  background: var(--papel); color: var(--tinta); font-variant-numeric: tabular-nums;
}
.barra-fila.plaza .pos { background: var(--verde); color: #fff; }
.barra-fila.plaza .barra-relleno { background: var(--verde); }
.insignia:empty { display: none; }
.insignia { font-size: .8rem; font-weight: 800; border-radius: 999px; padding: 0 .55rem; background: var(--tomate); color: #fff; }
.barra-texto:has(> .pos) { flex-wrap: wrap; row-gap: .25rem; }
.insignia, .barra-fila.mia .barra-texto::after { white-space: nowrap; }
.resumen { font-weight: 800; }
.sin-votos { color: var(--suave); margin-top: 1rem; font-size: .95rem; }
.sin-votos:empty { display: none; }

.cargando { color: var(--suave); }

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