/* ==================================
  1. GLOBALES Y RESETEO
==================================
*/

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #050509;
  color: #eee;
  display: flex;
  flex-direction: column;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  overscroll-behavior: none;
  overflow: hidden; /* Opcional: ayuda a fijar la app */
}

/* ==================================
  2. ELEMENTOS BASE
==================================
*/

button {
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  background: #4f46e5;
  color: white;
  font-weight: 600;
  font-size: 10px;
  border: 1px solid #4b5563;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

label {
  font-size: 0.9rem;
}

input[type="text"],
input[type="password"] {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #374151;
  background: #020617;
  color: #eee;
  width: 100%;
}

hr {
  border: none;
  height: 1px;
  width: 100%;
  margin: 14px 0 14px;
  background: linear-gradient(90deg, transparent, rgba(165, 180, 252, 0.35), transparent);
  border-radius: 999px;
  box-shadow: 0 0 10px rgba(79, 70, 229, 0.35);
}

/* ==================================
  3. LAYOUT PRINCIPAL
==================================
*/
.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: #0b0b12;
  border: 1px solid #1f1f2e;
  height: 35px; 
  border-radius: 8px;
      margin: 6px 6px 0 6px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}

.header-user {
  opacity: 0.8;
}

.header-user.user-menu-trigger {
  cursor: pointer;
  transition: background-color 0.2s ease;
  border-radius: 6px;
  padding: 4px 6px;
  margin: -4px 0; 
  font-weight: bold;
}

.header-user.user-menu-trigger:hover {
  background-color: #1f2937;
}

.app-screen {
  flex: 1;
  display: flex;
  flex-direction: column; /* Mobile-first */
  gap: 6px;
  padding: 6px;
  min-height: 0;
}

.app-column {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}

/* Tamaños por defecto (Móvil) */
.app-column-left {
  flex: 0 0 28%;
  min-height: 150px;
}
.app-column-main {
  flex: 0 0 38%;
  min-height: 200px;
}
.app-column-right {
  flex: 1;
}

.panel-header {
    padding: 4px 6px;
    background: #020617;
    border-radius: 6px;
    line-height: 1.3;
}

.panel {
  background: rgba(11, 11, 21, var(--panel-opacity));
  border-radius: 8px;
  border: var(--panel-border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 6px 8px;
  flex: 1;
  
  /* *** EFECTO CRISTAL *** */
  backdrop-filter: blur(var(--panel-blur-px));
  -webkit-backdrop-filter: blur(var(--panel-blur-px)); /* Para Safari/iOS */
  
  transition: background-color 0.2s, border 0.2s, backdrop-filter 0.2s;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.panel-header h2 {
  font-size: 0.9rem;
}

.panel-body {
  flex: 1;
  min-height: 0;
}

.panel-footer {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.panel-users {
  flex: 1;
}
.panel-map {
  flex: 1;
}
.panel-chat {
  flex: 1;
}

/* ==================================
  4. PANTALLA DE LOGIN (PREMIUM + MOBILE FIX)
==================================
*/
.login-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: #000;
  
  /* *** CORRECCIÓN MÓVIL: Margen de seguridad *** */
  padding: 20px; 
}

/* Fondo animado */
.login-screen::before {
  content: "";
  position: absolute;
  inset: -50px;
  background: url("/assets/img/fondo.jpg") no-repeat center center/cover;
  filter: blur(8px) brightness(0.6);
  animation: loginBgPan 30s infinite alternate ease-in-out;
  z-index: 0;
}

@keyframes loginBgPan {
  0% { transform: scale(1.1); }
  100% { transform: scale(1.2); }
}

.login-box {
  position: relative;
  z-index: 1; /* Nivel base */
  background: rgba(17, 25, 40, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 40px 30px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: loginPopIn 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes loginPopIn {
  0% { opacity: 0; transform: translateY(20px) scale(0.95); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.map-top-left-controls {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.map-top-right-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-header {
  text-align: center;
}

.login-header h2 {
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(to right, #818cf8, #c084fc);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 5px;
}

.login-header p {
  font-size: 0.9rem;
  color: #9ca3af;
}

/* Inputs */
.input-group label {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 6px;
  color: #cbd5e1;
  font-weight: 500;
  margin-left: 4px;
}

.input-wrapper {
  position: relative;
}

.input-wrapper input {
  width: 100%;
  padding: 12px 16px;
  padding-left: 40px;
  background: rgba(2, 6, 23, 0.6);
  border: 1px solid #374151;
  border-radius: 12px;
  color: #fff;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.input-wrapper input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
  background: rgba(2, 6, 23, 0.9);
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  opacity: 0.6;
  pointer-events: none;
  transition: opacity 0.3s;
}

.input-wrapper input:focus + .input-icon {
  opacity: 1;
  color: #818cf8;
}

/* Botón */
#btnLogin {
  padding: 14px;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
  transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}

#btnLogin:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.5);
  filter: brightness(1.1);
}

#btnLogin:active {
  transform: translateY(1px);
}

#btnLogin:disabled {
  background: #374151;
  box-shadow: none;
  transform: none;
  cursor: wait;
}

/* Mensajes */
.error, .success {
  font-size: 0.85rem;
  text-align: center;
  display: none; 
  min-height: 1rem;
  padding: 10px;
  border-radius: 8px;
  margin-top: 10px;
  font-weight: 500;
  animation: msgFadeIn 0.3s ease-out;
}

.error {
  background-color: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.success {
  background-color: rgba(34, 197, 94, 0.2);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

@keyframes msgFadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-footer {
  margin-top: 10px;
  text-align: center;
  font-size: 0.8rem;
}

.hint {
  background: rgba(31, 41, 55, 0.6);
  padding: 10px;
  border-radius: 8px;
  border-left: 3px solid #10b981;
  color: #d1d5db;
  text-align: left;
  line-height: 1.4;
}

/* --- RESTAURACIÓN DEL DISEÑO DEL MODAL DE ACTIVACIÓN --- */
/* Aseguramos que el overlay y el modal estén POR ENCIMA del login box */
#activationOverlay {
  z-index: 2000; 
}
#activationModal {
  z-index: 2001;
}

/* Textos dentro del modal */
#activationModal .activation-text {
  font-size: 0.95rem;
  text-align: center;
  line-height: 1.5;
  color: #cbd5e1;
  margin-bottom: 10px;
}

/* La caja del código */
.activation-code {
  font-family: "Courier New", monospace;
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: 4px;
  
  /* Gradiente de texto */
  background: linear-gradient(to right, #818cf8, #22d3ee);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  
  /* Fondo de la caja */
  background-color: rgba(2, 6, 23, 0.8); 
  border: 1px dashed #4f46e5; 
  
  padding: 15px 20px;
  border-radius: 12px;
  text-align: center;
  margin: 15px 0;
  user-select: text; /* Permitir copiar */
  box-shadow: inset 0 0 20px rgba(79, 70, 229, 0.1);
}

/* ==================================
  5. COMPONENTES
==================================
*/

/* 5.1 Panel de Jugadores */
#usersList {
  background: #020617;
  border-radius: 6px;
  padding: 4px;
  font-size: 0.85rem;
  display: flex;
  flex-direction: row;
  gap: 8px;
}

.user-list-column {
  flex: 1 1 50%;
  min-width: 0;
}

.user-list-team-header {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff; 
  padding: 2px;
  background: #1f2937;
  border-radius: 4px;
  text-align: center;
}

.user-list-team-subheader {
  font-size: 0.8rem;
  font-weight: 600;
  color: #a5b4fc;
  padding: 4px 6px;
  margin-top: 6px;
  border-bottom: 1px dashed #374151;
}
.user-list-alive-column .user-list-team-subheader:first-of-type {
  margin-top: 0;
  margin-bottom: 4px;
}

.user-list-dead-column .user-list-team-header {
  background: #b91c1c;
  margin-bottom: 4px;
}

.user-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 4px;
  border-radius: 6px;
  margin-bottom: 3px;
  background: #1f2937;
  line-height: 1;
}

.user-item-empty {
  font-size: 0.8rem;
  color: #666;
  padding: 4px 6px;
  font-style: italic;
}

.user-name {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.user-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.user-status {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-alive {
  background: #14532d;
  color: #bbf7d0;
}

.badge-dead {
  background: #4c0519;
  color: #fecaca;
}

.badge-dead-killer {
  white-space: nowrap;
  font-style: italic;
  opacity: 0.9;
}

/* Botones de Jugador */
.status-buttons {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.btn-secondary {
  background: #1f2937;
}

.btn-secondary:hover {
  background: #374151;
}

.btn-help {
  background: #f97316;
  width: 100%;
}

.user-help {
    margin-top: 5px;
}

.btn-help:hover {
  background: #ea580c;
}

.btn-alive.active {
  background: #15803d;
}

.btn-dead.active {
  background: #b91c1c;
}

button#btnAlive {
  background: #14532d;
}

button#btnDead {
  background: #94181b;
}

.color-settings {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
}

.color-settings input[type="color"] {
  width: 32px;
  height: 24px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid #374151;
}

/* Botones de Equipo */
.team-buttons-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px; 
  width: 100%;
}

.team-join-buttons {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}

.btn-join-team {
  font-size: 0.8rem;
  padding: 6px 4px;
}

.btn-join-team.active-team {
  background-color: #10b981;
  border-color: #059669;
  color: #fff;
  font-weight: 700;
  transform: scale(1.05);
}

.btn-join-team.active-team:hover {
  background-color: #059669;
  opacity: 1.0;
}

.btn-leave-team {
  font-size: 0.8rem;
  padding: 6px 10px;
  width: 100%;
}

.btn-leave-team.btn-danger {
  background-color: #dc2626;
}
.btn-leave-team.btn-danger:hover {
  background-color: #b91c1c;
}

button#btnLeaveTeam {
  background: #00a6ed;
}

/* 5.2 Panel de Mapa */
.panel-map .map-hint {
  font-size: 0.75rem;
  opacity: 0.7;
}

#mapContainer {
  flex: 1;
  background: #020617;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  cursor: grab;
  touch-action: none;
  margin-bottom: 6px;
} 

