/*
 * RFETA Live — design system.
 * Clean sport-data look inspired by World Archery: white canvas, a confident
 * federation blue, official-format scorecards, minimalist arrow values (no
 * coloured chips). One warm signal — a pulsing mark — is reserved for LIVE.
 */

@import url("https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap");

:root {
  --azul: #0b3d91;          /* federación blue — structure, totals */
  --azul-vivo: #1466d6;     /* brighter accent for links/hover */
  --azul-050: #eef3fb;
  --azul-100: #dbe6f7;

  --tinta: #0c1220;         /* ink */
  --tinta-70: #414b5c;
  --tinta-45: #737d8c;
  --tinta-25: #aab2be;

  --papel: #ffffff;
  --lienzo: #f4f6f9;        /* app background */
  --linea: #e7eaef;
  --linea-fuerte: #d6dbe3;

  --vivo: #e5352b;          /* LIVE only */
  --gana: #1f9d55;          /* winner / positive */
  --gana-050: #e7f6ee;

  --oro: #c69a2e;
  --plata: #9aa3ad;
  --bronce: #b06b3f;

  --sombra: 0 1px 2px rgba(12, 18, 32, 0.06), 0 4px 16px rgba(12, 18, 32, 0.06);
  --sombra-alta: 0 4px 12px rgba(12, 18, 32, 0.08), 0 18px 44px rgba(12, 18, 32, 0.12);
  --radio: 14px;
  --radio-s: 9px;

  --display: "Barlow Condensed", system-ui, sans-serif;
  --cuerpo: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--cuerpo);
  color: var(--tinta);
  background: var(--lienzo);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--azul-vivo); }

h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: 0.2px; }

/* ---------- App shell ---------- */

.barra {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--linea);
}
.barra-in {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.marca { display: flex; align-items: center; gap: 11px; font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: 0.4px; color: var(--tinta); }
.marca img { width: 30px; height: 30px; object-fit: contain; }
.marca span { color: var(--azul); }
.barra-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.barra-nav a {
  padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--tinta-70);
}
.barra-nav a:hover { background: var(--azul-050); color: var(--azul); }
.barra-nav a.fav { display: inline-flex; align-items: center; gap: 6px; }

.envoltura { max-width: 1240px; margin: 0 auto; padding: 24px 20px 72px; }

.pie { max-width: 1240px; margin: 0 auto; padding: 28px 20px 40px; color: var(--tinta-45); font-size: 13px; text-align: center; border-top: 1px solid var(--linea); }

/* ---------- Live badge ---------- */

