/* ============================================================
   Shell de aplicación — layout fijo, sin scroll de página,
   transiciones entre pantallas, hojas modales y toasts.

   Tema "aviador": cielo claro, azul de avión y amarillo de
   bufanda. El blanco es la superficie de las tarjetas.
   ============================================================ */

:root {
  /* --- superficies: cielo y nubes */
  --bg: #eef5fd;
  --bg-elev: #ffffff;
  --bg-elev-2: #e3eefb;
  --bg-appbar: rgba(255, 255, 255, 0.88);

  --border: #cddff5;
  --border-soft: #dfeafa;

  /* --- tinta */
  --text: #16233d;
  --text-dim: #5a6b8a;
  --text-faint: #6f82a3;

  /* --- azul de avión */
  --accent: #2f6fd0;
  --accent-strong: #1f5bb5;
  --accent-suave: #dfebfb;

  /* --- amarillo de bufanda: es color de relleno, nunca de texto
     sobre blanco. Para texto se usa --amarillo-tinta. */
  --amarillo: #f5b921;
  --amarillo-suave: #fef3d4;
  --amarillo-tinta: #8a5a00;
  /* alias histórico: el acento secundario ahora es el amarillo */
  --accent-2: #f5b921;

  /* --- estados */
  --ok: #1e9e6a;
  --ok-suave: #ddf5ec;
  --ok-tinta: #10704a;

  --warn: #e0a413;
  --warn-suave: #fef3d4;
  --warn-tinta: #8a5a00;

  --danger: #d64545;
  --danger-suave: #fdeaea;
  --danger-tinta: #b32d2d;

  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 8px 24px rgba(22, 45, 88, 0.12);
  --shadow-sm: 0 2px 8px rgba(22, 45, 88, 0.07);
  --shadow-lg: 0 -10px 40px rgba(22, 45, 88, 0.18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  /* nada de selección accidental de texto: se siente como app, no como página */
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

input,
textarea,
[contenteditable] {
  -webkit-user-select: text;
  user-select: text;
}

/* =============================================== estructura de la app */

.app {
  position: fixed;
  inset: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  /* nubes muy suaves de fondo; el .app es fijo, así que no scrollean */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='560' height='420' viewBox='0 0 560 420'%3E%3Cg fill='%23ffffff' opacity='.55'%3E%3Cpath d='M78 132c-14 0-25-9-25-21s11-21 25-21c4-14 17-24 32-24 13 0 25 7 30 18 3-1 7-2 11-2 13 0 23 9 23 21s-10 21-23 21z'/%3E%3Cpath d='M368 78c-11 0-19-7-19-16s8-16 19-16c3-11 13-19 25-19 10 0 19 6 23 14 3-1 5-1 8-1 10 0 18 7 18 16s-8 16-18 16z'/%3E%3Cpath d='M198 330c-16 0-29-10-29-23s13-23 29-23c4-15 20-27 37-27 15 0 28 8 34 19 3-1 8-2 12-2 15 0 26 10 26 23s-11 23-26 23z'/%3E%3Cpath d='M472 270c-11 0-20-7-20-16s9-16 20-16c3-11 14-19 26-19 10 0 20 6 24 14 2-1 5-1 8-1 10 0 19 7 19 16s-9 16-19 16z'/%3E%3C/g%3E%3C/svg%3E");
  /* tile chico: nubes de ~50px, textura de fondo y no ilustración */
  background-size: 300px 225px;
  background-repeat: repeat;
}

/* ------------------------------------------------------------ appbar */

.appbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  padding-top: calc(10px + var(--safe-top));
  min-height: calc(56px + var(--safe-top));
  background: var(--bg-appbar);
  -webkit-backdrop-filter: saturate(150%) blur(18px);
  backdrop-filter: saturate(150%) blur(18px);
  border-bottom: 1px solid var(--border-soft);
  position: relative;
  z-index: 20;
}

.appbar__icono {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  flex: none;
  background: linear-gradient(150deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
}

.appbar__icono .ico {
  width: 20px;
  height: 20px;
}

.appbar__textos {
  flex: 1;
  min-width: 0;
}

.appbar__titulo {
  font-size: 0.98rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.appbar__sub {
  font-size: 0.76rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* en celular el subtítulo del admin lista tres estados y el que se
   truncaba era justo el aviso del secreto: acá lo dejamos en dos líneas */
.appbar__sub--multi {
  white-space: normal;
  overflow: visible;
  line-height: 1.3;
}

@media (min-width: 560px) {
  .appbar__sub--multi {
    white-space: nowrap;
    overflow: hidden;
  }
}

/* botón circular del appbar (volver, salir, etc.) */
.icon-btn {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 1.05rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s, border-color 0.15s;
}

.icon-btn .ico {
  width: 19px;
  height: 19px;
}

.icon-btn:active {
  transform: scale(0.92);
  background: var(--accent-suave);
  border-color: var(--accent);
  color: var(--accent-strong);
}

/* ------------------------------------------- pila / stack de pantallas */

.stack {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  visibility: hidden;
  opacity: 0;
  transform: translateX(0);
  transition: transform 0.3s var(--ease), opacity 0.24s var(--ease), visibility 0.3s;
}

.screen.is-activa {
  visibility: visible;
  opacity: 1;
  transform: translateX(0);
  z-index: 2;
}

.screen.sale-izq {
  transform: translateX(-24%);
  opacity: 0;
}

.screen.entra-der {
  transform: translateX(100%);
  opacity: 0;
}

.screen.sale-der {
  transform: translateX(100%);
  opacity: 0;
}

.screen.entra-izq {
  transform: translateX(-24%);
  opacity: 0;
}

/* área de contenido con scroll propio (no scrollea la página) */
.screen__cuerpo {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 18px 16px;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* El truco del margin:auto en un contenedor flex con scroll: si el
   contenido es más corto que la pantalla queda centrado, y si es más
   largo scrollea desde arriba sin recortarse. Así no sobra aire. */
.screen__cuerpo > .contenido {
  margin-block: auto;
}

/* centra también en el eje horizontal (pantalla del teclado) */
.screen__cuerpo--centrado {
  align-items: center;
  justify-content: center;
}

/* zona fija abajo: teclado numérico, botón principal, tabbar */
.screen__pie {
  flex: none;
  padding: 12px 16px;
  padding-bottom: calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--border-soft);
  background: var(--bg-appbar);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.contenido {
  width: 100%;
  max-width: 520px;
  margin-inline: auto;
}

.contenido--ancho {
  max-width: 1060px;
}

@media (min-width: 900px) {
  .screen__cuerpo {
    padding: 26px 24px 40px;
  }
}

/* ------------------------------------------------------- tipografía */

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-size: 1.55rem;
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin-bottom: 8px;
}

h2 {
  font-size: 1.08rem;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}

h3 {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-dim);
  font-weight: 650;
  margin-bottom: 11px;
}

p {
  margin: 0 0 12px;
}

p:last-child {
  margin-bottom: 0;
}

.muted {
  color: var(--text-dim);
}

.small {
  font-size: 0.86rem;
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.center {
  text-align: center;
}

/* --------------------------------------------------------- íconos */

/* Todos los íconos son SVG inline y heredan el color del contexto,
   así se tiñen solos con el acento cuando corresponde. */
.ico {
  width: 1em;
  height: 1em;
  display: block;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ico--relleno {
  fill: currentColor;
  stroke: none;
}

/* ------------------------------------------------------------ cards */

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.card:last-child {
  margin-bottom: 0;
}

.card--flat {
  background: var(--bg-elev-2);
  box-shadow: none;
}

.card--ok {
  border-color: rgba(30, 158, 106, 0.45);
  background: linear-gradient(180deg, var(--ok-suave), var(--bg-elev) 70%);
}

.card--warn {
  border-color: rgba(224, 164, 19, 0.5);
  background: linear-gradient(180deg, var(--amarillo-suave), var(--bg-elev) 70%);
}

.card--danger {
  border-color: rgba(214, 69, 69, 0.45);
  background: linear-gradient(180deg, var(--danger-suave), var(--bg-elev) 70%);
}

/* ------------------------------------------------------------ forms */

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 7px;
}

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
textarea,
select {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 14px 14px;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea {
  min-height: 150px;
  font-family: var(--mono);
  font-size: 0.86rem;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 208, 0.18);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-faint);
}

/* el file input nativo era el único control que delataba el navegador */
input[type="file"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  background: var(--bg-elev-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 11px;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--text-dim);
  cursor: pointer;
}

input[type="file"]::file-selector-button {
  -webkit-appearance: none;
  appearance: none;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 9px;
  padding: 8px 13px;
  margin-right: 11px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 650;
  cursor: pointer;
}

input[type="file"]:focus {
  border-color: var(--accent);
  border-style: solid;
}

/* checkbox: nativo pero con el acento del tema y área de toque digna */
input[type="checkbox"] {
  -webkit-appearance: auto;
  appearance: auto;
  accent-color: var(--accent);
  width: 20px;
  height: 20px;
  flex: none;
  margin: 0;
  cursor: pointer;
}

/* fila de checkbox con etiqueta clickeable */
.check-row {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 500;
  margin-bottom: 14px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2);
  cursor: pointer;
}

.check-row:has(input:checked) {
  border-color: var(--danger);
  background: var(--danger-suave);
  color: var(--danger-tinta);
}

.field {
  margin-bottom: 15px;
}

.field:last-child {
  margin-bottom: 0;
}

/* ---------------------------------------------------------- botones */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: 1px solid transparent;
  background: var(--accent-strong);
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 650;
  padding: 15px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: filter 0.15s, opacity 0.15s, transform 0.09s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
  box-shadow: var(--shadow-sm);
}

.btn:active:not(:disabled) {
  transform: scale(0.975);
  filter: brightness(1.12);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.btn--ghost {
  background: var(--bg-elev);
  border-color: var(--border);
  color: var(--accent-strong);
  box-shadow: none;
}

.btn--ghost:active:not(:disabled) {
  background: var(--accent-suave);
}

.btn--danger {
  background: var(--bg-elev);
  border-color: rgba(214, 69, 69, 0.55);
  color: var(--danger-tinta);
  box-shadow: none;
}

.btn--danger:active:not(:disabled) {
  background: var(--danger-suave);
}

/* "Ejecutar concurso": la acción irreversible del evento. Amarillo con
   tinta oscura — entra en la paleta y se lee como "prestá atención". */
.btn--ok {
  background: var(--amarillo);
  color: var(--text);
  border-color: rgba(138, 90, 0, 0.35);
}

.btn--sm {
  width: auto;
  padding: 8px 13px;
  font-size: 0.85rem;
  border-radius: 9px;
}

.btn--auto {
  width: auto;
}

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

.btn-row .btn {
  flex: 1 1 150px;
}

/* ------------------------------------------------- display + teclado */

/* casilleros del número: se llenan de izquierda a derecha */
.digitos {
  display: flex;
  justify-content: center;
  gap: 9px;
  margin: 4px 0 10px;
}

.digito {
  width: clamp(52px, 15vw, 62px);
  height: clamp(66px, 10.5vh, 88px);
  border-radius: 13px;
  background: var(--bg-elev);
  border: 1.5px solid var(--border);
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s, background 0.18s, transform 0.18s;
}

.digito--vacio {
  color: var(--text-faint);
  font-size: 1.3rem;
  background: var(--bg-elev-2);
  box-shadow: none;
}

.digito--activo {
  border-color: var(--accent);
  background: var(--accent-suave);
  box-shadow: 0 0 0 3px rgba(47, 111, 208, 0.14);
}

.digito--nuevo {
  animation: pop 0.18s var(--ease);
}

@keyframes pop {
  0% {
    transform: scale(0.82);
  }
  100% {
    transform: scale(1);
  }
}

@media (max-width: 360px) {
  .digito {
    width: 46px;
    font-size: 1.7rem;
  }

  .digitos {
    gap: 7px;
  }
}

/* teclado numérico propio: nada de teclado del sistema.
   Las teclas crecen en pantallas altas para absorber el aire sobrante
   en vez de dejar un hueco muerto. */
.teclado {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  max-width: 420px;
  margin: 0 auto 10px;
}

.tecla {
  height: clamp(54px, 7.6vh, 72px);
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 650;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
  transition: background 0.12s, transform 0.08s, color 0.12s, border-color 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.tecla:active:not(:disabled) {
  transform: scale(0.94);
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
}

.tecla:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.tecla--accion {
  font-size: 1.15rem;
  font-family: var(--font);
  color: var(--text-dim);
  background: var(--bg-elev-2);
  box-shadow: none;
}

.tecla .ico {
  width: 24px;
  height: 24px;
}

/* --------------------------------------------------------- avisos */

.alert {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.92rem;
  margin-bottom: 14px;
  border: 1px solid;
}

.alert--error {
  background: var(--danger-suave);
  border-color: rgba(214, 69, 69, 0.4);
  color: var(--danger-tinta);
}

.alert--ok {
  background: var(--ok-suave);
  border-color: rgba(30, 158, 106, 0.4);
  color: var(--ok-tinta);
}

.alert--info {
  background: var(--accent-suave);
  border-color: rgba(47, 111, 208, 0.35);
  color: var(--accent-strong);
}

.alert--warn {
  background: var(--amarillo-suave);
  border-color: rgba(224, 164, 19, 0.5);
  color: var(--warn-tinta);
}

/* --------------------------------------------------------- badges */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 650;
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
  color: var(--text-dim);
  white-space: nowrap;
}

.badge--ok {
  color: var(--ok-tinta);
  border-color: rgba(30, 158, 106, 0.45);
  background: var(--ok-suave);
}

.badge--warn {
  color: var(--warn-tinta);
  border-color: rgba(224, 164, 19, 0.55);
  background: var(--amarillo-suave);
}

.badge--off {
  color: var(--danger-tinta);
  border-color: rgba(214, 69, 69, 0.45);
  background: var(--danger-suave);
}

/* ------------------------------------------------- números votados */

.numeros {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.numero-chip {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 9px 15px;
  border-radius: 11px;
  background: var(--accent-suave);
  border: 1px solid rgba(47, 111, 208, 0.3);
  color: var(--accent-strong);
}

/* campo del código: mayúsculas y letras separadas, para leerlo al teclear */
.campo-ticket {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 1.15rem;
  font-weight: 650;
}

.campo-ticket::placeholder {
  letter-spacing: 0.22em;
  font-weight: 400;
}

/* número de ticket: es lo que se dicta en la puerta, así que se lee de lejos */
.ticket-chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 2px 9px;
  border-radius: 8px;
  background: var(--amarillo-suave);
  border: 1px solid rgba(224, 164, 19, 0.55);
  color: var(--amarillo-tinta);
  white-space: nowrap;
}

.numero-chip--sm {
  font-size: 0.88rem;
  padding: 4px 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* --------------------------------------------------------- tablas */

.tabla-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

/* Sólo la tabla de participantes necesita un ancho mínimo, y sólo se
   muestra de 640px para arriba. Las tablas del resultado tienen
   contenido corto y entran sin scroll horizontal. */
.tabla-wrap--ancha table {
  min-width: 560px;
}

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  background: var(--bg-elev-2);
  position: sticky;
  top: 0;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: none;
}

td.num {
  text-align: right;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

/* en celular las tablas del resultado entran justas: recortar el padding
   les da los ~30px que faltaban para no scrollear en horizontal */
@media (max-width: 480px) {
  th,
  td {
    padding: 9px 8px;
  }

  th {
    font-size: 0.68rem;
    letter-spacing: 0.03em;
  }
}

/* ------------------------------------- participantes: tabla ↔ tarjetas */

/* En celular la tabla obligaba a scrollear en horizontal, y al llegar a
   los botones ya no se veía de quién era la fila. Abajo de 640px cada
   participante es una tarjeta con todo junto. */
.lista-tarjetas {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (min-width: 640px) {
  .lista-tarjetas {
    display: none;
  }
}

@media (max-width: 639px) {
  .tabla-wrap--ancha {
    display: none;
  }
}

.p-tarjeta {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  box-shadow: var(--shadow-sm);
}

.p-tarjeta__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 3px;
}

.p-tarjeta__nombre {
  font-weight: 650;
  letter-spacing: -0.01em;
  min-width: 0;
  overflow-wrap: anywhere;
}

.p-tarjeta__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.p-tarjeta__votos {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  background: var(--bg-elev-2);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

.p-tarjeta__acciones {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}

.p-tarjeta__acciones .btn {
  flex: 1;
  width: auto;
}

.p-tarjeta__acciones .btn--menos {
  flex: 0 0 56px;
}

/* --------------------------------------------------- buscador + acción */

/* antes wrapeaba y dejaba el botón huérfano en su propia fila */
.buscador-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 13px;
}

.buscador-row input[type="search"] {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 340px;
  padding-top: 11px;
  padding-bottom: 11px;
}

.buscador-row .btn {
  flex: none;
}

/* ---------------------------------------------------------- stats */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

/* tres tarjetas no deben dejar una huérfana en una grilla de dos */
.stats--tres {
  grid-template-columns: repeat(3, 1fr);
}

.stat {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  box-shadow: var(--shadow-sm);
}

.stat__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.stat__value {
  font-family: var(--mono);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--accent-strong);
}

.stats--tres .stat {
  padding: 11px 10px;
}

.stats--tres .stat__value {
  font-size: 1.2rem;
}

/* ---------------------------------------------------- tabbar (admin) */

.tabbar {
  flex: none;
  display: flex;
  background: var(--bg-appbar);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--border-soft);
  padding-bottom: var(--safe-bottom);
}

.tabbar__item {
  flex: 1;
  border: 0;
  background: none;
  color: var(--text-faint);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 9px 4px;
  padding-bottom: 11px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.tabbar__icono {
  display: grid;
  place-items: center;
  height: 22px;
}

.tabbar__icono .ico {
  width: 21px;
  height: 21px;
}

.tabbar__item[aria-selected="true"] {
  color: var(--accent-strong);
}

.tabbar__item:active {
  color: var(--text);
}

/* --------------------------------------------------------- ganador */

.ganador {
  position: relative;
  overflow: hidden;
  background: linear-gradient(150deg, var(--amarillo-suave), #fffdf6 60%, var(--accent-suave));
  border: 1px solid rgba(224, 164, 19, 0.6);
  border-radius: var(--radius);
  padding: 26px 20px;
  text-align: center;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

/* estela de vuelo detrás del número ganador */
.ganador::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='120' viewBox='0 0 240 120'%3E%3Cg fill='none' stroke='%23f5b921' stroke-width='2' stroke-linecap='round' stroke-dasharray='9 11' opacity='.3'%3E%3Cpath d='M-10 96c60-16 120-26 260-30'/%3E%3Cpath d='M-10 26c50 8 96 12 150 12'/%3E%3C/g%3E%3C/svg%3E")
    no-repeat center / cover;
  pointer-events: none;
}

.ganador > * {
  position: relative;
}

.ganador__numero {
  font-family: var(--mono);
  font-size: 3.1rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
  margin: 8px 0 10px;
  color: var(--accent-strong);
}

.ganador__nombre {
  font-size: 1.22rem;
  font-weight: 650;
}

.ganador__alas {
  display: grid;
  place-items: center;
  color: var(--amarillo-tinta);
  margin-bottom: 2px;
}

.ganador__alas .ico {
  width: 40px;
  height: 40px;
}

/* =================================================== hoja modal */

.hoja-fondo {
  position: fixed;
  inset: 0;
  background: rgba(22, 45, 88, 0.42);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.hoja-fondo.is-abierta {
  opacity: 1;
  pointer-events: auto;
}

.hoja {
  width: 100%;
  max-width: 480px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  padding: 22px 20px;
  padding-bottom: calc(20px + var(--safe-bottom));
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  transition: transform 0.3s var(--ease);
}

.hoja-fondo.is-abierta .hoja {
  transform: translateY(0);
}

.hoja__tirador {
  width: 38px;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
  margin: -6px auto 16px;
}

.hoja__titulo {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.hoja__texto {
  color: var(--text-dim);
  font-size: 0.94rem;
  margin-bottom: 20px;
  white-space: pre-line;
}

.hoja__destacado {
  font-family: var(--mono);
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent-strong);
  text-align: center;
  margin: 4px 0 18px;
}

.hoja__acciones {
  display: flex;
  flex-direction: column-reverse;
  gap: 9px;
}

@media (min-width: 560px) {
  .hoja-fondo {
    align-items: center;
  }

  .hoja {
    border-radius: 22px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 22px;
    transform: translateY(14px) scale(0.97);
  }

  .hoja__tirador {
    display: none;
  }

  .hoja-fondo.is-abierta .hoja {
    transform: translateY(0) scale(1);
  }
}

/* ======================================================== toasts */

.toasts {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  /* debajo del appbar, para no tapar el nombre ni el estado */
  top: calc(56px + var(--safe-top) + 10px);
  z-index: 200;
  width: calc(100% - 24px);
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  border-radius: 13px;
  padding: 12px 15px;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.4;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.97);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  color: var(--text);
  opacity: 0;
  transform: translateY(-14px) scale(0.97);
  transition: opacity 0.24s var(--ease), transform 0.24s var(--ease);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast--ok {
  border-color: rgba(30, 158, 106, 0.55);
  color: var(--ok-tinta);
}

.toast--error {
  border-color: rgba(214, 69, 69, 0.55);
  color: var(--danger-tinta);
}

.toast--warn {
  border-color: rgba(224, 164, 19, 0.6);
  color: var(--warn-tinta);
}

/* ===================================================== helpers */

.hidden {
  display: none !important;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* hélice girando: usa currentColor, así se ve tanto en botón azul
   como en botón fantasma */
.spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  opacity: 0.9;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  margin-right: 7px;
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.22;
  }
}

/* ------------------------------------------------ esqueleto de carga */

/* mientras cargan los participantes, en vez de un "Cargando…" pelado */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-elev-2) 25%,
    #f3f8ff 37%,
    var(--bg-elev-2) 63%
  );
  background-size: 400% 100%;
  animation: skeleton 1.4s ease infinite;
  border-radius: 7px;
}