#mapContainer.dragging {
  cursor: grabbing;
}

#mapInner {
  position: relative;
  transform-origin: 0 0;
  transition: transform 0.1s ease-out;
}

#mapImage {
  width: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

#markersLayer,
#destinationsLayer,
#enemyMarkersLayer {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.marker {
  position: absolute;
  width: 18px; /* AUMENTADO: De 14px a 18px para que quepa el emoji */
  height: 18px; /* AUMENTADO */
  border-radius: 50%;
  border: 2px solid #000;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 6px rgba(0,0,0,0.7);
  transition: left 1s linear, top 1s linear, background-color 0.3s;
  
  /* --- NUEVO: CENTRADO DEL ICONO --- */
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2; /* Asegurar que esté por encima de líneas u otros elementos */
}

/* El emoji dentro del marcador */
.marker-icon-inner {
  font-size: 10px; /* Tamaño ajustado al círculo */
  line-height: 1;
  pointer-events: none; /* Para que los clics pasen al marcador */
  filter: drop-shadow(0 0 1px rgba(0,0,0,0.5)); /* Sombra para contraste */
}

/* Ajuste para la calavera (para que no le afecte el cambio de tamaño/flex) */
.marker.marker-skull {
  width: auto;
  height: auto;
  background: transparent;
  border: none;
  box-shadow: none;
  font-size: 1.5rem;
  display: block; /* Restaurar display block para la calavera */
}

/* Ajuste para el marcador "YO" (hacerlo un poco más grande si tiene icono) */
.marker.me {
  width: 22px;
  height: 22px;
  box-shadow: 0 0 10px rgba(255,255,255,0.5);
  z-index: 3;
}

.marker.me .marker-icon-inner {
    font-size: 12px;
}

.marker-dest {
  position: absolute;
  transform: translate(-50%, -100%);
}

.marker-dest-pin {
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 14px solid #ef4444;
  margin: 0 auto;
}

.marker-dest-head {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid #000;
  margin: 0 auto;
  transform: translateY(4px);
}

.marker-enemy {
  position: absolute;
  width: 20px;
  height: 20px;
  background-color: #ef4444;
  border: 2px solid #ffffff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  color: #ffffff;
  text-shadow: 0 0 3px #000;
  pointer-events: none;
  box-shadow: 0 0 10px 3px rgba(239, 68, 68, 0.7);
  animation: pulse-enemy 1.5s infinite ease-in-out;
  transform: translate(-50%, -50%);
}

