/* Pueblazo (/pueblazo/): estilos locales, todos con el prefijo votle-. Usa las variables de /estilo/tokens.css. */

.votle {
  --votle-verde: var(--ok);
  padding-block: var(--e4) var(--e6);
}

.votle-cabeza {
  display: grid;
  gap: var(--e2);
}

.votle-cabeza .etiqueta {
  margin: 0;
}

.votle-titulo {
  margin: 0;
  font-size: clamp(2.2rem, 9.5vw, 3.6rem);
  line-height: 0.95;
}

.votle-regla {
  margin: 0;
  max-width: 34rem;
  color: var(--tinta-2);
}

.votle-regla strong {
  color: var(--tinta);
}

/* ---------- el pueblo misterioso ---------- */

.votle-misterio {
  display: grid;
  gap: var(--e3);
}

.votle-h2 {
  margin: 0;
  font-size: var(--t-3);
}

.votle-barras {
  display: grid;
  gap: 6px;
  min-height: 9rem;
}

.votle-barra {
  --barra-nombre: 4.6rem;
  --barra-valor: 4.2rem;
  min-height: 1.6rem;
}

.votle-barra .barra__relleno {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tinta) 28%, transparent); /* los colores oscuros también se ven de noche */
}

.votle-barra--oculta .barra__nombre {
  color: var(--tinta-2);
  font-family: var(--f-cifra);
  letter-spacing: 0.04em;
}

.votle-barra--resto .barra__nombre {
  color: var(--tinta-2);
  font-weight: 400;
}

.votle-barra--resto .barra__relleno {
  background: repeating-linear-gradient(135deg, var(--linea) 0 6px, transparent 6px 10px);
}

.votle-fuente,
.votle-creditos {
  margin: 0;
  color: var(--tinta-2);
  font-size: var(--t-1);
}

.votle-cargando,
.votle-error {
  margin: 0;
  color: var(--tinta-2);
}

/* ---------- pistas ---------- */

