body {
  font-family: Georgia, serif;
  background-color: #f0e68c;
  /* Couleur sable, rappelant les ruines antiques */
  color: #333;
  /*Font-size: 14px;*/
}

#merveilleMatrix,
#cardMatrix,
.player-zone {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin: 20px auto;
  padding: 5px;
  border: 2px solid #664c28;
  /* Bordure boisée */
  border-radius: 5px;
  background-color: #fff8dc;
  /* Fond plus clair */
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
}

.player-zone h2 {
  text-align: center;
  font-size: 20px;
  color: #f1c40f;
  /* Couleur or */
  text-transform: uppercase;
  margin-bottom: 10px;
}

.merveille,
.card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.merveille {
  width: 150px;
  height: 110px;
  margin: 5px;
  background-color: #c2b280;
  /* Couleur pierre */
  border: 2px solid #664c28;
  /* Couleur bois */
  text-align: center;
  padding: 5px;
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
}

.merveille:hover {
  transform: translateY(-5px);
  box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}


.card {
  width: 110px;
  height: 150px;
  margin: 5px;
  /*background-color: #c2b280;  Couleur pierre */
  /* border: 2px solid #664c28; Couleur bois */
  text-align: center;
  padding: 5px;
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
  Font-size: 14px;
}

.card .icon {
  margin-right: 5px;
  /* Icône bien espacée */
}

.player-zone {
  display: flex;
  /* Disposition horizontale */
  flex-wrap: wrap;
  justify-content: space-between;
  /* Espacer les deux colonnes */
  align-items: flex-start;
  /* Aligner en haut */
  margin: 10px;
  padding: 15px;
  min-height: 400px;
  /* Hauteur minimum augmentée */
  background-color: #a3a3a3;
  /*Couleur de fond légère */
  border: 2px solid #ccc;
  /*Bordure grise */
  border-radius: 5px;
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
  /* Ombre subtile */
}

#player1.player-zone {
  background-color: #002F6C;
  /*Couleur de fond légère */
  /*border: 2px solid #ccc;  Bordure grise */
}

#player2.player-zone {
  background-color: #D35400;
  /*Couleur de fond légère */
  /*border: 2px solid #ccc;  Bordure grise */
}

#player3.player-zone {
  background-color: #1E8449;
  /*Couleur de fond légère */
  /*border: 2px solid #ccc;  Bordure grise */
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.player-info {
  flex: 1;
  /* Prend 1 unité d'espace */
  padding: 10px;
  font-size: 14px;
  color: white;
}

.player-cards {
  flex: 2;
  /* Prend 2 unités d'espace */
  display: flex;
  /* Disposition horizontale des cartes */
  gap: 10px;
  /* Espacement entre les cartes */

}

.player-buildings {
  margin-top: 15px;
  padding: 15px;
  border-top: 2px solid #ccc;
  color: white;
  min-height: 250px;
  /* Hauteur minimum pour les bâtiments */
  max-height: 400px;
  /* Hauteur maximum augmentée */
  overflow-y: auto;
}

.player-buildings h3 {
  width: 100%;
  font-size: 1.2em;
  margin-bottom: 10px;
  color: white;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  padding-bottom: 5px;
}

/* 🏗️ NOUVEAU STYLE POUR LES BÂTIMENTS - REPRODUIT EXACTEMENT LE MODÈLE */

/* Grille des bâtiments - comme dans le modèle */
.buildings-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding: 20px;
  background: #fff8dc;
  border: 2px solid #aaa;
  min-height: 150px;
}

/* En-tête de groupe simplifié - juste l'icône */
.building-group-header {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 115px;
  height: 30px;
  background: linear-gradient(135deg, rgba(52, 152, 219, 0.3), rgba(41, 128, 185, 0.2));
  border: 2px solid rgba(52, 152, 219, 0.5);
  border-radius: 6px;
  margin-bottom: 10px;
  font-weight: bold;
  cursor: pointer;
  font-size: 1.5em;
}

