    background: #f1f5f9;
    border: 1.5px solid #e0e7ef;
    color: #2563eb;
    font-weight: 600;
    font-size: 1rem;
    border-radius: 8px;
    padding: 0.55rem 1.1rem;
    cursor: pointer;
    transition: background 0.15s, border 0.15s, color 0.15s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.cbt-review-toggle-answer:hover,
.cbt-review-toggle-answer:focus-visible {
    background: #e0e7ef;
    border-color: #2563eb;
    color: #1e293b;
    outline: none;
}

.cbt-eye-icon {
    width: 1.35em;
    height: 1.35em;
    display: inline-block;
    vertical-align: middle;
    color: inherit;
    stroke-width: 2.2;
}

.cbt-toggle-label {
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* --- Enhanced Professional & Responsive Review/Navigator --- */
/* Review Flex Layout: Responsive two-column, stacks on mobile */
.cbt-review-flex {
    display: flex;
    gap: 2.5rem;
    align-items: flex-start;
    margin-bottom: 2.5rem;
    width: 100%;
}

.cbt-review-left {
    flex: 2 1 0%;
    min-width: 0;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 6px 32px rgba(0, 0, 0, 0.09);
    border: 1.5px solid #e2e8f0;
    padding: 0;
    overflow: hidden;
    max-width: 100%;
}

.cbt-review-right {
    flex: 0 0 320px;
    min-width: 200px;
    max-width: 360px;
    background: #f1f5f9;
    border-radius: 18px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
    border: 1.5px solid #e2e8f0;
    padding: 22px 14px 28px 14px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
}

.cbt-review-navigator {
    width: 100%;
}

.cbt-review-nav-title {
    font-size: 1.13rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 14px;
    text-align: left;
    letter-spacing: 0.01em;
}

.cbt-review-nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(48px, 1fr));
    gap: 12px;
}

