/* =====================================================================
   Torneo LoL — bracket (árbol de eliminación directa), estilo broadcast / arena
   - fondo de arena con viñeta y trama
   - conectores como "líneas de energía": apagados hasta que el camino se define,
     dorados y con pulso de luz viajando cuando el ganador ya pasó por ahí
   - nodos con marcador en caja, fila ganadora dorada con trofeo, hora del cruce
   - trono del campeón con rayos
   ===================================================================== */
.bracket-card { padding: 16px; position: relative; overflow: hidden; }
.bracket-card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(233, 185, 73, 0.10), transparent 70%),
    radial-gradient(600px 300px at 100% 110%, rgba(229, 72, 77, 0.08), transparent 70%),
    radial-gradient(600px 300px at 0% 110%, rgba(47, 124, 246, 0.08), transparent 70%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 14px);
}
.bracket-card > * { position: relative; z-index: 1; }
.bracket-wrap { position: relative; }
.bracket-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; }
.bracket-tabs .btn.active { background: var(--gold); color: #1a1200; }
.bracket-scroll { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; padding: 6px 4px 14px; scroll-snap-type: x proximity; }
.bracket { --col: 248px; --gap: 44px; --line: rgba(233, 185, 73, 0.22); display: flex; column-gap: var(--gap); align-items: stretch; min-width: max-content; }
.round { display: flex; flex-direction: column; width: var(--col); flex: none; scroll-snap-align: start; }

/* ---- Cabecera de ronda: banner angular ---- */
.round-title {
  display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; margin-bottom: 12px; position: relative;
  background: linear-gradient(90deg, #12141c, #0a0c11); font-family: var(--font-display); font-weight: 900;
  letter-spacing: 0.18em; text-transform: uppercase; font-size: 15px; color: var(--text);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 100%, 10px 100%);
}
.round-title::after { content: ""; position: absolute; left: 10px; right: 0; bottom: 0; height: 2px; background: linear-gradient(90deg, var(--gold), rgba(233, 185, 73, 0.15)); }
.round-title .xs { font-family: var(--font); letter-spacing: 0.06em; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); color: var(--muted); }
.round.done .round-title { background: linear-gradient(90deg, rgba(233, 185, 73, 0.22), #0a0c11); }
.round.done .round-title .xs { background: var(--gold); color: #1a1200; }
.champion-col .round-title { background: linear-gradient(90deg, rgba(233, 185, 73, 0.35), #0a0c11); color: var(--gold); }
.round-matches { flex: 1; display: flex; flex-direction: column; justify-content: space-around; }
.mwrap { position: relative; flex: 1; display: flex; align-items: center; padding: 8px 0; }

/* ---- Conectores (barras de 2 px, apagados; "lit" = camino del ganador) ---- */
.mwrap::after { content: ""; position: absolute; right: calc(var(--gap) * -0.5 - 1px); width: calc(var(--gap) * 0.5 + 1px); top: 50%; height: 2px; margin-top: -1px; background: var(--line); }
.mwrap::before { content: ""; position: absolute; left: calc(var(--gap) * -0.5 - 1px); top: 25%; height: 50%; width: 2px; background: var(--line); }
.mwrap .in { position: absolute; left: calc(var(--gap) * -0.5); width: calc(var(--gap) * 0.5); top: 50%; height: 2px; margin-top: -1px; background: var(--line); }
.mwrap.no-in::before, .mwrap.no-in .in { display: none; }
.champion-col .mwrap::after, .champion-col .mwrap::before { display: none; }
.mwrap.lit::after, .mwrap.lit-in::before, .mwrap.lit-in .in {
  background: linear-gradient(90deg, var(--gold) 0%, #fff4cf 50%, var(--gold) 100%); background-size: 200% 100%;
  box-shadow: 0 0 10px rgba(233, 185, 73, 0.55); animation: bpulse 2.6s linear infinite;
}
.mwrap.lit-in::before { background: linear-gradient(180deg, var(--gold) 0%, #fff4cf 50%, var(--gold) 100%); background-size: 100% 200%; animation-name: bpulsev; }
@keyframes bpulse { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes bpulsev { from { background-position: 0 200%; } to { background-position: 0 -200%; } }
/* Punto de unión donde la energía llega al nodo */
.mwrap.lit-in .in::after { content: ""; position: absolute; right: -3px; top: -2px; width: 6px; height: 6px; border-radius: 50%; background: #fff4cf; box-shadow: 0 0 10px 2px rgba(233, 185, 73, 0.9); }

/* ---- Nodo (tarjeta de cruce) ---- */
.mnode {
  display: block; width: 100%; border: 1px solid var(--border-strong); color: var(--text); overflow: hidden;
  background: linear-gradient(180deg, #12141c 0%, #0a0c11 45%, #07080d 100%);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}
.mnode:hover { text-decoration: none; transform: translateY(-3px); border-color: var(--gold); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 24px rgba(233, 185, 73, 0.18); }
.mnode-head { display: flex; justify-content: space-between; align-items: center; padding: 5px 12px; background: rgba(0, 0, 0, 0.45); border-bottom: 1px solid var(--border); font-family: var(--font-display); letter-spacing: 0.14em; text-transform: uppercase; font-size: 12px; }
.badge.tiny { font-size: 10px; padding: 2px 6px; }
.mrow { display: flex; align-items: center; gap: 8px; padding: 7px 12px; min-height: 44px; position: relative; }
.mrow:nth-of-type(2) { box-shadow: inset 3px 0 0 var(--blue); }
.mrow:nth-of-type(3) { box-shadow: inset 3px 0 0 var(--red); }
.mrow + .mrow { border-top: 1px solid var(--border); }
.mrow .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: 0.04em; text-transform: uppercase; }
.mrow .sc { font-family: var(--font-display); font-weight: 800; font-size: 18px; min-width: 30px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; background: rgba(255, 255, 255, 0.06); font-variant-numeric: tabular-nums; }
.mrow .tick { color: #1a1200; display: inline-flex; width: 18px; height: 18px; border-radius: 50%; background: var(--gold); align-items: center; justify-content: center; box-shadow: 0 0 10px rgba(233, 185, 73, 0.7); }
.mrow .tick svg { width: 11px; height: 11px; }
.mrow .slot { width: 28px; height: 28px; border-radius: 50%; border: 1px dashed var(--border-strong); flex: none; }
.mrow.tbd .nm, .nm.tbd { color: var(--muted); font-style: italic; font-weight: 500; text-transform: none; font-family: var(--font); font-size: 13px; }
.mrow.won { background: linear-gradient(90deg, rgba(233, 185, 73, 0.28), rgba(233, 185, 73, 0.04) 70%, transparent); }
.mrow.won .nm { color: var(--gold); text-shadow: 0 0 14px rgba(233, 185, 73, 0.45); }
.mrow.won .sc { background: var(--gold); color: #1a1200; }
.mrow.lost { opacity: 0.45; filter: grayscale(0.6); }
.mrow.lost .nm { text-decoration: line-through; }
.mrow.me .nm { text-decoration: underline; text-decoration-color: var(--accent-2); text-underline-offset: 3px; }
.mrow.me::after { content: "VOS"; position: absolute; right: 44px; top: 50%; transform: translateY(-50%); font-size: 9px; letter-spacing: 0.2em; color: var(--accent-2); font-family: var(--font-display); }
.mnode-foot { display: flex; align-items: center; gap: 6px; padding: 4px 12px 6px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border); background: rgba(0, 0, 0, 0.25); }
.mnode-foot .live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); animation: livepulse 1.4s ease-out infinite; }
.mnode-foot .when { color: var(--text); font-weight: 600; }
.mnode.st-ready { border-color: rgba(255, 255, 255, 0.28); }
.mnode.st-in_progress { border-color: var(--red); box-shadow: 0 0 0 1px rgba(229, 72, 77, 0.35), 0 0 22px rgba(229, 72, 77, 0.25); }
.mnode.st-finished { border-color: rgba(233, 185, 73, 0.45); }
.mnode.st-pending { opacity: 0.72; }
.mnode.st-bye { opacity: 0.55; border-style: dashed; }
.mnode.mine { box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.35); }
.mnode.is-final .mnode-head { background: linear-gradient(90deg, rgba(233, 185, 73, 0.25), rgba(0, 0, 0, 0.45)); color: var(--gold); }
.mnode.final-done { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(232, 183, 74, 0.3), 0 0 32px rgba(232, 183, 74, 0.28); }

/* ---- Trono del campeón ---- */
.champ-node {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px 12px 20px; text-align: center; position: relative;
  border: 1px dashed var(--gold-line); background: #0a0c11;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}
.champ-node .ribbon { position: absolute; top: 0; left: 50%; transform: translateX(-50%); padding: 3px 14px; font-family: var(--font-display); font-size: 11px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--muted); background: rgba(255, 255, 255, 0.05); clip-path: polygon(0 0, 100% 0, calc(100% - 8px) 100%, 8px 100%); }
.champ-node.has { border-style: solid; border-color: var(--gold); background: radial-gradient(240px 160px at 50% 0%, rgba(233, 185, 73, 0.35), transparent 75%), linear-gradient(180deg, #14120a, #0a0c11); box-shadow: 0 0 40px rgba(232, 183, 74, 0.3), inset 0 0 0 1px rgba(233, 185, 73, 0.25); }
.champ-node.has .ribbon { background: var(--gold); color: #1a1200; }
.champ-node.has::before { content: ""; position: absolute; inset: -60%; z-index: 0; pointer-events: none; background: conic-gradient(from 0deg, rgba(233, 185, 73, 0) 0 8%, rgba(233, 185, 73, 0.28) 12%, rgba(233, 185, 73, 0) 16%, rgba(233, 185, 73, 0) 33%, rgba(233, 185, 73, 0.28) 37%, rgba(233, 185, 73, 0) 41%, rgba(233, 185, 73, 0) 58%, rgba(233, 185, 73, 0.28) 62%, rgba(233, 185, 73, 0) 66%, rgba(233, 185, 73, 0) 83%, rgba(233, 185, 73, 0.28) 87%, rgba(233, 185, 73, 0) 91%); animation: fxrays 16s linear infinite; }
.champ-node > * { position: relative; z-index: 1; }
.champ-node .nm { font-family: var(--font-display); font-size: 26px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.04em; }
.champ-node.has .nm { color: var(--gold); text-shadow: 0 0 24px rgba(233, 185, 73, 0.6); }
.champ-node.has .avatar { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--gold), 0 0 50px 8px rgba(233, 185, 73, 0.55) !important; }
.champ-node .cup { font-size: 40px; opacity: 0.35; animation: bfloat 3s ease-in-out infinite; filter: grayscale(1); }
@keyframes bfloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.champ-node .tname { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.bracket-hint { margin-top: 8px; }

@media (max-width: 700px) {
  .bracket { --col: 220px; --gap: 34px; }
  .bracket-card { padding: 12px; }
  .mrow { padding: 6px 10px; min-height: 40px; }
  .mrow .nm { font-size: 15px; }
  .mrow .avatar { width: 24px; height: 24px; font-size: 10px; }
  .mrow.me::after { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .mwrap.lit::after, .mwrap.lit-in::before, .mwrap.lit-in .in, .champ-node.has::before, .champ-node .cup, .mnode-foot .live-dot { animation: none !important; }
}
