:root {
  --primary-color: #4A6FA5;
  --accent-color: #2196f3;
  --secondary-color: #ff9800;
  --light-bg: #ffffff;
  --dark-text: #333333;
  --light-text: #8A9BAE;
  --success-color: #4CAF50;
  --error-color: #FF5252;
  --receiver-bubble: #f0f0f0;
  --sender-bubble: var(--accent-color);
  
  --font-heading: 'Rubik Moonrocks', cursive;
  --font-subheading: 'Righteous', cursive;
  --font-body: 'Quicksand', sans-serif;
  --font-accent: 'Caveat', cursive;
}

body {
  font-family: var(--font-body);
  background-color: #f5f7fb;
  margin: 0;
  padding: 0;
  color: var(--dark-text);
}

.config-options {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  font-size: 1rem;
  width: 100%;
}

.config-label {
  font-weight: 500;
  margin-right: 8px;
}

.level-link {
  color: var(--color-primary);
  text-decoration: none;
  padding: 0 8px;
  border-radius: 50%;
  transition: var(--transition-standard);
  font-weight: 500;
  display: inline-block;
}

.level-link:hover {
  background-color: rgba(106, 27, 154, 0.1);
}

.level-link.active {
  background-color: var(--color-primary);
  color: white;
}

.config-slash {
  margin: 0 2px;
  color: rgba(0, 0, 0, 0.3);
}

.config-options .separator {
  margin: 0 15px;
  color: rgba(0, 0, 0, 0.3);
  font-weight: 300;
}

.reset-link {
  display: inline-flex;
  align-items: center;
  margin-left: 5px;
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition-standard);
  background-color: rgba(106, 27, 154, 0.08);
  padding: 0 0.7rem;
  border-radius: 30px;
}

.reset-link:hover {
  color: var(--color-primary);
  background-color: rgba(106, 27, 154, 0.15);
  box-shadow: 0 2px 8px rgba(106, 27, 154, 0.2);
}

.reset-icon {
  margin-right: 5px;
}

/* Conteneur flexible pour le jeu et les résultats */
.game-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin: 0 auto;
}

.chat-container {
  position: relative;
  max-width: 420px;
  width: 100%;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  background: white;
  position: relative;
  margin: 0 auto;
  transition: transform 0.3s ease;
  height: 620px; /* Hauteur fixe */
  display: flex;
  flex-direction: column;
}

.chat-header {
  position: relative; /* Pour servir de référence à la notification */
  background: linear-gradient(135deg, #1565C0, #2196f3);
  /* background: #1565C0; */
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 15px;
  color: white;
  z-index: 1; /* Assurez-vous que le header est au-dessus des messages */
}

.success-notification {
  position: absolute;
  bottom: -30px; /* Ajustez pour positionner à cheval sur le bord inférieur */
  left: 50%;
  transform: translateX(-50%);
  color: white;
  padding: 10px 20px;
  border-radius: 15px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  z-index: 10; /* Assurez-vous que la notification est au-dessus de tous les autres éléments */
  opacity: 0;
  transition: opacity 0.3s ease;
  width: 85%;
  max-width: 450px;
  text-align: center;
  font-weight: 500;
}

.success-notification.success {
  background-color: var(--success-color);
}

.success-notification.error {
  background-color: var(--error-color);
}


.success-notification.show {
  opacity: 1;
}

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: var(--primary-color);
}

.chat-info h2 {
  margin: 0;
  font-size: 1.1rem;
  font-family: var(--font-subheading);
}

.chat-info p {
  margin: 0;
  font-size: 0.8rem;
  opacity: 0.8;
}

.chat-messages {
  position: relative;
  padding: 15px;
  flex: 1;
  overflow-y: auto;
  background: var(--light-bg);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 0; /* Assurez-vous que les messages sont en dessous du header */
}

.message {
  max-width: 80%;
}

.message.received {
  align-self: flex-start;
}

.message.sent {
  align-self: flex-end;
}

