/* ព្រះត្រៃបិដក ៨២ — paper-first reading UI, dark mode one tap away.
   Light is the default because this is a site people read for long
   stretches; the gold identity is kept as an accent, not as the ground. */

:root{
  --paper:#f4efe4; --paper2:#fbf8f1; --surface:#ffffff;
  --ink:#241c14; --ink2:#4a3d31; --muted:#6f5f4d;  /* AA contrast on --paper */
  --gold:#875c18; --gold-soft:#c9a24a;   /* AA as text on paper, sepia and white, and under white text */
  --accent:#7a4a1c;
  --line:rgba(36,28,20,.13); --line2:rgba(36,28,20,.07);
  --r:14px; --r-lg:20px; --r-pill:999px;
  --max:1080px; --gut:40px; --read:min(620px, calc(100% - var(--gut)));
  --pgpad:clamp(18px,6vw,72px);   /* side margin of a page-turn screen */
  --ui:"Noto Sans Khmer","Battambang",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  --serif:"Battambang","Noto Serif Khmer","Noto Sans Khmer",serif;
  /* Pāli in the reading face, set apart by weight only: Noto Serif Khmer Bold (used
     until 2026-10) stood 8% taller, 17% wider and 42% darker than Battambang, so
     every Pāli word jumped out of the line */
  --pali:"Battambang","Noto Sans Khmer",serif;
  --mono:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  --fs:18px; --lh:1.95;                   /* reader, user-adjustable */
  /* ---- UX1 tokens (2026-11-12).  Every scale the sheet uses, in one place; css/dict.css
     carries a copy of this block (keep them in step).  css/chat.css reads these. ---- */
  /* type: the UI scale.  Khmer letters never go under --fz-xs (12px); --fz-2xs is for digits only.
     (inputs keep a literal 16px: under it iOS zooms the page) */
  --fz-2xs:11px; --fz-xs:12px; --fz-sm:13px; --fz-md:14px; --fz-lg:15px; --fz-xl:16px; --fz-2xl:18px; --fz-3xl:20px;
  /* the old half steps (12.5 / 13.5 / 14.5 / 15.5) now sit on the whole step above; the reader page keeps
     them (see "the reader keeps its measure" below) until its own phase */
  --fz-xs-h:var(--fz-sm); --fz-sm-h:var(--fz-md); --fz-md-h:var(--fz-lg); --fz-lg-h:var(--fz-xl);
  /* Khmer stacks marks above and below the line: a heading gets 1.45, one-line labels 1.6,
     anything that wraps 1.7 or more */
  --lh-display:1.45; --lh-snug:1.6; --lh-ui:1.7; --lh-text:1.75;
  /* space */
  --sp-1:4px; --sp-2:8px; --sp-3:12px; --sp-4:16px; --sp-5:24px; --sp-6:32px;
  /* corners: --r-sm, --r-md, --r, --r-lg, --r-pill */
  --r-sm:8px; --r-md:12px;
  /* depth: 1 resting card, 2 raised card, 3 overlay (menus, sheets, toasts) */
  --shadow-1:0 1px 2px rgba(36,28,20,.06);
  --shadow-2:0 1px 2px rgba(36,28,20,.05), 0 6px 20px -6px rgba(36,28,20,.14);
  --shadow-3:0 2px 6px rgba(36,28,20,.06), 0 20px 48px -12px rgba(36,28,20,.26);
  /* surfaces, back to front: --paper (the page), --paper2 (a tinted band), --surface (a card);
     --tint is a chosen option: outlined in gold, washed with it, ink unchanged */
  --tint:color-mix(in srgb, var(--gold) 11%, var(--surface));
  --shadow:var(--shadow-2); --shadow-lg:var(--shadow-3);   /* the old names (css/chat.css, css/dict.css, read.html) */
  /* motion */
  --dur-1:.12s; --dur-2:.16s; --dur-3:.24s; --ease:ease; --ease-out:cubic-bezier(.2,.9,.3,1);
  /* layers, bottom to top */
  --z-under:-1; --z-sticky:30; --z-nav:40; --z-bar:50; --z-tabbar:55; --z-pop:60; --z-float:70; --z-toast:75;
  --z-scrim:80; --z-panel:90; --z-tip:95; --z-modal:100; --z-menu:110; --z-top:200;
  /* ink on a solid gold fill; the state colours; one colour per edition (110 / commentary / Pali / library) */
  --on-gold:#fff; --on-soft:var(--ink);   /* ink on a --gold fill, on a --gold-soft fill */
  --danger:#a83a29; --ok:#2c5f43; --ok-bg:rgba(44,95,67,.12);
  --field-line:rgba(36,28,20,.58);        /* the edge of something you type into: 3:1 against the page */
  --ed-pe:#8f3424; --ed-atk:#33409a; --ed-ce:#23583f; --ed-pk:#9c4b10; --ed-en:#6a2c62;
  --en-cover:#6a2c62; --en-cover-ink:#f6e6c4;   /* the English edition's drawn cover: the same in every theme, as a printed cover is */
  color-scheme: light;
}
:root[data-theme="dark"]{
  --paper:#14100b; --paper2:#1a150f; --surface:#211a13;
  --ink:#efe7da; --ink2:#d3c7b6; --muted:#9c8d7c;
  --gold:#d8b25c; --gold-soft:#f0d48a;
  --accent:#e0bd73;
  --line:rgba(240,228,210,.14); --line2:rgba(240,228,210,.07);
  --shadow-1:0 1px 2px rgba(0,0,0,.36);
  --shadow-2:0 1px 2px rgba(0,0,0,.36), 0 6px 20px -6px rgba(0,0,0,.5);
  --shadow-3:0 2px 6px rgba(0,0,0,.4), 0 20px 48px -12px rgba(0,0,0,.7);
  --tint:color-mix(in srgb, var(--gold) 14%, var(--surface));
  --on-gold:#1a140c; --on-soft:#1a140c; --danger:#f08a76; --ok:#68d8b2; --ok-bg:rgba(104,216,178,.14);
  --ed-pe:#f0a993; --ed-atk:#a9b5f2; --ed-ce:#68d8b2; --ed-pk:#f5b374; --ed-en:#e3aedc; --field-line:rgba(240,228,210,.42);
  color-scheme: dark;
}
:root[data-theme="sepia"]{
  --paper:#efe2c9; --paper2:#f7ecd8; --surface:#fdf6e8;
  --ink:#3a2b18; --ink2:#5a462c; --muted:#6a5233;
  --line:rgba(58,43,24,.16); --line2:rgba(58,43,24,.08);
  --gold:#7a5214; --ed-pk:#8a400c; --field-line:rgba(58,43,24,.66);   /* AA on the sepia paper and its tints */
  color-scheme: light;
}

*{ box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; -webkit-tap-highlight-color:transparent;
  scroll-behavior:smooth; }
@media (prefers-reduced-motion: reduce){ html{ scroll-behavior:auto; } }
body{
  margin:0; min-height:100%;
  font-family:var(--ui); color:var(--ink);
  background:var(--paper);
  -webkit-font-smoothing:antialiased;
  /* nothing on a phone should be able to push a horizontal scrollbar;
     clip (not hidden) so sticky headers keep working */
  overflow-x:hidden;
  overflow-x:clip;
  /* keep content clear of the notch / rounded corners in landscape */
  padding-left:env(safe-area-inset-left);
  padding-right:env(safe-area-inset-right);
}
/* no 300ms tap delay, no accidental double-tap zoom on controls */
a, button, summary, .chip, .tab, .iconBtn, .pnum, .fnref, .row, .vol,
.tocItem, .contCard, .clip{ touch-action:manipulation; }
a{ color:inherit; }
button{ font:inherit; color:inherit; }
:focus-visible{ outline:2px solid var(--gold); outline-offset:2px; border-radius:var(--r-sm); }
.skip{ position:absolute; left:-9999px; }
.skip:focus{ left:12px; top:12px; z-index:var(--z-top); background:var(--surface);
  padding:10px 14px; border-radius:var(--r-md); box-shadow:var(--shadow-2); }

/* ---------- top bar ---------- */
.top{
  position:sticky; top:0; z-index:var(--z-bar);
  background:color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter:saturate(1.4) blur(10px);
  border-bottom:1px solid var(--line2);
  padding-top:env(safe-area-inset-top);
}
.topIn{ width:min(var(--max), calc(100% - 32px)); margin:0 auto;
  display:flex; align-items:center; gap:var(--sp-3); padding:10px 0; }
.brand{ display:flex; align-items:center; gap:10px; text-decoration:none;
  flex:0 0 auto; }
.mark{ width:34px; height:34px; flex:0 0 auto; color:var(--gold); }
.brand b{ font-size:var(--fz-lg); font-weight:700; letter-spacing:-.01em;
  white-space:nowrap; }
.brand span{ display:block; font-size:var(--fz-xs); color:var(--muted); font-weight:400; }

.search{ flex:1 1 auto; position:relative; min-width:0; }
.search input{
  width:100%; font-family:var(--ui); color:var(--ink);
  background:var(--surface); border:1px solid var(--line);
  border-radius:var(--r-pill); padding:10px 14px 10px 40px;
  /* MUST stay >= 16px: iOS Safari zooms the page when you focus a field
     with a smaller font, and the zoom is not undone on blur. Do not shrink
     this to make the bar look tighter — restrict the padding instead. */
  font-size:16px;
}
/* same rule for anything else the user can type into */
input, select, textarea{ font-size:16px; }
.search input::placeholder{ color:var(--muted); }
.search svg{ position:absolute; left:14px; top:50%; transform:translateY(-50%);
  width:16px; height:16px; fill:var(--muted); pointer-events:none; }
.iconBtn{
  flex:0 0 auto; width:40px; height:40px; display:grid; place-items:center;
  background:transparent; border:0; color:var(--ink2);
  border-radius:var(--r-md); cursor:pointer; font-size:var(--fz-xl); line-height:1;
  transition:background-color var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}
.iconBtn:hover{ background:var(--line2); color:var(--ink); }
.iconBtn:active{ background:var(--line); }
.iconBtn .ic{ width:21px; height:21px; }
.ic{ flex:0 0 auto; }
/* the theme button shows what you would switch TO */
.iconBtn .icSun{ display:none; }
:root[data-theme="dark"] .iconBtn .icSun{ display:block; }
:root[data-theme="dark"] .iconBtn .icMoon{ display:none; }
.iconBtn[hidden]{ display:none; }

/* ---------- page shell ---------- */
.wrap{ width:min(var(--max), calc(100% - 32px)); margin:0 auto 96px; }
.hero{ padding:22px 0 8px; }
.hero h1{ margin:0 0 6px; font-size:clamp(20px,2.5vw,26px); line-height:1.3;
  letter-spacing:-.015em; }
.hero p{ margin:0; color:var(--muted); font-size:var(--fz-md); line-height:1.65;
  max-width:650px; }
.secHead{ display:flex; align-items:baseline; justify-content:space-between;
  gap:var(--sp-3); margin:34px 0 14px; }
.secHead h2{ margin:0; font-size:var(--fz-xl); letter-spacing:.01em; }
.secHead .hint{ font-size:var(--fz-sm); color:var(--muted); }

/* ---------- pitaka / volume browse ---------- */
.pitakaTabs{ display:flex; gap:var(--sp-2); flex-wrap:wrap; margin:18px 0 6px; }
.tab{ border:1px solid var(--line); background:var(--surface);
  border-radius:var(--r-pill); padding:var(--sp-2) var(--sp-4); font-size:var(--fz-md);
  cursor:pointer; white-space:nowrap; }
.tab[aria-selected="true"]{ background:var(--gold); color:var(--on-gold);
  border-color:var(--gold); font-weight:700; }
:root[data-theme="dark"] .tab[aria-selected="true"]{ color:var(--on-gold); }

/* nikāya / text groupings on the browse view */
.catParent{ font-size:var(--fz-lg); font-weight:700; margin:30px 0 4px;
  padding-bottom:6px; border-bottom:2px solid var(--gold-soft); }
.catHead{ display:flex; align-items:baseline; gap:10px; flex-wrap:wrap;
  margin:20px 0 8px; }
.catHead b{ font-size:var(--fz-md); letter-spacing:.01em; }
.catHead span{ font-size:var(--fz-xs); color:var(--muted); font-family:var(--mono);
  letter-spacing:.04em; }

/* volume view: វគ្គ → សូត្រ outline */
.vgWrap{ margin:18px 0 6px; }
.pannaHead{ font-size:var(--fz-sm); font-weight:700; color:var(--gold);
  letter-spacing:.02em; margin:18px 0 6px; }
.pannaHead:first-child{ margin-top:0; }
details.vg{ border:1px solid var(--line); border-radius:var(--r);
  background:var(--surface); margin:var(--sp-2) 0; overflow:hidden; }
details.vg > summary{ display:flex; align-items:baseline; gap:10px;
  padding:13px 15px; cursor:pointer; list-style:none;
  font-size:var(--fz-md-h); line-height:var(--lh-snug); }
details.vg > summary::-webkit-details-marker{ display:none; }
details.vg > summary::before{ content:"▸"; color:var(--gold);
  font-size:var(--fz-2xs); transform:translateY(-1px); }
details.vg[open] > summary::before{ content:"▾"; }
details.vg > summary span{ font-size:var(--fz-xs); color:var(--muted);
  font-family:var(--mono); margin-left:auto; white-space:nowrap; }
.vgList{ margin:0; padding:4px 0 10px; list-style:none;
  border-top:1px solid var(--line2); }
.vgList.open{ border:1px solid var(--line); border-radius:var(--r);
  background:var(--surface); padding:2px 0; margin-bottom:var(--sp-2); }
.vgList li{ padding:0; }
.vgList a, .vgList .miss, .vgList .ref{ display:flex; gap:var(--sp-2);
  align-items:baseline; text-decoration:none;
  padding:10px 16px 10px 26px; font-size:var(--fz-md); line-height:var(--lh-snug);
  border-top:1px solid var(--line2); }
.vgList li:first-child a, .vgList li:first-child .miss,
.vgList li:first-child .ref{ border-top:0; }
.vgList a:hover{ background:var(--paper2); }
.vgList .miss, .vgList .ref{ color:var(--muted); cursor:default; }
.vgList i{ margin-left:auto; font-style:normal; font-family:var(--mono);
  font-size:var(--fz-2xs); color:var(--muted); }
details.vg.allSec{ margin-top:var(--sp-4); }
details.vg.allSec .list{ border:0; border-radius:0; border-top:1px solid var(--line2); }

.vols{ display:grid; gap:10px; margin-top:14px;
  grid-template-columns:repeat(auto-fill,minmax(210px,1fr)); }
.vol{ display:block; text-decoration:none; background:var(--surface);
  border:1px solid var(--line); border-radius:var(--r); padding:12px 14px;
  transition:border-color var(--dur-1), transform var(--dur-1); }
.vol:hover{ border-color:var(--gold-soft); transform:translateY(-1px); }
.vol .n{ font-family:var(--mono); font-size:var(--fz-2xs); color:var(--gold);
  letter-spacing:.06em; }
.vol .t{ font-size:var(--fz-md-h); line-height:1.55; margin:3px 0 6px;
  display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2;
  line-clamp:2; overflow:hidden; }
.vol .m{ font-size:var(--fz-xs); color:var(--muted); }

/* ---------- section list (inside a volume) ---------- */
.crumb{ display:flex; align-items:center; gap:var(--sp-2); font-size:var(--fz-sm);
  color:var(--muted); margin:var(--sp-5) 0 var(--sp-1); }
.crumb a{ text-decoration:none; border-bottom:1px solid var(--line); }
.list{ margin-top:var(--sp-3); border:1px solid var(--line); border-radius:var(--r);
  overflow:hidden; background:var(--surface); }
.row{ display:flex; gap:var(--sp-3); align-items:flex-start; padding:13px 16px;
  text-decoration:none; border-top:1px solid var(--line2); }
.row:first-child{ border-top:0; }
.row:hover{ background:var(--paper2); }
.row .pg{ flex:0 0 auto; font-family:var(--mono); font-size:var(--fz-xs);
  color:var(--muted); padding-top:3px; min-width:44px; }   /* UX5: 12 px, the Khmer floor (was 11) */
.row .tx{ min-width:0; }
.row .tt{ font-size:var(--fz-lg); line-height:var(--lh-ui); }
.row .ex{ font-size:var(--fz-sm); color:var(--muted); line-height:var(--lh-text); margin-top:3px;
  display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2;
  line-clamp:2; overflow:hidden; }
.row .badge{ flex:0 0 auto; margin-left:auto; font-size:var(--fz-xs); color:var(--gold);
  border:1px solid var(--line); border-radius:var(--r-pill);
  padding:2px 9px; margin-top:2px; }   /* UX5: the read mark, always at the right edge */

/* ---------- continue reading & reading history ---------- */
.cont{ display:grid; gap:14px; grid-template-columns:1fr; }
@media (min-width:640px){
  .cont{ grid-template-columns:repeat(2, 1fr); gap:var(--sp-4); }
}

.contItem, .histItem{ position:relative; display:flex; flex-direction:column; height:100%; min-height:100px; }
.contCard, .histCard{
  position:relative; display:flex; align-items:flex-start; gap:14px;
  height:100%; box-sizing:border-box; padding:13px 14px 12px;
  border:1px solid var(--line); border-radius:var(--r-lg);
  background:var(--surface); text-decoration:none; color:var(--ink);
  box-shadow:var(--shadow-1);
  transition:transform var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease);
}
.contCard:hover, .histCard:hover{
  transform:translateY(-2px);
  box-shadow:var(--shadow-2);
  border-color:var(--gold-soft);
}
.contCard.isDone, .histCard.isDone{
  border-color:color-mix(in srgb, var(--ok) 40%, var(--line));
}
:root[data-theme="dark"] .contCard.isDone,
:root[data-theme="dark"] .histCard.isDone{
  border-color:rgba(62,115,84,.45);
}

/* Book Cover Thumbnail */
.contThumb{
  flex:0 0 52px; width:52px; height:74px; border-radius:var(--r-sm); overflow:hidden;
  position:relative; background:var(--paper2);
  box-shadow:0 2px 6px rgba(0,0,0,.15), inset 0 0 0 1px rgba(255,255,255,.08);
}
.contThumbArt{
  display:block; width:100%; height:100%;
  background-size:cover; background-position:center; position:relative;
}
.contThumbNo{
  position:absolute; bottom:0; left:0; right:0;
  font-family:var(--ui); font-size:var(--fz-xs); font-weight:700; text-align:center; white-space:nowrap; overflow:hidden;
  color:#fff; background:rgba(30, 20, 10, 0.84); backdrop-filter:blur(2px);
  padding:2px 2px 3px; line-height:1.15; text-shadow:0 1px 2px rgba(0,0,0,.6);
  border-radius:0 0 5px 5px;
}
.contThumb.pe .contThumbNo{ background:rgba(120, 40, 26, 0.88); }
.contThumb.atk .contThumbNo{ background:rgba(40, 50, 110, 0.88); }
.contThumb.ce .contThumbNo{ background:rgba(30, 75, 55, 0.88); }
.contThumb.pk .contThumbNo{ background:rgba(140, 70, 20, 0.88); }
@media (min-width:768px){
  .contThumb{ flex:0 0 56px; width:56px; height:80px; border-radius:7px; }
  .contThumbNo{ font-size:var(--fz-xs); }
}

/* Card Body & Typography */
.contBody{ flex:1 1 auto; min-width:0; display:flex; flex-direction:column; height:100%; justify-content:space-between; }
.contHead{ display:flex; align-items:center; gap:7px; margin-bottom:5px; font-size:var(--fz-xs); padding-right:30px; }
.edPill{ font-size:var(--fz-xs); font-weight:700; padding:2px 7px; border-radius:var(--r-pill);
  background:rgba(135,92,24,.1); color:var(--gold); }
