/* ==============================================================
   AI MCQs Global Quiz Engine v2 - Conflict-Free Edition
   CSS — host this file on GitHub and serve via jsDelivr CDN:
   https://cdn.jsdelivr.net/gh/YOUR-USER/aimcq-engine@VERSION/aimcq.css
   ============================================================== */
#aimcq-root-scope {
    --aq-primary: #007bff;
    --aq-primary-dark: #0056b3;
    --aq-secondary: #6c757d;
    --aq-secondary-dark: #5a6268;
    --aq-success: #28a745;
    --aq-success-light: #e9f7eb;
    --aq-danger: #dc3545;
    --aq-danger-light: #fdeaec;
    --aq-warning: #ffc107;
    --aq-info: #17a2b8;
    --aq-info-light: #e8f7f9;
    --aq-light: #f8f9fa;
    --aq-dark: #343a40;
    --aq-white: #fff;
    --aq-border: #dee2e6;
    --aq-shadow: 0 0.5rem 1rem rgba(0,0,0,0.1);
    --aq-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    all: initial;
    font-family: var(--aq-font);
    display: block;
    box-sizing: border-box;
}
#aimcq-root-scope *, #aimcq-root-scope *::before, #aimcq-root-scope *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
#aimcq-root-scope ul,
#aimcq-root-scope ol,
#aimcq-root-scope li,
#aimcq-root-scope ul li,
#aimcq-root-scope .aq-options ul,
#aimcq-root-scope .aq-options ul li {
    list-style: none !important;
    list-style-type: none !important;
    list-style-image: none !important;
    padding-left: 0 !important;
    margin-left: 0 !important;
}
#aimcq-root-scope .aq-options ul li::before,
#aimcq-root-scope .aq-options ul li::after,
#aimcq-root-scope .aq-explanation ul li::before,
#aimcq-root-scope .aq-explanation ul li::after,
#aimcq-root-scope .aq-explanation ol li::before,
#aimcq-root-scope .aq-explanation ol li::after {
    content: none !important;
    display: none !important;
}
#aimcq-root-scope .aq-explanation ul,
#aimcq-root-scope .aq-explanation ol {
    list-style: disc !important;
    list-style-type: disc !important;
    list-style-image: none !important;
    padding-left: 1.25rem !important;
    margin-left: 0.5rem !important;
    margin-bottom: 0.75em;
}
#aimcq-root-scope .aq-explanation ol {
    list-style: decimal !important;
    list-style-type: decimal !important;
}
#aimcq-root-scope .aq-explanation ul li,
#aimcq-root-scope .aq-explanation ol li {
    list-style: inherit !important;
    list-style-type: inherit !important;
    list-style-image: none !important;
    padding-left: 0.4rem !important;
    margin-left: 0 !important;
    display: list-item !important;
}
#aimcq-root-scope .aq-explanation ul li,
#aimcq-root-scope .aq-explanation ol li {
    padding-left: 0.4rem !important;
    margin-left: 0 !important;
    margin-bottom: 0.4rem;
    display: list-item !important;
}

/* --- STATEMENT LIST: numbered ol/ul inside question body (basic & professional) --- */
#aimcq-root-scope .aq-q-body ol,
#aimcq-root-scope .cbt-question-body ol {
    list-style: decimal !important;
    list-style-type: decimal !important;
    padding-left: 1.6rem !important;
    margin-left: 0.25rem !important;
    margin-top: 0.5em !important;
    margin-bottom: 0.75em !important;
}
#aimcq-root-scope .aq-q-body ul,
#aimcq-root-scope .cbt-question-body ul {
    list-style: disc !important;
    list-style-type: disc !important;
    padding-left: 1.6rem !important;
    margin-left: 0.25rem !important;
    margin-top: 0.5em !important;
    margin-bottom: 0.75em !important;
}
#aimcq-root-scope .aq-q-body ol li,
#aimcq-root-scope .aq-q-body ul li,
#aimcq-root-scope .cbt-question-body ol li,
#aimcq-root-scope .cbt-question-body ul li {
    list-style: inherit !important;
    list-style-type: inherit !important;
    display: list-item !important;
    padding-left: 0.1rem !important;
    margin-left: 0 !important;
    margin-bottom: 0.35em !important;
    line-height: 1.50 !important;
}
#aimcq-root-scope .aq-q-body ol li::before,
#aimcq-root-scope .aq-q-body ol li::after,
#aimcq-root-scope .aq-q-body ul li::before,
#aimcq-root-scope .aq-q-body ul li::after,
#aimcq-root-scope .cbt-question-body ol li::before,
#aimcq-root-scope .cbt-question-body ol li::after,
#aimcq-root-scope .cbt-question-body ul li::before,
#aimcq-root-scope .cbt-question-body ul li::after {
    content: none !important;
    display: none !important;
}

/* --- WRAPPER --- */
#aimcq-root-scope .aq-wrapper {
    font-family: var(--aq-font);
    max-width: 1100px;
    margin: 2rem auto;
    color: var(--aq-dark);
    line-height: 1.5;
}

/* --- START SCREEN --- */
#aimcq-root-scope .aq-start {
    text-align: center;
    padding: 3rem 2rem;
    border-radius: 12px;
    background: var(--aq-white);
}
#aimcq-root-scope .aq-start h2 {
    /* `!important` and explicit display/visibility defend against Blogger
       themes that aggressively style or hide all <h2> elements (very common —
       many themes set `font-size: 0` or `display: none` on h2s outside posts).
       Without these guards the start-screen title disappears on mobile in
       several popular Blogger themes. */
    font-size: 2.2rem !important;
    color: var(--aq-dark) !important;
    margin-bottom: 1rem !important;
    line-height: 1.3 !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em;
    font-family: var(--aq-font);
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    width: auto !important;
    overflow: visible !important;
    position: static !important;
    text-indent: 0 !important;
    text-transform: none !important;
}
#aimcq-root-scope .aq-title-sub {
    display: block;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--aq-secondary);
    margin-top: 0.5rem;
}
#aimcq-root-scope .aq-desc {
    font-size: 1.05rem;
    color: var(--aq-secondary);
    margin: 0 auto 2rem;
    max-width: 600px;
    font-family: var(--aq-font);
}
#aimcq-root-scope .aq-mode-btns {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 2rem;
}
#aimcq-root-scope .aq-start-btn {
    font-size: 1.05rem;
    font-weight: bold;
    padding: 0.9rem 2rem;
    cursor: pointer;
    border: none;
    border-radius: 50px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--aq-font);
    line-height: 1;
    text-decoration: none;
}
#aimcq-root-scope .aq-btn-quiz {
    background: var(--aq-primary);
    color: var(--aq-white);
}
#aimcq-root-scope .aq-btn-quiz:hover {
    background: var(--aq-primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,123,255,0.25);
}
#aimcq-root-scope .aq-btn-revision {
    background: var(--aq-warning);
    color: var(--aq-dark);
}
#aimcq-root-scope .aq-btn-revision:hover {
    background: #e0a800;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(255,193,7,0.25);
}

/* --- EXAM CONTAINER ---
   position:relative + overflow:hidden makes this the containing block for the
   nav panel and overlay, so they slide/appear only within the post bounds. --- */
#aimcq-root-scope .aq-exam {
    display: none;
    position: relative;
    overflow: hidden;
    min-height: 300px;
}

/* LAYOUT: always single column, main content takes full width */
#aimcq-root-scope .aq-layout {
    display: block;
}

/* --- NAV PANEL: absolute slide-in drawer scoped to .aq-exam ---
   position:absolute (not fixed) so the drawer stays within the post/quiz box
   and never overlaps the page header, sidebar, or other page content. --- */
#aimcq-root-scope .aq-nav-panel {
    background: var(--aq-white);
    padding: 1.5rem;
    position: absolute;
    top: 0;
    left: -320px;
    width: 300px;
    height: 100%;
    z-index: 30; /* only needs to beat siblings inside .aq-exam */
    border-radius: 0;
    box-shadow: 2px 0 20px rgba(0,0,0,0.15);
    transition: left 0.32s cubic-bezier(.4,0,.2,1);
    /* Panel itself does NOT scroll. Heading + topic tabs stay pinned at
       the top; only the question-number grid scrolls. Mirrors the CBT
       (Pro) interface so behaviour is consistent across both modes. */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#aimcq-root-scope .aq-nav-panel.drawer-open {
    left: 0;
}
#aimcq-root-scope .aq-nav-panel h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--aq-dark);
    border-bottom: 1px solid var(--aq-border);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    font-family: var(--aq-font);
    flex-shrink: 0;
}
#aimcq-root-scope .aq-nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    gap: 0.6rem;
    /* Only this section scrolls — the question-number buttons.
       flex:1 takes all remaining height in the nav panel; min-height:0
       lets the grid actually shrink inside the flex column (otherwise
       min-content prevents shrinking and would push the grid off-screen).
       Padding on EVERY side (not just the right, which is for the
       scrollbar) matters here: the active button's ring is drawn with
       box-shadow + a slight scale, both of which paint outside its own
       border box. Without matching padding around the grid, that ring
       gets sliced off flush against this container's own scroll edge —
       most visibly on the very first row, where there's no button above
       to imply the ring continues past view. */
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    align-content: start;
    padding: 8px 6px 8px 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 transparent;
}
#aimcq-root-scope .aq-nav-grid::-webkit-scrollbar { width: 6px; }
#aimcq-root-scope .aq-nav-grid::-webkit-scrollbar-track { background: transparent; }
#aimcq-root-scope .aq-nav-grid::-webkit-scrollbar-thumb {
    background: #94a3b8; border-radius: 3px;
}
#aimcq-root-scope .aq-nav-grid::-webkit-scrollbar-thumb:hover { background: #64748b; }
#aimcq-root-scope .aq-q-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 44px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9rem;
    transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
    border: 1.5px solid var(--aq-border);
    background: var(--aq-white);
    color: var(--aq-dark);
    font-family: var(--aq-font);
}
#aimcq-root-scope .aq-q-btn.q-answered {
    background: var(--aq-success);
    color: #fff;
    border-color: var(--aq-success);
}
#aimcq-root-scope .aq-q-btn.q-review {
    background: var(--aq-warning);
    color: #000;
    border-color: var(--aq-warning);
}
/* Active/current question — a solid, unmistakable boundary rather than a
   thin outline that can visually merge with the button's own border. The
   ring is TWO layers: an inner solid border (part of the box itself, so it
   never blurs or clips) plus an outer glow via box-shadow for separation
   from neighbouring buttons. Both sit fully inside the padding added to
   .aq-nav-grid above, so the ring never gets sliced by the scroll edge. */
#aimcq-root-scope .aq-q-btn.q-current {
    border: 2.5px solid var(--aq-primary);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.22), 0 2px 8px rgba(0, 123, 255, 0.28);
    transform: scale(1.06);
    z-index: 2;
}
/* Topic-grouped nav panel */
#aimcq-root-scope .aq-nav-topic-group { margin-bottom: 1.25rem; }
#aimcq-root-scope .aq-nav-topic-group:last-child { margin-bottom: 0; }
#aimcq-root-scope .aq-nav-topic-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--aq-secondary);
    margin: 0 0 0.6rem 0;
    padding: 0.3rem 0.5rem;
    background: var(--aq-light);
    border-left: 3px solid var(--aq-primary);
    border-radius: 3px;
    font-family: var(--aq-font);
}
/* Hidden state: when a topic tab filters the nav, non-matching groups collapse. */
#aimcq-root-scope .aq-nav-topic-group.aq-hidden { display: none !important; }
/* Legacy "dim" style kept for backwards-compat callers (unused by default now). */
#aimcq-root-scope .aq-nav-topic-group.aq-dim .aq-q-btn {
    opacity: 0.3;
    pointer-events: none;
}
#aimcq-root-scope .aq-nav-topic-group.aq-dim .aq-nav-topic-label {
    opacity: 0.45;
}

