.messages-container {
  width: 100%;
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1.5rem 0.5rem 0.5rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative; /* Asegurar que los atajos floten sobre el área de mensajes */
}

.messages-list {
  width: 100%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0 auto;
  padding-left: 37px;
  padding-right: 32px;
  box-sizing: border-box;
}

/* Línea separadora entre mensajes */
.messages-list > .message:not(:last-child) {
  border-bottom: 1px solid rgba(180, 180, 180, 0.18);
  margin-bottom: -2.2rem;
}

.message {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  /* Centrado horizontal */
  padding: 1.1rem 32px;
  border-radius: 2rem;
  box-shadow: none !important;
  position: relative;
  margin-left: auto;
  margin-right: auto;
  border: none !important;
  background: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  transition: box-shadow 0.25s, background 0.25s, border 0.25s;
  overflow: hidden;
  max-width: 768px;
  width: 100%;
}

.message.user {
  background: none;
  color: #fff;
  align-self: center;
  margin-left: auto;
  margin-right: auto;
  border: none;
  background: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;

  margin-bottom: 1.2rem;
}

.message.assistant {
  background: linear-gradient(135deg, var(--assistant-bubble) 60%, rgba(40,44,52,0.10) 100%);
  color: var(--text-primary);
  align-self: center;
  border: none !important;
  background: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  margin-left: auto;
  margin-right: auto;

  margin-bottom: 1.2rem;
  padding: 1.1rem 32px;
}

.message-avatar {
  display: none !important;
  font-size: 1.5rem;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(135, 206, 235, 0.12);
  box-shadow: none !important;
  border: none !important;
  background: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  flex-shrink: 0;
  margin-right: 0;
  margin-left: -2.5rem;
  margin-top: -3.4rem;
  margin-bottom: 0;
  z-index: 3;
  position: static;
}

.message-content {
  flex: 1;
  word-break: break-word;
  margin-left: 0;
  font-size: 1.01em;
  line-height: 1.7;
  letter-spacing: 0.01em;
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  text-shadow: 0 1px 2px rgba(0,0,0,0.04);
  padding-top: 0.2rem !important;
}

.message.user .message-avatar {
  background: #87CEEB;
  color: #fff;
  margin-left: 0;
  margin-right: -2.5rem;
  margin-top: -3.4rem;
}

.message.user .message-content {
  font-size: 1.8em !important;
}

.user-message {
  font-size: 1.2em !important;
}

.assistant-message {
  font-size: 0.96em;
  line-height: 1.6;
}

.typing-indicator {
  display: flex;
  gap: 0.2rem;
  align-items: center;
  margin-top: 0.2rem;
}

