/* ===== PIXELCHAT - ENHANCED CSS STYLES ===== */

/* Pixel Art Font Import */
@import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap");

/* Variables de colores pastel */
:root {
  --bg-light: #f0f8ff;
  --bg-dark: #1a1a2e;
  --primary-light: #ff9a9e;
  --primary-dark: #fad0c4;
  --secondary-light: #a8edea;
  --secondary-dark: #fed6e3;
  --accent-light: #ffeaa7;
  --accent-dark: #fab1a0;
  --text-light: #2d3436;
  --text-dark: #ddd;
  --border-light: #636e72;
  --border-dark: #74b9ff;
  --pixel-green: #4caf50;
  --pixel-red: #f44336;
  --pixel-purple: #9c27b0;
  --pixel-yellow: #ffeb3b;
}

/* Reset y configuración base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Press Start 2P", "Courier New", monospace;
  background: var(--bg-light);
  color: var(--text-light);
  transition: all 0.3s ease;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  font-size: 8px;
  line-height: 1.6;
}

/* Prevenir zoom en inputs en móviles */
input,
textarea,
select {
  font-size: 16px !important;
  font-family: "Press Start 2P", "Courier New", monospace;
  transform-origin: left top;
  zoom: 1;
}

@media screen and (max-width: 768px) {
  input,
  textarea,
  select {
    font-size: 16px !important;
  }
}

/* Modo oscuro */
body.dark-mode {
  background: var(--bg-dark);
  color: var(--text-dark);
}

/* ===== PERSONAJES CSS MEJORADOS (MÁS PIXELADOS) ===== */

/* Contenedor base para personajes */
.character {
  width: 80px;
  height: 80px;
  position: relative;
  cursor: pointer;
  margin: 10px;
  transition: transform 0.2s ease;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

.character:hover {
  transform: scale(1.1);
}

.character.selected {
  transform: scale(1.2);
  filter: drop-shadow(0 0 10px var(--primary-light));
}

/* BOOPY - Amable y tímido (Verde pixelado) */
.boopy {
  background: linear-gradient(
    90deg,
    var(--pixel-green) 0%,
    var(--pixel-green) 25%,
    #66bb6a 25%,
    #66bb6a 50%,
    var(--pixel-green) 50%,
    var(--pixel-green) 75%,
    #81c784 75%,
    #81c784 100%
  );
  border: 4px solid #2e7d32;
  border-radius: 0;
  position: relative;
  animation: boopy-blink 3s infinite;
  box-shadow: inset 4px 4px 0 #a5d6a7, inset -4px -4px 0 #388e3c;
}

.boopy::before {
  /* Ojos pixelados */
  content: "";
  position: absolute;
  top: 20px;
  left: 15px;
  width: 12px;
  height: 12px;
  background: #000;
  box-shadow: 0 0 0 2px #000, 28px 0 0 0 #000, 28px 0 0 2px #000,
    4px 4px 0 0 #fff, 32px 4px 0 0 #fff;
}

.boopy::after {
  /* Boca pixelada */
  content: "";
  position: absolute;
  top: 50px;
  left: 25px;
  width: 20px;
  height: 8px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    transparent 25%,
    #2e7d32 25%,
    #2e7d32 75%,
    transparent 75%,
    transparent 100%
  );
  box-shadow: 0 4px 0 0 #2e7d32, 4px 4px 0 0 #2e7d32, 8px 4px 0 0 #2e7d32,
    12px 4px 0 0 #2e7d32;
}

@keyframes boopy-blink {
  0%,
  90%,
  100% {
    opacity: 1;
  }
  95% {
    opacity: 0.3;
    transform: scaleY(0.1);
  }
}

/* RINDEE - Irónico y arrebatado (Rojo pixelado) */
.rindee {
  background: linear-gradient(
    45deg,
    var(--pixel-red) 0%,
    var(--pixel-red) 25%,
    #ef5350 25%,
    #ef5350 50%,
    var(--pixel-red) 50%,
    var(--pixel-red) 75%,
    #e57373 75%,
    #e57373 100%
  );
  border: 4px solid #c62828;
  border-radius: 0;
  position: relative;
  animation: rindee-shake 2s infinite;
  box-shadow: inset 4px 4px 0 #ffcdd2, inset -4px -4px 0 #d32f2f;
}

