/* ==============================================================
   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-right leaves room for the scrollbar so buttons don't get
       clipped. */
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    align-content: start;
    padding-right: 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: all 0.2s ease;
    border: 1px 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);
}
#aimcq-root-scope .aq-q-btn.q-current {
    box-shadow: 0 0 0 3px var(--aq-primary);
    border-color: var(--aq-primary);
    transform: scale(1.08);
    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; }
#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.
   ------------------------------------------------------------------------------------------------ */

/* TABLE ELEMENT — override every common inline property */
#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;
    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: 1rem !important;
    line-height: 1.6 !important;
    background: transparent !important;
    color: var(--aq-dark) !important;
    float: none !important;
    position: static !important;
    table-layout: auto !important;
    box-sizing: border-box !important;
}

/* COLGROUP / COL — strip any fixed widths */
#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 */
#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: 80px !important;
    max-width: none !important;
    white-space: normal !important;
    word-break: normal !important;
    word-wrap: normal !important;
    overflow-wrap: normal !important;
    hyphens: none !important;
}

/* First two columns (label/status columns) — never break short words */
#aimcq-root-scope .aq-q-body th:first-child,
#aimcq-root-scope .aq-q-body td:first-child,
#aimcq-root-scope .aq-q-body th:nth-child(2),
#aimcq-root-scope .aq-q-body td:nth-child(2),
#aimcq-root-scope .aq-explanation th:first-child,
#aimcq-root-scope .aq-explanation td:first-child,
#aimcq-root-scope .aq-explanation th:nth-child(2),
#aimcq-root-scope .aq-explanation td:nth-child(2),
#aimcq-root-scope .cbt-question-body th:first-child,
#aimcq-root-scope .cbt-question-body td:first-child,
#aimcq-root-scope .cbt-question-body th:nth-child(2),
#aimcq-root-scope .cbt-question-body td:nth-child(2),
#aimcq-root-scope .cbt-explanation th:first-child,
#aimcq-root-scope .cbt-explanation td:first-child,
#aimcq-root-scope .cbt-explanation th:nth-child(2),
#aimcq-root-scope .cbt-explanation td:nth-child(2) {
    white-space: nowrap !important;
    min-width: 90px !important;
    width: 1% !important; /* shrink-wrap to content */
}

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

/* 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 --- */
@media (max-width: 600px) {
    #aimcq-root-scope .aq-btn { padding: 0.6rem 1rem; font-size: 0.88rem; }
    #aimcq-root-scope .aq-header h2 { font-size: 1.2rem; }
    #aimcq-root-scope .aq-main { padding: 0rem!important; }
    #aimcq-root-scope .aq-q-body { font-size: 1.05rem; }
    #aimcq-root-scope .aq-start h2 { font-size: 1.7rem !important; display: block !important; visibility: visible !important; }
    #aimcq-root-scope .aq-start-btn { font-size: 0.95rem; padding: 0.75rem 1.5rem; width: 100%; justify-content: center; }
}
@media (max-width: 480px) {
    #aimcq-root-scope .aq-main, #aimcq-root-scope .aq-start { padding: 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; }
}

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

/* --- LOADING SPINNER --- */
#aimcq-root-scope .aq-loader-spinner {
    width: 48px;
    height: 48px;
    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); } }


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

