/* Oswald (solo subconjunto latino, ~12KB) autoalojada para titulares y
   marcadores — nada de CDN externo, coherente con que la PWA deba poder
   cachearse entera y funcionar sin depender de terceros en cada carga. */
@font-face {
  font-family: 'Oswald';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/oswald-700.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122;
}

:root {
  --verde: #0d5c3f;
  --verde-claro: #16824f;
  --rojo: #c0392b;
  --gris-100: #f1f2f4;
  --gris-200: #e3e6ea;
  --gris-400: #a7aeb6;
  --gris-700: #444a52;
  --texto: #14171a;
  --superficie: #ffffff;
  --superficie-alta: #eceef1;
  --borde-tarjeta: none;
  --burbuja-propia: #e3f2ec;
  --radio: 16px;
  --radio-chico: 10px;
  --sombra: 0 1px 2px rgba(20, 23, 26, .04), 0 6px 16px rgba(20, 23, 26, .08);
  --sombra-alta: 0 16px 40px rgba(20, 23, 26, .16);
  --fuente-display: 'Oswald', 'Arial Narrow', sans-serif;
  --patron-cesped: repeating-linear-gradient(
    118deg,
    rgba(255, 255, 255, .05) 0px, rgba(255, 255, 255, .05) 26px,
    transparent 26px, transparent 52px
  );
  color-scheme: light;
}

/* Dark-first: es el aspecto por defecto de la app (ver fijarValorPorDefectoTema
   en app.js), inspirado en apps de resultados tipo FotMob — fondo casi negro,
   tarjetas claramente más claras para que la elevación se note de verdad, y
   un verde mucho más vivo como acento en vez de ambientar toda la pantalla. */
:root[data-tema="oscuro"] {
  --verde: #22e07f;
  --verde-claro: #3df09a;
  --rojo: #ff6b6b;
  --gris-100: #0a0c0f;
  --gris-200: #23272d;
  --gris-400: #3c434b;
  --gris-700: #99a2ac;
  --texto: #f4f6f7;
  --superficie: #16191d;
  --superficie-alta: #1f242a;
  --borde-tarjeta: 1px solid #23272d;
  --burbuja-propia: #123322;
  --sombra: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px rgba(0, 0, 0, .4);
  --sombra-alta: 0 20px 50px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

@keyframes fade-in-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pop-in { 0% { transform: scale(.5); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-14px) scale(.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px) scale(.95); } }
@keyframes flash-resaltado { 0% { background: #fff3b0; } 100% { background: transparent; } }
@keyframes bounce-nav { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-3px); } }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--gris-100);
  color: var(--texto);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overscroll-behavior-y: contain;
  -webkit-tap-highlight-color: transparent;
}

/* nada de selección de texto tipo "página web" en los controles de la interfaz */
button, a, .tri, nav.bottomnav, header.topbar, .tabs {
  user-select: none;
  -webkit-user-select: none;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* [hidden] debe ganar siempre, aunque header.topbar/nav.bottomnav pongan su
   propio display:flex con más especificidad que la regla [hidden] del user
   agent — si no, se ven aunque tengan el atributo hidden puesto. */
header.topbar[hidden], nav.bottomnav[hidden] { display: none; }

header.topbar {
  background-image: var(--patron-cesped), linear-gradient(135deg, var(--verde-claro) 0%, var(--verde) 55%, #073826 100%);
  background-color: var(--verde);
  color: #fff;
  padding: calc(.75rem + env(safe-area-inset-top)) 1rem .75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .35);
}

header.topbar h1 {
  font-family: var(--fuente-display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.topbar-derecha {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-shrink: 0;
}

header.topbar select {
  background: rgba(255, 255, 255, .15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 6px;
  padding: .3rem .4rem;
  max-width: 38vw;
  font-size: .82rem;
}

.boton-gestion {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, .15);
  border: 1px solid rgba(255, 255, 255, .3);
  color: #fff;
  text-decoration: none;
  flex-shrink: 0;
  transition: transform .15s ease, background-color .15s ease;
}
.boton-gestion svg { width: 1.15rem; height: 1.15rem; }
.boton-gestion:active { transform: scale(.9) rotate(20deg); background: rgba(255, 255, 255, .3); }

main {
  flex: 1;
  padding: .75rem;
  padding-bottom: calc(5rem + env(safe-area-inset-bottom));
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

main.anim-vista { animation: fade-in-up .22s ease both; }
main.anim-profundizar { animation: deslizar-desde-derecha .28s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes deslizar-desde-derecha { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: translateX(0); } }

.pull-refresh {
  height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gris-100);
  color: var(--verde);
}
.pull-refresh-icono {
  font-size: 1.3rem;
  display: inline-block;
  line-height: 1;
}
.pull-refresh.cargando .pull-refresh-icono { animation: pull-refresh-girar .7s linear infinite; }
@keyframes pull-refresh-girar { to { transform: rotate(360deg); } }

.pantalla-auth {
  min-height: calc(100vh - 1.5rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.75rem;
  margin: -.75rem -.75rem 0;
  padding: 2.5rem 1.25rem 3rem;
  background-image: var(--patron-cesped), linear-gradient(160deg, var(--verde-claro) 0%, var(--verde) 45%, #052a1c 100%);
}
.pantalla-auth-marca { text-align: center; color: #fff; }
.pantalla-auth-icono {
  font-size: 3.4rem;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .35));
  animation: pulso-splash 2.6s ease-in-out infinite;
}
.pantalla-auth-marca h1 { margin: .5rem 0 0; font-size: 1.35rem; font-weight: 800; }
.pantalla-auth-marca p { margin: .15rem 0 0; opacity: .8; font-size: .72rem; letter-spacing: .12em; }
.pantalla-auth-card {
  width: 100%;
  max-width: 380px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .25);
}

.splash-arranque {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
}
.splash-icono {
  font-size: 3rem;
  animation: pulso-splash 1.1s ease-in-out infinite;
}
@keyframes pulso-splash { 0%, 100% { opacity: .4; transform: scale(.92); } 50% { opacity: 1; transform: scale(1); } }

nav.bottomnav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--superficie);
  border-top: var(--borde-tarjeta);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, .12);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 10;
}