/* --- ETIQUETA DE NOMBRE EN EL MAPA (CORREGIDO) --- */
/* --- ETIQUETA DE NOMBRE EN EL MAPA (CORREGIDO CON FLECHA) --- */
.marker-label {
  position: absolute;
  top: 100%; 
  left: 50%;
  transform: translateX(-50%);
  margin-top: 8px;
  
  /* Tipografía */
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  
  /* DISEÑO DE "PÍLDORA" */
  padding: 3px 6px;
  border-radius: 12px;
  width: max-content;      /* Se adapta al texto */
  max-width: 120px;        /* Si es muy largo, para aquí */
  
  /* IMPORTANTE: visible para que se vea la flecha que sale por arriba */
  overflow: visible;       
  
  /* Si el nombre es larguísimo, que ponga puntos suspensivos... 
     Nota: text-overflow suele requerir overflow:hidden, 
     pero aquí priorizamos ver la flecha. El max-width limitará el ancho. */
  
  background-color: var(--label-bg, rgba(0, 0, 0, 0.6)); /* Un poco más oscuro para leer mejor */
  text-shadow: var(--label-shadow, 0 0 3px #000);
  z-index: 100;
}

/* El triangulito (Flecha) */
.marker-label::before {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  
  /* Posición: Pegado justo encima de la etiqueta */
  bottom: 100%; 
  left: 50%;
  transform: translateX(-50%);
  
  /* Dibujo del triángulo */
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  /* El color debe coincidir con el fondo de la etiqueta */
  border-bottom: 6px solid var(--label-bg, rgba(0, 0, 0, 0.6));
}

.marker-skull .marker-label {
  margin-top: 6px;
}

.marker-dest .marker-label {
  margin-top: 6px;
}

@keyframes pulse-enemy {
  0% {
    box-shadow: 0 0 10px 3px rgba(239, 68, 68, 0.7);
    transform: translate(-50%, -50%) scale(1); /* Tamaño normal */
  }
  50% {
    box-shadow: 0 0 14px 5px rgba(239, 68, 68, 1); /* Más intenso */
    transform: translate(-50%, -50%) scale(1.1); /* Ligeramente más grande */
  }
  100% {
    box-shadow: 0 0 10px 3px rgba(239, 68, 68, 0.7);
    transform: translate(-50%, -50%) scale(1); /* Vuelve al tamaño normal */
  }
}

/* 5.3 Panel de Chat */
.panel-chat .panel-header {
  gap: 8px;
  align-items: center;
}

.panel-chat .panel-header h2 {
  flex-basis: 100%;
}

.chat-settings {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.chat-settings .toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
}

.toggle input {
  accent-color: #4ade80;
}

.toggle-label {
  cursor: pointer;
}

#messages.panel-body {
  background: #020617;
  border-radius: 6px;
  padding: 6px;
  font-size: 0.85rem;
  overflow-y: auto;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.msg {
  margin-bottom: 6px;
  line-height: 1.3;
  word-wrap: break-word;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.msg:hover {
  background-color: #1f2937;
}

.msg-left {
  flex: 1;
  display: flex;
  align-items: flex-start;
  line-height: 1.4;
}

.chat-online-dot {
  width: 8px;
  height: 8px;
  background-color: #666; /* Offline */
  border-radius: 50%;
  margin-right: 5px;
  margin-top: 5px;
  flex-shrink: 0;
  transition: background-color 0.3s ease;
}

.chat-online-dot.online {
  background-color: #22c55e; /* Online */
}

.msg-username {
  font-weight: 600;
  margin-right: 4px;
  line-height: inherit;
  white-space: nowrap;
}

.msg-time {
  font-size: 0.7rem;
  opacity: 0.6;
  white-space: nowrap;
}

.msg-edited-pencil {
  font-size: 0.7rem;
  opacity: 0.6;
  align-self: flex-start;
}

.msg-image {
  max-width: 50px;
  max-height: 50px;
  border-radius: 8px;
  border: 1px solid #374151;
  margin-top: 4px;
  margin-left: 4px;
  cursor: zoom-in;
  transition: opacity 0.2s ease;
}
.msg-image:hover {
  opacity: 0.8;
}

/* Audio Mensaje */
.msg-audio button {
  font-size: 0.8rem;
  padding: 4px 8px;
  margin-left: 4px;
}

.audio-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
}

.audio-btn {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  background: #374151;
  color: #eee;
  flex-shrink: 0;
  min-width: 26px;
}
.audio-btn:hover {
  background: #4b5563;
}
.audio-btn.audio-stop {
  background: #b91c1c;
}
.audio-btn.audio-stop:hover {
  background: #ef4444;
}

.audio-duration {
  font-size: 0.8rem;
  opacity: 0.7;
}

.audio-progress-container {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.audio-time {
  font-size: 0.8rem;
  opacity: 0.9;
  font-family: monospace;
}

.audio-progress-bar {
  flex-grow: 1;
  width: 45px;
  height: 12px;
}
.audio-progress-bar::-webkit-progress-bar {
  background-color: #1f2937;
  border-radius: 4px;
}
.audio-progress-bar::-webkit-progress-value {
  background-color: #4f46e5;
  border-radius: 4px;
}
.audio-progress-bar::-moz-progress-bar {
  background-color: #4f46e5;
  border-radius: 4px;
}


/* Chat Footer */
.chat-footer {
  margin-top: 4px;
  position: relative;
}

.input-row {
  display: flex;
  gap: 6px;
}

.input-row input {
  flex: 1;
}

.btn-record,
.btn-send-image,
.btn-emoji {
  min-width: 40px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1f2937;
  font-size: 1.1rem;
}

.btn-emoji:hover {
  background: #374151;
}

.btn-record.recording {
  background: #b91c1c;
  color: #fee2e2;
}

emoji-picker {
  position: absolute;
  bottom: 100%; 
  right: 0;
  z-index: 10;
  margin-bottom: 5px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
  overflow: hidden;
  
  /* Variables de Estilo */
  --background: #1f2937; 
  --border-color: #374151;
  --border-radius: 12px;
  --category-font-color: #eee;
  --color: #eee;
  --input-background: #020617; 
  --input-border-color: #374151;
  --input-font-color: #eee;
  --input-placeholder-color: #6b7280;
  --button-hover-background: #374151;
  --button-active-background: #4b5563;
  --indicator-color: #4f46e5; 
}

/* ==================================
  6. COMPONENTE DE VOZ
==================================
*/
.voice-chat-list-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 8px;
  padding: 4px 6px;
  background: #020617;
  border-bottom: 1px solid #1f2937;
  min-height: 40px;
  overflow: hidden;
  border-radius: 6px;
  margin-bottom: 4px;
}

.voice-chat-user-container {
  display: flex;
  flex-grow: 1;
  flex-shrink: 1;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: #374151 #020617;
}

.voice-chat-user-container::-webkit-scrollbar {
  height: 4px;
}
.voice-chat-user-container::-webkit-scrollbar-track {
  background: #020617;
}
.voice-chat-user-container::-webkit-scrollbar-thumb {
  background-color: #374151;
  border-radius: 4px;
}

.voice-user-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  padding: 2px 6px;
  border-radius: 6px;
  background: #1f2937;
  flex-shrink: 0;
}

.voice-user-badge .user-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
}

.voice-user-badge .mute-icon {
  opacity: 0.7;
  font-size: 0.9em;
  margin-left: 2px;
}

.voice-user-badge-empty {
  font-size: 0.8rem;
  color: #666;
  font-style: italic;
  padding: 2px 6px;
  flex-shrink: 0;
}

.voice-chat-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

button#btnJoinVoice {
  background: #14532d;
}

button#btnLeaveVoice {
  background: #690000;
}


/* ==================================
  7. MODALES Y OVERLAYS
==================================
*/
.picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
}

.picker-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #1f2937;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  width: 90%;
  max-width: 320px;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  padding: 12px;
  gap: 8px;
}

.picker-modal h2 {
  font-size: 1.1rem;
  text-align: center;
  margin-bottom: 8px;
}

.picker-btn {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  background: #374151;
  color: #eee;
  font-weight: 500;
}

.picker-btn:hover {
  background: #4b5563;
}


.picker-btn.btn-cancel {
  background: #ef4444;
}

.picker-btn.btn-danger {
  background: #dc2626;
  color: white;
}
.picker-btn.btn-danger:hover {
  background: #b91c1c;
}

/* Modal de Imagen */
.image-modal-overlay {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: rgba(0, 0, 0, 0.9);
  transition: opacity 0.3s ease;
  touch-action: none;
}

.image-modal-close {
  position: absolute;
  top: 15px;
  right: 35px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  z-index: 10002;
}

.image-modal-content {
  position: absolute;
  margin: auto;
  display: block;
  max-width: 90%;
  max-height: 90%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  transform-origin: 0 0;
  transition: transform 0.2s ease-out;
  cursor: grab;
}
.image-modal-content:active {
  cursor: grabbing;
}

/* Modal de Prompt */
#promptModal {
  gap: 6px;
}
#promptModal h2 {
  margin-bottom: 6px;
}
#promptModal label {
  font-size: 0.9rem;
  margin-bottom: 2px;
  opacity: 0.8;
  align-self: flex-start;
}
#promptModal input[type="text"] {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #374151;
  background: #020617;
  color: #eee;
  width: 100%;
  margin-bottom: 8px;
}
.prompt-buttons {
  display: flex;
  gap: 8px;
  width: 100%;
}
.prompt-buttons .picker-btn {
  flex: 1;
  padding: 10px;
}

/* Modal Manual de Usuario */
.manual-modal {
  max-width: 700px;
  width: 90%;
  height: 80vh;
  padding: 15px;
  gap: 10px;
}
.manual-modal h2 {
  margin-bottom: 0;
  padding-right: 30px;
}
.manual-modal .image-modal-close {
  position: absolute;
  top: 0px;
  right: 20px;
  z-index: 10;
}
.manual-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: #020617;
  border: 1px solid #1f2937;
  border-radius: 8px;
  padding: 10px 15px;
  scrollbar-width: thin;
  scrollbar-color: #4b5563 #1f2937;
}
.manual-content h3 {
  color: #a5b4fc;
  border-bottom: 1px solid #374151;
  padding-bottom: 4px;
  margin-top: 15px;
  margin-bottom: 8px;
}
.manual-content h3:first-child {
  margin-top: 0;
}
.manual-content p {
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 10px;
  opacity: 0.9;
}
.manual-content ul {
  list-style-position: inside;
  margin-left: 5px;
  margin-bottom: 10px;
}
.manual-content li {
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 5px;
}
.manual-content code {
  background: #1f2937;
  padding: 2px 5px;
  border-radius: 4px;
  font-family: monospace;
  color: #f1f1f1;
}

/* ==================================
  8. MENÚS CONTEXTUALES
==================================
*/
.context-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 1000;
}

.context-menu {
  display: none;
  position: fixed;
  z-index: 1001;
  width: 240px;
  background-color: #1f2937;
  border: 1px solid #374151;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
  padding: 6px;
  font-size: 0.9rem;
}

.context-menu-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  display: block;
  width: 100%;
  padding: 8px 12px;
  text-align: left;
  background: transparent;
  color: #eee;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
}

.context-menu-btn:hover {
  background-color: #374151;
}

.context-menu-separator {
  height: 1px;
  background-color: #374151;
  margin: 6px 0;
}