/* --- TOPIC TABS (horizontal scrollable — now inside the nav-panel sidebar) --- */
#aimcq-root-scope .aq-topic-tabs {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--aq-border) transparent;
    padding: 0 0 0.55rem 0;
    margin: 0 0 1rem 0;
    -ms-overflow-style: none;
    /* Pinned at the top of the nav panel above the scrollable grid —
       never shrinks, always visible. */
    flex-shrink: 0;
}
#aimcq-root-scope .aq-topic-tabs::-webkit-scrollbar { height: 4px; }
#aimcq-root-scope .aq-topic-tabs::-webkit-scrollbar-track { background: transparent; }
#aimcq-root-scope .aq-topic-tabs::-webkit-scrollbar-thumb { background: var(--aq-border); border-radius: 3px; }
#aimcq-root-scope .aq-topic-tab {
    flex: 0 0 auto;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    border: 1px solid var(--aq-border);
    background: var(--aq-white);
    color: var(--aq-dark);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--aq-font);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.18s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    line-height: 1.2;
}
#aimcq-root-scope .aq-topic-tab:hover {
    border-color: var(--aq-primary);
    color: var(--aq-primary);
}
#aimcq-root-scope .aq-topic-tab.active {
    background: var(--aq-primary);
    border-color: var(--aq-primary);
    color: var(--aq-white);
}
#aimcq-root-scope .aq-topic-tab .aq-topic-count {
    display: inline-block;
    background: rgba(0,0,0,0.08);
    color: inherit;
    border-radius: 999px;
    padding: 0.04rem 0.44rem;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 1.1em;
    text-align: center;
}
#aimcq-root-scope .aq-topic-tab.active .aq-topic-count {
    background: rgba(255,255,255,0.25);
}

/* --- SECTION HEADINGS (inline topic dividers) --- */
#aimcq-root-scope .aq-section-heading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.5rem 0 1.25rem 0;
    padding: 0.75rem 1rem;
    background: linear-gradient(90deg, rgba(0,123,255,0.08) 0%, rgba(0,123,255,0) 100%);
    border-left: 4px solid var(--aq-primary);
    border-radius: 6px;
}
#aimcq-root-scope .aq-section-heading .aq-section-icon {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--aq-primary);
    color: var(--aq-white);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}
#aimcq-root-scope .aq-section-heading .aq-section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--aq-dark);
    font-family: var(--aq-font);
    line-height: 1.3;
    flex: 1;
    min-width: 0;
}
#aimcq-root-scope .aq-section-heading .aq-section-meta {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--aq-secondary);
    white-space: nowrap;
}
#aimcq-root-scope .aq-section-heading.hidden { display: none !important; }

/* --- RESULTS: per-topic breakdown table --- */
#aimcq-root-scope .aq-topic-breakdown {
    margin-top: 1.5rem;
    text-align: left;
    background: var(--aq-white);
    border: 1px solid var(--aq-border);
    border-radius: 8px;
    overflow: hidden;
}
#aimcq-root-scope .aq-topic-breakdown h4 {
    margin: 0;
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--aq-dark);
    background: var(--aq-light);
    border-bottom: 1px solid var(--aq-border);
    font-family: var(--aq-font);
}
#aimcq-root-scope .aq-topic-breakdown-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--aq-border);
    font-family: var(--aq-font);
    font-size: 0.92rem;
}
#aimcq-root-scope .aq-topic-breakdown-row:last-child { border-bottom: none; }
#aimcq-root-scope .aq-topic-breakdown-name {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    color: var(--aq-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#aimcq-root-scope .aq-topic-breakdown-bar {
    flex: 0 0 90px;
    height: 6px;
    background: var(--aq-border);
    border-radius: 3px;
    overflow: hidden;
}
#aimcq-root-scope .aq-topic-breakdown-bar > span {
    display: block;
    height: 100%;
    background: var(--aq-primary);
    transition: width 0.4s ease;
}
#aimcq-root-scope .aq-topic-breakdown-stats {
    flex: 0 0 auto;
    font-weight: 700;
    color: var(--aq-dark);
    font-size: 0.88rem;
    white-space: nowrap;
}
#aimcq-root-scope .aq-topic-breakdown-pct {
    flex: 0 0 48px;
    text-align: right;
    font-weight: 700;
    font-size: 0.9rem;
}

/* --- MAIN CONTENT --- */
#aimcq-root-scope .aq-main {
    flex: 1;
    background: var(--aq-white);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--aq-shadow);
    min-width: 0;
}

/* --- EXAM HEADER --- */
#aimcq-root-scope .aq-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--aq-border);
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}
#aimcq-root-scope .aq-header h2 {
    margin: 0;
    font-size: 1.4rem;
    line-height: 1.3;
    font-weight: 700;
    color: var(--aq-dark);
    font-family: var(--aq-font);
}
/* Title + topic-badge stacked in the left side of the header */
#aimcq-root-scope .aq-header-title {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    min-width: 0;
    flex: 1;
}
#aimcq-root-scope .aq-current-topic {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.7rem;
    background: rgba(0,123,255,0.1);
    color: var(--aq-primary);
    border: 1px solid rgba(0,123,255,0.25);
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: var(--aq-font);
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#aimcq-root-scope .aq-current-topic::before {
    content: "";
    flex: 0 0 auto;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--aq-primary);
}
#aimcq-root-scope .aq-timer {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--aq-danger);
    background: var(--aq-danger-light);
    padding: 0.4rem 0.9rem;
    border-radius: 8px;
    border: 1px solid var(--aq-danger);
    font-family: var(--aq-font);
    white-space: nowrap;
}

/* --- PROGRESS BAR --- */
#aimcq-root-scope .aq-progress {
    width: 100%;
    background: #e9ecef;
    border-radius: 50px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    height: 10px;
}
#aimcq-root-scope .aq-progress-inner {
    height: 10px;
    width: 0%;
    background: var(--aq-primary);
    transition: width 0.4s ease;
    border-radius: 50px;
}

/* --- QUESTION --- */
#aimcq-root-scope .aq-question { margin-bottom: 2rem; animation: aqFadeIn 0.4s ease; }
#aimcq-root-scope .aq-question.hidden { display: none; }
#aimcq-root-scope .aq-q-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
    flex-wrap: wrap;
}
#aimcq-root-scope .aq-q-num {
    font-weight: 700;
    color: var(--aq-primary);
    font-size: 1.15rem;
    font-family: var(--aq-font);
}
#aimcq-root-scope .aq-passage-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--aq-info);
    background: var(--aq-info-light);
    border: 1px solid var(--aq-info);
    border-radius: 4px;
    padding: 2px 7px;
    white-space: nowrap;
    font-family: var(--aq-font);
    line-height: 1.5;
}
#aimcq-root-scope .aq-lang-sw { margin-left: auto; display: flex; gap: 4px; }
#aimcq-root-scope .aq-lang-btn {
    background: #5f5f5f;
    border: 1px solid #ddd;
    padding: 0.25rem 0.6rem;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    color: #fff;
    font-family: var(--aq-font);
    line-height: 1.4;
}
#aimcq-root-scope .aq-lang-btn.active {
    background: var(--aq-primary);
    border-color: var(--aq-primary);
}
#aimcq-root-scope .aq-q-body {
    font-size: 1.15rem;
    line-height: 1.65;
    color: var(--aq-dark);
    margin-bottom: 1.25rem;
    font-family: var(--aq-font);
}
#aimcq-root-scope .aq-q-body p { margin-bottom: 0.75em; }
#aimcq-root-scope .aq-q-body p:last-child { margin-bottom: 0.5rem; }

/* --- OPTIONS --- */
#aimcq-root-scope .aq-options ul {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}
#aimcq-root-scope .aq-options li { list-style: none !important; }
#aimcq-root-scope .aq-options label {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.9rem 1rem;
    border: 2px solid var(--aq-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    background: var(--aq-white);
}
#aimcq-root-scope .aq-options label:hover { border-color: var(--aq-primary); }
#aimcq-root-scope .aq-options input { display: none; }
#aimcq-root-scope .aq-opt-wrap {
    display: flex;
    align-items: center;
    width: 100%;
}
#aimcq-root-scope .aq-opt-lbl {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    background: var(--aq-light);
    color: var(--aq-secondary-dark);
    border-radius: 50%;
    margin-right: 10px;
    font-weight: bold;
    font-size: 0.9rem;
    border: 1px solid var(--aq-border);
    transition: all 0.2s;
    font-family: var(--aq-font);
}
#aimcq-root-scope .aq-options label:hover .aq-opt-lbl { background: #e9ecef; border-color: var(--aq-secondary); }
#aimcq-root-scope .aq-options label.selected { border-color: var(--aq-primary); background: #f0f7ff; }
#aimcq-root-scope .aq-options label.selected .aq-opt-lbl { background: var(--aq-primary); color: #fff; border-color: var(--aq-primary); }
#aimcq-root-scope .aq-options label.correct { border-color: var(--aq-success) !important; background: var(--aq-success-light) !important; }
#aimcq-root-scope .aq-options label.correct .aq-opt-lbl { background: var(--aq-success) !important; color: #fff !important; border-color: var(--aq-success) !important; }
#aimcq-root-scope .aq-options label.incorrect { border-color: var(--aq-danger) !important; background: var(--aq-danger-light) !important; }
#aimcq-root-scope .aq-options label.incorrect .aq-opt-lbl { background: var(--aq-danger) !important; color: #fff !important; border-color: var(--aq-danger) !important; }
#aimcq-root-scope .aq-options label.missed { border: 2px dashed var(--aq-success) !important; }
/* 5th "not attempted" option marked by the candidate: neutral, never red. */
#aimcq-root-scope .aq-options label.na-marked { border-color: #94a3b8 !important; background: #f1f5f9 !important; }
#aimcq-root-scope .aq-options label.na-marked .aq-opt-lbl { background: #64748b !important; color: #fff !important; border-color: #64748b !important; }
#aimcq-root-scope .aq-options label.disabled { cursor: not-allowed; opacity: 0.85; }
#aimcq-root-scope .aq-opt-img { max-width: 100%; height: auto; border-radius: 6px; margin-bottom: 0.25rem; display: block; }
#aimcq-root-scope .aq-opt-text p { margin: 0; font-family: var(--aq-font); font-size: 1rem; }

/* --- QUESTION FOOTER --- */
#aimcq-root-scope .aq-q-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.25rem;
}
#aimcq-root-scope .aq-review-wrap { font-size: 0.9em; color: var(--aq-dark); }
#aimcq-root-scope .aq-review-wrap label { cursor: pointer; display: flex; align-items: center; gap: 6px; font-family: var(--aq-font); }
#aimcq-root-scope .aq-clear-btn {
    background: transparent;
    color: var(--aq-secondary);
    border: none;
    cursor: pointer;
    font-size: 0.9em;
    padding: 0;
    font-weight: 400;
    font-family: var(--aq-font);
}
#aimcq-root-scope .aq-clear-btn:hover { color: var(--aq-dark); }

/* --- EXPLANATION --- */
#aimcq-root-scope .aq-explanation {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: var(--aq-info-light);
    border-left: 5px solid var(--aq-info);
    border-radius: 8px;
    font-size: 0.98rem;
    line-height: 1.65;
    color: var(--aq-dark);
    font-family: var(--aq-font);
}
#aimcq-root-scope .aq-explanation strong { color: var(--aq-info); font-weight: bold; }
#aimcq-root-scope .aq-explanation p { margin-bottom: 0.75em; }
#aimcq-root-scope .aq-explanation p:last-child { margin-bottom: 0; }
#aimcq-root-scope .aq-explanation ul, #aimcq-root-scope .aq-explanation ol { padding-left: 1.25rem; margin-bottom: 0.75em; }
#aimcq-root-scope .aq-explanation li { margin-bottom: 0.3em; font-family: var(--aq-font); }
#aimcq-root-scope .aq-explanation h5 { font-size: 1rem; font-weight: 700; margin: 1rem 0 0.4rem; color: var(--aq-dark); font-family: var(--aq-font); }

/* --- NAV CONTAINER (prev/next) --- */
#aimcq-root-scope .aq-nav-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--aq-border);
}
#aimcq-root-scope .aq-nav-right { margin-left: auto; display: flex; gap: 0.5rem; }
#aimcq-root-scope .aq-btn {
    padding: 0.7rem 1.4rem;
    font-size: 0.95rem;
    font-weight: bold;
    color: var(--aq-white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    font-family: var(--aq-font);
    line-height: 1;
    text-decoration: none;
}
#aimcq-root-scope .aq-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.12); }
#aimcq-root-scope .aq-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }
#aimcq-root-scope .aq-btn-prev { background: var(--aq-secondary); }
#aimcq-root-scope .aq-btn-prev:hover { background: var(--aq-secondary-dark); }
#aimcq-root-scope .aq-btn-next { background: var(--aq-secondary); }
#aimcq-root-scope .aq-btn-next:hover { background: var(--aq-secondary-dark); }
#aimcq-root-scope .aq-btn-submit { background: var(--aq-primary); }
#aimcq-root-scope .aq-btn-submit:hover { background: var(--aq-primary-dark); }
#aimcq-root-scope .aq-btn-check { background: var(--aq-success); }
#aimcq-root-scope .aq-btn-check:hover { background: #218838; }
#aimcq-root-scope .aq-btn[style*="visibility: hidden"] { pointer-events: none; opacity: 0; }