.nav-pill {
  position: absolute;
  top: .3rem;
  height: 2.1rem;
  background: var(--superficie-alta);
  border-radius: var(--radio-chico);
  opacity: 0;
  transition: transform .3s cubic-bezier(.34, 1.56, .64, 1), width .3s cubic-bezier(.34, 1.56, .64, 1), opacity .2s ease;
  z-index: 0;
  pointer-events: none;
}

nav.bottomnav a { position: relative; z-index: 1; }

nav.bottomnav a {
  flex: 1;
  text-align: center;
  padding: .5rem 0 .6rem;
  font-size: .68rem;
  color: var(--gris-700);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .15rem;
  transition: color .2s ease;
}

nav.bottomnav a .icono { display: flex; transition: transform .2s ease; }
nav.bottomnav a .icono svg { width: 1.35rem; height: 1.35rem; }
nav.bottomnav a.activo { color: var(--verde); font-weight: 600; }
nav.bottomnav a.activo .icono { animation: bounce-nav .35s ease; }
nav.bottomnav a:active .icono { transform: scale(.85); }

.card {
  background: var(--superficie);
  border: var(--borde-tarjeta);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 1rem;
  margin-bottom: .75rem;
  animation: fade-in-up .3s ease both;
}

h2.titulo-vista {
  font-family: var(--fuente-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: .01em;
  text-transform: uppercase;
  margin: .25rem 0 .85rem;
}

.cabecera-con-vuelta {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin: -.1rem 0 .75rem -.4rem;
}
.cabecera-con-vuelta .titulo-vista { margin: 0; }
.boton-atras {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.3rem;
  height: 2.3rem;
  flex-shrink: 0;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--verde);
  text-decoration: none;
  border-radius: 50%;
  transition: background-color .15s ease, transform .12s ease;
}
.boton-atras:active { background: var(--gris-100); transform: scale(.9); }

.tarjeta-rivales {
  display: flex;
  align-items: center;
  gap: .7rem;
  background: var(--superficie);
  border: var(--borde-tarjeta);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: .8rem .9rem;
  margin-bottom: .75rem;
  text-decoration: none;
  color: var(--texto);
  animation: fade-in-up .3s ease both;
  transition: transform .12s ease;
}
.tarjeta-rivales:active { transform: scale(.98); }
.tarjeta-rivales-icono { font-size: 1.4rem; flex-shrink: 0; }
.tarjeta-rivales strong { display: block; font-size: .88rem; }
.tarjeta-rivales-sub { font-size: .72rem; }
.tarjeta-rivales-flecha { margin-left: auto; font-size: 1.3rem; color: var(--gris-400); }

.tarjeta-partido {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  background: var(--superficie);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: .6rem .75rem;
  margin-bottom: .5rem;
  border-left: 3px solid var(--verde-claro);
  animation: fade-in-up .3s ease both;
  transition: background-color .3s ease, transform .15s ease;
}
.tarjeta-partido:active { transform: scale(.995); }
.tarjeta-partido.bloqueada { border-left-color: var(--gris-400); opacity: .82; }
.tarjeta-partido.recien-guardado { animation: flash-resaltado 1s ease; }

.tarjeta-partido-cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .2rem;
}

.tarjeta-partido-cabecera .fecha-partido {
  font-size: .66rem;
  color: var(--gris-700);
}

