/* ==========================================================================
 *  ZONE IN GAME (game.css)
 *  ========================================================================== */

/* Zone centrale du plateau */
.game-table {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    width: 100%;
}

/* --- ZONE PIOCHE, CARTE PIOCHÉE ET DÉFAUSSE --- */
.deck-container {
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Slot pour recevoir la carte piochée entre la pioche et la défausse */
#drawn-card-slot {
display: flex;
align-items: center;
justify-content: center;
min-width: 100px;
height: 140px;
transition: all 0.3s ease;
}

/* Si aucun élément n'est présent dans le slot, masquage propre */
#drawn-card-slot:empty {
display: none;
}

/* --- ANIMATION D'APPARITION DE LA CARTE PIOCHÉE --- */
.drawn-card-animation {
    animation: popInDrawnCard 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popInDrawnCard {
    0% {
        opacity: 0;
        transform: scale(0.6) translateY(-15px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.card-pile {
    width: 100px;
    height: 140px;
    border: 2px solid #333;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: light-dark(#e0e0e0, #707070);
    position: relative;
    pointer-events: none;
    cursor: not-allowed;
    filter: opacity(0.85);
    box-shadow: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
/* Uniquement si elle possède la classe .interactive (Joueur actif en Phase 3) */
.card-pile.interactive {
    pointer-events: auto !important;
    cursor: pointer !important;
    filter: none;
}

.card-pile.interactive:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* Débloque le clic droit et l'interaction sur la pile de défausse */
#discardPileSlot {
pointer-events: auto;
cursor: auto;
}

/* Grille en Carré (2x2) pour les 4 cartes */
.player-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 100px);
    grid-template-rows: repeat(2, 140px);
    gap: 12px;
    justify-content: center;
}

/* --- SLOTS DE CARTES & CONTENEUR 3D --- */
.card-slot {
    width: 100px;
    height: 140px;
    border-radius: 8px;
    position: relative;
    perspective: 1000px;
}

/* Conteneur interne pivotant 3D */
.card-slot .card-3d-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: visible; /* Permet au glow de dépasser autour de la carte */
}

/* État retourné (face visible) */
.card-slot .card-3d-inner.flipped {
    transform: rotateY(180deg);
}

/* Faces avant et arrière */
.card-slot .card-3d-back,
.card-slot .card-3d-front {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.card-slot .card-3d-back {
    transform: rotateY(0deg);
}

.card-slot .card-3d-front {
    transform: rotateY(180deg);
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* --- Animation Halo Glow (RÉACTEUR) --- */
@keyframes reactorGlow {
    0% {
        box-shadow: 0 0 8px #ff2a00, 0 0 15px #ff7700;
    }
    50% {
        box-shadow: 0 0 18px #ff0000, 0 0 30px #ff9900;
    }
    100% {
        box-shadow: 0 0 8px #ff2a00, 0 0 15px #ff7700;
    }
}

/* Autoriser le débordement de l'ombre portée */
.card-slot,
.card-slot .card-3d-inner {
    overflow: visible !important;
}

/* Applique le glow sur la face visible (face si flipped, dos si non-flipped) */
.card-3d-inner.flipped-glow.flipped .card-3d-front,
.card-3d-inner.flipped-glow:not(.flipped) .card-3d-back {
    animation: reactorGlow 1.2s infinite ease-in-out !important;
    border: 2px solid #ff3300 !important;
    border-radius: 8px !important;
    box-sizing: border-box !important;
}
/* Fallback direct sur l'élément inner ou l'image */
.card-3d-inner.flipped-glow {
    animation: reactorGlow 1.2s infinite ease-in-out !important;
    border-radius: 8px !important;
}

/* Animation et bordure pour la pioche et la défausse */
.card-pile.flipped-glow,
.card-slot.flipped-glow {
    animation: reactorGlow 1.2s infinite ease-in-out !important;
    border: 2px solid #ff3300 !important;
    border-radius: 8px !important;
    box-sizing: border-box !important;
}

/* --- ÉTIQUETTE NOM DU JOUEUR --- */
.player-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 15px 0;
}

.player-name {
    font-family: 'Yanone Kaffeesatz', sans-serif;
    font-size: 24px;
    font-weight: 600;
    color: var(--nav-link-color);
    margin-bottom: 8px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.player-container.is-me .player-name {
    color: #333333;
    border-bottom: 2px solid var(--nav-link-color);
}

/* --- INTERACTION & ÉTATS DE JEU --- */
.card-slot.disabled {
    pointer-events: none;
    cursor: not-allowed;
    filter: opacity(0.85) grayscale(20%);
    box-shadow: none;
}

.card-slot:not(.disabled) {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-slot:not(.disabled):hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* --- ANIMATIONS DE DISTRIBUTION & CARTE VOLANTE --- */
.dealing-card {
    position: fixed;
    z-index: 1000;
    pointer-events: none;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.4s ease;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    will-change: transform;
}

.dealing-card.flipping-in-flight {
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.4s ease;
    transform-style: preserve-3d;
    perspective: 1000px;
}

.slot-hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none;
}

.card-slot.slot-received {
    animation: cardArrive 0.3s ease-out forwards;
}

@keyframes cardArrive {
    0% {
        transform: scale(0.9);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Animation du halo vert pulsant */
.active-action-glow {
    background-color: rgba(72, 187, 120, 0.75);
    box-shadow: 0 0 15px 5px rgba(72, 187, 120, 0.75), 0 0 25px 8px rgba(72, 187, 120, 0.4);
    border-radius: 12px;
    transition: box-shadow 0.3s ease-in-out;
    animation: pulseGlow 1.8s infinite alternate;
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 10px 3px rgba(72, 187, 120, 0.6), 0 0 20px 5px rgba(72, 187, 120, 0.3);
    }
    100% {
        box-shadow: 0 0 20px 8px rgba(72, 187, 120, 0.9), 0 0 35px 12px rgba(72, 187, 120, 0.6);
    }
}

/* Overlay et conteneur modale pour les information des carte */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-card-content {
    background: #ffffff;
    border-radius: 12px;
    width: 90%;
    max-width: 480px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--nav-link-color);
}

.modal-card-title {
    font-family: 'Yanone Kaffeesatz', sans-serif;
    font-size: 32px;
    color: var(--nav-link-color);
    margin-bottom: 16px;
    text-align: center;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 8px;
}

.modal-card-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Zone visuelle : Personnage + Valeur */
.modal-card-visuals {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-title);
    border-radius: 8px;
    padding: 12px;
}

.modal-char-img {
    max-height: 160px;
    width: auto;
    object-fit: contain;
}

.modal-value-img {
    position: absolute;
    top: 10px;
    right: 15px;
    width: 42px;
    height: auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

/* Zone textuelle */
.modal-card-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-section-label {
    font-family: 'Yanone Kaffeesatz', sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-top: 6px;
}

.modal-text-desc, .modal-text-power {
    font-size: 14px;
    line-height: 1.4;
    color: #555;
    background: #f9f9f9;
    padding: 10px;
    border-radius: 6px;
    border-left: 3px solid var(--nav-link-color);
}

.modal-card-footer {
    margin-top: 20px;
    text-align: center;
}

/* Positionnement à gauche du deck pour la carte piochée */
#drawn-card-slot {
position: absolute;
left: -120px;
top: 0;
display: flex;
gap: 10px;
transition: all 0.4s ease-out;
}