.cbt-review-nav-btn {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: #e0e7ef;
    color: #334155;
    font-weight: 700;
    font-size: 1.13rem;
    border: 2.5px solid transparent;
    transition: background 0.18s, border 0.18s, color 0.18s, transform 0.15s;
    cursor: pointer;
    box-shadow: 0 1.5px 3px rgba(0, 0, 0, 0.04);
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

.cbt-review-nav-btn.active,
.cbt-review-nav-btn:focus-visible {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
    transform: scale(1.13);
    z-index: 2;
}

.cbt-review-nav-btn:hover {
    background: #3b82f6;
    color: #fff;
}

/* Responsive: stack columns and navigator on mobile/tablet */
@media (max-width: 900px) {
    .cbt-review-flex {
        flex-direction: column;
        gap: 1.2rem;
    }

    .cbt-review-right {
        max-width: 100%;
        width: 100%;
        min-width: 0;
        margin-top: 0;
        padding: 14px 4px 18px 4px;
        border-radius: 14px;
        box-shadow: 0 1.5px 8px rgba(0, 0, 0, 0.04);
    }
}

@media (max-width: 600px) {
    .cbt-review-nav-grid {
        grid-template-columns: repeat(auto-fit, minmax(38px, 1fr));
        gap: 7px;
    }

    .cbt-review-nav-btn {
        width: 38px;
        height: 38px;
        font-size: 1rem;
        border-radius: 7px;
    }
}

/* Review options: highlight correct, selected, and add icons */
.cbt-review-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.cbt-review-opt {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 18px;
    border-radius: 10px;
    background: #f1f5f9;
    border: 2.5px solid #e2e8f0;
    font-size: 1.07rem;
    font-weight: 500;
    color: #334155;
    position: relative;
    transition: background 0.18s, border 0.18s, color 0.18s;
    min-height: 44px;
    user-select: text;
}

.cbt-review-opt.selected {
    border-color: #06b6d4;
    background: #e0f2fe;
    color: #0369a1;
}

.cbt-review-opt.correct {
    border-color: #22c55e;
    background: #dcfce7;
    color: #166534;
}

.cbt-review-opt.selected.correct {
    border-color: #22c55e;
    background: linear-gradient(90deg, #dcfce7 70%, #e0f2fe 100%);
    color: #166534;
}

.cbt-review-opt-letter {
    display: inline-block;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e0e7ef;
    color: #334155;
    font-weight: 700;
    text-align: center;
    line-height: 32px;
    margin-right: 10px;
    font-size: 1.07rem;
    flex-shrink: 0;
}

.cbt-review-opt.selected .cbt-review-opt-letter {
    background: #06b6d4;
    color: #fff;
}

.cbt-review-opt.correct .cbt-review-opt-letter {
    background: #22c55e;
    color: #fff;
}

.cbt-review-opt.selected.correct .cbt-review-opt-letter {
    background: linear-gradient(90deg, #22c55e 70%, #06b6d4 100%);
    color: #fff;
}

/* Review meta info */
.cbt-review-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 18px 28px;
    margin: 12px 0 0 0;
    font-size: 1.01rem;
    color: #64748b;
}

.cbt-review-meta strong {
    color: #1e293b;
    font-weight: 600;
}

/* Explanation toggle polish */
.cbt-explain-toggle {
    margin-top: 18px;
    border-radius: 10px;
    background: #f1f5f9;
    border: 1.5px solid #e2e8f0;
    overflow: hidden;
}

.cbt-explain-toggle summary {
    cursor: pointer;
    font-weight: 700;
    color: #2563eb;
    padding: 13px 20px;
    background: #e0e7ef;
    border-bottom: 1.5px solid #e2e8f0;
    outline: none;
    font-size: 1.07rem;
    letter-spacing: 0.01em;
}

.cbt-explain-toggle[open] summary {
    border-bottom: 1.5px solid #e2e8f0;
}

.cbt-review-explanation {
    padding: 18px 20px;
    background: #f8fafc;
    border-radius: 0 0 10px 10px;
    border: none;
    font-size: 1.01rem;
    color: #334155;
}

/* Responsive: stack meta and options on mobile */
@media (max-width: 600px) {
    .cbt-review-meta {
        flex-direction: column;
        gap: 8px;
        font-size: 0.97rem;
    }

    .cbt-review-opt {
        font-size: 0.97rem;
        padding: 9px 10px;
        min-height: 36px;
    }

    .cbt-review-opt-letter {
        width: 22px;
        height: 22px;
        line-height: 22px;
        font-size: 0.97rem;
        margin-right: 7px;
    }

    .cbt-review-explanation {
        padding: 12px 10px;
        font-size: 0.93rem;
    }
}

/* --- CBT Review Two-Column Layout & Navigator Polish --- */
.cbt-review-flex {
    display: flex;
    gap: 32px;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.cbt-review-left {
    flex: 2 1 0%;
    min-width: 0;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
    border: 1px solid #e5e7eb;
    padding: 0;
    overflow: hidden;
}

.cbt-review-right {
    flex: 0 0 280px;
    min-width: 220px;
    max-width: 320px;
    background: #f8fafc;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    border: 1px solid #e5e7eb;
    padding: 18px 12px 24px 12px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.cbt-review-navigator {
    width: 100%;
}

.cbt-review-nav-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 12px;
    text-align: left;
}

.cbt-review-nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
    gap: 10px;
}

/* --------------------------------------------
   Answer Review: Item & Content Styling
   Improves spacing, typography and option visuals
--------------------------------------------- */
.cbt-review-item {
    padding: 0;
    margin: 0 0 18px 0;
}

.cbt-review-header {
    padding: 16px 20px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    border-bottom: 1px solid rgba(226, 232, 240, 0.7);
}

.cbt-review-header strong {
    font-size: 1.06rem;
    color: #0f172a;
    font-weight: 700;
}

.cbt-review-header .question-text {
    display: inline;
    font-weight: 600;
    color: #0b1220;
}

.cbt-review-body {
    padding: 18px 20px 22px 20px;
    background: #ffffff;
}

.cbt-review-left .cbt-review-item {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(226, 232, 240, 0.7);
}

/* Options list inside review */
.options-list,
.cbt-review-options {
    list-style: none;
    padding: 0;
    margin: 12px 0 8px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.options-list .option-item,
.cbt-review-opt {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #edf2f7;
    color: #0f172a;
}

.options-list .option-item .option-letter {
    width: 34px;
    height: 34px;
    line-height: 34px;
    border-radius: 8px;
    background: #f1f5f9;
    color: #0f172a;
    font-weight: 700;
    text-align: center;
}

.options-list .option-item.selected {
    background: linear-gradient(90deg, #e6f7ff 0%, #f0f9ff 100%);
    border-color: #bae6fd;
}

.options-list .option-item.correct {
    background: linear-gradient(90deg, #ecfdf5 0%, #f0fff4 100%);
    border-color: #bbf7d0;
}

.options-list .option-item.selected.correct {
    background: linear-gradient(90deg, #dcfce7 0%, #e6f7ff 100%);
    border-color: #86efac;
}

/* Answer block (Your Answer / Correct Answer / Time / Explanation) */
.cbt-review-answer-block {
    margin-top: 12px;
    padding: 14px 16px;
    background: #f8fafc;
    border-left: 4px solid rgba(37, 99, 235, 0.14);
    border-radius: 8px;
    color: #334155;
    display: block;
}

.cbt-review-answer-block span {
    display: block;
    margin: 4px 0;
}

.cbt-review-explanation {
    margin-top: 8px;
    padding: 12px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #eef2f7;
}

/* Small helpers */
.cbt-review-toggle-row {
    margin-top: 10px;
}

.question-text {
    font-size: 1.02rem;
}

@media (max-width: 900px) {
    .cbt-review-body {
        padding: 12px;
    }

    .options-list .option-item {
        padding: 10px;
    }
}

.cbt-review-nav-btn {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: #e0e7ef;
    color: #334155;
    font-weight: 700;
    font-size: 1.1rem;
    border: 2px solid transparent;
    transition: background 0.18s, border 0.18s, color 0.18s, transform 0.15s;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.cbt-review-nav-btn.active,
.cbt-review-nav-btn:focus-visible {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
    transform: scale(1.12);
    z-index: 2;
}

.cbt-review-nav-btn:hover {
    background: #3b82f6;
    color: #fff;
}

.cbt-review-meta strong {
    color: #1e293b;
    font-weight: 600;
}

/* Explanation toggle polish */
.cbt-explain-toggle {
    margin-top: 16px;
    border-radius: 8px;
    background: #f1f5f9;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.cbt-explain-toggle summary {
    cursor: pointer;
    font-weight: 600;
    color: #2563eb;
    padding: 12px 18px;
    background: #e0e7ef;
    border-bottom: 1px solid #e5e7eb;
    outline: none;
    font-size: 1rem;
}

.cbt-explain-toggle[open] summary {
    border-bottom: 1px solid #e5e7eb;
}

.cbt-review-explanation {
    padding: 16px 18px;
    background: #f8fafc;
    border-radius: 0 0 8px 8px;
    border: none;
    font-size: 0.98rem;
    color: #334155;
}

/* Responsive: stack meta and options on mobile */
@media (max-width: 600px) {
    .cbt-review-meta {
        flex-direction: column;
        gap: 8px;
        font-size: 0.93rem;
    }

    .cbt-review-opt {
        font-size: 0.97rem;
        padding: 9px 10px;
    }

    .cbt-review-opt-letter {
        width: 24px;
        height: 24px;
        line-height: 24px;
        font-size: 0.97rem;
    }
}

/* CBT Exam - Professional responsive polish (additive, non-breaking) */
@media (min-width: 992px) {
    .exam-body {
        display: grid;
        grid-template-columns: 1fr 320px;
        gap: 14px;
    }

    .main-content {
        min-width: 0;
    }

    .status-panel {
        min-width: 280px;
    }
}

@media (max-width: 991px) {
    .exam-body {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .status-panel {
        order: 2;
    }
}

/* Navigator tiles: consistent sizing */
.question-navigator .q {
    min-width: 34px;
    min-height: 34px;
    line-height: 1;
}

/* Header micro-tweaks for readability */
.exam-header .title {
    letter-spacing: .2px;
}

.exam-header .timer-display {
    font-weight: 700;
    color: #0f172a;
}

/* Improve touch targets on small screens */
@media (max-width: 640px) {
    .controls .cbt-button {
        padding: 12px 14px;
    }
}

/* --- CBT enhancements: elevated cards, glass effect, explanations --- */
.cbt-w-full {
    width: 100%
}

.cbt-hidden {
    display: none !important
}

/* =========================
   Final Layout Tuning - remove empty space and tighten panels
   Ensures question panel takes maximum width and navigator stays compact
   ========================= */

/* Use full container width and reduce outer padding to avoid empty margins */
.cbt-exam-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding-left: 12px;
    padding-right: 12px;
}

/* Tighten gap and force left panel to take more space */
.exam-body {
    gap: 8px !important;
}

.main-content {
    flex: 3 1 0% !important;
    padding: 12px !important;
}

.status-panel {
    flex: 0 0 300px !important;
    min-width: 260px !important;
    padding: 12px !important;
}

/* Ensure quiz card uses full width of left column (remove earlier centering/max-width) */
.quiz-area {
    max-width: none !important;
    width: 100% !important;
    margin: 0 0 12px 0 !important;
}

/* Remove unnecessary inner whitespace inside question area */
.quiz-area .question-text {
    margin-bottom: 10px !important;
}

.options-list {
    gap: 10px !important;
}

/* Keep navigator compact and aligned to top */
.status-panel {
    align-self: flex-start;
}

.status-grid {
    gap: 8px !important;
}

/* If viewport is narrow, stack navigator below and make it full-width */
@media (max-width: 992px) {
    .exam-body {
        flex-direction: column;
        gap: 12px !important;
    }

    .main-content,
    .status-panel {
        width: 100% !important;
        flex: none !important;
    }

    .status-panel {
        order: 2;
    }
}

/* Ensure Legend is visible around tablet sizes (~891px width) */
@media (max-width: 1024px) {

    /* Show legend fully by giving it priority in vertical space */
    .status-panel {
        position: static !important;
        max-height: none !important;
        overflow: visible !important;
    }

    .question-navigator {
        max-height: 24vh !important;
    }

    .legend {
        display: block !important;
        max-height: none !important;
        overflow: visible !important;
    }

    .legend ul {
        list-style: none;
        padding: 0;
        margin: 0;
        display: block !important;
    }

    .legend li {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
    }

    .legend .legend-label {
        display: flex;
        align-items: center;
        gap: 10px;
        font-weight: 600;
        color: #0f172a;
    }

    .legend .legend-count {
        min-width: 28px;
        height: 24px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 999px;
        background: #eef2ff;
        color: #3730a3;
        font-weight: 700;
    }

    /* Legend responsive layout: switch to two columns on small tablets, single column on phones */
    @media (max-width: 900px) and (min-width: 641px) {
        .legend ul {
            display: grid !important;
            grid-template-columns: 1fr 1fr;
            gap: 10px 16px;
        }

        .legend li {
            justify-content: flex-start;
        }
    }

    @media (max-width: 640px) {
        .legend ul {
            display: block !important;
        }

        .legend li {
            padding: 6px 0;
        }

        .legend .legend-count {
            min-width: 24px;
            height: 22px;
            font-size: .85rem;
        }
    }

    /* Ensure legend never collapses due to parent overflow */
    .status-panel .legend {
        display: block !important;
        overflow: visible !important;
    }
}

/* Strong override: ensure Legend is never hidden by theme overrides */
.status-panel .legend {
    display: block !important;
    visibility: visible !important;
}

.legend {
    display: block !important;
}

/* Do not force legend to scroll at tablet sizes; keep fully expanded */

.is-disabled {
    pointer-events: none;
    opacity: .5
}

.cbt-label-sm {
    font-size: .8rem;
    margin-right: .5rem
}

.cbt-text-muted-sm {
    font-size: .75rem;
    color: #6b7280
}

.cbt-mt-0 {
    margin-top: 0
}

.cbt-mt-12 {
    margin-top: 12px
}

.cbt-mb-30 {
    margin-bottom: 30px
}

.cbt-mt-40 {
    margin-top: 40px
}

.cbt-text-center {
    text-align: center
}

.cbt-text-danger {
    color: var(--cbt-danger)
}

.cbt-min-h-0 {
    min-height: 0 !important
}

.cbt-note-warning {
    font-size: .8rem;
    color: var(--cbt-warning)
}

.cbt-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px
}

.cbt-fieldset {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px
}

.cbt-fieldset legend {
    padding: 0 6px
}

.cbt-ul-sm {
    margin: .5rem 0 0 1rem;
    list-style: disc
}

.cbt-elevated {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
    padding: 1rem;
}

.cbt-glass {
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(8px);
    border-radius: 14px;
}

.cbt-cards-animated .summary-card {
    transition: transform .2s ease, box-shadow .2s ease;
}

.cbt-cards-animated .summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}

/* Advanced summary card variants */
.summary-card.color1 {
    background: linear-gradient(45deg, #000000, #000000);
    color: #fff;
}

.summary-card.color2 {
    background: linear-gradient(45deg, #353030, #15798f);
    color: #fff;
}

.summary-card.color3 {
    background: linear-gradient(45deg, #100202, #c084fc);
    color: #fff;
}

.summary-card.color4 {
    background: linear-gradient(45deg, #000000, #004cff);
    color: #0616f7;
}

.summary-card.color1 .label,
.summary-card.color2 .label,
.summary-card.color3 .label,
.summary-card.color4 .label {
    opacity: .95;
    color: #f0f9ff;
}

/* Explanation content */
.cbt-review-explanation {
    margin-top: .5rem;
    padding: .75rem 1rem;
    background: #f8fafc;
    border: 1px solid #eef2f7;
    border-radius: 10px;
}

.cbt-review-explanation img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

pre.mermaid {
    background: #fff;
    border-radius: 8px;
    padding: 12px;
    overflow: auto;
    border: 1px solid #eef2f7;
}

.quiz-area .cbt-math {
    font-size: 1.05em;
}

/* Dashboard layout with sidebar */
.cbt-dashboard-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

/* Make dashboard full-bleed inside theme containers for better use of space */
.cbt-dashboard-layout {
    padding-left: 16px;
    padding-right: 16px;
    overflow: visible;
}

.entry-content>.cbt-dashboard-layout,
.wp-block-post-content>.cbt-dashboard-layout,
.site-content .cbt-dashboard-layout {
    max-width: none !important;
    width: 100vw !important;
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;
}

/* Sidebar removed: original sidebar rules intentionally trimmed. */

@media (max-width: 960px) {
    .cbt-dashboard-layout {
        grid-template-columns: 1fr;
        position: relative;
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        transform: none;
        padding-left: 12px;
        padding-right: 12px;
    }

    /* Reset container breakout on small screens to prevent horizontal scroll */
    .entry-content>.cbt-dashboard-layout,
    .wp-block-post-content>.cbt-dashboard-layout,
    .site-content .cbt-dashboard-layout {
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

.cbt-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

/* On larger screens present the nav as a horizontal, pill-style row */
@media (min-width:900px) {
    .cbt-nav {
        flex-direction: row;
        align-items: center;
        gap: 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 6px;
        white-space: nowrap;
    }

    .cbt-nav::-webkit-scrollbar {
        height: 8px;
    }

    .cbt-nav::-webkit-scrollbar-thumb {
        background: rgba(15, 23, 42, 0.06);
        border-radius: 10px;
    }

    .cbt-nav-item {
        display: inline-flex;
        vertical-align: middle;
    }
}

.cbt-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    color: var(--cbt-text-muted, #111827);
    text-decoration: none;
    border: 1px solid rgba(14, 165, 233, 0.06);
    background: var(--cbt-surface, #ffffff);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

.cbt-nav-item i {
    display: none;
}

/* Global inline SVG icon sizing */
.cbt-icon {
    width: 18px !important;
    height: 18px !important;
    display: inline-block;
    vertical-align: middle;
    line-height: 1;
    color: currentColor;
    flex-shrink: 0;
}

.cbt-icon path,
.cbt-icon circle,
.cbt-icon rect,
.cbt-icon line,
.cbt-icon polyline {
    stroke: currentColor;
}

.cbt-icon[fill="currentColor"] path {
    stroke-width: 0;
}

/* Contextual tweaks */
.cbt-dashboard-layout .cbt-icon,
.cbt-nav-item .cbt-icon {
    width: 16px !important;
    height: 16px !important;
}

.cbt-nav-item .cbt-icon {
    color: #6b7280;
    background: rgba(15, 23, 42, 0.03);
    padding: 6px;
    border-radius: 8px;
}

.cbt-nav-item:hover .cbt-icon {
    color: var(--cbt-primary);
    background: rgba(21, 137, 235, 0.08);
}

.cbt-nav-item.active .cbt-icon {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
}

.cbt-button .cbt-icon {
    width: 16px !important;
    height: 16px !important;
}

.cbt-chip .cbt-icon {
    width: 14px !important;
    height: 14px !important;
}

/* Guard against themes forcing svg to 100% width or 1em */
svg.cbt-icon {
    width: 16px !important;
    height: 16px !important;
    display: inline-block;
}

.cbt-nav-item:hover {
    transform: translateY(-2px);
    background: var(--cbt-option-hover-bg, #f8fbff);
    border-color: rgba(59, 130, 246, 0.18);
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.04);
}

.cbt-nav-item:hover i {
    color: var(--cbt-primary);
}

.cbt-nav-item.active {
    border-color: rgba(6, 163, 224, 0.98);
    background: #12b0e8;
    /* lighter cyan-blue */
    color: #ffffff;
    box-shadow: 0 10px 30px rgba(18, 176, 232, 0.12);
}

button.cbt-nav-item {
    width: 100%;
    text-align: left;
    cursor: pointer;
}

/* Make sure nav stays single-column on small screens and looks compact on wide screens */
@media (min-width:900px) {
    .cbt-dashboard-nav {
        max-width: 100%;
    }

    /* When horizontal, make each item look like a pill */
    .cbt-nav {
        flex-wrap: nowrap;
    }

    .cbt-nav-item {
        border-radius: 999px;
        padding: 10px 18px;
        min-width: 120px;
        justify-content: flex-start;
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .cbt-nav-item .cbt-icon {
        margin-right: 10px;
    }

    /* Allow buttons to size naturally in horizontal layout */
    button.cbt-nav-item {
        width: auto;
    }
}

/* Force full-width layout on CBT pages even when themes enable a right sidebar */
.cbt-no-theme-sidebar #secondary,
.cbt-no-theme-sidebar .secondary,
.cbt-no-theme-sidebar .sidebar,
.cbt-no-theme-sidebar .widget-area {
    display: none !important;
}

.cbt-no-theme-sidebar #primary,
.cbt-no-theme-sidebar .content-area,
.cbt-no-theme-sidebar .site-content,
.cbt-no-theme-sidebar .container .site-content,
.cbt-no-theme-sidebar .container .content-area {
    width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 100% !important;
}

/* Common theme grids that allocate columns to sidebar */
.cbt-no-theme-sidebar .content-sidebar-wrap,
.cbt-no-theme-sidebar .content-sidebar-layout,
.cbt-no-theme-sidebar .site-main {
    grid-template-columns: 1fr !important;
}

/* Prevent clipping if parents set overflow hidden */
.cbt-no-theme-sidebar .site-content,
.cbt-no-theme-sidebar .content-area {
    overflow: visible !important;
}

/* Lists for tests and previous year */
.cbt-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 10px;
}

.cbt-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid #eef2f7;
    border-radius: 10px;
    background: #fff;
}

.cbt-list-title {
    font-weight: 600;
}

.cbt-nav-item.disabled {
    opacity: .6;
    pointer-events: none;
}

/* Result badges & explanation toggle */
.cbt-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    border-radius: 999px;
    color: #fff;
}

.cbt-badge.success {
    background: #16a34a;
}

.cbt-badge.danger {
    background: #dc2626;
}

.cbt-review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.cbt-answer-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    margin-bottom: 6px;
}

/* Enhanced explanation toggle styling */
.cbt-explain-toggle {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    margin: 15px 0;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);


    /* Modern card-style for quiz questions */
    .quiz-area {
        background: var(--cbt-bg-card, #fff);
        border-radius: 18px;
        box-shadow: 0 10px 30px rgba(2, 6, 23, 0.08);
        padding: 2rem 1.75rem;
        margin-bottom: 2rem;
        max-width: 880px;
        /* allow wider on desktop */
        margin-left: auto;
        margin-right: auto;
        border: 1px solid var(--cbt-border, #e5e7eb);
        outline: 1px solid rgba(99, 102, 241, 0.08);
    }

    .quiz-area .section-title {
        font-size: clamp(1rem, 1.4vw, 1.2rem);
        color: #1d4ed8;
        margin-bottom: 0.75rem;
        font-weight: 700;
        letter-spacing: .2px;
    }

    .quiz-area .question-text {
        font-size: clamp(1.15rem, 2.2vw, 1.45rem);
        font-weight: 700;
        color: #0f172a;
        margin-bottom: 1.25rem;
        line-height: 1.6;
    }

    .options-list {
        list-style: none;
        padding: 0;
        margin: 0;
        display: grid;
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .options-list li {
        background: #f8fafc;
        border: 2px solid #e0e7ef;
        border-radius: 14px;
        padding: 1rem 1.25rem;
        font-size: 1.05rem;
        color: #0f172a;
        cursor: pointer;
        transition: box-shadow .18s, border-color .18s, background .18s, transform .08s;
        box-shadow: 0 2px 8px rgba(2, 6, 23, 0.05);
        position: relative;
    }

    .options-list li.selected,
    .options-list li.active {
        border-color: #2563eb;
        background: #e0f2fe;
        box-shadow: 0 6px 18px rgba(37, 99, 235, 0.12);
        transform: translateY(-1px);
    }

    .options-list li:hover {
        border-color: #2563eb;
        background: #f0f9ff;
        transform: translateY(-1px);
    }

    .options-list li.correct {
        border-color: #16a34a;
        background: #dcfce7;
        box-shadow: 0 4px 14px rgba(22, 163, 74, 0.16);
    }

    .options-list li.incorrect {
        border-color: #dc2626;
        background: #fee2e2;
        box-shadow: 0 4px 14px rgba(220, 38, 38, 0.16);
    }

    @media (max-width: 600px) {
        .quiz-area {
            padding: 1rem 0.75rem;
        }

        .options-list li {
            padding: 0.75rem 0.75rem;
            font-size: 0.98rem;
        }
    }

    /* Tablet layout: 2-column options when space allows */
    @media (min-width: 768px) {
        .options-list {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }
    }

    /* Large screens: comfortable max width and spacing */
    @media (min-width: 1200px) {
        .quiz-area {
            max-width: 980px;
        }

        .options-list {
            gap: 16px;
        }
    }

    /* Respect reduced motion for accessibility */
    @media (prefers-reduced-motion: reduce) {
        .options-list li {
            transition: none;
        }
    }

    transition: all 0.3s ease;
}

.cbt-explain-toggle:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cbt-explain-toggle summary {
    padding: 12px 16px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    cursor: pointer;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cbt-explain-toggle summary:hover {
    background: linear-gradient(135deg, #e785f0 0%, #e54c61 100%);
    transform: translateY(-1px);
}

.cbt-explain-toggle summary::marker {
    color: white;
    font-size: 1.2em;
}

.cbt-explain-toggle[open] summary {
    border-radius: 8px 8px 0 0;
    background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
}

.cbt-explain-toggle[open] summary:hover {
    background: linear-gradient(135deg, #4338ca 0%, #0891b2 100%);
}

.cbt-review-explanation {
    padding: 16px;
    background: #f7fafc;
    border-top: 1px solid #e2e8f0;
    line-height: 1.6;
    color: #2d3748;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cbt-review-explanation p {
    margin: 0 0 12px 0;
}

.cbt-review-explanation p:last-child {
    margin-bottom: 0;
}

.cbt-review-explanation img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin-top: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cbt-review-explanation strong {
    color: #1a202c;
    font-weight: 600;
}

.cbt-review-explanation code {
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.9em;
}

@media (max-width: 960px) {
    .cbt-dashboard-layout {
        grid-template-columns: 1fr;
    }
}

/* Advanced header and sections */
.dashboard-header {
    background: linear-gradient(135deg, #eef2ff 0%, #eff6ff 50%, #f0fdf4 100%);
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.user-details h2 {
    margin: 0 0 4px;
    font-weight: 700;
}

.cbt-section>h3 {
    position: relative;
    padding-left: 10px;
}

.cbt-section>h3:before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 4px;
    height: 22px;
    background: linear-gradient(180deg, #4f46e5, #06b6d4);
    border-radius: 2px;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.chart-container {
    background: #fff;
    border: 1px solid #eef2f7;
    border-radius: 12px;
    padding: 16px;
    position: relative;
    height: 340px;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.chart-container h4 {
    margin: 0 0 12px;
    font-size: 14px;
    color: #111827;
}

/* Ensure canvases scale to container and leave breathing room so axes/labels are visible */
.chart-container canvas {
    width: 100% !important;
    height: auto !important;
    min-height: 220px;
    display: block;
    margin-top: 6px;
    margin-bottom: 6px;
}

@media (max-width: 640px) {
    .chart-container {
        height: 260px;
    }
}

@media (min-width: 1280px) {
    .chart-container {
        height: 380px;
    }
}

/* Review navigator styles */
.cbt-review-navigator {
    padding: 6px 0 0;
}

.cbt-review-nav-title {
    font-weight: 600;
    font-size: 0.95rem;
    padding: 8px 12px;
    border-bottom: 1px solid var(--cbt-border);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.cbt-review-nav-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px 12px;
    max-height: 220px;
    overflow: auto;
    align-content: flex-start;
}

.cbt-review-nav-btn {
    min-width: 38px;
    height: 38px;
    border-radius: 6px;
    background: #f8fafc;
    border: 1px solid #e6edf3;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--cbt-text);
    font-weight: 600;
}

.cbt-review-nav-btn.active {
    background: linear-gradient(90deg, #eef2ff, #f0f9ff);
    border-color: #dbeafe;
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.06);
}

.cbt-review-nav-btn.correct {
    background: #dcfce7;
    border-color: #bbf7d0;
}

.cbt-review-nav-btn.incorrect {
    background: #fee2e2;
    border-color: #fecaca;
}

.cbt-review-nav-grid::-webkit-scrollbar {
    height: 8px;
}

.cbt-review-nav-grid::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.08);
    border-radius: 6px;
}

.cbt-review-nav-grid {
    -webkit-overflow-scrolling: touch;
}

.cbt-review-flex {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.cbt-review-left {
    flex: 1;
}

.cbt-review-right {
    width: 260px;
    max-width: 34%;
}

@media (max-width: 900px) {
    .cbt-review-flex {
        flex-direction: column;
    }

    .cbt-review-right {
        width: 100%;
        max-width: 100%;
    }
}

/* Dashboard: Manage Plan section */
#cbt-section-plan .plan-cta {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding: 14px;
    border: 1px solid var(--cbt-border);
    border-radius: 12px;
    background: var(--cbt-surface);
    margin: 0 0 14px;
}

#cbt-section-plan .plan-cta .cta-text h4 {
    margin: 0 0 4px;
    font-size: 1.05rem;
}

#cbt-section-plan .plan-cta .cta-text p {
    margin: 0;
    color: var(--cbt-muted);
    font-size: .95rem;
}

#cbt-section-plan .plan-cta .cta-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

#cbt-section-plan .cbt-button.accent {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

#cbt-section-plan .cbt-button.ghost {
    background: transparent;
    border-color: var(--cbt-border);
    color: var(--cbt-text);
}

#cbt-section-plan .summary-card {
    background: #eef2ff;
    border-radius: 12px;
}

#cbt-section-plan .summary-card .value {
    color: #08c;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Dashboard: PYQ Sections (Common) */
#cbt-section-pyq-tests .cbt-grid,
#cbt-section-pyq-pdfs .cbt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

#cbt-section-pyq-tests .cbt-cardx,
#cbt-section-pyq-pdfs .cbt-cardx {
    border: 1px solid var(--cbt-border);
    border-radius: 10px;
    background: var(--cbt-surface);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#cbt-section-pyq-tests .cbt-cardx:hover,
#cbt-section-pyq-pdfs .cbt-cardx:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

#cbt-section-pyq-tests .cbt-cardx h5,
#cbt-section-pyq-pdfs .cbt-cardx h5 {
    margin: 0;
    font-size: 1rem;
    color: var(--cbt-text);
    line-height: 1.4;
}

#cbt-section-pyq-tests .cbt-meta,
#cbt-section-pyq-pdfs .cbt-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

#cbt-section-pyq-tests .cbt-actions,
#cbt-section-pyq-pdfs .cbt-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    padding-top: 4px;
}

#cbt-section-pyq-tests .cbt-actions .cbt-button,
#cbt-section-pyq-pdfs .cbt-actions .cbt-button {
    padding: 6px 12px;
    font-size: .85rem;
}

#cbt-section-pyq-tests .cbt-subheading,
#cbt-section-pyq-pdfs .cbt-subheading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin: 12px 0 12px;
}

#cbt-section-pyq-tests .cbt-subheading h4,
#cbt-section-pyq-pdfs .cbt-subheading h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

#cbt-section-pyq-tests .cbt-filter-bar,
#cbt-section-pyq-pdfs .cbt-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin: 0 0 15px;
}

/* Category Navigation Cards */
.ts-cats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.ts-cat-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px;
    background: var(--cbt-surface);
    border: 1px solid var(--cbt-border);
    border-radius: 12px;
    text-decoration: none !important;
    color: inherit !important;
    transition: all 0.2s ease;
}

.ts-cat-card:hover {
    border-color: var(--cbt-primary);
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.06);
}

.ts-cat-icon {
    width: 44px;
    height: 44px;
    background: #eff6ff;
    color: #2563eb;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.ts-cat-card:nth-child(even) .ts-cat-icon {
    background: #f0fdf4;
    color: #16a34a;
}

.ts-cat-info h4 {
    margin: 0 0 4px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--cbt-text);
}

.ts-explore-label {
    font-size: 0.8rem;
    color: var(--cbt-primary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ts-arrow {
    transition: transform 0.2s ease;
}

.ts-cat-card:hover .ts-arrow {
    transform: translateX(3px);
}

/* Item Row Meta Adjustment */
.ts-row-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 6px;
}


/* Dashboard: Reported Questions table */
#cbt-section-reported table {
    width: 100%;
    border-collapse: collapse;
}

#cbt-section-reported th,
#cbt-section-reported td {
    padding: .6rem .7rem;
    text-align: left;
}

#cbt-section-reported thead th {
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
}

#cbt-section-reported tbody tr:nth-child(odd) {
    background: #ffffff;
}

#cbt-section-reported tbody tr:nth-child(even) {
    background: #f9fafb;
}

#cbt-section-reported .col-status {
    white-space: nowrap;
}

