:root {
  --noche:      #14103a;
  --noche-alta: #1e1856;
  --dorado:     #f5c542;
  --menta:      #6fe3b8;
  --coral:      #ff8a75;
  --texto:      #efebff;
  --tenue:      #9b92cf;
  --borde:      rgba(155, 146, 207, 0.28);
}

* { box-sizing: border-box; }

::selection {
  background: rgba(245, 197, 66, 0.28);
  color: var(--texto);
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--noche);
  color: var(--texto);
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(46rem 30rem at 82% -8%, rgba(245, 197, 66, 0.13), transparent 62%),
    radial-gradient(38rem 26rem at 8% 108%, rgba(111, 227, 184, 0.10), transparent 60%);
}

/* ============ Pantalla del participante ============ */

.lienzo {
  position: relative;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.35rem 3rem;
}

.paso {
  width: 100%;
  max-width: 27rem;
}

.marca {
  margin: 0 0 1.6rem;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: var(--dorado);
}

.titular {
  margin: 0 0 0.85rem;
  font-family: "Fraunces", Georgia, serif;
  font-optical-sizing: auto;
  font-weight: 600;
  font-size: clamp(2.3rem, 10vw, 3.1rem);
  line-height: 1.02;
  letter-spacing: -0.015em;
}

.apoyo {
  margin: 0 0 2rem;
  max-width: 32ch;
  color: var(--tenue);
  font-size: 1rem;
  line-height: 1.55;
}

.etiqueta {
  display: block;
  margin-bottom: 0.55rem;
  font-size: 0.9rem;
  color: var(--tenue);
}

#celular {
  width: 100%;
  padding: 1rem 1.1rem;
  border: 1px solid var(--borde);
  border-radius: 0.9rem;
  background: var(--noche-alta);
  color: var(--texto);
  font-family: inherit;
  font-size: 1.35rem;
  letter-spacing: 0.06em;
}

#celular::placeholder { color: rgba(155, 146, 207, 0.55); letter-spacing: 0.06em; }

#celular:focus-visible,
button:focus-visible {
  outline: 2px solid var(--dorado);
  outline-offset: 3px;
}

#boton {
  width: 100%;
  margin-top: 0.9rem;
  padding: 1.05rem 1rem;
  border: 0;
  border-radius: 0.9rem;
  background: var(--dorado);
  color: #2a1d00;
  font-family: inherit;
  font-size: 1.02rem;
  font-weight: 700;
  cursor: pointer;
}

#boton:disabled { opacity: 0.55; cursor: progress; }

.error {
  margin: 0.9rem 0 0;
  padding: 0.8rem 0.95rem;
  border-left: 3px solid var(--coral);
  background: rgba(255, 138, 117, 0.1);
  border-radius: 0 0.5rem 0.5rem 0;
  color: var(--coral);
  font-size: 0.93rem;
  line-height: 1.45;
}

.nota {
  margin: 2.4rem 0 0;
  color: rgba(155, 146, 207, 0.72);
  font-size: 0.85rem;
}

.saludo {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  color: var(--tenue);
}

.saludo span { color: var(--texto); font-weight: 500; }

/* La tarjeta de regalo: el momento memorable */

.tarjeta {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 13.5rem;
  padding: 2.6rem 1.4rem 2.2rem;
  border: 1px solid var(--borde);
  border-radius: 1.4rem 1.4rem 1.4rem 3.4rem;
  background: var(--noche-alta);
  overflow: hidden;
}

.hilo {
  position: absolute;
  top: 0.95rem;
  left: 50%;
  width: 0.62rem;
  height: 0.62rem;
  margin-left: -0.31rem;
  border: 2px solid var(--tenue);
  border-radius: 50%;
}

.ruleta {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.7rem, 8.2vw, 2.5rem);
  line-height: 1.1;
  text-align: center;
  color: var(--tenue);
  overflow-wrap: break-word;
}