/* ---- 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: var(--aq-shadow);
    border-radius: 8px;
    border: 1px solid var(--aq-border);
    max-width: 900px; margin: 0 auto;
    overflow: hidden; text-align: left;
}
#aimcq-root-scope .cbt-start-header {
    background: var(--cbt-header); color: #fff;
    padding: 20px 25px; border-bottom: 4px solid var(--aq-primary);
}
#aimcq-root-scope .cbt-start-header h2 { margin: 0; font-size: 1.6rem; color: #fff !important; }
#aimcq-root-scope .cbt-content-area { padding: 25px; }

#aimcq-root-scope .cbt-exam-summary {
    display: flex; flex-wrap: wrap; gap: 15px;
    background: #f1f5f9; padding: 15px 20px; border-radius: 6px;
    margin-bottom: 25px; border-left: 5px solid var(--aq-primary);
}
#aimcq-root-scope .cbt-summary-item { flex: 1; min-width: 120px; font-size: 0.95rem; color: #334155; }
#aimcq-root-scope .cbt-summary-item strong {
    display: block; font-size: 0.85rem; color: #64748b;
    text-transform: uppercase; margin-bottom: 4px; letter-spacing: 0.5px;
}

#aimcq-root-scope .cbt-lang-select-container {
    text-align: right; margin-bottom: 10px; font-size: 0.95rem; color: #334155;
}
#aimcq-root-scope .cbt-lang-select {
    padding: 4px 8px; border: 1px solid #cbd5e1; border-radius: 4px;
    font-size: 0.95rem; font-family: inherit; font-weight: bold; background: #f8fafc;
}

#aimcq-root-scope .cbt-instructions-box {
    border: 1px solid #cbd5e1; border-radius: 6px; padding: 20px;
    max-height: 350px; overflow-y: auto; background: #fff;
    margin-bottom: 20px; box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}
#aimcq-root-scope .cbt-instructions-box h3 {
    margin-top: 0; color: #1e293b; font-size: 1.2rem;
    border-bottom: 1px solid #e2e8f0; padding-bottom: 10px; margin-bottom: 15px;
}
#aimcq-root-scope .cbt-instructions-box h4 { margin-top: 20px; color: #1e293b; font-size: 1.05rem; }
#aimcq-root-scope .cbt-instructions-box p,
#aimcq-root-scope .cbt-instructions-box li {
    color: #475569; line-height: 1.6; font-size: 0.95rem; margin-bottom: 10px;
}
#aimcq-root-scope .cbt-instructions-box ul,
#aimcq-root-scope .cbt-instructions-box ol { padding-left: 20px; }

#aimcq-root-scope .cbt-palette-demo {
    display: inline-flex; flex-wrap: wrap; gap: 15px; margin: 10px 0; padding: 10px;
    background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 4px;
}
#aimcq-root-scope .cbt-demo-item {
    display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: #475569;
}
#aimcq-root-scope .cbt-demo-icon {
    width: 28px; height: 28px; display: inline-flex;
    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: 15px; border-radius: 6px; margin-bottom: 25px;
}
#aimcq-root-scope .cbt-declaration label {
    display: flex; align-items: flex-start; gap: 12px; cursor: pointer;
    color: #334155; font-size: 0.95rem; line-height: 1.5; margin: 0; font-weight: 500;
}
#aimcq-root-scope .cbt-declaration input[type="checkbox"] {
    margin-top: 4px; transform: scale(1.2); cursor: pointer;
}

#aimcq-root-scope .cbt-resume-notice {
    color: #d63638; font-weight: bold; margin-bottom: 15px; font-size: 1.05rem;
}

#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: 12px 30px; font-size: 1.15rem; font-weight: bold; border-radius: 4px;
    cursor: pointer; transition: background 0.2s, transform 0.1s;
    box-shadow: 0 4px 6px rgba(92,184,92,0.2);
}
#aimcq-root-scope .cbt-start-btn:hover:not(:disabled) {
    background: var(--cbt-green-hover); transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(92,184,92,0.3);
}
#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;
}

/* ---- 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-right leaves room
       for the scrollbar so buttons don't get clipped. */
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    align-content: start;
    padding-right: 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;
}
#aimcq-root-scope .cbt-q-btn.q-current {
    outline: 2px solid #3498db; outline-offset: 2px; transform: scale(1.05);
}

/* ---- 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; }
#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-header { padding: 15px; }
    #aimcq-root-scope .cbt-exam-summary { flex-direction: column; gap: 8px; }
}

@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; }
}
