/* ---------------------------------------------------------------
   Despedida de Xavi · estadisticas lasertag
   Sin dependencias. Movil primero, se ensancha en pantallas grandes.
   --------------------------------------------------------------- */

:root {
  --fondo:        #0e1116;
  --fondo-2:      #151a22;
  --tarjeta:      #171d27;
  --tarjeta-alta: #1e2530;
  --borde:        #262e3a;
  --borde-suave:  #1f2732;

  --texto:        #e7eaf0;
  --texto-medio:  #9aa4b5;
  --texto-tenue:  #6b7688;

  --rojo:         #ef4a44;
  --rojo-suave:   #2b1618;
  --azul:         #4b8ef7;
  --azul-suave:   #14203a;
  --ambar:        #f5b544;
  --verde:        #35c48b;

  --radio:   14px;
  --radio-s: 10px;
  --ancho:   1180px;

  --sombra: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 700; letter-spacing: -.015em; }

b, strong { font-weight: 700; }

/* Todo numero tabular, para que las columnas no bailen */
.num, table, .cifra, .kpi-valor { font-variant-numeric: tabular-nums; }

/* ---------- cabecera ---------- */

.cabecera {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(14,17,22,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--borde-suave);
}

.cabecera-fila {
  max-width: var(--ancho);
  margin: 0 auto;
  padding: 12px 16px 10px;
}

.marca { display: inline-flex; align-items: center; gap: 11px; }

.marca-diana {
  width: 26px; height: 26px; flex: none;
  border-radius: 50%;
  border: 2px solid var(--rojo);
  position: relative;
}
.marca-diana::before,
.marca-diana::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  border-radius: 50%;
}
.marca-diana::before { width: 13px; height: 13px; border: 2px solid var(--rojo); }
.marca-diana::after  { width: 4px;  height: 4px;  background: var(--rojo); }

.marca-txt { display: flex; flex-direction: column; }
.marca-txt b {
  font-size: 14px; letter-spacing: .09em; line-height: 1.15;
}
.marca-txt small { color: var(--texto-tenue); font-size: 11.5px; letter-spacing: .03em; }

.nav {
  display: flex;
  gap: 2px;
  max-width: var(--ancho);
  margin: 0 auto;
  padding: 0 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav a {
  flex: none;
  padding: 9px 12px 11px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--texto-tenue);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color .12s;
}
.nav a:hover { color: var(--texto-medio); }
.nav a.activo { color: var(--texto); border-bottom-color: var(--rojo); }

/* ---------- estructura ---------- */

.app {
  max-width: var(--ancho);
  margin: 0 auto;
  padding: 20px 16px 60px;
}

.seccion { margin-bottom: 34px; }

.seccion-tit {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.seccion-tit h2 { font-size: 17px; }
.seccion-tit p { margin: 0; font-size: 12.5px; color: var(--texto-tenue); }

.sub {
  margin: -6px 0 14px;
  font-size: 13px;
  color: var(--texto-medio);
  max-width: 68ch;
}

.tarjeta {
  background: var(--tarjeta);
  border: 1px solid var(--borde-suave);
  border-radius: var(--radio);
  padding: 16px;
}

.rejilla { display: grid; gap: 12px; }
.rejilla.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rejilla.c3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.rejilla.c4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }

/* ---------- marcador de la serie ---------- */

.serie {
  background: linear-gradient(160deg, var(--tarjeta-alta), var(--tarjeta));
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 20px 16px;
  text-align: center;
  box-shadow: var(--sombra);
}
.serie-eti {
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--texto-tenue);
}
.serie-marcador {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; margin: 12px 0 6px;
}
.serie-lado { flex: 1; max-width: 190px; }
.serie-lado .nombre {
  font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
}
.serie-lado .puntos { font-size: 48px; font-weight: 800; line-height: 1; margin-top: 2px; }
.serie-lado.rojo .nombre, .serie-lado.rojo .puntos { color: var(--rojo); }
.serie-lado.azul .nombre, .serie-lado.azul .puntos { color: var(--azul); }
.serie-lado.pierde { opacity: .48; }
.serie-guion { font-size: 24px; color: var(--texto-tenue); font-weight: 300; }
.serie-pie { font-size: 13px; color: var(--texto-medio); }

/* ---------- KPIs ---------- */

.kpi {
  background: var(--tarjeta);
  border: 1px solid var(--borde-suave);
  border-radius: var(--radio-s);
  padding: 13px 14px;
}
.kpi-valor { font-size: 25px; font-weight: 800; line-height: 1.1; }
.kpi-eti { font-size: 11.5px; color: var(--texto-tenue); margin-top: 3px; }
.kpi-nota { font-size: 11.5px; color: var(--texto-medio); margin-top: 6px; }

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

