:root {
  /* Palette de couleurs principale - style cyberpunk/néon */
  --main-bg: #0d1117;
  --card-bg: #161b22;
  --card-border: #4d5b9e;
  --card-hover-border: #6f7ebd;
  --card-glow: rgba(111, 126, 189, 0.6);

  /* Couleurs d'interface */
  --text-color: #c9d1d9;
  --text-shadow: 0 0 8px rgba(148, 176, 255, 0.8);
  --button-color: #58a6ff;
  --button-hover: #7683d3;
  --button-glow: rgba(88, 166, 255, 0.6);

  /* Couleurs des types de cartes */
  --hp-color: #50fa7b;
  --ap-color: #ffb86c;
  --attack-color: #ff79c6;
  --defense-color: #50fa7b;
  --debuff-color: #bd93f9;
  --healing-color: #50fa7b;
  --special-color: #ffb86c;

  /* Ombres et effets */
  --card-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  --button-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

@import url('https://fonts.googleapis.com/css2?family=Exo+2:wght@400;600;700&family=Rajdhani:wght@500;600;700&display=swap');

/* Base styling */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Exo 2', sans-serif;
  margin: 0;
  padding: 0;
  background: var(--main-bg) url('../../images/mine_soufre.jpg') no-repeat center center fixed;
  background-size: cover;
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(10, 10, 25, 0.92), rgba(5, 5, 15, 0.95));
  z-index: -1;
}

.game-container, .deck-builder-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 15px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  position: relative;
}

/* Ajout d'un motif de grille subtil sur l'arrière-plan */
.game-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    linear-gradient(90deg, rgba(40, 44, 80, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(40, 44, 80, 0.05) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
  z-index: -1;
}

/* Zones de jeu */
.player-area, .ai-area, .opponent-area {
  display: flex;
  flex-direction: column;
  padding: 15px;
  border-radius: 12px;
  position: relative;
  backdrop-filter: blur(8px);
  transition: all 0.3s ease;
}

.ai-area, .opponent-area {
  background: linear-gradient(to right, rgba(92, 36, 42, 0.4), rgba(60, 20, 25, 0.3));
  border: 1px solid rgba(232, 69, 96, 0.3);
  box-shadow: 0 0 20px rgba(233, 69, 96, 0.15);
}

.player-area {
  background: linear-gradient(to right, rgba(38, 50, 105, 0.4), rgba(25, 33, 68, 0.3));
  border: 1px solid rgba(82, 100, 174, 0.3);
  box-shadow: 0 0 20px rgba(82, 100, 174, 0.15);
}

/* Ajout d'une ligne d'énergie sur le bord des zones */
.ai-area, .opponent-area::before, .player-area::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 10%;
  right: 10%;
  height: 2px;
  background: linear-gradient(to right,
    transparent,
    var(--attack-color),
    transparent
  );
  opacity: 0.8;
  box-shadow: 0 0 10px var(--attack-color);
}

.player-area::before {
  background: linear-gradient(to right,
    transparent,
    var(--defense-color),
    transparent
  );
  box-shadow: 0 0 10px var(--defense-color);
}

/* Barre de statut - Style de base optimisé */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px; /* Réduit de 15px à 10px */
  padding: 5px; /* Réduit de 8px à 5px */
  border-radius: 6px; /* Légèrement plus petit */
  background-color: rgba(0, 0, 0, 0.2);
  flex-wrap: wrap;
  gap: 8px; /* Réduit de 10px à 8px */
  min-height: 40px; /* Hauteur minimale pour éviter qu'elle ne devienne trop petite */
}

/* HP et AP - Réduction de taille */
.hp, .ap {
  padding: 4px 10px; /* Réduit de 6px 15px à 4px 10px */
  border-radius: 6px; /* Légèrement plus petit */
  font-weight: bold;
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: 0.8px; /* Réduit de 1px à 0.8px */
  text-shadow: var(--text-shadow);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 4px; /* Réduit de 6px à 4px */
  white-space: nowrap;
  font-size: 14px; /* Taille de police réduite pour gagner de l'espace */
}

.hp::before, .ap::before {
  content: "";
  display: inline-block;
  width: 10px; /* Réduit de 12px à 10px */
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.hp {
  background: linear-gradient(135deg, rgba(78, 204, 163, 0.2), rgba(78, 204, 163, 0.4));
  border: 1px solid var(--hp-color);
  box-shadow: 0 0 8px rgba(78, 204, 163, 0.2); /* Ombre légèrement réduite */
}

.hp::before {
  background-color: var(--hp-color);
  box-shadow: 0 0 4px var(--hp-color); /* Ombre réduite */
}

.ap {
  background: linear-gradient(135deg, rgba(255, 189, 105, 0.2), rgba(255, 189, 105, 0.4));
  border: 1px solid var(--ap-color);
  box-shadow: 0 0 8px rgba(255, 189, 105, 0.2); /* Ombre légèrement réduite */
}

.ap::before {
  background-color: var(--ap-color);
  box-shadow: 0 0 4px var(--ap-color); /* Ombre réduite */
}

/* Indicateur de tour */
.turn-indicator {
  text-align: center;
  font-size: 20px;
  font-weight: bold;
  margin: 5px 0 15px 0;
  padding: 8px;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.4), rgba(30, 30, 50, 0.4));
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 2px;
  position: relative;
  text-shadow: var(--text-shadow);
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

