/* static/monster.css (Version complète, nettoyée et mise à jour) */

/* ==========================================================================
   --- 1. Styles Globaux et Utilitaires ---
   ========================================================================== */
   html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #282c34;
    color: #eee;
}

*, *:before, *:after {
    box-sizing: inherit;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 10px;
}

/* ==========================================================================
   --- 2. Écrans d'Accueil et Overlays ---
   ========================================================================== */

/* --- Invite de Nom --- */
#name-prompt {
    background-color: #21252b;
    border: 1px solid #61dafb;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    text-align: center;
    z-index: 20;
    position: relative;
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}
#name-prompt.fading-out {
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none; 
}
#name-prompt h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #61dafb;
}
#name-prompt input[type="text"] {
    padding: 10px;
    margin-right: 10px;
    border: 1px solid #444;
    border-radius: 4px;
    min-width: 220px;
    background-color: #3a3f4a;
    color: #eee;
}
#name-prompt button {
    padding: 10px 20px;
    cursor: pointer;
    border: none;
    background-color: #61dafb;
    color: #282c34;
    border-radius: 4px;
    font-size: 1em;
    font-weight: bold;
    transition: background-color 0.2s ease, transform 0.1s ease-out; 
}
#name-prompt button:hover {
    background-color: #52c7e9;
}
#name-prompt button:active {
    background-color: #40a8c4; 
    transform: scale(0.98);   
}
#name-prompt button:disabled {
    background-color: #555;
    color: #999;
    cursor: not-allowed;
}
#join-error {
    margin-top: 15px;
    min-height: 1em;
    color: #ff6666;
    transition: color 0.3s ease;
}
#join-error.connecting {
    color: #61dafb; 
}

/* --- Overlay du Gagnant --- */
#winner-announcement-overlay {
    display: none; 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    justify-content: center; align-items: center;
    z-index: 1000; opacity: 0;
    transition: opacity 0.4s ease-in-out;
}
#winner-announcement-overlay.visible { opacity: 1; }
#winner-announcement-overlay.visible #winner-dialog-content { transform: scale(1); }
#winner-dialog-content {
    background-color: #2c3e50; 
    padding: 30px 50px; border-radius: 12px;
    text-align: center; color: white;
    box-shadow: 0 5px 25px rgba(0,0,0,0.7);
    transform: scale(0.7);
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55); 
    border: 2px solid #f1c40f; 
}
#winner-message-title {
    font-size: 2.8em; margin-top: 0; margin-bottom: 15px;
    color: #f1c40f; 
    text-shadow: 0 0 5px #f1c40f, 0 0 10px #f1c40f, 2px 2px 3px #000;
    font-weight: bold;
}
#winner-name-display {
    font-size: 1.6em; margin-bottom: 25px; color: #ecf0f1; 
}
#close-winner-button {
    padding: 12px 25px; font-size: 1.1em;
    background-color: #e74c3c; 
    color: white; border: none;
    border-radius: 5px; cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}
#close-winner-button:hover { background-color: #c0392b; transform: translateY(-1px); }
#close-winner-button:active { transform: translateY(1px); }

/* ==========================================================================
   --- 3. Fenêtres Modales ---
   ========================================================================== */

/* --- Styles Génériques --- */
.modal {
    position: fixed; 
    z-index: 100; 
    left: 0; top: 0;
    width: 100%; height: 100%; 
    overflow: auto;
    background-color: rgba(0,0,0,0.7); 
    display: flex; 
    align-items: center;
    justify-content: center;
    padding: 20px; 
}
.modal-content {
    background-color: #282c34; 
    padding: 20px;
    border: 1px solid #61dafb; 
    width: auto; 
    max-width: 600px; 
    border-radius: 8px; 
    text-align: center; 
    color: #eee;
    position: relative; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}
.modal-content .modal-close-button { 
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.8em;
    font-weight: bold;
    line-height: 1;
    color: #aaa;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}
.modal-content .modal-close-button:hover { color: #fff; }
.modal-content h3 {
    text-align: center;
    color: #61dafb;
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.5em;
}

/* --- Modale de Sélection de Forme --- */
.shape-selector {
    display: flex; 
    flex-wrap: wrap; 
    justify-content: center;
    gap: 15px; 
    margin-top: 20px; 
    padding: 10px;
    border: 1px solid #444; 
    border-radius: 4px; 
    min-height: 100px;
}
.shape-option {
    border: 2px solid #555; 
    padding: 8px; 
    cursor: pointer;
    min-width: 90px; 
    min-height: 90px; 
    display: flex; 
    flex-direction: column;
    justify-content: center; 
    align-items: center; 
    background-color: #3a3f4a;
    border-radius: 4px; 
    transition: all 0.2s ease;
}
.shape-option:hover { 
    border-color: #61dafb; 
    background-color: #4a4f5a; 
    transform: scale(1.05); 
}
.shape-option div { 
    font-size: 0.8em; 
    margin-bottom: 5px; 
}
.shape-preview-grid { 
    display: grid; 
    border: 1px solid #666; 
    margin: auto; 
}
.preview-cell { 
    width: 12px; 
    height: 12px; 
    border: 1px solid #444; 
    background-color: #555; 
}
.preview-cell.filled { 
    background-color: #61dafb; 
    border-color: #52c7e9; 
}

/* --- Modale d'Information du Monstre --- */
.monster-info-content {
    max-width: 500px; 
    text-align: left;
    padding: 25px;
}
.info-modal-details {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}
.info-modal-image-container {
    flex: 0 0 150px; 
    display: flex;
    justify-content: center;
    align-items: center;
}
#info-modal-card-image {
    max-width: 100%;
    max-height: 220px; 
    border-radius: 8px;
    border: 1px solid #444;
    background-color: #222; 
}
.info-modal-stats { flex-grow: 1; }
.info-modal-stats p {
    margin: 8px 0;
    font-size: 0.95em;
    line-height: 1.4;
}
.info-modal-stats p strong { color: #88ddff; }
.info-modal-description-text {
    font-size: 0.85em !important; 
    color: #ccc;
    background-color: rgba(0,0,0,0.15);
    padding: 8px;
    border-radius: 4px;
    min-height: 50px;
    border-left: 3px solid #61dafb;
}

/* --- Modale de Réaction Défensive --- */
.defense-reaction-content {
    max-width: 450px;
    text-align: center;
    padding: 25px; 
    background-color: #3a3f4a;
    border: 2px solid #ffc107; 
}
.defense-reaction-content h3 {
    color: #ffc107; 
    margin-top: 0;
    font-size: 1.4em;
    margin-bottom: 15px;
}
#reaction-modal-description {
    font-size: 0.95em;
    margin-bottom: 15px;
    line-height: 1.5;
    color: #f0f0f0; 
}
#reaction-modal-card-name-container {
    margin-bottom: 15px;
    font-size: 0.9em;
    color: #ddd;
}
#reaction-modal-card-name-container strong {
    color: #61dafb; 
    font-weight: bold;
}
#reaction-modal-timer {
    font-size: 1em; 
    color: #ffdd57; 
    font-weight: bold;
    margin-bottom: 20px;
}
.reaction-modal-buttons {
    display: flex;
    justify-content: space-around; 
    margin-top: 20px;
}
.reaction-modal-buttons button {
    min-width: 120px; 
    padding: 10px 15px;
}