/* --- RESULTS --- */
#aimcq-root-scope .aq-results {
    text-align: center;
    padding: 2.5rem 2rem;
    border-radius: 12px;
    margin-top: 1.5rem;
    display: none;
}
#aimcq-root-scope .aq-results.pass { background: var(--aq-success-light); border: 1px solid var(--aq-success); color: var(--aq-success); }
#aimcq-root-scope .aq-results.fail { background: var(--aq-danger-light); border: 1px solid var(--aq-danger); color: var(--aq-danger); }
#aimcq-root-scope .aq-results h3 { font-size: 1.9rem; margin-bottom: 1rem; font-family: var(--aq-font); font-weight: 700; }
#aimcq-root-scope .aq-results p { font-size: 1.15rem; font-family: var(--aq-font); }
#aimcq-root-scope .aq-results-table {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    border-collapse: collapse;
    background: var(--aq-white);
    border-radius: 8px;
    border-style: hidden;
    box-shadow: 0 0 0 1px var(--aq-border), 0 4px 12px rgba(0,0,0,0.06);
    font-family: var(--aq-font);
}
#aimcq-root-scope .aq-results-table th,
#aimcq-root-scope .aq-results-table td {
    padding: 12px 18px;
    border-bottom: 1px solid var(--aq-border);
    font-size: 1rem;
    text-align: left;
    font-family: var(--aq-font);
    color: var(--aq-dark);
}
#aimcq-root-scope .aq-results-table th { font-weight: 500; color: var(--aq-secondary); }
#aimcq-root-scope .aq-results-table td { text-align: right; font-weight: 700; }
#aimcq-root-scope .aq-results-table tr:last-child th,
#aimcq-root-scope .aq-results-table tr:last-child td { border-bottom: none; }
#aimcq-root-scope .aq-results-highlight { background: var(--aq-light); }

/* --- MODAL --- */
#aimcq-root-scope .aq-modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10002;
    animation: aqFadeIn 0.3s;
}
#aimcq-root-scope .aq-modal {
    background: var(--aq-white);
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--aq-shadow);
    width: 90%;
    max-width: 420px;
}
#aimcq-root-scope .aq-modal h3 { font-size: 1.4rem; margin-bottom: 0.75rem; color: var(--aq-dark); font-family: var(--aq-font); font-weight: 700; }
#aimcq-root-scope .aq-modal p { font-size: 1.05rem; color: var(--aq-secondary); margin-bottom: 1.5rem; font-family: var(--aq-font); }
#aimcq-root-scope .aq-modal-btns { display: flex; justify-content: center; gap: 0.75rem; flex-wrap: wrap; }
#aimcq-root-scope .aq-modal-btns button {
    padding: 0.65rem 1.4rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
    font-family: var(--aq-font);
    font-size: 0.95rem;
}
#aimcq-root-scope .aq-modal-confirm { background: var(--aq-danger); color: #fff; }
#aimcq-root-scope .aq-modal-cancel { background: #e9ecef; color: var(--aq-dark); }

/* NAV OVERLAY: injected as absolute child of .aq-exam — scoped to post only */
#aimcq-root-scope .aq-nav-overlay-scoped {
    display: none;
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.45);
    z-index: 20; /* above .aq-main (z-index:auto) but below .aq-nav-panel (z-index:30) */
    opacity: 0;
    transition: opacity 0.3s ease;
}
#aimcq-root-scope .aq-nav-overlay-scoped.active { display: block; opacity: 1; }

/* --- NAV TOGGLE BTN: injected into document.body for true viewport-fixed positioning ---
   Only the toggle button lives on body — the overlay is scoped inside .aq-exam. --- */
.aq-nav-toggle-portal {
    display: flex;
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2147483646;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 52px;
    height: 52px;
    padding: 0;
    box-shadow: 0 4px 16px rgba(0,123,255,0.35);
    cursor: pointer;
    justify-content: center;
    align-items: center;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    margin: 0;
    outline: none;
    font-family: inherit;
    line-height: 1;
    text-decoration: none;
    -webkit-appearance: none;
    appearance: none;
}
.aq-nav-toggle-portal:hover {
    background: #0056b3;
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,123,255,0.4);
}
/* Keep the in-scope toggle hidden (legacy fallback, never shown) */
#aimcq-root-scope .aq-nav-toggle { display: none !important; }
#aimcq-root-scope .aq-toggle-label { display: none; }
/* Keep legacy overlay hidden too (replaced by scoped overlay) */
#aimcq-root-scope .aq-nav-overlay { display: none !important; }

/* --- TABLES in content ---
   Covers all four containers: .aq-q-body, .aq-explanation, .cbt-question-body, .cbt-explanation
   All !important rules override any inline styles injected by WordPress / question content editors.
   ------------------------------------------------------------------------------------------------ */

/* OUTER WRAPPER — block display for horizontal scroll on small screens */
#aimcq-root-scope .aq-q-body table,
#aimcq-root-scope .aq-explanation table,
#aimcq-root-scope .cbt-question-body table,
#aimcq-root-scope .cbt-explanation table {
    display: table !important;       /* keep as real table for fixed layout to work */
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    border-collapse: collapse !important;
    border-spacing: 0 !important;
    border: 1px solid var(--aq-border) !important;
    margin-top: 0.5rem !important;
    margin-bottom: 1rem !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 0 !important;
    font-family: var(--aq-font) !important;
    font-size: 0.97rem !important;
    line-height: 1.6 !important;
    background: transparent !important;
    color: var(--aq-dark) !important;
    float: none !important;
    position: static !important;
    table-layout: fixed !important;  /* KEY: equal column distribution, no greediness */
    box-sizing: border-box !important;
}

/* Scrollable wrapper for narrow screens — wrap each table in a div via JS isn't available,
   so we use overflow on the table itself with display:block only at small viewport */
@media (max-width: 600px) {
    #aimcq-root-scope .aq-q-body table,
    #aimcq-root-scope .aq-explanation table,
    #aimcq-root-scope .cbt-question-body table,
    #aimcq-root-scope .cbt-explanation table {
        display: block !important;
        width: 100% !important;
    }
}

/* COLGROUP / COL — strip any fixed widths so fixed layout distributes evenly */
#aimcq-root-scope .aq-q-body col,
#aimcq-root-scope .aq-explanation col,
#aimcq-root-scope .cbt-question-body col,
#aimcq-root-scope .cbt-explanation col {
    width: auto !important;
}

/* TH & TD — override every common inline property; word-break ensures long sentences wrap */
#aimcq-root-scope .aq-q-body th,
#aimcq-root-scope .aq-q-body td,
#aimcq-root-scope .aq-explanation th,
#aimcq-root-scope .aq-explanation td,
#aimcq-root-scope .cbt-question-body th,
#aimcq-root-scope .cbt-question-body td,
#aimcq-root-scope .cbt-explanation th,
#aimcq-root-scope .cbt-explanation td {
    border: 1px solid var(--aq-border) !important;
    padding: 0.7rem 0.9rem !important;
    text-align: left !important;
    vertical-align: top !important;
    font-family: var(--aq-font) !important;
    font-size: 0.97rem !important;
    font-weight: normal !important;
    line-height: 1.6 !important;
    color: var(--aq-dark) !important;
    background: transparent !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    white-space: normal !important;
    word-break: break-word !important;      /* long sentences wrap inside fixed columns */
    overflow-wrap: break-word !important;
    hyphens: auto !important;
}

/* TH — header cell overrides */
#aimcq-root-scope .aq-q-body th,
#aimcq-root-scope .aq-explanation th,
#aimcq-root-scope .cbt-question-body th,
#aimcq-root-scope .cbt-explanation th {
    background: var(--aq-light) !important;
    font-weight: 700 !important;
    color: var(--aq-dark) !important;
    vertical-align: middle !important;
    white-space: normal !important;         /* headers also wrap in fixed layout */
}

/* Zebra striping — even rows */
#aimcq-root-scope .aq-q-body tbody tr:nth-child(even),
#aimcq-root-scope .aq-explanation tbody tr:nth-child(even),
#aimcq-root-scope .cbt-question-body tbody tr:nth-child(even),
#aimcq-root-scope .cbt-explanation tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.025) !important;
}

/* THEAD / TBODY / TFOOT / TR — strip any inline background/height/spacing */
#aimcq-root-scope .aq-q-body thead,
#aimcq-root-scope .aq-q-body tbody,
#aimcq-root-scope .aq-q-body tfoot,
#aimcq-root-scope .aq-q-body tr,
#aimcq-root-scope .aq-explanation thead,
#aimcq-root-scope .aq-explanation tbody,
#aimcq-root-scope .aq-explanation tfoot,
#aimcq-root-scope .aq-explanation tr,
#aimcq-root-scope .cbt-question-body thead,
#aimcq-root-scope .cbt-question-body tbody,
#aimcq-root-scope .cbt-question-body tfoot,
#aimcq-root-scope .cbt-question-body tr,
#aimcq-root-scope .cbt-explanation thead,
#aimcq-root-scope .cbt-explanation tbody,
#aimcq-root-scope .cbt-explanation tfoot,
#aimcq-root-scope .cbt-explanation tr {
    background: transparent !important;
    height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
}

/* --- KATEX overflow --- */
#aimcq-root-scope .katex-display { overflow-x: auto; overflow-y: hidden; padding-bottom: 8px; white-space: nowrap; }

/* --- PASSAGE --- */
/* --- PASSAGE DISPLAY BOX (separate from questions, shown/hidden on navigation) --- */
#aimcq-root-scope .aq-passage-display {
    background: var(--aq-light);
    border: 1px solid var(--aq-border);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
    scroll-behavior: smooth;
}
#aimcq-root-scope .aq-passage-display h3 {
    font-size: 1.15rem;
    color: var(--aq-dark);
    border-bottom: 1px solid var(--aq-border);
    padding-bottom: 0.5rem;
    margin-bottom: 0.85rem;
    font-family: var(--aq-font);
    font-weight: 700;
    margin-top: 0;
}
#aimcq-root-scope .aq-passage-content-en,
#aimcq-root-scope .aq-passage-content-hi {
    font-size: 1rem;
    line-height: 1.75;
    color: var(--aq-dark);
    font-family: var(--aq-font);
}
#aimcq-root-scope .aq-passage-content-en p,
#aimcq-root-scope .aq-passage-content-hi p { margin-bottom: 0.9em; }

/* --- RESPONSIVE (basic quiz/practice interface, phones) ---
   The "basic" engine (as opposed to the professional CBT interface, which
   already has its own dedicated mobile layout under the cbt- prefix) used to
   just strip padding to 0 on small screens and shrink a few fonts, leaving an
   edge-to-edge, cramped reading experience. Below rebuilds it into something
   that reads like a proper mobile exam app: a condensed sticky header, a
   thumb-reach sticky action bar for Prev/Next/Submit, larger tap targets on
   the options, and a start screen that isn't crowded — while leaving the
   desktop layout (and the professional cbt- interface) completely alone. */
