:root {
    --primary-color: #2c3e50;
    --accent-color: #3498db;
    --bg-gradient-start: #fdfbfb;
    --bg-gradient-end: #ebedee;
    --text-main: #2c3e50;
    --text-secondary: #6b7a7b;
    --card-bg: rgba(255, 255, 255, 0.95);
    --error: #c0392b;
    --ok: #27ae60;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Roboto', sans-serif;
    background: var(--bg-gradient-end);
    background-image: linear-gradient(120deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    color: var(--text-main);
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    align-items: center;
    overflow-x: hidden;
}

/* --- HEADER --- */
header {
    width: 100%;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    position: relative;
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    animation: fadeInDown 0.8s ease-out;
}

.header-logo-img {
    height: 100px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.logo-text {
    font-size: 26px;
    color: var(--text-main);
    font-weight: 300;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.logo-text strong { font-weight: 700; color: var(--primary-color); }

.reset-link {
    position: absolute;
    top: 20px;
    right: 20px;
    font: inherit;
    font-size: 12px;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.8;
}
.reset-link:hover { opacity: 1; text-decoration: underline; }

/* --- CONTENU --- */
main {
    flex: 1;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 0 16px 40px 16px;
}

.card {
    background: var(--card-bg);
    width: 100%;
    max-width: 700px;
    padding: 50px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    text-align: center;
    border: 1px solid rgba(255,255,255,0.8);
    animation: fadeInUp 0.6s ease-out;
}

h1 { font-size: 28px; font-weight: 300; margin: 0 0 15px; color: var(--primary-color); letter-spacing: -0.5px; }
h2 { font-size: 20px; font-weight: 400; margin-bottom: 25px; color: var(--text-secondary); }
p { color: var(--text-secondary); line-height: 1.6; font-size: 15px; margin: 0 0 25px; }
a { color: var(--accent-color); }

/* --- FORMULAIRE --- */
.name-form { margin: 30px auto 10px; max-width: 420px; text-align: left; }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }

input[type="text"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #f9f9f9;
    font-size: 16px;
    outline: none;
    transition: 0.3s;
    color: var(--text-main);
    font-family: inherit;
}
input[type="text"]:focus {
    border-color: var(--accent-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.1);
}
input[aria-invalid="true"] { border-color: var(--error); }

.form-error { color: var(--error); font-size: 14px; margin: 4px 0 0; text-align: center; }
.name-form .btn { display: block; margin: 25px auto 0; }
.small-note { font-size: 13px; margin: 20px 0 0; }

.btn {
    background-color: var(--primary-color);
    color: white;
    padding: 14px 32px;
    border: none;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 35px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(44, 62, 80, 0.2);
    font-family: inherit;
}
.btn:hover:not(:disabled) {
    background-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.3);
}
.btn:disabled { opacity: 0.6; cursor: wait; }

/* --- QUESTIONS --- */
.quiz-counter {
    font-size: 13px;
    color: var(--accent-color);
    text-align: right;
    margin-bottom: 15px;
    font-weight: 600;
    text-transform: uppercase;
}
.question-text { color: var(--primary-color); font-size: 22px; min-height: 60px; font-weight: 500; }

.option {
    width: 100%;
    background: white;
    padding: 18px 25px;
    margin: 12px 0;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    font: inherit;
    font-size: 15px;
    color: #34495e;
}
.option:hover:not(:disabled) {
    background-color: #f8fbff;
    border-color: var(--accent-color);
    transform: scale(1.01);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.1);
}
.option:focus-visible { outline: 3px solid rgba(52, 152, 219, 0.4); }
.option:disabled { cursor: default; opacity: 0.55; }
.options.locked .option { opacity: 0.55; cursor: default; }

.radio-circle {
    height: 20px; width: 20px;
    border: 2px solid #bdc3c7;
    border-radius: 50%;
    margin-right: 20px;
    flex-shrink: 0;
    transition: 0.2s;
}
.option:hover:not(:disabled) .radio-circle { border-color: var(--accent-color); }

