/* ============================================================
   Tema ChatsFun para los juegos (se carga después de estilos.css)
   - Fondo claro lila, cabecera morada y botones morados como el chat
   - Las mesas conservan el tapete verde, con marco morado
   ============================================================ */
:root {
  --cp-900: #3b0f8a; --cp-800: #4c1d95; --cp-700: #6d28d9; --cp-600: #7c3aed; --cp-500: #8b5cf6;
  --cp-300: #c4b5fd; --cp-200: #ddd6fe; --cp-100: #ede9fe; --cp-50: #f6f3ff;
  --cp-bg: #f1edfb; --cp-text: #1f1a33; --cp-muted: #6b6785; --cp-line: #ece8f6;
  --cp-shadow: 0 6px 24px rgba(76, 29, 149, .08);
  /* el marco de madera de las mesas pasa a morado */
  --madera: #4c1d95; --madera-hi: #7c3aed; --madera-lo: #2e1065;
  --f-titulo: "Nunito", system-ui, sans-serif;
  color-scheme: light;
}
body { background: var(--cp-bg); background-image: none; color: var(--cp-text); }
body::before { background: var(--cp-700); }
h1, h2, h3 { font-weight: 900; letter-spacing: -.01em; }
a { color: var(--cp-700); }
:focus-visible { outline-color: var(--cp-500); }