.rindee::before {
  /* Ojos irritados pixelados */
  content: "";
  position: absolute;
  top: 18px;
  left: 12px;
  width: 16px;
  height: 8px;
  background: #000;
  transform: skew(-20deg);
  box-shadow: 0 0 0 2px #000, 32px 0 0 0 #000, 32px 0 0 2px #000;
}

.rindee::after {
  /* Boca arrebatada pixelada */
  content: "";
  position: absolute;
  top: 45px;
  left: 20px;
  width: 24px;
  height: 16px;
  background: #c62828;
  box-shadow: 4px 0 0 0 #c62828, 8px 0 0 0 #c62828, 12px 0 0 0 #c62828,
    16px 0 0 0 #c62828, 0 4px 0 0 #c62828, 4px 4px 0 0 #ff5722,
    8px 4px 0 0 #ff5722, 12px 4px 0 0 #ff5722, 16px 4px 0 0 #c62828,
    20px 4px 0 0 #c62828;
}

@keyframes rindee-shake {
  0%,
  100% {
    transform: translateX(0) rotate(0deg);
  }
  25% {
    transform: translateX(-2px) rotate(-1deg);
  }
  75% {
    transform: translateX(2px) rotate(1deg);
  }
}

/* TROPXY - Sarcástico e irritable (Morado pixelado) */
.tropxy {
  background: linear-gradient(
    135deg,
    var(--pixel-purple) 0%,
    var(--pixel-purple) 25%,
    #ab47bc 25%,
    #ab47bc 50%,
    var(--pixel-purple) 50%,
    var(--pixel-purple) 75%,
    #ba68c8 75%,
    #ba68c8 100%
  );
  border: 4px solid #6a1b9a;
  border-radius: 0;
  position: relative;
  animation: tropxy-roll 4s infinite;
  box-shadow: inset 4px 4px 0 #e1bee7, inset -4px -4px 0 #7b1fa2;
}

.tropxy::before {
  /* Ojos sarcásticos pixelados */
  content: "";
  position: absolute;
  top: 22px;
  left: 18px;
  width: 8px;
  height: 12px;
  background: #000;
  box-shadow: 0 0 0 2px #000, 24px 0 0 0 #000, 24px 0 0 2px #000,
    0 -4px 0 0 #6a1b9a, 4px -4px 0 0 #6a1b9a, 20px -4px 0 0 #6a1b9a,
    24px -4px 0 0 #6a1b9a;
}

.tropxy::after {
  /* Sonrisa sarcástica pixelada */
  content: "";
  position: absolute;
  top: 52px;
  left: 16px;
  width: 32px;
  height: 4px;
  background: #6a1b9a;
  box-shadow: 4px 0 0 0 #6a1b9a, 8px 0 0 0 #6a1b9a, 12px 0 0 0 #6a1b9a,
    16px 0 0 0 #6a1b9a, 20px 0 0 0 #6a1b9a, 24px 0 0 0 #6a1b9a,
    28px 0 0 0 #6a1b9a, 0 -4px 0 0 #6a1b9a, 28px -4px 0 0 #6a1b9a;
  transform: rotate(2deg);
}

@keyframes tropxy-roll {
  0%,
  100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-3deg);
  }
  75% {
    transform: rotate(3deg);
  }
}

/* WIXYY - Positivo y manifestador (Amarillo pixelado) */
.wixyy {
  background: radial-gradient(
    circle,
    var(--pixel-yellow) 0%,
    var(--pixel-yellow) 30%,
    #fff176 30%,
    #fff176 60%,
    var(--pixel-yellow) 60%,
    var(--pixel-yellow) 100%
  );
  border: 4px solid #f57f17;
  border-radius: 0;
  position: relative;
  animation: wixyy-bounce 1.5s infinite;
  box-shadow: inset 4px 4px 0 #fff9c4, inset -4px -4px 0 #ff8f00;
}

