body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f5f5f5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    box-sizing: border-box;
}

.main-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
    min-height: 400px;
}

/* Zone droite - Quiz et saisie */
.quiz-container {
    min-width: 200px;
    max-width: 400px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    border-left: 2px solid #eee;
    padding-left: 15px;
    margin-left: -25px;
}

/* Zone gauche - Grille */
.graph-container {
    flex: 1;
    min-width: 300px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 20px;
}

#grille {
    border: 1px solid #ddd;
    cursor: zoom-in;
    max-width: 90vw;
    max-height: 90vh;
    width: 350px;
    height: auto;
    aspect-ratio: 1 / 1;
    background-color: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Contrôles du quiz */
.controls-container {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.controls-container button {
    padding: 8px 16px;
    background-color: #4285f4;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.controls-container button:hover {
    background-color: #3367d6;
}

#mode-select {
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

/* Zone de saisie */
.inputs-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.ligne-reponse {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.ligne-reponse label {
    font-weight: bold;
    min-width: 25px;
    text-align: center;
}

.ligne-reponse input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 100%;
    max-width: 150px;
    transition: border 0.3s;
}

.ligne-reponse input:focus {
    border-color: #4285f4;
    outline: none;
}

.correct {
    background-color: #e6ffed;
    border-color: #2ecc40 !important;
}

.incorrect {
    background-color: #ffebee;
    border-color: #ff4136 !important;
}

/* Résultats et bilan */
.results-container {
    margin-top: 20px;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

#score-container {
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 10px;
}

#score-container div:last-child {
    font-size: 0.85em;
    color: #666;
    margin-top: 4px;
}

#message-final {
    font-weight: 500;
    margin: 10px 0;
}

/* Bilan animé */
#bilan-container {
    display: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease, padding-top 0.3s ease;
    margin-top: 15px;
    padding-top: 0;
    border-top: 1px solid #eee;
}

#bilan-container.visible {
    display: block; /* 👈 Active l'affichage */
    max-height: 500px;
    padding-top: 15px;
}


/* Bouton bilan avec flèche */
#bilan-btn {
    background-color: #34a853 !important;
    margin-top: 10px;
}

#bilan-btn:hover {
    background-color: #2d9248 !important;
}

#bilan-btn span {
    display: inline-block;
    transition: transform 0.3s ease;
    margin-left: 6px;
    font-size: 0.9em;
}

#bilan-btn.active span {
    transform: rotate(180deg);
}

/* Responsive */
@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }

    .quiz-container,
    .graph-container {
        width: 100%;
        max-width: 100%;
    }

    #grille {
        max-width: 100%;
    }
}

.ligne-reponse {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.ligne-reponse label {
    font-weight: bold;
    min-width: 25px;
    text-align: center;
}



.ligne-reponse input[type="number"] {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 40px;
    font-size: 1em;
    text-align: center;
}

.reponse-compilee {
    margin-left: auto;
    padding: 4px 8px;
    font-family: monospace;
    font-size: 1.1em;
    background-color: #eee;
    border-radius: 5px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.reponse-compilee.correcte {
    background-color: #e6ffed;
    color: #0a0;
}

.reponse-compilee.incorrecte {
    background-color: #ffebee;
    color: #d00;
}

/* Responsive : empile les blocs en-dessous de 500px */
@media (max-width: 500px) {
    .ligne-reponse {
        flex-direction: column;
        align-items: flex-start;
    }

    .reponse-compilee {
        margin-left: 0;
        margin-top: 6px;
    }
}