@media (max-width: 600px) {
    /* The runner shell already owns the full viewport — the card no longer
       needs its own outer margin/shadow, just tidy internal spacing. */
    #aimcq-root-scope .aq-wrapper { margin: 0; max-width: 100%; }
    /* Bottom clears the sticky action bar; top clears the fixed header below
       (its exact height varies slightly with content, so 70px is a
       comfortable upper bound rather than a measured exact value). */
    #aimcq-root-scope .aq-main {
        padding: 70px 14px 92px !important;
        border-radius: 0;
        box-shadow: none;
        min-height: 100%;
    }

    /* Condensed header, pinned so title/timer stay visible while scrolling
       through a long question — the timer especially shouldn't scroll away. */
    #aimcq-root-scope .aq-header {
        position: fixed;
        top: 0; left: 0; right: 0;
        z-index: 15;
        background: rgba(255,255,255,0.97);
        -webkit-backdrop-filter: saturate(180%) blur(8px);
        backdrop-filter: saturate(180%) blur(8px);
        margin: 0;
        padding: 10px 14px;
        border-bottom: 1px solid var(--aq-border);
    }
    #aimcq-root-scope .aq-header h2 { font-size: 1rem; }
    #aimcq-root-scope .aq-header-title { gap: 2px; }
    #aimcq-root-scope .aq-current-topic { font-size: 0.7rem; padding: 0.2rem 0.55rem; max-width: 55vw; }
    #aimcq-root-scope .aq-timer { font-size: 0.95rem; padding: 0.3rem 0.6rem; }

    /* Progress bar: taller and easier to read at a glance, with a small
       "Question X of Y" label above it (set via JS as a data attribute —
       see ExamRunner.updateProg — and pulled in here with attr()) so the
       bar means something on its own instead of being a bare sliver. */
    #aimcq-root-scope .aq-progress {
        position: relative;
        height: 8px;
        margin: 22px 0 1.4rem;
        background: #e9ecef;
        box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
    }
    #aimcq-root-scope .aq-progress::before {
        content: attr(data-progress-label);
        position: absolute;
        left: 0;
        top: -20px;
        font-size: 0.78rem;
        font-weight: 600;
        color: var(--aq-secondary);
        font-family: var(--aq-font);
    }
    #aimcq-root-scope .aq-progress-inner {
        height: 8px;
        background: linear-gradient(90deg, var(--aq-primary), var(--aq-primary-dark));
        box-shadow: 0 0 6px rgba(0,123,255,0.35);
    }

    /* Question card: tighter type scale, still comfortable to read. */
    #aimcq-root-scope .aq-q-header { gap: 0.5rem; margin-bottom: 0.75rem; }
    #aimcq-root-scope .aq-q-num { font-size: 1rem; }
    #aimcq-root-scope .aq-q-body { font-size: 1rem; line-height: 1.55; margin-bottom: 1rem; }
    /* Language switch stays pinned to the right, exactly like desktop —
       margin-left:auto (inherited from the base rule) is what pushes it
       there inside the flex .aq-q-header row; nothing to override here. */
    #aimcq-root-scope .aq-passage-display { padding: 1rem; max-height: 220px; }

    /* Bigger, thumb-friendly, tap-responsive option targets. */
    #aimcq-root-scope .aq-options ul { gap: 0.55rem; }
    #aimcq-root-scope .aq-options label {
        padding: 0.85rem 0.9rem;
        border-radius: 10px;
        -webkit-tap-highlight-color: transparent;
    }
    #aimcq-root-scope .aq-options label:active { transform: scale(0.99); }
    #aimcq-root-scope .aq-opt-lbl { width: 27px; height: 27px; font-size: 0.82rem; margin-right: 9px; }
    #aimcq-root-scope .aq-opt-text p { font-size: 0.97rem; line-height: 1.5; }

    #aimcq-root-scope .aq-q-footer { flex-wrap: wrap; gap: 0.6rem; }
    #aimcq-root-scope .aq-explanation { padding: 1rem; font-size: 0.93rem; margin-top: 1.1rem; }

    /* Sticky bottom action bar — Prev / Next / Submit stay reachable with a
       thumb and always visible, instead of scrolling away with the page
       the way a bare inline row does. */
    #aimcq-root-scope .aq-nav-row {
        position: fixed;
        left: 0; right: 0; bottom: 0;
        margin: 0;
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
        background: rgba(255,255,255,0.98);
        -webkit-backdrop-filter: saturate(180%) blur(8px);
        backdrop-filter: saturate(180%) blur(8px);
        border-top: 1px solid var(--aq-border);
        box-shadow: 0 -6px 18px rgba(0,0,0,0.07);
        z-index: 14;
        gap: 0.5rem;
    }
    #aimcq-root-scope .aq-nav-right { gap: 0.5rem; }
    /* Prev stays left, Next/Submit/Check stay right — exactly like desktop.
       Buttons keep their natural content width instead of stretching to
       fill the row (a flex:1 here would blow the prev button up to match
       the row width, since it's the row's other direct flex child). */
    #aimcq-root-scope .aq-btn { padding: 0.7rem 1rem; font-size: 0.88rem; }
    /* Once results are shown the paper is done — Prev/Next/Submit no longer
       apply, so drop the sticky action bar instead of leaving it empty
       underneath the results. (Progressive enhancement: browsers without
       :has() just keep an empty bar, which is harmless.) */
    #aimcq-root-scope .aq-main:has(.aq-results[style*="display: block"]) .aq-nav-row { display: none; }

    /* Keep the question-palette FAB clear of the new sticky action bar. */
    .aq-nav-toggle-portal {
        bottom: calc(80px + env(safe-area-inset-bottom));
        width: 48px; height: 48px;
    }
    /* Palette drawer takes most of the width on a phone, never the whole
       thing, so a stray tap on the dimmed edge still closes it. */
    #aimcq-root-scope .aq-nav-panel { width: 84vw; left: -86vw; padding: 1.1rem; }
    #aimcq-root-scope .aq-nav-grid { grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); }

    /* Start screen: no longer competing side-by-side, one clear action per row. */
    #aimcq-root-scope .aq-start { padding: 2.2rem 1.1rem; }
    #aimcq-root-scope .aq-start h2 { font-size: 1.7rem !important; display: block !important; visibility: visible !important; }
    #aimcq-root-scope .aq-mode-btns { flex-direction: column; gap: 10px; margin-top: 1.5rem; }
    #aimcq-root-scope .aq-start-btn { font-size: 0.95rem; padding: 0.85rem 1.5rem; width: 100%; justify-content: center; }

    /* Results screen. */
    #aimcq-root-scope .aq-results { padding: 1.9rem 1.1rem; margin-top: 1.1rem; }
    #aimcq-root-scope .aq-results h3 { font-size: 1.55rem; }
    #aimcq-root-scope .aq-results p { font-size: 1rem; }
    #aimcq-root-scope .aq-results-table th, #aimcq-root-scope .aq-results-table td { padding: 10px 14px; font-size: 0.93rem; }
}
@media (max-width: 480px) {
    #aimcq-root-scope .aq-start { padding-left: 1rem; padding-right: 1rem; }
    #aimcq-root-scope .aq-start h2 { font-size: 1.4rem !important; display: block !important; visibility: visible !important; }
    #aimcq-root-scope .aq-desc { font-size: 0.95rem; margin-bottom: 1.5rem; }
    #aimcq-root-scope .aq-header h2 { font-size: 0.92rem; }
    #aimcq-root-scope .aq-current-topic { max-width: 46vw; }
    #aimcq-root-scope .aq-timer { font-size: 0.85rem; padding: 0.26rem 0.5rem; }
    #aimcq-root-scope .aq-btn { padding: 0.65rem 0.7rem; font-size: 0.83rem; }
}

@keyframes aqFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Every top-level state the start screen can be in (booting, ready,
   sleeping, revision-select…) fades in rather than popping — the swap
   from one .aq-start to the next is a JS innerHTML replace, so this is
   what makes it read as a transition instead of a flash. */
#aimcq-root-scope .aq-start { animation: aqFadeIn 0.35s ease; }
@media (prefers-reduced-motion: reduce) { #aimcq-root-scope .aq-start { animation: none; } }

/* --- LOADING SPINNER + SKELETON ---
   Shown while the remote quiz JSON is fetched (and merged, for
   multi-category papers). A bare spinner reads as "stuck" on a slow
   connection; pairing it with a shimmering silhouette of the start
   screen that's about to appear makes the wait feel purposeful and
   keeps the layout's shape stable once the real content lands. */
#aimcq-root-scope .aq-boot { padding: 3rem 2rem; }
#aimcq-root-scope .aq-loader-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid var(--aq-border, #dee2e6);
    border-top: 4px solid var(--aq-primary, #007bff);
    border-radius: 50%;
    margin: 0 auto;
    animation: aqSpin 0.8s linear infinite;
}
@keyframes aqSpin { to { transform: rotate(360deg); } }
#aimcq-root-scope .aq-boot-msg { margin-top: 1.1rem; font-size: 1.02rem; color: var(--aq-secondary, #6c757d); font-weight: 500; }
#aimcq-root-scope .aq-boot-skel { max-width: 360px; margin: 2rem auto 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
#aimcq-root-scope .aq-boot-skel-line {
    height: 12px; border-radius: 6px; width: 100%;
    background: linear-gradient(100deg, var(--aq-light, #f1f3f5) 40%, #eceef1 50%, var(--aq-light, #f1f3f5) 60%);
    background-size: 250% 100%;
    animation: aqShimmer 1.4s ease-in-out infinite;
}
#aimcq-root-scope .aq-boot-skel-w70 { width: 70%; }
#aimcq-root-scope .aq-boot-skel-w40 { width: 40%; height: 10px; }
#aimcq-root-scope .aq-boot-skel-btns { display: flex; gap: 12px; margin-top: 0.6rem; width: 100%; justify-content: center; }
#aimcq-root-scope .aq-boot-skel-btn {
    height: 42px; width: 150px; border-radius: 50px;
    background: linear-gradient(100deg, var(--aq-light, #f1f3f5) 40%, #eceef1 50%, var(--aq-light, #f1f3f5) 60%);
    background-size: 250% 100%;
    animation: aqShimmer 1.4s ease-in-out infinite;
}
@keyframes aqShimmer { from { background-position: 120% 0; } to { background-position: -20% 0; } }
@media (prefers-reduced-motion: reduce) {
    #aimcq-root-scope .aq-loader-spinner { animation-duration: 2.2s; }
    #aimcq-root-scope .aq-boot-skel-line,
    #aimcq-root-scope .aq-boot-skel-btn { animation: none; background: var(--aq-light, #f1f3f5); }
}
@media (max-width: 480px) {
    #aimcq-root-scope .aq-boot { padding: 2.4rem 1.2rem; }
    #aimcq-root-scope .aq-boot-skel-btns { flex-direction: column; align-items: center; }
    #aimcq-root-scope .aq-boot-skel-btn { width: 100%; max-width: 220px; }
}


/* ==================================================================
   PROFESSIONAL CBT EXAM INTERFACE  (exam_interface: 'professional')
   ==================================================================
   SSC / CBT-style fullscreen exam layout ported from the
   ai-mcqs-exam-maker WordPress plugin. All selectors are scoped under
   #aimcq-root-scope to stay conflict-free on any host page.
   ================================================================== */

#aimcq-root-scope {
    /* CBT-specific palette colours (engine --aq-* tokens reused elsewhere) */
    --cbt-unanswered: #ff3333;
    --cbt-answered: #00a651;
    --cbt-not-visited: #f0f0f0;
    --cbt-review: #7141b7;
    --cbt-header: #2c3e50;
    --cbt-green: #5cb85c;
    --cbt-green-hover: #4cae4c;
}

/* ----------------------------------------------------------------
   FULLSCREEN MODE — Blogger/WordPress template compatibility
   ----------------------------------------------------------------
   Many host templates (Blogger especially) put `transform`, `filter`,
   `perspective`, `will-change` or `contain` on a wrapping element.
   Per the CSS spec, that turns the wrapper into the containing block
   for any descendant `position: fixed`, which traps our overlay
   inside the post body. The JS now relocates the overlay to be a
   direct child of <body> when the exam starts, and these rules make
   sure scroll is locked on BOTH html and body and that the overlay
   sits above any sticky template header.
   ---------------------------------------------------------------- */
html.aimcq-cbt-fullscreen,
body.aimcq-cbt-fullscreen {
    overflow: hidden !important;
    height: 100% !important;
    /* Prevent iOS rubber-band scroll bleeding through */
    overscroll-behavior: none !important;
    /* Block touch-scroll on the page behind the overlay */
    touch-action: none !important;
}

/* When the overlay has been relocated to <body>, hide any sibling
   Blogger sticky headers / floating widgets by suppressing pointer
   events on them. We use an attribute on body the JS sets. */
body.aimcq-cbt-fullscreen > *:not(#aimcq-root-scope):not(script):not(style):not(noscript) {
    /* Don't unmount the template — just keep it from intercepting
       clicks or bleeding visually above the overlay. The overlay's
       solid background covers them. */
    pointer-events: none !important;
}

#aimcq-root-scope .cbt-exam-wrapper {
    font-family: var(--aq-font);
    max-width: 1100px;
    margin: 1.5rem auto;
    position: relative;
    color: var(--aq-dark);
    animation: aqFadeIn 0.35s ease;
}
@media (prefers-reduced-motion: reduce) { #aimcq-root-scope .cbt-exam-wrapper { animation: none; } }

/* ---- Fullscreen overlay while the exam is active ---- */
#aimcq-root-scope .cbt-exam-wrapper.exam-active {
    position: fixed;
    inset: 0;                       /* shorthand for top/right/bottom/left: 0 */
    top: 0; left: 0; right: 0; bottom: 0;   /* fallback for older browsers */
    /* NOTE: do NOT set width/height here. `position: fixed` + `inset: 0`
       already stretches the element to fill the *visible* viewport on
       every browser. Adding `height: 100vh` here breaks mobile because
       100vh is the LARGEST viewport (URL bar hidden) — so the element
       grows taller than the screen and the bottom action bar (Save &
       Next, Check Answer, etc.) gets pushed below the visible area.
       Letting top:0 / bottom:0 do the work auto-adjusts as the mobile
       URL bar shows or hides. */
    z-index: 2147483600;            /* max int-ish; above any Blogger sticky bar */
    background: #fff;
    margin: 0;
    max-width: none;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    touch-action: none;
    -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;
    /* Block any ancestor transform/filter from re-trapping us — these
       create a containing block for fixed children. Since we've moved
       to <body>, there should be no such ancestor, but belt-and-braces. */
    transform: none !important;
    filter: none !important;
    perspective: none !important;
    will-change: auto !important;
    contain: none !important;
}

/* Flex-child min-size discipline: by default a flex item has
   `min-height: auto`, which means it refuses to shrink below its
   content's intrinsic height. On short mobile viewports that lets
   the middle question area push the bottom bar off-screen. Setting
   `min-height: 0` on the scrollable middle restores normal flex
   shrinking so the bottom bar always stays visible. */
#aimcq-root-scope .cbt-exam-wrapper.exam-active .cbt-exam-layout,
#aimcq-root-scope .cbt-exam-wrapper.exam-active .cbt-main-content {
    min-height: 0;
}

