:root {
  --bg-color: #f5f5f5; /* Fond clair comme Outlook */
  --primary-color: #ffffff; /* Blanc pour les éléments principaux */
  --secondary-color: #f3f2f1; /* Gris très clair pour les éléments secondaires */
  --accent-color: #0078d4; /* Bleu Microsoft */
  --text-color: #333333; /* Texte foncé pour un bon contraste */
  --border-color: #e1dfdd; /* Couleur de bordure subtile */
  --shadow-color: rgba(0, 0, 0, 0.1); /* Ombre légère */
  --highlight-color: #c7e0f4; /* Bleu clair pour les surbrillances */
  --safe-color: #107c10; /* Vert Microsoft pour les éléments sécurisés */
  --warning-color: #ffb900; /* Jaune pour les avertissements */
  --phishing-color: #d13438; /* Rouge Microsoft pour les alertes */
  --link-color: #0078d4; /* Bleu pour les liens */
  --inspection-color: #333333; /* Couleur pour le texte d'inspection */
  --font-main: "Segoe UI", sans-serif; /* Police Microsoft */
}

/* --- Dark Mode --- */
body.dark {
  --bg-color: #1e1e1e;
  --primary-color: #2d2d2d;
  --secondary-color: #252525;
  --accent-color: #4fc3f7;
  --text-color: #e0e0e0;
  --border-color: #444444;
  --shadow-color: rgba(0, 0, 0, 0.4);
  --highlight-color: #1a3a4a;
  --safe-color: #4caf50;
  --warning-color: #ffca28;
  --phishing-color: #ef5350;
  --link-color: #4fc3f7;
  --inspection-color: #e0e0e0;
}

/* --- Theme Controls --- */
#theme-controls {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 9999;
  display: flex;
  gap: 6px;
  align-items: center;
}
.theme-toggle-btn {
  background: var(--primary-color);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px var(--shadow-color);
  transition: transform 0.2s;
}
.theme-toggle-btn:hover {
  transform: scale(1.1);
}
#theme-select {
  background: var(--primary-color);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.8rem;
  cursor: pointer;
  box-shadow: 0 2px 6px var(--shadow-color);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background: var(--bg-color);
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  min-height: 100vh;
  overflow-y: auto;
}

body.game-page {
  height: 100dvh;
  overflow: hidden;
}

#game-container {
  width: calc(100% - 32px);
  max-width: 1400px;
  flex: 1;
  min-height: 0;
  background: var(--primary-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  box-shadow: 0 2px 8px var(--shadow-color);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* --- Screens (Start/Game Over) --- */
.screen {
  padding: 30px;
  text-align: center;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--primary-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  box-shadow: 0 2px 8px var(--shadow-color);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: opacity 0.5s ease-in-out;
  z-index: 10;
}

.screen.hidden {
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

#start-screen h1 {
  color: var(--accent-color);
  margin-bottom: 20px;
  font-size: 2.5em;
}
#start-screen p {
  margin-bottom: 15px;
  max-width: 600px;
  line-height: 1.6;
}
#start-screen label {
  margin-top: 20px;
  display: block;
}
#player-name-input {
  margin-top: 5px;
  padding: 10px;
  font-family: var(--font-main);
  background-color: var(--primary-color);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  border-radius: 2px;
  margin-bottom: 20px;
}

/* Styles pour la sélection de difficulté */
.difficulty-selection {
  margin: 20px 0;
  width: 100%;
  max-width: 800px;
}

.difficulty-selection h3 {
  margin-bottom: 15px;
  color: var(--accent-color);
  font-size: 1.3em;
}

.difficulty-options {
  display: flex;
  justify-content: space-between;
  gap: 15px;
}

.difficulty-option {
  flex: 1;
  background-color: var(--secondary-color);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 15px;
  transition: all 0.3s ease;
  position: relative;
  cursor: pointer;
}

.difficulty-option:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px var(--shadow-color);
}

.difficulty-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.difficulty-option input[type="radio"]:checked + label {
  color: var(--accent-color);
  font-weight: bold;
}

.difficulty-option input[type="radio"]:checked ~ .difficulty-desc {
  color: var(--text-color);
}

.difficulty-option input[type="radio"]:checked {
  background-color: var(--highlight-color);
}

