/* =====================================================
   QUIZ — Cartes Aventure & Récompenses
   ===================================================== */

/* ── Grille des quiz ── */
.quiz-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

/* ── Carte quiz — style badge / tampon ── */
.quiz-card {
    background: var(--bg-card);
    padding: 2rem 1.5rem;
    border-radius: 1.5rem;
    border: 2.5px solid var(--border);
    text-decoration: none;
    color: var(--text-main);
    text-align: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow),
                4px 4px 0 rgba(212, 184, 150, 0.5);    /* effet décalage cahier */
    position: relative;
    overflow: hidden;

    /* Texture timbre en fond */
    background-image:
        radial-gradient(ellipse at top left,  var(--stamp-color) 0%, transparent 60%),
        radial-gradient(ellipse at bot right, var(--stamp-color) 0%, transparent 60%);
}

[data-theme="dark"] .quiz-card {
    box-shadow: var(--shadow),
                4px 4px 0 rgba(100, 255, 218, 0.08);
    background-image:
        radial-gradient(ellipse at top left,  rgba(100,255,218,0.04) 0%, transparent 60%),
        radial-gradient(ellipse at bottom right, rgba(255,214,10,0.04) 0%, transparent 60%);
}

.quiz-card:hover {
    transform: translateY(-10px) rotate(-1deg) scale(1.03);
    border-color: var(--primary);
    box-shadow: var(--shadow),
                6px 6px 0 rgba(45, 106, 79, 0.25);
    background-image: none;
}

[data-theme="dark"] .quiz-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow),
                0 0 30px rgba(100, 255, 218, 0.2),
                6px 6px 0 rgba(100, 255, 218, 0.1);
}

/* Aura */
.quiz-card.aura-glow::after {
    content: '';
    position: absolute;
    inset: -6px;
    background: var(--gradient-primary);
    filter: blur(22px);
    z-index: -1;
    opacity: 0;
    border-radius: inherit;
    transition: opacity 0.3s ease;
}

.quiz-card:hover.aura-glow::after {
    opacity: 0.35;
}

/* Overlay couleur au survol */
.quiz-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
    border-radius: inherit;
}

.quiz-card:hover::before {
    opacity: 0.04;
}

.quiz-card > * {
    position: relative;
    z-index: 1;
}

.quiz-card h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
}

.quiz-card:hover h3 {
    color: var(--primary);
}

/* Icône flottante */
.quiz-icon {
    font-size: 3.8rem;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15));
}

[data-theme="dark"] .quiz-icon {
    filter: drop-shadow(0 0 12px rgba(100,255,218,0.3));
}

/* ── Zone de score ── */
.score-zone {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    text-align: center;
    margin-bottom: 2rem;
    font-family: 'Outfit', sans-serif;
    padding: 0.75rem 1.5rem;
    background: var(--stamp-color);
    border-radius: 50px;
    border: 2px solid var(--border);
    display: inline-block;
}

[data-theme="dark"] .score-zone {
    border-color: var(--primary);
    background: rgba(100,255,218,0.06);
    color: var(--primary);
}

/* ── Bloc question ── */
.question-block {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px dashed var(--border);
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .question-block {
    border-bottom-color: var(--border);
}

.question-text {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    display: block;
    color: var(--text-main);
    font-family: 'Nunito', sans-serif;
}

/* ── Options ── */
.options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
}

.opt-btn {
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 1rem;
    background: var(--bg-card);
    color: var(--text-main);
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 2px 2px 0 rgba(212, 184, 150, 0.4);
}

.opt-btn:hover {
    background: var(--stamp-color);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 3px 5px 0 rgba(45, 106, 79, 0.2);
}

[data-theme="dark"] .opt-btn {
    box-shadow: 2px 2px 0 rgba(100,255,218,0.08);
}

[data-theme="dark"] .opt-btn:hover {
    box-shadow: 3px 5px 0 rgba(100,255,218,0.15);
    border-color: var(--primary);
    background: rgba(100,255,218,0.05);
}

.opt-btn.selected-option {
    background: var(--gradient-primary);
    color: white !important;
    border-color: var(--primary);
    transform: scale(1.04) translateY(-2px);
    box-shadow: 0 8px 20px rgba(45, 106, 79, 0.4);
    font-weight: 800;
}

