/* vivo.css — La vista en vivo de las familias (vivo.js). Diseño: maquetas/mesa-2026/publica6.html.
   Pantalla completa y siempre oscura, en horizontal (PC 1280×720, celular 844×390); en vertical se apila: marcador, cancha, cajas.
   Todo se mide contra el alto de la ventana (dvh) o de su caja (cqh), no en píxeles fijos. Fuentes DSEG7 y Saira: las de marca.css. */
.vv {
  position: fixed; inset: 0; z-index: 9000; overflow: auto; background: #0a1426; color: #e8edf5;
  font: 500 14px Montserrat, system-ui, sans-serif;
  --papel: #0f1c35; --alzado: #1a2b4d; --linea: #24365a; --tinta-2: #a9b4c8; --tinta-3: #7a87a0; --am: #fbbf24; --verde: #16a34a;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --pad: clamp(8px, 2.6dvh, 14px); --gap: clamp(6px, 2.1dvh, 12px); --bug: clamp(46px, 13.3dvh, 78px); --top: clamp(18px, 5.6dvh, 26px);
}
.vv *, .vv *::before, .vv *::after { box-sizing: border-box; margin: 0; }
.vv-in { display: flex; flex-direction: column; gap: var(--gap); padding: var(--pad); height: 100%; min-width: 0; }
.vv .firma { font-family: Saira, 'Montserrat', sans-serif; font-style: italic; font-weight: 900; text-transform: uppercase; }
.vv .dseg { font-family: DSEG7, var(--mono); font-weight: 700; }
.vv-rot { font: 700 clamp(8px, 1.5dvh, 10px) var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--tinta-3); }
.vv-sp { flex: 1; min-width: 0; }
.vv-caja { border: 1px solid var(--linea); border-radius: 12px; background: var(--papel); }