.votle-pistas {
  display: grid;
  gap: var(--e2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.votle-pista {
  display: grid;
  grid-template-columns: minmax(6.5rem, auto) 1fr;
  gap: 0 var(--e3);
  align-items: baseline;
  padding: var(--e2) var(--e3);
  border-radius: var(--radio-p, 8px);
  background: var(--papel-3);
}

.votle-pista__nombre {
  color: var(--tinta-2);
  font-size: var(--t-1);
  font-weight: 700;
}

.votle-pista__valor {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.votle-pista__nota {
  grid-column: 2;
  color: var(--tinta-2);
  font-size: var(--t-1);
}

.votle-pista--cerrada {
  display: block;
  padding-block: 6px;
  background: transparent;
  border: 1px dashed var(--linea);
  color: var(--tinta-2);
  font-size: var(--t-1);
}

.votle-pista--nueva {
  animation: votle-destello 1.2s var(--curva, ease) both;
}

@keyframes votle-destello {
  0% { opacity: 0; transform: translateY(6px); box-shadow: 0 0 0 2px var(--acento); }
  40% { opacity: 1; transform: none; box-shadow: 0 0 0 2px var(--acento); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ---------- el intento ---------- */

.votle-adivina {
  display: grid;
  gap: var(--e2);
  scroll-margin-top: var(--e3);
}

.votle-etiqueta {
  font-weight: 700;
}

.votle-caja {
  position: relative;
  display: flex;
  gap: var(--e2);
}

.votle-campo {
  flex: 1;
  min-width: 0;
  font-size: max(16px, var(--t-2)) !important; /* 16 px o más: así el iPhone no amplía la página al escribir */
}

.votle-probar {
  flex: none;
}

.votle-lista {
  position: absolute;
  inset-inline: 0;
  top: calc(100% + 4px);
  z-index: 30;
  max-height: 19.5rem;
  margin: 0;
  padding: var(--e1);
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  background: var(--papel-2);
  box-shadow: var(--sombra);
}

.votle-op {
  display: flex;
  justify-content: space-between;
  gap: var(--e3);
  align-items: center;
  min-height: 3rem;
  padding: var(--e2) var(--e3);
  border-radius: calc(var(--radio) - 4px);
  cursor: pointer;
}

.votle-op:hover,
.votle-op[aria-selected="true"] {
  background: var(--papel-3);
  box-shadow: inset 0 0 0 2px var(--acento);
}

.votle-op__nombre {
  font-weight: 700;
}

.votle-op__prov {
  flex: none;
  color: var(--tinta-2);
  font-size: var(--t-1);
}

.votle-ayuda {
  margin: 0;
  color: var(--tinta-2);
  font-size: var(--t-1);
}

/* ---------- la lista de intentos (el último, arriba) ---------- */

.votle-intentos {
  display: grid;
  gap: var(--e2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.votle-intento {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--e1) var(--e3);
  align-items: center;
  padding: var(--e2) var(--e3);
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  background: var(--papel-2);
}

.votle-intento--nuevo {
  animation: votle-entra 0.45s var(--curva, ease) both;
}

@keyframes votle-entra {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.votle-intento--acierto {
  border-color: var(--votle-verde);
  box-shadow: inset 0 0 0 1px var(--votle-verde);
}

.votle-intento__visto {
  display: flex;
  gap: var(--e2);
  align-items: baseline;
  min-width: 0;
}

.votle-intento__n {
  flex: none;
  color: var(--tinta-2);
  font-family: var(--f-cifra);
  font-weight: 900;
}

.votle-intento__nombre {
  min-width: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.votle-intento__prov {
  display: block;
  color: var(--tinta-2);
  font-size: var(--t-1);
  font-weight: 400;
}

.votle-intento__dato {
  display: flex;
  gap: var(--e2);
  align-items: center;
  justify-self: end;
}

.votle-intento__km {
  font-family: var(--f-cifra);
  font-size: 1.125rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums lining-nums;
  white-space: nowrap;
}

.votle-intento__flecha {
  display: inline-block;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--acento) no-repeat center / 1rem
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%231a1203' d='M8 1 14 9H10v6H6V9H2z'/%3E%3C/svg%3E");
  transform: rotate(var(--rumbo, 0deg));
  transition: transform 0.9s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.votle-intento__dir {
  min-width: 4.6rem;
  color: var(--tinta-2);
  font-size: var(--t-1);
}

.votle-intento__diana {
  font-size: 1.4rem;
  line-height: 1;
}

.votle-cuadros {
  grid-column: 1 / -1;
  display: flex;
  gap: 3px;
}

.votle-cuadros i {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 2px;
  background: var(--papel-3);
  box-shadow: inset 0 0 0 1px var(--linea);
}

.votle-cuadros i.si {
  background: var(--votle-verde);
  box-shadow: none;
}

/* ---------- el final ---------- */

.votle-final {
  display: grid;
  gap: var(--e4);
  padding: var(--e5) var(--e4);
  border: 1px solid color-mix(in srgb, var(--acento) 55%, var(--linea));
  border-radius: var(--radio-g, 18px);
  background: var(--papel-2);
  box-shadow: var(--sombra);
  scroll-margin-top: var(--e3);
}

.votle-final--nuevo {
  animation: votle-entra 0.5s var(--curva, ease) both;
}

.votle-final__titulo {
  margin: 0;
  font-size: var(--t-5);
}

.votle-final__titulo:focus {
  outline: none;
}

.votle-final__respuesta {
  margin: 0;
  font-size: var(--t-3);
}

.votle-final__sub {
  margin: 0;
  font-size: var(--t-2);
}

.votle-compartir {
  display: grid;
  gap: var(--e3);
}

.votle-rejilla {
  justify-self: start;
  margin: 0;
  padding: var(--e3) var(--e4);
  border-radius: var(--radio);
  background: var(--papel-3);
  font: 400 1.25rem / 1.35 var(--f-texto);
  white-space: pre;
  overflow-x: auto;
  max-width: 100%;
}

.votle-botones {
  flex-wrap: wrap;
  gap: var(--e2);
}

.votle-wa {
  border-color: #25d366;
}

.votle-hecho,
.votle-nota {
  margin: 0;
  color: var(--tinta-2);
  font-size: var(--t-1);
}

.votle-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--e2);
  margin: 0;
}

.votle-stats__par {
  display: grid;
  justify-items: center;
  text-align: center;
}

.votle-stats dt {
  order: 2;
  color: var(--tinta-2);
  font-size: 0.75rem;
}

.votle-stats__cifra {
  margin: 0;
  font-family: var(--f-cifra);
  font-size: var(--t-4);
  font-weight: 900;
  line-height: 1;
}

.votle-reparto {
  display: grid;
  gap: 4px;
}

.votle-reparto__fila {
  display: grid;
  grid-template-columns: 1.2rem 1fr;
  gap: var(--e2);
  align-items: center;
  font-size: var(--t-1);
}

.votle-reparto__barra {
  width: max(1.6rem, calc(var(--valor, 0) * 1%));
  padding-inline: var(--e2);
  border-radius: 3px;
  background: var(--papel-3);
  font-weight: 700;
  text-align: right;
}

.votle-reparto__fila--hoy .votle-reparto__barra {
  background: var(--votle-verde);
  color: var(--papel);
}

.votle-siguiente {
  margin: 0;
}

.votle-siguiente__reloj {
  font-family: var(--f-cifra);
  font-size: var(--t-3);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--enlace);
}

.votle-tienda:not(.tienda-entrada) {
  color: var(--enlace);
}

/* ---------- cómo se juega ---------- */

.votle-reglas {
  padding: var(--e3) var(--e4);
  border: 1px solid var(--linea);
  border-radius: var(--radio);
}

.votle-reglas summary {
  font-weight: 700;
  cursor: pointer;
}

.votle-reglas ul {
  display: grid;
  gap: var(--e2);
  margin: var(--e3) 0 0;
  padding-inline-start: 1.2rem;
}

@media (min-width: 40rem) {
  .votle-intento {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .votle-cuadros {
    grid-column: auto;
  }
}

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

:root[data-quieto] .votle *,
:root[data-quieto] .votle {
  animation: none !important;
  transition: none !important;
}
