/* My position card — boletería: dashed border, gold rank, mono labels */
.my-position {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background:
    linear-gradient(90deg, rgba(10, 219, 198, 0.06), transparent 80%),
    var(--bg-2);
  border: 1px dashed var(--accent);
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
}
.my-position__rank {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: rgba(10, 219, 198, 0.12);
  border: 1px solid rgba(10, 219, 198, 0.3);
  font-family: var(--font-scoreboard);
  font-size: 30px;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.my-position__info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.my-position__label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.my-position__detail {
  font-size: 14px;
  color: var(--ink);
}
.my-position__gap {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  padding-left: 14px;
  border-left: 1px dashed var(--line-strong);
}
.my-position__gap b { color: var(--accent); font-weight: 600; }

@media (max-width: 559px) {
  .my-position { flex-wrap: wrap; }
  .my-position__gap {
    width: 100%;
    padding: 10px 0 0;
    border-left: 0;
    border-top: 1px dashed var(--line-strong);
    margin-top: 10px;
  }
}

/* Tarjetas de desempeño del usuario — debajo de .my-position, arriba de
   la tabla. Mismas 4 métricas que antes vivían en /pronosticar, ahora
   en la paleta v5 boletería (scoreboard + mono caps) para que armonicen
   con .my-position y la tabla. */
.tournament-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.tournament-stats > .stat {
  padding: 14px 12px;
  text-align: center;
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.tournament-stats > .stat > .value {
  display: block;
  font-family: var(--font-scoreboard);
  font-size: 2rem;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--fg);
  margin-bottom: 6px;
}
.tournament-stats > .stat > .value.-exact  { color: var(--accent); }
.tournament-stats > .stat > .value.-result { color: var(--gold); }

.tournament-stats > .stat > .value > .over {
  font-size: 1rem;
  color: var(--fg-3);
}

.tournament-stats > .stat > .label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

@media (max-width: 559px) {
  /* Compacto: 4 en una fila chica para que la tabla se vea sin scrollear tanto. */
  .tournament-stats { grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 14px; }
  .tournament-stats > .stat { padding: 8px 3px; }
  .tournament-stats > .stat > .value { font-size: 1.3rem; margin-bottom: 2px; }
  .tournament-stats > .stat > .value > .over { font-size: 0.7rem; }
  .tournament-stats > .stat > .label { font-size: 8px; letter-spacing: 0.06em; }
}

.leaderboard-table {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.leaderboard-table > table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table th {
  padding: 10px 14px;
  text-align: left;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.18);
  border-bottom: 1px dashed var(--line-strong);
}

.leaderboard-table td {
  padding: 12px 14px;
  font-size: 14px;
  color: var(--ink-soft);
  border-bottom: 1px dashed var(--line);
}
.leaderboard-table tr:last-child td { border-bottom: 0; }
.leaderboard-table tr:hover td { background: rgba(255, 255, 255, 0.015); }

.leaderboard-table .rank {
  width: 48px;
  text-align: center;
  font-family: var(--font-scoreboard);
  font-size: 22px;
  font-weight: 400;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
}
/* Color de podio por rank absoluto (clase), no por nth-child: con paginación la
   fila 1 de la página 2 no debe salir dorada. Solo la página 1 trae -rank-1..3. */
.leaderboard-table tr.-rank-1 .rank { color: var(--accent); }
.leaderboard-table tr.-rank-2 .rank { color: #c8d6cd; }
.leaderboard-table tr.-rank-3 .rank { color: #b45309; }

/* Número de puesto + flecha de tendencia (subió/bajó respecto al último partido
   puntuado). El número se centra solo en la celda; la flecha va en posición
   absoluta a su derecha, así NO desplaza al número (las filas con y sin flecha
   quedan idénticas) ni se reserva espacio. Tamaño fijo: no se encoge con puestos
   de 2 dígitos. La flecha pone su propio color para no pisar el del podio. */
.leaderboard-table .rank { width: 58px; }
.leaderboard-table .rank > .rank__cell {
  position: relative;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}
/* width/height explícitos: el elemento es position:absolute sin ancho y el reset
   pone svg { max-width: 100% }; sin medida fija el ancho colapsa a 0 y la flecha
   desaparece. */
.leaderboard-table .rank-trend {
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 3px;
  width: 13px;
  height: 13px;
}
.leaderboard-table .rank-trend > .icon { display: block; width: 13px; height: 13px; }
.leaderboard-table .rank-trend.-up { color: var(--exacto); }
.leaderboard-table .rank-trend.-down { color: var(--red); }

.leaderboard-table .user { font-weight: 500; color: var(--ink); }
.leaderboard-table .user > .user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.leaderboard-table .user > .user-cell > .cl-logo {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  object-fit: contain;
}
.leaderboard-table .user > .user-cell > .meta {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.leaderboard-table .user > .user-cell > .meta > small {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
}
/* El nombre/usuario trunca con ellipsis en vez de desbordar: un @username largo
   (salas, donde no hay display_name) empujaba la tabla y overflow:hidden cortaba
   la columna de PTS en mobile angosto. */
.leaderboard-table .user > .user-cell > .meta > strong,
.leaderboard-table .user > .user-cell > .meta > a {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-table .points {
  width: 80px;
  text-align: right;
  font-family: var(--font-scoreboard);
  font-size: 22px;
  font-weight: 400;
  color: var(--accent);
  letter-spacing: 0.04em;
}

/* Current user row — un único gradiente continuo sobre toda la fila. Va en el
   <tr> (no en cada <td>, que reiniciaba el gradiente por columna y se veía
   segmentado); con border-collapse el fondo del tr se pinta detrás de las
   celdas transparentes como una sola banda. */
.leaderboard-table tr.-current {
  background: linear-gradient(90deg, rgba(10, 219, 198, 0.08), transparent 80%);
}
.leaderboard-table tr.-current .rank { color: var(--accent); }

@media (max-width: 480px) {
  .leaderboard-table .hide-mobile { display: none; }
  .leaderboard-table th,
  .leaderboard-table td { padding: 10px 10px; }
}

/* Pantallas muy angostas (~360px): el PTS no debe quedar fuera del borde
   redondeado de la tabla. Achicamos rank/PTS y el padding. */
@media (max-width: 380px) {
  .leaderboard-table th,
  .leaderboard-table td { padding: 10px 8px; }
  .leaderboard-table .rank { width: 40px; font-size: 18px; }
  .leaderboard-table .points { width: 52px; font-size: 18px; }
  .leaderboard-table .user > .user-cell { gap: 8px; }
}

/* Paginación de tablas de ranking (shared/_pagination). Anterior/Siguiente en
   la paleta boletería; vive bajo la tabla, dentro del Turbo Frame. */
.ranking-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}
.ranking-pagination__info {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.ranking-pagination__nav { display: flex; align-items: center; gap: 8px; }
.ranking-pagination__page {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}
.ranking-pagination__btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  background: rgba(0, 0, 0, 0.18);
  transition: border-color 120ms ease, color 120ms ease;
}
/* Área táctil ≥44px sin agrandar el botón visible (32px). */
.ranking-pagination__btn::after { content: ""; position: absolute; inset: -6px; }
.ranking-pagination__btn:hover { border-color: var(--accent); color: var(--accent); }
.ranking-pagination__btn.-disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* ──────────────────────────────────────────
   Fan podium — Top 3 de hinchas (fans/index).
   Visual order: 2° | 1° | 3° con el 1° más alto,
   estilo podio competitivo. Colores oro / plata
   / bronce coherentes con la fila top de la tabla.
   ────────────────────────────────────────── */
.fan-podium {
  display: grid;
  grid-template-columns: 1fr 1.18fr 1fr;
  align-items: end;
  gap: 14px;
  margin-bottom: 22px;
}

.fan-podium__step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 26px 14px 20px;
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  isolation: isolate;
  overflow: hidden;
  transition: transform 200ms ease;
}

.fan-podium__step::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  z-index: 2;
}

/* Glow decorativo detrás del escudo. */
.fan-podium__step::after {
  content: "";
  position: absolute;
  top: -30%;
  left: 50%;
  width: 140%;
  height: 80%;
  transform: translateX(-50%);
  border-radius: 50%;
  filter: blur(36px);
  opacity: 0;
  z-index: 0;
  pointer-events: none;
}

.fan-podium__step.-p1 {
  padding-top: 34px;
  padding-bottom: 26px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(10, 219, 198, 0.16), transparent 65%),
    linear-gradient(180deg, var(--card), var(--card-2));
  border-color: rgba(10, 219, 198, 0.45);
  box-shadow: 0 8px 30px var(--green-glow);
}
.fan-podium__step.-p1::before {
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 10px var(--accent);
}
.fan-podium__step.-p1::after { background: rgba(10, 219, 198, 0.45); opacity: 0.35; }

.fan-podium__step.-p2 { border-color: rgba(200, 214, 205, 0.3); }
.fan-podium__step.-p2::before { background: #c8d6cd; }
.fan-podium__step.-p2::after { background: rgba(200, 214, 205, 0.35); opacity: 0.18; }

.fan-podium__step.-p3 { border-color: rgba(217, 119, 6, 0.4); }
.fan-podium__step.-p3::before { background: #d97706; }
.fan-podium__step.-p3::after { background: rgba(217, 119, 6, 0.35); opacity: 0.18; }

.fan-podium__step.-mine {
  outline: 1px dashed var(--accent);
  outline-offset: -4px;
}

/* Posición ahora es una "medalla" — pill compacta con color de cada puesto. */
.fan-podium__rank {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-family: var(--font-scoreboard);
  font-size: 18px;
  line-height: 1;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid var(--line-strong);
}
.fan-podium__step.-p1 .fan-podium__rank {
  color: var(--accent);
  background: rgba(10, 219, 198, 0.14);
  border-color: rgba(10, 219, 198, 0.5);
  font-size: 22px;
  height: 30px;
  padding: 0 14px;
  box-shadow: 0 0 14px var(--green-glow);
}
.fan-podium__step.-p2 .fan-podium__rank {
  color: #d8e3dc;
  background: rgba(200, 214, 205, 0.12);
  border-color: rgba(200, 214, 205, 0.4);
}
.fan-podium__step.-p3 .fan-podium__rank {
  color: #e2954b;
  background: rgba(217, 119, 6, 0.14);
  border-color: rgba(217, 119, 6, 0.5);
}

.fan-podium__crest {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.07), rgba(0, 0, 0, 0.42));
  border: 1px solid var(--line);
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.35),
    inset 0 0 0 3px rgba(0, 0, 0, 0.2);
}
.fan-podium__crest > .cl-logo {
  width: 46px;
  height: 46px;
  object-fit: contain;
}
.fan-podium__step.-p1 .fan-podium__crest {
  width: 92px;
  height: 92px;
  border-color: rgba(10, 219, 198, 0.4);
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.4),
    0 0 24px var(--green-glow),
    inset 0 0 0 3px rgba(0, 0, 0, 0.2);
}
.fan-podium__step.-p1 .fan-podium__crest > .cl-logo {
  width: 58px;
  height: 58px;
}
.fan-podium__step.-p2 .fan-podium__crest { border-color: rgba(200, 214, 205, 0.32); }
.fan-podium__step.-p3 .fan-podium__crest { border-color: rgba(217, 119, 6, 0.38); }