/* Animation de pulsation pour l'indicateur de tour */
.turn-indicator::after {
  content: "";
  position: absolute;
  top: 0;
  left: -50%;
  width: 200%;
  height: 100%;
  background: linear-gradient(90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  animation: pulse 2s infinite;
}
.turn-indicator.your-turn {
  background: #4CAF50;
  color: white;
}

.turn-indicator.opponent-turn {
  background: #f44336;
  color: white;
}
@keyframes pulse {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Main de cartes */
.cards-hand {
  display: flex;
  overflow-x: auto;
  gap: 5px;
  padding: 1px 1px;
  min-height: 190px;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--card-border) rgba(0, 0, 0, 0.2);
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.cards-hand::-webkit-scrollbar {
  height: 6px;
}

.cards-hand::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.cards-hand::-webkit-scrollbar-thumb {
  background-color: var(--card-border);
  border-radius: 3px;
}
/* Base card style modification to accommodate background effects */

/* Cartes */
.card {
  background: linear-gradient(135deg, var(--card-bg), rgba(32, 36, 64, 0.8));
  border: 2px solid var(--card-border);
  border-radius: 12px;
  width: 130px;
  height: 180px;
  min-width: 130px; /* Empêche les cartes de rétrécir */
  display: flex;
  flex-direction: column;
  padding: 10px;
  cursor: pointer;
  position: relative;
  box-shadow: var(--card-shadow);
  text-align: center;
  overflow: hidden;
  scroll-snap-align: center;
  -webkit-user-select: none; /* Safari */
  -moz-user-select: none; /* Firefox */
  -ms-user-select: none; /* Internet Explorer/Edge */
  user-select: none; /* Non-prefixed version, currently supported by Chrome, Edge, Opera and Firefox */
  cursor: pointer; /* Change the cursor to a pointer to indicate it's clickable */  
}


.current-turn-card {
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.card-removing {
  opacity: 0 !important;
  transform: scale(0.5) translateY(-50px) !important;
}

.card.animate {
  animation: scaleUp 0.3s ease-in-out;
}

@keyframes scaleUp {
  0% { transform: scale(1); }
  100% { transform: scale(1.01); }
}
/*
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.1), transparent);
  opacity: 0.5;
  border-radius: 10px 10px 0 0;
  z-index: 0;
}*/

.player-hand .card:hover {

  border-color: var(--card-hover-border);
  box-shadow: 0 0 20px var(--card-glow);
  z-index: 10;
}

.player-hand .card:active {
  transform: translateY(-5px) scale(0.98);
}

.card.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.card-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}

.card-cost {
  color: #ffe600;
  border-radius: 3px;
  min-width: 18px;
  min-height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  text-shadow: 1px 1px #00000080 ;
  font-family: 'Rajdhani', sans-serif;
  font-size: 18px;
}


.card-type {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  font-weight: bold;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.card-type.attack {
  background: linear-gradient(135deg, var(--attack-color), rgba(180, 50, 70, 0.8));
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.card-type.defense {
  background: linear-gradient(135deg, var(--defense-color), rgba(60, 170, 130, 0.8));
  color:#161b22;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.card-type.debuff {
  background: linear-gradient(135deg, var(--debuff-color), rgba(130, 40, 165, 0.8));
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.card-type.healing {
  background: linear-gradient(135deg, var(--healing-color), rgba(60, 170, 130, 0.8));
  color:#161b22;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.card-type.special {
  background: linear-gradient(135deg, var(--special-color), rgba(220, 170, 80, 0.8));
  color:#161b22;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.card-name {
  font-weight: bold;
  text-align: center;
  margin: 8px 0;
  position: relative;
  z-index: 1;
  font-size: 12px;
  letter-spacing: 0.5px;
  color: #ffffff;
  text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
  padding: 0 5px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.card-description {
  font-size: 10px;
  flex-grow: 1;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  padding: 5px;
  margin-top: 5px;
  position: relative;
  z-index: 1;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.9);
  overflow: auto;
}


/* Champ de jeu */
.game-field {
  display: flex;
  justify-content: space-between;
  gap: 5px;
  margin: 5px 0;
  padding: 5px;
  background: linear-gradient(to bottom, rgba(20, 20, 40, 0.6), rgba(15, 15, 30, 0.6));
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
  min-height: 250px;
}

/* Effet de "champ de bataille" */
.game-field::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.03),
    rgba(255, 255, 255, 0.03) 10px,
    transparent 10px,
    transparent 20px
  );
  pointer-events: none;
}
.player-field{
  display: flex;
}
/* Cartes jouées par le joueur */
.played-card.played-by-player {
  background: linear-gradient(135deg, var(--card-bg), rgba(32, 36, 64, 0.8));
  border: 2px solid var(--card-border);
}

/* Cartes jouées par l'IA */
.played-card.played-by-ai {
  background: linear-gradient(135deg, rgba(60, 20, 25, 0.8), rgba(92, 36, 42, 0.8));
  border: 2px solid rgba(232, 69, 96, 0.8);
}

/* Cartes dans la main du joueur */
.card.player-card {
  background: linear-gradient(135deg, var(--card-bg), rgba(32, 36, 64, 0.8));
  border: 2px solid var(--card-border);
}

/* Cartes dans la main de l'IA */
.card.ai-card {
  background: linear-gradient(135deg, rgba(60, 20, 25, 0.8), rgba(92, 36, 42, 0.8));
  border: 2px solid rgba(232, 69, 96, 0.8);
}
/* Cartes jouées */
.played-card {
  width: 70px; /* Réduire la largeur */
  height: 100px; /* Réduire la hauteur */
  min-width: 130px; /* Empêche les cartes de rétrécir */
  font-size: 9px; /* Réduire la taille du texte */
  position: relative;
  transition: transform 0.3s ease;
  transform-origin: center center;
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 5px;
}
.played-card:hover {
  z-index: 100;
  transform: scale(1.15);
}

.played-card .card-name {
  font-size: 8px;
  max-height: 20px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.played-card .card-description {
  display:none;
  font-size: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Contrôles */
.controls {
  display: flex;
  justify-content: center;
  margin: 10px 0;
  gap: 15px;
  flex-wrap: wrap;
}
.decrement-btn,.increment-btn{  
  background: linear-gradient(135deg, var(--button-color), rgba(65, 75, 140, 0.9));
  color: white;
  border: none;
  padding: 3px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: var(--button-shadow);
  font-family: 'Exo 2', sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
}

#start-game-btn ,#load-deck-btn, #save-deck-btn {
  background: linear-gradient(135deg, var(--button-color), rgba(65, 75, 140, 0.9));
  color: white;
  border: none;
  padding: 3px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: var(--button-shadow);
  font-family: 'Exo 2', sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
  max-width: 150px;
}

#start-game-btn::before,#load-deck-btn::before,#save-deck-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.7s ease;
}

#start-game-btn:hover,#load-deck-btn:hover,#save-deck-btn:hover {
  background: linear-gradient(135deg, var(--button-hover), rgba(95, 105, 180, 0.9));
  box-shadow: 0 0 15px var(--button-glow);
  transform: translateY(-2px);
}

#end-turn-btn,#find-match-btn{  
  background: linear-gradient(135deg, var(--button-color), rgba(65, 75, 140, 0.9));
  color: white;
  text-shadow: 2px 2px 3px #0d1117;
  border: none;
  padding: 3px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: var(--button-shadow);
  font-family: 'Exo 2', sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
}

