/* ==========================================================================
   UNO — NOWEY
   ========================================================================= */

.titulo-juego {
  text-align: center;
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  color: #ff2b9c;
  text-shadow: 0 0 12px rgba(255, 43, 156, 0.6);
  letter-spacing: 2px;
  margin: 20px 0 10px 0;
}

.uno-container { display: flex; flex-direction: column; align-items: center; padding: 0 10px 30px 10px; }
.uno-viewport { width: 100%; max-width: 640px; position: relative; }

/* Overlays — fondo oscuro uniforme */
.overlay-modo, .overlay-sala {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  background: #0f0f13;
  border: 1px solid rgba(255,43,156,0.25);
  border-radius: 10px; padding: 30px 20px; min-height: 320px;
}

/* Overlay fin: encima de la mesa, no empuja la página */
.overlay-fin {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 16, 0.93);
  border-radius: 10px;
  padding: 30px 20px;
  z-index: 50;
}
.oculto { display: none !important; }

.overlay-modo h2, .overlay-sala h2, .overlay-fin h2 {
  font-family: 'Orbitron', sans-serif; font-weight: 900; font-size: 1.5rem;
  color: #ff2b9c; text-shadow: 0 0 12px rgba(255,43,156,0.6); margin-bottom: 12px;
}
.overlay-modo p, .overlay-sala p, .overlay-fin p {
  font-family: 'Chakra Petch', monospace; color: #94a3b8; font-size: 0.85rem; margin-bottom: 18px;
}