#cbt-section-reported .col-comment {
    max-width: 420px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Reported questions enhanced controls */
#cbt-section-reported .cbt-reported-controls input[type="search"] {
    padding: 8px 10px;
    border: 1px solid var(--cbt-border);
    border-radius: 8px;
    background: var(--cbt-bg-card);
    color: var(--cbt-text-dark);
}

#cbt-section-reported .cbt-reported-controls select {
    padding: 8px 10px;
    border: 1px solid var(--cbt-border);
    border-radius: 8px;
    background: var(--cbt-bg-card);
    color: var(--cbt-text-dark);
}

#cbt-section-reported .cbt-reported-controls button[disabled] {
    opacity: .55;
    cursor: not-allowed;
}

#cbt-section-reported #cbt-reported-table th:first-child,
#cbt-section-reported #cbt-reported-table td:first-child {
    width: 34px;
    text-align: center;
}

#cbt-section-reported #cbt-reported-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Pagination styles */
#cbt-section-reported .cbt-pagination ul {
    list-style: none;
    margin: 12px 0 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

#cbt-section-reported .cbt-pagination li {
    margin: 0;
}

#cbt-section-reported .cbt-pagination a.cbt-button.secondary {
    padding: 4px 10px;
    font-size: .8rem;
    line-height: 1.2;
}

#cbt-section-reported .cbt-pagination a.active {
    background: var(--cbt-primary);
    color: #fff;
    border-color: var(--cbt-primary);
}