/* --- Modale d'Invocation Spéciale --- */
#special-summon-card-container {
    max-height: 70vh;
    overflow-y: auto;
    padding: 10px;
}
.summon-target-graveyard-section {
    margin-bottom: 20px;
}
.summon-target-graveyard-section h4 {
    text-align: left;
    color: #61dafb;
    border-bottom: 1px solid #444;
    padding-bottom: 5px;
    margin-bottom: 10px;
}
.summon-target-card-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-start;
}
.summon-target-card-list .graveyard-card-item {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.summon-target-card-list .graveyard-card-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 10px #61dafb;
}

/* ==========================================================================
   --- 4. Layout et UI du Jeu Principal ---
   ========================================================================== */

/* --- Layout Général --- */
.main-wrapper {
    display: flex; 
    flex-wrap: wrap; 
    justify-content: center; 
    align-items: flex-start;
    width: 100%; 
    max-width: 1500px; 
    gap: 20px;
}
.game-area { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
}
#playerInfo {
    font-weight: bold; 
    margin-bottom: 5px; 
    color: #eee;
    min-height: 20px; 
    text-align: center; 
    width: 100%; 
    font-size: 0.9em;
}
#turn-display {
    width: 100%; 
    text-align: center; 
    margin-bottom: 10px;
    font-size: 1.1em; 
    color: #eee; 
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}
#turn-counter {
    display: inline-block; 
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.8em; 
    font-weight: bold; 
    color: #FF4433; 
    background-color: #1a0000;
    padding: 2px 10px; 
    border-radius: 5px; 
    border: 1px solid #440000;
    min-width: 40px; 
    text-align: center;
    text-shadow: 0 0 5px #FF4433, 0 0 8px #FF4433;
}
.hp-display {
    position: fixed;
    background-color: rgba(40, 44, 52, 0.9);
    color: white;
    padding: 8px 15px;
    border-radius: 8px;
    border: 1px solid #61dafb;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    font-size: 1em;
    z-index: 10;
    min-width: 180px;
}
#player1-hp-display { top: 10px; left: 10px; }
#player2-hp-display { top: 10px; right: 10px; }
.hp-display .hp-name { font-weight: bold; color: #ccc; }
.hp-display .hp-value { font-weight: bold; font-size: 1.1em; color: #61dafb; margin-left: 5px; }
#unit-tooltip {
    display: none; 
    position: absolute;
    background-color: rgba(40, 44, 52, 0.9); 
    border: 1px solid #61dafb; 
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    z-index: 1001; 
    pointer-events: none; 
    font-size: 0.85em;
    white-space: nowrap; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: opacity 0.1s ease-in-out; 
}
#tooltip-name {
    display: block;
    margin-bottom: 4px;
    color: #61dafb; 
    font-weight: bold;
}

/* --- Plateau de Jeu et Cases --- */
#game-board {
    width: 77vmin; 
    height: 70vmin;
    max-width: 715px; 
    max-height: 650px;
    min-width: 330px; 
    min-height: 300px;
    border: 3px solid #666;
    position: relative;
    background-color: #555;
    background-image: url("/static/stade.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 5px 5px 15px rgba(0,0,0,0.3);
    display: grid;
    grid-template-columns: repeat(11, 1fr);
    grid-template-rows: repeat(10, 1fr);
}
.cell {
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-sizing: border-box; 
    display: flex; 
    justify-content: center; 
    align-items: center;
    overflow: hidden; 
    position: relative; 
    cursor: default;
    background-clip: padding-box; 
    transition: background-color 0.2s ease;
}
@keyframes phosphorescent-pulse {
    0% {
      box-shadow: inset 0 0 8px 2px rgba(255, 255, 255, 0.4);
    }
    50% {
      box-shadow: inset 0 0 16px 4px rgba(255, 255, 255, 0.7);
    }
    100% {
      box-shadow: inset 0 0 8px 2px rgba(255, 255, 255, 0.4);
    }
  }
  
  
  /* --- Style du Joueur 1 (Rouge Sombre) --- */
  .cell.support-player1 {
      /* CHANGEMENT: Utilisation de 'darkred' directement pour le fond */
      background-color: darkred; 
  
      /* Bordure et lueur basées sur la couleur "darkred" */
      border: 1px solid rgba(139, 0, 0, 0.8);
      box-shadow: inset 0 0 8px 2px rgba(220, 53, 69, 0.7);
  
      /* Animation de pulsation */
      animation: phosphorescent-pulse 3.2s infinite ease-in-out;
      position: relative;
  }
  
  
  /* --- Style du Joueur 2 (Bleu Sombre) --- */
  .cell.support-player2 {
      /* CHANGEMENT: Utilisation de 'darkblue' directement pour le fond */
      background-color: darkblue;
  
      /* Bordure et lueur basées sur la couleur "darkblue" */
      border: 1px solid rgba(0, 0, 139, 0.8);
      box-shadow: inset 0 0 8px 2px rgba(0, 116, 217, 0.7);
      
      /* Animation de pulsation */
      animation: phosphorescent-pulse 3s infinite ease-in-out;
      position: relative;
  }

/* --- Surlignages de Cases --- */
/*
==========================================================================
--- AMÉLIORATION VISUELLE : ANCRE DE PLACEMENT VALIDE ---
==========================================================================
*/

/* L'animation qui fera pulser la lueur de la case */
@keyframes pulse-placement-anchor {
    0% {
      border-color: rgba(0, 174, 255, 0.6); /* Bleu semi-transparent */
      box-shadow: inset 0 0 15px rgba(0, 174, 255, 0.2);
    }
    50% {
      border-color: rgba(255, 255, 255, 1); /* Blanc pur pour l'effet "flash" */
      box-shadow: inset 0 0 25px rgba(0, 174, 255, 0.7);
    }
    100% {
      border-color: rgba(0, 174, 255, 0.6);
      box-shadow: inset 0 0 15px rgba(0, 174, 255, 0.2);
    }
  }
  
  /* Le nouveau style pour la case d'ancre de placement */
  .cell.valid-placement-anchor {
    /* On retire les anciens styles 'background-color' et 'outline' criards */
    
    /* Un fond bleuté très subtil et transparent */
    background-color: rgba(0, 174, 255, 0.1);
  
    /* Une bordure pointillée qui suggère une "zone de construction" */
    border: 2px dashed rgba(0, 174, 255, 0.6);
    
    /* Une lueur intérieure pour donner de la profondeur */
    box-shadow: inset 0 0 15px rgba(0, 174, 255, 0.2);
  
    cursor: pointer; /* Indique au joueur qu'il peut cliquer */
    z-index: 100;    /* On garde la case au-dessus des autres */
    
    /* On applique notre nouvelle animation ! */
    animation: pulse-placement-anchor 2s infinite ease-in-out;
  }
  