.fan-podium__name {
  position: relative;
  z-index: 2;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
  line-height: 1.25;
  max-width: 100%;
  word-break: break-word;
  hyphens: auto;
}
.fan-podium__step.-p1 .fan-podium__name { font-size: 16px; }

.fan-podium__count {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-top: auto;
}
.fan-podium__count > .value {
  font-family: var(--font-scoreboard);
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0.03em;
  color: var(--ink);
}
.fan-podium__step.-p1 .fan-podium__count > .value {
  color: var(--accent);
  font-size: 38px;
  text-shadow: 0 0 18px var(--green-glow);
}
.fan-podium__step.-p2 .fan-podium__count > .value { color: #d8e3dc; }
.fan-podium__step.-p3 .fan-podium__count > .value { color: #e2954b; }
.fan-podium__count > .label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

@media (max-width: 559px) {
  .fan-podium { gap: 6px; }
  .fan-podium__step { padding: 18px 6px 14px; gap: 8px; }
  .fan-podium__step.-p1 { padding-top: 22px; padding-bottom: 18px; }
  .fan-podium__crest { width: 54px; height: 54px; }
  .fan-podium__step.-p1 .fan-podium__crest { width: 66px; height: 66px; }
  .fan-podium__crest > .cl-logo { width: 34px; height: 34px; }
  .fan-podium__step.-p1 .fan-podium__crest > .cl-logo { width: 42px; height: 42px; }
  .fan-podium__name { font-size: 11.5px; }
  .fan-podium__step.-p1 .fan-podium__name { font-size: 13px; }
  .fan-podium__count > .value { font-size: 22px; }
  .fan-podium__step.-p1 .fan-podium__count > .value { font-size: 28px; }
  .fan-podium__rank { font-size: 14px; height: 22px; min-width: 30px; padding: 0 8px; }
  .fan-podium__step.-p1 .fan-podium__rank { font-size: 17px; height: 25px; padding: 0 10px; }
}

/* ──────────────────────────────────────────
   .fan-myteam — Card "Tu equipo" en fans/index.
   Layout simple: escudo + nombre + dos stats
   (Posición, Hinchas). Sin comparación con el líder.
   ────────────────────────────────────────── */
.fan-myteam {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 18px;
  padding: 16px 20px;
  margin-bottom: 22px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(10, 219, 198, 0.08), transparent 60%),
    linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid rgba(10, 219, 198, 0.3);
  border-radius: var(--radius-lg);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}
.fan-myteam::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent) 30%, var(--accent) 70%, transparent);
  opacity: 0.65;
}