.wixyy::before {
  /* Ojos brillantes pixelados */
  content: "";
  position: absolute;
  top: 20px;
  left: 16px;
  width: 12px;
  height: 12px;
  background: #000;
  box-shadow: 0 0 0 2px #000, 24px 0 0 0 #000, 24px 0 0 2px #000,
    4px 4px 0 0 #fff, 8px 4px 0 0 #fff, 28px 4px 0 0 #fff, 32px 4px 0 0 #fff,
    2px 2px 0 0 #ffe082, 26px 2px 0 0 #ffe082;
}

.wixyy::after {
  /* Sonrisa grande pixelada */
  content: "";
  position: absolute;
  top: 48px;
  left: 16px;
  width: 32px;
  height: 16px;
  background: #f57f17;
  box-shadow: 4px 0 0 0 #f57f17, 8px 0 0 0 #f57f17, 12px 0 0 0 #f57f17,
    16px 0 0 0 #f57f17, 20px 0 0 0 #f57f17, 24px 0 0 0 #f57f17,
    28px 0 0 0 #f57f17, 0 4px 0 0 #f57f17, 4px 4px 0 0 #ff5722,
    8px 4px 0 0 #ff5722, 12px 4px 0 0 #ff5722, 16px 4px 0 0 #ff5722,
    20px 4px 0 0 #ff5722, 24px 4px 0 0 #ff5722, 28px 4px 0 0 #f57f17,
    32px 4px 0 0 #f57f17;
}

@keyframes wixyy-bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-12px);
  }
}

/* ===== CONTENEDORES Y LAYOUT ===== */

.container {
  max-width: 400px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.welcome-screen {
  text-align: center;
  background: rgba(255, 255, 255, 0.95);
  border: 4px solid var(--border-light);
  border-radius: 0;
  padding: 30px;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.2),
    inset 4px 4px 0 rgba(255, 255, 255, 0.8);
  image-rendering: pixelated;
}

body.dark-mode .welcome-screen {
  background: rgba(26, 26, 46, 0.95);
  border-color: var(--border-dark);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.5),
    inset 4px 4px 0 rgba(255, 255, 255, 0.1);
}

.title {
  font-size: 16px;
  font-weight: normal;
  color: var(--primary-light);
  margin-bottom: 20px;
  text-shadow: 2px 2px 0 var(--border-light), 4px 4px 0 rgba(0, 0, 0, 0.3);
  letter-spacing: 2px;
}

.subtitle {
  font-size: 10px;
  margin-bottom: 20px;
  line-height: 1.8;
  letter-spacing: 1px;
}

.user-input {
  width: 100%;
  padding: 12px;
  border: 4px solid var(--border-light);
  border-radius: 0;
  font-family: "Press Start 2P", "Courier New", monospace;
  font-size: 10px;
  margin-bottom: 20px;
  background: #fff;
  color: var(--text-light);
  box-shadow: inset 4px 4px 0 rgba(0, 0, 0, 0.1),
    inset -2px -2px 0 rgba(255, 255, 255, 0.8);
  letter-spacing: 1px;
}

body.dark-mode .user-input {
  background: #2d3436;
  color: var(--text-dark);
  border-color: var(--border-dark);
  box-shadow: inset 4px 4px 0 rgba(0, 0, 0, 0.3),
    inset -2px -2px 0 rgba(255, 255, 255, 0.1);
}

.characters-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

.character-card {
  text-align: center;
  padding: 15px;
  border: 4px solid var(--border-light);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2),
    inset 2px 2px 0 rgba(255, 255, 255, 0.8);
}

body.dark-mode .character-card {
  background: rgba(45, 52, 54, 0.8);
  border-color: var(--border-dark);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5),
    inset 2px 2px 0 rgba(255, 255, 255, 0.1);
}

.character-card:hover {
  transform: translateY(-4px);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.3),
    inset 2px 2px 0 rgba(255, 255, 255, 0.9);
}

.character-card.selected {
  border-color: var(--primary-light);
  background: var(--primary-dark);
  transform: translateY(-4px);
  animation: pixel-pulse 1s infinite;
}