.cell.placement-preview {
    background-color: rgba(97, 218, 251, 0.4); 
    outline: 1px dashed #61dafb;
    outline-offset: -1px; 
    z-index: 1;
}
.cell.valid-move-target {
    cursor: pointer; 
    background-color: rgba(255, 235, 59, 0.3);
    outline: 2px dashed gold; 
    outline-offset: -2px; 
    z-index: 1;
}
.cell.valid-attack-target {
  cursor: crosshair; 
  outline: 3px solid red; 
  background-color: rgba(255, 0, 0, 0.3);
  outline-offset: -3px; 
  z-index: 1;
}
.cell.valid-destruction-target {
    cursor: crosshair !important;
    outline: 3px solid #ff00ff !important; /* Un contour magenta bien visible */
    background-color: rgba(255, 0, 255, 0.25) !important;
    outline-offset: -3px;
    z-index: 10;
}
.cell.tunnel-source-candidate {
    cursor: pointer;
    outline: 3px dashed #ff4500; 
}
.cell.tunnel-destination-candidate {
    cursor: pointer;
    background-color: rgba(255, 69, 0, 0.3); 
    outline: 2px solid #ff4500;
}
.cell.valid-effect-target {
    cursor: pointer;
    background-color: rgba(255, 193, 7, 0.3);
    outline: 3px dashed #ffc107;
    outline-offset: -3px;
}

/* --- Entités sur le Plateau --- */
.entity-container {
    display: flex; 
    justify-content: center;
    align-items: center;
    width: 100%; 
    height: 100%; 
    position: relative; 
}
.cell .entity, .cell img.entity-sprite { 
    z-index: 2; 
    pointer-events: none; 
    max-width: 100%; 
    max-height: 100%;
    object-fit: contain; 
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges; 
    image-rendering: crisp-edges;
    border-radius: 5px; 
}
.entity.king { 
    width: 90%; 
    height: 90%;
    background-size: contain;    
    background-repeat: no-repeat; 
    background-position: center;  
}
.entity.king.my-king { background-image: url('/static/uti.png'); } 
.entity.king.opponent-king { background-image: url('/static/ia.png'); }

/* --- États des Entités --- */
.entity-container.selected-unit { 
    outline: 3px solid gold !important; 
    box-shadow: 0 0 8px gold; 
}
.entity-container.selected-unit > .entity,
.entity-container.selected-unit > img.entity-sprite {
    filter: brightness(1.3) drop-shadow(0 0 4px gold);
}
img.entity-sprite.valid-attack-target-sprite,
.entity.king.valid-attack-target-sprite { 
    filter: drop-shadow(0 0 6px red) brightness(1.1);
}
.cell.valid-destruction-target img.entity-sprite { 
    filter: drop-shadow(0 0 5px #FF00FF) opacity(0.7); 
}
img.entity-sprite.tunnel-source-candidate {
    filter: drop-shadow(0 0 5px #ff4500);
}
img.entity-sprite.selected-for-tunnel { 
    outline: 4px solid #ff0000 !important; 
    box-shadow: 0 0 10px 3px #ff0000;
    filter: brightness(1.2);
}

.entity-container img.entity-sprite.mode-attack { animation: pulse-red 2s infinite ease-in-out; }
.entity-container img.entity-sprite.mode-defense { animation: pulse-blue 2s infinite ease-in-out; }

/* ==========================================================================
   --- 5. Zone de Contrôles Droite ---
   ========================================================================== */

.controls-area {
    display: flex; 
    flex-direction: column; 
    width: 320px;
    min-height: 500px; 
    justify-content: flex-start;
    padding-right: 5px;
}
#opponent-hand-display {
    text-align: center; 
    padding: 5px; 
    margin-bottom: 10px; 
    color: #ccc;
    background-color: rgba(255,255,255,0.05); 
    border-radius: 4px;
    font-size: 0.9em; 
    order: 1; 
    flex-shrink: 0;
}
#action-point-menu {
    order: 1; 
    text-align: center; 
    background-color: #1f232a; 
    color: white;
    padding: 8px; 
    margin-bottom: 10px; 
    border-radius: 5px;
    display: flex; 
    justify-content: space-around;
    align-items: center;
    font-weight: bold;
    border: 1px solid #444; 
    flex-shrink: 0;
}
#action-point-menu > span {
    display: flex;
    align-items: center;
    gap: 5px;
}
#action-point-menu span span {
    background-color: #ddd; 
    color: #1f232a; 
    padding: 2px 8px;
    border-radius: 10px; 
    margin-left: 5px; 
    min-width: 30px;
    display: inline-block; 
    text-align: center; 
    font-size: 0.9em;
}
#action-point-menu span #secret-guard-status.status-active {
    color: #28a745;
    background-color: #d4edda;
    font-weight: bold;
}
#action-point-menu span #secret-guard-status.status-inactive {
    color: #721c24;
    background-color: #f8d7da;
}
#action-point-menu #graveyard-pile-icon {
    width: 24px;
    height: 24px;
    background-image: url('/static/graveyard_icon.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    cursor: pointer;
    border: 1px solid #444;
    border-radius: 4px;
}
#action-point-menu #graveyard-pile-icon:hover {
    border-color: #61dafb;
    box-shadow: 0 0 5px rgba(97, 218, 251, 0.3);
}
#action-point-menu #graveyard-count-display {
    font-size: 0.9em;
    font-weight: bold;
    color: #ccc;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 2px 6px;
    border-radius: 8px;
    min-width: 18px;
    text-align: center;
    line-height: 1;
}
.deck-discard-area {
    display: flex;
    justify-content: space-around; 
    align-items: center;
    margin-bottom: 15px; 
    min-height: 100px; 
    order: 2; 
    flex-shrink: 0;
}
#deck-pile {
    position: relative; 
    width: 70px; 
    height: 100px; 
    cursor: pointer;
    border: 1px solid #666; 
    border-radius: 5px;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.4); 
    overflow: hidden;
    background-color: #555;
}
#deck-pile img { 
    display: block; 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
}
#deck-pile:hover { 
    box-shadow: 0 0 10px rgba(97, 218, 251, 0.7); 
    border-color: #61dafb; 
}
#deck-count {
    position: absolute; 
    bottom: 3px; right: 5px; 
    background-color: rgba(0, 0, 0, 0.8);
    color: white; 
    font-size: 0.9em; 
    font-weight: bold;
    padding: 1px 5px; 
    border-radius: 3px; 
    pointer-events: none;
}

#player-hand {
    border: 1px solid #444;
    min-height: 340px;
    max-height: 350px;
    background-color: rgba(40, 44, 52, 0.7);
    margin-bottom: 10px; 
    padding: 10px; 
    display: flex; 
    flex-wrap: wrap;
    gap: 10px; 
    justify-content: center; 
    align-content: flex-start;
    order: 3; 
    border-radius: 4px; 
    flex-grow: 1;
    overflow-y: auto; 
}

