
.afcq,
.afcq * { box-sizing: border-box; }

.afcq {
    --green: #1f3a17;
    --cream: #fff3a6;
    --gold: #d9b92f;
    --white: #ffffff;
    --ink: #172013;
    --success: #dff3d4;
    --error: #f6ddd6;
    max-width: 1420px;
    margin: 24px auto;
    padding: clamp(22px, 3.5vw, 52px);
    border-radius: 28px;
    background: var(--green);
    color: var(--white);
    font-family: inherit;
    box-shadow: 0 22px 60px rgba(0,0,0,.16);
}

.afcq__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
}

.afcq__eyebrow {
    margin: 0 0 6px;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    opacity: .7;
}

.afcq__title {
    margin: 0;
    color: var(--white);
    font-size: clamp(1.5rem, 2.2vw, 2.2rem);
}

.afcq__counter {
    text-align: right;
}
.afcq__counter span {
    display: block;
    font-size: .8rem;
    opacity: .7;
}
.afcq__counter strong {
    font-size: 1.05rem;
}

.afcq__progress-track {
    height: 8px;
    margin: 20px 0 34px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255,255,255,.16);
}
.afcq__progress-bar {
    display: block;
    width: 50%;
    height: 100%;
    background: var(--cream);
    transition: width .35s ease;
}

.afcq-question { display: none; }
.afcq-question.is-active { display: block; }

.afcq-question__text {
    max-width: 1100px;
    margin: 0;
    color: var(--white);
    font-size: clamp(1.4rem, 2.2vw, 2.25rem);
    line-height: 1.28;
}
.afcq-question__hint {
    margin: 14px 0 26px;
    opacity: .78;
}

.afcq__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.afcq-card { min-height: 170px; perspective: 1100px; }
.afcq-card__button {
    width: 100%;
    height: 100%;
    min-height: 170px;
    border: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
    font: inherit;
}
.afcq-card__button:focus-visible {
    outline: 4px solid var(--white);
    outline-offset: 5px;
    border-radius: 16px;
}
.afcq-card__inner {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    min-height: 170px;
    transform-style: preserve-3d;
    transition: transform .62s cubic-bezier(.2,.75,.2,1);
}
.afcq-card.is-flipped .afcq-card__inner { transform: rotateY(180deg); }

.afcq-card__face {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 18px 14px;
    border: 3px solid var(--gold);
    border-radius: 16px;
    background: linear-gradient(145deg, #fff8bd, var(--cream));
    color: var(--ink);
    backface-visibility: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,.16);
}
.afcq-card__back {
    transform: rotateY(180deg);
    background: var(--white);
}
.afcq-card[data-correct="true"] .afcq-card__back { background: var(--success); }
.afcq-card[data-correct="false"] .afcq-card__back { background: var(--error); }

.afcq-card__content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    text-align: center;
    overflow-wrap: anywhere;
}
.afcq-card__content strong {
    font-size: clamp(1.15rem, 1.55vw, 1.5rem);
    line-height: 1.15;
}
.afcq-card__content span {
    font-size: clamp(1rem, 1.15vw, 1.15rem);
    line-height: 1.3;
}
.afcq-card__flip {
    align-self: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,.78);
    font-size: .72rem;
    font-weight: 800;
    box-shadow: 0 3px 10px rgba(0,0,0,.1);
}

.afcq__feedback-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 24px;
}
.afcq__feedback { margin: 0; font-weight: 750; }

.afcq__next,
.afcq__restart {
    padding: 11px 18px;
    border: 2px solid rgba(255,255,255,.75);
    border-radius: 999px;
    background: transparent;
    color: var(--white);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}
.afcq__next:disabled {
    opacity: .38;
    cursor: not-allowed;
}
.afcq__next:not(:disabled):hover,
.afcq__restart:hover {
    background: var(--white);
    color: var(--green);
}

.afcq-results {
    display: none;
    text-align: center;
    padding: 50px 20px 30px;
}
.afcq-results.is-active { display: block; }
.afcq-results__icon {
    width: 74px;
    height: 74px;
    margin: 0 auto 18px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--cream);
    color: var(--green);
    font-size: 2rem;
    font-weight: 900;
}
.afcq-results h3 {
    margin: 0 0 8px;
    color: var(--white);
    font-size: 2rem;
}
.afcq-results p { margin: 8px 0; }

@media (max-width: 900px) {
    .afcq__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
    .afcq {
        margin: 10px auto;
        padding: 20px 16px;
        border-radius: 18px;
    }
    .afcq__header,
    .afcq__feedback-row {
        align-items: flex-start;
        flex-direction: column;
    }
    .afcq__counter { text-align: left; }
    .afcq__grid { grid-template-columns: 1fr; }
    .afcq-card,
    .afcq-card__button,
    .afcq-card__inner { min-height: 155px; }
    .afcq__next { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .afcq-card__inner,
    .afcq__progress-bar { transition: none; }
}


.afcq-results__actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 22px;
}

.afcq__review {
    padding: 11px 18px;
    border: 2px solid rgba(255,255,255,.75);
    border-radius: 999px;
    background: var(--white);
    color: var(--green);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.afcq__review:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.afcq__review:not(:disabled):hover {
    transform: translateY(-1px);
}

@media (max-width: 560px) {
    .afcq-results__actions {
        flex-direction: column;
    }

    .afcq__review,
    .afcq__restart {
        width: 100%;
    }
}
