:root {
  --fondo: #050b1c;
  --linea: rgba(216, 179, 74, .18);
  --linea-suave: rgba(255, 255, 255, .07);
  --azul: #1f56c3;
  --azul-claro: #6f9cf2;
  --dorado: #d8b34a;
  --dorado-claro: #f1d47e;
  --texto: #f3f5fa;
  --texto-2: #b3bfd9;
  --texto-3: #7383a8;
  --ok: #52cc94;
  --aviso: #f0b54a;
  --mal: #ef7070;
  --radio: 18px;
  --display: 'Oswald', 'Arial Narrow', 'Roboto Condensed', sans-serif;
  --cuerpo: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--fondo); -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  background: var(--fondo);
  color: var(--texto);
  font-family: var(--cuerpo);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(78px + env(safe-area-inset-bottom));
  overflow-x: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul, ol { list-style: none; }

.resplandor {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(70% 45% at 50% -5%, rgba(31, 86, 195, .38), transparent 70%),
    radial-gradient(35% 25% at 50% 6%, rgba(216, 179, 74, .09), transparent 70%);
}
.cabecera, .contenido, .pie { position: relative; z-index: 1; }

/* ---------- Cabecera ---------- */
.cabecera { text-align: center; padding: 26px 16px 6px; }
.marca { display: inline-block; -webkit-tap-highlight-color: transparent; }
.escudo {
  display: block; height: 150px; width: auto; margin: 0 auto;
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, .55)) drop-shadow(0 0 36px rgba(31, 86, 195, .28));
  transition: height .35s ease;
}
body:not([data-vista="inicio"]) .escudo { height: 78px; }
.torneo {
  margin-top: 12px;
  font-family: var(--display); font-weight: 500; font-size: 12px;
  letter-spacing: .2em; text-transform: uppercase; color: var(--dorado);
}

/* ---------- Pestañas ---------- */
.pestanas {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: rgba(5, 11, 28, .88);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-top: 1px solid var(--linea);
}
.pestanas a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 0 5px; border-radius: 12px;
  color: var(--texto-3); text-decoration: none;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  -webkit-tap-highlight-color: transparent; transition: color .2s;
}
.pestanas svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.pestanas a[aria-current="page"] { color: var(--dorado-claro); }
.pestanas a:focus-visible { outline: 2px solid var(--dorado); outline-offset: -2px; }

/* ---------- Contenido ---------- */
.contenido { max-width: 760px; margin: 0 auto; padding: 14px 16px 8px; display: grid; gap: 14px; }
.rejilla { display: grid; gap: 14px; }

.tarjeta {
  background: linear-gradient(180deg, rgba(31, 86, 195, .13), rgba(12, 25, 60, .55));
  border: 1px solid var(--linea-suave);
  border-radius: var(--radio);
  padding: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
  min-width: 0;
}
.tarjeta.destacada {
  border-color: var(--linea);
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(216, 179, 74, .11), transparent 60%),
    linear-gradient(180deg, rgba(31, 86, 195, .24), rgba(12, 25, 60, .6));
}
.etiqueta {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 14px;
  font-family: var(--display); font-weight: 500; font-size: 12px;
  letter-spacing: .16em; text-transform: uppercase; color: var(--texto-3);
}
.etiqueta b { font-weight: 500; color: var(--dorado); white-space: nowrap; }
.titulo-seccion {
  font-family: var(--display); font-weight: 500; font-size: 13px;
  letter-spacing: .16em; text-transform: uppercase; color: var(--dorado);
  margin: 6px 2px -4px;
}
.cifra { font-family: var(--display); font-weight: 600; font-size: 38px; line-height: 1; color: var(--dorado-claro); letter-spacing: .01em; }
.cifra.negativa { color: var(--mal); }
.j-info small .debe { color: var(--aviso); }
.nota { color: var(--texto-2); font-size: 14px; }
.nota-suave { color: var(--texto-3); font-size: 13px; }
.vacio { color: var(--texto-3); font-size: 14px; text-align: center; padding: 6px 0; }

.ico { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -2px; }

/* ---------- Partido ---------- */
.vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.vs .eq { font-family: var(--display); font-weight: 500; font-size: 20px; line-height: 1.15; text-transform: uppercase; letter-spacing: .02em; }
.vs .eq.rival { text-align: right; }
.vs .x { font-family: var(--display); font-size: 14px; color: var(--texto-3); letter-spacing: .1em; }
.vs .marcador { font-family: var(--display); font-weight: 600; font-size: 34px; color: var(--dorado-claro); white-space: nowrap; }
.vs .marcador i { font-style: normal; color: var(--texto-3); margin: 0 6px; font-weight: 500; }
.hero .vs .eq { font-size: 22px; }
.hero .vs .eq.rival { font-size: 26px; color: var(--texto); }
.datos { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 16px; color: var(--texto-2); font-size: 14px; }
.datos span { display: inline-flex; align-items: center; gap: 6px; }
.datos .ico { color: var(--dorado); }