/* --- Barre d'actions et Boutons --- */
#placement-controls { 
    order: 6; display: none; 
    justify-content: space-around; margin-top: 10px; flex-shrink: 0;
}
#placement-mode-selection {
    display: flex; align-items: center; gap: 15px;
    background-color: rgba(0,0,0,0.2);
    padding: 5px 10px; border-radius: 5px;
}
#placement-mode-selection label {
    cursor: pointer; display: flex;
    align-items: center; gap: 5px; font-weight: bold;
}
.placement-button { padding: 8px 12px; border: none; border-radius: 4px; cursor: pointer; font-weight: bold; margin: 0 5px; transition: background-color 0.2s ease; }
.placement-button.validate { background-color: #28a745; color: white; }
.placement-button.validate:hover:not(:disabled) { background-color: #218838; }
.placement-button.cancel { background-color: #dc3545; color: white; }
.placement-button.cancel:hover { background-color: #c82333; }
.placement-button.rotate { background-color: #ffc107; color: #282c34; }
.placement-button.rotate:hover { background-color: #e0a800; }
.placement-button:disabled { background-color: #555; color: #999; cursor: not-allowed; }

#selected-unit-actions-toolbar {
    order: 5; 
    display: none; 
    flex-direction: column; align-items: stretch; 
    margin-top: 10px; padding: 10px; border: 1px solid #555;
    background-color: #3a3f4a; border-radius: 4px; flex-shrink: 0;
}
#selected-unit-actions-toolbar h4 { margin: 0 0 8px 0; font-size: 0.9em; color: #ccc; text-align: center; }
#selected-unit-actions-toolbar button { 
    margin: 5px 0; padding: 8px 12px; cursor: pointer;
    border: none; border-radius: 4px; font-weight: bold;
    transition: background-color 0.2s ease;
}
#change-mode-button { background-color: #6f42c1; color: white; }
#change-mode-button:hover:not(:disabled) { background-color: #5a32a2; }
#selected-unit-actions-toolbar button#view-unit-info-button { background-color: #17a2b8; color: white; }
#selected-unit-actions-toolbar button#view-unit-info-button:hover:not(:disabled) { background-color: #138496; }
#selected-unit-actions-toolbar button#activate-effect-button { background-color: #ffc107; color: #21252b; }
#selected-unit-actions-toolbar button#activate-effect-button:hover:not(:disabled) { background-color: #e0a800; }
#selected-unit-actions-toolbar button:disabled { background-color: #555; color: #999; cursor: not-allowed; }

#actionButton { 
    padding: 12px 15px; cursor: pointer; border: none; background-color: #007bff; 
    color: white; font-size: 1em; border-radius: 4px; transition: background-color 0.2s ease; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.2); margin-top: 10px; order: 7; width: 100%; 
    flex-shrink: 0;
}
#actionButton:hover:not(:disabled) { background-color: #0069d9; }
#actionButton:disabled { background-color: #555; color: #aaa; cursor: not-allowed; box-shadow: none; }

/* --- Zone de Messages --- */
#messages { 
    height: 150px; list-style-type: none; padding: 0; margin: 0 0 10px 0; 
    border: 1px solid #444; overflow-y: scroll; background-color: #21252b; 
    min-height: 100px; box-shadow: inset 0 0 5px rgba(0,0,0,0.1); order: 4; 
    border-radius: 4px; flex-shrink: 0;
}
#messages li { padding: 6px 10px; border-bottom: 1px solid #333; font-size: 0.9em; word-wrap: break-word; color: #ccc;}
#messages li:last-child { border-bottom: none; }
.message-wait { color: #ffc107; font-style: italic;} 
.message-info { color: #61dafb; }
.message-error { color: #ff6b6b; font-weight: bold; }

/* ==========================================================================
   --- 6. Design des Cartes en Main ---
   ========================================================================== */
.card-template {
    width: 90px;
    height: 160px;
    border-radius: 8px;
    color: white;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-family: 'Segoe UI', sans-serif;
    animation: pulse-glow 4s infinite ease-in-out;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}
.card-template:hover {
    transform: translateY(-5px) scale(1.05);
}
.card-template.selected {
    box-shadow: 0 0 12px 4px #00ffff !important;
    border-color: #00ffff !important;
    transform: translateY(-3px) scale(1.02);
}
.design-reflechissant::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 35%);
    transform: rotate(15deg);
    z-index: 1;
}

/* Couleurs par Type */
.card-type-monstre { background-color: #2c2c2c; }
.card-type-magie { background-color: #4a235a; }
.card-type-piege { background-color: #8B4513; }
.card-type-activation { background-color: #e67e22; }

/* Bordures par Niveau */
.card-level-1 { border: 3px solid #CD7F32; } /* Bronze */
.card-level-2 { border: 3px solid #C0C0C0; } /* Argent */
.card-level-3 { border: 3px solid #FFD700; } /* Or */
.card-level-4 { border: 3px solid #b9f2ff; } /* Légendaire */

/* Structure Interne de la Carte */
.card-template .card-content {
    padding: 5px;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    text-align: center;
}
.card-template .card-title {
    font-size: 0.8em;
    font-weight: bold;
    text-shadow: 1px 1px 2px black;
    min-height: 2.5em;
    display: flex;
    align-items: center;
    justify-content: center;
}
.card-template .card-image {
    height: 60px;
    background-color: rgba(0,0,0,0.3);
    margin: 4px 0;
    border-top: 1px solid rgba(255,255,255,0.2);
    border-bottom: 1px solid rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
}
.card-template .card-image img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}
.card-template .card-description {
    font-size: 0.7em;
    background-color: rgba(0,0,0,0.2);
    padding: 4px;
    flex-grow: 1;
    border-radius: 3px;
    overflow: hidden;
}

/* ==========================================================================
   --- 7. Animations (@keyframes) ---
   ========================================================================== */

@keyframes pulse-glow {
    0% { box-shadow: 0 0 4px 1px rgba(220, 220, 220, 0.2); }
    50% { box-shadow: 0 0 8px 2px rgba(220, 220, 220, 0.6); }
    100% { box-shadow: 0 0 4px 1px rgba(220, 220, 220, 0.2); }
}

@keyframes pulse-red { 
    0%{box-shadow:0 0 6px 2px rgba(255,50,50,0.7)} 
    50%{box-shadow:0 0 12px 4px rgba(255,50,50,0.4)} 
    100%{box-shadow:0 0 6px 2px rgba(255,50,50,0.7)} 
}
@keyframes pulse-blue { 
    0%{box-shadow:0 0 6px 2px rgba(50,50,255,0.7)} 
    50%{box-shadow:0 0 12px 4px rgba(50,50,255,0.4)} 
    100%{box-shadow:0 0 6px 2px rgba(50,50,255,0.7)} 
}

@keyframes shake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-4px); }
    40%, 60% { transform: translateX(4px); }
}
.shake-animation {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

/* --- Animations Tunnel Express (Version Améliorée) --- */
@keyframes unit-tunneling-out {
    from { transform: scale(1.1) rotate(0deg); opacity: 1; }
    to { transform: scale(0) rotate(-180deg); opacity: 0; }
}
.unit-tunneling-out {
    animation: unit-tunneling-out 1s ease-in forwards;
}

@keyframes unit-tunneling-in {
    from { transform: scale(0) translateY(60%); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}
.unit-tunneling-in {
    animation: unit-tunneling-in 1s ease-out forwards;
}

@keyframes cell-tunnel-effect {
    0% { background-color: rgba(20, 10, 30, 0); }
    50% { background-color: rgba(20, 10, 30, 0.8); box-shadow: inset 0 0 15px #000; }
    100% { background-color: rgba(20, 10, 30, 0); }
}
.cell-tunnel-active {
    animation: cell-tunnel-effect 2s ease-in-out;
}

/* ==========================================================================
   --- 8. Styles Responsives ---
   ========================================================================== */
@media (max-width: 768px) {
    body {
        height: auto;
    }
    .main-wrapper {
        margin-top: 15%;
        flex-direction: column;
        align-items: center;
    }
    .controls-area {
        width: 95%;
        max-width: 400px;
    }
    #player-hand {
        min-height: 0;
        max-height: 200px;
    }
    .card-template {
        height: 120px;
        width: 75px;
        font-size: 0.8em;
    }
    .card-template .card-title { font-size: 0.8em; }
    .card-template .card-image { height: 50px; }
    .card-template .card-description { font-size: 0.6em; }
    
    #action-point-menu {
        flex-wrap: wrap;
        font-size: 0.9em;
    }
    #action-point-menu > span {
        margin-bottom: 5px;
    }
    #messages {
        height: 100px;
        font-size: 0.8em;
    }
        /* --- VOS AJOUTS --- */

    /* Pour que la zone de jeu prenne toute la largeur sur mobile */
    .game-area {
        width: 100%;
    }

    /* Pour rendre l'indicateur de mode (A/D) plus petit sur mobile */
    .mode-indicator {
        width: 10px;
        height: 10px;
        font-size: 9px;
    }
    #game-board {
        width: 100%;
        height: 100%;
    }
    /* NOUVELLE RÈGLE POUR LA BARRE D'OUTILS FLOTTANTE */
    #selected-unit-actions-toolbar {
        position: absolute; /* Permet de la positionner librement */
        z-index: 100;       /* S'assure qu'elle est au-dessus des autres éléments */
        border-radius: 6px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.5); /* Ajoute de la profondeur */
        border: 1px solid #61dafb;
        width: auto; /* La largeur s'adapte au contenu */
        
        /* On retire la marge pour un meilleur contrôle du positionnement */
        margin-top: 0; 
    }
    /* DANS monster.css, à l'intérieur de @media (max-width: 768px) */

    /* On transforme la barre de contrôle principale en colonne sur mobile */
    #placement-controls {
        flex-direction: column; /* Empile tous les groupes de boutons verticalement */
        gap: 15px; /* Ajoute de l'espace entre les groupes de boutons */
        width: auto; /* La largeur s'adapte au contenu */
        padding: 15px;
    }

    /* On empile les labels "Attaque" et "Défense" comme vous le souhaitiez */
    #placement-mode-selection {
        flex-direction: column;
        align-items: flex-start; /* On aligne à gauche pour un look plus propre */
        width: 100%;
        gap: 10px; /* Espace entre "Attaque" et "Défense" */
    }

    /* On ajuste la taille de la police des labels comme demandé */
    #placement-mode-selection label {
        font-size: 10px; /* 10px était un peu petit, 14px sera plus lisible et facile à cliquer */
    }

    /* On peut aussi regrouper les boutons de rotation */
    .rotation-buttons {
        display: flex;
        justify-content: center;
        gap: 10px;
        width: 100%;
    }
    /* DANS monster.css, à ajouter AVANT la section @media */
}