.context-menu-btn.btn-warn {
  color: #f97316;
}
.context-menu-btn.btn-warn:hover {
  background-color: #7c2d12;
  color: #f1f1f1;
}

.context-menu-btn.btn-danger {
  color: #f87171;
}
.context-menu-btn.btn-danger:hover {
  background-color: #b91c1c;
  color: #f1f1f1;
}

/* ==================================
  9. UTILIDADES Y OTROS
==================================
*/

/* Fondo Borroso */
:root {
  /* Fondo por defecto */
  --app-bg: url("/assets/img/fondo.jpg"); 
  
  /* *** VARIABLES VISUALES NUEVAS *** */
  --panel-opacity: 0.50;         /* Opacidad 0 a 1 */
  --panel-border: 1px solid #1f2937; /* Borde completo */
  --bg-blur-px: 10px;            /* Blur en píxeles */
  --bg-dim-opacity: 0.20;        /* Capa oscura 0 a 1 */
  --panel-blur-px: 5px;
}

.bg-blur {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: #050509; /* Fondo base de seguridad */
}
.bg-blur::before {
  content: "";
  position: absolute;
  inset: -20px;
  background-image: var(--app-bg);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  
  /* CAMBIO: Usar variable de blur */
  filter: blur(var(--bg-blur-px));
  
  transform: scale(1.05);
  transition: background-image 0.3s ease-in-out, filter 0.2s;
}

.bg-blur::after {
  content: "";
  position: absolute;
  inset: 0;
  /* CAMBIO: Usar variable de opacidad oscura */
  background: rgba(0, 0, 0, var(--bg-dim-opacity));
  transition: background-color 0.2s;
}

/* Scroll Genérico */
.scrollable {
  overflow-y: auto;
}

/* Alertas Flotantes */
/* ==================================
   ALERTAS FLOTANTES (REDISEÑO GLASS)
================================== */
#alertsContainer {
  position: fixed;
  right: 20px; /* Un poco más de margen */
  top: 60px;   /* Debajo del header */
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  pointer-events: none; /* Permite hacer clic a través del contenedor */
}

.alert-box {
  /* Variable por defecto si JS no la define */
  --alert-accent: #f97316; 
  
  pointer-events: auto; /* Reactivar clics en la alerta */
  background: rgba(15, 23, 42, 0.95); /* Fondo muy oscuro, casi opaco */
  color: #f1f5f9;
  
  /* Diseño de tarjeta */
  padding: 12px 16px;
  border-radius: 8px;
  min-width: 260px;
  max-width: 350px;
  
  /* Efectos visuales */
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 4px solid var(--alert-accent); /* El color viene aquí */
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.7), 
              0 0 15px -5px var(--alert-accent); /* Glow sutil del color */
  
  display: flex;
  flex-direction: column;
  gap: 6px;
  
  /* Animaciones */
  animation: alertSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden; /* Para cortar la barra de progreso */
  backdrop-filter: blur(10px);
}

.alert-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.alert-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* El punto de color del usuario */
.alert-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 5px currentColor; /* Brilla con su propio color */
}

.alert-close {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 0.8;
  color: #94a3b8;
  transition: color 0.2s;
  padding: 0;
  margin-left: 10px;
}

.alert-close:hover {
  color: #fff;
}

.alert-body {
  font-size: 0.9rem;
  color: #cbd5e1; /* Gris claro para texto secundario */
  line-height: 1.4;
}

/* BARRA DE PROGRESO (Reemplaza al texto del timer) */
.alert-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background-color: var(--alert-accent);
  width: 100%;
  transform-origin: left;
  animation: alertTimer 10s linear forwards; /* 10 segundos exactos */
}

@keyframes alertSlideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes alertTimer {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* Clase para animación de salida */
.alert-box.fade-out {
  animation: alertFadeOut 0.3s ease forwards;
}

@keyframes alertFadeOut {
  to { opacity: 0; transform: translateX(10px) scale(0.95); }
}

/* Indicador de Reconexión */
.connection-status {
  position: fixed;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: #b91c1c;
  color: #fee2e2;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  z-index: 10000;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

/* Botón de Logout (genérico) */
.btn-logout {
  padding: 5px 10px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: #ef4444;
  color: white;
  font-size: 0.8rem;
  height: 22px;
  line-height: 1;
}

/* Botón de Fullscreen (genérico) */
.btn-fullscreen {
	line-height: 1;
  transition: opacity 0.2s ease;
  padding: 5px 10px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: #445eef;
  color: white;
  font-size: 0.8rem;
}
.btn-fullscreen:hover {
  opacity: 1;
}

/* Estilos de Scrollbar Personalizados */
html, .scrollable {
  scrollbar-width: thin;
  scrollbar-color: #4b5563 #1f2937;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: #1f2937;
  border-radius: 8px;
}
::-webkit-scrollbar-thumb {
  background-color: #4b5563;
  border-radius: 8px;
  border: 2px solid #1f2937; 
}
::-webkit-scrollbar-thumb:hover {
  background-color: #4f46e5;
}
::-webkit-scrollbar-corner {
  background: #020617;
}

/* ==================================
  10. RESPONSIVE
==================================
*/
@media (min-width: 801px) {
  .app-screen {
    flex-direction: row; /* Cambia a horizontal */
    height: calc(100vh - 45px); 
  }

  .app-column {
    height: 100%;
    min-height: 0;
  }
  
  .app-column-left {
    flex: 0 0 25%;
    max-width: 350px;
  }
  
  .app-column-main {
    flex: 1 1 50%;
  }
  
  .app-column-right {
    flex: 0 0 25%;
    max-width: 400px;
  }
}

/* --- ESTILOS DE ESTADO DE USUARIO (MAPA) --- */
.user-status-bar {
  display: flex;
  flex-wrap: wrap; /* Para que quepan en móvil */
  gap: 6px;
}

.btn-status {
  flex: 1 1 auto; /* Permite que crezcan y se encojan */
  background: #1f2937; /* Gris oscuro */
  color: #9ca3af;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #374151;
}
.btn-status:hover {
  background: #374151;
  color: #eee;
}

.btn-status.active {
  background: #10b981; /* Verde (como equipo activo) */
  color: #fff;
  font-weight: 600;
  border-color: #059669;
}

.btn-status-clear {
  flex-grow: 0; /* No crece */
  flex-shrink: 0;
  background: #94181b; /* Gris medio */
  color: #fff;
  padding: 4px 8px;
  border: 1px solid #4b5563;
}
.btn-status-clear:hover {
  background: #b91c1c; /* Rojo al pasar */
}

/* --- ESTILOS DE ESTADO (LISTA DE USUARIOS) --- */
.user-activity-status {
  font-size: 0.75rem;
  opacity: 0.8;
  background: #020617; /* Fondo del chat */
  padding: 2px 6px;
  border-radius: 999px;
  white-space: nowrap;
}

/* --- ESTILOS DE CONTROLES DE ZOOM DEL MAPA --- */
.map-zoom-controls {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 10; /* Encima del mapa */
  display: flex;
  flex-direction: column; /* Vertical */
  gap: 6px;
}

.map-zoom-btn {
  width: 30px;
  height: 30px;
  background: rgba(31, 41, 55, 0.8); /* #1f2937 con 80% opacidad */
  border: 1px solid #4b5563;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  
  /* Efecto de cristal esmerilado */
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  
  padding: 0; /* Reset padding */
  line-height: 1; /* Centrar texto */
}

.map-zoom-btn:hover {
  background: rgba(75, 85, 99, 0.9); /* #4b5563 con 90% opacidad */
}

button#btnHelp {
    background: rgb(239 159 0 / 80%);
}

#btnZoomResetMap {
  font-size: 1rem; /* Ajustar el icono de reset */
}

@media (max-width: 800px) {
  #btnZoomIn,
  #btnZoomOut {
    display: none;
  }
}

/* --- ESTILOS MODAL DE AJUSTES --- */
.settings-modal {
  max-width: 400px; /* Un poco más ancho que un modal normal */
  width: 90%;
  max-height: 80vh; /* Alto máximo */
  padding: 15px;
  gap: 10px;
}