.difficulty-option label {
  display: block;
  font-size: 1.2em;
  font-weight: bold;
  margin-bottom: 10px;
  color: var(--text-color);
  cursor: pointer;
}

.difficulty-option:nth-child(1) label {
  color: var(--safe-color);
}

.difficulty-option:nth-child(2) label {
  color: var(--warning-color);
}

.difficulty-option:nth-child(3) label {
  color: var(--phishing-color);
}

.difficulty-desc {
  font-size: 0.9em;
  line-height: 1.4;
}

.difficulty-option input[type="radio"]:checked + label {
  text-decoration: underline;
}

.difficulty-option input[type="radio"]:checked ~ .difficulty-desc {
  font-weight: bold;
}

.difficulty-option:has(input[type="radio"]:checked) {
  border-color: var(--accent-color);
  background-color: var(--highlight-color);
  transform: translateY(-5px);
  box-shadow: 0 5px 15px var(--shadow-color);
}

#game-over-screen h2 {
  color: var(--accent-color);
  margin-bottom: 20px;
  font-size: 2.2em;
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* Styles pour le format diplôme */
#game-over-screen {
  justify-content: flex-start;
  overflow-y: auto;
  scrollbar-gutter: stable;
  padding: 24px;
  gap: 16px;
  background-image: linear-gradient(
    to bottom,
    var(--secondary-color),
    var(--primary-color)
  );
  border: 8px solid var(--border-color);
  box-shadow:
    0 0 20px rgba(0, 0, 0, 0.1),
    inset 0 0 10px rgba(0, 0, 0, 0.05);
}

#game-over-screen > * {
  flex-shrink: 0;
  max-width: 100%;
}

#game-over-screen h2,
#game-over-screen .score-link {
  margin: 0;
}

.result-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
}

/* Styles pour le score et l'appréciation */
.score-diploma {
  display: block;
  font-size: 1.3em;
  color: var(--text-color);
  margin: 0;
  padding: 10px;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  background-color: var(--secondary-color);
}

.score-diploma strong {
  color: var(--accent-color);
  font-weight: bold;
  text-transform: uppercase;
  font-size: 1.1em;
}

/* Styles pour le rang et sa description */
#final-rank {
  max-width: 80%;
}

.score-rank {
  margin: 25px auto;
  max-width: 100%;
  padding: 15px;
  background-color: var(--primary-color);
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}
.score-rank-actual {
  margin: 25px auto;
  max-width: 100%;
  padding: 15px;
  background-color: var(--primary-color);
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
  border: 2px dashed var(--safe-color);
}
.rank-title {
  font-size: 1.8em;
  color: var(--accent-color);
  margin-bottom: 10px;
  font-weight: bold;
}

.rank-description {
  font-size: 1.1em;
  color: var(--text-color);
  font-style: italic;
  line-height: 1.4;
  padding: 10px;
  background-color: var(--secondary-color);
  border-radius: 5px;
}

/* Styles spécifiques pour les titres et descriptions des rangs précédent/suivant */
.score-rank .rank-title {
  color: var(--text-color);
  opacity: 0.6;
}

.score-rank .rank-description {
  background-color: var(--secondary-color);
  opacity: 0.8;
}

/* Styles spécifiques pour le titre et la description du rang actuel */
.score-rank-actual .rank-title {
  color: var(--safe-color);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
}

.score-rank-actual .rank-description {
  background-color: var(--secondary-color);
  color: var(--safe-color);
  border-left: 3px solid var(--safe-color);
}

/* Style pour le message de mode de jeu */
.game-mode-info {
  margin-top: 15px;
  font-size: 1.1em;
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  display: inline-block;
  background-color: var(--secondary-color);
  transition: all 0.3s ease;
}

.game-mode-info:hover {
  transform: translateY(-3px);
  box-shadow: 0 3px 10px var(--shadow-color);
}

.game-mode-info strong {
  color: var(--accent-color);
  font-size: 1.2em;
}

/* --- Rank cylinder --- */
#rank-display {
  width: 100%;
  max-width: 760px;
}

#rank-cylinder-fixed {
  --rank-face-height: 160px;
  --rank-radius: 193px;
  width: 100%;
  height: calc(var(--rank-face-height) * 2.5 + 32px);
  position: relative;
  perspective: 1100px;
  overflow: hidden;
  border-radius: 16px;
  background: linear-gradient(
    to bottom,
    var(--secondary-color),
    var(--primary-color) 35%,
    var(--primary-color) 65%,
    var(--secondary-color)
  );
  box-shadow: inset 0 1px 12px var(--shadow-color);
}

