/* ═══════════════════════════════════════════════════════════════════
   quiz.css — Styles secondaires (non-critical) pour le quiz et les résultats.
   Les variables CSS et le layout de base sont inline dans chaque template.
   Ce fichier ajoute : animations, hover/active/selected, thème badge,
   erreurs, résultats, responsive fine-tuning.
   Mobile-first, puis breakpoints >= 480px / >= 768px.
   ═══════════════════════════════════════════════════════════════════ */

/* ── QUIZ PAGE — Secondary styles ──────────────────────────────── */

/* Theme badge above question */
.theme-badge {
    display: inline-block;
    background: var(--bg);
    /*color: var(--muted);*/
    font-size: 1.72rem;
    font-weight: 600;
    padding: 4px 22px;
    border-radius: 99px;
    margin-bottom: calc(var(--space) * 2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Answer button — interactive states */
.answer-btn:hover:not(:disabled) {
    border-color: var(--primary);
    background: #eff6ff;
}

.answer-btn:active:not(:disabled) {
    transform: scale(0.97);
}

.answer-btn.selected {
    border-color: var(--primary);
    background: var(--primary);
    color: var(--primary-contrast);
    box-shadow: var(--shadow-sm);
}

.answer-btn.selected .btn-num {
    background: rgba(255, 255, 255, 0.25);
    color: var(--primary-contrast);
}

/* Back button — return to previous question */
.back-btn {
    display: block;
    margin: calc(var(--space) * 1.5) auto 0;
    appearance: none;
    background: none;
    border: 1.5px solid transparent;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 14px;
    border-radius: 99px;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
    letter-spacing: 0.01em;
}

.back-btn:hover {
    color: var(--text);
    background: var(--bg);
    border-color: var(--border);
}

.back-btn:active {
    transform: scale(0.97);
}

.back-btn:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* Hint text below buttons */
.quiz-hint {
    text-align: center;
    color: var(--muted);
    font-size: 0.78rem;
    margin-top: calc(var(--space) * 2.5);
}

/* Inline error card */
.error-box {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--error);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: calc(var(--space) * 2);
}

.error-box p { margin: 0 0 10px; }

.error-box button {
    appearance: none;
    background: var(--error);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
}

.error-box button:focus-visible {
    outline: 3px solid var(--error);
    outline-offset: 2px;
}

/* Skeleton shimmer animation */
@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-line {
    height: 1.1rem;
    background: linear-gradient(90deg, var(--border) 25%, #f1f5f9 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
    border-radius: 6px;
    margin-bottom: 10px;
}

.skeleton-line:last-child { width: 65%; }

/* Fade-in for new questions */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-enter { animation: fadeIn 0.18s ease forwards; }

/* "See my results" link — visible after a few answers */
.results-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: calc(var(--space) * 2);
    padding: 8px 16px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    border: 1.5px solid var(--border);
    border-radius: 99px;
    transition: border-color 0.15s, background 0.15s;
}

.results-link:hover {
    border-color: var(--primary);
    background: #eff6ff;
}

.results-link:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* Milestone screen — shown at batch boundary (80 questions) */
.milestone {
    text-align: center;
    padding: calc(var(--space) * 2) 0;
    animation: fadeIn 0.25s ease forwards;
}

.milestone-emoji {
    font-size: 2.5rem;
    margin-bottom: calc(var(--space) * 1);
}

.milestone-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0 0 calc(var(--space) * 1);
}

.milestone-subtitle {
    color: var(--muted);
    font-size: 0.92rem;
    margin: 0 0 calc(var(--space) * 1);
    line-height: 1.45;
}

.milestone-extra {
    color: var(--muted);
    font-size: 0.82rem;
    margin: 0 0 calc(var(--space) * 3);
}

.milestone-actions {
    display: flex;
    flex-direction: column;
    gap: calc(var(--space) * 1.5);
}


/* ── RESULTS PAGE ──────────────────────────────────────────────── */

/* Header */
.results-header {
    text-align: center;
    margin-bottom: calc(var(--space) * 4);
}

.results-header .emoji {
    font-size: 2.5rem;
    display: block;
    margin-bottom: calc(var(--space) * 1);
}

.results-header h1 {
    font-size: 1.65rem;
    font-weight: 750;
    margin: 0 0 6px;
}

.results-header .subtitle {
    color: var(--muted);
    font-size: 0.92rem;
    margin: 0;
}

