body {
    font-family: 'Segoe UI', sans-serif;
    background: #f0f2f5;
    text-align: center;
    margin: 0;
    overflow-x: hidden;
}
 

/* --- PAGE 1 : ACCUEIL --- */
#page-accueil {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-image: url("patterns.png");
}
        
.hero-card {
    background: #EFEFEF;
    color: #2c3e50;
    padding: 50px;
    border-radius: 25px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
    max-width: 500px;
}

.btn-jouer {
    background: #512EE5;
    color: white;
    padding: 18px 50px;
    font-size: 1.8rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.3s;
    margin-top: 30px;
    box-shadow: 0 5px 15px rgba(39, 174, 96, 0.4);
}

.btn-jouer:hover {
    background: #512EE5;
    transform: scale(1.05);
}


/* --- PAGE 2 : JEU --- */
#page-jeu {
    display: none;
    padding: 20px;
    background-image: url("patterns.png");
}
        
.stats-bar { 
    background: white;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 10px; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    font-size: 1.2rem; 
    display: flex;
    justify-content: center;
    gap: 30px; 
}
        
#timer {
    color: #e74c3c;
    font-weight: bold;
}
        
.main-content {
    display: flex;
    justify-content: center;
    gap: 30px;
    align-items: flex-start;
}
        
.grille { 
    display: grid;
    grid-template-columns: repeat(15, 32px); 
    gap: 3px;
    background: #FFF200;
    padding: 10px;
    border-radius: 8px;
    user-select: none;
    touch-action: none;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.lettre { 
    width: 32px;
    height: 32px;
    background: white; 
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    font-weight: bold;
    border-radius: 2px;
    transition: 0.1s;
}

.selection {
    background: #3498db;
    color: white;
}

.valide {
    background: #2ecc71;
    color: white;
}

.erreur-flash {
    background: #e74c3c;
    color: white;
}

.panneau-mots { 
    width: 220px;
    background: white;
    padding: 15px;
    border-radius: 10px; 
    border: 2px solid #ddd;
    min-height: 480px;
    text-align: left; 
}

.panneau-mots h3 {
    margin-top: 0;
    color: #34495e;
    border-bottom: 2px solid #34495e;
    padding-bottom: 5px;
}

.mot-valide-item {
    color: #27ae60;
    font-weight: bold;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {from {
    opacity: 0; transform: translateX(10px);
} to { opacity: 1; transform: translateX(0); }
}

.controls {
    margin-top: 25px;
}

.btn-valider { 
    padding: 15px 45px;
    font-size: 1.2rem;
    cursor: pointer;
    border: none; 
    border-radius: 50px;
    font-weight: bold;
    background: #512EE5;
    color: white;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
    transition: 0.2s;
}


/* --- PAGE 3 : FIN ET CORRECTION --- */
#page-fin {
    display: none;
    padding: 20px;
    background-image: url("patterns.png");
}
    
.grille-correction { 
    display: grid;
    grid-template-columns: repeat(15, 25px); 
    gap: 2px;
    justify-content: center;
    margin: 20px 0;
    background: #2c3e50;
    padding: 10px;
    border-radius: 8px;
}

.lettre-corr { 
    width: 25px;
    height: 25px;
    background: rgba(255,255,255,0.1); 
    color: white;
    display: flex;
    align-items: center;
    justify-content: center; 
    font-size: 10px;
    font-weight: bold;
    border-radius: 2px;
}

.lettre-mot {
    background: #2ecc71;
    color: white;
}


/* ========== RESPONSIVE TABLETTE ========== */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
        align-items: center;
    }
    
    .panneau-mots {
        width: 100%;
        max-width: 520px;
        min-height: auto;
        margin-top: 20px;
    }
    
    .grille {
        grid-template-columns: repeat(15, 28px);
    }
    
    .lettre {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .hero-card {
        padding: 40px;
        margin: 20px;
    }
}

/* ========== RESPONSIVE MOBILE ========== */
@media (max-width: 768px) {
    .hero-card {
        padding: 30px 20px;
        margin: 15px;
        max-width: 90%;
    }
    
    .hero-card h1 {
        font-size: 1.8rem !important;
    }
    
    .hero-card p {
        font-size: 1rem !important;
    }
    
    .btn-jouer {
        padding: 14px 35px;
        font-size: 1.4rem;
    }
    
    .stats-bar {
        flex-direction: column;
        gap: 10px;
        font-size: 1rem;
        padding: 12px;
    }
    
    .grille {
        grid-template-columns: repeat(15, 22px);
        gap: 2px;
        padding: 8px;
    }
    
    .lettre {
        width: 22px;
        height: 22px;
        font-size: 10px;
    }
    
    .panneau-mots {
        width: 100%;
        max-width: 360px;
        padding: 12px;
    }
    
    .btn-valider {
        padding: 12px 30px;
        font-size: 1rem;
    }
    
    .grille-correction {
        grid-template-columns: repeat(15, 20px);
    }
    
    .lettre-corr {
        width: 20px;
        height: 20px;
        font-size: 8px;
    }
    
    #page-jeu, #page-fin {
        padding: 10px;
    }
}

/* ========== RESPONSIVE PETIT MOBILE ========== */
@media (max-width: 480px) {
    .hero-card {
        padding: 25px 15px;
        border-radius: 15px;
    }
    
    .hero-card h1 {
        font-size: 1.5rem !important;
    }
    
    .hero-card ul {
        padding-left: 15px;
        font-size: 0.9rem;
    }
    
    .btn-jouer {
        padding: 12px 30px;
        font-size: 1.2rem;
        margin-top: 20px;
    }
    
    .stats-bar {
        font-size: 0.9rem;
        padding: 10px;
        border-radius: 8px;
    }
    
    .grille {
        grid-template-columns: repeat(15, 18px);
        gap: 1px;
        padding: 6px;
        border-radius: 6px;
    }
    
    .lettre {
        width: 18px;
        height: 18px;
        font-size: 9px;
    }
    
    .panneau-mots {
        max-width: 100%;
        min-height: 150px;
    }
    
    .panneau-mots h3 {
        font-size: 0.95rem;
    }
    
    .mot-valide-item {
        padding: 6px 0;
        font-size: 0.9rem;
    }
    
    .btn-valider {
        padding: 10px 25px;
        font-size: 0.95rem;
    }
    
    .controls {
        margin-top: 15px;
    }
    
    .grille-correction {
        grid-template-columns: repeat(15, 16px);
        gap: 1px;
        padding: 6px;
    }
    
    .lettre-corr {
        width: 16px;
        height: 16px;
        font-size: 7px;
    }
}

/* ========== TRÈS PETIT ÉCRAN ========== */
@media (max-width: 360px) {
    .grille {
        grid-template-columns: repeat(15, 15px);
        padding: 4px;
    }
    
    .lettre {
        width: 15px;
        height: 15px;
        font-size: 8px;
    }
    
    .grille-correction {
        grid-template-columns: repeat(15, 14px);
    }
    
    .lettre-corr {
        width: 14px;
        height: 14px;
        font-size: 6px;
    }
    
    .hero-card h1 {
        font-size: 1.3rem !important;
    }
}