.vivo-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: 1px;
  color: var(--vivo); text-transform: uppercase;
}
.vivo-punto { width: 9px; height: 9px; border-radius: 50%; background: var(--vivo); position: relative; }
.vivo-punto::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--vivo); opacity: 0.5; animation: pulso 1.8s ease-out infinite; }
@keyframes pulso { 0% { transform: scale(0.6); opacity: 0.7; } 100% { transform: scale(1.5); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .vivo-punto::after { animation: none; } }

/* ---------- Hero ---------- */

.hero {
  position: relative; border-radius: var(--radio); overflow: hidden;
  background: linear-gradient(120deg, #0b3d91 0%, #123a7a 60%, #0a2a5e 100%);
  color: #fff; box-shadow: var(--sombra);
}
.hero-foto { position: absolute; inset: 0; object-fit: cover; width: 100%; height: 100%; opacity: 0.30; }
.hero-in { position: relative; padding: 18px 22px; display: flex; align-items: center; gap: 18px; }
.hero-in .txt { min-width: 0; flex: 1; }
.hero h1 {
  font-size: clamp(21px, 3.2vw, 32px); font-weight: 700; line-height: 1.08; text-transform: uppercase;
  /* Wrap to as many lines as needed across the full width — never truncated */
  overflow-wrap: anywhere;
}
.hero-meta { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13.5px; color: rgba(255,255,255,0.86); }
.hero-meta b { color: #fff; font-weight: 600; }
.hero .eyebrow { color: rgba(255,255,255,0.82); margin-bottom: 2px; }
.hero .vivo-chip { color: #fff; margin-bottom: 2px; }
.hero .vivo-punto, .hero .vivo-punto::after { background: #fff; border-color: #fff; }

/* Category picker — full-width rows */
.picker { display: flex; flex-direction: column; gap: 10px; }
.picker-row {
  display: flex; align-items: center; gap: 14px; background: var(--papel); border: 1px solid var(--linea);
  border-radius: var(--radio); padding: 14px 18px; box-shadow: var(--sombra); position: relative; overflow: hidden;
  transition: transform 0.12s, box-shadow 0.12s;
}
.picker-row::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--cat-color, var(--azul)); }
.picker-row:hover { transform: translateX(2px); box-shadow: var(--sombra-alta); color: inherit; }
.picker-row .ico-arco { flex-shrink: 0; }
.picker-row .info { flex: 1; min-width: 0; }
.picker-row .info h3 { font-size: 20px; font-weight: 600; text-transform: uppercase; line-height: 1.05; }
.picker-row .info .sub { font-size: 13px; color: var(--tinta-45); margin-top: 2px; }
.picker-row .flecha-ir { color: var(--tinta-25); font-family: var(--display); font-weight: 700; }
.picker-row:hover .flecha-ir { color: var(--azul); }

/* Club emblem / flag next to names */
.emblema { width: 24px; height: 24px; border-radius: 5px; object-fit: cover; background: #fff; flex-shrink: 0; box-shadow: 0 0 0 1px var(--linea); }
.emblema-ph { display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 11px; color: var(--tinta-45); }
/* Shoot-off arrow next to a match score */
.so { font-size: 10px; font-weight: 700; color: var(--azul); margin-left: 2px; vertical-align: super; }
.marc-so { font-size: 12px; color: var(--azul); font-weight: 600; margin-top: 4px; }
.marc-meta { display: flex; gap: 10px; justify-content: center; margin-top: 5px; font-size: 12px; color: var(--tinta-45); font-family: var(--display); font-weight: 600; letter-spacing: 0.3px; }
.marc-meta .prog { color: var(--azul); }

/* ---------- Section heads ---------- */

.seccion { display: flex; align-items: baseline; gap: 12px; margin: 30px 0 14px; }
.seccion h2 { font-size: 26px; font-weight: 700; text-transform: uppercase; }
.seccion .cuenta { color: var(--tinta-45); font-weight: 600; font-size: 14px; }
.eyebrow { font-family: var(--display); text-transform: uppercase; letter-spacing: 1.5px; font-weight: 600; font-size: 13px; color: var(--azul); }

/* ---------- Competition cards (full width) ---------- */

.comp-lista { display: flex; flex-direction: column; gap: 12px; }
.comp {
  display: block; background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio);
  padding: 18px 20px; box-shadow: var(--sombra); transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s;
}
.comp:hover { transform: translateY(-2px); box-shadow: var(--sombra-alta); border-color: var(--linea-fuerte); color: inherit; }
.comp-top { display: flex; align-items: center; gap: 12px; }
.comp h3 { font-size: 22px; font-weight: 600; line-height: 1.1; flex: 1; }
.comp-fecha { font-family: var(--display); font-weight: 600; color: var(--azul); font-size: 15px; white-space: nowrap; }
.comp-meta { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 3px 12px; font-size: 13.5px; color: var(--tinta-45); }
.comp-meta .disc { color: var(--tinta-70); font-weight: 600; }
.comp-tags { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px 8px; }
.etiqueta {
  font-size: 12.5px; font-weight: 600; color: var(--tinta-70); background: var(--lienzo);
  border: 1px solid var(--linea); padding: 3px 10px; border-radius: 999px;
}
.etiqueta.azul { color: var(--azul); background: var(--azul-050); border-color: var(--azul-100); }

/* ---------- Category cards grid ---------- */

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.cat {
  display: flex; flex-direction: column; gap: 12px; background: var(--papel);
  border: 1px solid var(--linea); border-radius: var(--radio); padding: 16px; box-shadow: var(--sombra);
  transition: transform 0.12s ease, box-shadow 0.12s ease; position: relative; overflow: hidden;
}
.cat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--cat-color, var(--azul)); }
.cat:hover { transform: translateY(-2px); box-shadow: var(--sombra-alta); color: inherit; }
.cat-icos { display: flex; align-items: center; gap: 7px; }
.ico-arco { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--cat-color, var(--azul)); color: #fff; }
.ico-arco svg { width: 20px; height: 20px; }
.ico-arco .letra { font-family: var(--display); font-weight: 700; color: #fff; font-size: 18px; letter-spacing: 0.5px; }
.subcat .ico-arco .letra { font-size: 20px; }
.ico-genero { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--lienzo); border: 1px solid var(--linea); color: var(--tinta-70); }
.ico-genero svg { width: 16px; height: 16px; }
.cat h3 { font-size: 19px; font-weight: 600; line-height: 1.08; text-transform: uppercase; }
.cat-pie { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.cat-cuenta { font-size: 13px; color: var(--tinta-45); font-weight: 500; }

/* ---------- Tabs ---------- */

/* Underline tabs with a full-width baseline */
.pestanas { display: flex; gap: 2px; overflow-x: auto; margin: 18px 0 8px; border-bottom: 1px solid var(--linea); scrollbar-width: none; }
.pestanas::-webkit-scrollbar { display: none; }
.pestanas a {
  font-family: var(--display); font-weight: 600; font-size: 16px; letter-spacing: 0.4px; text-transform: uppercase;
  padding: 11px 16px; color: var(--tinta-45); white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.pestanas a:hover { color: var(--azul); }
.pestanas a.on { color: var(--azul); border-bottom-color: var(--azul); }

/* Selected-category sub-header */
.subcat { display: flex; align-items: center; gap: 12px; }
.subcat .ico-arco svg { width: 22px; height: 22px; }
.subcat-tit { font-size: 22px; text-transform: uppercase; line-height: 1.05; }
.subcat-meta { font-size: 13px; color: var(--tinta-45); display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.subcat-sel { max-width: 260px; font-size: 14px; }

/* Event selector chips */
.eventos { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; }
.eventos::-webkit-scrollbar { display: none; }
.evento-chip {
  font-weight: 600; font-size: 13.5px; padding: 7px 13px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--linea); background: var(--papel); color: var(--tinta-70);
}
.evento-chip:hover { border-color: var(--azul-100); color: var(--azul); }
.evento-chip.on { background: var(--tinta); color: #fff; border-color: var(--tinta); }

/* ---------- Card container ---------- */

.tarjeta { background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio); box-shadow: var(--sombra); overflow: hidden; }
.tarjeta + .tarjeta { margin-top: 14px; }
.tarjeta-cab { padding: 14px 18px; border-bottom: 1px solid var(--linea); display: flex; align-items: center; gap: 10px; }
.tarjeta-cab h2 { font-size: 20px; text-transform: uppercase; }

/* ---------- Ranking table ---------- */

.rank { width: 100%; }
.fila {
  display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 10px;
  padding: 11px 14px 11px 11px; border-bottom: 1px solid var(--linea);
}
.fila:last-child { border-bottom: none; }
.fila.click { cursor: pointer; }
.fila.click:hover { background: var(--azul-050); }
.puesto { font-family: var(--display); font-weight: 700; font-size: 19px; color: var(--tinta-45); text-align: left; padding-left: 2px; }
.puesto.m1 { color: var(--oro); } .puesto.m2 { color: var(--plata); } .puesto.m3 { color: var(--bronce); }

.quien { display: flex; align-items: center; gap: 10px; min-width: 0; }
.foto { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: var(--lienzo); border: 1px solid var(--linea); flex-shrink: 0; }
.foto-ph { display: grid; place-items: center; color: var(--tinta-45); font-family: var(--display); font-weight: 700; font-size: 15px; border-color: var(--linea-fuerte); }

/* Athlete avatar with an overlapping circular club logo (bottom-right) */
.avatar { position: relative; flex-shrink: 0; line-height: 0; }
/* Photo overlays the initials placeholder; removed on error → initials show.
 * No z-index: DOM order already paints placeholder < photo < flag. */
.avatar .foto-ov { position: absolute; inset: 0; }
.avatar-flag { position: absolute; right: -3px; bottom: -3px; width: 18px; height: 18px; border-radius: 50%; object-fit: cover; background: var(--papel); box-shadow: 0 0 0 2px var(--papel); }
.perfil .avatar-flag { width: 30px; height: 30px; right: -2px; bottom: -2px; box-shadow: 0 0 0 3px var(--papel); }
.nombre { min-width: 0; }
.nombre .n { font-size: 15.5px; line-height: 1.15; }
.nombre .n b { font-weight: 700; }
.nombre .sub { font-size: 12.5px; color: var(--tinta-45); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bandera { width: 20px; height: 14px; border-radius: 2px; object-fit: cover; flex-shrink: 0; box-shadow: 0 0 0 1px var(--linea); }

.cifras { display: flex; align-items: center; gap: 14px; }
.mini { text-align: center; min-width: 26px; }
.mini b { display: block; font-weight: 600; font-size: 14px; }
.mini span { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--tinta-45); }
.total-pill {
  font-family: var(--display); font-weight: 700; font-size: 19px; color: #fff; background: var(--azul);
  border-radius: 7px; padding: 4px 12px; min-width: 58px; text-align: center;
}
/* Individual result modifier (DNS / DNF / DSQ …) in place of the score */
.total-pill.irm { background: var(--tinta-45); font-size: 13px; letter-spacing: 0.6px; }
.abre { color: var(--tinta-25); display: grid; place-items: center; width: 30px; font-size: 24px; line-height: 1; transition: transform 0.15s; }
.fila.abierta .abre { transform: rotate(90deg); color: var(--azul); }

.cabecera-cifras { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; padding: 8px 14px 8px 11px; border-bottom: 2px solid var(--linea-fuerte); }
.cabecera-cifras .ct { display: flex; gap: 14px; }
.cabecera-cifras .ct span { min-width: 26px; text-align: center; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--tinta-45); font-weight: 600; }
.cabecera-cifras .ct .w { min-width: 58px; }

/* ---------- Official scorecard ---------- */

.detalle { padding: 0 16px 16px; background: var(--azul-050); border-bottom: 1px solid var(--linea); }
.tablillas { display: grid; grid-template-columns: 1fr; gap: 18px; padding-top: 14px; }
@media (min-width: 760px) { .tablillas.doble { grid-template-columns: 1fr 1fr; } }

.tablilla { background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio-s); overflow: hidden; }
.tablilla-cab { display: flex; align-items: baseline; justify-content: space-between; padding: 9px 12px; background: var(--tinta); color: #fff; }
.tablilla-cab .d { font-family: var(--display); font-weight: 600; font-size: 15px; letter-spacing: 0.4px; text-transform: uppercase; }
.tablilla-cab .p { font-family: var(--display); font-weight: 700; font-size: 16px; }
.sc { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.sc th { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--tinta-45); font-weight: 600; padding: 7px 6px; border-bottom: 1px solid var(--linea); text-align: center; }
.sc th.flechas, .sc td.flechas { text-align: left; padding-left: 12px; }
.sc td { padding: 6px 4px; text-align: center; border-bottom: 1px solid var(--linea); font-variant-numeric: tabular-nums; }
.sc td.flechas { color: var(--tinta-70); white-space: nowrap; }
.sc td.flechas .a { display: inline-block; width: 23px; text-align: center; }
.sc td.flechas .a.g { color: var(--tinta); font-weight: 700; } /* X / 10 emphasised */
.sc th.n, .sc td.n { width: 34px; }
.sc td.suma { font-weight: 600; }
.sc td.corr { font-weight: 700; color: var(--azul); } /* running total */
.sc tr:last-child td { border-bottom: none; }
.sc tfoot td { background: var(--lienzo); font-weight: 700; border-top: 1px solid var(--linea-fuerte); }

.chip-num { font-family: var(--display); font-weight: 700; font-size: 14px; padding: 2px 9px; border-radius: 6px; display: inline-block; }
.chip-num.total { background: var(--azul); color: #fff; font-size: 15px; min-width: 46px; text-align: center; }

.ir-ficha { padding: 12px 2px 2px; margin: 0; }
.ir-ficha a { color: var(--azul); font-weight: 600; font-size: 14px; }
.arrastrado { text-align: right; padding: 10px 4px 2px; font-size: 13px; color: var(--tinta-45); }
.arrastrado b { font-family: var(--display); font-size: 20px; color: var(--azul); }

/* ---------- Team row ---------- */
.equipo-comp { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 4px 16px 14px; background: var(--azul-050); border-bottom: 1px solid var(--linea); }
.equipo-comp .m { display: flex; align-items: center; gap: 7px; font-size: 13.5px; }
.equipo-comp .m b { font-weight: 600; }
.equipo-comp .m .s { color: var(--azul); font-weight: 700; }

/* ---------- Brackets ---------- */

.bracket-wrap { overflow-x: auto; padding: 6px 2px 12px; cursor: grab; }
.bracket-wrap.arrastrando { cursor: grabbing; user-select: none; }
.bracket { display: flex; gap: 40px; min-width: min-content; }
.ronda { display: flex; flex-direction: column; min-width: 244px; }
.ronda-tit { font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: 14px; letter-spacing: 0.6px; color: var(--tinta-45); text-align: center; padding-bottom: 10px; }
.ronda-partidos { display: flex; flex-direction: column; justify-content: space-around; flex: 1; gap: 8px; }
.par { display: flex; flex-direction: column; justify-content: space-around; flex: 1; position: relative; gap: 14px; }
.match {
  background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio-s);
  box-shadow: var(--sombra); display: block; position: relative;
}
.match:hover { border-color: var(--azul-100); color: inherit; box-shadow: var(--sombra-alta); }
.match .lado:first-child { border-top-left-radius: var(--radio-s); border-top-right-radius: var(--radio-s); }
.match .lado:last-child { border-bottom-left-radius: var(--radio-s); border-bottom-right-radius: var(--radio-s); }
/* Connector lines: horizontal stubs + vertical join per pair */
.bracket .ronda:not(:last-child) .match::after { content: ""; position: absolute; left: 100%; top: 50%; width: 20px; height: 2px; background: var(--linea-fuerte); }
.bracket .ronda:not(:first-child) .match::before { content: ""; position: absolute; right: 100%; top: 50%; width: 20px; height: 2px; background: var(--linea-fuerte); }
.bracket .ronda:not(:last-child) .par::after { content: ""; position: absolute; left: calc(100% + 20px); top: 25%; bottom: 25%; width: 2px; background: var(--linea-fuerte); }
.bracket .ronda:not(:last-child) .par::before { content: ""; position: absolute; left: calc(100% + 20px); top: 50%; width: 20px; height: 2px; background: var(--linea-fuerte); }
.ronda-finales .match::before, .ronda-finales .match::after, .ronda-finales .par::before, .ronda-finales .par::after { display: none; }
/* Gold final sits where the bracket converges (centred); bronze just below it */
.ronda-finales .ronda-partidos { justify-content: center; gap: 22px; }
.final-bloque + .final-bloque { margin-top: 4px; }
.final-lbl { font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: 12.5px; letter-spacing: 0.5px; color: var(--azul); padding: 0 2px 5px; }
.match .lado { display: flex; align-items: center; gap: 8px; padding: 9px 11px; }
.match .lado .emblema { height: 20px; width: auto; min-width: 20px; max-width: 30px; object-fit: contain; }
.match .lado + .lado { border-top: 1px solid var(--linea); }
.match .lado .seed { font-size: 11px; color: var(--tinta-45); font-weight: 600; min-width: 22px; }
.match .lado .nm { flex: 1; font-size: 13.5px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.match .lado .nm b { font-weight: 700; }
.match .lado .nm .comps { display: block; font-size: 10.5px; color: var(--tinta-45); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.match .lado .diana-b { font-size: 11px; color: var(--tinta-25); font-weight: 600; flex-shrink: 0; font-family: var(--display); }
.match .lado .pts { font-family: var(--display); font-weight: 700; font-size: 15px; min-width: 26px; text-align: center; border-radius: 5px; padding: 1px 6px; background: var(--lienzo); color: var(--tinta-45); }
.match .lado .so-out { font-family: var(--display); font-weight: 700; font-size: 12px; color: var(--azul); margin-right: 6px; min-width: 12px; text-align: right; flex-shrink: 0; }
.match .lado.gana .pts { background: var(--azul); color: #fff; }
.match .lado.gana .nm { color: var(--tinta); }
.match .lado.vacio { color: var(--tinta-25); font-size: 12.5px; font-style: italic; }
.match .lado.vacio .nm { font-weight: 400; }
.match-bye { border-style: dashed; box-shadow: none; }
.match .match-pie { display: flex; justify-content: space-between; gap: 8px; padding: 5px 11px; font-size: 11px; color: var(--tinta-45); border-top: 1px solid var(--linea); font-family: var(--display); font-weight: 600; letter-spacing: 0.3px; }
.match .match-pie span:last-child { color: var(--azul); }

/* ---------- Match detail ---------- */
.marcador-cab {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px;
  background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio); box-shadow: var(--sombra); padding: 18px 16px;
}
.marc-lado { display: flex; align-items: center; gap: 10px; min-width: 0; }
.marc-lado.der { flex-direction: row-reverse; text-align: right; }
.marc-info { min-width: 0; }
.marc-info .nm { font-family: var(--display); font-size: clamp(17px, 2.4vw, 24px); font-weight: 700; text-transform: uppercase; line-height: 1.05; display: block; }
a.nm:hover { color: var(--azul); }
.marc-sub { font-size: 12.5px; color: var(--tinta-45); margin-top: 2px; }
.marc-sub a { color: var(--azul); font-weight: 600; }
.marc-comp { font-size: 12px; color: var(--tinta-45); margin-top: 3px; }
.marc-lado.gana .nm { color: var(--azul); }
.marc-lado .emblema { width: 30px; height: 30px; }
.marc-centro { text-align: center; padding: 0 6px; }
.marc-fase { font-family: var(--display); font-weight: 600; text-transform: uppercase; font-size: 12px; letter-spacing: 0.6px; color: var(--tinta-45); }
.marc-num { font-family: var(--display); font-weight: 700; font-size: clamp(30px, 6vw, 46px); line-height: 1; display: flex; align-items: center; gap: 8px; color: var(--tinta-25); }
.marc-num span { color: var(--tinta); min-width: 40px; }
.marc-num span.g { color: var(--azul); }
.marc-num i { color: var(--tinta-25); font-style: normal; font-size: 0.6em; }
.marc-num .tb { font-size: 0.42em; color: var(--tinta-45); font-weight: 600; vertical-align: 0.5em; margin: 0 8px; }
.marc-modo { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--tinta-45); margin-top: 4px; }

.duelo-tabla { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 460px; }
.duelo-tabla th { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--tinta-45); padding: 9px 10px; border-bottom: 2px solid var(--linea-fuerte); }
.duelo-tabla td { padding: 8px 10px; text-align: center; border-bottom: 1px solid var(--linea); }
.duelo-tabla tr:last-child td { border-bottom: none; }
.duelo-tabla .fl { letter-spacing: 1px; color: var(--tinta-70); width: 30%; white-space: nowrap; }
.duelo-tabla .fl .a { display: inline-block; width: 23px; text-align: center; }
.duelo-tabla th.fl:first-child, .duelo-tabla td.fl:first-child { text-align: right; }
.duelo-tabla th.fl:last-child, .duelo-tabla td.fl:last-child { text-align: left; }
.duelo-tabla .fl .a.g { color: var(--tinta); font-weight: 700; }
.duelo-tabla .pa { font-weight: 600; width: 11%; }
.duelo-tabla .setc { width: 18%; }
.setpar { display: inline-flex; align-items: center; gap: 8px; font-family: var(--display); }
.setpar b { font-weight: 700; font-size: 16px; color: var(--tinta-45); min-width: 16px; }
.setpar b.g { color: var(--azul); }
.setpar i { font-style: normal; font-size: 12px; color: var(--tinta-25); font-family: var(--cuerpo); }

.nav-duelo { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.nav-match { display: block; background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio-s); padding: 10px 14px; box-shadow: var(--sombra); margin-bottom: 8px; }
.nav-match:hover { border-color: var(--azul-100); color: inherit; }
.nav-match .lb { display: block; font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: 11px; letter-spacing: 0.6px; color: var(--azul); }
.nav-match .rv { font-size: 13px; color: var(--tinta-70); }
@media (max-width: 620px) { .nav-duelo { grid-template-columns: 1fr; } .marc-lado .emblema { display: none; } }

/* ---------- Logos strip (clubs / federations) ---------- */
.logos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.logo-card { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 10px; background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio-s); text-align: center; box-shadow: var(--sombra); }
.logo-card:hover { color: inherit; box-shadow: var(--sombra-alta); }
.logo-card img { width: 48px; height: 48px; object-fit: contain; }
.logo-card .ph { width: 48px; height: 48px; border-radius: 10px; background: var(--azul-050); color: var(--azul); display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 18px; }
.logo-card .lb { font-size: 12.5px; font-weight: 600; line-height: 1.2; }
.logo-card .n { font-size: 11px; color: var(--tinta-45); }

/* Quick-access buttons on the overview */
.accesos { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin: 18px 0 4px; }
.accesos.dos { grid-template-columns: 1fr 1fr; }

/* Overview two-column: schedule (main) beside the info sheet on desktop; on
 * mobile the schedule comes first, the info sheet below. */
.resumen-cols { display: grid; grid-template-columns: 1fr; gap: 0 24px; }
@media (min-width: 900px) {
  .resumen-cols { grid-template-columns: 320px minmax(0, 1fr); align-items: start; }
  .resumen-cols .col-info { grid-column: 1; grid-row: 1; }
  .resumen-cols .col-horario { grid-column: 2; grid-row: 1; }
}

/* Competition fact sheet on the overview (organizer, federation, level…) */
.ficha-comp { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2px 22px; margin: 0; padding: 16px 18px; background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio-s); box-shadow: var(--sombra); }
.col-info .ficha-comp { grid-template-columns: 1fr; }
.ficha-comp > div { padding: 6px 0; }
.ficha-comp dt { font-family: var(--display); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; font-size: 11.5px; color: var(--tinta-45); }
.ficha-comp dd { margin: 1px 0 0; font-size: 15px; font-weight: 500; color: var(--tinta); }