.tabla-caja {
  overflow-x: auto;
  border: 1px solid var(--borde-suave);
  border-radius: var(--radio);
  background: var(--tarjeta);
  -webkit-overflow-scrolling: touch;
}

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

thead th {
  position: sticky; top: 0;
  background: var(--tarjeta-alta);
  text-align: right;
  padding: 10px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--texto-tenue);
  white-space: nowrap;
  border-bottom: 1px solid var(--borde);
}
thead th:first-child, thead th.izq { text-align: left; }
thead th.orden { cursor: pointer; user-select: none; }
thead th.orden:hover { color: var(--texto); }
thead th.orden-activo { color: var(--ambar); }

tbody td {
  padding: 9px 10px;
  text-align: right;
  border-bottom: 1px solid var(--borde-suave);
  white-space: nowrap;
}
tbody td:first-child, tbody td.izq { text-align: left; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.pulsable { cursor: pointer; }
tbody tr.pulsable:hover { background: var(--tarjeta-alta); }

.pos {
  display: inline-block; min-width: 20px;
  color: var(--texto-tenue); font-size: 12px; font-weight: 700;
}
.pos.top1 { color: var(--ambar); }
.pos.top2, .pos.top3 { color: var(--texto-medio); }

.tenue { color: var(--texto-tenue); }
.medio { color: var(--texto-medio); }
.peque { font-size: 12px; }

/* ---------- fichas de jugador ---------- */

.punto-equipo {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  margin-right: 7px; vertical-align: 1px; flex: none;
}
.punto-equipo.rojo { background: var(--rojo); }
.punto-equipo.azul { background: var(--azul); }

.jug-rejilla {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 165px), 1fr));
}

.jug-tarjeta {
  display: block;
  background: var(--tarjeta);
  border: 1px solid var(--borde-suave);
  border-radius: var(--radio-s);
  padding: 13px 14px;
  transition: border-color .12s, transform .12s;
}
.jug-tarjeta:hover { border-color: var(--borde); transform: translateY(-1px); }
.jug-tarjeta .nom { font-weight: 700; font-size: 15px; display: flex; align-items: center; }
.jug-tarjeta .met { font-size: 12px; color: var(--texto-tenue); margin-top: 6px; }
.jug-tarjeta .met b { color: var(--texto); font-weight: 700; }

/* ---------- barras ---------- */

.barra {
  height: 6px; border-radius: 3px;
  background: var(--borde-suave);
  overflow: hidden;
}
.barra > i { display: block; height: 100%; border-radius: 3px; background: var(--ambar); }
.barra.rojo > i { background: var(--rojo); }
.barra.azul > i { background: var(--azul); }

.barra-fila {
  display: grid;
  grid-template-columns: 1fr 46px;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
}
.barra-fila:last-child { margin-bottom: 0; }
.barra-fila .eti { font-size: 12.5px; margin-bottom: 4px; display: flex; justify-content: space-between; gap: 8px; }
.barra-fila .val { text-align: right; font-size: 12.5px; font-weight: 700; }

/* ---------- matriz de duelos ---------- */

.matriz-caja { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.matriz { border-collapse: separate; border-spacing: 3px; font-size: 12.5px; }
.matriz th {
  position: static;
  background: none;
  border: 0;
  padding: 4px 6px;
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--texto-medio);
  text-transform: none;
  white-space: nowrap;
}
.matriz th.col { text-align: center; }
.matriz th.fil { text-align: right; }
.matriz td {
  border: 0;
  padding: 0;
  text-align: center;
}
.celda {
  width: 100%;
  min-width: 46px;
  height: 42px;
  border: 1px solid var(--borde-suave);
  border-radius: 8px;
  color: var(--texto);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: outline-color .1s;
  outline: 2px solid transparent;
}
.celda:hover { outline-color: var(--texto-medio); }
.celda.sel { outline-color: var(--ambar); }

.leyenda {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; color: var(--texto-tenue);
  margin-top: 12px; flex-wrap: wrap;
}
.leyenda-gradiente {
  height: 8px; width: 120px; border-radius: 4px;
}

/* ---------- pastillas / conmutadores ---------- */

.pastillas { display: flex; gap: 6px; flex-wrap: wrap; }

.pastilla {
  background: var(--tarjeta);
  border: 1px solid var(--borde);
  color: var(--texto-medio);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .12s;
}
.pastilla:hover { color: var(--texto); }
.pastilla.activa { background: var(--texto); color: var(--fondo); border-color: var(--texto); }

