/* =========================================
   LE JEU SET - STRUCTURE PRINCIPALE
   ========================================= */
#jeu-set {
    max-width: 1100px;
    margin: 0 auto;
    /* min-height pour repousser le footer */
    min-height: calc(100vh - 170px); 
    display: flex;
    flex-direction: column;
}

.hud {
    flex-shrink: 0; 
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 1.2rem;
    font-weight: bold;
}

#btn-plus-cartes,
#btn-indice,
#btn-rejouer {
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}

#btn-plus-cartes {
    background-color: var(--d-blue);
}
#btn-indice {
    background-color: var(--d-dark-blue);
}
#btn-plus-cartes:hover,
#btn-indice:hover {
    background-color: var(--d-orange);
}
#btn-rejouer {
    background-color: var(--d-green);
}
#btn-rejouer:hover {
    background-color: var(--d-dark-blue);
}

/* =========================================
   LE PLATEAU : LOGIQUE ORIENTATION
   ========================================= */
#plateau-set {
    flex-grow: 1; 
    display: grid;
    gap: 15px;
    padding: 15px;
    background-color: var(--d-light-blue);
    border-radius: 15px;
    align-content: start;
}

/* --- MODE PAYSAGE (PC / Écrans larges) --- */
@media screen and (orientation: landscape) {
    #plateau-set {
        grid-template-columns: repeat(4, 1fr); /* 4 colonnes */
        grid-auto-rows: minmax(0, 1fr);
    }
    
    .carte-set { /* Carte "couchée" */
        aspect-ratio: 3 / 2;
        flex-direction: row;
        padding: 5px 15px;
    }
    
    .carte-set svg {
        height: 85%;       /* Prend la hauteur disponible */
        max-width: 28%;    /* Limite la largeur pour en mettre 3 */
        transform: rotate(-90deg); /* Tourne la forme de 90° */
    }
}

/* --- MODE PORTRAIT (Smartphones / Tablettes verticales) --- */
@media screen and (orientation: portrait) {
    #plateau-set {
        grid-template-columns: repeat(3, 1fr); /* 3 colonnes */
        grid-auto-rows: minmax(0, 1fr);
    }
    
    .carte-set { /* Carte "debout" */
        aspect-ratio: 2 / 3;
        flex-direction: column;
        padding: 15px 5px;
    }
    
    .carte-set svg {
        width: 85%;        /* Prend la largeur disponible */
        max-height: 28%;   /* Limite la hauteur pour en mettre 3 */
        transform: none;   /* Forme verticale standard */
    }
}

/* =========================================
   STYLE COMMUN DES CARTES
   ========================================= */
.carte-set {
    background-color: white;
    border-radius: 12px;
    border: 2px solid #ddd;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    
    width: 100%;
    height: auto;
    
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5%; 
    cursor: pointer;
    transition: transform 0.1s, border-color 0.1s;
}

.carte-set:hover { transform: translateY(-5px); }
.carte-set.selected {
    border-color: var(--d-orange);
    border-width: 4px;
    box-shadow: 0 0 15px rgba(243, 120, 59, 0.4);
}

/* --- CLASSES D'ANIMATION --- */

/* Apparition (Pop-In) */
.anim-pop {
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) backwards;
}

@keyframes popIn {
    0% { opacity: 0; transform: scale(0.5) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* Vibration (Indice) */
.carte-indice {
    animation: shakeIndice 0.3s ease-in-out 2 !important;
    border-color: var(--d-blue) !important;
    box-shadow: 0 0 15px var(--d-blue) !important;
}

@keyframes shakeIndice {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px) rotate(-1deg); }
    75% { transform: translateX(5px) rotate(1deg); }
}

/* --- NOTIFICATION PERSONNALISÉE --- */
#notification-set {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    color: white;
    padding: 20px 40px;
    border-radius: 50px;
    font-size: 1.5rem;
    font-weight: bold;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    opacity: 0;
    pointer-events: none; /* Empêche la notification de bloquer les clics en dessous */
    
    /* L'animation élastique */
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 9999;
}

#notification-set.notif-show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Couleurs selon le type de message */
.notif-success {
    background-color: var(--d-green);
}

.notif-error {
    background-color: var(--d-orange);
}

/* =========================================
   RÈGLES DU JEU (Sous le plateau)
   ========================================= */

.regles-jeu {
    margin-top: 50px;
    padding: 35px;
    background-color: #ffffff;
    border-radius: 15px;
    border: 1px solid #eaeaea;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    line-height: 1.6;
}

.regles-jeu h2 {
    color: var(--d-dark-blue);
    margin-top: 0;
    font-size: 1.6rem;
}

.regles-jeu h3 {
    color: var(--d-blue);
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

ul.regles-liste {
    margin-top: 15px;
    margin-bottom: 25px;
    padding-left: 0;
}

ul.regles-liste li {
    margin-bottom: 8px;
    font-size: 1.05rem;
}

/* Boîtes d'exemples */
.exemples-set {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.exemple-carte {
    flex: 1;
    background-color: var(--d-light-blue);
    padding: 20px;
    border-radius: 10px;
    border-left: 5px solid var(--d-green);
    transition: transform 0.2s ease;
}

.exemple-carte:hover {
    transform: translateY(-3px);
}

.exemple-carte h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--d-dark-blue);
    font-size: 1.1rem;
}

.exemple-carte p {
    margin-bottom: 0 !important;
    font-size: 0.95rem;
    color: #333;
}

@media screen and (max-width: 768px) {
    .exemples-set {
        flex-direction: column;
    }
}