/* When the overlay has been moved to <body>, the wrapping
   #aimcq-root-scope element needs to participate in fullscreen too. */
body > #aimcq-root-scope.aimcq-cbt-relocated {
    position: fixed;
    inset: 0;
    z-index: 2147483600;
    pointer-events: auto;
}

/* ----------------------------------------------------------------
   START SCREEN
   ---------------------------------------------------------------- */
#aimcq-root-scope .cbt-start-screen {
    background: var(--aq-white);
    box-shadow: 0 1px 3px rgba(15,23,42,0.06), 0 12px 32px rgba(15,23,42,0.10);
    border-radius: 14px;
    border: 1px solid var(--aq-border);
    max-width: 900px; margin: 0 auto;
    overflow: hidden; text-align: left;
    animation: cbtFadeIn 0.25s ease both;
}
#aimcq-root-scope .cbt-start-header {
    background: linear-gradient(135deg, var(--cbt-header) 0%, var(--aq-primary-dark) 130%);
    color: #fff;
    padding: 22px 25px; border-bottom: 4px solid var(--aq-primary);
    position: relative;
}
#aimcq-root-scope .cbt-start-header h2 { margin: 0; font-size: 1.5rem; line-height: 1.3; color: #fff !important; font-weight: 700; }
#aimcq-root-scope .cbt-start-subtitle {
    margin: 6px 0 0; font-size: 0.9rem; font-weight: 500;
    color: rgba(255,255,255,0.85) !important; letter-spacing: 0.2px;
}
#aimcq-root-scope .cbt-content-area { padding: 25px; }

#aimcq-root-scope .cbt-exam-summary {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px;
    background: #f1f5f9; padding: 16px 18px; border-radius: 10px;
    margin-bottom: 22px; border: 1px solid #e2e8f0; border-left: 4px solid var(--aq-primary);
}
#aimcq-root-scope .cbt-summary-item {
    font-size: 0.95rem; color: #1e293b; font-weight: 600;
    background: #fff; border: 1px solid #e6ebf1; border-radius: 8px;
    padding: 10px 12px; box-shadow: 0 1px 2px rgba(15,23,42,0.03);
}
#aimcq-root-scope .cbt-summary-item strong {
    display: block; font-size: 0.72rem; color: #64748b; font-weight: 700;
    text-transform: uppercase; margin-bottom: 5px; letter-spacing: 0.6px;
}

#aimcq-root-scope .cbt-lang-select-container {
    text-align: right; margin-bottom: 14px; font-size: 0.9rem; color: #334155;
    display: flex; align-items: center; justify-content: flex-end; gap: 8px;
}
#aimcq-root-scope .cbt-lang-select {
    padding: 6px 10px; border: 1px solid #cbd5e1; border-radius: 6px;
    font-size: 0.9rem; font-family: inherit; font-weight: 600; background: #f8fafc;
    min-height: 34px;
}

#aimcq-root-scope .cbt-instructions-box {
    border: 1px solid #e2e8f0; border-radius: 10px; padding: 20px 22px;
    max-height: 340px; overflow-y: auto; background: #fff;
    margin-bottom: 20px; box-shadow: inset 0 2px 6px rgba(15,23,42,0.03);
    scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent;
}
#aimcq-root-scope .cbt-instructions-box::-webkit-scrollbar { width: 7px; }
#aimcq-root-scope .cbt-instructions-box::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
#aimcq-root-scope .cbt-instructions-box::-webkit-scrollbar-track { background: transparent; }
#aimcq-root-scope .cbt-instructions-box h3 {
    margin-top: 0; color: #0f172a; font-size: 1.15rem; font-weight: 700;
    border-bottom: 2px solid #eef2f7; padding-bottom: 12px; margin-bottom: 16px;
    display: flex; align-items: center; gap: 8px;
}
#aimcq-root-scope .cbt-instructions-box h3::before {
    content: ''; width: 5px; height: 18px; background: var(--aq-primary);
    border-radius: 3px; display: inline-block;
}
#aimcq-root-scope .cbt-instructions-box h4 { margin-top: 22px; margin-bottom: 10px; color: #1e293b; font-size: 0.98rem; font-weight: 700; }
#aimcq-root-scope .cbt-instructions-box p {
    color: #475569; line-height: 1.6; font-size: 0.93rem; margin-bottom: 12px;
}
#aimcq-root-scope .cbt-instructions-box ul { padding-left: 20px; }

/* Numbered instructions, rebuilt with CSS counters — the engine strips
   default list markers globally (#aimcq-root-scope li { list-style: none }),
   so this restores clean, professional badge-style numbering instead of
   leaving the list unmarked. */
#aimcq-root-scope .cbt-instructions-box ol {
    counter-reset: cbt-inst; padding-left: 0; margin: 0;
}
#aimcq-root-scope .cbt-instructions-box ol > li {
    counter-increment: cbt-inst;
    position: relative;
    padding: 6px 0 6px 34px !important;
    color: #334155; line-height: 1.55; font-size: 0.93rem; margin-bottom: 4px;
    border-radius: 6px;
}
#aimcq-root-scope .cbt-instructions-box ol > li::before {
    content: counter(cbt-inst);
    position: absolute; left: 0; top: 6px;
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--aq-info-light); color: var(--aq-primary-dark);
    font-size: 0.72rem; font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}
/* Critical safety/warning lines (blank-penalty, deadline, single-sitting, …)
   get a subtle highlighted treatment so they can't be skimmed past. */
#aimcq-root-scope .cbt-instructions-box ol > li.cbt-inst-warn {
    background: var(--aq-danger-light); padding-top: 8px; padding-bottom: 8px;
    padding-right: 10px; margin: 6px 0;
}
#aimcq-root-scope .cbt-instructions-box ol > li.cbt-inst-warn::before {
    background: var(--aq-danger); color: #fff; content: '!';
}

#aimcq-root-scope .cbt-palette-demo {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 16px;
    margin: 12px 0 4px; padding: 14px 16px;
    background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 8px;
}
#aimcq-root-scope .cbt-demo-item {
    display: flex; align-items: center; gap: 10px; font-size: 0.85rem; color: #475569;
}
#aimcq-root-scope .cbt-demo-icon {
    width: 26px; height: 26px; display: inline-flex; border-radius: 6px;
    justify-content: center; align-items: center; font-weight: bold; flex-shrink: 0;
}

#aimcq-root-scope .cbt-exam-description { margin-top: 10px; }

#aimcq-root-scope .cbt-declaration {
    background: #f8fafc; border: 1px solid #e2e8f0;
    padding: 16px 18px; border-radius: 10px; margin-bottom: 24px;
    transition: background 0.15s ease, border-color 0.15s ease;
}
#aimcq-root-scope .cbt-declaration:has(input:checked) {
    background: var(--aq-success-light); border-color: #b7dfc0;
}
#aimcq-root-scope .cbt-declaration label {
    display: flex; align-items: flex-start; gap: 12px; cursor: pointer;
    color: #334155; font-size: 0.93rem; line-height: 1.55; margin: 0; font-weight: 600;
}
#aimcq-root-scope .cbt-declaration input[type="checkbox"] {
    margin-top: 2px; width: 20px; height: 20px; flex-shrink: 0; cursor: pointer; accent-color: var(--aq-success);
}

#aimcq-root-scope .cbt-resume-notice {
    color: #b91c1c; font-weight: 700; margin-bottom: 15px; font-size: 1rem;
    background: var(--aq-danger-light); border-radius: 8px; padding: 10px 14px;
}

#aimcq-root-scope .cbt-action-bar {
    text-align: center; border-top: 1px solid #e2e8f0; padding-top: 20px;
}
#aimcq-root-scope .cbt-start-btn {
    background: var(--cbt-green); color: #fff; border: none;
    padding: 13px 40px; font-size: 1.1rem; font-weight: 700; border-radius: 8px;
    cursor: pointer; transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 4px 10px rgba(92,184,92,0.28);
    min-width: 240px; max-width: 100%;
}
#aimcq-root-scope .cbt-start-btn:hover:not(:disabled) {
    background: var(--cbt-green-hover); transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(92,184,92,0.35);
}
#aimcq-root-scope .cbt-start-btn:disabled {
    background: #a3d9a3; cursor: not-allowed; box-shadow: none; transform: none;
}

/* ----------------------------------------------------------------
   EXAM CONTAINER (visible only while exam-active)
   ---------------------------------------------------------------- */
#aimcq-root-scope .cbt-exam-container { display: none; height: 100%; flex-direction: column; }
#aimcq-root-scope .cbt-exam-wrapper.exam-active .cbt-exam-container { display: flex; }

/* ---- Top bar ---- */
#aimcq-root-scope .cbt-top-bar {
    background: var(--cbt-header); color: #fff;
    padding: 10px 20px; display: flex; justify-content: space-between; align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); z-index: 10; height: 60px; flex-shrink: 0;
}
#aimcq-root-scope .cbt-top-bar h2 {
    margin: 0; font-size: 1.2rem; color: #fff !important; line-height: 1.4;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%;
}
#aimcq-root-scope .cbt-timer-container {
    font-size: 1.05rem; font-weight: bold;
    display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
#aimcq-root-scope .cbt-timer {
    background: #fff; color: var(--aq-danger);
    padding: 4px 8px; border-radius: 4px; font-family: monospace; font-size: 1.15rem;
}
/* Last-minute (or deadline-shortened) window: pulse the timer to warn the user. */
#aimcq-root-scope .cbt-timer.cbt-timer-critical {
    background: var(--aq-danger); color: #fff; animation: aimcq-timer-pulse 1s ease-in-out infinite;
}
@keyframes aimcq-timer-pulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }

/* ---- Layout grid ---- */
#aimcq-root-scope .cbt-exam-layout {
    display: flex; flex: 1; overflow: hidden; background: #fff;
    flex-direction: row !important; touch-action: none;
}

/* ---- Left nav palette ----
   The panel is a fixed-layout flex column. Legend, section tabs,
   heading, and the Submit button are pinned (flex-shrink: 0). ONLY
   the question-number grid in the middle scrolls — so users can
   always see the legend at top and the Submit button at bottom
   even when there are many questions. */
#aimcq-root-scope .cbt-nav-panel {
    width: 320px; background: #e2f4ff; flex-shrink: 0;
    display: flex; flex-direction: column; padding: 15px;
    position: static; max-height: none;
    /* Panel itself no longer scrolls — only its question grid does. */
    overflow: hidden;
    touch-action: auto;
}

/* ---- Right questions area ---- */
#aimcq-root-scope .cbt-main-content {
    flex: 1; padding: 20px 40px; overflow-y: auto;
    border-left: 1px solid #ddd; scroll-behavior: smooth;
    position: relative; touch-action: auto; -webkit-overflow-scrolling: touch;
}

