/* 2 contra 2 (team.js, team_online.js): botón del menú, pantalla de equipos, grupo online y botón OBJETIVO del táctil */
.mgroup.team-group { display: grid; grid-template-columns: minmax(0, 1fr); }
.mbtn.feat.team2v2 { --b: #2f8cff; --d: #102a6a; --l: #ff7a6a; --g: rgba(79,180,255,.7); }
.mbtn.feat.team2v2, .mbtn.feat.team2v2:hover, .mbtn.feat.team2v2:focus-visible, .mbtn.feat.team2v2.sel { background-image:
    radial-gradient(circle at 90% 130%, rgba(255,90,90,.55), transparent 55%),
    repeating-linear-gradient(135deg, transparent 0 10px, rgba(255,255,255,.07) 10px 12px),
    linear-gradient(100deg, #7cc6ff 0 2px, #2f8cff 2px 48%, #e0304a 52%, #7a1030); background-size: auto; background-position: 0 0; }

/* pantalla de equipos (#team): la escena del menú detrás (css/modes.css .mode-scr), dos paneles de equipo con sus
   colores, cuatro huecos con retrato, opciones y botones .mbtn, y el plantel abajo (se desplaza si no cabe) */
#team { overflow: hidden; }
.team-scr .tm-teams, .team-scr .tm-row, .team-scr .tm-help { flex: none; }
.tm-teams { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: clamp(8px, 1.4vw, 18px); align-items: stretch; width: min(1100px, 100%); }
.tm-side { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 0 8px 8px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tc) 24%, rgba(10,12,30,.9)), rgba(10,12,30,.9));
  box-shadow: 0 0 0 2px #000, inset 0 0 0 2px var(--tc), inset 0 0 0 4px rgba(0,0,0,.45), 0 8px 0 rgba(0,0,0,.35), 0 0 22px color-mix(in srgb, var(--tc) 30%, transparent); }
.sub-screen:not(.hidden) .tm-side { animation: panel-in .35s .06s steps(5) both; }
.sub-screen:not(.hidden) .tm-side.team-red { animation-delay: .12s; }
.tm-side h3 { margin: 0 -8px; padding: 7px 10px 6px; font-weight: normal; font-size: clamp(8px, 1vw, 12px); letter-spacing: 3px; text-align: center; color: #fff;
  text-shadow: 2px 2px 0 #000; background: linear-gradient(180deg, var(--tl) 0 2px, var(--tc) 2px 60%, var(--td)); box-shadow: inset 0 0 0 2px rgba(0,0,0,.35), 0 2px 0 #000; }
.tm-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tm-slot { position: relative; display: flex; gap: 8px; align-items: center; padding: 6px; min-width: 0; cursor: pointer;
  background: rgba(6,8,20,.72); box-shadow: 0 0 0 2px #000, inset 0 0 0 2px color-mix(in srgb, var(--tc) 35%, #1a2246); transition: transform .1s steps(2); }
.tm-slot:hover { box-shadow: 0 0 0 2px #000, inset 0 0 0 2px var(--tc); }
.tm-slot.on { background: linear-gradient(180deg, rgba(255,216,74,.16), rgba(6,8,20,.8)); transform: translateY(-2px);
  box-shadow: 0 0 0 2px #000, inset 0 0 0 2px var(--gold), 0 0 16px rgba(255,216,74,.45), 0 4px 0 #000; }
.tm-slot.on::after { content: ""; position: absolute; left: 50%; top: -9px; width: 12px; height: 7px; margin-left: -6px; background: var(--gold);
  clip-path: polygon(0 0, 100% 0, 50% 100%); animation: arrow-nudge-y .6s steps(2) infinite; }
.tm-card { width: clamp(56px, 7.4vw, 100px); }
.tm-num { position: absolute; left: 2px; top: 2px; z-index: 1; min-width: 12px; padding: 3px 3px 2px; font-style: normal; font-size: 7px; text-align: center;
  color: #14141c; background: var(--tc); box-shadow: 0 0 0 2px #000; }
.tm-q { font-size: clamp(14px, 2vw, 26px); color: #ffd84a; text-shadow: 2px 2px 0 #b3261e; }
.tm-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.tm-name { font-weight: normal; font-size: clamp(7px, .85vw, 11px); color: #fff; text-shadow: 2px 2px 0 #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-ctls { display: flex; gap: 0; box-shadow: 0 0 0 2px #000; align-self: flex-start; }
.tm-ctls button { font: inherit; font-size: clamp(6px, .7vw, 9px); min-width: 30px; height: 22px; padding: 0 5px; color: #9fb3e6; background: #121933; border: 0; cursor: pointer;
  box-shadow: inset -1px 0 0 #000; }
.tm-ctls button:hover { color: #fff; background: #2d3b66; }
.tm-ctls button.on { color: #14141c; background: linear-gradient(180deg, #fff3a8, #ffd84a 60%, #e6b820); text-shadow: none; }
.tm-ctls button[data-ctl="p2"].on { background: linear-gradient(180deg, #c6f0ff, #5fd0ff 60%, #2a9ad0); }
.tm-ctls button[data-ctl="cpu"].on { background: linear-gradient(180deg, #e2e9fb, #9fb3e6 60%, #6f84c4); }
.tm-step { display: flex; gap: 6px; }
.tm-step .st-arrow { width: 24px; height: 22px; }
.tm-step .st-arrow::before { width: 6px; height: 8px; }
.tm-vs { align-self: center; font-size: clamp(16px, 2.6vw, 34px); color: #ffd84a; text-shadow: 3px 3px 0 #b3261e, 5px 5px 0 #000; animation: vs-throb 1.2s steps(2) infinite; }
@keyframes vs-throb { 50% { transform: scale(1.08); } }
.tm-row { display: flex; gap: 12px 16px; align-items: stretch; justify-content: center; width: min(1100px, 100%); }
.tm-map, .tm-cpu { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; box-sizing: border-box; }
.tm-cpu { justify-content: center; min-width: 220px; }
.tm-map-pv { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.tm-map-pv canvas { width: clamp(120px, 13vw, 176px); aspect-ratio: 16 / 9; image-rendering: pixelated; display: block; box-shadow: 0 0 0 2px #000, 0 0 0 4px #3b4c86; }
.tm-map-pv b, .stepper > b.tm-lvl { font-weight: normal; color: #ffd84a; font-size: clamp(7px, .8vw, 10px); letter-spacing: 1px; min-width: 70px; text-align: center; text-shadow: 2px 2px 0 #000; }
.tm-actions { display: flex; flex-direction: column; gap: 12px; justify-content: center; min-width: 280px; }
.tm-actions .mbtn { width: 100%; box-sizing: border-box; }
.tm-roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(40px, 4.4vw, 62px), 1fr)); gap: 5px; width: min(1100px, 100%); box-sizing: border-box;
  padding: 10px; flex: 1 1 auto; min-height: 72px; overflow-y: auto; align-content: start; }
.tm-roster { grid-auto-rows: clamp(28px, 2.9vw, 42px); }
.tm-pick { padding: 0; border: 0; background: #141a38; box-shadow: 0 0 0 2px #000; cursor: pointer; display: grid; place-items: center; overflow: hidden;
  transition: transform .08s steps(2); }
.tm-pick img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; image-rendering: pixelated; }
.tm-pick.on { box-shadow: 0 0 0 2px #000, inset 0 0 0 2px #ffd84a, 0 0 12px rgba(255,216,74,.6); transform: translateY(-2px); position: relative; z-index: 1; }
.tm-pick.lock img { filter: grayscale(1) brightness(.45); }
.tm-pick:hover { filter: brightness(1.2); transform: translateY(-2px); }
.tm-pick:active { transform: translateY(1px); }
.tm-help { font-size: clamp(6px, .65vw, 8px); color: #9fb3e6; text-align: center; line-height: 1.8; text-shadow: 2px 2px 0 #000; }
.tm-help.warn { color: #ff8a6a; animation: acc-shake .3s steps(4); }
@media (orientation: landscape) and (max-height: 500px) {
  .tm-teams { gap: 8px; }
  .tm-side { padding: 0 6px 6px; gap: 6px; }
  .tm-side h3 { font-size: 7px; padding: 4px 6px 3px; margin: 0 -6px; letter-spacing: 2px; }
  .tm-slots { gap: 6px; }
  .tm-slot { padding: 4px; gap: 6px; }
  .tm-slot.on::after { display: none; }
  .tm-card { width: 46px; }
  .tm-num { font-size: 6px; padding: 2px 2px 1px; min-width: 9px; }
  .tm-info { gap: 3px; }
  .tm-name { font-size: 7px; }
  .tm-ctls { align-self: stretch; }
  .tm-ctls button { flex: 1; min-width: 0; height: 40px; font-size: 7px; padding: 0 2px; }
  .tm-step { display: none; }
  .tm-vs { font-size: 13px; }
  .tm-row { gap: 8px; }
  .tm-map, .tm-cpu { padding: 6px 8px; gap: 4px; min-width: 0; }
  .tm-map .mode-label, .tm-cpu .mode-label { font-size: 6px; }
  .tm-map-pv { flex-direction: row; gap: 6px; }
  .tm-map-pv canvas { width: 64px; }
  .tm-map-pv b { min-width: 0; max-width: 80px; font-size: 7px; line-height: 1.5; white-space: normal; }
  .stepper > b.tm-lvl { min-width: 64px; font-size: 7px; }
  .tm-actions { flex-direction: row; gap: 10px; min-width: 0; flex: 1; }
  .tm-actions .mbtn { min-height: 48px; padding: 6px 10px; column-gap: 8px; }
  .tm-actions .mbtn .ico { width: 26px; height: 26px; }
  .tm-actions .mbtn small { display: none; }
  .tm-actions .mbtn .lbl { grid-row: 1 / span 2; white-space: normal; line-height: 1.4; }
  .mode-scr .tm-actions .mbtn.hero .lbl { font-size: 11px; letter-spacing: 1px; white-space: nowrap; }
  .mode-scr .tm-actions .mbtn .lbl { font-size: 8px; }
  .tm-roster { grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); grid-auto-rows: 44px; padding: 6px; gap: 4px; min-height: 60px; }
  .tm-help { display: none; }
}
/* móviles apaisados más estrechos (y con muesca): las opciones encogen y los botones se reparten el resto */
@media (orientation: landscape) and (max-height: 500px) and (max-width: 900px) {
  .tm-map, .tm-cpu { flex: 0 1 auto; padding: 5px 6px; }
  .tm-map-pv canvas { width: 52px; }
  .tm-map-pv b { max-width: 72px; font-size: 6px; overflow-wrap: anywhere; }
  .stepper > b.tm-lvl { min-width: 0; font-size: 6px; }
  .tm-map .stepper, .tm-cpu .stepper { gap: 4px; }
  .tm-map .st-arrow, .tm-cpu .st-arrow { width: 36px; min-width: 36px; }
  .tm-actions { flex: 1 1 0; min-width: 0; gap: 8px; }
  .tm-actions .mbtn { flex: 1 1 0; min-width: 0; padding: 4px 6px; }
  .tm-actions .mbtn .ico { display: none; }
  .tm-actions .mbtn { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
  .mode-scr .tm-actions .mbtn.hero .lbl { font-size: 9px; letter-spacing: 0; white-space: normal; }
  .mode-scr .tm-actions .mbtn .lbl { font-size: 7px; letter-spacing: 0; }
}
@media (orientation: landscape) and (max-height: 500px) and (max-width: 640px) {
  .tm-map .mode-label, .tm-cpu .mode-label { display: none; }
  .tm-map-pv b { display: none; }
  .tm-ctls button { font-size: 6px; letter-spacing: 0; padding: 0; }
}
@media (max-width: 860px) and (orientation: portrait) {
  .tm-teams { grid-template-columns: 1fr; }
  .tm-vs { text-align: center; }
  .tm-row { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { .tm-vs, .tm-slot.on::after { animation: none; } }
/* grupo online (#party, team_online.js): a la izquierda tu equipo (los dos del grupo, en azul) y tu luchador; a la
   derecha el código grande, copiar el enlace y unirse con un código. Debajo, el "buscando" y los botones. */
.pt-wrap { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(10px, 1.6vw, 18px); width: min(980px, 100%); flex: none; }
.pt-team { display: flex; flex-direction: column; gap: 12px; padding: 0 12px 12px; box-shadow: 0 0 0 2px #000, inset 0 0 0 2px var(--tc), inset 0 0 0 4px rgba(0,0,0,.45), 0 8px 0 rgba(0,0,0,.35); }
.pt-band { margin: 0 -12px; padding: 7px 10px 6px; font-weight: normal; font-size: clamp(8px, 1vw, 11px); letter-spacing: 3px; text-align: center; color: #fff; text-shadow: 2px 2px 0 #000;
  background: linear-gradient(180deg, var(--tl) 0 2px, var(--tc) 2px 60%, var(--td)); box-shadow: inset 0 0 0 2px rgba(0,0,0,.35), 0 2px 0 #000; }
.pt-members { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pt-member { display: flex; gap: 10px; align-items: center; padding: 8px; min-height: 84px; box-sizing: border-box; min-width: 0;
  background: rgba(6,8,20,.72); box-shadow: 0 0 0 2px #000, inset 0 0 0 2px color-mix(in srgb, var(--tc) 45%, #1a2246); animation: panel-in .3s steps(4) both; }
.pt-member.me { box-shadow: 0 0 0 2px #000, inset 0 0 0 2px var(--tc), 0 0 14px color-mix(in srgb, var(--tc) 40%, transparent); }
.pt-member.mode-empty { animation: none; }
.pt-member .pt-or { color: #6a789e; }
.pt-member .tm-card { width: clamp(60px, 7.4vw, 96px); }
.pt-who { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pt-who b { font-weight: normal; font-size: clamp(8px, .95vw, 12px); color: #fff; text-shadow: 2px 2px 0 #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-who small { font-size: 7px; color: var(--tl); letter-spacing: 1px; }
.pt-tags { display: flex; gap: 6px; }
.pt-tags:empty { display: none; }
.pt-tag { font-style: normal; font-size: 7px; padding: 3px 5px 2px; color: #14141c; background: var(--gold); box-shadow: 0 0 0 2px #000; }
.pt-tag.me { background: #5fd0ff; }
.pt-hero { display: flex; flex-direction: column; gap: 8px; }
.pt-hero .stepper b { font-size: clamp(9px, 1vw, 12px); color: var(--gold); }
.pt-side { display: flex; flex-direction: column; gap: 14px; padding: 12px 14px; }
.pt-code { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-bottom: 12px; border-bottom: 2px solid rgba(0,0,0,.35); box-shadow: 0 1px 0 rgba(159,179,230,.12); }
.pt-code .mode-label { align-self: stretch; }
.pt-code-v { font-weight: normal; font-size: clamp(20px, 2.6vw, 32px); letter-spacing: 8px; padding-left: 8px; color: var(--gold); text-shadow: 3px 3px 0 #b3261e, 5px 5px 0 #000; }
.pt-code-v.pop { animation: code-pop .4s steps(4); }
.pt-code .mbtn.mini, .pt-join .mbtn.mini { min-height: 36px; justify-content: center; }
.pt-copy { align-self: stretch; }
.pt-join { display: flex; flex-direction: column; gap: 8px; }
.pt-join-row { display: flex; gap: 8px; }
.pt-join input { flex: 1; min-width: 0; font: inherit; font-size: 12px; letter-spacing: 5px; text-align: center; text-transform: uppercase; padding: 9px 6px; color: var(--ink);
  background: #060814; border: 0; outline: none; box-shadow: 0 0 0 2px #000, inset 0 0 0 2px #26325c; }
.pt-join input::placeholder { color: #3b4c86; letter-spacing: 3px; }
.pt-join input:focus { box-shadow: 0 0 0 2px #000, inset 0 0 0 2px var(--gold), 0 0 14px rgba(255,216,74,.3); }
.pt-join-go { flex: none; }
.pt-searching { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 12px; width: min(560px, 100%); padding: 10px 14px; box-sizing: border-box;
  font-size: 9px; letter-spacing: 1px; color: var(--gold); text-shadow: 2px 2px 0 #000; background: rgba(0,0,0,.4); box-shadow: 0 0 0 2px #000, inset 0 0 0 2px #3b4c86; }
.pt-searching[hidden] { display: none; }
.pt-searching .mode-scan { flex-basis: 100%; }
.pt-actions { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.pt-actions .mbtn { min-width: 260px; }
.pt-actions .mbtn.mini { min-width: 200px; justify-content: center; }
#party.queued .pt-team { animation: none; box-shadow: 0 0 0 2px #000, inset 0 0 0 2px var(--gold), inset 0 0 0 4px rgba(0,0,0,.45), 0 8px 0 rgba(0,0,0,.35), 0 0 22px rgba(255,216,74,.35); }
.big-btn[disabled] { opacity: .45; pointer-events: none; }
@media (orientation: landscape) and (max-height: 500px) {
  .pt-wrap { gap: 10px; }
  .pt-team { gap: 6px; padding: 0 8px 8px; }
  .pt-band { margin: 0 -8px; font-size: 7px; padding: 4px 6px 3px; }
  .pt-members { gap: 6px; }
  .pt-member { min-height: 62px; padding: 5px; gap: 6px; }
  .pt-member.mode-empty { font-size: 6px; gap: 2px; }
  .pt-member.mode-empty::before { font-size: 12px; }
  .pt-member .pt-or { display: none; }
  .pt-member .tm-card { width: 48px; }
  .pt-who { gap: 3px; }
  .pt-who b { font-size: 8px; }
  .pt-tag { font-size: 6px; padding: 2px 3px 1px; }
  .pt-hero { flex-direction: row; align-items: center; gap: 8px; }
  .pt-hero .mode-label { flex: none; }
  .pt-hero .mode-label::after { display: none; }
  .pt-hero .stepper { flex: 1; }
  .pt-side { gap: 6px; padding: 8px 10px; }
  .pt-code { gap: 4px; padding-bottom: 6px; flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .pt-code-v { font-size: 18px; letter-spacing: 5px; }
  .pt-code .mbtn.mini, .pt-join .mbtn.mini { min-height: 44px; }
  .pt-join { gap: 4px; }
  .pt-join input { font-size: 11px; padding: 6px; }
  .pt-searching { padding: 6px 10px; font-size: 8px; gap: 4px 10px; }
  .pt-actions { gap: 10px; flex-wrap: nowrap; }
  .pt-actions .mbtn { min-width: 0; min-height: 48px; padding: 6px 12px; }
  .pt-actions .mbtn small { display: none; }
  .pt-actions .mbtn .lbl { grid-row: 1 / span 2; }
  .mode-scr .pt-actions .mbtn.hero .lbl { font-size: 11px; letter-spacing: 1px; }
  .pt-actions .mbtn .ico { width: 26px; height: 26px; }
}
@media (max-width: 860px) and (orientation: portrait) { .pt-wrap { grid-template-columns: 1fr; } }

/* botón OBJETIVO del táctil (combate 2 contra 2) */
#team-swap { display: none; position: fixed; z-index: 40; right: calc(env(safe-area-inset-right, 0px) + 14px); top: 21%; font: inherit; font-size: 9px; padding: 10px 12px;
  color: #fff; background: rgba(47,140,255,.55); border: 0; box-shadow: 0 0 0 2px #000, inset 0 0 0 2px rgba(255,255,255,.4); touch-action: none; }
#team-swap.on { display: block; }

/* torneos de 8 (tournament.js) */
.mbtn.feat.tourbtn { --b: #e0a020; --d: #6a4508; --l: #fff07a; --g: rgba(255,216,74,.6); }
.mbtn.feat.tourbtn, .mbtn.feat.tourbtn:hover, .mbtn.feat.tourbtn:focus-visible, .mbtn.feat.tourbtn.sel { background-image:
    radial-gradient(circle at 90% 130%, rgba(255,255,255,.35), transparent 55%),
    repeating-linear-gradient(45deg, transparent 0 10px, rgba(255,255,255,.08) 10px 12px),
    linear-gradient(180deg, #fff3b0 0 2px, #ffcc40 2px 35%, #e0a020 35% 75%, #6a4508 75%); background-size: auto; background-position: 0 0; }
/* compactos en el menú (una fila: icono + nombre) para no empujar el resto del menú fuera de la pantalla */
.menu-main .mbtn.feat.team2v2, .menu-main .mbtn.feat.tourbtn { min-height: clamp(40px, 6.2vh, 62px); grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto; align-items: center; column-gap: 10px;
  padding-top: clamp(6px, 1vh, 10px); padding-bottom: clamp(6px, 1vh, 10px); }
.menu-main .mbtn.feat.team2v2 small, .menu-main .mbtn.feat.tourbtn small { display: none; }
.menu-main .mbtn.feat.team2v2 .ico, .menu-main .mbtn.feat.tourbtn .ico { width: clamp(24px, 3.4vh, 36px); height: clamp(24px, 3.4vh, 36px); }
.menu-main .mbtn.feat.team2v2 .feat-tag, .menu-main .mbtn.feat.tourbtn .feat-tag { top: 50%; transform: translateY(-50%); }
/* móvil apaisado: RANKED, SMASH, 2 VS 2 y TORNEO en una sola fila (si no, la última fila del menú se sale) */
@media (orientation: landscape) and (max-height: 500px) {
  .mgroup.featured.with-team { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .menu-main .mgroup.featured.with-team .mbtn.feat { grid-template-columns: minmax(0, 1fr); justify-items: center; padding-left: 4px; padding-right: 4px; min-height: 44px; }
  .menu-main .mgroup.featured.with-team .mbtn.feat .ico { display: none; }
  .menu-main .mgroup.featured.with-team .mbtn.feat .lbl { font-size: 9px; letter-spacing: 0; }
}
/* CON AMIGOS del torneo: el azul del online */
.mbtn.feat.tourfr { --b: #2f8cff; --d: #102a6a; --l: #b4e0ff; --g: rgba(79,180,255,.6); }
.mbtn.feat.tourfr, .mbtn.feat.tourfr:hover, .mbtn.feat.tourfr:focus-visible, .mbtn.feat.tourfr.sel { background-image:
    radial-gradient(circle at 90% 130%, rgba(180,224,255,.4), transparent 55%),
    repeating-linear-gradient(135deg, transparent 0 10px, rgba(255,255,255,.07) 10px 12px),
    linear-gradient(180deg, #b4e0ff 0 2px, #4fb4ff 2px 35%, #2f8cff 35% 75%, #102a6a 75%); background-size: auto; background-position: 0 0; }

/* ---- pantalla del torneo (#tour, tournament.js) */
#tour { overflow-x: hidden; }
/* tourRender repinta con cada mensaje del servidor: la entrada de los paneles solo al cambiar de vista (.enter) */
#tour.sub-screen:not(.hidden) .panel { animation: none; }
#tour.sub-screen:not(.hidden) .tr-body.enter .panel { animation: panel-in .35s .06s steps(5) both; }
.tr-body { display: flex; flex-direction: column; align-items: center; gap: clamp(10px, 1.8vh, 18px); width: min(1100px, 100%); flex: none; }
/* entrada: los dos modos, tu luchador y unirse con código; debajo, las rondas */
.tr-entry { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: clamp(12px, 1.8vw, 20px); width: min(900px, 100%); align-items: stretch; }
.tr-modes { display: flex; flex-direction: column; gap: 14px; }
.tr-modes .mbtn.feat { flex: 1; min-height: clamp(84px, 13vh, 124px); grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; align-items: center; column-gap: 16px; row-gap: 8px; }
.tr-modes .mbtn.feat .ico { grid-row: 1 / span 2; grid-column: 1; width: clamp(40px, 6vh, 56px); height: clamp(40px, 6vh, 56px); }
.tr-modes .mbtn.feat .lbl { grid-column: 2; align-self: end; }
.tr-modes .mbtn.feat small { grid-column: 2; align-self: start; display: block; }
.mode-scr .tr-modes .mbtn.feat .lbl { font-size: clamp(12px, 2vh, 20px); }
.tr-side { display: flex; flex-direction: column; gap: 14px; padding: 12px 14px; box-sizing: border-box; }
.tr-hero { display: flex; gap: 12px; align-items: center; }
.tr-hero-port { width: clamp(64px, 7vw, 96px); }
.tr-hero-sel { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.tr-hero .stepper b { color: var(--gold); }
.tr-steps { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; }
.tr-steps li { font-size: 7px; letter-spacing: 1px; color: #c9d3ee; padding: 5px 7px 4px; background: rgba(8,10,26,.8); box-shadow: 0 0 0 2px #000, inset 0 0 0 2px #26325c; text-shadow: 1px 1px 0 #000; }
.tr-steps li + li::before { content: ""; display: inline-block; width: 6px; height: 8px; margin: 0 10px 0 -2px; background: var(--gold); clip-path: polygon(0 0, 100% 50%, 0 100%); vertical-align: -1px; }
.tr-steps li.cup { color: #14141c; background: linear-gradient(180deg, #fff3a8, #ffd84a 60%, #e6b820); box-shadow: 0 0 0 2px #000; text-shadow: none; }
.tr-help { margin: 0; font-size: 8px; color: #9fb3e6; text-align: center; line-height: 1.8; text-shadow: 2px 2px 0 #000; }
/* sala con amigos: código y tu luchador a la izquierda, los 8 jugadores a la derecha */
.tr-lobby-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); gap: clamp(12px, 1.8vw, 20px); width: min(1000px, 100%); }
.tr-players { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; }
.tr-lobby { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; width: 100%; }
.tr-player { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px; min-width: 0; min-height: 84px; box-sizing: border-box;
  background: rgba(6,8,20,.72); box-shadow: 0 0 0 2px #000, inset 0 0 0 2px #2d3b66; }
.tr-body.enter .tr-player:not(.mode-empty) { animation: panel-in .3s steps(4) both; }
.tr-player.me { box-shadow: 0 0 0 2px #000, inset 0 0 0 2px #5fd0ff, 0 0 12px rgba(95,208,255,.35); }
.tr-player .mode-port { width: 100%; max-width: 92px; }
.tr-player b { font-weight: normal; font-size: clamp(6px, .7vw, 8px); color: #fff; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 1px 1px 0 #000; }
.tr-player .pt-tag { position: absolute; top: -7px; left: 50%; transform: translateX(-50%); font-size: 6px; white-space: nowrap; }
/* cuadro: cabeceras de ronda arriba y columnas unidas por líneas (--G: hueco entre columnas) */
.tr-bracket { --G: clamp(18px, 2.6vw, 36px); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, .8fr); grid-template-rows: auto 1fr;
  column-gap: var(--G); row-gap: 10px; width: 100%; }
.tr-bracket h4 { margin: 0; font-weight: normal; font-size: clamp(6px, .7vw, 9px); letter-spacing: 1px; text-align: center; padding: 5px 4px 4px; color: #8d99c6;
  background: rgba(8,10,26,.7); box-shadow: 0 0 0 2px #000, inset 0 0 0 2px #26325c; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-bracket h4.past { color: #c9d3ee; }
.tr-bracket h4.on { color: #14141c; background: linear-gradient(180deg, #fff3a8, #ffd84a 60%, #e6b820); box-shadow: 0 0 0 2px #000, 0 0 14px rgba(255,216,74,.5); animation: tr-head 1.2s steps(2) infinite; }
.tr-bracket h4.cup { color: var(--gold); }
.tr-bracket h4.cup.on { color: #14141c; }
@keyframes tr-head { 50% { box-shadow: 0 0 0 2px #000, 0 0 4px rgba(255,216,74,.3); } }
.tr-col { position: relative; display: flex; flex-direction: column; min-width: 0; }
.tr-body.enter .tr-col { animation: tr-col-in .4s steps(5) both; animation-delay: calc(var(--i) * 90ms); }
@keyframes tr-col-in { from { opacity: 0; transform: translateX(-14px); } }
.tr-pair { position: relative; flex: 1; padding: 4px 0; display: flex; flex-direction: column; justify-content: space-around; gap: 8px; }
.tr-pair:not(.solo)::after { content: ""; position: absolute; right: calc(var(--G) / -2 - 1px); top: 25%; bottom: 25%; width: 2px; background: #3b4c86; box-shadow: 1px 0 0 #000; }
.tr-match { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 4px; background: rgba(8,10,26,.78); box-shadow: 0 0 0 2px #000, inset 0 0 0 1px #26325c; }
.tr-match::after { content: ""; position: absolute; left: 100%; top: 50%; width: calc(var(--G) / 2); height: 2px; margin-top: -1px; background: #3b4c86; box-shadow: 0 1px 0 #000; }
.tr-col.r1 .tr-match::before, .tr-col.r2 .tr-match::before { content: ""; position: absolute; right: 100%; top: 50%; width: calc(var(--G) / 2); height: 2px; margin-top: -1px; background: #3b4c86; box-shadow: 0 1px 0 #000; }
.tr-col.r2 .tr-match::after { width: var(--G); }
.tr-col.on .tr-match.next { box-shadow: 0 0 0 2px #000, inset 0 0 0 2px #ffd84a, 0 0 14px rgba(255,216,74,.35); }
.tr-match.mine { box-shadow: 0 0 0 2px #000, inset 0 0 0 2px #5fd0ff; }
.tr-col.on .tr-match.mine.next { box-shadow: 0 0 0 2px #000, inset 0 0 0 2px #5fd0ff, 0 0 16px rgba(95,208,255,.5); animation: tr-mine 1s steps(2) infinite; }
@keyframes tr-mine { 50% { box-shadow: 0 0 0 2px #000, inset 0 0 0 2px #ffd84a, 0 0 16px rgba(255,216,74,.5); } }
.tr-match.live { animation: tr-live 1s steps(2) infinite; }
@keyframes tr-live { 50% { box-shadow: 0 0 0 2px #000, inset 0 0 0 2px #ff4f7a; } }
.tr-chip { display: flex; align-items: center; gap: 6px; padding: 3px 6px 3px 3px; min-height: 28px; box-sizing: border-box; background: #121933; box-shadow: inset 3px 0 0 #2d3b66; min-width: 0; }
.tr-chip.empty { color: #4a5a8a; }
.tr-chip.empty .tr-face { background: repeating-linear-gradient(45deg, #0b0e22 0 3px, #141a38 3px 6px); }
.tr-chip b { font-weight: normal; font-size: clamp(6px, .7vw, 9px); color: #e8ecf8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 1px 1px 0 #000; }
.tr-face { flex: none; width: 36px; height: 24px; overflow: hidden; display: grid; place-items: center; background: #0b0e22; box-shadow: 0 0 0 1px #000; }
.tr-face img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.tr-face .tm-q { font-size: 10px; }
.tr-chip.me b { color: #5fd0ff; }
.tr-chip.me { box-shadow: inset 3px 0 0 #5fd0ff; }
.tr-chip.won { background: linear-gradient(90deg, #4a3a08, #2a2206); box-shadow: inset 3px 0 0 #ffd84a; }
.tr-chip.won b { color: #fff3b0; }
.tr-chip.won::after { content: ""; flex: none; margin-left: auto; width: 6px; height: 8px; background: var(--gold); clip-path: polygon(0 0, 100% 50%, 0 100%); }
.tr-chip.lost, .tr-chip.gone { opacity: .42; }
.tr-chip.lost .tr-face img { filter: grayscale(1); }
.tr-chip.fresh { animation: tr-fresh .7s steps(6) both; }
@keyframes tr-fresh { 0% { filter: brightness(3); transform: translateX(-8px); } 40% { filter: brightness(1.8); } 100% { filter: none; transform: none; } }
.tr-human { width: 6px; height: 6px; background: #5fe08a; flex: none; margin-left: auto; box-shadow: 0 0 0 1px #000; }
.tr-chip.won .tr-human { margin-left: 4px; order: 3; }
/* campeón */
.tr-champ { align-items: center; justify-content: center; gap: 8px; }
.tr-champ::before { content: ""; position: absolute; left: 50%; top: 50%; width: 180%; aspect-ratio: 1; transform: translate(-50%, -50%); pointer-events: none; opacity: 0; transition: opacity .4s;
  background: repeating-conic-gradient(from 0deg, rgba(255,216,74,.18) 0 10deg, transparent 10deg 20deg);
  -webkit-mask-image: radial-gradient(circle, #000 20%, transparent 65%); mask-image: radial-gradient(circle, #000 20%, transparent 65%); }
.tr-champ.done::before { opacity: 1; animation: tr-rays 12s linear infinite; }
@keyframes tr-rays { to { transform: translate(-50%, -50%) rotate(360deg); } }
.tr-trophy { position: relative; }
.tr-trophy img { display: block; width: clamp(48px, 6vw, 92px); image-rendering: pixelated; filter: drop-shadow(0 0 10px rgba(255,216,74,.5)); }
.tr-champ:not(.done) .tr-trophy img { filter: grayscale(.6) brightness(.7); }
.tr-champ.done .tr-trophy img { filter: drop-shadow(0 0 14px rgba(255,216,74,.7)); animation: tr-cup 1.6s steps(2) infinite; }
@keyframes tr-cup { 50% { transform: translateY(-4px); } }
.tr-champ-port { position: relative; width: clamp(64px, 7vw, 100px); }
.tr-champ-port.mode-empty { aspect-ratio: 4 / 3; }
.tr-champ.fresh .tr-champ-port { animation: port-pop .5s steps(4) both; }
.tr-champ-name { position: relative; font-weight: normal; font-size: clamp(7px, .8vw, 10px); color: #fff3b0; text-shadow: 2px 2px 0 #000; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-champ.mine .tr-champ-name { color: #5fd0ff; }
#tour .tr-status.win { color: #14141c; background: linear-gradient(180deg, #fff3a8, #ffd84a 60%, #e6b820); box-shadow: 0 0 0 2px #000, 0 0 20px rgba(255,216,74,.5); text-shadow: none; animation: code-pop .4s steps(4); }
#tour .pt-actions .mbtn.hero { min-width: 320px; }
@media (orientation: landscape) and (max-height: 500px) {
  .tr-body { gap: 8px; }
  .tr-entry, .tr-lobby-wrap { gap: 10px; }
  .tr-modes { gap: 10px; }
  .tr-modes .mbtn.feat { min-height: 64px; padding: 8px 12px; row-gap: 5px; }
  .tr-modes .mbtn.feat small { font-size: 6px; }
  .mode-scr .tr-modes .mbtn.feat .lbl { font-size: 12px; }
  .tr-modes .mbtn.feat .ico { width: 26px; height: 26px; }
  .tr-side, .tr-players { gap: 8px; padding: 8px 10px; }
  .tr-hero-port { width: 52px; }
  .tr-hero-sel { gap: 4px; }
  .tr-help { display: none; }
  .tr-steps li { font-size: 6px; padding: 4px 5px 3px; }
  .tr-lobby { gap: 6px; }
  .tr-player { min-height: 0; padding: 4px; gap: 3px; }
  .tr-player .mode-port { max-width: 58px; }
  .tr-bracket { --G: 16px; row-gap: 6px; }
  .tr-bracket h4 { font-size: 6px; padding: 3px 2px 2px; }
  .tr-face { width: 26px; height: 18px; }
  .tr-chip { min-height: 20px; padding: 1px 4px 1px 1px; gap: 4px; }
  .tr-chip b { font-size: 6px; }
  .tr-pair { gap: 4px; }
  .tr-match { padding: 2px; gap: 2px; }
  .tr-trophy img { width: 40px; }
  .tr-champ { gap: 4px; }
  .tr-champ-port { width: 52px; }
  #tour .pt-actions .mbtn.hero { min-width: 260px; }
}
/* móviles apaisados muy estrechos (568 x 320): tu luchador sin retrato en la sala para que quepan las flechas */
@media (orientation: landscape) and (max-height: 500px) and (max-width: 640px) {
  .tr-lobby-wrap { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
  .tr-lobby-wrap .tr-hero-port { display: none; }
  .tr-hero .stepper b { min-width: 0; font-size: 7px; }
  .tr-hero .st-arrow { width: 36px; min-width: 36px; }
  .tr-lobby { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .pt-code-v { font-size: 14px; letter-spacing: 3px; }
}
@media (max-width: 860px) and (orientation: portrait) { .tr-lobby { grid-template-columns: 1fr 1fr; } .tr-entry, .tr-lobby-wrap { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) {
  .tr-body.enter .tr-col, .tr-body.enter .tr-player, .tr-chip.fresh, .tr-champ.done::before, .tr-champ.done .tr-trophy img, .tr-bracket h4.on, .tr-match.live, .tr-col.on .tr-match.mine.next { animation: none; }
}
