/* Estilos propios sobre Tailwind */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

body {
  background-image:
    radial-gradient(900px 500px at 80% -10%, rgba(11,110,79,.35), transparent),
    radial-gradient(700px 400px at -10% 10%, rgba(255,207,51,.10), transparent);
  background-attachment: fixed;
}

.tab-btn {
  white-space: nowrap;
  padding: .55rem .85rem;
  font-size: .8rem;
  border-bottom: 3px solid transparent;
  color: #cbd5e1;
  transition: all .15s;
}
.tab-btn:hover { color: #fff; }
.tab-btn.active { color: #ffcf33; border-color: #ffcf33; }

.card {
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 1rem;
}

/* Ventana modal: fondo sólido (opaco) para que no se transparente lo de atrás */
.modal-box.card {
  background: #16263f;
  border-color: rgba(255,255,255,.14);
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
}

.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .15rem .55rem; border-radius: 999px; font-size: .7rem;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.1);
}

/* Animación de revelado del draft */
@keyframes pop {
  0% { transform: scale(.6) rotate(-6deg); opacity: 0; }
  60% { transform: scale(1.08) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}
.reveal { animation: pop .5s cubic-bezier(.18,.89,.32,1.28) both; }

@keyframes slideIn {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.slide-in { animation: slideIn .25s ease both; }

/* Toast */
.toast-item {
  background: #13233a; border: 1px solid rgba(255,255,255,.15);
  padding: .6rem 1rem; border-radius: .75rem; font-size: .85rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: slideIn .2s ease both;
}

/* Barra de progreso de puntos */
.bar { height: 8px; border-radius: 999px; background: rgba(255,255,255,.1); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; transition: width .6s ease; }

/* Banderas como imagen */
.flagimg { display: inline-block; border-radius: 3px; box-shadow: 0 1px 4px rgba(0,0,0,.45); vertical-align: middle; height: auto; }
.flag-sm { width: 1.4rem; }
/* Respaldo cuando una bandera no carga: muestra el código del país, sin ícono roto */
.flagcode {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .6rem; font-weight: 700; letter-spacing: .02em;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18);
  border-radius: 3px; padding: .1rem .25rem; color: #e2e8f0; vertical-align: middle;
  line-height: 1; min-width: 1.4rem;
}
.flag-md { width: 2.6rem; }
/* La bandera grande usa ALTURA fija (no ancho) para que, al girar la ruleta,
   banderas de distintas proporciones no muevan la página verticalmente. */
.flag-xl { height: 4.4rem; width: auto; border-radius: 6px; }

/* Recuadros de la ruleta con alto reservado: el contenido cambia adentro, sin saltos */
#revealBox { width: 100%; }
#slotTop, #slotBot {
  min-height: 6.5rem; width: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}

/* Modo proyector */
.projector { font-size: clamp(1rem, 2.5vw, 2rem); }
#draftStage:fullscreen {
  background: radial-gradient(1200px 700px at 50% -10%, rgba(11,110,79,.5), #073b2a);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100vw; height: 100vh; border-radius: 0; padding: 4vh 6vw; gap: 2vh;
}
#draftStage:fullscreen #revealBox { min-height: 34vh; gap: 3vh; justify-content: center; }