/* ---- Mobile nav toggle + overlay ---- */
@keyframes cbtPulseToggle {
    0%   { transform: translateX(-50%) scale(1);    box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
    50%  { transform: translateX(-50%) scale(1.08); box-shadow: 0 4px 20px rgba(0,123,255,0.6); }
    100% { transform: translateX(-50%) scale(1);    box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
}
#aimcq-root-scope .cbt-nav-toggle-btn {
    display: none; position: fixed; bottom: 85px; left: 50%; transform: translateX(-50%);
    z-index: 10002; background-color: var(--aq-primary); color: #fff; border: none;
    border-radius: 50%; width: 55px; height: 55px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3); cursor: pointer;
    justify-content: center; align-items: center; transition: all 0.3s ease;
    animation: cbtPulseToggle 2s infinite;
}
#aimcq-root-scope .cbt-nav-toggle-btn:hover,
#aimcq-root-scope .cbt-nav-toggle-btn:active {
    animation: none; transform: translateX(-50%) scale(1.1);
}
#aimcq-root-scope .cbt-nav-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5); z-index: 10000; opacity: 0;
    transition: opacity 0.3s ease; touch-action: none;
}

/* ---- Palette legend ---- */
#aimcq-root-scope .cbt-legend {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font-size: 0.8rem;
    margin-bottom: 20px; border-bottom: 1px solid #ccc; padding-bottom: 15px; flex-shrink: 0;
}
#aimcq-root-scope .cbt-legend-item { display: flex; align-items: center; gap: 8px; color: #333; }
#aimcq-root-scope .cbt-legend-icon {
    width: 32px; height: 28px; display: flex;
    justify-content: center; align-items: center; font-weight: bold; font-size: 0.85rem;
}
#aimcq-root-scope .cbt-icon-not-visited { background: var(--cbt-not-visited); border: 1px solid #999; color: #333; }
#aimcq-root-scope .cbt-icon-unanswered  { background: var(--cbt-unanswered); color: #fff; border-radius: 12px 12px 2px 2px; }
#aimcq-root-scope .cbt-icon-answered    { background: var(--cbt-answered); color: #fff; border-radius: 12px 12px 2px 2px; }
#aimcq-root-scope .cbt-icon-review      { background: var(--cbt-review); color: #fff; border-radius: 50%; }
#aimcq-root-scope .cbt-icon-answered-review {
    background: var(--cbt-review); color: #fff; border-radius: 50%; position: relative;
}
#aimcq-root-scope .cbt-icon-answered-review::after {
    content: ''; position: absolute; bottom: 1px; right: 1px;
    width: 8px; height: 8px; background: var(--cbt-answered);
    border-radius: 50%; border: 1px solid #fff;
}

/* ---- Section tabs ---- */
#aimcq-root-scope .cbt-section-tabs {
    display: flex; overflow-x: auto; gap: 6px; margin-bottom: 10px;
    padding-bottom: 6px; border-bottom: 1px solid #e2e8f0;
    scrollbar-width: thin; flex-shrink: 0; align-items: center; min-height: 35px;
}
#aimcq-root-scope .cbt-section-tabs::-webkit-scrollbar { height: 4px; }
#aimcq-root-scope .cbt-section-tabs::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
#aimcq-root-scope .cbt-section-tab {
    flex-shrink: 0; background: #fff; border: 1px solid #cbd5e1; border-radius: 16px;
    padding: 4px 12px; font-size: 0.8rem; cursor: pointer; white-space: nowrap;
    font-weight: 600; color: #64748b; transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
#aimcq-root-scope .cbt-section-tab:hover { border-color: #94a3b8; color: #334155; background: #f8fafc; }
#aimcq-root-scope .cbt-section-tab.active {
    background: var(--cbt-header); color: #fff; border-color: var(--cbt-header);
    box-shadow: 0 2px 4px rgba(44,62,80,0.2);
}

#aimcq-root-scope .cbt-nav-panel h4 { margin: 0 0 8px 0; font-size: 0.95rem; color: #333; flex-shrink: 0; }
#aimcq-root-scope .cbt-nav-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
    gap: 8px;
    /* ONLY this section scrolls — the question-number buttons. The
       legend, section tabs, "Questions" heading, and Submit button
       above and below stay pinned in place. flex: 1 takes all
       remaining height in the nav panel; min-height: 0 lets the
       grid actually shrink inside the flex column (otherwise
       min-content prevents shrinking). Padding on every side (not
       just the right, which is for the scrollbar) matters: the
       active button's ring is an outline + box-shadow that paints
       outside its own border box, and without matching padding here
       it gets sliced off flush against this scroll container's edge —
       most visibly on the very first row. */
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    align-content: start;
    padding: 8px 6px 8px 6px;
    margin-bottom: 15px;
    touch-action: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 transparent;
}
#aimcq-root-scope .cbt-nav-grid::-webkit-scrollbar { width: 6px; }
#aimcq-root-scope .cbt-nav-grid::-webkit-scrollbar-track { background: transparent; }
#aimcq-root-scope .cbt-nav-grid::-webkit-scrollbar-thumb {
    background: #94a3b8; border-radius: 3px;
}
#aimcq-root-scope .cbt-nav-grid::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* ---- Palette buttons ---- */
#aimcq-root-scope .cbt-q-btn {
    width: 45px; height: 40px; border: none; cursor: pointer; font-weight: bold;
    display: flex; justify-content: center; align-items: center; padding: 0; font-size: 0.95rem;
}
#aimcq-root-scope .cbt-q-btn.q-not-visited { background: var(--cbt-not-visited); color: #333; border: 1px solid #999; }
#aimcq-root-scope .cbt-q-btn.q-unanswered  { background: var(--cbt-unanswered); color: #fff; border-radius: 15px 15px 3px 3px; }
#aimcq-root-scope .cbt-q-btn.q-answered    { background: var(--cbt-answered); color: #fff; border-radius: 15px 15px 3px 3px; }
#aimcq-root-scope .cbt-q-btn.q-review      { background: var(--cbt-review); color: #fff; border-radius: 50%; }
#aimcq-root-scope .cbt-q-btn.q-answered-review {
    background: var(--cbt-review); color: #fff; border-radius: 50%; position: relative;
}
#aimcq-root-scope .cbt-q-btn.q-answered-review::after {
    content: ''; position: absolute; bottom: 2px; right: 2px;
    width: 10px; height: 10px; background: var(--cbt-answered);
    border-radius: 50%; border: 1px solid #fff;
}
/* Active/current question — same two-layer treatment as the basic engine's
   .aq-q-btn.q-current: a solid outline that's part of the paint (won't
   blur or partially clip) plus a soft glow for separation from neighbours.
   Both fit inside the padding added to .cbt-nav-grid above. */
#aimcq-root-scope .cbt-q-btn.q-current {
    outline: 3px solid #3498db;
    outline-offset: 2px;
    box-shadow: 0 0 0 5px rgba(52, 152, 219, 0.18);
    transform: scale(1.05);
    position: relative;
    z-index: 2;
}

/* ---- Bottom action bar ---- */
#aimcq-root-scope .cbt-bottom-bar {
    background: #f8f9fa; padding: 15px 20px;
    display: flex; justify-content: space-between; align-items: center;
    border-top: 1px solid #ddd; height: 70px; flex-shrink: 0; z-index: 10; touch-action: none;
}
#aimcq-root-scope .cbt-bottom-left,
#aimcq-root-scope .cbt-bottom-right { display: flex; gap: 10px; }
#aimcq-root-scope .cbt-action-btn {
    padding: 10px 20px; font-weight: bold; cursor: pointer; border-radius: 4px;
    border: 1px solid transparent; font-size: 0.95rem; transition: background 0.2s;
    display: inline-flex; align-items: center; justify-content: center; text-align: center; gap: 5px;
}
#aimcq-root-scope .cbt-btn-review { background: #f39c12; color: #fff; border-color: #d68910; }
#aimcq-root-scope .cbt-btn-review:hover { background: #d68910; }
#aimcq-root-scope .cbt-btn-clear { background: #fff; border-color: #bdc3c7; color: #333; }
#aimcq-root-scope .cbt-btn-clear:hover { background: #ecf0f1; }
#aimcq-root-scope .cbt-btn-save { background: var(--cbt-answered); color: #fff; border-color: #1e8449; }
#aimcq-root-scope .cbt-btn-save:hover { background: #1e8449; }
#aimcq-root-scope .cbt-btn-check { background: #3498db; color: #fff; border-color: #2980b9; }
#aimcq-root-scope .cbt-btn-check:hover { background: #2980b9; }

#aimcq-root-scope .cbt-btn-submit-nav {
    background: #3498db; color: #fff; padding: 12px; font-size: 1.1rem; width: 100%;
    border: none; border-radius: 4px; cursor: pointer; margin-top: auto;
    font-weight: bold; flex-shrink: 0;
}
#aimcq-root-scope .cbt-btn-submit-nav:hover { background: #2980b9; }

/* ---- Passage display ---- */
#aimcq-root-scope .cbt-passage-display {
    background-color: var(--aq-light); border: 1px solid var(--aq-border);
    border-radius: 8px; padding: 1.5rem; margin-bottom: 2rem;
    max-height: 250px; overflow-y: auto; box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}
#aimcq-root-scope .cbt-passage-display h3 {
    margin-top: 0; font-size: 1.5rem; color: var(--aq-dark);
    border-bottom: 1px solid var(--aq-border); padding-bottom: 0.75rem; margin-bottom: 1rem;
}

/* ---- Question styling ---- */
#aimcq-root-scope .cbt-question { margin-bottom: 2rem; animation: cbtFadeIn 0.3s ease; }
#aimcq-root-scope .cbt-question.hidden { display: none; }
#aimcq-root-scope .cbt-question-header {
    display: flex; align-items: center; margin-bottom: 1.5rem; gap: 1rem;
    flex-wrap: wrap; border-bottom: 1px solid #eee; padding-bottom: 10px;
}
#aimcq-root-scope .cbt-question-number { font-weight: bold; color: #333; font-size: 1.3rem; }
#aimcq-root-scope .cbt-passage-indicator {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 0.78rem; font-weight: 600; color: var(--aq-primary);
    background: var(--aq-info-light); padding: 3px 8px; border-radius: 12px;
}
#aimcq-root-scope .cbt-lang-switcher { margin-left: auto; display: flex; gap: 5px; }
#aimcq-root-scope .cbt-lang-switcher button {
    background: #bdc3c7; border: none; padding: 4px 10px; cursor: pointer;
    border-radius: 4px; font-size: 0.85rem; font-weight: bold; color: #333;
}
#aimcq-root-scope .cbt-lang-switcher button.active { background-color: var(--aq-primary); color: #fff; }
#aimcq-root-scope .cbt-question-body {
    font-size: 1.25rem; line-height: 1.6; color: var(--aq-dark); margin-bottom: 1.5rem;
}

/* ---- Options ---- */
#aimcq-root-scope .cbt-options ul {
    list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.75rem;
}
#aimcq-root-scope .cbt-options li { margin: 0; padding: 0; }
#aimcq-root-scope .cbt-options li::before,
#aimcq-root-scope .cbt-options li::after { display: none; content: none; }
#aimcq-root-scope .cbt-options label {
    display: flex; flex-direction: row; align-items: center;
    padding: 12px 15px; border: 1px solid var(--aq-border); border-radius: 4px;
    cursor: pointer; background: #fafafa; transition: all 0.2s;
}
#aimcq-root-scope .cbt-options label:hover { background: #f0f0f0; }
#aimcq-root-scope .cbt-options input { display: none; }
#aimcq-root-scope .cbt-opt-inner { display: flex; align-items: center; width: 100%; gap: 15px; }
#aimcq-root-scope .cbt-opt-letter {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; background-color: #e9ecef; border-radius: 4px;
    font-weight: bold; color: #495057; flex-shrink: 0; font-size: 0.95rem;
}
#aimcq-root-scope .cbt-options label.selected .cbt-opt-letter {
    background-color: var(--aq-primary); color: #fff;
}
#aimcq-root-scope .cbt-options label.correct .cbt-opt-letter { background-color: var(--aq-success); color: #fff; }
#aimcq-root-scope .cbt-options label.incorrect .cbt-opt-letter { background-color: var(--aq-danger); color: #fff; }
#aimcq-root-scope .cbt-opt-text { flex: 1; word-break: break-word; line-height: 1.5; }
#aimcq-root-scope .cbt-opt-text p { margin: 0; }
#aimcq-root-scope .cbt-options label.selected { border-color: var(--aq-primary); background-color: #f0f7ff; }
#aimcq-root-scope .cbt-options label.correct {
    border-color: var(--aq-success) !important; background-color: var(--aq-success-light) !important;
}
#aimcq-root-scope .cbt-options label.incorrect {
    border-color: var(--aq-danger) !important; background-color: var(--aq-danger-light) !important;
}
#aimcq-root-scope .cbt-options label.missed { border: 2px dashed var(--aq-success) !important; }
/* 5th "not attempted" option marked by the candidate: neutral, never red. */
#aimcq-root-scope .cbt-options label.na-marked { border-color: #94a3b8 !important; background-color: #f1f5f9 !important; }
#aimcq-root-scope .cbt-options label.na-marked .cbt-opt-letter { background-color: #64748b; color: #fff; }
#aimcq-root-scope .cbt-options label.disabled { cursor: not-allowed; }
#aimcq-root-scope .cbt-opt-img { max-width: 100%; border-radius: 4px; flex-shrink: 0; }