.fila-equipo-marcador {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .2rem 0;
}
.equipo-compacto {
  flex: 1;
  display: flex;
  align-items: center;
  gap: .5rem;
  min-width: 0;
  font-size: .85rem;
  font-weight: 600;
}
.equipo-compacto span { overflow-wrap: break-word; }
.equipo-compacto .tri,
.equipo-compacto .escudo-equipo img {
  width: 1.55rem;
  height: 1.55rem;
}

.fila-equipo-marcador input {
  width: 2.1rem;
  flex-shrink: 0;
  text-align: center;
  font-family: var(--fuente-display);
  font-size: 1.05rem;
  font-weight: 700;
  padding: .3rem 0;
  border: 1px solid var(--gris-400);
  border-radius: var(--radio-chico);
  background: var(--superficie);
  color: var(--texto);
  transition: box-shadow .15s ease;
}
.fila-equipo-marcador input:disabled { background: var(--superficie-alta); color: var(--gris-700); border-color: transparent; }
.fila-equipo-marcador input:focus { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--verde) 25%, transparent); }

.boton-extra-prediccion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: none;
  background: none;
  color: var(--gris-700);
  font-size: .72rem;
  font-weight: 600;
  padding: .35rem .1rem;
  cursor: pointer;
}
.chevron-extra { transition: transform .15s ease; }
.boton-extra-prediccion.abierto .chevron-extra { transform: rotate(90deg); }
.campos-extra-prediccion[hidden] { display: none; }
.campos-extra-prediccion {
  display: flex;
  gap: .5rem;
  padding: .1rem 0 .3rem;
}
.campos-extra-prediccion .campo { flex: 1; margin: 0; }
.campos-extra-prediccion label { font-size: .68rem; }
.campos-extra-prediccion input {
  width: 100%;
  font-size: .82rem;
  padding: .4rem .5rem;
  border: 1px solid var(--gris-400);
  border-radius: var(--radio-chico);
  background: var(--superficie);
  color: var(--texto);
}
.campos-extra-prediccion input:disabled { background: var(--superficie-alta); color: var(--gris-700); border-color: transparent; }
.campos-extra-prediccion input:focus { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--verde) 25%, transparent); }

.enlace-detalle {
  display: inline-block;
  border: none;
  background: none;
  color: var(--verde);
  text-decoration: none;
  font-size: .72rem;
  font-weight: 700;
  padding: .2rem .3rem;
  cursor: pointer;
  border-radius: 6px;
  transition: background-color .15s ease, transform .12s ease;
}
.enlace-detalle:active { transform: scale(.92); background: var(--superficie-alta); }

.partido-equipos {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

.equipo {
  flex: 1;
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .82rem;
  min-width: 0;
  line-height: 1.15;
}
.equipo span { overflow-wrap: break-word; }
.equipo.visitante { justify-content: flex-end; text-align: right; }

.tri {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 50%;
  background: var(--tri-bg, var(--verde));
  color: var(--tri-txt, #fff);
  border: 2px solid var(--tri-borde, rgba(255, 255, 255, .55));
  font-size: .6rem;
  font-weight: 800;
  letter-spacing: .01em;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .18), inset 0 0 0 1px rgba(255, 255, 255, .12);
  animation: pop-in .35s cubic-bezier(.34, 1.56, .64, 1) both;
}

.escudo-equipo {
  display: inline-flex;
  flex-shrink: 0;
  animation: pop-in .35s cubic-bezier(.34, 1.56, .64, 1) both;
}
.escudo-equipo img {
  width: 2.15rem;
  height: 2.15rem;
  object-fit: contain;
  flex-shrink: 0;
}
.escudo-equipo .tri-fallback { display: none; animation: none; }

.marcador {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-shrink: 0;
}

.separador-marcador { color: var(--gris-400); font-weight: 700; }

.marcador input {
  width: 2.6rem;
  text-align: center;
  font-family: var(--fuente-display);
  font-size: 1.3rem;
  font-weight: 700;
  padding: .5rem 0;
  border: 1px solid var(--gris-400);
  border-radius: var(--radio-chico);
  background: var(--superficie);
  color: var(--texto);
  transition: box-shadow .15s ease;
}

.marcador input:focus { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--verde) 25%, transparent); }
.marcador input:disabled { background: var(--superficie-alta); color: var(--gris-700); border-color: transparent; }

.guardado-indicador {
  display: block;
  text-align: right;
  font-size: .68rem;
  font-weight: 600;
  color: var(--verde);
  opacity: 0;
  white-space: nowrap;
}
.guardado-indicador.mostrar { animation: indicador-guardado 1.6s ease; }
@keyframes indicador-guardado {
  0% { opacity: 0; transform: translateY(2px); }
  15% { opacity: 1; transform: translateY(0); }
  75% { opacity: 1; }
  100% { opacity: 0; }
}

