:root {
    /* Couleurs */
    --primary-bg: #8c6d59;
    --primary-bg-alt: rgb(232, 217, 177);
    --primary-border: #e3d39f;
    --alt-bg: #8c6d59;
    --text-color: black;
    --error-color: red;
    --success-color: green;

    /* Margins et paddings */
    --default-margin: 4px;
    --default-padding: 4px;

    /* Bordures */
    --default-border-radius: 8px;
    --default-border-width: 2px;

    /* Polices */
    --font-family-primary: Arial, sans-serif;
    --font-family-secondary: Courier, monospace;
    --font-size-small: 12px;
    --font-size-medium: 14px;
    --font-size-large: 16px;
}

body {
    user-select: none;
    -webkit-user-select: none; /* Pour Safari */
    -moz-user-select: none; /* Pour Firefox */
    -ms-user-select: none; /* Pour Internet Explorer */
    margin: 0;
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    background-color: var(--primary-bg-alt);
}
/* Overlay pour forcer le mode portrait sur mobile */
#portrait-warning {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    z-index: 9999;
    text-align: center;
    padding-top: 20%;
}
/* Icône de téléphone qui tourne en CSS */
.phone-rotate-icon {
    width: 40px;
    height: 70px;
    border: 3px solid white;
    border-radius: 6px;
    margin: 0 auto 20px;
    position: relative;
    animation: rotatePhone 2s ease-in-out infinite;
}

.phone-rotate-icon::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

@keyframes rotatePhone {
    0% { transform: rotate(90deg); }
    50% { transform: rotate(0deg); }
    100% { transform: rotate(90deg); }
}
/* ... existing code ... */
@media screen and (max-height: 500px) and (orientation: landscape) {
    #portrait-warning {
        display: block;
    }
    body {
        overflow: hidden; /* Empêche le scroll derrière l'alerte */
    }
}
label {
    display: block;
    margin-bottom: 10px;
}

.etiquette {
    font-weight: bold;
}
.titreZone {
    text-align: center;
    background-color: var(--primary-bg);
    border: 2px solid var(--primary-border);
    border-radius: 8px;
    color: white;
}

.formConnexion {
    margin: 12px 0;
}
.titreBoite {
    text-align: center;
    background-color: var(--primary-bg);
    border: 2px solid var(--primary-border);
    border-radius: 8px;
    color: white;
}
.containerPlateau {
    display: none;
    padding: 10px;
}

/* Nouveau conteneur principal flexible */
.main-layout {
    display: flex;
    flex-direction: column; /* Un au dessus de l'autre par défaut */
    align-items: center;
    gap: 20px;
    width: 100%;
}
/* Plateau de jeu */
.plateau, .barette, .affichage {
    background-color: var(--primary-bg);
    border: var(--default-border-width) solid var(--primary-border);
    border-radius: var(--default-border-radius);
    margin: var(--default-margin) 0;
    padding: var(--default-padding);
}

/* Style pour le plateau de jeu */
.plateau {
    display: grid;
    grid-template-columns: 0.9rem repeat(15, 2.55rem);
    grid-template-rows: 0.9rem repeat(15, 2.55rem);
    background-color: var(--alt-bg);
    width: fit-content; /* S'adapte au contenu grid */
    height: auto;
    margin: 0;
    padding: 0 var(--default-padding) var(--default-padding) 0;

    /* Effet d'épaisseur et relief */
    border: 2px solid #5d4037; /* Bordure bois plus sombre */
    border-radius: 4px;
    box-shadow:
        /* Ombre 1 : L'épaisseur du plateau (côté bas et droit) */
            4px 4px 0 #3e2723,
                /* Ombre 2 : L'ombre portée sur la table (plus floue) */
            10px 10px 20px rgba(0, 0, 0, 0.4);
}

/* css (par ex. dans ton fichier css principal) */
.casePlateau.preview-move {
    outline: 3px solid #ff9800;
    outline-offset: -3px;
    box-shadow: inset 0 0 0 2px rgba(255, 152, 0, 0.35);
}
.casePlateau.preview-move-joker {
    outline: 3px dashed #ff9800;
}

.bestMoveDock {
    display: none;
    margin: 10px 0;
    padding: 10px;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.commandes-container {
    background-color: #ddc59e;
    width: 100%;
    max-width: 40rem; /* Garde une largeur cohérente avec le plateau */
    padding: 5px 10px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    margin: 0;
}
/* Media Query pour les écrans larges ou l'orientation paysage */
@media (min-width: 992px) {
    .main-layout {
        flex-direction: row; /* Côte à côte */
        justify-content: center;
        align-items: flex-start;
    }

    .plateau {
        margin: 0;
    }

    .commandes-container {
        width: 40rem; /* Même largeur que le plateau pour l'équilibre */
    }
}

.ligne, .colonne {
    display: flex;
    align-items: center; /* Aligns the text vertically */
    justify-content: center; /* Optional: centers the text horizontally too */
    color: var(--primary-bg-alt);
    font-size: var(--font-size-small);
    font-weight: bold;
}
.ligne {
    border-top: 1px solid black;
    border-bottom: 1px solid black;
}
.colonne {
    border-left: 1px solid black;
    border-right: 1px solid black;
}
.ligne:nth-child(1) {
    border-top: none;
}
.colonne:nth-child(1) {
    border-left: none;
}
/* Style pour la barette */
.barette {
    display: none;
    grid-template-columns: repeat(7, 2.55rem);
    width: auto;
    height: 3.25rem;
    z-index: 100;
}
.old-barette {
    display: none;
    grid-template-columns: repeat(7, 2rem);
    width: auto;
    height: 2rem;
    z-index: 100;
}
.div-barette {
    min-height: 4rem;
    min-width: 18rem;
    display: flex;
    justify-content: center;
    align-items: center;
}
.barette.mode-echange {
    border: 3px solid green;
    box-shadow: 0 0 8px rgba(0, 128, 0, 0.5);
}

/* Style pour les scores */
.affichage {
    width: 40rem;
    height: auto;
    font-size: var(--font-size-medium);
    background-color: var(--primary-border);
    border-color: var(--primary-bg);
    border-style: solid;
    border-width: 2px;
    border-radius: var(--default-border-radius);
    padding: 4px;
    margin: 4px;
}
.scores {
    display: grid;
    /* On définit 4 colonnes de largeur identique (1fr = 1 fraction de l'espace disponible) */
    grid-template-columns: repeat(4, 1fr);
    /* On définit les 2 lignes */
    grid-template-rows: repeat(2, auto);
    gap: 10px; /* Espace entre les cases */
    align-items: center;
    width: 100%;
    /* Empêche le contenu de déborder de la cellule */
    overflow: hidden;
}
.scoreCoupValide {
    color: var(--success-color) !important;
}

.scoreCoupInvalide {
    color: var(--error-color) !important;
}
.scores-header {
    background-color: #5d4037; /* Votre marron */
    color: white;
    font-weight: bold;
}

.scores-header .btn-outline-light {
    border: none;
}

.led-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    box-shadow: 0 0 3px rgba(0,0,0,0.5);
}

.led-online {
    background-color: #2ecc71; /* Vert */
    box-shadow: 0 0 8px #2ecc71;
}

.led-offline {
    background-color: #e74c3c; /* Rouge */
    box-shadow: 0 0 4px #e74c3c;
}

/* Style pour les messages */
.chat {
    display: block;
}
.messages {
    background-color: white;
    border-radius: var(--default-border-radius);
    border-color: var(--primary-border);
    border-style: solid;
    border-width: 2px;
    font-size: 0.8em;
    margin: 4px 0 0 0;
    height: 10vh;
    overflow: auto;
}
.texteMessage {
    width: 80%;
}
.date {
    font-weight: bold;
}
.pseudo {
    font-weight: bold;
    font-family: Courier, monospace;
}
.titre {
    display: block;
    width: auto;
    height: auto;
    font-size: var(--font-size-large);
    font-weight: bold;
    padding: 4px;
}
.scoresJoueurs {
    display: grid;
    gap: 4px;
    grid-template-columns: repeat(2, auto);
    grid-template-rows: auto;
    height: auto;
    font-family: Courier, monospace;
    font-size: var(--font-size-large);
    background-color: white;
    border-color: var(--primary-border);
    color: black;
    border-style: solid;
    border-width: 2px;
    border-radius: var(--default-border-radius);
    padding: 4px;
    margin: 4px 0 0 0;
}
.dernierTirage {
    font-family: Courier, monospace;
    font-size: var(--font-size-large);
    color: black;
}

.dernier-coup-gagnant {
    grid-column: 1 / span 2;
    background-color: antiquewhite;
    /* border-bottom: 1px solid #dee2e6;
    margin-bottom: 4px;
    padding: 4px; */
    font-size: var(--font-size-large);
    font-style: italic;
    color: #666;
    text-align: center;
}
.item-score-joueur {
    display: flex;
    align-items: center;
    background-color: antiquewhite;
    /* padding: 4px; */
}
.winner-name {
    font-weight: bold;
    color: #2c3e50;
}

.bestMoveList {
    display: grid;
    grid-template-columns: repeat(2, auto); /* Utilisation de fractions au lieu de 22rem */
    gap: 5px; /* Ajout d'un petit espace entre les boutons */
    height: auto;
    background-color: white;
    border-color: var(--primary-border);
    color: black;
    border-style: solid;
    border-width: 2px;
    border-radius: var(--default-border-radius);
    padding: 4px;
    margin: 4px 0 0 0;
}
/* Header, Footer */
header, footer {
    margin-top: auto;
    background-color: var(--primary-bg);
    color: var(--primary-border);
    text-align: center;
    font-size: 18px;
}
#header_message_zone {
    min-height: 1em; /* Réserve l'espace pour une ligne de texte */
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 500;
}
/* Optionnel : animation fluide quand le texte change */
#g_headerHTML {
    transition: opacity 0.3s ease;
}

.modalChoixJocker {
    display: none; /* Hidden by default */
    z-index: 1000; /* Sit on top */
    background-color: var(--primary-bg);
    border: var(--default-border-width) solid var(--primary-border);
    border-radius: var(--default-border-radius);
    margin: var(--default-margin) 0;
    padding: var(--default-padding);
    color: white;
    width: auto;
    height: auto;
}
.modal-header-jocker {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

/* Modal Content/Box */
.modalChoixJocker-content {
    display: grid;
    grid-template-columns: repeat(13, 2.55rem);
    grid-template-rows: repeat(2, 2.55rem);
    width: auto;
    height: auto;
}

/* The Close Button */
.closeModal {
    color: white;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    padding: 0 10px;
    line-height: 1;
}
.closeModal:hover,
.closeModal:focus {
    color: #ccc;
    text-decoration: none;
}
.button-bestmove {
    background-color: antiquewhite;
    border: 1px solid var(--primary-border); /* Ajout d'une bordure visible */
    border-radius: var(--default-border-radius);
    color: black;
    text-align: center;
    width: 100%; /* S'assure que le bouton prend toute la largeur de sa colonne grid */
    padding: 5px 2px;
    font-size: var(--font-size-small);
    cursor: pointer;
}
.button {
    background-color: antiquewhite;
    border-color: var(--primary-border);
    color: black;
    text-align: center;
    display: inline-block;
    border-radius: var(--default-border-radius);
    /* box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); */
    width: 100%;
    padding: 0 4px 0 4px;
    margin: 4px;
}
.button-bold {
    background-color: antiquewhite;
    border-color: var(--primary-border);
    color: black;
    text-align: center;
    display: inline-block;
    font-weight: bold;
    border-radius: var(--default-border-radius);
    box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
    padding: 0 8px 0 8px;
    margin: 4px;
}
.button-w100 {
    background-color: antiquewhite;
    border-color: var(--primary-border);
    color: black;
    text-align: center;
    display: inline-block;
    font-weight: bold;
    border-radius: var(--default-border-radius);
    box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
    width: 100%;
    padding: 0 8px 0 8px;
    margin: 0;
}
#buttonValider:disabled, #buttonRappeler:disabled, #buttonEchanger:disabled, #buttonPauseReprendre:disabled, #buttonMelanger:disabled {
    opacity: 0.5;
    filter: grayscale(100%); /* Optionnel : rend le bouton gris */
    cursor: not-allowed !important;
    pointer-events: auto; /* Permet quand même de voir le tooltip au survol */
}
.form-check-label {
    font-weight: bold;
}

.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.textScore {
    background-color: antiquewhite;
    border: 1px solid var(--primary-bg);
    color: black;
    text-align: center;
    display: inline-block;
    font-weight: bold;
    width: 100%;
    margin: 2px;
    /* On empêche le texte de passer à la ligne si trop long */
    white-space: nowrap;
    /* On ajoute des points de suspension si le texte est vraiment trop long */
    overflow: hidden;
    text-overflow: ellipsis;
    /* Optionnel : fixer une largeur min si nécessaire */
    min-width: 0;
}
.textInput {
    background-color: antiquewhite;
    border: 2px solid var(--primary-border);
    border-radius: var(--default-border-radius);
    color: black;
    display: inline-block;
}
.textLabel {
    color: var(--primary-bg);
    font-weight: bold;
}

.resultats-container {
    max-height: 400px;
    overflow-y: auto;
    background-color: white;
    border: 2px solid var(--primary-border);
    border-radius: var(--default-border-radius);
    padding: 10px;
    margin-top: 10px;
}

.resultats-container table {
    margin-bottom: 0;
}

/* Style des cases */
.casePlateau {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: Arial, sans-serif;
    font-size: 7px;
    border: 1px solid black;
    text-align: center;
}
/* Style des pions */
.pion {
    width: 2.45rem;
    height: 2.45rem;
    object-fit: contain;
    object-position: center;
    touch-action: none;
}
/* .pionBarette {
    width: 3rem;
    height: 3rem;
    object-fit: contain;
    object-position: center;
    touch-action: none;
} */
.pion-old-barette {
    width: 2rem;
    height: 2rem;
    object-fit: contain;
    object-position: center;
    touch-action: none;
}
.pion-selectionne {
    filter: brightness(0.7) sepia(1) hue-rotate(-50deg) saturate(5); /* Effet rouge/orangé */
    border: 3px solid #ff4444 !important;
    transform: translateY(-10px); /* Le pion se lève un peu */
}
.pion-last-move-highlight {
    filter: brightness(1.1) contrast(1.1) drop-shadow(0 0 5px #ffc107) drop-shadow(0 0 2px #ffc107);
    z-index: 2;
}

/* Couleurs des cases du plateau */
.white {
    background-color: white;
    color: black;
}
.grey {
    background-color: grey;
    color: black;
}
.pink {
    background-color: pink;
    color: black;
}
.lightblue {
    background-color: lightblue;
    color: black;
}
.blue {
    background-color: blue;
    color: white;
}
.red {
    background-color: red;
    color: white;
}
.confirm-dialog {
    display: none;
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--primary-bg);;
    border: 2px solid #ccc;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    min-width: 300px;
    text-align: center;
    color: white;
}