/* ── Editor Gutenberg: Quiz de Imagens ── */

.mc-quiz-imagens-editor {
    padding: 16px;
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    background: #f9fafb;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.mc-quiz-imagens-editor__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.mc-quiz-imagens-editor__badge {
    font-weight: 700;
    font-size: 13px;
    color: #374151;
}

.mc-quiz-imagens-editor__mode {
    font-size: 11px;
    color: #6b7280;
    background: #e5e7eb;
    padding: 3px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Cards de imagem no editor em grid 2 colunas */
.mc-quiz-imagens-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 8px;
}

/* ── Frontend: Quiz de Imagens ── */

/* ─── Body quando quiz está ativo ─── */
body.quiz-active {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

/* ─── Backdrop fullpage ─── */
.mqi-backdrop-fullpage {
    position: fixed;
    inset: 0;
    z-index: 0;
}

/* ─── Card ─── */
.mqi-card {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 36px 32px 32px;
    box-sizing: border-box;
    animation: mqiFadeIn 0.35s ease;
    /* Garante centralização em Android */
    margin: auto;
    flex-shrink: 0;
}

@keyframes mqiFadeIn {
    from { 
        opacity: 0; 
        transform: translateY(14px) scale(0.97);
    }
    to   { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
}

/* ─── Tempo ─── */
.mqi-timer {
    text-align: center;
    margin-bottom: 8px;
}

.mqi-timer span {
    font-size: 0.75rem !important;
    line-height: 1rem !important;
    color: #6b7280;
}

.mqi-timer hr {
    border: none;
    border-top: 2px solid;
    margin: 0 0 12px 0;
}

/* ─── Título ─── */
.mqi-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    text-align: center;
    margin: 0 0 24px;
    line-height: 1.4;
}

/* ─── Grid de imagens ─── */
.mqi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    align-items: stretch;
}

/* ─── Item ─── */
.mqi-item {
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.10);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    text-decoration: none;
}

.mqi-item:hover  { 
    transform: translateY(-4px); 
    box-shadow: 0 8px 24px rgba(0,0,0,0.18); 
}
.mqi-item:active { 
    transform: scale(0.97); 
}

a.mqi-item { 
    text-decoration: none; 
}

.mqi-item img {
    max-width: 100%;
    width: 100%;
    height: 180px !important;
    object-fit: cover;
    border-radius: 8px 8px 0px 0px !important;
    border: 1px solid rgb(255 255 255 / 80%) !important;
    display: block;
    flex-shrink: 0;
}

.mqi-item-label {
    padding: 10px 12px;
    text-align: center;
    color: #fff;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    width: 100%;
    box-sizing: border-box;
}

.mqi-item-label h3 {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.4;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
}

/* ─── Processamento ─── */
.mqi-processing {
    display: none;
    text-align: center;
    padding: 60px 20px;
}

.mqi-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f3f3f3;
    border-top-color: var(--color-scheme, #6d28d9);
    border-radius: 50%;
    animation: mqiSpin 0.9s linear infinite;
    margin: 0 auto 20px;
}

@keyframes mqiSpin { 
    to { 
        transform: rotate(360deg); 
    } 
}

.mqi-processing-text { 
    font-size: 1.1rem; 
    font-weight: 600; 
    color: #374151; 
    margin-bottom: 6px; 
}
.mqi-processing-sub  { 
    font-size: 0.85rem; 
    color: #9ca3af; 
}

/* ─── Resultado ─── */
.mqi-result {
    display: none;
    text-align: center;
    padding: 40px 20px;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.mqi-result.mqi-result--visible {
    opacity: 1;
    transform: translateY(0);
}

.mqi-result-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 24px;
    line-height: 1.4;
}

.mqi-reward-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: linear-gradient(135deg, var(--color-scheme, #6d28d9), #a855f7);
    color: #fff;
    padding: 18px 32px;
    border-radius: 14px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    min-width: 260px;
    box-shadow: 0 8px 24px rgba(109, 40, 217, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    border: none;
}

.mqi-reward-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(109, 40, 217, 0.45);
    color: #fff;
    text-decoration: none;
}

.mqi-reward-btn .mqi-arrow { 
    font-size: 1.2rem; 
    transition: transform 0.2s ease; 
}
.mqi-reward-btn:hover .mqi-arrow { 
    transform: translateX(5px); 
}

.mqi-disclaimer {
    margin-top: 18px;
    font-size: 0.82rem;
    color: #6b7280;
    background: #f9fafb;
    border-radius: 8px;
    padding: 10px 16px;
}

/* ─── Animação saída ─── */
@keyframes mqiFadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* ─── Responsivo ─── */
@media (max-width: 567px) {
    .mqi-card { 
        padding: 24px 16px;
        max-height: 85vh;
    }
    .mqi-item img { 
        height: 120px !important; 
    }
    .mqi-item-label h3 {
        font-size: 0.75rem;
    }
    .mqi-reward-btn { 
        min-width: auto;
        width: 100%; 
    }
}

@media (max-width: 375px) {
    .mqi-grid { 
        grid-template-columns: 1fr; 
    }
}