/* ---------- cabecera ---------- */
.barra { background: linear-gradient(90deg, #5b21b6, #6d28d9 50%, #7c3aed); box-shadow: 0 4px 18px rgba(76, 29, 149, .25); }
.barra-in { max-width: 1280px; padding-block: 10px; }
.logo { color: #fff; font-family: var(--f-texto); font-weight: 900; font-size: 24px; text-shadow: none; gap: 10px; }
.logo-ico { width: 38px; height: 38px; border-radius: 50%; background: #fff; color: var(--cp-700); display: grid; place-items: center; flex: none; }
.logo-ico svg { width: 22px; height: 22px; }
.logo-sub { font-size: 12px; font-weight: 800; background: rgba(255, 255, 255, .2); padding: 3px 9px; border-radius: 999px; letter-spacing: .02em; }
.nav { background: #fff; border-radius: 999px; padding: 4px; gap: 2px; }
.nav a { color: var(--cp-text); font-weight: 800; padding: 7px 14px; }
.nav a:hover { background: var(--cp-50); }
.nav a[aria-current="page"] { background: linear-gradient(135deg, var(--cp-500), var(--cp-700)); color: #fff; }
.yo { background: rgba(255, 255, 255, .16); color: #fff; text-decoration: none; }
.yo:hover { background: rgba(255, 255, 255, .26); }
.mi-avatar:empty { display: none; }
.punto { box-shadow: 0 0 0 2px rgba(255, 255, 255, .4); }

/* ---------- avatares ---------- */
.av { width: 30px; height: 30px; border-radius: 50%; flex: none; display: inline-grid; place-items: center; overflow: hidden;
  color: #fff; font-weight: 900; font-size: 12px; background: var(--cp-600); }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av.peq { width: 26px; height: 26px; font-size: 11px; margin-right: 8px; vertical-align: middle; }
.av.maquina { background: rgba(255, 255, 255, .15); font-size: 14px; }
.av.hueco { visibility: hidden; height: 0; }
.mi-avatar .av { width: 28px; height: 28px; }

/* ---------- página y salón ---------- */
.pagina { max-width: 1280px; }
.intro h1 { color: var(--cp-text); }
.intro p, .pie { color: var(--cp-muted); }
.unirse label { color: var(--cp-text); }
input, select { background: #fff; border: 1px solid var(--cp-line); color: var(--cp-text); }
input:focus, select:focus { outline: 0; border-color: var(--cp-300); box-shadow: 0 0 0 4px var(--cp-50); }
#codigo-unirse { box-shadow: var(--cp-shadow); }
.aviso { background: #fff1f2; border-color: #fecdd3; color: #9f1239; }
.aviso code { background: #ffe4e6; }
.aviso-sesion { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: #fff; border: 2px solid var(--cp-200); border-radius: 16px; padding: 12px 16px; margin-top: 6px; font-weight: 700; box-shadow: var(--cp-shadow); }
.aviso-sesion[hidden] { display: none !important; }

.abiertas h2 { color: var(--cp-text); }
.abiertas li { background: #fff; box-shadow: var(--cp-shadow); }
.abiertas li small { color: var(--cp-muted); }

/* Fichas de juego: tarjeta blanca con el abanico de cartas sobre un trozo de tapete */
.ficha { background: #fff; box-shadow: var(--cp-shadow); border-radius: 20px; padding: 0 0 18px; overflow: hidden; transition: transform .15s, box-shadow .15s; }
.ficha:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(76, 29, 149, .16); }
.ficha.resaltada { box-shadow: 0 0 0 4px var(--cp-500), 0 12px 30px rgba(76, 29, 149, .25); }
.ficha .abanico, .ficha > .tablero-muestra, .ficha > :first-child { margin: 0; padding-top: 14px; height: 150px;
  background: radial-gradient(ellipse at 50% 30%, var(--tapete-hi), var(--tapete) 60%, var(--tapete-lo)); }
.ficha > :not(:first-child) { margin-inline: 18px; }
.ficha .quien { color: var(--cp-700); margin-top: 6px; }
.ficha h2 { color: var(--cp-text); font-size: 24px; }
.ficha p { color: var(--cp-muted); font-weight: 600; }
.ficha select { background: var(--cp-50); border-color: var(--cp-200); font-weight: 700; }

/* ---------- botones ---------- */
.btn { background: linear-gradient(135deg, var(--cp-500), var(--cp-700)); color: #fff; box-shadow: 0 4px 12px rgba(109, 40, 217, .3); }
.btn:active { transform: translateY(1px); box-shadow: 0 2px 6px rgba(109, 40, 217, .3); }
.btn.fantasma { background: #fff; color: var(--cp-800); box-shadow: inset 0 0 0 2px var(--cp-200); }
.btn.fantasma:hover { background: var(--cp-50); }
/* dentro del tapete verde los botones secundarios siguen siendo translúcidos */
.tapete .btn.fantasma { background: rgba(0, 0, 0, .28); color: #fff; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .3); }
.resultado .btn.fantasma { background: #fff; color: var(--cp-800); box-shadow: inset 0 0 0 2px var(--cp-200); }

.pastilla { background: #fff; color: var(--cp-text); box-shadow: var(--cp-shadow); }
.pastilla b { color: var(--cp-700); }
.tapete .pastilla { background: rgba(0, 0, 0, .3); color: #fff; box-shadow: none; }
.tapete .pastilla b { color: var(--oro); }

/* ---------- mesas ---------- */
.cabeza h1 { color: var(--cp-text); }
.tapete { box-shadow: inset 0 0 0 8px var(--madera), inset 0 0 0 10px var(--madera-hi), inset 0 0 0 11px var(--madera-lo),
  inset 0 0 70px rgba(0, 0, 0, .45), 0 18px 40px rgba(76, 29, 149, .25); }
.codigo strong { font-family: var(--f-texto); font-weight: 900; }
.resultado { background: rgba(30, 10, 70, .6); }
.resultado .panel { background: #fff; box-shadow: 0 0 0 4px var(--cp-300), 0 20px 40px rgba(30, 10, 70, .4); }

.reglas { background: #fff; box-shadow: var(--cp-shadow); }
.reglas summary { color: var(--cp-700); }
.reglas p { color: var(--cp-text); }

.dialogo { background: #fff; color: var(--cp-text); box-shadow: 0 0 0 4px var(--cp-200), 0 20px 40px rgba(30, 10, 70, .35); }
.dialogo::backdrop { background: rgba(30, 10, 70, .55); }
.estilo[aria-checked="true"] { border-color: var(--cp-600); box-shadow: 0 0 0 3px var(--cp-200); }
.aviso-flotante { background: #1f1a33; color: #fff; box-shadow: 0 10px 30px rgba(30, 10, 70, .35); }

/* ---------- charla de la mesa ---------- */
.charla { background: #fff; color: var(--cp-text); box-shadow: var(--cp-shadow); border-radius: 18px; padding: 14px; gap: 10px; }
.charla h2 { color: var(--cp-text); font-size: 18px; }
.charla.plegable summary { color: var(--cp-text); font-size: 17px; display: flex; align-items: center; gap: 8px; list-style: none; }
.charla.plegable summary::-webkit-details-marker { display: none; }
.charla.plegable summary::after { content: '▾'; margin-left: auto; color: var(--cp-muted); transition: transform .15s; }
.charla.plegable:not([open]) summary::after { transform: rotate(-90deg); }
.charla.plegable[open] summary { margin-bottom: 10px; }
.no-leidos { background: #ef4444; color: #fff; border-radius: 999px; min-width: 20px; height: 20px; padding: 0 6px; font-size: 11px; display: inline-grid; place-items: center; }

.mensajes { background: var(--cp-50); border-radius: 14px; padding: 10px; gap: 6px; max-height: 300px; min-height: 120px; font-size: 14px; scroll-behavior: smooth; }
.mensajes li.vacio { color: var(--cp-muted); text-align: center; font-weight: 700; margin: auto; padding: 20px 0; }
.mensajes li.sistema { align-self: center; justify-self: center; text-align: center; font-style: normal; font-size: 12px; font-weight: 700;
  color: var(--cp-muted); background: #fff; border-radius: 999px; padding: 3px 12px; }
.mensajes li.msj { display: flex; gap: 8px; align-items: flex-end; max-width: 88%; }
.mensajes li.msj.mio { flex-direction: row-reverse; justify-self: end; margin-left: auto; }
.mensajes li.seguido { margin-top: -2px; }
.mensajes .cuerpo { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mensajes li.mio .cuerpo { align-items: flex-end; }
.mensajes .cab { display: flex; gap: 6px; align-items: baseline; font-size: 12px; padding-inline: 4px; }
.mensajes .cab b { color: var(--cp-text); font-weight: 900; }
.mensajes .cab time { color: var(--cp-muted); font-weight: 600; font-size: 11px; }
.mensajes .burbuja { background: #fff; border-radius: 4px 14px 14px 14px; padding: 7px 12px; font-weight: 600; line-height: 1.35;
  overflow-wrap: anywhere; box-shadow: 0 1px 2px rgba(0, 0, 0, .05); }
.mensajes li.mio .burbuja { background: linear-gradient(135deg, #e4dbff, #d8ccff); border-radius: 14px 4px 14px 14px; }
.mensajes .burbuja.solo-emoji { background: none; box-shadow: none; font-size: 30px; padding: 0 4px; }

.reacciones { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.reaccion { flex: none; border: 1px solid var(--cp-line); background: #fff; border-radius: 999px; padding: 5px 11px; font-weight: 700; font-size: 13px; cursor: pointer; color: var(--cp-text); }
.reaccion:hover { background: var(--cp-50); border-color: var(--cp-200); }
.reaccion:active { transform: scale(.95); }

.enviar { gap: 8px; }
.enviar input { border-radius: 999px; padding: 10px 16px; }
.btn-enviar { width: 46px; height: 42px; flex: none; border: 0; border-radius: 999px; cursor: pointer; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--cp-500), var(--cp-700)); color: #fff; box-shadow: 0 4px 12px rgba(109, 40, 217, .3); }
.btn-enviar svg { width: 20px; height: 20px; fill: #fff; }

@media (min-width: 1100px) {
  #vista-partida .bajo-mesa .mensajes { max-height: min(460px, 55vh); }
}
@media (max-width: 760px) {
  .barra-in { gap: 8px; }
  .logo span:not(.logo-ico) { display: none; }
  .logo-sub { display: none; }
  .nav a { padding: 6px 10px; font-size: 13px; }
  .baraja-btn span { display: none; }
  #mi-nombre { display: none; }
}

/* ---------- correcciones ---------- */
/* dentro del tapete verde el texto vuelve a ser claro */
.tapete { color: var(--texto); }
.tapete .asientos-espera .quien small, .tapete .libre { color: var(--suave); }
/* que la fila de reacciones no ensanche la columna del chat */
.charla > *, .bajo-mesa > * { min-width: 0; }
.reacciones { max-width: 100%; }
.mensajes li.sistema { max-width: 100%; overflow-wrap: anywhere; }
.charla { grid-template-columns: minmax(0, 1fr); }
.charla.plegable { overflow: hidden; }
.charla.plegable::details-content { min-width: 0; }

/* ---------- Jugadores de la mesa ---------- */
.av.mini { width: 22px; height: 22px; font-size: 9px; }
.asiento .nm span.av { overflow: hidden; }
.insignia-ia { display: inline-block; flex: none; font-size: 9px; font-weight: 800; letter-spacing: .04em; line-height: 1;
  padding: 3px 6px; border-radius: 6px; background: rgba(255, 255, 255, .18); color: #e5e7eb; text-transform: lowercase;
  vertical-align: middle; margin-left: 6px; }
.asiento .nm .insignia-ia { margin-left: 0; overflow: visible; }
.charla .cab .insignia-ia { margin-left: 0; }
.asiento.pensando { position: relative; }
.asiento.pensando::after { content: '💭 pensando…'; position: absolute; left: 50%; top: -18px; transform: translateX(-50%);
  background: #fff; color: #4c1d95; font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .25); white-space: nowrap; animation: pensar 1.4s ease-in-out infinite; pointer-events: none; z-index: 3; }
@keyframes pensar { 0%, 100% { opacity: .65; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .asiento.pensando::after { animation: none; } }

/* ---------- Mesa más grande, charla el doble de ancha ---------- */
.barra-in, .pagina { max-width: 1720px; }
.mesa { min-height: 640px; }
.asiento { max-width: 380px; }
/* Cartas tapadas de los rivales casi del tamaño de las mías */
.tapadas .carta { --cw: clamp(50px, 9.5vw, 84px); margin-left: calc(var(--cw) * -0.6); }
.sitio.izq .tapadas .carta, .sitio.der .tapadas .carta { --cw: clamp(36px, 4.4vw, 62px); margin-left: calc(var(--cw) * -0.72); }
.sitio.izq .asiento, .sitio.der .asiento { width: clamp(110px, 12vw, 210px); }
.tapadas { min-height: calc(var(--cw, 60px) * 1.2); }
@media (min-width: 1100px) {
  #vista-partida { grid-template-columns: minmax(0, 1fr) clamp(480px, 36vw, 660px); }
  #vista-partida .bajo-mesa .mensajes { max-height: min(640px, 62vh); min-height: min(360px, 40vh); }
}
@media (max-width: 700px) {
  .tapadas .carta, .sitio.izq .tapadas .carta, .sitio.der .tapadas .carta { --cw: 34px; margin-left: -22px; }
  .mesa { min-height: 0; }
}

/* ---------- "Fulano está escribiendo…" en la charla de la mesa ---------- */
.escribiendo { display: flex; align-items: center; gap: 8px; padding: 2px 12px 6px; font-size: 12.5px; font-style: italic; color: var(--cp-700, #6d28d9); }
.escribiendo[hidden] { display: none; }
.escribiendo .puntos { display: inline-flex; gap: 3px; }
.escribiendo .puntos i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .35; animation: escribe 1.2s infinite ease-in-out; }
.escribiendo .puntos i:nth-child(2) { animation-delay: .2s; }
.escribiendo .puntos i:nth-child(3) { animation-delay: .4s; }
@keyframes escribe { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .escribiendo .puntos i { animation: none; opacity: .7; } }

/* ---------- Pestaña desconectada porque los juegos están abiertos en otra ---------- */
.pestana-ocupada { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px;
  background: rgba(30, 10, 60, .55); backdrop-filter: blur(3px); }
.pestana-ocupada[hidden] { display: none; }
.pestana-ocupada .panel { background: #fff; color: var(--texto, #1f1a33); border-radius: 18px; padding: 24px 26px; max-width: 420px;
  text-align: center; display: grid; gap: 10px; box-shadow: 0 20px 50px rgba(40, 10, 90, .35); }
.pestana-ocupada h2 { margin: 0; font-size: 20px; color: #3b0f8a; }
.pestana-ocupada p { margin: 0; color: #6b6785; }
.pestana-ocupada .fila { display: flex; justify-content: center; margin-top: 6px; }

/* ---------- Invitar a un asiento ---------- */
.esperando-resp { color: var(--cp-muted, #6b6785); font-style: italic; }
li.invitado .av { opacity: .65; }
.capa-invitar { position: fixed; inset: 0; z-index: 200; background: rgba(20, 10, 40, .55); display: grid; place-items: center; padding: 16px; }
.dialogo-invitar { position: relative; background: #fff; color: #1f1a33; border-radius: 18px; width: min(440px, 100%); max-height: min(620px, 90vh); display: flex; flex-direction: column; gap: 10px; padding: 20px 20px 14px; box-shadow: 0 20px 50px rgba(40, 10, 90, .35); }
.dialogo-invitar h3 { margin: 0; font-size: 19px; }
.dialogo-invitar .nota { margin: 0; color: #6b6785; font-size: 13.5px; }
.dialogo-invitar input { border: 1px solid #ddd6fe; border-radius: 12px; padding: 9px 12px; font: inherit; }
.dialogo-invitar .cerrar { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: #f6f3ff; cursor: pointer; font-size: 15px; }
.lista-invitar { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.lista-invitar li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 12px; }
.lista-invitar li:hover { background: #f6f3ff; }
.lista-invitar .quien { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; font-weight: 700; flex-wrap: wrap; }
.lista-invitar .quien small { flex-basis: 100%; margin-left: 40px; margin-top: -4px; color: #6b6785; font-weight: 600; font-size: 12px; }
.lista-invitar .vacia { color: #6b6785; justify-content: center; }

/* ---------- Gráficos ilustrados (img/) ---------- */
/* Tapete de fieltro de verdad, con un poco de luz en el centro y sombra en los bordes */
.tapete {
  background:
    radial-gradient(ellipse at 50% 42%, rgba(255, 255, 255, .10), rgba(255, 255, 255, 0) 45%, rgba(0, 0, 0, .34) 100%),
    url(../img/tapete.jpg) center / 340px repeat,
    var(--tapete);
}
/* Salón: la carátula del juego en lo alto de cada ficha */
.ficha > .portada.portada { height: 170px; padding: 0; background-color: var(--tapete); background-size: cover; background-position: center; }
/* Ajedrez: piezas ilustradas (el símbolo queda oculto, solo para lectores de pantalla) */
.pz-ajedrez.con-img { display: block; width: 90%; height: 90%; background: center / contain no-repeat; color: transparent;
  -webkit-text-stroke: 0; text-shadow: none; font-size: 0; filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .35)); }
.abanico.mini-tablero .pz-ajedrez.con-img { font-size: 0; -webkit-text-stroke: 0; filter: none; }

/* Fichas ilustradas (img/piezas/), en el estilo de las carátulas */
.pz-dama[class], .pz-reversi[class], .pz-disco[class] { background-color: transparent; background-position: center; background-size: contain; background-repeat: no-repeat;
  box-shadow: none; filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .35)); }
.pz-dama.blanca { background-image: url(../img/piezas/dama-blanca.png); }
.pz-dama.negra { background-image: url(../img/piezas/dama-negra.png); }
.pz-dama.blanca.reina { background-image: url(../img/piezas/dama-blanca-reina.png); }
.pz-dama.negra.reina { background-image: url(../img/piezas/dama-negra-reina.png); }
.pz-dama.reina::after { content: none; }
.pz-reversi.blanca { background-image: url(../img/piezas/reversi-blanca.png); }
.pz-reversi.negra { background-image: url(../img/piezas/reversi-negra.png); }
.pz-disco { width: 92%; height: 92%; }
.pz-disco.roja { background-image: url(../img/piezas/disco-roja.png); }
.pz-disco.amarilla { background-image: url(../img/piezas/disco-amarilla.png); }
/* Hundir la flota: salpicadura, explosión y barco hundido */
.pz-flota.f-o { background: url(../img/piezas/flota-agua.png) center / 78% no-repeat; }
.pz-flota.f-x { background: url(../img/piezas/flota-tocado.png) center / 92% no-repeat, #7d8a96; }
.pz-flota.f-h { background: url(../img/piezas/flota-hundido.png) center / 92% no-repeat, #5b2323; }
.pz-flota.f-o::after, .pz-flota.f-x::after, .pz-flota.f-h::after { content: none; }
/* Casillas de madera en damas y ajedrez */
.zona-tablero[data-juego="damas"] .clara, .zona-tablero[data-juego="ajedrez"] .clara { background: url(../img/madera-clara.jpg) center / 220% #f0dfb4; }
.zona-tablero[data-juego="damas"] .oscura, .zona-tablero[data-juego="ajedrez"] .oscura { background: url(../img/madera-oscura.jpg) center / 220% #9b6a3c; }
/* Póquer: montoncito de fichas junto al bote */
.zona-grupo.con-fichas .etq::before { content: ""; display: inline-block; width: 38px; height: 38px; margin: -8px 6px -8px 0; vertical-align: middle;
  background: url(../img/piezas/fichas-casino.png) center / contain no-repeat; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .35)); }
/* Reversi: casillas de fieltro */
.zona-tablero[data-juego="reversi"] .celda { background: linear-gradient(rgba(60, 170, 100, .35), rgba(60, 170, 100, .35)), url(../img/tapete.jpg) center / 300% #2f8a52; }
.zona-tablero[data-juego="reversi"] button.celda.pulsable:hover { background: linear-gradient(rgba(120, 220, 150, .35), rgba(120, 220, 150, .35)), url(../img/tapete.jpg) center / 300% #3aa064; }
/* Nombre del juego como enlace (SEO) */
.ficha h2 a { color: inherit; text-decoration: none; }
.ficha h2 a:hover { color: var(--cp-700); text-decoration: underline; }
/* Puntos de cada jugador junto a su nombre */
.pts { display: inline-block; margin-left: 6px; padding: 1px 9px; border-radius: 999px; white-space: nowrap;
  background: linear-gradient(180deg, #f8dc8c, #e9b949); color: #3b2a06; font-size: 12.5px; font-weight: 900; line-height: 1.5;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35); font-variant-numeric: tabular-nums; }
.pts.cambia { animation: pts-sube .7s ease; }
@keyframes pts-sube { 0% { transform: scale(1); } 30% { transform: scale(1.35); box-shadow: 0 0 0 4px rgba(233, 185, 73, .45); } 100% { transform: scale(1); } }

/* Reloj del turno: barra que se vacía y segundos; en los últimos 10 s se pone roja y late */
.reloj { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 74px; height: 22px; padding: 0 10px;
  border-radius: 999px; overflow: hidden; background: rgba(0, 0, 0, .35); box-shadow: inset 0 0 0 1.5px rgba(233, 185, 73, .7);
  font: 800 12px/1 inherit; color: #fff; font-variant-numeric: tabular-nums; white-space: nowrap; }
.reloj i { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; background: linear-gradient(90deg, #e9b949, #f5d27a); opacity: .55; transition: width .25s linear; }
.reloj b { position: relative; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.reloj.apurado { box-shadow: inset 0 0 0 1.5px #f87171; animation: reloj-late 1s ease-in-out infinite; }
.reloj.apurado i { background: linear-gradient(90deg, #dc2626, #f87171); }
@keyframes reloj-late { 50% { transform: scale(1.08); } }
.asiento .reloj { margin-top: 2px; }
.reloj.en-msg { margin-left: 10px; vertical-align: middle; height: 24px; font-size: 13px; }

/* Enlaces legales del pie */
.pie .legal { margin-top: 8px; }
.pie .legal a { color: inherit; font-weight: 700; }

/* Logo de ChatsFun en la cabecera de los juegos */
.logo img.logo-img { display: block; height: 40px; width: auto; max-width: none; box-sizing: border-box; border-radius: 999px; padding: 5px 14px 5px 9px; background: #fff; border-radius: 999px; box-shadow: 0 2px 10px rgba(40, 10, 90, .18); }

/* ============================================================
   Cabecera en una fila, rivales sin solaparse y pantalla completa
   ============================================================ */
.logo img.logo-icono { display: none; }
.nav a { display: inline-flex; align-items: center; gap: 6px; }
.nav .t-corto { display: none; }
.btn-pantalla { display: inline-flex; align-items: center; gap: 6px; }
.btn-pantalla .ico-cerrar, .btn-pantalla[aria-pressed="true"] .ico-abrir { display: none; }
.btn-pantalla[aria-pressed="true"] .ico-cerrar { display: block; }

/* ---------- Pantalla completa: solo la mesa, fija y ocupando toda la pantalla ---------- */
.btn-charla, .cerrar-charla { display: none; }
body.pantalla-completa { overflow: hidden; overscroll-behavior: none; }
body.pantalla-completa .barra, body.pantalla-completa .pie, body.pantalla-completa .aviso-cookies { display: none !important; }
body.pantalla-completa #vista-partida { position: fixed; inset: 0; z-index: 40; display: flex !important; flex-direction: column; align-items: stretch; gap: 6px;
  background: var(--cp-bg); padding: max(6px, env(safe-area-inset-top, 0px)) max(6px, env(safe-area-inset-right, 0px)) max(6px, env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px)); }
/* Barra de arriba: marcador (se desliza) y botones, en una sola fila */
body.pantalla-completa #vista-partida > .cabeza { flex: none; display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; margin: 0; }
body.pantalla-completa #vista-partida > .cabeza h1, body.pantalla-completa #partida-codigo { display: none; }
body.pantalla-completa #vista-partida > .cabeza .marcador { flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0; padding: 0; }
body.pantalla-completa #vista-partida > .cabeza .marcador::-webkit-scrollbar { display: none; }
body.pantalla-completa #vista-partida > .cabeza .pastilla { flex: none; font-size: 13px; padding: 5px 10px; }
body.pantalla-completa #vista-partida > .cabeza .btn { flex: none; }
body.pantalla-completa .btn-charla { display: inline-flex; align-items: center; gap: 6px; position: relative; }
.btn-charla .no-leidos { position: absolute; top: -6px; right: -6px; }
/* La mesa ocupa todo lo que queda; si algo no cabe, se desplaza dentro de la mesa (la página no se mueve) */
body.pantalla-completa .mesa { flex: 1 1 auto; min-height: 0 !important; width: 100%; box-sizing: border-box; overflow-y: auto; overscroll-behavior: contain;
  grid-template-rows: auto minmax(0, 1fr) auto; align-content: stretch; }
/* La charla: oculta hasta pulsar 💬; entonces aparece por encima de la mesa */
body.pantalla-completa #vista-partida .bajo-mesa { display: none; }
body.pantalla-completa.charla-abierta #vista-partida .bajo-mesa { display: block; position: fixed; z-index: 45; margin: 0;
  left: max(8px, env(safe-area-inset-left, 0px)); right: max(8px, env(safe-area-inset-right, 0px)); bottom: max(8px, env(safe-area-inset-bottom, 0px)); }
body.pantalla-completa.charla-abierta .bajo-mesa .reglas { display: none; }
body.pantalla-completa.charla-abierta #charla-partida { position: relative; box-shadow: 0 -10px 40px rgba(20, 8, 50, .45); border-radius: 18px; max-height: min(70dvh, 560px); display: flex; flex-direction: column; }
body.pantalla-completa.charla-abierta #charla-partida .mensajes { max-height: none; min-height: 90px; flex: 1 1 auto; height: min(40dvh, 340px); }
body.pantalla-completa.charla-abierta #charla-partida summary::after { content: none; }
body.pantalla-completa.charla-abierta .cerrar-charla { display: grid; place-items: center; position: absolute; top: 10px; right: 10px; width: 34px; height: 34px;
  border: 0; border-radius: 50%; background: var(--cp-50); color: var(--cp-text); font-size: 15px; cursor: pointer; }
@media (min-width: 900px) {
  /* En pantallas grandes, la charla sale como panel a la derecha */
  body.pantalla-completa.charla-abierta #vista-partida .bajo-mesa { left: auto; width: 400px; top: 64px; }
  body.pantalla-completa.charla-abierta #charla-partida { max-height: 100%; height: 100%; }
  body.pantalla-completa.charla-abierta #charla-partida .mensajes { height: auto; }
}

@media (max-width: 700px) {
  /* Cabecera: todo en una fila (icono del logo, secciones, baraja y tu cuenta) */
  .barra-in { flex-wrap: nowrap; gap: 6px; padding-block: 8px; padding-left: max(10px, env(safe-area-inset-left, 0px)); padding-right: max(10px, env(safe-area-inset-right, 0px)); }
  .logo { flex: none; }
  .logo img.logo-img, .logo-sub { display: none; }
  .logo img.logo-icono { display: block; width: 40px; height: 40px; border-radius: 50%; background: #fff; padding: 4px; box-shadow: 0 2px 10px rgba(40, 10, 90, .18); }
  .nav { flex: 1 1 auto; min-width: 0; justify-content: space-between; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: 1 0 auto; justify-content: center; gap: 4px; padding: 7px 9px; font-size: 13.5px; }
  .nav .t-largo { display: none; }
  .nav .t-corto { display: inline; }
  .yo, .baraja-btn { margin-left: 0; flex: none; }
  .baraja-btn { width: 38px; height: 38px; padding: 0; justify-content: center; }
  .baraja-btn img { width: 16px; }
  #btn-yo { padding: 4px 5px 4px 9px; gap: 6px; }

  /* Título de la partida: una fila con el nombre y los botones, y el marcador debajo (se desliza) */
  #vista-partida > .cabeza { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 8px; align-items: center; margin-bottom: 10px; }
  #vista-partida > .cabeza h1 { font-size: 22px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #vista-partida > .cabeza .marcador { grid-column: 1 / -1; grid-row: 2; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    margin-inline: -16px; padding: 0 16px 2px; }
  #vista-partida > .cabeza .marcador::-webkit-scrollbar { display: none; }
  #vista-partida > .cabeza .pastilla { flex: none; font-size: 13px; padding: 5px 10px; }
  #vista-partida > .cabeza .btn.pequeno { padding: 7px 11px; font-size: 13.5px; }
  .btn-pantalla .t { display: none; }

  /* Rivales: columnas iguales arriba, cada uno en su hueco (sin montarse ni salirse) */
  .mesa { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-areas: "izq arr der" "medio medio medio" "yo yo yo"; gap: 10px 6px; }
  .mesa:has(> .sitio.arr:empty) { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "izq der" "medio medio" "yo yo"; }
  .mesa:has(> .sitio.izq:empty):has(> .sitio.der:empty) { grid-template-columns: minmax(0, 1fr); grid-template-areas: "arr" "medio" "yo"; }
  .mesa > .sitio { justify-self: stretch; align-self: start; width: 100%; }
  .mesa .sitio .asiento { width: 100%; max-width: 100%; flex: 1 1 0; padding: 6px 4px; }
  .asiento .nm { flex-wrap: wrap; justify-content: center; gap: 2px 5px; font-size: 13.5px; }
  .asiento .nm > span:not([class]) { max-width: calc(100% - 28px); }
  .asiento .nm .pts { margin-left: 0; font-size: 11.5px; padding: 0 7px; }
  .asiento .inf { font-size: 11px; line-height: 1.25; overflow-wrap: anywhere; }
  .mesa .tapadas { width: 100%; }
  .mesa .sitio .tapadas .carta { --cw: 32px; margin-left: -16px; }
  .mesa .sitio .tapadas .carta:first-child { margin-left: 0; }
  .mesa .tapadas:empty { display: none; }
  /* Bocadillos ("Pido 1", "No puede mover"): centrados sobre el jugador, sin salirse de la mesa */
  .mesa .sitio .bocadillo { right: 50%; transform: translateX(50%); top: -12px; max-width: 100%; font-size: 11px; padding: 2px 8px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* Pantalla completa en el móvil: más sitio para las cartas */
  body.pantalla-completa #vista-partida > .cabeza { display: flex; }
  body.pantalla-completa #vista-partida > .cabeza .marcador { margin: 0; padding: 0; }
  body.pantalla-completa .btn-charla .t { display: none; }
  body.pantalla-completa .mesa { --cw: clamp(48px, min(15vw, 10dvh), 110px); border-radius: 22px; padding: 16px 12px; }
  body.pantalla-completa .mesa .sitio .tapadas .carta { --cw: 34px; }

  /* Cuatro jugadores de cartas: en cruz (pareja enfrente, rivales a los lados) */
  .mesa.cruz, body.pantalla-completa .mesa.cruz { grid-template-columns: 74px minmax(0, 1fr) 74px; grid-template-areas: "arr arr arr" "izq medio der" "yo yo yo"; }
  .mesa.cruz > .sitio.izq, .mesa.cruz > .sitio.der { align-self: center; }
  .mesa.cruz > .sitio.arr { justify-self: center; width: min(100%, 220px); }
  .mesa.cruz .sitio.izq .asiento, .mesa.cruz .sitio.der .asiento { padding: 6px 2px; }
  .mesa.cruz .sitio.izq .nm, .mesa.cruz .sitio.der .nm { flex-direction: column; gap: 2px; font-size: 12.5px; }
  .mesa.cruz .sitio.izq .nm > span:not([class]), .mesa.cruz .sitio.der .nm > span:not([class]) { max-width: 100%; }
  .mesa.cruz .sitio.izq .tapadas, .mesa.cruz .sitio.der .tapadas { flex-direction: column; align-items: center; width: auto; min-height: 0; }
  .mesa.cruz .sitio.izq .tapadas .carta, .mesa.cruz .sitio.der .tapadas .carta { --cw: 30px; margin-left: 0; margin-top: -32px; }
  .mesa.cruz .sitio.izq .tapadas .carta:first-child, .mesa.cruz .sitio.der .tapadas .carta:first-child { margin-top: 0; }
  .mesa.cruz .sitio.izq .inf, .mesa.cruz .sitio.der .inf { font-size: 10.5px; }
  /* El centro (baza, mazo) un poco más pequeño para que quepa entre los dos lados */
  .mesa.cruz .medio { --cw: 46px; }
  body.pantalla-completa .mesa.cruz .medio { --cw: clamp(46px, 13vw, 60px); }
}
@media (max-width: 400px) {
  /* Muy estrecho: las secciones solo con su icono (menos la que estás viendo) */
  .nav a:not([aria-current]) .t { display: none; }
  .nav a { padding: 7px 10px; font-size: 15px; }
}

/* ---------- Rivales a los lados: nada se sale de su sitio (ordenador) ---------- */
.asiento { grid-template-columns: minmax(0, 1fr); }
.sitio.izq .asiento .nm, .sitio.der .asiento .nm { flex-wrap: wrap; justify-content: center; row-gap: 3px; }
/* Pantalla completa en el ordenador: la charla ocupa el panel de la derecha de arriba abajo */
@media (min-width: 900px) {
  body.pantalla-completa.charla-abierta #charla-partida .mensajes { height: calc(100dvh - 300px); min-height: 160px; }
}
/* Pantalla completa en el ordenador: la mesa centrada y con forma de mesa (no estirada a lo ancho) */
@media (min-width: 900px) {
  body.pantalla-completa .mesa { align-self: center; width: min(100%, calc((100dvh - 60px) * 1.35)); }
  body.pantalla-completa #vista-partida > .cabeza { align-self: center; width: min(100%, calc((100dvh - 60px) * 1.35)); }
}

/* ---------- Botones de acción ---------- */
.botones .btn.peligro { background: linear-gradient(135deg, #f43f5e, #be123c); color: #fff; border-color: transparent; box-shadow: 0 4px 12px rgba(190, 18, 60, .35); }
.botones .btn.peligro:hover { filter: brightness(1.06); }
/* Panel para elegir cuánto se envida o se sube */
.yo-zona { position: relative; }
.panel-cantidad { position: absolute; left: 50%; bottom: 58px; transform: translateX(-50%); z-index: 6; width: min(340px, calc(100% - 8px));
  background: #fff; color: var(--cp-text, #1f1235); border-radius: 18px; padding: 12px 14px 14px; box-shadow: 0 18px 44px rgba(10, 4, 30, .5);
  display: grid; gap: 10px; animation: pc-entra .16s ease-out; }
@keyframes pc-entra { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.panel-cantidad .pc-cab { display: flex; align-items: center; justify-content: space-between; font-size: 16px; }
.panel-cantidad .pc-cerrar { width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--cp-50, #f3efff); color: inherit; font-size: 14px; cursor: pointer; }
.panel-cantidad .pc-rapidas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.panel-cantidad .pc-rapidas .btn { justify-content: center; text-align: center; font-size: 18px; font-weight: 800; padding: 10px 0; color: var(--cp-700, #6d28d9); border-color: var(--cp-200, #ddd6fe); background: var(--cp-50, #f5f3ff); }
.panel-cantidad .pc-fila { display: grid; grid-template-columns: 44px 52px 44px 1fr; gap: 8px; align-items: center; }
.panel-cantidad .pc-paso { height: 44px; border: 1px solid var(--cp-200, #ddd6fe); border-radius: 12px; background: #fff; color: var(--cp-700, #6d28d9); font-size: 24px; font-weight: 800; cursor: pointer; }
.panel-cantidad .pc-paso:disabled { opacity: .35; cursor: default; }
.panel-cantidad .pc-valor { text-align: center; font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; }
.panel-cantidad .pc-ok { height: 44px; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .panel-cantidad { animation: none; } }

/* ---------- Bocadillos («Envido», «Paso», «Mus»…) más grandes y visibles ---------- */
.bocadillo { font-size: 15px; padding: 4px 13px; border-radius: 14px; box-shadow: 0 4px 12px rgba(0, 0, 0, .45); animation: bocadillo-sale .22s ease-out; }
.mi-placa .bocadillo { top: -30px; }
@keyframes bocadillo-sale { from { opacity: 0; scale: .6; } to { opacity: 1; scale: 1; } }
@media (prefers-reduced-motion: reduce) { .bocadillo { animation: none; } }

@media (max-width: 700px) {
  .mesa .sitio .bocadillo { font-size: 14px; padding: 3px 11px; top: -16px; }
  /* Botones de acción grandes, ocupando el ancho, fáciles de pulsar con el dedo */
  .botones { gap: 6px; width: 100%; }
  .botones .btn { flex: 1 1 0; min-width: 0; padding: 12px 6px; font-size: 15.5px; border-radius: 14px; white-space: nowrap; }
  .panel-cantidad { bottom: 60px; }
}
/* La primera carta tapada de los rivales de los lados no se mete hacia fuera (con pocas cartas se veían montadas) */
.sitio.izq .tapadas .carta:first-child, .sitio.der .tapadas .carta:first-child { margin-left: 0; }
/* Mientras un jugador piensa, su bocadillo anterior no se monta con el «pensando…» */
.asiento.pensando .bocadillo { visibility: hidden; }

/* ---------- Distintivo del asiento (quién es mano en el mus) ---------- */
.distintivo { display: inline-flex; align-items: center; gap: 4px; flex: none; padding: 3px 10px 3px 4px; border-radius: 999px;
  background: linear-gradient(135deg, #fde68a, #f59e0b); color: #4a2600; font-size: 12.5px; font-weight: 900; letter-spacing: .02em;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .85), 0 3px 10px rgba(0, 0, 0, .35); white-space: nowrap; line-height: 1.2; }
.distintivo .ic { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #fff; font-size: 12px; }
.asiento .nm .distintivo { overflow: visible; }

/* ================= Bingo (más visual) ================= */
.zona-bingo{container:bingo/inline-size;position:relative;display:flex;flex-direction:column;align-items:center;gap:14px;width:100%;max-width:980px;margin:0 auto}
/* Bolas por decenas, cada una de su color */
.bbola{--c1:#ff8fb1;--c2:#d6336c;position:relative;flex:none;width:38px;height:38px;border-radius:50%;display:grid;place-items:center;
  background:radial-gradient(circle at 32% 28%,#fff 0 12%,var(--c1) 40%,var(--c2) 100%);box-shadow:0 3px 8px rgba(0,0,0,.35),inset 0 -3px 6px rgba(0,0,0,.2)}
.bbola b{display:grid;place-items:center;width:64%;height:64%;border-radius:50%;background:#fff;color:#1f1630;font-weight:900;font-size:14px;line-height:1;box-shadow:inset 0 0 0 2px rgba(0,0,0,.06)}
.b-dec0{--c1:#ff9ec4;--c2:#e0307a}.b-dec1{--c1:#8fd3ff;--c2:#1c6fd1}.b-dec2{--c1:#9be7a6;--c2:#1f9a4a}
.b-dec3{--c1:#ffd58a;--c2:#e08a00}.b-dec4{--c1:#c9a8ff;--c2:#7a3fe0}.b-dec5{--c1:#ff9f8a;--c2:#d9381e}
.b-dec6{--c1:#86e8e0;--c2:#0f9c94}.b-dec7{--c1:#ffe27a;--c2:#c9a000}.b-dec8{--c1:#b8c4d6;--c2:#4a5a78}
.bbola.grande{width:clamp(96px,22vw,132px);height:clamp(96px,22vw,132px);box-shadow:0 10px 26px rgba(0,0,0,.45),inset 0 -8px 14px rgba(0,0,0,.22),0 0 0 6px rgba(255,255,255,.18)}
.bbola.grande b{font-size:clamp(38px,9vw,56px)}
.bbola.grande.vacia{--c1:#d9d4e6;--c2:#8a83a3}
.bbola.nueva{animation:bingo-sale .7s cubic-bezier(.2,.9,.3,1.25)}
@keyframes bingo-sale{0%{transform:translateX(-60px) rotate(-200deg) scale(.4);opacity:0}70%{transform:translateX(4px) rotate(10deg) scale(1.06);opacity:1}100%{transform:none}}

.bingo-cabeza{display:flex;align-items:center;gap:16px;width:100%;padding:12px 16px;border-radius:22px;box-sizing:border-box;
  background:linear-gradient(135deg,rgba(124,58,237,.92),rgba(219,39,119,.88));box-shadow:0 10px 24px rgba(0,0,0,.3),inset 0 1px 0 rgba(255,255,255,.25)}
.bingo-actual{flex:none;display:grid;place-items:center}
.bingo-info{flex:1 1 auto;min-width:0;display:grid;gap:8px;color:#fff}
.bingo-titulo{font-size:clamp(18px,3.6vw,24px);font-weight:900;letter-spacing:.01em}
.bingo-titulo b{font-size:1.25em}
.bingo-chips{display:flex;flex-wrap:wrap;gap:6px}
.bchip{padding:3px 10px;border-radius:999px;background:rgba(255,255,255,.2);font-size:12.5px;font-weight:800}
.bchip.turbo{background:#fde047;color:#4a2600}
.bchip.linea{background:#fff;color:#7c3aed}
.bingo-ultimas{display:flex;gap:6px;overflow:hidden;min-height:38px}
.bingo-ultimas .bbola:nth-child(n+4){opacity:.85}
.bingo-ultimas .bbola:first-child{animation:bingo-corre .5s ease-out}
@keyframes bingo-corre{from{transform:translateX(-24px);opacity:0}}
.bingo-reloj{width:clamp(96px,22vw,132px);height:clamp(96px,22vw,132px);border-radius:50%;display:grid;place-content:center;text-align:center;color:#fff;
  background:radial-gradient(circle at 35% 30%,rgba(255,255,255,.35),rgba(255,255,255,.08));box-shadow:inset 0 0 0 5px rgba(255,255,255,.5)}
.bingo-reloj b{font-size:clamp(40px,10vw,58px);font-weight:900;line-height:1}
.bingo-reloj span{font-size:13px;font-weight:800;opacity:.85}

.bingo-de{color:var(--crema);font-weight:800;font-size:14px}
.bingo-cartones{display:grid;gap:14px;width:100%;grid-template-columns:minmax(0,1fr)}
.bingo-cartones.n1{max-width:560px}
@container bingo (min-width:620px){.bingo-cartones.n2,.bingo-cartones.n3,.bingo-cartones.n4{grid-template-columns:repeat(2,minmax(0,1fr))}}
.bcarton{container-type:inline-size;--tc:#db2777;--tc2:#fce7f3;border-radius:16px;background:#fff;overflow:hidden;box-shadow:0 8px 20px rgba(0,0,0,.3),0 0 0 3px var(--tc);transition:transform .2s}
.bcarton.tema1{--tc:#2563eb;--tc2:#dbeafe}.bcarton.tema2{--tc:#16a34a;--tc2:#dcfce7}.bcarton.tema3{--tc:#ea580c;--tc2:#ffedd5}
.bc-cab{display:flex;align-items:center;justify-content:center;gap:10px;padding:6px 10px;background:var(--tc2);color:var(--tc);font-weight:900;font-size:clamp(14px,5cqi,20px)}
.bc-cab b{font-size:1.2em}
.bc-cab em{font-style:normal;font-size:12px;padding:2px 8px;border-radius:999px;background:var(--tc);color:#fff}
.bc-rejilla{display:grid;grid-template-columns:repeat(9,minmax(0,1fr));gap:3px;padding:8px}
.bc-rejilla span{aspect-ratio:1/1;display:grid;place-items:center;border-radius:8px;font-weight:900;font-size:clamp(10px,4.6cqi,22px);color:#2a2140;background:#faf7ff;box-shadow:inset 0 0 0 1px #ece6f5}
.bc-rejilla .vacia{background:transparent;box-shadow:none}
.bc-rejilla .marcado{color:#fff;background:radial-gradient(circle at 34% 28%,var(--c1),var(--c2) 75%);box-shadow:0 2px 4px rgba(0,0,0,.25);border-radius:50%}
.bc-rejilla .marcado.ult{animation:bingo-tacha .55s cubic-bezier(.2,.9,.3,1.4)}
@keyframes bingo-tacha{0%{transform:scale(.2);opacity:0}60%{transform:scale(1.25)}100%{transform:none}}
.bc-rejilla .en-linea{box-shadow:0 0 0 2px #fde047,0 2px 4px rgba(0,0,0,.25)}
.bc-rejilla .falta{box-shadow:inset 0 0 0 2px var(--tc);animation:bingo-late 1.1s ease-in-out infinite}
@keyframes bingo-late{50%{background:var(--tc2)}}
.bcarton.cerca{transform:translateY(-2px);box-shadow:0 10px 26px rgba(0,0,0,.35),0 0 0 3px var(--tc),0 0 22px 4px rgba(253,224,71,.65)}
.bcarton.cerca .bc-cab{background:var(--tc);color:#fff}
.bcarton.completo .bc-cab{background:linear-gradient(90deg,#f59e0b,#fde047,#f59e0b);color:#4a2600}

.bingo-panel90{width:100%;max-width:560px;color:var(--crema)}
.bingo-panel90 summary{cursor:pointer;font-weight:800;font-size:14px;text-align:center;padding:6px;border-radius:999px;background:rgba(0,0,0,.18);list-style:none}
.bingo-panel90 summary::-webkit-details-marker{display:none}
.bingo-panel90 .bingo-panel{width:100%;margin-top:8px;font-size:13px;gap:3px}
.bingo-panel90 .bingo-panel span{padding:4px 0}
.bingo-panel90 .bingo-panel .si{color:#fff;background:var(--c2)}
.bingo-panel90 .bingo-panel .ult{outline:2px solid #fff}

/* Celebración de línea y bingo */
.bingo-fiesta{position:absolute;inset:0;z-index:5;display:grid;place-items:center;pointer-events:none;overflow:hidden;animation:bingo-fuera 2.6s ease-in forwards}
.bf-caja{text-align:center;padding:18px 34px;border-radius:24px;background:linear-gradient(135deg,#7c3aed,#db2777);color:#fff;box-shadow:0 18px 50px rgba(0,0,0,.45),0 0 0 4px #fde047;animation:bingo-pop .6s cubic-bezier(.2,.9,.3,1.4)}
.bingo-fiesta.linea .bf-caja{background:linear-gradient(135deg,#2563eb,#16a34a)}
.bf-grande{font-size:clamp(44px,11vw,76px);font-weight:900;letter-spacing:.03em;line-height:1;text-shadow:0 4px 0 rgba(0,0,0,.2)}
.bf-texto{margin-top:6px;font-size:clamp(16px,3.6vw,22px);font-weight:800}
.bingo-fiesta i{position:absolute;top:-20px;width:10px;height:16px;border-radius:3px;background:#fde047;animation:bingo-confeti 2.2s linear forwards}
.bingo-fiesta i:nth-of-type(3n){background:#f472b6}.bingo-fiesta i:nth-of-type(3n+1){background:#60a5fa}.bingo-fiesta i:nth-of-type(4n){background:#4ade80}
.bingo-fiesta i:nth-of-type(1){left:5%;animation-delay:.05s}.bingo-fiesta i:nth-of-type(2){left:12%;animation-delay:.3s}.bingo-fiesta i:nth-of-type(3){left:19%;animation-delay:.12s}
.bingo-fiesta i:nth-of-type(4){left:27%;animation-delay:.4s}.bingo-fiesta i:nth-of-type(5){left:34%;animation-delay:.2s}.bingo-fiesta i:nth-of-type(6){left:41%}
.bingo-fiesta i:nth-of-type(7){left:49%;animation-delay:.35s}.bingo-fiesta i:nth-of-type(8){left:56%;animation-delay:.1s}.bingo-fiesta i:nth-of-type(9){left:63%;animation-delay:.45s}
.bingo-fiesta i:nth-of-type(10){left:70%;animation-delay:.22s}.bingo-fiesta i:nth-of-type(11){left:77%;animation-delay:.05s}.bingo-fiesta i:nth-of-type(12){left:84%;animation-delay:.38s}
.bingo-fiesta i:nth-of-type(13){left:90%;animation-delay:.15s}.bingo-fiesta i:nth-of-type(14){left:96%;animation-delay:.28s}
@keyframes bingo-pop{0%{transform:scale(.3) rotate(-8deg);opacity:0}100%{transform:none;opacity:1}}
@keyframes bingo-confeti{to{transform:translateY(110vh) rotate(720deg)}}
@keyframes bingo-fuera{0%,80%{opacity:1}100%{opacity:0}}
@media (prefers-reduced-motion:reduce){.bbola.nueva,.bc-rejilla .marcado.ult,.bc-rejilla .falta,.bingo-fiesta i,.bf-caja,.bingo-ultimas .bbola:first-child{animation:none}}
@media (max-width:700px){
  .bingo-cabeza{gap:12px;padding:10px 12px;border-radius:18px}
  .bbola{width:32px;height:32px}.bbola b{font-size:12.5px}
  .bingo-ultimas{gap:4px;min-height:32px}
  .bc-rejilla{gap:2px;padding:6px}
  .bc-rejilla span{border-radius:6px}
}
/* En el bingo los jugadores van arriba y los cartones ocupan todo el ancho */
.mesa:has(.zona-bingo) { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-areas: "izq arr der" "medio medio medio" "yo yo yo"; align-items: start; }
.mesa:has(.zona-bingo) .centro { padding-bottom: 8px; }
.mesa:has(.zona-bingo) .asiento .tapadas { display: none; }
.mesa:has(.zona-bingo) { min-height: 0; }
.bingo-cabeza { padding-block: 16px; }

/* ================= Mus: mesa con lances, piedras y recuento ================= */
/* Marcador de pareja en la cabecera: color del equipo y barra con lo que lleva de las 40 */
.pastilla.de-equipo { position: relative; overflow: hidden; padding-bottom: 8px; gap: 7px; }
.pastilla.de-equipo::after { content: ""; position: absolute; left: 0; bottom: 0; height: 4px; width: var(--progreso, 0%); background: #38bdf8; border-radius: 0 4px 4px 0; transition: width .6s ease; }
.pastilla.de-equipo.e1::after { background: #fb923c; }
.pastilla.de-equipo b { font-size: 1.15em; min-width: 1.3em; text-align: center; }
.pastilla.de-equipo.sube { animation: mus-sube .7s cubic-bezier(.2, .9, .3, 1.4); }
@keyframes mus-sube { 30% { transform: scale(1.18); box-shadow: 0 0 0 4px rgba(253, 224, 71, .7); } }

.zona-mus { container: mus / inline-size; width: 100%; max-width: 460px; display: grid; gap: 12px; justify-items: center; }
.mus-lances { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
@container mus (min-width: 330px) { .mus-lances { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.mus-lance { display: grid; gap: 1px; justify-items: center; padding: 6px 4px 7px; border-radius: 12px; background: rgba(0, 0, 0, .22); color: rgba(255, 255, 255, .55); text-align: center; min-width: 0; border: 2px solid transparent; }
.mus-lance strong { font-size: 13.5px; font-weight: 900; letter-spacing: .01em; }
.mus-lance em { font-style: normal; font-size: 10.5px; font-weight: 800; min-height: 13px; line-height: 1.2; overflow-wrap: anywhere; }
.mus-lance.es-actual { background: #fde047; color: #3b2600; border-color: #fff; box-shadow: 0 0 0 0 rgba(253, 224, 71, .7); animation: mus-late 1.6s ease-in-out infinite; }
@keyframes mus-late { 50% { box-shadow: 0 0 0 7px rgba(253, 224, 71, 0); } }
.mus-lance.es-paso, .mus-lance.es-querido, .mus-lance.es-rechazado, .mus-lance.es-solo, .mus-lance.es-ordago { background: rgba(255, 255, 255, .92); color: #2a2140; }
.mus-lance.es-querido em { color: #7c3aed; }
.mus-lance.mio em { color: #0369a1; }
.mus-lance.suyo em { color: #c2410c; }
.mus-lance.es-nojugado { background: rgba(0, 0, 0, .14); text-decoration: line-through; text-decoration-color: rgba(255, 255, 255, .35); }
.mus-lance.es-nojugado em { text-decoration: none; display: inline-block; }
.mus-lance.es-ordago { background: #be123c; color: #fff; }

.mus-medio { width: 100%; display: grid; justify-items: center; min-height: 86px; align-content: center; }
.mus-piedras { display: inline-flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 3px; max-width: 170px; }
.mus-piedras i { width: 13px; height: 11px; border-radius: 50% 50% 46% 54% / 60% 58% 42% 40%; background: radial-gradient(circle at 34% 28%, #fff, #d6c9a8 55%, #8a7a55); box-shadow: 0 2px 3px rgba(0, 0, 0, .45); }
.mus-piedras i:nth-child(odd) { transform: rotate(-14deg); }
.mus-piedras i.amarraco { width: 20px; height: 17px; background: radial-gradient(circle at 34% 28%, #fff3c4, #f2b33d 55%, #9a5b0a); }
.mus-piedras em { font-style: normal; color: #fff; font-weight: 900; }
.mus-bote { display: grid; justify-items: center; gap: 4px; padding: 10px 16px 9px; border-radius: 18px; background: rgba(0, 0, 0, .28); color: #fff; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .14); }
.mus-bote.nuevo { animation: mus-cae .45s cubic-bezier(.2, .9, .3, 1.35); }
.mus-bote.nuevo .mus-piedras i { animation: mus-piedra .5s cubic-bezier(.2, .9, .3, 1.5) backwards; }
.mus-bote.nuevo .mus-piedras i:nth-child(2) { animation-delay: .05s; } .mus-bote.nuevo .mus-piedras i:nth-child(3) { animation-delay: .1s; }
.mus-bote.nuevo .mus-piedras i:nth-child(4) { animation-delay: .15s; } .mus-bote.nuevo .mus-piedras i:nth-child(n+5) { animation-delay: .2s; }
@keyframes mus-cae { from { transform: scale(.6); opacity: 0; } }
@keyframes mus-piedra { from { transform: translateY(-46px) scale(.5); opacity: 0; } }
.mus-total { font-size: 15px; font-weight: 800; }
.mus-total b { font-size: 26px; font-weight: 900; color: #fde047; margin-right: 3px; line-height: 1; }
.mus-bote small { font-size: 11.5px; font-weight: 800; opacity: .85; }
.mus-bote.mio small { color: #7dd3fc; } .mus-bote.suyo small { color: #fdba74; }
.mus-bote.ordago { background: linear-gradient(135deg, #f43f5e, #9f1239); box-shadow: 0 0 0 3px #fde047, 0 10px 26px rgba(159, 18, 57, .55); animation: mus-ordago .9s ease-in-out infinite alternate; }
.mus-bote.ordago small { color: #fff; }
.mus-ordago { font-size: clamp(22px, 7cqi, 34px); font-weight: 900; letter-spacing: .03em; text-shadow: 0 3px 0 rgba(0, 0, 0, .25); }
@keyframes mus-ordago { to { transform: scale(1.06) rotate(-1.5deg); } }
.mus-mazo { display: grid; justify-items: center; gap: 6px; color: var(--suave, #cfe3d4); }
.mus-pila { position: relative; width: var(--cw); height: calc(var(--cw) * 1.5); }
.mus-pila .carta { position: absolute; inset: 0; margin: 0; }
.mus-pila .carta:nth-child(1) { transform: translate(-5px, 4px) rotate(-7deg); } .mus-pila .carta:nth-child(2) { transform: translate(3px, 2px) rotate(4deg); }
.mus-mazo small { font-weight: 800; font-size: 12.5px; }

.mus-recuento { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; gap: 5px; }
.mus-recuento li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 12px; background: rgba(255, 255, 255, .94); color: #2a2140; border-left: 5px solid #cbd5e1; animation: mus-fila .35s ease-out backwards; }
.mus-recuento li:nth-child(2) { animation-delay: .25s; } .mus-recuento li:nth-child(3) { animation-delay: .5s; } .mus-recuento li:nth-child(4) { animation-delay: .75s; }
@keyframes mus-fila { from { transform: translateX(-18px); opacity: 0; } }
.mus-recuento li.mio { border-left-color: #38bdf8; } .mus-recuento li.suyo { border-left-color: #fb923c; }
.mus-recuento strong { font-size: 13px; font-weight: 900; }
.mus-recuento .det { font-size: 12px; font-weight: 700; color: #5b5470; min-width: 0; line-height: 1.25; }
.mus-recuento .det b { color: #2a2140; }
.mus-recuento em { font-style: normal; font-weight: 900; font-size: 15px; }
.mus-recuento li.mio em { color: #0369a1; } .mus-recuento li.suyo em { color: #c2410c; }
.mus-recuento li.final { display: block; text-align: center; font-weight: 900; font-size: 13.5px; }
.mus-gana { margin-top: 8px; padding: 8px 16px; border-radius: 999px; font-weight: 900; font-size: 16px; background: #fde047; color: #3b2600; box-shadow: 0 6px 16px rgba(0, 0, 0, .35); }
.mus-gana.suyo { background: rgba(0, 0, 0, .35); color: #fff; }
@media (prefers-reduced-motion: reduce) { .mus-lance.es-actual, .mus-bote, .mus-bote.nuevo .mus-piedras i, .mus-recuento li, .pastilla.de-equipo.sube { animation: none; } }

/* En el mus el aviso de texto del centro va más pequeño: lo importante ya lo dice la mesa */
.mesa[data-juego="mus"] .mensaje { font-size: 13.5px; opacity: .92; }
.mesa[data-juego="mus"] .centro { min-height: 0; padding-bottom: 6px; }

@media (max-width: 700px) {
  /* Botones: si son muchos (envites del mus) bajan a una segunda fila en vez de pisarse */
  .botones { flex-wrap: wrap; }
  .botones .btn { flex: 1 1 28%; }
  /* Bocadillos de los jugadores de los lados: enteros, hacia dentro de la mesa */
  .mesa.cruz .sitio.izq .bocadillo { right: auto; left: 0; transform: none; max-width: none; overflow: visible; }
  .mesa.cruz .sitio.der .bocadillo { right: 0; left: auto; transform: none; max-width: none; overflow: visible; }
  .mesa.cruz .sitio.arr .bocadillo { max-width: none; overflow: visible; }
  .mesa[data-juego="mus"].cruz { grid-template-columns: 66px minmax(0, 1fr) 66px; }
}
@media (max-width: 700px) {
  /* Mus en el móvil: botones en dos filas ordenadas (los dos principales arriba, grandes) */
  .mesa[data-juego="mus"] .botones { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; }
  .mesa[data-juego="mus"] .botones .btn { grid-column: span 2; justify-content: center; text-align: center; padding: 12px 4px; }
  .mesa[data-juego="mus"] .botones .btn:nth-child(-n+2) { grid-column: span 3; font-size: 17px; padding: 14px 4px; }
  .mesa[data-juego="mus"] .botones .btn:nth-child(3):nth-last-child(2), .mesa[data-juego="mus"] .botones .btn:nth-child(4):last-child { grid-column: span 3; }
  .mesa[data-juego="mus"] .botones .btn:only-child { grid-column: 1 / -1; }
  /* Mis cuatro cartas, grandes: es lo que más se mira */
  .mesa[data-juego="mus"] .mano { --cw: clamp(60px, 20.5vw, 90px); }
  .mesa[data-juego="mus"] .mis-visibles { --cw: clamp(52px, 17vw, 76px); }
  .mesa[data-juego="mus"] .mus-lance { padding: 8px 4px 9px; }
  .mesa[data-juego="mus"] .mus-lance strong { font-size: 15px; }
  .mesa[data-juego="mus"] .mus-lance em { font-size: 11.5px; }
  .mesa[data-juego="mus"] .asiento .av.mini { width: 34px; height: 34px; }
  .mesa[data-juego="mus"] .asiento .inf { font-size: 11.5px; font-weight: 800; color: #e7f5ea; }
}

/* ---------- invitación a una mesa (llega con los juegos abiertos) ---------- */
.invitacion-mesa { position: fixed; z-index: 300; top: calc(12px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); width: min(460px, calc(100% - 20px)); box-sizing: border-box;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-radius: 18px; background: #fff; color: #1f1a33;
  box-shadow: 0 16px 44px rgba(40, 10, 90, .4), 0 0 0 2px #c4b5fd; animation: inv-baja .3s cubic-bezier(.2, .9, .3, 1); }
.invitacion-mesa .av { width: 40px; height: 40px; font-size: 15px; }
.invitacion-mesa .inv-texto { flex: 1 1 150px; min-width: 0; display: grid; }
.invitacion-mesa strong { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invitacion-mesa small { color: #6b6785; font-weight: 600; font-size: 13px; }
@keyframes inv-baja { from { transform: translate(-50%, -120%); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .invitacion-mesa { animation: none; } }
/* Sala de espera en pantallas estrechas: las filas con botones (invitado, añadir jugador) no ensanchan la página */
.espera-mesa > * { min-width: 0; max-width: 100%; }
@media (max-width: 560px) {
  .asientos-espera li { flex-wrap: wrap; row-gap: 6px; }
  .asientos-espera .quien { flex: 1 1 120px; }
  .asientos-espera li.invitado .quien { flex-basis: calc(100% - 40px); }
  .asientos-espera li .btn { margin-left: auto; }
}

/* ---------- «?» cómo se juega (partida a pantalla completa y app) ---------- */
.btn-reglas { display: none; }
body.pantalla-completa .btn-reglas { display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; min-width: 0; padding: 0; border-radius: 50%; font-weight: 900; font-size: 16px; }
.dialogo-reglas .texto-reglas { overflow-y: auto; display: grid; gap: 10px; padding-right: 4px; }
.dialogo-reglas .texto-reglas p { margin: 0; font-size: 15px; line-height: 1.5; color: #3b3654; }
.dialogo-reglas h3 { padding-right: 40px; }
@media (max-width: 420px) {
  body.pantalla-completa .btn-reglas { width: 30px; height: 30px; font-size: 14px; }
  body.pantalla-completa #vista-partida > .cabeza { gap: 5px; }
  body.pantalla-completa #vista-partida > .cabeza .marcador { gap: 5px; }
  body.pantalla-completa #vista-partida > .cabeza .pastilla { padding: 5px 8px; }
}

/* ================= monedas ================= */
.moneda { display: inline-block; width: 1.05em; height: 1.05em; border-radius: 50%; vertical-align: -0.16em; flex: none;
  background: radial-gradient(circle at 35% 30%, #fff3b0 0 18%, #fcd34d 40%, #d97706 100%); box-shadow: inset 0 0 0 1.5px rgba(146, 64, 14, .55), 0 1px 2px rgba(0, 0, 0, .25); }
.monedas-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; cursor: pointer; font: inherit; font-weight: 800; border-radius: 999px; padding: 7px 12px; }
.monedas-btn[hidden] { display: none; }
.entrada-mesa { margin: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; padding: 9px 14px; border-radius: 14px;
  background: rgba(255, 255, 255, .92); color: #3b2a05; font-weight: 800; font-size: 14.5px; text-align: center; }
.entrada-mesa[hidden] { display: none; }
.entrada-mesa.amistosa { background: rgba(255, 255, 255, .18); color: #fff; font-weight: 700; }
.resultado .panel .premio { margin: 0; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-weight: 900; font-size: 16px; color: #57534e; }
.resultado .panel .premio.gana { color: #15803d; }
.resultado .panel .premio.pierde { color: #b91c1c; }
.dialogo-monedas { text-align: center; }
.dialogo-monedas h3 { padding: 0 34px; }
.dialogo-monedas .saldo-grande { margin: 0; display: flex; align-items: baseline; justify-content: center; gap: 8px; font-size: 34px; font-weight: 900; color: #2a1650; }
.dialogo-monedas .saldo-grande .moneda { align-self: center; }
.dialogo-monedas .saldo-grande span { font-size: 15px; font-weight: 700; color: #6b6785; }
.dialogo-monedas ul { margin: 0; padding: 0 0 0 20px; text-align: left; display: grid; gap: 6px; font-size: 14.5px; line-height: 1.45; color: #3b3654; }
.dialogo-monedas .sin-recarga { margin: 0; padding: 10px 12px; border-radius: 12px; background: #f3effc; color: #3b3654; font-size: 14.5px; line-height: 1.45; }
.dialogo-monedas .sin-recarga[hidden] { display: none; }
