* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


/**
 * Fond principal avec image arctique
 * Utilise une image de fond fixe pour l'immersion dans le thème
 */
body {

    font-family: 'Yusei Magic', sans-serif;
    background: url('./images/fond-arctique.jpg') center/cover no-repeat fixed;
    background-color: #0F4A8A;
    min-height: 100vh;
    color: #ffffff;
    position: relative;
    overflow-x: hidden;
}


.jeu-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}


.titre-zone {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;

}

.titre-principal {
    font-family: 'Yusei Magic', sans-serif;
    font-size: 3.5rem;
    line-height: 1.1;
    cursor: pointer;
}

.titre-mot {
    display: block;
    color: #ffffff;
    text-shadow: 2px 2px 0 rgba(15, 74, 138, 0.4), 0 4px 20px rgba(0,0,0,0.3);
}

.titre-mot.arctique {
    color: #F89F1F;
    text-shadow: 2px 2px 0 rgba(15, 74, 138, 0.5), 0 4px 24px rgba(248,159,31,0.4);
}

.bouton-retour {
    padding: 0.8rem 1.8rem;
    background: rgba(248, 159, 31, 0.9);
    backdrop-filter: blur(10px);
    color: #0F4A8A;

    text-decoration: none;
    border-radius: 50px;
    font-weight: 700;

    font-size: 1rem;
    transition: all 0.3s ease;
    border: 2px solid rgba(255,255,255,0.3);
    box-shadow: 0 8px 20px rgba(248,159,31,0.3);
}

.bouton-retour:hover {
    background: rgba(255,255,255,0.95);
    transform: translateY(-3px);
   
}


.page-accueil {
    position: relative;
    display: flex;
    justify-content: center;
}
 
/**
 * Pingouin décoratif sur la page d'accueil
 * Positionné en absolute, ne bloque pas les clics
 */
.pingouin-container {
    position: absolute;
    bottom: -20px;
    left: -120px;
    width: 200px;
    pointer-events: none; /* Ne bloque pas les interactions */
    z-index: 10;
}

 
.pingouin-container img {
    width: 100%;
    height: auto;

}

.panel-accueil {
    width: 100%;
    max-width: 800px;
    background: rgba(8, 32, 80, 0.55);
    border-radius: 24px;
    border: 1px solid rgba(135, 175, 228, 0.35);
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.8rem;
}
 
.texte-accroche {
    font-family: 'Yusei Magic', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: #ffffff;
    text-align: center;
    text-shadow: 0 2px 10px rgba(0,0,0,0.4);
    line-height: 1.4;
}
 
.img-memory {
    width: 160px;
    height: 160px;
    object-fit: contain;
    filter: drop-shadow(0 8px 20px rgba(0,0,0,0.35));
}
 
.bouton-jouer {
    padding: 1rem 3rem;
    background: #F89F1F;
    color: #0F4A8A;
    border: none;
    border-radius: 50px;
    font-family: 'Yusei Magic', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(248,159,31,0.4);
}
 
.bouton-jouer:hover {
    background: #ffffff;
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(248,159,31,0.5);
}
 
.hint-clavier {
    font-size: 0.9rem;
    color: #ffffff;
    text-align: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(135, 175, 228, 0.3);
    border-radius: 50px;
    padding: 0.6rem 1.5rem;
}

.hint-clavier strong {
    color: #F89F1F;
    background: rgba(248, 159, 31, 0.15);
    padding: 2px 10px;
    border-radius: 50px;
    border: 1px solid rgba(248, 159, 31, 0.3);
}

 
.page-jeu {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}
 
/* Barre stats */
.barre-stats {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: rgba(8, 32, 80, 0.65);
    border-radius: 20px;
    border: 1px solid rgba(135,175,228,0.3);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}
 
.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    flex: 1;
}
 