/* arriba */
.vv-top { display: flex; align-items: center; gap: 10px; height: var(--top); flex: none; min-width: 0; }
.vv-ctx { color: var(--tinta-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.vv-etq { white-space: nowrap; }
.vv-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px; background: #b91c1c; color: #fff; font: 800 clamp(9px, 1.7dvh, 11px) Montserrat, sans-serif; letter-spacing: .08em; white-space: nowrap; }
.vv-pill i { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: vv-lat 1.4s ease-in-out infinite; }
.vv-pill.off { background: #334a7a; }
.vv-pill.off i { animation: none; opacity: .6; }
@keyframes vv-lat { 50% { opacity: .25 } }
.vv-x { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--linea); background: var(--papel); color: var(--tinta-2); font: 700 13px sans-serif; cursor: pointer; flex: none; }
.vv-error { margin: auto; max-width: 28em; text-align: center; color: var(--tinta-2); font-size: 16px; line-height: 1.4; }

/* marcador de transmisión: rojo | período y reloj | azul */
.vv-bug { display: grid; grid-template-columns: 1fr auto 1fr; height: var(--bug); flex: none; border-radius: 12px; overflow: hidden; border: 1px solid var(--linea); }
.vv-lado { display: flex; align-items: center; gap: clamp(8px, 1.8dvh, 14px); padding: 0 clamp(10px, 2.5dvh, 18px); min-width: 0; }
.vv-lado.v { flex-direction: row-reverse; }
.vv-logo { width: calc(var(--bug) * .67); height: calc(var(--bug) * .67); border-radius: 50%; background: #fff; flex: none; object-fit: contain; }
.vv-ini { display: grid; place-items: center; color: #fff; font: 900 calc(var(--bug) * .3) Saira, sans-serif; font-style: italic; border: 2px solid rgba(255,255,255,.5); }
.vv-logo.ch { width: clamp(18px, 3.2dvh, 24px); height: clamp(18px, 3.2dvh, 24px); }
.vv-ini.ch { font-size: 10px; border-width: 1px; }
.vv-nom { font-size: calc(var(--bug) * .31); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.1; }
.vv-pts { font-size: calc(var(--bug) * .64); line-height: 1; flex: none; }
.vv-cen { background: #050b18; display: flex; align-items: center; gap: clamp(8px, 1.7dvh, 12px); padding: 0 clamp(12px, 3dvh, 22px); }
.vv-per { font: 800 clamp(11px, 2dvh, 14px) Montserrat, sans-serif; color: var(--tinta-2); }
.vv-reloj { font-size: calc(var(--bug) * .51); color: var(--am); line-height: 1; }

/* cuerpo */
.vv-cuerpo { flex: 1; min-height: 0; display: flex; gap: var(--gap); container-type: size; }
.vv-colA, .vv-colB, .vv-der { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; min-height: 0; }
.vv-colA { flex: 1.08; } .vv-colB { flex: 1; }
.vv-der { flex: 1; }
.vv-izq { display: flex; flex-direction: column; gap: var(--gap); flex: none; --met: clamp(40px, 11cqh, 74px);
  width: calc((100cqh - var(--met) - var(--gap)) * 28 / 15); max-width: calc(100cqw - 300px); min-height: 0; }

/* cancha */
.vv-cancha { position: relative; border-radius: 12px; overflow: hidden; flex: none; container-type: size; border: 2px solid #2c4170;
  background: repeating-linear-gradient(135deg, rgba(255,255,255,.02) 0 2px, transparent 2px 10px), #0d1a33; }
.vv-uni > .vv-cuerpo > .vv-cancha { height: 100%; aspect-ratio: 14 / 15; }
.vv-izq .vv-cancha { width: 100%; aspect-ratio: 28 / 15; }
.vv-cancha > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
#vvFichas { position: absolute; inset: 0; }
.vv-jug { --j: clamp(30px, 14.5cqh, 92px); position: absolute; transform: translate(-50%, -50%); text-align: center; white-space: nowrap; line-height: 1.1; }
.vv-gen .vv-jug { --j: clamp(22px, 11.5cqh, 70px); }
.vv-jug svg, .vv-cam-res { width: var(--j); height: auto; display: block; margin: 0 auto; }
.vv-cam-res { height: calc(var(--j) * 1.17); display: grid; place-items: center; font-weight: 800; }
.vv-nm { font-weight: 700; margin-top: -3px; font-size: max(9px, calc(var(--j) * .22)); }
.vv-pt { display: inline-block; margin-top: 2px; padding: 1px 7px; border-radius: 7px; background: var(--verde); font-weight: 800; font-size: max(9px, calc(var(--j) * .19)); }
.vv-pt.rival { background: #334a7a; }
.vv-min { display: block; margin-top: 2px; font: 700 max(8px, calc(var(--j) * .16)) var(--mono, 'JetBrains Mono', monospace); color: #a9b4c8; letter-spacing: .02em; }   /* Mesa v2: el tiempo de juego, pequeño y callado (solo si el servidor lo trae) */
.vv-min.dentro { color: #4ade80; }
.vv-jug.brilla svg { filter: drop-shadow(0 0 10px rgba(251,191,36,.8)); }
.vv-vacio { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; color: var(--tinta-3); font-size: clamp(11px, 2.2dvh, 15px); }

/* puntos por cuarto */
.vv-sinjug .vv-cancha, .vv-cuartos:empty { display: none; }   /* Ola 2 · #20: sin jugadas con número ni puntos por cuarto, no ocupan pantalla */
.vv-cuartos { padding: clamp(6px, 1.8dvh, 10px) clamp(8px, 2dvh, 14px); flex: none; }
.vv-tab { display: grid; grid-template-columns: clamp(18px, 3.2dvh, 24px) minmax(0, 1fr) repeat(var(--cols), 2.2em) 2.8em; gap: clamp(3px, 1dvh, 6px) clamp(6px, 1.6dvh, 12px); align-items: center;
  font: 700 clamp(11px, 2.1dvh, 15px) var(--mono); text-align: center; }
.vv-tab .cab { color: var(--tinta-3); font-size: clamp(8px, 1.5dvh, 11px); }
.vv-tab .nd { color: var(--tinta-3); } .vv-tab .act { color: var(--am); } .vv-tab .tot { color: #fff; }
.vv-eqn { font-family: Montserrat, sans-serif; text-align: left; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* métricas */
.vv-mets { display: grid; gap: var(--gap); flex: none; }
.vv-uni .vv-mets { grid-template-columns: 1fr 1fr; }
.vv-izq .vv-mets { grid-auto-flow: column; grid-auto-columns: 1fr; height: var(--met); }   /* tantas columnas como fichas con dato */
.vv-mets:empty { display: none; }
.vv-uni .vv-mets > .vv-m:last-child:nth-child(odd) { grid-column: 1 / -1; }   /* en 2 columnas, la última sola ocupa la fila: sin hueco */
.vv-m { border-radius: 10px; background: var(--alzado); padding: clamp(5px, 1.5dvh, 8px) clamp(8px, 1.6dvh, 10px); min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.vv-m b { display: block; font: 800 clamp(13px, 2.6dvh, 17px) Montserrat, sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* marcas: una en grande a la vez, pasa sola cada 3 s */
.vv-marcas { position: relative; overflow: hidden; flex: 1; min-height: 0; background: var(--papel); }
.vv-gen .vv-marcas { flex: none; height: clamp(64px, 15cqh, 110px); }
.vv-marca { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; transition: opacity .6s; }
.vv-marca.ve { opacity: 1; }
.vv-marca img { max-width: 70%; max-height: 40%; object-fit: contain; }
.vv-gen .vv-marca img { max-height: 46%; }
.vv-puntos { position: absolute; left: 0; right: 0; bottom: clamp(5px, 1.4dvh, 10px); display: flex; justify-content: center; gap: 6px; }
.vv-puntos i { width: 7px; height: 7px; border-radius: 50%; background: rgba(120,135,160,.5); }
.vv-puntos i.ve { background: var(--am); }

/* Elso en su círculo + últimas jugadas (o el título que salta) */
.vv-elso { container-type: size; flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(6px, 2dvh, 14px); padding: clamp(8px, 2.2dvh, 16px); }
.vv-circ { width: min(86cqw, 46cqh); aspect-ratio: 1; border-radius: 50%; flex: none; position: relative; overflow: hidden; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 40%, #24477f, #102044 70%); border: 3px solid var(--am); }
.vv-circ.grande { width: min(86cqw, 58cqh); }
.vv-circ img { max-width: none; object-fit: contain; }
.vv-circ.grande img { position: absolute; }
.vv-estado { text-align: center; }
.vv-estado .firma { font-size: clamp(20px, min(11cqh, 13cqw), 36px); color: var(--am); line-height: 1; }
.vv-sub { font-size: clamp(10px, 2.3cqh, 14px); color: var(--tinta-2); margin-top: 4px; }
@keyframes vv-salto { 0% { transform: scale(.4) translateY(14px); opacity: 0 } 60% { transform: scale(1.15) translateY(-6px); opacity: 1 } 100% { transform: none } }
.vv .salto { animation: vv-salto .55s cubic-bezier(.3, 1.5, .5, 1) both; }
.vv-ult { width: 100%; min-height: 0; overflow: hidden; }
.vv-ult .vv-rot { margin-bottom: clamp(4px, 1.4dvh, 8px); }
.vv-ult ul { list-style: none; padding: 0; }
.vv-ult li { display: flex; gap: clamp(6px, 1.4dvh, 10px); align-items: center; padding: clamp(4px, 1.3dvh, 7px) 0; border-top: 1px solid var(--linea); font-size: clamp(10px, 2.1dvh, 14px); min-width: 0; }
.vv-ult li:nth-child(n+5) { display: none; }
.vv-ult .h { font: 700 clamp(9px, 1.6dvh, 11px) var(--mono); color: var(--tinta-3); flex: none; }
.vv-ult .pun { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.vv-ult li b { flex: none; } .vv-ult li.nueva b { color: var(--am); }
.vv-ult .sp { flex: 1; }
.vv-ult .q { color: var(--tinta-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.vv-nada { color: var(--tinta-3); font-size: 13px; padding-top: 6px; }
@container (max-height: 420px) { .vv-ult li:nth-child(n+3) { display: none; } }
@container (max-height: 215px) { .vv-ult li:nth-child(n+2) { display: none; } .vv-circ { width: min(86cqw, 40cqh); } .vv-elso { flex-direction: row; } }
@container (max-height: 215px) { .vv-ult { width: auto; flex: 1; } }

/* vertical (celular de pie, tableta vertical): se apila y se desliza */
@media (max-aspect-ratio: 11/10) {
  .vv { --bug: 64px; --top: 24px; --pad: 10px; --gap: 8px; }
  .vv-in { height: auto; min-height: 100%; }
  .vv-cuerpo { display: flex; flex-direction: column; container-type: normal; flex: none; }
  .vv-uni > .vv-cuerpo > .vv-cancha { width: 100%; height: auto; }
  .vv-izq { width: 100%; max-width: none; --met: 54px; }
  .vv-colA, .vv-colB, .vv-der { flex: none; }
  .vv-marcas, .vv-gen .vv-marcas { flex: none; height: 110px; }
  .vv-elso { flex: none; height: min(95vw, 360px); }
  .vv { --bug: 84px; }
  .vv-lado { padding: 0 10px; gap: 2px; flex-direction: column; justify-content: center; align-items: flex-start; }
  .vv-lado.v { flex-direction: column; align-items: flex-end; text-align: right; }
  .vv-spacer, .vv-lado .vv-sp { display: none; }
  .vv-logo:not(.ch) { display: none; }
  .vv-nom { font-size: 11px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; max-width: 100%; }
  .vv-pts { font-size: 38px; }
  .vv-cen { flex-direction: column; padding: 0 12px; gap: 4px; justify-content: center; }
  .vv-reloj { font-size: 24px; }
  .vv-etq { display: none; }
  .vv-izq .vv-mets { grid-auto-flow: row; grid-template-columns: 1fr 1fr; height: auto; }
  .vv-izq .vv-mets > .vv-m:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .vv-jug { --j: clamp(34px, 15cqw, 80px); }
  .vv-gen .vv-jug { --j: clamp(22px, 6.8cqw, 44px); }
}
@media (prefers-reduced-motion: reduce) { .vv .salto, .vv-pill i { animation: none; } .vv-marca { transition: none; } }

/* Ola 3 · #3 y #6: Compartir este partido (arriba) y la señal de frescura bajo el marcador */
.vv-comp { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--linea); background: var(--papel);
  color: #e8edf5; font: 700 12px Montserrat, sans-serif; cursor: pointer; flex: none; position: relative; }
.vv-comp::after, .vv-x::after { content: ''; position: absolute; inset: -8px; }   /* toque de 44 px sin agrandar la barra */
.vv-x { position: relative; display: grid; place-items: center; }
.vv-comp .ic, .vv-x .ic { width: 15px; height: 15px; }
.vv-min .ic { width: 1em; height: 1em; vertical-align: -.12em; }
.vv-fresco { display: flex; align-items: center; justify-content: center; gap: 6px; flex: none; height: clamp(12px, 2.4dvh, 16px); margin: calc(var(--gap) * -.5) 0;
  font: 600 clamp(9px, 1.6dvh, 11px) var(--mono); color: var(--tinta-3); }
.vv-fresco i { width: 6px; height: 6px; border-radius: 50%; background: var(--verde); }
.vv-fresco i.late { animation: vv-fresco .9s ease-out; }
.vv-fresco.sin { color: #fca5a5; }   /* color fijo: el aviso de sin conexión, sobre el marino de siempre */
.vv-fresco.sin i { background: #ef4444; animation: vv-lat 1.4s ease-in-out infinite; }
@keyframes vv-fresco { 0% { transform: scale(2.2); box-shadow: 0 0 0 0 rgba(22,163,74,.6); } 100% { transform: none; box-shadow: 0 0 0 8px rgba(22,163,74,0); } }
@media (prefers-reduced-motion: reduce) { .vv-fresco i.late { animation: none; } }
.vv-tt { display: flex; align-items: baseline; gap: 10px; margin-bottom: 5px; }
.vv-ley { margin-left: auto; font: 600 clamp(8px, 1.4dvh, 10px) var(--mono); color: var(--tinta-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
@media (max-width: 520px) { .vv-comp { padding: 0 7px; } .vv-comp span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } }
