/* ===== 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; }

/* ── 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: 60px; line-height: 1; }
.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; background: #f8f8f8; }
.cq-stat-correct { background: #f3f0ff; }
.cq-stat-wrong   { background: #fff5f5; }
.cq-stat-skip    { background: #fefce8; }
.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; }
}