/* Panel de equipos por jugador (solo visible en proyector) */
.stage-board { display: none; }
#draftStage:fullscreen .stage-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11vw, 1fr));
  gap: 1vw; width: 100%; margin-top: 2.5vh; max-height: 28vh; overflow: hidden;
}
#draftStage:fullscreen .sb-col {
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.12);
  border-radius: .6rem; padding: .5vw .7vw; text-align: left;
}
#draftStage:fullscreen .sb-name { font-size: clamp(.85rem, 1.5vw, 1.4rem); font-weight: 700; margin-bottom: .5vh; line-height: 1.1; }
#draftStage:fullscreen .sb-flags { display: flex; flex-wrap: wrap; gap: .3vw; }
#draftStage:fullscreen .sb-flags .flag-sm { width: clamp(1.4rem, 2.3vw, 2.4rem); }
#draftStage:fullscreen #slotTop,
#draftStage:fullscreen #slotBot { margin: 1vh 0; }
#draftStage:fullscreen .reveal > div { line-height: 1.15; }
#draftStage:fullscreen .text-7xl { font-size: clamp(4rem, 12vw, 9rem); line-height: 1; }
#draftStage:fullscreen .text-6xl { font-size: clamp(3.5rem, 10vw, 8rem); line-height: 1; }
#draftStage:fullscreen .text-5xl { font-size: clamp(3rem, 8vw, 6rem); line-height: 1; }
#draftStage:fullscreen .text-4xl { font-size: clamp(2.6rem, 7vw, 5rem); line-height: 1.1; }
#draftStage:fullscreen .text-3xl { font-size: clamp(2rem, 6vw, 4rem); line-height: 1.1; }
#draftStage:fullscreen .text-2xl { font-size: clamp(1.6rem, 4vw, 3rem); line-height: 1.1; }
#draftStage:fullscreen .flag-xl { height: clamp(7rem, 20vh, 14rem); width: auto; }
#draftStage:fullscreen #slotTop, #draftStage:fullscreen #slotBot { min-height: 22vh; }
#draftStage:fullscreen #nextBtn { font-size: clamp(1.1rem, 2.4vw, 2rem); padding: 1rem 2.5rem; margin-top: 2vh; }
#draftStage:fullscreen .chip { font-size: clamp(1rem, 2.2vw, 1.7rem); }
#draftStage:fullscreen .text-\[11px\] { font-size: clamp(.8rem, 1.6vw, 1.2rem); margin-bottom: 1vh; }

/* Tabla */
table.q { width: 100%; border-collapse: collapse; }
table.q th, table.q td { padding: .55rem .5rem; text-align: left; }
table.q tbody tr { border-top: 1px solid rgba(255,255,255,.07); }
table.q tbody tr:hover { background: rgba(255,255,255,.03); }

