/* Leveling Practice: a surveyor's level book. Buff waterproof-notebook paper, blue row rules and a red margin rule
   after the point column, slab headings like a field book cover, survey flagging-tape orange for actions, and
   numbers in a monospace so columns line up. Black on white with ruled blanks on paper. */
:root {
  --bg: #f3efe2;
  --paper: #fffdf6;
  --ink: #1c2620;
  --muted: #4f5a52;
  --line: #d9d2bd;
  --edge: #8b8774;
  --accent: #a63a0c;
  --accent-ink: #ffffff;
  --accent-soft: #f7e3d3;
  --info: #1f5a86;
  --ok: #17663a;
  --ok-soft: #dcefe2;
  --close: #7a5300;
  --close-soft: #f6ebd2;
  --bad: #a2261f;
  --bad-soft: #f8e1de;
  --focus: #1b5fd0;
  --rule: #a9c0d6;
  --margin: #c8513c;
  --thead: #e7dfc8;
  --void: #ece6d4;
  --smudge: #b9b19a;
  --rod: #fffef8;
  --rod-ink: #151515;
  --rod-red: #c0261c;
  --hair: #d4141b;
  --view: #2a2f2c;
  --g1: #dfe5ea;
  --g2: #a8b6c2;
  --ground: #6b3e12;
  --user: #a63a0c;
  --head: Rockwell, "Roboto Slab", "Zilla Slab", "Bookman Old Style", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  --r: 3px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131814;
    --paper: #1b221d;
    --ink: #e7ecdf;
    --muted: #a9b3a6;
    --line: #2e3830;
    --edge: #66705f;
    --accent: #f39a63;
    --accent-ink: #231000;
    --accent-soft: #3a2416;
    --info: #8cc3f0;
    --ok: #8adca6;
    --ok-soft: #14301f;
    --close: #f0c56b;
    --close-soft: #352a12;
    --bad: #ff9c8f;
    --bad-soft: #3a1c18;
    --focus: #8ab8ff;
    --rule: #34495a;
    --margin: #b4553f;
    --thead: #232c26;
    --void: #20271f;
    --smudge: #4d5347;
    --rod: #f4f1e6;
    --hair: #e0261f;
    --view: #0c0f0d;
    --g1: #26302b;
    --g2: #44524b;
    --ground: #e3a86a;
    --user: #f39a63;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.55 var(--sans); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
a { color: var(--info); text-underline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

.hero { padding: 18px 0 4px; max-width: 860px; }
h1 { font: 700 clamp(1.8rem, 5.4vw, 2.6rem)/1.08 var(--head); margin: 0 0 8px; letter-spacing: 0; }
.lede { margin: 0 0 12px; color: var(--muted); max-width: 70ch; }
h2 { font: 700 1.3rem/1.2 var(--head); margin: 0 0 10px; }

.tool { display: flex; flex-direction: column; }
.setup { order: 1; margin: 8px 0 4px; padding-top: 10px; border-top: 2px solid var(--ink); }
.work-area { order: 2; min-width: 0; }
.refcard { order: 3; }
@media (min-width: 1020px) {
  .tool { display: grid; grid-template-columns: minmax(0, 1fr) 320px; column-gap: 34px; align-items: start; }
  .setup { grid-column: 1; grid-row: 1; }
  .refcard { grid-column: 2; grid-row: 1; margin-top: 8px; }
  .work-area { grid-column: 1; grid-row: 2; }
  /* a book wider than its column takes the free width beside it (the rules card sits beside the setup only) */
  .work-area .bookwrap { width: max-content; min-width: 100%; max-width: calc(100% + 354px); }
}
fieldset { border: 0; padding: 0; margin: 0 0 10px; min-width: 0; }
legend { font-weight: 700; padding: 0; margin-bottom: 6px; }
.tdet { margin: 0 0 10px; }
.tdet > summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; gap: 6px; list-style: none; }
.tdet > summary::-webkit-details-marker { display: none; }
.tdet > summary::before { content: "+"; font-family: var(--mono); font-weight: 700; color: var(--accent); width: 1ch; }
.tdet[open] > summary::before { content: "−"; }
.tdet .tsum { font-weight: 400; color: var(--muted); font-size: 0.92rem; }
.toggles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.tg { position: relative; display: block; cursor: pointer; }
.tg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.tg span { display: flex; flex-direction: column; justify-content: center; min-height: 44px; height: 100%; padding: 5px 10px 5px 32px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); color: var(--muted); line-height: 1.2; }
.tg span::before { content: ""; position: absolute; left: 10px; top: 50%; width: 14px; height: 14px; margin-top: -8px; border: 2px solid var(--edge); border-radius: 2px; }
.tg b { font-size: 0.95rem; font-weight: 600; }
.tg small { display: none; color: var(--muted); font-size: 0.84rem; }
.tg.off { cursor: not-allowed; }
.tg.off span { background: var(--void); color: var(--edge); border-style: dashed; }
@media (min-width: 1020px) { .tg small { display: block; } .tg span::before { top: 9px; margin-top: 0; } .tg input:checked + span::after { top: 10px !important; margin-top: 0 !important; } }
.tg input:checked + span { color: var(--ink); border-color: var(--edge); }
.tg input:checked + span::before { border-color: var(--accent); background: var(--accent); }
.tg input:checked + span::after { content: ""; position: absolute; left: 15px; top: 50%; width: 4px; height: 8px; margin-top: -7px; border: solid var(--accent-ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.tg input:focus-visible + span, .sg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.tg .short { display: none; }
.setgrid { display: grid; gap: 0 12px; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
@media (min-width: 700px) { .setgrid { gap: 0 20px; } }
.seg { display: grid; border: 1px solid var(--edge); border-radius: var(--r); overflow: hidden; }
.seg3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.seg2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sg { position: relative; display: block; cursor: pointer; }
.sg + .sg { border-left: 1px solid var(--edge); }
.sg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.sg input:disabled { cursor: not-allowed; }
.sg > span { display: flex; align-items: center; justify-content: center; min-height: 44px; height: 100%; padding: 4px; text-align: center; font-size: 0.92rem; font-weight: 600; background: var(--paper); line-height: 1.15; }
.sg input:checked + span { background: var(--accent); color: var(--accent-ink); }
.sg input:disabled + span { color: var(--edge); background: var(--void); }
.cardset { max-width: 480px; }
.lvhint { margin: 4px 0 0; font-size: 0.86rem; color: var(--muted); }
.lvhint:empty { display: none; }
.setrow { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; }
label.inline { display: flex; align-items: center; gap: 8px; font-weight: 600; }
select, input { font: inherit; font-size: 16px; color: var(--ink); background: var(--paper); border: 1px solid var(--edge); border-radius: var(--r); min-height: 44px; padding: 6px 10px; }
select { max-width: 100%; }
.btn { font: inherit; font-weight: 650; min-height: 44px; padding: 8px 16px; border-radius: var(--r); border: 1px solid var(--ink); background: var(--paper); color: var(--ink); cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.small { padding: 6px 14px; }
.btn:hover { filter: brightness(0.95); }
.link { font: inherit; background: none; border: 0; padding: 10px 0; min-height: 44px; color: var(--info); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

/* the reference card: rules for this level, like the inside cover of a level book */
.refcard { margin: 16px 0 6px; padding: 10px 14px 10px; background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--margin); max-width: 560px; font-size: 0.92rem; }
.refcard h2 { font-size: 1.05rem; margin: 0 0 4px; }
.refcard dl { margin: 0; }
.refcard dt { font-weight: 650; padding-top: 5px; border-top: 1px solid var(--line); }
.refcard dt:first-child { border-top: 0; padding-top: 0; }
.refcard dd { margin: 0 0 5px; color: var(--muted); line-height: 1.35; }
.refcard .cardsub { margin: 8px 0 2px; font-weight: 650; }
.refcard .sc { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
.refcard .sc td { padding: 2px 6px 2px 0; border-bottom: 1px solid var(--line); }
.refcard .sc td:last-child { white-space: nowrap; padding-right: 0; }

.note { overflow-wrap: anywhere; margin: 12px 0; padding: 10px 12px; border-left: 5px solid var(--close); background: var(--close-soft); }
.note.info { border-left-color: var(--info); background: var(--paper); }
.note .link { min-height: 0; padding: 0; font-weight: 600; }

/* the sheet */
.sheet { margin: 12px 0 0; }
.sheet:focus { outline: none; }
.sheet-head { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; border-bottom: 2px solid var(--ink); padding-bottom: 4px; }
.sheet-head h2 { margin: 0; font-size: 1.3rem; }
.code { font-family: var(--mono); letter-spacing: 0.08em; color: var(--accent); }
.score { margin: 0; font-size: 0.95rem; color: var(--muted); }
.practice { margin: 6px 0 0; font-size: 0.93rem; color: var(--muted); }
.qs { list-style: none; margin: 0; padding: 0; }
.q { border-bottom: 1px solid var(--line); padding: 20px 0 10px; }
.qhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.q h3 { font: 700 1.18rem/1.25 var(--head); margin: 0 0 4px; }
.q h3 .qn { color: var(--accent); margin-right: 6px; }
.q .scen { margin: 0 0 10px; max-width: 75ch; }
.zoom { flex: none; background: transparent; }
@media (min-width: 900px) { .zoom { display: none; } }

/* the level book */
.bookwrap { overflow-x: auto; margin: 0 0 8px; max-width: 100%; }
table.book { border-collapse: collapse; background: var(--paper); font-variant-numeric: tabular-nums; border: 1px solid var(--edge); min-width: 100%; }
table.book th, table.book td { padding: 0 6px; height: 40px; border-bottom: 1px solid var(--rule); border-left: 1px solid var(--line); white-space: nowrap; }
table.book thead th { background: var(--thead); font: 650 0.86rem/1.2 var(--sans); text-align: center; height: 34px; border-bottom: 2px solid var(--edge); }
table.book .c-pt { text-align: left; font-weight: 650; border-right: 2px solid var(--margin); position: sticky; left: 0; background: var(--paper); z-index: 1; min-width: 4.4em; }
table.book thead .c-pt { background: var(--thead); }
table.book .num { font-family: var(--mono); text-align: right; font-size: 0.95rem; }
table.book .given { font-weight: 700; }
table.book .c-rem { color: var(--muted); font-size: 0.86rem; white-space: normal; min-width: 9em; }
table.book td.blank { padding: 0 2px; background: var(--paper); }
table.book td.blank input { width: 6.9em; min-height: 36px; border: 0; border-bottom: 1px dashed var(--edge); border-radius: 0; background: transparent; padding: 4px 4px; font-family: var(--mono); text-align: right; }
table.book td.blank input:focus { background: var(--accent-soft); }
table.book td.is-right { background: var(--ok-soft); }
table.book td.is-right input { border-bottom: 2px solid var(--ok); }
table.book td.is-wrong, table.book td.is-unread { background: var(--bad-soft); }
table.book td.is-wrong input, table.book td.is-unread input { border-bottom: 2px solid var(--bad); }
table.book td.is-close { background: var(--close-soft); }
table.book td.is-close input { border-bottom: 2px solid var(--close); }
table.book td.smudge { text-align: center; }
table.book td.blank.smudge:not([class*="is-"]) { background: color-mix(in srgb, var(--smudge) 35%, var(--paper)); }
table.book td.blank.smudge input { text-align: right; }
table.book td.smudge span { display: inline-block; min-width: 3.4em; border-radius: 40% 55% 45% 60%; background: var(--smudge); color: var(--ink); font-weight: 700; font-family: var(--mono); }
table.book td.void { background: var(--void); }
table.book tr.sumrow th, table.book tr.sumrow td { border-top: 3px double var(--edge); }
table.book .kv { font-weight: 700; color: var(--accent); }
table.book .rm { display: none; }
@media (max-width: 760px) {
  table.book.has-rem .c-rem { display: none; }
  table.book .rm { display: block; font-weight: 400; font-size: 0.78rem; color: var(--muted); line-height: 1.15; white-space: normal; max-width: 7.5em; padding-bottom: 2px; }
  table.book th, table.book td { padding: 0 4px; }
  table.book td.blank input { width: 5.3em; }
  .swipe { display: block; }
}
.swipe { display: none; margin: -2px 0 8px; font-size: 0.86rem; color: var(--muted); }
.cellnotes:empty { display: none; }
.cellfb { margin: 4px 0 10px; padding-left: 1.2em; max-width: 75ch; font-size: 0.94rem; }
.cellfb li { margin: 2px 0; }
.cellfb li.wrong, .cellfb li.unread { color: var(--bad); }
.cellfb li.close { color: var(--close); }

/* the rod, seen through the level */
.rods { display: grid; gap: 12px; }
.rodset { margin: 0; }
.rodset figcaption { font-size: 0.95rem; margin-bottom: 4px; }
.wins { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; max-width: 540px; }
.win { text-align: center; font-size: 0.86rem; color: var(--muted); }
svg.rodv { display: block; width: 100%; height: auto; }
.rodv .vbg { fill: var(--view); }
.rodv .vring { fill: none; stroke: var(--edge); stroke-width: 3; }
.rodv { max-width: 180px; margin: 0 auto; }
.rodv .rodface { fill: var(--rod); }
.rodv .rk { fill: var(--rod-ink); }
.rodv .rft { font: 700 11px var(--sans); fill: var(--rod-red); }
.rodv .rtn { font: 700 18px var(--sans); fill: var(--rod-ink); }
.rodv .hair { stroke: var(--hair); stroke-width: 1.3; }
.rodv .halo { stroke: #fff; stroke-width: 3.4; stroke-opacity: 0.9; }
.rodnote { margin: 6px 0 10px; font-size: 0.9rem; color: var(--muted); max-width: 75ch; }

/* the long section */
.secwrap { margin: 6px 0 10px; max-width: 700px; }
svg.section { display: block; width: 100%; height: auto; background: var(--paper); }
.section .g1 { stroke: var(--g1); stroke-width: 0.6; }
.section .g2 { stroke: var(--g2); stroke-width: 0.9; }
.section .gv { stroke: var(--g1); stroke-width: 0.5; }
.section text.gv { stroke: none; }
.section .gbox { fill: none; stroke: var(--ink); stroke-width: 1; }
.section .yl { font: 10px var(--sans); fill: var(--ink); text-anchor: end; }
.section .xl { font: 10px var(--sans); fill: var(--ink); text-anchor: middle; }
.section .axt { font: 600 10.5px var(--sans); fill: var(--ink); text-anchor: middle; }
.section .ground { fill: none; stroke: var(--ground); stroke-width: 2; }
.section .gpt { fill: var(--ground); }
.section text.gv { font: 9px var(--mono); fill: var(--ink); paint-order: stroke; stroke: var(--paper); stroke-width: 3px; stroke-linejoin: round; }
.section .formation { stroke: var(--ink); stroke-width: 1.4; stroke-dasharray: 6 4; }
.section .uline { fill: none; stroke: var(--user); stroke-width: 2; }
.section .upt { fill: var(--user); }
.tapnote { margin: 4px 0 0; font-size: 0.88rem; color: var(--muted); }
.keyfig { max-width: 620px; margin: 6px 0 8px; }
.figview { overflow: hidden; }
.qs.zoomed .figview { overflow-x: auto; }
.qs.zoomed .figview > svg.section { width: 200%; max-width: none; }
.qs.zoomed .figview .wins { max-width: none; width: 200%; }
@media (min-width: 900px) { .qs.zoomed .figview > svg.section { width: 100%; } .qs.zoomed .figview .wins { width: auto; max-width: 540px; } .qs.zoomed .figview { overflow: hidden; } }

/* questions below the book */
.qparts { max-width: 760px; }
.part { margin: 0 0 14px; min-width: 0; }
.part > .prompt, .part legend { display: block; font-weight: 600; margin: 0 0 6px; }
.opts { display: grid; gap: 4px; }
.opts.row { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); max-width: 680px; }
.opt { position: relative; display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); cursor: pointer; }
.opt input { margin: 3px 0 0; min-height: 0; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.opt .ot { min-width: 0; }
.opt:has(input:checked) { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.ain { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.ain input { width: 9em; max-width: 100%; font-family: var(--mono); }
.ain .unit { color: var(--muted); white-space: nowrap; }
.qfoot { display: flex; align-items: center; gap: 4px 16px; flex-wrap: wrap; }
.fbwrap:empty { display: none; }
.fb { margin: 6px 0 0; padding: 6px 10px; border-radius: var(--r); max-width: 70ch; }
.fb.right { background: var(--ok-soft); color: var(--ok); }
.fb.close { background: var(--close-soft); color: var(--close); }
.fb.wrong, .fb.unread { background: var(--bad-soft); color: var(--bad); }
.part.is-right .ain input { border-color: var(--ok); box-shadow: inset 0 0 0 1px var(--ok); }
.part.is-wrong .ain input { border-color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); }
.part.is-close .ain input { border-color: var(--close); box-shadow: inset 0 0 0 1px var(--close); }
.work { margin-top: 4px; }
.work > summary { cursor: pointer; color: var(--muted); font-size: 0.93rem; padding: 10px 0; min-height: 44px; display: flex; align-items: center; list-style: none; }
.work > summary::-webkit-details-marker { display: none; }
.work > summary::before { content: "+"; margin-right: 6px; font-weight: 700; font-family: var(--mono); }
.work[open] > summary::before { content: "−"; }
.work .ans { margin: 8px 0 2px; }
.steps { margin: 2px 0 8px; padding-left: 1.3em; font-size: 0.94rem; overflow-wrap: anywhere; }
.ask { display: inline-flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; padding: 6px 10px; background: var(--close-soft); border-radius: var(--r); }
.ask .link { padding: 0 4px; }
.ask[hidden] { display: none; }
.sheet-foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px 0; }

.share { margin: 10px 0 8px; }
.print-row { display: flex; align-items: flex-end; gap: 8px 10px; flex-wrap: wrap; }
.print-row label, .share-out label { display: flex; flex-direction: column; gap: 3px; font-size: 0.9rem; font-weight: 600; }
.share-out input { width: 100%; }
.recent { margin-top: 12px; border-top: 1px solid var(--line); }
.recent summary { cursor: pointer; padding: 11px 0; font-weight: 600; min-height: 44px; }
.recent ul { list-style: none; margin: 0; padding: 0; }
.recent li { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding: 4px 0; }
.recent small { display: block; color: var(--muted); }
.hint { color: var(--muted); font-size: 0.9rem; margin: 8px 0 10px; }

.toast { position: fixed; left: 50%; bottom: 16px; transform: translate(-50%, 160%); background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: var(--r); max-width: calc(100% - 32px); transition: transform 0.2s; z-index: 20; }
.toast.on { transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* content */
.content { padding: 22px 0 8px; max-width: 840px; }
.content h2 { margin-top: 30px; }
.content p { max-width: 70ch; }
.ltab { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
.ltab th, .ltab td { text-align: left; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.ltab th { font-size: 0.88rem; color: var(--muted); font-weight: 600; }
.ltab td:first-child { font-weight: 600; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 11px 0; font-weight: 600; min-height: 44px; }
.faq details p { margin: 0 0 12px; }
.sources { font-size: 0.92rem; color: var(--muted); overflow-wrap: anywhere; margin-top: 22px; }

footer { border-top: 1px solid var(--line); margin-top: 20px; padding: 16px 0 28px; color: var(--muted); font-size: 0.92rem; }
.indep { margin: 0 0 10px; }
.sb-footer p { margin: 6px 0; }
.sb-more { line-height: 1.8; }
.sb-footer a { color: var(--ink); }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }

@media (max-width: 600px) {
  .toggles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
  .tg .long { display: none; }
  .tg .short { display: block; }
  .tg span { padding: 5px 2px; text-align: center; align-items: center; font-size: 0.86rem; }
  .tg span::before, .tg input:checked + span::after { display: none; }
  .tg input:checked + span { background: var(--ink); color: var(--bg); border-color: var(--ink); }
  .sg > span { font-size: 0.84rem; }
  .ltab { font-size: 0.92rem; }
  .ltab thead { display: none; }
  .ltab tr { display: block; padding: 6px 0; border-bottom: 1px solid var(--line); }
  .ltab td { display: block; border: 0; padding: 1px 0; }
}

/* print: worksheet and key only; books as ruled tables with room to write */
.print-root { display: none; }
@page { margin: 0.45in 0.5in; }
@media print {
  :root { --ink: #000; --muted: #333; --line: #999; --paper: #fff; --edge: #555; --rule: #888; --margin: #000; --thead: #fff; --void: #fff;
    --rod: #fff; --rod-ink: #000; --rod-red: #000; --hair: #000; --view: #fff; --g1: #b5b5b5; --g2: #555; --ground: #000; --user: #000; --accent: #000; }
  body { background: #fff; color: #000; font: 10.5pt/1.38 var(--sans); }
  main, footer, .toast, .skip { display: none !important; }
  .print-root { display: block; }
  svg { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  table.pt { width: 100%; border-collapse: collapse; }
  table.pt > tbody > tr > td, table.pt > thead > tr > td { padding: 0; }
  .prun { font: 8.5pt var(--sans); color: #444; text-align: right; padding-bottom: 6pt !important; }
  .ph { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2pt solid #000; margin-bottom: 6pt; }
  .ph h2 { font: 700 15pt var(--head); margin: 0; }
  .ph p { margin: 0; }
  .pmeta { display: flex; justify-content: space-between; gap: 12pt; margin: 4pt 0 6pt; }
  .plabel { margin: 0 0 6pt; font-size: 9pt; font-style: italic; }
  .pq { list-style: none; margin: 0; padding: 0; }
  .pq > li { padding: 6pt 0 8pt; border-bottom: 0.75pt solid #999; break-inside: avoid; page-break-inside: avoid; }
  .pq h3 { font: 700 11.5pt var(--head); margin: 0 0 2pt; break-after: avoid; page-break-after: avoid; }
  .pq .pscen { margin: 0 0 5pt; }
  /* the book on paper: every cell ruled, rows tall enough to write in */
  .bookwrap { overflow: visible; margin: 0 0 6pt; }
  table.book { width: 100%; min-width: 0; table-layout: fixed; border: 1pt solid #000; font-size: 9.5pt; break-inside: avoid; page-break-inside: avoid; }
  /* widths on the header row: room to write in every column that is filled in */
  table.book thead .c-pt { width: 17mm; }
  table.book thead .c-bs, table.book thead .c-is, table.book thead .c-fs { width: 18mm; }
  table.book thead .c-hi, table.book thead .c-rl, table.book thead .c-rise, table.book thead .c-fall, table.book thead .c-corr, table.book thead .c-adj { width: 22mm; }
  table.book thead .c-rem { width: auto; }
  table.book th, table.book td { height: 7.2mm; border: 0.6pt solid #777; padding: 0 4pt; position: static; }
  table.book thead th { height: 6mm; border-bottom: 1.2pt solid #000; font-size: 8.5pt; background: #fff; white-space: normal; line-height: 1.1; }
  table.book .c-pt { border-right: 1.2pt solid #000; min-width: 0; background: #fff; }
  table.book .c-rem { font-size: 8pt; min-width: 0; overflow-wrap: anywhere; }
  table.book .num { font-size: 9.5pt; }
  /* Σ-row cells with nothing to fill in are shaded, so students know which sums to write */
  table.book td.void { background: #e4e4e4; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  table.book tr.sumrow th, table.book tr.sumrow td { border-top: 1.6pt double #000; }
  table.book td.smudge span { background: #fff; border: 0.8pt dashed #000; }
  table.book td.blank.smudge { background: #fff; text-align: left; }
  table.book td.blank.smudge span { min-width: 0; padding: 0 3pt; font-size: 8pt; }
  table.book .kv { color: #000; }
  table.book .rm { display: none !important; }
  .pfig .rods { display: grid; grid-template-columns: 1fr; gap: 0.5mm; }
  .pfig .rodset { display: grid; grid-template-columns: 30mm auto; align-items: center; }
  .pfig .wins { max-width: none; gap: 3mm; grid-template-columns: repeat(3, 35mm); }
  .pfig svg.rodv { width: 35mm; max-width: none; margin: 0 auto; }
  .pfig .rodset figcaption { font-size: 9.5pt; }
  .pfig .rodv .vring { stroke: #000; stroke-width: 2; }
  .pfig .rodv .rodface { stroke: #000; stroke-width: 1; }
  .pfig .rodnote { font-size: 8.5pt; margin: 1pt 0 3pt; color: #000; }
  .psec svg.section, .pkfig svg.section { width: 165mm; max-width: 100%; }
  .psec { break-inside: avoid; page-break-inside: avoid; margin: 2mm 0; }
  table.prodt { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 9pt; margin: 1mm 0 3mm; break-inside: avoid; page-break-inside: avoid; }
  table.prodt th, table.prodt td { border: 0.6pt solid #777; height: 8mm; padding: 0 4pt; text-align: left; }
  table.prodt thead th { height: 6mm; border-bottom: 1.2pt solid #000; font-weight: 600; }
  table.prodt tbody th { width: 30mm; font-weight: 600; }
  .pparts { font-size: 9.5pt; display: grid; grid-template-columns: 1fr 1fr; gap: 0 8mm; }
  .pparts .pp { margin: 0 0 3pt; break-inside: avoid; page-break-inside: avoid; }
  .pparts .pp p { margin: 0 0 2pt; }
  .pparts .pline { margin-top: 4pt !important; }
  .pparts .popts { font-size: 8.8pt; line-height: 1.3; }
  .pparts .popts span { margin-right: 8pt; white-space: nowrap; }
  .pkey { break-before: page; page-break-before: always; }
  .pk { margin: 0; padding-left: 0; list-style: none; }
  .pk > li { padding: 4pt 0 6pt; border-bottom: 0.75pt solid #bbb; }
  .pk h3 { font: 700 10.5pt var(--head); margin: 0 0 3pt; break-after: avoid; page-break-after: avoid; }
  .pk table.book { font-size: 9pt; }
  .pk table.book th, .pk table.book td { height: 5.6mm; }
  .pkt { width: 100%; border-collapse: collapse; font-size: 8.8pt; margin: 3pt 0; }
  .pkt td { border-bottom: 0.5pt solid #bbb; padding: 1.5pt 4pt 1.5pt 0; vertical-align: top; }
  .pkt tr { break-inside: avoid; page-break-inside: avoid; }
  .pkt .pkq { width: 34%; }
  .pkt .pka { width: 18%; font-weight: 700; }
  .pkt .pkw { color: #222; }
  .pk p { margin: 1pt 0 0; }
  .pk .pka { font-weight: 700; }
  .pk ul { margin: 1pt 0 0; padding-left: 13pt; font-size: 8.8pt; line-height: 1.3; }
  .pkcells summary { font-weight: 600; font-size: 9pt; list-style: none; break-after: avoid; page-break-after: avoid; }
  /* the heading travels with the first lines of its list */
  .pkc li:nth-child(-n+2) { break-before: avoid; page-break-before: avoid; }
  .pkcells summary::-webkit-details-marker { display: none; }
  .pkc { columns: 2; column-gap: 8mm; }
  .pkc li { break-inside: avoid; }
  .pkfig { margin: 2mm 0; break-inside: avoid; page-break-inside: avoid; }
}