@keyframes pixel-pulse {
  0%,
  100% {
    transform: translateY(-4px) scale(1);
    box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.3);
  }
  50% {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 12px 12px 0 rgba(0, 0, 0, 0.4);
  }
}

.character-name {
  font-size: 10px;
  font-weight: normal;
  margin-top: 10px;
  color: var(--text-light);
  letter-spacing: 1px;
}

body.dark-mode .character-name {
  color: var(--text-dark);
}

.character-trait {
  font-size: 8px;
  color: #636e72;
  margin-top: 8px;
  font-style: normal;
  letter-spacing: 0.5px;
}

body.dark-mode .character-trait {
  color: #b2bec3;
}

.start-chat-btn {
  background: var(--primary-light);
  border: 4px solid var(--border-light);
  border-radius: 0;
  padding: 12px 30px;
  font-family: "Press Start 2P", "Courier New", monospace;
  font-size: 10px;
  font-weight: normal;
  color: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 20px;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3),
    inset 2px 2px 0 rgba(255, 255, 255, 0.3);
}

.start-chat-btn:disabled {
  background: #ddd;
  border-color: #bbb;
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2),
    inset 1px 1px 0 rgba(255, 255, 255, 0.2);
}

.start-chat-btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.4),
    inset 2px 2px 0 rgba(255, 255, 255, 0.4);
}

body.dark-mode .start-chat-btn {
  background: var(--accent-dark);
  border-color: var(--border-dark);
}

/* Botón de modo oscuro */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--primary-light);
  border: 4px solid var(--border-light);
  border-radius: 0;
  width: 60px;
  height: 60px;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 1000;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3),
    inset 2px 2px 0 rgba(255, 255, 255, 0.3);
}

body.dark-mode .theme-toggle {
  background: var(--accent-dark);
  border-color: var(--border-dark);
}

.theme-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.4),
    inset 2px 2px 0 rgba(255, 255, 255, 0.4);
}

/* ===== CHAT INTERFACE MEJORADA ===== */

.chat-screen {
  display: none;
  width: 100%;
  height: 100vh;
  flex-direction: column;
}

.chat-header {
  background: var(--primary-light);
  padding: 15px;
  text-align: center;
  border-bottom: 4px solid var(--border-light);
  font-weight: normal;
  color: #fff;
  font-size: 10px;
  letter-spacing: 1px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2), inset 0 2px 0 rgba(255, 255, 255, 0.3);
}

body.dark-mode .chat-header {
  background: var(--accent-dark);
  border-color: var(--border-dark);
}

.chat-character-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

.chat-character-avatar {
  width: 40px;
  height: 40px;
  border-radius: 0;
  border: 3px solid #fff;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
}

.chat-character-details {
  text-align: left;
}

.chat-character-name {
  font-size: 12px;
  font-weight: normal;
  margin-bottom: 4px;
  letter-spacing: 1px;
}

.chat-character-status {
  font-size: 8px;
  opacity: 0.9;
  letter-spacing: 0.5px;
}

.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: var(--bg-light);
  display: flex;
  flex-direction: column;
  gap: 15px;
}

body.dark-mode .chat-messages {
  background: var(--bg-dark);
}

.message {
  display: flex;
  align-items: flex-end;
  animation: pixel-fadeIn 0.5s ease;
}

@keyframes pixel-fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.message.user {
  justify-content: flex-end;
}

.message.character {
  justify-content: flex-start;
}

.message-bubble {
  max-width: 80%;
  min-width: 120px;
  padding: 12px 16px;
  border-radius: 0;
  font-size: 9px;
  line-height: 1.6;
  border: 3px solid var(--border-light);
  word-wrap: break-word;
  word-break: break-word;
  white-space: pre-wrap;
  letter-spacing: 0.5px;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.2),
    inset 1px 1px 0 rgba(255, 255, 255, 0.5);
}

.message.user .message-bubble {
  background: var(--secondary-light);
  color: var(--text-light);
  border-color: var(--border-light);
}