.btn {
  display: inline-block;
  background: linear-gradient(135deg, var(--verde-claro), var(--verde));
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: .7rem 1.1rem;
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .01em;
  cursor: pointer;
  text-align: center;
  transition: transform .12s ease, box-shadow .15s ease, filter .15s ease;
}
.btn:not(:disabled):hover { box-shadow: 0 4px 14px color-mix(in srgb, var(--verde) 35%, transparent); filter: brightness(1.05); }
.btn:not(:disabled):active { transform: scale(.97); }
.btn:disabled { background: var(--gris-400); cursor: not-allowed; }
.btn.secundario { background: var(--superficie); color: var(--verde); border: 1px solid var(--verde); }
.btn.ancho { display: block; width: 100%; }

.campo {
  margin-bottom: .75rem;
}
.campo label {
  display: block;
  font-size: .8rem;
  color: var(--gris-700);
  margin-bottom: .3rem;
}
.campo input, .campo select {
  width: 100%;
  padding: .6rem .7rem;
  border: 1px solid var(--gris-400);
  border-radius: var(--radio-chico);
  background: var(--superficie);
  color: var(--texto);
  font-size: .95rem;
}
.campo input:focus, .campo select:focus {
  outline: none;
  border-color: var(--verde);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--verde) 20%, transparent);
}

.mensaje {
  padding: .6rem .8rem;
  border-radius: var(--radio-chico);
  font-size: .85rem;
  margin-bottom: .75rem;
}
.mensaje.error { background: color-mix(in srgb, var(--rojo) 14%, var(--superficie)); color: var(--rojo); }
.mensaje.ok { background: color-mix(in srgb, var(--verde) 14%, var(--superficie)); color: var(--verde-claro); }

.fila-liga {
  display: block;
  width: 100%;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  padding: .6rem 0;
  border-bottom: 1px solid var(--gris-200);
  animation: fade-in-up .3s ease both;
  transition: background-color .15s ease;
}
.fila-liga:last-child { border-bottom: none; }
.fila-liga:active { background: var(--superficie-alta); }

.chevron-fila-liga { color: var(--gris-700); flex-shrink: 0; }

.cabecera-equipo-detalle {
  display: flex;
  align-items: center;
  gap: .7rem;
}
.cabecera-equipo-detalle strong { font-size: 1.1rem; }

.tabla-casa-fuera {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  border-top: 1px solid var(--gris-200);
  padding-top: .6rem;
}
.fila-casa-fuera {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  font-size: .8rem;
  gap: .4rem;
}
.fila-casa-fuera span:first-child { color: var(--gris-700); }
.fila-casa-fuera span:not(:first-child) { text-align: center; font-weight: 600; }
.fila-casa-fuera-cabecera span { color: var(--gris-700); font-weight: 600; font-size: .72rem; }
.fila-casa-fuera-cabecera span:not(:first-child) { text-align: center; }

.lista-plantilla {
  display: flex;
  flex-direction: column;
  margin-bottom: .8rem;
  border-radius: var(--radio-chico);
  overflow: hidden;
  background: var(--superficie-alta);
}
.fila-jugador-plantilla {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .55rem .7rem;
  border-bottom: 1px solid var(--gris-200);
  font-size: .85rem;
}
.fila-jugador-plantilla:last-child { border-bottom: none; }
.dorsal-jugador {
  width: 1.8rem;
  flex-shrink: 0;
  text-align: center;
  font-family: var(--fuente-display);
  font-weight: 700;
  font-size: .95rem;
  color: var(--verde);
}
.nombre-jugador-plantilla { flex: 1; min-width: 0; overflow-wrap: break-word; }
.edad-jugador { flex-shrink: 0; font-size: .74rem; }

.selector-jugador { position: relative; }
/* .flotante: colgado de <body> y posicionado en JS (ver activarSelectorJugador),
   no relativo a .selector-jugador — así escapa del contexto de apilamiento
   que crea cada .tarjeta-partido (tiene "animation" siempre puesto) y no se
   queda enterrado detrás de la tarjeta siguiente. */
.selector-jugador-lista.flotante {
  position: fixed;
  z-index: 1000;
  max-height: 230px;
  overflow-y: auto;
  background: var(--superficie-alta);
  border: 1px solid var(--gris-400);
  border-radius: var(--radio-chico);
  box-shadow: var(--sombra-alta);
}
.selector-jugador-opcion {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  color: var(--texto);
  padding: .55rem .7rem;
  font-size: .85rem;
  cursor: pointer;
}
.selector-jugador-opcion:hover, .selector-jugador-opcion:active { background: var(--superficie); }
.selector-jugador-vacio { padding: .6rem .7rem; font-size: .82rem; }

.selector-jugador-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-bottom: .35rem;
}
.chip-seleccionado {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: color-mix(in srgb, var(--verde) 16%, var(--superficie-alta));
  color: var(--verde);
  border-radius: 20px;
  padding: .25rem .35rem .25rem .65rem;
  font-size: .78rem;
  font-weight: 600;
}
.quitar-chip {
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  font-size: .72rem;
  padding: .1rem .25rem;
  line-height: 1;
}
.selector-jugador-caja { width: 100%; }