.fan-myteam__crest {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.42));
  border: 1px solid rgba(10, 219, 198, 0.35);
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.3),
    inset 0 0 0 3px rgba(0, 0, 0, 0.18);
}
.fan-myteam__crest > .cl-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.fan-myteam__body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.fan-myteam__label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.fan-myteam__name {
  font-family: var(--font);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fan-myteam__stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  padding-left: 18px;
  border-left: 1px dashed var(--line-strong);
}
.fan-myteam__stat > .value {
  font-family: var(--font-scoreboard);
  font-size: 26px;
  line-height: 1;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.fan-myteam__stat > .label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

@media (max-width: 559px) {
  .fan-myteam {
    grid-template-columns: auto 1fr;
    row-gap: 14px;
    padding: 14px 16px;
  }
  .fan-myteam__crest { width: 52px; height: 52px; }
  .fan-myteam__crest > .cl-logo { width: 32px; height: 32px; }
  .fan-myteam__name { font-size: 16px; }
  .fan-myteam__stat {
    grid-column: span 1;
    align-items: flex-start;
    padding: 10px 0 0;
    border-left: 0;
    border-top: 1px dashed var(--line-strong);
  }
  .fan-myteam__stat.-rank { grid-column: 1 / 2; }
  .fan-myteam__stat.-count { grid-column: 2 / 3; align-items: flex-end; }
  .fan-myteam__stat > .value { font-size: 22px; }
}
