/* --- GLOBAL --- */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #2c3e50;
    color: white;
    margin: 0;
    height: 100vh;
    overflow: hidden;
    /* Empêche le scroll */
}

#game-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 1200px;
    margin: 0 auto;
    background-color: #34495e;
    border-left: 2px solid #222;
    border-right: 2px solid #222;
}

/* --- ZONES JOUEURS --- */
.player-zone {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: #2c3e50;
    border-bottom: 1px solid #000;
}

#player2 {
    border-bottom: 2px solid #111;
    background: #3b2e2e;
}

/* Teinte rouge pour J2 */
#player1 {
    border-top: 2px solid #111;
    background: #2e353b;
}

/* Teinte bleue pour J1 */

/* Indicateur visuel du tour actif */
.active-turn {
    box-shadow: inset 0 0 20px 5px gold;
}

/* --- HÉROS --- */
.hero-container {
    width: 120px;
    text-align: center;
    border: 2px solid gold;
    border-radius: 50%;
    padding: 10px;
    cursor: pointer;
    background: #444;
    transition: 0.2s;
}

.hero-container:hover {
    transform: scale(1.05);
}

/* --- MAIN (HAND) --- */
.hand {
    display: flex;
    justify-content: center;
    gap: 5px;
    flex-grow: 1;
    height: 160px;
    padding: 0 20px;
}

/* --- PLATEAU (BOARD) --- */
#board {
    flex: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background-image: radial-gradient(#5a4a3a, #3e3226);
    position: relative;
}

.board-row {
    height: 45%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
}

.center-controls {
    height: 10%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    background: rgba(0, 0, 0, 0.3);
}

button {
    padding: 10px 20px;
    font-size: 16px;
    background: #f1c40f;
    border: none;
    cursor: pointer;
    font-weight: bold;
    border-radius: 5px;
}

button:hover {
    background: #f39c12;
}

/* --- CARTES --- */
.card {
    width: 100px;
    height: 140px;
    background-color: #ecf0f1;
    color: #333;
    border-radius: 8px;
    border: 2px solid #7f8c8d;
    display: flex;
    flex-direction: column;
    position: relative;
    user-select: none;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    font-size: 12px;
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-10px);
    z-index: 10;
}

/* Stats de la carte */
.card-cost,
.card-atk,
.card-hp {
    position: absolute;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    color: white;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
}

.card-cost {
    top: -5px;
    left: -5px;
    background-color: #3498db;
    border: 1px solid white;
}

.card-atk {
    bottom: -5px;
    left: -5px;
    background-color: #f39c12;
    border: 1px solid white;
}

.card-hp {
    bottom: -5px;
    right: -5px;
    background-color: #e74c3c;
    border: 1px solid white;
}

.card-image {
    height: 50%;
    background-color: #bdc3c7;
    border-bottom: 1px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.card-desc {
    padding: 2px;
    text-align: center;
    font-size: 10px;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-name {
    font-weight: bold;
    text-align: center;
    background: #222;
    color: gold;
    padding: 2px 0;
}

/* États des cartes */
.card.can-play {
    box-shadow: 0 0 10px #2ecc71;
    border-color: #2ecc71;
}

/* Carte jouable en main */
.card.sleeping {
    filter: grayscale(0.8);
    cursor: not-allowed;
}

/* Ne peut pas attaquer */
.card.ready {
    box-shadow: 0 0 10px #f1c40f;
    border-color: gold;
}

/* Prêt à attaquer */
.card.selected {
    box-shadow: 0 0 15px 5px #e74c3c;
    transform: scale(1.1);
    z-index: 100;
}

/* Sélectionné pour attaquer */

#game-message {
    color: #e74c3c;
    font-weight: bold;
    margin-left: 10px;
}

/* --- MODAL DE CONNEXION --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #2c3e50;
    padding: 30px;
    border-radius: 10px;
    border: 2px solid gold;
    text-align: center;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    max-width: 400px;
    width: 90%;
    /* Transition pour l'apparition si on voulait */
}

.input-group {
    margin: 15px 0;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #f1c40f;
}

.input-group input {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    border: 1px solid #7f8c8d;
    border-radius: 5px;
    background: #ecf0f1;
    color: #333;
    box-sizing: border-box;
    /* Important pour pas dépasser */
}

.modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 20px 0;
}

.modal-buttons button {
    padding: 15px;
    font-size: 18px;
    width: 100%;
}

.btn-secondary {
    background: #7f8c8d;
}

.btn-secondary:hover {
    background: #95a5a6;
}

.btn-small {
    padding: 10px !important;
    font-size: 14px !important;
}

/* LISTE DES JEUX */
#games-list-container {
    max-height: 300px;
    overflow-y: auto;
    margin: 10px 0;
    background: #34495e;
    border: 1px solid #7f8c8d;
    border-radius: 5px;
}

.game-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #555;
    background: rgba(255, 255, 255, 0.05);
}

.game-item:last-child {
    border-bottom: none;
}

.game-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.game-info {
    text-align: left;
}

.game-name {
    font-weight: bold;
    color: #f1c40f;
}

.game-host {
    font-size: 12px;
    color: #bdc3c7;
}

.status-msg {
    font-style: italic;
    color: #ccc;
    font-size: 14px;
}

.hidden {
    display: none !important;
}