#rank-cylinder-fixed::before,
#rank-cylinder-fixed::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 36px;
  z-index: 4;
  pointer-events: none;
}

#rank-cylinder-fixed::before {
  top: 0;
  background: linear-gradient(var(--secondary-color), transparent);
}

#rank-cylinder-fixed::after {
  bottom: 0;
  background: linear-gradient(transparent, var(--secondary-color));
}

.rank-reel-rotor {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: translateZ(calc(-1 * var(--rank-radius))) rotateX(0deg);
}

.rank-panel {
  position: absolute;
  top: 50%;
  left: 20px;
  right: 20px;
  height: var(--rank-face-height);
  margin-top: calc(var(--rank-face-height) / -2);
  background-color: var(--secondary-color);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  backface-visibility: hidden;
  transform: rotateX(var(--face-angle)) translateZ(var(--rank-radius));
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s;
}

.rank-face-content {
  width: 100%;
  flex-shrink: 0;
}

.rank-panel.rank-in-view {
  opacity: 0.78;
  visibility: visible;
}

.rank-panel.current-rank {
  background: var(--primary-color);
  box-shadow: 0 3px 10px var(--shadow-color);
  opacity: 1;
}

.rank-reel-focus {
  position: absolute;
  top: 50%;
  left: 19px;
  right: 19px;
  height: calc(var(--rank-face-height) + 2px);
  transform: translateY(-50%);
  border: 2px solid var(--accent-color);
  border-radius: 10px;
  box-shadow:
    0 0 0 3px var(--highlight-color),
    0 4px 16px var(--shadow-color);
  z-index: 3;
  pointer-events: none;
}

.rank-reel-focus::before {
  content: "";
  position: absolute;
  top: calc(50% - 7px);
  left: -13px;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 9px solid var(--accent-color);
}

.is-spinning .rank-panel {
  opacity: 1;
  visibility: visible;
}

.rank-reel-caption {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding-top: 12px;
  font-size: 0.8rem;
  color: var(--text-color);
}

#rank-position {
  font-weight: 600;
}

#rank-replay-btn {
  color: var(--link-color);
  font: inherit;
  border: 1px solid var(--border-color);
  background: var(--primary-color);
  border-radius: 20px;
  padding: 7px 12px;
  cursor: pointer;
}

#rank-replay-btn:hover {
  background: var(--highlight-color);
}

#rank-replay-btn:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 3px;
}

#rank-replay-btn[hidden] {
  display: none;
}

.rank-context {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
  color: var(--text-color);
}

.rank-panel-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
  width: 100%;
}

.rank-panel .rank-emoji {
  font-size: 1.5em;
  flex-shrink: 0;
  line-height: 1;
}

.rank-panel .rank-title {
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--accent-color);
  line-height: 1.2;
  min-width: 0;
  margin: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

.rank-panel .rank-description {
  font-size: 0.95rem;
  color: var(--text-color);
  margin: 0;
  padding: 0;
  background: transparent;
  line-height: 1.45;
  white-space: pre-line;
}

.current-rank .rank-emoji {
  font-size: 2.2em;
}

.current-rank .rank-title {
  font-size: 1.6rem;
}

@media (prefers-reduced-motion: reduce) {
  .rank-panel {
    transition: none;
  }
}

/* --- Game UI --- */
#game-ui {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
  width: 100%;
  opacity: 1;
  transition: opacity 0.5s ease-in-out;
  position: absolute;
  top: 0;
  left: 0;
}
#game-ui.hidden {
  opacity: 0;
  pointer-events: none;
}

#email-viewer {
  min-width: 0;
  min-height: 0;
  background-color: var(--primary-color);
  padding: 20px;
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  position: relative;
}