input, select, textarea {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
  border-radius: .55rem; padding: .45rem .6rem; color: #fff; outline: none;
}
input:focus, select:focus { border-color: #ffcf33; }
select option { background: #13233a; }

.btn { border-radius: .6rem; padding: .5rem .9rem; font-weight: 600; font-size: .85rem; transition: .15s; }
.btn-gold { background: #ffcf33; color: #0f172a; }
.btn-gold:hover { background: #ffd84d; }
.btn-ghost { background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.12); }
.btn-ghost:hover { background: rgba(255,255,255,.14); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ════════ Bracket de eliminatorias (simétrico, converge al centro) ════════ */
.bk-wrap { overflow-x: auto; padding: 6px 0 16px; }
.bk { display: flex; align-items: stretch; justify-content: center; min-width: max-content; gap: 0; }
.bk-side { display: flex; align-items: stretch; }
.bk-side .round { display: flex; flex-direction: column; min-width: 140px; }
.round-label { flex: 0 0 auto; text-align: center; font-size: 11px; font-weight: 700; color: #cbd5e1; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 6px; }
.round-slots { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: space-around; }
.bk-side .slot { flex: 1 1 0; display: flex; align-items: center; position: relative; padding: 5px 0; }

/* Tarjeta de llave */
.bm {
  width: 100%;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 8px;
  background: rgba(255,255,255,.05);
  overflow: hidden;
}
.krow {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 7px; font-size: 11px; line-height: 1.15; min-height: 28px;
  cursor: pointer; transition: background .12s;
}
.krow + .krow { border-top: 1px solid rgba(255,255,255,.1); }
.krow:hover { background: rgba(255,255,255,.09); }
.krow .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.krow .nm.placeholder { color: #64748b; }
.krow.win { background: rgba(255,207,51,.30); font-weight: 700; }
.krow.dim { opacity: .45; }
/* Tus equipos en el bracket: anillo dorado (se apila con el fondo de "ganó") */
.krow.mine { box-shadow: inset 0 0 0 2px rgba(255,207,51,.65); }
.krow.mine .nm { font-weight: 700; }
.krow.mine .me-badge { font-size: .5rem; padding: .02rem .25rem; }
.krow .wk { color: #ffcf33; }
.krow .kedit { font-size: 10px; opacity: .5; padding: 0 2px; }
.krow .kedit:hover { opacity: 1; }
/* lado derecho: espejo (bandera a la derecha) */
.bm-right .krow { flex-direction: row-reverse; text-align: right; }
/* marcador de eliminatorias (goles) */
.kscore { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 3px; border-top: 1px solid rgba(255,255,255,.1); background: rgba(0,0,0,.15); }
.kscore input { width: 34px; padding: 1px 4px; text-align: center; font-size: 11px; }
.kscore-view { text-align: center; font-size: 10px; color: #94a3b8; padding: 2px; border-top: 1px solid rgba(255,255,255,.1); }

/* Conectores tipo árbol.
   IZQUIERDA: las llaves alimentan hacia la DERECHA (centro). Conector vertical en
   las rondas alimentadoras = todas menos la última (Semifinal).
   DERECHA: espejo — alimentan hacia la IZQUIERDA. Alimentadoras = todas menos la
   primera del DOM (Semifinal, que está pegada al centro). */
.bk-side .round { margin: 0 14px; }
/* Línea horizontal: cada llave tira un trazo hacia el centro */
.bk-side.left .slot::after {
  content: ''; position: absolute; left: 100%; top: 50%;
  width: 14px; height: 2px; background: rgba(255,255,255,.25);
}
.bk-side.right .slot::after {
  content: ''; position: absolute; right: 100%; top: 50%;
  width: 14px; height: 2px; background: rgba(255,255,255,.25);
}
/* Línea vertical: une cada par de llaves (solo rondas alimentadoras) */
.bk-side.left .round:not(:last-child) .slot:nth-child(odd)::before {
  content: ''; position: absolute; left: calc(100% + 14px); top: 50%;
  width: 2px; height: 100%; background: rgba(255,255,255,.25);
}
.bk-side.right .round:not(:first-child) .slot:nth-child(odd)::before {
  content: ''; position: absolute; right: calc(100% + 14px); top: 50%;
  width: 2px; height: 100%; background: rgba(255,255,255,.25);
}

/* Centro: final + campeón */
.bk-center { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 160px; padding: 0 6px; }
.bm-final { width: 150px; border-color: rgba(255,207,51,.5); }
.champ {
  margin-top: 12px; text-align: center; padding: 10px 14px;
  border: 1px solid rgba(255,207,51,.4); border-radius: 12px;
  background: rgba(255,207,51,.08); min-width: 130px;
}

/* Secciones desplegables (Inicio: Puntos por fase / Cómo funciona) */
details.fold > summary {
  cursor: pointer; list-style: none; font-weight: 700; color: #e2e8f0;
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after {
  content: '▸'; color: #94a3b8; transition: transform .2s; font-size: .9em;
}
details.fold[open] > summary::after { transform: rotate(90deg); }

/* Bloques de partidos agrupados por día (pestaña Partidos) */
.day-group { margin-bottom: 1.25rem; }
.day-header {
  font-weight: 700; font-size: .9rem; color: #e2e8f0;
  padding: .5rem .8rem; margin-bottom: .6rem;
  background: rgba(255,207,51,.10);
  border: 1px solid rgba(255,207,51,.22);
  border-radius: .75rem;
  display: flex; align-items: center; gap: .4rem;
}

/* Captura de marcador inline (host, en la pestaña Partidos) */
.inline-score { display: inline-flex; align-items: center; gap: 4px; }
.msc {
  width: 2.6rem; text-align: center; font-size: 1rem; font-weight: 700;
  padding: .3rem .2rem; -moz-appearance: textfield;
}
.msc::-webkit-outer-spin-button, .msc::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Resaltado de "tú" (espectador que eligió a qué jugador sigue) */
.me-ring { box-shadow: 0 0 0 2px #ffcf33 inset; }
.me-badge {
  display: inline-flex; align-items: center; padding: .05rem .4rem;
  border-radius: 999px; font-size: .6rem; font-weight: 700;
  background: #ffcf33; color: #0f172a; letter-spacing: .03em;
}

/* Confeti simple */
@keyframes fall {
  to { transform: translateY(110vh) rotate(360deg); opacity: .9; }
}
.confetti { position: fixed; top: -10px; width: 9px; height: 14px; z-index: 60; animation: fall linear forwards; }