.typing-indicator span {
  display: block;
  width: 7px;
  height: 7px;
  background: #87CEEB;
  border-radius: 50%;
  animation: typingBlink 1.2s infinite both;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBlink {
  0%, 80%, 100% { opacity: 0.3; }
  40% { opacity: 1; }
}

.floating-messages {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 480px;
  z-index: 10; /* Menor que los modales */
}

.welcome-message {
  text-align: center;
  margin: 0 auto;
  max-width: 480px;
  background: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  position: static;
}

.welcome-message h2 {
  font-size: 1.5rem;
  background: linear-gradient(90deg, #87CEEB, #b983ff, #87CEEB);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.welcome-message-p {
  color: #fff !important;
  font-size: 1.1rem;
  user-select: text;
  text-shadow: 0 1px 8px rgba(0,0,0,0.25);
  margin: 0;
  background: none !important;
  -webkit-background-clip: initial !important;
  -webkit-text-fill-color: #fff !important;
  background-clip: initial !important;
}

.welcome-message-p::selection {
  background: #87CEEB;
  color: #fff !important;
}


.image-container{
    display: flex;
    flex-direction: row;
    
}

.shortcuts-legend {
  margin: 1.5rem auto 0 auto;
  padding: 1.2rem 2rem 1.2rem 2rem;
  background: linear-gradient(90deg, #e0e7ff 0%, #f0fdfa 100%);
  border-radius: 1.2rem;
  box-shadow: 0 2px 12px 0 rgba(60,60,90,0.08);
  max-width: 420px;
  text-align: left;
  font-size: 1.05em;
  color: rgba(210, 210, 210, 0.82); /* Gris claro igual que kbd */
  border: 1.5px solid #b6e0fe;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.shortcuts-legend-floating {
  position: static;
  margin-top: 1.2rem;
  max-width: 420px;
  min-width: 220px;
  text-align: left;
  font-size: 0.92em;
  color: rgba(210, 210, 210, 0.82); /* Gris claro igual que kbd */
  border: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.7rem 1.1rem 0.7rem 1.1rem;
  pointer-events: auto;
  transition: opacity 0.2s;
}

.shortcuts-legend-floating .shortcuts-title {
  font-weight: 700;
  font-size: 1.05em;
  background: linear-gradient(90deg, #87CEEB, #b983ff, #87CEEB); /* Igual que welcome-message h2 */
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-fill-color: transparent;
  margin-bottom: 0.3rem;
}

.shortcuts-legend-floating .shortcuts-list {
  list-style: none;
  padding: 0;
  margin: 0;
  width: 100%;
}

.shortcuts-legend-floating .shortcuts-list li {
  margin-bottom: 0.18em;
  display: flex;
  align-items: center;
  gap: 0.6em;
  font-size: 0.98em;
  color: rgba(210, 210, 210, 0.82); /* Igual que la leyenda y kbd */
}

.shortcuts-legend-floating .shortcuts-list kbd,
.shortcuts-legend .shortcuts-list kbd {
  background: #222; /* Fondo negro oscuro */
  border: 1.5px solid #111; /* Borde negro más oscuro */
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.93em;
  font-family: 'JetBrains Mono', 'Fira Mono', 'Menlo', 'monospace';
  color: rgba(210, 210, 210, 0.82); /* Igual que la leyenda */
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.message-divider {
  border: none;
  border-top: 1.5px solid rgba(180, 180, 180, 0.18);
  margin: 60px 0 0.5rem 0;
  width: 100%;
  max-width: 800px;
}

@media (max-width: 700px) {
  .messages-container {
    padding: 0.7rem 0.1rem 0.1rem 0.1rem;
    width: 100vw;
    box-sizing: border-box;
    height: calc(100dvh - 110px); /* 105px - 5px */
    max-height: calc(100dvh - 110px);
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .messages-list {
    max-width: 100vw;
    width: 100vw;
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .message {
    padding: 0.7rem 0.5rem;
    max-width: 100vw;
    width: 100%;
    font-size: 0.98em;
    box-sizing: border-box;
    margin-left: 0;
    margin-right: 0;
  }
  .message.user,
  .message.assistant {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }
  .message.user .message-content {
    font-size: 1.1em !important;
  }
  .message-avatar {
    display: none !important;
    width: 2rem;
    height: 2rem;
    font-size: 1.1rem;
    margin-left: -2rem;
    margin-top: -2.2rem;
  }
  .message.user .message-avatar {
    margin-right: -2rem;
    margin-top: -2.2rem;
  }
  .floating-messages {
    position: static;
    top: auto;
    left: auto;
    transform: none;
    max-width: 98vw;
    width: 98vw;
    margin: 6rem auto 0 auto; /* Aumenta el margen superior */
    padding: 0 0.2rem;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
  }
  .welcome-message {
    text-align: center;
    margin: 0 auto 1.5rem auto; /* Aumenta el margen inferior */
    max-width: 98vw;
    width: 98vw;
    background: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0.5rem 0.2rem 0.5rem 0.2rem;
    position: static;
    box-sizing: border-box;
  }
  .shortcuts-legend {
    max-width: 98vw;
    width: 98vw;
    padding: 0.7rem 0.5rem;
    font-size: 0.95em;
    box-sizing: border-box;
  }
  .shortcuts-legend-floating {
    position: static;
    margin-top: 1.3rem; /* Aumenta separación respecto al mensaje de bienvenida */
    max-width: 98vw;
    width: 98vw;
    min-width: 0;
    text-align: left;
    font-size: 0.9em;
    color: rgba(210, 210, 210, 0.82);
    border: none;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0.2rem 0.5rem 0.2rem;
    pointer-events: auto;
    transition: opacity 0.2s;
    box-sizing: border-box;
  }
  .message-divider {
    margin: 30px 0 0.3rem 0;
    max-width: 99vw;
    width: 99vw;
  }
  .image-container {
    flex-direction: column;
    align-items: center;
  }
}

/* Ajuste especial para landscape hasta 960px */
@media (max-width: 960px) and (orientation: landscape) {
  .messages-container {
    padding: 0.2rem 1.2rem 0.05rem 1.2rem;
    width: 100vw;
    box-sizing: border-box;
    height: calc(100dvh - 80px);
    max-height: calc(100dvh - 80px);
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: transparent !important;
  }
  .messages-list {
    max-width: 100vw;
    width: 100vw;
    padding-left: 1.2rem;
    padding-right: 1.2rem;
    box-sizing: border-box;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: transparent !important;
  }
  .message {
    padding: 0.3rem 6rem;
    max-width: 100vw;
    width: 100%;
    font-size: 0.68em;
    box-sizing: border-box;
    margin-left: 0;
    margin-right: 0;
  }
  .message.assistant {
    padding: 0.3rem 6rem;
  }
  .message.user,
  .message.assistant {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }
  .floating-messages,
  .welcome-message,
  .shortcuts-legend,
  .shortcuts-legend-floating {
    max-width: 98vw;
    width: 98vw;
    box-sizing: border-box;
  }
  .message-divider {
    margin: 20px 0 0.2rem 0;
    max-width: 99vw;
    width: 99vw;
  }
}

/* Asegúrate de que las ventanas modales tengan un z-index mayor, por ejemplo: */
.download-modal, .ajustes-herramientas-modal {
  z-index: 1100 !important;
  position: fixed;
  /* ...otros estilos de modal... */
}