.message.character .message-bubble {
  background: #fff;
  color: var(--text-light);
  border-color: var(--border-light);
}

body.dark-mode .message.user .message-bubble {
  background: var(--secondary-dark);
  border-color: var(--border-dark);
  color: var(--text-dark);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.4),
    inset 1px 1px 0 rgba(255, 255, 255, 0.1);
}

body.dark-mode .message.character .message-bubble {
  background: #2d3436;
  color: var(--text-dark);
  border-color: var(--border-dark);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.4),
    inset 1px 1px 0 rgba(255, 255, 255, 0.1);
}

.message-time {
  font-size: 7px;
  color: #636e72;
  margin-top: 8px;
  text-align: right;
  letter-spacing: 0.5px;
}

body.dark-mode .message-time {
  color: #b2bec3;
}

.message.character .message-time {
  text-align: left;
}

.chat-input-container {
  padding: 15px;
  background: #fff;
  border-top: 4px solid var(--border-light);
  display: flex;
  gap: 10px;
  box-shadow: 0 -4px 0 rgba(0, 0, 0, 0.1),
    inset 0 2px 0 rgba(255, 255, 255, 0.8);
}

body.dark-mode .chat-input-container {
  background: #2d3436;
  border-color: var(--border-dark);
  box-shadow: 0 -4px 0 rgba(0, 0, 0, 0.3),
    inset 0 2px 0 rgba(255, 255, 255, 0.1);
}

.chat-input {
  flex: 1;
  padding: 12px;
  border: 3px solid var(--border-light);
  border-radius: 0;
  font-family: "Press Start 2P", "Courier New", monospace;
  font-size: 9px;
  background: var(--bg-light);
  color: var(--text-light);
  letter-spacing: 0.5px;
  box-shadow: inset 3px 3px 0 rgba(0, 0, 0, 0.1),
    inset -1px -1px 0 rgba(255, 255, 255, 0.8);
}

body.dark-mode .chat-input {
  background: var(--bg-dark);
  color: var(--text-dark);
  border-color: var(--border-dark);
  box-shadow: inset 3px 3px 0 rgba(0, 0, 0, 0.3),
    inset -1px -1px 0 rgba(255, 255, 255, 0.1);
}

.send-button {
  background: var(--primary-light);
  border: 3px solid var(--border-light);
  border-radius: 0;
  width: 50px;
  height: 50px;
  cursor: pointer;
  font-size: 16px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3),
    inset 1px 1px 0 rgba(255, 255, 255, 0.3);
}

body.dark-mode .send-button {
  background: var(--accent-dark);
  border-color: var(--border-dark);
}

.send-button:hover {
  transform: translateY(-2px);
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.4),
    inset 1px 1px 0 rgba(255, 255, 255, 0.4);
}

.back-button {
  position: fixed;
  top: 20px;
  left: 20px;
  background: var(--secondary-light);
  border: 4px solid var(--border-light);
  border-radius: 0;
  width: 60px;
  height: 60px;
  cursor: pointer;
  font-size: 20px;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 1000;
  color: var(--text-light);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3),
    inset 2px 2px 0 rgba(255, 255, 255, 0.3);
}

body.dark-mode .back-button {
  background: var(--secondary-dark);
  border-color: var(--border-dark);
  color: var(--text-dark);
}

.back-button:hover {
  transform: translateY(-2px);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.4),
    inset 2px 2px 0 rgba(255, 255, 255, 0.4);
}

/* Indicador de escritura pixelado */
.typing-indicator {
  display: none;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 0;
  margin: 10px 20px;
  width: fit-content;
  border: 3px solid var(--border-light);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.2),
    inset 1px 1px 0 rgba(255, 255, 255, 0.5);
}

body.dark-mode .typing-indicator {
  background: rgba(45, 52, 54, 0.95);
  border-color: var(--border-dark);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.4),
    inset 1px 1px 0 rgba(255, 255, 255, 0.1);
}

.typing-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  background: var(--primary-light);
  border-radius: 0;
  animation: pixel-typing-bounce 1.4s infinite ease-in-out;
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3);
}

.typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}
.typing-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes pixel-typing-bounce {
  0%,
  80%,
  100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}

