/* ============================================================
   FC BARCELONA — Onces históricos · una sola pantalla
   Tipografía Gelion · gold #FFD180 sobre blaugrana.
   Dos tarjetas apiladas (campo + panel más estrecho) con los
   escudos grandes por detrás, pisando el campo (efecto 2D).
   ============================================================ */
@font-face { font-family:'Gelion'; src:url('../../assets/font/gelion-thin.woff') format('woff');     font-weight:100; font-display:swap; }
@font-face { font-family:'Gelion'; src:url('../../assets/font/gelion-light.woff') format('woff');    font-weight:300; font-display:swap; }
@font-face { font-family:'Gelion'; src:url('../../assets/font/gelion-regular.woff') format('woff');  font-weight:400; font-display:swap; }
@font-face { font-family:'Gelion'; src:url('../../assets/font/gelion-medium.woff') format('woff');   font-weight:500; font-display:swap; }
@font-face { font-family:'Gelion'; src:url('../../assets/font/gelion-semibold.woff') format('woff'); font-weight:600; font-display:swap; }
@font-face { font-family:'Gelion'; src:url('../../assets/font/gelion-bold.woff') format('woff');     font-weight:700; font-display:swap; }
/* Marcador y temporizador — fuente DOTO (Google Fonts): matriz de puntos real,
   vendorizada localmente. Sustituye al 7-segmentos para los dígitos. */
@font-face { font-family:'Doto'; src:url('../../assets/font/doto-regular.ttf') format('truetype'); font-weight:400; font-display:swap; }
@font-face { font-family:'Doto'; src:url('../../assets/font/doto-bold.ttf') format('truetype');    font-weight:700; font-display:swap; }
@font-face { font-family:'Doto'; src:url('../../assets/font/doto-black.ttf') format('truetype');   font-weight:900; font-display:swap; }
.dgt { font-family:'Doto','Gelion',monospace; font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: .04em; }

