/* ===== Custom Quiz App — Mobile-First ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

.cq-app, .cq-app * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.cq-app {
    max-width: 480px;
    margin: 24px auto;
    padding: 0 12px 40px;
}

/* ── Card ── */
.cq-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 24px 20px 20px;
    box-shadow: 0 2px 24px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* ── Brand / Landing ── */
.cq-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}
.cq-brand-icon { font-size: 36px; line-height: 1; }
.cq-title {
    font-size: 22px; font-weight: 800;
    color: #0d0d0d; line-height: 1.2;
}
.cq-subtitle { font-size: 13px; color: #666; margin-top: 2px; }

/* ── Info chips ── */
.cq-info-row { display: flex; gap: 8px; flex-wrap: wrap; }
.cq-info-chip {
    background: #f3f0ff; color: #5b21b6;
    font-size: 11px; font-weight: 600;
    padding: 5px 10px; border-radius: 20px; white-space: nowrap;
}

/* ── Step selector (Exam → Subject → Topic) ── */
.cq-steps { display: flex; flex-direction: column; gap: 10px; }
.cq-step-label {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; color: #7c3aed; margin-bottom: 2px;
}
.cq-step { display: flex; flex-direction: column; gap: 4px; }

/* ── Select ── */
.cq-select {
    width: 100%;
    padding: 13px 16px;
    border: 1.5px solid #e0e0e0;
    border-radius: 12px;
    font-size: 15px; font-weight: 500; color: #1a1a1a;
    background: #fff;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    cursor: pointer;
    transition: border-color 0.2s;
}
.cq-select:focus { outline: none; border-color: #7c3aed; }
.cq-select:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Topic dropdown (replaces the native <select>) ──
   A closed control: tap to open a styled panel, pick one, it closes --
   same interaction as the original native <select>, not an always-open
   scroller. GeneratePress (parent theme) ships a global button:focus/
   :hover background with higher specificity than a single-class base
   rule (element+pseudo-class beats one class) -- every interactive state
   below re-asserts its own background explicitly so that default never
   shows through (the exact bug the scroll-tab version hit). */
.cq-dropdown { position: relative; }
.cq-dropdown-trigger {
    width: 100%; display: flex; align-items: center; justify-content: space-between;
    padding: 13px 16px;
    appearance: none; -webkit-appearance: none;
    border: 1.5px solid #e0e0e0; border-radius: 12px;
    background: #fff; font-size: 15px; font-weight: 500; color: #1a1a1a;
    cursor: pointer; transition: border-color 0.2s;
}
.cq-dropdown-trigger:hover, .cq-dropdown-trigger:focus { background: #fff; color: #1a1a1a; outline: none; }
.cq-dropdown-trigger:focus-visible { outline: 2px solid #7c3aed; outline-offset: 2px; }
.cq-dropdown-trigger::after {
    content: ""; flex: 0 0 auto; width: 10px; height: 10px; margin-left: 10px;
    border-right: 2px solid #888; border-bottom: 2px solid #888;
    transform: rotate(45deg); transition: transform 0.2s;
}
.cq-dropdown.open .cq-dropdown-trigger { border-color: #7c3aed; }
.cq-dropdown.open .cq-dropdown-trigger::after { transform: rotate(-135deg); margin-top: 4px; }

.cq-dropdown-panel {
    position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20;
    max-height: 260px; overflow-y: auto;
    background: #fff; border: 1.5px solid #e0e0e0; border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 6px;
}
.cq-dropdown-option {
    display: block; width: 100%; text-align: left;
    padding: 10px 12px;
    appearance: none; -webkit-appearance: none;
    border: none; border-radius: 8px;
    background: #fff; font-size: 14.5px; font-weight: 500; color: #333;
    cursor: pointer; transition: background 0.1s;
}
.cq-dropdown-option:hover, .cq-dropdown-option:focus {
    background: #f5f3ff; color: #333; outline: none;
}
.cq-dropdown-option:focus-visible { outline: 2px solid #7c3aed; outline-offset: -2px; }
.cq-dropdown-option[aria-selected="true"] {
    background: #f3f0ff; color: #7c3aed; font-weight: 700;
}

/* ── Language pills ── */
.cq-lang-pills {
    display: flex; gap: 8px;
}
.cq-lang-pill {
    flex: 1; padding: 10px;
    border: 1.5px solid #e0e0e0; border-radius: 10px;
    background: #fff; font-size: 14px; font-weight: 600; color: #555;
    cursor: pointer; text-align: center; transition: all 0.15s;
}
.cq-lang-pill.active {
    border-color: #7c3aed; background: #f3f0ff; color: #7c3aed;
}
.cq-lang-pill:hover:not(.active) { border-color: #bbb; }

/* ── Buttons ── */
.cq-btn-dark {
    display: block; width: 100%; padding: 15px;
    background: #0d0d0d; color: #fff;
    border: none; border-radius: 14px;
    font-size: 16px; font-weight: 700;
    cursor: pointer; text-align: center; letter-spacing: 0.2px;
    transition: opacity 0.2s, transform 0.1s;
}
.cq-btn-dark:hover:not(:disabled) { opacity: 0.85; }
.cq-btn-dark:active:not(:disabled) { transform: scale(0.98); }
.cq-btn-dark:disabled { opacity: 0.35; cursor: not-allowed; }
.cq-btn-outline {
    display: block; width: 100%; padding: 14px;
    background: transparent; color: #0d0d0d;
    border: 2px solid #e0e0e0; border-radius: 14px;
    font-size: 15px; font-weight: 600; cursor: pointer;
    text-align: center; transition: border-color 0.2s;
}
.cq-btn-outline:hover { border-color: #0d0d0d; }

/* ── Top bar ── */
.cq-topbar {
    display: flex; align-items: center; gap: 10px; margin-bottom: -6px;
}
.cq-back-btn {
    background: none; border: 1.5px solid #e0e0e0; border-radius: 50%;
    width: 34px; height: 34px; display: flex;
    align-items: center; justify-content: center;
    font-size: 16px; cursor: pointer; color: #333;
    flex-shrink: 0; transition: border-color 0.2s;
}
.cq-back-btn:hover { border-color: #999; }
.cq-topbar-title {
    flex: 1; font-size: 16px; font-weight: 700; color: #0d0d0d;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cq-timer {
    display: flex; align-items: center; gap: 4px;
    font-size: 14px; font-weight: 700; color: #555;
    white-space: nowrap; flex-shrink: 0;
}
.cq-timer.cq-timer-warn { color: #dc2626; animation: cq-pulse 1s infinite; }
@keyframes cq-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ── Progress bar ── */
.cq-progress-bar-wrap {
    height: 4px; background: #f0f0f0; border-radius: 4px; overflow: hidden;
}
.cq-progress-bar-fill {
    height: 100%; background: #7c3aed; border-radius: 4px;
    transition: width 0.4s ease;
}

/* ── Counter ── */
.cq-counter {
    font-size: 12px; font-weight: 600; color: #7c3aed; letter-spacing: 0.3px;
}

/* ── Question ── */
.cq-question {
    font-size: 18px; font-weight: 600; color: #0d0d0d;
    line-height: 1.5; min-height: 54px;
}

/* ── Options ── */
.cq-options { display: flex; flex-direction: column; gap: 10px; }
.cq-option {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 14px 16px;
    border: 1.5px solid #e0e0e0; border-radius: 12px;
    cursor: pointer; font-size: 15px; font-weight: 500; color: #1a1a1a;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    user-select: none; background: #fff;
}
.cq-option:hover:not(.cq-disabled) { border-color: #7c3aed; background: #faf8ff; }
.cq-option:active:not(.cq-disabled) { transform: scale(0.99); }
.cq-option-text { flex: 1; line-height: 1.4; }
.cq-option-radio {
    width: 22px; height: 22px;
    border: 2px solid #ccc; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}

/* ── SELECTED (user taps — immediate feedback, purple) ── */
.cq-option.cq-selected {
    border-color: #7c3aed;
    background: #f3f0ff;
}
.cq-option.cq-selected .cq-option-radio {
    background: #7c3aed; border-color: #7c3aed;
}
.cq-option.cq-selected .cq-option-radio::after {
    content: '';
    width: 8px; height: 8px;
    background: #fff; border-radius: 50%;
}

/* ── CORRECT (purple — matches screenshot, same feel as "selected") ── */
.cq-option.cq-correct {
    border-color: #7c3aed;
    background: #f3f0ff;
}
.cq-option.cq-correct .cq-option-radio {
    background: #7c3aed; border-color: #7c3aed;
}
.cq-option.cq-correct .cq-option-radio::after {
    content: '✓'; color: #fff;
    font-size: 13px; font-weight: 700; line-height: 1;
}

/* ── WRONG (red) ── */
.cq-option.cq-wrong {
    border-color: #dc2626; background: #fff5f5;
}
.cq-option.cq-wrong .cq-option-radio {
    background: #dc2626; border-color: #dc2626;
}
.cq-option.cq-wrong .cq-option-radio::after {
    content: '✕'; color: #fff;
    font-size: 12px; font-weight: 700; line-height: 1;
}

.cq-disabled { cursor: not-allowed; }
.cq-option.cq-correct.cq-disabled,
.cq-option.cq-wrong.cq-disabled { opacity: 1; }
.cq-option.cq-disabled:not(.cq-correct):not(.cq-wrong) { opacity: 0.55; }

/* ── Explanation ── */
.cq-explanation {
    background: #fffbeb; border: 1px solid #fbbf24;
    border-radius: 10px; padding: 12px 14px;
    font-size: 13px; color: #78350f; line-height: 1.5;
}
.cq-explanation strong {
    display: block; margin-bottom: 4px;
    font-size: 11px; text-transform: uppercase;
    letter-spacing: 0.5px; color: #92400e;
}

/* ── Wrong-answer countdown chip ── */
.cq-next-countdown {
    display: flex; align-items: center; justify-content: space-between;
    background: #fef3c7; border: 1px solid #fbbf24;
    border-radius: 10px; padding: 10px 14px;
    font-size: 13px; font-weight: 600; color: #78350f;
}
.cq-next-countdown .cq-countdown-num {
    font-size: 18px; font-weight: 800; color: #d97706;
    min-width: 24px; text-align: center;
}
.cq-skip-now {
    background: none; border: 1px solid #d97706;
    border-radius: 8px; padding: 4px 10px;
    font-size: 12px; font-weight: 600; color: #92400e; cursor: pointer;
}
.cq-skip-now:hover { background: #fde68a; }

/* ── Language toggle (in-quiz top) ── */
.cq-lang-row { display: flex; justify-content: flex-end; }
.cq-lang-btn {
    background: none; border: 1.5px solid #e0e0e0;
    border-radius: 20px; padding: 5px 12px;
    font-size: 12px; font-weight: 600; color: #555;
    cursor: pointer; transition: border-color 0.2s;
}
.cq-lang-btn:hover { border-color: #7c3aed; color: #7c3aed; }

/* ── Results ── */
.cq-results-card { text-align: center; }
.cq-result-icon {
    font-size: 40px; line-height: 1;
    width: 76px; height: 76px; margin: 0 auto;
    display: flex; align-items: center; justify-content: center;
    background: #f3f0ff; border-radius: 50%;
}
.cq-result-title { font-size: 22px; font-weight: 800; color: #0d0d0d; }
.cq-score-ring { display: inline-flex; align-items: baseline; gap: 4px; }
.cq-score-num { font-size: 56px; font-weight: 800; color: #7c3aed; line-height: 1; }
.cq-score-denom { font-size: 28px; font-weight: 600; color: #aaa; }
.cq-score-pct { font-size: 20px; font-weight: 700; color: #555; }
.cq-score-msg { font-size: 15px; color: #666; }

.cq-stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cq-stat { padding: 12px 8px; border-radius: 12px; border: 1px solid transparent; background: #f8f8f8; }
.cq-stat-correct { background: #f3f0ff; border-color: #e4defc; }
.cq-stat-wrong   { background: #fff5f5; border-color: #fcdfdf; }
.cq-stat-skip    { background: #fefce8; border-color: #faf0c5; }
.cq-stat-num { display: block; font-size: 26px; font-weight: 800; }
.cq-stat-correct .cq-stat-num { color: #7c3aed; }
.cq-stat-wrong   .cq-stat-num { color: #dc2626; }
.cq-stat-skip    .cq-stat-num { color: #d97706; }
.cq-stat-label { font-size: 11px; font-weight: 600; color: #888; margin-top: 2px; display: block; }

.cq-result-actions { display: flex; flex-direction: column; gap: 10px; }

/* ── Responsive ── */
@media (max-width: 400px) {
    .cq-question { font-size: 16px; }
    .cq-option { font-size: 14px; padding: 12px 14px; }
    .cq-title { font-size: 19px; }
    .cq-score-num { font-size: 46px; }
}