/* DANS monster.css, à ajouter à la fin du fichier */

/* ==========================================================================
   --- 9. Styles des Cartes dans les Modales (Cimetière / Invoc. Spé.) ---
   ========================================================================== */

/* Conteneurs pour s'assurer que les cartes s'alignent bien en grille */
#graveyard-modal-cards-container,
.summon-target-card-list {
    display: flex;
    flex-wrap: wrap;
    gap: 15px; /* Espace entre les cartes */
    justify-content: center; /* Centrer les cartes dans le conteneur */
    padding-top: 10px;
}

/* Style principal pour une carte dans une modale */
.modal-card-item {
    width: 110px;  /* Un peu plus grand qu'une carte en main */
    height: 190px;
    border: 2px solid #888;
    border-radius: 8px;
    background-color: #2c3e50;
    color: white;
    display: flex;
    flex-direction: column;
    font-family: 'Segoe UI', sans-serif;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden; /* Empêche le contenu de déborder */
}

.modal-card-item:hover {
    transform: scale(1.05);
    border-color: #61dafb;
    box-shadow: 0 0 10px #61dafb;
}

/* Titre de la carte */
.modal-card-item .card-title {
    font-size: 0.8em;
    font-weight: bold;
    text-align: center;
    padding: 5px;
    background-color: rgba(0,0,0,0.3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Ajoute "..." si le nom est trop long */
}
.modal-card-item .card-title span {
    font-size: 0.9em;
    color: #ccc;
}

/* Image de la carte */
.modal-card-item .card-image-area {
    height: 100px; /* Zone d'image plus grande */
    background-size: cover;
    background-position: center;
    border-top: 1px solid #444;
    border-bottom: 1px solid #444;
}

/* Stats de la carte */
.modal-card-item .card-stats {
    font-size: 0.75em;
    font-weight: bold;
    text-align: center;
    padding: 4px;
    background-color: rgba(0,0,0,0.3);
    display: flex;
    justify-content: space-around;
    margin-top: auto; /* Pousse les stats vers le bas */
}

/* Nouveaux styles pour la modale de prévisualisation de carte */
#card-preview-modal .modal-content {
    max-width: 350px; /* Ajustez selon la taille souhaitée pour la carte agrandie */
    text-align: center;
}
#preview-modal-card-display {
    width: 220px; /* Taille de la carte prévisualisée */
    height: 380px; /* Proportionnelle à une carte de jeu */
    margin: 0 auto 15px auto;
    background-color: #282c34;
    border: 2px solid #61dafb;
    border-radius: 12px;
    color: #eee;
    display: flex;
    flex-direction: column;
    padding: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    overflow: hidden;
}
#preview-modal-card-display .card-header { padding: 8px; background: rgba(0,0,0,0.5); border-bottom: 1px solid #444;}
#preview-modal-card-display .card-name { font-size: 1.1em; font-weight: bold; }
#preview-modal-card-display .card-name span { font-size: 0.9em; color: #ccc; } /* Pour le niveau */

