/* =====================================================
   LES PREGUNTES DEL SR. MOEBIUS — CSS
   ===================================================== */

.quiz-section {
    padding-top: calc(var(--header-h) + 1rem);
    padding-bottom: 2rem;
    min-height: calc(100vh - 80px);
}

/* Header top amb nivell + so */
.quiz-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .5rem;
}

/* Botó so */
.quiz-sound-toggle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg);
    border: none;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s ease, opacity .15s ease;
    font-family: var(--font);
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
}

.quiz-sound-toggle:hover {
    background: var(--verde);
}

.quiz-sound-toggle.muted {
    opacity: .4;
}

/* Barra progrés global */
.quiz-progress-global {
    max-width: 640px;
    margin: 0 auto 1rem;
}

/* Panel comú */
.quiz-panel {
    max-width: 640px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
    text-align: center;
}

/* ==================== PANTALLA INICI ==================== */
.quiz-moebius {
    width: 110px;
    height: 110px;
    object-fit: contain;
    margin: 0 auto 1.25rem;
}

.quiz-main-title {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 900;
    color: var(--verde);
    margin-bottom: .5rem;
}

.quiz-intro {
    font-size: 1.15rem;
    color: var(--muted);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* Selecció de nivells */
.quiz-choose {
    font-size: 1rem;
    color: var(--muted);
    margin-bottom: 1rem;
}

.quiz-levels-select {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.quiz-level-btn {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .75rem 1.2rem;
    border-radius: var(--r-full);
    border: none;
    color: var(--white);
    cursor: pointer;
    font-family: var(--font);
    transition: transform .15s ease, box-shadow .15s ease;
}

.quiz-level-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
}

.quiz-level-btn-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.quiz-level-btn-name {
    font-size: .85rem;
    font-weight: 800;
    line-height: 1;
}

/* ==================== PANTALLA INTRO NIVELL ==================== */
.quiz-level-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    margin: 0 auto 1rem;
    color: var(--white);
}

.quiz-level-name {
    font-size: clamp(1.6rem, 3.5vw, 2.2rem);
    font-weight: 900;
    color: var(--negro);
    margin-bottom: .35rem;
}

.quiz-level-count {
    font-size: 1.05rem;
    color: var(--muted);
    margin-bottom: 2rem;
}

/* ==================== PANTALLA JOC ==================== */

/* Barra de progrés */
.quiz-progress {
    width: 100%;
    height: 10px;
    background: var(--bg);
    border-radius: var(--r-full);
    overflow: hidden;
}

.quiz-progress-bar {
    height: 100%;
    background: var(--verde);
    border-radius: var(--r-full);
    transition: width .4s ease;
    width: 0;
}

.quiz-header {
    margin-bottom: 1.5rem;
}

.quiz-level-label {
    display: inline-block;
    font-size: 1.15rem;
    font-weight: 800;
    margin-bottom: .75rem;
}

.quiz-meta {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--muted);
}

.quiz-score-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.quiz-score {
    color: var(--verde);
    font-size: 1.4rem;
}

.quiz-plus {
    background: var(--verde);
    color: var(--white);
    font-size: .85rem;
    font-weight: 900;
    padding: .2rem .6rem;
    border-radius: var(--r-full);
    white-space: nowrap;
    opacity: 0;
    transition: none;
}

.quiz-plus.show {
    animation: plusPop 1s ease forwards;
}

@keyframes plusPop {
    0%   { opacity: 0; transform: translateY(4px) scale(.8); }
    15%  { opacity: 1; transform: translateY(0) scale(1.1); }
    50%  { opacity: 1; transform: translateY(-8px) scale(1); }
    100% { opacity: 0; transform: translateY(-18px) scale(.9); }
}

/* Pregunta */
.quiz-body {
    margin-bottom: 1.5rem;
}

.quiz-char-small {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin: 0 auto .75rem;
}

.quiz-question {
    font-size: clamp(1.2rem, 3vw, 1.55rem);
    font-weight: 800;
    color: var(--negro);
    line-height: 1.4;
}

/* Opcions */
.quiz-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
    margin-bottom: 1.5rem;
}

.quiz-option {
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 700;
    color: var(--negro);
    background: var(--white);
    border: 3px solid var(--bg);
    border-radius: var(--r);
    padding: 1rem .75rem;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, transform .15s ease;
    text-align: center;
    line-height: 1.35;
}