.stat-label {
    font-size: 0.75rem;
    color: #87AFE4;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
 
.stat-valeur {
    font-family: 'Yusei Magic', sans-serif;
    font-size: 1.8rem;
    color: #ffffff;
    line-height: 1;
}
 
.barre-boutons {
    display: flex;
    gap: 0.6rem;
    margin-left: auto;
}
 
.bouton-barre {
    padding: 0.55rem 1.2rem;
    background: rgba(255,255,255,0.08);
    color: #ffffff;
    border: 1px solid rgba(135,175,228,0.35);
    border-radius: 50px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}
 
.bouton-barre:hover {
    background: rgba(255,255,255,0.18);
    transform: translateY(-2px);
}
 
.bouton-barre.doré {
    background: #F89F1F;
    color: #0F4A8A;
    border-color: transparent;
}
 
.bouton-barre.doré:hover {
    background: #ffffff;
}
 

 
.grille-cartes {
    display: grid;
    gap: 1rem;
    margin: 0 auto;
    width: 100%;
}
 
/**
 * Grilles adaptatives selon le niveau
 * Niveau 1-2 : 4 colonnes
 * Niveau 3 : 5 colonnes pour optimiser l'espace
 */
.grille-cartes.niveau-1 {
    grid-template-columns: repeat(4, 1fr);
    max-width: 820px;
}
 
.grille-cartes.niveau-2 {
    grid-template-columns: repeat(4, 1fr);
    max-width: 820px;
}
 
.grille-cartes.niveau-3 {
    grid-template-columns: repeat(5, 1fr);
    max-width: 900px;
}
 
 
/**
 * Carte de jeu avec animation 3D
 * Utilise transform-style: preserve-3d pour la rotation 3D
 */
.carte {
    aspect-ratio: 3/4;
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 6px 14px rgba(0,0,0,0.3);
}

/**
 * Cartes carrées au niveau 3
 * Ratio 1:1 pour optimiser l'espace avec 20 cartes
 */
.grille-cartes.niveau-3 .carte {
    aspect-ratio: 1;
}
 
/* Animation au survol (sauf si déjà retournée ou trouvée) */
.carte:hover:not(.retournee):not(.trouvee) {
    transform: translateY(-6px) scale(1.03);
    box-shadow: 0 12px 24px rgba(0,0,0,0.4);
}


/**
 * État retournée - rotation 180° en Y
 * Classe ajoutée par JavaScript lors du clic
 */
.carte.retournee {
    transform: rotateY(180deg);
}
 

/**
 * État trouvée - rotation + opacité réduite
 * Plus d'interactions possibles (pointer-events: none)
 */
.carte.trouvee {
    transform: rotateY(180deg);
    pointer-events: none;
}
 
.carte.trouvee .face-arriere {
    opacity: 0.3;
    filter: grayscale(80%);
}
 

/**
 * Face de carte (avant et arrière)
 * backface-visibility: hidden cache la face non visible
 * C'est ce qui permet l'effet de retournement propre
 */
.face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden; /* necessaire pour effet 3D*/
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
 

/**
 * Face avant (dos de la carte)
 * Image du sapin en fond
 */
.face-avant {
    background-color: rgba(15, 74, 138, 0.7);
    border: 1.5px solid rgba(135,175,228,0.5);
    background-image: url('./images/pine-tree.png');
    background-size: 55%;
    background-repeat: no-repeat;
    background-position: center;
}
 

/**
 * Face arrière (image de l'animal)
 * Pré-retournée à 180° pour que l'effet 3D fonctionne
 */
.face-arriere {
    background: rgba(255,255,255,0.9);
    border: 1.5px solid rgba(135,175,228,0.6);
    transform: rotateY(180deg);
    padding: 0.8rem;
}
 
.face-arriere img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.15));
}
 

 
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
}
 
.modal.active {
    display: flex;
}
 
.modal-contenu {
    background: rgba(8, 32, 80, 0.95);
    border: 1px solid rgba(248,159,31,0.5);
    border-radius: 28px;
    padding: 3rem;
    text-align: center;
    max-width: 460px;
    width: 90%;
    box-shadow: 0 24px 60px rgba(0,0,0,0.4);
}
 
.modal-contenu h2 {
    font-family: 'Yusei Magic', sans-serif;
    font-size: 2.5rem;
    color: #F89F1F;
    margin-bottom: 1rem;
}
 
.modal-contenu p {
    font-size: 1.1rem;
    color: #87AFE4;
    margin-bottom: 0.5rem;
    font-weight: 600;
}
 
.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    margin-top: 2rem;
}
 
.bouton-modal {
    padding: 1rem 2rem;
    background: #F89F1F;
    color: #0F4A8A;
    border: none;
    border-radius: 50px;
    font-family: 'Yusei Magic', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px rgba(248,159,31,0.4);
}
 
.bouton-modal:hover {
    background: #ffffff;
    transform: translateY(-3px);
}
 
.bouton-modal.secondaire {
    background: rgba(255,255,255,0.08);
    color: #ffffff;
    border: 1px solid rgba(135,175,228,0.35);
    box-shadow: none;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95rem;
}
 
.bouton-modal.secondaire:hover {
    background: rgba(255,255,255,0.18);
}
 

 
.footer-credits {
    text-align: center;
    padding: 1.5rem 1rem;
    background: rgba(15,74,138,0.45);
    border-top: 1px solid rgba(135,175,228,0.2);
    margin-top: 2rem;
}
 
.footer-credits p { font-size: 0.8rem; color: #87AFE4; }
.footer-credits a { color: #F89F1F; text-decoration: none; font-weight: 600; }
.footer-credits a:hover { text-decoration: underline; }
 

/**
 * Conteneur de neige animée
 * Position fixed pour couvrir tout l'écran
 * pointer-events: none pour ne pas bloquer les clics
 */ 
#neige-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}
 

/**
 * Flocon de neige animé
 * Animation CSS avec keyframes pour effet de chute
 */
.flocon {
    position: absolute;
    top: -10px;
    color: rgba(255,255,255,0.9);
    user-select: none;
    pointer-events: none;
    animation: tomber linear infinite;
}
 
.flocon.petit  { font-size: 0.7rem; opacity: 0.5; }
.flocon.moyen  { font-size: 1.1rem; opacity: 0.7; }
.flocon.grand  { font-size: 1.6rem; opacity: 0.9; }
 

/**
 * Animation de chute de neige
 * Tombe de haut en bas avec rotation et mouvement horizontal
 */
@keyframes tomber {
    0%   { transform: translateY(0) translateX(0) rotate(0deg); opacity: 1; }
    50%  { transform: translateY(50vh) translateX(20px) rotate(180deg); }
    100% { transform: translateY(105vh) translateX(-20px) rotate(360deg); opacity: 0.15; }
}