.settings-modal h2 {
  margin-bottom: 0;
  padding-right: 30px; /* Espacio para el botón de cerrar */
}

/* Reutilizar el botón de cerrar del modal de imagen/manual */
.settings-modal .image-modal-close {
  position: absolute;
  right: 20px;
  z-index: 10;
  top: -7px;
}

.settings-content {
  flex: 1; /* Ocupa el espacio restante */
  min-height: 0; /* Para que flex funcione */
  overflow-y: auto;
  background: #020617; /* Fondo del chat */
  border: 1px solid #1f2937;
  border-radius: 8px;
  padding: 10px 15px;
  /* Aplicar el estilo de scrollbar que ya definimos */
  scrollbar-width: thin;
  scrollbar-color: #4b5563 #1f2937;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.settings-section h3 {
  color: #a5b4fc; /* Color índigo */
  border-bottom: 1px solid #374151;
  padding-bottom: 4px;
  margin-bottom: 0;
}
.settings-section .settings-hint {
  font-size: 0.8rem;
  line-height: 1.4;
  opacity: 0.7;
  margin-bottom: 5px;
}
.settings-section label {
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0.9;
}
.settings-section input {
  margin-top: 4px;
}
.settings-section .picker-btn {
  margin-top: 10px;
  background: #10b981; /* Verde */
}
.settings-section .picker-btn:hover {
  background: #059669;
}

.color-picker-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 5px;
}
.color-picker-wrapper input[type="color"] {
  width: 50px;
  height: 35px;
  padding: 2px;
  border-radius: 6px;
  border: 1px solid #374151;
  background: #020617;
  display: block !important; /* Sobreescribir el display:none anterior */
}
.color-picker-wrapper #colorHexValue {
  /* Lo convertimos en un "badge" de previsualización */
  font-size: 1.1rem;
  font-weight: 700;
  background: #020617;
  border: 1px solid #374151;
  padding: 6px 12px;
  border-radius: 6px;
  /* El color lo aplica JS */
}

/* --- ESTILOS MENÚ CONTEXTUAL (AÑADIDO) --- */
.context-menu-btn.btn-success {
  color: #22c55e; /* Verde brillante */
}
.context-menu-btn.btn-success:hover {
  background-color: #15803d; /* Verde oscuro */
  color: #f1f1f1;
}
#promptOverlay {
  z-index: 2000 !important;
}

#promptModal {
  z-index: 2001 !important;
}

/* --- ESTILOS DE ACORDEÓN (DETALLES) --- */
details.settings-details {
  background: #111827;
  border: 1px solid #374151;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 10px;
}

details.settings-details summary {
  padding: 12px 15px;
  cursor: pointer;
  font-weight: 600;
  color: #a5b4fc;
  background: #1f2937;
  list-style: none; /* Quitar triángulo por defecto */
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
}

details.settings-details summary:hover {
  background: #374151;
}

details.settings-details summary::after {
  content: '+'; 
  font-weight: bold;
  font-size: 1.1rem;
}

details.settings-details[open] summary::after {
  content: '-';
}

details.settings-details[open] summary {
  border-bottom: 1px solid #374151;
}

/* Contenedor interno del formulario dentro del details */
details.settings-details .settings-inner {
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* --- SELECTOR DE FONDOS --- */
.bg-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.bg-option {
  height: 60px;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid #374151; /* Borde gris por defecto */
  
  /* Esto asegura que la imagen se vea bien en el cuadradito */
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  
  transition: transform 0.2s, border-color 0.2s;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.bg-option:hover {
  transform: scale(1.05);
  border-color: #a5b4fc;
}

.bg-option.active {
  border-color: #10b981; /* Borde verde activo */
  transform: scale(0.95);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

/* --- SLIDERS PERSONALIZADOS (TEMA FORTNITE) --- */
input[type=range] {
  -webkit-appearance: none; /* Quitar estilo por defecto */
  width: 100%;
  background: transparent;
  cursor: pointer;
  height: 24px; /* Altura del área sensible */
  margin: 0;
  touch-action: none;
}

/* Barra (Track) - Chrome/Safari/Edge */
input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  background: #1f2937; /* Gris oscuro */
  border-radius: 4px;
  border: 1px solid #374151;
}

/* Botón (Thumb) - Chrome/Safari/Edge */
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 18px;
  width: 18px;
  border-radius: 50%;
  background: #4f46e5; /* Índigo principal */
  border: 2px solid #fff; /* Borde blanco para resaltar */
  margin-top: -7px; /* Centrar verticalmente */
  box-shadow: 0 0 5px rgba(0,0,0,0.5);
  transition: transform 0.1s, background 0.2s;
}

/* Firefox Track */
input[type=range]::-moz-range-track {
  width: 100%;
  height: 6px;
  background: #1f2937;
  border-radius: 4px;
  border: 1px solid #374151;
}

/* Firefox Thumb */
input[type=range]::-moz-range-thumb {
  height: 18px;
  width: 18px;
  border-radius: 50%;
  background: #4f46e5;
  border: 2px solid #fff;
  box-shadow: 0 0 5px rgba(0,0,0,0.5);
  cursor: pointer;
}

/* Efectos Hover/Active */
input[type=range]:focus {
  outline: none;
}
input[type=range]:hover::-webkit-slider-thumb {
  background: #6366f1; /* Índigo más claro */
  transform: scale(1.1);
}
input[type=range]:active::-webkit-slider-thumb {
  background: #10b981; /* Verde al arrastrar */
  transform: scale(1.2);
}

/* --- CLASE PARA OCULTAR MODAL AL ARRASTRAR --- */
.ghost-mode {
  opacity: 0 !important; /* Totalmente transparente */
  transition: opacity 0.2s ease-in-out;
  pointer-events: none; /* Para que no bloquee clicks si se queda pillado (seguridad) */
}

/* Aseguramos que el contenedor del modal tenga transición para que el efecto sea suave */
.picker-modal {
  transition: opacity 0.2s ease-in-out, transform 0.2s;
}
/* --- ESTILOS DE CABECERA DE SLIDER (Etiqueta + Valor) --- */
.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.slider-value {
  font-family: monospace;
  background: #1f2937;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #374151;
  font-size: 0.85rem;
  color: #a5b4fc;
  font-weight: bold;
}

/* --- INDICADOR FLOTANTE (HUD) --- */
/* Aparece cuando arrastras el slider y el modal desaparece */
#visualValueIndicator {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.7); /* Fondo oscuro semitransparente */
  color: white;
  padding: 20px 30px;
  border-radius: 16px;
  font-size: 2.5rem; /* Texto grande */
  font-weight: 700;
  font-family: "Roboto", sans-serif;
  z-index: 3000; /* Por encima de todo */
  pointer-events: none; /* No interfiere con el ratón */
  backdrop-filter: blur(8px); /* Efecto cristal */
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  
  /* Animación de entrada */
  opacity: 0;
  transition: opacity 0.2s ease-in-out, transform 0.1s;
}

#visualValueIndicator.visible {
  opacity: 1;
}

/* --- ANIMACIÓN DE BORRADO DE MENSAJE MEJORADA --- */
@keyframes msgSmoothDelete {
  0% {
    opacity: 1;
    transform: scale(1);
    max-height: 300px; 
    margin-bottom: 6px;
    padding-top: 2px;
    padding-bottom: 2px;
    border: 1px solid transparent;
  }
  
  30% {
    opacity: 0;
    transform: scale(0.98);
  }

  100% {
    opacity: 0;
    transform: scale(0.95);
    max-height: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    border: none;
  }
}

.msg.removing {
  animation: msgSmoothDelete 0.5s ease-in-out forwards;
  overflow: hidden; 
  pointer-events: none; 
  min-height: 0; 
}

