  :root{ --ink:#1A1917; --muted:#6B6862; --line:#D6CFBF; --line-soft:#E7E1D6; --paper:#FFFFFF; --bg:#F6F3EC; --ash:#EFEBE2; --zebra:#F6F3EC; --red:#C8321F; --red-dark:#A82A19; --blue:#1D4ED8; --blue-dark:#1E40AF; --green:#047857; --sec-formula:#B91C1C; --sec-words:#0E7490; --sec-worked:#047857; --sec-mistake:#9A3412; --sec-table:#1D4ED8; --sec-exam:#3730A3; --sec-formula-bg:#FBF6F6; --sec-words-bg:#F4FAFB; --sec-worked-bg:#F5FAF6; --sec-mistake-bg:#FBF7F4; --tag-info-ink:#0E7490; --tag-info-bg:#CFFAFE; --tag-ref-ink:#3730A3; --tag-ref-bg:#E0E7FF; --tag-warn-ink:#92400E; --tag-warn-bg:#FEF3C7; --tag-warn-line:#FCD34D; --tag-note-bg:#EFF6FF; }
  *{ box-sizing:border-box; } html,body{ margin:0; padding:0; }
  body{ font-family:'Segoe UI',Arial,sans-serif; color:var(--ink); line-height:1.3; }
  /* GLOBAL RULE (owner 2026-07-06): an equation/expression never splits across two lines on a printed
     resource — keep each rendered math atom on one line (it moves whole to the next line if it must). */
  .katex{ white-space:nowrap; }
  @page{ size:A4; margin:8mm; }
  svg line,svg path{ shape-rendering:geometricPrecision; }
  body{ print-color-adjust:exact; -webkit-print-color-adjust:exact; }
  .ft{ position:fixed; bottom:2mm; left:0; right:0; display:flex; align-items:center; justify-content:center;
       gap:6px; font-size:8px; color:var(--muted); } .ft img{ height:10px; opacity:.7; }
  .ft span{ position:relative; top:1.5px; }
  .printbtn{ position:fixed; top:14px; right:16px; z-index:99; background:var(--red); color:#fff; border:none;
       border-radius:9px; padding:9px 16px; font:700 14px/1 'Segoe UI',Arial,sans-serif; cursor:pointer;
       box-shadow:0 2px 8px rgba(0,0,0,.18); }
  .printbtn:hover{ background:var(--red-dark); }
  /* screen-only headroom so the fixed Print button never sits over the sheet header (print unaffected) */
  @media screen{ body{ padding-top:54px; } }
  @media print{ .printbtn{ display:none !important; } }