.etiqueta {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.etiqueta.rojo { background: var(--rojo-suave); color: var(--rojo); }
.etiqueta.azul { background: var(--azul-suave); color: var(--azul); }
.etiqueta.neutra { background: var(--borde-suave); color: var(--texto-medio); }
.etiqueta.ambar { background: #2e2413; color: var(--ambar); }

/* ---------- medallas ---------- */

.medalla {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--tarjeta-alta);
  border: 1px solid var(--borde);
  border-radius: 999px;
  padding: 5px 12px 5px 8px;
  font-size: 12px;
  font-weight: 600;
}
.medalla svg { width: 15px; height: 15px; flex: none; color: var(--ambar); }
.medalla .quien { color: var(--texto-tenue); font-weight: 500; }

/* ---------- ficha detalle ---------- */

.volver {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--texto-medio);
  margin-bottom: 14px;
}
.volver:hover { color: var(--texto); }

.ficha-cab {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 16px;
}
.ficha-cab h1 { font-size: 30px; letter-spacing: -.02em; }
.ficha-cab .meta { font-size: 13px; color: var(--texto-tenue); margin-top: 4px; }

.selector-jug {
  background: var(--tarjeta);
  border: 1px solid var(--borde);
  color: var(--texto);
  border-radius: var(--radio-s);
  padding: 8px 12px;
  font-size: 13.5px;
  font-family: inherit;
}

/* ---------- duelo cara a cara ---------- */

.h2h { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
.h2h .lado { text-align: center; }
.h2h .lado .n { font-size: 15px; font-weight: 700; }
.h2h .vs { font-size: 11px; color: var(--texto-tenue); letter-spacing: .1em; }

.h2h-fila {
  display: grid; grid-template-columns: 52px 1fr 52px;
  align-items: center; gap: 10px; margin-top: 11px;
}
.h2h-fila .n { font-size: 14px; font-weight: 700; }
.h2h-fila .n.izq { text-align: left; }
.h2h-fila .n.der { text-align: right; }
.h2h-fila .eti { text-align: center; font-size: 11px; color: var(--texto-tenue); }
.h2h-barra { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--borde-suave); margin-top: 5px; }
.h2h-barra i:first-child { background: var(--rojo); }
.h2h-barra i:last-child  { background: var(--azul); }

/* ---------- graficos ---------- */

.grafico { width: 100%; height: auto; display: block; overflow: visible; }
.g-linea { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.g-eje  { stroke: var(--borde); stroke-width: 1; }
.g-txt  { fill: var(--texto-tenue); font-size: 10px; }

/* ---------- records ---------- */

.record {
  background: var(--tarjeta);
  border: 1px solid var(--borde-suave);
  border-radius: var(--radio-s);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.record .tit { font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--texto-tenue); }
.record .quien { font-size: 18px; font-weight: 800; }
.record .dato { font-size: 13px; color: var(--ambar); font-weight: 700; }
.record .ctx { font-size: 12px; color: var(--texto-tenue); }

.dato-curioso {
  border-left: 2px solid var(--ambar);
  padding: 2px 0 2px 13px;
  margin-bottom: 13px;
  font-size: 13.5px;
  color: var(--texto-medio);
}
.dato-curioso:last-child { margin-bottom: 0; }
.dato-curioso b { color: var(--texto); }

/* ---------- pie ---------- */

.pie {
  max-width: var(--ancho);
  margin: 0 auto;
  padding: 22px 16px 40px;
  border-top: 1px solid var(--borde-suave);
  font-size: 12px;
  color: var(--texto-tenue);
}
.pie p { margin: 0 0 5px; }
.pie a { color: var(--texto-medio); text-decoration: underline; text-underline-offset: 2px; }
.pie-tenue { color: var(--texto-tenue); }

/* ---------- escritorio ---------- */

@media (min-width: 720px) {
  body { font-size: 15.5px; }
  .app { padding: 26px 24px 70px; }
  .cabecera-fila { padding: 15px 24px 11px; }
  .nav { padding: 0 18px; }
  .nav a { padding: 10px 14px 12px; font-size: 14px; }
  .serie { padding: 28px 24px; }
  .serie-lado .puntos { font-size: 62px; }
  .marca-txt b { font-size: 15px; }
  .seccion-tit h2 { font-size: 19px; }
  .celda { min-width: 62px; height: 50px; font-size: 14.5px; }
}

@media (min-width: 1000px) {
  .rejilla.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Respetar quien no quiera animaciones */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