@keyframes skeleton {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0 0;
  }
}

.sk-linea {
  height: 12px;
  margin-bottom: 8px;
}

.sk-linea:last-child {
  margin-bottom: 0;
}

.sk-boton {
  height: 34px;
  border-radius: 9px;
  flex: 1;
}

/* --------------------------------------- confirmación al votar */

/* avioncito con estela: reemplaza el tilde plano */
.tilde {
  position: relative;
  width: 92px;
  height: 92px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--accent-suave);
  border: 2px solid var(--accent);
  display: grid;
  place-items: center;
  color: var(--accent-strong);
  animation: aparece 0.45s var(--ease);
}

.tilde .ico {
  width: 44px;
  height: 44px;
}

/* ráfaga amarilla alrededor del avioncito */
.tilde::before {
  content: "";
  position: absolute;
  inset: -13px;
  border-radius: 50%;
  border: 2px dashed var(--amarillo);
  opacity: 0.85;
  animation: gira 9s linear infinite;
}

@keyframes gira {
  to {
    transform: rotate(360deg);
  }
}

@keyframes aparece {
  0% {
    transform: scale(0.4);
    opacity: 0;
  }
  60% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* confeti suave para la pantalla de número registrado */
.festejo {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.festejo i {
  position: absolute;
  top: -16px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  opacity: 0;
  animation: cae 3.4s var(--ease) forwards;
}

@keyframes cae {
  0% {
    transform: translateY(-10px) rotate(0deg);
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  100% {
    transform: translateY(105vh) rotate(520deg);
    opacity: 0;
  }
}

/* ------------------------------------------------------ estado vacío */

.vacio {
  text-align: center;
  color: var(--text-dim);
  padding: 34px 16px;
}

.vacio__icono {
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  color: var(--accent);
  opacity: 0.75;
}

.vacio__icono .ico {
  width: 54px;
  height: 54px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  .festejo {
    display: none;
  }
}