.building-group-header:hover {
  background: linear-gradient(135deg, rgba(52, 152, 219, 0.4), rgba(41, 128, 185, 0.3));
}

/* Pile de cartes - exactement comme le modèle */
.card-stack {
  position: relative;
  width: 60px;
  min-height: 120px;
  padding-bottom: 80px;
  margin: 10px;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px dashed gray;
  cursor: pointer;
}

/* Cartes dans la pile - exactement comme le modèle */
.card-stack .building-item {
  position: absolute;
  top: calc(var(--stack-index) * 40px);
  left: 0;
  width: 55px;
  height: 95px;
  background-color: #3498db;
  color: white;
  border-radius: 4px;
  border: 2px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: calc(var(--stack-index));
  transition: top 0.2s ease, transform 0.2s ease;
  font-size: 1.2em;
  cursor: pointer;
}

.card-stack .building-item:hover {
  transform: translateY(-5px) scale(1.05);
  z-index: 999 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Compteur - exactement comme le modèle */
.stack-counter {
  position: absolute;
  top: -3px;
  right: -3px;
  background: #e67e22;
  color: white;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65em;
  font-weight: bold;
  border: 1px solid white;
  z-index: 20;
}

/* Scrollbar personnalisée pour les bâtiments */
.player-buildings::-webkit-scrollbar,
.buildings-grid::-webkit-scrollbar {
  width: 6px;
}

.player-buildings::-webkit-scrollbar-track,
.buildings-grid::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.player-buildings::-webkit-scrollbar-thumb,
.buildings-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.player-buildings::-webkit-scrollbar-thumb:hover,
.buildings-grid::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

.actions-container {
  margin-top: 10px;
  padding: 10px;
  border: 2px solid #ccc;
  background-color: #f9f9f9;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.actions-container p {
  font-weight: bold;
  margin-bottom: 5px;
}

.actions-container button {
  padding: 8px;
  border: none;
  background-color: #008CBA;
  color: white;
  font-size: 14px;
  cursor: pointer;
}

.actions-container button:hover {
  background-color: #005f75;
}

.actions-container button:nth-child(4) {
  /* Bouton annuler */
  background-color: #e74c3c;
}

.actions-container button:nth-child(4):hover {
  background-color: #c0392b;
}


.selected {
  animation: pop 0.3s ease forwards;
}

.player-table {
  width: 100%;
  border-collapse: collapse;
  color: white;
}

.player-table td {
  vertical-align: top;
  padding: 10px;
}

.player-info {
  width: 50%;
  /*background-color: rgba(255, 255, 255, 0.1);*/
  border-right: 2px solid gray;
}


.player-wonder {
  min-height: 250px;
  /* Hauteur augmentée pour la merveille */
  padding: 20px;
  color: white;
  /* Pour bien voir le texte */
  text-shadow: 4px 4px 8px rgba(0, 0, 0, 2);
  /* Améliore la lisibilité */
  border: 3px solid gold;
  /* 🔥 Bordure dorée pour un effet premium */
  border-radius: 10px;
  /* Coins arrondis pour un effet plus propre */
}


.player-cards,
.player-buildings {
  text-align: center;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  color: white;
}

.player-cards .card,
.player-buildings .card {
  margin: 5px;
}


@keyframes pop {
  0% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.2);
    opacity: 0.8;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* 🎯 MODAL POPUP POUR LES ACTIONS */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background: linear-gradient(135deg, #2c3e50, #34495e);
  border-radius: 15px;
  padding: 30px;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  color: white;
  position: relative;
  animation: slideIn 0.3s ease;
}

.modal-header {
  text-align: center;
  margin-bottom: 20px;
  border-bottom: 2px solid #f39c12;
  padding-bottom: 15px;
}

.modal-header h2 {
  margin: 0;
  color: #f39c12;
  font-size: 1.5em;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.modal-body {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.card-preview {
  flex: 1;
  background: linear-gradient(135deg, #8b4513, #a0522d);
  border-radius: 10px;
  padding: 15px;
  text-align: center;
  border: 3px solid #f39c12;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card-preview .card-icon {
  font-size: 2em;
  margin-bottom: 10px;
}

.card-preview .card-name {
  font-size: 1.2em;
  font-weight: bold;
  margin-bottom: 10px;
  color: #f39c12;
}

.card-preview .card-type {
  background: rgba(0, 0, 0, 0.3);
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 0.9em;
  margin-bottom: 10px;
}

.card-details {
  flex: 1;
}

.cost-section,
.gain-section {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
}

.cost-section h3,
.gain-section h3 {
  margin: 0 0 10px 0;
  color: #e74c3c;
  font-size: 1.1em;
}

.gain-section h3 {
  color: #27ae60;
}

.resource-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.resource-item {
  background: rgba(255, 255, 255, 0.1);
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 0.9em;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.alternative-resource {
  background: rgba(243, 156, 18, 0.2) !important;
  border: 1px solid #f39c12 !important;
  position: relative;
  animation: pulse 2s infinite;
}

.alternative-resource::after {
  content: " (choix)";
  font-size: 0.7em;
  color: #f39c12;
  font-weight: bold;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(243, 156, 18, 0.4);
  }

  70% {
    box-shadow: 0 0 0 5px rgba(243, 156, 18, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(243, 156, 18, 0);
  }
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-top: 20px;
}

.action-button {
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.action-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.build-button {
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  color: white;
}

.build-button:hover {
  background: linear-gradient(135deg, #229954, #27ae60);
}

.sell-button {
  background: linear-gradient(135deg, #f39c12, #e67e22);
  color: white;
}

.sell-button:hover {
  background: linear-gradient(135deg, #e67e22, #d35400);
}

.wonder-button {
  background: linear-gradient(135deg, #8e44ad, #9b59b6);
  color: white;
}

.wonder-button:hover {
  background: linear-gradient(135deg, #7d3c98, #8e44ad);
}

.buy-button {
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
}

.buy-button:hover {
  background: linear-gradient(135deg, #2980b9, #1f618d);
}

.cancel-button {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
  grid-column: span 2;
}

.cancel-button:hover {
  background: linear-gradient(135deg, #c0392b, #a93226);
}

.close-button {
  position: absolute;
  top: 15px;
  right: 20px;
  background: none;
  border: none;
  font-size: 1.5em;
  color: #bdc3c7;
  cursor: pointer;
  transition: color 0.3s ease;
}

.close-button:hover {
  color: #e74c3c;
}

.can-build {
  border-color: #27ae60 !important;
  box-shadow: 0 0 15px rgba(39, 174, 96, 0.3);
}

.cannot-build {
  border-color: #e74c3c !important;
  opacity: 0.7;
}

.action-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

/* ⚔️ JETONS MILITAIRES */
.military-token {
  display: inline-block;
  font-size: 1.2em;
  margin: 0 2px;
  padding: 2px 4px;
  border-radius: 4px;
  cursor: help;
  transition: transform 0.2s ease;
}

.military-token:hover {
  transform: scale(1.3);
}

/* Jetons de victoire selon l'âge */
.victory-1 {
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  border: 1px solid #1e8449;
  box-shadow: 0 0 5px rgba(39, 174, 96, 0.5);
}

.victory-2 {
  background: linear-gradient(135deg, #3498db, #5dade2);
  border: 1px solid #2874a6;
  box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}

.victory-3 {
  background: linear-gradient(135deg, #9b59b6, #bb8fce);
  border: 1px solid #7d3c98;
  box-shadow: 0 0 5px rgba(155, 89, 182, 0.5);
}

/* Jetons de défaite */
.defeat {
  background: linear-gradient(135deg, #e74c3c, #ec7063);
  border: 1px solid #c0392b;
  box-shadow: 0 0 5px rgba(231, 76, 60, 0.5);
}

/* Animation pour les nouveaux jetons */
.military-token.new-token {
  animation: militaryTokenAppear 0.8s ease;
}

@keyframes militaryTokenAppear {
  0% {
    opacity: 0;
    transform: scale(0) rotate(180deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.3) rotate(0deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}