.tarjeta.resuelta {
  border-color: rgba(245, 197, 66, 0.55);
  box-shadow: inset 0 0 0 1px rgba(245, 197, 66, 0.18);
}

.tarjeta.resuelta .ruleta {
  color: var(--dorado);
  animation: aterrizaje 0.55s cubic-bezier(0.18, 1.4, 0.4, 1) both;
}

@keyframes aterrizaje {
  from { transform: scale(0.86); opacity: 0.3; }
  to   { transform: scale(1);    opacity: 1; }
}

.cierre {
  margin: 1.4rem 0 0;
  color: var(--menta);
  font-size: 0.95rem;
  line-height: 1.55;
}

.secundario {
  margin-top: 1.6rem;
  padding: 0.75rem 1.2rem;
  border: 1px solid var(--borde);
  border-radius: 0.75rem;
  background: transparent;
  color: var(--tenue);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .tarjeta.resuelta .ruleta { animation: none; }
}

/* ============ Panel de administración ============ */

.panel {
  position: relative;
  max-width: 68rem;
  margin: 0 auto;
  padding: 2.4rem 1.3rem 5rem;
}

.panel-cabecera {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.panel h1 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 1.9rem;
}

.panel h2 {
  margin: 2.6rem 0 0.9rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.salir { color: var(--tenue); font-size: 0.9rem; }

.cifras {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
}

.cifra {
  padding: 1rem 1.1rem;
  border: 1px solid var(--borde);
  border-radius: 0.9rem;
  background: var(--noche-alta);
}

.cifra b {
  display: block;
  font-family: "Fraunces", Georgia, serif;
  font-size: 2.1rem;
  font-weight: 600;
  line-height: 1;
}

.cifra span {
  display: block;
  margin-top: 0.35rem;
  color: var(--tenue);
  font-size: 0.83rem;
  line-height: 1.35;
}

.tabla-envoltura { overflow-x: auto; }

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

th, td {
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--borde);
  text-align: left;
  white-space: nowrap;
}

th { color: var(--tenue); font-weight: 500; }

td.flecha { color: var(--dorado); }

.pendiente { color: var(--tenue); font-style: italic; }

.chip {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 0.4rem;
  background: rgba(111, 227, 184, 0.14);
  color: var(--menta);
  font-size: 0.78rem;
}

.chip.frio {
  background: rgba(155, 146, 207, 0.14);
  color: var(--tenue);
}

textarea {
  width: 100%;
  min-height: 11rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--borde);
  border-radius: 0.8rem;
  background: var(--noche-alta);
  color: var(--texto);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.88rem;
  line-height: 1.6;
  resize: vertical;
}

.panel input[type="text"],
.panel input[type="password"] {
  width: 100%;
  padding: 0.85rem 1rem;
  margin-bottom: 0.7rem;
  border: 1px solid var(--borde);
  border-radius: 0.8rem;
  background: var(--noche-alta);
  color: var(--texto);
  font-family: inherit;
  font-size: 1rem;
}

.panel button {
  padding: 0.8rem 1.3rem;
  border: 0;
  border-radius: 0.8rem;
  background: var(--dorado);
  color: #2a1d00;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

.panel button.peligro {
  background: transparent;
  border: 1px solid rgba(255, 138, 117, 0.5);
  color: var(--coral);
}

.aviso {
  margin: 1rem 0;
  padding: 0.85rem 1rem;
  border-left: 3px solid var(--menta);
  background: rgba(111, 227, 184, 0.09);
  border-radius: 0 0.5rem 0.5rem 0;
  font-size: 0.92rem;
  line-height: 1.5;
}

.aviso.malo {
  border-left-color: var(--coral);
  background: rgba(255, 138, 117, 0.09);
}

.acceso {
  max-width: 22rem;
  margin: 18vh auto 0;
}

.ayuda {
  margin: 0 0 0.9rem;
  color: var(--tenue);
  font-size: 0.9rem;
  line-height: 1.55;
}

.acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1rem;
}

