/* ============================================================
   CBQ Pre-Test Gate — compulsory details + instructions modal
   Shown on all viewports before the test starts.
   ============================================================ */

.cbq-pretest-gate {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(15, 23, 42, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: cbq-pt-fade-in .25s ease-out;
    font-family: 'Inter', 'Baloo Tamma 2', system-ui, -apple-system, sans-serif;
}
@keyframes cbq-pt-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.cbq-pretest-card {
    background: #ffffff;
    border-radius: 20px;
    max-width: 560px;
    width: 100%;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 30px 80px -20px rgba(15,23,42,.5), 0 10px 30px -8px rgba(15,23,42,.2);
    animation: cbq-pt-slide-up .35s cubic-bezier(.34, 1.56, .64, 1);
}
.cbq-pretest-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
@keyframes cbq-pt-slide-up {
    from { opacity: 0; transform: translateY(24px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Hero ─────────────────────────────────────────────────── */
.cbq-pretest-hero {
    position: relative;
    padding: 28px 28px 20px;
    background: linear-gradient(135deg, #2563eb, #1e40af);
    color: #fff;
    border-radius: 20px 20px 0 0;
    text-align: center;
}

/* Language toggle — sits inline next to Start button in footer */
.cbq-pretest-lang {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #475569;
    padding: 0;
    border-radius: 10px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.cbq-pretest-lang:hover  { background: #f8fafc; border-color: #cbd5e1; }
.cbq-pretest-lang:active { transform: scale(.94); }
.cbq-pretest-lang svg    { flex-shrink: 0; display: block; }
.cbq-pretest-badge {
    display: inline-block;
    margin-bottom: 10px;
}
.cbq-pretest-badge span {
    display: inline-block;
    background: rgba(255,255,255,.2);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 99px;
    letter-spacing: .5px;
    text-transform: uppercase;
}
.cbq-pretest-title {
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 8px;
    line-height: 1.3;
    letter-spacing: -.02em;
}
.cbq-pretest-desc {
    font-size: 13px;
    color: rgba(255,255,255,.85);
    margin: 0;
    line-height: 1.5;
}

/* ── Stats grid ───────────────────────────────────────────── */
.cbq-pretest-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 20px 22px 0;
}
.cbq-pretest-stat {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.cbq-pretest-stat-icon {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #eff6ff;
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cbq-pretest-stat-icon svg { width: 18px; height: 18px; }
.cbq-pretest-stat-val {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.cbq-pretest-stat-val .unit {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    margin-left: 2px;
}
.cbq-pretest-stat-lbl {
    font-size: 10px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .4px;
}

/* ── Marks scheme ─────────────────────────────────────────── */
.cbq-pretest-marks {
    padding: 16px 22px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cbq-pretest-marks-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
}
.cbq-pretest-marks-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.cbq-pretest-marks-item.pos { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.cbq-pretest-marks-item.neg { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.cbq-pretest-marks-item.neg.muted { background: #f8fafc; color: #64748b; border: 1px solid #e2e8f0; }

/* ── Instructions ─────────────────────────────────────────── */
.cbq-pretest-instr {
    padding: 20px 22px 0;
}
.cbq-pretest-instr h3 {
    font-size: 14px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 10px;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.cbq-pretest-instr ol {
    margin: 0;
    padding-left: 20px;
    color: #334155;
}
.cbq-pretest-instr li {
    font-size: 13px;
    line-height: 1.65;
    margin-bottom: 6px;
}
.cbq-pretest-instr li::marker {
    color: #2563eb;
    font-weight: 700;
}

/* Admin-provided custom instructions HTML — style loose elements consistently */
.cbq-pretest-instr-custom {
    font-size: 13px;
    line-height: 1.65;
    color: #334155;
}
.cbq-pretest-instr-custom p { margin: 0 0 10px; }
.cbq-pretest-instr-custom p:last-child { margin-bottom: 0; }
.cbq-pretest-instr-custom ul,
.cbq-pretest-instr-custom ol { margin: 0 0 10px; padding-left: 22px; }
.cbq-pretest-instr-custom li { margin-bottom: 6px; }
.cbq-pretest-instr-custom ul li::marker,
.cbq-pretest-instr-custom ol li::marker { color: #2563eb; font-weight: 700; }
.cbq-pretest-instr-custom strong,
.cbq-pretest-instr-custom b { color: #0f172a; }
.cbq-pretest-instr-custom a { color: #2563eb; text-decoration: underline; }

/* ── Footer (sticky at bottom of card) ──────────────────── */
.cbq-pretest-footer {
    flex-shrink: 0;
    padding: 16px 22px calc(16px + env(safe-area-inset-bottom));
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -8px 24px -12px rgba(15,23,42,.15);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 2;
}
.cbq-pretest-check {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #334155;
    cursor: pointer;
    font-weight: 500;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.cbq-pretest-check input {
    width: 18px;
    height: 18px;
    accent-color: #2563eb;
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
}

/* Actions row: Start button (fills) + language switcher (fixed-size) */
.cbq-pretest-actions {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.cbq-pretest-start {
    flex: 1 1 auto;
    padding: 10px 14px;
    min-height: 42px;
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px -3px rgba(37,99,235,.4);
    transition: transform .15s ease, box-shadow .2s ease, background .15s ease, opacity .2s ease;
    -webkit-tap-highlight-color: transparent;
}
.cbq-pretest-start:hover:not(:disabled) {
    background: #1d4ed8;
    box-shadow: 0 10px 24px -4px rgba(37,99,235,.55);
    transform: translateY(-1px);
}
.cbq-pretest-start:active:not(:disabled) { transform: translateY(0) scale(.98); }
.cbq-pretest-start:disabled {
    opacity: .45;
    cursor: not-allowed;
    box-shadow: none;
}

/* Body lock while gate is open */
body.cbq-pretest-locked { overflow: hidden !important; }

/* Mobile: full-height feel */
@media (max-width: 600px) {
    .cbq-pretest-gate { padding: 0; align-items: stretch; }
    .cbq-pretest-card {
        border-radius: 0;
        max-height: 100vh;
        max-width: 100%;
    }
    .cbq-pretest-hero { border-radius: 0; padding: 26px 22px 18px; padding-top: calc(26px + env(safe-area-inset-top)); }
    .cbq-pretest-title { font-size: 20px; }
    .cbq-pretest-stats { grid-template-columns: repeat(3, 1fr); padding: 18px 18px 0; }
    .cbq-pretest-stat-val { font-size: 18px; }
    .cbq-pretest-marks { padding: 14px 18px 0; }
    .cbq-pretest-instr { padding: 18px 18px 0; }
    .cbq-pretest-footer { padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); }
}

/* Dark theme */
html[data-mcqp-theme="dark"] .cbq-pretest-card { background: #121a32; }
html[data-mcqp-theme="dark"] .cbq-pretest-stat { background: rgba(30,41,59,.5); border-color: rgba(51,65,85,.5); }
html[data-mcqp-theme="dark"] .cbq-pretest-stat-val { color: #f1f5f9; }
html[data-mcqp-theme="dark"] .cbq-pretest-instr h3 { color: #f1f5f9; }
html[data-mcqp-theme="dark"] .cbq-pretest-instr ol { color: #cbd5e1; }
html[data-mcqp-theme="dark"] .cbq-pretest-check { color: #e2e8f0; }
html[data-mcqp-theme="dark"] .cbq-pretest-footer { border-top-color: rgba(51,65,85,.4); }

/* ============================================================
   v4.3.3 — Fullscreen exit warning banner
   ============================================================ */
.cbq-fs-banner {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translate(-50%, -140%);
    z-index: 100010;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px 10px 16px;
    background: linear-gradient(135deg, #1e40af, #2563eb);
    color: #ffffff;
    border-radius: 14px;
    box-shadow: 0 12px 32px -8px rgba(30,64,175,.6), 0 4px 12px -2px rgba(15,23,42,.2);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 12.5px;
    font-weight: 600;
    max-width: calc(100vw - 32px);
    transition: transform .35s cubic-bezier(.34, 1.56, .64, 1);
    pointer-events: none;
}
.cbq-fs-banner.is-on {
    transform: translate(-50%, 0);
    pointer-events: auto;
}
.cbq-fs-banner-body {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
    min-width: 0;
}
.cbq-fs-banner-body svg { flex-shrink: 0; opacity: .9; }
.cbq-fs-banner-body span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cbq-fs-banner button {
    appearance: none;
    padding: 7px 12px;
    background: #ffffff;
    color: #1d4ed8;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background .15s ease, transform .1s ease;
}
.cbq-fs-banner button:hover  { background: #f1f5f9; }
.cbq-fs-banner button:active { transform: scale(.96); }

@media (max-width: 600px) {
    .cbq-fs-banner {
        top: 12px;
        font-size: 11.5px;
        padding: 9px 12px 9px 14px;
        gap: 10px;
    }
    .cbq-fs-banner-body span { max-width: 180px; }
    .cbq-fs-banner button { padding: 6px 10px; font-size: 11px; }
}

/* v4.3.4 — Inline variant (inside right sidebar, below Test Overview) */
.cbq-fs-banner.cbq-fs-banner--inline {
    position: static;
    transform: translateY(-12px);
    opacity: 0;
    max-width: 100%;
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 12px;
    box-shadow: 0 6px 18px -8px rgba(30,64,175,.5);
    font-size: 12px;
    pointer-events: none;
    display: none;
    flex-wrap: wrap;
    gap: 10px;
    transition: opacity .25s ease, transform .25s ease;
}
.cbq-fs-banner.cbq-fs-banner--inline.is-on {
    display: flex;
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}
.cbq-fs-banner.cbq-fs-banner--inline .cbq-fs-banner-body {
    flex: 1 1 100%;
    min-width: 0;
}
.cbq-fs-banner.cbq-fs-banner--inline .cbq-fs-banner-body span {
    white-space: normal;            /* allow wrap inside the narrow sidebar */
    line-height: 1.4;
}
.cbq-fs-banner.cbq-fs-banner--inline button {
    width: 100%;
    padding: 9px 12px;
    font-size: 12px;
}

/* ============================================================
   v4.4.9 — Dark mode readability for pretest gate
   ============================================================ */
html[data-mcqp-theme="dark"] .cbq-pretest-card {
    background: #121a32;
    border-color: #233056;
    color: #e2e8f0;
}
html[data-mcqp-theme="dark"] .cbq-pretest-stat {
    background: #182240;
    border-color: #233056;
    color: #e2e8f0;
}
html[data-mcqp-theme="dark"] .cbq-pretest-stat-icon {
    background: rgba(255,255,255,.06);
    color: #93c5fd;
}
html[data-mcqp-theme="dark"] .cbq-pretest-stat-val  { color: #f8fafc; }
html[data-mcqp-theme="dark"] .cbq-pretest-stat-lbl  { color: #94a3b8; }
html[data-mcqp-theme="dark"] .cbq-pretest-stat-val .unit { color: #94a3b8; }

html[data-mcqp-theme="dark"] .cbq-pretest-marks-item.pos {
    background: rgba(16,185,129,.12);
    border-color: rgba(16,185,129,.3);
    color: #6ee7b7;
}
html[data-mcqp-theme="dark"] .cbq-pretest-marks-item.neg {
    background: rgba(239,68,68,.12);
    border-color: rgba(239,68,68,.3);
    color: #fca5a5;
}
html[data-mcqp-theme="dark"] .cbq-pretest-marks-item.neg.muted {
    background: rgba(148,163,184,.1);
    border-color: rgba(148,163,184,.2);
    color: #94a3b8;
}

html[data-mcqp-theme="dark"] .cbq-pretest-instr h3 { color: #f8fafc; }
html[data-mcqp-theme="dark"] .cbq-pretest-instr ol li { color: #cbd5e1; }
html[data-mcqp-theme="dark"] .cbq-pretest-instr li::marker { color: #60a5fa; }
html[data-mcqp-theme="dark"] .cbq-pretest-instr-custom { color: #cbd5e1; }
html[data-mcqp-theme="dark"] .cbq-pretest-instr-custom strong,
html[data-mcqp-theme="dark"] .cbq-pretest-instr-custom b { color: #f8fafc; }
html[data-mcqp-theme="dark"] .cbq-pretest-instr-custom a { color: #60a5fa; }
html[data-mcqp-theme="dark"] .cbq-pretest-instr-custom ul li::marker,
html[data-mcqp-theme="dark"] .cbq-pretest-instr-custom ol li::marker { color: #60a5fa; }

html[data-mcqp-theme="dark"] .cbq-pretest-footer {
    background: #121a32;
    border-top-color: #233056;
}
html[data-mcqp-theme="dark"] .cbq-pretest-check {
    color: #e2e8f0;
}
html[data-mcqp-theme="dark"] .cbq-pretest-check span { color: #e2e8f0; }

html[data-mcqp-theme="dark"] .cbq-pretest-lang {
    background: #182240;
    border-color: #233056;
    color: #e2e8f0;
}
html[data-mcqp-theme="dark"] .cbq-pretest-lang:hover {
    background: #243068;
    border-color: #334080;
}

/* FS banner — inline sidebar variant already works in dark; top-center fine too */