:root {
  --accent: #FFD180;
  --accent-line: rgba(255,209,128,0.40);
  --accent-faint: rgba(255,209,128,0.13);
  --ink: #130129;
  --panel: rgba(19,1,41,0.40);
  --white-72: rgba(255,255,255,0.72);
  --white-44: rgba(255,255,255,0.44);
  --radius: 16px;
  --ease: cubic-bezier(0.22,1,0.36,1);
  /* Toolkit de micro-interacciones: decel suave + muelle con rebote. */
  --ease-decel: cubic-bezier(0.22,1,0.36,1);
  --ease-spring: cubic-bezier(0.34,1.56,0.64,1);
  --font: 'Gelion', system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Campo MÁS GRANDE y con proporción real (68:105). El ancho se deriva del
     alto, así el SVG de líneas nunca se deforma y los 11 quedan bien espaciados. */
  --pitch-h: min(66vh, 620px);
  --pitch-w: calc(var(--pitch-h) * 68 / 105);
  /* Dorsal y ficha proporcionales al campo: la separación mínima entre slots
     es ~20% del ancho; el disco ocupa ~13% → nunca se solapan. */
  --shirt: clamp(26px, calc(var(--pitch-w) * 0.135), 46px);
  --pwidth: calc(var(--pitch-w) * 0.19);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { background: #0a0118; color: #fff; font-family: var(--font); font-weight: 400; -webkit-font-smoothing: antialiased; overflow: hidden; }

/* Fondo de vídeos */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: #0a0118; }
.bg__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1.6s ease; transform: scale(1.04); }
.bg__video.active { opacity: 0.5; }
.bg__scrim { position: absolute; inset: 0; background:
  radial-gradient(ellipse at 50% 10%, rgba(19,1,41,0.30), transparent 60%),
  linear-gradient(180deg, rgba(10,1,24,0.62), rgba(10,1,24,0.38) 40%, rgba(10,1,24,0.78)); }
/* Velo intermedio de desenfoque progresivo entre el vídeo y el prototipo
   (mismo recurso que Inditex): scrim translúcido + backdrop blur. La máscara
   hace el desenfoque progresivo (más nítido arriba, más velado hacia el centro
   donde vive el componente) para integrar el fondo con el resto de demos. */
.bg__veil { position: absolute; inset: 0; pointer-events: none;
  background: rgba(10,1,24,0.10);
  backdrop-filter: blur(8px) saturate(108%); -webkit-backdrop-filter: blur(8px) saturate(108%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,0.35), #000 22%, #000 100%);
          mask-image: linear-gradient(180deg, rgba(0,0,0,0.35), #000 22%, #000 100%); }

.glass { background: var(--panel); border: 1px solid var(--accent-line); border-radius: var(--radius);
  backdrop-filter: blur(14px) saturate(120%); -webkit-backdrop-filter: blur(14px) saturate(120%);
  box-shadow: 0 10px 38px rgba(0,0,0,0.35); }

.btn { font-family: var(--font); cursor: pointer; border-radius: 999px; border: 1px solid var(--accent-line);
  background: transparent; color: var(--accent); padding: 11px 22px; font-size: 14px; font-weight: 600;
  transition: background .22s var(--ease), color .22s var(--ease), border-color .22s var(--ease), filter .22s var(--ease),
    box-shadow .22s var(--ease), transform .14s var(--ease-spring); }
.btn:hover { background: var(--accent-faint); transform: translateY(-2px); }
.btn:active { transform: scale(0.96); transition-duration: .12s; }
.btn--solid { background: var(--accent); color: var(--ink); border-color: var(--accent); }
.btn--solid:hover { filter: brightness(1.05); background: var(--accent); }
.btn--ghost { color: var(--white-72); border-color: rgba(255,255,255,0.2); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.ico { width: 1em; height: 1em; display: block; flex: 0 0 auto; }
.btn--icon { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 11px; }
.btn--icon .ico { width: 18px; height: 18px; }

/* ---------- Layout raíz ---------- */
.app { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column;
  padding: clamp(12px, 2vw, 22px); gap: clamp(10px, 1.6vw, 18px); }

/* ---------- Escenario ---------- */
/* El componente completo (cabecera con escudos + marcador y el campo) se
   ancla ARRIBA, ajustado al modal; si no cabe por el header, hay scroll. */
.stage { flex: 1 1 auto; min-height: 0; width: 100%; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 0;
  overflow-y: auto; scrollbar-width: none; }
.stage::-webkit-scrollbar { display: none; }

/* ---------- JERARQUÍA: marcador (fondo) → campo (principal) → sistema (secundaria) --- */

/* 1) MARCADOR al FONDO: capa de atrás (z-index 0), header flotante recesivo —
   NO es una tarjeta (fondo translúcido suave, sin borde duro), ligeramente
   rotado y más grande; su parte inferior queda DETRÁS de la tarjeta del campo. */
.scoreboard { position: relative; z-index: 0; width: calc(var(--pitch-w) + 42px);
  display: flex; align-items: center; justify-content: space-between;
  gap: clamp(8px, 2.5vw, 16px); padding: 8px clamp(10px, 3vw, 18px) 46px;
  margin-bottom: clamp(-58px, -9vw, -42px);
  /* SIN card: el marcador (escudos + año) flota sobre el campo, sin fondo,
     blur, borde ni sombra. La inclinación va en cada escudo (±2°). */
  background: none; border-radius: 0; box-shadow: none;
  backdrop-filter: none; -webkit-backdrop-filter: none;
  transform: none; }

/* 2) Tarjeta PRINCIPAL: el campo, la protagonista (más prominente: cristal más
   sólido, borde dorado, elevación mayor, por DELANTE del marcador). */
.field-card { position: relative; z-index: 3; flex: 0 0 auto; width: var(--pitch-w);
  display: flex; flex-direction: column;
  background: rgba(19,1,41,0.52); border: 1px solid var(--accent-line); border-radius: var(--radius);
  backdrop-filter: blur(16px) saturate(125%); -webkit-backdrop-filter: blur(16px) saturate(125%);
  box-shadow: 0 28px 66px rgba(0,0,0,0.58); overflow: hidden; }
/* Mismo tamaño óptico, verticales y alineados con el marcador; viewBox
   cuadrado → nítidos en retina, sin deformación ni recorte. */
/* Escudos SIN caja detrás: solo el arte vectorial con una sombra suave de
   recorte. Inclinación pareada sutil: casa -2° (izq), fuera +2° (der). */
.sb__crest { flex: 0 0 auto; width: clamp(60px, 15vw, 102px); height: auto; align-self: center;
  background: none; border: 0; box-shadow: none;
  filter: drop-shadow(0 5px 12px rgba(0,0,0,0.45)); }
.sb__crest--h { --tilt: -2deg; transform: rotate(var(--tilt)); transform-origin: center bottom; }
.sb__crest--a { --tilt:  2deg; transform: rotate(var(--tilt)); transform-origin: center bottom; }
.sb__crest .crest__img, .sb__crest .crest__svg, .sb__crest svg, .sb__crest img {
  width: 100%; height: auto; display: block; object-fit: contain; }
/* Cross-fade/morph de escudos entre eras: dos capas apiladas (saliente +
   entrante). El contenedor mantiene el alto del escudo entrante para que el
   marcador no reflowee al cambiar de dimensiones. */
.sb__crest { position: relative; }
.sb__crest .crest__layer { display: block; width: 100%; transition: opacity .52s var(--ease), transform .52s var(--ease); }
.sb__crest .crest__layer--out { position: absolute; inset: 0; opacity: 1; }
.sb__crest.is-morphing .crest__layer--in { opacity: 0; transform: scale(.92); }
.sb__crest.is-morphing.run .crest__layer--in { opacity: 1; transform: none; }
.sb__crest.is-morphing.run .crest__layer--out { opacity: 0; transform: scale(1.06); }
.sb__core { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: center; text-align: center; }
.matchtitle__center { line-height: 1; }
.matchtitle__center.is-anim { animation: sbPop .5s var(--ease); }
@keyframes sbPop { from { opacity: 0; transform: translateY(6px) scale(.9); } to { opacity: 1; transform: none; } }
/* Año en estilo DISPLAY dot-matrix: la fuente de marcador (7-seg/dgt) sobre
   una textura de puntos que simula una matriz de leds; el texto se "enciende"
   recortando esa textura. Si el navegador no soporta el recorte, cae a sólido. */
/* Año en DOTO (matriz de puntos real de la propia fuente — sin el truco de
   textura por background-clip, que ya no hace falta). */
.sb__year { display: inline-block; font-size: clamp(36px, 7.4vw, 56px); font-weight: 700;
  letter-spacing: .05em; line-height: 1; color: var(--accent);
  font-family: 'Doto','Gelion',monospace; font-variant-numeric: tabular-nums;
  text-shadow: 0 0 10px rgba(255,209,128,.35); }
/* Transición de año en estilo dot-matrix: ligero parpadeo de leds + barrido. */
.sb__year--rolling { animation: dotMatrix .16s steps(2) infinite; }
@keyframes dotMatrix { 0% { opacity: 1; filter: brightness(1); } 50% { opacity: .82; filter: brightness(1.25); } 100% { opacity: 1; filter: brightness(1); } }
/* Marcador de resultado y reloj: tipografía de marcador (7-seg). */
.sb__score { font-family:'Doto','Gelion',monospace; font-size: clamp(36px, 8vw, 56px); font-weight: 900; line-height: .9; color: #fff; }
.sb__dash { font-weight: 300; color: var(--white-44); margin: 0 .14em; font-size: .5em; vertical-align: .18em; }
.matchtitle__meta { font-size: 11px; color: var(--white-44); margin-top: 5px; letter-spacing: .02em; }
.sb__clock { display: inline-block; color: var(--accent); font-size: clamp(24px, 5vw, 36px); line-height: 1; }

/* Sede / ciudad en dos líneas */
.sb__venue { display: block; color: var(--white-72); font-size: 12px; font-weight: 500; }
.sb__city  { display: block; color: var(--white-44); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; margin-top: 2px; }

/* Marcador en vivo: resultado R - R (los escudos ya van en los lados). */
.sb__live { display: inline-flex; align-items: baseline; justify-content: center; }

/* ---------- Toast de GOL (minimal) ----------
   Pastilla dorada que aparece bajo el marcador al caer un gol: icono + min +
   autor (p.ej. "23' Cruyff"). Flota en posición absoluta para no empujar el
   layout; se desliza/funde y se va sola. Estilo blaugrana/dorado. */
.sb__core { position: relative; }
.goal-toast { position: absolute; top: 12px; left: 50%; margin-top: 0;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 5px 11px 5px 9px; border-radius: 999px;
  background: linear-gradient(150deg, var(--accent), #f2b347); color: var(--ink);
  border: 1px solid rgba(255,255,255,.28);
  box-shadow: 0 6px 18px rgba(0,0,0,.42), 0 0 0 1px rgba(255,209,128,.25);
  font-size: 12px; font-weight: 700; letter-spacing: .01em; pointer-events: none; z-index: 10;
  transform: translate(-50%, 8px) scale(.86); opacity: 0; transform-origin: top center; }
/* Toast de GOL: entra deslizándose con muelle (overshoot + asentamiento) y
   se va con un fundido limpio. La animación de entrada manda al añadir .is-in;
   al quitarla, la transición de salida hace el fade-out. */
.goal-toast { transition: opacity .3s var(--ease), transform .3s var(--ease); }
.goal-toast.is-in { opacity: 1; transform: translate(-50%, 0) scale(1);
  animation: goalToastIn .5s var(--ease-spring) both; }
@keyframes goalToastIn {
  0%   { opacity: 0; transform: translate(-50%, 8px) scale(.86); }
  60%  { opacity: 1; transform: translate(-50%, -2px) scale(1.04); }
  100% { opacity: 1; transform: translate(-50%, 0) scale(1); } }
.goal-toast__min { font-family:'Scoreboard','Gelion',monospace; font-variant-numeric: tabular-nums; opacity: .9; }
.goal-toast__icon { width: 14px; height: 14px; display: block; flex: 0 0 auto; }
.goal-toast__icon svg { width: 100%; height: 100%; display: block; }

/* Campo SIN caja: banda a TODO el ancho del panel, sin borde/radio/sombra ni
   fondo extra; solo una textura de césped muy sutil sobre el mismo cristal.
   Separadores finos arriba/abajo para integrarlo con cabecera y datos. */
.pitch { position: relative; z-index: 2; width: 100%; height: var(--pitch-h); overflow: hidden;
  background: repeating-linear-gradient(180deg, rgba(255,255,255,.015) 0 7.14%, rgba(255,255,255,.038) 7.14% 14.28%);
  border-top: 1px solid rgba(255,255,255,.06); border-bottom: 1px solid rgba(255,255,255,.06); }
.pitch__svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
/* Líneas del campo en DORADO (combinan con el borde dorado de la tarjeta), no
   en blanco. El contorno exterior y las porterías se omiten en el SVG: el límite
   del campo lo da el propio borde de la tarjeta. */
.pitch__svg g { stroke: rgba(255,209,128,.34); }
.pitch__svg [fill="#fff"] { fill: rgba(255,209,128,.62); }

/* Botón JUGAR dentro del campo, esquina inferior derecha. Por encima de
   jugadores/heatmap, anclado al campo, no al panel. */
.pitch .btn--play { position: absolute; right: 12px; bottom: 12px; z-index: 9;
  min-width: 48px; min-height: 48px; border-radius: 999px;
  box-shadow: 0 6px 18px rgba(0,0,0,.45); }
.pitch .btn--play:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 10px 24px rgba(0,0,0,.5); }
.pitch .btn--play:active { transform: scale(0.92); transition-duration: .12s; }
.pitch .btn--play .ico { width: 20px; height: 20px; transform: translateX(1px); }
/* Confirmación de "Jugar": el botón da un pulso de muelle al iniciar el partido. */
.pitch .btn--play.is-firing { animation: playFire .42s var(--ease-spring) both; }
@keyframes playFire { 0% { transform: scale(0.92); } 45% { transform: scale(1.12); } 100% { transform: scale(1); } }

/* Heatmap — puntos BLANCOS, por debajo de los jugadores. */
.heatmap { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.heatdot { position: absolute; border-radius: 50%; transform: translate(-50%,-50%);
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,.92), rgba(255,255,255,.34) 68%, transparent);
  /* Nube de puntos: cada punto entra con muelle y un escalonado radial (los más
     cercanos al jugador primero) → la mancha "florece" hacia fuera, sin golpe. */
  animation: heatIn .46s var(--ease-spring) both; animation-delay: var(--di, 0ms); }
@keyframes heatIn { from { opacity: 0; transform: translate(-50%,-50%) scale(.2); } }

/* Jugadores */
.player { position: absolute; transform: translate(-50%,-50%); background: none; border: 0; cursor: grab;
  display: flex; flex-direction: column; align-items: center; gap: 4px; width: var(--pwidth); font-family: var(--font);
  transition: left .62s var(--ease-decel), top .62s var(--ease-decel), transform .22s var(--ease-spring), opacity .25s var(--ease);
  z-index: 2; touch-action: none; }
.player:hover { transform: translate(-50%,-50%) scale(1.08); z-index: 5; }
.player:not(.is-focused):active { transform: translate(-50%,-50%) scale(0.96); transition-duration: .12s; }
.player.is-dragging { transition: transform .18s var(--ease); z-index: 20; cursor: grabbing; }
.player.is-dragging .player__shirt { transform: scale(1.14); box-shadow: 0 0 0 3px var(--accent), 0 10px 24px rgba(0,0,0,.55); }
.pitch.is-arranging .player:not(.is-dragging) { opacity: .5; }
.player--moved .player__shirt { box-shadow: 0 0 0 2px var(--accent), 0 6px 16px rgba(0,0,0,.5); }
.player.is-focused { z-index: 7; }
/* Token enfocado: crece con muelle (overshoot) en vez de un escalado plano. */
.player.is-focused .player__shirt { transform: scale(1.32); box-shadow: 0 0 0 3px var(--accent), 0 8px 22px rgba(0,0,0,.6);
  transition: transform .32s var(--ease-spring), box-shadow .2s var(--ease); }
.player.is-dim { opacity: .42; }
/* Jugador ENTRANTE (nuevo en esta era/sistema): aparece con fade+scale suave
   en su destino, sin parpadeo de estado vacío. */
.player.is-incoming { animation: playerIn .46s var(--ease-spring) both; }
@keyframes playerIn { from { opacity: 0; transform: translate(-50%,-50%) scale(.78); } to { opacity: 1; transform: translate(-50%,-50%) scale(1); } }
/* Jugador SALIENTE (ya no está en la nueva era): se desvanece en su sitio. */
.player.is-leaving { pointer-events: none; animation: playerOut .34s var(--ease) both; }
@keyframes playerOut { from { opacity: 1; transform: translate(-50%,-50%) scale(1); } to { opacity: 0; transform: translate(-50%,-50%) scale(.78); } }
.player__shirt { position: relative; width: var(--shirt); height: var(--shirt); border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: calc(var(--shirt) * 0.34); color: var(--ink); background: linear-gradient(150deg, var(--accent), #f2b347);
  box-shadow: 0 5px 14px rgba(0,0,0,.4), inset 0 0 0 2px rgba(255,255,255,.22); transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.player--gk .player__shirt { background: linear-gradient(150deg,#6be3a0,#2bb673); }
/* 1912 sin dorsal: disco con un punto en lugar de número (intencional). */
.player__shirt--anon::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: rgba(19,1,41,.55); }
.player__star { position: absolute; bottom:-4px; left:-6px; font-size: 11px; }
.player__name { font-size: clamp(9px, calc(var(--pitch-w) * 0.033), 12px); font-weight: 500; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.85); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
/* Pista (Spark) sobre la pieza clave a mover (L3 Koeman ↑ / L4 Messi ↓). */
.player__spark { position: absolute; top: -9px; right: -9px; width: 17px; height: 17px; color: var(--accent);
  filter: drop-shadow(0 0 7px rgba(255,209,128,.75)); animation: sparkPulse 1.4s var(--ease) infinite; pointer-events: none; z-index: 3; }
.player__spark svg { width: 100%; height: 100%; display: block; }

/* Banquillo flotante (solo fichas, sin textos largos) */
.bench { position: absolute; left: 0; right: 0; bottom: 0; z-index: 8; display: flex; gap: 7px; padding: 10px 10px 12px;
  overflow-x: auto; scrollbar-width: none; background: linear-gradient(0deg, rgba(8,1,20,.92), rgba(8,1,20,.55) 60%, transparent);
  animation: benchIn .3s var(--ease) both; }
.bench::-webkit-scrollbar { display: none; }
@keyframes benchIn { from { opacity: 0; transform: translateY(10px); } }
.benchchip { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 3px; background: none; border: 0; cursor: pointer; font-family: var(--font); }
.benchchip__shirt { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: var(--ink);
  background: linear-gradient(150deg, var(--accent), #f2b347); box-shadow: 0 4px 10px rgba(0,0,0,.4), inset 0 0 0 2px rgba(255,255,255,.2); transition: transform .18s var(--ease); }
.benchchip--gk .benchchip__shirt { background: linear-gradient(150deg,#6be3a0,#2bb673); }
.benchchip__shirt { transition: transform .18s var(--ease-spring), box-shadow .18s var(--ease); }
.benchchip:hover .benchchip__shirt { transform: translateY(-3px) scale(1.06); }
.benchchip:active .benchchip__shirt { transform: scale(0.94); transition-duration: .12s; }
.benchchip__name { font-size: 10px; color: #fff; white-space: nowrap; }
.benchchip--shine .benchchip__shirt { box-shadow: 0 0 0 2px var(--accent), 0 0 16px rgba(255,209,128,.5); }

/* ---------- Tarjeta secundaria — MÁS ESTRECHA, pisada por el campo ---------- */
/* Datos y controles: parte del MISMO cristal (sin fondo/borde propios),
   mismo ancho y mismo padding lateral que la cabecera → columna alineada. */
/* 3) Tarjeta SECUNDARIA: sistema/formación + datos + controles. Subordinada a
   la del campo: más estrecha, cristal más tenue, borde y elevación menores. */
/* CONECTADA a la principal: se mete BAJO el borde inferior de la tarjeta del
   campo (margin-top negativo + z-index menor) → emerge de debajo, cohesionada,
   no flotando suelta. Mantiene la jerarquía (más estrecha y tenue). */
.panel { position: relative; z-index: 2; width: calc(var(--pitch-w) * 0.9); align-self: center;
  margin-top: clamp(-22px, -3.2vw, -14px); min-width: 0;
  padding: calc(clamp(14px, 4vw, 18px) + 8px) clamp(13px, 4vw, 17px) 14px;
  display: flex; flex-direction: column; gap: 11px;
  background: rgba(19,1,41,0.34); border: 1px solid rgba(255,209,128,0.20);
  border-top: 0; border-radius: 0 0 14px 14px;
  backdrop-filter: blur(9px) saturate(115%); -webkit-backdrop-filter: blur(9px) saturate(115%);
  box-shadow: 0 16px 32px rgba(0,0,0,0.32); }

/* Sistemas SIEMPRE en una sola línea, integrados y CONTENIDOS: nunca se
   desbordan de la tarjeta (min-width:0 + overflow:hidden + chips que encogen). */
.systems { display: flex; gap: 6px; justify-content: center; flex-wrap: nowrap;
  width: 100%; min-width: 0; overflow: hidden; padding: 0; }
.chip { position: relative; font-family: var(--font); cursor: pointer; border: 1px solid var(--accent-faint); background: transparent;
  color: var(--white-72); border-radius: 9px; padding: 7px 8px; font-size: 12px; font-weight: 600;
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), transform .14s var(--ease-spring);
  display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; min-width: 0; flex: 1 1 0; justify-content: center; overflow: hidden; }
.chip > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.chip:hover { border-color: var(--accent-line); color: #fff; transform: translateY(-2px); }
.chip:active { transform: scale(0.96); transition-duration: .12s; }
.chip.is-on { background: var(--accent); color: var(--ink); border-color: var(--accent); }
/* Selección de sistema: el chip activo da un pulso de muelle al elegirse. */
.chip.is-on.is-juston { animation: chipPop .42s var(--ease-spring) both; }
@keyframes chipPop { 0% { transform: scale(0.96); } 45% { transform: scale(1.08); } 100% { transform: scale(1); } }
.chip .spark { width: 12px; height: 12px; color: var(--accent); animation: sparkPulse 1.6s var(--ease) infinite; }
.chip.is-on .spark { color: var(--ink); }
@keyframes sparkPulse { 0%,100% { opacity: .55; transform: scale(.9); } 50% { opacity: 1; transform: scale(1.12); } }

/* ---------- Suplentes en modo LISTA (modal secundario) ----------
   SIN tarjetas: DOS columnas separadas por LÍNEAS divisorias (filas con borde
   inferior fino). Compacto para no ocupar más alto del necesario. */
.subs { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; row-gap: 0;
  max-height: 34vh; overflow-y: auto; overflow-x: hidden; scrollbar-width: none;
  animation: subsIn .34s var(--ease-decel) both; }
.subs::-webkit-scrollbar { display: none; }
@keyframes subsIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
/* Cada suplente entra escalonado (decel) tras la lista → revelado ordenado. */
.subs .sub { animation: subRowIn .34s var(--ease-decel) both; }
.subs .sub:nth-child(1) { animation-delay: .02s; } .subs .sub:nth-child(2) { animation-delay: .06s; }
.subs .sub:nth-child(3) { animation-delay: .10s; } .subs .sub:nth-child(4) { animation-delay: .14s; }
.subs .sub:nth-child(5) { animation-delay: .18s; } .subs .sub:nth-child(6) { animation-delay: .22s; }
.subs .sub:nth-child(n+7) { animation-delay: .26s; }
@keyframes subRowIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.sub { display: flex; align-items: center; gap: 9px; width: 100%; min-width: 0; cursor: pointer; font-family: var(--font);
  background: none; border: 0; border-bottom: 1px solid var(--accent-faint); border-radius: 0; padding: 8px 2px;
  color: #fff; transition: color .18s var(--ease), border-color .18s var(--ease), transform .14s var(--ease-spring); text-align: left; }
.sub:hover { border-bottom-color: var(--accent-line); color: var(--accent); transform: translateX(2px); }
.sub:active { transform: scale(0.98); transition-duration: .12s; }
.sub__num { font-family:'Scoreboard','Gelion',monospace; min-width: 22px; text-align: center; font-size: 15px; color: var(--accent); }
.sub__name { flex: 1 1 auto; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub__pos { font-size: 10px; color: var(--white-44); letter-spacing: .08em; flex: 0 0 auto; }
.sub--gk .sub__num { color: #6be3a0; }
.sub--shine { color: var(--accent); border-bottom-color: var(--accent-line); }
.sub--shine .spark { width: 13px; height: 13px; color: var(--accent); animation: sparkPulse 1.6s var(--ease) infinite; flex: 0 0 auto; }

/* Stats — DOS columnas, solo iconos. min-width:0 + mins reducidos para que
   NADA se desborde de su columna/tarjeta. */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 12px; }
/* Panel de partido: las cuatro estadísticas entran escalonadas (decel suave)
   al pulsar "Jugar", para que el panel se revele con orden y no de golpe. */
.stats:not([hidden]) .stat { animation: statIn .42s var(--ease-decel) both; }
.stats:not([hidden]) .stat:nth-child(1) { animation-delay: .04s; }
.stats:not([hidden]) .stat:nth-child(2) { animation-delay: .10s; }
.stats:not([hidden]) .stat:nth-child(3) { animation-delay: .16s; }
.stats:not([hidden]) .stat:nth-child(4) { animation-delay: .22s; }
@keyframes statIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.stat { min-width: 0; }
.stat__top { display: flex; align-items: center; justify-content: space-between; gap: 4px; font-size: 12px; margin-bottom: 5px; font-variant-numeric: tabular-nums; font-weight: 600; }
.stat__h { color: var(--accent); min-width: 24px; text-align: left; }
.stat__top > span:last-child { min-width: 24px; text-align: right; color: #fff; }
.stat__l { color: var(--white-44); display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; }
.stat__l .ico { width: 14px; height: 14px; }
.stat__bar { height: 5px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; display: flex; }
.stat__fill { height: 100%; transition: width .6s var(--ease); }
.stat__fill--h { background: var(--accent); }
.stat__fill--a { background: rgba(255,255,255,.28); }

/* Acciones — solo el control de "reiniciar" del último nivel (text-free). */
.actions { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 2px; flex-wrap: wrap; }
/* Si no hay acción visible (solo el botón "siguiente" oculto), la fila se COLAPSA
   por completo — así no sobra margen abajo del panel al mostrar los sistemas. */
.actions:empty, .actions:has(> [hidden]:only-child) { display: none; }

/* ---------- Responsive ---------- */
/* ===== Coreografía de entrada: campo → 11 uno a uno → tarjeta secundaria;
   escudos con ZOOM + ROTACIÓN. (Reduced-motion la desactiva más abajo.) ===== */
@keyframes brFieldIn { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes brPanelIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes brCrestIn { 0% { opacity: 0; transform: scale(.2) rotate(-40deg); } 55% { opacity: 1; } 100% { opacity: 1; transform: rotate(var(--tilt, 0deg)); } }
@keyframes brPlayerIn { from { opacity: 0; transform: translate(-50%,-50%) scale(.35); } to { opacity: 1; transform: translate(-50%,-50%) scale(1); } }
.field-card { animation: brFieldIn .6s var(--ease) both; }
.sb__crest { animation: brCrestIn .7s cubic-bezier(0.34,1.56,0.64,1) .15s both; }
.panel { animation: brPanelIn .55s var(--ease) 1.7s both; }
.pitch.is-entering .player { opacity: 0; animation: brPlayerIn .5s cubic-bezier(0.34,1.56,0.64,1) both;
  animation-delay: calc(0.55s + var(--i, 0) * 0.085s); }

@media (max-width: 900px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100%; }
  /* Campo más grande también en móvil para espaciar bien a los 11. */
  :root { --pitch-h: min(58vh, 460px); }
  /* Token de jugador: como máximo DOS líneas (disco + nombre); el nombre
     nunca salta a una tercera línea. */
  .player { gap: 3px; }
  .player__name { font-size: clamp(9px, 2.8vw, 11px); }
  /* Chips de sistema más compactos para que NUNCA se salgan del contenedor. */
  .chip { padding: 7px 6px; font-size: 11px; }
  /* Banquillo en dos columnas también (líneas divisorias), compacto. */
  .subs { column-gap: 12px; }
}
@media (max-width: 420px) {
  .chip { font-size: 10px; gap: 2px; padding: 6px 5px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  /* Excepción: el cambio de era sigue siendo un crossfade limpio (solo
     opacidad, sin transform), nunca un pop abrupto. */
  .sb__crest .crest__layer { transition: opacity .3s linear !important; transform: none !important; }
  .sb__crest.is-morphing .crest__layer--in { transform: none !important; }
  .sb__crest.is-morphing.run .crest__layer--out { transform: none !important; }
  .player.is-incoming, .player.is-leaving { animation: none !important; }
  .goal-toast { transition: opacity .2s linear !important; transform: translate(-50%, 0) !important; }
}