#cbt-section-reported .cbt-pagination .cbt-button.secondary.disabled {
    opacity: .45;
    cursor: default;
}

#cbt-section-reported .cbt-gap {
    display: inline-block;
    padding: 4px 8px;
    font-size: .8rem;
    color: var(--cbt-text-medium);
}

#cbt-section-reported .cbt-pagination-note {
    margin: 0;
}

/* Dashboard: Gamification calendar */
#cbt-section-gamification .cbt-cal-weekdays {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-right: 6px;
}

#cbt-section-gamification .cbt-cal-weekdays .wd {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 42px;
    height: 42px;
    text-align: left;
    font-weight: 600;
    font-size: .95rem;
    letter-spacing: .02em;
    color: var(--cbt-muted);
}

#cbt-section-gamification .cbt-cal-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#cbt-section-gamification .cbt-cal-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    position: relative;
    border: 1px solid #e5e7eb;
    background: #eef2f6;
}

#cbt-section-gamification .cbt-cal-cell.l0 {
    background: #eef2f6;
}

#cbt-section-gamification .cbt-cal-cell.l1 {
    background: #dcfce7;
}

#cbt-section-gamification .cbt-cal-cell.l2 {
    background: #86efac;
}

#cbt-section-gamification .cbt-cal-cell.l3 {
    background: #22c55e;
}

#cbt-section-gamification .cbt-cal-cell.l4 {
    background: #15803d;
}

#cbt-section-gamification .cbt-cal-cell.l3 .num,
#cbt-section-gamification .cbt-cal-cell.l4 .num {
    color: #ffffff;
}

#cbt-section-gamification .cbt-cal-cell .num {
    font-size: .95rem;
    font-weight: 600;
}

#cbt-section-gamification .cbt-cal-cell.today {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

#cbt-section-gamification .cbt-cal-cell.selected {
    box-shadow: inset 0 0 0 2px #f59e0b;
}

#cbt-section-gamification .cbt-cal-cell:hover {
    filter: brightness(0.98);
}

@media (max-width:640px) {
    #cbt-section-gamification .cbt-cal-weekdays .wd {
        width: 34px;
        height: 34px;
        font-size: .95rem;
    }

    #cbt-section-gamification .cbt-cal-cell {
        width: 34px;
        height: 34px;
    }
}

/* =================================================================== */
/*  CBT EXAM PLATFORM - UNIFIED FRONTEND STYLESHEET V5.7 (Consolidated)
/*  Covers: Dashboard, Profile, Live Exam, Results & Common Elements
/* =================================================================== */

/* --- 1. Global Setup & Design System --- */
:root {
    --cbt-primary: #0ea5e9;
    /* Sky 500 */
    --cbt-success: #16a34a;
    /* Green */
    --cbt-danger: #dc2626;
    /* Red */
    --cbt-warning: #f59e0b;
    /* Amber */
    --cbt-review-answered: #06b6d4;
    /* Cyan 500 */
    --cbt-info: #0284c7;
    /* Sky 600 */
    --cbt-bg-main: #f3f4f6;
    --cbt-bg-card: #ffffff;
    --cbt-text-dark: #1f2937;
    --cbt-text-medium: #4b5563;
    --cbt-text-light: #9ca3af;
    --cbt-border: #d1d5db;
    --cbt-radius: 8px;
    --cbt-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --cbt-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    --transition: all 0.2s ease-in-out;

    /* Derived status colors (use these everywhere for easy theming) */
    --cbt-status-answered: var(--cbt-success);
    --cbt-status-not-answered: #ef4444;
    --cbt-status-review: var(--cbt-warning);
    --cbt-status-answered-review: var(--cbt-review-answered);

    /* Option color tokens for accessibility */
    --cbt-option-border: var(--cbt-border);
    --cbt-option-hover-bg: rgba(14, 165, 233, 0.10);
    /* primary tint */
    --cbt-option-hover-border: var(--cbt-primary);
    --cbt-option-selected-bg: rgba(14, 165, 233, 0.16);
    --cbt-option-selected-border: var(--cbt-primary);

    /* Back-compat alias */
    --white: #ffffff;
    --primary-dark: #1f2937;
    --dark-gray: #4b5563;
    --medium-gray: #d1d5db;
    --radius: var(--cbt-radius);
    --shadow: var(--cbt-shadow);
}

/* THEME VARIANTS: add class on <html> or <body>, e.g., <body class="cbt-theme-ocean"> */
.cbt-theme-ocean {
    --cbt-primary: #0ea5e9;
    /* sky-500 */
    --cbt-info: #0284c7;
    /* sky-600 */
    --cbt-success: #10b981;
    /* emerald-500 */
    --cbt-danger: #ef4444;
    /* red-500 */
    --cbt-warning: #f59e0b;
    /* amber-500 */
    --cbt-review-answered: #06b6d4;
    /* cyan-500 */
    --cbt-bg-main: #f0f9ff;
    /* sky-50 */
}

.cbt-theme-sunset {
    --cbt-primary: #f97316;
    /* orange-500 */
    --cbt-info: #ea580c;
    /* orange-600 */
    --cbt-success: #22c55e;
    /* green-500 */
    --cbt-danger: #dc2626;
    /* red-600 */
    --cbt-warning: #f59e0b;
    /* amber-500 */
    --cbt-review-answered: #f43f5e;
    /* rose-500 */
    --cbt-bg-main: #fff7ed;
    /* orange-50 */
}

.cbt-theme-emerald {
    --cbt-primary: #059669;
    /* emerald-600 */
    --cbt-info: #047857;
    /* emerald-700 */
    --cbt-success: #10b981;
    /* emerald-500 */
    --cbt-danger: #ef4444;
    /* red-500 */
    --cbt-warning: #eab308;
    /* yellow-500 */
    --cbt-review-answered: #22d3ee;
    /* cyan-400 */
    --cbt-bg-main: #ecfdf5;
    /* emerald-50 */
}

.cbt-button {
    display: inline-block;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border-radius: var(--cbt-radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    background-color: var(--cbt-primary);
    color: white;
}

.cbt-button:hover {
    background-color: var(--cbt-info);
    transform: translateY(-2px);
    box-shadow: var(--cbt-shadow);
}

.cbt-button.secondary {
    background-color: var(--cbt-bg-card);
    color: var(--cbt-text-medium);
    border-color: var(--cbt-border);
}

.cbt-button.secondary:hover {
    background-color: #e5e7eb;
}

.cbt-button.danger {
    background-color: var(--cbt-danger);
}

.cbt-button.danger:hover {
    background-color: #b91c1c;
}

/* Utility: inline layout for icon + label */
.cbt-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Ads removed */


/* --- 2. User Dashboard --- */
.cbt-dashboard {
    max-width: 100%;
    margin: 0 auto;
    padding: 1.25rem;
}

.entry-content .cbt-dashboard,
.wp-block-post-content .cbt-dashboard {
    max-width: none !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Force full-width content inside dashboard, overriding theme containers */
.cbt-dashboard>* {
    max-width: none !important;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
}

.cbt-dashboard .cbt-section,
.cbt-dashboard .dashboard-header {
    width: 100%;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    background: var(--cbt-bg-card);
    padding: 20px;
    border-radius: var(--cbt-radius);
    border: 1px solid #e5e7eb;
}

.dashboard-header .user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.dashboard-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
}

.dashboard-header .user-details h2 {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0 0 5px 0;
}

.dashboard-header .user-details p {
    margin: 0;
    color: #6b7280;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* button hover already defined above; keep one source of truth */

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.history-header h3,
.cbt-section h3 {
    font-size: 1.5rem;
    margin-top: 0;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--cbt-border);
}

.history-header h3 {
    margin-bottom: 0;
    /* Override for flex container */
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
}

.summary-card {
    padding: 1.5rem;
    border-radius: var(--cbt-radius);
    text-align: center;
    background-color: #eef2ff;
}

.summary-card .value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--cbt-primary);
}

.summary-card .label {
    font-size: 1rem;
    color: var(--cbt-text-medium);
    margin-top: 0.5rem;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.chart-container {
    position: relative;
    height: 340px;
    padding: 14px;
    overflow: visible;
}

.chart-container h4 {
    text-align: center;
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--cbt-text-medium);
}

.history-table-wrapper {
    overflow-x: auto;
}

.history-table-wrapper table {
    width: 100%;
    border-collapse: collapse;
}

.history-table-wrapper th,
.history-table-wrapper td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--cbt-border);
}

.history-table-wrapper th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--cbt-text-medium);
}

.history-table-wrapper tbody tr {
    transition: background-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.history-table-wrapper tbody tr:hover {
    background-color: #fcfdff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

.checkbox-col {
    width: 20px;
    text-align: center;
}

/* Section card look for tabs */
.cbt-section.cbt-tab {
    background: var(--cbt-bg-card);
    border: 1px solid #e5e7eb;
    border-radius: var(--cbt-radius);
    padding: 16px;
}


/* --- 3. Live Exam Interface (polished) --- */
.guest-prompt .cbt-guest-top-links,
.guest-prompt .cbt-guest-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Top link buttons: Login / Register (ghost) and Attempt as Guest (primary) */
.cbt-guest-top-links .cbt-link,
.cbt-guest-top-links .cbt-attempt-guest {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1;
    transition: transform 160ms var(--transition), box-shadow 160ms var(--transition), background 160ms var(--transition);
}

/* Ghost style for Login / Register */
.cbt-guest-top-links .cbt-link {
    background: transparent;
    color: var(--cbt-text-medium);
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: none;
}

.cbt-guest-top-links .cbt-link:hover,
.cbt-guest-top-links .cbt-link:focus {
    transform: translateY(-2px);
    color: var(--cbt-text-dark);
    background: rgba(14, 165, 233, 0.04);
    outline: none;
}

/* Primary gradient CTA for Attempt as Guest to make it distinct */
.cbt-guest-top-links .cbt-attempt-guest {
    background: linear-gradient(90deg, var(--cbt-primary), var(--cbt-info));
    color: #ffffff;
    border: 0;
    box-shadow: 0 10px 30px rgba(14, 165, 233, 0.12);
}

.cbt-guest-top-links .cbt-attempt-guest:hover,
.cbt-guest-top-links .cbt-attempt-guest:focus {
    transform: translateY(-2px);
    box-shadow: 0 12px 36px rgba(14, 165, 233, 0.16);
}

/* Instruction card (logged-in users) */
.instruction-screen {
    background: var(--cbt-bg-card);
    border: 1px solid var(--cbt-border);
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 8px 20px rgba(16, 24, 40, 0.04);
    margin-top: 12px;
}

.instruction-screen .instruction-title {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 1.1rem;
    background-color: peru;
}

.instruction-screen .instruction-summary {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    color: var(--cbt-text-medium);
}

.instruction-screen .instruction-summary p {
    margin: 0;
}

/* Summary item cards for Total Questions / Duration */
.instruction-summary .summary-item {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: linear-gradient(180deg, #fff, #fbfdff);
    border: 1px solid rgba(15, 23, 42, 0.04);
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(11, 22, 40, 0.04);
    min-width: 160px;
}

.instruction-summary .summary-item .summary-label {
    font-size: 0.95rem;
    color: var(--cbt-text-medium);
    font-weight: 600;
}

.instruction-summary .summary-item .summary-value {
    font-size: 1.05rem;
    color: var(--cbt-text-dark);
    font-weight: 700;
}

.instruction-summary .summary-item .summary-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(14, 165, 233, 0.08);
    color: var(--cbt-info);
    font-weight: 700;
    flex-shrink: 0;
}

.instruction-summary .summary-item .summary-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.instruction-screen .instruction-rules ul {
    margin: 8px 0 12px 1rem;
    color: var(--cbt-text-medium);
}

.instruction-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.instruction-actions .cbt-button {
    min-width: 160px;
}

.cbt-instruction-note {
    margin: 0;
    font-size: 0.95rem;
    color: var(--cbt-text-medium);
}

/* Ensure good focus visibility for keyboard users */
.cbt-guest-top-links .cbt-link:focus,
.cbt-guest-top-links .cbt-attempt-guest:focus,
.cbt-button:focus {
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.12);
    outline: none;
}

/* Hide textual separators (we use spacing instead) */
.guest-prompt .cbt-sep {
    display: none !important;
}

/* Responsive: stack vertically on narrow viewports */
@media (max-width: 640px) {

    .guest-prompt .cbt-guest-top-links,
    .guest-prompt .cbt-guest-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .cbt-guest-top-links .cbt-link,
    .cbt-guest-top-links .cbt-attempt-guest {
        width: 100%;
    }

    .instruction-screen {
        padding: 14px;
    }
}

/* --- Instruction rules: polished list styles --- */
.instruction-rules ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 10px;
}