.quiz-option:hover:not(:disabled) {
    border-color: var(--verde);
    transform: translateY(-2px);
}

.quiz-option:disabled {
    cursor: default;
    opacity: .85;
}

.quiz-option-correct {
    border-color: var(--verde) !important;
    background: #e8f5e9 !important;
    color: #2e7d32 !important;
    opacity: 1 !important;
}

.quiz-option-wrong {
    border-color: #e53935 !important;
    background: #ffebee !important;
    color: #c62828 !important;
    opacity: 1 !important;
}

/* Feedback */
.quiz-feedback {
    padding: 1.25rem;
    border-radius: var(--r);
    margin-bottom: 1rem;
    text-align: left;
}

.quiz-feedback-ok {
    background: #e8f5e9;
    border: 2px solid var(--verde);
}

.quiz-feedback-ko {
    background: #ffebee;
    border: 2px solid #e53935;
}

.quiz-feedback-text {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.55;
    margin-bottom: 1rem;
    color: var(--negro);
}

.quiz-feedback .btn {
    display: block;
    width: 100%;
}

/* ==================== PANTALLA RESUM NIVELL ==================== */
.quiz-level-result-name {
    font-size: clamp(1.5rem, 3.5vw, 2rem);
    font-weight: 900;
    color: var(--verde);
    margin-bottom: .5rem;
}

.quiz-level-result-score {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--negro);
    margin-bottom: .35rem;
}

.quiz-level-result-msg {
    font-size: 1.15rem;
    color: var(--muted);
    margin-bottom: 2rem;
}

/* ==================== PANTALLA RESULTAT FINAL ==================== */
.quiz-result-title {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 900;
    color: var(--verde);
    margin-bottom: .5rem;
}

.quiz-result-score {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--negro);
    margin-bottom: .5rem;
}

.quiz-result-msg {
    font-size: 1.1rem;
    color: var(--muted);
    line-height: 1.6;
    margin-bottom: 2rem;
}

.quiz-result-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.quiz-result-secondary {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.quiz-link-btn {
    font-family: var(--font);
    font-size: .9rem;
    font-weight: 700;
    color: var(--muted);
    background: none;
    border: none;
    cursor: pointer;
    transition: color .15s ease;
    text-decoration: none;
}

.quiz-link-btn:hover {
    color: var(--verde);
}

/* Repàs de respostes */
.quiz-review {
    text-align: left;
    margin-top: 1rem;
    border-top: 1px solid var(--bg);
    padding-top: 1.25rem;
}

.quiz-review-item {
    padding: 1rem;
    margin-bottom: .75rem;
    border-radius: var(--r);
    background: var(--bg);
}

.quiz-review-item.correct {
    border-left: 4px solid var(--verde);
}

.quiz-review-item.wrong {
    border-left: 4px solid #e53935;
}

.quiz-review-q {
    font-size: 1rem;
    font-weight: 800;
    color: var(--negro);
    margin-bottom: .5rem;
}

.quiz-review-answer {
    font-size: .9rem;
    line-height: 1.5;
    margin-bottom: .2rem;
}

.quiz-review-answer.user-wrong {
    color: #c62828;
}

.quiz-review-answer.user-correct {
    color: #2e7d32;
}

.quiz-review-explain {
    font-size: .85rem;
    color: var(--muted);
    font-style: italic;
    margin-top: .35rem;
    padding-top: .35rem;
    border-top: 1px solid rgba(0,0,0,.06);
}


/* ==================== RESPONSIVE ==================== */
@media (max-width: 640px) {
    .quiz-panel {
        padding: 1.5rem 1rem;
    }

    .quiz-options {
        grid-template-columns: 1fr;
    }

    .quiz-moebius {
        width: 80px;
        height: 80px;
    }

    .quiz-level-icon {
        width: 64px;
        height: 64px;
        font-size: 1.8rem;
    }

    .quiz-result-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .quiz-result-secondary {
        flex-direction: column;
        align-items: center;
    }

    .quiz-levels-select {
        gap: .5rem;
    }

    .quiz-level-btn {
        padding: .6rem .9rem;
    }

    .quiz-level-btn-icon {
        font-size: 1rem;
    }

    .quiz-level-btn-name {
        font-size: .75rem;
    }
}
