/* UASA revision — "the marked exercise book".
   Paper sheets on a desk, ink-blue type, one bold element: the teacher's red pen
   (schemes, ticks, crosses, the circled score). OMR bubbles for options, ruled answer lines. */

@font-face { font-family: "Lexend"; src: url(fonts/lexend-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Lexend"; src: url(fonts/lexend-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Lexend"; src: url(fonts/lexend-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Noto Naskh Arabic"; src: url(fonts/noto-naskh-arabic-arabic-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Noto Naskh Arabic"; src: url(fonts/noto-naskh-arabic-arabic-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Kalam"; src: url(fonts/kalam-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Kalam"; src: url(fonts/kalam-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --desk: #e6ebef;
  --paper: #ffffff;
  --text: #1b2230;
  --ink: #23408e;          /* fountain-pen blue: headings, numbers, primary actions */
  --pencil: #5d6675;       /* secondary text */
  --rule: #cfdaea;         /* exercise-book lines */
  --margin: #eba3ad;       /* red margin rule */
  --pen: #c8102e;          /* teacher's red pen */
  --pen-wash: #fdf0f2;
  --hl: #ffe45c;           /* highlighter */
  --fill: #2b2f36;         /* pencil-shaded bubble */
  --focus: #2f6fed;
  --sheet-pad: 88px;       /* left margin width (question numbers live here) */
  --font: "Lexend", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --hand: "Kalam", "Comic Sans MS", cursive;
  --font-ar: "Noto Naskh Arabic", "Geeza Pro", "Traditional Arabic", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --desk: #11151d; --paper: #1a2030; --text: #e3e8f2; --ink: #a9c1ff; --pencil: #9aa3b5;
    --rule: #2c3750; --margin: #6b3a44; --pen: #ff7b8c; --pen-wash: #2a1b22; --hl: rgba(255, 214, 0, .32);
    --fill: #e3e8f2; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --desk: #11151d; --paper: #1a2030; --text: #e3e8f2; --ink: #a9c1ff; --pencil: #9aa3b5;
  --rule: #2c3750; --margin: #6b3a44; --pen: #ff7b8c; --pen-wash: #2a1b22; --hl: rgba(255, 214, 0, .32);
  --fill: #e3e8f2; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--desk); color: var(--text); font: 16.5px/1.65 var(--font); }
a { color: var(--ink); text-underline-offset: 3px; }
img, svg { max-width: 100%; height: auto; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[lang="ar"], .ar, .jawi { font-family: var(--font-ar); direction: rtl; unicode-bidi: isolate; font-size: 1.3em; }
sup { line-height: 0; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--desk) 88%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--rule); }
.topbar-in { max-width: 920px; margin: 0 auto; padding: 8px 16px; display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; }
.crumbs { font-size: 14px; color: var(--pencil); margin-right: auto; }
.crumbs a { color: var(--pencil); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs .sep { margin: 0 6px; opacity: .6; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

button, .btn { font: inherit; font-size: 14px; line-height: 1.2; color: var(--text); background: var(--paper);
  border: 1px solid var(--rule); border-radius: 6px; padding: 7px 12px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px; }
button:hover, .btn:hover { border-color: var(--ink); }
.btn.solid, button.solid { background: var(--ink); border-color: var(--ink); color: var(--paper); font-weight: 700; }
.seg { display: inline-flex; }
.seg button { border-radius: 0; margin-left: -1px; }
.seg button:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.seg button:last-child { border-radius: 0 6px 6px 0; }
.seg button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); position: relative; z-index: 1; }
.timer { display: none; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); padding: 0 4px; }
body.exam .timer { display: inline; }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: ""; width: 0; height: 0; border: 4px solid transparent; border-top-color: currentColor; margin-top: 4px; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); background: var(--paper); border: 1px solid var(--rule);
  border-radius: 8px; padding: 6px; min-width: 210px; box-shadow: 0 10px 30px rgba(20, 30, 50, .14); display: grid; gap: 2px; z-index: 30; }
.menu-list button { border: 0; width: 100%; justify-content: flex-start; padding: 8px 10px; }
.menu-list button:hover { background: var(--desk); }
.menu-list hr { border: 0; border-top: 1px solid var(--rule); margin: 4px 0; }
.icon-btn { width: 34px; justify-content: center; padding: 7px 0; }

/* ---------- the sheet ---------- */
.page { max-width: 920px; margin: 0 auto; padding: 22px 16px 80px; }
.sheet { position: relative; background: var(--paper); border-radius: 3px; padding: 40px 48px 56px var(--sheet-pad);
  box-shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 12px 32px rgba(20, 30, 50, .07); }
.sheet::before { content: ""; position: absolute; top: 0; bottom: 0; left: calc(var(--sheet-pad) - 22px); border-left: 1.5px solid var(--margin); }
.sheet + .sheet { margin-top: 22px; }

.doc-head { margin-bottom: 26px; }
.doc-head .where { color: var(--pencil); font-size: 15px; }
.doc-head h1 { font-size: 34px; line-height: 1.15; letter-spacing: -.01em; color: var(--ink); margin: 6px 0 8px; font-weight: 700; max-width: 22ch; }
.doc-head .sub { color: var(--pencil); font-size: 15px; }
.chapter-no { position: absolute; left: 0; width: calc(var(--sheet-pad) - 34px); text-align: right; top: 34px;
  font-size: 46px; font-weight: 700; color: var(--ink); line-height: 1; }

.objectives { margin: 0 0 8px; padding: 0; }
.objectives h2 { font-size: 17px; margin: 0 0 6px; color: var(--ink); }
.objectives ul { margin: 0; padding-left: 20px; }
.objectives li { margin: 3px 0; }

/* ---------- module typography ---------- */
.module { max-width: 68ch; }
.module h2 { position: relative; font-size: 25px; line-height: 1.25; color: var(--ink); margin: 46px 0 12px; }
.module h2 .sn { position: absolute; right: calc(100% + 34px); top: 0; width: 60px; text-align: right; font-size: 21px; }
.module h3 { font-size: 19px; margin: 28px 0 8px; }
.module p, .module ul, .module ol { margin: 0 0 14px; }
.module li { margin: 4px 0; }
mark, .keyterm b, .hl { background: linear-gradient(transparent 38%, var(--hl) 38%, var(--hl) 88%, transparent 88%); color: inherit; padding: 0 2px; }
.keyterm { margin: 16px 0; padding: 2px 0 2px 16px; border-left: 3px solid var(--ink); }
.example { margin: 18px 0; padding: 0 16px; background: color-mix(in srgb, var(--rule) 22%, var(--paper));
  background-image: linear-gradient(transparent 31px, var(--rule) 32px); background-size: 100% 32px; line-height: 32px; border-radius: 3px; }
.example .ex-title { font-weight: 700; color: var(--ink); }
.tip { margin: 16px 0; padding-left: 16px; border-left: 3px solid var(--rule); }
.tip::before { content: "Tip. "; font-weight: 700; color: var(--ink); }
.warn { position: relative; margin: 18px 0; padding: 4px 0 4px 16px; border-left: 3px solid var(--pen); }
.warn::before { content: "Careful!"; position: absolute; right: calc(100% + 30px); top: 0; width: 70px; text-align: right;
  font-family: var(--hand); font-weight: 700; color: var(--pen); transform: rotate(-6deg); font-size: 18px; line-height: 1.1; }
.quick-check { margin: 22px 0; padding: 12px 16px; border: 1.5px dashed var(--ink); border-radius: 6px; }
.quick-check::before { content: "Try it"; display: block; font-weight: 700; color: var(--ink); margin-bottom: 2px; }
.src { font-size: 13px; color: var(--pencil); font-style: italic; }
.grid { display: grid; gap: 0; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin: 12px 0 6px;
  border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
.grid .cell { padding: 14px 10px 12px; font-size: 14px; text-align: center; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); line-height: 1.4; }
.grid .cell img { height: 96px; width: auto; object-fit: contain; display: block; margin: 0 auto 10px; }
.grid .cell b { display: block; color: var(--ink); }
.next { display: flex; justify-content: space-between; gap: 10px; margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--rule); }