.res {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-family: var(--cuerpo); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.res.v { background: var(--dorado); color: #1b1503; }
.res.e { background: rgba(111, 156, 242, .18); color: var(--azul-claro); }
.res.d { background: rgba(239, 112, 112, .14); color: var(--mal); }
.res.aplazado, .res.programado { background: rgba(255, 255, 255, .07); color: var(--texto-2); }
.res.cancelado { background: rgba(239, 112, 112, .1); color: var(--mal); }

.partido .lineas { display: grid; gap: 7px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--linea-suave); font-size: 14px; color: var(--texto-2); }
.partido .lineas p { display: flex; gap: 8px; align-items: flex-start; }
.partido .lineas .ico { margin-top: 3px; color: var(--dorado); }

/* ---------- Estadísticas ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stats div { text-align: center; padding: 10px 0 8px; border-radius: 12px; background: rgba(255, 255, 255, .035); }
.stats b { display: block; font-family: var(--display); font-weight: 600; font-size: 28px; line-height: 1.1; color: var(--texto); }
.stats div:nth-child(2) b { color: var(--dorado-claro); }
.stats span { font-size: 11px; color: var(--texto-3); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.goles-linea { display: flex; justify-content: center; gap: 18px; margin-top: 12px; color: var(--texto-2); font-size: 14px; }
.goles-linea b { color: var(--texto); font-weight: 600; }

/* ---------- Barras ---------- */
.barra { position: relative; height: 10px; border-radius: 999px; background: rgba(255, 255, 255, .08); margin: 16px 0 10px; }
.barra > i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: linear-gradient(90deg, #b8912c, var(--dorado-claro)); box-shadow: 0 0 18px rgba(216, 179, 74, .35); }
.barra > em { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--texto); border-radius: 2px; opacity: .55; }
.barra.fina { height: 6px; margin: 8px 0 0; }
.barra.fina > i { box-shadow: none; }
.barra-pie { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--texto-3); }
.barra-pie b { color: var(--texto-2); font-weight: 600; }
.aviso-linea { margin-top: 12px; font-size: 14px; color: var(--texto-2); display: flex; gap: 8px; align-items: center; }
.aviso-linea.ok { color: var(--ok); }
.aviso-linea b { color: var(--texto); font-weight: 600; }

.fuentes { display: grid; gap: 14px; }
.fuente-cab { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 14px; }
.fuente-cab span { color: var(--texto-2); }
.fuente-cab b { font-weight: 600; white-space: nowrap; }
.fuente-cab small { color: var(--texto-3); font-weight: 400; }