.instruction-rules li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(250, 250, 252, 0.95));
    border: 1px solid rgba(15, 23, 42, 0.04);
    padding: 12px 14px;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(11, 22, 40, 0.04);
    color: var(--cbt-text-medium);
}

.instruction-rules li::before {
    content: '✔';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--cbt-primary);
    color: #fff;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 2px;
}

.instruction-rules li strong {
    color: var(--cbt-text-dark);
}

.instruction-rules li p {
    margin: 0;
}

@media (max-width: 520px) {
    .instruction-rules li {
        padding: 10px 12px;
    }

    .instruction-rules li::before {
        width: 28px;
        height: 28px;
        font-size: 0.85rem;
    }
}

@media (max-width: 640px) {
    .instruction-summary .summary-item {
        width: 100%;
    }
}


.cbt-exam-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Exam pages: prevent accidental horizontal scroll (mobile + WebView) */
.cbt-exam-page {
    overflow-x: clip;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

@supports not (overflow-x: clip) {
    .cbt-exam-page {
        overflow-x: hidden;
    }
}

/* Tap targets: keep primary exam buttons comfortably clickable */
.cbt-exam-page .controls button,
.cbt-exam-page .status-panel-actions .cbt-button,
.cbt-exam-page #submitBtn {
    min-height: 44px;
    touch-action: manipulation;
}

.hidden {
    display: none;
}

/* Pause state visual treatment */
body.exam-paused .exam-header {
    opacity: .55;
}

/* ------------------------------------------------------------------ */
/* Guest Notice (shown for anonymous users after exam start)          */
/* Professional, compact, accessible styling. Placed inside exam wrap. */
.cbt-guest-notice {
    position: sticky;
    top: 12px;
    z-index: 11060;
    /* above modal overlays used elsewhere */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    margin: 0 0 14px 0;
    border-radius: 10px;
    background: linear-gradient(90deg, rgba(14, 165, 233, 0.12), rgba(6, 182, 212, 0.06));
    border: 1px solid rgba(14, 165, 233, 0.18);
    box-shadow: 0 6px 18px rgba(6, 16, 37, 0.06);
    color: var(--cbt-text-dark);
    font-size: 0.95rem;
}

.cbt-guest-notice-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.cbt-guest-notice-message {
    flex: 1 1 auto;
    color: var(--cbt-text-dark);
    line-height: 1.2;
}

.cbt-guest-notice-message a {
    color: var(--cbt-primary);
    font-weight: 600;
    text-decoration: underline;
    margin-left: 6px;
}

.cbt-guest-notice-message a:hover {
    color: #075985;
}

.cbt-guest-notice-dismiss {
    flex: 0 0 auto;
    background: #ffffff;
    color: var(--cbt-primary);
    border: 0;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(16, 24, 40, 0.06);
}

.cbt-guest-notice-dismiss:hover {
    transform: translateY(-1px);
}

@media (max-width: 640px) {
    .cbt-guest-notice {
        padding: 10px 12px;
        font-size: 0.9rem;
        border-radius: 8px;
    }

    .cbt-guest-notice-dismiss {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
}

/* End guest notice styles */
body.exam-paused .quiz-area {
    opacity: .35;
}

body.exam-paused .status-panel {
    opacity: .4;
}

body.exam-paused .controls {
    opacity: .4;
}

body.exam-paused .exam-header-right button#pauseBtn {
    opacity: 1;
}

body.exam-paused .exam-header-right button#pauseBtn i {
    color: var(--cbt-danger);
}

/* Ensure modal sits above blurred content */
body.exam-paused #pauseModal.cbt-modal {
    display: flex;
    opacity: 1;
}

body.exam-paused .cbt-modal-content {
    animation: none;
}

/* Pause modal refinement */
#pauseModal .cbt-modal-content {
    text-align: center;
}

#pauseModal h3 {
    margin-top: 0;
}

#pauseModal p {
    color: var(--cbt-text-medium);
}

#pauseModal .cbt-modal-actions {
    gap: 12px;
}

/* 3.1 - Start Screen Styles */
.start-screen {
    max-width: 700px;
    margin: 50px auto;
    padding: 40px 50px;
    background-color: var(--cbt-bg-card);
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.start-screen #examTitle {
    font-size: 2.25rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 20px;
}

.start-screen .start-summary {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
    color: #6b7280;
    font-size: 1rem;
}

.start-screen .start-summary p {
    margin: 0;
}

.start-screen .start-summary strong {
    color: #4b5563;
}

.start-screen .start-instructions {
    margin: 30px 0;
    padding-top: 30px;
    border-top: 1px solid #f3f4f6;
}

.start-screen .start-instructions h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 15px;
}

.start-screen #quizInstructions {
    color: #4b5563;
    line-height: 1.6;
}

.start-screen #quizInstructions p:last-child {
    margin-bottom: 0;
}

.start-screen .start-actions {
    margin-top: 30px;
}

.cbt-start-btn {
    font-size: 1.2rem;
    padding: 1rem 2rem;
    background-color: var(--cbt-success);
    color: white;
    border: none;
    cursor: pointer;
    border-radius: var(--cbt-radius);
}

.cbt-start-btn:hover {
    background-color: #15803d;
}

.start-user-greeting {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.start-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.guest-prompt {
    text-align: center;
}

.guest-prompt p {
    font-size: 1.1em;
    color: #4b5563;
    margin-bottom: 20px;
}

.auth-links {
    margin-top: 15px;
}

.auth-links.full-width {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* 3.2 - Main Exam View */
.exam-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    padding: 1.25rem 2rem;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 50%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.12);
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.exam-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--cbt-primary) 0%, var(--cbt-info) 50%, var(--cbt-success) 100%);
}

.exam-header-left,
.exam-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
    z-index: 1;
}

.timer-display {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--cbt-primary);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
    padding: 0.75rem 1.25rem;
    border-radius: 10px;
    border: 1px solid rgba(59, 130, 246, 0.2);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
    transition: all 0.3s ease;
}

.timer-display:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.timer-display.warning {
    color: var(--cbt-danger);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
    border-color: rgba(239, 68, 68, 0.2);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
    animation: pulse 1.5s infinite;
}

.q-timer {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--cbt-info);
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.08) 0%, rgba(2, 132, 199, 0.04) 100%);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid rgba(2, 132, 199, 0.15);
    font-size: 0.9rem;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(2, 132, 199, 0.1);
}

.exam-tool-btn {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    color: var(--cbt-text-dark);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
    text-decoration: none;
}

/* Fullscreen toggle: icon-only control in header (left of Pause) */
.cbt-exam-page .exam-header-right #fullscreenBtn.cbt-fs-toggle {
    width: clamp(2.75rem, 7vw, 3.25rem);
    height: clamp(2.75rem, 7vw, 3.25rem);
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    gap: 0;
    justify-content: center;
}

.cbt-exam-page .exam-header-right #fullscreenBtn.cbt-fs-toggle .cbt-ico {
    font-size: clamp(1.15rem, 4.5vw, 1.5rem);
    line-height: 1;
}

@media (max-width: 520px) {
    .cbt-exam-page .exam-header-right #fullscreenBtn.cbt-fs-toggle {
        width: clamp(3rem, 10vw, 3.75rem);
        height: clamp(3rem, 10vw, 3.75rem);
        border-radius: 0.85rem;
    }
}

.exam-tool-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s ease;
}

.exam-tool-btn:hover::before {
    left: 100%;
}

.exam-tool-btn:hover {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-color: var(--cbt-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
    color: var(--cbt-primary);
}

.exam-tool-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.exam-tool-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.25);
}

#examUserProfile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(59, 130, 246, 0.02) 100%);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    border: 1px solid rgba(59, 130, 246, 0.1);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.08);
    transition: all 0.3s ease;
}

#examUserProfile:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(59, 130, 246, 0.04) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.12);
}

#examUserAvatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

#examUserName {
    font-weight: 600;
    color: var(--cbt-text-dark);
    font-size: 0.9rem;
    white-space: nowrap;
}

.exam-body {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.main-content {
    grid-column: 1 / -1;
}

.quiz-area {
    padding: 2rem;
    background: var(--cbt-bg-card);
    border-radius: var(--cbt-radius);
    box-shadow: var(--cbt-shadow);
    transition: opacity 0.3s ease;
}

.quiz-area {
    border: 1px solid #e5e7eb;
}

.quiz-area.fade-out {
    opacity: 0;
}

.section-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--cbt-primary);
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.question-text {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

#questionImageContainer {
    margin-bottom: 1.5rem;
    text-align: center;
}

#questionImageContainer img {
    max-width: 100%;
    height: auto;
    border-radius: var(--cbt-radius);
    box-shadow: var(--cbt-shadow);
}

.options-list {
    list-style: none;
    padding: 0;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 2px solid var(--cbt-option-border);
    border-radius: var(--cbt-radius);
    margin-bottom: 1rem;
    cursor: pointer;
    transition: var(--transition);
    background: #fff;
}

.option-item:hover {
    border-color: var(--cbt-option-hover-border);
    background: var(--cbt-option-hover-bg);
}

.option-item.selected {
    border-color: var(--cbt-option-selected-border);
    background: var(--cbt-option-selected-bg);
    font-weight: 600;
}

.option-item:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.25);
}

.option-item:focus-within {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.25);
}

.option-item input {
    display: none;
}

.option-letter {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--cbt-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.option-item.selected .option-letter {
    background: var(--cbt-primary);
    color: white;
}

.nat-input {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    border: 2px solid var(--cbt-border);
    border-radius: var(--cbt-radius);
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.controls button {
    padding: 0.8rem 1.25rem;
    border: 1px solid var(--cbt-border);
    background: #fff;
    color: var(--cbt-text-dark);
    cursor: pointer;
    border-radius: 10px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: var(--transition);
}

.controls button:hover {
    background: #f8fafc;
    border-color: var(--cbt-primary);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
}

.controls button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.25);
}

.controls button.btn-clear {
    background: #ffffff;
    border-color: var(--cbt-border);
    color: var(--cbt-text-dark);
}

.controls button.btn-clear:hover {
    background: #f3f4f6;
}

.controls button.btn-mark {
    background: var(--cbt-warning);
    border-color: var(--cbt-warning);
    color: #fff;
}

.controls button.btn-mark:hover {
    background: #d97706;
}

.controls button.btn-save {
    background: var(--cbt-primary);
    border-color: var(--cbt-primary);
    color: #fff;
}

.controls button.btn-save:hover {
    background: var(--cbt-info);
}

.controls button.submit-final {
    background: var(--cbt-success);
    color: white;
    border-color: var(--cbt-success);
}

.controls button:hover {
    background-color: #f3f4f6;
}

.controls button.submit-final:hover {
    background-color: #15803d;
}

/* Accessibility helper */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    border: 0;
}

/* Inline spinner replacement for submit button */
.cbt-inline-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 3px solid rgba(14, 165, 233, 0.35);
    border-top-color: var(--cbt-primary);
    border-radius: 50%;
    animation: cbtSpin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

@keyframes cbtSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Sticky mobile action bar for controls */
@media (max-width: 640px) {
    .controls {
        /* WebView-safe: avoid position:fixed (can be broken in mobile WebViews).
           Use sticky so controls stay accessible without overlay bugs. */
        position: sticky;
        bottom: 0;
        background: var(--cbt-bg-card);
        border-top: 1px solid var(--cbt-border);
        padding: .65rem .85rem calc(.85rem + env(safe-area-inset-bottom, 0px));
        box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.12);
        z-index: 999;
        gap: .5rem;
        justify-content: space-between;
    }

    .controls button {
        flex: 1 1 auto;
        min-width: 0;
        justify-content: center;
        min-height: 44px;
    }

    .cbt-exam-container {
        /* Extra breathing room above theme footer + iOS safe area */
        padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    }
}