#end-turn-btn {
  background: linear-gradient(135deg, #e94560, #c1344a);
}

#end-turn-btn:hover {
  background: linear-gradient(135deg, #f05670, #d43f55);
  box-shadow: 0 0 15px rgba(233, 69, 96, 0.5);
}
#find-match-btn {
  background: linear-gradient(135deg, #45bbe9, #1b4680);
}

#find-match-btn:hover {
  background: linear-gradient(135deg, #56ccf0, #3f4ed4);
  box-shadow: 0 0 15px rgba(140, 69, 233, 0.5);
}


/* Deck et indicateurs */
.deck-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
}

.deck-pile {
  width: 45px;
  height: 65px;
  background: linear-gradient(135deg, var(--card-bg), rgba(32, 36, 64, 0.8));
  border: 2px solid var(--card-border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 18px;
  position: relative;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Simulation de plusieurs cartes empilées */
.deck-pile::before, .deck-pile::after {
  content: "";
  position: absolute;
  border-radius: 8px;
  background: var(--card-bg);
  border: 2px solid var(--card-border);
}

.deck-pile::before {
  width: 45px;
  height: 65px;
  top: -4px;
  left: -4px;
  z-index: -1;
}

.deck-pile::after {
  width: 45px;
  height: 65px;
  top: -8px;
  left: -8px;
  z-index: -2;
}

.deck-count {
  font-size: 14px;
  color: #ddd;
  text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.message-log::-webkit-scrollbar {
  width: 6px;
}

.message-log::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.message-log::-webkit-scrollbar-thumb {
  background-color: var(--card-border);
  border-radius: 3px;
}

.log-entry {
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  animation: fadeIn 0.3s ease-in;
}

.log-entry.opponent-log {
  color: #ff4444;
  background-color: #ffe6e6;
}

.log-entry.player-log {
  color: #44a944;
  background-color: #e6ffe6;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.player-log {
  color: #829bff;
  text-shadow: 0 0 5px rgba(130, 155, 255, 0.5);
}

.ai-log {
  color: #ff8a8a;
  text-shadow: 0 0 5px rgba(255, 138, 138, 0.5);
}

.system-log {
  color: #e2e8f0;
  text-shadow: 0 0 5px rgba(226, 232, 240, 0.5);
}

/* Effets */
.effects {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 50%;
}

.effect {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  color: white;
  font-weight: bold;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.effect::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.7);
}

.effect.attack {
  background: linear-gradient(135deg, var(--attack-color), rgba(180, 50, 70, 0.8));
}

.effect.defense {
  background: linear-gradient(135deg, var(--defense-color), rgba(60, 170, 130, 0.8));
}

.effect.poison {
  background: linear-gradient(135deg, var(--debuff-color), rgba(130, 40, 165, 0.8));
}

.effect.healing {
  background: linear-gradient(135deg, var(--healing-color), rgba(60, 170, 130, 0.8));
}

.effect.temp-attack, .effect.temp-defense {
  animation: pulsate 1.5s infinite alternate;
}

@keyframes pulsate {
  0% { opacity: 0.7; }
  100% { opacity: 1; }
}

/* Écran de fin de partie */
.game-over-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(5px);
}

.game-over-message {
  font-size: 40px;
  font-weight: bold;
  margin-bottom: 30px;
  text-align: center;
  color: #ffffff;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
  animation: glowText 2s infinite alternate;
  letter-spacing: 2px;
}

@keyframes glowText {
  0% { text-shadow: 0 0 10px rgba(255, 255, 255, 0.5); }
  100% { text-shadow: 0 0 25px rgba(255, 255, 255, 0.8), 0 0 40px rgba(82, 100, 174, 0.6); }
}

.restart-button {
  font-size: 20px;
  padding: 15px 40px;
  background: linear-gradient(135deg, #5264AE, #3a4a8c);
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 20px rgba(82, 100, 174, 0.5);
}

.restart-button:hover {
  background: linear-gradient(135deg, #7e8fd1, #5264AE);
  box-shadow: 0 0 30px rgba(82, 100, 174, 0.8);
}

/* Affichage du code du deck */
.deck-code-display {
  margin-top: 15px;
  text-align: center;
  padding: 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  gap: 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex-wrap: wrap;
  align-items: center;  
}

#deck-code-display {
  font-family: monospace;
  color: var(--ap-color);
  font-weight: bold;
  text-shadow: 0 0 5px rgba(255, 189, 105, 0.5);
  word-break: break-all;
  max-width: 100%;
}

#return-to-deck-builder {
  display: flex;
  justify-content: center;
  color: var(--text-color);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 5px;
  background: rgba(82, 100, 174, 0.3);
  transition: all 0.3s ease;
  max-width: 200px;
}

#return-to-deck-builder:hover {
  background: rgba(82, 100, 174, 0.5);
  color: white;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

#deck-key-input{
  padding: 10px;
  border-radius: 5px;
  width: 100%;
  max-width: 200px;
}

