/* ===========================================================================
   CHAPAS — el aspecto
   ---------------------------------------------------------------------------
   Es un juego a PANTALLA COMPLETA: la barra del sitio se esconde y todo lo que
   se ve —menús, cancha, resultado— vive dentro de `#cha`, que tapa la ventana.
   Cada pantalla trae su propio «volver», así que no hace falta la barra.

   Va con colores propios y no con las variables del tema: es la misma decisión
   de los otros juegos (Neon, Bloqueo…). Un juego tiene su paleta y no cambia
   con el modo noche del panel.

   Tres cosas a la vista:
     · `[hidden]` se declara aquí, dentro de `#cha`: el sitio NO tiene una regla
       global, así que sin ella un `display:flex` le gana al atributo y las
       pantallas se pintan todas a la vez.
     · Los menús caben en un celular ACOSTADO (360 px de alto): se compactan con
       `max-height`, no solo con el ancho.
     · El escenario se puede GIRAR 90° (`.is-girada`) para quien tiene el
       teléfono en vertical y la rotación bloqueada. Su tamaño sale de la
       ventana al revés (100dvh de ancho, 100vw de alto).
   =========================================================================== */

/* La barra y el pie del sitio sobran: el juego trae sus propios controles. */
body.cha-body .exc-topbar,
body.cha-body .exc-footer,
body.cha-body .exc-toasts-off { display: none !important; }
body.cha-body { overflow: hidden; background: #06110a; }
body.cha-body main { padding: 0 !important; margin: 0 !important; max-width: none !important; }

.cha {
  --cha-verde: #2f8a2f;
  --cha-azul: #2f7bff;
  --cha-rojo: #ff4a5c;
  --cha-oro: #ffd23a;
  --cha-tx: #eef4ff;
  --cha-tx2: #a9bbd6;
  --cha-fondo: #0a1c10;
  --cha-panel: rgba(8, 20, 14, .72);
  --cha-borde: rgba(255, 255, 255, .13);
  --cha-hud: 54px;

  position: fixed; inset: 0; z-index: 4000;
  color: var(--cha-tx);
  font-family: var(--exc-font, system-ui), -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  background: var(--cha-fondo);
  overflow: hidden;
}
.cha *, .cha *::before, .cha *::after { box-sizing: border-box; }
.cha [hidden] { display: none !important; }
.cha button { font: inherit; color: inherit; cursor: pointer; }
.cha svg { width: 1.2em; height: 1.2em; flex: none; }
.cha h1, .cha h2, .cha h3, .cha h4, .cha p { margin: 0; }

/* ── Las pantallas ───────────────────────────────────────────────────────── */
.cha-pant {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  overflow-x: hidden; overflow-y: auto;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background:
    radial-gradient(900px 420px at 50% -8%, rgba(120, 230, 150, .26), transparent 62%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .035) 0 90px, rgba(0, 0, 0, .06) 90px 180px),
    linear-gradient(180deg, #11421f, #07200f 70%, #05150a);
  -webkit-overflow-scrolling: touch;
}
.cha-juego { background: #06110a; overflow: hidden; padding: 0; }

.cha-barra {
  display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  padding: .7rem .9rem; flex: none;
}
.cha-herr { display: flex; gap: .35rem; align-items: center; }
.cha-tit { font-size: 1.15rem; font-weight: 800; letter-spacing: .01em; text-align: center; flex: 1; }
.cha-sub { text-align: center; color: var(--cha-tx2); font-size: .9rem; padding: 0 1rem .6rem; }
.cha-h3 { font-size: 1rem; font-weight: 800; margin-bottom: .2rem; }
.cha-ayuda { color: var(--cha-tx2); font-size: .85rem; margin-bottom: .6rem; }

/* ── Botones ─────────────────────────────────────────────────────────────── */
.cha-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 44px; padding: .55rem 1.05rem;
  border-radius: 12px; border: 1px solid var(--cha-borde);
  background: rgba(255, 255, 255, .08); color: var(--cha-tx);
  font-weight: 700; font-size: .95rem; text-decoration: none; line-height: 1.1;
  transition: transform .12s, background .15s, opacity .15s;
}
.cha-btn:hover { background: rgba(255, 255, 255, .15); }
.cha-btn:active { transform: scale(.97); }
.cha-btn:disabled { opacity: .45; cursor: default; }
.cha-btn-pri { background: linear-gradient(180deg, #ffe066, #ffb81f); color: #2b1a00; border-color: rgba(255, 255, 255, .35); box-shadow: 0 3px 0 #b27a00, 0 8px 18px rgba(0, 0, 0, .35); }
.cha-btn-pri:hover { background: linear-gradient(180deg, #ffe985, #ffc23d); }
.cha-btn-peligro { background: linear-gradient(180deg, #ff6b78, #d92b3f); border-color: rgba(255, 255, 255, .3); box-shadow: 0 3px 0 #8f1626; }
.cha-btn-suave { background: rgba(255, 255, 255, .09); }
.cha-btn-s { min-height: 38px; padding: .35rem .8rem; font-size: .85rem; }

.cha-ib {
  width: 44px; height: 44px; display: inline-grid; place-items: center; flex: none;
  border-radius: 12px; border: 1px solid var(--cha-borde);
  background: rgba(0, 0, 0, .35); padding: 0;
}
.cha-ib:hover { background: rgba(255, 255, 255, .16); }
.cha-ib svg { width: 22px; height: 22px; }
.cha-ib .s-off { display: none; }
.cha-ib.is-off .s-on { display: none; }
.cha-ib.is-off .s-off { display: block; }

/* ── Chips y pastillas ───────────────────────────────────────────────────── */
.cha-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.cha-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .3rem .65rem; border-radius: 999px;
  background: rgba(255, 255, 255, .1); border: 1px solid var(--cha-borde);
  font-size: .85rem; font-weight: 700; white-space: nowrap;
}
.cha-chip svg { width: 1.05em; height: 1.05em; }
.cha-chip-tk { color: var(--cha-oro); border-color: rgba(255, 210, 58, .4); background: rgba(255, 210, 58, .12); }
.cha-chip-tk-mas { color: #7dffa6; border-color: rgba(125, 255, 166, .45); background: rgba(80, 220, 130, .15); font-size: 1.05rem; padding: .4rem .9rem; }
.cha-chip-tk-menos { color: #ff8c97; border-color: rgba(255, 140, 151, .45); background: rgba(255, 74, 92, .14); font-size: 1.05rem; padding: .4rem .9rem; }
.cha-chip-xp { color: #9fd1ff; border-color: rgba(159, 209, 255, .4); background: rgba(80, 150, 255, .14); }
.cha-chip-nv { color: #ffd9a0; border-color: rgba(255, 190, 90, .45); background: rgba(255, 170, 40, .14); }
.cha-chip-ok { color: #9dffbe; border-color: rgba(157, 255, 190, .4); background: rgba(80, 220, 130, .12); }
.cha-pill { display: inline-block; padding: .12rem .55rem; border-radius: 999px; background: rgba(47, 123, 255, .28); border: 1px solid rgba(120, 170, 255, .5); font-size: .78rem; font-weight: 700; }
.cha-beta { font-style: normal; font-size: .62rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: .05rem .35rem; border-radius: 6px; background: rgba(255, 190, 40, .2); color: #ffd27a; margin-left: .3rem; }

/* ── Avatares ────────────────────────────────────────────────────────────── */
.cha-av {
  display: inline-grid; place-items: center; flex: none;
  width: 38px; height: 38px; border-radius: 50%;
  font-weight: 800; font-size: 1rem; color: #fff;
  border: 2px solid rgba(255, 255, 255, .85);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .4);
}
.cha-av-0 { background: radial-gradient(circle at 30% 25%, #7fb2ff, #1e55d8 70%); }
.cha-av { overflow: hidden; }
.cha-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cha-av-1 { background: radial-gradient(circle at 30% 25%, #ff9aa5, #c4182c 70%); }

/* ── MENÚ ────────────────────────────────────────────────────────────────── */
.cha-m {
  flex: 1; display: flex; flex-wrap: wrap; align-content: center; justify-content: center;
  gap: 1.2rem 2.2rem; padding: .4rem 1.2rem 1.6rem; max-width: 1100px; width: 100%; margin: 0 auto;
}
.cha-m-izq, .cha-m-der { flex: 1 1 320px; max-width: 440px; display: flex; flex-direction: column; gap: .9rem; }
.cha-logo { text-align: center; }
.cha-logo-ico { display: inline-grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: radial-gradient(circle at 30% 25%, #7fb2ff, #1e55d8 70%); border: 3px solid #fff; box-shadow: 0 6px 22px rgba(30, 85, 216, .6); }
.cha-logo-ico svg { width: 42px; height: 42px; stroke-width: 1.6; color: #fff; }
.cha-logo h1 { font-size: 2.5rem; font-weight: 700; letter-spacing: .05em; margin-top: .35rem; text-shadow: 0 3px 0 #0a2f9e, 0 6px 18px rgba(0, 0, 0, .55); }
.cha-logo p { color: var(--cha-tx2); font-size: .95rem; margin-top: .1rem; }

.cha-yo { background: var(--cha-panel); border: 1px solid var(--cha-borde); border-radius: 18px; padding: .9rem 1rem; backdrop-filter: blur(6px); }
.cha-yo-cab { display: flex; align-items: center; gap: .7rem; }
.cha-yo-cab .cha-av { width: 46px; height: 46px; font-size: 1.2rem; }
.cha-yo-tx { display: flex; flex-direction: column; gap: .2rem; min-width: 0; align-items: flex-start; }
.cha-yo-nom { font-size: 1.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.cha-xp { height: 9px; border-radius: 99px; background: rgba(255, 255, 255, .14); margin-top: .7rem; overflow: hidden; }
.cha-xp span { display: block; height: 100%; background: linear-gradient(90deg, #5ad1ff, #2f7bff); border-radius: inherit; transition: width .5s; }
.cha-xp-t { display: block; color: var(--cha-tx2); font-size: .75rem; margin-top: .3rem; }
.cha-invita-mini { color: var(--cha-tx2); font-size: .85rem; margin-top: .6rem; }

.cha-retos { display: flex; flex-direction: column; gap: .5rem; }
.cha-reto { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .6rem .8rem; border-radius: 14px; background: rgba(255, 210, 58, .13); border: 1px solid rgba(255, 210, 58, .4); font-size: .9rem; font-weight: 600; }

.cha-cta {
  display: flex; align-items: center; gap: .9rem; text-align: left; width: 100%;
  padding: .85rem 1rem; min-height: 72px; border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, .22);
  background: linear-gradient(180deg, rgba(255, 255, 255, .15), rgba(255, 255, 255, .06));
  box-shadow: 0 4px 0 rgba(0, 0, 0, .35), 0 10px 22px rgba(0, 0, 0, .3);
  transition: transform .12s;
}
.cha-cta:active { transform: translateY(2px) scale(.99); }
.cha-cta-ico { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: rgba(0, 0, 0, .3); flex: none; }
.cha-cta-ico svg { width: 28px; height: 28px; }
.cha-cta-tx { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.cha-cta-tx b { font-size: 1.08rem; }
.cha-cta-tx small { color: var(--cha-tx2); font-size: .82rem; line-height: 1.25; }
.cha-cta-cpu .cha-cta-ico { background: linear-gradient(180deg, #3fd06a, #1c8a3c); }
.cha-cta-pvp .cha-cta-ico { background: linear-gradient(180deg, #ffd23a, #e0900a); color: #2b1a00; }
.cha-cta-como .cha-cta-ico { background: rgba(255, 255, 255, .15); }
.cha-cta-como { min-height: 58px; }
.cha-cta-ch { margin-bottom: .2rem; }

.cha-top { background: var(--cha-panel); border: 1px solid var(--cha-borde); border-radius: 16px; padding: .7rem .9rem; }
.cha-top h4 { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--cha-tx2); margin-bottom: .35rem; }
.cha-top-f { display: flex; align-items: center; gap: .55rem; padding: .22rem 0; font-size: .9rem; }
.cha-top-f b { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cha-top-f.is-yo { color: #7dffb0; }
.cha-top-p { width: 1.4rem; color: var(--cha-tx2); font-weight: 800; }
.cha-top-c { font-weight: 800; color: var(--cha-oro); }

/* ── NIVELES CONTRA LA COMPUTADORA ───────────────────────────────────────── */
.cha-niveles {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem;
  padding: .3rem 1.2rem 1.6rem; max-width: 1000px; width: 100%; margin: 0 auto;
}
.cha-nivel {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: .3rem;
  padding: .9rem .6rem .8rem; border-radius: 18px; text-align: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, .13), rgba(255, 255, 255, .05));
  border: 1px solid var(--cha-borde); box-shadow: 0 4px 0 rgba(0, 0, 0, .3);
  min-height: 132px;
}
.cha-nivel:active { transform: translateY(2px); }
.cha-nivel-n { font-size: 2rem; font-weight: 900; line-height: 1; color: var(--cha-oro); text-shadow: 0 2px 0 rgba(0, 0, 0, .4); }
.cha-nivel-nom { font-size: 1rem; }
.cha-estrellas { display: inline-flex; gap: 2px; }
.cha-estrellas i { width: 9px; height: 9px; background: rgba(255, 255, 255, .2); clip-path: polygon(50% 0, 62% 36%, 100% 38%, 70% 60%, 80% 100%, 50% 76%, 20% 100%, 30% 60%, 0 38%, 38% 36%); }
.cha-estrellas i.on { background: var(--cha-oro); }
.cha-nivel-e { color: var(--cha-tx2); font-size: .78rem; font-weight: 600; }
.cha-nivel.is-actual { border-color: var(--cha-oro); box-shadow: 0 0 0 2px rgba(255, 210, 58, .5), 0 4px 0 rgba(0, 0, 0, .3), 0 0 22px rgba(255, 210, 58, .3); }
.cha-nivel.is-actual .cha-nivel-e { color: var(--cha-oro); }
.cha-nivel.is-ok { background: linear-gradient(180deg, rgba(70, 200, 110, .28), rgba(70, 200, 110, .1)); }
.cha-nivel.is-ok .cha-nivel-e { color: #8dffb0; }
.cha-nivel.is-bloq { opacity: .5; filter: grayscale(.6); }

/* ── DUELO: MESAS ────────────────────────────────────────────────────────── */
.cha-pvp { display: grid; grid-template-columns: 1fr; gap: 1.2rem; padding: .3rem 1.2rem 1.6rem; max-width: 1000px; width: 100%; margin: 0 auto; }
@media (min-width: 720px) { .cha-pvp { grid-template-columns: 1fr 1fr; } }
.cha-pvp-col { display: flex; flex-direction: column; gap: .8rem; min-width: 0; }
.cha-mesas { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: .55rem; }
.cha-mesa {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem;
  min-height: 64px; padding: .5rem; border-radius: 14px;
  border: 1px solid var(--cha-borde); background: rgba(255, 255, 255, .07);
  font-size: 1.15rem; font-weight: 800;
}
.cha-mesa b { display: inline-flex; align-items: center; gap: .3rem; }
.cha-mesa svg { color: var(--cha-oro); }
.cha-mesa small { font-size: .68rem; font-weight: 600; color: var(--cha-tx2); }
.cha-mesa.is-on { border-color: var(--cha-oro); background: rgba(255, 210, 58, .16); box-shadow: 0 0 0 2px rgba(255, 210, 58, .45); }
.cha-mesa.is-no { opacity: .5; }
.cha-bote { color: var(--cha-tx2); font-size: .88rem; line-height: 1.35; }
.cha-bloque { background: var(--cha-panel); border: 1px solid var(--cha-borde); border-radius: 16px; padding: .8rem .9rem; display: flex; flex-direction: column; gap: .55rem; }
.cha-bloque h4 { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--cha-tx2); }
.cha-fila { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.cha-in {
  min-height: 44px; padding: .5rem .8rem; border-radius: 12px; width: 100%;
  background: rgba(0, 0, 0, .35); border: 1px solid var(--cha-borde); color: var(--cha-tx); font: inherit; font-size: 1rem;
}
.cha-in:focus { outline: 2px solid var(--cha-oro); outline-offset: 1px; }
.cha-in-cod { width: 6.2rem; text-align: center; letter-spacing: .35em; font-weight: 800; text-transform: uppercase; }
.cha-gente { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.cha-gente-f { display: flex; align-items: center; gap: .6rem; padding: .35rem .2rem; }
.cha-gente-tx { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.cha-gente-tx b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cha-gente-tx small { color: var(--cha-tx2); }
.cha-gente-vacia { color: var(--cha-tx2); font-size: .88rem; }

.cha-invita { display: flex; flex-direction: column; align-items: center; gap: .6rem; text-align: center; padding: 2rem 1.4rem; max-width: 460px; margin: auto; }
.cha-invita > svg { width: 54px; height: 54px; color: var(--cha-oro); }
.cha-invita p { color: var(--cha-tx2); }
.cha-invita-b { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; margin-top: .4rem; }

/* ── BUSCANDO ────────────────────────────────────────────────────────────── */
.cha-centro { align-items: center; justify-content: center; }
.cha-espera { display: flex; flex-direction: column; align-items: center; gap: .8rem; text-align: center; padding: 1.4rem; max-width: 420px; }
.cha-girando { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 30% 25%, #7fb2ff, #1e55d8 70%); border: 3px solid #fff; animation: cha-gira 1.4s linear infinite; }
.cha-girando svg { width: 50px; height: 50px; color: #fff; }
@keyframes cha-gira { to { transform: rotate(360deg); } }
.cha-sala { display: flex; flex-direction: column; align-items: center; gap: .4rem; padding: .8rem 1.4rem; border-radius: 16px; background: var(--cha-panel); border: 1px dashed rgba(255, 210, 58, .6); }
.cha-sala small { color: var(--cha-tx2); }
.cha-sala b { font-size: 2.6rem; letter-spacing: .35em; padding-left: .35em; color: var(--cha-oro); font-weight: 900; }
.cha-seg { color: var(--cha-tx2); font-variant-numeric: tabular-nums; }
.cha-espera-b { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; }

/* ══════════════════════════════════════════════════════════════════════════
   LA CANCHA
   ══════════════════════════════════════════════════════════════════════════ */
.cha-stage {
  position: absolute; inset: 0; overflow: hidden;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
/* Girado 90° para quien tiene el teléfono en vertical y la rotación bloqueada.
   La caja mide la ventana AL REVÉS; el JS mide `clientWidth/clientHeight` y
   traduce los toques con `getBoundingClientRect`, así que no hay otro cálculo. */
.cha-stage.is-girada {
  inset: auto; top: 0; left: 100vw;
  width: 100vh; height: 100vw;
  width: 100dvh; height: 100dvw;
  transform-origin: top left; transform: rotate(90deg);
}
#cha-canvas { position: absolute; left: 0; top: 0; display: block; touch-action: none; cursor: crosshair; }

.cha-hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr) auto;
  align-items: center; gap: .5rem;
  min-height: var(--cha-hud); padding: 5px max(8px, env(safe-area-inset-right)) 5px max(8px, env(safe-area-inset-left));
  background: linear-gradient(180deg, #2c2f34, #191b1f);
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .45);
}
.cha-hud .cha-ib { width: 40px; height: 40px; border-radius: 10px; }
.cha-lado { display: flex; align-items: center; gap: .5rem; min-width: 0; padding: .15rem .4rem; border-radius: 12px; border-bottom: 3px solid transparent; transition: border-color .2s, background .2s; }
.cha-lado-1 { justify-content: flex-end; text-align: right; }
.cha-lado.is-turno { border-bottom-color: var(--cha-oro); background: rgba(255, 210, 58, .1); }
.cha-nom { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.cha-nom b { font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cha-nom small { color: var(--cha-tx2); font-size: .72rem; font-weight: 700; }
.cha-marcador { display: flex; align-items: center; gap: .5rem; }
.cha-g { font-size: 2rem; font-weight: 900; min-width: 1.4ch; text-align: center; font-variant-numeric: tabular-nums; text-shadow: 0 2px 6px rgba(0, 0, 0, .6); }
.cha-centro-h { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 62px; padding: 3px 8px; border-radius: 10px; background: #f3f4f7; color: #1b1d22; }
.cha-centro-h:empty { display: none; }
.cha-pote { display: inline-flex; align-items: center; gap: .3rem; font-weight: 800; font-size: .85rem; color: #6b4b00; }
.cha-pote svg { color: #e0900a; }
.cha-reloj { font-weight: 900; font-size: 1.1rem; line-height: 1; padding: 2px 8px; border-radius: 8px; background: #d9dce4; color: #42464f; font-variant-numeric: tabular-nums; }
.cha-reloj.is-mio { background: #2f7bff; color: #fff; }
.cha-reloj.is-urge { background: #e0283d; color: #fff; animation: cha-pulso .5s ease-in-out infinite alternate; }
@keyframes cha-pulso { from { transform: scale(1); } to { transform: scale(1.12); } }

.cha-turnos {
  position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); z-index: 2;
  padding: .22rem .85rem; border-radius: 999px; background: rgba(0, 0, 0, .5);
  font-size: .8rem; font-weight: 700; white-space: nowrap; pointer-events: none;
  max-width: 70%; overflow: hidden; text-overflow: ellipsis;
}
.cha-turnos:empty { display: none; }
.cha-turnos.is-mio { background: rgba(47, 123, 255, .75); }

/* El efecto: cómo sale el balón de curvo. Abajo a la izquierda, donde cae el
   pulgar de quien lo lleva con las dos manos. */
.cha-efecto {
  position: absolute; left: max(10px, env(safe-area-inset-left)); bottom: max(10px, env(safe-area-inset-bottom)); z-index: 3;
  display: flex; gap: 6px; padding: 6px; border-radius: 16px; background: rgba(0, 0, 0, .45); border: 1px solid var(--cha-borde);
}
.cha-ef { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border-radius: 12px; border: 1px solid var(--cha-borde); background: rgba(255, 255, 255, .08); }
.cha-ef svg { width: 22px; height: 22px; }
.cha-ef-izq svg { transform: scaleX(-1); }
.cha-ef-0 span { width: 12px; height: 12px; border-radius: 50%; background: currentColor; opacity: .85; }
.cha-ef.is-on { background: var(--cha-oro); color: #2b1a00; border-color: #fff; box-shadow: 0 0 12px rgba(255, 210, 58, .6); }

.cha-aviso {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%) scale(.6); z-index: 4;
  padding: .55rem 1.4rem; border-radius: 16px; background: rgba(0, 0, 0, .72);
  border: 2px solid rgba(255, 255, 255, .55);
  font-size: 1.5rem; font-weight: 900; letter-spacing: .02em; text-align: center; white-space: nowrap;
  max-width: 92%; pointer-events: none; opacity: 0; transition: opacity .15s, transform .22s cubic-bezier(.2, 1.4, .4, 1);
}
.cha-aviso.is-on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.cha-aviso.gol { font-size: 2.6rem; color: var(--cha-oro); border-color: var(--cha-oro); background: rgba(40, 24, 0, .78); text-shadow: 0 0 18px rgba(255, 210, 58, .7); }
.cha-aviso.mal { color: #ffb1b9; border-color: #ff6b78; }
.cha-aviso.tu { color: #a9ccff; border-color: #5a9bff; }
.cha-ido {
  position: absolute; left: 50%; top: calc(var(--cha-hud) + 6px); transform: translateX(-50%); z-index: 3;
  padding: .3rem .9rem; border-radius: 999px; background: rgba(224, 40, 61, .85); font-size: .82rem; font-weight: 700; white-space: nowrap;
}

/* Pedir que se gire el teléfono. */
.cha-gira { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; background: rgba(4, 12, 7, .94); padding: 1.4rem; text-align: center; }
.cha-gira-c { display: flex; flex-direction: column; align-items: center; gap: .8rem; max-width: 340px; }
.cha-gira-ico svg { width: 74px; height: 74px; color: var(--cha-oro); animation: cha-gira-tel 2.2s ease-in-out infinite; }
@keyframes cha-gira-tel { 0%, 20% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
.cha-gira p { color: var(--cha-tx2); }

/* ── RESULTADO Y DIÁLOGOS ────────────────────────────────────────────────── */
.cha-fin { position: absolute; inset: 0; z-index: 10; display: grid; place-items: center; padding: 1rem; background: rgba(3, 9, 5, .72); backdrop-filter: blur(4px); overflow: auto; }
.cha-fin-c {
  width: min(94vw, 440px); max-height: 96%; overflow: auto; text-align: center;
  padding: 1.3rem 1.3rem 1.2rem; border-radius: 22px;
  background: linear-gradient(180deg, #17301f, #0b1a11); border: 1px solid rgba(255, 255, 255, .2);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
  animation: cha-entra .3s cubic-bezier(.2, 1.3, .4, 1);
}
.cha-fin-chico { width: min(92vw, 380px); }
@keyframes cha-entra { from { transform: scale(.85); opacity: 0; } }
.cha-fin h2 { font-size: 1.7rem; font-weight: 900; }
.cha-fin.is-gana .cha-fin-c { border-color: var(--cha-oro); box-shadow: 0 0 40px rgba(255, 210, 58, .3), 0 20px 60px rgba(0, 0, 0, .6); }
.cha-fin.is-gana h2 { color: var(--cha-oro); }
.cha-fin.is-pierde h2 { color: #ff8c97; }
.cha-fin-m { font-size: 3.2rem; font-weight: 900; letter-spacing: .04em; margin: .2rem 0; font-variant-numeric: tabular-nums; }
.cha-fin-s { color: var(--cha-tx2); font-size: .92rem; min-height: 1.2em; }
.cha-fin-chips { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin: .9rem 0 .4rem; min-height: 1px; }
.cha-fin-b { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; margin-top: .9rem; }
.cha-fin-inv { margin-top: .8rem; font-size: .85rem; color: var(--cha-tx2); }
.cha-fin-inv a { color: var(--cha-oro); font-weight: 700; }
.cha-como { text-align: left; }
.cha-como h2 { text-align: center; margin-bottom: .6rem; }
.cha-pasos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .75rem; }
.cha-pasos li { display: flex; gap: .8rem; align-items: flex-start; }
.cha-pasos b { display: block; margin-bottom: .1rem; }
.cha-pasos p { color: var(--cha-tx2); font-size: .88rem; line-height: 1.35; }
.cha-paso-n { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--cha-oro); color: #2b1a00; font-weight: 900; }

/* ══════════════════════════════════════════════════════════════════════════
   PANTALLAS BAJAS: un celular ACOSTADO mide 360-420 px de alto
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-height: 520px) {
  .cha { --cha-hud: 34px; }
  /* La barra de arriba, delgada: cada píxel que ocupa es cancha más chica. */
  .cha-hud { padding-top: 2px; padding-bottom: 2px; gap: .35rem; }
  .cha-hud .cha-ib { width: 30px; height: 30px; border-radius: 8px; }
  .cha-hud .cha-ib svg { width: 18px; height: 18px; }
  .cha-hud .cha-av { width: 26px; height: 26px; font-size: .78rem; border-width: 1.5px; }
  .cha-lado { padding: 0 .3rem; border-bottom-width: 2px; }
  .cha-nom b { font-size: .78rem; }
  .cha-nom small { font-size: .62rem; }
  .cha-g { font-size: 1.3rem; }
  .cha-centro-h { flex-direction: row; gap: .4rem; padding: 1px 7px; min-width: 0; }
  .cha-reloj { font-size: .85rem; padding: 1px 6px; }
  .cha-pote { font-size: .75rem; }
  /* El aviso de turno sobre la cancha tapaba el borde de abajo: aquí lo dice
     la barra (el lado al que le toca se ilumina). */
  .cha-turnos { display: none; }
  /* El efecto, en columna en el margen de la izquierda y no encima del campo. */
  .cha-efecto { flex-direction: column; left: max(4px, env(safe-area-inset-left)); top: 50%; bottom: auto; transform: translateY(-50%); padding: 4px; gap: 4px; border-radius: 14px; }
  .cha-ef { width: 36px; height: 36px; }
  .cha-barra { padding: .35rem .7rem; }
  .cha-m { gap: .6rem 1.4rem; padding: 0 1rem .8rem; flex-wrap: nowrap; align-content: flex-start; }
  .cha-m-izq, .cha-m-der { flex: 1 1 0; max-width: none; gap: .5rem; }
  .cha-logo-ico { width: 48px; height: 48px; }
  .cha-logo-ico svg { width: 28px; height: 28px; }
  .cha-logo h1 { font-size: 1.6rem; margin-top: .15rem; }
  .cha-logo p { display: none; }
  .cha-yo { padding: .55rem .75rem; }
  .cha-yo-cab .cha-av { width: 36px; height: 36px; font-size: 1rem; }
  .cha-xp { margin-top: .4rem; }
  .cha-chips { margin-top: .35rem; }
  .cha-invita-mini { display: none; }
  .cha-cta { min-height: 56px; padding: .5rem .8rem; border-radius: 14px; }
  .cha-cta-ico { width: 38px; height: 38px; }
  .cha-cta-tx small { display: none; }
  .cha-cta-como { min-height: 46px; }
  .cha-top { display: none; }
  .cha-niveles { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .5rem; padding: .2rem .8rem 1rem; }
  .cha-nivel { min-height: 96px; padding: .5rem .3rem; border-radius: 14px; gap: .15rem; }
  .cha-nivel-n { font-size: 1.5rem; }
  .cha-nivel-nom { font-size: .82rem; }
  .cha-sub { padding-bottom: .3rem; font-size: .8rem; }
  .cha-aviso { font-size: 1.2rem; padding: .4rem 1rem; }
  .cha-aviso.gol { font-size: 2rem; }
  .cha-fin-c { padding: .9rem 1rem; }
  .cha-fin h2 { font-size: 1.3rem; }
  .cha-fin-m { font-size: 2.2rem; }
  .cha-fin-chips { margin: .5rem 0 .2rem; }
  .cha-fin-b { margin-top: .5rem; }
}
@media (max-width: 560px) and (min-height: 521px) {
  .cha-niveles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cha-logo h1 { font-size: 2rem; }
  .cha-nom b { max-width: 20vw; }
}
@media (max-width: 700px) {
  .cha-nom small { display: none; }
  .cha-lado { gap: .3rem; padding: .1rem .2rem; }
}
@media (prefers-reduced-motion: reduce) {
  .cha *, .cha *::before, .cha *::after { animation: none !important; transition: none !important; }
}

/* ── Las dos caras del resultado ─────────────────────────────────────────── */
.cha-fin-vs { display: flex; align-items: flex-start; justify-content: center; gap: 1rem; margin-bottom: .5rem; }
.cha-vs-j { position: relative; display: flex; flex-direction: column; align-items: center; gap: .3rem; width: 38%; min-width: 0; transition: opacity .3s, filter .3s; }
.cha-vs-j b { font-size: .88rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cha-av-g { width: 72px; height: 72px; font-size: 1.8rem; border-width: 3px; }
.cha-vs-x { align-self: center; font-weight: 900; color: var(--cha-tx2); font-size: 1rem; letter-spacing: .1em; margin-top: -1.2rem; }
.cha-vs-j.is-gana .cha-av-g { border-color: var(--cha-oro); box-shadow: 0 0 0 3px rgba(255, 210, 58, .35), 0 0 22px rgba(255, 210, 58, .5); }
.cha-vs-j.is-pierde { opacity: .72; filter: grayscale(.55); }
.cha-corona { position: absolute; top: -20px; left: 50%; transform: translateX(-50%) rotate(-8deg); width: 32px !important; height: 32px !important; color: var(--cha-oro); filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .6)); }
@media (max-height: 520px) {
  .cha-av-g { width: 48px; height: 48px; font-size: 1.2rem; border-width: 2px; }
  .cha-fin-vs { margin-bottom: .1rem; gap: .6rem; }
  .cha-corona { width: 22px !important; height: 22px !important; top: -14px; }
  .cha-vs-x { margin-top: -.8rem; }
}

/* ── «1 vs 1»: el botón del menú ─────────────────────────────────────────── */
.cha-cta-uno { border-color: rgba(255, 210, 58, .55); box-shadow: 0 0 0 1px rgba(255, 210, 58, .25), 0 0 26px rgba(255, 210, 58, .16); }
.cha-cta-uno .cha-cta-ico { background: linear-gradient(180deg, #5aa2ff, #1e55d8); color: #fff; }

/* ── El anillo del reloj: rodea el avatar de quien tira y se va gastando ──
   `--r` es lo que queda (de 1 a 0) y lo escribe el JS cada décima de segundo.
   Verde mientras sobra, ámbar a la mitad y rojo en los últimos cinco. */
.cha-anillo {
  --r: 1; --ac: #3fd06a;
  display: inline-grid; place-items: center; flex: none; padding: 4px; border-radius: 50%;
  background: rgba(255, 255, 255, .14); transition: background .2s, box-shadow .2s;
}
.cha-anillo.is-on { background: conic-gradient(var(--ac) calc(var(--r) * 1turn), rgba(255, 255, 255, .14) 0); box-shadow: 0 0 12px color-mix(in srgb, var(--ac) 55%, transparent); }
.cha-anillo.is-med { --ac: #ffb21e; }
.cha-anillo.is-urge { --ac: #ff3b4f; animation: cha-pulso .5s ease-in-out infinite alternate; }
.cha-anillo .cha-av { border-width: 2px; }

/* ── La presentación: quién contra quién, antes del primer tiro ─────────── */
.cha-pres {
  position: absolute; inset: 0; z-index: 7; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.1rem;
  padding: calc(var(--cha-hud) + 8px) 1rem 1rem;
  background: radial-gradient(ellipse at 50% 40%, rgba(14, 40, 26, .93), rgba(4, 12, 8, .97) 75%);
  animation: cha-pres-in .25s ease-out both;
}
.cha-pres[hidden] { display: none; }
@keyframes cha-pres-in { from { opacity: 0; } to { opacity: 1; } }
.cha-pres-c { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 1rem; width: min(760px, 100%); }
.cha-pres-j { display: flex; flex-direction: column; align-items: center; gap: .35rem; min-width: 0; text-align: center; }
.cha-pres-j b { font-size: clamp(1.05rem, 3.6vw, 1.7rem); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cha-pres-j small { color: var(--cha-tx2); font-weight: 800; letter-spacing: .06em; }
.cha-av-xl { width: clamp(72px, 17vh, 118px); height: clamp(72px, 17vh, 118px); font-size: clamp(1.8rem, 6vh, 3rem); border-width: 3px; box-shadow: 0 6px 22px rgba(0, 0, 0, .55); }
.cha-pres-izq { animation: cha-pres-izq .5s cubic-bezier(.2, .9, .3, 1.15) both; }
.cha-pres-der { animation: cha-pres-der .5s cubic-bezier(.2, .9, .3, 1.15) both; }
@keyframes cha-pres-izq { from { transform: translateX(-90px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes cha-pres-der { from { transform: translateX(90px); opacity: 0; } to { transform: none; opacity: 1; } }
.cha-pres-mid { display: flex; flex-direction: column; align-items: center; gap: .5rem; min-width: 7.5rem; position: relative; }
.cha-pres-vs { font-size: clamp(2rem, 8vh, 3.6rem); font-weight: 900; font-style: italic; color: var(--cha-oro); text-shadow: 0 3px 0 rgba(0, 0, 0, .5), 0 0 24px rgba(255, 210, 58, .5); animation: cha-pres-vs .55s .25s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes cha-pres-vs { from { transform: scale(.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.cha-pres-mid small { color: var(--cha-tx2); font-size: .8rem; font-weight: 700; text-align: center; }

/* El bote: dos tickets cruzan desde cada lado y se funden en uno. */
.cha-pres-pote { position: relative; display: grid; place-items: center; height: 2.6rem; width: 100%; }
.cha-pres-tk { position: absolute; top: 50%; left: 50%; width: 1.7rem; height: 1.7rem; color: var(--cha-oro); opacity: 0; }
.cha-pres-tk svg { width: 100%; height: 100%; }
.cha-pres-tk-0 { animation: cha-tk-0 .9s .55s ease-in both; }
.cha-pres-tk-1 { animation: cha-tk-1 .9s .55s ease-in both; }
@keyframes cha-tk-0 { 0% { transform: translate(-190%, -50%) rotate(-20deg); opacity: 1; } 80% { opacity: 1; } 100% { transform: translate(-50%, -50%) scale(.6); opacity: 0; } }
@keyframes cha-tk-1 { 0% { transform: translate(90%, -50%) rotate(20deg); opacity: 1; } 80% { opacity: 1; } 100% { transform: translate(-50%, -50%) scale(.6); opacity: 0; } }
.cha-pres-bote { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .8rem; border-radius: 999px; background: rgba(255, 210, 58, .16); border: 1px solid rgba(255, 210, 58, .6); color: var(--cha-oro); font-weight: 900; font-size: 1.15rem; opacity: 0; animation: cha-bote .45s 1.4s cubic-bezier(.2, 1.6, .4, 1) both; }
.cha-pres-bote svg { width: 1.2rem; height: 1.2rem; }
@keyframes cha-bote { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.cha-pres-tip { max-width: 34rem; text-align: center; color: var(--cha-tx2); font-size: .95rem; line-height: 1.35; padding: .45rem 1rem; border-radius: 999px; background: rgba(255, 255, 255, .07); }
.cha-pres-tip::before { content: attr(data-pre); color: var(--cha-oro); font-weight: 800; margin-right: .4rem; text-transform: uppercase; font-size: .72rem; letter-spacing: .1em; }

@media (max-height: 520px) {
  .cha-anillo { padding: 3px; }
  .cha-hud .cha-av { width: 24px; height: 24px; }
  .cha-pres { gap: .5rem; padding-top: calc(var(--cha-hud) + 2px); }
  .cha-av-xl { width: 64px; height: 64px; font-size: 1.6rem; }
  .cha-pres-pote { height: 2rem; }
  .cha-pres-tip { font-size: .8rem; padding: .25rem .8rem; }
  .cha-cta-uno { box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cha-pres-izq, .cha-pres-der, .cha-pres-vs, .cha-pres-tk, .cha-pres-bote { animation-duration: .01s; animation-delay: 0s; }
  .cha-anillo.is-urge { animation: none; }
}

/* ── Tiro de suerte ──────────────────────────────────────────────────────── */
.cha-cta-suerte { border-color: rgba(180, 107, 255, .6); box-shadow: 0 0 0 1px rgba(180, 107, 255, .25), 0 0 26px rgba(180, 107, 255, .2); }
.cha-cta-suerte .cha-cta-ico { background: linear-gradient(180deg, #c58cff, #7a3fd8); color: #fff; }

/* En esta modalidad la barra de arriba solo lleva «volver», el título y los botones de sonido. */
.cha-sue-tit { display: none; align-items: center; justify-content: center; gap: .5rem; font-size: 1.05rem; color: var(--cha-oro); }
.cha-sue-tit svg { width: 22px; height: 22px; }
.cha[data-modo="suerte"] .cha-sue-tit { display: flex; }
.cha[data-modo="suerte"] .cha-hud { grid-template-columns: auto minmax(0, 1fr) auto; }
.cha[data-modo="suerte"] .cha-lado,
.cha[data-modo="suerte"] .cha-marcador,
.cha[data-modo="suerte"] .cha-turnos { display: none; }

.cha-sue-c { max-width: 460px; }
.cha-sue-ley { list-style: none; margin: .4rem 0 .2rem; padding: 0; display: grid; gap: .35rem; }
.cha-sue-fila { display: flex; align-items: center; gap: .65rem; padding: .4rem .7rem; border-radius: 12px; background: rgba(255, 255, 255, .07); font-weight: 700; text-align: left; }
.cha-sue-fila span { flex: 1; }
.cha-sue-punto { width: 16px; height: 16px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(255, 255, 255, .18); flex: none; }
.cha-sue-tk { display: inline-flex; align-items: center; gap: .3rem; color: var(--cha-oro); }
.cha-sue-tk svg { width: 1.1rem; height: 1.1rem; }
.cha-sue-nota { color: var(--cha-tx2); font-size: .85rem; line-height: 1.35; margin-top: .35rem; }
.cha-sue-viento { font-style: italic; }
.cha-sue-prob { color: #ffd27a; font-weight: 700; }
#cha-sue-jugar:disabled { opacity: .55; cursor: not-allowed; }

@media (max-height: 520px) {
  .cha-sue-c { max-width: 560px; }
  .cha-sue-ley { grid-template-columns: 1fr 1fr; gap: .25rem .5rem; }
  .cha-sue-fila { padding: .25rem .5rem; font-size: .85rem; }
  .cha-sue-nota { font-size: .75rem; margin-top: .15rem; }
}

/* ══ RESULTADO (rediseño) ═══════════════════════════════════════════════════
   Marcador a la izquierda —título, los dos avatares con el resultado en medio—
   y a la derecha lo que se ganó y los botones. Un solo elemento se mueve de
   verdad (la corona del ganador) más una ráfaga de confeti al ganar. */
#cha-fin .cha-res {
  position: relative; width: min(880px, 96vw); max-width: none; padding: 0; text-align: left; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  border-radius: 26px; border: 1px solid rgba(255, 255, 255, .14);
  background: linear-gradient(165deg, #15321f 0%, #0a1a10 100%);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .65);
  animation: cha-res-in .32s cubic-bezier(.2, .9, .3, 1) both;
}
@keyframes cha-res-in { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
#cha-fin.is-gana .cha-res { border-color: rgba(255, 210, 58, .7); box-shadow: 0 0 0 1px rgba(255, 210, 58, .25), 0 0 60px rgba(255, 210, 58, .22), 0 24px 70px rgba(0, 0, 0, .65); }
#cha-fin.is-pierde .cha-res { border-color: rgba(255, 140, 151, .35); }

.cha-res-izq {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .55rem;
  padding: 1.5rem 1.2rem 1.3rem; text-align: center; border-right: 1px solid rgba(255, 255, 255, .09);
  background: radial-gradient(ellipse at 50% -10%, rgba(255, 255, 255, .07), transparent 65%);
}
#cha-fin.is-gana .cha-res-izq { background: radial-gradient(ellipse at 50% -10%, rgba(255, 210, 58, .24), transparent 68%); }
.cha-res-der { display: flex; flex-direction: column; justify-content: center; gap: .85rem; padding: 1.5rem 1.4rem; min-width: 0; }

.cha-res-ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: #3a2600; background: linear-gradient(180deg, #ffe27a, #e0900a); box-shadow: 0 4px 14px rgba(224, 144, 10, .5); }
.cha-res-ico svg { width: 24px; height: 24px; }
#cha-fin.is-empata .cha-res-ico { color: #fff; background: linear-gradient(180deg, #8fa3c2, #566a8a); box-shadow: none; }
.cha-res-ico[hidden] { display: none; }

#cha-fin .cha-res h2 { font-size: clamp(1.7rem, 4.4vw, 2.5rem); line-height: 1.05; letter-spacing: .01em; font-weight: 900; }
#cha-fin.is-gana .cha-res h2 {
  background: linear-gradient(180deg, #fff3b0, #ffc928 60%, #e8920a); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .35));
}
#cha-fin.is-pierde .cha-res h2 { color: #ff9aa5; }

/* El marcador: avatar · resultado · avatar. */
#cha-fin .cha-fin-vs { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: start; gap: .5rem; width: 100%; margin: 1rem 0 0; }
#cha-fin .cha-vs-j { width: auto; gap: .35rem; }
#cha-fin .cha-vs-j b { font-size: .92rem; }
#cha-fin .cha-av-g { width: 84px; height: 84px; font-size: 2.1rem; border-width: 3px; }
#cha-fin .cha-vs-score { align-self: center; margin-top: -1rem; font-size: clamp(2.2rem, 6.5vw, 3.4rem); font-weight: 900; line-height: 1; letter-spacing: .02em; font-variant-numeric: tabular-nums; white-space: nowrap; text-shadow: 0 3px 0 rgba(0, 0, 0, .45); animation: cha-res-score .5s .2s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes cha-res-score { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
#cha-fin .cha-vs-j.is-gana .cha-av-g { border-color: var(--cha-oro); box-shadow: 0 0 0 4px rgba(255, 210, 58, .35), 0 0 28px rgba(255, 210, 58, .6); }
#cha-fin .cha-vs-j.is-pierde { opacity: .6; filter: grayscale(.7); }
#cha-fin .cha-corona { top: -22px; width: 34px !important; height: 34px !important; animation: cha-res-corona .55s .35s cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes cha-res-corona { from { transform: translateX(-50%) translateY(-26px) rotate(-30deg); opacity: 0; } to { transform: translateX(-50%) rotate(-8deg); opacity: 1; } }

/* Sin avatares (el tiro de suerte) el número grande es el protagonista. */
#cha-fin .cha-fin-m { font-size: clamp(2.6rem, 8vw, 4rem); line-height: 1; margin: .1rem 0; color: var(--cha-oro); text-shadow: 0 3px 0 rgba(0, 0, 0, .45); }
#cha-fin .cha-fin-m.is-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Lo que se ganó. */
#cha-fin .cha-fin-s { font-size: .98rem; line-height: 1.4; color: #cfe0f5; min-height: 0; }
#cha-fin .cha-fin-s:empty { display: none; }
#cha-fin .cha-fin-chips { justify-content: flex-start; margin: 0; gap: .45rem; }
#cha-fin .cha-chip { font-size: .95rem; padding: .3rem .8rem; }

.cha-res-xp { display: grid; gap: .35rem; }
.cha-res-xp[hidden] { display: none; }
.cha-res-xp-t { display: flex; justify-content: space-between; align-items: baseline; font-size: .82rem; color: var(--cha-tx2); font-variant-numeric: tabular-nums; }
.cha-res-xp-t b { color: #fff; font-size: .92rem; }
.cha-res-barra { height: 12px; border-radius: 999px; background: rgba(255, 255, 255, .12); overflow: hidden; box-shadow: inset 0 1px 3px rgba(0, 0, 0, .5); }
.cha-res-barra i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #2f7bff, #4fc3ff); transition: width .9s cubic-bezier(.2, .8, .2, 1); }
.cha-res-xp.is-sube .cha-res-barra i { background: linear-gradient(90deg, #ffb21e, #ffe27a); }

/* Los botones: el principal manda. */
#cha-fin .cha-fin-b { flex-wrap: nowrap; justify-content: stretch; gap: .6rem; margin: .2rem 0 0; }
#cha-fin .cha-fin-b .cha-btn { flex: 1 1 0; min-height: 50px; font-size: 1rem; justify-content: center; }
#cha-fin .cha-fin-b .cha-btn-pri { flex: 1.5 1 0; font-weight: 800; }
#cha-fin .cha-fin-inv { margin: 0; text-align: left; }

/* Confeti: veintiséis piezas que caen una sola vez. */
.cha-res-conf { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.cha-res-conf i { position: absolute; top: -16px; left: var(--x); width: 9px; height: 15px; border-radius: 2px; opacity: 0; animation: cha-conf var(--t) var(--d) cubic-bezier(.3, .6, .5, 1) forwards; }
@keyframes cha-conf { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 100% { opacity: 0; transform: translate(var(--dx), 105vh) rotate(var(--r)); } }
#cha-fin .cha-res { z-index: 2; }

/* En vertical, una sola columna. */
@media (max-width: 680px) {
  #cha-fin .cha-res { grid-template-columns: minmax(0, 1fr); width: min(94vw, 430px); }
  .cha-res-izq { border-right: 0; border-bottom: 1px solid rgba(255, 255, 255, .09); padding: 1.2rem 1rem 1rem; }
  .cha-res-der { padding: 1.1rem 1.2rem 1.3rem; }
  #cha-fin .cha-av-g { width: 72px; height: 72px; font-size: 1.8rem; }
}
/* Celular acostado: todo cabe en 390 px de alto. */
@media (max-height: 520px) {
  #cha-fin .cha-res { width: min(780px, 96vw); border-radius: 20px; }
  .cha-res-izq { padding: .8rem .8rem .7rem; gap: .3rem; }
  .cha-res-der { padding: .8rem 1rem; gap: .55rem; }
  .cha-res-ico { width: 32px; height: 32px; }
  .cha-res-ico svg { width: 18px; height: 18px; }
  #cha-fin .cha-res h2 { font-size: 1.5rem; }
  #cha-fin .cha-av-g { width: 56px; height: 56px; font-size: 1.4rem; border-width: 2px; }
  #cha-fin .cha-fin-vs { margin-top: .75rem; }
  #cha-fin .cha-vs-j b { font-size: .8rem; }
  #cha-fin .cha-vs-score { font-size: 2rem; margin-top: -.7rem; }
  #cha-fin .cha-corona { width: 22px !important; height: 22px !important; top: -15px; }
  #cha-fin .cha-fin-m { font-size: 2.4rem; }
  #cha-fin .cha-fin-s { font-size: .85rem; }
  #cha-fin .cha-chip { font-size: .85rem; padding: .2rem .65rem; }
  #cha-fin .cha-fin-b .cha-btn { min-height: 44px; }
  .cha-res-barra { height: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  #cha-fin .cha-res, #cha-fin .cha-vs-score, #cha-fin .cha-corona { animation: none; }
  .cha-res-barra i { transition: none; }
}

/* Resultado: más compacto y centrado. Antes se estiraba casi a todo el ancho
   de un celular acostado y quedaba largo y plano. */
#cha-fin .cha-res { width: min(640px, 90vw); }
.cha-res-izq { border-right: 0; padding-right: .6rem; }
.cha-res-der { padding-left: .6rem; align-items: stretch; text-align: center; }
#cha-fin .cha-fin-s { text-align: center; }
#cha-fin .cha-fin-chips { justify-content: center; }
.cha-res-xp-t { justify-content: space-between; }
#cha-fin .cha-fin-inv { text-align: center; }
@media (min-width: 681px) { #cha-fin .cha-res { background-image: linear-gradient(90deg, transparent calc(50% - .5px), rgba(255,255,255,.08) calc(50% - .5px), rgba(255,255,255,.08) calc(50% + .5px), transparent calc(50% + .5px)), linear-gradient(165deg, #15321f 0%, #0a1a10 100%); } }
@media (max-height: 520px) {
  #cha-fin .cha-res { width: min(600px, 88vw); }
  .cha-res-izq { padding-right: .4rem; }
  .cha-res-der { padding-left: .4rem; }
}
@media (max-width: 680px) { #cha-fin .cha-res { width: min(94vw, 430px); } }

/* ── Menú: tiro de suerte y tienda, en una fila compacta ─────────────────── */
.cha-cta-par { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.cha-cta-par[hidden] { display: none; }
.cha-cta-par > .cha-cta[hidden] { display: none; }
.cha-cta-par:has(> .cha-cta[hidden]:first-child), .cha-cta-par:has(> .cha-cta[hidden]:last-child) { grid-template-columns: minmax(0, 1fr); }
.cha-cta-mini { padding: .55rem .7rem; gap: .55rem; min-height: 0; }
.cha-cta-mini .cha-cta-ico { width: 38px; height: 38px; border-radius: 11px; }
.cha-cta-mini .cha-cta-ico svg { width: 22px; height: 22px; }
.cha-cta-mini .cha-cta-tx b { font-size: .95rem; line-height: 1.1; }
.cha-cta-mini .cha-cta-tx small { font-size: .7rem; line-height: 1.15; }
.cha-cta-tienda { border-color: rgba(79, 195, 255, .55); }
.cha-cta-tienda .cha-cta-ico { background: linear-gradient(180deg, #5fd0ff, #1e8bd8); color: #fff; }

/* ── La TIENDA ───────────────────────────────────────────────────────────── */
.cha-tienda { display: flex; flex-direction: column; gap: 0; padding-bottom: .6rem; overflow: hidden; }
.cha-t-tabs { display: flex; gap: .35rem; padding: .3rem .9rem 0; overflow-x: auto; scrollbar-width: none; }
.cha-t-tabs::-webkit-scrollbar { display: none; }
.cha-t-tab { flex: none; padding: .55rem 1.1rem; border-radius: 8px 8px 0 0; font-weight: 800; font-size: .92rem; white-space: nowrap; color: #fff; background: #8e9490; opacity: .85; }
.cha-t-tab.is-on { background: #f2f4f2; color: #131815; opacity: 1; }
.cha-t-fila {
  flex: 1; min-height: 0; display: flex; gap: .8rem; padding: .8rem .9rem; overflow-x: auto; scroll-snap-type: x proximity;
  background: #f2f4f2; border-top: 1px solid rgba(0, 0, 0, .15);
}
.cha-t-card {
  flex: 0 0 min(215px, 42vw); scroll-snap-align: start; display: flex; flex-direction: column; align-items: stretch; gap: .5rem;
  padding: .7rem .7rem .8rem; border-radius: 4px; background: #262a27; color: #fff; text-align: center; box-shadow: 0 2px 0 rgba(0, 0, 0, .25);
}
.cha-t-card h3 { font-size: 1.15rem; font-weight: 900; line-height: 1.15; }
.cha-t-pila { width: 100%; height: auto; aspect-ratio: 260 / 240; max-height: 36vh; align-self: center; object-fit: contain; }
.cha-t-barras { display: grid; gap: .3rem; text-align: left; }
.cha-t-barra { display: grid; grid-template-columns: 5.4rem minmax(0, 1fr); align-items: center; gap: .4rem; font-size: .82rem; }
.cha-t-barra b { font-weight: 800; }
.cha-t-seg { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; padding: 2px; background: #050706; border-radius: 2px; }
.cha-t-seg i { height: 11px; background: #14201a; border-radius: 1px; }
.cha-t-seg i.on { background: linear-gradient(180deg, #8bf14a, #3fb324); box-shadow: 0 0 6px rgba(120, 240, 60, .45); }

.cha-t-mejora, .cha-t-usar { position: relative; min-height: 46px; width: 100%; justify-content: center; font-weight: 900; font-size: 1.05rem; border: 0; border-radius: 3px; box-shadow: 0 3px 0 rgba(0, 0, 0, .35); }
.cha-t-mejora { background: linear-gradient(180deg, #86e21b, #4bb10f); color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.cha-t-mejora:disabled { filter: grayscale(.8) brightness(.8); opacity: .75; }
.cha-t-usar { background: linear-gradient(180deg, #1c9cff, #0a62d8); color: #fff; }
.cha-t-usar.is-uso, .cha-t-usar:disabled { background: #565b58; color: #fff; box-shadow: none; opacity: 1; }
.cha-t-aviso { position: absolute; right: -8px; top: -12px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: #e0182d; color: #fff; font-weight: 900; border: 2px solid #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .4); }
.cha-t-vacia { background: #262a27; justify-content: center; }
.cha-t-vacia p { color: #cfd6d1; font-weight: 800; font-size: 1rem; line-height: 1.3; padding: 0 .4rem; }
.cha-t-nota { padding: .4rem 1rem 0; font-size: .8rem; color: var(--cha-tx2); text-align: center; }

/* La ventana de mejora de un equipo. */
.cha-mej-c { max-width: 460px; width: min(94vw, 460px); text-align: left; }
.cha-mej-c h2 { text-align: center; }
.cha-mej-lista { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .55rem; }
.cha-mej-f { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "cab btn" "seg btn" "d btn" "falta falta"; gap: .25rem .8rem; align-items: center; padding: .6rem .7rem; border-radius: 12px; background: rgba(255, 255, 255, .07); }
.cha-mej-cab { grid-area: cab; display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.cha-mej-cab small { color: var(--cha-tx2); }
.cha-mej-f .cha-t-seg { grid-area: seg; }
.cha-mej-d { grid-area: d; font-size: .8rem; color: #cfe0f5; }
.cha-mej-b { grid-area: btn; width: auto; min-width: 8.2rem; min-height: 44px; font-size: .95rem; padding: 0 .8rem; }
.cha-mej-b svg { width: 1.05rem; height: 1.05rem; }
.cha-mej-falta { grid-area: falta; color: #ffb21e; font-size: .75rem; }

/* El equipo con el que se juega tiñe los avatares de la cancha y del resultado. */
.cha[data-color="rojo"] .cha-av-0 { background: radial-gradient(circle at 30% 25%, #ff9aa5, #c4182c 70%); }
.cha[data-color="rojo"] .cha-av-1 { background: radial-gradient(circle at 30% 25%, #7fb2ff, #1e55d8 70%); }

@media (max-height: 520px) {
  .cha-t-tab { padding: .35rem .8rem; font-size: .8rem; }
  .cha-t-fila { padding: .5rem .7rem; gap: .6rem; }
  .cha-t-card { flex-basis: min(190px, 30vw); padding: .45rem .5rem .55rem; gap: .3rem; }
  .cha-t-card h3 { font-size: .95rem; }
  .cha-t-pila { max-height: 17vh; }
  .cha-t-barra { font-size: .72rem; grid-template-columns: 4.4rem minmax(0, 1fr); gap: .3rem; }
  .cha-t-seg i { height: 8px; }
  .cha-t-barras { gap: .15rem; }
  .cha-t-mejora, .cha-t-usar { min-height: 34px; font-size: .9rem; }
  .cha-t-nota { display: none; }
  .cha-t-vacia p { font-size: .82rem; }
  .cha-mej-c { width: min(96vw, 620px); max-width: 620px; padding: .8rem 1rem; }
  .cha-mej-lista { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem; }
  .cha-mej-f { grid-template-columns: minmax(0, 1fr); grid-template-areas: "cab" "seg" "d" "btn" "falta"; padding: .45rem .5rem; }
  .cha-mej-b { width: 100%; min-width: 0; min-height: 36px; }
  .cha-mej-d { font-size: .7rem; }
  .cha-cta-par { gap: .45rem; }
  .cha-cta-mini .cha-cta-tx small { display: none; }
}

/* Las tarjetas ocupan todo el alto: el aire sobrante va arriba de la pila y de las barras. */
.cha-t-card:not(.cha-t-vacia) .cha-t-pila { margin-top: auto; }
.cha-t-card:not(.cha-t-vacia) .cha-t-barras { margin-top: auto; }

/* Las pestañas de la tienda son botones cuando se pueden tocar. */
button.cha-t-tab { border: 0; font: inherit; font-weight: 800; font-size: .92rem; cursor: pointer; }
button.cha-t-tab:not(.is-on) { background: #8e9490; color: #fff; opacity: .95; }
button.cha-t-tab:focus-visible { outline: 3px solid var(--cha-oro); outline-offset: 2px; }

/* Los avatares: dos filas que se recorren hacia la derecha, como en el modelo. */
.cha-t-fila.is-avatares { display: grid; grid-auto-flow: column; grid-template-rows: repeat(2, max-content); grid-auto-columns: min(170px, 38vw); gap: .7rem; align-content: start; }
.cha-t-av { padding: .55rem .5rem .6rem; gap: .35rem; }
.cha-t-av h3 { font-size: .95rem; }
.cha-t-av-img { width: min(124px, 74%); height: auto; aspect-ratio: 1; align-self: center; border-radius: 16px; border: 3px solid #3a3f3c; background: #0e120f; }
.cha-t-av.is-uso .cha-t-av-img { border-color: #3fd06a; box-shadow: 0 0 0 2px rgba(63, 208, 106, .35); }
.cha-t-av .cha-t-usar { min-height: 38px; font-size: .95rem; }
@media (max-height: 520px) {
  .cha-t-fila.is-avatares { grid-auto-columns: 126px; gap: .45rem; }
  .cha-t-av { padding: .3rem .35rem .4rem; gap: .2rem; }
  .cha-t-av h3 { font-size: .8rem; }
  .cha-t-av-img { width: 52px; border-width: 2px; border-radius: 12px; }
  .cha-t-av .cha-t-usar { min-height: 28px; font-size: .8rem; }
}
.exc-avatar-amigable { object-fit: cover; background: #1b2433; }

/* ══ EXCLIVIA DIAMOND ARENA — la interfaz como la mandó el diseñador ════════
   Barra de arriba oscura con filete dorado y los colores de cada equipo, el
   logo debajo del reloj, y una barra de abajo con los tres efectos, el turno y
   la fuerza del jalón. Los nombres de las clases son los de siempre: lo único
   que cambia es cómo se ven. */
.cha-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.cha-logo-img { width: min(300px, 90%); height: auto; filter: drop-shadow(0 4px 14px rgba(0, 0, 0, .55)); }
.cha-logo { align-items: center; }

.cha-juego .cha-stage { background: #050a14; }
.cha-hud {
  background: linear-gradient(180deg, #0b1424 0%, #070c17 100%);
  border-bottom: 0; box-shadow: 0 8px 22px rgba(0, 0, 0, .6);
  z-index: 4;
}
.cha-hud::after {                       /* el filete: azul a la izquierda, dorado en el centro, rojo a la derecha */
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: linear-gradient(90deg, #2f7bff 0%, #2f7bff 30%, #c8923a 42%, #c8923a 58%, #ff4a5c 70%, #ff4a5c 100%);
  box-shadow: 0 0 10px rgba(255, 210, 120, .35);
}
.cha-hud-logo { position: absolute; left: 50%; top: calc(100% - 2px); transform: translateX(-50%); width: auto; height: clamp(24px, 6.2vh, 46px); z-index: 5; pointer-events: none; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .7)); }
.cha-lado { border-bottom: 0; background: transparent; }
.cha-lado.is-turno { background: rgba(255, 210, 90, .08); box-shadow: inset 0 -3px 0 #ffd23a; }
.cha-nom b { color: #fff; font-weight: 800; }
.cha-nom small { color: #ffc54a; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.cha-g { font-size: clamp(1.6rem, 5.4vh, 2.6rem); font-weight: 900; }
#cha-g-0 { color: #4e9bff; text-shadow: 0 0 14px rgba(70, 150, 255, .75); }
#cha-g-1 { color: #ff6577; text-shadow: 0 0 14px rgba(255, 90, 110, .75); }
.cha-centro-h { background: transparent; color: #fff; padding: 0; min-width: 0; }
.cha-reloj {
  min-width: 5.4rem; text-align: center; padding: .28rem .9rem; border-radius: 10px; letter-spacing: .08em;
  background: linear-gradient(180deg, #131c30, #0a101d); color: #ffd25a; border: 1px solid rgba(200, 146, 58, .75);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, .6); font-size: 1.2rem; font-weight: 800;
}
.cha-reloj.is-mio { background: linear-gradient(180deg, #17315e, #0d1b36); color: #ffe27a; }
.cha-reloj.is-urge { background: linear-gradient(180deg, #5a0f1a, #2a0710); color: #fff; border-color: #ff4a5c; }
.cha-pote { color: #ffd25a; }
.cha-pote svg { color: #ffc54a; }

/* La barra de abajo. */
.cha-pie {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4;
  display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 24rem); align-items: center; gap: .7rem;
  padding: .45rem max(.8rem, env(safe-area-inset-right)) max(.45rem, env(safe-area-inset-bottom)) max(.8rem, env(safe-area-inset-left));
  background: linear-gradient(0deg, #070c17 0%, #0b1424 100%); box-shadow: 0 -8px 22px rgba(0, 0, 0, .55);
}
.cha-pie::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, #2f7bff, #c8923a 40%, #c8923a 60%, #ff4a5c); opacity: .9; }
.cha-pie .cha-efecto { position: static; transform: none; display: flex; gap: .5rem; padding: 0; background: transparent; border: 0; z-index: 1; }
.cha-pie .cha-ef { width: auto; height: auto; display: grid; justify-items: center; gap: .15rem; padding: 0; border: 0; background: transparent; border-radius: 0; }
.cha-pie .cha-ef img { width: clamp(52px, 8.5vw, 84px); height: auto; display: block; filter: saturate(.7) brightness(.85); transition: filter .15s, transform .15s; -webkit-user-drag: none; }
.cha-pie .cha-ef small { font-size: .62rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #aab6cf; }
.cha-pie .cha-ef.is-on img { filter: drop-shadow(0 0 10px rgba(255, 196, 70, .85)) saturate(1.1); transform: translateY(-1px); }
.cha-pie .cha-ef.is-on small { color: #ffc54a; }
.cha-pie .cha-ef:focus-visible img { outline: 2px solid #ffd23a; outline-offset: 2px; border-radius: 10px; }

.cha-pie .cha-turnos {
  position: static; transform: none; justify-self: center; display: block; max-width: 100%; z-index: 1;
  padding: .55rem 2.2rem; border-radius: 0; text-align: center; white-space: nowrap; text-overflow: ellipsis; overflow: hidden;
  font-size: clamp(.78rem, 1.9vh + .3rem, 1.05rem); font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: #fff;
  background: linear-gradient(180deg, #0f1a31, #070d1b); border: 1px solid rgba(200, 146, 58, .8);
  clip-path: polygon(14px 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 14px 100%, 0 50%);
  box-shadow: none;
}
.cha-pie .cha-turnos b { color: #ffc54a; }
.cha-pie .cha-turnos:empty { visibility: hidden; display: block; }
.cha-pie .cha-turnos.is-mio { background: linear-gradient(180deg, #15305f, #0a1731); }

.cha-fuerza { display: grid; grid-template-columns: minmax(0, 1fr); gap: .15rem; justify-items: stretch; z-index: 1; }
.cha-fuerza-pista { position: relative; display: block; height: 20px; border-radius: 10px; background: #04070d; border: 1px solid #2a3350; box-shadow: inset 0 2px 5px rgba(0, 0, 0, .7); overflow: visible; }
.cha-fuerza-pista i { display: block; height: 100%; width: calc(var(--p) * 100%); border-radius: 10px; background: repeating-linear-gradient(90deg, #ffd24a 0 19px, #d89a12 19px 21px); transition: width .05s linear; }
.cha-fuerza-pista b { position: absolute; top: 50%; left: calc(var(--p) * (100% - 24px)); width: 24px; height: 24px; margin-top: -12px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff1b0, #f2b21e 70%); border: 2px solid #8a5d10; box-shadow: 0 2px 6px rgba(0, 0, 0, .6); }
.cha-fuerza small { font-size: .72rem; color: #cfd8ea; text-align: right; }

/* Celular acostado: la barra se hace delgada y los textos pequeños se van. */
@media (max-height: 520px) {
  .cha-pie { grid-template-columns: auto minmax(0, 1fr) minmax(0, 11rem); gap: .45rem; padding-top: .25rem; padding-bottom: max(.25rem, env(safe-area-inset-bottom)); }
  .cha-pie .cha-efecto { flex-direction: row; left: auto; top: auto; gap: .35rem; padding: 0; }
  .cha-pie .cha-ef img { width: 46px; }
  .cha-pie .cha-ef small { display: none; }
  .cha-pie .cha-turnos { display: block; padding: .3rem 1.3rem; font-size: .72rem; }
  .cha-fuerza small { display: none; }
  .cha-fuerza-pista { height: 15px; }
  .cha-fuerza-pista b { width: 18px; height: 18px; margin-top: -9px; left: calc(var(--p) * (100% - 18px)); }
  .cha-hud-logo { height: 20px; }
  .cha-reloj { min-width: 4rem; font-size: .9rem; padding: .1rem .5rem; }
  .cha-g { font-size: 1.3rem; }
}
/* En vertical y en tarjetas muy estrechas, una sola fila apretada. */
@media (max-width: 560px) {
  .cha-stage:not(.is-girada) .cha-pie { grid-template-columns: auto minmax(0, 1fr); }
  .cha-stage:not(.is-girada) .cha-fuerza { grid-column: 1 / -1; }
  .cha-stage:not(.is-girada) .cha-pie .cha-turnos { padding: .45rem 1.2rem; }
}
/* Con el escenario GIRADO (teléfono en vertical con la rotación bloqueada) el
   escenario es de 844×390 aunque la ventana mida 390×844: las consultas de
   medios no lo ven, así que se repite lo del celular acostado. */
.cha-stage.is-girada .cha-pie { grid-template-columns: auto minmax(0, 1fr) minmax(0, 11rem); gap: .45rem; padding-top: .25rem; padding-bottom: .25rem; }
.cha-stage.is-girada .cha-pie .cha-ef img { width: 46px; }
.cha-stage.is-girada .cha-pie .cha-ef small, .cha-stage.is-girada .cha-fuerza small { display: none; }
.cha-stage.is-girada .cha-pie .cha-turnos { padding: .3rem 1.3rem; font-size: .72rem; }
.cha-stage.is-girada .cha-fuerza-pista { height: 15px; }
.cha-stage.is-girada .cha-fuerza-pista b { width: 18px; height: 18px; margin-top: -9px; left: calc(var(--p) * (100% - 18px)); }
.cha-stage.is-girada .cha-hud-logo { height: 20px; }
.cha-stage.is-girada .cha-reloj { min-width: 4rem; font-size: .9rem; padding: .1rem .5rem; }
/* El tiro de suerte no tiene turnos ni rival: solo efecto y fuerza. */
.cha[data-modo="suerte"] .cha-pie .cha-turnos { visibility: hidden; }

/* El selector de estadio del «1 vs 1» (solo cuentas de prueba). */
.cha-estadios { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: .5rem 0 0; font-size: .78rem; color: var(--cha-tx2); }
.cha-estadios[hidden] { display: none; }
.cha-est-op { border: 1px solid rgba(255, 255, 255, .18); background: rgba(8, 16, 32, .6); color: inherit; border-radius: 999px; padding: .3rem .75rem; font: inherit; font-weight: 600; cursor: pointer; }
.cha-est-op[aria-pressed="true"] { border-color: #ffd34d; color: #ffd34d; background: rgba(255, 211, 77, .12); }
.cha-est-sep { margin-left: .6rem; }

/* Celular acostado (y escenario girado): sin barra de abajo. Los botones de efecto van en columna al costado izquierdo, la
   barra de fuerza vertical al derecho y la placa de turno flota abajo, chica. La cancha ocupa el alto que quedó libre. */
@media (max-height: 520px) {
  .cha-pie { position: static; display: block; height: 0; padding: 0; background: none; box-shadow: none; pointer-events: none; }
  .cha-pie::before { display: none; }
  .cha-pie .cha-efecto { position: absolute; left: max(6px, env(safe-area-inset-left)); top: 50%; transform: translateY(-50%); flex-direction: column; gap: .3rem; pointer-events: auto; }
  .cha-pie .cha-ef img { width: 40px; }
  .cha-pie .cha-turnos { position: absolute; left: 50%; bottom: 3px; transform: translateX(-50%); padding: .12rem .8rem; font-size: .62rem; white-space: nowrap; opacity: .9; background: rgba(5, 10, 20, .7); border-radius: 999px; }
  .cha-pie .cha-fuerza { position: absolute; right: max(8px, env(safe-area-inset-right)); top: 50%; transform: translateY(-50%); width: 14px; height: 46%; display: block; }
  .cha-fuerza-pista { height: 100%; width: 14px; }
  .cha-fuerza-pista i { position: absolute; left: 0; right: 0; bottom: 0; width: auto; height: calc(var(--p) * 100%); background: repeating-linear-gradient(0deg, #ffd24a 0 9px, #d89a12 9px 11px); }
  .cha-fuerza-pista b { left: -2px; top: auto; bottom: calc(var(--p) * (100% - 18px)); margin-top: 0; }
}
.cha-stage.is-girada .cha-pie { position: static; display: block; height: 0; padding: 0; background: none; box-shadow: none; pointer-events: none; }
.cha-stage.is-girada .cha-pie::before { display: none; }
.cha-stage.is-girada .cha-pie .cha-efecto { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); flex-direction: column; gap: .3rem; pointer-events: auto; }
.cha-stage.is-girada .cha-pie .cha-ef img { width: 40px; }
.cha-stage.is-girada .cha-pie .cha-turnos { position: absolute; left: 50%; bottom: 3px; transform: translateX(-50%); padding: .12rem .8rem; font-size: .62rem; white-space: nowrap; background: rgba(5, 10, 20, .7); border-radius: 999px; }
.cha-stage.is-girada .cha-pie .cha-fuerza { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 14px; height: 46%; display: block; }
.cha-stage.is-girada .cha-fuerza-pista { height: 100%; width: 14px; }
.cha-stage.is-girada .cha-fuerza-pista i { position: absolute; left: 0; right: 0; bottom: 0; width: auto; height: calc(var(--p) * 100%); background: repeating-linear-gradient(0deg, #ffd24a 0 9px, #d89a12 9px 11px); }
.cha-stage.is-girada .cha-fuerza-pista b { left: -2px; top: auto; bottom: calc(var(--p) * (100% - 18px)); margin-top: 0; }

/* ── La barra de arriba como la propuesta del diseñador ────────────────────────────────────────────
   Paneles oscuros con el borde interior inclinado, avatares grandes con aro que se montan sobre la cancha, el nivel en
   píldora, el marcador al centro con el reloj en píldora dorada y, debajo, la sede (estadio · ciudad). */
.cha-hud { --cha-hud: 62px; background: linear-gradient(180deg, #08101f, #050a14); gap: .6rem; }
.cha-hud::after { height: 3px; background: linear-gradient(90deg, #2f7bff 0, #2f7bff 28%, #d9a441 40%, #d9a441 60%, #ff4a5c 72%, #ff4a5c 100%); }
.cha-lado { position: relative; gap: .7rem; padding: .2rem 1.4rem .2rem .3rem; border-radius: 0; box-shadow: none !important; background: none; }
.cha-lado-1 { padding: .2rem .3rem .2rem 1.4rem; }
.cha-lado::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(20, 38, 76, .55), rgba(8, 16, 32, .2)); clip-path: polygon(0 0, 100% 0, calc(100% - 24px) 100%, 0 100%); }
.cha-lado-1::before { background: linear-gradient(270deg, rgba(76, 20, 34, .55), rgba(32, 8, 14, .2)); clip-path: polygon(24px 0, 100% 0, 100% 100%, 0 100%); }
.cha-lado.is-turno::before { background: linear-gradient(90deg, rgba(60, 90, 160, .65), rgba(20, 38, 76, .25)); }
.cha-lado-1.is-turno::before { background: linear-gradient(270deg, rgba(160, 60, 80, .65), rgba(76, 20, 34, .25)); }
.cha-hud .cha-anillo { padding: 3px; margin: -4px 0 -12px; position: relative; z-index: 6; }
.cha-hud .cha-anillo .cha-av { width: 54px; height: 54px; font-size: 1.3rem; border-width: 2px; box-shadow: 0 4px 12px rgba(0, 0, 0, .6); }
.cha-nom b { font-size: 1.1rem; }
.cha-nom small { align-self: flex-start; font-size: .66rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #ffd47a; padding: .05rem .6rem; border-radius: 999px; border: 1px solid rgba(217, 164, 65, .7); background: rgba(8, 16, 32, .7); margin-top: .15rem; }
.cha-lado-1 .cha-nom small { align-self: flex-end; }
.cha-marcador { position: relative; }
.cha-centro-h { flex-direction: column; gap: .1rem; }
.cha-reloj { border: 1.5px solid #d9a441; background: rgba(5, 10, 20, .85); color: #ffd47a; border-radius: 999px; }
.cha-sede { display: flex; align-items: center; gap: .3rem; font-size: .6rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #dfe7f7; white-space: nowrap; }
.cha-sede svg { width: 14px; height: 14px; color: #ffd47a; }
.cha-sede b { font-weight: 800; }
.cha[data-modo="suerte"] .cha-sede { display: none; }
@media (max-height: 520px) {
  .cha-hud { --cha-hud: 40px; }
  .cha-hud .cha-anillo { margin: -6px 0 -14px; padding: 2px; }
  .cha-hud .cha-anillo .cha-av { width: 40px; height: 40px; font-size: 1rem; }
  .cha-nom b { font-size: .85rem; }
  .cha-nom small { font-size: .5rem; padding: 0 .4rem; margin-top: 0; }
  .cha-lado { padding: 0 1rem 0 .2rem; gap: .4rem; }
  .cha-lado-1 { padding: 0 .2rem 0 1rem; }
  .cha-sede { font-size: .5rem; }
  .cha-sede svg { width: 10px; height: 10px; }
  .cha-hud-logo { display: none; }
}
.cha-stage.is-girada .cha-hud { --cha-hud: 40px; }
.cha-stage.is-girada .cha-hud .cha-anillo { margin: -6px 0 -14px; padding: 2px; }
.cha-stage.is-girada .cha-hud .cha-anillo .cha-av { width: 40px; height: 40px; font-size: 1rem; }
.cha-stage.is-girada .cha-hud-logo { display: none; }