.message-bubble {
  padding: 8px 12px;
  border-radius: 18px;
  position: relative;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.message-bubble p {
  margin: 0;
  padding-right: 40px; /* Espace pour l'heure */
}

.received .message-bubble {
  background-color: var(--receiver-bubble);
  border-top-left-radius: 0;
  color: var(--dark-text);
}

.sent .message-bubble {
  background-color: var(--sender-bubble);
  border-top-right-radius: 0;
  color: white;
  font-weight: 500; /* Texte plus épais pour les bulles bleues */
}

.message-time {
  font-size: 0.7rem;
  position: absolute;
  bottom: 8px;
  right: 12px;
}

.sent .message-time {
  color: rgba(255,255,255,0.7);
}

.received .message-time {
  color: var(--light-text);
}

.chat-actions {
  padding: 12px 15px;
  display: flex;
  align-items: center;
  background: white;
  border-top: 1px solid rgba(0,0,0,0.05);
  gap: 10px;
}

.action-button {
  padding: 10px;
  border-radius: 50px;
  border: none;
  font-weight: 700; /* Passer de 500 à 700 pour un texte plus gras */
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}


.action-button:hover {
  transform: translateY(-2px);
}

.action-button:disabled {
  background-color: #cccccc;
  color: #888888;
  cursor: not-allowed;
  transform: none;
  opacity: 0.7;
  box-shadow: none;
}

.action-button:disabled:hover {
  transform: none;
}

.send-button {
  background-color: var(--accent-color);
  color: white;
}

.send-button:disabled {
  background-color: #a0c8e7;
}

.fallacy-button {
  background-color: var(--secondary-color);
  color: white;
}

.fallacy-button:disabled {
  background-color: #e0e0e0;
}

.button-container {
  padding: 15px 25px 10px;
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0; /* Ne pas réduire la taille de la zone de bouton */
}

.stats-counter {
  display: flex;
  align-items: center;
  margin-right: auto;
  font-size: 0.9rem;
  color: var(--dark-text);
  background: #f0f0f0;
  padding: 5px 10px;
  border-radius: 30px;
}

.stats-counter .correct {
  color: var(--success-color);
  font-weight: bold;
}

.stats-counter .incorrect {
  color: var(--error-color);
  font-weight: bold;
}

.stats-counter .separator {
  margin: 0 10px;
  color: var(--light-text);
}

.hidden {
  display: none;
}

.fallacy-detected .message-bubble {
  border: 2px solid var(--secondary-color);
  background-color: rgba(255, 152, 0, 0.1);
}

/* Zone des résultats */
.results-area {
  width: 100%;
  max-width: 420px;
  margin: 20px auto 0;
}

/* Panneau de résultats avec défilement */
.results-panel {
  background: white;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.08);
  width: 100%;
  height: 620px; /* Même hauteur que le chat */
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  overflow: hidden; /* Cacher le débordement initial */
}

h4 {
  padding-bottom: .5rem;
}

.results-panel.hidden {
  display: none !important; /* Forcer le masquage */
}

/* Titre du panneau */
.results-panel h3 {
  margin: 0;
  padding: 10px 25px 20px;
  font-size: 1.5rem;
  font-family: var(--font-subheading);
  flex-shrink: 0; /* Ne pas réduire la taille du titre */
}

/* Zone d'explication avec défilement */
.fallacy-explanation {
  flex: 1;
  overflow-y: auto;
  padding: 0 25px 15px;
  text-align: left;
  background: #f8f9fa;
  margin: 0 25px;
  border-radius: 10px;
}

.fallacy-explanation h4 {
  font-family: var(--font-subheading);
  color: var(--primary-color);
}

/* Saut de ligne avant "Comment l'éviter" */
.fallacy-explanation h4:nth-of-type(2) {
  margin-top: 30px;
  padding-top: 15px;
  border-top: 1px solid #e0e0e0;
}

.progress-indicator {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  z-index: 2;
}

.progress-bar {
  height: 100%;
  background-color: var(--accent-color);
  width: 0%;
  transition: width 0.3s ease;
}

.typing-indicator {
  padding: 8px 12px;
  border-radius: 18px;
  border-top-left-radius: 0;
  background-color: var(--receiver-bubble);
  align-self: flex-start;
  max-width: 80%;
  display: inline-flex;
  align-items: center;
}

.typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--light-text);
  animation: typingAnimation 1.5s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
  animation-delay: 0s;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.3s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.6s;
}

@keyframes typingAnimation {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.6;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* Style responsive pour les écrans plus larges */
@media (min-width: 992px) {
  /* Par défaut, garder la direction en colonne pour centrer le chat */
  .game-area {
    flex-direction: column;
    align-items: center;
  }

  .game-area.show-results {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    max-width: 900px; /* Limiter la largeur maximale du conteneur */
    margin: 0 auto;
  }

  /* Chat positionné à droite de sa zone */
  .show-results .chat-container {
    margin-right: 2rem; /* Coller à droite de sa zone */
    margin-left: auto; /* Pousser à droite */
    transform: translateX(0); /* Annuler le transform précédent */
  }

  /* Panneau de résultats positionné à gauche de sa zone */
  .show-results .results-area {
    margin-left: 2rem; /* Coller à gauche de sa zone */
    margin-right: auto; /* Pousser à gauche */
    transform: translateX(0);
  }
  
  .results-area {
    opacity: 0;
    transform: translateX(30px);
    visibility: hidden;
    max-height: 0;
    overflow: hidden;
    margin-top: 0;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s, max-height 0.3s;
  }
  
  .show-results .results-area {
    opacity: 1;
    transform: translateX(0);
    visibility: visible;
    max-height: 1000px; /* Valeur suffisamment grande */
  }
}