/* Deck builder */
.deck-builder-container {
  padding: 20px;
}

.deck-builder-container h1 {
  color: var(--text-color);
  text-align: center;
  margin-bottom: 20px;
  text-shadow: var(--text-shadow);
}

.card-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  margin: 0 auto;
  flex-wrap: wrap;
  max-height: 720px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--card-border) rgba(0, 0, 0, 0.2);
  padding: 1px;
}

.card-grid::-webkit-scrollbar {
  width: 8px;
}

.card-grid::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.card-grid::-webkit-scrollbar-thumb {
  background-color: var(--card-border);
  border-radius: 4px;
}

.deck-info {
  margin: 20px 0;
  padding: 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  text-align: center;
}

/* Classe spécifique pour les boutons dans le deck-builder-container */
.deck-builder-container .button-container {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.deck-builder-container a {
  background: linear-gradient(135deg, var(--button-color), rgba(65, 75, 140, 0.9));
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: var(--button-shadow);
  font-family: 'Exo 2', sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
  text-align: center;
  text-decoration: none;
}

.deck-builder-container a::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.7s ease;
}

.deck-builder-container a:hover {
  background: linear-gradient(135deg, var(--button-hover), rgba(95, 105, 180, 0.9));
  box-shadow: 0 0 15px var(--button-glow);
  transform: translateY(-2px);
}

.deck-builder-container a:hover::before {
  left: 100%;
}

.deck-builder-container a:active {
  transform: translateY(1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.deck-builder-container a:disabled {
  background: linear-gradient(135deg, #6b6b6b, #4a4a4a);
  cursor: not-allowed;
  box-shadow: none;
}

/* Styles spécifiques pour les boutons */
#save-deck-btn, #load-deck-btn, #return-to-deck-builder {
  max-width: 200px;
  width: 100%;
}

/* Classe spécifique pour les boutons dans le deck-builder-container */
.deck-builder-container .button-container {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.deck-builder-container a {
  background: linear-gradient(135deg, var(--button-color), rgba(65, 75, 140, 0.9));
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: var(--button-shadow);
  font-family: 'Exo 2', sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
  text-align: center;
  text-decoration: none;
}

.deck-builder-container a::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.7s ease;
}

.deck-builder-container a:hover {
  background: linear-gradient(135deg, var(--button-hover), rgba(95, 105, 180, 0.9));
  box-shadow: 0 0 15px var(--button-glow);
  transform: translateY(-2px);
}

.deck-builder-container a:hover::before {
  left: 100%;
}

.deck-builder-container a:active {
  transform: translateY(1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.deck-builder-container a:disabled {
  background: linear-gradient(135deg, #6b6b6b, #4a4a4a);
  cursor: not-allowed;
  box-shadow: none;
}

/* Styles spécifiques pour les boutons */
#save-deck-btn, #load-deck-btn, #return-to-deck-builder {
  max-width: 200px;
  width: 100%;
}

#deck-key-input {
  padding: 10px;
  border-radius: 5px;
  width: 100%;
  max-width: 200px;
}




/* Card Background Effects for different card types */


/* Common overlay for all cards to ensure text readability */
.card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.2));
  z-index: -1;
  pointer-events: none;
}

/* Attack Card Background */
.card[data-type="attack"] {
  background: var(--card-bg);
}

.card[data-type="attack"]::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 50% 130%, var(--attack-color) 0%, transparent 70%),
    linear-gradient(45deg, transparent 45%, rgba(255, 121, 198, 0.1) 50%, transparent 55%),
    linear-gradient(-45deg, transparent 45%, rgba(255, 121, 198, 0.1) 50%, transparent 55%),
    repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255, 121, 198, 0.05) 10px, rgba(255, 121, 198, 0.05) 20px);
  z-index: -2;
  opacity: 0.8;
  /*animation: attackPulse 3s infinite alternate;*/
  animation: attackShockwave 3s infinite;
}