/* Floating "refresh now" button — only added on live pages. Anchored to the
 * right edge of the centred content column so it doesn't float off alone in the
 * margin on wide screens. */
.btn-refresh {
  position: fixed; right: max(18px, calc((100vw - 1240px) / 2 + 18px)); bottom: 18px; z-index: 60;
  width: 50px; height: 50px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--azul); color: #fff; box-shadow: var(--sombra-alta);
  display: grid; place-items: center; font-size: 23px; line-height: 1;
  transition: transform 0.12s, background 0.12s;
}
.btn-refresh:hover { background: var(--azul-vivo); transform: translateY(-2px); color: #fff; }
.btn-refresh .ico { display: block; }
.btn-refresh.cargando { pointer-events: none; }
.btn-refresh.cargando .ico { animation: girar 0.8s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn-refresh.cargando .ico { animation: none; } }
@media (max-width: 620px) { .btn-refresh { width: 46px; height: 46px; right: 14px; bottom: 14px; } }
.acceso {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 18px;
  background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio); box-shadow: var(--sombra);
  font-family: var(--display); font-weight: 600; font-size: 18px; text-transform: uppercase; letter-spacing: 0.3px;
  transition: transform 0.12s, box-shadow 0.12s;
}
.acceso span { color: var(--azul); }
.acceso:hover { transform: translateY(-2px); box-shadow: var(--sombra-alta); color: var(--azul); }