.edPill.pe{ background:rgba(192,112,90,.14); color:var(--ed-pe); }
.edPill.atk{ background:rgba(127,143,208,.16); color:var(--ed-atk); }
.edPill.ce{ background:rgba(86,140,115,.16); color:var(--ed-ce); }
.edPill.vm{ background:rgba(135,92,24,.1); color:var(--gold); }
:root[data-theme="dark"] .edPill.pe{ color:#f0a993; }
:root[data-theme="dark"] .edPill.atk{ color:#a9b5f2; }
:root[data-theme="dark"] .edPill.ce{ color:#68d8b2; }
.contBook{ color:var(--muted); font-size:var(--fz-xs); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.contStat{ font-size:var(--fz-xs); font-weight:700; color:var(--gold); margin-left:auto; white-space:nowrap; }
.contStat.done{ color:var(--ok); background:rgba(62,115,84,.12); padding:1px 7px; border-radius:var(--r-pill); }
:root[data-theme="dark"] .contStat.done{ color:#68d8b2; background:rgba(104,216,178,.14); }

.contTitle{ font-size:var(--fz-md-h); font-weight:600; line-height:1.45; color:var(--ink); margin-bottom:6px;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }

/* Progress bar inside body */
.contProgWrap{ margin:4px 0 6px; }
.contBar{ height:4.5px; border-radius:var(--r-pill); background:color-mix(in srgb, var(--line) 45%, transparent); overflow:hidden; }
.contBar i{ display:block; height:100%; border-radius:var(--r-pill); background:var(--gold); transition:width var(--dur-3) var(--ease); }
.contCard.isDone .contBar i, .histCard.isDone .contBar i{ background:var(--ok); }
:root[data-theme="dark"] .contCard.isDone .contBar i,
:root[data-theme="dark"] .histCard.isDone .contBar i{ background:#68d8b2; }

.contFoot{ display:flex; align-items:center; gap:6px; font-size:var(--fz-xs); color:var(--muted); margin-top:auto; }
.contDot{ opacity:.5; }
.contAction{ margin-left:auto; color:var(--gold); font-weight:600; font-size:var(--fz-xs); }
.contCard:hover .contAction, .histCard:hover .contAction{ text-decoration:underline; }

/* Dismiss Close Button */
.secHeadActs{ display:flex; align-items:center; gap:var(--sp-3); }
.contDel, .histItem .del{
  position:absolute; top:8px; right:8px; width:26px; height:26px;
  border-radius:50%; border:1px solid transparent; background:transparent;
  color:var(--muted); font-size:var(--fz-xs); line-height:1; cursor:pointer;
  display:grid; place-items:center; z-index:5; opacity:0;
  transition:opacity var(--dur-2) var(--ease), color var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease), background var(--dur-2) var(--ease);
}
.contDel::after, .histItem .del::after{ content:""; position:absolute; inset:-8px; } /* 42px touch hit-area */
.contItem:hover .contDel, .contDel:focus-visible,
.histItem:hover .del, .histItem .del:focus-visible{ opacity:1; }
@media (max-width:767px){ .contDel, .histItem .del{ opacity:.75; } }
.contDel:hover, .histItem .del:hover{ color:var(--danger); border-color:rgba(179,65,47,.2); background:rgba(179,65,47,.1); }
.contDel .ic, .histItem .del .ic{ width:12px; height:12px; }

.empty{ text-align:center; color:var(--muted); padding:56px 20px;
  line-height:1.9; font-size:var(--fz-lg); }

/* pre-JS / no-JS fallback content (replaced by app.js) — also what
   crawlers see for the home page */
.seoHome{ padding:26px 0 40px; }
.seoHome h1{ font-size:clamp(20px,3vw,28px); line-height:var(--lh-display); margin:0 0 var(--sp-3); }
.seoHome > p{ color:var(--ink2); line-height:1.9; max-width:64ch; margin:0 0 22px; }
.seoHome h2{ font-size:var(--fz-lg); margin:0 0 10px; }
.seoVols{ list-style:none; margin:0; padding:0; columns:2; column-gap:var(--sp-5); }
.seoVols li{ break-inside:avoid; margin:0 0 var(--sp-1); }
.seoVols a{ text-decoration:none; color:var(--accent); font-size:var(--fz-sm-h);
  line-height:var(--lh-text); }
.seoVols a:hover{ text-decoration:underline; }
@media (max-width:560px){ .seoVols{ columns:1; } }
.count{ font-size:var(--fz-sm); color:var(--muted); margin:var(--sp-1) 0 0; }

/* ---------- reader ---------- */
.rtop{ position:sticky; top:0; z-index:var(--z-bar);
  background:color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter:saturate(1.4) blur(10px);
  border-bottom:1px solid var(--line2);
  padding-top:env(safe-area-inset-top); }
.rtopIn{ width:var(--read); margin:0 auto; display:flex; align-items:center;
  gap:10px; padding:9px 0; }
.rtopIn .who{ flex:1 1 auto; min-width:0; }
.rtopIn .who b{ display:block; font-size:var(--fz-sm-h); font-weight:700;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.rtopIn .who span{ display:block; font-size:var(--fz-xs); color:var(--muted);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.prog{ height:2px; background:var(--gold); width:0; transition:width var(--dur-2); }

.reader{ width:var(--read); margin:26px auto 120px; }
.rtitle{ text-align:center; font-size:clamp(20px,2.6vw,26px); font-weight:700;
  line-height:1.55; margin:8px 0 6px; }
.rsub{ text-align:center; font-size:var(--fz-xs-h); color:var(--muted);
  font-family:var(--mono); margin-bottom:var(--sp-2); }
.rrule{ width:64px; height:2px; background:var(--gold-soft); opacity:.55;
  margin:16px auto 30px; border-radius:2px; }

.pageMark{ text-align:center; color:var(--muted); font-family:var(--mono);
  font-size:var(--fz-xs); letter-spacing:.1em; margin:36px 0 16px; }
.pageMark::before, .pageMark::after{ content:"—"; margin:0 var(--sp-2); opacity:.5; }
.head{ text-align:center; font-weight:700; font-size:calc(var(--fs) + 1px);
  line-height:1.75; margin:30px 0 16px; }
.head + .head{ margin-top:-6px; }
.para{ font-family:var(--serif); text-align:justify; text-justify:inter-character; hyphens:none;
  word-break:normal; overflow-wrap:break-word;
  font-size:var(--fs); line-height:var(--lh); margin:0 0 14px;
  text-indent:1.5em; color:var(--ink); text-align-last:start; }
.para.pcont{ text-indent:0; }

/* a gatha's Khmer rendering: the print sets it as an indented block, a narrower
   justified measure between the prose, so the reader sees where the verse is */
.para.quote{ margin-left:2.2em; margin-right:2.2em; text-indent:0; text-align:justify; text-justify:inter-character; }
@media (max-width:520px){ .para.quote{ margin-left:1.3em; margin-right:.6em; }
  .para{ text-indent:1.2em; margin-bottom:var(--sp-3); } }

.rnav{ display:flex; gap:10px; margin-top:44px; }
.rnav a, .rnav span{ flex:1; text-decoration:none; font-size:var(--fz-sm);
  color:var(--muted); border:1px solid var(--line); border-radius:var(--r);
  padding:13px 15px; line-height:1.55; background:var(--surface); }
.rnav a:hover{ border-color:var(--gold-soft); color:var(--ink); }
.rnav .next{ text-align:right; }
.rnav .off{ opacity:.4; }
/* the end of a volume: «បន្ទាប់ ›» leads on to the next volume (shown beside the end card too) */
.rnav .next.nv small{ display:block; margin-top:2px; font-size:var(--fz-xs); color:var(--gold); }
.rnav .next.nv b{ display:block; color:var(--ink); }
.secEnd ~ .rnav a.next.nv{ display:block; }   /* (above the :has(.upNext) rule) */
/* every section ends with a quiet way home and to the volume's contents */
.rHome{ display:flex; flex-wrap:wrap; justify-content:center; gap:4px 22px; margin:18px 0 8px; }
.rHome a{ display:inline-flex; align-items:center; gap:6px; min-height:44px; padding:4px 6px;
  color:var(--ink2); font-size:var(--fz-sm-h); text-decoration:none; }
.rHome a:hover{ color:var(--ink); }
.rHome .ic{ width:18px; height:18px; color:var(--muted); flex:0 0 auto; }
.rHome span{ border-bottom:1px solid var(--line); }
#reader.lazyWait .rHome{ display:none; }   /* (a long unit still loading: its end is not here yet) */
.pairBtn{ display:block; text-align:center; text-decoration:none; border:0;
  margin:26px 0 0; padding:14px 18px; border-radius:var(--r);
  background:var(--gold); color:var(--on-gold); font-weight:700; font-size:var(--fz-md-h); }
:root[data-theme="dark"] .pairBtn{ color:var(--on-gold); }
.pairBtn small{ display:block; font-weight:400; opacity:.85; font-size:var(--fz-xs);
  margin-top:2px; }
/* the commentary button beside the end card's "អានបន្ត": one gold action per screen */
.pairBtn.quiet{ background:var(--surface); color:var(--ink); border:1px solid var(--line);
  font-weight:600; margin-top:var(--sp-3); }
.pairBtn.quiet small{ color:var(--muted); opacity:1; }
.pairBtn.quiet:hover{ border-color:var(--gold-soft); }
/* (the dark theme's dark label is for the gold button only) */
:root[data-theme="dark"] .pairBtn.quiet, :root[data-theme="dark"] .pairBtn.planBack{ color:var(--ink); }

/* ---------- the end of a section: done, what comes next, today's reading ---------- */
.secEnd{ margin-top:46px; padding-top:18px; border-top:1px solid var(--line); }
.secEnd ~ .rnav{ margin-top:30px; }
/* the up-next card already leads on: the bottom row keeps only "‹ មុន" */
.secEnd:has(.upNext) ~ .rnav .next{ display:none; }
.seTop{ display:flex; align-items:center; justify-content:space-between; gap:var(--sp-3);
  margin-bottom:14px; }
.seDone{ display:inline-flex; align-items:center; gap:7px; font-size:var(--fz-sm-h); color:var(--muted); }
.seDone .ic{ width:22px; height:22px; padding:3px; border-radius:50%; background:var(--gold);
  color:var(--on-gold); stroke-width:2.4; }
:root[data-theme="dark"] .seDone .ic{ color:var(--on-gold); }
.seShare{ display:inline-flex; align-items:center; gap:6px; border:1px solid var(--line);
  background:var(--surface); color:var(--ink2); border-radius:var(--r-pill); padding:7px 14px;
  font:600 var(--fz-sm) var(--ui); cursor:pointer; }
.seShare .ic{ width:17px; height:17px; color:var(--gold); }
.seShare:hover{ border-color:var(--gold-soft); }
.upNext{ display:block; text-decoration:none; color:var(--ink); background:var(--surface);
  border:1px solid var(--line); border-radius:var(--r-lg); padding:16px 18px 18px;
  box-shadow:var(--shadow-2); }
.upNext:hover{ border-color:var(--gold-soft); }
.unLab{ display:block; font-size:var(--fz-xs-h); color:var(--muted); margin-bottom:var(--sp-1); }
.unTitle{ display:block; font-size:17px; line-height:var(--lh-ui); }
.unTease{ display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden;
  margin-top:6px; font-family:var(--serif); font-size:var(--fz-lg); line-height:1.85; color:var(--ink2); }
.unGo{ display:block; margin-top:14px; text-align:center; padding:var(--sp-3) var(--sp-4); border-radius:var(--r);
  background:var(--gold); color:var(--on-gold); font-weight:700; font-size:var(--fz-lg); }
:root[data-theme="dark"] .unGo{ color:var(--on-gold); }
.dailyCard{ display:block; text-decoration:none; color:var(--ink); margin-top:22px;
  padding:14px 16px; border-radius:var(--r); border:1px dashed var(--gold-soft); background:var(--paper2); }
.dailyCard:hover{ border-style:solid; }
.dcLab{ display:flex; align-items:center; gap:6px; font-size:var(--fz-xs-h); color:var(--gold); font-weight:600; }
.dcLab .ic{ width:16px; height:16px; }
.dcTitle{ display:block; margin-top:6px; font-size:var(--fz-xl); line-height:var(--lh-ui); }
.dcMeta{ display:block; font-size:var(--fz-xs-h); color:var(--muted); }
.dcTease{ display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
  margin-top:6px; font-family:var(--serif); font-size:var(--fz-md-h); line-height:1.8; color:var(--ink2); }
.dailyDone{ display:flex; gap:10px; align-items:flex-start; margin-top:22px; padding:13px 16px;
  border-radius:var(--r); background:var(--paper2); border:1px solid var(--line); font-size:var(--fz-sm-h);
  color:var(--muted); line-height:var(--lh-text); }
.dailyDone b{ display:block; color:var(--ink); font-size:var(--fz-md-h); }
.dailyDone .ic{ width:22px; height:22px; padding:3px; border-radius:50%; background:var(--gold);
  color:var(--on-gold); stroke-width:2.4; margin-top:2px; }
:root[data-theme="dark"] .dailyDone .ic{ color:var(--on-gold); }
.a2Line{ display:flex; align-items:center; gap:10px; margin-top:22px; padding:12px 12px 12px 14px;
  border-radius:var(--r); background:var(--surface); border:1px solid var(--line);
  font-size:var(--fz-sm); color:var(--muted); line-height:var(--lh-ui); }
.a2Line b{ display:block; color:var(--ink); font-size:var(--fz-sm-h); }
.a2Ico .ic{ width:22px; height:22px; color:var(--gold); }
.a2Glyph .ic{ width:16px; height:16px; vertical-align:-3px; color:var(--gold); }
.a2Line > div{ flex:1; min-width:0; }
/* outlined: the end card's one gold action is "អានបន្ត" above it */
.a2Go{ border:1px solid var(--gold); border-radius:var(--r-pill); background:transparent; color:var(--gold);
  font:700 var(--fz-sm) var(--ui); padding:var(--sp-2) var(--sp-4); min-height:44px; cursor:pointer; }
.a2Go:hover{ background:color-mix(in srgb, var(--gold) 10%, transparent); }
.a2Line .x{ border:0; background:none; color:var(--muted); padding:var(--sp-1); cursor:pointer; }
.a2Line .x .ic{ width:18px; height:18px; }
/* a festival plan (js/app.js SEASONS) on the home page's plan promo */
.planPromo .ppSea{ flex:1 1 100%; display:flex; align-items:center; gap:6px; margin-top:6px; font-size:var(--fz-sm); color:var(--gold); font-weight:600; }
.planPromo .ppSea .ic{ width:16px; height:16px; }
.tpl.season{ border-style:dashed; border-color:var(--gold-soft); }
.tpl.season[aria-pressed="true"]{ border-style:solid; }
/* Homepage Responsive Hub (Tablet & Desktop multi-column dashboard) */
.homeHub{ margin:0 0 var(--sp-4); }
@media (min-width:768px){
  .homeHub{
    display:grid;
    grid-template-columns:minmax(0, 1.25fr) minmax(0, 1fr);
    gap:18px;
    align-items:stretch;
  }
  .homeHubMain{ display:flex; flex-direction:column; height:100%; min-width:0; }
  .homeHubMain #dailyHome{ flex:1; display:flex; flex-direction:column; height:100%; }
  .homeHubMain .dailyHome{ flex:1; display:flex; flex-direction:column; margin-bottom:0; height:100%; }
  .homeHubMain .dhTease{ -webkit-line-clamp:3; height:auto; }
  .homeHubMain .dhAct{ margin-top:auto; padding-top:14px; }
  .homeHubSide{ display:flex; flex-direction:column; min-width:0; height:100%; }
  .homeHubSide #planHome{ flex:1; display:flex; flex-direction:column; height:100%; }
  .homeHubSide #planHome .secHead{ margin-top:0; margin-bottom:var(--sp-2); }
  .homeHubSide .planHomeCard{ flex:1; display:flex; flex-direction:column; justify-content:space-between; margin-bottom:0; height:100%; }
  .homeHubSide .planPromo{ flex:1; display:flex; flex-direction:column; justify-content:center; margin-top:0; height:100%; }
}

/* the home page's daily reading, under the hero */
.dailyHome{ margin:0 0 26px; padding:18px 20px 20px; border-radius:var(--r-lg); background:var(--surface);
  border:1px solid var(--line); box-shadow:var(--shadow-2); }
.dhLab{ display:flex; align-items:center; gap:7px; font-size:var(--fz-sm); color:var(--gold); font-weight:600; }
.dhLab .ic{ width:17px; height:17px; }
.dhTitle{ display:block; margin-top:var(--sp-2); font-size:clamp(18px,2.4vw,21px); font-weight:700; line-height:var(--lh-ui);
  color:var(--ink); text-decoration:none; }
.dhMeta{ font-size:var(--fz-xs-h); color:var(--muted); margin-top:2px; }
/* two lines, always: 3 lines in the fallback font became 2 when Battambang arrived,
   and the shelf under the card jumped */
.dhTease{ margin:10px 0 0; font-family:var(--serif); font-size:var(--fz-lg); line-height:1.85; color:var(--ink2);
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; height:3.7em; }
.dhDone{ display:flex; align-items:center; gap:var(--sp-2); margin-top:10px; font-size:var(--fz-sm-h); color:var(--ink2); }
.dhDone .ic{ width:22px; height:22px; padding:3px; border-radius:50%; background:var(--gold); color:var(--on-gold);
  stroke-width:2.4; flex:0 0 auto; }
:root[data-theme="dark"] .dhDone .ic{ color:var(--on-gold); }
.dhAct{ display:flex; align-items:center; gap:var(--sp-3); margin-top:var(--sp-4); flex-wrap:wrap; }
.dhAct .pairBtn{ display:inline-block; margin:0; padding:11px 26px; }
/* the card's room, kept while daily.json loads: inserted later it pushed the shelf
   down (layout shift 0.22 on a phone) */
.dhWait{ min-height:238px; margin-bottom:26px; }
@media (max-width:370px){ .dhWait{ min-height:248px; } }
@media (max-width:340px){ .dhWait{ min-height:283px; } }   /* the two buttons wrap */
/* «អានជាមួយគ្នា» — communal reading card on the home page and reader end card */
.boardCard{ margin:14px 0 24px; padding:16px 18px; border-radius:var(--r-lg);
  background:var(--surface); border:1px solid var(--line); font-size:var(--fz-sm-h);
  color:var(--ink2); line-height:1.75; box-shadow:var(--shadow-1); }
#boardHome .boardCard{ margin:var(--sp-3) 0 var(--sp-5); }
.bcHead{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:var(--sp-3); }
.bcTitleGroup{ display:flex; align-items:center; gap:var(--sp-2); }
.bcIco{ width:28px; height:28px; border-radius:50%; background:rgba(181,133,56,.12);
  color:var(--gold); display:grid; place-items:center; flex:0 0 auto; }
.bcIco .ic{ width:15px; height:15px; }
.bcTitle{ font-size:var(--fz-md-h); font-weight:700; color:var(--ink); }
.bcLivePill{ display:inline-flex; align-items:center; gap:6px; padding:3px 10px;
  border-radius:var(--r-pill); background:rgba(47,158,91,.12); color:#1e6b3c;
  font-size:var(--fz-xs); font-weight:600; }
:root[data-theme="dark"] .bcLivePill{ background:rgba(47,158,91,.22); color:#66db96; }
.bcStats{ display:grid; grid-template-columns:repeat(auto-fit, minmax(85px, 1fr)); gap:var(--sp-2); margin:4px 0 2px; }
.bcStat{ background:var(--paper2); border:1px solid var(--line2); border-radius:var(--r);
  padding:9px 12px; display:flex; flex-direction:column; align-items:center; text-align:center; }
.bcVal{ font-size:16.5px; font-weight:700; color:var(--gold); font-family:var(--mono); line-height:1.25; }
.bcLbl{ font-size:var(--fz-xs); color:var(--muted); margin-top:3px; white-space:nowrap; }
.bcNotes{ list-style:none; margin:10px 0 0; padding:0; display:flex; flex-direction:column; gap:5px; font-size:var(--fz-xs-h); color:var(--muted); }
.bcNotes li{ display:flex; align-items:center; gap:6px; }
.bcDot{ width:5px; height:5px; border-radius:50%; background:var(--gold); opacity:.7; display:inline-block; flex:0 0 auto; }
.bcLive{ display:flex; align-items:center; gap:var(--sp-2); color:var(--ink); font-weight:600; }
.liveDot{ width:8px; height:8px; border-radius:50%; background:#2f9e5b; flex:0 0 auto;
  box-shadow:0 0 0 0 rgba(47,158,91,.5); animation:livePulse 2s infinite; }
@keyframes livePulse{ 70%{ box-shadow:0 0 0 7px rgba(47,158,91,0); } 100%{ box-shadow:0 0 0 0 rgba(47,158,91,0); } }
@media (prefers-reduced-motion: reduce){ .liveDot{ animation:none; } }
.bcSteady{ margin-top:10px; padding-top:10px; border-top:1px solid var(--line2);
  font-size:var(--fz-xs); color:var(--muted); line-height:1.65; }
.bcSteady span{ color:var(--ink2); font-weight:600; }
.rstate{ text-align:center; color:var(--muted); margin:90px auto; font-size:var(--fz-lg); }

/* ---------- panels (TOC / settings) ---------- */
.scrim{ position:fixed; inset:0; z-index:var(--z-scrim); background:rgba(20,14,8,.5);
  backdrop-filter:blur(2px); }
.panel{ position:fixed; z-index:var(--z-panel); background:var(--paper2);
  box-shadow:var(--shadow-3); display:flex; flex-direction:column; }
.panel.side{ top:0; bottom:0; right:0; width:min(400px,88vw);
  border-left:1px solid var(--line);
  padding-right:env(safe-area-inset-right); }
.panel.sheet{ left:0; right:0; bottom:0; border-radius:var(--r-lg) var(--r-lg) 0 0;
  border-top:1px solid var(--line); max-height:80vh; max-height:80dvh;
  padding-bottom:env(safe-area-inset-bottom); }
/* settings on a wide screen: a popover hanging from the Aa button, the page
   stays visible (and readable) behind it */
.scrim.clear{ background:transparent; backdrop-filter:none; }
.panel.pop{ width:min(380px, calc(100vw - 24px)); max-height:min(78vh, 640px);
  border:1px solid var(--line); border-radius:var(--r); }
.panel.pop::before{ content:""; position:absolute; top:-6px; right:18px;
  width:10px; height:10px; background:var(--paper2); transform:rotate(45deg);
  border-left:1px solid var(--line); border-top:1px solid var(--line); }
.setPreview{ margin:var(--sp-3) var(--sp-4) var(--sp-1); padding:12px 14px; border-radius:var(--r-md);
  background:var(--paper); border:1px solid var(--line2); color:var(--ink);
  font-family:var(--serif); font-size:var(--fs); line-height:var(--lh);
  text-align:justify; text-justify:inter-character; text-align-last:start; text-indent:2em;
  max-height:calc(var(--fs) * var(--lh) * 3 + 24px); overflow:hidden; }
.panelHead{ display:flex; align-items:center; justify-content:space-between;
  gap:10px; padding:14px 16px; border-bottom:1px solid var(--line2); }
.panelHead b{ font-size:var(--fz-md-h); }
.panelBody{ overflow:auto; -webkit-overflow-scrolling:touch;
  overscroll-behavior:contain; padding:6px 0 20px; }
.tocItem{ display:flex; gap:10px; padding:11px 16px; text-decoration:none;
  border-top:1px solid var(--line2); font-size:var(--fz-md); line-height:1.55; }
.tocItem:first-child{ border-top:0; }
.tocItem:hover{ background:var(--surface); }
.tocItem.on{ background:var(--surface); box-shadow:inset 3px 0 0 var(--gold); }
.tocItem .pg{ font-family:var(--mono); font-size:var(--fz-2xs); color:var(--muted);
  min-width:40px; padding-top:2px; }

.setRow{ padding:14px 16px; border-top:1px solid var(--line2); }
.setRow:first-child{ border-top:0; }
.setRow .lab{ font-size:var(--fz-sm); color:var(--muted); margin-bottom:9px; }
.chips{ display:flex; gap:var(--sp-2); flex-wrap:wrap; }
.chip{ border:1px solid var(--line); background:var(--surface);
  border-radius:var(--r-pill); padding:8px 15px; font-size:var(--fz-md);
  cursor:pointer; }
/* UX5, one gold action per screen: a chosen option is outlined and tinted (as the home filter
   pills since UX1); solid gold is kept for the screen's one action */
.chip[aria-pressed="true"]{ background:var(--tint); color:var(--ink);
  border-color:var(--gold); font-weight:700; }

@media (max-width:820px){ :root{ --gut:32px; --lh:1.85; } }
@media (max-width:720px){
  :root{ --gut:24px; --lh:1.85; }

  /* header: brand + icons on one row, search wraps to its own full-width row */
  .top{ background:color-mix(in srgb, var(--paper) 94%, transparent); }
  .topIn{ flex-wrap:wrap; row-gap:var(--sp-2); column-gap:var(--sp-2); padding:9px 0; }
  .brand span{ display:none; }            /* drop the tagline, keep the name */
  .brand b{ font-size:var(--fz-md); }
  #authSlot{ order:2; margin-left:auto; }
  .top .iconBtn{ order:2; }
  /* keep the mobile contents button beside the account actions */
  .top #navBtn{ margin-left:auto; }
  .top #meBtn{ margin-left:0; }
  .search{ order:3; flex-basis:100%; }
  .search input{ padding-top:11px; padding-bottom:11px; }

  .wrap{ margin-bottom:64px; }
  .hero{ padding:16px 0 2px; }
  .hero p{ display:none; }                /* the app hero — keep only the H1 */
  .secHead{ margin:24px 0 10px; }
  .pitakaTabs{ gap:6px; }
  .tab{ padding:10px 15px; }              /* ≥44px touch target */
  .catParent{ font-size:var(--fz-md); border-bottom-width:1px; margin:22px 0 2px; }
  .catHead{ margin:16px 0 6px; }
  .vols{ grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:var(--sp-2); }
  .vol{ padding:10px 12px; }
  .vol .t{ font-size:var(--fz-md); }

  .reader{ margin:14px auto 96px; }
  .row{ padding:12px 13px; }
  .rtopIn{ gap:6px; }
  .rtopIn .who b{ font-size:var(--fz-xs-h); }
  .iconBtn{ width:36px; height:36px; font-size:var(--fz-lg); }
  .rtop #authSlot{ display:none; }        /* sign-in lives on the home screen */
  details.vg > summary{ flex-wrap:wrap; padding:12px 13px; }
  .vgList a, .vgList .miss, .vgList .ref{ padding-left:20px; }
}
@media (max-width:380px){
  :root{ --gut:18px; --read:calc(100% - var(--gut)); --fs:17px; }
  .brand b{ font-size:var(--fz-xs-h); }
  .cont{ grid-template-columns:1fr; }
  /* reader header now carries listen + find + toc + settings — tighten it */
  .rtopIn{ gap:5px; }
  .rtopIn .iconBtn{ width:34px; height:34px; font-size:var(--fz-md); } }
@media (max-width:340px){ .topIn{ column-gap:var(--sp-1); } .brand{ gap:6px; }
}
@media print{
  .top,.rtop,.rnav,.pairBtn,.panel,.scrim,.iconBtn,
  .secEnd,.dailyCard,.dailyDone,.boardCard,.a2Line,.hlpop{ display:none !important; }
  body{ background:#fff; } .reader{ width:auto; margin:0; }
}

/* ---------- reading progress (localStorage-backed) ---------- */
.bar{ height:3px; border-radius:2px; background:var(--line);
  margin-top:9px; overflow:hidden; }
.bar.wide{ margin-top:14px; max-width:420px; }
.bar i{ display:block; height:100%; background:var(--gold); border-radius:2px; }
.contCard .m{ display:flex; gap:6px; flex-wrap:wrap; }
.row.seen .tt{ color:var(--ink2); }
.badge.done{ color:var(--gold); border-color:var(--gold-soft);
  font-weight:700; }

.toast{ position:fixed; left:50%; bottom:calc(22px + env(safe-area-inset-bottom));
  transform:translate(-50%,160%);
  z-index:var(--z-toast); display:flex; align-items:center; gap:var(--sp-3);
  background:var(--surface); border:1px solid var(--line);
  border-radius:var(--r-pill); padding:10px 12px 10px 18px;
  box-shadow:var(--shadow-3); font-size:var(--fz-sm-h); max-width:calc(100% - 32px);
  transition:transform .28s var(--ease-out); }
.toast.go{ transform:translate(-50%,0); }
.toast button{ border:0; background:var(--gold); color:var(--on-gold); font-size:var(--fz-sm);
  border-radius:var(--r-pill); padding:7px 14px; cursor:pointer;
  white-space:nowrap; }
:root[data-theme="dark"] .toast button{ color:var(--on-gold); }

/* ---------- បន្តអាន: swipe-to-remove ---------- */
.linkBtn{ border:0; background:none; color:var(--muted); font-size:var(--fz-sm);
  cursor:pointer; padding:2px 0; border-bottom:1px solid var(--line); }
.linkBtn:hover{ color:var(--ink); }
.secHead .linkBtn{ border-bottom:0; color:var(--gold); font-weight:600; padding:2px 0;
  display:inline-flex; align-items:center; gap:3px; text-decoration:none; }
.secHead .linkBtn:hover{ color:var(--ink); }

/* ---------- offline download ---------- */
.offBox{ max-width:var(--read, 520px); margin:var(--sp-2) auto 0; }
/* «អំពីច្បាប់នេះ» (#/about): the closing pages of volume 82, read like a page of the book */
.homeColophon{ margin:var(--sp-4) 0 var(--sp-3); padding-top:var(--sp-2); border-top:1px solid var(--line2, rgba(128,128,128,.25)); }
.aboutEd{ max-width:var(--read, 620px); margin:var(--sp-2) auto var(--sp-4); line-height:1.95; }
.aboutEd h2{ text-align:center; font-size:var(--fz-lg, 1.15rem); margin:var(--sp-3) 0 var(--sp-2); }
.aboutEd p{ margin:0 0 var(--sp-2); text-indent:2em; text-align:justify; text-justify:inter-character; text-align-last:start; hyphens:none; }
.aboutEd .aboutEdC{ text-align:center; text-align-last:center; text-indent:0; }
.aboutEd .aboutEdSign{ text-align:right; text-align-last:right; text-indent:0; color:var(--muted); }
.aboutEdParts{ list-style:none; padding:0; margin:0 0 var(--sp-2); text-align:center; }
.aboutEdParts li{ margin:2px 0; }
/* the same closing pages at the end of volume 82 in the reader (read.js paintColophon) */
.colophon82{ margin:var(--sp-4) 0 var(--sp-3); padding-top:var(--sp-3); border-top:1px solid var(--line2, rgba(128,128,128,.25)); }
.colophon82 .head{ text-align:center; }
.colophon82 .cpCenter{ text-align:center; text-align-last:center; text-indent:0; }
.colophon82 .cpSign{ text-align:right; color:var(--muted); margin:0 0 var(--sp-2); }
.colophon82 .cpParts{ list-style:none; padding:0; margin:0 0 var(--sp-2); text-align:center; }
.offBox .pairBtn[disabled]{ opacity:.7; }
.offMeta{ margin-top:10px; font-family:var(--mono); font-size:var(--fz-xs);
  color:var(--muted); text-align:center; min-height:1.2em; }
/* ---------- reading history / continue items dismiss ---------- */
.swipe{ position:relative; border-radius:var(--r); }
.swipe .del, .histItem .del{ position:absolute; top:6px; right:6px; width:28px; height:28px;
  border-radius:50%; border:1px solid var(--line); background:var(--surface);
  color:var(--muted); font-size:var(--fz-xs); line-height:1; cursor:pointer;
  display:grid; place-items:center; z-index:5; opacity:.85;
  transition:opacity var(--dur-1), color var(--dur-1), border-color var(--dur-1), background var(--dur-1); }
.swipe .del::after, .histItem .del::after{ content:""; position:absolute; inset:-8px; } /* 44px hit-area */
.swipe:hover .del, .swipe .del:focus-visible,
.histItem:hover .del, .histItem .del:focus-visible{ opacity:1; }
.swipe .del:hover, .histItem .del:hover{ color:var(--danger); border-color:var(--danger); background:rgba(179,65,47,.08); }

/* ---------- auth + reports (Supabase) ---------- */
.authBtn{ border:1px solid var(--line); background:var(--surface);
  border-radius:var(--r-pill); padding:7px 14px; font-size:var(--fz-sm-h);
  cursor:pointer; white-space:nowrap;
  max-width:34vw; overflow:hidden; text-overflow:ellipsis; }
.authBtn:hover{ border-color:var(--gold-soft); }
#authSlot{ display:flex; align-items:center; gap:6px; min-width:0; flex:0 1 auto; }
.adminLink{ text-decoration:none; }

.signWall{ text-align:center; padding:60px 20px; }
.signWall .swIcon{ font-size:36px; }
.signWall h2{ margin:14px 0 6px; font-size:19px; }
.signWall p{ color:var(--muted); line-height:1.9; max-width:44ch; margin:0 auto 18px; }
.signWall .pairBtn{ display:inline-block; margin-bottom:14px; }
.signWall .rback{ display:block; font-size:var(--fz-sm); color:var(--muted);
  text-decoration:none; }

.reportBtn{ background:#b3412f; }
:root[data-theme="dark"] .reportBtn{ color:#fff; }
.reportBox label{ display:block; font-size:var(--fz-sm); color:var(--muted);
  margin:var(--sp-3) 0 var(--sp-1); }
.reportBox input, .reportBox textarea{ width:100%; font-family:var(--ui);
  border:1px solid var(--line); border-radius:var(--r-md); padding:9px 11px;
  background:var(--surface); color:var(--ink); }
.reportBox .rQuote{ margin:var(--sp-2) 0 0; padding:9px 12px; border-left:3px solid var(--gold);
  background:var(--paper2); border-radius:var(--r-sm); font-family:var(--serif);
  line-height:1.9; max-height:30vh; overflow:auto; }
.shareActions .go{ background:var(--gold); color:var(--on-gold); border-color:var(--gold);
  font-weight:700; }
:root[data-theme="dark"] .shareActions .go{ color:var(--on-gold); }
.shareActions .ghost{ background:none; }

/* ---------- footnotes ---------- */
.fnref{ font-size:.62em; line-height:0; vertical-align:.55em;
  font-weight:700; padding:0 .1em; font-family:var(--ui); }
.fnref a{ color:var(--gold); text-decoration:none; }
.fnref a:hover{ text-decoration:underline; }
.fn{ font-family:var(--ui); font-size:.8em; line-height:1.75;
  color:var(--muted); margin:14px 0 6px; padding:var(--sp-2) 0 0;
  border-top:1px solid var(--line2); text-indent:0; }
.fn + .fn{ margin-top:var(--sp-1); padding-top:2px; border-top:none; }
.fn::before{ content:"↳ "; color:var(--gold-soft); }
.fnnum{ color:var(--gold); font-weight:700; margin-right:.15em;
  scroll-margin-top:70px; }
.fnback{ color:var(--gold); text-decoration:none; margin-right:.3em;
  font-family:var(--ui); }
.fnback:hover{ color:var(--ink); }

/* footnote pop-up on tapping a reference */
.fnpop{ position:absolute; z-index:var(--z-tip); background:var(--paper2);
  border:1px solid var(--line); border-radius:var(--r-md); padding:12px 14px;
  box-shadow:var(--shadow-3); font-family:var(--ui); font-size:var(--fz-sm-h);
  line-height:var(--lh-text); color:var(--ink); }
.fnpop p{ margin:0 0 var(--sp-2); }
.fnpop a{ color:var(--gold); font-size:var(--fz-xs-h); text-decoration:none;
  font-weight:700; }

/* citation pop-up card on hovering (desktop) or tapping (mobile) */
.citepop{
  position:absolute;
  z-index:calc(var(--z-tip) + 1);
  background:var(--paper2);
  border:1px solid var(--line);
  border-radius:var(--r-md);
  padding:var(--sp-3) var(--sp-4);
  box-shadow:var(--shadow-3);
  font-family:var(--ui);
  font-size:var(--fz-sm-h);
  line-height:var(--lh-text);
  color:var(--ink);
  max-width:380px;
  box-sizing:border-box;
  animation:citePopFade var(--dur-2) ease-out;
}
@keyframes citePopFade{
  from{ opacity:0; transform:translateY(4px); }
  to{ opacity:1; transform:translateY(0); }
}
.citepop-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:var(--sp-2);
  margin-bottom:var(--sp-2);
  padding-bottom:6px;
  border-bottom:1px solid var(--line2);
}
.citepop-title{
  font-weight:700;
  color:var(--ink);
  font-size:var(--fz-sm-h);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.citepop-meta{
  font-size:var(--fz-xs);
  color:var(--gold);
  font-weight:700;
  white-space:nowrap;
}
.citepop-body{
  font-family:var(--serif, serif);
  font-size:var(--fz-md-h);
  line-height:1.75;
  color:var(--ink);
  margin:0 0 10px;
  max-height:220px;
  overflow-y:auto;
}
.citepop-close{
  background:none;
  border:none;
  cursor:pointer;
  font-size:var(--fz-xl);
  color:var(--muted);
  padding:0 var(--sp-1);
  line-height:1;
}
.citepop-close:hover{ color:var(--ink); }
.citepop-foot{
  display:flex;
  justify-content:flex-end;
}
.citepop-btn{
  display:inline-flex;
  align-items:center;
  gap:var(--sp-1);
  background:var(--gold);
  color:#fff !important;
  text-decoration:none;
  font-weight:700;
  font-size:var(--fz-xs-h);
  padding:5px 12px;
  border-radius:var(--r-sm);
  transition:background var(--dur-2) var(--ease);
}
.citepop-btn:hover{
  background:var(--gold-dark, #8a5a0d);
}
.citepop-loading{
  display:flex;
  align-items:center;
  gap:var(--sp-2);
  color:var(--muted);
  font-size:var(--fz-sm);
  padding:var(--sp-3) 0;
}
.cite-spinner{
  width:14px;
  height:14px;
  border:2px solid var(--line2);
  border-top-color:var(--gold);
  border-radius:50%;
  animation:citeSpin .6s linear infinite;
}
@keyframes citeSpin{
  to{ transform:rotate(360deg); }
}

/* golden pulse highlight on target paragraph */
@keyframes paraPulse{
  0%{ background:rgba(180,115,0,.35); }
  100%{ background:transparent; }
}
.para-highlight{
  animation:paraPulse 2.5s ease-out forwards;
  border-radius:var(--r-sm);
}

/* deep-linkable paragraph numbers + the tap menu */
.para{ scroll-margin-top:70px; }
.pnum{ color:var(--gold); text-decoration:none; font-weight:700;
  font-family:var(--mono); font-size:.8em; cursor:pointer; }
.pnum:hover{ text-decoration:underline; }
.para.bm{ box-shadow:inset 3px 0 0 var(--gold); }
.para.bm .pnum::after{ content:" 🔖"; font-size:.85em; }

/* the block currently being read aloud */
.para.speaking, .head.speaking{
  background:color-mix(in srgb, var(--gold-soft) 20%, transparent);
  box-shadow:inset 3px 0 0 var(--gold);
  border-radius:3px; transition:background-color var(--dur-3); }
/* highlights (js/hl.js): a wash of colour behind the words -- no padding, so colouring a
   passage never moves a letter */
mark.hl{ color:inherit; padding:0; border-radius:2px; cursor:pointer;
  -webkit-box-decoration-break:clone; box-decoration-break:clone; }
mark.hl.c1{ background:rgba(250, 204, 21, .40); }
mark.hl.c2{ background:rgba(74, 222, 128, .32); }
mark.hl.c3{ background:rgba(96, 165, 250, .32); }
mark.hl.c4{ background:rgba(244, 114, 182, .30); }
:root[data-theme="dark"] mark.hl.c1{ background:rgba(250, 204, 21, .24); }
:root[data-theme="dark"] mark.hl.c2{ background:rgba(74, 222, 128, .20); }
:root[data-theme="dark"] mark.hl.c3{ background:rgba(96, 165, 250, .22); }
:root[data-theme="dark"] mark.hl.c4{ background:rgba(244, 114, 182, .22); }
.selBar .hlBtn{ background:var(--surface); color:var(--ink); border:1px solid var(--line); }
/* (read.html's dark .shareBtn label is for the gold button; this one sits on the surface) */
:root[data-theme="dark"] .selBar .hlBtn{ color:var(--ink); }
.hlpop{ position:absolute; z-index:var(--z-pop); display:flex; align-items:center; gap:var(--sp-1); padding:6px;
  background:var(--surface); border:1px solid var(--line); border-radius:var(--r); box-shadow:var(--shadow-3); }
.hlpop > button{ display:inline-flex; align-items:center; gap:6px; border:0; background:none; cursor:pointer;
  font:600 var(--fz-sm) var(--ui); color:var(--ink); padding:8px 10px; border-radius:var(--r-sm); white-space:nowrap; }
.hlpop > button:hover{ background:var(--paper2); }
.hlpop > button .ic{ width:17px; height:17px; color:var(--muted); }
.hlSw{ display:flex; gap:6px; padding:0 6px 0 4px; margin-right:2px; border-right:1px solid var(--line); }
.hlSw .sw{ width:26px; height:26px; border-radius:50%; border:2px solid transparent; cursor:pointer; padding:0; }
.hlSw .sw.c1{ background:rgb(250, 204, 21); } .hlSw .sw.c2{ background:rgb(74, 222, 128); }
.hlSw .sw.c3{ background:rgb(96, 165, 250); } .hlSw .sw.c4{ background:rgb(244, 114, 182); }
.hlSw .sw[aria-pressed="true"]{ border-color:var(--ink); box-shadow:inset 0 0 0 2px var(--surface); }
.pnpop{ display:flex; flex-direction:column; padding:6px; gap:2px; }
.pnpop button{ border:0; background:none; text-align:left; cursor:pointer;
  font:inherit; color:var(--ink); padding:9px 12px; border-radius:var(--r-sm);
  white-space:nowrap; }
.pnpop button:hover{ background:var(--surface); }

/* embedded Pāli (in Khmer script) — the printed book sets it bolder and blacker
   than the translation; here the same face in bold, so the line keeps one height */
.pali{ font-family:var(--pali); font-weight:700; color:var(--ink); }
.para.paliB{ text-align:center; text-indent:0; max-width:40ch; margin-left:auto; margin-right:auto; }

/* ============================================================
   Pāli Scholastic & Critical Edition Typography
   ============================================================ */
.pali-lemma{
  font-family:var(--serif);
  font-weight:700;
  color:var(--gold);
  letter-spacing:.01em;
}
:root[data-theme="dark"] .pali-lemma{
  color:#e5b964;
}
.pali-speech{
  color:var(--ink);
  font-style:normal;
}
.pali-cite{
  font-family:var(--ui);
  font-size:.84em;
  color:var(--gold);
  background:rgba(180,115,0,.08);
  border:1px solid rgba(180,115,0,.26);
  border-radius:4px;
  padding:1px 6px;
  margin:0 2px;
  display:inline-block;
  vertical-align:baseline;
  line-height:var(--lh-display);
  white-space:nowrap;
  text-decoration:none;
  cursor:pointer;
  transition:background-color var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease), color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease), transform var(--dur-2) var(--ease);
}
.pali-cite:hover, .pali-cite:focus-visible{
  background:rgba(180,115,0,.16);
  border-color:var(--gold);
  color:var(--gold);
  box-shadow:0 2px 6px rgba(180,115,0,.18);
  transform:translateY(-1px);
}
:root[data-theme="dark"] .pali-cite{
  background:rgba(229,185,100,.1);
  border-color:rgba(229,185,100,.28);
  color:#e5b964;
}
:root[data-theme="dark"] .pali-cite:hover{
  background:rgba(229,185,100,.2);
  border-color:#e5b964;
  color:#f3d48e;
  box-shadow:0 2px 8px rgba(0,0,0,.4);
}
.pali-variant{
  font-size:.88em;
  color:var(--muted);
  border-bottom:1px dashed var(--line);
  padding-bottom:1px;
}
.pali-variant .pali-variant, .pali-variant .pali-cite{ font-size:1em; border:0; opacity:1; padding:0; background:none; margin:0; }
:root[data-theme="dark"] .pali-variant{
  color:#9aa5b8;
  border-bottom-color:rgba(255,255,255,.15);
}
.pali-puccha{
  color:#8b3a2b;
  font-weight:600;
}
:root[data-theme="dark"] .pali-puccha{
  color:#df8a7c;
}
.pali-peyyala{
  color:var(--gold);
  font-weight:700;
  letter-spacing:.03em;
}
:root[data-theme="dark"] .pali-peyyala{
  color:#dcb360;
}

/* bookmarks in the reader's ☰ panel */
.tocBm{ border-bottom:1px solid var(--line); padding:6px 0 8px;
  margin-bottom:var(--sp-1); }
.tocBm > b{ display:block; font-size:var(--fz-xs); color:var(--muted);
  padding:6px 16px 4px; }

/* ចំណាំ — a personal anthology of gathered passages (#/bm view).
   Passages are set in the reading serif, like clippings pressed between
   the pages; folders are quiet chapter rules, not boxed file rows. */
.bmHead{ margin:20px 0 6px; }
.bmHead h1{ margin:0; font-size:23px; font-weight:700; letter-spacing:-.015em; }
.bmCount{ margin:5px 0 0; font-size:var(--fz-xs-h); color:var(--muted);
  font-family:var(--mono); letter-spacing:.03em; }
.bmNew{ margin-top:13px; border:1px solid var(--line); background:var(--surface);
  color:var(--ink); font:inherit; font-size:var(--fz-sm); padding:8px 15px;
  border-radius:var(--r-pill); cursor:pointer; }
.bmNew:hover{ border-color:var(--gold-soft); }
.bmWrap{ margin:14px 0 60px; }
.bmWrap.drop{ outline:2px dashed var(--gold-soft); outline-offset:6px;
  border-radius:var(--r); }

.clips{ display:flex; flex-direction:column; gap:11px; margin:var(--sp-3) 0; }
.clip{ position:relative; background:var(--surface);
  border:1px solid var(--line); border-left:3px solid var(--gold-soft);
  border-radius:3px 12px 12px 3px;
  transition:border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease), transform var(--dur-2) var(--ease); }
.clip:hover{ border-left-color:var(--gold); box-shadow:var(--shadow-2); }
.clip:active{ transform:scale(.992); }
.clip.dragging{ opacity:.35; }
.clip.drop, .bmFldHead.drop{ border-color:var(--gold);
  background:color-mix(in srgb, var(--gold) 9%, transparent); }
.clipBody{ display:block; text-decoration:none; color:inherit;
  padding:14px 42px 13px 16px; }
/* a highlight on the bookmarks page: its own colour down the side */
.hlClip .clipBody{ padding-right:var(--sp-4); }
.hlClip.c1{ border-left-color:rgb(250, 204, 21); } .hlClip.c2{ border-left-color:rgb(74, 222, 128); }
.hlClip.c3{ border-left-color:rgb(96, 165, 250); } .hlClip.c4{ border-left-color:rgb(244, 114, 182); }
.hlHead{ display:flex; align-items:baseline; gap:var(--sp-2); font-size:17px; margin:30px 0 12px; }
.hlHead span{ font-size:var(--fz-xs-h); color:var(--muted); font-weight:400; }
.clipQ{ margin:0; font-family:var(--serif); font-size:var(--fz-lg); line-height:1.85;
  color:var(--ink); text-indent:0;
  display:-webkit-box; -webkit-line-clamp:4; line-clamp:4;
  -webkit-box-orient:vertical; overflow:hidden; }
.clipNote{ margin:9px 0 0; font-size:var(--fz-sm); line-height:var(--lh-text); color:var(--ink2);
  padding-left:11px; border-left:2px solid var(--line2); }
.clipMeta{ margin:10px 0 0; font-size:var(--fz-xs); color:var(--muted);
  font-family:var(--mono); letter-spacing:.03em; }
.clipMore{ position:absolute; top:8px; right:6px; border:0; background:none;
  color:var(--muted); font-size:var(--fz-2xl); line-height:1; padding:var(--sp-1) var(--sp-2);
  border-radius:var(--r-sm); cursor:pointer; }
.clipMore:hover{ background:var(--paper2); color:var(--ink); }

.bmFld{ margin:24px 0 2px; }
.bmFldHead{ display:flex; align-items:center; gap:9px; cursor:pointer;
  padding:7px 2px 9px; border-bottom:1.5px solid var(--gold-soft);
  -webkit-user-select:none; user-select:none; }
.bmTri{ flex:0 0 auto; color:var(--gold); font-size:var(--fz-2xs);
  transition:transform var(--dur-2) var(--ease); }
.bmFld.open > .bmFldHead > .bmTri{ transform:rotate(90deg); }
.bmFldName{ flex:1; min-width:0; font-size:var(--fz-md); font-weight:700;
  letter-spacing:.02em; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.bmFldN{ flex:0 0 auto; font-size:var(--fz-2xs); color:var(--muted); font-family:var(--mono); }
.bmFldHead .clipMore{ position:static; margin:-4px -4px -4px 0; }
.bmFldBody{ overflow:hidden; max-height:0; opacity:0;
  transition:max-height .28s var(--ease), opacity var(--dur-3) var(--ease); }
.bmFld.open > .bmFldBody{ max-height:6000px; opacity:1; }
.bmFldBody > .bmFld{ margin-left:14px; }
.bmFldEmpty{ font-size:var(--fz-xs); color:var(--muted); font-style:italic;
  padding:10px 4px 2px; }

.bmEmpty{ text-align:center; color:var(--muted); padding:56px 22px;
  line-height:2; font-size:var(--fz-md); }
.bmEmpty .g{ display:block; font-size:34px; color:var(--gold-soft);
  margin-bottom:var(--sp-3); }
.bmEmpty b{ display:block; color:var(--ink); font-size:var(--fz-lg-h);
  font-weight:700; margin-bottom:var(--sp-2); }

@media (hover:none){ .clip:hover{ border-left-color:var(--gold-soft);
  box-shadow:none; } }
@media (prefers-reduced-motion: reduce){
  .clip, .bmTri{ transition:none; }
  .bmFldBody{ transition:none; }
  .clip:active{ transform:none; }
}

/* a ⋯ context menu */
.ctxMenu{ position:absolute; z-index:var(--z-menu); min-width:150px;
  background:var(--surface); border:1px solid var(--line);
  border-radius:var(--r-md); box-shadow:var(--shadow-3); overflow:hidden;
  display:flex; flex-direction:column; }
.ctxMenu button{ border:0; background:none; text-align:right; cursor:pointer;
  font:inherit; color:var(--ink); padding:11px 14px; }
.ctxMenu button:hover{ background:var(--paper2); }
.ctxMenu button.danger, .s2act .go.danger{ color:var(--danger); }
.s2act .go.danger{ background:none; border-color:var(--danger); }

/* folder picker */
.pfList{ max-height:46vh; overflow:auto; margin:var(--sp-1) 0 var(--sp-2);
  border:1px solid var(--line2); border-radius:var(--r-md); }
.pf{ display:block; width:100%; text-align:left; border:0; background:none;
  font:inherit; color:var(--ink); padding:10px 12px; cursor:pointer;
  border-top:1px solid var(--line2); }
.pf:first-child{ border-top:0; }
.pf:hover{ background:var(--paper2); }
.sheet2 select{ width:100%; font-family:var(--ui); font-size:16px;
  border:1px solid var(--line); border-radius:var(--r-md); padding:10px 12px;
  background:var(--surface); color:var(--ink); }

/* verse / gāthā — set out line by line; mostly the Khmer rendering of a stanza, so plain
   serif. A stanza that is all marked Pāli (.vpali) gets the bolder .pali face (see above) */
.verse{ font-family:var(--serif); font-size:var(--fs);
  line-height:calc(var(--lh) - .2); text-align:center; text-indent:0;
  margin:18px auto; max-width:40em; white-space:normal; color:var(--ink);
  text-wrap:balance; scroll-margin-top:70px; }   /* one printed line (two padas) per line */
.verse.vpali{ font-family:var(--pali); font-weight:700; }

/* jump-to-anchor flash */
.flash{ animation:tpflash 1.6s ease-out; }
@keyframes tpflash{ 0%,15%{ background:var(--gold-soft); }
  100%{ background:transparent; } }

/* in-section find */
.findBar{ position:fixed; left:0; right:0; top:0; z-index:var(--z-modal);
  display:flex; align-items:center; gap:6px;
  padding:calc(8px + env(safe-area-inset-top)) calc(10px + env(safe-area-inset-right))
          8px calc(10px + env(safe-area-inset-left));
  background:var(--paper2); border-bottom:1px solid var(--line);
  box-shadow:var(--shadow-3); }
.findBar input{ flex:1; min-width:0; font-size:16px; padding:8px 10px;
  border:1px solid var(--line); border-radius:var(--r-sm); background:var(--surface);
  color:var(--ink); }
.findBar .fcount{ font-family:var(--mono); font-size:var(--fz-xs); color:var(--muted);
  min-width:3.2em; text-align:center; }
.findBar button{ flex:0 0 auto; width:34px; height:34px; border-radius:var(--r-sm);
  border:1px solid var(--line); background:var(--surface); color:var(--ink);
  font-size:var(--fz-lg); cursor:pointer; }
.findBar button:hover{ border-color:var(--gold-soft); }
mark{ background:var(--gold-soft); color:var(--on-soft); border-radius:2px;
  padding:0 1px; }
mark.on{ background:var(--gold); color:var(--on-gold); }

/* anonymous read meter */
.meterLine{ margin-top:26px; padding-top:14px; border-top:1px solid var(--line2);
  text-align:center; font-family:var(--ui); font-size:var(--fz-xs-h); color:var(--muted); }
.meterLine.low{ color:var(--gold); }
.meterLine a{ color:var(--gold); font-weight:700; text-decoration:none; }

/* full-text search (home) */
.ftBox{ margin-top:22px; border-top:1px solid var(--line2); padding-top:var(--sp-4); }
.ftHead{ display:flex; align-items:baseline; justify-content:space-between;
  flex-wrap:wrap; gap:6px 10px;
  font-size:var(--fz-lg); font-weight:700; margin-bottom:var(--sp-2); }
.ftHead .linkBtn{ color:var(--gold); font-weight:700; }
.ftHead .ftScope{ display:block; margin-top:2px; font-size:var(--fz-sm); font-weight:400; color:var(--muted); line-height:var(--lh-text); }   /* UX5 C4 */
.ftHint{ color:var(--muted); font-size:var(--fz-sm); margin:6px 0; }
.ftList{ display:flex; flex-direction:column; gap:2px; }
.ftItem{ display:block; text-decoration:none; color:var(--ink);
  padding:var(--sp-3) var(--sp-3); border-radius:var(--r); }
.ftItem:hover{ background:var(--surface); }
.ftT{ font-weight:700; font-size:var(--fz-md); }
.ftT span{ font-weight:400; color:var(--muted); font-size:var(--fz-xs); }
.ftS{ font-family:var(--serif); font-size:var(--fz-sm-h); color:var(--muted);
  line-height:1.75; margin-top:3px; }
.ftS mark{ background:var(--gold-soft); color:var(--ink); }
:root[data-theme="dark"] .ftS mark{ color:var(--on-gold); }
.ftLink{ display:block; color:inherit; text-decoration:none; }
.ftPages{ margin-top:6px; font-size:var(--fz-xs-h); color:var(--muted); line-height:2.1; }
.ftPages a{ display:inline-block; min-width:2em; margin-right:6px; padding:0 6px;
  text-align:center; border:1px solid var(--line); border-radius:var(--r-pill);
  color:var(--gold); text-decoration:none; }
.ftPages a:hover{ border-color:var(--gold-soft); }
/* result filters + basket / commentary badges */
.ftChips{ display:flex; gap:6px; margin:6px 0; overflow-x:auto; scrollbar-width:none;
  -webkit-overflow-scrolling:touch; }
.ftChips::-webkit-scrollbar{ display:none; }
.ftChip{ flex:0 0 auto; font-family:var(--ui); font-size:var(--fz-sm); color:var(--ink);
  background:var(--surface); border:1px solid var(--line); border-radius:var(--r-pill);
  padding:6px 12px; min-height:34px; cursor:pointer; white-space:nowrap; }
.ftChip b{ font-weight:400; color:var(--muted); margin-left:2px; }
.ftChip.on{ background:var(--tint); border-color:var(--gold); color:var(--ink); font-weight:700; }   /* UX5: tint, not gold */
.ftChip.on b{ color:var(--ink2); }
.ftBadge{ display:inline-block; vertical-align:1px; font-size:var(--fz-xs); font-weight:700;
  padding:0 7px; margin-right:6px; border-radius:var(--r-pill); line-height:1.8;
  border:1px solid currentColor; }
.ftBadge.v{ color:#6e4f80; }
.ftBadge.s{ color:#2f6a50; }
.ftBadge.a{ color:#2c5c8c; }
.ftBadge.c{ color:var(--muted); }
:root[data-theme="dark"] .ftBadge.v{ color:#c3a3d6; }
:root[data-theme="dark"] .ftBadge.s{ color:#8fcbab; }
:root[data-theme="dark"] .ftBadge.a{ color:#93bde6; }
.ftBadge.m{ color:#434e9c; }
:root[data-theme="dark"] .ftBadge.m{ color:#a9b3ee; }

/* ---------- account menu (replaces the browser confirm) ---------- */
.authHost{ position:relative; }
.authMenu{ position:absolute; top:calc(100% + 8px); right:0; z-index:calc(var(--z-menu) + 10);
  min-width:180px; background:var(--surface); border:1px solid var(--line);
  border-radius:var(--r-md); box-shadow:var(--shadow-3); overflow:hidden; }
.authWho{ padding:10px 14px; font-size:var(--fz-xs-h); color:var(--muted);
  border-bottom:1px solid var(--line2); white-space:nowrap;
  overflow:hidden; text-overflow:ellipsis; }
.authItem{ display:block; width:100%; text-align:right; padding:11px 14px;
  font-size:var(--fz-md); background:none; border:0; cursor:pointer; text-decoration:none;
  color:var(--ink); }
.authItem:hover{ background:var(--paper2); }

/* ---------- report / auth bottom-sheet (keyboard-safe on iOS) ---------- */
.sheet2{ width:min(460px,100%); max-height:88vh; display:flex;
  flex-direction:column; background:var(--paper2);
  border:1px solid var(--line); border-radius:var(--r-lg); padding:18px;
  box-shadow:var(--shadow-3); overflow:hidden; }
.sheet2 h3{ margin:0 0 10px; font-size:var(--fz-xl); }
.sheet2 .rQuote{ margin:0 0 var(--sp-1); padding:10px 12px; overflow:auto;
  flex:0 1 auto; max-height:34vh;
  border-left:3px solid var(--gold); background:var(--surface);
  border-radius:var(--r-sm); font-family:var(--serif); line-height:1.9; font-size:var(--fz-lg); }
.sheet2 label{ display:block; font-size:var(--fz-sm); color:var(--muted);
  margin:var(--sp-3) 0 var(--sp-1); }
.sheet2 label span{ opacity:.7; }
.sheet2 input, .sheet2 textarea{ width:100%; font-family:var(--ui);
  border:1px solid var(--line); border-radius:var(--r-md); padding:10px 12px;
  background:var(--surface); color:var(--ink); }
.sheet2 textarea{ resize:vertical; min-height:44px; }
.s2msg{ font-size:var(--fz-sm); margin:10px 0 0; min-height:1.2em; line-height:var(--lh-ui); }
.s2msg.err{ color:var(--danger); font-weight:700; }
.s2msg.ok{ color:var(--gold); font-weight:700; }
.s2act{ display:flex; gap:var(--sp-2); margin-top:14px; flex:0 0 auto; }
.s2act button{ flex:1; border-radius:var(--r-md); padding:13px; font-size:var(--fz-md-h);
  border:1px solid var(--line); background:var(--surface); cursor:pointer; }
.s2act .go{ background:var(--gold); color:var(--on-gold); border-color:var(--gold);
  font-weight:700; }
:root[data-theme="dark"] .s2act .go{ color:var(--on-gold); }
.s2act .go:disabled{ opacity:.7; cursor:default; }
.s2act .ghost{ background:none; }
@supports(padding:max(0px)){
  .shareModal{ align-items:flex-end; }
  .sheet2{ margin-bottom:max(16px, env(safe-area-inset-bottom));
    border-radius:var(--r-lg); }
}
@media(min-width:560px){ .shareModal{ align-items:center; } }

/* ============================================================
   Motion — make the site feel like an app, not a set of pages.
   All of it is opt-out under prefers-reduced-motion.
   ============================================================ */

/* base modal shell. read.html ships its own copy inline; this is what
   the SPA pages (index.html) use, and both pick up the entrance below. */
.shareModal{ position:fixed; inset:0; z-index:var(--z-modal); display:flex;
  align-items:center; justify-content:center; padding:20px;
  background:rgba(20,14,8,.72);
  -webkit-backdrop-filter:blur(3px); backdrop-filter:blur(3px); }

/* dialogs fade the scrim and float the sheet up — no JS hook needed,
   a fresh element runs its animation once on insert */
.shareModal{ animation:tpDim .18s ease both; }
.shareModal > *{ animation:tpSheet .26s var(--ease-out) both; }
@keyframes tpDim{ from{ opacity:0; } }
@keyframes tpSheet{ from{ opacity:0; transform:translateY(18px) scale(.985); } }

/* the ⋯ menu and toasts get the same lift */
.ctxMenu{ animation:tpSheet .16s ease both; transform-origin:top right; }

/* SPA route changes cross-fade + rise (Chromium, Android, Safari 18+);
   browsers without the API just swap instantly, exactly as before */
@media (prefers-reduced-motion: no-preference){
  ::view-transition-old(root){ animation:tpVTout .16s ease both; }
  ::view-transition-new(root){ animation:tpVTin .24s var(--ease-out) both; }
}
@keyframes tpVTout{ to{ opacity:0; } }
@keyframes tpVTin{ from{ opacity:0; transform:translateY(8px); } }

/* tap feedback — the whole UI depresses very slightly under a finger.
   (.contCard is left out: it owns a swipe-to-delete gesture of its own.) */
.row, .vol, .tab, .chip, .pf, .iconBtn, .linkBtn,
.ctxMenu button, .authItem, details.vg > summary{
  transition:transform var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease),
             border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease); }
.row:active, .vol:active, .tab:active, .chip:active,
.pf:active, .iconBtn:active,
.linkBtn:active, details.vg > summary:active{ transform:scale(.977); }

@media (prefers-reduced-motion: reduce){
  .shareModal, .shareModal > *, .ctxMenu{ animation:none; }
  ::view-transition-old(root), ::view-transition-new(root){ animation:none; }
  .row, .vol, .tab, .chip, .pf, .iconBtn, .linkBtn,
  details.vg > summary{ transition:none; }
  .row:active, .vol:active, .tab:active, .chip:active,
  .pf:active, .iconBtn:active,
  .linkBtn:active, details.vg > summary:active{ transform:none; }
}

/* ============================================================
   Touch devices — iPhone, iPad, Android tablets
   ============================================================ */

/* On a touchscreen :hover sticks after a tap until you tap elsewhere.
   Kill the ones that move or recolour things so cards don't stay "lifted"
   or highlighted after you've moved on. Pointer/trackpad users keep them. */
@media (hover: none){
  .vol:hover{ border-color:var(--line); transform:none; }
  .rnav a:hover, .iconBtn:hover, .authBtn:hover{
    border-color:var(--line); color:inherit; }
  .row:hover, .tocItem:hover, .ftItem:hover,
  .chip:hover, .pf:hover, .pnpop button:hover, .ctxMenu button:hover,
  .authItem:hover, .tab:hover{ background:transparent; }
  .tocItem.on:hover{ background:var(--surface); }
}

/* Tablet in the desktop layout (iPad portrait/landscape, 12.9" etc.):
   the chrome is mouse-sized. Give touch targets more room. */
@media (min-width:721px) and (max-width:1180px) and (pointer:coarse){
  .tab{ padding:11px 18px; font-size:var(--fz-md-h); }
  .row{ padding:15px 18px; }
  .tocItem{ padding:14px 16px; }
  .chip{ padding:11px 17px; }
  .rnav a, .rnav span{ padding:var(--sp-4) var(--sp-4); }
  .iconBtn{ width:40px; height:40px; }
  .vols{ grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); }
}

/* Landscape phone: vertical space is scarce — don't wrap the search onto
   its own row, and flatten the hero. */
@media (max-width:900px) and (max-height:520px) and (orientation:landscape){
  .topIn{ flex-wrap:nowrap; row-gap:0; }
  .search{ order:0; flex-basis:auto; }
  #authSlot{ order:0; margin-left:0; }
  .top .iconBtn{ order:0; }
  .hero{ padding:10px 0 0; }
  .reader{ margin-top:10px; }
}

/* ---------- back-to-top (reader + home) ---------- */
.toTop{
  position:fixed; z-index:var(--z-float);
  right:calc(16px + env(safe-area-inset-right));
  bottom:calc(16px + env(safe-area-inset-bottom));
  width:44px; height:44px; display:grid; place-items:center;
  border-radius:50%; border:1px solid var(--line);
  background:var(--surface); color:var(--ink); font-size:var(--fz-2xl); line-height:1;
  box-shadow:var(--shadow-3); cursor:pointer;
  opacity:0; transform:translateY(12px) scale(.9); pointer-events:none;
  transition:opacity var(--dur-3) var(--ease), transform var(--dur-3) var(--ease);
}
.toTop.show{ opacity:.92; transform:none; pointer-events:auto; }
.toTop:active{ transform:scale(.92); }
@media (prefers-reduced-motion: reduce){
  .toTop{ transition:none; }
}

/* ---------- search suggestions (recent queries) ---------- */
.qSuggest{
  position:absolute; left:0; right:0; top:calc(100% + 8px); z-index:var(--z-pop);
  background:var(--surface); border:1px solid var(--line);
  border-radius:var(--r); box-shadow:var(--shadow-3); overflow:hidden;
  padding:var(--sp-1); }
.qSuggest .qsHead{ font-size:var(--fz-xs); color:var(--muted); padding:8px 10px 4px; }
.qSuggest button{ display:flex; align-items:center; gap:9px; width:100%;
  border:0; background:none; text-align:left; cursor:pointer;
  font:inherit; color:var(--ink); padding:10px; border-radius:var(--r-md); }
.qSuggest button:hover{ background:var(--paper2); }
.qSuggest button .qsIco{ color:var(--muted); font-size:var(--fz-sm); flex:0 0 auto; }
.qSuggest button .qsX{ margin-left:auto; color:var(--muted); font-size:var(--fz-md);
  padding:2px 6px; border-radius:var(--r-sm); }

/* ---------- reader: TOC filter + vagga groups ---------- */
.tocTools{ padding:10px 16px 6px; border-bottom:1px solid var(--line2);
  position:sticky; top:0; background:var(--paper2); z-index:1; }
.tocFilter{ width:100%; font-family:var(--ui); font-size:16px;
  border:1px solid var(--line); border-radius:var(--r-md); padding:9px 12px;
  background:var(--surface); color:var(--ink); }
/* a volume's list (#/b/N): its filter, and where you were */
.volTools{ display:flex; flex-wrap:wrap; gap:10px; margin:2px 0 16px; }
.volTools .tocFilter{ flex:1 1 260px; }
#volList .row[hidden]{ display:none; }
.tocGroup{ border-top:1px solid var(--line2); }
.tocGroup:first-child{ border-top:0; }
.tocGroup > summary{ list-style:none; cursor:pointer; padding:var(--sp-3) var(--sp-4);
  font-size:var(--fz-sm); font-weight:700; color:var(--gold);
  display:flex; align-items:center; gap:var(--sp-2); }
.tocGroup > summary::-webkit-details-marker{ display:none; }
.tocGroup > summary::before{ content:"▸"; font-size:10px; }
.tocGroup[open] > summary::before{ content:"▾"; }
.tocGroup > summary span{ margin-left:auto; font-family:var(--mono);
  font-size:var(--fz-2xs); color:var(--muted); font-weight:400; }
.tocGroup .tocItem{ padding-left:28px; }
.tocEmpty{ padding:var(--sp-5) var(--sp-4); text-align:center; color:var(--muted);
  font-size:var(--fz-sm-h); }

/* ---------- reader: reading-position indicator ---------- */
.posInd{ flex:0 0 auto; font-family:var(--mono); font-size:var(--fz-xs);
  color:var(--muted); white-space:nowrap; padding-left:2px; }
@media (max-width:560px){ .posInd{ display:none; } }

/* chrome shouldn't be text-selectable when tapped quickly */
.top, .rtop, .rnav, .panel, .pnpop, .fnpop, .toTop, .qSuggest,
.ctxMenu, .toast{ -webkit-user-select:none; user-select:none; }

/* ============================================================
   Native-app feel — auto-hiding header, swipe, skeletons, A2HS
   ============================================================ */

/* the reader top bar slides out of the way while you scroll down */
.rtop{ transition:transform var(--dur-3) var(--ease); will-change:transform; }
.rtop.rhide{ transform:translateY(-100%); }

/* swipe between sections — brief slide-out before the next page loads */
.reader.swipeOut{ transition:transform var(--dur-2) var(--ease), opacity var(--dur-2) var(--ease); }
.reader.swipeOut.left{ transform:translateX(-7%); opacity:0; }
.reader.swipeOut.right{ transform:translateX(7%); opacity:0; }

/* skeleton placeholder while the section loads */
.rskel{ width:var(--read); margin:34px auto 120px; }
.skl{ background:linear-gradient(90deg,
    var(--line2) 25%, var(--line) 37%, var(--line2) 63%);
  background-size:400% 100%; border-radius:var(--r-sm);
  animation:sklShine 1.4s ease infinite; }
@keyframes sklShine{ from{ background-position:100% 0; } to{ background-position:-100% 0; } }
.rskel .skl.t{ height:26px; width:68%; margin:6px auto 12px; }
.rskel .skl.s{ height:12px; width:38%; margin:0 auto 34px; }
.rskel .skl.l{ height:15px; margin:0 0 13px; }
.rskel .skl.l:nth-of-type(4n){ width:88%; }
.rskel .skl.l:nth-of-type(6n){ width:72%; }

@media (prefers-reduced-motion: reduce){
  .rtop{ transition:none; }
  .reader.swipeOut{ transition:none; }
  .skl{ animation:none; }
}

/* ============================================================
   Page-turn ("book") reading mode — one printed page per screen,
   flipped horizontally with a smooth slide
   ============================================================ */
body.pagedMode{ overflow:hidden; }
body.pagedMode .rtop{ position:fixed; left:0; right:0; top:0; z-index:var(--z-bar); }
/* height (not inset's implicit top:0/bottom:0 span) pinned explicitly to the
   DYNAMIC viewport -- on a phone/tablet whose browser chrome (address bar,
   tab strip) shows and hides as you scroll, "inset:0" on a fixed element
   sizes against whichever viewport state happened to be current at layout
   time, which drifts page to page. That drift was exactly what fed the
   auto-fit measurement below: clientHeight came out different run to run
   for the SAME content, so one page fit at full size and the next one
   didn't and had to shrink or scroll. 100dvh tracks the real visible area
   continuously instead of a snapshot of it. */
body.pagedMode .reader{ position:fixed; left:0; right:0; top:0;
  height:100vh; height:100dvh; z-index:1; width:100%;
  margin:0; padding:0; }
body.pagedMode .pageMark{ display:none; }         /* the bar shows the page no. */
body.pagedMode .toTop{ display:none; }
body.pagedMode .selBar.sheet{ bottom:calc(52px + env(safe-area-inset-bottom)); }

.pgViewport{ position:absolute; inset:0; overflow:hidden; touch-action:pan-y; }
.pgTrack{ display:flex; height:100%; width:100%;
  transition:transform .38s cubic-bezier(.4,0,.2,1); will-change:transform; }
.pgTrack.dragging{ transition:none; }
.pgPane{ flex:0 0 100%; height:100%; overflow-y:auto; overflow-x:hidden;
  -webkit-overflow-scrolling:touch;
  padding:calc(env(safe-area-inset-top) + 82px) var(--pgpad)
          calc(72px + env(safe-area-inset-bottom));
  /* the track can hold the whole volume — skip rendering off-screen pages */
  content-visibility:auto; contain-intrinsic-size:auto 100vh;
  contain-intrinsic-size:auto 100dvh; }
.pgPane .rpage{ max-width:var(--read); margin-left:auto; margin-right:auto; }

/* book view — the scanned page image in place of the OCR text */
.pgScan{ display:none; }
body.bookView .pgPane{ overflow:hidden;
  padding:calc(env(safe-area-inset-top) + 46px) 6px
          calc(env(safe-area-inset-bottom) + 40px);
  display:flex; align-items:center; justify-content:center; }
body.bookView .pgPane > .rpage{ display:none; }
body.bookView .pgScan{ display:flex; position:relative; width:100%; height:100%;
  align-items:center; justify-content:center; }
body.bookView .pgScan canvas{ max-width:100%; max-height:100%;
  background:#fff; box-shadow:0 3px 22px rgba(0,0,0,.28); border-radius:2px;
  opacity:0; transition:opacity .3s var(--ease); }
body.bookView .pgScan.ready canvas{ opacity:1; }

/* a paper-shaped skeleton while pdf.js downloads the volume + rasterises */
.pgScan .pgSheet{ position:absolute; aspect-ratio:1 / 1.414;
  height:min(100%, 88vh); max-width:100%;
  background:#f6f1e6; border-radius:2px; overflow:hidden;   /* matches the scan's paper */
  box-shadow:0 3px 22px rgba(0,0,0,.22);
  display:flex; align-items:center; justify-content:center; }
.pgScan .pgSheet::before{ content:""; position:absolute; inset:0;
  background:linear-gradient(100deg, transparent 30%,
    rgba(0,0,0,.06) 45%, rgba(0,0,0,.1) 50%, rgba(0,0,0,.06) 55%, transparent 70%);
  background-size:250% 100%; animation:pgShine 1.5s ease-in-out infinite; }
.pgScan .pgSpin{ width:26px; height:26px; border-radius:50%;
  border:2.5px solid var(--line); border-top-color:var(--gold);
  animation:pgSpin .8s linear infinite; }
.pgScan.ready .pgSheet, .pgScan.err .pgSheet::before{ display:none; }
.pgScan.err .pgSheet{ background:var(--surface); }
@keyframes pgShine{ from{ background-position:130% 0; } to{ background-position:-130% 0; } }
@keyframes pgSpin{ to{ transform:rotate(360deg); } }

.pgScan .pgScanMsg{ position:absolute; bottom:12px; left:0; right:0;
  text-align:center; color:var(--muted); font-family:var(--mono);
  font-size:var(--fz-xs); padding:0 var(--sp-3); pointer-events:none; }
.pgScan.err .pgScanMsg{ pointer-events:auto; cursor:pointer; color:var(--ink); }
.pgScan.ready .pgScanMsg{ display:none; }
@media (prefers-reduced-motion: reduce){
  .pgScan .pgSheet::before{ animation:none; }
  .pgScan .pgSpin{ animation-duration:1.6s; }
}

.pgBar{ position:fixed; left:0; right:0; bottom:0; z-index:calc(var(--z-bar) - 4);
  display:none; align-items:center; justify-content:center; gap:14px;
  padding:9px 0 calc(9px + env(safe-area-inset-bottom));
  background:color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter:saturate(1.4) blur(10px);
  border-top:1px solid var(--line2);
  font-family:var(--mono); font-size:var(--fz-xs); color:var(--muted);
  transition:transform var(--dur-3) var(--ease); }
body.pagedMode .pgBar{ display:flex; }
/* page number · progress · time left, on the same column as the header and text */
.pgBarIn{ width:var(--read); display:flex; align-items:center; gap:14px; }
.pgBar .pgnum, .pgBar .pgleft{ flex:0 0 auto; white-space:nowrap; }
.pgBar .pgleft:empty{ display:none; }
.pgBar .pgprog{ flex:1; height:2px; background:var(--line);
  border-radius:2px; overflow:hidden; }
/* running head: the sutta / chapter this screen belongs to */
.runHead{ display:none; position:fixed; z-index:2; left:0; right:0;
  top:calc(env(safe-area-inset-top) + 58px); width:var(--read); margin:0 auto;
  text-align:center; font-size:var(--fz-xs); line-height:var(--lh-ui); color:var(--muted);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  letter-spacing:.01em; pointer-events:none;
  background:var(--paper); padding-bottom:var(--sp-1); }   /* a long page scrolls under it */
body.pagedMode:not(.bookView) .runHead:not(:empty){ display:block; }
/* this printed page goes on below the screen — scroll it (space / PageDown) */
body.pagedMode::after{ content:""; position:fixed; left:0; right:0; z-index:3;
  bottom:calc(38px + env(safe-area-inset-bottom)); height:44px; pointer-events:none;
  background:linear-gradient(to bottom, transparent, var(--paper));
  opacity:0; transition:opacity var(--dur-3) var(--ease); }
body.pagedMode.paneMore::after{ opacity:1; }
/* page-turn: header, running head, text and bottom bar share one column —
   the text's own width inside a screen's side margins */
body.pagedMode .rtopIn, body.pagedMode .pgBarIn, body.pagedMode .runHead{
  width:min(720px, calc(100% - 2 * var(--pgpad) - var(--gut))); }
.pgBar .pgprog i{ display:block; height:100%; background:var(--gold); width:0;
  transition:width .3s var(--ease); }
.chromeHidden .rtop{ transform:translateY(-100%); }
.chromeHidden .pgBar{ transform:translateY(115%); }

.pgChevron{ position:fixed; top:50%; transform:translateY(-50%); z-index:calc(var(--z-bar) - 5);
  width:42px; height:66px; border:1px solid var(--line); border-radius:var(--r-md);
  cursor:pointer; background:color-mix(in srgb, var(--paper) 80%, transparent);
  color:var(--muted); font-size:22px; line-height:1; display:none; }
@media (hover:hover) and (min-width:900px){
  body.pagedMode .pgChevron{ display:block; }
}
.pgChevron.l{ left:10px; } .pgChevron.r{ right:10px; }
.pgChevron:hover{ color:var(--ink); border-color:var(--gold-soft); }
.pgChevron[disabled]{ opacity:.22; pointer-events:none; }
.chromeHidden .pgChevron{ opacity:0; pointer-events:none; transition:opacity var(--dur-3); }

@media (prefers-reduced-motion: reduce){
  .pgTrack{ transition:none; }
  .pgBar, .chromeHidden .pgBar, .chromeHidden .rtop{ transition:none; }
}

/* ============================================================
   Canon navigator — a persistent tree on wide screens,
   a slide-in drawer on phones/tablets
   ============================================================ */
/* sits BELOW the site header (lower z-index), so the header always
   covers its own strip and there's no overlap to paint around */
.cnav{
  position:fixed; left:0; z-index:var(--z-nav);
  top:calc(56px + env(safe-area-inset-top)); bottom:0;
  width:min(288px, 84vw);
  display:flex; flex-direction:column;
  background:var(--paper2); border-right:1px solid var(--line);
  transform:translateX(-101%);
  transition:transform var(--dur-3) var(--ease);
}
.cnav.show{ transform:none; box-shadow:var(--shadow-3); }
.cnavScrim{
  position:fixed; inset:0; z-index:calc(var(--z-nav) - 1); background:rgba(20,14,8,.42);
  opacity:0; pointer-events:none; transition:opacity var(--dur-3);
}
.cnavScrim.show{ opacity:1; pointer-events:auto; }

/* Contents access is available at every width; desktop uses it to show or hide the tree. */
#navBtn{ display:none; }
@media (max-width:767px){ #navBtn{ display:grid; width:40px; height:40px; } }
@media (min-width:768px){ #navBtn{ display:grid; } }

/* a "show" tab on the left edge once the sidebar is collapsed (wide only) */
.cnavPeek{
  display:none;
  position:fixed; left:0; top:50%; transform:translateY(-50%); z-index:calc(var(--z-nav) + 1);
  width:24px; height:72px; padding:0;
  border:1px solid var(--line); border-left:0;
  border-radius:0 12px 12px 0;
  background:var(--paper2); color:var(--gold);
  font-size:var(--fz-xl); line-height:1; cursor:pointer;
  box-shadow:var(--shadow-2); transition:background-color var(--dur-1), width var(--dur-1);
}
.cnavPeek:hover{ background:var(--surface); width:28px; }
@media (min-width:1000px){
  body.navHidden .cnavPeek{ display:grid; place-items:center; }
}

.cnavTop{ display:flex; align-items:center; justify-content:space-between;
  padding:12px 14px 10px; border-bottom:1px solid var(--line2); flex:0 0 auto; }
.cnavTop b{ font-size:var(--fz-md); }
.cnavTop .linkBtn{ border-bottom:0; color:var(--gold); font-weight:600; text-decoration:none; padding:2px 6px; }
.cnavTop .linkBtn:hover{ color:var(--ink); }
.cnavBody{ flex:1; overflow:auto; -webkit-overflow-scrolling:touch;
  overscroll-behavior:contain; padding:6px 0 28px; }

.cnav a, .cnav .tnode > button, .cnav .tref{
  display:flex; align-items:center; gap:6px; width:100%;
  text-decoration:none; color:var(--ink); font:inherit; text-align:left;
  border:0; background:none; cursor:pointer; line-height:1.45;
  /* one indent step per nesting level (--d set on the row / its .tnode) */
  padding:9px 14px 9px calc(14px + var(--d, 0) * 15px);
  font-size:calc(13.8px - var(--d, 0) * 0.4px);
  border-radius:0;
}
.cnav .tnode > button:hover, .cnav a:hover{ background:var(--surface); }
.cnav .tref{ cursor:default; }   /* same look as the links, just not clickable */
.cnav .tkids > a, .cnav .tkids > .tref{ color:var(--ink2); }  /* leaves a touch dimmer */
.cnav .tcar{ flex:0 0 auto; width:12px; color:var(--muted); font-size:var(--fz-2xs);
  transition:transform var(--dur-2); }
.cnav .tnode.open > button > .tcar{ transform:rotate(90deg); }
.cnav .tkids{ display:none; }
.cnav .tnode.open > .tkids{ display:block; }
.cnav .l1 > button{ font-weight:700; font-size:var(--fz-md); }
.cnav a.on{ color:var(--gold); font-weight:700; background:var(--surface);
  box-shadow:inset 3px 0 0 var(--gold); }
.cnavBody > a{ font-weight:600; }

@media (min-width:1000px){
  .cnav{ transform:none; box-shadow:none; }
  .cnavScrim{ display:none; }
  .topIn{
    width:calc(100vw - 32px);
    max-width:none;
    padding-left:var(--sp-4);
    padding-right:var(--sp-4);
  }
  .brand{
    width:calc(min(288px, 84vw) - 16px);
    flex:0 0 calc(min(288px, 84vw) - 16px);
  }
  .wrap{
    margin-left:calc(min(288px,84vw) + 16px);
    margin-right:auto;
    width:min(var(--max), calc(100vw - min(288px,84vw) - 48px));
  }
  body.navHidden .topIn{
    width:min(var(--max), calc(100% - 32px));
    max-width:var(--max);
    margin:0 auto;
    padding-left:0;
    padding-right:0;
  }
  body.navHidden .brand{
    width:auto;
    flex:0 0 auto;
  }
  body.navHidden .cnav{ transform:translateX(-100%); }
  body.navHidden .wrap{ margin-left:auto;
    width:min(var(--max), calc(100% - 32px)); }
}
@media (prefers-reduced-motion: reduce){
  .cnav{ transition:none; } .cnavScrim{ transition:none; }
}

/* ---------- home: the 82 volumes, shelved by basket and nikāya ----------
   The printed edition uses one cover for every volume; a wall of 82 identical
   covers is hard to scan, so each cover carries only its volume number and
   the title is set underneath, catalogue-card style. */
.shelfGroup{ margin:18px 0 6px; font-size:var(--fz-sm); font-weight:700; color:var(--muted);
  letter-spacing:.02em; display:flex; align-items:baseline; gap:10px; }
.shelfGroup::after{ content:""; flex:1; height:1px; background:var(--line2); }
.shelf{ display:grid; gap:20px 14px; margin:10px 0 8px;
  grid-template-columns:repeat(auto-fill, minmax(96px, 1fr)); }
@media (min-width:768px){
  .shelf{ grid-template-columns:repeat(auto-fill, minmax(116px, 1fr)); gap:22px 16px; margin:14px 0 16px; }
  .bcovCap{ font-size:var(--fz-sm); line-height:1.45; }
  .bcovCap b{ font-size:var(--fz-xs); }
}
@media (min-width:1100px){
  .shelf{ grid-template-columns:repeat(auto-fill, minmax(126px, 1fr)); gap:26px 18px; }
}
.bcov{ display:block; text-decoration:none; color:inherit; min-width:0; }
.bcovArt{
  position:relative; display:block; aspect-ratio:460/651; overflow:hidden;
  border-radius:2px 5px 5px 2px;
  background:#a8551a url("../covers/cover.webp") top center / cover no-repeat;
  box-shadow:0 1px 3px rgba(58,32,10,.25), inset 4px 0 6px -4px rgba(0,0,0,.5);
  transition:transform var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.bcov:hover .bcovArt{ transform:translateY(-2px);
  box-shadow:0 6px 16px rgba(58,32,10,.28), inset 4px 0 6px -4px rgba(0,0,0,.5); }
/* a solid band over the printed "ភាគ ១" carries the real volume number */
.bcovArt::after{ content:""; position:absolute; left:0; right:0; top:41%; height:24%;
  background:#8a3f10; box-shadow:0 -1px 0 rgba(255,255,255,.12), 0 1px 0 rgba(0,0,0,.2); }
.bcovNo{ position:absolute; left:0; right:0; top:41%; height:24%; z-index:1;
  display:flex; align-items:center; justify-content:center;
  color:#f6e6c4; font-weight:700; font-size:clamp(15px, 4vw, 18px); }
.bcovCap{ display:block; margin-top:7px; font-size:var(--fz-xs-h); line-height:var(--lh-snug); color:var(--ink2); }
.bcovCap b{ display:block; font-size:var(--fz-xs); font-weight:400; color:var(--muted); }
.bcov:hover .bcovCap{ color:var(--ink); }
.catParent.v{ border-bottom-color:#b08bc3; } .catParent.s{ border-bottom-color:#7fae96; }
.catParent.a{ border-bottom-color:#86a9cc; } .catParent.m{ border-bottom-color:#7f8fd0; }
/* the Visuddhimagga (books 83-90): each volume's own printed cover, no number band */
.bcov.vm .bcovArt{ background-color:#24318f; background-position:center; background-size:cover; }
.bcov.vm .bcovArt::after{ display:none; }
.vmHead{ margin-top:34px; }
/* the home page's shortcuts to each basket's shelf */
.shelfJump{ display:flex; flex-wrap:wrap; gap:var(--sp-2); margin:22px 0 2px; }
.shelfJump .chip{ padding:7px 14px; font-size:var(--fz-sm-h); }
.shelfJump .chip.vm{ border-color:#7f8fd0; color:var(--ed-atk); font-weight:700; }
:root[data-theme="dark"] .shelfJump .chip.vm{ color:#b3bcf2; border-color:#5d6bb8; }
.catParent{ scroll-margin-top:124px; }
@media (prefers-reduced-motion: reduce){ .bcovArt{ transition:none; } }
/* ---------- the 110-volume edition (ព្រះត្រៃបិដក បាលីប្រែ) ----------
   its own shelf: the print colours its covers by basket (Vinaya yellow, Sutta orange,
   Abhidhamma red; covers/p/), the volume's number set above the seated Buddha */
.bcov.pe .bcovArt{ background-color:#d08a3a; background-position:center; background-size:cover; }
.bcov.pe .bcovArt::after{ display:none; }
.bcov.pe .bcovNo{ top:5%; height:20%; color:#2b1408; font-size:clamp(14px, 3.6vw, 17px);
  text-shadow:0 1px 0 rgba(255,255,255,.3); }
.peHead{ margin-top:34px; scroll-margin-top:124px; }
.shelfJump .chip.pe{ border-color:#c0705a; color:var(--ed-pe); font-weight:700; }
:root[data-theme="dark"] .shelfJump .chip.pe{ color:#f0a993; border-color:#a5594a; }

/* ---------- the 214-volume Pāli-only edition (គម្ពីរបាលីសុទ្ធ ឆដ្ឋសង្គាយនា) ---------- */
.shelfJump .chip.ce{ border-color:#2a7b62; color:#185b46; font-weight:700; }
:root[data-theme="dark"] .shelfJump .chip.ce{ color:#68d8b2; border-color:#2f8b6f; }
.catParent.ce{ border-bottom-color:#2a7b62; }
.cSubTabs{ display:flex; flex-wrap:wrap; gap:var(--sp-2); margin:14px 0 16px; }
.cSubTabs .chip{ padding:6px 14px; font-size:var(--fz-sm); cursor:pointer; }
.cSubTabs .chip.active{ background:var(--ink); color:var(--bg); border-color:var(--ink); }
.bcov.c-cov .bcovArt{
  background-color:#172b26; background-position:center; background-size:cover;
}
.bcov.c-cov .bcovArt::after{ display:none; }
/* search results say which edition: "បិ.អ" over "៦១/១២០", "បិ.បាលីប្រែ" over "២៣/៣៤៣" */
.row .pg.ed{ font-size:var(--fz-xs); flex:0 0 80px; min-width:0; line-height:var(--lh-snug); }   /* UX5: one width for every edition */
.row .pg.ed b{ display:block; font-family:var(--ui); font-size:var(--fz-xs); font-weight:700; color:var(--gold); }
.ftEd{ font-weight:700; color:var(--gold); }
.row .pg.ed.pe b, .ftEd.pe{ color:var(--ed-pe); }
:root[data-theme="dark"] .row .pg.ed.pe b, :root[data-theme="dark"] .ftEd.pe{ color:#eba08c; }
.offP{ margin-top:22px; padding-top:18px; border-top:1px solid var(--line2); }
.offWhat{ font-size:var(--fz-md); color:var(--ink2); margin:0 0 10px; line-height:var(--lh-text); }
@media (max-width:600px){
  .shelf{ grid-template-columns:repeat(4, minmax(0, 1fr)); gap:14px 9px; }
  .bcovNo{ font-size:var(--fz-sm); }
  .bcovCap{ font-size:var(--fz-xs); line-height:1.45; }
}

/* ============================================================
   Edition Switcher & Fast Shelf Navigation (UX Overhaul)
   ============================================================ */
.edSwitchWrap{ margin:18px 0 14px; }
.edSwitcher{ display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:var(--sp-2);
  background:var(--paper2); padding:6px; border-radius:calc(var(--r) + 4px); border:1px solid var(--line); }
@media (max-width:768px){ .edSwitcher{ grid-template-columns:repeat(auto-fit, minmax(130px, 1fr)); gap:6px; } }
.edTab{ display:flex; flex-direction:column; align-items:center; justify-content:center;
  padding:10px 8px 8px; border-radius:var(--r); border:1px solid transparent; background:transparent;
  color:var(--muted); cursor:pointer; text-align:center; transition:color var(--dur-2) var(--ease), background-color var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease); min-height:48px; position:relative; }
.edTab:hover{ color:var(--ink); background:color-mix(in srgb, var(--surface) 60%, transparent); }
.edTab.active{ background:var(--surface); color:var(--ink); font-weight:700;
  border-color:var(--line); box-shadow:var(--shadow-1); }
.edTab.active::before{ content:""; position:absolute; top:-1px; left:12px; right:12px; height:3px;
  border-radius:3px 3px 0 0; background:var(--gold); }
.edTab.pe.active::before{ background:var(--ed-pe); }
.edTab.atk.active::before{ background:var(--ed-atk); }
.edTab.ce.active::before{ background:var(--ed-ce); }
.edTab.pk.active::before{ background:var(--ed-pk); }
.edTab.active .edTabLbl{ color:var(--gold); }
.edTab.pe.active .edTabLbl{ color:var(--ed-pe); }
.edTab.atk.active .edTabLbl{ color:var(--ed-atk); }
.edTab.ce.active .edTabLbl{ color:var(--ed-ce); }
.edTab.pk.active .edTabLbl{ color:var(--ed-pk); }
:root[data-theme="dark"] .edTab.pe.active .edTabLbl{ color:#f0a993; }
:root[data-theme="dark"] .edTab.atk.active .edTabLbl{ color:#a9b5f2; }
:root[data-theme="dark"] .edTab.ce.active .edTabLbl{ color:#68d8b2; }
:root[data-theme="dark"] .edTab.pk.active .edTabLbl{ color:#f5b374; }
.edTabLbl{ font-size:var(--fz-md); line-height:1.35; font-weight:700; }
.edTabSub{ font-size:var(--fz-xs); color:var(--muted); margin-top:2px; font-family:var(--mono); }
@media (min-width:768px){
  .edTab{ min-height:52px; padding:11px 12px 9px; }
  .edTabLbl{ font-size:var(--fz-md-h); }
  .edTabSub{ font-size:var(--fz-xs); margin-top:3px; }
}

/* Shelf Controls: View Toggle & Basket Pills */
.shelfToolBar{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin:10px 0 6px; }
#basketPillsBox{ flex:1 1 auto; min-width:0; }
.viewModeToggle{ display:inline-flex; background:var(--paper2); border:1px solid var(--line);
  border-radius:var(--r-pill); padding:2px; flex:0 0 auto; align-self:center; margin-bottom:6px; }
.vmBtn{ border:0; background:transparent; color:var(--muted); padding:5px 11px;
  border-radius:var(--r-pill); font-size:var(--fz-md); cursor:pointer; min-height:36px; min-width:38px;
  display:grid; place-items:center; transition:color var(--dur-1), background-color var(--dur-1), box-shadow var(--dur-1); }
.vmBtn:hover{ color:var(--ink); }
.vmBtn.active{ background:var(--surface); color:var(--gold); font-weight:700; box-shadow:var(--shadow-1); }
.vmBtn .ic{ width:18px; height:18px; }   /* UX5: icons, not ⊞ ☰ */

/* Basket Filter Pills */
.basketPills{ display:flex; gap:7px; overflow-x:auto; padding:4px 2px 6px; margin:0;
  scrollbar-width:none; -webkit-overflow-scrolling:touch; }
.basketPills::-webkit-scrollbar{ display:none; }
.bpPill{ display:inline-flex; align-items:center; gap:6px; flex:0 0 auto;
  padding:6px 12px; border-radius:var(--r-pill); border:1px solid var(--line);
  background:var(--surface); color:var(--ink2); font-size:var(--fz-sm); cursor:pointer; white-space:nowrap;
  transition:color var(--dur-2) var(--ease), background-color var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease), transform var(--dur-2) var(--ease); min-height:36px; box-shadow:var(--shadow-1); }
.bpPill:hover{ border-color:var(--gold-soft); color:var(--ink); transform:translateY(-1px); }
.bpPill .bpLbl{ font-weight:500; }
.bpPill .bpCnt{ font-size:var(--fz-2xs); font-weight:700; padding:1px 6px; border-radius:var(--r-pill);
  background:var(--paper2); color:var(--muted); line-height:1.2; font-family:var(--mono); }

.ed-82 .bpPill.active{ background:var(--gold); color:var(--on-gold); border-color:var(--gold); font-weight:700; }
.ed-82 .bpPill.active .bpCnt{ background:rgba(0,0,0,.18); color:inherit; }

.ed-110 .bpPill.active{ background:var(--ed-pe); color:var(--on-gold); border-color:var(--ed-pe); font-weight:700; }
.ed-110 .bpPill.active .bpCnt{ background:rgba(0,0,0,.18); color:inherit; }

.ed-atk .bpPill.active{ background:var(--ed-atk); color:var(--on-gold); border-color:var(--ed-atk); font-weight:700; }
.ed-atk .bpPill.active .bpCnt{ background:rgba(0,0,0,.18); color:inherit; }

.ed-pali .bpPill.active{ background:var(--ed-ce); color:var(--on-gold); border-color:var(--ed-ce); font-weight:700; }
.ed-pali .bpPill.active .bpCnt{ background:rgba(0,0,0,.18); color:inherit; }

:root[data-theme="dark"] .ed-82 .bpPill.active{ color:var(--on-gold); }
:root[data-theme="dark"] .ed-82 .bpPill.active .bpCnt{ background:rgba(0,0,0,.18); }

/* Scholastic Compact List View Mode */
.shelfList{ display:flex; flex-direction:column; gap:6px; margin:10px 0 30px; }
.volRow{ display:flex; align-items:center; gap:var(--sp-3); padding:10px 14px; background:var(--surface);
  border:1px solid var(--line); border-radius:var(--r); text-decoration:none; color:var(--ink);
  transition:background var(--dur-1), border-color var(--dur-1); }
.volRow:hover{ background:color-mix(in srgb, var(--gold-soft) 12%, var(--surface)); border-color:var(--gold-soft); }
.vrBadges{ flex:0 0 auto; display:flex; align-items:center; gap:6px; min-width:92px; }
.vrNum{ font-size:var(--fz-xs-h); font-weight:700; padding:3px 8px; border-radius:var(--r-pill);
  background:rgba(135,92,24,.1); color:var(--gold); }
.vrNum.pe{ background:rgba(192,112,90,.14); color:var(--ed-pe); }
.vrNum.atk{ background:rgba(127,143,208,.16); color:var(--ed-atk); }
.vrNum.ce{ background:rgba(86,140,115,.16); color:var(--ed-ce); }
.vrNum.pk{ background:rgba(200,120,40,.16); color:var(--ed-pk); }
:root[data-theme="dark"] .vrNum.pe{ color:#f0a993; }
:root[data-theme="dark"] .vrNum.atk{ color:#a9b5f2; }
:root[data-theme="dark"] .vrNum.ce{ color:#68d8b2; }
:root[data-theme="dark"] .vrNum.pk{ color:#f5b374; }
.catParent.pk{ border-bottom-color:var(--ed-pk); }
.vrStatus{ font-size:var(--fz-xs); color:var(--gold); font-weight:700; }
.vrStatus.done{ color:var(--ok); }
/* ---------- READMARK (js/readmark.js, 2026-11-06): what is already read, at a glance ----------
   finished = the site's "done" green (as «✓ អានចប់» on the continue cards); started = gold */
:root{ --rm-done:var(--ok); --rm-done-bg:var(--ok-bg); }
/* a cover: a check flag on a finished volume, a thin bar «អានបាន N%» under a started one */
.rmFlag{ position:absolute; z-index:2; top:6px; right:6px; display:inline-flex; align-items:center; gap:3px;
  padding:2px 7px 2px 5px; border-radius:var(--r-pill); background:#2f5f43; color:#fff;
  font-size:var(--fz-xs); font-weight:700; line-height:var(--lh-snug); box-shadow:0 1px 3px rgba(0,0,0,.35); }
.rmFlag .ic{ width:13px; height:13px; stroke-width:2.4; }
.bcov.rmDone .bcovArt{ filter:saturate(.72); }
.bcov.rmDone .bcovCap{ color:var(--muted); }
.rmProg{ display:block; margin-top:6px; }
.rmProgBar{ display:block; height:3px; border-radius:2px; background:var(--line); overflow:hidden; }
.rmProgBar i{ display:block; height:100%; background:var(--gold); border-radius:2px; }
.rmProgTx{ display:block; margin-top:3px; font-size:var(--fz-xs); line-height:var(--lh-display); color:var(--gold); font-weight:600; }
.rmProg + .bcovCap{ margin-top:3px; }
/* list rows and the drawer */
.vrStatus .ic{ width:13px; height:13px; vertical-align:-2px; margin-right:2px; stroke-width:2.4; }
.vrStatus.done{ color:var(--rm-done); background:var(--rm-done-bg); padding:1px 7px; border-radius:var(--r-pill); white-space:nowrap; }
.volRow.rmDone .vrTitle{ color:var(--ink2); font-weight:500; }
.rmNav{ margin-left:auto; flex:0 0 auto; font-size:var(--fz-xs); font-weight:700; color:var(--gold); }
.rmNav.done{ color:var(--rm-done); display:inline-flex; }
.rmNav .ic{ width:15px; height:15px; stroke-width:2.4; }
.sr{ position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
/* the quiet line over the shelves: counts, and «លាក់ក្បាលដែលអានចប់» */
.rmShelfLine{ display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:6px 14px;
  margin:10px 2px 0; font-size:var(--fz-xs-h); color:var(--muted); }
.rmCount{ display:inline-flex; align-items:center; gap:6px; flex-wrap:wrap; }
.rmDot{ width:8px; height:8px; border-radius:50%; background:var(--gold); display:inline-block; }
.rmDot.done{ background:var(--rm-done); }
.rmSep{ margin:0 2px; }
.rmHideBtn{ display:inline-flex; align-items:center; gap:7px; min-height:36px; padding:4px 2px;
  border:0; background:none; font:inherit; font-size:var(--fz-xs-h); color:var(--ink2); cursor:pointer; }
.rmBox{ width:17px; height:17px; border:1.5px solid var(--muted); border-radius:4px; display:inline-grid; place-items:center; }
.rmBox .ic{ width:13px; height:13px; stroke-width:2.6; opacity:0; }
.rmHideBtn[aria-pressed="true"] .rmBox{ background:var(--rm-done); border-color:var(--rm-done); color:#fff; }
:root[data-theme="dark"] .rmHideBtn[aria-pressed="true"] .rmBox{ color:#10241a; }
.rmHideBtn[aria-pressed="true"] .rmBox .ic{ opacity:1; }
.rmHide #shelfContainer .bcov.rmDone, .rmHide #shelfContainer .volRow.rmDone,
.rmHide #shelfContainer .rmAllDone{ display:none; }
/* section rows of a volume: a finished one is ticked and a touch quieter */
.row .badge.done{ color:var(--rm-done); background:var(--rm-done-bg); border-color:transparent; font-weight:700; }
.row:has(> .badge.done) .tt{ color:var(--ink2); }
/* the volume page: «អានចប់ ១២/៣៥ ផ្នែក · ៣៤%», and a finished volume's way on */
.rmVol{ margin-top:var(--sp-3); max-width:420px; }
.rmVolTx{ margin:0; font-size:var(--fz-sm); line-height:var(--lh-ui); color:var(--ink2); }
.rmVolTx b{ color:var(--ink); }
.rmVolTx .ic{ width:16px; height:16px; color:var(--rm-done); stroke-width:2.4; vertical-align:-3px; margin-right:var(--sp-1); }
.rmVol .bar.wide{ margin-top:7px; }
.rmFin{ display:flex; flex-wrap:wrap; align-items:center; gap:10px 14px; margin-top:14px; max-width:620px;
  padding:12px 14px; border:1px solid color-mix(in srgb, var(--rm-done) 35%, var(--line));
  border-radius:var(--r); background:var(--rm-done-bg); }
.rmFinIco .ic, .rmNoteIco .ic{ width:22px; height:22px; padding:3px; border-radius:50%;
  background:var(--rm-done); color:#fff; stroke-width:2.4; display:block; }
:root[data-theme="dark"] .rmFinIco .ic, :root[data-theme="dark"] .rmNoteIco .ic{ color:#10241a; }
.rmFinTx{ flex:1 1 160px; display:flex; flex-direction:column; font-size:var(--fz-md); }
.rmFinTx small{ font-size:var(--fz-xs); color:var(--muted); }
.rmFinGo{ flex:0 1 auto; display:grid; grid-template-columns:1fr auto; column-gap:var(--sp-2); align-items:center;
  padding:7px 12px; border:1px solid var(--line); border-radius:var(--r); background:var(--surface);
  color:var(--ink); text-decoration:none; min-width:0; }
.rmFinGo small{ grid-column:1; font-size:var(--fz-xs); color:var(--muted); }
.rmFinGo b{ grid-column:1; font-size:var(--fz-sm-h); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rmFinGo .rmChev{ grid-column:2; grid-row:1 / span 2; color:var(--gold); font-size:var(--fz-2xl); }
.rmFinGo:hover{ border-color:var(--gold-soft); }
/* the reader: a section already finished */
.rmNote{ position:relative; display:flex; gap:var(--sp-3); align-items:flex-start; width:var(--read); margin:14px auto 0;
  padding:12px 40px 12px 14px; border:1px solid color-mix(in srgb, var(--rm-done) 35%, var(--line));
  border-radius:var(--r); background:color-mix(in srgb, var(--rm-done) 8%, var(--surface));
  font-family:var(--ui); transition:opacity var(--dur-3) var(--ease), transform var(--dur-3) var(--ease); }
.rmNote.rmGone{ opacity:0; transform:translateY(-6px); }
.rmNoteBody{ min-width:0; flex:1; }
.rmNoteTx{ margin:0; font-size:var(--fz-md); line-height:var(--lh-ui); color:var(--ink); }
.rmNoteTx span{ color:var(--muted); font-size:var(--fz-sm); white-space:nowrap; }
.rmNoteSub{ margin:2px 0 0; font-size:var(--fz-sm); color:var(--muted); }
.rmNoteAct{ display:flex; flex-wrap:wrap; align-items:center; gap:var(--sp-2) var(--sp-4); margin-top:var(--sp-2); }
.rmGo{ display:inline-flex; align-items:center; min-height:38px; padding:6px 14px; border-radius:var(--r-pill);
  background:var(--gold); color:var(--on-gold); font-weight:700; font-size:var(--fz-sm-h); text-decoration:none; }
:root[data-theme="dark"] .rmGo{ color:var(--on-gold); }
.rmAgain{ min-height:38px; padding:4px 2px; border:0; background:none; font:inherit; font-size:var(--fz-sm-h);
  color:var(--ink2); text-decoration:underline; text-underline-offset:3px; text-decoration-color:var(--line); cursor:pointer; }
.rmNoteTo{ margin:6px 0 0; font-size:var(--fz-xs-h); color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rmX{ position:absolute; top:6px; right:6px; width:34px; height:34px; display:grid; place-items:center;
  border:0; background:none; color:var(--muted); border-radius:50%; cursor:pointer; }
.rmX:hover{ background:var(--line2); color:var(--ink); }
.rmX .ic{ width:16px; height:16px; }
@media (prefers-reduced-motion: reduce){ .rmNote{ transition:none; } }
.vrInfo{ flex:1 1 auto; min-width:0; }
.vrTitle{ font-size:var(--fz-md); font-weight:600; line-height:var(--lh-display); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.vrSub{ font-size:var(--fz-xs); color:var(--muted); margin-top:2px; }
.vrArrow{ flex:0 0 auto; font-size:var(--fz-xl); color:var(--muted); }

/* Profile Reading History */
.profHistBox{ margin:var(--sp-6) 0; padding-top:var(--sp-5); border-top:1px solid var(--line2); }
.histList{ display:grid; gap:var(--sp-3); grid-template-columns:1fr; margin-top:14px; }
@media (min-width:680px){
  .histList{ grid-template-columns:repeat(2, 1fr); gap:14px; }
}
.emptyHist{ text-align:center; padding:36px 18px; color:var(--muted); font-size:var(--fz-md); line-height:1.8;
  background:var(--surface); border-radius:var(--r-lg); border:1px dashed var(--line); }
.shelfCountBadge{ display:inline-block; font-size:var(--fz-xs); color:var(--muted); font-family:var(--mono); margin-left:var(--sp-2); font-weight:400; }

.qVolJump{ display:flex; align-items:center; gap:var(--sp-3); margin:0 0 14px; padding:13px 15px;
  border:1px solid color-mix(in srgb,var(--gold) 35%,var(--line)); border-radius:var(--r-lg);
  background:color-mix(in srgb,var(--gold) 7%,var(--surface)); text-decoration:none;
  transition:border-color var(--dur-2),transform var(--dur-2),box-shadow var(--dur-2); }
.qVolJump:hover{ border-color:var(--gold); transform:translateY(-1px); box-shadow:var(--shadow-2); }
.qVolIcon{ flex:0 0 34px; width:34px; height:34px; display:grid; place-items:center;
  border-radius:50%; background:color-mix(in srgb,var(--gold) 13%,var(--surface)); color:var(--gold); font-size:var(--fz-3xl); }
.qVolInfo{ min-width:0; flex:1 1 auto; display:flex; flex-direction:column; gap:2px; }
.qVolInfo b{ font-size:var(--fz-md); line-height:var(--lh-display); }
.qVolInfo small{ color:var(--muted); font-size:var(--fz-xs); }
.qVolAction{ flex:0 0 auto; color:var(--gold); font-size:var(--fz-xs); font-weight:700; white-space:nowrap; }
/* a bare number ("23", "២៣", "23/45"): that volume (page) in every edition, one tap each */
.qDest{ margin:0 0 6px; border:1px solid color-mix(in srgb,var(--gold) 35%,var(--line));
  border-radius:var(--r-lg); background:color-mix(in srgb,var(--gold) 7%,var(--surface)); overflow:hidden; }
.qDestHead{ display:flex; align-items:baseline; justify-content:space-between; gap:10px;
  padding:11px 15px 9px; font-weight:700; font-size:var(--fz-lg); }
.qDestHead small{ font-weight:400; font-size:var(--fz-xs); color:var(--muted); text-align:right; }
.qDestRow{ display:flex; align-items:center; gap:var(--sp-3); padding:10px 15px; text-decoration:none;
  border-top:1px solid color-mix(in srgb,var(--gold) 18%,var(--line2)); transition:background var(--dur-2); }
.qDestRow:hover{ background:color-mix(in srgb,var(--gold) 12%,var(--surface)); }
.qDestEd{ flex:0 0 86px; font-size:var(--fz-xs); line-height:1.45; color:var(--gold); }
.qDestEd.pe{ color:var(--ed-pe); }
:root[data-theme="dark"] .qDestEd.pe{ color:#eba08c; }
.qDestInfo{ min-width:0; flex:1 1 auto; display:flex; flex-direction:column; gap:1px; }
.qDestName{ font-size:var(--fz-md); line-height:var(--lh-snug); overflow-wrap:anywhere; }
.qDestInfo small{ color:var(--muted); font-size:var(--fz-xs); line-height:var(--lh-snug); }
.qDestGo{ flex:0 0 auto; color:var(--gold); font-size:var(--fz-3xl); line-height:1; }
.qNumHead{ margin-top:22px; }
.qNumHead h3{ margin:0; font-size:var(--fz-md); color:var(--ink2); }

/* ============================================================
   ប្រវត្តិរូប — a reader's ledger, not a dashboard  (#/me)
   ============================================================ */
.prof{ max-width:560px; margin:22px auto 90px; }
@media (min-width:768px){
  .prof{ max-width:680px; }
}

.profTop{ display:flex; align-items:flex-start; gap:14px; }
.profMono{ flex:0 0 auto; width:52px; height:52px; border-radius:50%;
  display:grid; place-items:center; font-family:var(--serif);
  font-size:24px; color:var(--on-gold);
  background:linear-gradient(150deg, color-mix(in srgb, var(--gold) 78%, var(--gold-soft)), var(--gold)); }
:root[data-theme="dark"] .profMono{ color:var(--on-gold);
  background:linear-gradient(150deg, var(--gold-soft), var(--gold)); }
.profName{ margin:2px 0 0; font-family:var(--serif); font-size:24px;
  font-weight:700; line-height:1.25; display:flex; align-items:center; gap:var(--sp-2); }
.profEdit{ border:0; background:none; color:var(--muted); cursor:pointer;
  font-size:var(--fz-lg); padding:2px 4px; border-radius:var(--r-sm); }
.profEdit:hover{ color:var(--gold); }
.profSince{ margin:5px 0 0; font-family:var(--mono); font-size:var(--fz-xs);
  letter-spacing:.03em; color:var(--muted); }
.profRule{ height:2px; background:var(--gold-soft); opacity:.5;
  margin:18px 0 22px; border-radius:2px; }
/* UX4: the history comes first, straight under the rule (no second line, no empty band);
   the sign-in line for a reader without an account wraps: Khmer leading */
.profRule + .profHistBox{ margin-top:0; padding-top:0; border-top:0; }
.profSince.profSign{ font-family:var(--ui); font-size:var(--fz-sm); letter-spacing:0; line-height:var(--lh-text); }

/* streak — the emotional centre, given room */
/* the weekly rhythm (#/me): weeks at the goal, an 8-week grid, the goal chips */
.weekHero{ text-align:center; margin:6px 0 16px; }
.whN{ font-family:var(--serif); font-size:52px; font-weight:700; line-height:1.1; color:var(--ink); }
.whN small{ font-size:26px; color:var(--muted); font-weight:400; }
.whLbl{ display:block; margin-top:2px; font-size:var(--fz-sm-h); color:var(--muted); }
.whSub{ display:block; margin-top:var(--sp-2); font-size:var(--fz-sm-h); color:var(--ink2); }
.weekGrid{ display:grid; gap:5px; max-width:340px; margin:0 auto; }
.wgRow{ display:grid; grid-template-columns:66px repeat(7, 1fr) 22px; gap:5px; align-items:center; }
.wgHead span{ text-align:center; font-size:var(--fz-xs); color:var(--muted); }
.wgLab{ font-size:var(--fz-xs); color:var(--muted); text-align:right; padding-right:var(--sp-1); white-space:nowrap; }
.wgCell{ aspect-ratio:1; border-radius:5px; border:1px solid var(--line); background:transparent; }
.wgCell.on{ background:var(--gold); border-color:var(--gold); }
.wgCell.fut{ border-style:dashed; opacity:.5; }
.wgMet .ic{ width:16px; height:16px; color:var(--gold); stroke-width:2.4; display:block; margin:auto; }
.goalRow{ display:flex; flex-wrap:wrap; align-items:center; justify-content:center; gap:var(--sp-2);
  margin:18px 0 6px; font-size:var(--fz-sm); color:var(--muted); }
.goalRow .chips{ gap:var(--sp-1); }
.goalRow .chip{ min-width:34px; padding:5px 8px; }
.weekNote{ text-align:center; font-size:var(--fz-xs-h); color:var(--muted); line-height:1.75; margin:var(--sp-1) auto 0;
  max-width:420px; }
.profOpt{ display:flex; align-items:center; justify-content:center; gap:var(--sp-2);
  margin:10px auto 0; font-size:var(--fz-sm); color:var(--ink2); cursor:pointer; }
.profOpt input{ width:20px; height:20px; accent-color:var(--gold); cursor:pointer; }   /* UX5: was 16 */
.streakHero{ text-align:center; margin:6px 0 18px; }
.streakN{ font-family:var(--serif); font-size:52px; font-weight:700;
  line-height:1; color:var(--ink); }
.streakN .fire{ font-size:30px; vertical-align:12px; margin-right:6px;
  -webkit-text-stroke:0; }
.streakLbl{ display:block; margin-top:var(--sp-1); font-size:var(--fz-sm); color:var(--muted); }
.streakBest{ display:block; margin-top:6px; font-size:var(--fz-xs);
  font-family:var(--mono); color:var(--muted); }

.dotRow{ display:flex; justify-content:center; gap:6px; margin:14px 0 4px; }
.dot{ width:9px; height:9px; border-radius:50%; border:1px solid var(--line);
  background:transparent; }
.dot.on{ background:var(--gold); border-color:var(--gold); }
.dotRow + .dotCap{ text-align:center; font-size:var(--fz-xs); color:var(--muted);
  font-family:var(--mono); letter-spacing:.08em; margin-bottom:18px; }

/* milestone track — a thin road with stops, a mark where you are */
.mileTrack{ position:relative; height:2px; background:var(--line);
  margin:26px 18px 10px; border-radius:2px; }
.mileFill{ position:absolute; left:0; top:0; bottom:0; background:var(--gold-soft);
  border-radius:2px; }
.mileStop{ position:absolute; top:50%; transform:translate(-50%,-50%);
  display:flex; flex-direction:column; align-items:center; gap:5px; }
.mileStop .pin{ width:9px; height:9px; border-radius:50%;
  background:var(--surface); border:1.5px solid var(--line); }
.mileStop.on .pin{ background:var(--gold); border-color:var(--gold); }
.mileStop .n{ font-family:var(--mono); font-size:var(--fz-xs); color:var(--muted);
  white-space:nowrap; }
.mileStop.on .n{ color:var(--gold); }
.mileStop.last{ transform:translate(-82%,-50%); }   /* keep the end label on-track */
.mileHere{ position:absolute; top:-14px; transform:translateX(-50%);
  font-size:var(--fz-lg); }
.mileHint{ text-align:center; font-size:var(--fz-xs-h); color:var(--muted);
  margin:16px 0 6px; }

/* window toggle + the numbers as a ledger */
.winTabs{ display:flex; gap:6px; justify-content:center; margin:26px 0 14px; }
.winTab{ border:1px solid var(--line); background:var(--surface); cursor:pointer;
  font:inherit; font-size:var(--fz-xs-h); color:var(--muted);
  padding:6px 13px; border-radius:var(--r-pill); }
.winTab[aria-pressed="true"]{ background:var(--tint); color:var(--ink);
  border-color:var(--gold); font-weight:700; }   /* UX5: tint, not gold */

.ledger{ margin:0; border-top:1px solid var(--line2); }
.ledger div{ display:flex; align-items:baseline; justify-content:space-between;
  gap:var(--sp-4); padding:14px 2px; border-bottom:1px solid var(--line2); }
.ledger dt{ font-size:var(--fz-sm-h); color:var(--ink2); margin:0; }
.ledger dd{ margin:0; font-family:var(--serif); font-size:19px; font-weight:700;
  color:var(--ink); }
.ledger .sub{ font-size:var(--fz-xs); color:var(--muted); font-family:var(--mono);
  font-weight:400; margin-left:6px; }

.profActs{ margin-top:var(--sp-5); display:flex; gap:var(--sp-4); }

/* account — merged in from the old header sign-in menu */
.profAuth{ margin-top:28px; padding-top:20px; border-top:1px solid var(--line2); }
.profAuth.in{ display:flex; align-items:center; justify-content:space-between;
  gap:var(--sp-4); flex-wrap:wrap; }
.paWho b{ display:block; font-size:var(--fz-md-h); }
.paWho span{ font-size:var(--fz-xs); color:var(--muted); font-family:var(--mono); }
.paActs{ display:flex; align-items:center; gap:var(--sp-4); }
.paActs .linkBtn{ font-size:var(--fz-sm); }

@media (prefers-reduced-motion: reduce){ .mileFill{ transition:none; } }

/* ---------- line icons (js/icons.js) in context ---------- */
.pnpop button{ display:flex; align-items:center; gap:10px; }
.pnpop .ic{ width:18px; height:18px; color:var(--muted); }
.pnpop button:hover .ic{ color:var(--gold); }
.shareBtn{ display:inline-flex; align-items:center; justify-content:center; gap:7px; }
.shareBtn .ic{ width:17px; height:17px; }
.findBar button{ display:grid; place-items:center; }
.findBar button .ic, .toTop .ic{ width:18px; height:18px; }
.contDel, .swipe .del{ display:grid; place-items:center; }
.contDel .ic, .swipe .del .ic, .qSuggest .ic, .x .ic, .profEdit .ic{ width:15px; height:15px; }
.qSuggest button .qsIco{ display:inline-grid; }
.streakN .fire .ic{ width:32px; height:32px; color:#c2571c; vertical-align:-3px; stroke-width:1.6; }
.mileHere .ic{ width:15px; height:15px; color:#c2571c; }
:root[data-theme="dark"] .streakN .fire .ic, :root[data-theme="dark"] .mileHere .ic{ color:#e8894a; }
.pf .ic{ width:16px; height:16px; vertical-align:-3px; color:var(--muted); margin-right:var(--sp-1); }
#listenBtn .ic{ width:20px; height:20px; }

/* quieter lists: a hairline frame, no floating card */
.list{ box-shadow:none; border-color:var(--line2); }

/* selection bar: one primary action (share); copy and report stay quiet */
.selBar .reportBtn{ background:var(--surface); color:var(--muted); border:1px solid var(--line); }
.selBar .dictBtn{ background:var(--surface); color:var(--ink); border:1px solid var(--line); }
:root[data-theme="dark"] .selBar .dictBtn{ color:var(--ink); }
/* on a phone the four-action bar stays as it was: the lookup floats above it as one pill */
.selBar.sheet .shareBtn.dictBtn{ position:absolute; left:50%; bottom:calc(100% + 10px); transform:translateX(-50%);
  flex:none; flex-direction:row; gap:6px; padding:var(--sp-2) var(--sp-4); border-radius:var(--r-pill); font-size:var(--fz-sm); box-shadow:var(--shadow-3); }
.selBar.sheet .shareBtn.dictBtn .ic{ width:16px; height:16px; }
body:has(.selBar.sheet[style*="flex"] .dictBtn:not([style*="none"])) .toast{ bottom:calc(166px + env(safe-area-inset-bottom)); }
.selBar .reportBtn:hover{ color:var(--danger); border-color:var(--danger); }
:root[data-theme="dark"] .selBar .reportBtn{ color:var(--muted); }
.selBar.sheet .shareBtn{ font-size:var(--fz-sm); }
/* a confirmation toast floats above the pinned selection bar instead of covering it */
body:has(.selBar.sheet[style*="flex"]) .toast{ bottom:calc(112px + env(safe-area-inset-bottom)); }

/* ---------- page-turn (text view): screens cut at one type size ----------
   read.js paginate() measures each screen in a hidden pane sized to the SMALLEST
   visible height (svh), so text always fits whether a phone's address bar is
   showing or not, and nothing reflows while you read. */
.pgPane.pgMeasure{ position:absolute; left:0; top:0; width:100%;
  height:100vh; height:100svh; visibility:hidden; pointer-events:none;
  content-visibility:visible; }
/* a paragraph split across two screens: the part before the break is justified
   to its last line like a printed page; the continuation is not indented again */
.pgPane .para.splitHead{ text-align-last:justify; margin-bottom:0; }
.pgPane .para.cont{ text-indent:0; }

/* ---------- បុគ្គល និងទីកន្លែង: people & places (#/n) ---------- */
.nmTools{ display:flex; gap:10px 14px; align-items:center; flex-wrap:wrap; margin:18px 0 6px; }
.nmFilter{ flex:1 1 260px; min-width:0; font:inherit; font-size:var(--fz-lg); color:var(--ink);
  background:var(--surface); border:1px solid var(--line); border-radius:var(--r-pill);
  padding:9px 16px; }
.nmFilter:focus{ outline:none; border-color:var(--gold); box-shadow:0 0 0 2px color-mix(in srgb, var(--gold) 35%, transparent); }
.nmKinds{ margin:14px 0 0; }
.nmKindHd{ display:block; font-size:var(--fz-xs-h); font-weight:700; color:var(--gold);
  letter-spacing:.02em; margin:0 0 7px; }
.nmKinds .chips, .nmPk{ gap:6px; }
.nmKinds .chip, .nmSort .chip, .nmPk .chip{ padding:6px 12px; font-size:var(--fz-sm-h); }
.chip i{ font-style:normal; font-family:var(--mono); font-size:var(--fz-xs); color:var(--muted); margin-left:2px; }
.chip[aria-pressed="true"] i{ color:inherit; opacity:.8; }
#nmList{ margin-top:22px; }
.nmGrid{ display:grid; gap:0 18px; grid-template-columns:repeat(auto-fill,minmax(210px,1fr));
  border-top:1px solid var(--line2); }
.nm{ display:flex; align-items:baseline; gap:var(--sp-2); padding:10px 2px; text-decoration:none;
  border-bottom:1px solid var(--line2); min-width:0; }
.nm b{ font-size:var(--fz-lg); font-weight:600; min-width:0; overflow-wrap:anywhere; }
.nm span{ font-size:var(--fz-xs); color:var(--muted); white-space:nowrap; }
.nm i{ margin-left:auto; font-style:normal; font-family:var(--mono); font-size:var(--fz-2xs); color:var(--muted); }
.nm:hover b{ color:var(--gold); }
.nmLetter{ font-size:var(--fz-3xl); font-weight:700; color:var(--gold); margin:22px 0 4px; }
.nmLetter:first-child{ margin-top:0; }
.hero .nmKind, .nmHit .nmKind{ font-size:var(--fz-xs-h); font-weight:700; color:var(--gold); letter-spacing:.03em; }
.hero .nmKind{ margin-bottom:var(--sp-1); }
.hero p b{ font-weight:600; color:var(--ink2); }
.nmPk{ margin:var(--sp-4) 0 var(--sp-1); }
.nmBook{ font-size:var(--fz-sm-h); color:var(--muted); margin:22px 0 -4px; }
.nmBook a{ color:var(--ink); font-weight:700; text-decoration:none; margin-right:6px; }
.nmBook a:hover{ color:var(--gold); }
.row .ex mark{ background:color-mix(in srgb, var(--gold-soft) 45%, transparent); color:var(--ink); padding:0 1px; }
:root[data-theme="dark"] .row .ex mark{ background:color-mix(in srgb, var(--gold-soft) 22%, transparent); }
.nmMore{ margin:var(--sp-4) auto 0; max-width:320px; }
.nmPeek{ display:flex; flex-wrap:wrap; gap:var(--sp-2); min-height:38px; }
.nmChip{ display:inline-flex; align-items:baseline; gap:6px; padding:7px 13px; font-size:var(--fz-md);
  text-decoration:none; background:var(--surface); border:1px solid var(--line); border-radius:var(--r-pill); }
.nmChip span{ font-size:var(--fz-xs); color:var(--muted); }
.nmChip:hover{ border-color:var(--gold-soft); }
.nmHit{ display:flex; flex-wrap:wrap; align-items:baseline; gap:4px 10px; margin:22px 0 -10px;
  padding:var(--sp-3) var(--sp-4); text-decoration:none; background:var(--surface);
  border:1px solid var(--line); border-left:3px solid var(--gold); border-radius:var(--r); }
.nmHit b{ font-size:17px; }
.nmHit span:last-child{ font-size:var(--fz-sm); color:var(--muted); }
.nmHit:hover{ border-color:var(--gold-soft); border-left-color:var(--gold); }
@media (max-width:720px){
  .nmGrid{ grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:0 var(--sp-3); }
  .nm{ flex-wrap:wrap; row-gap:0; }
  .nm span{ order:3; width:100%; }
}
.nmRow .tx{ flex:1 1 auto; }
/* a name's page: the count line is the point of the header, keep it on phones */
@media (max-width:720px){ .hero.nmHero p{ display:block; font-size:var(--fz-sm-h); } }

/* ---------- find in this section: a compact card, not an edge-to-edge strip ---------- */
.findBar{ left:auto; right:calc(12px + env(safe-area-inset-right));
  top:calc(66px + env(safe-area-inset-top));          /* under the reader's header, not over it */
  width:min(440px, calc(100% - 24px)); padding:6px 6px 6px 8px;
  border:1px solid var(--line); border-radius:var(--r); box-shadow:var(--shadow-2); }
.findBar input{ border:0; background:transparent; padding:7px 6px; }
.findBar input:focus{ outline:none; }
.findBar:focus-within{ border-color:var(--gold); box-shadow:var(--shadow-2), 0 0 0 2px color-mix(in srgb, var(--gold) 35%, transparent); }
.findBar button{ border:0; background:none; color:var(--muted); width:32px; height:32px; }
.findBar button:hover{ background:var(--line2); color:var(--ink); }
/* arriving from a search result or a name's page: the words you came for, as a pill
   at the bottom -- no input, no keyboard; ‹ › only when they occur more than once */
.findBar.findPill{ top:auto; bottom:calc(18px + env(safe-area-inset-bottom));
  left:50%; right:auto; transform:translateX(-50%);
  width:auto; max-width:calc(100% - 24px); gap:2px; padding:var(--sp-1) var(--sp-1) var(--sp-1) var(--sp-4);
  border-radius:var(--r-pill); }
body.pagedMode .findBar.findPill{ bottom:calc(48px + env(safe-area-inset-bottom)); }
.findPill .fpWords{ font-size:var(--fz-md); font-weight:600; color:var(--ink); white-space:nowrap;
  overflow:hidden; text-overflow:ellipsis; min-width:0; padding-right:6px; }
.findPill .fcount{ min-width:0; padding:0 var(--sp-1); }
.findPill.one .fcount, .findPill.one [data-f="prev"], .findPill.one [data-f="next"]{ display:none; }
/* the match you were sent to: a short glow so the eye finds it */
mark.pulse{ animation:tppulse 1.6s ease-out; }
@keyframes tppulse{ 0%,30%{ box-shadow:0 0 0 6px color-mix(in srgb, var(--gold) 45%, transparent); }
  100%{ box-shadow:0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce){ mark.pulse{ animation:none; } }

/* ---------- touch targets: inline links big enough for a finger ----------
   breadcrumbs, quiet text links and the rename pencil were 19-25px tall; an
   invisible layer around them takes the tap, so nothing visible moves */
.crumb a, .linkBtn, .emptyLink{ position:relative; }
.crumb a::after, .linkBtn::after, .emptyLink::after{ content:""; position:absolute; inset:-10px -6px; }
.profEdit{ min-width:36px; min-height:36px; display:inline-grid; place-items:center; }
/* icon buttons (34-36px on phones), chips and small bar buttons: the same invisible
   layer brings the tap area to ~44px for older fingers -- nothing visible moves */
.iconBtn, .chip, .ftChip, .seShare, .a2Go, .asStep, .asX, .findBar button, .a2Line .x{ position:relative; }
.iconBtn::after, .asStep::after, .asX::after, .findBar button::after, .a2Line .x::after{
  content:""; position:absolute; inset:-5px; }
.chip::after, .ftChip::after, .seShare::after, .a2Go::after{
  content:""; position:absolute; inset:-5px 0; }
.findBar input::-webkit-search-cancel-button{ display:none; }

/* text selected for copy / share: the site's gold, not the browser's blue */
::selection{ background:color-mix(in srgb, var(--gold-soft) 45%, transparent); color:inherit; }

/* ---------- ផែនការអាន: reading plans (#/plan) ---------- */
.rpage{ scroll-margin-top:64px; }           /* ?at= lands below the sticky header */
.planForm{ margin:18px 0 0; max-width:780px; }
.planForm [hidden]{ display:none; }
.pfStep{ padding:var(--sp-4) 0; border-top:1px solid var(--line2); }
.pfStep:first-child{ border-top:0; padding-top:var(--sp-1); }
.pfStep h3{ margin:0 0 10px; font-size:var(--fz-md); color:var(--gold); letter-spacing:.02em; }
.planForm .chips{ gap:7px; }
.planForm .chip{ padding:7px 13px; font-size:var(--fz-md); }
.pfSub{ margin-top:10px; padding-left:var(--sp-3); border-left:2px solid var(--gold-soft); }
.pfMode{ margin-bottom:10px; }
.pfDate{ display:inline-flex; align-items:center; gap:var(--sp-2); font-size:var(--fz-sm-h); color:var(--muted); }
.pfDate input, .pfInput{ font:inherit; font-size:16px;   /* under 16px iPhone zooms in */ color:var(--ink); background:var(--surface);
  border:1px solid var(--line); border-radius:var(--r-pill); padding:6px 12px; }
/* the form ran three screens deep under a dozen gold chips with its button at the very
   end: now the button rides along at the foot of the screen, and a chosen chip is a
   tint, so the only solid gold left is the action */
/* (UX5: every .chip now does this, see .chip[aria-pressed]) */
.planBar{ position:sticky; bottom:0; z-index:var(--z-sticky); display:flex; align-items:center; gap:var(--sp-3);
  margin:18px -16px 0; padding:10px 16px calc(10px + env(safe-area-inset-bottom));
  background:color-mix(in srgb, var(--paper) 94%, transparent); border-top:1px solid var(--line);
  -webkit-backdrop-filter:blur(8px); backdrop-filter:blur(8px); }
.planBar .pairBtn{ flex:0 0 auto; margin:0; padding:12px 20px; }
.pbSum{ flex:1 1 auto; min-width:0; font-size:var(--fz-xs-h); color:var(--muted); line-height:var(--lh-snug); }
.pbSum b{ display:block; font-size:var(--fz-lg); color:var(--ink); }
body:has(.planBar) .toTop{ display:none; }
.planSum{ margin:6px 0 4px; padding:16px 18px; background:var(--surface); border:1px solid var(--line);
  border-radius:var(--r); }
.psMain{ font-size:26px; font-weight:700; line-height:1.3; }
.psMain span{ font-size:var(--fz-lg); font-weight:400; color:var(--muted); }
.psSub{ margin-top:var(--sp-1); font-size:var(--fz-sm-h); color:var(--muted); line-height:var(--lh-text); }
.psWarn{ margin-top:10px; font-size:var(--fz-sm-h); line-height:var(--lh-text); color:#9b3b22; }
:root[data-theme="dark"] .psWarn{ color:#e8894a; }
.psDays{ list-style:none; margin:var(--sp-3) 0 0; padding:10px 0 0; border-top:1px solid var(--line2);
  font-size:var(--fz-sm-h); line-height:1.85; color:var(--ink2); }
.psDays b{ color:var(--ink); font-weight:600; }
#planGo{ max-width:320px; margin-top:18px; }
.planStat{ margin:14px 0 6px; }
.planStat .bar.wide{ max-width:none; margin-top:0; height:5px; }
.psRow{ display:flex; justify-content:space-between; gap:6px 12px; flex-wrap:wrap; font-size:var(--fz-sm-h);
  color:var(--muted); margin-top:9px; }
.psOk{ color:var(--gold); font-weight:600; }
.psLate{ color:var(--accent); font-weight:600; }      /* behind: said plainly, not in alarm red */
.psFix{ margin-top:var(--sp-3); font-size:var(--fz-sm-h); line-height:var(--lh-text); color:var(--ink2); padding:10px 14px;
  border:1px dashed var(--line); border-radius:var(--r-md); }
.psFix .linkBtn{ color:var(--gold); font-weight:600; }
.planToday{ margin:20px 0; padding:14px 16px 12px; background:var(--surface); border:1px solid var(--line);
  border-left:3px solid var(--gold); border-radius:var(--r); }
.ptHead{ display:flex; flex-wrap:wrap; align-items:baseline; gap:2px 12px; }
.ptHead b{ font-size:var(--fz-xl); }
.ptHead span{ font-size:var(--fz-sm); color:var(--muted); }
.ptList{ list-style:none; margin:10px 0 0; padding:0; }
.ptList li a{ display:grid; grid-template-columns:24px 1fr; column-gap:var(--sp-2); padding:9px 0;
  border-top:1px solid var(--line2); text-decoration:none; }
.ptTick{ grid-row:span 2; width:18px; height:18px; margin-top:var(--sp-1); border-radius:50%;
  border:1.5px solid var(--line); display:grid; place-items:center; color:#fff; }
.ptList li.done .ptTick{ background:var(--gold); border-color:var(--gold); }
:root[data-theme="dark"] .ptList li.done .ptTick{ color:var(--on-gold); }
.ptTick .ic{ width:12px; height:12px; stroke-width:2.4; }
.ptT{ font-size:var(--fz-lg); line-height:1.55; }
.ptT i{ font-style:normal; font-size:var(--fz-xs-h); color:var(--muted); }
.ptM{ font-size:var(--fz-xs-h); color:var(--muted); }
.ptList li.done .ptT{ color:var(--muted); }
.ptAct{ display:flex; align-items:center; gap:10px 18px; flex-wrap:wrap; margin-top:var(--sp-3); }
.ptAct .pairBtn{ display:inline-block; margin:0; padding:10px 26px; }
.planDays{ list-style:none; margin:0; padding:0; border-top:1px solid var(--line2); }
.planDays li{ display:flex; align-items:baseline; gap:10px; padding:10px 2px;
  border-bottom:1px solid var(--line2); font-size:var(--fz-md); }
.planDays b{ flex:0 0 auto; min-width:7.5em; font-weight:600; }
.planDays span{ min-width:0; color:var(--ink2); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.planDays i{ margin-left:auto; flex:0 0 auto; font-style:normal; font-size:var(--fz-xs-h); color:var(--muted); }
.planFoot{ margin:26px 0 10px; text-align:center; }
.planPromo{ display:flex; flex-wrap:wrap; align-items:baseline; gap:var(--sp-1) var(--sp-3); margin:14px 0 0;
  padding:var(--sp-3) var(--sp-4); text-decoration:none; background:var(--surface); border:1px solid var(--line);
  border-radius:var(--r); }
.planPromo b{ font-size:var(--fz-lg); }
.planPromo span{ flex:1 1 260px; font-size:var(--fz-sm-h); color:var(--muted); line-height:var(--lh-ui); }
.planPromo i{ font-style:normal; font-size:var(--fz-sm-h); color:var(--gold); font-weight:600; }
.planPromo:hover{ border-color:var(--gold-soft); }
.planHomeCard{ display:block; text-decoration:none; padding:16px 18px; background:var(--surface);
  border:1px solid var(--line); border-radius:var(--r-lg);
  box-shadow:var(--shadow-1);
  transition:border-color var(--dur-2), box-shadow var(--dur-2), transform var(--dur-2); }
.planHomeCard:hover{ border-color:var(--gold-soft); box-shadow:var(--shadow-2); transform:translateY(-1px); }
.phHead{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:var(--sp-3); flex-wrap:wrap; }
.phBadge{ display:inline-flex; align-items:center; gap:6px; font-size:var(--fz-xs-h); font-weight:600;
  color:var(--gold); background:rgba(181,133,56,.1); padding:3px 10px; border-radius:var(--r-pill); }
.phBadge .ic{ width:14px; height:14px; }
.phDay{ font-size:var(--fz-xs-h); color:var(--muted); font-family:var(--mono); }
.phDay .phPct{ color:var(--ink); font-weight:700; margin-left:var(--sp-1); }

/* When reading is done today */
.phDoneBox{ display:flex; align-items:center; gap:var(--sp-3); padding:12px 14px;
  background:color-mix(in srgb, #2e7d32 8%, var(--paper2));
  border:1px solid color-mix(in srgb, #2e7d32 22%, transparent);
  border-radius:var(--r); margin:4px 0 14px; }
:root[data-theme="dark"] .phDoneBox{ background:rgba(46,125,50,.15); border-color:rgba(76,175,80,.28); }
.phDoneIco{ width:34px; height:34px; border-radius:50%; background:#2e7d32;
  color:#fff; display:grid; place-items:center; flex:0 0 auto;
  box-shadow:0 2px 6px rgba(46,125,50,.3); }
.phDoneIco .ic{ width:18px; height:18px; stroke-width:2.4; }
.phDoneText{ flex:1 1 auto; min-width:0; }
.phDoneTitle{ display:block; font-size:var(--fz-md-h); font-weight:700; color:var(--ink); line-height:var(--lh-display); }
.phDoneNext{ display:block; font-size:var(--fz-xs-h); color:var(--muted); margin-top:2px; line-height:var(--lh-display); }
.phDoneNext b, .phDoneNext em{ font-style:normal; font-weight:600; color:var(--ink); }

/* When reading is still to be done */
.phReadBox{ display:flex; align-items:center; justify-content:space-between; gap:var(--sp-3);
  padding:11px 14px; background:var(--paper2); border:1px solid var(--line2);
  border-radius:var(--r); margin:4px 0 14px; }
.phReadInfo{ flex:1 1 auto; min-width:0; }
.phWhen{ display:inline-block; font-size:var(--fz-xs); font-weight:600; color:var(--gold); margin-bottom:2px; }
.phWhen.phLag{ color:var(--danger); }
.phReadTitle{ display:block; font-size:var(--fz-lg-h); font-weight:700; color:var(--ink); line-height:1.45; }
.phReadMeta{ display:block; font-size:var(--fz-xs-h); color:var(--muted); margin-top:2px; }
.phReadCta{ display:inline-flex; align-items:center; gap:var(--sp-1); font-size:var(--fz-sm);
  font-weight:700; color:var(--gold); flex:0 0 auto; padding:6px 12px;
  background:var(--surface); border:1px solid var(--gold-soft); border-radius:var(--r-pill); }

/* Progress bar inside card */
.phBarWrap{ margin-top:var(--sp-1); }
.phBar{ height:6px; border-radius:3px; background:var(--paper2); border:1px solid var(--line2); overflow:hidden; }
.phBar i{ display:block; height:100%; background:linear-gradient(90deg, var(--gold) 0%, #d4a359 100%); border-radius:3px; transition:width .3s var(--ease); }
.pairBtn.planBack{ background:var(--surface); color:var(--ink); border:1px solid var(--gold); }
.pairBtn.planBack small{ color:var(--muted); opacity:1; }
.ptHead .ptCount{ margin-left:auto; font-size:var(--fz-xs-h); font-weight:600; color:var(--gold); }
/* a part read some way: the circle fills like a small pie */
.ptList li.started .ptTick{ border-color:var(--gold-soft);
  background:conic-gradient(var(--gold) var(--read), transparent 0); }
.ptM b{ font-weight:600; color:var(--gold); }
/* suggested plans: cards above the do-it-yourself steps */
.tplGrid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(230px, 1fr)); gap:10px; }
/* UX4: festival plans that cannot start yet: one folded row under the recommended plans */
.pfLater > summary{ display:flex; flex-wrap:wrap; align-items:baseline; column-gap:var(--sp-2);
  min-height:44px; padding:var(--sp-2) 0; cursor:pointer; list-style:none; line-height:var(--lh-ui); }
.pfLater > summary::-webkit-details-marker{ display:none; }
.pfLater > summary::before{ content:"▸"; color:var(--gold); font-size:var(--fz-xs); }
.pfLater[open] > summary::before{ content:"▾"; }
.pfLater > summary b{ font-size:var(--fz-md); color:var(--gold); letter-spacing:.02em; }
.pfLater > summary span{ font-size:var(--fz-sm); color:var(--muted); }
.pfLater > .pfHint{ margin-top:0; }
.pfLater > .tplGrid{ margin-top:var(--sp-3); }
.tpl{ display:flex; flex-direction:column; gap:var(--sp-1); text-align:left; padding:12px 14px 11px; font:inherit;
  color:var(--ink); background:var(--surface); border:1px solid var(--line); border-radius:var(--r); cursor:pointer; }
.tpl b{ font-size:var(--fz-lg-h); line-height:var(--lh-snug); }
.tpl span{ font-size:var(--fz-sm); line-height:1.65; color:var(--ink2); }
.tpl i{ margin-top:auto; padding-top:var(--sp-1); font-style:normal; font-size:var(--fz-xs-h); font-weight:600; color:var(--gold); }
.tpl:hover{ border-color:var(--gold-soft); }
.tpl[aria-pressed="true"]{ border-color:var(--gold); box-shadow:inset 0 0 0 1.5px var(--gold); }
.pfHint{ margin:9px 0 0; font-size:var(--fz-sm); line-height:var(--lh-text); color:var(--muted); }
.planForm .pfWeek .chip{ min-width:58px; text-align:center; }
/* this week, and the month calendar: one round cell a day */
.wkStrip{ display:grid; grid-template-columns:repeat(7, 1fr); gap:var(--sp-1); margin-top:var(--sp-4); max-width:460px; }
.wkNote{ margin-top:6px; font-size:var(--fz-xs-h); color:var(--muted); }
.pc{ display:flex; flex-direction:column; align-items:center; gap:3px; padding:0; border:0; background:none;
  font:inherit; color:var(--ink); cursor:pointer; min-height:44px; }
.pc i{ font-style:normal; font-size:var(--fz-xs); color:var(--muted); }
.pc b{ display:grid; place-items:center; width:34px; height:34px; border-radius:50%; font-size:var(--fz-sm-h);
  font-weight:600; border:1.5px solid var(--line); background:var(--surface); }
.pc.done b{ background:var(--gold); border-color:var(--gold); color:var(--on-gold); }
:root[data-theme="dark"] .pc.done b{ color:var(--on-gold); }
.pc.part b{ border-color:var(--gold); background:linear-gradient(to top, rgba(201,162,74,.38) 50%, var(--surface) 50%); }
.pc.miss b{ border-style:dashed; color:var(--muted); }
.pc.rest b{ border-color:transparent; background:none; color:var(--muted); font-weight:400; }
.pc.out b{ border-color:transparent; background:none; color:var(--muted); font-weight:400; opacity:.55; }
.pc.now b{ box-shadow:0 0 0 2px var(--paper), 0 0 0 4px var(--gold); }
.planCal .pc.now b{ box-shadow:0 0 0 2px var(--surface), 0 0 0 4px var(--gold); }
.pc[aria-pressed="true"] b{ outline:2px solid var(--ink); outline-offset:2px; }
/* the plan page: one column on phones (reading, calendar, settings); side by side
   once there is room -- the reading on the left, the calendar and the chosen day on
   the right.  Sized by the page's own width (the sidebar may be open or not). */
.planPage{ container-type:inline-size; }
.planGrid{ display:grid; grid-template-columns:minmax(0, 1fr); grid-template-areas:"main" "side" "set"; }
.planMain{ grid-area:main; min-width:0; }
.planSide{ grid-area:side; min-width:0; max-width:560px; }
.planGrid > .planSet{ grid-area:set; }
@container (min-width:860px){
  .planGrid{ grid-template-columns:minmax(0, 1fr) 330px; grid-template-rows:auto 1fr;
    grid-template-areas:"main side" "set side"; column-gap:var(--sp-6); align-items:start; }
  .planSide{ max-width:none; margin-top:14px; }
  .planSide .planCal{ margin-top:0; }
  .wkStrip{ display:none; }                 /* the month calendar sits right beside it */
}
.planCal{ margin-top:26px; padding:10px 12px 12px; background:var(--surface); border:1px solid var(--line);
  border-radius:var(--r); }
.pcHead{ display:flex; align-items:center; justify-content:space-between; gap:var(--sp-2); margin:0 0 var(--sp-1) var(--sp-1); }
.pcHead h2{ margin:0; font-size:var(--fz-lg); }
.pcNav{ display:flex; align-items:center; gap:0; }
.pcNav b{ font-size:var(--fz-md); min-width:7.2em; text-align:center; }
.pcNav .iconBtn:disabled{ opacity:.3; cursor:default; }
.pcNext .ic{ transform:rotate(180deg); }
.pcGrid{ display:grid; grid-template-columns:repeat(7, 1fr); gap:2px; }
.pcGrid .pcW{ font-style:normal; text-align:center; font-size:var(--fz-xs); color:var(--muted); padding:2px 0 4px; }
.pcKey{ display:flex; flex-wrap:wrap; gap:var(--sp-1) var(--sp-3); margin:10px 4px 0; font-size:var(--fz-xs); color:var(--muted); }
.pcKey span{ display:inline-flex; align-items:center; gap:5px; }
.pcKey .k{ width:12px; height:12px; border-radius:50%; border:1.5px solid var(--line); background:var(--surface); }
.pcKey .k.done{ background:var(--gold); border-color:var(--gold); }
.pcKey .k.part{ border-color:var(--gold); background:linear-gradient(to top, rgba(201,162,74,.38) 50%, var(--surface) 50%); }
.pcKey .k.miss{ border-style:dashed; }
.pcKey .k.rest{ border-color:transparent; background:var(--line); }
.pcDay{ margin-top:var(--sp-3); padding:var(--sp-3) var(--sp-4) var(--sp-2); background:var(--surface); border:1px solid var(--line);
  border-radius:var(--r); }
.pcdHead{ display:flex; flex-wrap:wrap; align-items:baseline; gap:2px 12px; }
.pcdHead b{ font-size:var(--fz-lg); }
.pcdHead span{ font-size:var(--fz-sm); color:var(--muted); }
.pcDay .ptList{ margin-top:6px; }
.ptList .ptMore{ padding:10px 0 4px; border-top:1px solid var(--line2); }
.ptList .ptMore .linkBtn{ color:var(--gold); font-weight:600; font-size:var(--fz-sm-h); }
/* behind: three calm choices */
.planCatch{ margin:var(--sp-4) 0 0; padding:14px 16px; border:1px solid var(--line); border-radius:var(--r);
  background:var(--paper2); }
.planCatch > b{ font-size:var(--fz-lg); }
.planCatch p{ margin:6px 0 10px; font-size:var(--fz-sm-h); line-height:1.75; color:var(--ink2); }
.pcOpts{ display:grid; grid-template-columns:repeat(auto-fit, minmax(210px, 1fr)); gap:var(--sp-2); }
.pcOpts button{ display:flex; flex-direction:column; gap:2px; text-align:left; font:inherit; color:var(--ink);
  padding:10px 12px; background:var(--surface); border:1px solid var(--line); border-radius:var(--r-md); cursor:pointer; }
.pcOpts button b{ font-size:var(--fz-md); }
.pcOpts button small{ font-size:var(--fz-xs-h); line-height:var(--lh-ui); color:var(--muted); }
.pcOpts button:hover{ border-color:var(--gold-soft); }
/* a finished day, a milestone, a new plan, a finished plan */
.ptDone, .planCheer, .planHello{ display:flex; gap:10px; align-items:flex-start; margin:18px 0 0; padding:var(--sp-3) var(--sp-4);
  border-radius:var(--r); background:var(--surface); border:1px solid var(--gold-soft); }
.ptDone > .ic, .planCheer > .ic{ flex:0 0 auto; width:26px; height:26px; padding:var(--sp-1); border-radius:50%;
  background:var(--gold); color:var(--on-gold); stroke-width:2.4; }
:root[data-theme="dark"] .ptDone > .ic, :root[data-theme="dark"] .planCheer > .ic{ color:var(--on-gold); }
.ptDone span, .planCheer span{ font-size:var(--fz-md); line-height:var(--lh-text); }
.ptDone b{ display:block; font-size:var(--fz-lg-h); }
.ptDone small{ display:block; font-size:var(--fz-xs-h); color:var(--muted); }
.planToday.ahead{ border-left-color:var(--gold-soft); }
.planHello{ flex-direction:column; gap:var(--sp-1); }
.planHello b{ font-size:var(--fz-xl); }
.planHello > span{ font-size:var(--fz-sm-h); line-height:1.75; color:var(--ink2); }
.planFin{ margin:18px 0 6px; padding:22px 18px; text-align:center; border-radius:var(--r-lg);
  background:var(--surface); border:1px solid var(--gold-soft); }
.planFin .pfMark .ic{ width:48px; height:48px; padding:10px; border-radius:50%; background:var(--gold); color:var(--on-gold); stroke-width:2.2; }
:root[data-theme="dark"] .planFin .pfMark .ic{ color:var(--on-gold); }
.planFin h2{ margin:10px 0 4px; font-size:var(--fz-3xl); }
.planFin p{ margin:0; color:var(--muted); font-size:var(--fz-md); }
.planFin .pairBtn{ display:inline-block; margin-top:var(--sp-4); padding:11px 26px; }
/* reminders in the phone's calendar */
.planAdd{ margin-top:var(--sp-3); padding:13px 16px 14px; background:var(--surface); border:1px solid var(--gold-soft);
  border-radius:var(--r); }
.paHead{ display:flex; align-items:center; gap:var(--sp-2); }
.paHead .ic{ flex:0 0 auto; color:var(--gold); }
.paHead b{ font-size:var(--fz-md-h); line-height:var(--lh-snug); }
.planAdd > p{ margin:6px 0 0; font-size:var(--fz-sm-h); line-height:var(--lh-text); color:var(--ink2); }
/* used: a thank-you in its place, gone on the next visit */
.planAdd.paDone{ display:flex; gap:10px; align-items:flex-start; }
.paDone > .ic{ flex:0 0 auto; width:26px; height:26px; padding:var(--sp-1); border-radius:50%; background:var(--gold);
  color:var(--on-gold); stroke-width:2.4; }
:root[data-theme="dark"] .paDone > .ic{ color:var(--on-gold); }
.paDone b{ display:block; font-size:var(--fz-md-h); line-height:var(--lh-snug); }
.paDone small{ display:block; font-size:var(--fz-xs-h); line-height:1.65; color:var(--muted); }
.paDone .linkBtn{ margin-top:var(--sp-1); padding:0; color:var(--gold); font-weight:600; }
.psCal{ margin-top:10px; }
.psCal > summary{ cursor:pointer; color:var(--gold); font-weight:600; font-size:var(--fz-sm-h); padding:var(--sp-1) 0; }
.psCal .remBtn{ flex:1 1 220px; }
.planAdd .pfHint{ font-size:var(--fz-xs-h); color:var(--muted); }
.planAdd .remBtn{ flex:1 1 100%; max-width:none; }
.remBtns{ display:flex; flex-wrap:wrap; gap:var(--sp-2); margin-top:10px; }
.remBtn{ flex:1 1 220px; max-width:330px; display:inline-flex; align-items:center; gap:10px; padding:9px 14px; text-decoration:none; color:var(--ink);
  background:var(--surface); border:1px solid var(--line); border-radius:var(--r-md); min-height:44px; }
.remBtn .ic{ flex:0 0 auto; color:var(--gold); }
.remBtn span{ font-size:var(--fz-md); font-weight:600; line-height:var(--lh-display); }
.remBtn small{ display:block; font-size:var(--fz-xs); font-weight:400; color:var(--muted); }
.remBtn:hover{ border-color:var(--gold-soft); }
/* settings, folded away */
.planSet{ margin:26px 0 8px; border-top:1px solid var(--line2); }
.planSet > summary{ padding:14px 2px; font-size:var(--fz-lg); font-weight:600; cursor:pointer; }
.planSet .pfStep:first-of-type{ border-top:0; padding-top:var(--sp-1); }
.planSet .chips{ gap:7px; }
.planSet .chip{ padding:7px 13px; font-size:var(--fz-md); }
.psPrev{ margin:var(--sp-1) 0 0; padding:12px 14px; font-size:var(--fz-sm-h); line-height:1.8; color:var(--ink2);
  border:1px dashed var(--gold-soft); border-radius:var(--r-md); }
.psPrev[hidden]{ display:none; }
.psPrevAct{ display:flex; align-items:center; gap:14px; margin-top:var(--sp-2); }
.psPrevAct .pairBtn{ display:inline-block; margin:0; padding:9px 24px; }
.phDone{ display:flex; align-items:center; gap:6px; }
.phDone .ic{ width:18px; height:18px; color:var(--gold); stroke-width:2.4; }
/* the reader: where today's plan part ends */
.planStop{ display:flex; flex-wrap:wrap; align-items:center; gap:var(--sp-2) var(--sp-3); margin:26px 0 8px; padding:14px 16px;
  font-family:var(--ui); font-size:var(--fz-md-h); line-height:var(--lh-ui); background:var(--surface);
  border:1px solid var(--gold-soft); border-radius:var(--r); text-indent:0; }
.planStop .psIco .ic{ width:26px; height:26px; padding:var(--sp-1); border-radius:50%; background:var(--gold); color:var(--on-gold);
  stroke-width:2.4; display:block; }
:root[data-theme="dark"] .planStop .psIco .ic{ color:var(--on-gold); }
.planStop b{ flex:1 1 200px; }
.planStop .psBtns{ display:flex; flex-wrap:wrap; align-items:center; gap:var(--sp-2) var(--sp-4); flex:1 1 100%; }
.planStop .pairBtn{ display:inline-block; margin:0; padding:10px 22px; }
.planStop .linkBtn{ font-size:var(--fz-md); color:var(--gold); font-weight:600; text-decoration:none; }
@media (max-width:560px){
  .pc b{ width:32px; height:32px; font-size:var(--fz-sm); }
  .tplGrid{ grid-template-columns:1fr; }
}

/* Pakiṇṇaka contents: the printed hierarchy (lv0 part, lv1 chapter, lv2+ indented) */
.row.lv0 .tt, .row.lv1 .tt, .tocItem.lv0, .tocItem.lv1{ font-weight:700; }
.row.lv2{ padding-left:30px; } .row.lv3{ padding-left:44px; } .row.lv4{ padding-left:58px; }
.tocItem.lv2{ padding-left:30px; } .tocItem.lv3{ padding-left:44px; } .tocItem.lv4{ padding-left:58px; }

/* the 110-volume contents with levels (2026-11, src/build_p110_units.py): a division heading
   (.phd, bold, set on the paper2 tint), its reading units at the margin, a unit's
   sub-headings (.psub) indented under it, smaller and quieter -- they open the unit there */
.plv .row.lv2, .tocLv .tocItem.lv2{ padding-left:var(--sp-4); }
.row.phd, .tocItem.phd{ background:var(--paper2); }
.row.phd .tt{ font-weight:700; color:var(--ink); }
.plv .row.lv3, .tocLv .tocItem.lv3{ padding-left:40px; padding-top:7px; padding-bottom:7px; }
.row.psub .tt, .tocItem.psub{ font-size:var(--fz-sm-h); color:var(--ink2); }
.row.psub .pg, .tocItem.psub .pg{ opacity:.75; }
.tocItem.on2{ box-shadow:inset 3px 0 0 color-mix(in srgb, var(--gold) 45%, transparent); }
/* the reader: a sub-heading inside a unit (#h-<old id>), where an old address lands */
h2.head.sub{ margin-top:40px; }
.rpage.rpCont > .pageMark{ display:none; }
/* a long unit read in slices: what follows the text waits for the last slice */
#reader.lazyWait .secEnd, #reader.lazyWait .rnav, #reader.lazyWait #pairSlot, #reader.lazyWait #atkPairSlot,
#reader.lazyWait #dailySlot, #reader.lazyWait #boardSlot, #reader.lazyWait #a2Slot{ display:none; }
.lazyMore{ min-height:1px; }
#lzEnd{ min-height:60vh; }
[id^="h-"]{ scroll-margin-top:72px; }
.rkick{ text-align:center; font-size:var(--fz-sm); line-height:var(--lh-text); color:var(--muted); margin:0 0 2px; }

/* library.tripitaka82.com (html.lib, set in the page head from the hostname): the 15
   Pakiṇṇaka books on their own host -- its own name in the header, a library hero with
   the way back to the main site; the main site's drawer has one quiet link over */
.brand .brandLib{ display:none; }
html.lib .brand .brandMain{ display:none; }
html.lib .brand .brandLib{ display:inline; }
.libHero h1{ margin-bottom:var(--sp-1); }
.libMain{ display:inline-flex; align-items:center; gap:6px; margin-top:10px; padding:6px 0;
  font-size:var(--fz-sm-h); color:var(--ink2); text-decoration:none; }
.libMain .ic{ width:16px; height:16px; color:var(--gold); flex:0 0 auto; }
.libMain b{ font-weight:600; color:var(--gold); }
.libMain:hover span{ text-decoration:underline; text-underline-offset:3px; }
.cnavBody > a.cnavOut{ margin-top:14px; padding-top:var(--sp-3); border-top:1px solid var(--line);
  font-weight:400; font-size:var(--fz-sm); color:var(--muted); }
/* UX4: the library and the dictionary are drawer rows like the others: icon, name, one line */
.cnavBody > a.cnavExt{ margin-top:var(--sp-3); padding-top:var(--sp-3); border-top:1px solid var(--line); }
.cnavBody > a.cnavExt + a.cnavExt{ margin-top:0; border-top:0; }
.cnavExt .cnavTx{ display:flex; flex-direction:column; min-width:0; }
.cnavExt .cnavTx small{ font-size:var(--fz-sm); font-weight:400; color:var(--muted); line-height:var(--lh-snug); }
.ed-pk .bpPill.active{ background:var(--ed-pk); color:var(--on-gold); border-color:var(--ed-pk); font-weight:700; }
.ed-pk .bpPill.active .bpCnt{ background:rgba(0,0,0,.18); color:inherit; }

/* ===== book mode: the Pakiṇṇaka books on library.tripitaka82.com (2026-10-28) =====
   html.bookMode is set by js/read.js for pk books only (never on the main host); bk-mil
   (Milinda, dialogue), bk-him (Him Raya, root text + commentary), bk-ksm (Khong Sumit,
   numbered analyses).  Modern printed books: one heading once, the part it sits in above
   it, text justified by stretching the spaces (as the print does, not the letters),
   lists that hang, root text in the Pāli face, stanzas set as one block. */
html.bookMode .reader{ margin-top:22px; }
html.bookMode .rkick{ text-align:center; font-size:var(--fz-sm); line-height:var(--lh-text); color:var(--muted);
  margin:0 auto 2px; max-width:34em; }
html.bookMode .rkick span{ white-space:normal; }
html.bookMode .rkick i{ font-style:normal; color:var(--gold-soft); margin:0 .45em; }
html.bookMode .rtitle{ font-family:"Moul","Battambang",var(--serif); font-weight:400;
  font-size:clamp(19px,2.4vw,24px); line-height:1.9; color:var(--ink); margin:6px 0 4px;
  text-wrap:balance; }
html.bookMode .rsub{ font-family:var(--ui); font-size:var(--fz-xs-h); letter-spacing:0; }
html.bookMode .rrule{ width:44px; height:1px; opacity:1; background:var(--gold-soft); margin:14px auto 22px; }

/* paragraphs: the print's rhythm (first-line indent, little space between) */
html.bookMode .para{ margin-bottom:.55em; text-indent:1.6em; }
html.bookMode .para.pcont{ text-indent:0; }
/* justified as the print is, the main reader's way: zwify() puts a zero-width space between Khmer
   words, so a line breaks between words and spreads evenly (text-justify:inter-character) */
@media (max-width:520px){ html.bookMode .para{ text-indent:1.3em; margin-bottom:.5em; } }

/* page markers: a hairline with the printed page at the right, not a centred line */
html.bookMode .pageMark{ display:flex; align-items:center; gap:10px; margin:22px 0 12px;
  font-family:var(--ui); font-size:var(--fz-xs); letter-spacing:0; color:var(--muted); }
html.bookMode .pageMark::before{ content:""; flex:1; margin:0; opacity:1; border-top:1px solid var(--line2); }
html.bookMode .pageMark::after{ content:none; }
html.bookMode .pageMark:empty{ display:none; }
html.bookMode .rpage:first-of-type .pageMark{ margin-top:0; }

/* headings inside a section; the section's own first heading is the title above */
html.bookMode .head{ font-size:calc(var(--fs) + 1px); line-height:1.8; margin:26px 0 12px;
  color:var(--ink); text-wrap:balance; }
html.bookMode .head.dupTitle{ display:none; }
html.bookMode .head + .head{ margin-top:-4px; }
/* "ចប់ …": the small closing line under a part */
html.bookMode .head.endmark{ font-weight:400; font-size:calc(var(--fs) - 2px); color:var(--ink2);
  margin:14px 0 24px; }
html.bookMode .head.endmark::after{ content:""; display:block; width:28px; margin:10px auto 0;
  border-top:1px solid var(--gold-soft); }

/* Milinda: the speaker of each turn, as the print sets it */
html.bookMode .spk{ font-weight:700; color:var(--accent); }
html.bookMode .para.turn{ margin-bottom:.4em; }
html.bookMode .lemma{ font-weight:700; }

/* numbered items: the number hangs, the text keeps its own edge */
html.bookMode .para.li{ text-indent:-1.5em; padding-left:1.5em; margin-bottom:.35em; }
html.bookMode .para.li + .para:not(.li){ margin-top:.6em; }

/* root text (mūla): the Pāli face, set in the measure (not centred like a verse) */
/* (Pāli has spaces between its words and no word marks: it spreads at those spaces) */
html.bookMode .para.mula{ font-family:var(--pali); font-weight:700; color:var(--ink); text-justify:inter-word;
  margin:.8em 0 .7em; }
html.bookMode .para.mula .pali{ font-weight:700; }

/* stanzas: one block, its lines starting at one edge, centred as a whole */
html.bookMode .verse{ display:table; text-align:left; margin:14px auto 16px; max-width:100%;
  text-wrap:wrap; }
html.bookMode .verse .vl{ display:block; padding-left:1.2em; text-indent:-1.2em; }

/* footnotes: a short rule above the page's notes, the number, no arrows */
html.bookMode .fn{ font-family:var(--serif); font-size:.84em; line-height:1.8; color:var(--ink2);
  border-top:0; margin:4px 0 2px; padding:0; text-align:left; }
html.bookMode .fn::before{ content:none; }
html.bookMode :not(.fn) + .fn{ margin-top:18px; padding-top:10px; position:relative; }
html.bookMode :not(.fn) + .fn::after{ content:""; position:absolute; left:0; top:0; width:88px;
  border-top:1px solid var(--line); }
html.bookMode .fn .fnback{ font-size:.9em; }
html.bookMode .fnnum{ font-family:var(--ui); }

/* the reader's contents: front matter in one collapsed group */
.fmGroup{ border-bottom:1px solid var(--line2); }
.fmGroup > summary{ display:flex; align-items:center; gap:var(--sp-2); padding:var(--sp-3) var(--sp-4); cursor:pointer;
  list-style:none; font-size:var(--fz-md); color:var(--muted); min-height:44px; }
.fmGroup > summary::-webkit-details-marker{ display:none; }
.fmGroup > summary svg{ width:16px; height:16px; transition:transform var(--dur-2); transform:rotate(180deg); flex:0 0 auto; }
.fmGroup[open] > summary svg{ transform:rotate(-90deg); }
.fmGroup > summary small{ margin-left:auto; font-family:var(--ui); font-size:var(--fz-xs); }
.fmGroup .tocItem{ font-size:var(--fz-sm-h); color:var(--ink2); }

/* the library's volume page: a book's own opening (js/app.js pkVolume) */
.pkHero{ display:grid; grid-template-columns:104px 1fr; gap:var(--sp-1) var(--sp-4); align-items:start; padding:12px 0 6px; }
.pkHeroCov{ grid-row:1 / span 2; display:block; width:104px; aspect-ratio:5 / 7; border-radius:4px;
  background:var(--surface) center / cover no-repeat; box-shadow:0 1px 2px rgba(0,0,0,.12), 0 6px 18px rgba(60,40,10,.16); }
.pkHeroTx{ min-width:0; }
.pkHeroTx h1{ margin:0 0 6px; font-size:clamp(18px,2.4vw,24px); line-height:var(--lh-snug); text-wrap:balance; }
.pkHeroBy{ margin:0 0 var(--sp-1); font-size:var(--fz-md); line-height:var(--lh-ui); color:var(--ink2); }
.pkHeroDesc{ margin:0 0 6px; font-size:var(--fz-sm-h); line-height:1.65; color:var(--muted); }
.pkHeroMeta{ margin:0; font-size:var(--fz-xs-h); line-height:var(--lh-ui); color:var(--muted); }
.pkHeroTx .bar{ margin-top:var(--sp-2); }
.pkHeroAct{ grid-column:1 / -1; display:flex; flex-direction:column; gap:10px; margin-top:var(--sp-4); }
.pkHeroAct .pairBtn{ margin:0; }
@media (min-width:700px){
  .pkHero{ grid-template-columns:150px 1fr; gap:6px 28px; padding-top:18px; }
  .pkHeroCov{ width:150px; grid-row:1 / span 2; }
  .pkHeroAct{ grid-column:2; flex-direction:row; flex-wrap:wrap; margin-top:10px; }
  .pkHeroAct .pairBtn{ flex:0 1 auto; min-width:220px; }
}
.pkToc{ margin-top:22px; }
.volFm{ border:1px solid var(--line2); border-radius:var(--r); margin:0 0 var(--sp-3); background:var(--surface); }
.volFm > summary{ padding:10px 14px; }
.volFm .list{ margin:0; border-top:1px solid var(--line2); }
/* the library home: a cover says its volume (ភាគ ១, បរិច្ឆេទទី ១) and what it holds */
.pk-cov .bcovCap{ font-weight:700; color:var(--ink); }
.pk-cov .bcovCap b{ display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
  font-weight:400; color:var(--muted); margin-top:1px; }
.pkAbout{ margin:var(--sp-1) 0 0; font-size:var(--fz-sm); line-height:1.65; color:var(--ink2); }

/* book mode: a comparison table read row by row (810 pp. 90, 118-121: «N left cell» then the
   right cell, q): each row opens on a hairline and its further cell sits under the item's
   text on a gold rule, so it reads as the same row's other column, not as a new paragraph */
html.bookMode .para:has(+ .para.quote){ text-indent:-1.5em; padding-left:1.5em; border-top:1px solid var(--line2);
  padding-top:.5em; margin-bottom:.15em; }
html.bookMode .para.quote{ text-indent:0; margin:0 0 .6em 1.5em; padding-left:.8em;
  border-left:2px solid var(--gold-soft); color:var(--ink2); }

/* «សួរព្រះធម៌» -- the Dhamma chat's button on the www home page (js/chatbtn.js; the sheet is
   css/chat.css, loaded on the first tap).  Quiet, not gold: the home's one gold action is
   the daily reading's button.  Fixed, so showing it after load never moves the page. */
.chatFab{ position:fixed; z-index:var(--z-float); right:calc(16px + env(safe-area-inset-right));
  bottom:calc(16px + env(safe-area-inset-bottom));
  display:inline-flex; align-items:center; gap:9px; min-height:50px; padding:5px 20px 5px 15px;
  border:1px solid var(--gold-soft); border-radius:var(--r-pill); background:var(--surface); color:var(--ink);
  box-shadow:var(--shadow-3); font:700 var(--fz-lg)/1.35 var(--ui); text-align:left; cursor:pointer;
  animation:chatFabIn .3s var(--ease-out) both; }
.chatFab .ic{ width:23px; height:23px; color:var(--gold); }
.chatFab:hover{ border-color:var(--gold); }
.chatFabT small{ display:block; font-size:var(--fz-xs); font-weight:600; color:var(--muted); }
.chatFabT small[hidden]{ display:none; }
.chatFab.off{ border-style:dashed; }
.chatFab[aria-busy="true"] .ic{ animation:chatFabWait 1s ease-in-out infinite; }
.chatFab[hidden], html.chatOpen .chatFab{ display:none; }
@media (max-width:999px){ body:has(.cnavScrim.show) .chatFab{ display:none; } }
@media (min-width:900px){ .chatFab{ right:28px; bottom:28px; } }
@keyframes chatFabIn{ from{ opacity:0; transform:translateY(14px); } }
@keyframes chatFabWait{ 50%{ opacity:.35; } }
@media (prefers-reduced-motion: reduce){ .chatFab, .chatFab[aria-busy="true"] .ic{ animation:none; } }
/* the link to a text's pair (2026-11-05): one quiet card on the volume page and at the end of
   the reader -- label, work, volume, chevron; no emoji, no underline, no gold */
.pairLinks{ display:flex; flex-direction:column; gap:var(--sp-2); margin:6px 0 14px; }
.pairLink{ display:flex; align-items:center; gap:var(--sp-3); min-height:44px; padding:9px 14px;
  border:1px solid var(--line); border-radius:var(--r-md); background:var(--surface); color:var(--ink);
  text-decoration:none; }
.pairLink:hover{ border-color:var(--gold-soft); }
.pairLink:focus-visible{ outline:2px solid var(--gold); outline-offset:2px; }
.pairLink .plIco{ flex:0 0 auto; color:var(--gold); display:inline-flex; }
.pairLink .plIco svg{ width:20px; height:20px; }
.pairLink .plTx{ flex:1 1 auto; min-width:0; display:flex; flex-wrap:wrap; align-items:baseline;
  column-gap:var(--sp-2); row-gap:0; line-height:1.55; }
.pairLink .plLab{ font-size:var(--fz-xs); color:var(--muted); white-space:nowrap; }
.pairLink .plMain{ font-weight:600; font-size:var(--fz-lg); }
.pairLink .plDet{ font-size:var(--fz-sm); color:var(--muted); }
.pairLink .plGo{ flex:0 0 auto; color:var(--muted); display:inline-flex; }
.pairLink .plGo svg{ width:18px; height:18px; transform:scaleX(-1); }
#pairSlot .pairLink, #atkPairSlot .pairLink{ margin:var(--sp-3) 0; }

/* LEVELS82 (2026-11, data/lv82.json): the 82 volumes' contents in levels, as the 110's -- a
   division on the tint (.phd), a top division (.ph0: nipata, samyutta, pannasaka, a work) a shade
   stronger with a gold edge, the suttas at the margin, each commentary (.cm) indented under its
   sutta with a small «អដ្ឋកថា» tag before its name (the volume page and the reader's contents) */
.row.ph0, .tocItem.ph0{ background:color-mix(in srgb, var(--gold-soft) 16%, var(--paper2));
  box-shadow:inset 3px 0 0 var(--gold-soft); }
.tocItem.phd{ font-weight:700; color:var(--ink); }
.tocItem.phd.on{ box-shadow:inset 3px 0 0 var(--gold); }
.row.cm .tt, .tocItem.cm{ color:var(--ink2); }
.cmTag{ display:inline-block; margin:0 6px 0 0; padding:0 7px; border:1px solid var(--line);
  border-radius:var(--r-pill); font-size:var(--fz-xs); line-height:var(--lh-ui); font-weight:600; color:var(--gold);
  vertical-align:1px; white-space:nowrap; }
.tocItem .lvMk{ flex:0 0 auto; margin-left:auto; font-size:var(--fz-xs); color:var(--gold); }
.tocLv82 .tocItem.phd:not(.ph0){ background:color-mix(in srgb, var(--gold-soft) 9%, transparent); }
/* LV82-C (2026-11-10): the pieces of one commentary (.csub) one step in under its «អដ្ឋកថា» row,
   smaller and quieter, like the 110's sub-headings */
.plv .row.lv4, .tocLv .tocItem.lv4{ padding-left:64px; padding-top:6px; padding-bottom:6px; }
.row.csub .tt, .tocItem.csub{ font-size:var(--fz-sm-h); color:var(--ink2); }
.row.csub .pg, .tocItem.csub .pg{ opacity:.75; }

/* Word lookup (2026-11-11, js/lookup.js): the meaning of the selected word(s), in a card at the
   foot of the page -- a sheet on phones, a panel at the right on wide screens */
.lkCard{ position:fixed; z-index:var(--z-scrim); left:8px; right:8px; bottom:calc(8px + env(safe-area-inset-bottom));
  max-height:min(62vh, 520px); display:flex; flex-direction:column; background:var(--surface);
  border:1px solid var(--line); border-radius:var(--r); box-shadow:var(--shadow-3); overflow:hidden; }
@media (min-width:720px){ .lkCard{ left:auto; right:20px; bottom:20px; width:420px; } }
.lkHead{ display:flex; align-items:center; justify-content:space-between; padding:10px 8px 10px 16px;
  border-bottom:1px solid var(--line); font:700 var(--fz-md) var(--ui); color:var(--ink); }
.lkX{ border:0; background:none; cursor:pointer; color:var(--muted); width:40px; height:40px;
  display:inline-flex; align-items:center; justify-content:center; border-radius:var(--r-md); }
.lkX:hover{ background:var(--bg); color:var(--ink); }
.lkX svg{ width:20px; height:20px; }
.lkBody{ overflow:auto; -webkit-overflow-scrolling:touch; padding:var(--sp-1) 0 var(--sp-2); }
.lkWait, .lkNone{ margin:0; padding:var(--sp-4); color:var(--muted); font:var(--fz-lg) var(--ui); }
.lkW + .lkW{ border-top:1px solid var(--line); }
.lkE{ display:block; padding:10px 16px; color:var(--ink); text-decoration:none; }
.lkE:hover{ background:var(--bg); }
.lkH{ font:700 19px/1.5 var(--kh, var(--ui)); margin-right:var(--sp-2); }
.lkP{ font:italic var(--fz-sm) var(--ui); color:var(--muted); }
.lkG{ display:block; font:var(--fz-xl)/1.75 var(--kh, var(--ui)); color:var(--ink2, var(--ink)); overflow-wrap:anywhere; }
.lkB{ display:inline-block; margin-top:var(--sp-1); font:600 var(--fz-xs) var(--ui); color:var(--muted);
  border:1px solid var(--line); border-radius:var(--r-pill); padding:1px 8px; }
.lkMore{ display:block; padding:10px 16px 6px; font:600 var(--fz-sm-h) var(--ui); color:var(--gold, var(--muted)); text-decoration:none; }
@media print{ .lkCard{ display:none !important; } }

/* share card: the seven grounds -- the swatches wrap, a light one keeps an edge (the drawn
   templates' row, .shareStyles, is in read.html beside the rest of the sheet) */
.shareSwatches{ flex-wrap:wrap; row-gap:var(--sp-2); justify-content:center; }
.shareSwatches .swatch{ box-shadow:inset 0 0 0 1px rgba(0,0,0,.18); }

/* ---------- lotus + buddha (2026-11-11): the site's small animations ----------
   A lotus opens petal by petal (TPI.lotus): at the end of a reading («អានចប់ · សាធុ») and, opening
   and closing, wherever the site waits.  The home page's mark (TPI.buddha): a seated figure before
   a halo that breathes, on a lotus seat.  All of it stops under prefers-reduced-motion. */
.lotus{ flex:none; overflow:visible; }
.lotus .lp, .bArt .lp{ fill:#f3b3c6; stroke:#d9638c; stroke-width:.8; stroke-linejoin:round;
  transform:rotate(var(--a)); transform-origin:0 0; }
.lotus .lpB, .bArt .lpB{ fill:#e98fab; }
.lotus .lh{ fill:var(--gold-soft); }
:root[data-theme="dark"] .lotus .lp, :root[data-theme="dark"] .bArt .lp{ fill:#d98aa4; stroke:#f3b3c6; }
:root[data-theme="dark"] .lotus .lpB, :root[data-theme="dark"] .bArt .lpB{ fill:#b9607f; }
@keyframes lotusOpen{ from{ transform:rotate(0deg) scale(.3); opacity:0; } }
@keyframes lotusBreath{ from{ transform:rotate(calc(var(--a) * .3)) scale(.82); } }
.seDone .lotus{ width:34px; height:29px; margin:-6px 0 -2px; }
.seLotus .lp, .bArt .lp{ animation:lotusOpen .9s cubic-bezier(.2,.7,.2,1) both; animation-delay:calc(var(--i) * 90ms + 150ms); }
.empty.loading{ display:flex; flex-direction:column; align-items:center; gap:10px; }
.lotus.spin{ width:44px; height:37px; }
.lotus.spin .lp{ animation:lotusBreath 1.3s ease-in-out infinite alternate; animation-delay:calc(var(--i) * 60ms); }

.hero.heroArt{ display:grid; grid-template-columns:1fr auto; column-gap:14px; align-items:center; }
.hero.heroArt > h1, .hero.heroArt > p{ grid-column:1; }
.hero.heroArt > .bArt{ grid-column:2; grid-row:1 / span 2; width:104px; height:104px; }
@media (min-width:720px){ .hero.heroArt > .bArt{ width:136px; height:136px; } }
.bArt{ overflow:visible; }
.bArt .bHalo{ fill:color-mix(in srgb, var(--gold-soft) 26%, transparent); }
.bArt .bHalo2{ fill:color-mix(in srgb, var(--gold-soft) 30%, transparent); }
.bArt .bRays path{ stroke:var(--gold-soft); stroke-width:2; stroke-linecap:round; fill:none; }
.bArt .bFig{ fill:var(--gold); }
.bArt .bFig .bRobe{ fill:none; stroke:var(--bg, #f4efe4); stroke-width:1.6; stroke-linecap:round; opacity:.55; }
.bArt .bHalo, .bArt .bHalo2, .bArt .bRays{ transform-origin:0 0; }
@keyframes bBreath{ 50%{ transform:scale(1.09); opacity:.75; } }
@keyframes bTurn{ to{ transform:rotate(360deg); } }
@keyframes bRise{ from{ opacity:0; transform:translateY(6px); } }
.bArt .bHalo{ animation:bBreath 6s ease-in-out infinite; }
.bArt .bHalo2{ animation:bBreath 6s ease-in-out -3s infinite; }
.bArt .bRays{ animation:bTurn 90s linear infinite; }
.bArt .bFig{ animation:bRise 1.2s ease-out both; }
@media (prefers-reduced-motion: reduce){
  .lotus .lp, .bArt .lp, .bArt .bHalo, .bArt .bHalo2, .bArt .bRays, .bArt .bFig{ animation:none !important; }
}
@media print{ .bArt{ display:none; } }

/* ---------- 2026-11-11: tap targets, the phone's intro line, background art ---------- */
.brand, .seShare{ min-height:44px; }
.dhTitle{ display:block; padding:7px 0; }
.skip{ min-height:44px; display:inline-flex; align-items:center; }
.hero p.heroShort{ display:none; }
@media (max-width:719px){
  .hero p.heroShort{ display:block; font-size:var(--fz-md-h); line-height:var(--lh-text); margin-top:2px; }
}

.bgArt{ position:fixed; inset:0; z-index:var(--z-under); overflow:hidden; pointer-events:none; contain:strict; }
.bgArt i{ position:absolute; top:-8vh; left:var(--x); width:var(--s); height:calc(var(--s) * .6);
  background:linear-gradient(135deg, #fbd5df, #e88aa8); border-radius:92% 8% 92% 8%; opacity:.5;
  animation:petalFall var(--d) linear var(--w) infinite; will-change:transform; }
@keyframes petalFall{
  0%{ transform:translate3d(0, 0, 0) rotate(0deg); }
  25%{ transform:translate3d(6vw, 29vh, 0) rotate(130deg); }
  50%{ transform:translate3d(-4vw, 58vh, 0) rotate(250deg); }
  75%{ transform:translate3d(7vw, 87vh, 0) rotate(390deg); }
  100%{ transform:translate3d(1vw, 118vh, 0) rotate(520deg); }
}
.bgMandala{ position:absolute; right:-170px; bottom:-170px; width:520px; height:520px; opacity:.16;
  fill:none; stroke:var(--gold-soft); stroke-width:.7; animation:bTurn 160s linear infinite; }
.bgMandala.b2{ right:auto; bottom:auto; left:-210px; top:22vh; width:460px; height:460px; opacity:.11;
  animation-duration:220s; animation-direction:reverse; }
:root[data-theme="dark"] .bgArt i{ opacity:.26; }
:root[data-theme="dark"] .bgMandala{ opacity:.1; }
/* a cover / a row rises in the first time it is scrolled to */
.rv{ opacity:0; transform:translateY(22px) scale(.95); transition:opacity .4s var(--ease), transform .4s var(--ease); }
.rv.up{ transform:translateY(-22px) scale(.95); }        /* left through the top */
.rv.in{ opacity:1; transform:none; transition:opacity .55s ease var(--rd, 0ms), transform .55s cubic-bezier(.2,.7,.2,1) var(--rd, 0ms); }
.hero.heroArt > .bArt{ transform:translateY(calc(var(--sy, 0) * 26px)) scale(calc(1 - var(--sy, 0) * .18)); opacity:calc(1 - var(--sy, 0) * .75); }
.scrollBar{ position:fixed; left:0; right:0; top:0; height:3px; z-index:calc(var(--z-pop) + 5); background:linear-gradient(90deg, var(--gold-soft), var(--gold));
  transform:scaleX(0); transform-origin:0 50%; pointer-events:none; }
@media (prefers-reduced-motion: reduce){ .scrollBar{ display:none; } .hero.heroArt > .bArt{ transform:none; opacity:1; } }
@media (hover:hover){ .shelf .bcov{ transition:transform var(--dur-3) var(--ease), box-shadow var(--dur-3) var(--ease); } .shelf .bcov:hover{ transform:translateY(-5px); } }
@media (prefers-reduced-motion: reduce){
  .bgArt i{ display:none; } .bgMandala{ animation:none; }
  .rv{ opacity:1; transform:none; }
}
@media print{ .bgArt{ display:none; } }

/* first paint (2026-11-11): the plain volume list is for crawlers / no-script; with scripts on
   only the lotus shows until the app renders (index.html sets html.js before the first paint) */
.js #view > .seoHome{ min-height:62vh; display:flex; align-items:center; justify-content:center; padding:0; }
.js #view > .seoHome > :not(.empty){ display:none; }

/* the contents drawer on phones (2026-11-11, owner's iPhone 15: "looks off"): it began 56px down,
   but the phone header with its search row is ~108px tall, so the drawer's own top bar and half
   of its first row sat hidden behind the header.  Now it covers the full height, over the header,
   inside the safe areas, with a real close button. */
.cnavTop .cnavX{ display:none; }
@media (max-width:999px){
  .cnav{ top:0; z-index:var(--z-float); width:min(320px, 86vw); padding-top:env(safe-area-inset-top);
    padding-left:env(safe-area-inset-left); border-radius:0 18px 18px 0; }
  .cnavScrim{ z-index:calc(var(--z-float) - 1); }
  .cnavTop{ padding:10px 8px 10px 18px; min-height:56px; }
  .cnavTop b{ font-size:17px; }
  .cnavTop .cnavHideTx{ display:none; }
  .cnavTop .cnavX{ display:block; width:22px; height:22px; }
  .cnavTop .linkBtn{ width:44px; height:44px; display:grid; place-items:center; padding:0; color:var(--muted); border-radius:var(--r-md); }
  .cnavBody{ padding:8px 0 calc(28px + env(safe-area-inset-bottom)); }
  .cnavBody > a, .cnav .tnode > button{ min-height:48px; font-size:var(--fz-lg-h); }
  .cnav .l1 > button{ font-size:var(--fz-lg-h); }
}

/* the drawer's lotus header, icons and daily card (2026-11-11, owner chose draft C) */
.cnavHero{ flex:0 0 auto; display:grid; grid-template-columns:auto 1fr; column-gap:var(--sp-3); align-items:center;
  padding:6px 18px 14px; border-bottom:1px solid var(--line2);
  background:radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--gold-soft) 22%, transparent), transparent 70%); }
.cnavHero .bArt{ grid-row:1 / span 2; width:76px; height:76px; }
.cnavHero > b{ font-size:16.5px; align-self:end; }
.cnavWeek{ display:flex; align-items:center; gap:5px; font-size:var(--fz-xs); color:var(--muted); align-self:start; margin-top:var(--sp-1); }
.cnavWeek i{ width:9px; height:9px; border-radius:50%; border:1.5px solid var(--gold-soft); box-sizing:border-box; }
.cnavWeek i.on{ background:var(--gold); border-color:var(--gold); }
.cnavWeek i.fu{ border-color:var(--line); }
.cnavWeek span:first-child{ margin-right:3px; }
.cnavBody > a.cnavIc{ display:flex; align-items:center; gap:var(--sp-3); }
.cnavBody > a.cnavIc .ic{ width:20px; height:20px; flex:none; color:var(--gold); }
.cnavSep{ height:1px; background:var(--line2); margin:var(--sp-2) 0; }
.cnavDaily a{ display:block; box-sizing:border-box; width:calc(100% - 28px); margin:16px 14px 0; padding:12px 14px; border:1px dashed var(--gold-soft); border-radius:var(--r);
  background:var(--surface); white-space:normal; height:auto; min-height:0; line-height:var(--lh-ui); }
.cnavDaily small{ display:flex; align-items:center; gap:6px; color:var(--gold); font-weight:700; font-size:var(--fz-xs); }
.cnavDaily small .ic{ width:15px; height:15px; }
.cnavDaily b{ display:block; font-size:var(--fz-lg); margin:3px 0 2px; color:var(--ink); }
.cnavDaily span{ display:block; font-size:var(--fz-xs-h); color:var(--muted); font-weight:400; }
.cnavDaily em{ display:block; font-style:normal; font-size:var(--fz-sm); font-weight:700; color:var(--gold); margin-top:5px; }
@media (min-width:1000px){ .cnavHero .bArt{ width:60px; height:60px; } }

/* ---------- app feel (2026-11-11) ---------- */
/* nothing in the chrome selects or zooms on a double tap; a pressed thing gives way a little */
a, button, .row, .bcov, .chip{ touch-action:manipulation; }
.top, .tabBar, .cnav, .chips, .edTabs{ -webkit-user-select:none; user-select:none; -webkit-touch-callout:none; }
@media (hover:none){
  .bcov:active, .row:active, .chip:active, .dailyHome .go:active, .tabBar a:active, .cnavBody > a:active{
    transform:scale(.965); transition:transform .08s var(--ease); }
}
html{ overscroll-behavior-y:none; }
.tabBar{ display:none; }
@media (max-width:767px){
  .tabBar{ display:grid; grid-template-columns:repeat(5, 1fr); position:fixed; left:0; right:0; bottom:0; z-index:var(--z-tabbar);
    padding:6px 6px calc(6px + env(safe-area-inset-bottom)); background:color-mix(in srgb, var(--paper2) 88%, transparent);
    -webkit-backdrop-filter:saturate(1.4) blur(14px); backdrop-filter:saturate(1.4) blur(14px);
    border-top:1px solid var(--line); }
  .tabBar a{ display:flex; flex-direction:column; align-items:center; gap:2px; padding:4px 2px 2px; min-height:48px;
    color:var(--muted); text-decoration:none; font:600 var(--fz-xs)/1.3 var(--ui); border-radius:var(--r-md); }
  .tabBar a .ic{ width:23px; height:23px; }
  .tabBar a.on{ color:var(--gold); }
  .tabBar a.on .ic{ stroke-width:2.2; }
  body.hasTabs{ padding-bottom:calc(66px + env(safe-area-inset-bottom)); }
  body.hasTabs .toTop, body.hasTabs .chatFab{ bottom:calc(78px + env(safe-area-inset-bottom)); }
  body.hasTabs .toast{ bottom:calc(84px + env(safe-area-inset-bottom)); }
  /* the tab bar has them now */
  body.hasTabs #meBtn, body.hasTabs #bmBtn{ display:none; }
  body:has(.cnavScrim.show) .tabBar{ display:none; }
}
@media print{ .tabBar{ display:none !important; } }

/* the tab bar in the reader (2026-11-11): its own bottom things move up; page-turn mode and the
   scanned-book view keep their own bars */
@media (max-width:767px){
  body.hasTabs .selBar.sheet{ bottom:calc(66px + env(safe-area-inset-bottom)); }
  body.hasTabs .findBar.findPill{ bottom:calc(78px + env(safe-area-inset-bottom)); }
  body.hasTabs .lkCard{ bottom:calc(72px + env(safe-area-inset-bottom)); }
  body.bookView .tabBar{ display:none; }
  body.hasTabs.pagedMode, body.hasTabs.bookView{ padding-bottom:0; }
  /* page-turn mode (2026-11-12): the tab bar stays; the reader, its page bar and the things
     above it end 60px higher */
  body.hasTabs.pagedMode:not(.bookView){ --tabH:calc(60px + env(safe-area-inset-bottom)); }
  body.hasTabs.pagedMode:not(.bookView) .reader{ height:calc(100vh - var(--tabH)); height:calc(100dvh - var(--tabH)); }
  body.hasTabs.pagedMode:not(.bookView) .pgBar{ bottom:var(--tabH); padding-bottom:9px; }
  body.hasTabs.pagedMode:not(.bookView)::after{ bottom:calc(38px + var(--tabH)); }
  body.hasTabs.pagedMode:not(.bookView) .selBar.sheet{ bottom:calc(52px + var(--tabH)); }
  body.hasTabs.pagedMode:not(.bookView) .findBar.findPill{ bottom:calc(48px + var(--tabH)); }
  /* UX3: one place for each action.  The contents are the tab bar's «មាតិកា», so the top bar does
     not draw its contents button while the tab bar shows (the scanned-book view has no tab bar and
     keeps it).  And the page title is not drawn above a printed heading that says the same words:
     it stays for screen readers and the top bar carries it. */
  body.hasTabs:not(.bookView) .rtop #tocBtn{ display:none; }
  .rtitle.dup{ position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); margin:0; white-space:nowrap; }
}

/* ---------- UX1 step 3 (2026-11-12) / UX3 item 6: the reader on the phase-1 scale ----------
   UX1 held the reader page on its old half-step sizes and leading; UX3 lifted that hold (the
   reading text has its own sizes and leading and never used these tokens; page-turn mode shows
   one printed page per screen, so its page count does not depend on them).  What remains: the
   page-turn running head keeps its leading of 1.6 (--lh-snug on the new scale = the old --lh-ui),
   or at --lh-ui 1.7 it grows 1.2px and its bottom edge covers the top of the first line by 0.4px
   (it sits at top 58px over a screen whose text starts at 82px). */
body.pagedMode .runHead{ line-height:var(--lh-snug); }

/* ---------- UX1 step 2 (2026-11-12): states, in one place ----------
   what you type into has an edge you can see (3:1); a gold button answers a pointer; the
   controls that had no pressed state get one; a disabled control looks it; and one switch
   for people who asked their device for less motion. */
.search input, .tocFilter, .nmFilter, .reportBox input, .reportBox textarea, .sheet2 input, .sheet2 textarea,
.sheet2 select, .pfDate input, .pfInput{ border-color:var(--field-line); }
.search input:focus-visible, .tocFilter:focus-visible, .sheet2 input:focus-visible, .sheet2 textarea:focus-visible,
.sheet2 select:focus-visible, .reportBox input:focus-visible, .reportBox textarea:focus-visible,
.pfDate input:focus-visible, .pfInput:focus-visible{ outline:2px solid var(--gold); outline-offset:1px; border-color:var(--gold); }
.search input:focus-visible{ border-radius:var(--r-pill); }
@media (hover:hover){
  .pairBtn:not(.quiet):not(.planBack):hover, .unGo:hover, .rmGo:hover, .toast button:hover,
  .s2act .go:not(.danger):hover, .shareActions .go:hover{ filter:brightness(1.08); }
  .winTab:hover, .ftChip:hover, .chip:hover, .tab:hover{ border-color:var(--gold-soft); }
  .tabBar a:hover{ color:var(--ink); }
}
.pairBtn:active, .unGo:active, .rmGo:active, .a2Go:active, .seShare:active, .edTab:active, .bpPill:active,
.vmBtn:active, .volRow:active, .tocItem:active, .ftChip:active, .winTab:active, .tpl:active, .remBtn:active,
.authBtn:active, .planHomeCard:active, .pairLink:active, .nmChip:active{ transform:scale(.98); }
:where(button, input, select, textarea):disabled, :where([aria-disabled="true"]){ opacity:.55; cursor:not-allowed; }
@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{ animation-duration:.01ms !important; animation-delay:0s !important;
    animation-iteration-count:1 !important; transition-duration:.01ms !important; transition-delay:0s !important;
    scroll-behavior:auto !important; }
  /* a wait still has to look like a wait */
  .pgScan .pgSpin, .cite-spinner{ animation-duration:1.6s !important; animation-iteration-count:infinite !important; }
}

/* ---------- UX1 step 4 (2026-11-12): the home view ----------
   A new visitor: what this is, that it is free, today's reading (the one gold button) and the first
   shelf, inside one phone screen.  A returning reader: «បន្តអាន» first, with the gold button.
   A chosen filter is outlined and tinted; solid gold is the screen's one action. */
.hero.heroArt h1{ font-size:clamp(22px,2.6vw,28px); line-height:var(--lh-display); letter-spacing:0; margin-bottom:var(--sp-1);
  text-wrap:balance; }
.hero .heroLead{ color:var(--ink2); font-size:var(--fz-lg); line-height:var(--lh-text); max-width:34em; }
.hero .heroHow{ margin-top:2px; }
.hero.heroArt > .bArt{ grid-row:1 / span 3; }
@media (max-width:720px){
  .hero.heroArt{ padding:var(--sp-3) 0 var(--sp-1); column-gap:var(--sp-3); }
  .hero .heroLead{ display:block; font-size:var(--fz-md); }
  .hero.heroArt > .bArt{ width:76px; height:76px; }
  /* a reader with something to carry on: the page opens on it (the heading stays for screen readers) */
  .hero.heroBack{ position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); padding:0; }
}
/* បន្តអាន: the first card leads */
.contSec > .secHead{ margin-top:var(--sp-4); }
.contSec{ margin-bottom:var(--sp-4); }
.contSec .contCard{ border-color:var(--line2); box-shadow:var(--shadow-1); }
.contSec .contCard:hover{ box-shadow:var(--shadow-2); }
.contSec .contCard.lead{ border-color:color-mix(in srgb, var(--gold) 40%, var(--line)); box-shadow:var(--shadow-2); }
.contCard.lead .contTitle{ font-size:var(--fz-xl); line-height:var(--lh-snug); }
.contCard.lead .contAction{ background:var(--gold); color:var(--on-gold); padding:7px 16px; border-radius:var(--r-pill);
  font-size:var(--fz-md); font-weight:700; white-space:nowrap; }
.contCard.lead:hover .contAction{ text-decoration:none; filter:brightness(1.08); }
.contSec .contTitle{ line-height:var(--lh-snug); }
.contAll{ display:none; }
@media (max-width:767px){
  .contSec .contItem:not(:first-child){ display:none; }      /* the rest are one tap away: «ប្រវត្តិទាំងអស់» */
  .contAll{ display:inline-flex; }
}
/* today's reading */
h2.dhLab{ margin:0; line-height:var(--lh-snug); }
.dailyHome{ border-color:var(--line2); box-shadow:var(--shadow-2); margin-bottom:var(--sp-4); }
.dailyHome .pairBtn.quiet{ border-color:var(--gold); }
.dhWait{ margin-bottom:var(--sp-4); }
@media (max-width:767px){
  .dailyHome{ padding:14px var(--sp-4) var(--sp-4); }
  .dhTitle{ margin-top:2px; padding:var(--sp-1) 0; }
  .dhTease{ -webkit-line-clamp:1; height:auto; margin-top:6px; }
  .dhAct{ margin-top:var(--sp-3); }
}
/* no plan yet: one compact row under the daily card, not a tall card beside it */
.homeHub{ margin-bottom:var(--sp-3); }
.homeHub.noPlan{ display:block; }
.homeHub.noPlan .dailyHome{ margin-bottom:var(--sp-3); }
.homeHub .planPromo{ display:flex; flex-direction:row; flex-wrap:wrap; align-items:center; justify-content:flex-start;
  gap:2px 10px; height:auto; min-height:48px; margin:0; padding:var(--sp-2) 14px; border-color:var(--line2);
  box-shadow:var(--shadow-1); }
.homeHub .planPromo > .ic{ width:18px; height:18px; color:var(--gold); flex:0 0 auto; }
.homeHub .planPromo b{ font-size:var(--fz-md); white-space:nowrap; }
.homeHub .planPromo > span:not(.ppSea){ flex:1 1 0; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  font-size:var(--fz-sm); }
.homeHub .planPromo i{ margin-left:auto; white-space:nowrap; font-size:var(--fz-sm); }
.homeHub .planPromo .ppSea{ order:5; margin-top:0; }
@media (max-width:767px){ .homeHub .planPromo > span:not(.ppSea){ display:none; } }
.planHomeCard{ border-color:var(--line2); box-shadow:var(--shadow-1); }
/* editions and filters */
html:not(.lib) .edSwitchWrap{ margin:var(--sp-4) 0 var(--sp-3); }
.edSwitcher{ border-color:var(--line2); }
.edTabLbl{ line-height:var(--lh-snug); }
.edTabSub{ font-family:var(--ui); line-height:var(--lh-snug); margin-top:0; }
html:not(.lib) #basketPillsBox .bpPill.active{ background:var(--tint); color:var(--ink); border-color:var(--gold);
  font-weight:700; box-shadow:none; }
html:not(.lib) #basketPillsBox .ed-110 .bpPill.active{ border-color:var(--ed-pe); background:color-mix(in srgb, var(--ed-pe) 11%, var(--surface)); }
html:not(.lib) #basketPillsBox .ed-atk .bpPill.active{ border-color:var(--ed-atk); background:color-mix(in srgb, var(--ed-atk) 11%, var(--surface)); }
html:not(.lib) #basketPillsBox .ed-pali .bpPill.active{ border-color:var(--ed-ce); background:color-mix(in srgb, var(--ed-ce) 11%, var(--surface)); }
/* UX5: the library's chosen filter too (it kept its solid fill in UX1) */
html.lib #basketPillsBox .bpPill.active{ background:color-mix(in srgb, var(--ed-pk) 11%, var(--surface)); color:var(--ink);
  border-color:var(--ed-pk); font-weight:700; box-shadow:none; }
html.lib #basketPillsBox .bpPill.active .bpCnt{ background:transparent; color:var(--ink2); }
html:not(.lib) #basketPillsBox .bpPill.active .bpCnt{ background:transparent; color:var(--ink2); padding:1px 0; }
/* the shelves: headings in order (h2 edition, h3 basket, h4 nikaya), captions with room for Khmer */
html:not(.lib) h3.catParent, html:not(.lib) h4.shelfGroup{ line-height:var(--lh-snug); }
html:not(.lib) #shelfContainer > .secHead:first-child{ margin-top:var(--sp-3); }
html:not(.lib) .bcovCap{ line-height:var(--lh-snug); }
/* the phone's first screen: tighter edition tabs, the shelf's own heading read out but not drawn
   (the chosen tab says the same), and no plan row (the tab bar has «ផែនការអាន»; a festival plan
   that is near still shows) */
@media (max-width:767px){
  .homeHub .planPromo:not(.sea){ display:none; }
  .homeHub.noPlan .dailyHome{ margin-bottom:0; }
  html:not(.lib) .edSwitchWrap{ margin-top:var(--sp-3); }
  .edSwitcher{ padding:var(--sp-1); gap:var(--sp-1); }
  .edTab{ min-height:48px; padding:6px 6px 5px; }
  .edTabLbl{ font-size:var(--fz-md); line-height:var(--lh-display); }
  .edTabSub{ line-height:var(--lh-display); }
  html:not(.lib) .shelfToolBar{ margin:var(--sp-2) 0 0; }
  html:not(.lib) #shelfContainer > .secHead.peHead:first-child{ margin-top:var(--sp-3); }
  html:not(.lib) #shelfContainer > .secHead:first-child:not(.peHead){ position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); margin:0; }
  html:not(.lib) #shelfContainer > .secHead:first-child:not(.peHead) + h3.catParent{ margin-top:var(--sp-2); }
  html:not(.lib) .shelf{ margin-top:var(--sp-2); }
  .dhWait{ min-height:203px; }
}
@media (min-width:768px){ .dhWait{ min-height:234px; } }

/* ---- a page that could not load (UX2): TPI.fail in js/icons.js -- home, volume page, reader ---- */
.loadFail{ display:flex; flex-direction:column; align-items:center; gap:var(--sp-3); text-align:center;
  max-width:44ch; margin:var(--sp-6) auto; padding:var(--sp-6) var(--sp-4);
  color:var(--ink2); font-size:var(--fz-lg); line-height:var(--lh-text); }
.loadFail > .ic{ width:40px; height:40px; color:var(--muted); }
.loadFail .lfMsg{ margin:0; }
.loadFail .pairBtn{ display:inline-block; min-width:168px; min-height:44px; margin:var(--sp-1) 0 0;
  padding:var(--sp-3) var(--sp-5); font-family:inherit; cursor:pointer; transition:filter var(--dur-2) var(--ease), transform var(--dur-1) var(--ease); }
.loadFail .pairBtn:hover{ filter:brightness(1.06); }
.loadFail .pairBtn:active{ transform:scale(.98); }
.loadFail .pairBtn:disabled{ cursor:default; }
.loadFail .lfBack{ color:var(--muted); font-size:var(--fz-sm); padding:var(--sp-2) var(--sp-3); }
.loadFail .lfBack:hover{ color:var(--ink); }
#reader > .loadFail{ margin-top:72px; }

/* ---- the volume page's header (UX2): cover, name, counts, progress, one gold action.  The 82,
   the 110, the commentary and the Pali volumes; the library's own is .pkHero above ---- */
.volHero{ display:grid; grid-template-columns:auto minmax(0,1fr); gap:var(--sp-3) var(--sp-4); align-items:start;
  padding:var(--sp-2) 0 var(--sp-1); }
.volHeroCov .contThumb{ flex:none; width:72px; height:102px; }
.volHeroTx{ min-width:0; }
.volHeroTx h1{ margin:0 0 var(--sp-1); font-size:var(--fz-3xl); line-height:var(--lh-display); letter-spacing:-.015em; text-wrap:balance; }
/* (a name of several parts -- «សុមង្គលវិលាសិនី · សីលក្ខន្ធវគ្គ · បឋមភាគ» -- breaks between the parts, not inside a word) */
.volHeroTx h1 span{ display:inline-block; max-width:100%; }
.volHeroMeta{ margin:0; color:var(--muted); font-size:var(--fz-sm); line-height:var(--lh-ui); }
.volHeroMeta span{ white-space:nowrap; }
.volHeroTx .rmVol{ margin-top:var(--sp-2); }
.volHeroTx > .bar{ margin-top:var(--sp-2); }
.volHeroAct{ grid-column:1 / -1; }
.volHeroAct .pairBtn{ margin:0; padding:var(--sp-2) var(--sp-4); min-height:48px; transition:filter var(--dur-2) var(--ease), transform var(--dur-1) var(--ease); }
.volHeroAct .pairBtn:hover{ filter:brightness(1.06); }
.volHeroAct .pairBtn:active{ transform:scale(.98); }
.volHeroAct .pairBtn small{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.volHero + #pairBar:not(:empty){ margin-top:var(--sp-2); }
.volHero ~ .volTools{ margin-top:var(--sp-3); }
@media (min-width:768px){
  .volHero{ gap:var(--sp-2) var(--sp-5); padding-top:var(--sp-3); }
  .volHeroCov{ grid-row:1 / span 2; }
  .volHeroCov .contThumb{ width:112px; height:158px; }
  .volHeroCov .contThumbNo{ font-size:var(--fz-sm); padding-top:var(--sp-1); padding-bottom:var(--sp-1); }
  .volHeroTx h1{ font-size:clamp(20px,2.5vw,26px); }
  .volHeroMeta{ font-size:var(--fz-md); }
  .volHeroAct{ grid-column:2; align-self:end; }
  .volHeroAct .pairBtn{ display:inline-block; min-width:240px; max-width:100%; padding:var(--sp-3) var(--sp-5); }
}

/* ---------- UX3 item 4 (2026-11-12): 44px tap targets on touch screens ----------
   Measured on a phone: search-result page links 31x29, contents rows 34-37 (201 of 213 in
   book 31), volume rows 35-38, filter pills 36, the cover / list toggle 38x36, the profile's
   window tabs 40x32.  Rows that touch each other have no room for a hidden layer, so they
   grow to 44px.  Pills, tabs and page links keep their drawn size and take the tap in an
   invisible layer; the rows of page links are spaced so that the layers do not overlap
   (link 29 + 2 x 7.5 = 44; 6px between links = 3 + 3).  Mouse layouts are unchanged. */
@media (pointer:coarse){
  .tocItem, .row.lv3, .row.lv4{ min-height:44px; }
  .ftPages a{ position:relative; min-width:38px; margin-block:7.5px; }
  .ftPages a::after{ content:""; position:absolute; inset:-7.5px -3px; }
  .bpPill, .winTab{ position:relative; }
  .bpPill::after{ content:""; position:absolute; inset:-4px 0; }
  .winTab::after{ content:""; position:absolute; inset:-6px -3px; }
  .vmBtn{ position:relative; min-width:44px; }
  .vmBtn::after{ content:""; position:absolute; inset:-4px 0; }
  /* UX5: #/me goal chips (were 34x41), the board checkbox row (22 high), the rename button (36),
     the plan's date and time fields (38 high), breadcrumbs (39 high), the paragraph number in the
     reader (17 high: a layer only, the reading text does not move) */
  .goalRow .chip{ min-width:44px; min-height:44px; }
  .profOpt{ min-height:44px; }
  .profEdit{ min-width:44px; min-height:44px; }
  .pfDate input, .pfInput{ min-height:44px; }
  .crumb a::after{ inset:-13px -6px; }
  .pnum{ position:relative; }
  .pnum::after{ content:""; position:absolute; inset:-14px -4px; }
}

/* ================= the English edition (2026-11; html.enMode, set by js/read.js) =================
   Books 901-967 (e1-e67): SuttaCentral's English translations.  The text and its titles are
   English, the site's own labels stay Khmer.  English is set as English is read on a screen:
   a Latin serif the device already has (no font download; each face of the stack has the
   Pāli letters ā ī ū ṁ ṅ ñ ṭ ḍ ṇ ḷ), ranged left, no letter-spacing, no hyphenation, a space
   between paragraphs instead of an indent, a line height of the reader's own choice scaled
   to Latin letters (Khmer needs room for its marks above and below: 1.95 there is 1.6 here),
   and the same column (--read: about 70 letters a line at the default size).  Verse is set
   line by line, a long line turning under itself.  Tokens only: no new colour, radius, shadow. */
html.enMode{ --en-serif:"Palatino Linotype",Palatino,"Noto Serif","Times New Roman",serif;
  --en-lh:calc(var(--lh) * .82); }
html.enMode .rtitle.enTitle{ font-family:var(--en-serif); line-height:1.3; margin-bottom:var(--sp-1); text-wrap:balance; }
html.enMode .enRef{ display:block; font-family:var(--ui); font-size:var(--fz-sm); font-weight:700; color:var(--gold);
  letter-spacing:.04em; line-height:var(--lh-snug); margin-bottom:2px; }
html.enMode .enPi{ text-align:center; font-family:var(--en-serif); font-style:italic; font-size:var(--fz-lg);
  line-height:var(--lh-snug); color:var(--ink2); margin:0 0 var(--sp-2); }
html.enMode .rsub{ font-family:var(--ui); }
html.enMode .pageMark{ display:none; }                 /* (a page here is not a printed page) */
html.enMode .para{ font-family:var(--en-serif); text-align:left; text-justify:auto; text-indent:0;
  line-height:var(--en-lh); margin:0 0 .8em; letter-spacing:0; word-spacing:normal; hyphens:manual;
  overflow-wrap:break-word; text-align-last:auto; }
html.enMode .para .pnum{ margin-right:.2em; }
html.enMode .enN{ font-family:var(--ui); font-size:.72em; font-weight:700; color:var(--muted); margin-right:.3em; }
/* headings inside a text, by their level in the source */
html.enMode .head.enH{ font-family:var(--en-serif); text-align:left; line-height:1.35; margin:1.7em 0 .6em;
  font-size:calc(var(--fs) * 1.2); text-wrap:balance; scroll-margin-top:70px; }
html.enMode .head.enH3{ font-size:calc(var(--fs) * 1.1); }
html.enMode .head.enH4{ font-size:var(--fs); }
html.enMode .head.enH5, html.enMode .head.enH6{ font-size:var(--fs); font-weight:400; font-style:italic; }
html.enMode .head.enH + .head.enH{ margin-top:-.2em; }
html.enMode .head.enNum{ font-family:var(--ui); font-size:var(--fz-md); color:var(--muted); letter-spacing:.04em;
  margin-bottom:.3em; }
html.enMode .enRule{ border:0; height:1px; width:64px; background:var(--gold-soft); margin:1.8em auto; }
/* what a paragraph is */
html.enMode .para.en-rule{ border-left:3px solid var(--gold-soft); padding-left:.9em; font-weight:700; }
html.enMode .para.en-namo{ text-align:center; font-style:italic; margin:.4em 0 1.4em; }
html.enMode .para.en-end{ text-align:center; font-style:italic; color:var(--ink2); margin:1.2em 0; }
html.enMode .para.en-x{ font-style:italic; color:var(--ink2); }
html.enMode .para.en-u{ color:var(--ink2); font-size:calc(var(--fs) * .92); }
html.enMode .para.en-li{ padding-left:1.7em; margin-bottom:.45em; }
html.enMode .para.en-li .enN{ display:inline-block; min-width:1.7em; margin:0 0 0 -1.7em; font-size:.8em;
  font-weight:400; }
html.enMode .para.en-li + .para:not(.en-li){ margin-top:.9em; }
html.enMode .para.en-dt{ font-weight:700; margin-bottom:.15em; }
html.enMode .para.en-dd{ margin-left:1.5em; }
/* verse: a block set in from the prose, one line of the stanza per line; a line too long for
   the column turns under itself, further in */
html.enMode .verse.enV{ display:block; position:relative; font-family:var(--en-serif); text-align:left;
  line-height:var(--en-lh); margin:1em 0 1em 1.6em; max-width:none; text-wrap:wrap; }
html.enMode .verse.enV .vl{ display:block; padding-left:1.4em; text-indent:-1.4em; }
html.enMode .verse.enV .enN{ position:absolute; left:-2.2em; width:1.9em; text-align:right; margin:0; line-height:inherit;
  top:.25em; }
html.enMode .verse.enV.enHasN{ margin-left:2.4em; }
html.enMode .verse.enU{ color:var(--ink2); font-size:calc(var(--fs) * .92); }
html.enMode .rpage i, html.enMode .rpage em{ font-style:italic; }
html.enMode .head.enNum + .verse.enV, html.enMode .head.enNum + .para{ margin-top:.2em; }
html.enMode .setPreview{ font-family:var(--en-serif); line-height:var(--en-lh); text-align:left; text-justify:auto;
  text-indent:0; max-height:calc(var(--fs) * var(--lh) * .82 * 3 + 24px); }
html.enMode .setPreview{ display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:3; line-clamp:3; max-height:none; }
html.enMode .setPreview:empty{ display:none; }
.tocEn .tocItem .pg:empty{ display:none; }
@media (max-width:520px){
  html.enMode .para{ margin-bottom:.75em; }
  html.enMode .verse.enV{ margin-left:1em; }
  html.enMode .verse.enV.enHasN{ margin-left:2.1em; }
  html.enMode .para.en-dd{ margin-left:1em; }
}

/* ---- the English edition on the home page, the shelf and the volume page (js/app.js) ----
   Its colour is --ed-en (as each edition has one).  The fifth tab: five across where there is
   room; on a phone the four Khmer editions keep their two rows of two and English is one
   full-width row under them.  A cover is drawn, not a picture (no printed cover exists): the
   work's Pāli name, its English name in the reading serif, what the volume holds. */
.edTab.en.active::before{ background:var(--ed-en); }
.edTab.en.active .edTabLbl{ color:var(--ed-en); }
@media (min-width:700px){ .edSwitcher.ed5{ grid-template-columns:repeat(5, minmax(0, 1fr)); } }
@media (max-width:699px){
  .edSwitcher.ed5{ grid-template-columns:repeat(2, minmax(0, 1fr)); }
  .edSwitcher.ed5 .edTab.en{ grid-column:1 / -1; flex-direction:row; gap:var(--sp-2); align-items:baseline; }
}
.bcov.en .bcovArt{ background:var(--en-cover); color:var(--en-cover-ink); display:flex; flex-direction:column;
  align-items:center; justify-content:space-between; text-align:center; padding:13% 9% 11%;
  font-family:"Palatino Linotype",Palatino,"Noto Serif","Times New Roman",serif; }
.bcov.en .bcovArt::after{ display:none; }
.enCovPi{ font-size:var(--fz-2xs); font-style:italic; line-height:1.25; opacity:.9; }
.enCovT{ font-size:clamp(11px, 3vw, 15px); font-weight:700; line-height:1.2; text-wrap:balance; hyphens:auto; overflow-wrap:break-word; }
.enCovR{ font-family:var(--ui); font-size:var(--fz-2xs); font-weight:700; letter-spacing:.02em; line-height:1.25; min-height:1.25em;
  align-self:stretch; }
.enCovR:not(:empty){ border-top:1px solid color-mix(in srgb, currentColor 45%, transparent); padding-top:5px; margin:0 10%; }
.bcov.en .bcovCap{ overflow-wrap:break-word; }
@media (max-width:600px){            /* a phone: three covers across (a cover carries words), the Pāli name in the caption only */
  .shelf.enShelf{ grid-template-columns:repeat(3, minmax(0, 1fr)); }
  .bcov.en .bcovArt{ padding:16% 7% 10%; justify-content:center; gap:8px; }
  .bcov.en .enCovPi{ display:none; }
  .enCovR:not(:empty){ margin:0 4%; }
}
.bcov.en .bcovCap b{ font-style:italic; }
.contThumb.en{ background:var(--en-cover); }
.contThumb.en .contThumbArt{ display:flex; align-items:center; justify-content:center; padding:0 4px 16px; text-align:center;
  color:var(--en-cover-ink); font-family:"Palatino Linotype",Palatino,"Noto Serif","Times New Roman",serif; }
.contThumb.en .enCovT{ font-size:var(--fz-xl); line-height:1.15; }
.volHeroCov .contThumb.en .enCovT{ font-size:var(--fz-3xl); }
.contThumb.en .contThumbNo:empty{ display:none; }
.contThumb.en .contThumbNo{ background:color-mix(in srgb, var(--en-cover) 62%, #000); color:var(--en-cover-ink); text-shadow:none;
  font-size:var(--fz-2xs); }
.edPill.en{ background:color-mix(in srgb, var(--ed-en) 14%, transparent); color:var(--ed-en); }
.vrNum.en{ background:color-mix(in srgb, var(--ed-en) 14%, transparent); color:var(--ed-en); }
.row .pg.ed.en b, .ftEd.en, .qDestEd.en{ color:var(--ed-en); }
/* the English contents: no page column (the pages are not printed pages), the Pāli name under a title */
.enList .row .pg:empty{ display:none; }
.enList .row .ex{ font-style:italic; }
.cnavEn .cnavTx > span{ font-weight:700; }

/* ---- the English edition's credit: a quiet line at the end of every text and under a
   volume's name (translator · source · licence), and the note under the English shelf ---- */
.enCredit{ margin:var(--sp-5) 0 0; font-family:var(--ui); font-size:var(--fz-sm); line-height:var(--lh-ui); color:var(--muted);
  text-align:center; }
.enCredit a, .enAbout a{ color:var(--gold); text-decoration:underline; text-underline-offset:2px; }
.volHeroTx .enCredit{ margin:var(--sp-1) 0 0; text-align:left; }
.enAbout{ margin:var(--sp-6) 0 var(--sp-4); padding:var(--sp-4); border:1px solid var(--line2); border-radius:var(--r-md);
  background:var(--paper2); font-size:var(--fz-md); line-height:var(--lh-text); color:var(--ink2); }
.enAbout p{ margin:0 0 var(--sp-2); }
.enAbout ul{ margin:var(--sp-2) 0 0; padding-left:1.2em; }
.enAbout li{ margin:0 0 var(--sp-1); }
@media (pointer:coarse){ .enCredit a, .enAbout a{ position:relative; }
  .enCredit a::after, .enAbout a::after{ content:""; position:absolute; inset:-12px -6px; } }
html.enMode .unTease{ font-family:var(--en-serif); letter-spacing:0; word-spacing:normal; text-align:left; text-justify:auto;
  line-height:1.5; }

/* ---- the translators' notes in the English edition (release 2): the site's footnote form, set
   in the English reading face; a reference to another text of the edition is a link ---- */
html.enMode .fnref{ font-family:var(--ui); font-size:.66em; vertical-align:.6em; padding:0 .05em 0 .1em; }
html.enMode .fn.enFn{ font-family:var(--en-serif); font-size:.86em; line-height:1.55; color:var(--ink2);
  text-align:left; letter-spacing:0; word-spacing:normal; }
html.enMode .fn.enFn .fnnum{ font-family:var(--ui); }
.enNoteLink{ color:var(--gold); text-decoration:underline; text-underline-offset:2px; }
.fnpop p[lang="en"]{ font-family:"Palatino Linotype",Palatino,"Noto Serif","Times New Roman",serif; font-size:var(--fz-md);
  line-height:1.55; }
.fnpop p .enNoteLink{ font-size:inherit; font-weight:400; text-decoration:underline; }
@media (pointer:coarse){ html.enMode .fnref a{ position:relative; }
  html.enMode .fnref a::after{ content:""; position:absolute; inset:-14px -10px; } }
html.enMode .fn.enFn::before{ content:none; }

/* ---- the Abhidhamma (release 2): a list item one or two levels in; a book's label on its cover,
   its volume page and the note under its shelf ---- */
html.enMode .para.en-li.enD2{ margin-left:1.6em; }
html.enMode .para.en-li.enD3{ margin-left:3.2em; }
.enLab{ display:block; margin-top:2px; font-family:var(--ui); font-size:var(--fz-xs); font-weight:700; color:var(--ed-en); }
.enLabNote{ margin:var(--sp-2) 0 0; padding:var(--sp-2) var(--sp-3); border-left:3px solid var(--ed-en); background:var(--paper2);
  border-radius:0 var(--r-sm) var(--r-sm) 0; font-size:var(--fz-sm); line-height:var(--lh-ui); color:var(--ink2); }
.enAbout.enAbh{ margin-top:var(--sp-4); }
/* (the licence's own notice: the full credit it asks for, in smaller type under the credit line) */
.enCredit .enNotice{ display:block; margin-top:var(--sp-1); font-size:var(--fz-xs); line-height:var(--lh-snug); overflow-wrap:anywhere; }