@keyframes attackShockwave {
  0%, 100% {
    box-shadow: 0 0 0px 0px rgba(255, 0, 0, 0.8);
  }
  50% {
    box-shadow: 0 0 30px 15px rgba(255, 0, 0, 0.3);
  }
}


@keyframes attackPulse {
  0% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
  100% { opacity: 0.7; transform: scale(1); }
}

/* Defense Card Background */
.card[data-type="defense"] {
  background: var(--card-bg);
}

.card[data-type="defense"]::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 50% 120%, var(--defense-color) 0%, transparent 70%),
    radial-gradient(circle at 80% 20%, rgba(80, 250, 123, 0.2) 0%, transparent 40%),
    radial-gradient(circle at 20% 80%, rgba(80, 250, 123, 0.2) 0%, transparent 40%),
    repeating-conic-gradient(transparent 0%, transparent 5%, rgba(80, 250, 123, 0.08) 5%, transparent 10%);
  z-index: -2;
  opacity: 0.8;
  animation: defenseShield 4s infinite linear;
}

@keyframes defenseShield {
  0% { box-shadow: 0 0 10px rgba(80, 250, 123, 0.5); }
  50% { box-shadow: 0 0 20px rgba(80, 250, 123, 1); }
  100% { box-shadow: 0 0 10px rgba(80, 250, 123, 0.5); }
}

/* Debuff Card Background */
.card[data-type="debuff"] {
  position: relative;
  overflow: hidden;
  background: var(--card-bg);
}

.card[data-type="debuff"]::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(189, 147, 249, 0.5) 20%, transparent 70%);
  transform: translate(-50%, -50%) scale(0);
  border-radius: 50%;
  z-index: -2;
  opacity: 0.8;
  animation: debuffRipple 3s infinite;
}

@keyframes debuffRipple {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0.8;
  }
  50% {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0.5;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 0;
  }
}
/* Healing Card Background */
.card[data-type="healing"] {
  background: var(--card-bg);
}

.card[data-type="healing"]::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 50% 120%, var(--healing-color) 0%, transparent 70%),
    repeating-radial-gradient(circle at 50% 50%, transparent 0px, transparent 10px, rgba(80, 250, 123, 0.05) 11px, transparent 20px),
    linear-gradient(0deg, transparent 0%, rgba(80, 250, 123, 0.08) 50%, transparent 100%);
  z-index: -2;
  opacity: 0.9;
  animation: healingPulse 4s infinite alternate ease-in-out;
}

@keyframes healingPulse {
  0% { background-color: rgba(80, 250, 123, 0.5); }
  50% { background-color: rgba(80, 250, 123, 1); }
  100% { background-color: rgba(80, 250, 123, 0.5); }
}

/* Special Card Background */
.card[data-type="special"] {
  position: relative;
  overflow: hidden;
  border-radius: 15px;
  background: conic-gradient(
    from 0deg,
    #ff00803a,
    #ff8c003a,
    #fffd003a,
    #00ff8c3a,
    #008cff3a,
    #8c00ff3a,
    #ff00803a
  );
  background-size: 200% 200%;
  
}

@keyframes specialBackground {
  0% {
    background-position: 0% 0%;
  }
  100% {
    background-position: 100% 100%;
  }
}

/* HP (Health Points) Card Background */
.card[data-type="hp"] {
  background: var(--card-bg);
}

.card[data-type="hp"]::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 50% 50%, rgba(80, 250, 123, 0.15) 0%, transparent 70%),
    linear-gradient(0deg, transparent 47%, rgba(80, 250, 123, 0.1) 50%, transparent 53%),
    linear-gradient(90deg, transparent 47%, rgba(80, 250, 123, 0.1) 50%, transparent 53%),
    linear-gradient(45deg, transparent 45%, rgba(80, 250, 123, 0.05) 50%, transparent 55%),
    linear-gradient(-45deg, transparent 45%, rgba(80, 250, 123, 0.05) 50%, transparent 55%);
  z-index: -2;
  opacity: 0.8;
  animation: hpPulse 3s infinite ease-in-out;
}

@keyframes hpPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* AP (Action Points) Card Background */
.card[data-type="ap"] {
  background: var(--card-bg);
}

.card[data-type="ap"]::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 50% 120%, var(--ap-color) 0%, transparent 70%),
    repeating-linear-gradient(60deg, transparent, transparent 15px, rgba(255, 184, 108, 0.05) 15px, rgba(255, 184, 108, 0.05) 30px),
    radial-gradient(circle at 80% 30%, rgba(255, 184, 108, 0.1) 0%, transparent 40%);
  z-index: -2;
  opacity: 0.8;
  animation: apShimmer 4s infinite linear;
}

@keyframes apShimmer {
  0% { background-position: 0% 0%; }
  100% { background-position: 100% 100%; }
}



/* Votre CSS existant reste intact jusqu'à la fin, je vais ajouter les media queries ici */