.fila-liga-cabecera {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.puesto-liga {
  width: 1.6rem;
  flex-shrink: 0;
  font-family: var(--fuente-display);
  font-weight: 700;
  color: var(--gris-700);
  font-size: 1rem;
}

.nombre-liga {
  flex: 1;
  min-width: 0;
  font-size: .88rem;
  font-weight: 600;
  overflow-wrap: break-word;
}

.pts-liga {
  flex-shrink: 0;
  font-family: var(--fuente-display);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--verde);
}
.pts-liga small { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-weight: 600; font-size: .6rem; color: var(--gris-700); }

.fila-liga-stats {
  display: flex;
  flex-wrap: wrap;
  gap: .1rem .6rem;
  margin: .4rem 0 0 calc(1.4rem + 2.15rem + .5rem + .5rem);
  font-size: .68rem;
  color: var(--gris-700);
}
.fila-liga-stats strong { color: var(--texto); }

@media (max-width: 360px) {
  .fila-liga-stats { margin-left: 0; }
}

.tabs {
  display: flex;
  gap: .4rem;
  margin-bottom: .75rem;
  flex-wrap: wrap;
}
.tabs button {
  border: 1px solid var(--gris-400);
  background: var(--superficie);
  border-radius: 20px;
  padding: .35rem .8rem;
  font-size: .78rem;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .12s ease, background-color .2s ease, color .2s ease, border-color .2s ease;
}
@media (max-width: 380px) {
  .tabs button { padding: .32rem .6rem; font-size: .73rem; }
}
.tabs button:active { transform: scale(.93); }
.tabs button.activo {
  background: var(--verde);
  border-color: var(--verde);
  color: #fff;
  animation: pop-in .25s ease both;
}

.tabs-admin {
  margin-top: .25rem;
}
.tabs-admin button {
  padding: .3rem .6rem;
  font-size: .72rem;
}