#email-header {
  margin-bottom: 20px;
  background: var(--primary-color);
  padding: 15px;
  border-bottom: 1px solid var(--border-color);
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.email-header-content {
  width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

#email-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.email-btn {
  white-space: nowrap;
  min-height: 40px;
  padding: 6px 12px;
  font-family: var(--font-main);
  font-size: 0.85em;
  border: 3px solid transparent; /* Bordure plus épaisse */
  border-radius: 4px;
  cursor: pointer;
  transition:
    border-color 0.2s,
    box-shadow 0.2s,
    opacity 0.2s;
  color: var(--text-color);
  background-color: #f5f7fa; /* Légèrement coloré au lieu de blanc pur */
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); /* Ombre légère pour donner du relief */
}

.email-btn:hover:not(:disabled) {
  background-color: var(--secondary-color);
}

.email-btn:active:not(:disabled) {
  background-color: var(--highlight-color);

  /* Styles pour les labels de section de rang */
  .rank-section-label {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--accent-color); /* Couleur bleue pour attirer l'attention */
    margin-top: 25px;
    margin-bottom: 10px;
    text-align: left; /* Aligné à gauche pour plus de visibilité */
    padding-left: 20px; /* Décalage pour l'alignement avec l'encart */
    position: relative; /* Pour positionner l'indicateur */
  }

  /* Petit indicateur visuel avant chaque label */
  .rank-section-label::before {
    content: "➤"; /* Flèche pointant vers la droite */
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-size: 0.9em;
  }

  /* Ajustements pour les encarts de rang */
  .score-rank,
  .score-rank-actual {
    padding: 20px; /* Plus de padding interne */
    max-width: 600px; /* Élargir la box */
    margin-left: auto; /* Pour centrer si #final-rank n'est pas déjà centré */
    margin-right: auto; /* Pour centrer si #final-rank n'est pas déjà centré */
    border-radius: 10px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
  }

  /* Styles spécifiques pour les rangs précédent et suivant (affadis) */
  .score-rank {
    background-color: #f8f8f8; /* Fond plus clair */
    opacity: 0.85; /* Légèrement transparent */
    transform: scale(0.97); /* Légèrement plus petit */
    border: 1px solid #e0e0e0;
  }

  /* Bordure verte pointillée pour le rang actuel et mise en valeur */
  .score-rank-actual {
    border: 2px dashed var(--safe-color) !important;
    background-color: white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15); /* Ombre plus prononcée */
    transform: scale(1.02); /* Légèrement plus grand */
    position: relative;
    z-index: 2; /* Au-dessus des autres encarts */
  }

  /* Styles pour le contenu DANS les encarts (.rank-item) */
  .rank-item-content {
    /* Conteneur pour emoji et titre */
    display: flex;
    align-items: center; /* Aligner verticalement emoji et titre */
    margin-bottom: 12px; /* Espace avant la description */
  }

  .rank-emoji {
    font-size: 2.2em; /* Emoji plus grand */
    margin-right: 15px; /* Plus d'espace à droite de l'emoji */
    line-height: 1; /* Pour un meilleur alignement vertical avec le texte */
  }

  .rank-title-text {
    font-size: 1.5em; /* Titre plus grand, style "Peter Parker" */
    font-weight: 600;
    color: var(--accent-color); /* Bleu par défaut pour les titres */
    line-height: 1.2;
  }

  .rank-desc-text {
    font-size: 1em; /* Description plus lisible */
    color: #555; /* Gris foncé pour la description */
    line-height: 1.6;
    text-align: left; /* Assurer l'alignement à gauche pour la description */
  }

  /* Spécificités pour le rang actuel (dans .score-rank-actual) */
  .score-rank-actual .rank-title-text {
    color: var(--safe-color); /* Titre en vert pour le rang actuel */
  }

  /* Spécificités pour les rangs précédent/suivant (dans .score-rank) */
  /* Pas besoin de surcharger .rank-title-text ici si la couleur par défaut (accent-color) convient */

  .score-rank .previous-rank .rank-desc-text,
  .score-rank .next-rank .rank-desc-text {
    font-size: 0.95em; /* Description des autres rangs légèrement plus petite */
  }

  /* Classe Muted (pour la description des rangs précédent/suivant si besoin) */
  .muted {
    color: #777; /* Gris plus clair pour le texte muted */
    font-style: italic;
  }
}

.email-btn:disabled {
  cursor: not-allowed;
  opacity: 0.8;
}

/* Animation pour le clignotement alterné des boutons */
@keyframes pulse-safe {
  0%,
  50%,
  100% {
    border-color: transparent;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }
  25% {
    border-color: var(--safe-color);
    box-shadow: 0 0 8px var(--safe-color);
    text-shadow: 0 0 1px var(--safe-color);
  }
}

