.quiz-wrapper {
    display: flex;
    flex-direction: row; /* Côte à côte sur grand écran */
    align-items: flex-start;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    font-family: 'Georgia', serif;
}
/* Menu */
.menu {
    position: sticky;
    top: 20px; 
    width: 220px;
    background: #333;
    color: #fff;
    padding: 20px;
    box-sizing: border-box;
    height: 100vh; /* Prend toute la hauteur de la fenêtre */
    overflow-y: auto; /* Défilement si le contenu dépasse */
    margin:10px;
    border-radius: 10px;
}

/* Contenu du quiz */
.content {
    flex: 1;
    order:2;
    padding: 20px;
    overflow-y: auto; /* Permet le défilement du contenu */
    display: flex;
    justify-content: center;
}

.content p {
     line-height: 1.3;
     font-size:16px;
}
    .menu h2 {
        margin-top: 0;
        font-size: 18px;
        border-bottom: 1px solid #555;
        padding-bottom: 10px;
        color: #ffffff;
    }
    .menu a {
        color: #fff;
        text-decoration: none;
        display: block;
        margin: 8px 0;
        font-size: 16px;
        line-height: 1.3;
    }
    
    .menu p {
        color: #fff;
        text-decoration: none;
        display: block;
        margin: 8px 0;
        font-size: 16px;
    }
    .menu a:hover {
        text-decoration: underline;
    }
    /* --- Contenu du quiz --- */
    .content {
        flex: 1;
        padding: 20px;
        display: flex;
        justify-content: center;
    }
    .quiz-container {
        max-width: 700px;
        width: 100%;
        background-color: #fff;
        padding: 20px;
        border-radius: 10px;
        box-shadow: 0 0 10px rgba(0,0,0,0.1);
    }
    .question {
        margin-bottom: 12px;
    }
    .question p {
        margin: 10px 0px 10px 0px;
    }
    .choice {
        padding: 3px 5px;
        display: block;
        font-size: 16px;
        cursor: pointer;
    }
    .correct { background-color: #b6f7b0; }
    .incorrect { background-color: #f7b0b0; }
    
    .buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.result-line {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 18px;
    margin-top: 10px;
}

.score {
    color: #7e0000;
    font-weight: bold;
}

    button:hover { background-color: #555; }
    #resultat { margin-top: 15px; }

.buttons button {
    background-color: #000;   /* noir */
    color: #fff;              /* texte blanc */
    border: none;
    padding: 8px 14px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.buttons button:hover {
    background-color: #222;
}

.quiz-link.locked {
    pointer-events: none;
    opacity: 0.5;
    cursor: not-allowed;
}

.quiz-link .check {
    margin-left: 6px;
    color: #2ecc71;
    font-weight: bold;
}
.classement {
    margin-top: 10px;
    font-size: 1.1rem;
    color: #f39c12;
    font-weight: bold;
}
.btn-next {
    margin-top: 15px;
    padding: 10px 20px;
    background: #2ecc71;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
}

h1 {
    color: #2c3e50;
    margin: 0.2em 0em 1em 0em;
}
.card {
    background: #ecf0f1;
    padding: 20px;
    margin: 15px 0;
    border-radius: 8px;
    font-size: 1.2em;
}
button {
    background: #3498db;
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1em;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 20px;
}
button:hover {
    background: #2980b9;
}
table {
    border-collapse: collapse;
    width: 100%;
    table-layout: fixed;
    overflow-x: auto;
}
th, td {
    border: 1px solid #bdc3c7;
    padding: 5px;
    text-align: center;
}
th {
    background-color: #3498db;
    color: white;
    position: sticky;
    top: 0;
}
td {
    background-color: #ecf0f1;
}
/* Conteneur pour limiter la largeur globale et centrer */
.table-container {
    width: 100%;
    max-width: 600px; /* Largeur maximale du tableau */
    margin: 20px auto; /* Centre le tableau horizontalement */
    overflow-x: auto;
}

#tableTop {
    width: 100%;
    max-width: 400px; /* On réduit encore un peu pour un effet "compact" */
    margin: 0 auto;
    table-layout: auto; /* Laissez le navigateur ajuster selon le contenu du score */
    border-collapse: collapse;
}

/* Colonne Rang : Petit et fixe */
#tableTop th:first-child, 
#tableTop td:first-child {
    width: 60px;
    min-width: 60px;
}

/* Colonne Score : S'adapte mais ne dépasse pas une certaine limite */
#tableTop th:last-child, 
#tableTop td:last-child {
    width: auto; 
    min-width: 150px;
}

/* Style général des cellules pour éviter que le texte ne colle */
#tableTop th, #tableTop td {
    padding: 5px 3px;
    border: 1px solid #ddd;
}
#tableTop td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap; /* Empêche le score de revenir à la ligne */
}