.quiz-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.link-btn {
    background: none;
    border: none;
    font: inherit;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 0;
}
.link-btn:hover:not(:disabled) { color: var(--accent-color); text-decoration: underline; }
.link-btn:disabled { opacity: 0.4; cursor: default; }

/* --- PROGRESSION --- */
.progress-container { width: 100%; height: 6px; position: fixed; top: 0; left: 0; z-index: 100; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary-color), var(--accent-color)); width: 0%; transition: width 0.4s cubic-bezier(0.25, 1, 0.5, 1); box-shadow: 0 2px 10px rgba(52, 152, 219, 0.5); }

/* --- CHARGEMENT --- */
.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
    margin: 40px auto;
}
.loading-text { font-weight: 500; color: var(--primary-color); }

/* --- RÉSULTAT --- */
.result-heading { color: var(--primary-color); }
.result-title { color: var(--accent-color); font-weight: 700; }
.result-desc { font-size: 16px; max-width: 500px; margin: 0 auto 15px auto; }
.result-second { font-size: 15px; margin-bottom: 10px; }
.result-second strong { color: var(--primary-color); }
.chart-wrap { position: relative; width: 100%; margin-bottom: 30px; }
canvas { max-height: 380px; margin: 20px auto; }

.info-box {
    text-align: left;
    background: #f8fbff;
    padding: 30px;
    border-radius: 12px;
    margin-top: 20px;
    border: 1px solid #e1e8ed;
}
.info-title { color: var(--primary-color); font-size: 16px; display: block; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 1px; }
.info-title-spaced { margin-top: 25px; }
.info-hint { font-size: 13px; margin: 0 0 12px; }
.link-list { margin: 0 0 12px; padding-left: 22px; color: var(--text-main); line-height: 1.9; }
.link-list a { text-decoration: none; border-bottom: 1px dotted var(--accent-color); }
.link-list a:hover { border-bottom-style: solid; }

.verify-box {
    margin-top: 30px;
    padding: 18px;
    border: 2px dashed #cfd9e0;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
}
.verify-label { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-secondary); }
.verify-code { font-family: "Courier New", monospace; font-size: 26px; font-weight: 700; letter-spacing: 3px; color: var(--primary-color); }
.verify-hint { font-size: 13px; color: var(--text-secondary); }
.verify-box.unverified { border-color: #e6b0aa; }
.verify-box.unverified .verify-code { color: var(--error); font-size: 16px; letter-spacing: 0; font-family: inherit; }

/* --- PAGE VÉRIFICATION --- */
.verify-form { display: flex; gap: 10px; max-width: 420px; margin: 25px auto 0; }
.verify-form input { text-transform: uppercase; text-align: center; letter-spacing: 2px; }
.verify-form .btn { margin-top: 0; white-space: nowrap; }
.verify-result { margin-top: 30px; text-align: left; }
.verify-result table { width: 100%; border-collapse: collapse; }
.verify-result th, .verify-result td { padding: 10px 8px; border-bottom: 1px solid #e1e8ed; font-size: 15px; vertical-align: top; }
.verify-result th { color: var(--text-secondary); font-weight: 500; width: 40%; }
.status-ok { color: var(--ok); font-weight: 700; text-align: center; }
.status-ko { color: var(--error); font-weight: 700; text-align: center; }

/* --- FOOTER --- */
footer {
    text-align: center;
    font-size: 11px;
    color: var(--text-secondary);
    padding: 20px 16px;
    letter-spacing: 0.5px;
}
footer p { font-size: 11px; margin: 0 0 6px; }

.hidden { display: none !important; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 600px) {
    .card { padding: 28px 20px; }
    .header-logo-img { height: 72px; }
    .logo-text { font-size: 20px; }
    .question-text { font-size: 19px; }
    .option { padding: 15px 16px; }
    .radio-circle { margin-right: 14px; }
    .info-box { padding: 20px; }
    .verify-form { flex-direction: column; }
    .reset-link { top: 12px; right: 12px; }
}