@keyframes pulse-phishing {
  0%,
  50%,
  100% {
    border-color: transparent;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }
  75% {
    border-color: var(--phishing-color);
    box-shadow: 0 0 8px var(--phishing-color);
    text-shadow: 0 0 1px var(--phishing-color);
  }
}

#classify-safe-btn.email-btn:not(:disabled) {
  animation: pulse-safe 3s infinite;
}

#classify-phishing-btn.email-btn:not(:disabled) {
  animation: pulse-phishing 3s infinite;
}

#email-body-container {
  margin-bottom: 20px;
  background: var(--primary-color);
  padding: 15px;
  position: relative;
  z-index: 2;
}

#email-header p {
  margin-bottom: 8px;
}

#email-header strong {
  color: var(--text-color);
  font-weight: 600;
}
#email-body {
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.6;
}

.inspectable {
  cursor: help;
  text-decoration: underline;
  text-decoration-style: dotted;
  color: var(--link-color);
}
.inspectable:hover {
  background-color: var(--highlight-color);
}
#email-body .link {
  color: var(--link-color);
  text-decoration: underline;
  cursor: help;
}
#email-body .link:hover {
  background-color: var(--highlight-color);
}

#analysis-panel {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 2;
  background-color: var(--secondary-color);
  border-left: 1px solid var(--border-color);
}
.panel-section {
  width: 100%;
  margin-bottom: 25px;
  text-align: center;
}
.panel-section h3 {
  color: var(--accent-color);
  margin-bottom: 10px;
  font-size: 1.2em;
  font-weight: 600;
}

#timer {
  font-size: 2.5em;
  font-weight: bold;
  color: var(--safe-color);
  transition: color 0.3s;
}
#timer.warning {
  color: var(--warning-color);
}
#timer.danger {
  color: var(--phishing-color);
}

#security-bar-container {
  width: 90%;
  height: 6px;
  background-color: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
  margin: 0 auto;
}
#security-bar {
  height: 100%;
  width: 100%;
  background-color: var(--safe-color);
  transition:
    width 0.5s ease-out,
    background-color 0.5s ease-out;
}
#errors-left {
  font-weight: bold;
} /* Added */

#score {
  font-size: 1.5em;
}
#auto-analyze-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#inspection-display {
  margin-top: 15px;
  padding: 10px;
  background-color: var(--primary-color);
  border: 1px solid var(--border-color);
  border-radius: 2px;
  min-height: 50px;
  width: 100%;
  word-wrap: break-word;
  font-size: 0.9em;
  color: var(--inspection-color);
  line-height: 1.4;
}

#action-buttons {
  display: flex;
  justify-content: space-around;
  width: 100%;
  margin-top: auto;
  padding-bottom: 10px;
}

.btn {
  padding: 8px 16px;
  font-family: var(--font-main);
  font-size: 0.9em;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  transition:
    background-color 0.2s,
    opacity 0.2s;
  color: white;
  background-color: var(--accent-color);
}
.btn:hover:not(:disabled) {
  background-color: #106ebe;
}
.btn:active:not(:disabled) {
  background-color: #005a9e;
}
.btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* Suppression des styles de fond coloré pour les boutons */
#classify-safe-btn {
  background-color: white;
}
#classify-safe-btn:hover:not(:disabled) {
  background-color: #f5f5f5;
}
#classify-phishing-btn {
  background-color: white;
}
#classify-phishing-btn:hover:not(:disabled) {
  background-color: #f5f5f5;
}
#start-btn,
#restart-btn,
#feedback-continue-btn {
  background-color: var(--accent-color);
  color: white;
  font-weight: 600;
}
#start-btn:hover,
#restart-btn:hover,
#feedback-continue-btn:hover {
  background-color: #106ebe;
}

/* Style spécifique pour le bouton SOS Sécu */
#auto-analyze-btn.email-btn {
  background-color: #f5f7fa; /* Même couleur légèrement colorée */
  color: var(--text-color);
  font-weight: normal;
  transition: all 0.2s ease;
}

#auto-analyze-btn.email-btn:hover:not(:disabled) {
  background-color: #f5f5f5;
}

