@import url(‘https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap’);#quiz-container {
font-family: ‘Poppins’, sans-serif;
background-color: #ffffff;
border-radius: 15px;
box-shadow: 0 8px 25px rgba(0,0,0,0.1);
width: 100%;
max-width: 650px;
padding: 35px 40px;
margin: 20px auto;
box-sizing: border-box;
}
#quiz-container h1 {
text-align: center;
color: #2c3e50;
margin-bottom: 25px;
font-weight: 700;
font-size: 2em;
}
#question-text {
font-size: 1.4em;
font-weight: 600;
margin-bottom: 20px;
color: #34495e;
}
.btn-grid {
display: grid;
grid-template-columns: 1fr;
gap: 12px;
}
.btn {
background-color: #f4f4f9;
border: 1px solid #ddd;
border-radius: 8px;
padding: 15px 20px;
font-size: 1.1em;
cursor: pointer;
text-align: left;
transition: all 0.3s ease;
}
.btn:hover:not(:disabled) {
background-color: #e9e9f3;
}
.btn.correct {
background-color: #eafaf1;
border-color: #27ae60;
color: #27ae60;
font-weight: 600;
}
.btn.wrong {
background-color: #fdeded;
border-color: #e74c3c;
color: #e74c3c;
}
.btn:disabled {
cursor: not-allowed;
}
#definition-container {
margin-top: 20px;
padding: 15px;
background-color: #f8f9fa;
border-left: 5px solid #5dade2;
border-radius: 5px;
font-size: 0.95em;
}
.hide { display: none; }
#controls {
display: flex;
justify-content: space-between;
margin-top: 25px;
border-top: 1px solid #eee;
padding-top: 15px;
}
#submit-btn {
background-color: #e0f2f7;
border: 2px solid #a8dadc;
border-radius: 8px;
padding: 10px 25px;
font-weight: 600;
cursor: pointer;
}
#result {
text-align: center;
margin-top: 25px;
}
#score-text {
font-size: 1.8em;
font-weight: 700;
color: #2980b9;
}
const questionText = document.getElementById(« question-text »);
const answerButtons = document.getElementById(« answer-buttons »);
const definitionBox = document.getElementById(« definition-container »);
const progress = document.getElementById(« progress »);
const submitBtn = document.getElementById(« submit-btn »);
const resultBox = document.getElementById(« result »);let index = 0;
let score = 0;const questions = [
{
question: »Que signifie le mot « apocryphe » ? »,
answers:[
{text: »Officiel et reconnu »,correct:false},
{text: »Douteux ou non authentifié »,correct:true},
{text: »Très ancien »,correct:false},
{text: »Sacré »,correct:false}
],
definition: »Apocryphe désigne un texte ou un fait dont l’authenticité est douteuse. »
},
{
question: »Que veut dire « péremptoire » ? »,
answers:[
{text: »Incertain »,correct:false},
{text: »Qui ne souffre aucune réplique »,correct:true},
{text: »Très lent »,correct:false},
{text: »Désordonné »,correct:false}
],
definition: »Péremptoire qualifie une affirmation catégorique et autoritaire. »
},
{
question: »Qu’est-ce qu’un « thuriféraire » ? »,
answers:[
{text: »Un critique sévère »,correct:false},
{text: »Un admirateur excessif »,correct:true},
{text: »Un religieux isolé »,correct:false},
{text: »Un artisan »,correct:false}
],
definition: »Un thuriféraire est une personne qui loue quelqu’un avec excès. »
},
{
question: »Que signifie « sibyllin » ? »,
answers:[
{text: »Très bruyant »,correct:false},
{text: »Clair et précis »,correct:false},
{text: »Mystérieux et difficile à comprendre »,correct:true},
{text: »Ancien »,correct:false}
],
definition: »Sibyllin qualifie un propos obscur ou énigmatique. »
},
{
question: »Que veut dire « obsolète » ? »,
answers:[
{text: »Très moderne »,correct:false},
{text: »Tombé en désuétude »,correct:true},
{text: »Fragile »,correct:false},
{text: »Rare »,correct:false}
],
definition: »Obsolète désigne ce qui n’est plus utilisé ou dépassé. »
},
{
question: »Qu’est-ce qu’un « atrabilaire » ? »,
answers:[
{text: »Quelqu’un de joyeux »,correct:false},
{text: »Une personne colérique et sombre »,correct:true},
{text: »Un savant »,correct:false},
{text: »Un menteur »,correct:false}
],
definition: »Atrabilaire décrit une personne de mauvaise humeur chronique. »
},
{
question: »Que signifie « prolixe » ? »,
answers:[
{text: »Très silencieux »,correct:false},
{text: »Qui parle abondamment »,correct:true},
{text: »Qui agit vite »,correct:false},
{text: »Qui est discret »,correct:false}
],
definition: »Prolixe signifie excessivement bavard ou trop détaillé. »
},
{
question: »Que veut dire « éthéré » ? »,
answers:[
{text: »Lourd »,correct:false},
{text: »Matériel »,correct:false},
{text: »Très léger et irréel »,correct:true},
{text: »Sale »,correct:false}
],
definition: »Éthéré qualifie ce qui est aérien, presque irréel. »
},
{
question: »Qu’est-ce qu’un « ostracisme » ? »,
answers:[
{text: »Une récompense »,correct:false},
{text: »Une exclusion volontaire »,correct:true},
{text: »Un débat »,correct:false},
{text: »Un culte »,correct:false}
],
definition: »L’ostracisme est le fait d’exclure quelqu’un d’un groupe. »
},
{
question: »Que signifie « vétille » ? »,
answers:[
{text: »Un objet précieux »,correct:false},
{text: »Un détail insignifiant »,correct:true},
{text: »Une victoire »,correct:false},
{text: »Une émotion forte »,correct:false}
],
definition: »Une vétille est une chose de très peu d’importance. »
}
];
function startQuiz(){
index = 0;
score = 0;
resultBox.innerHTML = « »;
submitBtn.classList.add(« hide »);
showQuestion();
}function showQuestion(){
progress.innerText = `Question ${index+1} / ${questions.length}`;
questionText.innerText = questions[index].question;
answerButtons.innerHTML = « »;
definitionBox.classList.add(« hide »);questions[index].answers.forEach(a=>{
const btn = document.createElement(« button »);
btn.innerText = a.text;
btn.classList.add(« btn »);
if(a.correct) btn.dataset.correct = « true »;
btn.onclick = selectAnswer;
answerButtons.appendChild(btn);
});
}function selectAnswer(e){
const btn = e.target;
const correct = btn.dataset.correct === « true »;
if(correct) score++;Array.from(answerButtons.children).forEach(b=>{
b.disabled = true;
if(b.dataset.correct === « true ») b.classList.add(« correct »);
if(b === btn && !correct) b.classList.add(« wrong »);
});if(!correct){
definitionBox.innerHTML = « Définition : » + questions[index].definition;
definitionBox.classList.remove(« hide »);
}setTimeout(()=>{
index++;
index =9) msg= »🏆 Excellent vocabulaire ! »;
else if(score>=6) msg= »👍 Bon niveau, continue ! »;
else if(score>=3) msg= »📘 En progression. »;
else msg= »🌱 Début prometteur. »;resultBox.innerHTML = `
Quiz – Mots rares
${score} / ${questions.length}
${msg}
`; submitBtn.classList.remove(« hide »); submitBtn.onclick = startQuiz; }startQuiz();