/* Écrans moyens (tablettes, max-width: 768px) */
@media (max-width: 768px) {
  /* Conteneur principal */
  .game-container, .deck-builder-container {
    padding: 10px;
    max-width: 100%;
  }

  /* Zones de jeu */
  .player-area, .ai-area, .opponent-area {
    padding: 10px;
    margin-bottom: 10px;
  }

  /* Barre de statut */
  .status-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .hp, .ap {
    padding: 5px 10px;
    font-size: 14px;
  }

  /* Main de cartes */
  .cards-hand {
    gap: 10px;
    padding: 10px 0;
  }
/* Base card style modification to accommodate background effects */
  .card {
    position: relative;
    z-index: 1;
    overflow: hidden;
    width: 110px;
    height: 150px;
    min-width: 110px;
    font-size: 10px;
  }

  .card-name {
    font-size: 11px;
  }

  .card-description {
    font-size: 9px;
  }

  .card-cost {
    width: 24px;
    height: 24px;
    font-size: 14px;
  }

  .played-card {
    width: 60px;
    height: 85px;
    min-width: 60px;
    font-size: 8px;
  }

  /* Contrôles */
  .controls {
    gap: 10px;
  }

  #start-game-btn, #load-deck-btn, #save-deck-btn, #end-turn-btn, #find-match-btn {
    padding: 8px 15px;
    font-size: 14px;
    max-width: 120px;
  }

  /* Indicateur de tour */
  .turn-indicator {
    font-size: 16px;
    padding: 6px;
  }

  /* Deck builder */
  .card-grid {
    gap: 10px;
    max-height: 500px;
  }
  .status-bar {
    flex-direction: row; /* Reste en ligne mais avec wrapping */
    justify-content: flex-start;
    padding: 4px;
    margin-bottom: 8px;
    min-height: 35px;
  }

  .hp, .ap {
    padding: 3px 8px;
    font-size: 12px;
    gap: 3px;
  }

  .hp::before, .ap::before {
    width: 8px;
    height: 8px;
  }
}

/* Petits écrans (smartphones, max-width: 480px) */
@media (max-width: 480px) {
  /* Conteneur principal */
  .game-container, .deck-builder-container {
    padding: 5px;
  }

  /* Corps */
  body {
    font-size: 14px;
  }

  /* Zones de jeu */
  .player-area, .ai-area, .opponent-area {
    padding: 8px;
    margin-bottom: 8px;
  }

  /* Barre de statut */
  .status-bar {
    padding: 5px;
  }

  .hp, .ap {
    padding: 4px 8px;
    font-size: 12px;
  }

  .hp::before, .ap::before {
    width: 10px;
    height: 10px;
  }

  /* Main de cartes */
  .cards-hand {
    gap: 8px;
    padding: 8px 0;
    min-height: 140px;
  }

  .card {
    width: 90px;
    height: 120px;
    min-width: 90px;
    padding: 8px;
  }

  .card-header {
    margin-bottom: 5px;
  }

  .card-cost {
    width: 20px;
    height: 20px;
    font-size: 12px;
  }

  .card-type {
    font-size: 10px;
    padding: 2px 5px;
  }

  .card-name {
    font-size: 10px;
    margin: 5px 0;
  }

  .card-description {
    font-size: 8px;
    padding: 4px;
  }


  .played-card {
    width: 50px;
    height: 70px;
    min-width: 50px;
    padding: 4px;
  }

  .played-card .card-name {
    font-size: 7px;
  }

  /* Contrôles */
  .controls {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }

  #start-game-btn, #load-deck-btn, #save-deck-btn, #end-turn-btn ,#find-match-btn{
    padding: 6px 12px;
    font-size: 12px;
    max-width: 100px;
  }

  /* Indicateur de tour */
  .turn-indicator {
    font-size: 14px;
    padding: 5px;
  }

  /* Deck et indicateurs */
  .deck-pile {
    width: 35px;
    height: 50px;
    font-size: 14px;
  }

  .deck-pile::before {
    width: 35px;
    height: 50px;
    top: -3px;
    left: -3px;
  }

  .deck-pile::after {
    width: 35px;
    height: 50px;
    top: -6px;
    left: -6px;
  }

  .deck-count {
    font-size: 12px;
  }
  /* Écran de fin de partie */
  .game-over-message {
    font-size: 24px;
    margin-bottom: 20px;
  }

  .restart-button {
    font-size: 16px;
    padding: 10px 25px;
  }

  /* Deck builder */
  .deck-builder-container {
    padding: 10px;
  }

  .deck-builder-container h1 {
    font-size: 20px;
    margin-bottom: 15px;
  }

  .card-grid {
    gap: 8px;
    max-height: 400px;
  }

  .deck-info {
    margin: 15px 0;
    padding: 8px;
  }

  .deck-builder-container .button-container {
    gap: 10px;
  }

  #save-deck-btn, #load-deck-btn, #return-to-deck-builder {
    padding: 8px 15px;
    font-size: 12px;
    max-width: 150px;
  }

  #deck-key-input {
    padding: 8px;
    max-width: 150px;
  }
  .status-bar {
    padding: 3px;
    margin-bottom: 6px;
    gap: 6px;
    min-height: 30px;
  }

  .hp, .ap {
    padding: 2px 6px;
    font-size: 10px;
    gap: 2px;
  }

  .hp::before, .ap::before {
    width: 6px;
    height: 6px;
  }
}