.content.bilan .table-container {
    width: 100%;
    max-width: 500px; /* Doit être identique au max-width du tableTop */
    margin: 30px auto;
    overflow-x: hidden; /* Plus besoin de scroll si on n'a que 2 colonnes */
}

/* menu pour petits écrans */
/* Pour les petits écrans */
@media (max-width: 768px) {
     
    .quiz-wrapper {
        flex-direction: column; /* Empilement vertical sur mobile */
    }

    .menu {
        order: -1; /* Place le menu au-dessus du contenu */
        width: 100% !important;
        height: auto !important;
        position: static !important;
        margin: 0 0 20px 0 !important;
    }
    
    .content {
        width: 100% !important;
        padding: 10px !important;
    }
}


/* quiz container */
.quiz-container { 
    max-width:700px; 
    width:100%; 
    background:#fff; 
    padding:20px; 
    border-radius:10px; 
    box-shadow:0 0 10px rgba(0,0,0,0.1);
}

/* question */
.question { margin-bottom:12px; }
.question p { margin:4px 0; }
.choice { padding:3px 5px; display:block; margin-bottom:4px; font-size:16px; cursor:pointer; }
.correct { background-color:#b6f7b0; }
.incorrect { background-color:#f7b0b0; }

/* boutons */
.buttons { display:flex; gap:10px; margin-top:15px; flex-wrap:wrap; }
.buttons button { background:#000; color:#fff; border:none; padding:8px 14px; border-radius:5px; cursor:pointer; font-size:14px; }
.buttons button:hover { background:#222; }
.buttons button:focus, .buttons button:active { outline:none; box-shadow:none; }

/* résultat */
.result-line { display:flex; align-items:center; gap:20px; font-size:18px; margin-top:10px; flex-wrap:wrap; }
.score { color:#7e0000; font-weight:bold; }

.quiz-link.locked {
    pointer-events: none;
    opacity: 0.5;
    cursor: default;
}

#tableTopScores {
    border-collapse: collapse;
    text-align: center;
    width: 100%;
}
#tableTopScores th {
    background-color: #3498db;
    color: white;
    position: sticky;
    top: 0;
}
#tableTopScores td {
    background-color: #ecf0f1;
}

/* ===============================
   PAGE BILAN FINAL
   =============================== */

body:has(.bilan) {
    display: block; /* on annule le layout menu */
}

.content.bilan {
    max-width: 1200px;
    margin: 0 auto;
    display: block; /* annule le centrage flex */
}

.content.bilan h1 {
    text-align: center;
    margin-bottom: 0px;
}

.content.bilan h2 {
    margin-top: 40px;
    text-align: center;
}

/* cartes score */
.content.bilan .cards {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.content.bilan .card {
    min-width: 220px;
    text-align: center;
    font-size: 1.4rem;
}

/* bouton recommencer */
.content.bilan button {
    display: block;
    margin: 30px auto;
    font-size: 1.1rem;
}

/* tableau */
.content.bilan .table-container {
    margin-top: 30px;
    overflow-x: auto;
}

.content.bilan table {
    min-width: 0px;
}
.col-player {
    background-color: #ffeaa7 !important;
    font-weight: bold;
}
.row-player {
    background-color: #fab1a0 !important;
    font-weight: bold;
}
.diagonal-header {
    position: relative;
    width: 150px; 
    height: 50px;
    padding: 0 !important;
    
    /* 1. On remet la couleur de fond des autres th (ex: #f8f9fa) */
    background-color: #3498db; 
    
    /* 2. On ajoute la ligne par-dessus le fond */
    background-image: linear-gradient(to top right, 
        transparent calc(50% - 0.5px), 
        #888, 
        transparent calc(50% + 0.5px)
    );
}

.diagonal-header .top-right {
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 0.85em;
}

.diagonal-header .bottom-left {
    position: absolute;
    bottom: 5px;
    left: 10px;
    font-size: 0.85em;
}

/* On s'assure que les autres cellules th restent bien alignées */
#theadTop th {
    vertical-align: middle;
}

/* Style pour la ligne du joueur */
.row-player {
    background-color: #fff4d1 !important; /* Un jaune/orangé très clair */
    outline: 2px solid #fdcb6e; /* Optionnel : ajoute un contour pour bien marquer la ligne */
}

/* Style pour la cellule exacte où se trouve le joueur (intersection ligne/colonne) */
.row-player .col-player {
    background-color: #fdcb6e !important; /* Couleur plus vive à l'intersection */
    color: #000;
}