.map-left-controls {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.map-top-left-controls .map-float-btn {
    display: none;
}

.map-float-btn {
  width: 30px;
  height: 30px;
  background: rgba(31, 41, 55, 0.6);
  border: 1px solid #4b5563;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  
  /* Efecto cristal */
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transition: background-color 0.2s ease, transform 0.1s;
}

.map-float-btn:hover {
  background: rgba(75, 85, 99, 0.9);
}

.map-float-btn:active {
  transform: scale(0.95);
}

@media (max-width: 800px) {
  
  .map-left-controls {
    bottom: 10px; /* Ajusta si chocan con algo */
    left: 10px;
  }
  
    .map-top-left-controls {
    top: 10px; /* Ajusta si chocan con algo */
    left: 10px;
  }
  
    .map-top-right-controls {
    top: 10px; /* Ajusta si chocan con algo */
    right: 10px;
  }
}

/* ==================================
   FIX: TAMAÑO DE MINI VIDEO EN BARRA
================================== */

/* 1. Tarjeta del usuario en la barra superior */
.voice-user-badge {
  display: flex;
  flex-direction: column; /* Video arriba, nombre abajo */
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.7rem;
  padding: 4px 6px;
  border-radius: 6px;
  background: #1f2937;
  flex-shrink: 0;
  min-width: 60px;       /* Ancho mínimo */
  cursor: pointer;
  transition: background 0.2s;
  border: 1px solid transparent;
}

.voice-user-badge:hover {
  background: #374151;
  border-color: #4b5563;
}

/* 2. Contenedor EXACTO del mini video */
.mini-video-container {
  width: 30px;   /* Icono pequeño */
  height: 20px;  
  background: #000;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #4b5563;
  margin-bottom: 2px;
  position: relative;
}

/* 3. Video dentro de la barra (Recortado para llenar) */
.mini-video-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  transform: scaleX(-1); /* Efecto espejo por defecto para selfie */
}


/* Texto del nombre en la barra */
.voice-user-badge span {
  max-width: 70px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

/* ==================================
   MODAL DE VIDEO (GRID INTELIGENTE)
================================== */

/* Contenedor con scroll */
.video-grid-content {
  display: flex !important;
  flex-direction: column;
  gap: 15px;
  padding: 15px;
  overflow-y: auto;
}

/* Títulos */
.grid-section-title {
  font-size: 0.85rem;
  color: #a5b4fc;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  border-bottom: 1px solid #374151;
  padding-bottom: 4px;
}

/* --- REJILLA DE VIDEO (Layout 3 Columnas) --- */
.video-section-grid {
  display: grid;
  /* Ajustado a 280px. En pantalla grande cabrán 3 exactos (280*3 < 1000px) */
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
  grid-auto-flow: dense; 
  width: 100%;
  padding-bottom: 10px;
}

/* --- TARJETA BASE --- */
.grid-user-card {
  background: #1f2937;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  border: 1px solid #374151;
  cursor: zoom-in; 
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  
  /* Default: Cuadrado/Vertical */
  aspect-ratio: 4/3; 
  width: 100%;
  grid-column: span 1; 
  grid-row: span 1;
}

/* Efecto Hover */
.grid-user-card:hover {
  z-index: 10;
  transform: scale(1.03); /* Ligero zoom al pasar el ratón */
  box-shadow: 0 8px 20px rgba(0,0,0,0.6);
  border-color: #a5b4fc;
}

/* CLASE HORIZONTAL (16:9) */
.grid-user-card.wide {
  grid-column: span 1; /* CAMBIO: Ahora ocupa 1 sola columna para caber 3 en línea */
  aspect-ratio: 16/9;   /* Mantiene el formato panorámico (rectangular) */
}

/* CLASE VERTICAL (Móvil) */
.grid-user-card.tall {
  grid-column: span 1;
  grid-row: span 2; /* Ocupa 2 filas de alto para compensar lo estrecho */
  aspect-ratio: 9/16;
}

/* RESPONSIVE: MÓVIL */
@media (max-width: 900px) {
  .video-section-grid {
      /* En tablets/móviles bajamos a 2 columnas */
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

@media (max-width: 600px) {
  .video-section-grid {
      /* En móviles pequeños, 1 o 2 columnas dependiendo del ancho */
      grid-template-columns: 1fr 1fr; 
  }
  /* En móvil forzamos a que ocupen todo el ancho disponible */
  .grid-user-card.wide { grid-column: span 2; } 
  .grid-user-card.tall { grid-row: span 2; grid-column: span 1; }
}

/* VIDEO GRID */
.grid-user-card video {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Rellenar sin bordes negros en miniatura */
  background-color: #111;
}

.grid-user-name {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
  color: white;
  padding: 6px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  pointer-events: none;
}

/* Ocultar nombre en modo expandido para limpiar la vista (opcional, o hacerlo más discreto) */
.grid-user-card.expanded .grid-user-name {
    background: rgba(0,0,0,0.5);
    padding: 15px;
    font-size: 1.2rem;
}

/* ==================================
   SECCIÓN SOLO AUDIO
================================== */

.audio-section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  width: 100%;
}

.audio-only-card {
  background: #111827;
  border-radius: 6px;
  padding: 8px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  border: 1px solid #374151;
  height: 50px;
}

.audio-avatar {
  font-size: 1.1rem;
  background: #1f2937;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  line-height: 1;
}

.audio-card-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.audio-card-info .name {
    font-weight: bold;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.audio-card-info .status {
    font-size: 0.7rem;
    opacity: 0.6;
}

/* --- MODAL DE REJILLA (Altura Inteligente) --- */
.video-grid-modal {
  max-width: 1000px !important;
  width: 95% !important;
  
  /* CAMBIO CLAVE: Altura dinámica */
  height: auto !important;    /* Se encoge si hay pocos videos */
  max-height: 90vh;           /* Nunca pasa del 90% de la altura de pantalla */
  
  display: flex;
  flex-direction: column;
  padding: 0 !important;
  background: #0f172a !important;
  
  /* Centrado perfecto en pantalla (esto ya lo hereda de .picker-modal, pero aseguramos) */
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  
  overflow: hidden; /* Para recortar bordes redondeados */
}

/* Header fijo (siempre visible al hacer scroll) */
.video-grid-modal h2 {
  padding: 15px;
  background: #1e293b;
  margin: 0;
  border-bottom: 1px solid #334155;
  flex-shrink: 0; /* Evita que el título se aplaste */
}

/* Contenedor de videos con Scroll interno */
.video-grid-content {
  display: flex !important;
  flex-direction: column;
  gap: 10px;
  padding: 15px;
  
  /* SCROLL MAGIA: */
  overflow-y: auto; /* Scroll solo aquí si excede el max-height */
  overscroll-behavior: contain; /* Evita mover la página de fondo */
  
  /* Altura mínima para que no se vea feo si está cargando */
  min-height: 200px; 
}

.video-grid-modal .image-modal-close {
  top: 2px;
  right: 15px;
}

/* --- MODAL DE VIDEO FULLSCREEN (SIMPLIFICADO) --- */
#videoFullscreenOverlay {
  display: none;
  position: fixed;
  z-index: 10000;
  inset: 0; /* Ocupa toda la pantalla */
  background-color: #000; /* Fondo negro para las bandas */
}

#videoFullscreenContainer {
  width: 100%; 
  height: 100%; 
  display: flex; 
  align-items: center; 
  justify-content: center;
}

#videoFullscreenPlayer {
  /* Ocupar el máximo espacio disponible */
  width: 100%;
  height: 100%;
  object-fit: contain; 
  transition: opacity 0.2s ease;
}

/* Estilos Panel Gestión Usuarios */
.user-mgmt-controls {
  padding-bottom: 10px;
  border-bottom: 1px solid #374151;
  margin-bottom: 10px;
}

.user-mgmt-list {
  min-height: 200px;
  max-height: 60vh;
  overflow-y: auto;
}

.mgmt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.mgmt-table th {
  text-align: left;
  padding: 8px;
  background: #1f2937;
  color: #a5b4fc;
  position: sticky;
  top: 0;
}

.mgmt-table td {
  padding: 8px;
  border-bottom: 1px solid #374151;
  vertical-align: middle;
}

.mgmt-table tr:hover {
  background: #111827;
}