table.data { border-collapse: collapse; margin: 12px 0 18px; font-size: 15.5px; width: 100%; }
table.data th, table.data td { padding: 8px 12px 8px 0; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
table.data th { color: var(--ink); border-bottom: 2px solid var(--ink); font-weight: 700; }
table.data td img { display: block; }
figure { margin: 18px 0; text-align: center; }
figure img, figure svg { border-radius: 2px; }
figcaption { font-size: 14px; color: var(--pencil); margin-top: 6px; }
figure.row { display: flex; flex-wrap: wrap; justify-content: center; gap: 28px; align-items: flex-end; }
figure.row > div { text-align: center; }

/* ---------- questions ---------- */
.section-head { margin: 44px 0 4px; padding-bottom: 10px; border-bottom: 2px solid var(--ink); display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; }
.section-head.first { margin-top: 8px; }
.section-head h2 { margin: 0; font-size: 22px; color: var(--ink); flex: 1; }
.section-head .instr { flex-basis: 100%; color: var(--pencil); font-size: 15px; }
.marks { color: var(--pencil); font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.section-head .marks { font-size: 15px; }

.q { position: relative; padding: 22px 0 20px; border-bottom: 1px solid var(--rule); }
.q-num { position: absolute; left: calc(-1 * var(--sheet-pad)); width: calc(var(--sheet-pad) - 34px); text-align: right;
  font-size: 21px; font-weight: 700; color: var(--ink); line-height: 1.4; }
.q-body { min-width: 0; }
.stem { max-width: 70ch; }
.stem p { margin: 0 0 8px; }
.q-tags { margin-top: 12px; font-size: 13px; color: var(--pencil); }
.q-tags span + span::before { content: " / "; opacity: .6; }

/* bilingual (Malay first, English below, as on the real paper) */
.bi-ms { display: block; }
.bi-en { display: block; font-style: italic; color: var(--pencil); }
.options .bi-en, .choices .bi-en { font-size: .94em; }
.bi-rumi { display: block; }
.bi-jawi { display: block; direction: rtl; text-align: right; unicode-bidi: isolate; font-family: var(--font-ar); font-size: 1.3em; line-height: 1.9; color: var(--text); }
.options .bi-jawi, .choices .bi-jawi { text-align: right; }
.choices label .bi-jawi { text-align: left; }
.section-head h2 .bi-en, .qsec .bi-en { font-size: .8em; font-weight: 400; }
.cover h1 .bi-en { font-size: .6em; font-weight: 400; }

/* OMR bubbles */
.options { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 4px; }
.options.grid2 { grid-template-columns: 1fr 1fr; }
.options li { position: relative; }
.options label { display: flex; gap: 12px; align-items: flex-start; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.options label:hover { background: color-mix(in srgb, var(--rule) 35%, transparent); }
.options input, .choices input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.bubble { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--pencil);
  display: inline-grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--pencil); margin-top: -1px; transition: background .12s, color .12s; }
.options input:checked + .bubble, .choices input:checked + .bubble { background: var(--fill); border-color: var(--fill); color: var(--paper); }
.options input:focus-visible + .bubble, .choices input:focus-visible + .bubble { outline: 3px solid var(--focus); outline-offset: 2px; }
.options img { max-height: 110px; }
/* red-pen feedback */
.options li.correct .bubble { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--pen); }
.options li.correct label::after, .choices label.correct::after { content: "✓"; font-family: var(--hand); font-weight: 700; color: var(--pen); font-size: 24px; line-height: 1; margin-left: 4px; }
.options li.wrong label::after, .choices label.wrong::after { content: "✗"; font-family: var(--hand); font-weight: 700; color: var(--pen); font-size: 24px; line-height: 1; margin-left: 4px; }
.choices { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 10px 0 4px; }
.choices label { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 6px; border-radius: 6px; font-size: 16px; }
.choices label:hover { background: color-mix(in srgb, var(--rule) 35%, transparent); }
.choices .bubble { width: 20px; height: 20px; }