[data-theme="dark"] .opt-btn.selected-option {
    color: #0a1628 !important;
    box-shadow: 0 8px 20px rgba(100,255,218,0.4);
}

.opt-btn.correct {
    background-color: var(--success) !important;
    color: white !important;
    border-color: var(--success);
    box-shadow: 0 6px 15px rgba(82, 183, 136, 0.5);
}

.opt-btn.wrong {
    background-color: var(--danger) !important;
    color: white !important;
    border-color: var(--danger);
    box-shadow: 0 6px 15px rgba(230, 57, 70, 0.4);
}

/* ── Boîte feedback ── */
.feedback-box {
    margin-top: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 1rem;
    display: none;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.55;
    animation: slideDown 0.4s ease-out;
}

.feedback-correct {
    background: rgba(82, 183, 136, 0.12);
    border-left: 5px solid var(--success);
    color: var(--success);
    border-radius: 0 1rem 1rem 0;
}

[data-theme="dark"] .feedback-correct {
    background: rgba(0, 184, 148, 0.1);
}

.feedback-wrong {
    background: rgba(230, 57, 70, 0.10);
    border-left: 5px solid var(--danger);
    color: var(--danger);
    border-radius: 0 1rem 1rem 0;
}

[data-theme="dark"] .feedback-wrong {
    background: rgba(255, 71, 87, 0.1);
}

/* ── Dictée ── */
.dictee-box {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 2px solid var(--glass-border);
    border-left: 10px solid var(--accent);
    border-radius: 1rem;
    box-shadow: var(--shadow);
}

[data-theme="dark"] .dictee-box {
    border-left-color: var(--primary);
}

.hidden-word {
    background: var(--gradient-primary);
    color: transparent;
    padding: 0.3rem 0.8rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    margin: 0.3rem;
    box-shadow: 2px 3px 0 rgba(0,0,0,0.15);
    font-weight: 700;
}

.hidden-word:hover {
    color: white;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 3px 6px 0 rgba(45, 106, 79, 0.3);
}

[data-theme="dark"] .hidden-word:hover {
    color: #0a1628;
    box-shadow: 3px 6px 0 rgba(100,255,218,0.2);
}

/* ── Ornements décoratifs ── */
.ornament {
    position: absolute;
    font-size: 2.2rem;
    opacity: 0.12;
    pointer-events: none;
    z-index: 0;
}

.ornament-tl { top: 0.75rem; left: 0.75rem; }
.ornament-tr { top: 0.75rem; right: 0.75rem; }
.ornament-bl { bottom: 0.75rem; left: 0.75rem; }
.ornament-br { bottom: 0.75rem; right: 0.75rem; }

/* ── Séparateur quiz ── */
.quiz-separator {
    height: 4px;
    background: var(--gradient-orange);
    margin: 2.5rem 0;
    border-radius: 10px;
    position: relative;
    border: none;
}

.quiz-separator::after {
    content: '';
    position: absolute;
    inset: -5px -10px;
    background: var(--gradient-orange);
    filter: blur(12px);
    opacity: 0.35;
    z-index: -1;
    border-radius: 10px;
}

/* ── Marqueur lettre (dictée) ── */
@keyframes pulseMarker {
    from {
        transform: scale(1);
        box-shadow: 0 0 10px rgba(233, 168, 58, 0.5);
    }
    to {
        transform: scale(1.25);
        box-shadow: 0 0 28px rgba(233, 168, 58, 1);
    }
}

.letter-marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5em;
    height: 1.5em;
    border: 4px solid var(--secondary) !important;
    border-radius: 50%;
    background: rgba(233, 168, 58, 0.28) !important;
    color: var(--secondary) !important;
    font-weight: 900 !important;
    margin: 0 3px;
    box-shadow: 0 0 16px rgba(233, 168, 58, 0.65), inset 0 0 5px white;
    vertical-align: middle;
    animation: pulseMarker 1s infinite alternate;
    position: relative;
    z-index: 10;
}