/* --- CBT Exam Layout: Question Navigator as right sidebar --- */
.exam-body {
    position: relative;
    display: flex;
    flex-direction: row;
}

.main-content {
    flex: 1 1 auto;
    margin-right: 340px;
}

.status-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 320px;
    height: 100%;
    background: var(--cbt-bg-card);
    border-radius: 14px 0 0 14px;
    box-shadow: -2px 0 24px rgba(0, 0, 0, 0.07);
    padding: 24px 16px;
    overflow-y: auto;
    z-index: 10;
    min-width: 280px;
    display: flex;
    flex-direction: column;
}

@media (max-width: 900px) {
    .status-panel {
        position: static;
        width: 100%;
        max-width: 100%;
        border-radius: 14px;
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
        margin: 24px 0 0 0;
        height: auto;
        z-index: 1;
    }

    .main-content {
        margin-right: 0;
    }

    .exam-body {
        flex-direction: column;
    }
}

/* 3.3 - Status Panel, Navigator & Legend (New Professional Style) */
.status-panel {
    padding: 24px;
    background: var(--cbt-bg-card);
    border-radius: var(--cbt-radius);
    box-shadow: var(--cbt-shadow);
    align-self: flex-start;
    flex: 0 0 300px;
    min-width: 280px;
    /* Make panel sticky and constrain height so the navigator inside can scroll */
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 24px - 12px);
    max-height: calc(100dvh - 24px - 12px);
    /* viewport minus padding and offset */
    display: flex;
    flex-direction: column;
    overflow: visible;
    /* allow legend to fully render without clipping */
}

.status-panel h4 {
    font-size: 1.2em;
    color: var(--primary-dark);
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--medium-gray);
}

.question-navigator {
    display: flex;
    /* flex grid of buttons */
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    overflow: auto;
    /* enable scrolling for many questions */
    flex: 1 1 auto;
    /* take available space in the panel */
    padding-right: 4px;
    /* room for scrollbar */
    min-height: 80px;
    /* keep some height even for short quizzes */
}

/* Thin scrollbar styling for navigator */
.question-navigator::-webkit-scrollbar {
    width: 8px;
}

.question-navigator::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 6px;
}

.question-navigator::-webkit-scrollbar-track {
    background: #f1f5f9;
}

@supports (scrollbar-color: auto) {
    .question-navigator {
        scrollbar-width: thin;
        scrollbar-color: #94a3b8 #e5e7eb;
    }
}

.q-btn {
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    font-weight: 700;
    color: var(--white);
    cursor: pointer;
    font-size: 1em;
    transition: var(--transition);
    border: 2px solid transparent;
}

.q-btn:hover {
    transform: scale(1.1);
}

.q-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--cbt-primary);
}

.q-btn.not-answered {
    background-color: var(--cbt-status-not-answered);
}

.q-btn.answered {
    background-color: var(--cbt-status-answered);
}

.q-btn.review {
    background-color: var(--cbt-status-review);
}

.q-btn.answered-review {
    background-color: var(--cbt-status-answered-review);
}

.q-btn.not-visited {
    background-color: var(--white);
    color: var(--dark-gray);
    border: 1px solid var(--medium-gray);
}

.q-btn.current {
    box-shadow: 0 0 0 3px var(--white), 0 0 0 5px var(--cbt-primary);
    transform: scale(1.15);
    z-index: 2;
}

.legend ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.legend li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    font-size: 0.9em;
    font-weight: 500;
}

.legend {
    display: block;
}

.legend .legend-label {
    display: flex;
    align-items: center;
    gap: 12px;
}

.legend .status-box {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    flex-shrink: 0;
}

.legend .status-box.answered {
    background-color: var(--cbt-status-answered) !important;
}

.legend .status-box.not-answered {
    background-color: var(--cbt-status-not-answered) !important;
}

.legend .status-box.review {
    background-color: var(--cbt-status-review) !important;
}

.legend .status-box.answered-review {
    background-color: var(--cbt-status-answered-review) !important;
}

.legend .status-box.not-visited {
    background-color: var(--white) !important;
    border: 1px solid var(--medium-gray) !important;
}

.legend .legend-count {
    background-color: #eef2ff;
    color: #4338ca;
    font-weight: bold;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
}

/* 3.4 - Modals */
.cbt-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.cbt-modal.active {
    display: flex;
}

.cbt-modal-content {
    background: white;
    padding: 2rem;
    border-radius: var(--cbt-radius);
    text-align: left;
    max-width: 560px;
    width: calc(100% - 2rem);
}

.cbt-modal-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Guest instruction overlay/modal - ensure it appears above theme footer */
.cbt-guest-instruction-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    z-index: 11050;
}

.cbt-guest-instruction-modal {
    width: 92%;
    max-width: 720px;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.cbt-guest-top-links {
    text-align: left;
    margin-bottom: 8px;
}

.cbt-guest-top-links a {
    color: var(--cbt-primary);
    text-decoration: underline;
    font-weight: 600;
}

.cbt-guest-instruction-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.cbt-guest-cta .cbt-button.primary {
    padding: 10px 18px;
}

/* Professional Review & Submit Modal Styling */
#submitModal .cbt-modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 65%);
    border: 1px solid #e2e8f0;
    box-shadow: 0 12px 34px -8px rgba(0, 0, 0, 0.18);
}

#submitModal h3 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

#submitModal h3:before {
    content: "\f058";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    color: var(--cbt-primary);
}

#submitModal .cbt-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 14px;
    margin: 10px 0 18px;
}

#submitModal .pv-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 10px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

#submitModal .pv-item:before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(140deg, rgba(14, 165, 233, 0.08), rgba(14, 165, 233, 0));
    opacity: 0;
    transition: .3s;
}

#submitModal .pv-item:hover:before {
    opacity: 1;
}

#submitModal .pv-label {
    display: block;
    font-size: .70rem;
    font-weight: 600;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: #475569;
    margin-bottom: 6px;
}

#submitModal .pv-value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    min-width: 46px;
    height: 46px;
    border-radius: 12px;
    background: #eef2ff;
    color: var(--cbt-primary);
    box-shadow: inset 0 0 0 2px #e2e8f0;
}

#submitModal .pv-item:nth-child(1) .pv-value {
    background: #dcfce7;
    color: #15803d;
}

#submitModal .pv-item:nth-child(2) .pv-value {
    background: #fee2e2;
    color: #b91c1c;
}

#submitModal .pv-item:nth-child(3) .pv-value {
    background: #fef9c3;
    color: #b45309;
}

#submitModal .pv-item:nth-child(4) .pv-value {
    background: #cffafe;
    color: #0e7490;
}

#submitModal .pv-item:nth-child(5) .pv-value {
    background: #f1f5f9;
    color: #64748b;
}

#submitModal .pv-note {
    font-size: .85rem;
    color: #475569;
    background: #f1f5f9;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    margin: 0 0 12px;
}

#submitModal .cbt-modal-actions {
    justify-content: space-between;
}

#submitModal #confirmSubmitBtn {
    background: var(--cbt-success);
    border: 1px solid var(--cbt-success);
}

#submitModal #confirmSubmitBtn:hover {
    background: #15803d;
}

#submitModal #cancelSubmitBtn {
    background: #ffffff;
    color: #1f2937;
    border: 1px solid #e2e8f0;
}

#submitModal #cancelSubmitBtn:hover {
    background: #f1f5f9;
}

@media (max-width:520px) {
    #submitModal .cbt-preview-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    #submitModal .pv-value {
        font-size: 1.2rem;
        height: 42px;
        min-width: 42px;
    }
}

/* Fullscreen button label styling */
.exam-header-right #fullscreenBtn .fs-label {
    font-size: .65rem;
    font-weight: 600;
    display: inline-block;
    margin-left: 4px;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: #64748b;
}

/* --- 4. User Profile Page --- */
.cbt-profile-container {
    max-width: 700px;
    margin: 40px auto;
    padding: 30px 40px;
    background-color: var(--cbt-bg-card);
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

.cbt-profile-container h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--cbt-text-dark);
    margin-top: 0;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f3f4f6;
}

#cbt-edit-profile-form .cbt-form-row {
    margin-bottom: 25px;
}

#cbt-edit-profile-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #374151;
}

#cbt-edit-profile-form input[type="text"],
#cbt-edit-profile-form input[type="email"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--cbt-border);
    border-radius: 6px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#cbt-edit-profile-form input[type="text"]:focus,
#cbt-edit-profile-form input[type="email"]:focus {
    border-color: var(--cbt-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    outline: none;
}

#cbt-edit-profile-form input:disabled {
    background: #f3f4f6;
    cursor: not-allowed;
    color: var(--cbt-text-medium);
}

#cbt-edit-profile-form .description {
    font-size: 0.9em;
    color: var(--cbt-text-medium);
    margin-top: 6px;
}

.profile-pic-row {
    display: flex;
    align-items: center;
    gap: 20px;
    background-color: #f9fafb;
    padding: 20px;
    border-radius: var(--cbt-radius);
    border: 1px dashed var(--cbt-border);
}

#profile-pic-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--white);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.profile-pic-row .field-group {
    flex-grow: 1;
}

.submit-row {
    border-top: 1px solid #e5e7eb;
    padding-top: 25px;
    margin-top: 30px;
    display: flex;
    gap: 10px;
    align-items: center;
}

/* --- 5. Results Page --- */
.cbt-results-page-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 2rem;
    background-color: #f9fafb;
}

.cbt-results-header {
    text-align: center;
    margin-bottom: 40px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 20px;
}

.cbt-results-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.cbt-results-header p {
    font-size: 1.1rem;
    color: #6b7280;
    margin-top: 0;
}

.cbt-results-section {
    background-color: var(--cbt-bg-card);
    border-radius: 12px;
    padding: 25px 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

.cbt-results-section h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #111827;
    margin-top: 0;
    margin-bottom: 25px;
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 15px;
}

.cbt-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 20px;
}

.cbt-summary-card {
    background-color: #f9fafb;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    border: 1px solid #e5e7eb;
    transition: var(--transition);
}

.cbt-summary-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -4px rgba(0, 0, 0, 0.07);
    border-color: #d1d5db;
}

.cbt-summary-card .value {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--cbt-primary);
    margin-bottom: 8px;
}

.cbt-summary-card .label {
    font-size: 0.9rem;
    color: #6b7280;
    font-weight: 500;
}

.cbt-summary-card.correct .value {
    color: var(--cbt-success);
}

.cbt-summary-card.incorrect .value {
    color: var(--cbt-danger);
}

#leaderboard-snippet table {
    width: 100%;
    border-collapse: collapse;
}

/* Top Performers snippet: mobile responsive */
#leaderboard-snippet .cbt-leaderboard-snippet {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

#leaderboard-snippet table {
    min-width: 560px;
}

#leaderboard-snippet td:nth-child(1),
#leaderboard-snippet th:nth-child(1),
#leaderboard-snippet td:nth-child(3),
#leaderboard-snippet th:nth-child(3),
#leaderboard-snippet td:nth-child(4),
#leaderboard-snippet th:nth-child(4),
#leaderboard-snippet td:nth-child(5),
#leaderboard-snippet th:nth-child(5) {
    white-space: nowrap;
}

#leaderboard-snippet td:nth-child(2),
#leaderboard-snippet th:nth-child(2) {
    white-space: normal;
    min-width: 160px;
}

@media (max-width: 640px) {
    #leaderboard-snippet th,
    #leaderboard-snippet td {
        padding: 10px 10px;
        font-size: 13px;
    }

    /* Hide Score column on small screens */
    #leaderboard-snippet th:nth-child(4),
    #leaderboard-snippet td:nth-child(4) {
        display: none;
    }

    #leaderboard-snippet table {
        min-width: 480px;
    }
}

@media (max-width: 420px) {
    /* Hide Time column on very small screens */
    #leaderboard-snippet th:nth-child(5),
    #leaderboard-snippet td:nth-child(5) {
        display: none;
    }

    #leaderboard-snippet table {
        min-width: 380px;
    }
}

#leaderboard-snippet th,
#leaderboard-snippet td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

#leaderboard-snippet th {
    background-color: #f9fafb;
    font-weight: 600;
    color: #374151;
}

