/* Sparta Bingo · estilos. Paleta negro, rojo y dorado; bolillas de colores por decena. */
@font-face { font-family: "Bricolage"; src: url("fuentes/bricolage-800.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("fuentes/dmsans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("fuentes/dmsans-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("fuentes/dmsans-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --fondo: #140B0B; --panel: #241414; --panel-2: #34201E; --borde: #4A2A26; --hundido: #1C1010;
  --texto: #FFFFFF; --texto-2: #EADBD6; --suave: #CDB9B4; --apagado: #9C7F79;
  --oro: #E9B949; --oro-claro: #F3D27E; --sobre-oro: #1A0B08; --rojo: #C8333A; --error: #FF8A80;
  --papel: #FFFDF7; --tinta: #2A1210; --tinta-2: #7A4A42; --vacia: #EEE7D6; --borde-papel: #E4DCC8;
  --verde: #7FE3D8;
  --display: "Bricolage", "DM Sans", system-ui, sans-serif;
  --cuerpo: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--fondo); color: var(--texto); font-family: var(--cuerpo);
  -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--oro-claro); outline-offset: 2px; }
a { color: var(--oro); }
a:hover { color: var(--oro-claro); }
.oculto { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

#app { max-width: 520px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.pantalla { flex: 1; display: flex; flex-direction: column; gap: 16px; padding: 20px 20px calc(24px + env(safe-area-inset-bottom)); }

/* ---------- elementos comunes */
.btn { min-height: 48px; border-radius: 16px; border: none; padding: 0 18px; font-weight: 700; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn-oro { background: var(--oro); color: var(--sobre-oro); font-family: var(--display); font-weight: 800; font-size: 18px; }
.btn-oro:hover { background: var(--oro-claro); color: var(--sobre-oro); }
.btn-borde { background: transparent; border: 2px solid var(--oro); color: var(--oro); }
.btn-gris { background: var(--panel); color: var(--texto-2); }
.btn-grande { min-height: 60px; font-size: 19px; border-radius: 18px; }
.btn-icono { width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 12px; background: var(--panel); color: var(--texto); border: none; flex: none; }
.ancho { width: 100%; }
.panel { background: var(--panel); border-radius: 22px; padding: 18px 20px; }
.etiqueta { font-size: 14px; font-weight: 700; color: var(--texto-2); }
.suave { color: var(--suave); }
.chip { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--panel-2); color: var(--texto-2); white-space: nowrap; }
.chip-oro { background: var(--oro); color: var(--sobre-oro); font-weight: 800; }
.campo { height: 52px; width: 100%; border-radius: 14px; border: 2px solid var(--borde); background: var(--fondo); color: var(--texto);
  font-size: 17px; padding: 0 16px; }
.campo::placeholder { color: var(--apagado); }
.campo-codigo { font-family: var(--display); font-weight: 800; letter-spacing: .2em; text-transform: uppercase; font-size: 18px; }
.campo[aria-invalid="true"] { border-color: var(--error); }
.error { color: var(--error); font-size: 14px; margin: 0; }
.fila { display: flex; align-items: center; gap: 10px; }
.titulo { margin: 0; font-family: var(--display); font-weight: 800; font-size: 22px; }
.barra { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.segmento { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; background: var(--fondo); border-radius: 14px; padding: 4px; }
.segmento button { min-height: 44px; border: none; border-radius: 11px; background: transparent; color: var(--texto-2); font-weight: 700; font-size: 14px; }
.segmento button[aria-pressed="true"] { background: var(--oro); color: var(--sobre-oro); font-weight: 800; }
.segmento.tres { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.interruptor { width: 52px; height: 32px; flex: none; border: none; border-radius: 16px; padding: 3px; display: flex; background: var(--borde); justify-content: flex-start; }
.interruptor[aria-pressed="true"] { background: var(--oro); justify-content: flex-end; }
.interruptor span { width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); }

.avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-weight: 800; font-size: 15px; color: var(--fondo); overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- bolillas */
.bolilla { --c: #FF6B6B; --t: 104px; width: var(--t); height: var(--t); flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 32% 26%, rgba(255,255,255,.8) 0%, rgba(255,255,255,0) 30%), radial-gradient(circle at 50% 50%, rgba(0,0,0,0) 55%, rgba(0,0,0,.32) 100%), var(--c);
  box-shadow: 0 calc(var(--t) * .08) calc(var(--t) * .22) rgba(0,0,0,.45); }
.bolilla span { width: 56%; height: 56%; border-radius: 50%; background: var(--papel); display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-weight: 800; font-size: calc(var(--t) * .27); color: var(--fondo); box-shadow: inset 0 -2px 4px rgba(0,0,0,.15); }
.bolilla.nueva { animation: caer .5s cubic-bezier(.2,.9,.3,1.3); }
@keyframes caer { from { transform: translateY(-30px) scale(.6) rotate(-40deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- inicio */
.portada { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; display: block; margin: -20px -20px 0; width: calc(100% + 40px); max-width: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 75%, transparent); mask-image: linear-gradient(to bottom, #000 75%, transparent); }
.inicio h1 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 30px; line-height: 1.1; }
.inicio .bajada { margin: 6px 0 0; font-size: 16px; line-height: 1.45; color: var(--texto-2); }
.form { display: flex; flex-direction: column; gap: 12px; }
.separador { display: flex; align-items: center; gap: 12px; color: var(--suave); font-size: 13px; }
.separador::before, .separador::after { content: ""; flex: 1; height: 1px; background: var(--borde); }
.pie { font-size: 13px; color: var(--suave); line-height: 1.5; margin: 0; }
.pie a { color: var(--suave); }
.apoyo { display: flex; align-items: center; gap: 10px; color: var(--oro); font-weight: 700; font-size: 15px; text-decoration: none;
  background: var(--panel); border-radius: 16px; padding: 12px 16px; min-height: 48px; }

/* ---------- sala de espera */
.codigo-grande { font-family: var(--display); font-weight: 800; font-size: 40px; letter-spacing: .14em; line-height: 1; }
.link-sala { font-size: 13px; color: var(--suave); word-break: break-all; }
.lista { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.lista li { display: flex; align-items: center; gap: 12px; min-height: 46px; }
.lista .nombre { flex: 1; font-size: 16px; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.desconectado { opacity: .5; }
.opciones-boton { width: 100%; min-height: 64px; border: none; background: transparent; color: var(--texto); padding: 10px 16px;
  display: flex; align-items: center; gap: 12px; text-align: left; }
.opciones-boton svg { transition: transform .2s; flex: none; }
.opciones-boton[aria-expanded="true"] svg { transform: rotate(180deg); }
.opciones { padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 16px; }
.opcion { display: flex; flex-direction: column; gap: 8px; }
.opcion-fila { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.paso { display: flex; align-items: center; gap: 10px; }
.paso button { width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--borde); background: transparent; color: #fff; font-size: 22px; font-weight: 700; }
.paso output { min-width: 48px; text-align: center; font-family: var(--display); font-weight: 800; font-size: 20px; }
.ayuda { font-size: 13px; color: var(--suave); line-height: 1.4; margin: 0; }

/* ---------- juego */
.juego-cabeza { display: flex; align-items: center; gap: 16px; }
.juego-cabeza .info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.salio { font-family: var(--display); font-weight: 800; font-size: 24px; }
.recientes { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.progreso { height: 6px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.progreso div { height: 100%; background: var(--oro); border-radius: 999px; width: 0; }
.control { display: flex; align-items: center; gap: 12px; background: var(--panel); border-radius: 16px; padding: 10px 12px; }

/* Cartón: pergamino suave con greca griega arriba y abajo. Detrás de los números no va ninguna imagen, para que se lean rápido. */
.carton { --pergamino: #F4EAD5; background-color: var(--pergamino);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='12' viewBox='0 0 24 12'%3E%3Cpath d='M0 11h4V3h12v6h-6V6h3' fill='none' stroke='%23A4342F' stroke-width='1.6'/%3E%3Cpath d='M16 11h8' fill='none' stroke='%23A4342F' stroke-width='1.6'/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='12' viewBox='0 0 24 12'%3E%3Cpath d='M0 11h4V3h12v6h-6V6h3' fill='none' stroke='%23A4342F' stroke-width='1.6'/%3E%3Cpath d='M16 11h8' fill='none' stroke='%23A4342F' stroke-width='1.6'/%3E%3C/svg%3E"),
    radial-gradient(ellipse at 20% 10%, rgba(255,255,255,.55), transparent 55%),
    radial-gradient(ellipse at 85% 90%, rgba(150,110,60,.16), transparent 60%);
  background-repeat: repeat-x, repeat-x, no-repeat, no-repeat;
  background-position: 0 6px, 0 calc(100% - 6px), 0 0, 0 0;
  background-size: 24px 12px, 24px 12px, 100% 100%, 100% 100%;
  border-radius: 22px; padding: 22px 12px; display: flex; flex-direction: column; gap: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35), inset 0 0 0 2px rgba(164,52,47,.35); }
.carton-cabeza { display: flex; align-items: baseline; justify-content: space-between; padding: 0 4px; }
.carton-cabeza strong { font-family: var(--display); font-weight: 800; font-size: 17px; color: var(--tinta); }
.carton-cabeza span { font-size: 12px; font-weight: 700; color: var(--tinta-2); }
.grilla { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 4px; }
.celda { height: 46px; border-radius: 10px; display: flex; align-items: center; justify-content: center; position: relative; padding: 0;
  font-family: var(--display); font-weight: 800; font-size: 16px; color: var(--tinta); background: #fff; border: 1.5px solid var(--borde-papel); width: 100%; }
.celda.vacia { background: rgba(122,74,66,.08); border: none; }
/* La lambda (Λ) de los escudos espartanos marca las casillas sin número; el casco queda solo para las marcas. */
.celda.vacia::after { content: "Λ"; font-family: var(--display); font-weight: 800; font-size: 20px; color: rgba(164,52,47,.22); }
.celda svg { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); opacity: .55; pointer-events: none; }
.celda.temblor { animation: temblor .35s; }
@keyframes temblor { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.cartones { display: flex; flex-direction: column; gap: 12px; }
.mensaje { margin: 0; text-align: center; font-size: 15px; font-weight: 700; color: var(--suave); min-height: 22px; }
.mensaje.aviso { color: var(--oro-claro); }
.cantar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; position: sticky; bottom: calc(12px + env(safe-area-inset-bottom)); }
.cantar button { min-height: 64px; border: none; border-radius: 18px; font-family: var(--display); font-weight: 800; font-size: 22px; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.cantar .linea { background: var(--oro); color: var(--sobre-oro); }
.cantar .bingo { background: var(--rojo); color: #fff; }
.cantar button:disabled { opacity: .45; }
.cantar .cantada { display: flex; flex-direction: column; gap: 2px; font-size: 16px; line-height: 1.15; padding: 6px 10px; }
.cantar .cantada small { font-family: var(--cuerpo); font-weight: 700; font-size: 13px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tablero { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
.tablero div { height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 800; font-size: 13px;
  background: var(--hundido); color: var(--apagado); }
.tablero .salio-ya { background: var(--c); color: var(--fondo); }
.tablero .ultima { background: #fff; color: var(--fondo); box-shadow: 0 0 0 2px var(--oro); }

/* ---------- final */
.final { text-align: center; position: relative; }
.final .grito { font-family: var(--display); font-weight: 800; font-size: 72px; line-height: 1; color: var(--oro); margin: 6px 0 0; letter-spacing: -.02em; }
.ganador { display: flex; align-items: center; justify-content: center; gap: 14px; }
.verificado { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; color: var(--verde); }
.confeti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.confeti i { position: absolute; top: -20px; width: 10px; height: 6px; border-radius: 2px; animation: confeti 3.2s linear forwards; }
@keyframes confeti { to { transform: translateY(110vh) rotate(720deg); } }
@media (prefers-reduced-motion: reduce) {
  .bolilla.nueva, .celda.temblor { animation: none; }
  .confeti { display: none; }
}

/* ---------- capas: avisos, diálogos, ranking */
.avisos { position: fixed; left: 50%; transform: translateX(-50%); top: calc(12px + env(safe-area-inset-top)); width: min(480px, calc(100% - 24px));
  display: flex; flex-direction: column; gap: 8px; z-index: 20; pointer-events: none; }
.aviso-caja { border-radius: 14px; padding: 12px 14px; font-size: 14px; font-weight: 700; background: var(--panel); color: var(--texto-2);
  box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.aviso-caja.oro { background: var(--oro); color: var(--sobre-oro); font-weight: 800; font-size: 15px; }
.aviso-caja.error { background: #3A1414; color: var(--error); }
.aviso-caja.ok { background: #0E2E2B; color: var(--verde); }
.aviso-caja.alerta { background: #3A2A0E; color: var(--oro-claro); }
.conexion { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: #3A2A0E; color: var(--oro-claro); font-weight: 700; font-size: 14px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); text-align: center; }

dialog { border: none; border-radius: 22px; padding: 0; background: var(--panel); color: var(--texto); width: min(440px, calc(100% - 32px)); max-height: calc(100dvh - 48px); }
dialog::backdrop { background: rgba(0,0,0,.6); }
.dialogo { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.dialogo h2 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 20px; }
.dialogo p { margin: 0; font-size: 14px; color: var(--texto-2); line-height: 1.45; }
.dos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.rk { display: flex; flex-direction: column; gap: 6px; }
.rk-cab, .rk-fila { display: grid; grid-template-columns: 36px minmax(0, 1fr) 56px 64px; gap: 8px; align-items: center; padding: 0 8px; }
.rk-cab { font-size: 12px; font-weight: 700; color: var(--suave); }
.rk-fila { min-height: 50px; border-radius: 14px; background: var(--fondo); }
.rk-fila.vos { background: var(--panel-2); box-shadow: inset 0 0 0 2px var(--oro); }
.rk-pos { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 800; font-size: 14px; background: var(--panel-2); color: var(--texto-2); }
.rk-pos.p1 { background: var(--oro); color: var(--sobre-oro); } .rk-pos.p2 { background: #C9CED6; color: var(--sobre-oro); } .rk-pos.p3 { background: #C98A5A; color: var(--sobre-oro); }
.rk-num { text-align: center; font-family: var(--display); font-weight: 800; font-size: 18px; color: var(--oro); }
.rk-num.chico { font-family: var(--cuerpo); font-weight: 500; font-size: 15px; color: var(--suave); }
.rk-nombre { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- compu: horizontal */
@media (min-width: 960px) and (orientation: landscape) {
  #app { max-width: 1280px; }
  .pantalla.juego { display: grid; grid-template-columns: 300px minmax(0, 1fr) 300px; grid-template-rows: auto 1fr; gap: 20px 28px; align-items: start; }
  .juego > .barra { grid-column: 1 / -1; }
  .juego .col-izq, .juego .col-centro, .juego .col-der { display: flex; flex-direction: column; gap: 16px; }
  .juego .col-izq { align-items: stretch; }
  .juego .col-izq .juego-cabeza { flex-direction: column; text-align: center; }
  .juego .col-izq .bolilla.actual { --t: 180px !important; }
  .juego .col-izq .recientes { justify-content: center; }
  .celda { height: 64px; font-size: 22px; }
  .celda.vacia::after { font-size: 28px; }
  .celda svg { width: 40px; height: 40px; }
  .cantar { position: static; }
  .pantalla.espera, .pantalla.inicio, .pantalla.final { max-width: 520px; width: 100%; margin: 0 auto; }
  .solo-movil { display: none !important; }
}
@media not ((min-width: 960px) and (orientation: landscape)) {
  .solo-compu { display: none !important; }
}