/* ---- Explanation ---- */
#aimcq-root-scope .cbt-explanation {
    margin-top: 1.5rem; padding: 1.25rem; background-color: var(--aq-info-light);
    border-left: 5px solid var(--aq-info); border-radius: 4px; font-size: 1rem;
}

/* ---- Results screen ---- */
#aimcq-root-scope .cbt-results {
    text-align: center; padding: 3rem 2rem; border-radius: 12px; margin-bottom: 2rem;
}
#aimcq-root-scope .cbt-results.pass { background-color: var(--aq-success-light); }
#aimcq-root-scope .cbt-results.fail { background-color: var(--aq-danger-light); }
#aimcq-root-scope .cbt-results-title { margin-bottom: 1.5rem; font-size: 2.2rem; color: var(--aq-dark); }
#aimcq-root-scope .cbt-results-table {
    width: 100%; max-width: 450px; margin: 0 auto; border-collapse: collapse;
    background: var(--aq-white); border-radius: 8px; border-style: hidden;
    box-shadow: 0 0 0 1px var(--aq-border), 0 4px 12px rgba(0,0,0,0.05);
}
#aimcq-root-scope .cbt-results-table th,
#aimcq-root-scope .cbt-results-table td {
    padding: 14px 20px; border-bottom: 1px solid var(--aq-border);
    font-size: 1.1rem; color: var(--aq-dark);
}
#aimcq-root-scope .cbt-results-table th { text-align: left; font-weight: 500; color: var(--aq-secondary-dark); }
#aimcq-root-scope .cbt-results-table td { text-align: right; font-weight: bold; }
#aimcq-root-scope .cbt-results-table tr:last-child th,
#aimcq-root-scope .cbt-results-table tr:last-child td { border-bottom: none; }
#aimcq-root-scope .cbt-results-table .cbt-highlight-row { background-color: var(--aq-light); }

/* ---- Sectional breakdown ---- */
#aimcq-root-scope .cbt-breakdown {
    max-width: 560px; margin: 1.75rem auto 0; text-align: left;
    background: var(--aq-white); border: 1px solid var(--aq-border);
    border-radius: 8px; padding: 1.25rem 1.5rem;
}
#aimcq-root-scope .cbt-breakdown h4 {
    margin: 0 0 1rem; font-size: 1.1rem; color: var(--aq-dark);
}
#aimcq-root-scope .cbt-breakdown-row {
    display: grid; grid-template-columns: 1.4fr 0.6fr 1.4fr 0.5fr;
    align-items: center; gap: 10px; padding: 8px 0;
    border-top: 1px solid var(--aq-border);
}
#aimcq-root-scope .cbt-breakdown-row:first-of-type { border-top: none; }
#aimcq-root-scope .cbt-breakdown-name { font-weight: 600; font-size: 0.95rem; color: var(--aq-dark); }
#aimcq-root-scope .cbt-breakdown-stats { font-size: 0.9rem; color: var(--aq-secondary-dark); }
#aimcq-root-scope .cbt-breakdown-bar {
    background: #e9ecef; border-radius: 6px; height: 10px; overflow: hidden;
}
#aimcq-root-scope .cbt-breakdown-bar span { display: block; height: 100%; border-radius: 6px; }
#aimcq-root-scope .cbt-breakdown-pct { font-weight: 700; font-size: 0.9rem; text-align: right; }

/* ---- Modal ---- */
#aimcq-root-scope .cbt-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.6); display: none; justify-content: center; align-items: center;
    z-index: 2147483601; animation: cbtFadeIn 0.3s; touch-action: none;
}
#aimcq-root-scope .cbt-modal-dialog {
    background: var(--aq-white); padding: 2rem; border-radius: 8px; text-align: center;
    box-shadow: var(--aq-shadow); width: 90%; max-width: 450px;
}
#aimcq-root-scope .cbt-modal-title { font-size: 1.5em; margin-top: 0; margin-bottom: 1rem; color: #333; }
#aimcq-root-scope .cbt-modal-body { margin-bottom: 1.5rem; font-size: 1.1rem; color: var(--aq-secondary); }
#aimcq-root-scope .cbt-modal-buttons button {
    margin: 0 0.5rem; padding: 0.75rem 1.5rem; border-radius: 4px;
    border: none; cursor: pointer; font-weight: bold;
}
#aimcq-root-scope .cbt-modal-confirm { background-color: #3498db; color: #fff; }
#aimcq-root-scope .cbt-modal-cancel { background-color: #e9ecef; color: var(--aq-dark); }

@keyframes cbtFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---- Print protection ---- */
@media print {
    #aimcq-root-scope .cbt-exam-wrapper,
    html.aimcq-cbt-fullscreen,
    body.aimcq-cbt-fullscreen { display: none !important; }
}

/* ----------------------------------------------------------------
   RESPONSIVE
   ---------------------------------------------------------------- */
@media (max-width: 991px) {
    #aimcq-root-scope .cbt-exam-wrapper.exam-active .cbt-exam-layout { flex-direction: row !important; }
    #aimcq-root-scope .cbt-nav-panel {
        position: fixed !important; top: 0; left: -320px !important;
        width: 300px !important; height: 100% !important; z-index: 10001;
        border-radius: 0; box-shadow: 0 0 20px rgba(0,0,0,0.2);
        transition: left 0.35s cubic-bezier(0.25,0.8,0.25,1);
        /* Keep the panel itself non-scrolling on mobile too — only the
           question-number grid scrolls (rule above). The drawer is
           already height: 100% of the visible viewport. */
        overflow: hidden;
        max-height: 100% !important;
    }
    #aimcq-root-scope .cbt-exam-wrapper.nav-panel-open .cbt-nav-panel { left: 0 !important; }
    #aimcq-root-scope .cbt-exam-wrapper.nav-panel-open .cbt-nav-overlay { display: block; opacity: 1; }
    #aimcq-root-scope .cbt-main-content { padding: 15px; border-left: none; }

    #aimcq-root-scope .cbt-nav-toggle-btn { display: flex; bottom: calc(85px + env(safe-area-inset-bottom)); }
    #aimcq-root-scope .cbt-bottom-bar {
        padding: 10px; height: auto; min-height: 70px; flex-direction: column; gap: 8px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom)); overflow-x: hidden;
    }
    #aimcq-root-scope .cbt-bottom-left,
    #aimcq-root-scope .cbt-bottom-right {
        width: 100%; justify-content: space-between; display: flex; gap: 8px;
    }
    #aimcq-root-scope .cbt-action-btn {
        flex: 1; padding: 10px 5px; font-size: 0.85rem; line-height: 1.2;
        white-space: normal; height: auto;
    }
    #aimcq-root-scope .cbt-start-screen { border-radius: 10px; margin: 0 2px; }
    #aimcq-root-scope .cbt-start-header { padding: 16px 18px; }
    #aimcq-root-scope .cbt-start-header h2 { font-size: 1.25rem; }
    #aimcq-root-scope .cbt-start-subtitle { font-size: 0.82rem; }
    #aimcq-root-scope .cbt-content-area { padding: 16px; }
    #aimcq-root-scope .cbt-exam-summary { grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 12px; }
    #aimcq-root-scope .cbt-summary-item { font-size: 0.85rem; padding: 8px 10px; }
    #aimcq-root-scope .cbt-instructions-box { max-height: 44vh; padding: 14px 16px; }
    #aimcq-root-scope .cbt-instructions-box h3 { font-size: 1.02rem; }
    #aimcq-root-scope .cbt-palette-demo { grid-template-columns: 1fr; padding: 10px 12px; }
    #aimcq-root-scope .cbt-lang-select-container { justify-content: space-between; }
    #aimcq-root-scope .cbt-lang-select { flex: 1; }
    #aimcq-root-scope .cbt-declaration { padding: 12px 14px; }
    #aimcq-root-scope .cbt-action-bar { padding-top: 16px; }
    #aimcq-root-scope .cbt-start-btn { width: 100%; padding: 14px 20px; }
}

@media (max-width: 480px) {
    #aimcq-root-scope .cbt-content-area { padding: 12px; }
    #aimcq-root-scope .cbt-exam-summary { grid-template-columns: 1fr 1fr; }
    #aimcq-root-scope .cbt-instructions-box ol > li,
    #aimcq-root-scope .cbt-instructions-box p { font-size: 0.88rem; }
}

@media (max-width: 480px) {
    #aimcq-root-scope .cbt-top-bar { padding: 8px 12px; height: 55px; }
    #aimcq-root-scope .cbt-top-bar h2 { font-size: 1.1rem; max-width: 55%; }
    #aimcq-root-scope .cbt-timer-container { font-size: 0.95rem; }
    #aimcq-root-scope .cbt-timer { font-size: 1.05rem; padding: 3px 6px; }
    #aimcq-root-scope .cbt-action-btn { font-size: 0.8rem; padding: 10px 4px; }
    #aimcq-root-scope .cbt-nav-toggle-btn {
        bottom: calc(95px + env(safe-area-inset-bottom)); width: 50px; height: 50px;
    }
    #aimcq-root-scope .cbt-results { padding: 1.5rem 1rem; }
    #aimcq-root-scope .cbt-results-title { font-size: 1.6rem; margin-bottom: 1rem; }
    #aimcq-root-scope .cbt-results-table th,
    #aimcq-root-scope .cbt-results-table td { padding: 10px 15px; font-size: 1rem; }
    #aimcq-root-scope .cbt-modal-dialog { padding: 1.5rem; width: 85%; }
    #aimcq-root-scope .cbt-modal-buttons { display: flex; flex-direction: column; gap: 12px; }
    #aimcq-root-scope .cbt-modal-buttons button { margin: 0; width: 100%; padding: 12px; font-size: 1.05rem; }
    #aimcq-root-scope .cbt-breakdown-row {
        grid-template-columns: 1fr 0.5fr; grid-row-gap: 4px;
    }
    #aimcq-root-scope .cbt-breakdown-bar { grid-column: 1 / -1; }
}

/* ============================================================================
   Carbon copy / response sheet (test-series finish screen)
   ========================================================================== */
