/* ============================================================
   Kids Kingdom - Swar Picture Quiz
   Image on the left (25%), 8 Devanagari letters on the right
   (75%, 4x2 grid) - pick the letter that starts the picture's
   word. All 10 questions shown in a list. Identical structure
   to alphabet-picture-quiz.css, with slightly smaller/flexible
   letter-button text to comfortably fit wider conjuncts like
   क्ष, त्र, ज्ञ, श्र.
   Reuses exam-btn/exam-score classes from addition-exam.css.
   ============================================================ */

.apq-wrap {
    max-width: 900px;
    margin: 0 auto;
    padding: 10px 16px 50px;
}

.apq-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 26px;
}

.apq-tab-btn {
    background: #fff;
    border: 2px solid var(--color-bg, #FFF9F0);
    color: var(--color-dark, #2D3142);
    font-family: var(--font-heading);
    font-weight: 700;
    padding: 10px 26px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s;
}
.apq-tab-btn:hover { border-color: var(--color-primary, #FF6B6B); }
.apq-tab-btn.active {
    background: var(--color-primary, #FF6B6B);
    color: #fff;
    border-color: var(--color-primary, #FF6B6B);
}

/* ================= QUESTION LIST ================= */
.apq-list {
    display: flex;
    flex-direction: column;
    gap: 22px;
    margin-bottom: 30px;
}

.apq-card {
    background: #fff;
    border-radius: 16px;
    padding: 18px 20px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.apq-card-number {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.8rem;
    color: #aaa;
    margin-bottom: 12px;
    text-align: center;
}

.apq-body {
    display: flex;
    gap: 18px;
    align-items: stretch;
}

/* ---- left: image (25%) ---- */
.apq-image-col {
    flex: 0 0 25%;
    max-width: 25%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.apq-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 14px;
    border: 3px solid var(--color-bg, #FFF9F0);
    background: var(--color-bg, #FFF9F0);
}

.apq-caption {
    margin-top: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--color-dark, #2D3142);
    text-align: center;
    min-height: 1.4em;
    visibility: hidden;
}
.apq-caption.visible { visibility: visible; }

/* ---- right: 8-letter grid (75%) ---- */
.apq-letters-col {
    flex: 1 1 75%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 10px;
}

.apq-letter-btn {
    background: var(--color-bg, #FFF9F0);
    border: 3px solid var(--color-bg, #FFF9F0);
    border-radius: 12px;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--color-dark, #2D3142);
    cursor: pointer;
    min-height: 52px;
    padding: 4px 6px;
    transition: transform 0.15s, border-color 0.15s;
}
.apq-letter-btn:hover { transform: translateY(-2px); border-color: var(--color-secondary, #4ECDC4); }

.apq-letter-btn.selected {
    border-color: var(--color-primary, #FF6B6B);
    box-shadow: 0 0 0 3px rgba(255,107,107,0.25);
}

.apq-letter-btn.is-correct {
    border-color: #10B981;
    background: #ecfdf5;
    color: #10B981;
}

.apq-letter-btn.is-wrong {
    border-color: #EF4444;
    background: #fef2f2;
    color: #EF4444;
}

/* ================= ACTIONS + SCORE ================= */
.apq-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    margin-bottom: 20px;
}

/* ================= RESPONSIVE ================= */
/* Tablet: keep side-by-side but a bit more breathing room for the image */
@media (max-width: 900px) and (min-width: 641px) {
    .apq-image-col { flex-basis: 30%; max-width: 30%; }
    .apq-letters-col { flex-basis: 70%; }
    .apq-letter-btn { font-size: 1.1rem; min-height: 48px; }
}

/* Mobile: stack image above the letter grid - this is the main
   audience, so the letters stay a comfortable touch size */
@media (max-width: 640px) {
    .apq-body {
        flex-direction: column;
        gap: 14px;
    }
    .apq-image-col {
        flex: 1 1 auto;
        max-width: 160px;
        margin: 0 auto;
    }
    .apq-letters-col {
        flex: 1 1 auto;
    }
    .apq-letter-btn {
        font-size: 1.3rem;
        min-height: 48px;
    }
    .apq-card { padding: 14px 12px 16px; }
}

@media (max-width: 380px) {
    .apq-image-col { max-width: 130px; }
    .apq-letter-btn { font-size: 1rem; min-height: 44px; }
    .apq-letters-col { gap: 8px; }
}