#leaderboard-snippet td {
    color: #4b5563;
}

#leaderboard-snippet tr:last-child td {
    border-bottom: none;
}

#leaderboard-snippet td:first-child {
    font-weight: bold;
    color: var(--cbt-primary);
}

/* Full leaderboard shortcode styling */
.cbt-leaderboard {
    max-width: 1100px;
    margin: 40px auto 2em;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
}

.cbt-leaderboard h4 {
    margin: 0 0 1rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid #e5e7eb;
    color: #111827;
}

.cbt-leaderboard table {
    width: 100%;
    border-collapse: collapse;
}

.cbt-leaderboard th,
.cbt-leaderboard td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.cbt-leaderboard th {
    background-color: #f9fafb;
    font-weight: 600;
    color: #374151;
}

.cbt-leaderboard tr:last-child td {
    border-bottom: none;
}

#leaderboard-snippet td:first-child {
    font-weight: bold;
    color: var(--cbt-primary);
}

.cbt-review-item {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
}

.cbt-review-header {
    padding: 15px 20px;
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.cbt-review-header strong {
    font-size: 1.1rem;
    color: #1f2937;
}

.cbt-review-body {
    padding: 20px;
    line-height: 1.6;
}

.cbt-review-body p {
    margin: 0 0 10px 0;
    color: #4b5563;
}

.cbt-review-body p:last-child {
    margin-bottom: 0;
}

.cbt-review-body strong {
    color: #374151;
}

.cbt-review-item.correct {
    border-left: 4px solid var(--cbt-success);
}

.cbt-review-item.incorrect {
    border-left: 4px solid var(--cbt-danger);
}

.cbt-review-item.correct .cbt-review-header {
    background-color: rgba(22, 163, 74, 0.05);
}

.cbt-review-item.incorrect .cbt-review-header {
    background-color: rgba(220, 38, 38, 0.05);
}

.cbt-review-explanation {
    margin-top: 15px;
    padding: 15px;
    background-color: #f8f8f8;
    border-radius: 6px;
    border-top: 2px solid #e5e7eb;
    font-size: 0.95rem;
}

.cbt-results-actions {
    text-align: center;
    margin-top: 40px;
}

.cbt-results-actions .cbt-button {
    margin: 0 10px;
}

/* --- 6. Notice, Warning, and Error Styles --- */
.cbt-login-prompt {
    max-width: 800px;
    margin: 40px auto;
    padding: 30px;
    background: var(--cbt-bg-card);
    border-left: 5px solid var(--cbt-danger);
    box-shadow: var(--cbt-shadow);
    border-radius: var(--cbt-radius);
    text-align: center;
}

.cbt-login-prompt h3 {
    margin-top: 0;
}

.cbt-notice,
.cbt-error {
    padding: 1.25rem 1.5rem;
    margin: 20px 0;
    border-radius: var(--cbt-radius);
    border-width: 1px;
    border-left-width: 5px;
    border-style: solid;
    font-size: 1rem;
    line-height: 1.5;
}

.cbt-notice p,
.cbt-error p {
    margin: 0;
    padding: 0;
}

.cbt-notice.success {
    background-color: #f0fdf4;
    border-color: #22c55e;
    color: #15803d;
}

.cbt-notice.warning {
    background-color: #fffbeb;
    border-color: #f59e0b;
    color: #b45309;
}

.cbt-notice.error,
.cbt-error {
    background-color: #fee2e2;
    border-color: #ef4444;
    color: #b91c1c;
}


/* --- 7. Responsive Design --- */
/* Leave desktop sidebar to default layout rules (grid columns) */
/* =================================================================== */
/* 10. QUESTION REPORT MODAL STYLES (Corrected)
/* =================================================================== */

/* Responsive Exam Header for Small Screens */
@media (max-width: 768px) {
    .exam-header {
        padding: 1rem;
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }

    .exam-header-left,
    .exam-header-right {
        gap: 0.5rem;
    }

    .timer-display {
        font-size: 1.2rem;
        padding: 0.5rem 0.75rem;
    }

    .q-timer {
        font-size: 0.85rem;
        padding: 0.4rem 0.75rem;
    }

    .exam-tool-btn {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
        min-width: 40px;
        height: 40px;
    }

    .exam-tool-btn span.fs-label {
        display: none;
    }

    .exam-tool-btn span.cbt-ico {
        font-size: 1.2rem;
    }
}

@media (max-width: 640px) {
    .exam-header {
        padding: 0.75rem;
        gap: 0.5rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .exam-header-left {
        order: 1;
        width: 100%;
        justify-content: center;
        margin-bottom: 0.5rem;
    }

    .exam-header-right {
        order: 2;
        width: 100%;
        justify-content: center;
        gap: 0.75rem;
    }

    .timer-display {
        font-size: 1.1rem;
        padding: 0.5rem 0.75rem;
    }

    .q-timer {
        font-size: 0.8rem;
        padding: 0.35rem 0.6rem;
    }

    .exam-tool-btn {
        padding: 0.5rem 0.7rem;
        font-size: 0.8rem;
        min-width: 36px;
        height: 36px;
    }

    .exam-tool-btn span.cbt-ico {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .exam-header {
        padding: 0.5rem;
        gap: 0.25rem;
    }

    .exam-header-left,
    .exam-header-right {
        gap: 0.25rem;
    }

    .timer-display {
        font-size: 1rem;
        padding: 0.4rem 0.6rem;
    }

    .q-timer {
        font-size: 0.75rem;
        padding: 0.3rem 0.5rem;
    }

    .exam-tool-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
        min-width: 32px;
        height: 32px;
    }

    .exam-tool-btn span.cbt-ico {
        font-size: 1rem;
    }

    #examUserProfile {
        padding: 0.3rem 0.75rem;
        gap: 0.5rem;
    }

    #examUserAvatar {
        width: 28px;
        height: 28px;
    }

    #examUserName {
        font-size: 0.8rem;
    }
}

/* Responsive styling for explanation toggle */
@media (max-width: 768px) {
    .cbt-explain-toggle summary {
        padding: 10px 14px;
        font-size: 0.95rem;
    }

    .cbt-review-explanation {
        padding: 14px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .cbt-explain-toggle {
        margin: 12px 0;
    }

    .cbt-explain-toggle summary {
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    .cbt-review-explanation {
        padding: 12px;
        font-size: 0.85rem;
    }
}

@media (max-width: 360px) {
    .exam-header {
        padding: 0.4rem;
    }

    .exam-header-left,
    .exam-header-right {
        gap: 0.2rem;
    }

    .timer-display {
        font-size: 0.95rem;
        padding: 0.35rem 0.5rem;
    }

    .q-timer {
        display: none;
        /* Hide question timer on very small screens */
    }

    .exam-tool-btn {
        padding: 0.35rem 0.5rem;
        min-width: 28px;
        height: 28px;
    }

    .exam-tool-btn span.cbt-ico {
        font-size: 0.9rem;
    }
}


/* --- Report Button in Controls --- */
.controls .report-btn {
    background: var(--medium-gray);
    color: var(--dark-gray);
    padding: 14px 18px;
    /* Slightly different padding */
}

.controls .report-btn:hover {
    background: var(--dark-gray);
    color: var(--white);
}

/* --- Modal Additions --- */
.cbt-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2rem;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
}

.cbt-modal-content h3 {
    text-align: left;
    margin-bottom: 1.5rem;
}

/* --- Form inside Modal --- */
.cbt-modal-form .form-group {
    margin-bottom: 1rem;
}

.cbt-modal-form select,
.cbt-modal-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--medium-gray);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
}

.cbt-modal-form select:focus,
.cbt-modal-form textarea:focus {
    border-color: var(--cbt-primary);
    /* CORRECTED: Was '--primary' */
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
    /* CORRECTED: Replaced undefined '--primary-light' */
    outline: none;
}

.cbt-modal-form .submit-report-btn {
    width: 100%;
    padding: 12px;
    background-color: var(--cbt-danger);
    /* CORRECTED: Was using undefined '--danger' */
    color: var(--white);
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.cbt-modal-form .submit-report-btn:hover {
    background-color: #b91c1c;
    /* Darker red for consistency */
}

.cbt-modal-form .submit-report-btn:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
}

/* Menu toggle removed — no sidebar present */

/* Activity Calendar styles moved to assets/css/gamification.css */

/* =========================
   Optimized CBT Exam Panel Styles
   ========================= */

/* Container: Remove unnecessary margins/padding for full space usage */
.cbt-exam-container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 10px;
    background: #f9fafb;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Header: Compact and aligned */
.exam-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 8px 8px 0 0;
    margin-bottom: 15px;
}