.ayuda a,
.aviso a {
  color: var(--menta);
  text-underline-offset: 0.2em;
}

/* ============ Buscarse en la lista ============ */

.paso.ancho { max-width: 34rem; }

/* --- El campo --- */

.buscador-caja {
  position: relative;
  display: flex;
  align-items: center;
}

.lupa {
  position: absolute;
  left: 1.15rem;
  width: 1.3rem;
  height: 1.3rem;
  color: var(--tenue);
  pointer-events: none;
  transition: color 0.25s ease;
}

#buscador {
  width: 100%;
  padding: 1.3rem 3.3rem 1.3rem 3.35rem;
  border: 1px solid var(--borde);
  border-radius: 1.1rem;
  background: var(--noche-alta);
  color: var(--texto);
  caret-color: var(--dorado);
  font-family: "Fraunces", Georgia, serif;
  font-optical-sizing: auto;
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.25s ease, box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

#buscador::placeholder {
  color: rgba(155, 146, 207, 0.6);
  font-weight: 400;
  letter-spacing: 0;
}

/* El aspa que Chrome mete solo; la nuestra está justo debajo. */
#buscador::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

#buscador:focus {
  outline: none;
  border-color: rgba(245, 197, 66, 0.75);
  box-shadow: 0 0 0 3px rgba(245, 197, 66, 0.16),
              0 22px 48px -30px rgba(245, 197, 66, 0.75);
}

.buscador-caja:focus-within .lupa { color: var(--dorado); }

.limpiar {
  position: absolute;
  right: 0.85rem;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(155, 146, 207, 0.16);
  color: var(--tenue);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.limpiar svg { width: 1rem; height: 1rem; }
.limpiar:hover { background: rgba(155, 146, 207, 0.28); color: var(--texto); }

.limpiar:focus-visible {
  outline: 2px solid var(--dorado);
  outline-offset: 2px;
}

/* --- Antes de escribir --- */

.pista {
  margin: 1.1rem 0 0;
  color: var(--tenue);
  font-size: 0.9rem;
}

.pista strong { color: var(--texto); font-weight: 500; }

/* --- Los resultados --- */

.resultados {
  margin-top: 1.1rem;
  max-height: 23rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--borde);
  border-radius: 1.1rem;
  background: var(--noche-alta);
  scrollbar-width: thin;
  scrollbar-color: rgba(155, 146, 207, 0.45) transparent;
}

.resultados::-webkit-scrollbar { width: 10px; }
.resultados::-webkit-scrollbar-track { background: transparent; }
.resultados::-webkit-scrollbar-thumb {
  border: 3px solid var(--noche-alta);
  border-radius: 10px;
  background: rgba(155, 146, 207, 0.45);
}

.nombres { list-style: none; margin: 0; padding: 0.4rem; }

/* Una línea finísima entre filas: sin ella se leen como un solo bloque. */
.nombres li + li::before {
  content: "";
  display: block;
  height: 1px;
  margin: 0 1rem;
  background: rgba(155, 146, 207, 0.14);
}

.nombres li {
  animation: asoma 0.42s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(var(--turno, 0) * 28ms);
}