/* Scrollbar personalizada pixelada */
.chat-messages::-webkit-scrollbar {
  width: 12px;
}

.chat-messages::-webkit-scrollbar-track {
  background: var(--bg-light);
  border: 2px solid var(--border-light);
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--primary-light);
  border: 2px solid var(--border-light);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.3);
}

body.dark-mode .chat-messages::-webkit-scrollbar-track {
  background: var(--bg-dark);
  border-color: var(--border-dark);
}

body.dark-mode .chat-messages::-webkit-scrollbar-thumb {
  background: var(--accent-dark);
  border-color: var(--border-dark);
}

/* Responsive mejorado */
@media (max-width: 480px) {
  body {
    font-size: 7px;
  }

  .container {
    padding: 10px;
  }

  .welcome-screen {
    padding: 20px;
  }

  .characters-grid {
    gap: 15px;
  }

  .character {
    width: 60px;
    height: 60px;
  }

  .title {
    font-size: 14px;
  }

  .subtitle {
    font-size: 9px;
  }

  .user-input,
  .chat-input {
    font-size: 16px !important; /* Prevenir zoom en móviles */
  }

  .character-name {
    font-size: 9px;
  }

  .character-trait {
    font-size: 7px;
  }

  .message-bubble {
    max-width: 90%;
    font-size: 8px;
  }

  .chat-character-info {
    gap: 10px;
  }

  .chat-character-avatar {
    width: 30px;
    height: 30px;
  }

  .chat-character-name {
    font-size: 10px;
  }

  .chat-character-status {
    font-size: 7px;
  }

  .theme-toggle,
  .back-button {
    width: 50px;
    height: 50px;
    font-size: 16px;
  }
}

/* 1. Sistema de caja controlado */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* 2. Body sin margen ni scroll horizontal */
html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
}

/* 3. Contenedor principal fluido */
.container {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}
@media screen and (max-width: 480px) {
  .send-button {
    width: 80px;
    height: 50px;
    font-size: 8px;
    padding: 8px;
  }

  .chat-input {
    font-size: 10px;
  }
}
.chat-input::placeholder {
  color: #aaa; /* o el color que quieras */
  font-size: 14px; /* ajusta al gusto */
  opacity: 1; /* importante para visibilidad */
}
.send-button {
  background-color: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 0 10px;
  color: #555;
  transition: color 0.3s ease;
}

.send-button:hover {
  color: #000;
}
.chat-input-container {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px; /* espacio entre input y botón, opcional */
  padding: 8px;
  box-sizing: border-box;
}

.chat-input {
  flex: 1 1 auto;
  max-width: 85%; /* o usa un valor fijo como 80% */
  padding: 8px 12px;
  font-size: 1rem;
  border-radius: 12px;
  border: 1px solid #ccc;
}

.send-button {
  flex-shrink: 0;
  padding: 8px 12px;
  font-size: 1.2rem;
  border: none;
  background-color: #c06f6f;
  color: white;
  border-radius: 08px;
  cursor: pointer;
}
.chat-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.message {
  max-width: 60%;
}
.chatMessages {
  width: 100%;
  padding: 0 1rem;
  box-sizing: border-box;
}

.message {
  max-width: 90%;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  word-wrap: break-word;
}
.message {
  max-width: calc(100% - 2rem); /* 1rem de margen a cada lado */
}
.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: var(--bg-light);
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%; /* que ocupe todo el ancho */
  box-sizing: border-box;
}

body.dark-mode .chat-messages {
  background: var(--bg-dark);
}

.message {
  width: 100%; /* que el mensaje ocupe todo el ancho */
  max-width: 100%;
  box-sizing: border-box;
  padding: 12px 16px; /* espacio interno cómodo */
  background-color: var(--message-bg, #eee); /* fondo para que destaque */
  border-radius: 8px;
  display: flex;
  align-items: flex-end;
  animation: pixel-fadeIn 0.5s ease;
  word-wrap: break-word; /* evita que textos largos desborden */
  white-space: normal; /* para que el texto haga wrap */
}
