/* ========================================================
 *  Mini Reading Practice — Frontend CSS
 *  Test page + Result page (split-pane reader)
 * ======================================================== */

/* === 9Reading brand palette ===
 * Coral       #C8442C   primary accent (buttons, active states)
 * Ink         #1A1816   primary text
 * Highlight   #FFE34A   support-sentence highlight, marker accents
 * Moss        #2F5D3A   success/correct answers
 * Cream       #FBFAF6   page background (lightest)
 * Cream Deep  #F4EFE2   panel/card surface (slightly deeper)
 */
:root {
    --mrp-coral: #C8442C;
    --mrp-coral-hover: #A8341E;
    --mrp-coral-soft: #F8E1DA;
    --mrp-ink: #1A1816;
    --mrp-ink-soft: #5C5853;
    --mrp-highlight: #FFE34A;
    --mrp-highlight-soft: #FFF6BD;
    --mrp-moss: #2F5D3A;
    --mrp-moss-soft: #DCEBDF;
    --mrp-cream: #FBFAF6;
    --mrp-cream-deep: #F4EFE2;
    --mrp-cream-line: #E8E2D2;   /* border based on cream-deep */
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--mrp-ink);
    background: var(--mrp-cream);
    overflow: hidden;
}

.mrp-body {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ===== HEADER ===== */
.mrp-header {
    height: 56px;
    flex-shrink: 0;
    background: var(--mrp-cream);
    border-bottom: 1px solid var(--mrp-cream-line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 10;
}
.mrp-header-left, .mrp-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}
.mrp-logo-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    line-height: 0;
}
.mrp-logo-img {
    height: 28px;
    width: auto;
    display: block;
}
.mrp-test-title {
    display: none;
}
.mrp-timer {
    font-family: ui-monospace, monospace;
    font-size: 16px;
    font-weight: 600;
    color: var(--mrp-ink);
    background: var(--mrp-cream-deep);
    padding: 6px 14px;
    border-radius: 8px;
}
.mrp-score-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--mrp-moss-soft);
    border: 1px solid var(--mrp-moss);
    color: var(--mrp-moss);
    padding: 6px 14px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 14px;
}
.mrp-score-num { font-size: 16px; font-weight: 700; }
.mrp-score-pct { opacity: 0.7; font-size: 13px; }

/* ===== BUTTONS ===== */
.mrp-btn {
    background: #ffffff;
    border: 1px solid var(--mrp-cream-line);
    color: var(--mrp-ink);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: all 0.15s;
}
.mrp-btn:hover { background: var(--mrp-cream-deep); }
.mrp-btn-primary {
    background: var(--mrp-coral);
    border-color: var(--mrp-coral);
    color: #ffffff;
}
.mrp-btn-primary:hover { background: var(--mrp-coral-hover); border-color: var(--mrp-coral-hover); }
.mrp-btn-large { padding: 12px 28px; font-size: 15px; }

/* ===== MAIN SPLIT LAYOUT ===== */
.mrp-main {
    flex: 1;
    display: flex;
    overflow: hidden;
    background: var(--mrp-cream);
}
.mrp-pane {
    overflow: hidden;
    background: #ffffff;
}
.mrp-pane-passage   { width: 50%; min-width: 280px; }
.mrp-pane-questions { flex: 1;     min-width: 280px; background: var(--mrp-cream); }

.mrp-pane-inner {
    height: 100%;
    overflow-y: auto;
    padding: 24px 32px;
}
.mrp-pane-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--mrp-cream-line);
}
.mrp-pane-header h2 {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--mrp-ink-soft);
    text-transform: uppercase;
    letter-spacing: 1.4px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.mrp-pane-header h2::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 2px;
    background: var(--mrp-coral);
    flex-shrink: 0;
}
.mrp-qcount, .mrp-hint-text {
    font-size: 13px;
    color: var(--mrp-ink-soft);
}

/* ===== RESIZER ===== */
.mrp-resizer {
    width: 6px;
    background: transparent;
    cursor: col-resize;
    flex-shrink: 0;
    transition: background 0.15s;
    position: relative;
}
.mrp-resizer:hover, .mrp-resizer.active {
    background: var(--mrp-coral-soft);
}
.mrp-resizer::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 24px;
    background: var(--mrp-cream-line);
    border-radius: 2px;
}

/* ===== PASSAGE ===== */
.mrp-passage-content {
    font-size: 15px;
    line-height: 1.8;
    color: var(--mrp-ink);
    max-width: 720px;
}
.mrp-sentence {
    transition: background-color 0.3s, box-shadow 0.3s;
    border-radius: 3px;
    padding: 1px 2px;
}

/* HIGHLIGHT — uses brand Highlight (#FFE34A) softened */
.mrp-sentence.mrp-highlight {
    background: var(--mrp-highlight-soft);
    box-shadow: 0 0 0 2px var(--mrp-highlight);
    color: var(--mrp-ink);
    font-weight: 500;
}
.mrp-sentence.mrp-highlight-flash {
    animation: mrpHighlightFlash 0.6s ease-out;
}
@keyframes mrpHighlightFlash {
    0%   { background: var(--mrp-highlight); transform: scale(1); }
    50%  { background: var(--mrp-highlight); transform: scale(1.01); }
    100% { background: var(--mrp-highlight-soft); transform: scale(1); }
}

/* ===== QUESTIONS (test page) ===== */
.mrp-q {
    background: #ffffff;
    border: 1px solid var(--mrp-cream-line);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    gap: 12px;
    box-shadow: 0 1px 2px rgba(26, 24, 22, 0.04);
}
.mrp-q-num {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--mrp-coral-soft);
    color: var(--mrp-coral-hover);
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mrp-q-content { flex: 1; min-width: 0; }
.mrp-q-text {
    margin: 0 0 12px;
    font-size: 14px;
    line-height: 1.6;
    color: #1e293b;
    font-weight: 500;
}
.mrp-q-text.mrp-q-fill input {
    display: inline-block;
    border: none;
    border-bottom: 2px solid #cbd5e1;
    padding: 2px 8px;
    margin: 0 4px;
    font-family: inherit;
    font-size: 14px;
    width: 160px;
    background: #f8fafc;
    transition: border-color 0.2s;
}
.mrp-q-text.mrp-q-fill input:focus {
    outline: none;
    border-color: var(--mrp-coral);
    background: #fff;
}