#preview-modal-card-display .card-image-area {
    height: 180px; /* Plus grande zone d'image */
    background-size: cover;
    background-position: center;
    border-bottom: 1px solid #444;
    border-top: 1px solid #444;
    background-color: #111;
    display: flex;
    align-items: center;
    justify-content: center;
}
#preview-modal-card-display .card-unit-sprite { max-width: 90%; max-height: 90%; object-fit: contain; }

#preview-modal-card-display .card-description-box { padding: 8px; font-size: 0.85em; flex-grow: 1; overflow-y: auto; background-color: rgba(0,0,0,0.1); line-height: 1.4;}
#preview-modal-card-display .card-type-text { font-style: italic; color: #aaa; margin: 0 0 5px 0; text-align: center; }
#preview-modal-card-display .card-description-text { color: #ccc; margin: 0; }

#preview-modal-card-display .card-stats-bar { padding: 6px; background: rgba(0,0,0,0.5); font-size: 0.9em; font-weight: bold; display: flex; justify-content: space-around; border-top: 1px solid #444;}
#preview-modal-card-display .card-stats-bar .card-atk,
#preview-modal-card-display .card-stats-bar .card-def { color: #fff; }
#preview-modal-card-display .card-stats-bar .card-ap-mp-value { color: #61dafb; text-align: center; width: 100%; }

#card-preview-modal-actions button {
    margin: 5px;
    padding: 10px 15px;
}

@keyframes summon-animation {
    from {
        opacity: 0;
        transform: scale(0.5) rotate(-15deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.unit-summoned {
    /* Applique l'animation à l'élément */
    animation: summon-animation 1s ease-out; /* On change 0.4s en 1s */

}
/* ==========================================================================
   --- Styles Thème Galaxie et Animations des Supports ---
   ========================================================================== */

/* Animation phosphorescente pour les supports (les @keyframes sont conservés pour la définition du box-shadow statique, mais l'animation ne sera plus appliquée) */
@keyframes glow-white {
    0% { box-shadow: 0 0 5px rgba(255, 255, 255, 0.4), inset 0 0 5px rgba(255, 255, 255, 0.4); }
    50% { box-shadow: 0 0 15px rgba(255, 255, 255, 0.8), inset 0 0 15px rgba(255, 255, 255, 0.8); }
    100% { box-shadow: 0 0 5px rgba(255, 255, 255, 0.4), inset 0 0 5px rgba(255, 255, 255, 0.4); }
}

@keyframes glow-gold {
    0% { box-shadow: 0 0 5px rgba(255, 215, 0, 0.4), inset 0 0 5px rgba(255, 215, 0, 0.4); }
    50% { box-shadow: 0 0 15px rgba(255, 215, 0, 0.8), inset 0 0 15px rgba(255, 215, 0, 0.8); }
    100% { box-shadow: 0 0 5px rgba(255, 215, 0, 0.4), inset 0 0 15px rgba(255, 215, 0, 0.4); }
}

/* Styles pour les supports du joueur 1 en mode galaxie (blanc phosphorescent constant) */
.cell.support-galaxy-player1 {
    background-color: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.7);
    /* Ligne animation retirée */
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8), inset 0 0 15px rgba(255, 255, 255, 0.8); /* <-- Box-shadow statique pour l'effet glow */
}

/* Styles pour les supports du joueur 2 en mode galaxie (or phosphorescent constant) */
.cell.support-galaxy-player2 {
    background-color: rgba(255, 215, 0, 0.3);
    border: 1px solid rgba(255, 215, 0, 0.7);
    /* Ligne animation retirée */
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.8), inset 0 0 15px rgba(255, 215, 0, 0.8); /* <-- Box-shadow statique pour l'effet glow */
}
/* Styles pour la section des options multijoueur */
#multiplayer-options {
    background-color: #21252b; /* Même fond que name-prompt */
    border: 1px solid #61dafb; /* Même bordure que name-prompt */
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    text-align: center;
    margin-top: 20px; /* Conserver le margin-top du HTML */
    max-width: 500px; /* Limiter la largeur pour une meilleure présentation */
    width: 90%; /* S'assurer qu'il est réactif sur les petits écrans */
    margin-left: auto; /* Centrer le bloc */
    margin-right: auto; /* Centrer le bloc */
}

#multiplayer-options h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #61dafb; /* Couleur d'accentuation */
    font-size: 1.5em;
}

#multiplayer-options h4 { /* Pour "Salons Publics Disponibles" */
    margin-top: 15px;
    margin-bottom: 10px;
    color: #eee;
    font-size: 1.1em;
    border-bottom: 1px solid #444; /* Une légère ligne de séparation */
    padding-bottom: 5px;
}

/* Styles pour les sections individuelles (créer, rejoindre public, rejoindre privé) */
#create-room-section,
#join-public-section,
#join-private-section {
    margin-bottom: 15px;
    padding: 10px;
    background-color: rgba(0,0,0,0.1); /* Légèrement plus foncé pour les sections */
    border-radius: 5px;
    border: 1px solid #333;
}

/* Styles pour les champs de saisie */
#multiplayer-options input[type="text"],
#multiplayer-options input[type="password"] {
    padding: 10px;
    margin-right: 10px;
    border: 1px solid #444;
    border-radius: 4px;
    background-color: #3a3f4a;
    color: #eee;
    font-size: 0.9em;
    flex-grow: 1; /* Permet aux inputs de prendre l'espace disponible */
}

/* Ajustements spécifiques pour les largeurs des inputs */
#newRoomNameInput, #privateRoomIdInput {
    width: 180px; /* Largeur par défaut si non flexible */
    max-width: calc(100% - 140px); /* Ajustement pour mobile */
}
#newRoomPasswordInput, #privateRoomPasswordInput {
    width: 120px; /* Largeur par défaut si non flexible */
    max-width: calc(100% - 80px); /* Ajustement pour mobile */
}


/* Styles pour les boutons */
#multiplayer-options button {
    padding: 10px 20px;
    cursor: pointer;
    border: none;
    background-color: #61dafb; /* Couleur bleue d'accentuation */
    color: #282c34;
    border-radius: 4px;
    font-size: 1em;
    font-weight: bold;
    transition: background-color 0.2s ease, transform 0.1s ease-out;
    margin-left: 5px; /* Petit espacement si plusieurs boutons/inputs sur la même ligne */
}

#multiplayer-options button:hover {
    background-color: #52c7e9;
}

#multiplayer-options button:active {
    background-color: #40a8c4;
    transform: scale(0.98);
}

#multiplayer-options button:disabled {
    background-color: #555;
    color: #999;
    cursor: not-allowed;
}

/* Style spécifique pour le bouton "Retour" */
#backToModeSelectionButton {
    background-color: #f0ad4e; /* Une couleur différente pour le bouton de retour */
    color: #21252b;
    margin-top: 15px;
    width: auto; /* Ne prend pas toute la largeur */
    padding: 10px 30px; /* Plus de padding pour le rendre plus visible */
}

#backToModeSelectionButton:hover {
    background-color: #ec971f;
}

/* Styles pour la liste des salons publics */
#publicRoomList {
    list-style-type: none;
    padding: 0;
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid #444;
    border-radius: 4px;
    background-color: #3a3f4a; /* Fond légèrement plus clair que le conteneur principal */
}

