/* ==========================================================================
   1. CONFIGURATION GLOBALE & RESET
   ========================================================================== */
:root {
    --tapis-url: url('/tapis/vert.svg');
    --tapis-color: #399e23;
    --panel-bg: #eafa7f;
    /* Dimensions réactives des cartes / conteneurs de mains */
    --card-w: 120px;
    --card-h: 175px;
    --hand-w: 800px;
}

body {
    background-color: var(--tapis-color);
    background-image: var(--tapis-url);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
    user-select: none; /* Empêche la sélection de texte */
    font-family: 'Arial', sans-serif;
    margin: 0;
}

/* Cache l'application tant que VueJS n'est pas chargé */
[v-cloak] { display: none !important; }

/* Transitions VueJS standards (Fade) */
.fade-enter-active, .fade-leave-active { transition: opacity 0.4s; }
.fade-enter-from, .fade-leave-to { opacity: 0; }


/* ==========================================================================
   2. INTERFACE UTILISATEUR (PANNEAUX, BOUTONS, MODALES)
   ========================================================================== */

/* --- Panneaux d'infos (Coins de l'écran) --- */
.ui-panel {
    background-color: var(--panel-bg, #eafa7f);
    border: 3px solid black;
    color: black;
    font-family: 'Arial Black', sans-serif;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    z-index: 60;
}

/* Petite carte affichée dans le panneau "Dernier Pli" */
.mini-card-display {
    width: 45px; height: 65px;
    border-radius: 3px; background: white;
    box-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* --- Modales (Login / Lobby / Fin de partie) --- */
.modal-overlay {
    position: absolute; inset: 0;
    background-color: rgba(0,0,0,0.7);
    z-index: 100;
    display: flex; align-items: center; justify-content: center;
    pointer-events: auto;
}

.modal-box {
    background-color: #1e3a8a;
    border: 4px solid #facc15;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    padding: 2rem;
    text-align: center;
    color: white;
    width: 500px; max-width: 95%;
    position: relative;
}

.modal-title {
    font-family: 'Arial Black', sans-serif;
    font-size: 2.5rem;
    color: #facc15;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    text-shadow: 2px 2px 0 black;
}

/* --- Éléments de Formulaire --- */
.btn-action {
    background: #facc15; color: black; font-weight: 900;
    padding: 12px 24px; border-radius: 6px; font-size: 1.2rem;
    border-bottom: 4px solid #b45309; transition: all 0.1s;
    width: 100%; cursor: pointer;
}
.btn-action:hover { background: #fde047; }
.btn-action:active { transform: translateY(2px); border-bottom: 2px solid #b45309; }

.btn-secondary {
    background: #6b7280; color: white; font-weight: 900;
    padding: 12px 24px; border-radius: 6px; font-size: 1.2rem;
    border-bottom: 4px solid #374151; transition: all 0.1s;
    width: 100%; cursor: pointer;
}
.btn-secondary:hover { background: #9ca3af; }
.btn-secondary:active { transform: translateY(2px); border-bottom: 2px solid #374151; }

.input-text {
    width: 100%; padding: 12px; margin-bottom: 15px;
    border-radius: 6px; border: 2px solid #facc15;
    background: rgba(0,0,0,0.3); color: white;
    font-size: 1.2rem; text-align: center; font-weight: bold;
}
.input-text:focus { outline: none; background: rgba(0,0,0,0.5); }

.input-text-sm {
    width: 100%; padding: 7px 10px; margin-bottom: 8px;
    border-radius: 6px; border: 2px solid #facc15;
    background: rgba(0,0,0,0.3); color: white;
    font-size: 0.95rem; text-align: center; font-weight: bold;
}
.input-text-sm:focus { outline: none; background: rgba(0,0,0,0.5); }


/* ==========================================================================
   3. CARTES ET DISTRIBUTION
   ========================================================================== */

/* --- Carte Standard --- */
.card-img {
    position: absolute;
    width: var(--card-w); height: var(--card-h);
    border-radius: 8px;
    box-shadow: -3px 3px 6px rgba(0,0,0,0.4);
    background-color: #f0f0f0;  /* Couleur de fond légère au lieu du blanc pur */
    background-image: linear-gradient(
        90deg,
        #f0f0f0 0%,
        #e8e8e8 50%,
        #f0f0f0 100%
    );
    background-size: 200% 100%;
    animation: card-loading 1.5s ease-in-out infinite;
    object-fit: fill;
    transform-origin: center center;
    border: 1px solid #ddd;  /* Bordure légère pour définition */
    /* La position est gérée par JS via style inline (--tx, --ty, --rot) */
    transform: translate(var(--tx), var(--ty)) rotate(var(--rot));
    transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    will-change: transform;
    -webkit-user-drag: none;
}

/* Animation de "skeleton loader" pendant le chargement des images */
@keyframes card-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Une fois l'image chargée, arrêter l'animation et avoir le fond correct */
.card-img.loaded {
    background-image: none !important;
    animation: none !important;
    background-color: white;
    border: none;  /* Enlever la bordure une fois chargée */
}


/* --- Interaction (Main du joueur) --- */
.card-img.interactive { 
    pointer-events: auto; 
    cursor: pointer;
    /* Optimisation pour éviter le délai de clic sur mobile */
    touch-action: manipulation; 
}

/* --- VERSION ORDINATEUR (Souris uniquement) --- */
/* Le @media (hover: hover) garantit que ce bloc ne s'active QUE si on a une souris */
@media (hover: hover) {
    .card-img.interactive:hover {
        /* Pas de changement de transform-origin : garder center center pour éviter le saut de position */
        transform: translate(var(--tx), var(--ty)) rotate(var(--rot)) scale(1.1);
        z-index: 100 !important;
        box-shadow: 0 0 25px rgba(255,255,0,0.9);
        border: 2px solid gold;
        /* Hover-in rapide (100ms) pour éviter la boucle d'oscillation */
        transition: transform 0.1s ease-out, box-shadow 0.1s ease-out;
    }
}

/* --- VERSION TACTILE (iPad / Mobile) --- */
/* Au lieu de sauter, la carte s'enfonce légèrement et s'éclaire quand on appuie dessus */
.card-img.interactive:active {
    filter: brightness(1.2); 
    /* On garde la position exacte calculée par le JS, on réduit juste l'échelle */
    transform: translate(var(--tx), var(--ty)) rotate(var(--rot)) scale(0.95);
    transition: transform 0.1s;
    z-index: 100 !important; /* Passe au premier plan pendant l'appui */
}

/* --- Carte Non Jouable (Grisée) --- */
.card-img.dimmed {
    opacity: 1 !important;        /* On garde l'opacité à 100% pour ne pas voir à travers */
    filter: brightness(60%);      /* On baisse la luminosité (effet ombre) */
    cursor: not-allowed !important;
    transition: all 0.2s ease;
    /* Pas de changement d'échelle pour garder l'alignement parfait */
}

/* --- Paquet du Donneur (Effet 3D) --- */
.dealer-deck-container {
    position: relative;
    width: var(--card-w); height: var(--card-h);
}
.deck-card-slice {
    position: absolute; left: 0; bottom: 0;
    width: 100%; height: 100%;
    background-image: var(--back-url, url('/static/cards/back_vert.svg'));
    background-size: cover;
    border-radius: 8px; border: 1px solid #ccc;
    box-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}
.dealer-pos {
    position: absolute; z-index: 15; pointer-events: none;
    display: flex; align-items: center; justify-content: center;
}

/* --- Conteneurs des Mains --- */
.hand-container {
    position: absolute;
    display: flex; justify-content: center; align-items: flex-end;
    width: var(--hand-w); height: 250px;
    pointer-events: none;
}

/* --- Carte Volante (Animation distribution/pli) --- */
.flying-card {
    position: absolute;
    width: var(--card-w); height: var(--card-h);
    background-color: white; 
    border-radius: 8px; border: 2px solid white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    z-index: 150; 
    transform-origin: center center;
    transition: all 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden; 
}
.flying-card img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}

/* --- CARTE GAGNANTE DU PLI --- */
.trick-card-winner {
    z-index: 100 !important; /* Passe devant tout le monde */
    transform: translate(var(--tx), var(--ty)) rotate(var(--rot)) scale(1.1) !important; /* Gros Zoom */
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.8) !important; /* Halo Doré */
    border: 3px solid #facc15 !important;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}


/* ==========================================================================
   BLOC JOUEUR FIXE (Nom + Enchère)
   ========================================================================== */

.player-card {
    position: absolute;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: transparent;
    border: none;
    box-shadow: none;
    z-index: 50;
    pointer-events: none;
}

/* GESTION DU NOM (Coupe si trop long) */
.player-name {
    width: 95%;            /* Prend presque toute la largeur */
    text-align: center;
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
    
    /* Le secret pour les noms longs : "Jean-Christophe..." */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; 
}

/* L'ENCHÈRE (Pastille attachée en bas) */
.player-bid-badge {
    position: absolute;
    bottom: -24px;         
    left: 50%;
    transform: translateX(-50%); 
    
    background-color: #f3f4f6; 
    color: #1f2937;            
    border: 2px solid #333;
    border-radius: 12px;
    
    /* --- CORRECTIONS DE TAILLE --- */
    width: 115px;          /* Largeur fixe (SURCOINCHE = 10 chars) */
    height: 28px;          /* Hauteur fixe */
    padding: 0;            /* Pas de padding pour respecter la taille fixe */
    overflow: hidden;
    
    /* --- CENTRAGE PARFAIT --- */
    display: flex;
    justify-content: center; /* Centre horizontalement */
    align-items: center;     /* Centre verticalement */
    
    /* --- TEXTE --- */
    font-size: 0.75rem;
    font-weight: 800;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
    z-index: 55;           
}

/* On s'assure que les images à l'intérieur (les couleurs) ne cassent pas la hauteur */
.player-bid-badge img {
    height: 14px;
    width: 14px;
    margin-left: 4px;
    display: block; /* Évite les espacements fantômes sous les images */
}

/* VARIANTE : Badge au-dessus (Pour le joueur SUD) */
.player-card.badge-top .player-bid-badge {
    bottom: auto;       /* On annule l'ancrage bas par défaut */
    top: -24px;         /* On le place en haut */
    
    /* Optionnel : Si vous voulez que la flèche du badge pointe vers le bas */
    /* (nécessite d'adapter le border-radius si vous voulez être perfectionniste) */
}


/* ==========================================================================
   ÉTAT ACTIF (C'est à mon tour)
   ========================================================================== */
.active-turn {
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 140, 0, 0.6);
    /* On remplace transform: scale(1.1); par la propriété native scale */
    scale: 1.1; 
    z-index: 50;
}

/* Animation de réflexion (Anneaux) */
.active-turn::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 10px;
    border: 2px dashed #fbbf24;
    opacity: 0.6;
    animation: thinking-spin 4s linear infinite;
    pointer-events: none;
}
.active-turn::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 10px;
    border-top: 2px solid white;
    border-bottom: 2px solid white;
    border-left: 2px solid transparent;
    border-right: 2px solid transparent;
    opacity: 0.4;
    animation: thinking-spin 1.5s linear infinite reverse;
    pointer-events: none;
}

.active-turn .player-name {
    color: #fbbf24;
    text-shadow: 0 0 5px rgba(251, 191, 36, 0.8);
}

@keyframes thinking-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes popIn {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* --- Icône SVG dans le badge (Coeur, Pique...) --- */
.bid-icon {
    height: 1.2em;
    width: auto;
    vertical-align: middle;
    margin-left: 4px;
    margin-bottom: 2px;
    display: inline-block;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.3));
}


/* ==========================================================================
   5. INTERFACE D'ENCHÈRES
   ========================================================================== */

.bid-overlay {
    position: absolute; inset: 0; z-index: 80;
    background-color: transparent; /* Pas de fond gris, on voit le jeu */
    pointer-events: none; /* Click-through */
    
    /* MODIFICATION ICI : CENTRAGE TOTAL */
    display: flex; 
    justify-content: center; 
    align-items: center; /* C'est ce qui centre verticalement */
}

/* Animation d'entrée/sortie spécifique aux enchères */
.bid-anim-enter-active, .bid-anim-leave-active { transition: opacity 0.3s ease; }
.bid-anim-enter-from, .bid-anim-leave-to { opacity: 0; }

.bid-box {
    pointer-events: auto;
    
    /* MODIFICATION ICI : On retire la marge du bas */
    margin-bottom: 0; 
    
    width: min(420px, 90vw);
    background: rgba(16, 25, 60, 0.95);
    border: 2px solid #fbbf24;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    animation: slideUpFade 0.3s ease-out;
}

@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Compteur de points */
.bid-counter {
    display: flex; align-items: center; justify-content: center;
    gap: 10px; margin-bottom: 8px;
    background: rgba(0,0,0,0.3); padding: 5px; border-radius: 8px;
}
.bid-value-display {
    font-family: 'Arial Black', sans-serif; font-size: 2rem;
    color: #fbbf24; width: 80px; text-align: center;
}
.btn-counter {
    background: #3b82f6; color: white; font-weight: bold; font-size: 1.2rem;
    width: 30px; height: 30px; border-radius: 50%;
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.1s;
}
.btn-counter:active { transform: scale(0.9); }
.btn-counter:disabled { opacity: 0.3; cursor: not-allowed; }

/* Grille des Couleurs */
.bid-suits-grid {
    display: flex; justify-content: center; gap: 8px; margin-bottom: 10px;
}
.btn-suit {
    width: 40px; height: 40px;
    background: white; border: 2px solid transparent; border-radius: 6px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.btn-suit img { width: 28px; height: 28px; object-fit: contain; }
.btn-suit:hover { transform: translateY(-2px); }
.btn-suit.selected {
    background: #fbbf24; border-color: #f59e0b;
    box-shadow: 0 0 10px #fbbf24;
}

/* Boutons d'Action (Valider, Passe, Coinche) */
.bid-actions-row { display: flex; justify-content: space-between; gap: 8px; }

.btn-take, .btn-pass, .btn-coinche {
    flex: 1; padding: 8px 0;
    font-weight: bold; font-size: 0.9rem;
    border-radius: 6px; cursor: pointer; border: none;
    text-transform: uppercase; transition: filter 0.2s;
}

.btn-take {
    background: linear-gradient(to bottom, #22c55e, #15803d);
    color: white; border-bottom: 3px solid #14532d;
}
.btn-take:disabled { filter: grayscale(1); opacity: 0.5; cursor: not-allowed; }

.btn-coinche {
    background: linear-gradient(to bottom, #ef4444, #b91c1c);
    color: white; border-bottom: 3px solid #7f1d1d;
}
.btn-coinche.active { animation: pulse 1s infinite; }

.btn-pass {
    background: #6b7280; color: white; border-bottom: 3px solid #374151;
}
.btn-take:active, .btn-pass:active, .btn-coinche:active {
    transform: translateY(2px); border-bottom-width: 0; margin-top: 3px;
}


/* ==========================================================================
   6. SYSTÈME DE NOTIFICATIONS (TOASTS)
   ========================================================================== */

.message-toast {
    position: absolute;
    padding: 15px 30px;
    border-radius: 10px;
    font-family: 'Arial', sans-serif;
    font-weight: bold;
    font-size: 1.4rem;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    z-index: 200; pointer-events: none;
    white-space: nowrap;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 1;
    transform: scale(1) translate(-50%, -50%);
}

.msg-type-info    { background: rgba(255, 255, 255, 0.95); color: #1e3a8a; border: 4px solid #3b82f6; }
.msg-type-announce { background: #fef08a; color: black; border: 4px solid #eab308; font-size: 1.8rem; box-shadow: 0 0 30px rgba(234, 179, 8, 0.6); }
.msg-type-error   { background: #fee2e2; color: #991b1b; border: 4px solid #ef4444; }
.msg-type-success { background: #dcfce7; color: #166534; border: 4px solid #22c55e; }

/* Positions relatives */
.msg-pos-center { top: 50%; left: 50%; }


/* --- Fenêtre d'Annonces (Style identique aux Enchères) --- */

/* --- Overlay transparent pour les Annonces (Comme les Enchères) --- */
.announcement-overlay {
    position: fixed; /* Fixed car on est dans le <teleport> */
    inset: 0;
    z-index: 210; /* Au-dessus des avatars (z=100) et du recap (z=210) */
    
    /* LE PLUS IMPORTANT : Fond transparent */
    background-color: transparent; 
    
    /* Permet de cliquer sur le jeu à travers les zones vides */
    pointer-events: none; 
    
    /* Centrage */
    display: flex;
    align-items: center;
    justify-content: center;
}

.announcement-box {
    width: min(500px, 95vw);
    /* Le même fond bleu nuit et bordure dorée que .bid-box */
    background: rgba(16, 25, 60, 0.95);
    border: 2px solid #fbbf24;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    text-align: center;
    color: white;
    pointer-events: auto;
}

.announcement-title {
    color: #fbbf24; /* Jaune doré */
    font-size: 1.5rem;
    font-weight: 900;
    text-transform: uppercase;
    margin-bottom: 20px;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
}

.announcement-row {
    /* Fond légèrement plus clair pour détacher les lignes */
    background: rgba(255, 255, 255, 0.05); 
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.announcement-name {
    font-weight: bold;
    color: #fff;
    font-size: 1.1rem;
    text-transform: uppercase;
}


.mini-card-list {
    display: flex;
    gap: 5px;             /* Espace de 5px entre les cartes */
    align-items: center;  /* Aligne verticalement */
    margin-top: 5px;
}


.mini-card-img {
    /* Taille (ajustez selon vos besoins) */
    width: 40px; 
    height: 60px;
    background-color: white;  /* Force le fond blanc */
    border-radius: 4px;       /* Arrondit les coins pour faire "carte" */
    box-shadow: 0 2px 4px rgba(0,0,0,0.5); /* Une petite ombre */
    border: 1px solid #ccc; /* Une fine bordure grise */
}

.announcement-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 25px;
}

/* Boutons plus modernes */
.btn-declare {
    background: linear-gradient(to bottom, #22c55e, #16a34a);
    color: white; font-weight: bold; padding: 10px 25px; border-radius: 5px;
    box-shadow: 0 4px 0 #15803d; transition: transform 0.1s;
}
.btn-declare:active { transform: translateY(2px); box-shadow: 0 1px 0 #15803d; }

.btn-hush { 
    background: linear-gradient(to bottom, #9ca3af, #6b7280);
    color: white; font-weight: bold; padding: 10px 25px; border-radius: 5px;
    box-shadow: 0 4px 0 #4b5563; transition: transform 0.1s;
}
.btn-hush:active { transform: translateY(2px); box-shadow: 0 1px 0 #4b5563; }
.btn-hush:hover { background: #6b7280; }


/* --- NOUVEAU STYLE RECAPITULATIF --- */
.recap-box {
    background: rgba(20, 20, 30, 0.95); /* Fond très sombre quasi opaque */
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1.5rem;
    color: white;
    max-width: 600px; /* Plus étroit */
    width: 95%;
    position: relative;
    backdrop-filter: blur(10px); /* Effet verre */
}

/* Titre de la manche */
.recap-header {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #fbbf24; /* Jaune Coinche */
    margin-bottom: 1rem;
    border-bottom: 2px solid rgba(251, 191, 36, 0.2);
    padding-bottom: 0.5rem;
}

/* Lignes du tableau plus compactes */
.recap-table-compact tr {
    transition: background 0.2s;
}
.recap-table-compact td {
    padding: 6px 10px; /* Padding vertical réduit */
    vertical-align: middle;
}
/* Une ligne sur deux légèrement teintée */
.recap-table-compact tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.03);
}

/* Le macaron du résultat (Réussi/Chuté) */
.result-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: 900;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.result-success {
    background: linear-gradient(135deg, #065f46, #059669);
    border: 1px solid #34d399;
    color: #ecfdf5;
}
.result-fail {
    background: linear-gradient(135deg, #7f1d1d, #dc2626);
    border: 1px solid #f87171;
    color: #fef2f2;
}

.btn-timer {
    background: #2563eb; /* Bleu */
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    padding: 12px 0;
    width: 100%;
    border-radius: 8px;
    border: none;
    border-bottom: 4px solid #1e40af;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.1s;
}
.btn-timer:active { transform: translateY(2px); border-bottom-width: 0; margin-top: 14px; }

/* --- Formulaire Challenge (admin) --- */
.challenge-input {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    color: #fff;
    padding: 6px 10px;
    font-size: 12px;
    width: 100%;
    outline: none;
    transition: border-color 0.15s;
}
.challenge-input:focus { border-color: rgba(234,179,8,0.6); }
.challenge-input option { background: #1f2937; color: #fff; }
.challenge-checkbox {
    width: 14px; height: 14px;
    accent-color: #eab308;
    cursor: pointer;
}

/* --- Overlay transparent pour les Annonces et Modales Génériques --- */
/* --- Overlay transparent pour les Annonces et Modales Génériques --- */
.announcement-overlay {
    position: fixed; /* Fixe par rapport à l'écran */
    inset: 0;        /* Prend tout l'écran (Top/Bottom/Left/Right = 0) */
    z-index: 210;    /* Au-dessus des avatars et du recap de manche */
    
    /* Fond transparent pour voir le jeu en dessous */
    background-color: rgba(0, 0, 0, 0.4); /* Légèrement grisé pour détacher le texte, ou 'transparent' si vous préférez */
    
    /* Centrage du contenu (La boîte de dialogue) */
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* Permet de cliquer sur le jeu à travers les zones vides */
    pointer-events: auto; 
}


.msg-type-urgent {
    /* Rouge sombre élégant au lieu du rouge vif */
    background: linear-gradient(135deg, #b91c1c 0%, #7f1d1d 100%); 
    color: white;
    
    /* Bordure plus fine */
    border: 2px solid #facc15; 
    border-radius: 8px;
    
    /* Taille réduite (était 2.5rem) */
    font-size: 1.5rem !important; 
    padding: 8px 20px;
    
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    
    /* Ombres plus douces */
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
    
    z-index: 300;
    
    /* Juste une petite entrée dynamique, sans pulsation infinie */
    animation: pop-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pop-in {
    from { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* --- BULLES DE DIALOGUE (COMIC STYLE) --- */

/* Quand un player-hud contient une bulle active, il passe au premier plan */
.player-hud:has(.speech-bubble) {
    z-index: 250;
}

.speech-bubble {
    position: absolute;
    z-index: 65;
    background: #ffffff;
    color: #1a1a1a;
    
    /* TAILLE & TEXTE */
    padding: 12px 20px; /* Plus d'espace intérieur */
    border-radius: 12px; /* Coins un peu plus carrés */
    font-family: 'Arial Black', 'Verdana', sans-serif; /* Police très grasse */
    font-weight: 900;
    font-size: 1.1rem; /* Texte plus gros (était 0.9rem) */
    line-height: 1.1;
    text-align: center;
    white-space: nowrap;
    
    /* EFFET "POP" */
    border: 3px solid #000; /* Bordure épaisse */
    box-shadow: 4px 4px 0px rgba(0,0,0,0.3); /* Ombre dure décalée */
    
    z-index: 500;
    min-width: 100px; /* Largeur minimum augmentée */
}

/* --- LE PETIT TRIANGLE (POINTE) --- */
/* On utilise un hack CSS avec des bordures pour faire le triangle */

/* J0 : Bulle au-dessus, flèche en bas pointant vers le joueur */
.bubble-bottom { 
    bottom: 110%; 
    left: 50%; 
    transform: translateX(-50%); 
    margin-bottom: 25px; /* L'espacement que tu avais défini */
}
.bubble-bottom::after { 
    content: ''; 
    position: absolute; 
    top: 100%; 
    left: 50%; 
    transform: translateX(-50%);
    border-width: 12px 12px 0 12px; /* Triangle de 12px pointant vers le bas */
    border-style: solid;
    border-color: #000 transparent transparent transparent; /* Couleur noire en haut */
}
/* J1 : Bulle à gauche du joueur, flèche à droite pointant vers lui */
.bubble-right { right: 110%; top: 50%; transform: translateY(-50%); }
.bubble-right::after { left: 100%; top: 50%; margin-top: -6px; border-width: 6px 0 6px 6px; }

/* J2 : Bulle en-dessous du joueur, flèche en haut pointant vers lui */
.bubble-top { top: 140%; left: 50%; transform: translateX(-50%); }
.bubble-top::after { content: ''; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
    border-width: 0 12px 12px 12px; /* Triangle de 12px pointant vers le haut */
    border-style: solid;
    border-color: transparent transparent #000 transparent; /* Couleur noire en bas */
}
/* J3 : Bulle à droite du joueur, flèche à gauche pointant vers lui */
.bubble-left { left: 110%; top: 50%; transform: translateY(-50%); }
.bubble-left::after { right: 100%; top: 50%; margin-top: -6px; border-width: 6px 6px 6px 0; }

.bubble-left::after {
    content: ''; position: absolute; left: -12px; top: 50%;
    transform: translateY(-50%);
    border-width: 12px 12px 12px 0; /* Triangle plus gros */
    border-style: solid;
    border-color: transparent #000 transparent transparent;
}

.bubble-right::after {
    content: ''; position: absolute; right: -12px; top: 50%;
    transform: translateY(-50%);
    border-width: 12px 0 12px 12px;
    border-style: solid;
    border-color: transparent transparent transparent #000;
}

/* 3. Joueur HAUT (Bulle en dessous) */
.bubble-top {
    top: 140%; /* Un peu plus bas */
    left: 50%;
    transform: translateX(-50%);
}

/* 4. Joueur BAS/MOI (Bulle au dessus) */
.bubble-bottom {
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 25px; /* Plus d'espace avec la main */
}

.pop-enter-active, .pop-leave-active { 
    transition: opacity 0.2s ease-out, transform 0.2s ease-out; 
}

/* État de départ/fin : Invisible et légèrement plus petit */
.pop-enter-from, .pop-leave-to { 
    opacity: 0; 
    /* On évite de toucher au translate ici pour ne pas casser le centrage */
    /* On joue juste sur l'échelle très légèrement pour un effet de "zoom in" subtil */
    /* Note : Si cela cause encore un micro-décalage, supprimez la partie 'scale(0.9)' */
    transform: scale(0.9); 
}


.msg-type-round-start {
    /* Fond Bleu Nuit Dégradé (Rappel du Lobby) */
    background: linear-gradient(180deg, #172554 0%, #0f172a 100%);
    
    /* Bordure Or épaisse + Arrondi "Pilule" */
    border: 4px solid #facc15;
    border-radius: 50px;
    
    /* Typographie Massive */
    font-family: 'Arial Black', sans-serif;
    font-size: 3rem !important; /* Très gros */
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 20px 60px !important;
    
    /* Effets de lumière et d'ombre (Le "Glow") */
    box-shadow: 
        0 10px 30px rgba(0,0,0,0.8),          /* Ombre portée noire */
        0 0 30px rgba(250, 204, 21, 0.4),     /* Halo doré externe */
        inset 0 0 20px rgba(250, 204, 21, 0.2); /* Reflet doré interne */
    
    text-shadow: 
        0 4px 0 #000,                         /* Ombre dure du texte */
        0 0 15px rgba(255,255,255,0.5);       /* Lueur blanche sur le texte */
        
    z-index: 1000; /* Au dessus de tout */
    
    /* Animation d'entrée majestueuse */
    animation: cinema-enter 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes cinema-enter {
    0% { 
        opacity: 0; 
        transform: translate(-50%, -50%) scale(0.5); /* Part de petit */
        letter-spacing: 1em; /* Lettres écartées */
    }
    100% { 
        opacity: 1; 
        transform: translate(-50%, -50%) scale(1); 
        letter-spacing: 0.1em; /* Lettres serrées */
    }
}

.fullscreen-btn {
    position: fixed;
    top: 2px;
    right: 2px;
    z-index: 1000;
    padding: 2px 4px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.55);
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6));
}

.fullscreen-btn:hover {
    color: rgba(255, 255, 255, 0.95);
}

.quit-btn {
    padding: 1px 4px;
    line-height: 1;
    background: transparent;
    border: none;
    cursor: pointer;
    color: rgba(127, 29, 29, 0.55);
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6));
    transition: color 0.2s ease;
}

.quit-btn:hover {
    color: rgba(127, 29, 29, 0.95);
}

/* BARRE D'ICÔNES LATÉRALE GAUCHE */
.game-sidebar {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 10px 6px;
    background: rgba(10, 10, 20, 0.78);
    border-radius: 0 14px 14px 0;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.16);
    border-left: none;
    box-shadow: 3px 0 16px rgba(0,0,0,0.45);
}
.sidebar-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: rgba(255,255,255,0.06);
    border-radius: 9px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.82);
    transition: background 0.15s, color 0.15s, transform 0.1s;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.6));
    flex-shrink: 0;
}
.sidebar-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    transform: scale(1.08);
}
.sidebar-btn:disabled {
    opacity: 0.25;
    cursor: default;
    background: transparent;
}
.sidebar-btn:disabled:hover {
    background: transparent;
    color: rgba(255, 255, 255, 0.25);
    transform: none;
}
.sidebar-btn.sidebar-btn-active {
    background: rgba(251, 191, 36, 0.25);
    color: #fbbf24;
}
.sidebar-btn.quit-sidebar {
    color: #f87171;
    background: rgba(220, 38, 38, 0.18);
}
.sidebar-btn.quit-sidebar:hover {
    background: rgba(220, 38, 38, 0.4);
    color: #fca5a5;
    transform: scale(1.08);
}
.sidebar-divider {
    width: 28px;
    height: 1px;
    background: rgba(255, 255, 255, 0.18);
    margin: 4px 0;
}

/* CARTES JOUEUR SALON D'ATTENTE */
.lobby-player-card {
    position: relative;
    border-radius: 16px;
    border: 2px solid rgba(255,255,255,0.12);
    padding: 72px 8px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: border-color 0.3s, background 0.3s, opacity 0.3s;
    background: rgba(0,0,0,0.28);
    text-align: center;
    min-width: 0;
}
.lobby-seat-avatar {
    position: absolute;
    top: -58px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 120px;
    border-radius: 16px;
    overflow: hidden;
    border: 3px solid rgba(255,255,255,0.18);
    box-shadow: 0 6px 20px rgba(0,0,0,0.65);
    background: #1a1c2e;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.lobby-seat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

/* Badge Joker — lobby (avatar 120px) — coin haut-gauche, centre du SVG aligné sur le coin */
.lobby-joker-badge {
    position: absolute;
    top: -62px;                 /* avatar à -58px ; badge 36px → centre sur coin haut-gauche + 10px vers le bas */
    left: calc(50% - 78px);     /* 50% - 60 (demi-avatar) - 18 (demi-badge 36px) */
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 12;
    pointer-events: none;
    transform: rotate(-20deg);
    filter: drop-shadow(0 1px 5px rgba(0,0,0,0.95)) drop-shadow(0 0 3px rgba(0,0,0,0.7));
}
.lobby-joker-badge svg,
.lobby-joker-badge img {
    width: 32px;
    height: auto;
}

/* Badge Joker — HUD jeu (avatar 175px) — coin haut-gauche, analogue au jeton donneur bas-droit */
.hud-joker-badge {
    position: absolute;
    top: -8px;                  /* -20px → +12px vers le bas : évite la coupure sur Nord */
    left: -26px;                /* demi-badge 52px */
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 12;
    pointer-events: none;
    transform: rotate(-20deg);
    filter: drop-shadow(0 2px 7px rgba(0,0,0,0.95)) drop-shadow(0 0 4px rgba(0,0,0,0.7));
}
.hud-joker-badge svg,
.hud-joker-badge img {
    width: 52px;
    height: auto;
}

.lobby-player-card.state-human-us   { border-color: rgba(59,130,246,0.9);  background: rgba(30,58,138,0.28); }
.lobby-player-card.state-human-us   .lobby-seat-avatar { border-color: #60a5fa; box-shadow: 0 0 18px rgba(96,165,250,0.45), 0 6px 20px rgba(0,0,0,0.65); }
.lobby-player-card.state-human-them { border-color: rgba(239,68,68,0.9);   background: rgba(127,29,29,0.28); }
.lobby-player-card.state-human-them .lobby-seat-avatar { border-color: #f87171; box-shadow: 0 0 18px rgba(248,113,113,0.45), 0 6px 20px rgba(0,0,0,0.65); }
.lobby-player-card.state-bot  { border-color: rgba(168,85,247,0.65); border-style: dashed; background: rgba(88,28,135,0.22); }
.lobby-player-card.state-bot  .lobby-seat-avatar { border-color: rgba(192,132,252,0.85); border-style: solid; box-shadow: 0 0 14px rgba(168,85,247,0.35), 0 6px 20px rgba(0,0,0,0.65); }
.lobby-player-card.state-empty { border-color: rgba(255,255,255,0.1); border-style: dashed; opacity: 0.45; }

/* BULLE DE DIALOGUE LOBBY */
.bubble-lobby {
    position: absolute;
    bottom: calc(100% + 66px);
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    color: #1a1a1a;
    padding: 7px 13px;
    border-radius: 10px;
    border: 2.5px solid #000;
    box-shadow: 3px 3px 0 rgba(0,0,0,0.3);
    font-family: 'Arial Black', 'Verdana', sans-serif;
    font-weight: 900;
    font-size: 0.8rem;
    text-align: center;
    white-space: nowrap;
    z-index: 200;
    pointer-events: none;
    animation: pop-in 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}
.bubble-lobby::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 7px;
    border-style: solid;
    border-color: #000 transparent transparent transparent;
}

/* JETON DONNEUR (DEALER CHIP) */
.dealer-token {
    position: absolute;
    top: -15px;   /* Déborde un peu en haut */
    right: -15px; /* Déborde un peu à droite */
    width: 40px;
    height: 40px;
    z-index: 60;  /* Au-dessus de la carte joueur */
    filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.5));
    animation: drop-chip 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* AVATAR SUR LE PLATEAU (coin opposé au jeton donneur) */
.player-avatar-token {
    position: absolute;
    bottom: -15px;
    left: -15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.25);
    z-index: 60;
    filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.5));
    pointer-events: none;
}

/* Animation d'arrivée du jeton (effet "posé sur la table") */
@keyframes drop-chip {
    from { transform: scale(3); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   HUD AVATARS — vignettes dans les 4 coins du plateau
   ========================================================================== */
.player-hud {
    position: absolute;
    z-index: 110;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    pointer-events: none;
    transition: transform 0.25s ease;
}

.hud-avatar-outer {
    position: relative;
    display: inline-block;
}

.hud-avatar-wrap {
    width: 175px;
    height: 175px;
    border-radius: 28px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.55);
    border: 3px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.65);
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.25s ease;
}

.hud-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

/* Contour pulsant pendant la réflexion — inset shadow = trait épaissi sans changer les dimensions */
.player-hud.hud-thinking .hud-avatar-wrap {
    animation: hud-thinking-pulse 1s ease-in-out infinite;
}

@keyframes hud-thinking-pulse {
    0%, 100% {
        box-shadow: inset 0 0 0 0px rgba(251,191,36,0.0),
                    0 0 22px rgba(251,191,36,0.4), 0 8px 32px rgba(0,0,0,0.65);
    }
    50% {
        box-shadow: inset 0 0 0 4px rgba(251,191,36,0.85),
                    0 0 44px rgba(251,191,36,0.85), 0 8px 32px rgba(0,0,0,0.65);
    }
}

/* Joueur déconnecté — contour rouge pulsant, grisé */
.player-hud.hud-disconnected .hud-avatar-wrap {
    animation: hud-disconnected-pulse 2s ease-in-out infinite;
    filter: grayscale(70%);
    opacity: 0.75;
}

@keyframes hud-disconnected-pulse {
    0%, 100% { box-shadow: inset 0 0 0 0px rgba(239,68,68,0.0), 0 8px 32px rgba(0,0,0,0.65); }
    50%       { box-shadow: inset 0 0 0 4px rgba(239,68,68,0.8), 0 0 24px rgba(239,68,68,0.5), 0 8px 32px rgba(0,0,0,0.65); }
}

.hud-disconnected-badge {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 900;
    color: rgba(239,68,68,0.85);
    text-shadow: 0 1px 4px rgba(0,0,0,0.7);
    pointer-events: none;
}

/* Badge AFK — horloge, coin haut-droit, même taille que le jeton donneur */
.hud-afk-badge {
    position: absolute;
    top: -20px;
    right: -20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, #1a0d00 55%, #2d1800 100%);
    border: 2.5px solid #f59e0b;
    z-index: 10;
    box-shadow:
        0 0 10px rgba(245,158,11,0.55),
        0 3px 8px rgba(0,0,0,0.7),
        inset 0 0 6px rgba(245,158,11,0.12);
    pointer-events: none;
    animation: afk-glow 1s ease-in-out infinite;
    /* Marques des heures (12, 3, 6, 9) simulées par l'outline */
    outline: 1px solid transparent;
}

/* Aiguille des minutes — tourne en 10s (durée de AFK_GRACE_SECS) */
.hud-afk-badge::before {
    content: '';
    position: absolute;
    bottom: 50%;
    left: calc(50% - 1px);
    width: 2px;
    height: 12px;
    background: #f59e0b;
    border-radius: 1px 1px 0 0;
    transform-origin: bottom center;
    animation: afk-hand-min 10s linear infinite;
}

/* Chiffre centré — au-dessus des aiguilles */
.afk-badge-num {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fef08a;
    font-size: 0.82rem;
    font-weight: 900;
    text-shadow: 0 0 6px rgba(245,158,11,0.8), 0 1px 3px rgba(0,0,0,0.9);
    z-index: 1;
}

@keyframes afk-hand-min {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes afk-glow {
    0%, 100% { box-shadow: 0 0 8px rgba(245,158,11,0.4), 0 3px 8px rgba(0,0,0,0.7), inset 0 0 6px rgba(245,158,11,0.1); }
    50%       { box-shadow: 0 0 18px rgba(245,158,11,0.9), 0 3px 8px rgba(0,0,0,0.7), inset 0 0 6px rgba(245,158,11,0.2); }
}

/* Jeton donneur — centré sur le coin bas-droit de l'avatar */
.hud-dealer-chip {
    position: absolute;
    bottom: -20px;
    right: -20px;
    width: 40px;
    height: 40px;
    z-index: 10;
    filter: drop-shadow(0 3px 8px rgba(0,0,0,0.7));
    animation: drop-chip 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hud-name {
    font-size: 14px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
    max-width: 210px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* Équipe NOUS — bordure bleue */
.player-hud.hud-us .hud-avatar-wrap {
    border-color: rgba(96, 165, 250, 0.65);
    box-shadow: 0 0 22px rgba(96, 165, 250, 0.3), 0 8px 32px rgba(0, 0, 0, 0.65);
}

/* Équipe EUX — bordure rouge */
.player-hud.hud-them .hud-avatar-wrap {
    border-color: rgba(248, 113, 113, 0.65);
    box-shadow: 0 0 22px rgba(248, 113, 113, 0.3), 0 8px 32px rgba(0, 0, 0, 0.65);
}

/* Tour actif — halo or, légère mise à l'échelle */
.player-hud.hud-active .hud-avatar-wrap {
    border-color: #fbbf24;
    box-shadow: 0 0 36px rgba(251, 191, 36, 0.7), 0 8px 32px rgba(0, 0, 0, 0.65);
    transform: scale(1.05);
}

.player-hud.hud-active .hud-name {
    color: #fbbf24;
    text-shadow: 0 0 8px rgba(251, 191, 36, 0.6);
}

/* ==========================================================================
   BULLES D'ANNONCES SPÉCIALES (COINCHE / SURCOINCHE)
   Version "Pro & Sobre"
   ========================================================================== */

/* --- BULLES ÉQUIPE NOUS (bleu) et ÉQUIPE EUX (rouge) --- */
.speech-bubble.bubble-team-us {
    border-color: #60a5fa;
    box-shadow: 4px 4px 0px rgba(96, 165, 250, 0.4);
}
.speech-bubble.bubble-team-us::after  { border-color: #60a5fa transparent transparent transparent; }
.speech-bubble.bubble-bottom.bubble-team-us::after { border-color: transparent transparent #60a5fa transparent; }
.speech-bubble.bubble-left.bubble-team-us::after   { border-color: transparent #60a5fa transparent transparent; }
.speech-bubble.bubble-right.bubble-team-us::after  { border-color: transparent transparent transparent #60a5fa; }

.speech-bubble.bubble-team-them {
    border-color: #f87171;
    box-shadow: 4px 4px 0px rgba(248, 113, 113, 0.4);
}
.speech-bubble.bubble-team-them::after  { border-color: #f87171 transparent transparent transparent; }
.speech-bubble.bubble-bottom.bubble-team-them::after { border-color: transparent transparent #f87171 transparent; }
.speech-bubble.bubble-left.bubble-team-them::after   { border-color: transparent #f87171 transparent transparent; }
.speech-bubble.bubble-right.bubble-team-them::after  { border-color: transparent transparent transparent #f87171; }

/* Base commune pour les bulles spéciales */
.speech-bubble.bubble-coinche,
.speech-bubble.bubble-surcoinche {
    font-family: 'Roboto', sans-serif; /* Police standard du jeu */
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 16px;
    min-width: auto; /* On laisse le texte décider de la largeur */
    box-shadow: 0 4px 10px rgba(0,0,0,0.5); /* Ombre portée élégante */
    transform-origin: center center;
    /* On utilise l'animation d'entrée standard "pop" définie plus haut dans le CSS, 
       mais on force une taille un peu plus grande */
    transform: scale(1.1); 
}

/* --- STYLE COINCHE (Rouge Casino) --- */
.bubble-coinche {
    /* Dégradé Rouge profond, plus classe que le rouge pur */
    background: linear-gradient(180deg, #dc2626 0%, #991b1b 100%) !important; 
    color: white !important;
    border: 2px solid rgba(255,255,255,0.8) !important;
}

/* Petite flèche Rouge pour la Coinche */
.bubble-coinche::after { border-color: #991b1b transparent transparent transparent !important; }
.bubble-bottom.bubble-coinche::after { border-color: transparent transparent #dc2626 transparent !important; }
.bubble-left.bubble-coinche::after { border-color: transparent #dc2626 transparent transparent !important; }
.bubble-right.bubble-coinche::after { border-color: transparent transparent transparent #dc2626 !important; }


/* --- STYLE SURCOINCHE (Violet Royal & Or) --- */
.bubble-surcoinche {
    /* Dégradé Violet sombre */
    background: linear-gradient(180deg, #7c3aed 0%, #4c1d95 100%) !important; 
    color: #fcd34d !important; /* Texte Doré */
    border: 2px solid #fcd34d !important; /* Bordure Dorée */
}

/* Petite flèche Violette pour la Surcoinche */
.bubble-surcoinche::after { border-color: #4c1d95 transparent transparent transparent !important; }
.bubble-bottom.bubble-surcoinche::after { border-color: transparent transparent #7c3aed transparent !important; }
.bubble-left.bubble-surcoinche::after { border-color: transparent #7c3aed transparent transparent !important; }
.bubble-right.bubble-surcoinche::after { border-color: transparent transparent transparent #7c3aed !important; }


.think-bubble {
    position: absolute;
    background: rgba(30, 41, 59, 0.95); /* Fond sombre bleuté */
    border: 2px dashed #8b5cf6; /* Bordure violette pour la réflexion */
    border-radius: 16px;
    padding: 6px 10px;
    color: #c4b5fd;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    z-index: 100;
    white-space: nowrap;
    pointer-events: none;
}

/* Petits cercles pour l'effet "nuage de pensée" */
.think-bubble::before, .think-bubble::after {
    content: '';
    position: absolute;
    background: rgba(30, 41, 59, 0.95);
    border: 2px dashed #8b5cf6;
    border-radius: 50%;
}

.think-bubble::before { width: 8px; height: 8px; }
.think-bubble::after { width: 4px; height: 4px; }

/* Orientations et positionnement des cercles selon le joueur */
.think-bubble.bottom-pos {
    bottom: 115%; left: 50%; transform: translateX(-50%);
}
.think-bubble.bottom-pos::before { bottom: -10px; left: 50%; transform: translateX(-50%); }
.think-bubble.bottom-pos::after { bottom: -16px; left: 50%; transform: translateX(-50%); }

/* Joueur à DROITE de l'écran (J1) : La bulle s'affiche à sa GAUCHE */
.think-bubble.right-pos {
    right: 115%; top: 50%; transform: translateY(-50%);
}
.think-bubble.right-pos::before { right: -10px; top: 50%; transform: translateY(-50%); }
.think-bubble.right-pos::after { right: -16px; top: 50%; transform: translateY(-50%); }

.think-bubble.top-pos {
    top: 115%; left: 50%; transform: translateX(-50%);
}
.think-bubble.top-pos::before { top: -10px; left: 50%; transform: translateX(-50%); }
.think-bubble.top-pos::after { top: -16px; left: 50%; transform: translateX(-50%); }

/* Joueur à GAUCHE de l'écran (J3) : La bulle s'affiche à sa DROITE */
.think-bubble.left-pos {
    left: 115%; top: 50%; transform: translateY(-50%);
}
.think-bubble.left-pos::before { left: -10px; top: 50%; transform: translateY(-50%); }
.think-bubble.left-pos::after { left: -16px; top: 50%; transform: translateY(-50%); }

/* Transition douce */
.fade-think-enter-active, .fade-think-leave-active {
    transition: opacity 0.3s ease;
}
.fade-think-enter-from, .fade-think-leave-to {
    opacity: 0;
}

/* Swap Lobby */

.btn-swap {
    width: 2.5rem;       /* w-10 */
    height: 2.5rem;      /* h-10 */
    border-radius: 50%;  /* rounded-full */
    
    background-color: #374151; /* bg-gray-700 */
    border: 2px solid rgba(234, 179, 8, 0.5); /* border-yellow-500/50 */
    color: white;
    
    display: flex;
    align-items: center;
    justify-content: center;
    
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); /* shadow-xl */
    
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: scale(1);
    cursor: pointer;
}

.btn-swap:hover {
    background-color: #ca8a04; /* hover:bg-yellow-600 */
    border-color: white;       /* hover:border-white */
    transform: scale(1.1) rotate(180deg); /* Animation Zoom + Rotation */
}

/* ==========================================================================
   OVERLAY "RETOURNEZ VOTRE TÉLÉPHONE"
   ========================================================================== */

#rotate-overlay {
    display: none;
    position: fixed; inset: 0; z-index: 9999;
    background: #0d1b2a;
    color: white;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Arial Black', sans-serif;
    font-size: 1.2rem;
    text-align: center;
    gap: 20px;
}
#rotate-overlay .rotate-icon {
    font-size: 5rem;
    animation: rotate-hint 1.5s ease-in-out infinite alternate;
}
@keyframes rotate-hint {
    from { transform: rotate(0deg); }
    to   { transform: rotate(90deg); }
}
/* Visible sur écran tactile en portrait (téléphone/tablette retournés) */
@media (pointer: coarse) and (orientation: portrait) {
    #rotate-overlay { display: flex; }
}

/* ==========================================================================
   CENTRAGE DES MAINS SUD/NORD
   ========================================================================== */

/* translateX(-50%) recalcule depuis la largeur réelle de --hand-w */
#hand-0 {
    margin-left: 0 !important;
    transform: translateX(-50%) !important;
}
#hand-2 {
    margin-left: 0 !important;
    transform: translateX(-50%) rotate(180deg) !important;
}