/* Options (radio) */
.mrp-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.mrp-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 14px;
}
.mrp-option:hover { border-color: #93c5fd; background: #f8fbff; }
.mrp-option:has(input:checked) {
    background: var(--mrp-coral-soft);
    border-color: var(--mrp-coral);
}
.mrp-option input {
    accent-color: var(--mrp-coral);
    margin: 0;
}
.mrp-option .mrp-letter {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f1f5f9;
    color: #475569;
    font-weight: 700;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.mrp-option:has(input:checked) .mrp-letter {
    background: var(--mrp-coral);
    color: #ffffff;
}

/* Sentence completion fill input */
.mrp-fill {
    display: inline-block;
    border: none;
    border-bottom: 2px solid #cbd5e1;
    padding: 2px 8px;
    margin: 0 4px;
    font-family: inherit;
    font-size: 14px;
    width: 160px;
    background: #f8fafc;
}
.mrp-fill:focus {
    outline: none;
    border-color: var(--mrp-coral);
    background: #fff;
}

/* Matching select */
.mrp-select {
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    min-width: 180px;
}

/* ===== MODAL ===== */
.mrp-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mrp-modal-dialog {
    background: #ffffff;
    border-radius: 12px;
    padding: 28px;
    width: 420px;
    max-width: calc(100vw - 32px);
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.mrp-modal-dialog h3 {
    margin: 0 0 12px;
    font-size: 18px;
    color: #0f172a;
}
.mrp-modal-dialog p {
    margin: 0 0 20px;
    color: #475569;
    line-height: 1.6;
}
.mrp-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ===== RESULT PAGE ===== */
.mrp-result-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.mrp-q-result {
    background: #ffffff;
    border: 1px solid var(--mrp-cream-line);
    border-left: 4px solid var(--mrp-cream-line);
    border-radius: 10px;
    padding: 14px 16px;
    transition: box-shadow 0.15s;
    box-shadow: 0 1px 2px rgba(26, 24, 22, 0.04);
}
.mrp-q-result.is-correct { border-left-color: var(--mrp-moss); }
.mrp-q-result.is-wrong   { border-left-color: var(--mrp-coral); }
.mrp-q-result.is-skip    { border-left-color: var(--mrp-highlight); }

.mrp-q-result.mrp-q-active {
    box-shadow: 0 0 0 2px var(--mrp-coral-soft);
    border-left-color: var(--mrp-coral);
}

.mrp-q-result-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.mrp-q-result .mrp-q-num {
    width: 28px;
    height: 28px;
    font-size: 12px;
    background: var(--mrp-cream-deep);
    color: var(--mrp-ink);
}
.mrp-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    text-transform: capitalize;
    letter-spacing: 0.2px;
}
.mrp-badge-correct { background: var(--mrp-moss-soft);    color: var(--mrp-moss); }
.mrp-badge-wrong   { background: var(--mrp-coral-soft);   color: var(--mrp-coral); }
.mrp-badge-skip    { background: var(--mrp-highlight-soft); color: #7A5C00; }

.mrp-answer-row {
    display: flex;
    gap: 12px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.mrp-answer-cell {
    flex: 1;
    min-width: 140px;
    background: #f8fafc;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}
.mrp-answer-cell.mrp-answer-correct {
    background: #ecfdf5;
    border-color: #a7f3d0;
}
.mrp-answer-label {
    display: block;
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}
.mrp-answer-cell.mrp-answer-correct .mrp-answer-label { color: #047857; }
.mrp-answer-value {
    font-weight: 600;
    color: #1e293b;
    font-size: 14px;
}
.mrp-answer-correct .mrp-answer-value { color: #065f46; }

/* Explanation toggle — bold uppercase like the screenshot */
.mrp-explain-toggle {
    margin-top: 10px;
    background: transparent;
    border: 0;
    color: var(--mrp-ink);
    padding: 6px 0;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    text-decoration: underline;
    text-underline-offset: 4px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: opacity 0.15s;
}
.mrp-explain-toggle:hover { opacity: 0.7; }
.mrp-explain-toggle.is-open {
    background: transparent;
    border: 0;
    color: var(--mrp-ink);
}
.mrp-explain-arrow {
    font-size: 10px;
    transition: transform 0.2s;
}
.mrp-explain-toggle.is-open .mrp-explain-arrow {
    transform: rotate(180deg);
}

/* Explanation box — cream-deep bg with moss left border (matches screenshot) */
.mrp-explain-box {
    margin-top: 10px;
    background: var(--mrp-cream-deep);
    border: 0;
    border-left: 4px solid var(--mrp-moss);
    border-radius: 6px;
    padding: 14px 16px;
}
.mrp-explain-text {
    margin: 0 0 8px;
    color: var(--mrp-ink);
    line-height: 1.65;
    font-size: 13px;
}
.mrp-explain-sentence {
    display: block;
    margin-bottom: 8px;
}
.mrp-explain-sentence:last-child {
    margin-bottom: 0;
}
/* Emphasis (*text*) — used in analytical explains to flag the English term
 * being paraphrased. Rendered BOLD (not italic) per request — đọc rõ hơn,
 * không nghiêng. Slightly muted color so it reads as "this is what's being
 * analyzed" not "this is the conclusion". */
.mrp-explain-text em,
.mrp-explain-sentence em {
    font-style: normal;
    font-weight: 700;
    color: #A23420;
}
.mrp-explain-lead {
    font-weight: 600;
    color: var(--mrp-moss);
}
/* Inline passage quote — monospace pill on cream background, signals
 * "this is a direct quote from the reading passage".
 * display:inline + box-decoration-break:clone → background ôm sát text
 * từng dòng (mỗi dòng 1 pill riêng) thay vì 1 hộp full-width chiếm cả
 * khoảng trống khi quote xuống nhiều dòng. */
.mrp-explain-text .mrp-quote,
.mrp-explain-sentence .mrp-quote {
    display: inline;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
    background: var(--mrp-cream);
    color: var(--mrp-ink);
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.92em;
    padding: 1px 7px;
    border-radius: 4px;
    border: 1px solid var(--mrp-cream-line);
    margin: 0 1px;
    /* tránh chữ dính sát nhau giữa các dòng khi pill wrap */
    line-height: 2;
}
/* Bold emphasis inside explain — wrapped via **text** markdown */
.mrp-explain-text strong,
.mrp-explain-sentence strong {
    font-weight: 700;
    color: var(--mrp-ink);
}
.mrp-explain-letter {
    display: inline-block;
    padding: 0 4px;
    margin: 0 1px;
    background: var(--mrp-coral-soft);
    color: var(--mrp-coral);
    border-radius: 3px;
    font-weight: 600;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.mrp-explain-letter.mrp-explain-roman {
    background: var(--mrp-coral-soft);
    color: var(--mrp-coral);
    font-style: italic;
    font-weight: 700;
}
.mrp-explain-meta {
    margin: 8px 0 0;
    padding-top: 10px;
    border-top: 1px dashed var(--mrp-cream-line);
    color: var(--mrp-ink-soft);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.mrp-meta-icon { font-size: 14px; }
.mrp-explain-meta b {
    background: var(--mrp-moss-soft);
    color: var(--mrp-moss);
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: ui-monospace, monospace;
    font-size: 11px;
}
.mrp-meta-hint { font-style: italic; opacity: 0.8; }

/* Mobile */
@media (max-width: 900px) {
    .mrp-main { flex-direction: column; }
    .mrp-pane-passage,
    .mrp-pane-questions { width: 100% !important; min-width: 0; }
    .mrp-pane-passage { height: 40%; flex-shrink: 0; }
    .mrp-pane-questions { flex: 1; }
    .mrp-resizer { display: none; }
    .mrp-test-title { display: none; }
}

/* =============== BLOCK / GROUP STYLING =============== */
.mrp-block, .mrp-result-block {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px dashed #e2e8f0;
}
.mrp-block:last-child, .mrp-result-block:last-child {
    border-bottom: 0;
}
.mrp-block-header, .mrp-result-block-head {
    margin-bottom: 16px;
    padding-bottom: 0;
}
.mrp-block-header h3,
.mrp-result-block-head h3 {
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 700;
    color: var(--mrp-ink-soft);
    text-transform: uppercase;
    letter-spacing: 1.4px;
    display: flex;
    align-items: center;
    gap: 10px;
}
/* Coral dash marker before section labels — matches brand style guide */
.mrp-block-header h3::before,
.mrp-result-block-head h3::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 2px;
    background: var(--mrp-coral);
    flex-shrink: 0;
}
.mrp-block-instr {
    margin: 4px 0 8px;
    font-size: 13px;
    color: var(--mrp-ink-soft);
    font-style: italic;
}

/* =============== Option list (matching types) =============== */
.mrp-option-list {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 14px;
    margin: 8px 0 12px;
}
.mrp-option-list-title {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 700;
    color: #1e293b;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.mrp-option-row {
    font-size: 13px;
    line-height: 1.7;
    color: #334155;
}
.mrp-option-row b {
    display: inline-block;
    min-width: 24px;
    color: var(--mrp-coral-hover);
    font-family: ui-monospace, monospace;
}

/* =============== Summary completion =============== */
.mrp-summary-block {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
}
.mrp-summary-title {
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
}
.mrp-summary-text {
    font-size: 14px;
    line-height: 1.9;
    color: #1e293b;
}

/* Structured summary (IELTS "Complete the notes" — heading + bullets) */
.mrp-summary-text .mrp-summary-heading {
    margin: 14px 0 6px;
    font-size: 14.5px;
    font-weight: 700;
    color: #0f172a;
}
.mrp-summary-text .mrp-summary-heading:first-child { margin-top: 0; }
.mrp-summary-text .mrp-summary-list {
    margin: 0 0 6px;
    padding-left: 22px;
    list-style: disc outside;
}
.mrp-summary-text .mrp-summary-list li {
    margin: 4px 0;
    line-height: 1.8;
}

/* ── Summary / Table Completion — table layout ───────────────────── */
.mrp-summary-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.mrp-summary-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 14px;
    line-height: 1.7;
    color: #1e293b;
}
.mrp-summary-table th,
.mrp-summary-table td {
    border: 1px solid #d8dee9;
    padding: 12px 14px;
    text-align: left;
    vertical-align: top;
}
.mrp-summary-table thead th {
    background: #f1f5f9;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
}
.mrp-summary-table tbody td:first-child {
    font-weight: 600;
    white-space: nowrap;
}
.mrp-summary-table-result th,
.mrp-summary-table-result td { vertical-align: middle; }
.mrp-summary-blank {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0 2px;
}
.mrp-summary-num {
    background: var(--mrp-coral-soft);
    color: var(--mrp-coral-hover);
    font-weight: 700;
    font-size: 11px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* =============== MC multi (test page) =============== */
.mrp-q-multi .mrp-mc-options-readonly {
    margin-bottom: 12px;
}
.mrp-option-static {
    cursor: default;
}
.mrp-multi-selects {
    background: #f1f5f9;
    border-radius: 8px;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
}
.mrp-multi-label {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
}
.mrp-multi-select {
    margin-right: 6px;
    margin-bottom: 4px;
}

/* =============== MC result list =============== */
.mrp-mc-result-list {
    list-style: none;
    margin: 8px 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.mrp-mc-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    color: #475569;
}
.mrp-mc-result-item .mrp-letter {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f1f5f9;
    color: #475569;
    font-weight: 700;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.mrp-mc-result-item.mrp-mc-correct-letter {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
    font-weight: 600;
}
.mrp-mc-result-item.mrp-mc-correct-letter .mrp-letter {
    background: #10b981;
    color: #fff;
}
.mrp-mc-result-item.mrp-mc-picked {
    box-shadow: 0 0 0 2px #93c5fd;
}
.mrp-mc-result-item.mrp-mc-wrong-pick {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}
.mrp-mc-result-item.mrp-mc-wrong-pick .mrp-letter {
    background: #ef4444;
    color: #fff;
}

/* =============== Inline answers (sentence/summary completion) =============== */
.mrp-answer-inline {
    display: inline-block;
    border-bottom: 2px solid #cbd5e1;
    padding: 1px 8px;
    margin: 0 2px;
    font-weight: 600;
    border-radius: 3px 3px 0 0;
    min-width: 60px;
    text-align: center;
}
.mrp-answer-inline.mrp-corr  { background: #ecfdf5; color: #065f46; border-color: #10b981; }
.mrp-answer-inline.mrp-wrong { background: #fef2f2; color: #991b1b; border-color: #ef4444; text-decoration: line-through; }
.mrp-answer-inline.mrp-skip  { background: #fffbeb; color: #92400e; border-color: #f59e0b; }
.mrp-answer-inline-correct {
    display: inline-block;
    color: #065f46;
    background: #ecfdf5;
    border-bottom: 2px solid #10b981;
    padding: 1px 8px;
    margin-left: 4px;
    font-weight: 700;
    border-radius: 3px 3px 0 0;
}

/* =============== Summary result block =============== */
.mrp-summary-block-result {
    background: #fafbfc;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 8px;
}
.mrp-summary-result-blank {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin: 0 2px;
}

/* ===========================================================
 *  HORIZONTAL SELECT QUESTION LAYOUT
 *  Used for: matching_headings, matching_information,
 *            matching_features, matching_sentence_endings
 *  Pattern:  [#.]  [Select ▼]  [Statement text...]
 * =========================================================== */
.mrp-q-select {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 10px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: box-shadow 0.15s, border-color 0.15s;
}
.mrp-q-select:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}
.mrp-q-select .mrp-q-num {
    flex-shrink: 0;
    width: auto;
    height: auto;
    background: transparent;
    border-radius: 0;
    color: #1e293b;
    font-weight: 700;
    font-size: 16px;
    line-height: 1;
    padding-right: 4px;
    /* override flex defaults from generic .mrp-q-num */
    display: inline-block;
}

.mrp-select-inline {
    flex-shrink: 0;
    min-width: 110px;
    appearance: none;
    -webkit-appearance: none;
    background-color: #f8fafc;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M3.204 5L8 10.481 12.796 5H3.204z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 9px 32px 9px 14px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.15s;
}
.mrp-select-inline:hover {
    border-color: #94a3b8;
    background-color: #f1f5f9;
}
.mrp-select-inline:focus {
    outline: none;
    border-color: var(--mrp-coral);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    background-color: #ffffff;
}
.mrp-select-inline:invalid,
.mrp-select-inline:not(:has(option:checked[value]:not([value=""]))) {
    color: #475569;
}

.mrp-q-text-inline {
    flex: 1;
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    color: #1e293b;
    font-weight: 500;
}

/* On mobile stack vertically */
@media (max-width: 600px) {
    .mrp-q-select {
        flex-wrap: wrap;
    }
    .mrp-q-text-inline {
        flex-basis: 100%;
        font-size: 14px;
    }
}

/* ===========================================================
 *  RICH-CONTENT PASSAGE STYLING
 *  Passage now comes from TinyMCE — supports headings, lists,
 *  images, blockquotes etc. We style them inside .mrp-passage-content
 * =========================================================== */
.mrp-passage-content h1,
.mrp-passage-content h2,
.mrp-passage-content h3,
.mrp-passage-content h4 {
    font-family: inherit;
    font-weight: 700;
    color: #0f172a;
    margin: 18px 0 10px;
    line-height: 1.3;
}
.mrp-passage-content h2 { font-size: 22px; }
.mrp-passage-content h3 { font-size: 18px; }
.mrp-passage-content h4 { font-size: 16px; }

.mrp-passage-content p {
    margin: 0 0 14px;
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
    -ms-hyphens: auto;
}
.mrp-passage-content ul,
.mrp-passage-content ol {
    margin: 0 0 14px;
    padding-left: 28px;
}
.mrp-passage-content li {
    margin-bottom: 6px;
}
.mrp-passage-content blockquote {
    border-left: 3px solid #cbd5e1;
    margin: 12px 0;
    padding: 6px 0 6px 16px;
    color: #475569;
    font-style: italic;
}
.mrp-passage-content img {
    max-width: 100%;
    height: auto;
    margin: 10px 0;
    border-radius: 6px;
    display: block;
}
.mrp-passage-content a {
    color: var(--mrp-coral-hover);
    text-decoration: underline;
}
.mrp-passage-content strong { font-weight: 700; color: #0f172a; }
.mrp-passage-content em { font-style: italic; }
.mrp-passage-content code {
    background: #f1f5f9;
    padding: 1px 6px;
    border-radius: 4px;
    font-family: ui-monospace, monospace;
    font-size: 0.92em;
}

/* ===========================================================
 *  SUMMARY COMPLETION + WORD LIST (A-G)
 * =========================================================== */
.mrp-summary-wordlist-block {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 12px;
}
.mrp-wordlist {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 4px 0 16px;
}
.mrp-wordlist-title {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 700;
    color: #1e293b;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.mrp-wordlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 6px 16px;
}
.mrp-wordlist-item {
    display: flex;
    gap: 6px;
    font-size: 13px;
    line-height: 1.5;
    color: #1e293b;
}
.mrp-wordlist-letter {
    color: var(--mrp-coral-hover);
    font-weight: 700;
    min-width: 18px;
    font-family: ui-monospace, monospace;
}
.mrp-wordlist-word {
    color: #334155;
}

/* Inline blank with select dropdown */
.mrp-summary-blank-wordlist {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0 2px;
}
.mrp-select-blank {
    appearance: none;
    -webkit-appearance: none;
    background-color: #f8fafc;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M3.204 5L8 10.481 12.796 5H3.204z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 4px 24px 4px 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    cursor: pointer;
    min-width: 60px;
}
.mrp-select-blank:hover {
    border-color: #94a3b8;
    background-color: #f1f5f9;
}
.mrp-select-blank:focus {
    outline: none;
    border-color: var(--mrp-coral);
    background-color: #fff;
}
.mrp-wordlist-result {
    background: #f0f6fc;
    border-color: #bfdbfe;
}

/* =======================================================================
 *  v1.5.4 — RESULT PAGE UI REFINEMENT
 *  Make result cards compact: status as left border + tinted bg,
 *  inline "Your: — → Correct: X" format, subtle text-link explanation.
 * ======================================================================= */

/* Card — tighter padding, status as left border + bg tint */
.mrp-q-result {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-left: 3px solid transparent;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 8px;
}
.mrp-q-result.is-correct {
    border-left-color: #10b981;
    background: #f0fdf4;
    border-color: #d1fae5;
}
.mrp-q-result.is-wrong {
    border-left-color: #ef4444;
    background: #fef2f2;
    border-color: #fee2e2;
}
.mrp-q-result.is-skip {
    border-left-color: #f59e0b;
    background: #fffbeb;
    border-color: #fde68a;
}
.mrp-q-result.mrp-q-active {
    box-shadow: 0 0 0 3px rgba(59,130,246,0.25);
    border-left-color: var(--mrp-coral);
}

/* Header — number + status badge in single tight row */
.mrp-q-result .mrp-q-result-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.mrp-q-result .mrp-q-num {
    width: auto;
    height: auto;
    min-width: 0;
    background: transparent;
    color: #0f172a;
    font-weight: 700;
    font-size: 14px;
    padding: 0;
    border-radius: 0;
    display: inline;
}
.mrp-q-result .mrp-q-num::after {
    content: '.';
}

.mrp-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.5;
}
.mrp-badge-correct { background: #d1fae5; color: #047857; }
.mrp-badge-wrong   { background: #fee2e2; color: #b91c1c; }
.mrp-badge-skip    { background: #fef3c7; color: #92400e; }

/* Question text */
.mrp-q-result .mrp-q-text {
    margin: 0 0 4px;
    font-size: 14px;
    line-height: 1.5;
    color: #1f2937;
    font-weight: 500;
}

/* Inline answer row — replaces 2-column box layout */
.mrp-q-result .mrp-answer-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 0 0;
    padding: 0;
    border: 0;
    font-size: 13px;
}
.mrp-q-result .mrp-answer-cell {
    flex: none;
    background: transparent;
    padding: 0;
    border: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    border-radius: 0;
}
.mrp-q-result .mrp-answer-label {
    display: inline;
    font-size: 11px;
    color: #6b7280;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    margin: 0;
}
.mrp-q-result .mrp-answer-label::after {
    content: ':';
    margin-left: 0;
}
.mrp-q-result .mrp-answer-value {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    padding: 1px 8px;
    border-radius: 4px;
    line-height: 1.5;
    display: inline-block;
}
.mrp-q-result .mrp-answer-cell.mrp-answer-correct .mrp-answer-label {
    color: #047857;
}
.mrp-q-result .mrp-answer-cell.mrp-answer-correct .mrp-answer-value {
    background: #d1fae5;
    border-color: #a7f3d0;
    color: #065f46;
}

/* Arrow between Your and Correct */
.mrp-q-result .mrp-answer-row .mrp-answer-correct::before {
    content: '→';
    color: #94a3b8;
    font-weight: 400;
    margin-right: 2px;
}

/* Show explanation — subtle text link, no big button */
.mrp-q-result .mrp-explain-toggle {
    margin-top: 6px;
    margin-left: 0;
    background: transparent;
    border: 0;
    color: var(--mrp-coral-hover);
    padding: 0;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
}
.mrp-q-result .mrp-explain-toggle:hover {
    background: transparent;
    text-decoration: underline;
    color: #1d4ed8;
}
.mrp-q-result .mrp-explain-toggle.is-open {
    background: transparent;
    color: #1d4ed8;
    border: 0;
}
.mrp-q-result .mrp-explain-arrow {
    font-size: 9px;
}

/* Explanation box — lighter, less visual weight */
.mrp-q-result .mrp-explain-box {
    margin-top: 6px;
    background: rgba(59,130,246,0.06);
    border: 0;
    border-left: 2px solid #93c5fd;
    border-radius: 0 4px 4px 0;
    padding: 8px 10px;
}
.mrp-q-result .mrp-explain-text {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #1f2937;
}
.mrp-q-result .mrp-explain-meta {
    margin: 4px 0 0;
    font-size: 11px;
    color: #6b7280;
}

/* Result block headers — uppercase tagline style */
.mrp-result-block {
    margin-bottom: 16px;
    padding-bottom: 12px;
}
.mrp-result-block-head {
    margin-bottom: 8px;
}
.mrp-result-block-head h3 {
    margin: 0 0 4px;
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

/* MC result list — tighter spacing */
.mrp-q-result .mrp-mc-result-list {
    margin: 6px 0;
    gap: 3px;
}
.mrp-q-result .mrp-mc-result-item {
    padding: 4px 10px;
    font-size: 13px;
}

/* Option list inside result block (matching types) — lighter */
.mrp-option-list-result {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    padding: 8px 12px;
    margin: 4px 0 10px;
}
.mrp-option-list-result .mrp-option-list-title {
    font-size: 11px;
    margin-bottom: 4px;
}
.mrp-option-list-result .mrp-option-row {
    font-size: 12px;
    line-height: 1.6;
}

/* Score pill in header — compact */
.mrp-score-pill {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 999px;
    padding: 4px 14px;
}
.mrp-score-num {
    font-weight: 700;
    color: #047857;
    font-size: 15px;
}
.mrp-score-pct {
    color: #059669;
    font-size: 12px;
    font-weight: 600;
}

/* Hint text in result page header */
.mrp-hint-text {
    color: #6b7280;
    font-size: 12px;
    font-style: italic;
}

/* =======================================================================
 *  v1.5.4 — TEST PAGE QUESTION CARDS — Light tightening
 * ======================================================================= */
.mrp-q {
    padding: 12px 14px;
    margin-bottom: 8px;
    gap: 10px;
}
.mrp-q .mrp-q-num {
    width: 26px;
    height: 26px;
    font-size: 12px;
}
.mrp-q .mrp-q-text {
    margin-bottom: 8px;
}
.mrp-q .mrp-option {
    padding: 6px 10px;
    font-size: 13px;
}
.mrp-q .mrp-option .mrp-letter {
    width: 20px;
    height: 20px;
    font-size: 11px;
}

/* ===========================================================
 *  RESULT PAGE — Next test button + modal
 * =========================================================== */
.mrp-btn-primary {
    background: var(--mrp-coral-hover) !important;
    color: white !important;
    border-color: var(--mrp-coral-hover) !important;
    font-weight: 600;
}
.mrp-btn-primary:hover {
    background: #1d4ed8 !important;
    border-color: #1d4ed8 !important;
}

.mrp-type-picker {
    position: fixed;
    top: 70px;
    right: 24px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: 0 10px 32px rgba(15,23,42,0.15);
    z-index: 100;
    max-width: 320px;
}
.mrp-type-picker p {
    margin: 0 0 10px;
    font-size: 13px;
    color: #475569;
    font-weight: 500;
}
.mrp-type-picker-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.mrp-type-picker-btn {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    color: #1e293b;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
    font-family: inherit;
    font-weight: 500;
}
.mrp-type-picker-btn:hover {
    background: var(--mrp-coral-soft);
    border-color: #93c5fd;
    color: #1e40af;
}
.mrp-type-picker-cancel {
    color: #64748b !important;
    margin-top: 4px;
}

.mrp-loading-overlay-result {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.85);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
}
.mrp-loading-spinner-result {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--mrp-coral-hover);
    border-radius: 50%;
    animation: mrp-result-spin 0.8s linear infinite;
}
@keyframes mrp-result-spin { to { transform: rotate(360deg); } }
.mrp-loading-overlay-result p {
    color: #475569;
    font-weight: 500;
}

.mrp-modal-overlay-result {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.mrp-modal-content-result {
    background: white;
    border-radius: 16px;
    padding: 32px 40px;
    max-width: 440px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.mrp-modal-content-result h3 {
    margin: 0 0 12px;
    font-size: 20px;
}
.mrp-modal-content-result p {
    margin: 0 0 24px;
    color: #475569;
}
.mrp-modal-content-result .mrp-btn {
    margin: 0 4px;
}
.mrp-modal-emoji {
    font-size: 56px;
    margin-bottom: 8px;
}

/* ===========================================================
 *  RESUME / DRAFT
 * =========================================================== */
.mrp-resume-card {
    max-width: 460px !important;
    position: relative;
}
.mrp-resume-card p {
    line-height: 1.7;
    color: #334155;
}
.mrp-resume-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}
.mrp-resume-actions .mrp-btn {
    min-width: 140px;
}
.mrp-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: 0;
    background: transparent;
    color: #94a3b8;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s;
}
.mrp-modal-close:hover {
    background: #f1f5f9;
    color: #475569;
}

.mrp-saved-indicator {
    font-size: 12px;
    color: #047857;
    background: #d1fae5;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 600;
    opacity: 0;
    transform: translateY(-2px);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}
.mrp-saved-indicator.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Reuse modal styles from result page if present, otherwise define minimal */
.mrp-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.mrp-modal-content {
    background: white;
    border-radius: 16px;
    padding: 32px 40px;
    max-width: 440px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

/* ===========================================================
 *  PARAGRAPH LABELS (for matching_headings / matching_information)
 *  Auto-applied to <p data-mrp-para="A"> by passage renderer
 * =========================================================== */
[data-mrp-para] {
    position: relative;
    padding-left: 48px;
    margin-bottom: 22px;
    min-height: 36px;
}
[data-mrp-para]::before {
    content: attr(data-mrp-para);
    position: absolute;
    left: 0;
    top: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #1e40af 0%, var(--mrp-coral-hover) 100%);
    color: white;
    font-weight: 700;
    font-size: 15px;
    text-align: center;
    line-height: 32px;
    font-family: ui-sans-serif, -apple-system, system-ui, sans-serif;
    letter-spacing: 0;
    box-shadow: 0 2px 4px rgba(30, 64, 175, 0.2);
}

/* Slight indent compensation for nested content like blockquotes */
[data-mrp-para] blockquote {
    margin-left: 0;
}

/* Mobile: smaller labels */
@media (max-width: 640px) {
    [data-mrp-para] {
        padding-left: 38px;
    }
    [data-mrp-para]::before {
        width: 26px;
        height: 26px;
        font-size: 13px;
        line-height: 26px;
        border-radius: 6px;
    }
}

/* ===========================================================
 *  WORD-LEVEL HIGHLIGHT (gap-filling answer keywords)
 *  Used by result.js for sentence_completion / summary_completion
 *  (only highlights the answer word, not the whole sentence)
 * =========================================================== */
mark.mrp-word-hl {
    background: linear-gradient(180deg, transparent 60%, #fde047 60%);
    color: inherit;
    font-weight: 700;
    padding: 0 2px;
    border-radius: 2px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
    animation: mrp-word-flash 1.4s ease-in-out;
}

@keyframes mrp-word-flash {
    0%   { background: #fde047; transform: scale(1); }
    30%  { background: #facc15; transform: scale(1.05); }
    100% { background: linear-gradient(180deg, transparent 60%, #fde047 60%); transform: scale(1); }
}

/* ===========================================================
 *  ALREADY-ATTEMPTED SCREEN
 * =========================================================== */
html:has(.mrp-already-body) {
    overflow-y: auto;
    height: auto;
}
.mrp-already-body {
    background: #f8fafc;
    min-height: 100vh;
    height: auto;
    overflow-y: auto;
}
.mrp-already-main {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 50px 20px;
    min-height: calc(100vh - 70px);
}
.mrp-already-card {
    background: white;
    border-radius: 18px;
    padding: 50px 50px 40px;
    max-width: 560px;
    width: 100%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.08);
    border: 1px solid #e2e8f0;
}
.mrp-already-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    font-size: 38px;
    line-height: 72px;
    margin: 0 auto 20px;
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.25);
}
.mrp-already-icon-upgrade {
    background: linear-gradient(135deg, #E0613C 0%, #C8442C 100%);
    box-shadow: 0 6px 20px rgba(200, 68, 44, 0.28);
}
.mrp-already-card h1 {
    margin: 0 0 8px;
    font-size: 26px;
    color: #0f172a;
    font-weight: 700;
}
.mrp-already-sub {
    color: #475569;
    margin: 0 0 28px;
    font-size: 14px;
    line-height: 1.6;
}

.mrp-already-score-box {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    padding: 22px 24px;
    margin-bottom: 28px;
}
.mrp-already-score-box.is-high {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border-color: #86efac;
}
.mrp-already-score-box.is-mid {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-color: #fcd34d;
}
.mrp-already-score-box.is-low {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-color: #fca5a5;
}
.mrp-already-score-num {
    font-size: 48px;
    font-weight: 800;
    line-height: 1;
    color: #0f172a;
    font-family: ui-sans-serif, -apple-system, system-ui, sans-serif;
}
.mrp-already-score-meta {
    margin-top: 8px;
    font-size: 13px;
    color: #475569;
}

.mrp-already-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.mrp-already-actions .mrp-btn-large {
    padding: 14px 22px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
    text-decoration: none;
    display: block;
    text-align: center;
    transition: all 0.15s;
}
.mrp-already-actions .mrp-btn-primary {
    background: linear-gradient(135deg, var(--mrp-coral-hover) 0%, #1d4ed8 100%);
    color: white;
    border: 0;
}
.mrp-already-actions .mrp-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
    color: white;
}
.mrp-already-actions .mrp-btn-retake {
    background: white;
    color: #1e40af;
    border: 2px solid #c7d2fe;
}
.mrp-already-actions .mrp-btn-retake:hover {
    background: var(--mrp-coral-soft);
    border-color: #93c5fd;
    color: #1e40af;
}
.mrp-already-actions .mrp-btn-secondary {
    background: transparent;
    color: #64748b;
    border: 1px solid #e2e8f0;
}
.mrp-already-actions .mrp-btn-secondary:hover {
    background: #f8fafc;
    color: #334155;
}

.mrp-already-history {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
    text-align: left;
}
.mrp-already-history summary {
    cursor: pointer;
    color: var(--mrp-coral-hover);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    user-select: none;
}
.mrp-already-history-list {
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
}
.mrp-already-history-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 12px;
}
.mrp-already-history-when {
    flex: 1;
    color: #475569;
}
.mrp-already-history-score {
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
}
.mrp-already-history-score.is-high { background: #dcfce7; color: #166534; }
.mrp-already-history-score.is-mid  { background: #fef3c7; color: #854d0e; }
.mrp-already-history-score.is-low  { background: #fee2e2; color: #991b1b; }
.mrp-already-history-link {
    color: var(--mrp-coral-hover);
    text-decoration: none;
    font-weight: 600;
}
.mrp-already-history-link:hover {
    text-decoration: underline;
}

@media (max-width: 600px) {
    .mrp-already-card {
        padding: 36px 26px 30px;
    }
    .mrp-already-card h1 { font-size: 22px; }
    .mrp-already-score-num { font-size: 40px; }
}

/* Note explaining algorithm-led distribution */
.mrp-already-note {
    background: var(--mrp-coral-soft);
    border: 1px solid #c7d2fe;
    border-radius: 10px;
    padding: 14px 18px;
    margin: 0 0 24px;
    font-size: 13px;
    line-height: 1.6;
    color: #1e40af;
    text-align: left;
}

/* ===========================================================
 *  SHORT ANSWER QUESTIONS
 * =========================================================== */
.mrp-q-saq .mrp-q-text {
    margin-bottom: 8px;
    color: #1e293b;
}

/* ── Diagram labelling (short_answer + imageUrl) ─────────────────── */
.mrp-diagram {
    margin: 0 0 20px;
    text-align: center;
}
.mrp-diagram-title {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    text-align: center;
}
.mrp-diagram-img {
    max-width: 100%;
    height: auto;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    display: inline-block;
}
.mrp-diagram-result { margin-bottom: 16px; }
.mrp-saq-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.mrp-saq-input {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 14px;
    color: #0f172a;
}
.mrp-saq-input:focus {
    border-color: var(--mrp-coral);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.mrp-saq-limit-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 4px 10px;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    transition: all 0.15s;
}
.mrp-saq-limit-badge.is-over {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #fecaca;
}
.mrp-saq-wc {
    font-weight: 700;
}

/* SAQ result row */
.mrp-saq-answer-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 6px 0;
    margin-top: 4px;
}
.mrp-saq-label {
    font-size: 12px;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ===========================================================
 *  COPY GUARD — toast + print block
 * =========================================================== */
.mrp-copy-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.92);
    color: #fff;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    z-index: 2147483647;   /* above everything */
    pointer-events: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    animation: mrp-toast-fadein 0.18s ease-out;
}
.mrp-copy-toast.is-fadeout {
    animation: mrp-toast-fadeout 0.18s ease-in forwards;
}
@keyframes mrp-toast-fadein {
    from { opacity: 0; transform: translate(-50%, 16px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes mrp-toast-fadeout {
    from { opacity: 1; transform: translate(-50%, 0); }
    to   { opacity: 0; transform: translate(-50%, 16px); }
}

/* Block printing of test/result pages.
 *
 * Real containers: <body class="mrp-body"> and <body class="mrp-body mrp-result-body">.
 * Strategy: hide ALL descendants of .mrp-body, then add a ::before pseudo-element
 * with the "disabled" message. The ::before is not selected by `*` so it survives
 * the universal hide rule.
 */
@media print {
    body.mrp-body * {
        display: none !important;
        visibility: hidden !important;
    }
    body.mrp-body {
        display: block !important;
        background: #fff !important;
    }
    body.mrp-body::before {
        content: "🔒 Printing is disabled for this page.";
        display: block !important;
        visibility: visible !important;
        font-size: 22px;
        text-align: center;
        padding: 100px 20px;
        color: #475569;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    }
    /* Also nuke any header/footer the theme might inject outside .mrp-body */
    body > *:not(.mrp-body) {
        display: none !important;
    }
}

/* ===========================================================
 *  FEEDBACK MODAL (frontend result page)
 * =========================================================== */
.mrp-feedback-trigger {
    background: #fff;
    border: 1px solid #d1d5db;
    color: #374151;
    font-weight: 500;
}
.mrp-feedback-trigger:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.mrp-fb-modal[hidden] { display: none; }
.mrp-fb-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.mrp-fb-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
}
.mrp-fb-dialog {
    position: relative;
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
}
.mrp-fb-head {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.mrp-fb-head h3 {
    margin: 0;
    font-size: 16px;
    color: #1e293b;
}
.mrp-fb-x {
    background: none;
    border: 0;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #94a3b8;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 4px;
}
.mrp-fb-x:hover { background: #f1f5f9; color: #475569; }

.mrp-fb-body {
    padding: 20px;
    overflow-y: auto;
}
.mrp-fb-row {
    margin-bottom: 16px;
}
.mrp-fb-row label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: #374151;
    margin-bottom: 6px;
}
.mrp-fb-row select,
.mrp-fb-row textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}
.mrp-fb-row textarea {
    resize: vertical;
    line-height: 1.5;
}
.mrp-fb-counter {
    text-align: right;
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
}
.mrp-fb-types {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.mrp-fb-type {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 400 !important;
    font-size: 13px !important;
    margin: 0 !important;
    transition: background 0.15s, border-color 0.15s;
}
.mrp-fb-type:hover { background: #f9fafb; border-color: #cbd5e1; }
.mrp-fb-type input[type="radio"]:checked + span { font-weight: 600; color: #1e3a8a; }
.mrp-fb-type:has(input:checked) { background: var(--mrp-coral-soft); border-color: #93c5fd; }

.mrp-fb-error {
    padding: 10px 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    border-radius: 6px;
    font-size: 13px;
}
.mrp-fb-foot {
    padding: 14px 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #f9fafb;
    border-radius: 0 0 12px 12px;
}
@media (max-width: 600px) {
    .mrp-fb-types { grid-template-columns: 1fr; }
}

/* ============================================================
 *  v1.27.3 — Submit validation error banner
 *  Shown when user tries to submit with unanswered questions.
 *  Floats as fixed toast at top-center of viewport (v1.27.5).
 * ============================================================ */

.mrp-submit-error {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 520px;
    background: #FEF2F2;
    border: 1px solid #FCA5A5;
    border-radius: 10px;
    padding: 14px 44px 14px 18px;   /* extra right pad for × button */
    box-shadow: 0 8px 24px rgba(220, 38, 38, 0.18);
    z-index: 10000;
    animation: mrpErrSlide 0.25s ease-out;
}
.mrp-submit-error-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 0;
    background: transparent;
    color: #B91C1C;
    font-size: 22px;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.mrp-submit-error-close:hover {
    background: rgba(220, 38, 38, 0.12);
}
.mrp-submit-error-close:focus {
    outline: 2px solid #FCA5A5;
    outline-offset: 1px;
}
@keyframes mrpErrSlide {
    from { opacity: 0; transform: translate(-50%, -10px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}
.mrp-submit-error-title {
    color: #B91C1C;
    font-weight: 700;
    font-size: 14.5px;
    margin-bottom: 4px;
}
.mrp-submit-error-list {
    color: #7F1D1D;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.5;
}
.mrp-submit-error-hint {
    color: #991B1B;
    font-size: 12.5px;
    opacity: 0.85;
}

/* Flash highlight on the unanswered question */
.mrp-q-flash {
    animation: mrpQFlash 1.8s ease-out;
    border-radius: 8px;
}
@keyframes mrpQFlash {
    0%, 100% { background-color: transparent; box-shadow: none; }
    20%, 60% { background-color: #FEF3C7; box-shadow: 0 0 0 4px #FBBF24; }
}

/* ===== Public-test locked "Next test" (non-member) + hover tooltip ===== */
.mrp-next-wrap { position: relative; display: inline-flex; }
.mrp-btn-next-locked {
    background: #ffffff;
    border: 1px solid var(--mrp-cream-line);
    color: #A8A29A;
    padding: 8px 16px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    opacity: .7;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.mrp-btn-next-locked:hover { background: #ffffff; }
.mrp-next-tip {
    position: absolute;
    top: calc(100% + 9px);
    right: 0;
    background: var(--mrp-ink);
    color: #ffffff;
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
    padding: 8px 12px;
    border-radius: 8px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity .15s ease, transform .15s ease;
    box-shadow: 0 10px 26px -10px rgba(0, 0, 0, .5);
    z-index: 30;
}
.mrp-next-tip::after {
    content: "";
    position: absolute;
    bottom: 100%;
    right: 24px;
    border: 6px solid transparent;
    border-bottom-color: var(--mrp-ink);
}
.mrp-next-wrap:hover .mrp-next-tip,
.mrp-next-wrap:focus .mrp-next-tip { opacity: 1; transform: translateY(0); }