.mgmt-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mgmt-actions {
  display: flex;
  gap: 4px;
}

/* Botones de icono pequeños */
.btn-icon {
  padding: 4px 6px;
  font-size: 1rem;
  line-height: 1;
  background: #374151;
  border: 1px solid #4b5563;
  min-width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover {
  background: #4b5563;
  transform: scale(1.1);
}

.btn-icon.btn-danger {
  background: #7f1d1d;
  border-color: #991b1b;
}
.btn-icon.btn-danger:hover {
  background: #b91c1c;
}

.btn-icon.btn-warn {
  background: #7c2d12;
  border-color: #9a3412;
}
.btn-icon.btn-warn:hover {
  background: #ea580c;
}

.btn-icon.btn-success {
  background: #14532d;
  border-color: #166534;
}
.btn-icon.btn-success:hover {
  background: #22c55e;
}
.badge-pending {
  background: #f59e0b; /* Color Ámbar/Naranja */
  color: #fff; /* Texto oscuro para contraste o blanco */
  font-weight: bold;
}
/* Estilos para la leyenda del panel de gestión */
.mgmt-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #374151;
  justify-content: center; /* Centrado */
  background: rgba(0, 0, 0, 0.2);
  padding: 10px;
  border-radius: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #9ca3af; /* Color de texto suave */
  cursor: help; /* Cursor de ayuda al pasar el ratón */
}

/* Reutilizamos el estilo .btn-icon pero lo hacemos un poco más pequeño para la leyenda */
.legend-item .btn-icon {
  font-size: 0.9rem;
  width: 24px;
  height: 24px;
  pointer-events: none; /* Que no parezcan clickeables en la leyenda */
  border-radius: 8px;
}

.connection-modal {
  /* Posicionamiento fijo para cubrir todo */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100dvh; /* 100% de la altura visual del dispositivo (dynamic viewport height) */
  z-index: 9999;
  
  /* EL TRUCO DEL CENTRADO */
  /* Usamos !important para que si el JS pone 'display: block', esto lo corrija */
  display: flex !important; 
  justify-content: center; /* Centro Horizontal */
  align-items: center;     /* Centro Vertical */
  
  /* Estilo visual */
  background-color: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(8px);
  
  /* Oculto por defecto usando visibilidad y opacidad en lugar de display:none 
     para no romper el flexbox cuando cargue */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Cuando está activo */
.connection-modal.is-visible {
  opacity: 1;
  visibility: visible;
}

/* En style.css (reemplaza la clase .connection-box existente) */
.connection-box {
  margin: auto;
  max-width: 90%;
  width: 350px;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);

  /* --- NUEVAS LÍNEAS PARA CORREGIR POSICIÓN --- */
  display: flex;            /* Activa modo flexible */
  flex-direction: column;   /* Pone los elementos uno encima de otro */
  align-items: center;      /* Centra todo horizontalmente */
  gap: 20px;                /* Espacio entre el spinner y el texto */
}

/* Spinner y Textos (Igual que antes) */
.delulu-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  border-top-color: #a855f7;
  border-left-color: #3b82f6;
  animation: spin 1s cubic-bezier(0.55, 0.055, 0.675, 0.19) infinite;
}

.connection-box p {
  color: #fff;
  margin: 0;
  font-weight: 500;
}

@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ==================================
   11. MINIMIZAR PANELES (FIX DINÁMICO SOLO MÓVIL)
================================== */

/* 1. ESTILO BASE (Escritorio): Botón oculto */
.panel-toggle-btn {
  display: none; /* <--- IMPORTANTE: Oculto en PC */
  
  /* Estilos visuales (se aplicarán cuando se muestre en móvil) */
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 1.1rem;
  padding: 0 8px;
  cursor: pointer;
  transition: transform 0.2s;
  line-height: 1;
}

/* Rotación de flecha si tiene la clase */
.panel.is-collapsed .panel-toggle-btn {
  transform: rotate(180deg);
  color: #6b7280;
}

/* ==================================
   FIX MÓVIL: WRAPPER STRATEGY (DEFINITIVO)
================================== */

/* ESTILO BASE DEL WRAPPER (Para PC y Móvil por defecto) */
.panel-content-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;           /* Ocupa todo el espacio disponible en el panel */
  min-height: 0;     /* Permite el scroll interno */
  overflow: hidden;  /* Evita desbordes */
}

/* ==================================
   FIX MÓVIL: COLAPSO SÓLIDO (SIN HUECOS)
================================== */

@media (max-width: 800px) {
  
  /* 1. Botón visible */
  .panel-toggle-btn { display: block; }

  /* 2. Layout Principal */
  .app-screen {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 55px); 
    overflow: hidden;
  }

  /* 3. Columnas (Animamos el flex-grow para que se estiren suavemente) */
  .app-column-left,
  .app-column-main,
  .app-column-right {
    display: flex;
    flex-direction: column;
    transition: flex 0.3s ease; /* Animación del contenedor */
    min-height: 0;
  }

  /* Pesos iniciales (Abiertos) */
  .app-column-left  { flex: 1 1 25%; }
  .app-column-main  { flex: 3 1 40%; }
  .app-column-right { flex: 2 1 35%; }

  /* 4. Panel Normal */
  .panel {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden; 
    padding-bottom: 6px; 
  }
  
  .panel-content-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    opacity: 1;
    transition: opacity 0.2s; /* Pequeño fade */
  }

  /* --- ESTADO COLAPSADO (LA SOLUCIÓN) --- */

  /* A) COLUMNA PADRE: ANULAR TODOS LOS TAMAÑOS */
  .app-column.col-collapsed {
    /* flex-grow: 0, flex-shrink: 0, flex-basis: auto (importante 'auto') */
    flex: 0 0 auto !important; 
    
    /* Forzar altura automática según contenido */
    height: auto !important;
    
    /* Matar el min-height de 150px original */
    min-height: 0 !important; 
    
    margin-bottom: 6px; 
  }

  /* Refuerzo específico para la izquierda y main */
  .app-column-left.col-collapsed,
  .app-column-main.col-collapsed,
  .app-column-right.col-collapsed {
      flex-basis: auto !important; /* Esto elimina el hueco fantasma */
      min-height: 0 !important;
  }

  /* B) PANEL */
  .panel.is-collapsed {
    height: auto !important; 
    min-height: 0 !important;
    padding-bottom: 0 !important;
    gap: 0;
	margin-bottom: -6px;
  }

  /* C) EL WRAPPER: DESAPARECE COMPLETAMENTE */
  /* Usamos display: none para asegurar que no ocupe ni 1 pixel */
  .panel.is-collapsed .panel-content-wrapper {
    display: none !important;
  }
}

/* Botón Flotante del Tracker */
.map-tracker-btn {
  position: absolute;
  top: 10px; /* Arriba a la derecha */
  right: 10px;
  width: 40px;
  height: 40px;
  background: rgba(31, 41, 55, 0.9);
  border: 1px solid #4b5563;
  border-radius: 12px; /* Cuadrado redondeado */
  color: #9ca3af; /* Gris por defecto (apagado) */
  font-size: 1.4rem;
  cursor: pointer;
  z-index: 20;
  backdrop-filter: blur(4px);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.map-tracker-btn:hover {
  transform: scale(1.05);
  background: #374151;
  color: #fff;
}

/* ... (Al final de style.css) ... */

/* Estado ACTIVO (Live) - APLICADO A BOTONES FLOTANTES */
.map-tracker-btn.active,
.map-float-btn.active,
#btnToggleTracker.active {
  background: #14532d !important; /* Verde oscuro forzado */
  border-color: #22c55e !important;
  color: #fff !important;
  box-shadow: 0 0 15px rgba(34, 197, 94, 0.6);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

@keyframes breathe-red-marker {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.8);
    border-color: #fff;
  }
  50% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    border-color: #ef4444; /* Borde rojo */
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    border-color: #fff;
  }
}

/* Clase combinada: tiene tracking activo PERO está perdido */
.marker.tracking.lost {
  animation: breathe-red-marker 1s infinite ease-in-out !important;
}

