:root {
  --color-fondo: #0F172A;
  --color-tarjeta: #1E293B;
  --color-dorado: #FBBF24;
  --color-turquesa: #06B6D4;
  --color-texto: #F1F5F9;
  --color-texto-tenue: #94A3B8;
  --color-error: #EF4444;
  --color-exito: #22C55E;

  --tema-madera-clara: #B08968;
  --tema-madera-oscura: #7F5539;
  --tema-marmol: #E5E7EB;
  --tema-neon-fondo: #120022;

  --radio-xl: 24px;
  --radio-lg: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--color-fondo);
  color: var(--color-texto);
  font-family: 'Nunito', -apple-system, system-ui, sans-serif;
  overscroll-behavior: none; /* evita el "rebote" del navegador dentro del WebView */
  user-select: none;        /* evita selección de texto accidental al arrastrar fichas */
}

.pantalla {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.pantalla-centrada {
  justify-content: center;
  align-items: center;
  text-align: center;
}

.titulo-app {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 2px;
  margin: 16px 0 4px;
}

.subtitulo {
  color: var(--color-texto-tenue);
  margin-bottom: 48px;
}

/* Botones grandes, pensados para pulgar (spec: "1 mano") */
.boton-grande {
  display: block;
  width: 100%;
  padding: 20px 24px;
  border-radius: var(--radio-xl);
  border: none;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  margin-bottom: 16px;
}

.boton-dorado { background: var(--color-dorado); color: var(--color-fondo); }
.boton-turquesa-outline {
  background: transparent;
  border: 2px solid var(--color-turquesa);
  color: var(--color-turquesa);
}

.boton-icono-flotante {
  background: var(--color-tarjeta);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  color: var(--color-error);
  font-size: 18px;
}

/* ---------- Sala de juego ---------- */

.barra-superior {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 4px;
}

.marcador { font-weight: 800; font-size: 14px; }
.marcador-a { color: var(--color-dorado); }
.marcador-b { color: var(--color-turquesa); }

.timer-barra-fondo {
  width: 150px;
  height: 10px;
  background: rgba(0,0,0,.3);
  border-radius: 8px;
  overflow: hidden;
}
.timer-barra-relleno {
  height: 100%;
  transition: width .1s linear, background-color .3s;
}

.fila-avatares {
  display: flex;
  justify-content: space-evenly;
  padding: 8px 0;
}
.avatar-jugador { text-align: center; font-size: 11px; }
.avatar-circulo {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  color: var(--color-fondo);
  margin: 0 auto 2px;
  transition: transform .2s;
}
.avatar-circulo.equipo-a { background: var(--color-dorado); }
.avatar-circulo.equipo-b { background: var(--color-turquesa); }
.avatar-circulo.turno-activo { transform: scale(1.15); box-shadow: 0 0 16px rgba(251,191,36,.6); }

.tablero {
  flex: 1;
  margin: 8px;
  border-radius: 20px;
  padding: 12px;
  display: flex;
  align-items: center;
  overflow: hidden;
  position: relative;
}
.tablero.tema-madera { background: linear-gradient(135deg, var(--tema-madera-clara), var(--tema-madera-oscura)); }
.tablero.tema-marmol { background: var(--tema-marmol); }
.tablero.tema-neon { background: var(--tema-neon-fondo); border: 2px solid var(--color-turquesa); box-shadow: 0 0 20px rgba(6,182,212,.5); }

.fichas-en-mesa {
  flex: 1;
  display: flex;
  gap: 3px;
  overflow-x: auto;
  padding: 4px;
}

.zona-drop {
  width: 44px;
  height: 84px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(0,0,0,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.5);
  flex-shrink: 0;
  transition: all .15s;
}
.zona-drop.activa {
  background: rgba(6,182,212,.35);
  border: 2px solid var(--color-turquesa);
}

/* ---------- Fichas ---------- */

.ficha {
  background: var(--color-texto);
  border: 2px solid var(--color-fondo);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 3px 6px rgba(0,0,0,.25);
  touch-action: none; /* clave: le decimos al navegador que NO haga scroll al tocar una ficha, para poder arrastrarla nosotros con Pointer Events */
}
.ficha.horizontal { flex-direction: row; }
.ficha.jugable { box-shadow: 0 0 14px rgba(251,191,36,.6); }
.ficha.no-jugable { opacity: .5; }
.ficha.arrastrando { opacity: .35; }

.ficha-mitad {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 4px;
}
.ficha-divisor { background: rgba(15,23,42,.6); }
.ficha .ficha-divisor { width: 100%; height: 2px; }
.ficha.horizontal .ficha-divisor { width: 2px; height: 100%; }

.pip {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--color-fondo);
  justify-self: center; align-self: center;
  opacity: 0;
}
.pip.activo { opacity: 1; }

/* Ficha "fantasma" que sigue al dedo mientras se arrastra */
.ficha-fantasma {
  position: fixed;
  pointer-events: none;
  z-index: 999;
  transform: scale(1.15);
  filter: drop-shadow(0 8px 10px rgba(0,0,0,.5));
}

.mano-jugador {
  background: var(--color-tarjeta);
  border-radius: 24px 24px 0 0;
  padding: 12px 8px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
}

.chat-rapido {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 8px;
}
.chip-sticker {
  background: var(--color-tarjeta);
  border: none;
  color: var(--color-texto);
  padding: 8px 14px;
  border-radius: 16px;
  font-size: 13px;
}
.burbuja-chat {
  background: var(--color-tarjeta);
  padding: 6px 10px;
  border-radius: 12px;
  font-size: 13px;
  margin: 0 12px 6px;
  display: inline-block;
}

.spinner {
  width: 22px; height: 22px;
  border: 3px solid rgba(255,255,255,.2);
  border-top-color: var(--color-dorado);
  border-radius: 50%;
  animation: girar 0.8s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

.hoja-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: flex; align-items: flex-end;
  z-index: 100;
}
.hoja-contenido {
  background: var(--color-tarjeta);
  width: 100%;
  border-radius: 24px 24px 0 0;
  padding: 24px;
}

/* SweetAlert2 con la identidad de Full Dominoes (ver assets/js/alertas.js) */
.fd-swal-popup {
  border-radius: 24px !important;
  font-family: 'Nunito', -apple-system, system-ui, sans-serif !important;
  border: 1px solid rgba(251, 191, 36, .25);
}
.fd-swal-boton {
  border-radius: 16px !important;
  font-weight: 800 !important;
  padding: 10px 24px !important;
}
.fd-swal-boton-cancelar {
  border-radius: 16px !important;
  font-weight: 700 !important;
}