/* written parts */
.part { position: relative; margin-top: 16px; }
.part > .marks { float: right; margin-left: 12px; }
.part-label { font-weight: 700; margin-right: 6px; vertical-align: top; }
.part > .stem { display: inline-block; vertical-align: top; max-width: calc(100% - 7em); }
textarea.answer { display: block; width: 100%; margin-top: 8px; font: inherit; font-size: 16px; color: var(--ink);
  padding: 0 4px; border: 0; border-bottom: 1px solid var(--rule); border-radius: 0; resize: vertical; background: transparent;
  line-height: 32px; background-image: linear-gradient(transparent 31px, var(--rule) 31px); background-size: 100% 32px; background-attachment: local; }
textarea.answer:focus { outline: none; background-color: color-mix(in srgb, var(--hl) 12%, transparent); }
textarea.answer::placeholder { color: var(--pencil); opacity: .6; }
.lines { display: none; }

/* ---------- the red pen ---------- */
details.scheme { margin-top: 10px; }
details.scheme > summary { display: inline-block; cursor: pointer; list-style: none; font-family: var(--hand); font-weight: 700;
  font-size: 18px; color: var(--pen); padding: 0 2px; border-bottom: 1.5px solid transparent; }
details.scheme > summary::-webkit-details-marker { display: none; }
details.scheme > summary:hover { border-bottom-color: var(--pen); }
details.scheme[open] > summary { font-size: 15px; opacity: .75; }
.s-hide, details.scheme[open] > summary .s-show { display: none; }
details.scheme[open] > summary .s-hide { display: inline; }
details.scheme .scheme-body { position: relative; color: var(--pen); margin-top: 4px; padding: 8px 14px 8px 16px; border-left: 2px solid var(--pen);
  background: var(--pen-wash); border-radius: 0 6px 6px 0; font-size: 16px; animation: ink .18s ease-out; }
