/* === GÉNÉRAL === */
   body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f2f5;
    color: #333;
    margin: 0;
    padding: 20px;
    text-align: center;
    
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center; 
    align-items: center;    
}

h1 { color: #2c3e50; }
a { color: #3498db; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Conteneur principal  */
.container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    box-sizing: border-box; 
}

.container.hero {
    max-width: 600px; 
    padding: 3rem 2rem;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

#welcome-msg {
    font-size: 1.1rem;
    color: #555;
    margin-bottom: 2rem;
}


.cta-group {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

/* === BOUTONS & FORMULAIRES ===== */
button, .btn, .btn-primary, .btn-secondary {
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    display: inline-block;
    transition: all 0.3s ease;
    text-decoration: none; 
    font-weight: 600;
}

button, .btn, .btn-primary {
    background-color: #3498db;
    color: white;
}

button:hover, .btn:hover, .btn-primary:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    text-decoration: none;
}

.btn-secondary {
    background-color: transparent;
    color: #3498db;
    border: 2px solid #3498db;
    padding: 10px 22px; 
}

.btn-secondary:hover {
    background-color: #eaf6ff;
    text-decoration: none;
}


#logoutBtn {
    background-color: #e74c3c;
    color: white;
}
#logoutBtn:hover {
    background-color: #c0392b;
}

/* Formulaires */
.login-container {
    max-width: 400px;
    width: 100%;
}

.form-group {
    margin-bottom: 15px;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
}

/* === PAGE DE JEU === */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    width: 100%;
    max-width: 800px;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #ecf0f1;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
}

select {
    padding: 8px;
    border-radius: 5px;
    border: 1px solid #bdc3c7;
}

.stats {
    font-size: 1.2rem;
    margin-bottom: 15px;
    font-weight: bold;
}

/* --- GRILLE & CARTES --- */
.memory-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin: 20px auto 50px auto;
    perspective: 1000px;
    max-width: 800px;
}

.memory-card {
    width: 100px;
    height: 100px;
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.5s;
}

.memory-card.flip {
    transform: rotateY(180deg);
}

.front-face, .back-face {
    width: 100%;
    height: 100%;
    position: absolute;
    border-radius: 8px;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.front-face {
    background-color: white;
    border: 2px solid #2c3e50;
    transform: rotateY(180deg);
    box-sizing: border-box;
}

.front-face img {
    width: 90%;
    height: 90%;
    object-fit: contain;
    display: block; 
}

.back-face {
    background-color: #2c3e50;
}

/* Scores Table */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
th, td { border: 1px solid #ddd; padding: 12px; text-align: left; }
th { background-color: #3498db; color: white; }
tr:nth-child(even) { background-color: #f2f2f2; }

/* === MEDIA QUERIES (RESPONSIVE) === */

/* --- TABLETTES (max 768px) --- */
@media screen and (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container.hero {
        padding: 2rem 1.5rem;
    }

    h1 {
        font-size: 2rem;
    }

    .memory-card {
        width: 80px;  
        height: 80px;
    }
}

/* --- MOBILES (max 480px) --- */
@media screen and (max-width: 480px) {
    .hero h1 {
        font-size: 1.8rem;
    }

    .cta-group {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    button, .btn, .btn-primary, .btn-secondary {
        width: 100%;
        margin: 0;
        margin-bottom: 5px;
        text-align: center;
        box-sizing: border-box;
    }

    header {
        flex-direction: column;
        gap: 10px;
    }

    .controls {
        flex-direction: column;
    }

    select {
        width: 100%;
        margin-bottom: 10px;
    }

    .memory-card {
        width: 70px;
        height: 70px;
    }
}