/* ===== Divisor de equipos ===== */

.contenedor {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ===== Opciones ===== */
.opciones {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.segmentado {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
}

.segmentado label {
  position: relative;
  cursor: pointer;
}

.segmentado input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmentado span {
  display: block;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  color: var(--texto-suave);
  transition: background-color 0.15s, color 0.15s;
}

.segmentado input:checked + span {
  background: #fff;
  color: var(--verde);
}

.segmentado input:focus-visible + span {
  outline: 3px solid var(--foco);
  outline-offset: 2px;
}

.interruptor {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  cursor: pointer;
}

.interruptor input {
  width: 20px;
  height: 20px;
  accent-color: var(--cesped-1);
}

/* ===== Lista de jugadores ===== */
.panel-titulo {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.panel-titulo h2 {
  margin: 0;
  font-size: 20px;
}

.contador {
  font-weight: 700;
  font-size: 14px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(46, 125, 50, 0.85);
  white-space: nowrap;
}

.contador.incompleto {
  background: rgba(255, 202, 40, 0.9);
  color: var(--equipo-b-texto);
}

.ayuda {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--texto-suave);
}

.lista-jugadores {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 8px;
}

.jugador {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  transition: opacity 0.15s;
}

.jugador.fuera {
  opacity: 0.5;
}

.jugador .juega {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--cesped-1);
  cursor: pointer;
}

.jugador .nombre {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  padding: 6px 10px;
}

.jugador .nivel {
  flex-shrink: 0;
  min-height: 38px;
  padding: 6px 4px;
  width: 64px;
}

.sin-nivel .nivel {
  display: none;
}

.jugador .quitar {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--texto-suave);
  font-size: 18px;
  cursor: pointer;
}

.jugador .quitar:hover {
  background: rgba(229, 57, 53, 0.25);
  color: #fff;
}

.fila-agregar {
  display: flex;
  gap: 8px;
}

.fila-agregar .campo {
  flex: 1;
  min-width: 0;
}

/* ===== Botón principal ===== */
.btn-grande {
  min-height: 56px;
  font-size: 19px;
  box-shadow: var(--sombra);
}

/* ===== Resultado ===== */
.equipos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.equipo {
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.06);
  border-top: 5px solid var(--equipo-a);
}

.equipo-b {
  border-top-color: var(--equipo-b);
}

.equipo h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.equipo .cantidad {
  font-size: 14px;
  font-weight: 400;
  color: var(--texto-suave);
}

.equipo ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.equipo li {
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 17px;
}

.equipo li:last-child {
  border-bottom: 0;
}

.diferencia {
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--texto-suave);
  text-align: center;
}

.diferencia:empty {
  display: none;
}

.acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.acciones .btn {
  flex: 1 1 160px;
}

@media (max-width: 420px) {
  .opciones {
    flex-direction: column;
    align-items: stretch;
  }

  .segmentado {
    justify-content: center;
  }

  .segmentado label {
    flex: 1;
    text-align: center;
  }

  .equipos {
    gap: 8px;
  }

  .equipo {
    padding: 10px;
  }

  .equipo li {
    font-size: 16px;
  }
}

/* En el celu el botón queda a mano mientras se recorre la lista */
@media (max-width: 720px) {
  .btn-grande {
    position: sticky;
    bottom: max(12px, env(safe-area-inset-bottom));
    z-index: 5;
  }
}