/* ... (Al final del archivo) ... */

/* Animación de respiración para el punto del mapa (StreamLink+) */
@keyframes breathe-green-marker {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.8);
    border-color: #fff;
  }
  50% {
    box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
    border-color: #22c55e; /* Borde se pone verde */
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    border-color: #fff;
  }
}

.marker.tracking {
  animation: breathe-green-marker 2s infinite ease-in-out;
  z-index: 5; /* Que se vea por encima de otros */
}

/* Consola del Tracker */
.tracker-console {
  background: #0f172a; /* Azul muy oscuro */
  border: 1px solid #334155;
  border-radius: 6px;
  height: 120px; /* Altura fija */
  padding: 8px;
  font-family: "Consolas", "Monaco", monospace;
  font-size: 0.75rem;
  text-align: left;
  color: #94a3b8;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}

.log-line {
  line-height: 1.4;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding-bottom: 2px;
  animation: fadeIn 0.3s ease;
}

.log-line.debug { 
    color: #64748b; /* Gris azulado */
    font-style: italic; 
    font-size: 0.7em;
}

.log-line.info { color: #60a5fa; }    /* Azul: Información normal */
.log-line.success { color: #4ade80; font-weight: bold; } /* Verde: Éxitos importantes */
.log-line.warn { color: #facc15; }    /* Amarillo: Procesos lentos o avisos */
.log-line.error { color: #f87171; font-weight: bold; }   /* Rojo: Fallos */

/* ... al final de style.css ... */

/* Animación de SOS / Ayuda */
@keyframes help-sos-pulse {
  0% {
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.8); /* Rojo intenso */
  }
  70% {
    transform: translate(-50%, -50%) scale(1.8); /* Crece */
    box-shadow: 0 0 0 20px rgba(239, 68, 68, 0); /* Se desvanece */
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

button#btnHelp {
    height: 50px;
}

/* Clase que activaremos con JS */
.marker.help-active {
  animation: help-sos-pulse 1.5s infinite ease-out !important;
  background-color: #dc2626 !important; /* Rojo fijo */
  border-color: #fff !important;
  z-index: 100 !important; /* Siempre encima de los demás */
}

/* Si tiene icono dentro, que se ponga blanco para contraste */
.marker.help-active .marker-icon-inner {
    color: white !important;
    filter: none !important;
}

/* --- LISTA DE SPAWNS (Estilo Switch) --- */
.spawn-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1f2937;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #374151;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.spawn-item:hover {
    background: #374151;
}

.spawn-item.active {
    background: #10b981; /* Verde activo */
    border-color: #059669;
    color: white;
}

.spawn-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.spawn-icon-img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.spawn-name {
    font-size: 0.9rem;
    font-weight: 500;
}

#spawnsLayer {
    /* Variable que controlará el tamaño desde JS */
    --icon-scale: 1; 
    /* Asegura que los cambios sean fluidos */
    transition: none;
}

.map-spawn-icon, 
.map-spawn-line, 
.map-spawn-line-dot {
    will-change: transform, left, top;
    contain: layout style;
}

/* --- ICONOS (Puntos y Clusters) --- */
.map-spawn-icon {
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none; 
    z-index: 1;
    
    /* Escala controlada por variable JS para rendimiento */
    transform: translate(-50%, -50%) scale(var(--icon-scale, 1));
    will-change: transform; 
    /* Transición suave solo para el tamaño */
    transition: transform 0.05s linear; 
}

/* --- IMAGEN DEL ICONO (TAMAÑO UNIFICADO) --- */
.map-spawn-icon img {
    display: block;
    /* FIJAMOS EL TAMAÑO AQUÍ PARA QUE TODOS SEAN IGUALES */
    width: 28px; 
    height: 28px;
    object-fit: contain;
    filter: drop-shadow(0 0 2px rgba(0,0,0,0.8));
}

/* --- NÚMERO CENTRADO PERFECTO --- */
.cluster-badge {
    position: absolute;
    
    /* Centrado matemático absoluto */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    
    z-index: 10;
    pointer-events: none;
    
    /* Estilo del texto */
    background: transparent;
    border: none;
    box-shadow: none;
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 900;
    font-family: sans-serif;
    line-height: 1;
    white-space: nowrap;
    
    /* Borde negro fuerte (Sombra) para que se lea encima de cualquier color */
    text-shadow: 
        -1.5px -1.5px 0 #000,  
         1.5px -1.5px 0 #000,
        -1.5px  1.5px 0 #000,
         1.5px  1.5px 0 #000,
         0 0 4px rgba(0,0,0,0.8);
}

/* Ajuste para iconos agrupados */
.map-spawn-icon.is-cluster img {
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.6));
}

/* --- ZIPLINES (CORRECCIÓN VISUAL) --- */

.map-spawn-line {
    position: absolute;
    /* Multiplicamos el grosor base (4px) por la escala inversa.
       Así, si haces zoom, la altura real baja para compensar. */
    height: calc(4px * var(--icon-scale, 1)); 
    background-color: #fbbf24; 
    transform-origin: 0 50%; 
    z-index: 1;
    pointer-events: none;
    box-shadow: 0 0 3px rgba(0,0,0,0.8);
    border-radius: 2px;
    
    will-change: transform;
}

.map-spawn-line-dot {
    position: absolute;
    width: 10px; /* Más grandes */
    height: 10px;
    background-color: #fbbf24;
    border: 2px solid #fff;
    border-radius: 50%;
    z-index: 2;
    pointer-events: none;
    box-shadow: 0 0 4px rgba(0,0,0,0.8);
    
    /* Los puntos SÍ usan la escala para no volverse gigantes al hacer zoom */
    transform: translate(-50%, -50%) scale(var(--icon-scale, 1));
    will-change: transform;
}

/* --- BOTÓN MAESTRO (TODO/NADA) --- */
.spawn-master-switch {
display: flex;
    align-items: center;
    justify-content: space-between;
    background: #374151;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #4b5563;
    cursor: pointer;
    margin-bottom: 7px;
    font-weight: bold;
    color: #fff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    margin-top: 15px;
}

.spawn-master-switch:hover {
    background: #4b5563;
    transform: translateY(-1px);
}

.spawn-master-switch.active {
    background: #059669; /* Verde más oscuro/serio */
    border-color: #10b981;
}

/* ==================================
   PANTALLA DE CARGA (SPLASH SCREEN)
================================== */
#splashScreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #020617;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

#splashScreen.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.splash-title {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(to right, #818cf8, #c084fc);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-transform: uppercase;
  animation: pulseTitle 2s infinite ease-in-out;
}

.splash-text {
  color: #94a3b8;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 1px;
  /* Añadir estas líneas para asegurar que las frases largas se vean bien: */
  text-align: center;
  max-width: 90%;
  margin: 0 auto;
  line-height: 1.4;
}

@keyframes pulseTitle {
  0%, 100% { opacity: 0.8; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

.active-streams-bar {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 8px;
  min-height: 35px;
  align-items: center;
  justify-content: flex-start;
  scrollbar-width: thin;
  scrollbar-color: #4b5563 #1f2937;
  margin-top: -6px;
}


.stream-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: white; 
  text-decoration: none;
  padding: 2px 8px;
  border-radius: 8px; /* Un poco menos redondo para parecer "tarjeta" */
  font-size: 0.8rem;
  font-weight: 700;
  transition: transform 0.2s, filter 0.2s;
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
  
  /* Para que no se encojan al hacer scroll */
  flex-shrink: 0; 
  white-space: nowrap;
}

.stream-chip:hover {
  filter: brightness(1.2); /* Aclarar el color del usuario al pasar el ratón */
  box-shadow: 0 6px 12px rgba(0,0,0,0.4);
}

/* Punto de estado "Live" */
.stream-chip .live-dot {
  width: 8px;
  height: 8px;
  background-color: currentColor; /* Usa el color del texto (blanco o negro) */
  border-radius: 50%;
  animation: pulse-live 1.5s infinite;
  box-shadow: 0 0 5px currentColor;
}

@keyframes pulse-live {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1); }
}