/* ---------- Cupos ---------- */
.cupos { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.cupos i { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid rgba(216, 179, 74, .45); }
.cupos i.lleno { background: linear-gradient(180deg, var(--dorado-claro), #b8912c); border-color: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, .06); color: var(--texto-2); font-size: 12.5px; font-weight: 500; }
.chip b { color: var(--texto); font-weight: 700; }

/* ---------- Lista de jugadores ---------- */
.lista { display: grid; }
.lista li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--linea-suave); min-width: 0; }
.lista li:first-child { border-top: 0; padding-top: 2px; }
.lista li:last-child { padding-bottom: 2px; }
.dorsal {
  flex: none; width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 600; font-size: 15px; color: var(--dorado-claro);
  background: radial-gradient(circle at 30% 25%, rgba(111, 156, 242, .35), rgba(31, 86, 195, .25));
  border: 1px solid var(--linea);
}
.dorsal.letras { font-size: 13px; letter-spacing: .02em; }
.j-info { flex: 1; min-width: 0; }
.j-info b { display: block; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.j-info small { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--texto-3); font-size: 12.5px; margin-top: 1px; }
.j-info small span { display: inline-flex; align-items: center; gap: 4px; }
.lista li.libre .dorsal { background: none; border: 1.5px dashed rgba(216, 179, 74, .35); color: var(--texto-3); }
.lista li.libre b { color: var(--texto-3); font-weight: 500; }

.pastilla { flex: none; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pastilla.ok { background: rgba(82, 204, 148, .13); color: var(--ok); }
.pastilla.parcial { background: rgba(240, 181, 74, .13); color: var(--aviso); }
.pastilla.pend { background: rgba(255, 255, 255, .06); color: var(--texto-3); }
.etq-roja { display: inline-block; padding: 1px 7px; border-radius: 6px; background: rgba(239, 112, 112, .15); color: var(--mal); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }

.cartulina { display: inline-block; width: 8px; height: 11px; border-radius: 1.5px; vertical-align: -1px; }
.cartulina.am { background: #f3cf3c; }
.cartulina.ro { background: #e5484d; }

/* ---------- Goleadores ---------- */
.ranking li { gap: 14px; }
.ranking .pos { width: 22px; text-align: center; font-family: var(--display); font-weight: 600; font-size: 18px; color: var(--texto-3); }
.ranking li:first-child .pos { color: var(--dorado-claro); }
.ranking .num { font-family: var(--display); font-weight: 600; font-size: 24px; color: var(--dorado-claro); min-width: 28px; text-align: right; }

/* ---------- Movimientos ---------- */
.monto { flex: none; font-weight: 700; font-size: 15px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.monto.entra { color: var(--ok); }
.monto.sale { color: var(--texto-2); }
.resumen-caja { display: flex; gap: 18px; margin-top: 12px; font-size: 14px; color: var(--texto-2); flex-wrap: wrap; }
.resumen-caja b { color: var(--texto); font-weight: 600; }

/* ---------- Alertas ---------- */
.alerta { border-color: rgba(239, 112, 112, .35); background: linear-gradient(180deg, rgba(239, 112, 112, .1), rgba(12, 25, 60, .55)); }
.alerta .etiqueta { color: var(--mal); }

/* ---------- Estados ---------- */
.estado-carga { display: flex; justify-content: center; gap: 8px; padding: 50px 0; }
.estado-carga .punto { width: 8px; height: 8px; border-radius: 50%; background: var(--dorado); opacity: .3; animation: latido 1.2s infinite ease-in-out; }
.estado-carga .punto:nth-child(2) { animation-delay: .15s; }
.estado-carga .punto:nth-child(3) { animation-delay: .3s; }
@keyframes latido { 0%, 100% { opacity: .25; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.1); } }
.mensaje { text-align: center; padding: 26px 20px; }
.mensaje h2 { font-family: var(--display); font-weight: 500; font-size: 20px; letter-spacing: .04em; margin-bottom: 8px; }
.mensaje p { color: var(--texto-2); font-size: 14px; }
.boton {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 16px;
  padding: 10px 18px; border-radius: 999px; border: 1px solid var(--linea);
  color: var(--dorado-claro); font-weight: 600; font-size: 14px;
}
.boton:hover { background: rgba(216, 179, 74, .08); }

/* ---------- Pie ---------- */
.pie {
  max-width: 760px; margin: 0 auto; padding: 6px 16px 24px;
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
  color: var(--texto-3); font-size: 12.5px; text-align: center;
}
.pie button { color: var(--texto-2); font-size: 12.5px; font-weight: 600; padding: 6px 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 5px; }
.pie button:hover { color: var(--dorado-claro); }
.pie button.girando svg { animation: girar .8s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

/* ---------- Escritorio ---------- */
@media (min-width: 760px) {
  body { padding-bottom: 0; font-size: 15.5px; }
  .cabecera { padding-top: 34px; }
  .escudo { height: 184px; }
  body:not([data-vista="inicio"]) .escudo { height: 92px; }
  .pestanas {
    position: sticky; top: 12px; bottom: auto; left: auto; right: auto;
    width: min(520px, calc(100% - 32px)); margin: 10px auto 4px;
    padding: 5px; border: 1px solid var(--linea); border-radius: 999px;
    background: rgba(8, 17, 42, .82);
  }
  .pestanas a { flex-direction: row; justify-content: center; gap: 7px; padding: 9px 0; border-radius: 999px; font-size: 13.5px; }
  .pestanas svg { width: 18px; height: 18px; }
  .pestanas a[aria-current="page"] { background: linear-gradient(180deg, rgba(216, 179, 74, .2), rgba(216, 179, 74, .07)); }
  .pestanas a:hover { color: var(--texto); }
  .pestanas a[aria-current="page"]:hover { color: var(--dorado-claro); }
  .contenido { padding-top: 22px; }
  .rejilla.dos { grid-template-columns: 1fr 1fr; }
  .tarjeta { padding: 22px; }
  .hero .vs .eq { font-size: 26px; }
  .hero .vs .eq.rival { font-size: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