@keyframes asoma {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.nombre {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.9rem 1rem;
  border: 0;
  border-radius: 0.75rem;
  background: transparent;
  color: var(--texto);
  font-family: inherit;
  font-size: 1.02rem;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.nombre .quien { overflow-wrap: anywhere; }

/* El trozo que la persona acaba de escribir. */
.nombre mark {
  background: transparent;
  color: var(--dorado);
  font-weight: 700;
}

.punta {
  flex: none;
  width: 1.1rem;
  height: 1.1rem;
  color: var(--dorado);
  opacity: 0;
  transform: translateX(-5px);
  transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.nombre:hover:not(:disabled),
.nombre.activo,
.nombre:focus-visible:not(:disabled) {
  background: rgba(245, 197, 66, 0.09);
  outline: none;
}

.nombre:focus-visible:not(:disabled) { box-shadow: inset 0 0 0 1px rgba(245, 197, 66, 0.5); }

.nombre:hover:not(:disabled) .punta,
.nombre.activo .punta,
.nombre:focus-visible:not(:disabled) .punta { opacity: 1; transform: none; }

/* Quien ya jugó: se ve, se lee, y no se puede tocar. */
.nombre:disabled {
  color: var(--tenue);
  cursor: not-allowed;
}

.nombre:disabled mark { color: var(--tenue); font-weight: 700; }

.sello {
  flex: none;
  padding: 0.15rem 0.55rem;
  border-radius: 0.4rem;
  background: rgba(155, 146, 207, 0.14);
  color: var(--tenue);
  font-size: 0.72rem;
  white-space: nowrap;
}

.vacio {
  margin: 1.1rem 0 0;
  padding: 1.1rem 1.2rem;
  border: 1px dashed var(--borde);
  border-radius: 1.1rem;
  color: var(--tenue);
  font-size: 0.93rem;
  line-height: 1.55;
}

/* Para los lectores de pantalla, no para la vista. */
.sr-solo {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .nombres li { animation: none; }
  .punta { transition: none; }
}

.confirmar-nombre {
  margin: 0 0 1.4rem;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.6rem, 7vw, 2.2rem);
  line-height: 1.15;
  color: var(--dorado);
  overflow-wrap: break-word;
}

#soy-yo {
  width: 100%;
  padding: 1.05rem 1rem;
  border: 0;
  border-radius: 0.9rem;
  background: var(--dorado);
  color: #2a1d00;
  font-family: inherit;
  font-size: 1.02rem;
  font-weight: 700;
  cursor: pointer;
}

#soy-yo:disabled { opacity: 0.55; cursor: not-allowed; }

#no-soy { width: 100%; margin-top: 0.7rem; }

a.secundario { display: inline-block; text-decoration: none; }

/* ============ Enlaces del panel ============ */

.enlace-unico {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.enlace-unico input {
  flex: 1 1 18rem;
  min-width: 0;
  padding: 0.8rem 1rem;
  border: 1px solid var(--borde);
  border-radius: 0.8rem;
  background: var(--noche-alta);
  color: var(--menta);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.9rem;
}

.enlace-celda { white-space: nowrap; }

.enlace-celda input {
  width: 12rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--borde);
  border-radius: 0.5rem;
  background: var(--noche);
  color: var(--tenue);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.75rem;
}

.panel .copiar,
.wa-boton {
  padding: 0.45rem 0.8rem;
  border-radius: 0.6rem;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.panel .copiar {
  border: 1px solid var(--borde);
  background: transparent;
  color: var(--texto);
  cursor: pointer;
}

.panel .copiar.copiado {
  border-color: var(--menta);
  color: var(--menta);
}

.wa-boton {
  display: inline-block;
  border: 1px solid rgba(111, 227, 184, 0.45);
  background: rgba(111, 227, 184, 0.1);
  color: var(--menta);
  text-decoration: none;
}

.enlace-unico .copiar,
.enlace-unico .wa-boton { padding: 0.8rem 1.1rem; font-size: 0.9rem; }

/* ============ Subir el archivo ============ */

.archivo {
  display: block;
  margin-bottom: 0.9rem;
  padding: 1.1rem 1.2rem;
  border: 1px dashed var(--borde);
  border-radius: 0.9rem;
  background: var(--noche-alta);
  cursor: pointer;
}

.archivo span {
  display: block;
  margin-top: 0.5rem;
  color: var(--tenue);
  font-size: 0.85rem;
}

.archivo input[type="file"] { color: var(--texto); font-family: inherit; font-size: 0.9rem; }

.o-bien { margin: 0 0 0.5rem; }