.fila-clasificacion {
  display: flex;
  align-items: center;
  padding: .5rem 0;
  border-bottom: 1px solid var(--gris-200);
  font-size: .85rem;
  gap: .5rem;
  animation: fade-in-up .3s ease both;
  transition: background-color .3s ease;
}
.fila-clasificacion .puesto { width: 1.6rem; font-family: var(--fuente-display); font-weight: 700; font-size: 1rem; color: var(--gris-700); }
.fila-clasificacion .alias { flex: 1; }
.ajuste-nota { font-size: .68rem; }
.fila-clasificacion .total { font-family: var(--fuente-display); font-weight: 700; font-size: 1.05rem; }
.fila-clasificacion:nth-child(1) .puesto { color: #d4af37; }
.fila-clasificacion:nth-child(2) .puesto { color: #9aa0a6; }
.fila-clasificacion:nth-child(3) .puesto { color: #b06a3a; }

.tarjeta-rival { animation: fade-in-up .3s ease both; }
.tarjeta-rival-cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  width: 100%;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.tarjeta-rival.abierta .tarjeta-rival-cabecera {
  padding-bottom: .5rem;
  margin-bottom: .35rem;
  border-bottom: 1px solid var(--gris-200);
}
.tarjeta-rival-cabecera strong { font-size: .95rem; }
.total-rival { font-family: var(--fuente-display); font-weight: 700; font-size: 1.05rem; color: var(--verde); }
.chevron-rival {
  color: var(--gris-700);
  font-size: .8rem;
  transition: transform .2s ease;
  flex-shrink: 0;
}
.tarjeta-rival.abierta .chevron-rival { transform: rotate(180deg); }
.fila-pick-rival {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .3rem 0;
  font-size: .82rem;
}
.fila-pick-rival .muted:first-child { flex: 1; min-width: 0; overflow-wrap: break-word; }
.pts-conseguidos { font-weight: 700; color: var(--verde); white-space: nowrap; }
.ya-rellenado { color: var(--verde); font-weight: 600; white-space: nowrap; }
.fila-pick-rival.actualizado { animation: flash-resaltado 1.2s ease; }
.extra-pick-rival { flex: 1 0 100%; font-size: .78rem; }

.predictor-lista { touch-action: pan-y; }

.predictor-fila {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--gris-200);
  background: var(--superficie);
  animation: fade-in-up .3s ease both;
  transition: background-color .3s ease;
}
.predictor-fila .puesto { width: 1.4rem; flex-shrink: 0; font-weight: 700; color: var(--gris-700); }
.nombre-equipo-predictor {
  flex: 1;
  min-width: 0;
  font-size: .85rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.nombre-equipo-texto { flex: 1; min-width: 0; overflow-wrap: break-word; }

.mango-arrastre {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: var(--gris-400);
  cursor: grab;
  touch-action: none;
  user-select: none;
  border-radius: 8px;
  transition: background-color .15s ease, color .15s ease;
}
.mango-arrastre:hover { color: var(--gris-700); background: var(--superficie-alta); }

.predictor-fila.arrastrando {
  cursor: grabbing;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .18);
  border-radius: 10px;
  background: var(--superficie);
}
.predictor-fila.arrastrando .mango-arrastre { color: var(--verde); cursor: grabbing; }
.predictor-fila.recien-movido { animation: flash-resaltado .8s ease; }

/* ---- skeleton loaders ---- */
.skeleton {
  background: linear-gradient(90deg, var(--gris-200) 25%, var(--superficie-alta) 37%, var(--gris-200) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radio-chico);
}
.skeleton-linea { height: .9rem; margin-bottom: .55rem; }
.skeleton-linea.corta { width: 40%; }
.skeleton-partido { height: 3.6rem; margin-bottom: .6rem; }

/* ---- toasts ---- */
.toast-contenedor {
  position: fixed;
  top: .75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  width: calc(100% - 1.5rem);
  max-width: 480px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: .7rem 1rem;
  border-radius: 10px;
  font-size: .85rem;
  font-weight: 600;
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
  animation: toast-in .28s cubic-bezier(.34, 1.56, .64, 1) both, toast-out .25s ease 2.6s forwards;
}
.toast.ok { background: var(--verde-claro); }
.toast.error { background: var(--rojo); }

/* ---- celebraciones (gol / líder), estilo pixel-art/8-bit ---- */
.overlay-celebracion {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .6);
  animation: overlay-cel-entrada .2s steps(3) both;
  cursor: pointer;
  padding: 1rem;
}
.overlay-celebracion.saliendo { animation: overlay-cel-salida .3s ease both; }
@keyframes overlay-cel-entrada { from { opacity: 0; } to { opacity: 1; } }
@keyframes overlay-cel-salida { to { opacity: 0; } }

.caja-celebracion {
  --color-cel: var(--verde);
  --color-cel-txt: #fff;
  background: #0b0f14;
  border: 6px solid var(--color-cel);
  border-radius: 4px;
  box-shadow: 0 0 0 3px #0b0f14, 0 0 0 9px var(--color-cel), 0 10px 30px rgba(0, 0, 0, .5);
  padding: 2rem 2.25rem;
  text-align: center;
  animation: caja-cel-pop .4s steps(6) both;
}
@keyframes caja-cel-pop {
  0% { transform: scale(.3) rotate(-4deg); opacity: 0; }
  60% { transform: scale(1.08) rotate(1deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}

.icono-rebote {
  font-size: 3rem;
  animation: rebote-pixel .5s steps(4) infinite;
}
@keyframes rebote-pixel {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-16px); }
}

.texto-celebracion {
  font-family: "Courier New", monospace;
  font-weight: 900;
  font-size: 2rem;
  letter-spacing: .06em;
  color: var(--color-cel);
  text-shadow: 2px 2px 0 #000, 4px 4px 0 rgba(0, 0, 0, .4);
  margin: .5rem 0 .6rem;
  animation: parpadeo-pixel .8s steps(2) infinite;
}
@keyframes parpadeo-pixel { 50% { opacity: .7; } }

.subtitulo-celebracion {
  color: var(--color-cel-txt);
  background: var(--color-cel);
  display: inline-block;
  padding: .3rem .8rem;
  border-radius: 3px;
  font-weight: 700;
  font-size: .85rem;
  letter-spacing: .02em;
  max-width: 220px;
  overflow-wrap: break-word;
}

.caja-lider { --color-cel: #ffd23f; --color-cel-txt: #3a2b00; }
.texto-lider { font-size: 1.6rem; }

/* Escena de gol: secuencia de sprites en pixel-art (jugador genérico, sin
   nombre ni cara identificable — ver assets/img/gol-secuencia.png), 15
   fotogramas en tira horizontal recorridos con steps(). Al terminar se
   revela el marcador con los escudos reales de los dos equipos. */
.caja-gol-escena { padding: 1rem; }

.sprite-gol {
  width: min(300px, 78vw);
  aspect-ratio: 384 / 220;
  margin: 0 auto .9rem;
  background-image: url('../img/gol-secuencia.png');
  background-repeat: no-repeat;
  background-size: 1500% 100%;
  image-rendering: pixelated;
  animation: sprite-gol-avance 2.55s steps(14) forwards;
}
@keyframes sprite-gol-avance {
  /* Con background-size:1500%, el 100% de background-position-x equivale a
     -14 anchos de contenedor (fórmula (contenedor - imagen) * %), es decir,
     exactamente el ancho de la hoja de 15 fotogramas. */
  from { background-position-x: 0%; }
  to { background-position-x: 100%; }
}

.marcador-final-gol {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .4rem;
  opacity: 0;
  animation: aparecer-marcador .4s ease 2.75s forwards;
}
@keyframes aparecer-marcador { to { opacity: 1; } }
.escudo-marcador { width: 1.7rem; height: 1.7rem; object-fit: contain; flex-shrink: 0; }
.nombre-marcador { font-size: .72rem; font-weight: 700; color: #fff; }
.marcador-numero { font-family: "Courier New", monospace; font-weight: 900; font-size: .95rem; color: #ffd23f; }

/* ---- muro de comentarios ---- */
.muro-lista {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  max-height: 60vh;
  overflow-y: auto;
}
.muro-noticias {
  max-height: 30vh;
}

.mensaje-muro {
  align-self: flex-start;
  max-width: 82%;
  background: var(--superficie-alta);
  border-radius: 14px 14px 14px 4px;
  padding: .5rem .7rem;
  animation: fade-in-up .25s ease both;
}
.mensaje-muro.propio {
  align-self: flex-end;
  background: var(--burbuja-propia);
  border-radius: 14px 14px 4px 14px;
}
.mensaje-muro.sistema {
  align-self: center;
  max-width: 92%;
  background: color-mix(in srgb, var(--verde) 12%, var(--superficie-alta));
  border: 1px solid color-mix(in srgb, var(--verde) 30%, transparent);
  border-radius: var(--radio-chico);
  text-align: center;
}
.mensaje-muro.sistema .mensaje-muro-cabecera { justify-content: center; }
.mensaje-muro.sistema .mensaje-muro-texto { font-weight: 600; }

.mensaje-muro-cabecera {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .68rem;
  margin-bottom: .2rem;
}
.mensaje-muro-cabecera strong { font-size: .74rem; }

.borrar-comentario {
  margin-left: auto;
  border: none;
  background: none;
  color: var(--gris-700);
  cursor: pointer;
  font-size: .7rem;
  padding: 0 .2rem;
  transition: color .15s ease, transform .12s ease;
}
.borrar-comentario:active { transform: scale(.85); color: var(--rojo); }

.mensaje-muro-texto {
  font-size: .86rem;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}

.muro-form {
  display: flex;
  gap: .5rem;
  margin-top: .75rem;
  position: sticky;
  bottom: calc(4.2rem + env(safe-area-inset-bottom));
}
.muro-form input {
  flex: 1;
  min-width: 0;
  padding: .6rem .7rem;
  border: 1px solid var(--gris-400);
  border-radius: 20px;
  font-size: .88rem;
}
.muro-form input:focus { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--verde) 20%, transparent); }
.muro-form .btn { border-radius: 20px; padding: .6rem 1.1rem; }

.fila-lista {
  display: flex;
  gap: .4rem;
  margin-bottom: .5rem;
  align-items: center;
}
.fila-lista .in-lista-puesto {
  width: 3.4rem;
  flex-shrink: 0;
  padding: .5rem .4rem;
  border: 1px solid var(--gris-400);
  border-radius: 8px;
  text-align: center;
}
.fila-lista .in-lista-valor {
  flex: 1;
  min-width: 0;
  padding: .5rem .6rem;
  border: 1px solid var(--gris-400);
  border-radius: 8px;
}
.quitar-fila-lista {
  border: none;
  background: var(--superficie-alta);
  color: var(--rojo);
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform .12s ease;
}
.quitar-fila-lista:active { transform: scale(.85); }

.fila-regla-extra {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--gris-200);
  transition: opacity .2s ease;
}
.fila-regla-extra:last-child { border-bottom: none; }
.fila-regla-extra.inactiva { opacity: .5; }
.icono-regla-extra { font-size: 1.1rem; flex-shrink: 0; }
.fila-regla-extra .in-regla-nombre {
  flex: 1;
  min-width: 0;
  padding: .5rem .6rem;
  border: 1px solid var(--gris-400);
  border-radius: 8px;
  background: var(--superficie);
  color: var(--texto);
}
.fila-regla-extra .in-regla-puntos {
  width: 3.6rem;
  flex-shrink: 0;
  padding: .5rem .3rem;
  border: 1px solid var(--gris-400);
  border-radius: 8px;
  text-align: center;
  background: var(--superficie);
  color: var(--texto);
}
.switch-regla-activa { flex-shrink: 0; display: flex; }
.switch-regla-activa input {
  appearance: none;
  -webkit-appearance: none;
  width: 2.2rem;
  height: 1.3rem;
  border-radius: 1rem;
  background: var(--gris-400);
  position: relative;
  cursor: pointer;
  transition: background-color .2s ease;
}
.switch-regla-activa input::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  transition: transform .2s ease;
}
.switch-regla-activa input:checked { background: var(--verde); }
.switch-regla-activa input:checked::before { transform: translateX(.9rem); }
.quitar-regla-extra {
  border: none;
  background: var(--superficie-alta);
  color: var(--rojo);
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform .12s ease;
}
.quitar-regla-extra:active { transform: scale(.85); }