/* Ajustement pour très petits écrans (max-width: 320px) */
@media (max-width: 320px) {
  .card {
    width: 80px;
    height: 100px;
    min-width: 80px;
  }

  .played-card {
    width: 45px;
    height: 60px;
    min-width: 45px;
  }

  #start-game-btn, #load-deck-btn, #save-deck-btn, #end-turn-btn {
    padding: 5px 10px;
    font-size: 10px;
    max-width: 90px;
  }
  .status-bar {
    padding: 2px;
    margin-bottom: 5px;
    gap: 4px;
    min-height: 25px;
  }

  .hp, .ap {
    padding: 2px 5px;
    font-size: 9px;
  }

  .hp::before, .ap::before {
    width: 5px;
    height: 5px;
  }
}
/* Ajoutez ces styles à votre fichier styles.css */

.log-toggle {
  cursor: pointer;
  font-size: 24px;
  margin-left: 10px;
  color: var(--text-color);
  transition: color 0.3s ease;
}

.log-toggle:hover {
  color: var(--button-hover);
}

.message-log {
  display: none; /* Masqué par défaut */
  position: absolute;
  top: 50px;
  right: 20px;
  width: 300px;
  height: 400px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 8px;
  padding: 12px;
  font-size: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
  scrollbar-width: thin;
  scrollbar-color: var(--card-border) rgba(0, 0, 0, 0.2);
  z-index: 1000;
}

.message-log .log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.close-log {
  cursor: pointer;
  font-size: 20px;
  color: var(--text-color);
  transition: color 0.3s ease;
}

.close-log:hover {
  color: var(--button-hover);
}

.active-turn {
  font-weight: bold;
  color: green;
}

.turn-indicator {
  margin-left: 10px;
  color: green;
  font-weight: bold;
}
/* Conteneur principal */
.game-container {
  display: flex;
  flex-direction: column;
  padding: 5px;
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  height: 100vh;
  overflow-y: hidden; /* Pas d’ascenseur global vertical */
  overflow-x: hidden;
}

/* Zones de jeu */
.player-area, .ai-area, .opponent-area {
  display: flex;
  flex-direction: column;
  padding: 5px;
  border-radius: 8px;
  backdrop-filter: blur(8px);
  transition: all 0.3s ease;
  flex: 1 1 auto;
  max-height: 33vh;
  overflow: hidden; /* Pas d’ascenseur dans les zones principales */
}

/* Barre de statut */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px;
  border-radius: 4px;
  background-color: rgba(0, 0, 0, 0.2);
  gap: 3px;
  flex-wrap: nowrap;
  min-height: 25px;
  max-height: 25px;
  overflow: hidden;
}

.hp, .ap {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}

.hp::before, .ap::before {
  width: 6px;
  height: 6px;
}

/* Main de cartes */
.cards-hand {
  display: flex;
  justify-content: center;
  gap: 1px;
  padding: 2px;
  height: 160px; /* Légère augmentation pour plus de texte */
  overflow-x: hidden;
  overflow-y: hidden; /* Pas d’ascenseur */
  flex-wrap: nowrap;
  width: 100%;
}

.card {
  width: 19.8vw; /* ~142px sur 720px, 5 cartes = 710px */
  height: 150px; /* Hauteur augmentée pour le texte */
  min-width: 65px;
  max-width: 145px;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden; /* Pas d’ascenseur dans la carte */
}

.card-header {
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  overflow: hidden;
}

.card-cost {
  width: 20px;
  height: 20px;
  font-size: 14px; /* Augmentation pour lisibilité */
  line-height: 20px;
}