/* ── Confettis ── */
.confetti {
    position: fixed;
    top: -50px;
    width: 15px;
    height: 15px;
    background-color: #f00;
    z-index: 9999;
    pointer-events: none;
    border-radius: 3px;
}

@keyframes confetti-fall {
    0%   { transform: translateY(0)    rotate(0deg);   opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ── Mega pop (célébration) ── */
@keyframes mega-pop {
    0%   { transform: translate(-50%,-50%) scale(0) rotate(-20deg);  opacity: 0; }
    30%  { transform: translate(-50%,-50%) scale(1.2) rotate(5deg);  opacity: 1; }
    80%  { transform: translate(-50%,-50%) scale(1)   rotate(0deg);  opacity: 1; }
    100% { transform: translate(-50%,-50%) scale(1.5) rotate(0deg);  opacity: 0; }
}

.mega-title {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%) scale(0);
    font-size: 5rem;
    font-weight: 900;
    color: var(--secondary);
    text-shadow: 0 0 30px rgba(233,168,58,0.8), 0 0 60px rgba(233,168,58,0.4);
    z-index: 10000;
    text-align: center;
    pointer-events: none;
    animation: mega-pop 1.5s cubic-bezier(0.175,0.885,0.32,1.275) forwards;
    white-space: nowrap;
    font-family: 'Outfit', sans-serif;
}

/* ── Overlay résultat ── */
.result-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.87);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(16px);
    animation: fadeInUp 0.45s ease;
}

/* ── Modal résultat — parchemin d'aventurier ── */
.result-modal {
    max-width: 520px;
    width: 90%;
    text-align: center;
    padding: 3rem 2.5rem;
    background: var(--bg-card);
    border: 4px solid var(--secondary);
    border-radius: 2.5rem;
    box-shadow: 0 0 60px rgba(233,168,58,0.35),
                0 0 0 8px rgba(233,168,58,0.1);
    color: var(--text-main);
    transform: scale(0);
    animation: popIn 0.5s cubic-bezier(0.175,0.885,0.32,1.275) forwards;

    /* Lignes parchemin */
    background-image:
        repeating-linear-gradient(
            transparent,
            transparent 27px,
            var(--notebook-line) 28px
        );
    background-size: 100% 28px;
}

[data-theme="dark"] .result-modal {
    border-color: var(--secondary);
    box-shadow: 0 0 60px rgba(255,214,10,0.3),
                0 0 0 8px rgba(255,214,10,0.08);
    background-image:
        repeating-linear-gradient(
            transparent,
            transparent 27px,
            var(--notebook-line) 28px
        );
}

.result-modal h2 {
    color: var(--secondary) !important;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}

/* ── Bouton résultat final ── */
.final-result-btn {
    background: var(--gradient-orange);
    color: white !important;
    border: none;
    padding: 1.25rem 3rem;
    font-size: 1.4rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(233,168,58,0.5),
                0 3px 0 rgba(180,100,0,0.4);
    transition: all 0.3s cubic-bezier(0.175,0.885,0.32,1.275);
    text-shadow: 0 2px 4px rgba(0,0,0,0.25);
    margin: 2rem 0;
    display: inline-block;
    letter-spacing: 0.4px;
}

.final-result-btn:hover {
    transform: translateY(-5px) scale(1.06);
    box-shadow: 0 20px 45px rgba(233,168,58,0.7);
}

/* ── Bouton validation (coffre au trésor) ── */
.validate-btn-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 1.25rem;
    width: 100%;
}

.treasure-btn {
    background: var(--gradient-orange);
    border: none;
    border-radius: 50px;
    padding: 0.9rem 2.5rem;
    font-size: 2rem;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(233,168,58,0.5),
                0 3px 0 rgba(150,80,0,0.35);
    transition: all 0.25s cubic-bezier(0.175,0.885,0.32,1.275);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: pulse-treasure 1.5s ease-in-out infinite;
}

.treasure-btn::after {
    content: "Valider !";
    font-size: 1.1rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.treasure-btn:hover {
    transform: translateY(-4px) scale(1.08);
    box-shadow: 0 14px 32px rgba(233,168,58,0.7);
}

@keyframes pulse-treasure {
    0%, 100% { transform: scale(1);    }
    50%       { transform: scale(1.05); }
}