#auto-analyze-btn.email-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* --- Abandon Button --- */
.abandon-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-color);
  opacity: 0.7;
  font-size: 0.8rem;
  padding: 6px 12px;
  width: 100%;
}
.abandon-btn:hover {
  opacity: 1;
  border-color: var(--warning-color);
  color: var(--warning-color);
}

/* --- Feedback Popup --- */
#feedback-modal {
  position: fixed; /* Or absolute relative to game-container */
  top: 0;
  left: 0;
  right: 0; /* Ensure it covers full width */
  bottom: 0; /* Ensure it covers full height */
  background-color: rgba(0, 0, 0, 0.85); /* Modal now has the dark background */
  display: flex; /* Always flex, for centering */
  justify-content: center;
  align-items: center;
  z-index: 100; /* Above everything */
  opacity: 0; /* Start of animation */
  visibility: hidden; /* Ensure it's fully hidden initially */
  pointer-events: none;
  transition: opacity 0.3s ease-in-out; /* Only opacity transition now */
}

#feedback-modal.visible {
  opacity: 1; /* End of animation */
  visibility: visible; /* Make it visible when class is added */
  pointer-events: auto;
}

/* Styles pour l'image du gars de la sécurité */
#secu-guy-container {
  position: absolute; /* Positioned within #feedback-modal */
  top: 0;
  left: 0;
  width: 100%; /* Fills #feedback-modal */
  height: 100%; /* Fills #feedback-modal */
  z-index: 99; /* Juste derrière la popup de contenu, mais au-dessus du fond du modal */
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

#secu-guy-container.visible {
  opacity: 1;
}

#secu-guy-img {
  max-width: 80%;
  max-height: 80%;
  position: absolute;
  z-index: 99;
  transform: translateX(25%); /* Décaler l'image vers la droite */
  right: 0; /* Positionner à partir du bord droit */
  margin: 0;
}

#feedback-content {
  background-color: var(--primary-color);
  padding: 24px;
  border: 1px solid var(--border-color);
  border-radius: 2px;
  width: 90%;
  max-width: 750px;
  text-align: center;
  box-shadow: 0 2px 8px var(--shadow-color);
  transform: scale(0.9);
  transition: transform 0.3s ease-in-out;
  position: relative;
  z-index: 101; /* S'assurer que la popup est au-dessus de l'image */
}

#feedback-modal.visible #feedback-content {
  transform: scale(1);
}

#feedback-title {
  font-size: 2em; /* Larger title */
  margin-bottom: 15px;
  font-weight: bold;
}

#feedback-explanation {
  /* Added for explanation text */
  font-size: 1.1em;
  margin-bottom: 20px;
  color: var(--text-color);
}

#feedback-clues {
  margin-bottom: 25px;
  padding: 15px;
  background-color: var(--secondary-color);
  border-radius: 2px;
  text-align: left;
  max-height: 400px;
  overflow-y: auto;
  line-height: 1.6;
  font-size: 0.95em;
  border: 1px solid var(--border-color);
}
#feedback-clues ul {
  list-style: none; /* Remove default bullets */
  padding-left: 0;
}
#feedback-clues li {
  margin-bottom: 14px;
  padding-left: 1.5em; /* Indent */
  position: relative;
  display: flex;
  flex-direction: column;
}
#feedback-clues li::before {
  /* Custom bullet */
  content: "▶";
  position: absolute;
  left: 0;
  color: var(--accent-color);
  font-size: 0.8em;
  top: 3px;
}

/* Styles pour les techniques et explications des indices */
.clue-technique {
  color: var(--accent-color);
  font-weight: bold;
  display: block;
  margin-bottom: 3px;
  font-size: 1.05em;
}

.clue-explanation {
  display: block;
  color: var(--text-color);
  padding-left: 0.3em;
}
#feedback-clues strong {
  /* Highlight 'Indices:' */
  color: var(--accent-color);
  display: block;
  margin-bottom: 10px;
}

#feedback-continue-btn {
  margin-top: 10px; /* Ensure spacing */
  padding: 12px 30px; /* Adjust button size */
}

/* --- Tooltip qui suit le curseur --- */
#cursor-tooltip {
  position: fixed;
  padding: 6px 10px;
  background-color: var(--primary-color);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 2px;
  font-size: 0.85em;
  pointer-events: none;
  z-index: 9999;
  max-width: 250px;
  word-wrap: break-word;
  box-shadow: 0 2px 5px var(--shadow-color);
  white-space: pre-line;
}

