/* =========================================================
   Tournaments view
   ========================================================= */

.tboard {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 440px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding: 0 18px 24px 20px;
}

/* Type badges */
.tbadge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
  color: var(--b-ink);
  background: var(--b-bg);
}
.tbadge--international { --b-bg: #e5ecfc; --b-ink: #2448b0; }
.tbadge--special       { --b-bg: #fbe6db; --b-ink: #8f3f17; }
.tbadge--national      { --b-bg: #fcefcf; --b-ink: #7d5908; }
.tbadge--local         { --b-bg: #ddf2ee; --b-ink: #13655b; }

/* ---------- List card ---------- */
.tlist-card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 22px 14px 14px;
  box-shadow: 0 1px 2px rgba(16, 26, 44, .03), 0 18px 40px -26px rgba(16, 26, 44, .25);
  animation: rise .6s cubic-bezier(.2, .7, .2, 1) both;
  position: sticky;
  top: 16px;
}
.tlist-card__head { padding: 0 8px; }
.tlist-card__head h2 {
  margin: 0 0 4px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 26px;
  letter-spacing: -0.03em;
}
.tlist-card__head p { margin: 0; color: var(--muted); font-size: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 8px 10px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  transition: background .2s, border-color .2s, color .2s;
}
.chip small { font-size: 11.5px; color: var(--muted-2); }
.chip:hover { border-color: #cdd3dc; }
.chip.is-on { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip.is-on small { color: rgba(255, 255, 255, .6); }
.tlist-card__country { margin: 0 8px 12px; }
.tlist-card__country select { height: 34px; }

.tlist {
  list-style: none;
  margin: 0;
  padding: 0 2px 0 0;
  max-height: min(calc(100vh - 260px), 900px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.titem {
  width: 100%;
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: none;
  text-align: left;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.titem:hover { background: var(--head); }
.titem:focus-visible { outline: 2px solid var(--navy); outline-offset: -2px; }
.titem.is-active {
  background: var(--gold-row);
  border-color: var(--gold-line);
}
.tlist li + li .titem { margin-top: 2px; }

.titem__date {
  display: grid;
  place-items: center;
  width: 50px;
  height: 54px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  line-height: 1;
}
.titem__date b { font-family: var(--display); font-size: 21px; font-weight: 800; letter-spacing: -0.03em; color: var(--ink); }
.titem__date small { margin-top: -10px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

.titem__main { display: grid; gap: 3px; min-width: 0; }
.titem__main strong {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.titem__meta, .titem__winner {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.titem__meta .flag { width: 18px; height: 12px; }
.titem__winner { color: var(--ink-2); }
.titem__winner svg { width: 14px; height: 14px; flex: none; fill: none; stroke: var(--gold); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Detail card ---------- */
.tdetail { padding: 30px 26px 20px; }
.tdetail__head { padding: 0 6px 20px; }
.tdetail__head .eyebrow { margin-bottom: 12px; }
.tdetail__name {
  margin: 0 0 14px;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(32px, 4vw, 48px);
  line-height: .98;
  letter-spacing: -0.04em;
  color: #0a1222;
}
.tdetail__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 0;
  font-size: 15px;
  color: var(--ink-2);
}
.tdetail__meta i { width: 4px; height: 4px; border-radius: 50%; background: var(--muted-2); }
.tdetail__meta b { color: var(--ink); }

.tdetail__pending {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: #fff6e2;
  border: 1px solid #f1d998;
  font-size: 14px;
  color: #6f5310;
}
.tdetail__pending b {
  padding: 3px 9px;
  border-radius: 999px;
  background: #e2a91f;
  color: #fff;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* Mini podium */
.tpodium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}
.tpod {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  gap: 6px 12px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  border-left-width: 3px;
  animation: rise .5s cubic-bezier(.2, .7, .2, 1) both;
  opacity: 0;
  transform: translateY(10px);
}
.tpod:nth-child(2) { animation-delay: .06s; }
.tpod:nth-child(3) { animation-delay: .12s; }
.tpod--1 { background: var(--gold-bg); border-color: var(--gold-line); --medal: var(--gold); }
.tpod--2 { background: var(--silver-bg); border-color: var(--silver-line); --medal: var(--silver); }
.tpod--3 { background: var(--bronze-bg); border-color: var(--bronze-line); --medal: var(--bronze); }
.tpod.is-link { cursor: pointer; transition: transform .2s; }
.tpod.is-link:hover { transform: translateY(-2px); }
.tpod.is-link:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.tpod__pos {
  grid-row: 1 / 3;
  font-family: var(--display);
  font-weight: 800;
  font-size: 38px;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--medal);
}
.tpod__who { display: grid; gap: 3px; min-width: 0; }
.tpod__who strong { font-size: 15px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpod__who span { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.tpod__who .flag { width: 18px; height: 12px; }
.tpod__pts {
  font-family: var(--display);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.tpod__pts small { margin-left: 4px; font-family: var(--font); font-weight: 400; font-size: 12px; color: var(--muted); }

/* Results table tweaks */
.tresults .c-rank { width: 92px; white-space: nowrap; }
.tresults tr.is-static { cursor: default; }
.tresults tr.is-static:hover td.c-player { text-decoration: none; }
.tresults tr.is-static td.c-player { color: var(--ink-2); }
.tag-off {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--head);
  font-size: 10.5px;
  color: var(--muted-2);
  vertical-align: 1px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1240px) {
  .tboard { grid-template-columns: minmax(0, 1fr); }
  .tlist-card { position: static; }
  .tlist { max-height: 420px; }
}
@media (max-width: 900px) {
  .tboard { padding: 0 12px 18px; }
  .tdetail { padding: 22px 12px 14px; }
  .tpodium { grid-template-columns: 1fr; }
  .tresults td, .tresults th { padding: 0 6px; }
  .tresults .c-rank { width: 72px; font-size: 13px; }
  .tresults .c-nat { width: 34px; }
  .tresults .nat { font-size: 0; gap: 0; }
  .tresults td.c-player { max-width: 170px; }
}

/* ---------- Upcoming ---------- */
.tbadge--upcoming { --b-bg: var(--navy); --b-ink: #fff; }
.titem--upcoming { border-style: dashed; border-color: #cfd5de; margin-bottom: 6px; }
.titem--upcoming .titem__date b { font-size: 15px; text-transform: uppercase; letter-spacing: .02em; }
.titem--upcoming .titem__date small { margin-top: -6px; }
.tupcoming {
  margin: 4px 6px 6px;
  padding: 22px 24px;
  border-radius: 12px;
  border: 1px dashed #cfd5de;
  background: var(--head);
  font-size: 15px;
  color: var(--ink-2);
}
.tupcoming p { margin: 0; }
.tupcoming p + p { margin-top: 10px; color: var(--muted); }
.tupcoming a { color: var(--ink); }

/* ---------- Points system ---------- */
.tpoints {
  margin: 14px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--head);
  font-size: 13.5px;
  color: var(--ink-2);
}
.tpoints summary {
  padding: 13px 16px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tpoints summary::-webkit-details-marker { display: none; }
.tpoints summary::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.6px solid var(--ink-2);
  border-bottom: 1.6px solid var(--ink-2);
  transform: rotate(45deg);
  transition: transform .2s;
}
.tpoints[open] summary::after { transform: rotate(-135deg); }
.tpoints > p, .tpoints ul { margin: 0 16px 12px; }
.tpoints ul { padding-left: 18px; color: var(--muted); }
.tpoints li + li { margin-top: 5px; }
.tpoints b { color: var(--ink); }
.tpoints .table-wrap { margin: 0 10px 12px; }
.tpoints__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
}
.tpoints__table th, .tpoints__table td { padding: 6px 7px; text-align: right; white-space: nowrap; }
.tpoints__table th:first-child, .tpoints__table td:first-child { text-align: left; color: var(--muted); }
.tpoints__table th { font-weight: 500; font-size: 11px; color: var(--muted); background: var(--line-soft); }
.tpoints__table tbody tr + tr td { border-top: 1px solid var(--line-soft); }

/* Igual que el ranking: por debajo de 1240px las 3 tarjetas del podio sobran (la tabla ya lo muestra) */
@media (max-width: 1240px) {
  .tpodium { display: none; }
}

/* ---------- Enlace a resultados completos (Challonge) ---------- */
.tbracket {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin: 0 0 22px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--navy);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 14px 30px -18px rgba(19, 33, 59, .8);
  transition: transform .2s, box-shadow .2s;
}
.tbracket:hover { transform: translateY(-2px); box-shadow: 0 20px 36px -18px rgba(19, 33, 59, .9); }
.tbracket:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.tbracket__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .1);
}
.tbracket__icon svg { width: 24px; height: 24px; fill: none; stroke: #f4c24f; stroke-width: 1.8; stroke-linejoin: round; }
.tbracket__text { display: grid; gap: 2px; min-width: 0; }
.tbracket__text strong { font-size: 16px; font-weight: 700; }
.tbracket__text span { font-size: 13px; color: rgba(255, 255, 255, .7); }
.tbracket__go {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: #f4c24f;
  color: var(--navy);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.tbracket__go span { transition: transform .2s; }
.tbracket:hover .tbracket__go span { transform: translate(2px, -2px); }

.tdetail__sub {
  margin: 0 6px 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}

@media (max-width: 600px) {
  .tbracket { grid-template-columns: auto minmax(0, 1fr); }
  .tbracket__go { grid-column: 1 / -1; justify-content: center; }
}

/* Buscador + Filters en la lista de torneos */
.tlist-card .search-row { margin: 14px 8px 0; }
.tlist-card .search-row .search--card { margin: 0; height: 40px; }
@media (max-width: 900px) {
  .tlist-card .filters-toggle { height: 40px; }
  #t-card:not(.filters-open) .tfilters { display: none !important; }
  #t-card.filters-open .tfilters { animation: rise .25s ease both; }
  #t-card:not(.filters-open) .tlist { margin-top: 12px; }
}

/* Desplegables de tipo y pais, uno al lado del otro */
.tfilters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 8px; }
.tfilters .select, .tfilters select { width: 100%; min-width: 0; }
.tfilters select { height: 38px; }

/* Etiqueta de tipo: corta en movil */
.tbadge .sm { display: none; }
@media (max-width: 900px) {
  .ph__tlist .tbadge .lg, .tlist .tbadge .lg { display: none; }
  .ph__tlist .tbadge .sm, .tlist .tbadge .sm { display: inline; }
}

/* Podio del torneo con el mismo aire que el del ranking */
.tpod { grid-template-columns: 44px minmax(0, 1fr); column-gap: 18px; padding: 16px 18px; }
.tpod__pos { font-size: 46px; text-align: center; letter-spacing: -0.05em; }
.tpod__who strong { font-size: 16px; }