@keyframes ink { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.scheme .key { font-family: var(--hand); font-weight: 700; font-size: 22px; line-height: 1.3; }
.scheme .expl { color: var(--text); margin-top: 2px; }
.scheme ul.points { margin: 4px 0; padding: 0; list-style: none; }
.scheme ul.points li { display: flex; gap: 10px; align-items: flex-start; padding: 3px 0; }
.scheme ul.points li .pm { margin-left: auto; font-family: var(--hand); font-weight: 700; white-space: nowrap; }
.scheme ul.points input { appearance: none; -webkit-appearance: none; flex: 0 0 auto; width: 20px; height: 20px; margin: 3px 0 0;
  border: 1.5px solid var(--pen); border-radius: 3px; cursor: pointer; display: grid; place-items: center; background: var(--paper); }
.scheme ul.points input:checked::after { content: "✓"; font-family: var(--hand); font-weight: 700; font-size: 20px; color: var(--pen); line-height: 1; margin-top: -2px; }
.scheme .selfmark { font-size: 14px; color: var(--pencil); }
.scheme .any { font-family: var(--hand); font-size: 17px; }

/* the circled score */
.scorebar { display: none; margin: 4px 0 18px; align-items: center; gap: 18px; flex-wrap: wrap; }
.scorebar.show { display: flex; }
.score-circle { font-family: var(--hand); font-weight: 700; color: var(--pen); font-size: 34px; line-height: 1;
  padding: 14px 22px 10px; border: 2.5px solid var(--pen); border-radius: 50% 46% 52% 48% / 55% 50% 50% 45%; transform: rotate(-4deg); }
.score-detail { color: var(--pencil); font-size: 15px; max-width: 52ch; }

/* ---------- exam cover ---------- */
.cover { text-align: center; padding: 10px 0 30px; border-bottom: 2px solid var(--ink); margin-bottom: 10px; }
.cover .label { display: inline-block; font-size: 13px; color: var(--pen); border: 1.5px solid var(--pen); border-radius: 4px; padding: 2px 10px; margin-bottom: 18px; }
.cover .code { font-size: 15px; font-weight: 700; }
.cover h1 { font-size: 34px; color: var(--ink); margin: 6px 0; }
.cover .fields { display: grid; grid-template-columns: 2fr 1fr; gap: 10px 22px; text-align: left; max-width: 560px; margin: 22px auto; font-size: 15px; }
.cover .fields div { border-bottom: 1px solid var(--text); padding: 18px 0 4px; }
.cover ol { text-align: left; max-width: 600px; margin: 14px auto 0; font-size: 15px; }

/* ---------- index pages ---------- */
.shelf { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin-top: 8px; }
.book { position: relative; display: flex; flex-direction: column; justify-content: center; aspect-ratio: 3 / 4; padding: 18px 16px 18px 30px;
  border-radius: 3px 8px 8px 3px; text-decoration: none; color: #1b2230; background: var(--cover, #2f6db5);
  box-shadow: inset 12px 0 0 rgba(0, 0, 0, .16), 0 2px 0 rgba(0, 0, 0, .08), 0 10px 22px rgba(20, 30, 50, .16); transition: transform .15s; }
.book:hover { transform: translateY(-3px); }
.book .label { background: #fff; border-radius: 4px; padding: 10px 12px 12px; box-shadow: 0 1px 0 rgba(0, 0, 0, .1); }
.book .label .t { font-weight: 700; font-size: 18px; line-height: 1.2; color: #1b2230; }
.book .label .s { font-size: 13px; color: #5d6675; margin-top: 6px; border-top: 1px solid #cfdaea; padding-top: 6px; }
.contents { list-style: none; padding: 0; margin: 10px 0 0; }
.contents li { position: relative; display: flex; align-items: baseline; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.contents .n { position: absolute; left: calc(-1 * var(--sheet-pad)); width: calc(var(--sheet-pad) - 34px); text-align: right; font-weight: 700; color: var(--ink); font-size: 18px; }
.contents .name { flex: 1; min-width: 220px; font-weight: 600; }
.contents .sub-line { display: block; font-weight: 400; font-size: 14px; color: var(--pencil); }
.contents .links { display: flex; gap: 8px; align-items: center; }
.contents .soon { color: var(--pencil); font-size: 14px; font-style: italic; }
.mark-score { font-family: var(--hand); font-weight: 700; color: var(--pen); min-width: 52px; text-align: right; }
.mark-score.none { visibility: hidden; }
.h-section { font-size: 21px; color: var(--ink); margin: 40px 0 6px; }

/* ---------- sidebar ---------- */
.toc-btn { display: none; }
.page:has(> .side) { max-width: 1200px; display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 30px; align-items: start; }
body:has(.side) .topbar-in { max-width: 1200px; }
.main-col { min-width: 0; }
.side { position: sticky; top: 72px; max-height: calc(100vh - 92px); overflow: auto; padding: 18px 4px 18px 0; }
.side-title { font-weight: 700; color: var(--ink); font-size: 15px; margin: 0 0 8px 12px; }
.toc { list-style: none; margin: 0; padding: 0; }
.toc a { display: flex; gap: 8px; padding: 6px 10px; border-left: 2px solid var(--rule); color: var(--pencil); text-decoration: none; font-size: 14.5px; line-height: 1.35; }
.toc a:hover { color: var(--ink); }
.toc .tn { color: var(--ink); font-weight: 600; min-width: 26px; }
.toc a.current { color: var(--ink); border-left-color: var(--ink); font-weight: 600; background: color-mix(in srgb, var(--paper) 70%, transparent); }
.qsec { font-size: 13px; color: var(--pencil); margin: 14px 0 8px 2px; }
.qgrid { display: grid; grid-template-columns: repeat(5, 32px); gap: 8px 10px; padding-left: 2px; }
.qn { width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--pencil); display: grid; place-items: center;
  font-size: 13px; font-weight: 600; color: var(--pencil); text-decoration: none; background: var(--paper); }
.qn:hover { border-color: var(--ink); color: var(--ink); }
.qn.answered { background: var(--fill); border-color: var(--fill); color: var(--paper); }
.qn.right { background: var(--fill); border-color: var(--fill); color: var(--paper); box-shadow: 0 0 0 2px var(--desk), 0 0 0 4px var(--pen); }
.qn.wrong { background: var(--pen-wash); border-color: var(--pen); color: var(--pen); }
.side-foot { display: grid; gap: 10px; justify-items: start; margin: 22px 0 0 12px; font-size: 14px; }
.side-foot .btn { font-size: 14px; }
@media (max-width: 1099px) {
  .page:has(> .side) { display: block; max-width: 920px; }
  body:has(.side) .topbar-in { max-width: 920px; }
  .toc-btn { display: inline-flex; }
  .side { display: none; }
  body.side-open .side { display: block; position: fixed; z-index: 50; top: 0; left: 0; bottom: 0; width: min(300px, 86vw); max-height: none;
    background: var(--paper); padding: 22px 18px; box-shadow: 0 0 40px rgba(10, 20, 40, .25); animation: slidein .16s ease-out; }
  body.side-open::after { content: ""; position: fixed; inset: 0; z-index: 45; background: rgba(15, 22, 35, .35); }
}
@keyframes slidein { from { transform: translateX(-12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- small screens ---------- */
@media (max-width: 680px) {
  :root { --sheet-pad: 46px; }
  body { font-size: 16px; }
  .sheet { padding: 26px 18px 40px var(--sheet-pad); }
  .sheet::before { left: calc(var(--sheet-pad) - 12px); }
  .q-num, .contents .n { width: calc(var(--sheet-pad) - 18px); font-size: 17px; }
  .chapter-no { width: calc(var(--sheet-pad) - 18px); font-size: 30px; top: 26px; }
  .module h2 .sn { right: calc(100% + 18px); width: 40px; font-size: 15px; }
  .warn::before { position: static; display: block; transform: none; width: auto; text-align: left; }
  .doc-head h1, .cover h1 { font-size: 27px; }
  .options.grid2 { grid-template-columns: 1fr; }
  .topbar-in { padding: 6px 12px; }
  .crumbs { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- print (A4) ---------- */
@page { size: A4; margin: 14mm 14mm 16mm 10mm; }
@media print {
  :root { --desk: #fff; --paper: #fff; --text: #000; --pencil: #444; --rule: #9aa; --sheet-pad: 16mm; --hl: #fff176; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: #fff; font-size: 11pt; line-height: 1.38; }
  .side, .toc-btn, .topbar, .scorebar, .no-print, .q-tags, .next, details.scheme > summary { display: none !important; }
  .page, .page:has(> .side) { display: block; max-width: none; padding: 0; }
  .sheet { box-shadow: none; padding: 0 0 0 var(--sheet-pad); border-radius: 0; }
  .sheet::before { display: none; }
  .sheet + .sheet { margin-top: 0; break-before: page; }
  .doc-head h1 { font-size: 22pt; }
  .chapter-no { font-size: 26pt; top: 0; }
  .q { padding: 7pt 0 5pt; }
  .q.mcq, .options li, .q-lead, figure, .keyterm, .example, .tip, .warn, .quick-check, table.data tr { break-inside: avoid; }
  .part { break-inside: avoid; margin-top: 8pt; }
  .q-lead, .section-head, .module h2, .module h3 { break-after: avoid; }
  .section-head.newpage { break-before: page; }
  .cover { break-after: page; min-height: 230mm; padding-top: 30mm; border-bottom: 0; }
  figure { margin: 6pt 0; }
  figure img, figure svg { max-height: 52mm; width: auto !important; }
  .part figure img { max-height: 30mm; }
  .options { gap: 0; margin-top: 4pt; }
  .options label { padding: 1pt 0; }
  .bi-en { font-size: .95em; }
  .bubble { width: 18pt; height: 18pt; font-size: 9pt; }
  textarea.answer { display: none; }
  .lines { display: block; }
  .lines span { display: block; height: 7.5mm; border-bottom: 0.6pt solid #888; }
  details.scheme:not([open]) { display: none; }
  details.scheme .scheme-body { background: none; animation: none; }
  .scheme ul.points input { display: none; }
  body.print-questions details.scheme { display: none !important; }
  a { color: inherit; text-decoration: none; }
  .book { box-shadow: none; border: 1px solid #000; }
}
