@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&family=Poppins:wght@400;500;600;700&display=swap');

/* ───────────────────────────────────────
   VARIABLES
─────────────────────────────────────── */
:root {
    --bg:        #f0edff;
    --card:      #ffffff;
    --primary:   #6c63ff;
    --primary-d: #574fd6;
    --accent:    #f7a6ff;
    --success:   #4CAF50;
    --success-d: #3d9142;
    --text:      #2c2a4a;
    --muted:     #7b7a99;
    --border:    #e0ddf7;
    --radius:    16px;
    --shadow:    0 8px 32px rgba(108, 99, 255, 0.13);
}

/* ───────────────────────────────────────
   RESET & BASE
─────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Nunito', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

/* ───────────────────────────────────────
   CARTE PRINCIPALE
─────────────────────────────────────── */
.container,
section#form,
form {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 36px 32px;
    width: 100%;
    max-width: 480px;
}

/* Quand la page n'a pas de .container, le form est la carte */
body > form {
    margin-bottom: 12px;
}

/* ───────────────────────────────────────
   TITRES
─────────────────────────────────────── */
h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 6px;
    text-align: center;
}

h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 24px;
    text-align: center;
    line-height: 1.4;
}

/* ───────────────────────────────────────
   LABELS & INPUTS TEXTE
─────────────────────────────────────── */
label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

input[type="text"] {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-family: 'Nunito', sans-serif;
    font-size: 15px;
    color: var(--text);
    background: #faf9ff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    margin-bottom: 18px;
}

input[type="text"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
    background: #fff;
}

/* ───────────────────────────────────────
   GROUPES (question + réponses)
─────────────────────────────────────── */
.question,
.reponses,
.input-group {
    width: 100%;
    margin-bottom: 8px;
}

.reponses {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.R1, .R2, .R3, .R4 {
    margin-bottom: 4px;
}

/* ───────────────────────────────────────
   RADIO BUTTONS (choix bonne réponse)
─────────────────────────────────────── */
#radio-container {
    background: #f7f5ff;
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 20px;
}

#radio-container span {
    display: block;
    font-weight: 700;
    font-size: 13px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
}

#radio-container input[type="radio"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
    vertical-align: middle;
    margin-right: 8px;
}

#radio-container br {
    display: none;
}

/* chaque ligne radio */
#radio-container > label,
#radio-container > input[type="radio"] {
    display: inline;
    text-transform: none;
    letter-spacing: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

/* on reconstruit les lignes radio proprement */
#radio-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ───────────────────────────────────────
   RADIO DANS QUIZ (réponses QCM)
─────────────────────────────────────── */
.container form label {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #faf9ff;
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
    transition: border-color 0.2s, background 0.2s;
    margin-bottom: 10px;
}

.container form label:hover {
    border-color: var(--primary);
    background: #f0edff;
}

.container form label:has(input:checked) {
    border-color: var(--primary);
    background: #ece9ff;
    color: var(--primary-d);
}

.container form input[type="radio"] {
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    cursor: pointer;
}

/* ───────────────────────────────────────
   BOUTONS
─────────────────────────────────────── */
button,
button[type="submit"],
.envoyer {
    width: 100%;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 13px;
    border-radius: 12px;
    font-family: 'Nunito', sans-serif;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.2s, transform 0.1s;
    letter-spacing: 0.02em;
}

button:hover {
    background: var(--primary-d);
}

button:active {
    transform: scale(0.98);
}

/* Bouton valider dans quiz */
.container button[type="submit"] {
    background: var(--success);
    margin-top: 6px;
}

.container button[type="submit"]:hover {
    background: var(--success-d);
}

/* ───────────────────────────────────────
   SCORE BADGE
─────────────────────────────────────── */
.container > p {
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--muted);
    background: #f0edff;
    border-radius: 20px;
    padding: 5px 16px;
    display: inline-block;
    margin: 0 auto 20px;
    width: 100%;
}

/* ───────────────────────────────────────
   LIENS
─────────────────────────────────────── */
a {
    display: block;
    text-align: center;
    margin-top: 12px;
    text-decoration: none;
    color: var(--primary);
    font-weight: 700;
    font-size: 14px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 2px solid var(--border);
    background: transparent;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

a:hover {
    background: #f0edff;
    border-color: var(--primary);
}

/* ───────────────────────────────────────
   MESSAGES D'ERREUR
─────────────────────────────────────── */
body > p {
    background: #ffe0e0;
    color: #b00020;
    border-radius: 10px;
    padding: 10px 18px;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 16px;
    text-align: center;
    width: 100%;
    max-width: 480px;
}

/* ───────────────────────────────────────
   PAGE RÉSULTAT
─────────────────────────────────────── */
body > h1,
body > h2 {
    text-align: center;
}

body > h1 {
    margin-bottom: 8px;
}

body > h2 {
    font-size: 20px;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 24px;
}

/* ───────────────────────────────────────
   PAGE CLASSEMENT
─────────────────────────────────────── */
body > h1 + p,
.classement-ligne {
    font-size: 16px;
    color: var(--text);
}

/* ───────────────────────────────────────
   RESPONSIVE
─────────────────────────────────────── */
@media (max-width: 520px) {
    .container,
    section#form,
    form {
        padding: 28px 18px;
    }

    h1 { font-size: 22px; }
    h2 { font-size: 16px; }
}