/* ===== Vistas ===== */
.vista {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.vista[hidden] {
  display: none;
}

/* Paneles de las vistas de grupo (el modo "lista a mano" mantiene su diseño) */
.vista:not(#vistaManual) .panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vista:not(#vistaManual) .panel > h2 {
  margin: 0;
  font-size: 20px;
}

.vista:not(#vistaManual) .panel > .ayuda,
.vista:not(#vistaManual) .panel > p {
  margin: 0;
}

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

.btn-link {
  align-self: center;
  border: 0;
  background: none;
  color: var(--texto-suave);
  font: inherit;
  font-size: 14px;
  text-decoration: underline;
  cursor: pointer;
  padding: 6px;
}

.btn-link:hover {
  color: var(--texto);
}

.btn-chico {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 14px;
}

.btn-ancho {
  width: 100%;
}

.btn-destacado {
  background: var(--equipo-b);
  color: var(--equipo-b-texto);
}

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

.aviso {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 202, 40, 0.16);
  border: 1px solid rgba(255, 202, 40, 0.6);
  font-size: 14px;
}

.sin-conexion {
  margin: 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 13px;
  text-align: center;
}

.separador {
  margin: 0;
  text-align: center;
  color: var(--texto-suave);
}

.vacia {
  margin: 4px 0 12px;
  padding: 16px;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.3);
  text-align: center;
  color: var(--texto-suave);
}

/* ===== Crear grupo ===== */
.form-crear,
.form-partido {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-partido {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.form-partido .ancho {
  grid-column: 1 / -1;
}

.etiqueta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
}

.etiqueta .ayuda {
  font-weight: 400;
  margin: 0;
}

.fila-codigo {
  display: flex;
  gap: 8px;
}

.fila-codigo .campo {
  flex: 1;
  min-width: 0;
}

textarea.campo {
  resize: vertical;
  min-height: 120px;
  font: inherit;
  font-size: 16px;
}

.codigo-grande {
  margin: 0;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 22px;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
  user-select: all;
}

/* ===== Chips (¿Quién sos? y asistencia) ===== */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.chip.grande {
  padding: 10px 16px;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--texto);
  border-color: rgba(255, 255, 255, 0.3);
}

.chip.va {
  background: var(--cesped-1);
  color: #fff;
  border-color: #81c784;
}

.chip.no {
  background: rgba(229, 57, 53, 0.22);
  color: #fff;
  border-color: #ef9a9a;
}

.chip.pend {
  background: rgba(255, 255, 255, 0.1);
  color: var(--texto-suave);
  border-color: rgba(255, 255, 255, 0.25);
}

.chip.yo {
  box-shadow: 0 0 0 2px var(--equipo-b);
}

/* ===== Grupo: selector ===== */
.selector-boton {
  border: 0;
  background: none;
  color: var(--texto);
  font: inherit;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 0;
  text-align: left;
}

.menu-grupos {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--borde-panel);
  padding-top: 6px;
}

.opcion-menu {
  border: 0;
  background: none;
  color: var(--texto);
  font: inherit;
  text-align: left;
  padding: 10px 4px;
  border-radius: 8px;
  cursor: pointer;
}

.opcion-menu:hover {
  background: rgba(255, 255, 255, 0.08);
}

.opcion-menu.peligro {
  color: #ef9a9a;
}

/* ===== Grupo: partido ===== */
.partido-titulo {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.pregunta {
  margin: 4px 0 0;
  font-weight: 700;
}

.respuestas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.resp {
  min-height: 52px;
  font-size: 17px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--texto);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.resp.elegido-voy {
  background: var(--cesped-1);
  border-color: #a5d6a7;
  color: #fff;
}

.resp.elegido-no {
  background: rgba(229, 57, 53, 0.3);
  border-color: #ef9a9a;
  color: #fff;
}

.cupo {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cupo-texto {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.barra-cupo {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.barra-cupo span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--cesped-1);
  transition: width 0.3s;
}

.barra-cupo.lleno span {
  background: var(--equipo-b);
}

.grupo-chips {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.grupo-chips h3 {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--texto-suave);
}

.botones-chicos {
  display: flex;
  gap: 8px;
}

/* ===== Sin grupo ===== */
.barra-manual {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  font-size: 14px;
  color: var(--texto-suave);
}

.vista:not(#vistaManual) .ayuda {
  margin: 0;
}
