/* ===========================================================
   🎨 STYLE GLOBAL - Xsnake
   =========================================================== */

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #111; /* Fond sombre par défaut */
    color: #fff;
    text-align: center;
    overflow: hidden; /* Évite le scroll élastique sur mobile */
}

/* ===== TITRES ===== */

h1 {
    font-size: 2.2em;
    margin-top: 20px;
    letter-spacing: 1px;
}

h2 {
    font-size: 1.3em;
    margin-top: 25px; /* Un peu plus d'espace */
    margin-bottom: 15px;
    color: #ddd;
}

/* ===== PAGE MENU (OPTIONS) ===== */

#menu {
    background: #222;
    padding: 20px;
    border-bottom: 3px solid #444;
    height: 100vh; /* Prend tout l'écran au démarrage */
    box-sizing: border-box;
    overflow-y: auto;
}

/* --- NOUVEAU STYLE POUR LES LABELS --- */
#menu label {
    display: flex;
    align-items: center; /* Aligne parfaitement le bouton radio et le texte verticalement */
    justify-content: flex-start; /* Aligne le contenu à gauche à l'intérieur du label */
    
    margin: 12px auto; /* Centre le bloc du label horizontalement dans la page */
    width: fit-content; /* La largeur s'adapte au contenu */
    min-width: 150px; /* Largeur minimale fixe pour que les options s'alignent verticalement */
    
    font-size: 1.1em;
    cursor: pointer;
}

/* Cas particulier pour le label "Table unique" qui est plus large */
#menu > label:first-of-type {
    width: auto; /* Pas de largeur fixe */
    justify-content: center; /* Reste centré normalement */
    min-width: auto;
}

#menu input[type="radio"] {
    transform: scale(1.2);
    margin-right: 12px; /* Un peu plus d'espace entre le bouton et le texte */
}

#table_unique {
    margin-left: 10px;
    padding: 5px;
    font-size: 1em;
    border-radius: 5px;
    border: none;
}

#goBtn {
    margin-top: 35px;
    padding: 15px 45px;
    font-size: 1.5em;
    font-weight: bold;
    border: none;
    border-radius: 50px;
    background: linear-gradient(145deg, #28a745, #218838);
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}

#goBtn:active {
    transform: scale(0.95);
}

/* ===== ZONE DE JEU ===== */

#game {
    width: 100%;
    height: 100%;
    background: #111;
}

#questionZone {
    font-size: 1.5em;
    padding: 10px;
    background: #222;
    border-bottom: 3px solid #333;
    color: #ffc107; /* Jaune pour bien ressortir */
    font-weight: bold;
}

#questionZone h2 {
    margin: 0; /* Reset des marges pour la zone question */
    font-size: 1.2em;
}

/* ===== CANVAS ===== */

#gameCanvas {
    display: block;
    margin: 0 auto;
    background: #111;
    /* Important : évite le scroll et le zoom tactile pendant le jeu */
    touch-action: none; 
}

/* ===========================================================
   🏆 ÉCRAN DE FIN (OVERLAY)
   =========================================================== */

#endScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92); /* Fond très sombre transparent */
    backdrop-filter: blur(5px); /* Effet de flou moderne */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#endScreen h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.success-msg { color: #28a745; }
.fail-msg { color: #dc3545; }

/* Résumé des erreurs */
.error-summary {
    background: #222;
    padding: 15px 25px;
    border-radius: 12px;
    margin: 20px 0 30px 0;
    max-width: 85%;
    border: 1px solid #444;
    text-align: center;
}

.error-summary p {
    margin-top: 0;
    color: #aaa;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.error-item {
    color: #ffc107; /* Jaune */
    font-weight: bold;
    font-size: 1.1em;
    display: inline-block;
    margin: 5px 12px;
    padding: 5px 10px;
    background: rgba(255, 193, 7, 0.1); /* Fond jaune très léger */
    border-radius: 5px;
}

/* Conteneur des boutons */
.btn-container {
    display: flex;
    gap: 20px;
}

.end-btn {
    padding: 12px 25px;
    font-size: 1.1em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    color: white;
    transition: transform 0.2s, filter 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.end-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.end-btn:active {
    transform: translateY(1px);
}

.btn-menu {
    background: #17a2b8; /* Bleu info */
    box-shadow: 0 4px 0 #117a8b;
}

.btn-replay {
    background: #28a745; /* Vert succès */
    box-shadow: 0 4px 0 #1e7e34;
}