.btn-mate {
  font-family: 'Chakra Petch', monospace; font-weight: 700; letter-spacing: 1px;
  background: linear-gradient(135deg, #ff2b9c, #b3196d); color: #1a0212;
  border: none; padding: 12px 28px; border-radius: 8px; font-size: 0.85rem;
  cursor: pointer; box-shadow: 0 0 16px rgba(255,43,156,0.4); margin-bottom: 10px; width: 240px;
}
.btn-mate.btn-multi    { background: linear-gradient(135deg, #00b7ff, #0080b3); color: #021018; box-shadow: 0 0 16px rgba(0,183,255,0.4); }
.btn-mate.btn-agresivo { background: linear-gradient(135deg, #ff7b00, #a34e00); color: #150800; box-shadow: 0 0 16px rgba(255,123,0,0.4); }
.btn-mate:active { transform: scale(0.96); }
.btn-salir { display: inline-block; color: #94a3b8; text-decoration: none; font-family: 'Chakra Petch', monospace; font-size: 0.8rem; }
.btn-volver { background: none; border: none; color: #64748b; font-family: 'Chakra Petch', monospace; margin-top: 8px; cursor: pointer; }

/* Botones en el overlay-modo: tienen subtítulo */
.btn-mate span {
  display: block; font-size: 0.65rem; font-weight: 400; opacity: 0.75; margin-top: 2px; letter-spacing: 0;
}

/* Grid de modos */
.modos-grid {
  display: flex; flex-direction: column; align-items: center; gap: 0; width: 100%;
}

/* Botón reglas */
.btn-reglas {
  background: none; border: 1px solid rgba(255,43,156,0.3); color: #ff2b9c;
  font-family: 'Chakra Petch', monospace; font-size: 0.8rem; padding: 7px 20px;
  border-radius: 20px; cursor: pointer; margin-top: 14px;
  transition: background 0.2s;
}
.btn-reglas:hover { background: rgba(255,43,156,0.1); }

/* Modales (reglas / próximamente) */
.modal-reglas, .modal-pronto {
  position: absolute; inset: 0; z-index: 60;
  background: rgba(4,8,12,0.92);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-reglas-inner {
  background: #0f0f13; border: 1px solid rgba(255,43,156,0.3);
  border-radius: 10px; padding: 24px 20px; width: 100%; max-width: 400px;
  position: relative; max-height: 90vh; overflow-y: auto;
}
.modal-reglas-inner h3 {
  font-family: 'Orbitron', sans-serif; font-weight: 900; color: #ff2b9c;
  font-size: 1.1rem; margin-bottom: 14px; text-align: center;
  text-shadow: 0 0 10px rgba(255,43,156,0.6);
}
.modal-reglas-inner ul {
  list-style: none; padding: 0; margin: 0;
}
.modal-reglas-inner ul li {
  font-family: 'Chakra Petch', monospace; color: #cbd5e1; font-size: 0.8rem;
  padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,0.06); line-height: 1.5;
}
.modal-reglas-inner ul li:last-child { border-bottom: none; }
.modal-reglas-inner ul li b { color: #ff2b9c; }
.modal-reglas-inner p {
  font-family: 'Chakra Petch', monospace; color: #94a3b8; font-size: 0.85rem;
  text-align: center; line-height: 1.6;
}
.modal-cerrar {
  position: absolute; top: 10px; right: 12px;
  background: none; border: none; color: #64748b; font-size: 1.1rem; cursor: pointer;
  line-height: 1;
}
.modal-cerrar:hover { color: #ff2b9c; }
.pronto-icono { font-size: 2.5rem; text-align: center; margin-bottom: 10px; }

.overlay-sala input {
  width: 220px; padding: 10px 14px; margin-bottom: 10px; border-radius: 8px;
  border: 1px solid rgba(255,43,156,0.3); background: #0a0f14; color: #e2e8f0;
  font-family: 'Chakra Petch', monospace; text-align: center;
}
.sala-o-divisor { color: #64748b; font-family: 'Chakra Petch', monospace; margin: 6px 0; }
.sala-estado { min-height: 18px; color: #ffe94d !important; }

/* Mesa principal */
.uno-mesa {
  position: relative;
  background: radial-gradient(ellipse at center, #1a0416, #0f0f13 75%);
  border: 1px solid rgba(255,43,156,0.25); border-radius: 14px; min-height: 520px;
  display: flex; flex-direction: column; padding: 10px; box-sizing: border-box;
}

.btn-fullscreen-mate {
  position: absolute; top: 8px; right: 8px; z-index: 25;
  background: rgba(4,8,12,0.7); border: 1px solid rgba(255,43,156,0.35); color: #ff2b9c;
  width: 34px; height: 34px; border-radius: 8px; font-size: 1rem; cursor: pointer;
}

/* Rivales */
.uno-rivales { display: flex; justify-content: space-around; padding: 10px 30px; flex-wrap: wrap; gap: 10px; }
.uno-rival { text-align: center; font-family: 'Chakra Petch', monospace; color: #94a3b8; font-size: 0.7rem; position: relative; }
.uno-rival.turno-activo { color: #ffe94d; }
.uno-rival b { display: block; font-family: 'Orbitron', sans-serif; color: #e2e8f0; font-size: 1rem; }

/* Badge de castigo/bloqueo */
.rival-badge {
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  background: #ff2b9c; color: #fff; font-family: 'Orbitron', sans-serif; font-weight: 900;
  font-size: 0.75rem; padding: 2px 7px; border-radius: 20px; white-space: nowrap;
  box-shadow: 0 0 10px rgba(255,43,156,0.7); animation: badge-aparecer 1.6s ease forwards;
  pointer-events: none; z-index: 10;
}
.rival-badge.badge-bloqueo { background: #ff7b00; box-shadow: 0 0 10px rgba(255,123,0,0.7); }
.rival-badge.badge-mas4    { background: #b31c1c; box-shadow: 0 0 10px rgba(179,28,28,0.7); }

@keyframes badge-aparecer {
  0%   { opacity: 0; transform: translateX(-50%) translateY(-6px) scale(0.8); }
  15%  { opacity: 1; transform: translateX(-50%) translateY(0)    scale(1.1); }
  80%  { opacity: 1; transform: translateX(-50%) translateY(0)    scale(1);   }
  100% { opacity: 0; transform: translateX(-50%) translateY(-8px) scale(0.9); }
}

/* ============================================================
   Centro de la mesa
   ============================================================ */
.uno-centro {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  min-height: 160px;
  position: relative;
}

/* ============================================================
   Indicador de sentido — brazo largo que orbita el descarte
   ============================================================ */
.sentido-orbital {
  position: absolute;
  width: 220px;
  height: 220px;
  pointer-events: none;
  z-index: 5;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.sentido-arm {
  position: absolute;
  inset: 0;
  animation: orbita-cw 2.6s linear infinite;
}
.sentido-arm.antihorario {
  animation: orbita-ccw 2.6s linear infinite;
}

.sentido-arm::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 2px;
  height: 50%;
  background: linear-gradient(to top, transparent 0%, rgba(255,43,156,0.0) 20%, rgba(255,43,156,0.6) 70%, rgba(255,43,156,1) 100%);
}

.sentido-flecha {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.1rem;
  line-height: 1;
  color: #ff2b9c;
  text-shadow:
    0 0 10px rgba(255,43,156,1),
    0 0 22px rgba(255,43,156,0.7);
}

@keyframes orbita-cw  { from { transform: rotate(0deg); } to { transform: rotate(360deg);  } }
@keyframes orbita-ccw { from { transform: rotate(0deg); } to { transform: rotate(-360deg); } }

/* Cartas */
.carta-uno {
  width: 62px; height: 92px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-family: 'Orbitron', sans-serif; font-weight: 900; font-size: 1.3rem; color: #fff;
  cursor: pointer; user-select: none; transition: transform 0.15s ease; border: 2px solid rgba(255,255,255,0.25);
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.carta-uno:active { transform: translateY(-6px); }
.carta-uno.jugable:hover { transform: translateY(-10px); }
.carta-uno.no-jugable { opacity: 0.45; cursor: default; }
.carta-uno.dorso { background: repeating-linear-gradient(45deg, #1a0416, #1a0416 4px, #2b0726 4px, #2b0726 8px); border-color: rgba(255,43,156,0.3); width: 40px; height: 60px; }

.c-rojo    { background: linear-gradient(160deg, #ff3b3b, #b31c1c); }
.c-amarillo{ background: linear-gradient(160deg, #ffd43b, #b38f00); color: #1a1400; }
.c-verde   { background: linear-gradient(160deg, #39ff8f, #0f8f4a); color: #04140a; }
.c-azul    { background: linear-gradient(160deg, #3b9bff, #1c4fb3); }
.c-negro   { background: linear-gradient(160deg, #2b2b2b, #0a0a0a); }

.uno-mazo { width: 62px; height: 92px; border-radius: 8px; background: repeating-linear-gradient(45deg, #1a0416, #1a0416 4px, #2b0726 4px, #2b0726 8px); border: 2px solid rgba(255,43,156,0.4); cursor: pointer; display: flex; align-items: center; justify-content: center; font-family: 'Chakra Petch', monospace; color: #ff2b9c; font-size: 0.65rem; text-align: center; }
.uno-descarte { position: relative; width: 62px; height: 92px; }

/* Aviso central */
.uno-aviso {
  text-align: center; font-family: 'Orbitron', sans-serif; font-weight: 800; color: #ffe94d;
  text-shadow: 0 0 10px rgba(255,233,77,0.7); font-size: 1rem; padding: 6px; min-height: 28px;
}

/* Selector de color */
.uno-selector-color { display: flex; justify-content: center; gap: 12px; padding: 10px 0; }
.color-btn { width: 44px; height: 44px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.4); cursor: pointer; }
.color-rojo    { background: #ff3b3b; }
.color-amarillo{ background: #ffd43b; }
.color-verde   { background: #39ff8f; }
.color-azul    { background: #3b9bff; }

/* Mano del jugador */
.uno-zona-mano { display: flex; justify-content: center; gap: 6px; padding: 10px 0; min-height: 100px; flex-wrap: wrap; }

/* Botón UNO */
.btn-uno {
  align-self: center; background: linear-gradient(135deg, #ffe94d, #b3a300); color: #1a1600;
  box-shadow: 0 0 20px rgba(255,233,77,0.6); animation: uno-pulso 0.8s ease-in-out infinite;
}
@keyframes uno-pulso { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }

.staff-footer-note { margin-top: 18px; text-align: center; }
.staff-footer-note a { color: #64748b; text-decoration: none; font-family: 'Chakra Petch', monospace; font-size: 0.8rem; }

/* ==========================================================================
   Logo y animaciones de cartas
   ========================================================================= */
.logo-container { text-align: center; margin: 20px 0 10px 0; }
.logo-juego { max-width: 180px; height: auto; filter: drop-shadow(0 0 10px rgba(255, 43, 156, 0.6)); }

/* Carta volando al descarte (tiro normal) */
.carta-volando {
  position: fixed;
  z-index: 999;
  pointer-events: none;
  transition: left 0.45s cubic-bezier(0.4,0,0.2,1), top 0.45s cubic-bezier(0.4,0,0.2,1), opacity 0.45s ease;
  transform: scale(1.1) rotate(-8deg);
  box-shadow: 0 8px 24px rgba(0,0,0,0.7);
  opacity: 1;
}
.carta-volando.aterrizando { opacity: 0; transform: scale(0.9) rotate(0deg); }

/* Carta robada del mazo — borde degradado verde flúor → naranja */
.carta-robada {
  border: 3px solid transparent !important;
  background-clip: padding-box !important;
  box-shadow:
    0 0 0 3px transparent,
    0 8px 24px rgba(0,0,0,0.7);
  position: fixed;
  z-index: 999;
  pointer-events: none;
  transition: left 0.45s cubic-bezier(0.4,0,0.2,1), top 0.45s cubic-bezier(0.4,0,0.2,1), opacity 0.45s ease;
  opacity: 1;
  animation: borde-robo 0.55s ease forwards;
}
.carta-robada.aterrizando { opacity: 0; }

@keyframes borde-robo {
  0%   { box-shadow: 0 0  0px 3px #39ff14, 0 8px 24px rgba(0,0,0,0.7); transform: scale(1.15) rotate(5deg); }
  50%  { box-shadow: 0 0 16px 4px #a0ff00, 0 8px 28px rgba(0,0,0,0.7); transform: scale(1.2) rotate(-3deg); }
  100% { box-shadow: 0 0 12px 3px #ff7b00, 0 8px 20px rgba(0,0,0,0.6); transform: scale(1.1) rotate(0deg); }
}

/* ==========================================================================
   Modo Agresivo — estilos adicionales
   ========================================================================= */

.titulo-agresivo {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 1.5rem;
  color: #ff7b00 !important;
  text-shadow: 0 0 12px rgba(255,123,0,0.7) !important;
  margin-bottom: 12px;
}

.btn-volver-modo {
  color: #64748b;
  text-decoration: none;
  font-family: 'Chakra Petch', monospace;
  font-size: 0.78rem;
  margin-top: 10px;
  display: inline-block;
}
.btn-volver-modo:hover { color: #ff7b00; }

.reglas-rapidas {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 3px 6px;
  padding: 4px 8px;
  background: rgba(255,123,0,0.07);
  border: 1px solid rgba(255,123,0,0.22);
  border-radius: 8px;
  margin: 0 4px 6px 4px;
}
.reglas-rapidas span {
  font-family: 'Chakra Petch', monospace;
  font-size: 0.6rem;
  color: #94a3b8;
  line-height: 1.4;
}
.reglas-rapidas .sep {
  color: rgba(255,123,0,0.45);
  font-size: 0.7rem;
}

.carta-uno.adelantable {
  box-shadow: 0 0 0 3px #ffe94d, 0 0 14px rgba(255,233,77,0.7);
  animation: adelant-pulso 0.7s ease-in-out infinite;
}
@keyframes adelant-pulso {
  0%,100% { box-shadow: 0 0 0 3px #ffe94d, 0 0 14px rgba(255,233,77,0.6); }
  50%      { box-shadow: 0 0 0 4px #ffb800, 0 0 22px rgba(255,184,0,0.9); }
}

.carta-uno.seleccionada-doble {
  transform: translateY(-14px) scale(1.08);
  box-shadow: 0 0 0 3px #ff7b00, 0 0 18px rgba(255,123,0,0.8);
}

/* ---- Multijugador lobby ---- */
.input-mate {
    background: #1a1a2e;
    border: 2px solid #444;
    color: #fff;
    font-family: 'Chakra Petch', sans-serif;
    font-size: 1.1rem;
    padding: .5em .8em;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: .5em;
    text-align: center;
}
.input-mate::placeholder { color: #666; }
.input-mate:focus { outline: none; border-color: #e63946; }

.multi-nombre-bloque {
    margin-bottom: 1em;
    text-align: left;
}
.multi-nombre-bloque label {
    display: block;
    font-size: .85rem;
    color: #aaa;
    margin-bottom: .3em;
}

#bloque-unirse {
    margin-top: .8em;
}

#sala-espera {
    margin-top: 1.2em;
    background: rgba(255,255,255,.05);
    border-radius: 10px;
    padding: .8em 1em;
    text-align: center;
}
#codigo-sala-display {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: .12em;
    color: #e63946;
    margin-bottom: .4em;
}
#jugadores-espera-lista {
    font-size: .95rem;
    color: #ccc;
    margin-bottom: .8em;
}

#multi-error {
    color: #e63946;
    font-size: .9rem;
    min-height: 1.5em;
    text-align: center;
    margin-top: .5em;
}

/* ---- Historial descarte modo agresivo (abanico más visible) ---- */
body.modo-agresivo .uno-descarte {
    width: auto;
    min-width: 92px;
    max-width: 320px;
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 0;
    overflow: visible;
    padding-left: 8px;
    padding-right: 4px;
}

/* Cada carta del historial se desplaza menos (más visible) y rota un poco */
body.modo-agresivo .uno-descarte .carta-uno {
    margin-left: -28px;
    position: relative;
    z-index: 1;
    transform: rotate(-4deg);
    box-shadow: -2px 2px 8px rgba(0,0,0,0.45);
    transition: transform 0.15s ease, margin-left 0.15s ease;
}

/* La carta de más a la derecha (la última / superior) queda recta y encima de todas */
body.modo-agresivo .uno-descarte .carta-uno:last-child {
    margin-left: -22px;
    transform: rotate(0deg) scale(1.05);
    z-index: 20;
    box-shadow: 0 4px 14px rgba(0,0,0,0.55);
}

/* Primera carta del abanico sin margen negativo */
body.modo-agresivo .uno-descarte .carta-uno:first-child {
    margin-left: 0;
}

/* Si hay muchas cartas, que no se salgan demasiado */
body.modo-agresivo .uno-descarte .carta-uno:nth-child(n+6) {
    margin-left: -34px;
}

/* ---- Ajustes lobby multijugador (agregado) ---- */
.overlay-sala #bloque-crear,
.overlay-sala #bloque-unirse {
    width: 100%;
    max-width: 260px;
}
.overlay-sala .btn-mate { width: 100%; }
.overlay-sala .btn-volver { margin-top: 14px; cursor: pointer; background: none; border: none; }
#sala-espera .btn-mate { width: 220px; }