#publicRoomList li {
    padding: 8px;
    color: #ccc;
    text-align: center;
    border-bottom: 1px solid #555; /* Ligne de séparation entre les éléments de la liste */
}

#publicRoomList li:last-child {
    border-bottom: none; /* Pas de bordure pour le dernier élément */
}

/* Styles pour les boutons "Rejoindre" dans la liste des salons */
#publicRoomList .join-room-button {
    padding: 5px 10px;
    font-size: 0.9em;
    background-color: #28a745; /* Vert pour rejoindre */
    color: white;
}

#publicRoomList .join-room-button:hover {
    background-color: #218838;
}
/* --- NOUVEAU : Styles par défaut pour l'accueil (Desktop) --- */

/* On définit l'affichage en ligne pour les groupes de boutons */
#initial-mode-selection,
#solo-difficulty-selection {
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* On définit l'affichage en ligne pour les sections de formulaire */
#create-room-section,
#join-private-section {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap; /* Permet aux éléments de passer à la ligne si l'espace manque */
}

/* On donne une largeur de base aux champs de texte pour qu'ils ne prennent pas toute la place */
#create-room-section input,
#join-private-section input {
    width: auto; 
    flex-grow: 1; /* Permet aux champs de grandir si nécessaire */
}
/* Styles Responsives pour les sections de formulaire */
@media (max-width: 600px) {
    #create-room-section,
    #join-private-section {
        flex-direction: column; /* Les éléments s'empilent sur les petits écrans */
        align-items: stretch; /* Les éléments s'étirent sur toute la largeur */
    }

    #multiplayer-options input[type="text"],
    #multiplayer-options input[type="password"] {
        margin-right: 0; /* Pas de marge à droite en mode empilé */
        margin-bottom: 10px; /* Marge en bas pour séparer les inputs */
        width: 100%; /* Prend toute la largeur disponible */
        max-width: none; /* Annule le max-width précédent */
    }

    #multiplayer-options button {
        margin-left: 0; /* Pas de marge à gauche pour les boutons empilés */
        width: 100%; /* Prend toute la largeur disponible */
    }
    .nav-links {
        flex-direction: column;
    }
    
}
/* --- NOUVEAU : Indicateurs de Mode (A/D) --- */
.mode-indicator {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    color: white;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
    z-index: 5;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.mode-indicator-attack {
    background-color: rgba(217, 30, 24, 0.8); /* Rouge */
}

.mode-indicator-defense {
    background-color: rgba(30, 139, 217, 0.8); /* Bleu */
}

/* --- CORRIGÉ : Styles pour les cartes de terrain avec effet "Glow" --- */

/* Thème Sahel (Désert) */
.cell.support-sahel-player1 { 
    background-color: rgba(210, 180, 140, 0.9); 
    border: 1px solid #D2B48C;
    box-shadow: 0 0 12px rgba(210, 180, 140, 0.7), inset 0 0 10px rgba(210, 180, 140, 0.6);
}
.cell.support-sahel-player2 { 
    background-color: rgba(139, 69, 19, 0.9); 
    border: 1px solid #D2B48C;
    box-shadow: 0 0 12px rgba(210, 180, 140, 0.7), inset 0 0 10px rgba(210, 180, 140, 0.6);
}

/* Thème Médiéval (Château) */
.cell.support-medieval-player1 { 
    background-color: rgba(192, 192, 192, 0.9); 
    border: 1px solid #f0f0f0;
    box-shadow: 0 0 12px rgba(192, 192, 192, 0.8), inset 0 0 10px rgba(192, 192, 192, 0.7);
}
.cell.support-medieval-player2 { 
    background-color: rgba(77, 77, 77, 0.9); 
    border: 1px solid #C0C0C0;
    box-shadow: 0 0 12px rgba(192, 192, 192, 0.6), inset 0 0 10px rgba(192, 192, 192, 0.5);
}

/* Thème Asiatique (Dojo) */
.cell.support-asia-player1 { 
    background-color: rgba(128, 0, 128, 0.9); 
    border: 1px solid #DA70D6;
    box-shadow: 0 0 12px rgba(128, 0, 128, 0.8), inset 0 0 10px rgba(128, 0, 128, 0.7);
}
.cell.support-asia-player2 { 
    background-color: rgba(48, 48, 48, 0.9); 
    border: 1px solid #800080;
    box-shadow: 0 0 12px rgba(128, 0, 128, 0.6), inset 0 0 10px rgba(128, 0, 128, 0.5);
}

/* Thème Montagne (Cimes) - Couleurs mises à jour */
.cell.support-montagne-player1 { 
    background-color: rgba(0, 100, 0, 0.9);  /* Vert Foncé */
    border: 1px solid #90ee90; /* Bordure vert clair */
    box-shadow: 0 0 12px rgba(0, 100, 0, 0.8), inset 0 0 10px rgba(0, 100, 0, 0.7);
}
.cell.support-montagne-player2 { 
    background-color: rgba(255, 215, 0, 0.9); /* Or */
    border: 1px solid #FFFFE0; /* Bordure jaune très clair */
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.8), inset 0 0 10px rgba(255, 215, 0, 0.7);
}

@keyframes pulse-placement-anchor {
    0% {
      border-color: rgba(0, 174, 255, 0.6); /* Bleu semi-transparent */
      box-shadow: inset 0 0 15px rgba(0, 174, 255, 0.2);
    }
    50% {
      border-color: rgba(255, 255, 255, 1); /* Blanc pur pour l'effet "flash" */
      box-shadow: inset 0 0 25px rgba(0, 174, 255, 0.7);
    }
    100% {
      border-color: rgba(0, 174, 255, 0.6);
      box-shadow: inset 0 0 15px rgba(0, 174, 255, 0.2);
    }
  }
  
  /* Le nouveau style pour la case d'ancre de placement */
  .cell.valid-placement-anchor {
    /* On retire les anciens styles 'background-color' et 'outline' criards */
    
    /* Un fond bleuté très subtil et transparent */
    background-color: rgba(0, 174, 255, 0.1);
  
    /* Une bordure pointillée qui suggère une "zone de construction" */
    border: 2px dashed rgba(0, 174, 255, 0.6);
    
    /* Une lueur intérieure pour donner de la profondeur */
    box-shadow: inset 0 0 15px rgba(0, 174, 255, 0.2);
  
    cursor: pointer; /* Indique au joueur qu'il peut cliquer */
    z-index: 100;    /* On garde la case au-dessus des autres */
    
    /* On applique notre nouvelle animation ! */
    animation: pulse-placement-anchor 2s infinite ease-in-out;
  }
  .ia-indicator {
    position: absolute;
    bottom: 2px; /* Position en bas ... */
    right: 3px;  /* ... et à droite de la case du monstre */
    
    background-color: #343a40; /* Un gris sombre et neutre */
    color: #e9ecef; /* Texte clair */
    border: 1px solid #6c757d; /* Bordure grise */
    
    font-size: 10px; /* Texte très petit */
    font-weight: bold;
    font-family: 'Lato', sans-serif; /* Une police claire et lisible */
    
    padding: 0px 3px; /* Un peu d'espace intérieur */
    border-radius: 3px; /* Bords légèrement arrondis */
    
    z-index: 6; /* Doit être au-dessus du sprite mais peut être sous d'autres indicateurs si besoin */
}
/* DANS static/monster.css (remplacez les anciens styles de chat par ceci) */

