/*
 * exam-paper.css — makes the practice-exam pages look like a real NCEA exam paper.
 *
 * Loaded ONLY by the prediction-exam-*.html pages, and every rule is scoped to
 * body.exam-paper, because .question-box is shared with every topic bank on the
 * site. Nothing here changes the page's markup or behaviour except the formula
 * panel, which main.js builds.
 *
 * What it borrows from the real papers: Times New Roman question text, Arial
 * headings / cover / tables, the cover's layout (spaced standard number, big
 * level number, grey title band, criteria table), and the dotted margin strip,
 * which here holds each question's tools so they are always visible (hover
 * does not exist on phones). No NZQA branding.
 *
 * ⚠ Targets the DOM AFTER main.js has run: groupQuestionHeaders() prepends a
 * .question-header (grade tag + empty h4 + time display) to each part, and
 * fetchAndDisplayPredictionExam() adds .mark-scheme-container blocks, the
 * marking-schedule controls and the cut scores. If the API is unreachable the
 * server-rendered questions stay (bare .grade-tag, no header) and still style.
 *
 * Each page sets its own footer line: style="--exam-footer: '...'" on <body>.
 */

body.exam-paper {
    --paper-serif: 'Times New Roman', Tinos, Times, serif;
    --paper-sans: Arial, Arimo, 'Helvetica Neue', Helvetica, sans-serif;
    --paper-rule: #cdd3d9;
    --band: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='24'%3E%3Cpath d='M6 0C10 4 10 8 6 12S2 20 6 24' fill='none' stroke='%23a3adb9' stroke-width='1.4' stroke-linecap='round' stroke-dasharray='0.1 2.7'/%3E%3C/svg%3E");
    background-color: #eceff2;
}

body.exam-paper main {
    padding: 1.6rem 1rem 3.2rem;
}

/* ===================== cover ===================== */
body.exam-paper .exam-cover-sheet {
    position: relative;
    background: #fff;
    border: 1px solid var(--paper-rule);
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(20, 30, 40, .06);
    max-width: 950px;
    margin: .4rem auto 0;
    padding: 2.2rem 3rem 1.8rem;
}
body.exam-paper .exam-cover-sheet .container { max-width: none; margin: 0; padding: 0; }

