/* ── Deechea Quiz — PYQ Front-end Styles ─────────────────────────────────
   Mirrors booster.css design (.dq-boost → .dq-pyq, .dqb-* → .dqp-*)
   Extra: accordion explanation sections in review screen.
──────────────────────────────────────────────────────────────────────── */

/* ── WRAPPER ─────────────────────────────────────────────────────────────── */
.dq-pyq {
    font-family: 'Inter', 'Segoe UI', -apple-system, sans-serif;
    max-width: 860px;
    margin: 0 auto;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,.11);
    border: 1px solid #e2e8f0;
    background: #fff;
}

/* ── BUTTONS ─────────────────────────────────────────────────────────────── */
.dqp-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 11px 22px; border-radius: 8px; font-size: 14px; font-weight: 600;
    cursor: pointer; border: none; transition: all .15s ease;
}
.dqp-btn-start, .dqp-btn-primary {
    background: linear-gradient(135deg, #4f46e5, #6366f1); color: #fff;
}
.dqp-btn-start:hover, .dqp-btn-primary:hover { opacity: .9; }
.dqp-btn-outline { background: #fff; color: #475569; border: 1.5px solid #e2e8f0; }
.dqp-btn-outline:hover { border-color: #6366f1; color: #6366f1; }

/* ── START SCREEN ────────────────────────────────────────────────────────── */
.dqp-start { padding: 48px 28px; text-align: center; background: linear-gradient(160deg, #f5f3ff 0%, #fff 60%); }
.dqp-start-card { max-width: 440px; margin: 0 auto; }
.dqp-start-icon { font-size: 52px; margin-bottom: 8px; }
.dqp-start-badge {
    display: inline-block; background: #e0e7ff; color: #4338ca;
    font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    padding: 4px 14px; border-radius: 20px; margin-bottom: 12px;
}
.dqp-exam-title { margin: 0 0 4px; font-size: 24px; color: #1e293b; font-weight: 800; }
.dqp-exam-sub   { margin: 0 0 20px; font-size: 14px; color: #6366f1; font-weight: 600; }
.dqp-start-meta { display: flex; justify-content: center; gap: 22px; margin-bottom: 26px; flex-wrap: wrap; }
.dqp-meta-item  { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: #475569; font-weight: 600; }
.dqp-meta-icon  { font-size: 16px; }
.dqp-start-note { margin-top: 16px; font-size: 12px; color: #94a3b8; }

/* ── LOADING ─────────────────────────────────────────────────────────────── */
.dqp-loading     { padding: 80px 28px; text-align: center; color: #6b7280; }
.dqp-loading-inner p { font-size: 14px; margin-top: 14px; }
.dqp-spinner {
    width: 40px; height: 40px; border: 4px solid #e2e8f0;
    border-top-color: #6366f1; border-radius: 50%;
    animation: dqp-spin .7s linear infinite; margin: 0 auto;
}
@keyframes dqp-spin { to { transform: rotate(360deg); } }

/* ── QUIZ HEADER ─────────────────────────────────────────────────────────── */
.dqp-quiz-header {
    background: linear-gradient(135deg, #1a1a2e, #0f3460);
    padding: 16px 28px;
    display: flex; align-items: center; justify-content: space-between;
}
.dqp-quiz-info     { flex: 1; min-width: 0; }
.dqp-quiz-name-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.dqp-exam-name     { color: #fff; font-weight: 700; font-size: 14.5px; }
.dqp-badge-pyq {
    background: rgba(99,102,241,.85); color: #fff;
    font-size: 10px; font-weight: 700; letter-spacing: .1em;
    padding: 2px 8px; border-radius: 12px; text-transform: uppercase;
}
.dqp-progress-wrap  { display: flex; align-items: center; gap: 10px; }
.dqp-progress-bar   { flex: 1; height: 5px; background: rgba(255,255,255,.15); border-radius: 4px; overflow: hidden; }
.dqp-progress-fill  { height: 100%; width: 0; background: linear-gradient(90deg,#6366f1,#818cf8); border-radius: 4px; transition: width .3s ease; }
.dqp-progress-label { color: #cbd5e1; font-size: 11.5px; font-weight: 600; white-space: nowrap; }

/* ── QUESTION AREA ───────────────────────────────────────────────────────── */
.dqp-question-area {
    padding: 28px 32px 24px;
    margin-right: 266px;
    min-height: 420px;
    background: #f8fafc;
}
.dqp-qlabel {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .08em; color: #4f46e5;
    background: #e0e7ff; display: inline-block;
    padding: 4px 12px; border-radius: 20px; margin: 0 0 14px;
}
.dqp-qtext {
    font-size: 15.5px; font-weight: 500; color: #1e293b;
    margin: 0 0 22px; line-height: 1.7;
}

/* ── OPTIONS ─────────────────────────────────────────────────────────────── */
.dqp-opts { display: flex; flex-direction: column; gap: 10px; }
.dqp-opt {
    display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
    background: #fff; border: 1.5px solid #e2e8f0; border-radius: 10px;
    padding: 13px 16px; cursor: pointer; font-size: 14px; color: #334155;
    transition: all .15s ease; line-height: 1.45;
}
.dqp-opt:hover { border-color: #6366f1; background: #eef2ff; }
.dqp-opt-label {
    background: #e2e8f0; color: #475569; font-weight: 700; font-size: 12.5px;
    min-width: 28px; height: 28px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all .15s;
}
.dqp-opt.dqp-selected { border-color: #6366f1; background: #eef2ff; }
.dqp-opt.dqp-selected .dqp-opt-label { background: #6366f1; color: #fff; }
.dqp-opt-img {
    max-width: 100%;
    max-height: 160px;
    border-radius: 6px;
    display: block;
    object-fit: contain;
}
.dqp-opt-has-image { align-items: flex-start; }
.dqp-opt-has-image .dqp-opt-img { flex: 1; }

/* ── RESULT SCREEN ───────────────────────────────────────────────────────── */
.dqp-result       { padding: 44px 28px; text-align: center; }
.dqp-result-card  { max-width: 480px; margin: 0 auto; }
.dqp-result-emoji { font-size: 52px; margin-bottom: 6px; }
.dqp-result-title { font-size: 22px; color: #1e293b; margin: 0 0 20px; font-weight: 800; }
.dqp-result-ring  { position: relative; width: 132px; height: 132px; margin: 0 auto 24px; }
.dqp-result-ring svg { width: 100%; height: 100%; }
.dqp-ring-text    { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.dqp-ring-pct     { font-size: 25px; font-weight: 800; color: #1e293b; }
.dqp-ring-sub     { font-size: 11px; color: #94a3b8; }
.dqp-result-stats { display: flex; justify-content: center; gap: 28px; margin-bottom: 20px; flex-wrap: wrap; }
.dqp-stat         { display: flex; flex-direction: column; align-items: center; }
.dqp-stat-val     { font-size: 24px; font-weight: 800; color: #1e293b; }
.dqp-stat-lbl     { font-size: 11.5px; color: #94a3b8; font-weight: 600; }

.dqp-cuet-score {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border: 1px solid #86efac; border-radius: 10px;
    padding: 12px 24px; margin-bottom: 22px;
    display: flex; align-items: center; justify-content: center; gap: 12px;
}
.dqp-cuet-label { font-size: 12px; font-weight: 600; color: #166534; }
.dqp-cuet-val   { font-size: 22px; font-weight: 800; color: #15803d; }

.dqp-result-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

/* ── REVIEW SCREEN ───────────────────────────────────────────────────────── */
.dqp-review-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 18px 28px; border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}
.dqp-review-header h2 { margin: 0; font-size: 16px; color: #1e293b; font-weight: 700; }
.dqp-review-list { padding: 8px 28px 32px; }

.dqp-rev-q { padding: 24px 0; border-bottom: 1px solid #f1f5f9; }
.dqp-rev-q:last-child { border-bottom: none; }
.dqp-rev-qnum { background: #0f3460; color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 4px; margin-right: 8px; }
.dqp-rev-qtext { font-size: 15px; font-weight: 500; color: #1e293b; margin: 0 0 14px; line-height: 1.65; }

.dqp-opts-review { display: flex; flex-direction: column; gap: 8px; margin-bottom: 0; }
.dqp-opt-static {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px;
    border: 1.5px solid #e2e8f0; border-radius: 8px; background: #f8fafc;
    font-size: 13.5px; color: #334155; line-height: 1.4;
}
.dqp-opt-static.dqp-correct        { border-color: #22c55e; background: #f0fdf4; color: #15803d; font-weight: 600; }
.dqp-opt-static.dqp-correct .dqp-opt-label { background: #22c55e; color: #fff; }
.dqp-opt-static.dqp-chosen-wrong   { border-color: #ef4444; background: #fef2f2; color: #b91c1c; }
.dqp-opt-static.dqp-chosen-wrong .dqp-opt-label { background: #ef4444; color: #fff; }
.dqp-opt-static.dqp-opt-has-image  { align-items: flex-start; }

/* ── EXPLANATION ACCORDION ───────────────────────────────────────────────── */
.dqp-exp-wrap    { margin-top: 16px; display: flex; flex-direction: column; gap: 6px; }
.dqp-exp-block   { border-radius: 8px; overflow: hidden; border: 1px solid #e5e7eb; }
.dqp-exp-toggle {
    width: 100%; text-align: left; background: none; border: none;
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
    color: #374151; transition: background .12s;
}
.dqp-exp-toggle:hover { background: #f9fafb; }
.dqp-exp-toggle .dqp-exp-icon { font-size: 16px; margin-right: 8px; }
.dqp-exp-toggle .dqp-exp-chevron { font-size: 12px; color: #9ca3af; transition: transform .2s; flex-shrink: 0; }
.dqp-exp-toggle.open .dqp-exp-chevron { transform: rotate(180deg); }
.dqp-exp-body {
    display: none; padding: 10px 14px 14px;
    font-size: 13px; color: #374151; line-height: 1.7;
    border-top: 1px solid #f1f5f9;
}
.dqp-exp-body.open { display: block; }

/* Color variants per section */
.dqp-exp-block[data-exp="short"]    .dqp-exp-toggle { background: #fefce8; border-bottom: 1px solid #fef08a; }
.dqp-exp-block[data-exp="short"]    .dqp-exp-body   { background: #fefce8; }
.dqp-exp-block[data-exp="correct"]  .dqp-exp-toggle { background: #f0fdf4; border-bottom: 1px solid #bbf7d0; }
.dqp-exp-block[data-exp="correct"]  .dqp-exp-body   { background: #f0fdf4; }
.dqp-exp-block[data-exp="wrong"]    .dqp-exp-toggle { background: #fff1f2; border-bottom: 1px solid #fecdd3; }
.dqp-exp-block[data-exp="wrong"]    .dqp-exp-body   { background: #fff1f2; }
.dqp-exp-block[data-exp="strategy"] .dqp-exp-toggle { background: #eff6ff; border-bottom: 1px solid #bfdbfe; }
.dqp-exp-block[data-exp="strategy"] .dqp-exp-body   { background: #eff6ff; }
.dqp-exp-block[data-exp="memory"]   .dqp-exp-toggle { background: #fdf4ff; border-bottom: 1px solid #e9d5ff; }
.dqp-exp-block[data-exp="memory"]   .dqp-exp-body   { background: #fdf4ff; }
.dqp-exp-block[data-exp="ncert"]    .dqp-exp-toggle { background: #fff7ed; border-bottom: 1px solid #fed7aa; }
.dqp-exp-block[data-exp="ncert"]    .dqp-exp-body   { background: #fff7ed; }
.dqp-exp-block[data-exp="code"]     .dqp-exp-toggle { background: #e2e8f0; border-bottom: 1px solid #cbd5e1; }
.dqp-exp-block[data-exp="code"]     .dqp-exp-body   { background: #f8fafc; padding: 0; }

.dqp-code-block {
    margin: 0;
    padding: 14px 16px;
    background: #0f172a;
    color: #e2e8f0;
    font-family: Consolas, Monaco, 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.55;
    overflow-x: auto;
    white-space: pre;
    -webkit-overflow-scrolling: touch;
}
.dqp-code-block code { background: none; padding: 0; color: inherit; font-family: inherit; }

/* ── PALETTE — inherits .dq-boost palette, scoped to .dqp-pal ───────────── */
.dqp-pal {
    position: fixed;
    top: 58px; right: 0;
    width: 260px;
    max-height: calc(100vh - 66px);
    background: #fff;
    border-left: 1px solid #c2cfe0;
    border-bottom: 1px solid #c2cfe0;
    border-radius: 0 0 0 10px;
    box-shadow: -3px 4px 24px rgba(0,0,0,.14);
    z-index: 9999999;
    font-family: 'Segoe UI','Trebuchet MS',Arial,sans-serif;
    display: flex; flex-direction: column; overflow: hidden;
}
.dqp-pal .lp-hdr {
    background: linear-gradient(135deg,#1a1a2e,#0f3460);
    padding: 10px 13px;
    display: flex; align-items: center; gap: 9px; flex-shrink: 0;
}
.dqp-pal .lp-av {
    width:36px; height:36px; border-radius:50%;
    background:rgba(255,255,255,.15); border:2px solid rgba(255,255,255,.35);
    display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.dqp-pal .lp-info { display:flex; flex-direction:column; min-width:0; flex:1; }
.dqp-pal .lp-name { font-size:13px; font-weight:700; color:#fff; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dqp-pal .lp-subj { font-size:9.5px; color:rgba(255,255,255,.75); text-transform:uppercase; letter-spacing:1px; margin-top:1px; }
.dqp-pal .lp-timer {
    background:rgba(0,0,0,.28); border-radius:5px;
    padding:3px 8px; font-size:13px; font-weight:700; color:#fff;
    font-family:'Courier New',monospace; letter-spacing:1px;
    flex-shrink:0; min-width:62px; text-align:center;
}
.dqp-pal .lp-timer.lp-warn { background:rgba(220,38,38,.85); animation:dqp-blink 1s infinite; }
@keyframes dqp-blink { 0%,100%{opacity:1} 50%{opacity:.42} }

.dqp-pal .lp-legend {
    display:grid; grid-template-columns:1fr 1fr;
    gap:5px 4px; padding:9px 12px 8px;
    background:#f5f8fc; border-bottom:1px solid #dde4ef; flex-shrink:0;
}
.dqp-pal .lp-leg-row { display:flex; align-items:center; gap:6px; font-size:9.5px; color:#374151; font-weight:500; line-height:1.3; }
.dqp-pal .lp-full    { grid-column:1/-1; }
.dqp-pal .lp-lb {
    width:22px; height:22px; min-width:22px;
    display:inline-flex; align-items:center; justify-content:center;
    font-size:10px; font-weight:700; color:#fff;
    flex-shrink:0;
}
.dqp-pal .lp-lb-nv  { background:#94a3b8; border-radius:4px; }
.dqp-pal .lp-lb-na  { background:#dc2626; border-radius:4px; }
.dqp-pal .lp-lb-ans { background:#16a34a; border-radius:4px; }
.dqp-pal .lp-lb-mk  { background:#7c3aed; border-radius:50%; }
.dqp-pal .lp-lb-am  { background:#7c3aed; border-radius:50%; position:relative; }
.dqp-pal .lp-lb-am::after {
    content:''; position:absolute; bottom:-3px; right:-4px;
    width:11px; height:11px; border-radius:2px; border:1.5px solid #fff;
    background:#16a34a; display:block;
}
.dqp-pal .lp-sec {
    background:#1e3f7a; color:#fff;
    font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.08em;
    padding:5px 12px; flex-shrink:0;
}
.dqp-pal .lp-scroll { flex:1; overflow-y:auto; padding:8px 10px; }
.dqp-pal .lp-grid   { display:grid; grid-template-columns:repeat(5,1fr); gap:5px; }
.dqp-pal .lp-q {
    aspect-ratio:1; display:flex; align-items:center; justify-content:center;
    font-size:11px; font-weight:700; color:#fff; border-radius:4px;
    cursor:pointer; background:#94a3b8; transition:transform .1s;
}
.dqp-pal .lp-q:hover  { transform:scale(1.1); }
.dqp-pal .lp-q.lp-nv  { background:#94a3b8; }
.dqp-pal .lp-q.lp-na  { background:#dc2626; }
.dqp-pal .lp-q.lp-ans { background:#16a34a; }
.dqp-pal .lp-q.lp-mk  { background:#7c3aed; border-radius:50%; }
.dqp-pal .lp-q.lp-am  { background:#7c3aed; border-radius:50%; }
.dqp-pal .lp-q.lp-cur { outline:3px solid #f59e0b; outline-offset:1px; }

.dqp-pal .lp-btns  { padding:8px 10px 10px; display:flex; flex-direction:column; gap:5px; border-top:1px solid #e5e7eb; flex-shrink:0; }
.dqp-pal .lp-btn {
    width:100%; padding:7px 10px; border:none; border-radius:6px;
    font-size:11.5px; font-weight:600; cursor:pointer; transition:opacity .15s;
}
.dqp-pal .lp-btn:hover { opacity:.85; }
.dqp-pal .lp-btn-sm  { background:#fff3cd; color:#92400e; border:1px solid #fde68a; }
.dqp-pal .lp-btn-mk  { background:#ede9fe; color:#6d28d9; border:1px solid #ddd6fe; }
.dqp-pal .lp-btn-cl  { background:#fee2e2; color:#b91c1c; border:1px solid #fecaca; }
.dqp-pal .lp-btn-sn  { background:linear-gradient(135deg,#22c55e,#16a34a); color:#fff; }
.dqp-pal .lp-btn-sub { background:linear-gradient(135deg,#4f46e5,#6366f1); color:#fff; }

/* ── TIME'S UP OVERLAY ───────────────────────────────────────────────────── */
.dqp-timeup-overlay {
    display:none; position:fixed; inset:0;
    background:rgba(0,0,0,.7); z-index:99999999;
    align-items:center; justify-content:center;
}
.dqp-timeup-overlay.show { display:flex; }
.dqp-cup-box {
    background:#fff; border-radius:16px; padding:36px 40px; text-align:center;
    box-shadow:0 8px 40px rgba(0,0,0,.3); max-width:340px;
}

/* ── RESPONSIVE ──────────────────────────────────────────────────────────── */
/* Same inline-collapsible + paginated-grid + swipe mobile pattern used across
   booster.css / categorized.css / fulllength.css — see pyq.js buildPalette
   for the FIX-M1 rationale (position:fixed breaks under WP theme transforms). */
/* FIX-M1: mobile no longer uses position:fixed for the palette (WordPress
   themes commonly apply a transform to <body> for their own mobile-menu
   animation, which silently breaks position:fixed everywhere below it — the
   panel then drifts with the page instead of staying pinned to the screen).
   Instead .dqp-pal-inline sits in normal document flow right after the
   question area, with the grid/legend/action-buttons collapsed by default
   behind a "Palette ▾" toggle so it doesn't eat permanent screen space. */
@media (max-width: 700px) {
    .dqp-question-area { margin-right: 0; padding: 18px 16px; position: relative; }
    .dqp-pal-inline {
        position: static !important;
        width: 100% !important;
        max-height: none !important;
        margin: 14px 0 0 !important;
        border: 1px solid #c2cfe0 !important;
        border-radius: 12px !important;
        box-shadow: 0 2px 10px rgba(0,0,0,.08) !important;
    }
    .dqp-pal-inline .lp-hdr { border-radius: 11px 11px 0 0; flex-wrap: nowrap; }
    .dqp-pal-inline .lp-toggle {
        flex-shrink: 0; display: flex; align-items: center; gap: 4px;
        background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.35);
        color: #fff; font-size: 11.5px; font-weight: 700;
        padding: 6px 10px; border-radius: 6px; cursor: pointer;
    }
    .dqp-pal-inline .lp-toggle:active { background: rgba(255,255,255,.28); }
    .dqp-pal-inline .lp-toggle-chev { font-size: 11px; }
    .dqp-pal-inline .lp-scroll { max-height: 46vh; }
    .dqp-screen-start, .dqp-screen-result { padding: 28px 16px; }
    .dqp-review-header, .dqp-review-list  { padding-left: 16px; padding-right: 16px; }
}

/* ── Syllabus / Category Coverage panel (Full-Length Test start screen) ── */
.dqp-syllabus {
    margin: 18px 0;
    text-align: left;
    background: #f8f7ff;
    border: 1px solid #e3ddfb;
    border-radius: 10px;
    padding: 12px 16px;
}
.dqp-syllabus summary {
    cursor: pointer;
    font-weight: 600;
    color: #5b3df0;
    outline: none;
}
.dqp-syllabus-list {
    margin: 12px 0 4px;
    padding-left: 20px;
}
.dqp-syllabus-list > li {
    margin-bottom: 10px;
}
.dqp-syllabus-list ul {
    margin: 4px 0 0 0;
    padding-left: 18px;
    color: #555;
    font-size: 13px;
}
.dqp-syllabus-list ul li {
    margin-bottom: 2px;

    /* ── Mobile arrow tab: replaces the header "Palette ▾" toggle as the
       primary way to open the question grid; tucks against the right edge
       of the question card so it's reachable with a thumb. ────────────── */
    .dqp-pal-inline .lp-hdr .lp-toggle { display: none; }

    .dqp-navtab {
        position: absolute;
        top: 50%;
        right: 0;
        transform: translateY(-50%);
        width: 28px;
        height: 56px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: linear-gradient(135deg,#6366f1,#8b5cf6);
        border: none;
        border-radius: 10px 0 0 10px;
        color: #fff;
        box-shadow: -2px 2px 10px rgba(0,0,0,.2);
        cursor: pointer;
        z-index: 20;
    }
    .dqp-navtab:active, .dqp-navtab-open { background: linear-gradient(135deg,#4f46e5,#7c3aed); }
    .dqp-navtab-arrow { font-size: 20px; line-height: 1; transform: translateX(1px); }

    .dqp-hint {
        display: none;
        position: absolute;
        top: calc(50% - 50px);
        right: 32px;
        max-width: 160px;
        background: #1e293b;
        color: #fff;
        font-size: 11.5px;
        line-height: 1.4;
        padding: 8px 10px;
        border-radius: 8px;
        box-shadow: 0 4px 14px rgba(0,0,0,.25);
        z-index: 21;
    }
    .dqp-hint::after {
        content: '';
        position: absolute;
        top: 100%;
        right: 10px;
        border: 6px solid transparent;
        border-top-color: #1e293b;
    }

    .dqp-nudge {
        display: none;
        position: absolute;
        left: 50%;
        bottom: 10px;
        transform: translateX(-50%);
        max-width: 90%;
        background: #fef3c7;
        border: 1px solid #f59e0b;
        color: #92400e;
        font-size: 12px;
        line-height: 1.4;
        text-align: center;
        padding: 9px 14px;
        border-radius: 20px;
        box-shadow: 0 4px 14px rgba(0,0,0,.15);
        z-index: 21;
    }

    /* ── Full-screen question-palette modal (replaces the old inline
       slide-down panel) — position is computed in JS from scrollY, so it
       is immune to the position:fixed/ancestor-transform issue noted in
       FIX-M1 above. The header (name/timer) stays visible in place. ──── */
    .dqp-pal-inline { position: relative !important; }

    .dqp-pal-inline .lp-collapsible { display: none; }
    /* When open this is detached and appended to <body> (see openPalette),
       so it's no longer inside .dqp-pal-inline's overflow:hidden card — this
       rule intentionally does NOT require that ancestor. */
    .dqp-collapsible-open {
        display: flex !important;
        flex-direction: column;
        position: absolute;
        left: 0;
        width: 100%;
        background: #f4f6fb;
        z-index: 999999;
        overflow-y: auto;
        box-shadow: 0 10px 30px rgba(0,0,0,.3);
        padding-bottom: 18px;
    }
    .dqp-collapsible-open .lp-scroll {
        flex: 1; max-height: none;
        overflow-y: auto; overflow-x: hidden;
        padding: 8px 10px 6px; background: #fff;
    }
    .dqp-collapsible-open .lp-btns { flex-shrink: 0; }

    /* Everything below is deliberately self-contained (does NOT rely on a
       .dqp-pal ancestor) — .lp-collapsible is detached and appended straight
       to <body> when opened (see openPalette in the matching JS file), so
       it loses every ".dqp-pal .lp-xxx" rule above. Without these duplicates
       the legend/grid/section-header render as a bare unstyled list. */
    .dqp-collapsible-open .lp-legend {
        display: grid; grid-template-columns: 1fr 1fr;
        gap: 6px 8px; padding: 12px 14px 10px;
        background: #f5f8fc; border-bottom: 1px solid #dde4ef; flex-shrink: 0;
    }
    .dqp-collapsible-open .lp-leg-row { display:flex; align-items:center; gap:7px; font-size:12px; color:#374151; font-weight:500; line-height:1.3; }
    .dqp-collapsible-open .lp-full { grid-column: 1 / -1; }
    .dqp-collapsible-open .lp-lb {
        width:24px; height:24px; min-width:24px;
        display:inline-flex; align-items:center; justify-content:center;
        font-size:11px; font-weight:700; color:#fff;
        flex-shrink:0; position:relative; line-height:1;
    }
    .dqp-collapsible-open .lp-lb-nv  { background:#94a3b8; border-radius:5px; }
    .dqp-collapsible-open .lp-lb-na  { background:#dc2626; border-radius:5px; }
    .dqp-collapsible-open .lp-lb-ans { background:#16a34a; border-radius:5px; }
    .dqp-collapsible-open .lp-lb-mk  { background:#7c3aed; border-radius:50%; }
    .dqp-collapsible-open .lp-lb-am  { background:#7c3aed; border-radius:50%; overflow:visible; }
    .dqp-collapsible-open .lp-lb-am::after {
        content:''; position:absolute; bottom:-3px; right:-4px;
        width:12px; height:12px; border-radius:2px; border:1.5px solid #fff;
        background:#16a34a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 11 11'%3E%3Crect x='2.5' y='2.5' width='6' height='1.1' rx='.4' fill='white'/%3E%3Crect x='2.5' y='4.8' width='6' height='1.1' rx='.4' fill='white'/%3E%3Crect x='2.5' y='7.1' width='4' height='1.1' rx='.4' fill='white'/%3E%3C/svg%3E") center/contain no-repeat;
    }
    .dqp-collapsible-open .lp-sec {
        background:#1e3f7a; color:#fff;
        font-size:12px; font-weight:700;
        padding:8px 14px; letter-spacing:.7px;
        text-transform:uppercase; flex-shrink:0;
    }
    .dqp-collapsible-open .lp-grid {
        display: grid !important;
        grid-template-columns: repeat(6,1fr) !important;
        gap: 7px !important;
        width: 100% !important; box-sizing: border-box !important;
    }
    .dqp-collapsible-open .lp-q {
        display:flex !important; align-items:center !important; justify-content:center !important;
        aspect-ratio:1/1 !important; width:100% !important;
        font-size:13px !important; font-weight:700 !important;
        cursor:pointer !important; user-select:none !important;
        color:#fff !important; position:relative !important;
        box-sizing:border-box !important; line-height:1 !important; border-radius:5px;
    }
    .dqp-collapsible-open .lp-nv  { background:#94a3b8 !important; border-radius:5px !important; }
    .dqp-collapsible-open .lp-na  { background:#dc2626 !important; border-radius:5px !important; }
    .dqp-collapsible-open .lp-ans { background:#16a34a !important; border-radius:5px !important; }
    .dqp-collapsible-open .lp-mk  { background:#7c3aed !important; border-radius:50% !important; }
    .dqp-collapsible-open .lp-am  { background:#7c3aed !important; border-radius:50% !important; overflow:visible !important; }
    .dqp-collapsible-open .lp-am::after {
        content:'' !important; position:absolute !important; bottom:-3px !important; right:-4px !important;
        width:11px !important; height:11px !important;
        border-radius:2px !important; border:1.5px solid #fff !important; z-index:3 !important;
        background:#16a34a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 11 11'%3E%3Crect x='2.5' y='2.5' width='6' height='1.1' rx='.4' fill='white'/%3E%3Crect x='2.5' y='4.8' width='6' height='1.1' rx='.4' fill='white'/%3E%3Crect x='2.5' y='7.1' width='4' height='1.1' rx='.4' fill='white'/%3E%3C/svg%3E") center/contain no-repeat !important;
    }
    .dqp-collapsible-open .lp-cur {
        background:#1d4ed8 !important; border-radius:5px !important;
        box-shadow:0 3px 10px rgba(29,78,216,.4) !important;
    }

    /* Question hidden by mobile pagination (see .lp-pager below). Needs the
       compound ".dqp-pal .lp-q" / ".dqp-collapsible-open .lp-q" specificity
       to reliably beat the "display:flex !important" colour-state rules. */
    .dqp-pal .lp-q.lp-q-hidden,
    .dqp-collapsible-open .lp-q.lp-q-hidden {
        display: none !important;
    }

    /* ── Mobile pager: shows 20 questions per "page" with prev/next arrows
       instead of one long scroll — only appears when a set has more than
       20 questions. */
    .dqp-pal .lp-pager,
    .dqp-collapsible-open .lp-pager {
        align-items: center; justify-content: center; gap: 16px;
        padding: 10px 12px; border-top: 1px solid #dde4ef;
        background: #eef2f9; flex-shrink: 0;
    }
    .dqp-pal .lp-pager-btn,
    .dqp-collapsible-open .lp-pager-btn {
        width: 34px; height: 34px; border-radius: 50%; border: none;
        background: linear-gradient(135deg,#1a3a6b,#1e5baa); color: #fff;
        font-size: 19px; line-height: 1; cursor: pointer;
        display: flex; align-items: center; justify-content: center;
        flex-shrink: 0;
    }
    .dqp-pal .lp-pager-btn:disabled,
    .dqp-collapsible-open .lp-pager-btn:disabled { opacity: .35; cursor: default; }
    .dqp-pal .lp-pager-label,
    .dqp-collapsible-open .lp-pager-label {
        font-size: 12px; font-weight: 700; color: #1e3f7a;
        min-width: 96px; text-align: center;
    }

    .dqp-navtab { z-index: 1000000; transition: top .15s; }
    .dqp-navtab-open { background: linear-gradient(135deg,#4f46e5,#7c3aed); }
    .dqp-start, .dqp-result { padding: 28px 16px; }
    .dqp-review-header, .dqp-review-list { padding-left: 16px; padding-right: 16px; }
    .dqp-start-meta { flex-direction: column; align-items: center; gap: 10px; }
    .dqp-pal .lp-scroll { touch-action: pan-y; }
}

/* ── Match-the-Following table (rendered from pipe-table markdown) ── */
.dqp-match-table { width:100%; border-collapse:collapse; margin:10px 0 16px; font-size:14px; border-radius:6px; overflow:hidden; }
.dqp-match-table th { background:#e8edf8; font-weight:600; text-align:left; padding:8px 14px; border:1px solid #c8d3e8; color:#1e293b; }
.dqp-match-table td { padding:7px 14px; border:1px solid #dde4f0; color:#334155; vertical-align:top; }
.dqp-match-table tbody tr:nth-child(even) { background:#f6f8fc; }

/* FIX (match-table-image-fix): a match-the-following cell can itself be a
   picture (e.g. chemical-structure diagrams) instead of text — keep it
   from overflowing/stretching the table cell or row. */
.dqp-cell-img { display:block; max-width:100%; max-height:120px; height:auto; margin:2px 0; border-radius:4px; }

/* ── Numbered stem list (Arrange / Choose-correct questions) ── */
.dqp-stem-list { margin:8px 0 10px 18px; padding:0; }
.dqp-stem-list li { color:#334155; font-size:14px; line-height:1.6; margin-bottom:4px; }

/* ── Multi-paragraph question text ── */
.dqp-qpara { margin:0 0 8px; color:#1e293b; font-size:15px; line-height:1.65; }

/* ── Question figure (e.g. "Observe the given figure and answer") ── */
.dqp-qimg-wrap { margin: 4px 0 18px; text-align: center; }
.dqp-qimg {
    max-width: 100%;
    max-height: 360px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* ── PASSAGE BOX — shown separately above the question stem, so a shared
   reading passage is never visually run together with the actual question
   being asked (e.g. Comprehension / Assertion-Reason style PYQs). ────────── */
.dqp-passage-box {
    background: linear-gradient(180deg, #faf9ff 0%, #f5f3ff 100%);
    border: 1px solid #e0d9fb;
    border-left: 4px solid #7c3aed;
    border-radius: 10px;
    padding: 0;
    margin: 0 0 18px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(124, 58, 237, 0.06);
}
.dqp-passage-label {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(124, 58, 237, 0.08);
    margin: 0;
    padding: 8px 16px;
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .08em; color: #6d28d9;
    border-bottom: 1px solid #e0d9fb;
}
.dqp-passage-label::before { content: "📄"; font-size: 12px; }
.dqp-passage-text {
    font-size: 14.5px; line-height: 1.8; color: #3f3a52;
    padding: 16px 18px;
    max-height: 260px; overflow-y: auto;
}
.dqp-passage-text p { margin: 0 0 10px; }
.dqp-passage-text p:last-child { margin-bottom: 0; }
.dqp-passage-text::-webkit-scrollbar { width: 6px; }
.dqp-passage-text::-webkit-scrollbar-thumb { background: #ddd6fe; border-radius: 4px; }
.dqp-passage-text::-webkit-scrollbar-track { background: transparent; }