/* --- SYSTÈME DE CHAT FLOTTANT PREMIUM --- */

#chat-container {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 1000;
}

/* Le bouton/bulle principal */
#chat-toggle-button {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #0078f2, #00c6ff); /* Dégradé de bleu */
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 120, 242, 0.4);
    transition: all 0.3s ease;
    animation: breathing-glow 3s infinite ease-in-out; /* Animation de respiration */
}

#chat-toggle-button:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 20px rgba(0, 120, 242, 0.5);
}

/* L'animation de "respiration" pour la bulle */
@keyframes breathing-glow {
    0% { box-shadow: 0 5px 15px rgba(0, 120, 242, 0.4); }
    50% { box-shadow: 0 5px 25px rgba(0, 198, 255, 0.6); }
    100% { box-shadow: 0 5px 15px rgba(0, 120, 242, 0.4); }
}

/* Le badge de notification */
#chat-notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    width: 15px;
    height: 15px;
    background-color: #ff3b30;
    border-radius: 50%;
    border: 2px solid #fff;
    transform: scale(0); /* Caché par défaut */
    transition: transform 0.2s ease;
}
#chat-notification-badge.visible {
    transform: scale(1);
}

/* La fenêtre de chat principale */
#chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 340px;
    max-height: 500px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;

    /* L'effet "verre dépoli" */
    background: rgba(44, 49, 60, 0.7);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);

    /* Animation d'ouverture/fermeture */
    transform-origin: bottom right;
    transform: scale(0);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28), opacity 0.2s ease;
    visibility: hidden;
}

/* Quand le conteneur a la classe .open, on affiche la fenêtre */
#chat-container.open #chat-window {
    transform: scale(1);
    opacity: 1;
    visibility: visible;
}

/* L'en-tête de la fenêtre de chat */
#chat-header {
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
#chat-header h3 { margin: 0; font-size: 1.1em; color: #fff; }
#chat-close-button {
    background: none; border: none; font-size: 24px;
    color: #aaa; cursor: pointer; transition: color 0.2s ease;
}
#chat-close-button:hover { color: #fff; }

/* La liste des messages elle-même */
#chat-window #messages {
    flex-grow: 1; /* Prend tout l'espace restant */
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Style de la barre de défilement (pour Chrome/Safari) */
#chat-window #messages::-webkit-scrollbar { width: 6px; }
#chat-window #messages::-webkit-scrollbar-track { background: transparent; }
#chat-window #messages::-webkit-scrollbar-thumb { background-color: rgba(255, 255, 255, 0.3); border-radius: 3px; }

/* Les bulles de messages (styles conservés et légèrement améliorés) */
#messages li {
    padding: 10px 15px;
    border-radius: 20px;
    max-width: 85%;
    line-height: 1.5;
    word-wrap: break-word;
    border-bottom: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
/* ... (gardez les styles .message-normal, .message-joueur et leurs ::before/::after) ... */
/* DANS monster.css, remplacez la règle pour #placement-controls */

#placement-controls { 
    /* On le transforme en panneau flottant */
    position: absolute;
    display: none; /* Reste caché par défaut */
    
    /* Style pour un look "barre d'outils" */
    background-color: #2c313a;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #61dafb;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    
    /* On utilise flex pour bien aligner les boutons à l'intérieur */
    display: flex; 
    justify-content: center;
    align-items: center;
    gap: 10px;
    
    z-index: 200; /* S'assure qu'il est bien au-dessus des autres éléments */
}
/* Style pour les liens de navigation de l'accueil */
.nav-links {
    text-align: center;
    margin-top: 15px;
    margin-bottom: 25px;
    display: flex;
    justify-content: center;
    gap: 25px; /* Espace entre les liens */
}

.nav-links a {
    color: #a0cff4; /* Bleu clair */
    text-decoration: none; /* Pas de soulignement */
    font-size: 1.1em;
    font-weight: bold;
    padding: 5px 0;
    position: relative;
    transition: color 0.3s ease;
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    background-color: #61dafb;
    bottom: 0;
    left: 0;
    transform: scaleX(0); /* Ligne initialement cachée */
    transform-origin: center;
    transition: transform 0.3s ease;
}

.nav-links a:hover {
    color: #ffffff; /* Le texte devient blanc au survol */
}

.nav-links a:hover::after {
    transform: scaleX(1); /* La ligne apparaît au survol */
}
/* DANS cartes.php, à la fin de la balise <style> */

/* --- NOUVEAU : Style pour la modale d'aperçu de carte --- */

.modal-overlay {
    position: fixed; /* Reste fixe sur l'écran */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85); /* Fond noir semi-transparent */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000; /* Au-dessus de tout le reste */
    
    /* Gère la visibilité et l'animation */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    position: relative;
    max-width: 90vw; /* Largeur maximale sur petits écrans */
    max-height: 90vh; /* Hauteur maximale */
    transform: scale(0.7); /* Commence plus petit pour l'animation */
    transition: transform 0.3s ease;
}

.modal-overlay.visible .modal-content {
    transform: scale(1); /* Grossit à sa taille normale à l'ouverture */
}

#modal-card-image {
    max-width: 100%;
    max-height: 90vh; /* S'assure que l'image ne dépasse pas de l'écran */
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
}

.modal-close-button {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 40px;
    height: 40px;
    background-color: white;
    color: #333;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    border: 2px solid #333;
}

/* On rend les cartes dans la grille cliquables */
.card-item {
    cursor: pointer;
}
/* DANS monster.css, à ajouter à la fin, à l'intérieur de @media (max-width: 768px) { ... } */

/* --- NOUVEAU : Amélioration du Responsive de l'Accueil (index.php) --- */

/* On ajuste la largeur du conteneur principal sur mobile */
#name-prompt {
    width: 90%;
    padding: 20px;
}

/* On empile les boutons de sélection de mode (Solo / Ligne) */
#initial-mode-selection,
#solo-difficulty-selection {
    display: flex;
    flex-direction: column;
    gap: 12px; /* Espace entre les boutons empilés */
    align-items: stretch; /* Les boutons prennent toute la largeur */
}

#initial-mode-selection button,
#solo-difficulty-selection button {
    width: 100%;
    padding: 12px;
    font-size: 1.1em;
    margin: 0;
}

/* On réorganise la section de création de salon */
#create-room-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#create-room-section input {
    margin-right: 0;
    width: 100%;
}

/* On réorganise la section pour rejoindre un salon privé */
#join-private-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#join-private-section input {
    margin-right: 0;
    width: 100%;
}