.leyenda-puntos {
  font-size: .75rem;
  font-weight: 600;
  color: var(--verde);
  background: color-mix(in srgb, var(--verde) 12%, var(--superficie));
  padding: .45rem .7rem;
  border-radius: var(--radio-chico);
  margin: 0 0 .75rem;
}

.subtitulo-lista {
  font-size: .8rem;
  font-weight: 600;
  color: var(--gris-700);
  margin: .75rem 0 .3rem;
}
.subtitulo-lista:first-child { margin-top: 0; }

.lista-pasos { margin: 0; padding: 0; list-style: none; }
.lista-pasos li {
  position: relative;
  padding-left: 1.3rem;
  margin-bottom: .55rem;
  font-size: .87rem;
}
.lista-pasos li:last-child { margin-bottom: 0; }
.lista-pasos li::before {
  content: '';
  position: absolute;
  left: 0;
  top: .48em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--verde);
}

.tabla-scroll { overflow-x: auto; margin-bottom: .6rem; }
table.tabla-puntos {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
}
table.tabla-puntos th, table.tabla-puntos td {
  padding: .5rem .55rem;
  text-align: left;
  border-bottom: 1px solid var(--gris-200);
  white-space: nowrap;
}
table.tabla-puntos th {
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--gris-700);
}
table.tabla-puntos tr:last-child td { border-bottom: none; }
table.tabla-puntos td.num { text-align: right; font-weight: 700; color: var(--verde); }