/* Top-1 hero card */
.top-card {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    border-radius: var(--radius);
    padding: calc(var(--space) * 4) calc(var(--space) * 3);
    text-align: center;
    box-shadow: var(--shadow-lg);
    margin-bottom: calc(var(--space) * 3);
    position: relative;
    overflow: hidden;
}

/* Decorative circle */
.top-card::after {
    content: '';
    position: absolute;
    top: -40%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 50%;
    pointer-events: none;
}

.top-card .label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    opacity: 0.85;
    margin-bottom: calc(var(--space) * 1);
}

.top-card .name {
    font-size: 1.5rem;
    font-weight: 750;
    margin-bottom: calc(var(--space) * 1);
}

.top-card .pct {
    font-size: 2.8rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: calc(var(--space) * 1);
}

.top-card .match-label {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 14px;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Runner-up cards (2nd & 3rd) */
.runner-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: calc(var(--space) * 1.5);
    margin-bottom: calc(var(--space) * 3);
}

.runner-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: calc(var(--space) * 2.5) calc(var(--space) * 2);
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}

.runner-card:hover { box-shadow: var(--shadow-md); }

.runner-card .rank {
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: calc(var(--space) * 0.5);
}

.runner-card .name {
    font-size: 1rem;
    font-weight: 650;
    margin-bottom: calc(var(--space) * 1);
}

.runner-card .pct {
    font-size: 1.6rem;
    font-weight: 750;
    color: var(--primary);
    margin-bottom: calc(var(--space) * 0.5);
}

.runner-card .match-label {
    font-size: 0.72rem;
    color: var(--muted);
    font-weight: 500;
}

/* Full-list accordion */
.all-results { margin-bottom: calc(var(--space) * 3); }

.toggle-all {
    appearance: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    width: 100%;
    text-align: center;
    transition: background 0.15s, border-color 0.15s;
}

.toggle-all:hover {
    background: var(--surface);
    border-color: var(--primary);
}

.toggle-all:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

.all-list {
    display: none;
    margin-top: calc(var(--space) * 1.5);
}

.all-list.open { display: block; }

.all-row {
    display: flex;
    align-items: center;
    gap: calc(var(--space) * 1.5);
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: calc(var(--space) * 1);
    font-size: 0.9rem;
}

.all-row .r-rank {
    font-weight: 700;
    color: var(--muted);
    min-width: 28px;
    text-align: center;
}

.all-row .r-name { flex: 1; font-weight: 600; }

.all-row .r-bar {
    width: 60px;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}

.all-row .r-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.all-row .r-pct {
    font-weight: 700;
    min-width: 50px;
    text-align: right;
    font-size: 0.88rem;
}

/* Action buttons (share, retake) */
.actions {
    display: flex;
    flex-direction: column;
    gap: calc(var(--space) * 1.5);
    margin-bottom: calc(var(--space) * 3);
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 650;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    border: none;
    transition: transform 0.1s, opacity 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.97); }

.btn:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--primary);
    color: var(--primary-contrast);
}

.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Disclaimer */
.disclaimer {
    text-align: center;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.5;
    padding: 0 calc(var(--space) * 2);
}

/* Empty state */
.no-results {
    text-align: center;
    padding: calc(var(--space) * 6) calc(var(--space) * 2);
    color: var(--muted);
}

.no-results .emoji {
    font-size: 2rem;
    margin-bottom: calc(var(--space) * 2);
    display: block;
}


/* ── RESPONSIVE ────────────────────────────────────────────────── */

@media (max-width: 400px) {
    .runner-cards { grid-template-columns: 1fr; }
    .top-card .pct { font-size: 2.2rem; }
}

@media (min-width: 480px) {
    /* Quiz card breathing room on wider screens */
    .quiz-card {
        padding: calc(var(--space) * 5);
    }

    .question-text { font-size: 1.35rem; }

    /* Results */
    .results-wrapper {
        padding: calc(var(--space) * 6) calc(var(--space) * 3);
    }

    .top-card {
        padding: calc(var(--space) * 5) calc(var(--space) * 4);
    }

    .top-card .pct { font-size: 3.2rem; }
}

@media (min-width: 768px) {
    /* Side-by-side actions on tablet+ */
    .actions {
        flex-direction: row;
    }

    .actions .btn { flex: 1; }
}
