/* ============================================================
   MatchApp RFFM — sistema visual
   ============================================================ */
:root {
  /* Marca */
  --rojo: #E11D2A;
  --rojo-600: #C41722;
  --rojo-tint: rgba(225, 29, 42, .10);

  /* Superficies (claro) */
  --bg: #f2f3f5;
  --bg-grad-1: #f6f7f9;
  --bg-grad-2: #eceef1;
  --card: #ffffff;
  --card-2: #f7f8fa;
  --text: #14171c;
  --muted: #6b7280;
  --faint: #9aa1ac;
  --line: #e8eaed;
  --line-strong: #d9dce1;

  /* Estados */
  --win: #16a34a;
  --draw: #9ca3af;
  --loss: #ef4444;

  /* Sombras */
  --sh-sm: 0 1px 2px rgba(16,20,28,.06), 0 1px 3px rgba(16,20,28,.05);
  --sh-md: 0 2px 6px rgba(16,20,28,.07), 0 8px 24px rgba(16,20,28,.06);
  --sh-lg: 0 8px 30px rgba(16,20,28,.12);

  --r-sm: 10px;
  --r: 16px;
  --r-lg: 22px;

  --topbar-h: 54px;
  --tabbar-h: 62px;
  --maxw: 680px;
}
/* Paleta oscura: se aplica por preferencia del SO salvo que el usuario haya
   forzado el claro, y siempre que el usuario fuerce el oscuro con data-theme. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0d10;
    --bg-grad-1: #101318;
    --bg-grad-2: #0a0c0f;
    --card: #16191f;
    --card-2: #1c2027;
    --text: #eef0f3;
    --muted: #9aa1ac;
    --faint: #6b7280;
    --line: #262b33;
    --line-strong: #333a44;
    --rojo-tint: rgba(225, 29, 42, .18);
    --sh-sm: 0 1px 2px rgba(0,0,0,.4);
    --sh-md: 0 4px 16px rgba(0,0,0,.45);
    --sh-lg: 0 10px 34px rgba(0,0,0,.55);
  }
}
:root[data-theme="dark"] {
  --bg: #0b0d10;
  --bg-grad-1: #101318;
  --bg-grad-2: #0a0c0f;
  --card: #16191f;
  --card-2: #1c2027;
  --text: #eef0f3;
  --muted: #9aa1ac;
  --faint: #6b7280;
  --line: #262b33;
  --line-strong: #333a44;
  --rojo-tint: rgba(225, 29, 42, .18);
  --sh-sm: 0 1px 2px rgba(0,0,0,.4);
  --sh-md: 0 4px 16px rgba(0,0,0,.45);
  --sh-lg: 0 10px 34px rgba(0,0,0,.55);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 50% -200px, var(--bg-grad-1), transparent 70%),
    linear-gradient(var(--bg-grad-1), var(--bg-grad-2));
  background-attachment: fixed;
  min-height: 100vh;
  padding-top: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
a.plain { text-decoration: none; color: inherit; display: block; }

/* ---------- Top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0;
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0;
  display: flex; align-items: center; gap: 4px;
  background: color-mix(in srgb, var(--card) 78%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
  z-index: 30;
}
.topbar h1 {
  font-size: 19px; font-weight: 800; letter-spacing: -.02em; margin: 0;
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#themeBtn, #userBtn { font-size: 20px; flex: 0 0 auto; }
.topbar h1::before {
  content: ""; width: 26px; height: 26px; border-radius: 7px; flex: 0 0 auto;
  background: url("/icons/icon-192.png") center / cover no-repeat;
  box-shadow: var(--sh-sm);
}
.iconbtn {
  background: none; border: none; color: var(--text); cursor: pointer;
  width: 38px; height: 38px; font-size: 26px; line-height: 1;
  display: grid; place-items: center; border-radius: 12px;
}
.iconbtn:active { background: var(--card-2); }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; inset: auto 0 0 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; z-index: 30;
  background: color-mix(in srgb, var(--card) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; text-decoration: none; color: var(--faint); font-size: 11px; font-weight: 600;
}
.tab span { font-size: 21px; line-height: 1; }
.tab.active { color: var(--rojo); }

main { max-width: var(--maxw); margin: 0 auto; padding: 14px 14px 8px; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--sh-sm);
  overflow: hidden; margin-bottom: 14px;
}
.section-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--faint); margin: 18px 6px 8px;
}
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: none; }
a.plain:active .row { background: var(--card-2); }
.grow { flex: 1; min-width: 0; }
.name { font-weight: 650; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { font-size: 12.5px; color: var(--muted); }
.muted { color: var(--faint); }
.right { margin-left: auto; text-align: right; }

/* Escudos */
.escudo {
  width: 30px; height: 30px; flex: 0 0 30px; object-fit: contain;
  border-radius: 7px; background: var(--card-2);
}
.escudo.lg { width: 52px; height: 52px; flex-basis: 52px; border-radius: 12px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; text-decoration: none;
  background: var(--card-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 11px; margin: 4px 6px 0 0; color: var(--text);
}
.badge {
  display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .03em;
  padding: 3px 8px; border-radius: 999px; background: var(--card-2);
  border: 1px solid var(--line); color: var(--muted);
}
.badge.tit { background: var(--rojo-tint); border-color: transparent; color: var(--rojo); }

/* ---------- Sub-pestañas ---------- */
.subtabs {
  display: flex; gap: 6px; margin-bottom: 14px; overflow-x: auto;
  padding-bottom: 2px; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.subtabs::-webkit-scrollbar { display: none; }
.subtab {
  flex: 0 0 auto; padding: 8px 15px; border-radius: 999px; cursor: pointer;
  background: var(--card); border: 1px solid var(--line);
  color: var(--muted); font-size: 13px; font-weight: 650; white-space: nowrap;
  transition: transform .08s ease;
}
.subtab:active { transform: scale(.96); }
.subtab.active { background: var(--rojo); color: #fff; border-color: var(--rojo); box-shadow: 0 4px 12px var(--rojo-tint); }

/* ---------- Buscador ---------- */
.search {
  width: 100%; padding: 13px 16px; border-radius: 14px;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--text);
  font-size: 16px; margin-bottom: 14px; outline: none;
  box-shadow: var(--sh-sm);
}
.search:focus { border-color: var(--rojo); box-shadow: 0 0 0 4px var(--rojo-tint); }
.star { font-size: 23px; cursor: pointer; color: var(--line-strong); background: none; border: none; padding: 4px; transition: transform .12s ease; }
.star:active { transform: scale(1.3); }
.star.on { color: #f5a623; }
.star.club { font-size: 27px; }
.fav-club-hint { font-size: 11.5px; color: var(--muted); padding: 0 14px 12px; line-height: 1.4; }

/* ---------- Estados ---------- */
.empty { text-align: center; color: var(--muted); padding: 44px 22px; white-space: pre-line; line-height: 1.5; }
.spinner { text-align: center; color: var(--faint); padding: 40px; }
.spinner::after {
  content: ""; display: inline-block; width: 22px; height: 22px; margin-left: 4px;
  border: 2.5px solid var(--line-strong); border-top-color: var(--rojo);
  border-radius: 50%; vertical-align: -5px; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Clasificación ---------- */
table.clasif { width: 100%; border-collapse: collapse; font-size: 13.5px; table-layout: fixed; }
table.clasif th, table.clasif td { padding: 11px 4px; text-align: center; font-variant-numeric: tabular-nums; }
table.clasif th { color: var(--faint); font-weight: 700; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; }
table.clasif col.c-pos { width: 38px; }
table.clasif col.c-n { width: 30px; }
table.clasif col.c-pts { width: 40px; }
table.clasif col.c-rac { width: 60px; }
table.clasif td.eq { text-align: left; overflow: hidden; }
table.clasif td.eq .eqcell { display: flex; align-items: center; gap: 7px; min-width: 0; }
table.clasif td.eq .escudo { width: 24px; height: 24px; flex-basis: 24px; }
table.clasif td.eq .name { font-size: 13.5px; font-weight: 650; min-width: 0; }
table.clasif tbody tr { border-top: 1px solid var(--line); }
table.clasif tbody tr:nth-child(even) { background: var(--card-2); }   /* filas alternas */
table.clasif tbody tr.hl,
table.clasif tbody tr.hl:nth-child(even) { background: var(--rojo-tint); }
.pos {
  width: 24px; height: 24px; border-radius: 8px; display: inline-grid; place-items: center;
  font-weight: 800; font-size: 12px; background: var(--card-2); color: var(--muted);
}
.pos.asc { background: rgba(22,163,74,.15); color: var(--win); }
.pos.desc { background: rgba(239,68,68,.15); color: var(--loss); }
.pts { font-weight: 800; color: var(--text); }
.racha { display: inline-flex; gap: 3px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* ---------- Partidos (listado) — sin escudos, nombres completos ---------- */
.jornada-h { font-size: 12px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; padding: 14px 6px 8px; }
.mrow { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.mrow:last-of-type { border-bottom: none; }
.mrow:active { background: var(--card-2); }
.mrow.noacta { opacity: .72; }
.mteams { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.mteam {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  font-size: 14px; font-weight: 600; line-height: 1.2;
}
.mteam .escudo { width: 22px; height: 22px; flex: 0 0 22px; border-radius: 5px; }
.mteam > span {
  min-width: 0; white-space: normal; overflow-wrap: anywhere;  /* no se cortan los nombres */
}
.mteam.win { font-weight: 800; }
.mres {
  flex: none; display: flex; align-items: center; gap: 5px;
  font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums;
}
.mres i { font-style: normal; color: var(--faint); font-weight: 600; }
.mres .w { color: var(--win); }
.mres .l { color: var(--muted); }
.mres.pend { font-size: 12.5px; font-weight: 700; color: var(--muted); text-align: right; }
.mgo { flex: none; color: var(--faint); font-size: 20px; font-weight: 700; line-height: 1; }
.mobs { font-size: 11.5px; color: var(--muted); padding: 0 14px 10px; margin-top: -4px; }

/* ---------- Tiles de stats (jugador) ---------- */
.tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; margin-bottom: 14px; }
.tile {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--sh-sm); padding: 13px 4px 10px; text-align: center;
}
.tile-v { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.tile-n { font-size: 9.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; margin-top: 3px; }
@media (max-width: 400px) { .tile-v { font-size: 18px; } .tiles { gap: 7px; } }

/* ============================================================
   ACTA — marcador, campo y timeline realistas
   ============================================================ */
.acta-hero {
  border-radius: var(--r-lg); overflow: hidden; margin-bottom: 14px;
  border: 1px solid var(--line); box-shadow: var(--sh-md);
  background:
    radial-gradient(120% 140% at 50% -20%, color-mix(in srgb, var(--rojo) 22%, var(--card)) 0%, var(--card) 55%);
  color: var(--text);
}
.acta-hero .meta { text-align: center; font-size: 11.5px; color: var(--muted); padding: 12px 12px 0; font-weight: 600; }
.acta-hero .scoreline {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  padding: 12px 14px 16px;
}
.acta-hero .side { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.acta-hero .side .name { font-size: 13px; font-weight: 700; text-align: center; white-space: normal; line-height: 1.25; }
.acta-hero .escudo.xl { width: 62px; height: 62px; border-radius: 14px; background: rgba(255,255,255,.5); box-shadow: var(--sh-sm); }
.acta-hero .marcador { font-size: 40px; font-weight: 900; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.acta-hero .marcador .pen { display:block; font-size: 11px; font-weight: 700; color: var(--muted); margin-top: 2px; }
.acta-hero .estado { text-align: center; font-size: 11px; color: var(--rojo); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding-bottom: 12px; }

/* Campo de fútbol */
.pitch-wrap { padding: 4px 0 2px; }
.pitch {
  position: relative; width: 100%; aspect-ratio: 68 / 105; max-height: 74vh; margin: 0 auto;
  border-radius: 16px; overflow: hidden;
  background:
    repeating-linear-gradient(0deg, #2e8b3d 0 9.09%, #2f9640 9.09% 18.18%);
  box-shadow: inset 0 0 40px rgba(0,0,0,.28);
}
@media (prefers-color-scheme: dark) {
  .pitch { background: repeating-linear-gradient(0deg, #1f6e2e 0 9.09%, #227a33 9.09% 18.18%); }
}
.pitch .lines { position: absolute; inset: 0; }
.pitch .lines * { stroke: rgba(255,255,255,.55); stroke-width: 1.4; fill: none; }
.pmark {
  position: absolute; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  width: 58px; text-decoration: none;
}
.pmark .shirt {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff;
  border: 2px solid rgba(255,255,255,.9); box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.pmark .pn {
  font-size: 10px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.9);
  max-width: 62px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center;
}
.pmark.gk .shirt { background: #f5a623; color: #1a1a1a; }

/* Suplentes / banquillo */
.bench-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
@media (max-width: 460px) { .bench-grid { grid-template-columns: 1fr; } }
.bench-side { border-right: 1px solid var(--line); }
.bench-side:last-child { border-right: none; }
.bench-side h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); margin: 0; padding: 10px 14px 4px; }
.bench-row { display: flex; align-items: center; gap: 9px; padding: 7px 14px; font-size: 13px; }
.bench-row .num { width: 22px; text-align: center; color: var(--faint); font-weight: 700; font-size: 12px; }

/* Timeline de sucesos */
.timeline { padding: 6px 0; }
.tl {
  display: grid; grid-template-columns: 1fr 46px 1fr; align-items: center;
  gap: 6px; padding: 7px 10px; font-size: 13.5px; border-top: 1px solid var(--line);
}
.tl:first-child { border-top: none; }
.tl .min { text-align: center; font-size: 11px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl .ev { display: flex; align-items: center; gap: 7px; min-width: 0; }
.tl .ev .ico { font-size: 15px; flex: 0 0 auto; }
.tl .ev .who { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl .ev.L { justify-content: flex-end; text-align: right; }
.tl .ev.V { justify-content: flex-start; }
.tl .ev.empty { opacity: 0; }
.tl .sale { font-size: 11px; color: var(--faint); }

select.search { appearance: none; -webkit-appearance: none; background-image: none; }

/* Aviso de carga (primera vez on-demand) */
.aviso {
  background: color-mix(in srgb, var(--rojo) 10%, var(--card));
  border: 1px solid color-mix(in srgb, var(--rojo) 30%, var(--line));
  color: var(--text); border-radius: var(--r);
  padding: 12px 14px; margin-bottom: 14px; font-size: 13px; line-height: 1.45;
}

/* Cambio en la cronología: entra (verde) / sale (rojo tenue) */
.tl .entra { color: var(--win); font-weight: 650; }
.tl .sale  { color: var(--loss); font-size: 12px; }

/* ---------- Home / onboarding ---------- */
.hero { text-align: center; padding: 34px 20px 30px; }
.hero-ball { font-size: 54px; line-height: 1; }
.hero h2 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin: 14px 0 6px; }
.hero p { color: var(--muted); font-size: 14px; line-height: 1.5; max-width: 340px; margin: 0 auto 20px; }
.btn {
  display: block; text-align: center; text-decoration: none;
  background: var(--rojo); color: #fff; font-weight: 700; font-size: 15px;
  padding: 14px 20px; border-radius: 14px; box-shadow: 0 6px 18px var(--rojo-tint);
  max-width: 320px; margin: 0 auto;
}
.btn:active { transform: scale(.98); }
.btn.ghost { background: var(--card); color: var(--rojo); border: 1px solid var(--line); box-shadow: var(--sh-sm); margin-top: 4px; }

/* Tarjeta de favorito en la home */
.fav-card { padding-bottom: 4px; }
.fav-card .escudo.lg { border-radius: 10px; }
.fav-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.fav-id { flex: 1; min-width: 0; }
.fav-name { font-weight: 750; letter-spacing: -.01em; line-height: 1.2; white-space: normal; overflow-wrap: anywhere; }
.fav-head .chev { font-size: 18px; flex: 0 0 auto; }

/* Equipos de un club favorito */
.fav-teams { border-top: 1px solid var(--line); }
.fav-team { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); }
.fav-team:first-child { border-top: none; }
.fav-team:active { background: var(--card-2); }
.fav-team .escudo { width: 26px; height: 26px; flex: 0 0 26px; }
.fav-team-n { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; white-space: normal; overflow-wrap: anywhere; }
.fav-team-c { font-size: 11px; color: var(--faint); flex: 0 0 auto; }

/* Próximo / Último dentro de la tarjeta de equipo favorito */
.fav-match { display: flex; align-items: flex-start; gap: 10px; padding: 9px 14px; border-top: 1px solid var(--line); }
.fav-match .lbl { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); flex: 0 0 48px; padding-top: 3px; }
.mm { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.mm-teams { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.mm-t { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 12.5px; }
.mm-t .escudo { width: 18px; height: 18px; flex: 0 0 18px; border-radius: 4px; }
.mm-t > span { min-width: 0; white-space: normal; overflow-wrap: anywhere; line-height: 1.2; }
.mm-t.win { font-weight: 800; }
.mm-r { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; font-weight: 800; font-variant-numeric: tabular-nums; font-size: 15px; }
.mm-r i { font-style: normal; color: var(--faint); font-weight: 600; }
.mm-r .w { color: var(--win); }
.mm-r .l { color: var(--muted); }
.mm-r.pend { font-size: 11.5px; font-weight: 700; color: var(--muted); text-align: right; max-width: 96px; white-space: normal; line-height: 1.2; }

/* ---------- Segmento de búsqueda ---------- */
.seg { display: flex; background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; margin-bottom: 12px; }
.seg-b { flex: 1; border: none; background: none; color: var(--muted); font-weight: 700; font-size: 14px; padding: 9px; border-radius: 9px; cursor: pointer; }
.seg-b.on { background: var(--card); color: var(--rojo); box-shadow: var(--sh-sm); }
.hint { font-size: 12.5px; color: var(--faint); margin: 0 4px 12px; line-height: 1.45; }
.hint b { color: var(--muted); font-weight: 700; }

/* Respeta el atributo hidden (algunas clases con display lo pisaban) */
[hidden] { display: none !important; }

/* ---------- Titulares en grid sobre el campo (no táctico) ---------- */
.pitch.grid { display: flex; flex-direction: column; aspect-ratio: auto; height: auto; padding: 10px 6px; }
.pitch.grid .lines { opacity: .5; }
.pzone { position: relative; z-index: 1; padding: 10px 0; }
.pzone + .pzone { border-top: 1px dashed rgba(255,255,255,.35); }
.pgk { display: flex; justify-content: center; padding: 4px 0 10px; }
.pzone:last-child .pgk { order: 2; padding: 10px 0 4px; }
.pzone:last-child { display: flex; flex-direction: column; }
.pgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px 4px; }
@media (max-width: 420px) { .pgrid { grid-template-columns: repeat(4, 1fr); } }
.pchip { display: flex; flex-direction: column; align-items: center; gap: 4px; text-decoration: none; }
.pchip .shirt {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; font-weight: 800; color: #fff;
  border: 2px solid rgba(255,255,255,.9); box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.pchip .shirt.gk { background: #f5a623; color: #1a1a1a; }
.pchip .pn {
  font-size: 10.5px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.9);
  max-width: 72px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center;
}

/* ---------- Plantilla en cards ---------- */
.jgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 4px; }
@media (min-width: 560px) { .jgrid { grid-template-columns: repeat(3, 1fr); } }
.jcard {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--sh-sm); padding: 14px 12px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.jcard:active { background: var(--card-2); }
.jcard-badge {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font-size: 20px; background: var(--card-2); border: 1px solid var(--line);
}
.jcard-badge.gk { background: rgba(245,166,35,.18); border-color: transparent; }
.jcard-name { font-size: 13px; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
.jcard-sub { font-size: 11px; color: var(--faint); }

/* ---------- Clasificación con scroll horizontal (más columnas) ---------- */
.tscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.clasif.full { table-layout: auto; min-width: 520px; }
table.clasif.full th, table.clasif.full td { padding: 10px 7px; white-space: nowrap; }
table.clasif.full .c-eq { min-width: 150px; }
table.clasif.full td.eq .name { max-width: 150px; }

/* Tablas de ranking de jugadores (goles, minutos, porteros, stats) */
table.clasif.rank { min-width: 0; width: 100%; }          /* sin scroll salvo que de verdad no quepa */
table.clasif.rank .c-eq { width: 100%; }                  /* el nombre ocupa el hueco: sin huecos */
table.clasif.rank td.eq { padding-right: 10px; }
table.clasif.rank td.eq .eqcell { align-items: center; gap: 8px; }
table.clasif.rank td.eq .eqcell .escudo { width: 22px; height: 22px; flex-basis: 22px; }
table.clasif.rank .jn { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
table.clasif.rank .jn .name {                             /* salto de línea en vez de cortar con … */
  max-width: none; white-space: normal; overflow-wrap: anywhere; word-break: break-word;
}
table.clasif.rank .jn .sub { font-size: 11px; white-space: normal; }
table.clasif.rank th:not(.c-eq):not(.c-pos), table.clasif.rank td:not(.eq):not(:first-child) { white-space: nowrap; }
table.clasif.rank td b { font-weight: 800; }

/* ---------- EN JUEGO (partido en directo) ---------- */
.mres .live {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .03em; color: var(--rojo);
  text-transform: uppercase;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--rojo); animation: pulse 1.3s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }
.mrow.islive { background: color-mix(in srgb, var(--rojo) 6%, transparent); }

/* ---------- Clasificación: líder ---------- */
.pos.gold { background: #f5c518; color: #4a3b00; }
:root[data-theme="dark"] .pos.gold, :root:not([data-theme="light"]) .pos.gold { color: #3a2e00; }
table.clasif tbody tr.lead td:first-child { box-shadow: inset 3px 0 0 #f5c518; }

/* ---------- Barra de refresco / frescura ---------- */
.refbar { display: flex; align-items: center; gap: 10px; margin: 0 2px 12px; }
.refstamp { font-size: 12px; color: var(--muted); flex: 1; }
.refbtn {
  border: 1px solid var(--line-strong); background: var(--card); color: var(--text);
  font-size: 12.5px; font-weight: 650; padding: 7px 12px; border-radius: 999px; cursor: pointer;
}
.refbtn:active { background: var(--card-2); }
.refbtn.spin { color: var(--muted); }
.refbtn[disabled] { opacity: .7; cursor: default; }

/* ---------- Acciones del acta / compartir ---------- */
.hero-actions { display: flex; justify-content: center; padding: 0 0 12px; }
.chip.share { cursor: pointer; border: 1px solid var(--line-strong); background: var(--card); }

/* ---------- Cara a cara ---------- */
.h2h-rec { padding: 12px 14px; font-size: 14px; font-weight: 700; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.h2h-rec .w { color: var(--win); }
.h2h-rec .l { color: var(--loss); }
.h2h-rec .sub { font-weight: 500; }
.h2h-empty { padding: 14px; font-size: 13px; color: var(--muted); text-align: center; }

/* ---------- Tarjeta de notificaciones ---------- */
.pushcard { margin-bottom: 14px; }
.btnpush {
  border: 1px solid var(--rojo); background: var(--rojo); color: #fff;
  font-size: 13px; font-weight: 700; padding: 8px 14px; border-radius: 999px; cursor: pointer; flex: 0 0 auto;
}
.btnpush.on { background: var(--card); color: var(--rojo); }
.btnpush[disabled] { opacity: .55; cursor: default; }

/* ---------- Login / Registro / Cuenta ---------- */
.auth-card { max-width: 420px; margin: 18px auto; padding: 22px 18px 18px; text-align: center; }
.auth-logo {
  width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 16px;
  background: url("/icons/icon-192.png") center / cover no-repeat; box-shadow: var(--sh-sm);
}
.auth-title { margin: 0 0 16px; font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.auth-card form { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.auth-card .search { margin: 0; }
.auth-card .btn { margin-top: 4px; }
.auth-err {
  background: var(--rojo-tint); color: var(--rojo); border-radius: 10px;
  padding: 9px 12px; font-size: 13px; font-weight: 600; text-align: center;
}
.auth-alt { margin-top: 14px; font-size: 13.5px; color: var(--muted); }
.auth-alt a { color: var(--rojo); font-weight: 700; text-decoration: none; }

/* Avisos (banda) para verificación / recuperación */
.banner {
  border-radius: 12px; padding: 11px 14px; font-size: 13.5px; font-weight: 600;
  margin-bottom: 12px; line-height: 1.4; border: 1px solid transparent;
}
.banner a { font-weight: 800; text-decoration: none; color: inherit; text-decoration: underline; }
.banner.ok {
  background: rgba(22, 163, 74, .12); color: #16a34a; border-color: rgba(22, 163, 74, .25);
}
.banner.warn {
  background: rgba(217, 119, 6, .12); color: #d97706; border-color: rgba(217, 119, 6, .25);
}
.banner.ok a { color: inherit; }

/* App privada: sin sesión se oculta la barra inferior */
body.noauth .tabbar { display: none; }

/* Previa de partido (campo, Maps, tiempo, calendario) */
.previa .prow { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); }
.previa .prow:first-child { border-top: none; }
.previa .prow .k { width: 22px; text-align: center; flex: none; }
.previa .prow .v { flex: 1; font-weight: 600; }
.previa .prow .v a { color: var(--rojo); font-weight: 700; text-decoration: none; }
.previa .chip { margin: 0; }
/* "Cómo llegan": tarjeta comparativa de dos columnas */
.ctx2 { display: flex; align-items: flex-start; gap: 8px; padding: 18px 10px; }
.ctx-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.ctx-col .escudo.lg { width: 52px; height: 52px; margin-bottom: 4px; }
.ctx-team { font-weight: 700; font-size: 13.5px; line-height: 1.25; overflow-wrap: anywhere; }
.ctx-posn { font-weight: 800; font-size: 26px; color: var(--rojo); margin-top: 4px; }
.ctx-sub { font-size: 12.5px; color: var(--muted); }
.ctx-gol { font-size: 12px; color: var(--text); margin-top: 4px; opacity: .85; }
.ctx-gc { font-size: 12.5px; font-weight: 700; margin-top: 2px; }
.ctx-forma { display: flex; gap: 4px; justify-content: center; margin-top: 6px; }
.ctx-forma .fdot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.ctx-vs { align-self: center; font-weight: 800; color: var(--faint); font-size: 14px; padding: 0 4px; flex: none; }

/* Panel de administración */
.admin-row { padding: 9px 0; border-top: 1px solid var(--line); }
.admin-row:first-child { border-top: none; }
.admin-row .del { width: auto; padding: 6px 12px; font-size: 13px; margin: 0; }