.card-type {
  font-size: 10px; /* Augmentation */
  padding: 2px 5px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-name {
  font-size: 12px; /* Augmentation pour lisibilité */
  margin: 4px 0;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 28px; /* Légère augmentation */
}

.card-description {
  font-size: 10px; /* Augmentation pour lisibilité */
  padding: 4px;
  flex-grow: 1;
  line-height: 1.3;
  overflow: hidden; /* Pas d’ascenseur, texte coupé si trop long */
  text-overflow: ellipsis;
  max-height: 70px; /* Plus d’espace pour le texte */
}


.played-card {
  width: 13vw; /* ~93px sur 720px */
  height: 100px; /* Hauteur augmentée */
  min-width: 45px;
  max-width: 95px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.played-card .card-name {
  font-size: 8px; /* Augmentation */
  max-height: 24px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.played-card .card-description {
  font-size: 7px; /* Augmentation */
  max-height: 50px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Contrôles */
.controls {
  display: flex;
  justify-content: center;
  margin: 3px 0;
  gap: 5px;
  flex-wrap: wrap;
  max-height: 50px;
  overflow: hidden;
}

#start-game-btn, #load-deck-btn, #save-deck-btn, #end-turn-btn, #find-match-btn {
  padding: 4px 8px;
  font-size: 10px;
  max-width: 90px;
}

/* Indicateur de tour */
.turn-indicator {
  font-size: 12px;
  padding: 4px;
  margin: 3px 0;
  max-height: 25px;
  overflow: hidden;
}

/* Deck et indicateurs */
.deck-pile {
  width: 30px;
  height: 45px;
  font-size: 12px;
  overflow: hidden;
}

.deck-pile::before, .deck-pile::after {
  width: 30px;
  height: 45px;
}

.deck-count {
  font-size: 10px;
  overflow: hidden;
}

/* Effets (ajout d’ascenseur) */
.effects {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 50%;
  max-height: 50px; /* Limite la hauteur pour ne pas empiéter */
  overflow-y: auto; /* Ascenseur vertical activé */
  overflow-x: hidden;
  padding: 2px;
  scrollbar-width: thin; /* Ascenseur fin */
  scrollbar-color: var(--card-border) rgba(0, 0, 0, 0.2);
}

.effects::-webkit-scrollbar {
  width: 6px;
}

.effects::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.effects::-webkit-scrollbar-thumb {
  background-color: var(--card-border);
  border-radius: 3px;
}

.effect {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  color: white;
  font-weight: bold;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

/* Media queries ajustées */
@media (max-width: 768px) {
  .cards-hand {
    height: 150px;
  }

  .card {
    width: 19.6vw;
    height: 140px;
    min-width: 60px;
    max-width: 140px;
  }

  .card-cost {
    font-size: 13px;
  }

  .card-type {
    font-size: 9px;
  }

  .card-name {
    font-size: 11px;
  }

  .card-description {
    font-size: 9px;
    max-height: 65px;
  }

  .played-card {
    width: 12.8vw;
    height: 90px;
    min-width: 40px;
    max-width: 90px;
  }

  .played-card .card-name {
    font-size: 7px;
  }

  .played-card .card-description {
    font-size: 6px;
    max-height: 45px;
  }

  .effects {
    max-height: 45px;
  }
}

@media (max-width: 480px) {
  .cards-hand {
    height: 140px;
  }

  .card {
    width: 19.5vw;
    height: 130px;
    min-width: 55px;
    max-width: 135px;
  }

  .card-cost {
    font-size: 12px;
  }

  .card-type {
    font-size: 8px;
  }

  .card-name {
    font-size: 10px;
  }

  .card-description {
    font-size: 8px;
    max-height: 60px;
  }

 
  .played-card {
    width: 12.5vw;
    height: 85px;
    min-width: 35px;
    max-width: 85px;
  }

  .effects {
    max-height: 40px;
  }
}

@media (min-width: 1024px) { /* Optimisation pour PC */
  .game-container {
    max-width: 1200px;
    padding: 10px;
  }

  .player-area, .ai-area, .opponent-area {
    padding: 10px;
    max-height: 33vh;
  }

  .cards-hand {
    height: 200px;
  }

  .card {
    width: 220px;
    height: 190px;
    min-width: 200px;
    max-width: 240px;
    padding: 10px;
    font-size: 14px;
  }

  .card-cost {
    width: 30px;
    height: 30px;
    font-size: 18px;
    line-height: 30px;
  }

  .card-type {
    font-size: 12px;
    padding: 4px 8px;
  }

  .card-name {
    font-size: 16px;
    max-height: 40px;
  }

  .card-description {
    font-size: 12px;
    max-height: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
  }


  .played-card {
    width: 140px;
    height: 130px;
    min-width: 120px;
    max-width: 150px;
    padding: 6px;
    font-size: 10px;
  }

  .played-card .card-name {
    font-size: 10px;
    max-height: 30px;
  }

  .played-card .card-description {
    font-size: 8px;
    max-height: 70px;
  }

  .status-bar {
    padding: 5px;
    min-height: 35px;
    max-height: 35px;
  }

  .hp, .ap {
    padding: 4px 10px;
    font-size: 14px;
  }

  .hp::before, .ap::before {
    width: 10px;
    height: 10px;
  }

  .controls {
    gap: 10px;
    max-height: 50px;
  }

  .turn-indicator {
    font-size: 16px;
    padding: 6px;
    max-height: 30px;
  }

  .deck-pile {
    width: 50px;
    height: 70px;
    font-size: 16px;
  }

  .deck-pile::before, .deck-pile::after {
    width: 50px;
    height: 70px;
  }

  .deck-count {
    font-size: 14px;
  }

  .effects {
    max-height: 60px; /* Plus d’espace pour les effets sur PC */
  }
}
.action-log-container {
  position: absolute;
  top: 0;
  right: 0;
  width: 300px;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 10px;
  overflow-y: auto;
  display: none; /* Masqué par défaut */
  z-index: 1000;
}

.action-log-container h3 {
  text-align: center;
}

.log-entry {
  margin-bottom: 5px;
}

.card.unplayable {
  opacity: 0.5; /* Réduit l'opacité pour assombrir la carte */
  filter: grayscale(50%); /* Ajoute un effet de grisaille pour renforcer l'impression d'injouabilité */
  cursor: not-allowed; /* Change le curseur pour indiquer que la carte ne peut pas être jouée */
}
/* Exemple de CSS pour les effets visuels */
.card-effect {
  position: absolute;
  width: 50px;
  height: 50px;
  opacity: 0;
  animation: fadeInOut 1s ease-in-out;
}

.card-effect--attack {
  background-color: red;
}

.card-effect--defense {
  background-color: blue;
}

.card-effect--heal {
  background-color: green;
}

.card-effect--buff {
  background-color: yellow;
}

.card-effect--debuff {
  background-color: purple;
}

.card-effect--special {
  background-color: orange;
}

@keyframes fadeInOut {
  0%, 100% {
      opacity: 0;
  }
  50% {
      opacity: 1;
  }
}

/* Exemple de CSS pour les animations de PV */
.health-gain {
  color: green;
  animation: pulse 0.5s;
}

.health-loss {
  color: red;
  animation: pulse 0.5s;
}

@keyframes pulse {
  0%, 100% {
      transform: scale(1);
  }
  50% {
      transform: scale(1.1);
  }
}


.opponent-card {
  background: linear-gradient(to right, rgba(92, 36, 42, 0.4), rgba(60, 20, 25, 0.3));
  border: 1px solid rgba(232, 69, 96, 0.3);
}