.exam-header-left,
.exam-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.exam-header .timer-display,
.exam-header .q-timer {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.exam-tool-btn {
    background: transparent;
    border: none;
    color: #fff;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.exam-tool-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Body: Flex layout with question taking more space */
.exam-body {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.main-content {
    flex: 2;
    /* More space for question */
    background: #fff;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    min-width: 0;
}

.status-panel {
    flex: 1;
    /* Less space for navigator */
    background: #fff;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    min-width: 250px;
}

/* Question area: Tight spacing */
.quiz-area {
    background: #fff;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 15px;
}

.quiz-area .section-title {
    font-size: 1rem;
    color: #2563eb;
    margin-bottom: 8px;
    font-weight: 600;
}

.quiz-area .question-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 12px;
}

.options-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.options-list li {
    background: #f8fafc;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.options-list li:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.options-list li.selected {
    border-color: #10b981;
    background: #ecfdf5;
}

/* Controls: Aligned and responsive */
.controls {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 15px;
    flex-wrap: wrap;
}

.controls .cbt-button {
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.controls .cbt-button:hover {
    opacity: 0.9;
}

/* Status panel: Grid for navigator */
.status-panel .panel-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: #1f2937;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(35px, 1fr));
    gap: 6px;
    margin-bottom: 15px;
}

.status-grid .chip {
    width: 35px;
    height: 35px;
    border-radius: 6px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.status-grid .chip:hover {
    background: #e5e7eb;
}

/* Responsive: Stack on mobile/tablet */
@media (max-width: 768px) {
    .exam-body {
        flex-direction: column;
        gap: 10px;
    }

    .main-content,
    .status-panel {
        flex: none;
        width: 100%;
    }

    .exam-header {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .controls {
        justify-content: center;
    }

    .status-grid {
        grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
    }

    .status-grid .chip {
        width: 40px;
        height: 40px;
    }
}

/* Additional responsive tweaks */
@media (max-width: 480px) {
    .cbt-exam-container {
        padding: 5px;
    }

    .exam-header {
        padding: 8px 10px;
    }

    .main-content,
    .status-panel {
        padding: 10px;
    }

    .quiz-area {
        padding: 10px;
    }

    .options-list li {
        padding: 8px 10px;
        font-size: 0.9rem;
    }

    .controls {
        gap: 6px;
    }

    .controls .cbt-button {
        padding: 6px 10px;
        font-size: 0.9rem;
    }
}

/* Strong final overrides to remove any leftover horizontal gap between panels */
.cbt-exam-container .exam-body {
    display: flex !important;
    gap: 6px !important;
    align-items: flex-start !important;
}

.cbt-exam-container .main-content {
    flex: 4 1 0% !important;
    padding-right: 8px !important;
}

.cbt-exam-container .status-panel {
    flex: 0 0 280px !important;
    margin-left: 0 !important;
    padding-left: 8px !important;
}

.cbt-exam-container .quiz-area {
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
}

.cbt-exam-container .quiz-area,
.cbt-exam-container .options-list {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Remove any side margins applied by theme wrappers */
.cbt-exam-container,
.cbt-exam-container>* {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* If any element is forced centered (auto margins), unset it */
.cbt-exam-container .quiz-area[style] {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Extra: make sure navigator sits flush to the right of the question card */
.cbt-exam-container .status-panel {
    box-sizing: border-box !important;
}

/* Force the layout to use two-column flex (no absolute sidebar) so quiz uses full left width */
@media (min-width: 901px) {
    .exam-body {
        position: static !important;
        display: flex !important;
        flex-direction: row !important;
        gap: 12px !important;
    }

    .exam-body .main-content {
        margin-right: 0 !important;
        flex: 1 1 auto !important;
    }

    /* make navigator participate in flow instead of absolute positioning */
    .exam-body .status-panel {
        position: static !important;
        right: auto !important;
        top: auto !important;
        width: 320px !important;
        min-width: 260px !important;
        flex: 0 0 320px !important;
        height: auto !important;
        box-shadow: -2px 0 24px rgba(0, 0, 0, 0.04) !important;
    }

    /* Ensure quiz card expands to fill left column */
    .exam-body .main-content .quiz-area {
        max-width: none !important;
        width: 100% !important;
        margin: 0 !important;
    }

    .exam-body .main-content .options-list {
        width: 100% !important;
    }
}

/* Legend responsiveness and positioning improvements */
.question-navigator {
    max-height: 46vh;
    /* Limit navigator height on desktop to give legend more space */
}

.legend {
    flex-shrink: 0;
    /* Prevent legend from shrinking */
}

@media (max-width: 640px) {
    .question-navigator {
        max-height: 25vh;
        /* Reduce navigator height on small screens to give legend more vertical space */
    }

    .legend li {
        margin-bottom: 8px;
        /* Tighter spacing for compact layout */
        font-size: 0.85em;
        /* Smaller font for better fit */
    }

    .legend .status-box {
        width: 18px;
        /* Smaller status boxes */
        height: 18px;
    }

    .legend .legend-count {
        width: 20px;
        /* Smaller count badges */
        height: 20px;
        font-size: 0.75em;
    }
}

@media (max-width: 640px) {
    .status-panel {
        overflow-y: auto;
        /* Allow scrolling if legend content overflows on small screens */
    }
}


/* =================================================================== */
/* Start-screen / instruction full-width overrides                        */
/* Ensure the instructions/start card and container use full available   */
/* width so the right-side empty area is removed on large layouts.      */
/* =================================================================== */
.start-screen,
.instruction-screen {
    max-width: none !important;
    width: 100% !important;
    margin: 0 auto !important;
    padding: 32px 48px !important;
    box-sizing: border-box !important;
}

/* On very large screens keep comfortable padding but still span full */
@media (min-width: 1600px) {

    .start-screen,
    .instruction-screen {
        padding-left: 96px !important;
        padding-right: 96px !important;
    }
}

/* Make the overall exam container truly edge-to-edge (optional) */
.cbt-exam-container,
.content-area.cbt-exam-page {
    width: 100vw !important;
    max-width: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Keep the start-screen card visually rounded while using full width */
.start-screen .instruction-screen {
    border-radius: 12px;
    background: #ffffff;
}

/* If the theme or container adds an extra inner column, force the inner
   content to span full width as well. */
.cbt-exam-container>* {
    max-width: 100% !important;
}

/* =================================================================== */
/* Professional polish: typography, spacing, buttons, accessibility */
:root {
    --ui-bg: #ffffff;
    --ui-surface: #f8fafc;
    --muted: #94a3b8;
    --text-primary: #0f172a;
    --accent: #0ea5e9;
    /* cyan */
    --accent-2: #3b82f6;
    /* blue */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius: 12px;
}

html,
body {
    font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
    color: var(--text-primary);
}

/* Base layout adjustments for better reading rhythm */
.cbt-exam-container {
    padding: 32px !important;
}

.quiz-area {
    max-width: 980px;
    margin: 0 auto;
}

/* Improve question typography */
.question-text {
    font-size: 1.35rem !important;
    line-height: 1.6 !important;
}

.section-title {
    font-size: .95rem !important;
}

/* Buttons: primary / secondary / ghost */
.cbt-button,
.controls button {
    border-radius: 10px;
    padding: 10px 16px;
    font-weight: 600;
}

.cbt-button.primary,
.controls .btn-save {
    background: var(--accent-2);
    color: #fff;
    border: none;
}

.cbt-button.ghost,
.controls button.btn-clear {
    background: transparent;
    border: 1px solid #e6eef7;
    color: var(--text-primary);
}

.controls .btn-mark {
    background: var(--warning);
    color: #fff;
    border: none;
}

.controls .submit-final {
    background: var(--success);
    color: #fff;
    border: none;
}

/* Focus states for keyboard users */
a:focus,
button:focus,
input:focus,
.q-btn:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    border-radius: 8px;
}

/* Legend: clearer badges */
.legend .legend-count {
    background: #eef2ff;
    color: #3730a3;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 999px;
}

.legend .status-box {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(2, 6, 23, 0.06);
}

/* Subtle hover and reduced motion support */
@media (prefers-reduced-motion: no-preference) {
    .option-item:hover {
        transform: translateY(-3px);
        transition: transform .18s ease, box-shadow .18s ease;
    }
}

/* Tighten layout on small screens */
@media (max-width: 640px) {
    .cbt-exam-container {
        padding: 16px !important;
    }

    .quiz-area {
        padding: 18px !important;
    }

    .status-panel {
        width: 100% !important;
        position: static !important;
    }
}

/* End professional polish */

/* ========================= Minimal / Compact Preset ========================= */
/* Tight, gray-accented, minimal UI with square buttons and no animations */
:root {
    --mc-bg: #ffffff;
    --mc-surface: #f7f7f8;
    --mc-muted: #9aa4ae;
    --mc-text: #0b1220;
    --mc-primary: #6b7280;
    /* muted gray */
    --mc-success: #059669;
}

html,
body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial;
    font-size: 15px;
    color: var(--mc-text);
}

/* Reduce spacing and remove decorative effects */
.cbt-exam-container {
    padding: 12px !important;
}

.quiz-area {
    max-width: 900px;
    padding: 18px !important;
    margin: 0 auto;
    box-shadow: none !important;
    border: 1px solid #eef0f2;
}

.start-screen,
.instruction-screen {
    padding: 20px !important;
}

.question-text {
    font-size: 1.15rem !important;
    line-height: 1.4 !important;
}

.section-title {
    font-size: .9rem !important;
}

/* Compact options */
.option-item {
    padding: 10px 12px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #eceff1;
}

.option-item.selected {
    background: #f1f5f9;
    box-shadow: none;
    border-color: #dbe2ea;
}

/* Square, compact buttons */
.controls button,
.cbt-button {
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.95rem;
}

.controls .btn-save {
    background: var(--mc-primary);
    color: #fff;
    border: none;
}

.controls .btn-mark {
    background: #f59e0b;
    color: #fff;
}

/* Navigator compact grid */
.question-navigator {
    gap: 6px;
}

.q-btn {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    font-size: .9rem;
}

/* Legend compact */
.legend {
    padding: 10px;
}

.legend li {
    padding: 6px 0;
    font-size: .9rem;
}

.legend .legend-count {
    padding: 2px 6px;
    font-size: .8rem;
}

/* Remove animations and shadows for minimal preset */
* {
    transition: none !important;
    animation: none !important;
    box-shadow: none !important;
}

/* Small screens: tighter layout */
@media (max-width: 640px) {
    .cbt-exam-container {
        padding: 10px !important;
    }

    .quiz-area {
        padding: 12px !important;
    }

    .controls {
        gap: 8px;
    }
}

/* End Minimal / Compact Preset */
/* =================================================================== */
/* 11. MOBILE RESPONSIVE FIXES FOR CONTROLS                            */
/* =================================================================== */

@media (max-width: 768px) {

    /* Main controls container */
    .controls {
        flex-direction: column;
        gap: 12px;
        padding-bottom: 20px;
        /* Ensure space from bottom edge */
        position: sticky;
        bottom: 0;
        background: var(--cbt-bg-card, #ffffff);
        border-top: 1px solid var(--cbt-border, #e5e7eb);
        padding-left: 12px;
        padding-right: 12px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        z-index: 30;
    }

    /* Right controls group - applies to both original and moved locations */
    .controls .right-controls,
    .mobile-moved-controls {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
        gap: 10px;
        justify-content: space-between;
    }

    /* Buttons responsive styling - match moved controls too */
    .controls button,
    .mobile-moved-controls button {
        flex: 1 1 auto;
        /* Allow growth but respect wrap */
        min-width: 45%;
        /* ensure 2 buttons per row or full width */
        padding: 12px 10px;
        font-size: 14px;
        white-space: nowrap;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Specific adjustment for Clear Response to perhaps take full width if needed, or fit in flow */
    #clearBtn {
        order: 3;
        /* Move Clear Response to bottom if desired, or keep as is */
        width: 100%;
        /* Make clear response full width to avoid accidental clicks */
        margin-top: 5px;
        background-color: #f3f4f6;
        border: 1px solid #d1d5db;
        color: #374151;
    }

    /* Mark and Save buttons side-by-side */
    #markBtn,
    #saveNextBtn {
        flex: 1;
        /* Split remaining space */
        min-width: 120px;
    }

    /* Ensure Mark-for-Review is never hidden by conflicting theme rules */
    #markBtn {
        display: inline-flex;
        min-height: 44px;
        touch-action: manipulation;
    }

    /* Keep Submit directly after Question Status (no sticky bottom gap) */
    .status-panel-actions {
        position: static;
        bottom: auto;
        background: transparent;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        margin-top: 12px !important;
        z-index: auto;
    }

    /* Make Save Next more prominent */
    #saveNextBtn {
        background-color: #2563eb;
        color: #ffffff;
    }

    /* Add padding to container to prevent clipping by mobile bars */
    .cbt-exam-container {
        padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    }

    /* Question Navigator Mobile Fixes */
    .status-panel {
        margin-top: 20px;
        border-top: 2px solid #e5e7eb;
        padding-top: 20px;
    }

    .question-navigator {
        max-height: 180px !important;
        /* Limit height on mobile */
        overflow-y: auto;
    }
}

/* --- Responsive Table Styles for Dashboard & Reports --- */
@media (max-width: 768px) {

    /* Force tables to not be like tables anymore */
    .cbt-dashboard table,
    .cbt-dashboard thead,
    .cbt-dashboard tbody,
    .cbt-dashboard th,
    .cbt-dashboard td,
    .cbt-dashboard tr {
        display: block;
    }

    /* Hide table headers (but not display: none;, for accessibility) */
    .cbt-dashboard thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .cbt-dashboard tr {
        border: 1px solid #ccc;
        border-radius: 8px;
        margin-bottom: 15px;
        background: #fff;
        padding: 10px;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    }

    .cbt-dashboard td {
        /* Behave  like a "row" */
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50% !important;
        text-align: right;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: flex-end;
    }

    .cbt-dashboard td:before {
        /* Now like a table header */
        position: absolute;
        /* Top/left values mimic padding */
        top: 0;
        left: 6px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        display: flex;
        align-items: center;
        height: 100%;
        color: #4b5563;
        /* Label the data */
        content: attr(data-label);
    }

    .cbt-dashboard td:last-child {
        border-bottom: 0;
        justify-content: center;
        padding-left: 0 !important;
        margin-top: 5px;
    }

    .cbt-dashboard td:last-child:before {
        display: none;
        /* No label for Actions usually */
    }

    /* Checkbox column special handling */
    .cbt-dashboard td.checkbox-col,
    .cbt-dashboard th.checkbox-col {
        padding-left: 10px !important;
        text-align: left;
        justify-content: flex-start;
    }

    .cbt-dashboard td.checkbox-col:before {
        display: none;
    }

    /* Results Page Mobile Optimizations */
    .cbt-results-page-container {
        padding: 1rem;
    }

    .cbt-results-header h2 {
        font-size: 1.8rem;
    }

    .cbt-summary-grid {
        gap: 10px;
        grid-template-columns: 1fr 1fr;
    }

    .cbt-summary-card .value {
        font-size: 1.5rem;
    }

    .cbt-review-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

/* Status panel: keep actions close to legend in all modes */
.cbt-exam-page .status-panel .question-navigator {
    /* Navigator stays at top and can scroll if long */
    order: 1;
    flex: 1 1 auto !important;
    max-height: 46vh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.cbt-exam-page .status-panel .legend {
    /* Put Question Status at the bottom of the panel */
    order: 3;
    margin-top: auto;
    margin-bottom: 0;
}

.cbt-exam-page .status-panel .status-panel-actions {
    /* Keep Submit/Instructions above the bottom legend */
    order: 2;
    position: static;
    margin-top: 12px !important;
}