/* print corner marks, as on the real cover */
body.exam-paper .exam-cover-sheet .container::before,
body.exam-paper .exam-cover-sheet .container::after {
    content: "";
    position: absolute;
    top: 3.25rem;
    width: 11px;
    height: 11px;
    border-bottom: 1px solid #111;
}
body.exam-paper .exam-cover-sheet .container::before { left: 3rem; border-left: 1px solid #111; }
body.exam-paper .exam-cover-sheet .container::after { right: 9.6rem; border-right: 1px solid #111; }

body.exam-paper .exam-code {
    position: absolute;
    top: 4.35rem;
    left: 3rem;
    float: none;
    font: 700 1.3rem var(--paper-sans);
    letter-spacing: .42em;
    color: #111;
}
body.exam-paper .cover-level {
    position: absolute;
    top: 1.1rem;
    right: 3rem;
    font: 700 7.4rem/1 var(--paper-sans);
    letter-spacing: -.04em;
    color: #111;
}
body.exam-paper .cover-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.1rem;
    margin: 6.8rem 0 1.7rem;
}
body.exam-paper .cover-brand-name { font: 700 1.75rem 'Poppins', sans-serif; color: #1f2a37; letter-spacing: -.01em; }
body.exam-paper .cover-brand h2 {
    margin: 0;
    padding-left: 1.1rem;
    border-left: 1.5px solid #9aa4ae;
    font: 500 1.08rem/1.25 'Poppins', sans-serif;
    color: #3b4652;
    text-align: left;
}
body.exam-paper .cover-band { background: #d4d6d9; padding: 1.45rem 1rem 1.35rem; text-align: center; }
body.exam-paper .cover-band h1 { font: 700 2.15rem/1.15 var(--paper-sans); color: #151515; margin: 0 0 .55rem; text-align: center; }
body.exam-paper .cover-standard { font: 700 1.5rem/1.2 var(--paper-sans); color: #151515; margin: 0; }
body.exam-paper .exam-credits {
    text-align: center;
    font: 400 1.08rem var(--paper-sans);
    font-style: normal;
    margin: 1.4rem 0 1.2rem;
    color: #151515;
}
body.exam-paper .cover-criteria { width: 100%; border-collapse: collapse; margin: 0 0 1.6rem; }
body.exam-paper .cover-criteria th {
    background: #d4d6d9;
    border: 1px solid #6b6f74;
    font: 700 .98rem var(--paper-sans);
    padding: .45rem .6rem;
    text-align: center;
    color: #151515;
}
body.exam-paper .cover-criteria td {
    border: 1px solid #6b6f74;
    font: 400 .93rem/1.35 var(--paper-sans);
    padding: .4rem .55rem;
    vertical-align: top;
    color: #151515;
    width: 33.33%;
}
body.exam-paper .instructions { border: 0; padding: 0; }
body.exam-paper .instructions h3 { display: none; }
body.exam-paper .instructions ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .55rem;
    font: 400 1.05rem/1.45 var(--paper-sans);
    color: #151515;
}
/* the real cover's order: the bold "attempt ALL" line first, a bold capital line last */
body.exam-paper .i-attempt { order: 1; font-weight: 700; }
body.exam-paper .i-formula { order: 2; }
body.exam-paper .i-working { order: 3; }
body.exam-paper .i-time { order: 4; }
body.exam-paper .i-calc { order: 5; }
body.exam-paper .i-tools { order: 6; }
body.exam-paper .i-start { order: 7; font-weight: 700; text-transform: uppercase; }
body.exam-paper .band-swatch {
    display: inline-block;
    width: 1.7rem;
    height: 1.05rem;
    vertical-align: -.18rem;
    background: var(--band);
    background-size: 12px 24px;
    border: 1px solid #bfc6ce;
}
body.exam-paper #main-timer-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem 1.2rem;
    background: #f5f6f8;
    border: 1px solid #d6dbe0;
    border-radius: 4px;
    padding: .75rem 1.1rem;
    margin: 1.5rem 0 0;
    text-align: left;
}
body.exam-paper #main-timer-controls h4 {
    margin: 0;
    font: 600 .74rem 'Poppins', sans-serif;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #56606a;
}
body.exam-paper #main-timer-display {
    font: 700 1.9rem var(--paper-sans);
    color: #111;
    margin: 0 auto 0 0;
    font-variant-numeric: tabular-nums;
}
body.exam-paper #main-timer-controls .timer-buttons { display: flex; gap: .5rem; }
body.exam-paper #main-timer-controls .timer-buttons button { padding: .45rem 1.4rem; font-size: .85rem; margin: 0; }
body.exam-paper .cover-foot { margin-top: 1.5rem; padding-top: .9rem; border-top: 1px solid #e1e4e8; text-align: center; }
body.exam-paper .cover-foot p { margin: .15rem 0; font: 400 .8rem var(--paper-sans); color: #56606a; }

/* ===================== question sheets ===================== */
body.exam-paper .exam-container { max-width: 950px; margin: 0 auto; padding: 0; }
body.exam-paper .exam-question-title {
    position: relative;
    font: 700 1.3rem/1.2 var(--paper-sans);
    letter-spacing: .02em;
    text-align: left;
    color: #111;
    background: #fff;
    border: 1px solid var(--paper-rule);
    border-bottom: 0;
    margin: 2.4rem 0 0;
    padding: 1.35rem 6.2rem .75rem 1.6rem;
}
body.exam-paper .exam-question-title::after {
    content: "";
    position: absolute;
    left: 1.6rem;
    right: 6.2rem;
    bottom: 0;
    border-bottom: 2px solid #111;
}
body.exam-paper .exam-question-title:has(+ .prediction-question)::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 4.6rem;
    background: var(--band);
    background-size: 12px 24px;
    border-left: 1px solid #d5dae0;
}
body.exam-paper .exam-question-title:not(:has(+ .prediction-question)) { padding-right: 1.6rem; }
body.exam-paper .exam-question-title:not(:has(+ .prediction-question))::after { right: 1.6rem; }

body.exam-paper .prediction-question {
    position: relative;
    overflow: visible;
    background: #fff;
    border: 1px solid var(--paper-rule);
    border-top: 0;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    padding: 1.3rem 6.2rem 1.5rem 3.9rem;
    min-height: 16.5rem; /* room for all three tools (measured ~15.4rem with the Font Awesome icons), so none is ever cut off */
}
body.exam-paper .prediction-question + .prediction-question { border-top: 1px solid #e3e6ea; }
body.exam-paper .question-header { display: flex; align-items: center; gap: .6rem; margin: 0 0 .15rem; }
body.exam-paper .question-header h4:empty { display: none; }
body.exam-paper .recommended-time-display { display: none; }
body.exam-paper .prediction-question .grade-tag {
    display: inline-block;
    font: 600 .68rem 'Poppins', sans-serif;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: #56606a;
    border: 1px solid #c9ced5;
    border-radius: 3px;
    padding: .05rem .45rem;
}
body.exam-paper .prediction-question > h3 {
    position: absolute;
    left: 1.45rem;
    top: 1.22rem;
    margin: 0;
    font: 400 1.18rem/1.5 var(--paper-serif);
    color: #111;
}
body.exam-paper .prediction-question p { font: 400 1.17rem/1.55 var(--paper-serif); color: #111; margin: .5em 0; }
body.exam-paper .prediction-question h4 { font: 700 1rem var(--paper-sans); margin: .9rem 0 .2rem; color: #111; }
body.exam-paper .prediction-question .question-image { border-radius: 3px; margin: 1.2rem auto; }
body.exam-paper .prediction-question table {
    border-collapse: collapse !important;
    margin: 1em auto !important;
    font: 400 1.05rem var(--paper-serif);
    color: #111;
}
body.exam-paper .prediction-question th,
body.exam-paper .prediction-question td { border: 1px solid #111 !important; padding: 6px 14px !important; }
body.exam-paper .prediction-question th { background: #f3f4f6; font-weight: 700; }
body.exam-paper .prediction-question thead tr { border-bottom: 0 !important; }

/* Papers from 2026 carry their diagrams as inline black-on-white SVG, the
   (i)/(ii) parts as a hanging column, and tables in a scrolling wrapper. */
body.exam-paper .exam-figure { clear: both; margin: 1.1rem 0; text-align: center; }
body.exam-paper .exam-figure svg { display: inline-block; max-width: 100%; height: auto; overflow: visible; }
/* two drawings side by side (a 3-D view beside its cross-section); they stack when there's no room */
body.exam-paper .exam-figure-pair { clear: both; display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: .6rem 3.2rem; margin: 1.1rem 0; }
body.exam-paper .exam-figure-pair .exam-figure { margin: 0; flex: 0 1 auto; min-width: 0; }
body.exam-paper .exam-sub { clear: both; display: grid; grid-template-columns: 2.4rem minmax(0, 1fr); margin-top: .9rem; }
body.exam-paper .exam-sub-label { font: 400 1.17rem/1.55 var(--paper-serif); color: #111; margin: .5em 0; }
body.exam-paper .exam-table-wrap { clear: both; overflow-x: auto; }
body.exam-paper .exam-table th[scope="row"] { text-align: left; }
/* a scene photo beside the opening of the question, as real papers have */
body.exam-paper .exam-photo { float: right; width: min(40%, 300px); margin: .35rem 0 .8rem 1.4rem; }
body.exam-paper .exam-photo picture,
body.exam-paper .exam-photo img { display: block; width: 100%; height: auto; border-radius: 2px; }
body.exam-paper .prediction-question .inline-answer { clear: both; }
/* The diagram after a scene photo moves up beside it when there is room, scaled to fit, so a
   short opening doesn't leave a gap under it; with too little room it drops below as before. */
@media (min-width: 601px) {
    body.exam-paper .exam-photo ~ .exam-figure { clear: none; display: flow-root; min-width: 21rem; }
}

/* the real paper's footer line, at the end of each question */
body.exam-paper .prediction-question:has(+ .exam-question-title)::after,
body.exam-paper .prediction-question:has(+ .mark-scheme-container)::after {
    content: var(--exam-footer, "Maths Study Hub practice paper");
    display: block;
    margin-top: 2rem;
    text-align: center;
    font: 400 .72rem var(--paper-sans);
    letter-spacing: .03em;
    color: #6b7480;
}

/* ===================== the margin band: tools always visible ===================== */
body.exam-paper .sidebar-trigger-zone { display: none; }
body.exam-paper .question-sidebar,
body.exam-paper .sidebar-trigger-zone:hover + .question-sidebar,
body.exam-paper .question-sidebar:hover {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    height: auto;
    width: 4.6rem;
    opacity: 1;
    transform: none;
    animation: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
    padding: 1.05rem 0;
    z-index: 1;
    background: var(--band);
    background-size: 12px 24px;
    border-left: 1px solid #d5dae0;
}
body.exam-paper .sidebar-btn {
    width: auto;
    height: auto;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .24rem;
    cursor: pointer;
    color: #3e4954;
    transform: none;
}
body.exam-paper .sidebar-btn > i {
    box-sizing: border-box;
    width: 2.65rem;
    height: 2.65rem;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #c3c9d0;
    box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    transition: background-color .15s, color .15s, border-color .15s;
}
body.exam-paper .sidebar-btn::after {
    font: 600 .6rem/1.2 'Poppins', sans-serif;
    color: #3e4954;
    background: #fff;
    padding: .05rem .25rem;
    border-radius: 2px;
}
body.exam-paper .timer-btn::after { content: attr(data-time) " min"; }
body.exam-paper .answer-btn::after { content: "Answer"; }
body.exam-paper .formula-btn::after { content: "Formulae"; }
body.exam-paper .sidebar-btn:hover { background: none; transform: none; color: #3e4954; }
body.exam-paper .sidebar-btn:hover > i,
body.exam-paper .sidebar-btn:focus-visible > i { background: #4A90E2; color: #fff; border-color: #4A90E2; }
body.exam-paper .sidebar-btn:focus-visible { outline: none; }
/* while a part's answer is open, its key turns blue and reads "Hide" (main.js sets the inline display) */
body.exam-paper .prediction-question:has(> .inline-answer[style*="block"]) .answer-btn > i { background: #4A90E2; color: #fff; border-color: #4A90E2; }
body.exam-paper .prediction-question:has(> .inline-answer[style*="block"]) .answer-btn::after { content: "Hide"; }

/* ===================== answers, marking schedule, cut scores ===================== */
body.exam-paper .prediction-question .inline-answer {
    margin: 1.4rem 0 .3rem;
    padding: 1rem 1.3rem .9rem;
    background: #f4f8f6;
    border: 1px solid #d3e1da;
    border-left: 4px solid var(--secondary-color, #50E3C2);
    border-radius: 4px;
}
body.exam-paper .prediction-question .inline-answer::before {
    content: "Answer and marking";
    display: block;
    font: 700 .68rem 'Poppins', sans-serif;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #1d7a63;
    margin-bottom: .4rem;
}
body.exam-paper .prediction-question .inline-answer p,
body.exam-paper .prediction-question .inline-answer li { font: 400 1rem/1.6 'Poppins', sans-serif; color: #222; margin: .45em 0; }
/* key results and the "common errors" notes in the 2026-on answers */
body.exam-paper .prediction-question .inline-answer .answer-result { background: #fffbe6; border-left: 3px solid #f0d36b; padding: .3rem .7rem; }
body.exam-paper .prediction-question .inline-answer .answer-check { font-size: .92rem; font-style: italic; color: #4a5560; border-left: 3px solid #cfd6dd; padding: .1rem .7rem; }
body.exam-paper .mark-scheme-table .exam-scheme-part { font-weight: 700; text-align: center; white-space: nowrap; }
body.exam-paper .exam-draft-note {
    margin: 1.6rem 0 0;
    padding: .8rem 1.1rem;
    background: #fff8e1;
    border: 1px solid #f0d36b;
    border-radius: 4px;
    font: 400 .95rem/1.5 'Poppins', sans-serif;
    color: #5c4a00;
}
body.exam-paper .mark-scheme-container { background: #f6f7f9; border: 1px solid var(--paper-rule); border-top: 0; padding: 1rem 1.6rem 1.2rem; }
body.exam-paper .mark-scheme-container h3 { font: 700 1rem var(--paper-sans) !important; color: #111 !important; text-align: left !important; margin: 0 0 .3rem; }
body.exam-paper .mark-scheme-table { font-family: var(--paper-sans); font-size: .92rem; margin: .6rem 0; }
body.exam-paper .mark-scheme-table th { background: #d4d6d9; border: 1px solid #6b6f74; font-weight: 700; color: #151515; padding: .45rem; }
body.exam-paper .mark-scheme-table td { border: 1px solid #6b6f74; color: #151515; padding: .45rem; }
body.exam-paper #bulk-answer-controls {
    background: #fff;
    border: 1px solid var(--paper-rule);
    border-top: 0;
    padding: 1.1rem 1.6rem 1.4rem;
    margin: 0 !important;
    text-align: left !important;
}
body.exam-paper #bulk-answer-controls .cta-button {
    background: #4A90E2;
    color: #fff;
    font: 600 .92rem 'Poppins', sans-serif;
    padding: .65rem 1.6rem;
    border: 0;
    cursor: pointer;
}
body.exam-paper .exam-container > .question-box:not(.prediction-question) {
    background: #fff;
    border: 1px solid var(--paper-rule);
    border-top: 0;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    padding: .6rem 1.6rem 1.2rem;
}

/* ===================== formula sheet panel (built by main.js) ===================== */
body.exam-paper .formula-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(390px, 92vw);
    background: #fff;
    border-left: 1px solid var(--paper-rule);
    box-shadow: -10px 0 28px rgba(20, 30, 40, .14);
    z-index: 1000;
    transform: translateX(104%);
    visibility: hidden;
    transition: transform .25s ease, visibility .25s;
    display: flex;
    flex-direction: column;
    font-family: 'Poppins', sans-serif;
    color: #151515;
}
body.exam-paper .formula-drawer.open { transform: none; visibility: visible; }
body.exam-paper .fd-head { display: flex; align-items: center; gap: .8rem; padding: 1rem 1.2rem .7rem; border-bottom: 2px solid #111; }
body.exam-paper .fd-head h2 { margin: 0; font: 700 1.15rem var(--paper-sans); }
body.exam-paper .fd-head span { font: 400 .8rem var(--paper-sans); color: #56606a; margin-right: auto; }
body.exam-paper .fd-close {
    border: 1px solid #c3c9d0;
    background: #fff;
    border-radius: 50%;
    width: 2.2rem;
    height: 2.2rem;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    color: #333;
}
body.exam-paper .fd-close:hover,
body.exam-paper .fd-close:focus-visible { background: #4A90E2; color: #fff; border-color: #4A90E2; outline: none; }
body.exam-paper .fd-body { overflow: auto; padding: .3rem 1.2rem 1.4rem; }
body.exam-paper .fd-body h3,
body.exam-paper .fd-body h4 { font: 700 .9rem var(--paper-sans); margin: 1rem 0 .4rem; padding: .3rem .55rem; background: #d4d6d9; color: #151515; }
body.exam-paper .fd-body dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .55rem .9rem; margin: 0; align-items: baseline; }
body.exam-paper .fd-body dt { font: 400 .92rem var(--paper-sans); color: #333; }
body.exam-paper .fd-body dd { margin: 0; font: 400 1.02rem var(--paper-serif); }
body.exam-paper .fd-body ul { margin: 0; padding-left: 1.2rem; font: 400 1rem/1.7 var(--paper-serif); }
body.exam-paper .fd-body p { font: 400 1rem var(--paper-serif); }
body.exam-paper .fd-body .fd-note { font: 400 .8rem var(--paper-sans); color: #56606a; margin: .9rem 0 0; }

/* ===================== phones ===================== */
@media (max-width: 600px) {
    body.exam-paper main { padding: 1rem .6rem 2rem; }
    body.exam-paper .exam-cover-sheet { padding: 1.2rem 1.1rem 1.4rem; }
    body.exam-paper .exam-cover-sheet .container::before,
    body.exam-paper .exam-cover-sheet .container::after { display: none; }
    body.exam-paper .exam-code { top: 1.45rem; left: 1.1rem; font-size: 1rem; letter-spacing: .3em; }
    body.exam-paper .cover-level { top: .5rem; right: 1.1rem; font-size: 3.9rem; }
    body.exam-paper .cover-brand { margin: 3.6rem 0 1rem; flex-wrap: wrap; gap: .45rem .7rem; }
    body.exam-paper .cover-brand-name { font-size: 1.25rem; }
    body.exam-paper .cover-brand h2 { font-size: .9rem; padding-left: .7rem; }
    body.exam-paper .cover-band { padding: 1rem .7rem; }
    body.exam-paper .cover-band h1 { font-size: 1.45rem; }
    body.exam-paper .cover-standard { font-size: 1.02rem; }
    /* criteria: stack as heading, text, heading, text ... */
    body.exam-paper .cover-criteria { display: grid; grid-template-columns: 1fr; }
    body.exam-paper .cover-criteria thead,
    body.exam-paper .cover-criteria tbody,
    body.exam-paper .cover-criteria tr { display: contents; }
    body.exam-paper .cover-criteria th,
    body.exam-paper .cover-criteria td { display: block; width: auto; text-align: left; }
    body.exam-paper .cover-criteria th:nth-child(1) { order: 1; }
    body.exam-paper .cover-criteria td:nth-child(1) { order: 2; }
    body.exam-paper .cover-criteria th:nth-child(2) { order: 3; }
    body.exam-paper .cover-criteria td:nth-child(2) { order: 4; }
    body.exam-paper .cover-criteria th:nth-child(3) { order: 5; }
    body.exam-paper .cover-criteria td:nth-child(3) { order: 6; }
    body.exam-paper .instructions ul { font-size: .98rem; }
    body.exam-paper .exam-question-title { font-size: 1.12rem; padding: 1.05rem 1rem .6rem; }
    body.exam-paper .exam-question-title::after { left: 1rem; right: 1rem; }
    body.exam-paper .exam-question-title:has(+ .prediction-question)::before { display: none; }
    body.exam-paper .prediction-question { display: flex; flex-direction: column; padding: 1.05rem 1rem 0 2.5rem; min-height: 0; }
    body.exam-paper .prediction-question > * { min-width: 0; }
    body.exam-paper .prediction-question > h3 { left: .85rem; top: 1rem; }
    body.exam-paper .question-header { align-self: flex-start; }
    body.exam-paper .prediction-question p { font-size: 1.07rem; }
    body.exam-paper .exam-photo { float: none; width: 100%; margin: .5rem 0 .8rem; }
    body.exam-paper .exam-sub { grid-template-columns: 2rem minmax(0, 1fr); }
    body.exam-paper .exam-sub-label { font-size: 1.07rem; }
    /* a displayed equation too wide for a phone scrolls inside itself, not the page */
    body.exam-paper .prediction-question mjx-container[display="true"] { overflow-x: auto; overflow-y: hidden; max-width: 100%; }
    /* the band becomes a strip under each part */
    body.exam-paper .question-sidebar,
    body.exam-paper .sidebar-trigger-zone:hover + .question-sidebar,
    body.exam-paper .question-sidebar:hover {
        order: 98;
        position: static;
        flex-direction: row;
        justify-content: flex-end;
        gap: 1.2rem;
        width: auto;
        margin: 1rem -1rem 0 -2.5rem;
        padding: .55rem 1rem;
        border-left: 0;
        border-top: 1px solid var(--paper-rule);
    }
    body.exam-paper .sidebar-btn { flex-direction: row; gap: .35rem; }
    body.exam-paper .sidebar-btn > i { width: 2.45rem; height: 2.45rem; }
    body.exam-paper .prediction-question .inline-answer { order: 99; margin-bottom: 1rem; }
    body.exam-paper .prediction-question:has(+ .exam-question-title)::after,
    body.exam-paper .prediction-question:has(+ .mark-scheme-container)::after { order: 100; margin: 1.2rem 0 1rem; }
    body.exam-paper .mark-scheme-container,
    body.exam-paper #bulk-answer-controls,
    body.exam-paper .exam-container > .question-box:not(.prediction-question) { padding-inline: 1rem; overflow-x: auto; }
    /* the formula sheet slides up from the bottom */
    body.exam-paper .formula-drawer {
        top: auto;
        left: 0;
        right: 0;
        width: auto;
        height: 66vh;
        border-left: 0;
        border-top: 1px solid var(--paper-rule);
        border-radius: 14px 14px 0 0;
        transform: translateY(104%);
    }
    body.exam-paper .formula-drawer.open { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    body.exam-paper .formula-drawer { transition: none; }
}