.aq-cc-sub{color:var(--aq-muted,#64748b);margin:6px 0 14px;line-height:1.55;font-size:.95rem}
.aq-cc-actions{margin:0 0 18px}
.aq-cc-dl{cursor:pointer}
.aq-cc-sheet{display:flex;flex-direction:column;gap:14px;text-align:left}
.aq-cc-item{background:#fff;border:1px solid var(--aq-border,#e2e8f0);border-radius:14px;padding:18px 20px;
    box-shadow:0 1px 2px rgba(15,23,42,.04),0 6px 20px rgba(15,23,42,.05)}
.aq-cc-q{font-weight:600;line-height:1.55;margin-bottom:12px;color:var(--aq-dark,#1e293b);font-size:.98rem}
.aq-cc-q img{max-width:100%;height:auto;border-radius:8px}
.aq-cc-n{display:inline-block;background:rgba(79,70,229,.10);color:var(--aq-primary,#4f46e5);font-weight:800;
    font-size:.78rem;padding:3px 11px;border-radius:999px;margin-right:8px;vertical-align:middle;
    letter-spacing:.02em;white-space:nowrap}
.aq-cc-opts{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px}
.aq-cc-opt{display:flex;align-items:center;gap:10px;padding:10px 12px;
    border:1.5px solid var(--aq-border,#e2e8f0);border-radius:10px;font-size:.93rem;background:#fff}
.aq-cc-key{display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;min-width:26px;
    border-radius:50%;background:var(--aq-light,#f1f5f9);border:1px solid var(--aq-border,#e2e8f0);
    color:#475569;font-weight:700;font-size:.82rem;line-height:1}
.aq-cc-otext{flex:1;line-height:1.5;min-height:26px;display:flex;flex-direction:column;justify-content:center}
.aq-cc-otext img{max-width:100%;height:auto;border-radius:6px}
.aq-cc-opt.marked{border-color:var(--aq-primary,#4f46e5);background:rgba(79,70,229,.08)}
.aq-cc-opt.marked .aq-cc-key{background:var(--aq-primary,#4f46e5);border-color:var(--aq-primary,#4f46e5);color:#fff}
.aq-cc-tick{align-self:center;margin-left:6px;white-space:nowrap;color:var(--aq-primary,#4f46e5);font-weight:700;
    font-size:.66rem;text-transform:uppercase;letter-spacing:.05em;padding:3px 9px;border-radius:999px;
    background:rgba(79,70,229,.10)}
.aq-cc-na{display:inline-block;margin-top:10px;color:#b45309;background:#fef3c7;border:1px solid #fde68a;
    font-size:.7rem;font-weight:700;text-transform:uppercase;letter-spacing:.05em;padding:3px 10px;border-radius:999px}

/* ---- Lists inside carbon-copy question statements & option text ----
   The engine's global reset strips list styles inside #aimcq-root-scope,
   so restore them here exactly like .aq-explanation does. */
#aimcq-root-scope .aq-cc-q ul li::before,
#aimcq-root-scope .aq-cc-q ul li::after,
#aimcq-root-scope .aq-cc-q ol li::before,
#aimcq-root-scope .aq-cc-q ol li::after,
#aimcq-root-scope .aq-cc-otext ul li::before,
#aimcq-root-scope .aq-cc-otext ul li::after,
#aimcq-root-scope .aq-cc-otext ol li::before,
#aimcq-root-scope .aq-cc-otext ol li::after {
    content: none !important;
    display: none !important;
}
#aimcq-root-scope .aq-cc-q ul,
#aimcq-root-scope .aq-cc-otext ul {
    list-style: disc !important;
    list-style-type: disc !important;
    padding-left: 1.35rem !important;
    margin: 0.5rem 0 0.75rem !important;
}
#aimcq-root-scope .aq-cc-q ol,
#aimcq-root-scope .aq-cc-otext ol {
    list-style: decimal !important;
    list-style-type: decimal !important;
    padding-left: 1.35rem !important;
    margin: 0.5rem 0 0.75rem !important;
}
#aimcq-root-scope .aq-cc-q ul li,
#aimcq-root-scope .aq-cc-q ol li,
#aimcq-root-scope .aq-cc-otext ul li,
#aimcq-root-scope .aq-cc-otext ol li {
    display: list-item !important;
    list-style: inherit !important;
    list-style-type: inherit !important;
    padding-left: 0.25rem !important;
    margin: 0 0 0.35em !important;
    font-weight: 400;
    line-height: 1.6;
}
#aimcq-root-scope .aq-cc-q p { margin: 0 0 0.6em; }
#aimcq-root-scope .aq-cc-q p:last-child { margin-bottom: 0; }

/* ---- Tables (match-the-column etc.) inside carbon-copy content ----
   Same treatment as .aq-q-body / .aq-explanation tables. */
#aimcq-root-scope .aq-cc-q table,
#aimcq-root-scope .aq-cc-otext table,
.aq-cc-q table,
.aq-cc-otext table {
    display: table !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
    border-spacing: 0 !important;
    border: 1px solid var(--aq-border, #e2e8f0) !important;
    margin: 0.6rem 0 0.9rem !important;
    padding: 0 !important;
    font-size: 0.9rem !important;
    line-height: 1.55 !important;
    background: #fff !important;
    color: var(--aq-dark, #334155) !important;
    float: none !important;
    position: static !important;
    box-sizing: border-box !important;
}
#aimcq-root-scope .aq-cc-q col,
#aimcq-root-scope .aq-cc-otext col,
.aq-cc-q col,
.aq-cc-otext col { width: auto !important; }
#aimcq-root-scope .aq-cc-q th,
#aimcq-root-scope .aq-cc-q td,
#aimcq-root-scope .aq-cc-otext th,
#aimcq-root-scope .aq-cc-otext td,
.aq-cc-q th, .aq-cc-q td,
.aq-cc-otext th, .aq-cc-otext td {
    border: 1px solid var(--aq-border, #e2e8f0) !important;
    padding: 9px 12px !important;
    text-align: left !important;
    vertical-align: top !important;
    font-size: 0.9rem !important;
    font-weight: 400 !important;
    line-height: 1.55 !important;
    color: var(--aq-dark, #334155) !important;
    background: transparent !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
}
#aimcq-root-scope .aq-cc-q th,
#aimcq-root-scope .aq-cc-otext th,
.aq-cc-q th, .aq-cc-otext th {
    background: var(--aq-light, #f8fafc) !important;
    font-weight: 700 !important;
    vertical-align: middle !important;
}
#aimcq-root-scope .aq-cc-q tbody tr:nth-child(even) td,
.aq-cc-q tbody tr:nth-child(even) td { background: rgba(0, 0, 0, 0.02) !important; }
#aimcq-root-scope .aq-cc-q thead, #aimcq-root-scope .aq-cc-q tbody,
#aimcq-root-scope .aq-cc-q tfoot, #aimcq-root-scope .aq-cc-q tr,
#aimcq-root-scope .aq-cc-otext thead, #aimcq-root-scope .aq-cc-otext tbody,
#aimcq-root-scope .aq-cc-otext tfoot, #aimcq-root-scope .aq-cc-otext tr,
.aq-cc-q thead, .aq-cc-q tbody, .aq-cc-q tfoot, .aq-cc-q tr,
.aq-cc-otext thead, .aq-cc-otext tbody, .aq-cc-otext tfoot, .aq-cc-otext tr {
    background: transparent !important;
    height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
}
@media (max-width: 600px) {
    #aimcq-root-scope .aq-cc-q table,
    #aimcq-root-scope .aq-cc-otext table,
    .aq-cc-q table,
    .aq-cc-otext table {
        display: block !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
}


/* ============================================================================
   v14.6 — Test-series carbon copy: match the EXACT padding/margins of the
   leaderboard "View response" sheet. CSS-only, no markup/JS change.

   Reference geometry (leaderboard view, aimcq-auth.css):
     .aimcq-fe-runner-body  max-width:1000px; margin:0 auto; padding:18px  (12px ≤640)
       #aimcq-response-print
         .aimcq-fe-rsheet-head  card  padding:16px 20px; margin-bottom:12px
         .aimcq-fe-rsheet-note  box   padding:10px 14px; margin:12px 0 16px
         .aq-cc-sheet           gap:14px
           .aq-cc-item          padding:18px 20px
             .aq-cc-opts        gap:8px
               .aq-cc-opt       padding:10px 12px

   The in-CBT carbon copy lives in .cbt-main-content (padding:20px 40px, no
   max-width) → .cbt-results. We reproduce the runner-body geometry ON
   .cbt-results and rebuild the header card + note box so both screens have
   identical spacing. Scoped to :has(.aq-cc-sheet) so only the carbon copy is
   touched; score/revision/normal result screens are unchanged.
   ========================================================================== */

/* Outer wrapper: mirror .aimcq-fe-runner-body (centered 1000px, 18px pad) and
   neutralise .cbt-main-content's asymmetric 20px/40px padding just for this
   screen so the left/right spacing matches the leaderboard exactly. */
#aimcq-root-scope .cbt-main-content:has(.aq-cc-sheet) { padding: 0 !important; }
#aimcq-root-scope .cbt-results:has(.aq-cc-sheet),
#aimcq-root-scope .cbt-results.pass:has(.aq-cc-sheet) {
    background: #f6f7fb;
    text-align: left;
    max-width: 1000px;
    margin: 0 auto;
    padding: 18px;
    border-radius: 0;
}

/* Header card = .aimcq-fe-rsheet-head : padding 16px 20px, margin-bottom 12px.
   Title + note-as-meta live inside one card. We build the card on the title
   and let the sub sit as its meta line, matching the leaderboard header. */
#aimcq-root-scope .cbt-results:has(.aq-cc-sheet) .cbt-results-title {
    background: #fff;
    border: 1px solid #e7eaf1;
    border-radius: 14px;
    margin: 0 0 12px;
    padding: 16px 20px;
    font-size: 1.3rem;
    letter-spacing: -.01em;
    color: #0f172a;
    text-align: left;
    box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 6px 20px rgba(15,23,42,.05);
}

/* Note line = .aimcq-fe-rsheet-note : dashed box, padding 10px 14px,
   margin 12px 0 16px. */
#aimcq-root-scope .cbt-results:has(.aq-cc-sheet) .aq-cc-sub {
    color: #64748b;
    font-size: .85rem;
    font-weight: 600;
    line-height: 1.55;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    margin: 12px 0 16px;
    padding: 10px 14px;
    text-align: left;
}

/* Download button row: the leaderboard keeps the button inside the header on
   the right; here it follows the note. Give it the same 0/margin the sheet
   expects so there's no extra gap before the first card. */
#aimcq-root-scope .cbt-results:has(.aq-cc-sheet) .aq-cc-actions {
    margin: 0 0 16px;
    padding: 0;
    text-align: left;
}
#aimcq-root-scope .cbt-results:has(.aq-cc-sheet) .aq-cc-dl {
    background: #4f46e5;
    color: #fff;
    border: 0;
    border-radius: 9px;
    padding: 10px 18px;
    font-size: .92rem;
    font-weight: 700;
    width: auto;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
#aimcq-root-scope .cbt-results:has(.aq-cc-sheet) .aq-cc-dl:hover { background: #4338ca; }

/* Sheet + cards + options: identical spacing tokens to the leaderboard. */
#aimcq-root-scope .cbt-results:has(.aq-cc-sheet) .aq-cc-sheet { gap: 14px; }
#aimcq-root-scope .cbt-results:has(.aq-cc-sheet) .aq-cc-item {
    padding: 18px 20px;
    border-color: #e7eaf1;
    box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 6px 20px rgba(15,23,42,.05);
}
#aimcq-root-scope .cbt-results:has(.aq-cc-sheet) .aq-cc-q     { margin-bottom: 12px; font-size: .98rem; }
#aimcq-root-scope .cbt-results:has(.aq-cc-sheet) .aq-cc-n     { background: #eef2ff; color: #4f46e5; padding: 3px 11px; margin-right: 8px; }
#aimcq-root-scope .cbt-results:has(.aq-cc-sheet) .aq-cc-opts  { gap: 8px; }
#aimcq-root-scope .cbt-results:has(.aq-cc-sheet) .aq-cc-opt   { padding: 10px 12px !important; border-color: #e7eaf1; background: #fff; }
#aimcq-root-scope .cbt-results:has(.aq-cc-sheet) .aq-cc-key   { width: 26px; height: 26px; min-width: 26px; background: #f1f5f9; border-color: #e2e8f0; color: #475569; }
#aimcq-root-scope .cbt-results:has(.aq-cc-sheet) .aq-cc-otext { color: #334155; min-height: 26px; display: flex; flex-direction: column; justify-content: center; }
#aimcq-root-scope .cbt-results:has(.aq-cc-sheet) .aq-cc-opt.marked { border-color: #4f46e5; background: #eef2ff; }
#aimcq-root-scope .cbt-results:has(.aq-cc-sheet) .aq-cc-opt.marked .aq-cc-key { background: #4f46e5; border-color: #4f46e5; color: #fff; }
#aimcq-root-scope .cbt-results:has(.aq-cc-sheet) .aq-cc-tick  { margin-left: 6px; padding: 3px 9px; background: #eef2ff; color: #4f46e5; }
#aimcq-root-scope .cbt-results:has(.aq-cc-sheet) .aq-cc-na    { margin-top: 10px; padding: 3px 10px; }

/* Mobile: match .aimcq-fe-runner-body's 12px padding at ≤640px. */
@media (max-width: 640px) {
    #aimcq-root-scope .cbt-results:has(.aq-cc-sheet),
    #aimcq-root-scope .cbt-results.pass:has(.aq-cc-sheet) { padding: 12px; }
    #aimcq-root-scope .cbt-results:has(.aq-cc-sheet) .cbt-results-title { font-size: 1.15rem; padding: 14px 16px; }
    #aimcq-root-scope .cbt-results:has(.aq-cc-sheet) .aq-cc-dl { width: 100%; }
}