.tarjeta-premio {
  display: flex;
  justify-content: space-between;
  padding: .4rem 0;
  border-bottom: 1px solid var(--gris-200);
  font-size: .88rem;
}
.tarjeta-premio:last-child { border-bottom: none; }
.tarjeta-premio .puesto-premio { font-weight: 700; color: var(--verde); }

.tarjeta-picks-especiales p.subtitulo-lista { margin-top: .6rem; }
.picks-especiales-lista {
  font-size: .85rem;
  color: var(--texto);
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.opciones-tema {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.opcion-tema {
  display: flex;
  align-items: center;
  padding: .8rem 1rem;
  border: 1px solid var(--gris-400);
  border-radius: 10px;
  background: var(--superficie);
  color: var(--texto);
  font-size: .92rem;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, transform .12s ease;
}
.opcion-tema:active { transform: scale(.98); }
.opcion-tema.activo {
  border-color: var(--verde);
  border-width: 2px;
  background: color-mix(in srgb, var(--verde) 12%, var(--superficie));
  font-weight: 700;
  color: var(--verde);
}

.lista-tipos-noti {
  margin-top: .85rem;
  display: flex;
  flex-direction: column;
}
.fila-tipo-noti {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .65rem .1rem;
  border-bottom: 1px solid var(--gris-200);
  font-size: .85rem;
  cursor: pointer;
}
.fila-tipo-noti:last-child { border-bottom: none; }
.in-tipo-noti {
  appearance: none;
  -webkit-appearance: none;
  width: 2.4rem;
  height: 1.4rem;
  border-radius: 1rem;
  background: var(--gris-400);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color .2s ease;
}
.in-tipo-noti::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  transition: transform .2s ease;
}
.in-tipo-noti:checked { background: var(--verde); }
.in-tipo-noti:checked::before { transform: translateX(1rem); }

.fila-participante {
  padding: .7rem 0;
  border-bottom: 1px solid var(--gris-200);
}
.fila-participante:last-child { border-bottom: none; }
.fila-participante-cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .4rem;
}
.in-ajuste-manual {
  width: 4.5rem;
  padding: .4rem;
  text-align: center;
  font-weight: 700;
  border: 1px solid var(--gris-400);
  border-radius: 8px;
}
.in-ajuste-motivo {
  width: 100%;
  padding: .5rem .6rem;
  margin-bottom: .5rem;
  border: 1px solid var(--gris-400);
  border-radius: 8px;
  font-size: .85rem;
}

.fila-corregir {
  padding: .7rem 0;
  border-bottom: 1px solid var(--gris-200);
}
.fila-corregir:last-child { border-bottom: none; }
.fila-corregir-equipos {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .5rem;
  font-size: .85rem;
}
.fila-corregir-equipos .marcador { flex-shrink: 0; }

.codigo-invitacion {
  font-family: var(--fuente-display);
  font-size: 1.3rem;
  letter-spacing: .15em;
  background: var(--superficie-alta);
  color: var(--verde);
  padding: .5rem .8rem;
  border-radius: var(--radio-chico);
  display: inline-block;
}

.centro { text-align: center; }
.muted { color: var(--gris-700); font-size: .8rem; }
.espacio-top { margin-top: 1rem; }