#cursor-tooltip.hidden {
  display: none; /* Utiliser display:none au lieu d'opacity pour éviter tout problème */
}

#cursor-tooltip.warning {
  border-left: 3px solid var(--warning-color);
}

#cursor-tooltip.danger {
  border-left: 3px solid var(--phishing-color);
}

/* Animation subtile pour le tooltip - simplifiée */
@keyframes tooltip-fade {
  0% {
    opacity: 0.9;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.9;
  }
}

#cursor-tooltip:not(.hidden) {
  animation: tooltip-fade 2s infinite;
}

/* Curseurs personnalisés pour les éléments inspectables */
.inspectable {
  cursor: help;
}

/* Lorsqu'on survole un élément inspectable, on cache le tooltip et on utilise un curseur personnalisé */
.inspectable:hover {
  cursor: help;
}

/* --- Tooltip dynamique --- */
.tooltip-element {
  position: fixed;
  padding: 8px 12px;
  background-color: var(--primary-color);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 2px;
  font-size: 0.9em;
  pointer-events: none;
  z-index: 9999;
  max-width: 500px;
  min-width: 300px;
  word-wrap: break-word;
  box-shadow: 0 2px 4px var(--shadow-color);
  white-space: pre-line;
  transform: translate(10px, 10px);
}

.tooltip-element.warning {
  border-left: 3px solid var(--warning-color);
}

.tooltip-element.danger {
  border-left: 3px solid var(--phishing-color);
}

/* --- New Badges Popup (game-over screen) --- */
#new-badges-popup {
  max-width: 760px;
  margin-top: 0;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, #fef9c3, #fef3c7);
  border: 2px solid #f59e0b;
  border-radius: 12px;
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.4s,
    transform 0.4s;
}
#new-badges-popup.visible {
  opacity: 1;
  transform: translateY(0);
}
.badges-popup-title {
  font-size: 1.1rem;
  font-weight: bold;
  margin-bottom: 0.7rem;
  color: #92400e;
}
.badges-popup-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.badge-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.6rem;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 8px;
}
.badge-emoji {
  font-size: 1.5rem;
}
.badge-name {
  font-weight: 600;
  font-size: 0.9rem;
}
.badge-desc {
  font-size: 0.78rem;
  color: #64748b;
  margin-left: auto;
}
body.dark #new-badges-popup {
  background: linear-gradient(135deg, #422006, #451a03);
  border-color: #d97706;
}
body.dark .badges-popup-title {
  color: #fbbf24;
}
body.dark .badge-item {
  background: rgba(255, 255, 255, 0.05);
}
body.dark .badge-desc {
  color: #a1a1aa;
}
.profile-link-btn {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.5rem 1.2rem;
  background: var(--accent-color, #0078d4);
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s;
}
.profile-link-btn:hover {
  background: #005a9e;
}

.result-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

@media (max-width: 700px) {
  #game-container {
    width: 100%;
    border-radius: 0;
  }
  #game-ui {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }
  #email-viewer {
    grid-column: 1;
    grid-row: 2;
    padding: 12px;
    border-right: 0;
  }
  #email-header,
  #email-body-container {
    padding: 8px;
  }
  #analysis-panel {
    grid-column: 1;
    grid-row: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 12px;
    border-left: 0;
    border-bottom: 1px solid var(--border-color);
    max-height: 35dvh;
  }
  .panel-section {
    margin-bottom: 0;
    font-size: 0.8rem;
  }
  .panel-section h3 {
    font-size: 0.85rem;
    margin-bottom: 4px;
  }
  .panel-section:nth-child(4) {
    grid-column: span 2;
    text-align: left;
  }
  #timer {
    font-size: 2em;
  }
  #analysis-panel .abandon-btn {
    padding: 6px;
    font-size: 0.75rem;
  }
  #game-over-screen {
    padding: 20px 12px;
    border-width: 4px;
  }
  .rank-panel .rank-title {
    font-size: 1.1rem;
  }
  .current-rank .rank-title {
    font-size: 1.25rem;
  }
  .rank-panel .rank-description {
    font-size: 0.85rem;
  }
}