.mas-horario { margin-top: 4px; }
.mas-horario > summary { cursor: pointer; font-family: var(--display); font-weight: 600; text-transform: uppercase; font-size: 15px; color: var(--azul); padding: 12px 4px; list-style: none; }
.mas-horario > summary::-webkit-details-marker { display: none; }
.mas-horario > summary::before { content: "+ "; }
.mas-horario[open] > summary::before { content: "– "; }

/* ---------- Club eliminations (athlete then their matches) ---------- */
.elim-club { display: flex; flex-direction: column; gap: 12px; }
.elim-arquero { background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio); box-shadow: var(--sombra); overflow: hidden; }
.elim-nom { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--linea); font-size: 16px; }
.elim-nom b { font-weight: 700; }
/* Category as a right-aligned link, same height as the name */
.cat-link { font-size: 13px; color: var(--tinta-45); font-weight: 500; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; text-align: right; }
.cat-link span { color: var(--tinta-25); font-family: var(--display); font-weight: 700; }
.cat-link:hover, .cat-link:hover span { color: var(--azul); }
.elim-partidos { display: flex; flex-direction: column; }
.elim-partido { display: grid; grid-template-columns: minmax(120px, 1fr) 2fr auto; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--linea); }
.elim-partido:last-child { border-bottom: none; }
.elim-partido:hover { background: var(--azul-050); color: inherit; }
.elim-partido .fase { font-family: var(--display); font-weight: 600; text-transform: uppercase; font-size: 13px; color: var(--tinta-45); }
.elim-partido .rival { font-size: 14px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.elim-partido .res { font-family: var(--display); font-weight: 700; font-size: 16px; color: var(--tinta-45); }
.elim-partido .res.gana { color: var(--azul); }

/* ---------- Schedule ---------- */
.dia-tit { font-family: var(--display); font-weight: 600; text-transform: uppercase; font-size: 16px; letter-spacing: 0.4px; color: var(--tinta-70); margin: 20px 0 6px; }
.horario .it { display: flex; align-items: center; gap: 14px; padding: 9px 16px; border-radius: 8px; }
.horario .it.activo { background: var(--azul-050); box-shadow: inset 3px 0 0 var(--azul); }
.horario .it .vivo-punto { flex-shrink: 0; margin-left: -6px; }
.horario .hora { font-family: var(--display); font-weight: 600; color: var(--azul); font-size: 15px; min-width: 96px; }
.horario .ev { flex: 1; }
.horario .ev-col { flex: 1; min-width: 0; }
.horario .ev-col .ev { display: block; }
.horario .ev.l0 { font-weight: 500; }
.horario .ev-subs { display: block; font-size: 13px; color: var(--tinta-45); margin-top: 2px; }
.horario a.it:hover { background: var(--azul-050); color: inherit; }
.horario .it-ir { color: var(--tinta-25); font-family: var(--display); font-weight: 700; }
.horario a.it:hover .it-ir { color: var(--azul); }

/* Programa (schedule slot) */
.prog-partido { display: grid; grid-template-columns: 130px 1fr 64px 1fr; align-items: center; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--linea); }
.prog-partido:last-child { border-bottom: none; }
.prog-partido:hover { background: var(--azul-050); color: inherit; }
.prog-partido .fase { font-family: var(--display); font-weight: 600; text-transform: uppercase; font-size: 12.5px; color: var(--tinta-45); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prog-partido .lado { font-size: 14px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.prog-partido .lado.der { text-align: left; }
.prog-partido .lado.g { font-weight: 700; color: var(--azul); }
.prog-partido .lado.bye { color: var(--tinta-25); font-style: italic; }
.prog-partido .diana { color: var(--tinta-25); font-weight: 500; font-size: 0.9em; }
.prog-partido .res { font-family: var(--display); font-weight: 700; font-size: 15px; color: var(--tinta-45); text-align: center; }
@media (max-width: 620px) { .prog-partido { grid-template-columns: 1fr 54px 1fr; } .prog-partido .fase { display: none; } }
.prog-cat { margin-bottom: 16px; scroll-margin-top: 76px; }
.prog-anchors { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 16px; }
.prog-anchors a { font-family: var(--display); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.3px; color: var(--azul); background: var(--azul-050); border: 1px solid var(--azul-100); border-radius: 999px; padding: 5px 12px; }
.prog-anchors a:hover { background: var(--azul-100); color: var(--azul); }
.prog-cat-cab { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio-s) var(--radio-s) 0 0; font-family: var(--display); font-weight: 600; font-size: 18px; text-transform: uppercase; box-shadow: var(--sombra); }
.prog-cat-cab + .tarjeta { border-radius: 0 0 var(--radio-s) var(--radio-s); border-top: none; }
.prog-mas { display: block; padding: 10px 16px; border-top: 1px solid var(--linea); font-weight: 600; color: var(--azul); font-size: 14px; }

/* ---------- Profile ---------- */
.perfil { display: flex; align-items: center; gap: 18px; margin: 6px 0 4px; }
.perfil .av { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 1px solid var(--linea); background: var(--lienzo); }
.perfil h1 { font-size: 34px; font-weight: 700; text-transform: uppercase; line-height: 1; display: flex; align-items: center; gap: 12px; }
.perfil .meta { color: var(--tinta-45); margin-top: 5px; font-size: 14px; }
.datos { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 18px 0; }
.dato { background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio-s); padding: 14px 16px; box-shadow: var(--sombra); }
.dato b { font-family: var(--display); font-weight: 700; font-size: 26px; display: block; line-height: 1; }
.dato span { font-size: 12px; color: var(--tinta-45); text-transform: uppercase; letter-spacing: 0.4px; }
/* The headline stat (final ranking) — filled, stands out */
.dato.destacado { background: linear-gradient(135deg, var(--azul) 0%, var(--azul-vivo) 100%); border-color: transparent; box-shadow: var(--sombra-alta); }
.dato.destacado b { color: #fff; font-size: 34px; }
.dato.destacado span { color: rgba(255, 255, 255, 0.85); }

/* ---------- Favorite star ---------- */
.estrella { background: none; border: none; cursor: pointer; color: var(--tinta-25); font-size: 18px; line-height: 1; padding: 2px; transition: transform 0.1s, color 0.1s; }
.estrella:hover { transform: scale(1.15); color: var(--oro); }
.estrella.on { color: var(--oro); }

/* ---------- Form controls (Kumo-style: soft rounded, light border) ---------- */
.campo, .buscador input, .buscador select, .subcat-sel, select[data-nav] {
  font-family: var(--cuerpo); font-size: 15px; padding: 10px 14px; height: 42px;
  border: 1px solid var(--linea-fuerte); border-radius: 10px; background: var(--papel); color: var(--tinta);
  outline: none; transition: border-color 0.12s, box-shadow 0.12s; appearance: none; -webkit-appearance: none;
}
select.campo, .buscador select, .subcat-sel, select[data-nav] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23737d8c' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; cursor: pointer;
}
.buscador { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.buscador input { flex: 1; min-width: 200px; }
.campo:focus, .buscador input:focus, .buscador select:focus, .subcat-sel:focus, select[data-nav]:focus {
  border-color: var(--azul-vivo); box-shadow: 0 0 0 3px rgba(20, 102, 214, 0.15);
}
.campo:hover, .buscador input:hover, .buscador select:hover, .subcat-sel:hover { border-color: var(--tinta-25); }

/* ---------- Empty / breadcrumb ---------- */
.migas { font-size: 13.5px; color: var(--tinta-45); margin: 2px 0 14px; }
.migas a { color: var(--azul); font-weight: 600; }
.vacio { text-align: center; padding: 48px 20px; color: var(--tinta-45); }
.vacio .ic { font-family: var(--display); font-size: 15px; letter-spacing: 2px; color: var(--tinta-25); text-transform: uppercase; }
.vacio h3 { font-size: 22px; color: var(--tinta-70); margin: 10px 0 6px; text-transform: uppercase; }

.cuerpo { padding: 4px 0; }

/* utilities */
@media (max-width: 620px) {
  .oculta-movil { display: none; }
  .cifras { gap: 9px; }
  .mini { min-width: 20px; }
  /* Rank rows: reclaim space — the whole row is tappable, so drop the chevron */
  .abre { display: none; }
  /* Stat cards two-up instead of 3 + 1 */
  .datos { grid-template-columns: 1fr 1fr; }
  /* Club classification: no per-row category link or favourite star on mobile */
  .rank-clasif .cat-link, .rank-clasif .estrella { display: none; }
  /* Competition header: bigger name, smaller meta */
  .hero-in { padding: 16px 16px; }
  .hero h1 { font-size: 25px; -webkit-line-clamp: 3; }
  .hero-meta { font-size: 11.5px; gap: 2px 10px; margin-top: 5px; }
  .comp h3 { font-size: 20px; }
  .comp-meta { font-size: 12.5px; }
  /* Category sub-header: dropdown drops below the name */
  .subcat { flex-wrap: wrap; }
  .subcat-sel { flex: 1 0 100%; max-width: none; margin-top: 8px; }
}
