/* ព្រះត្រៃបិដក ៨២ — 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:#9a6b1f; --gold-soft:#c9a24a;
  --accent:#7a4a1c;
  --line:rgba(36,28,20,.13); --line2:rgba(36,28,20,.07);
  --shadow:0 1px 2px rgba(36,28,20,.06), 0 8px 28px rgba(36,28,20,.07);
  --shadow-lg:0 12px 48px rgba(36,28,20,.16);
  --r:14px; --r-lg:20px; --r-pill:999px;
  --max:1080px; --read:min(720px, calc(100% - 40px));
  --ui:"Noto Sans Khmer","Battambang",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  --serif:"Battambang","Noto Serif Khmer","Noto Sans Khmer",serif;
  --mono:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  --fs:18px; --lh:2.0;                    /* reader, user-adjustable */
  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:0 1px 2px rgba(0,0,0,.4), 0 8px 28px rgba(0,0,0,.34);
  --shadow-lg:0 12px 48px rgba(0,0,0,.5);
  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);
  color-scheme: light;
}

*{ box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; }
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;
}
a{ color:inherit; }
button{ font:inherit; color:inherit; }
:focus-visible{ outline:2px solid var(--gold); outline-offset:2px; border-radius:6px; }
.skip{ position:absolute; left:-9999px; }
.skip:focus{ left:12px; top:12px; z-index:200; background:var(--surface);
  padding:10px 14px; border-radius:10px; box-shadow:var(--shadow); }

/* ---------- top bar ---------- */
.top{
  position:sticky; top:0; z-index:50;
  background:color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter:saturate(1.4) blur(10px);
  border-bottom:1px solid var(--line2);
}
.topIn{ width:min(var(--max), calc(100% - 32px)); margin:0 auto;
  display:flex; align-items:center; gap:12px; padding:10px 0; }
.brand{ display:flex; align-items:center; gap:10px; text-decoration:none;
  flex:0 0 auto; }
.mark{ width:32px; height:32px; border-radius:10px; flex:0 0 auto;
  background:linear-gradient(140deg,var(--gold-soft),var(--gold));
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.25); position:relative; }
.mark::after{ content:""; position:absolute; inset:7px; border-radius:5px;
  border:1.5px solid rgba(255,255,255,.55); }
.brand b{ font-size:15px; font-weight:700; letter-spacing:-.01em;
  white-space:nowrap; }
.brand span{ display:block; font-size:11px; 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:38px; height:38px; display:grid; place-items:center;
  background:var(--surface); border:1px solid var(--line);
  border-radius:12px; cursor:pointer; font-size:16px; line-height:1;
}
.iconBtn:hover{ border-color:var(--gold-soft); }
.iconBtn[hidden]{ display:none; }

/* ---------- page shell ---------- */
.wrap{ width:min(var(--max), calc(100% - 32px)); margin:0 auto 96px; }
.hero{ padding:34px 0 10px; }
.hero h1{ margin:0 0 8px; font-size:clamp(22px,3.4vw,32px); line-height:1.3;
  letter-spacing:-.015em; }
.hero p{ margin:0; color:var(--muted); font-size:15px; line-height:1.7;
  max-width:60ch; }
.secHead{ display:flex; align-items:baseline; justify-content:space-between;
  gap:12px; margin:34px 0 14px; }
.secHead h2{ margin:0; font-size:16px; letter-spacing:.01em; }
.secHead .hint{ font-size:13px; color:var(--muted); }

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

/* nikāya / text groupings on the browse view */
.catParent{ font-size:15px; 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:14px; letter-spacing:.01em; }
.catHead span{ font-size:11.5px; color:var(--muted); font-family:var(--mono);
  letter-spacing:.04em; }

/* volume view: វគ្គ → សូត្រ outline */
.vgWrap{ margin:18px 0 6px; }
.pannaHead{ font-size:13px; 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:8px 0; overflow:hidden; }
details.vg > summary{ display:flex; align-items:baseline; gap:10px;
  padding:13px 15px; cursor:pointer; list-style:none;
  font-size:14.5px; line-height:1.5; }
details.vg > summary::-webkit-details-marker{ display:none; }
details.vg > summary::before{ content:"▸"; color:var(--gold);
  font-size:11px; transform:translateY(-1px); }
details.vg[open] > summary::before{ content:"▾"; }
details.vg > summary span{ font-size:11.5px; 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:8px; }
.vgList li{ padding:0; }
.vgList a, .vgList .miss, .vgList .ref{ display:flex; gap:8px;
  align-items:baseline; text-decoration:none;
  padding:10px 16px 10px 26px; font-size:14px; line-height:1.5;
  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:11px; color:var(--muted); }
details.vg.allSec{ margin-top:16px; }
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 .12s, transform .12s; }
.vol:hover{ border-color:var(--gold-soft); transform:translateY(-1px); }
.vol .n{ font-family:var(--mono); font-size:11px; color:var(--gold);
  letter-spacing:.06em; }
.vol .t{ font-size:14.5px; 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:11.5px; color:var(--muted); }

/* ---------- section list (inside a volume) ---------- */
.crumb{ display:flex; align-items:center; gap:8px; font-size:13px;
  color:var(--muted); margin:24px 0 4px; }
.crumb a{ text-decoration:none; border-bottom:1px solid var(--line); }
.list{ margin-top:12px; border:1px solid var(--line); border-radius:var(--r);
  overflow:hidden; background:var(--surface); }
.row{ display:flex; gap:12px; 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:11px;
  color:var(--muted); padding-top:3px; min-width:44px; }
.row .tx{ min-width:0; }
.row .tt{ font-size:15px; line-height:1.6; }
.row .ex{ font-size:13px; color:var(--muted); line-height:1.7; 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; font-size:11px; color:var(--gold);
  border:1px solid var(--line); border-radius:var(--r-pill);
  padding:2px 9px; margin-top:2px; }

/* ---------- continue reading ---------- */
.cont{ display:grid; gap:10px;
  grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); }
.contCard{ display:block; text-decoration:none; padding:12px 14px;
  border:1px solid var(--line); border-left:3px solid var(--gold);
  border-radius:var(--r); background:var(--surface); }
.contCard .t{ font-size:14.5px; line-height:1.5; }
.contCard .m{ font-size:11.5px; color:var(--muted); margin-top:4px; }

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

/* 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:1.4; margin:0 0 12px; }
.seoHome > p{ color:var(--ink2); line-height:1.9; max-width:64ch; margin:0 0 22px; }
.seoHome h2{ font-size:15px; margin:0 0 10px; }
.seoVols{ list-style:none; margin:0; padding:0; columns:2; column-gap:24px; }
.seoVols li{ break-inside:avoid; margin:0 0 4px; }
.seoVols a{ text-decoration:none; color:var(--accent); font-size:13.5px;
  line-height:1.7; }
.seoVols a:hover{ text-decoration:underline; }
@media (max-width:560px){ .seoVols{ columns:1; } }
.count{ font-size:13px; color:var(--muted); margin:4px 0 0; }

/* ---------- reader ---------- */
.rtop{ position:sticky; top:0; z-index:50;
  background:color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter:saturate(1.4) blur(10px);
  border-bottom:1px solid var(--line2); }
.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:13.5px; font-weight:700;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.rtopIn .who span{ display:block; font-size:11px; color:var(--muted);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.prog{ height:2px; background:var(--gold); width:0; transition:width .15s; }

.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:12.5px; color:var(--muted);
  font-family:var(--mono); margin-bottom:8px; }
.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:11px; letter-spacing:.1em; margin:36px 0 16px; opacity:.7; }
.pageMark::before, .pageMark::after{ content:"—"; margin:0 8px; opacity:.5; }
.head{ text-align:center; font-weight:700; font-size:calc(var(--fs) + 1px);
  line-height:1.75; margin:30px 0 16px; }
.para{ font-family:var(--serif); text-align:justify; hyphens:none;
  word-break:normal; overflow-wrap:break-word;
  font-size:var(--fs); line-height:var(--lh); margin:0 0 18px;
  text-indent:2em; color:var(--ink); }

.rnav{ display:flex; gap:10px; margin-top:44px; }
.rnav a, .rnav span{ flex:1; text-decoration:none; font-size:13px;
  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; }
.pairBtn{ display:block; text-align:center; text-decoration:none;
  margin:26px 0 0; padding:14px 18px; border-radius:var(--r);
  background:var(--gold); color:#fff; font-weight:700; font-size:14.5px; }
:root[data-theme="dark"] .pairBtn{ color:#1a140c; }
.pairBtn small{ display:block; font-weight:400; opacity:.85; font-size:12px;
  margin-top:2px; }
.rstate{ text-align:center; color:var(--muted); margin:90px auto; font-size:15px; }

/* ---------- panels (TOC / settings) ---------- */
.scrim{ position:fixed; inset:0; z-index:80; background:rgba(20,14,8,.5);
  backdrop-filter:blur(2px); }
.panel{ position:fixed; z-index:90; background:var(--paper2);
  box-shadow:var(--shadow-lg); display:flex; flex-direction:column; }
.panel.side{ top:0; bottom:0; right:0; width:min(400px,88vw);
  border-left:1px solid var(--line); }
.panel.sheet{ left:0; right:0; bottom:0; border-radius:20px 20px 0 0;
  border-top:1px solid var(--line); max-height:80vh; }
.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:14.5px; }
.panelBody{ overflow:auto; -webkit-overflow-scrolling:touch; padding:6px 0 20px; }
.tocItem{ display:flex; gap:10px; padding:11px 16px; text-decoration:none;
  border-top:1px solid var(--line2); font-size:14px; 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:11px; 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:13px; color:var(--muted); margin-bottom:9px; }
.chips{ display:flex; gap:8px; flex-wrap:wrap; }
.chip{ border:1px solid var(--line); background:var(--surface);
  border-radius:var(--r-pill); padding:8px 15px; font-size:14px;
  cursor:pointer; }
.chip[aria-pressed="true"]{ background:var(--gold); color:#fff;
  border-color:var(--gold); font-weight:700; }
:root[data-theme="dark"] .chip[aria-pressed="true"]{ color:#1a140c; }

@media (max-width:640px){
  :root{ --read:min(720px, calc(100% - 28px)); }
  .brand span{ display:none; }            /* drop the tagline, keep the name */
  .brand b{ font-size:13px; }
  .topIn{ gap:8px; }
  .hero{ padding:22px 0 4px; }
  .reader{ margin-top:16px; }
  .row{ padding:12px 13px; }
  .rtopIn{ gap:7px; }
  .rtopIn .who b{ font-size:12.5px; }
  .iconBtn{ width:34px; height:34px; font-size:15px; }
  .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; }
  .catHead{ margin:16px 0 6px; }
  .catParent{ margin-top:24px; }
}
@media (max-width:400px){
  :root{ --read:calc(100% - 20px); --fs:17px; }
  .brand b{ font-size:0; }                /* logo-only when truly tight */
  .topIn{ gap:6px; }
  .rtopIn{ gap:5px; }
  .iconBtn{ width:32px; height:32px; }
  .vols, .cont{ grid-template-columns:1fr; }
}
@media print{
  .top,.rtop,.rnav,.pairBtn,.panel,.scrim,.iconBtn{ 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:22px; transform:translate(-50%,140%);
  z-index:75; display:flex; align-items:center; gap:12px;
  background:var(--surface); border:1px solid var(--line);
  border-radius:var(--r-pill); padding:10px 12px 10px 18px;
  box-shadow:var(--shadow-lg); font-size:13.5px; max-width:calc(100% - 32px);
  transition:transform .28s cubic-bezier(.2,.9,.3,1); }
.toast.go{ transform:translate(-50%,0); }
.toast button{ border:0; background:var(--gold); color:#fff; font-size:13px;
  border-radius:var(--r-pill); padding:7px 14px; cursor:pointer;
  white-space:nowrap; }
:root[data-theme="dark"] .toast button{ color:#1a140c; }

/* ---------- បន្តអាន: swipe-to-remove ---------- */
.linkBtn{ border:0; background:none; color:var(--muted); font-size:13px;
  cursor:pointer; padding:2px 0; border-bottom:1px solid var(--line); }
.linkBtn:hover{ color:var(--ink); }
.swipe{ position:relative; overflow:hidden; border-radius:var(--r); }
.swipeBg{ position:absolute; inset:0; display:flex; align-items:center;
  justify-content:flex-end; padding-right:20px; border-radius:var(--r);
  background:#b3412f; color:#fff; font-size:13.5px; font-weight:700; }
.swipe.armed .swipeBg{ background:#8f3021; }
.swipe .contCard{ position:relative; will-change:transform;
  touch-action:pan-y; }
.swipe .del{ position:absolute; top:8px; right:8px; width:26px; height:26px;
  border-radius:50%; border:1px solid var(--line); background:var(--surface);
  color:var(--muted); font-size:12px; line-height:1; cursor:pointer;
  opacity:0; transition:opacity .12s; }
.swipe:hover .del, .swipe .del:focus-visible{ opacity:1; }
.swipe .del:hover{ color:#b3412f; border-color:#b3412f; }
@media (pointer:coarse){ .swipe .del{ display:none; } }

/* ---------- auth + reports (Supabase) ---------- */
.authBtn{ border:1px solid var(--line); background:var(--surface);
  border-radius:var(--r-pill); padding:7px 14px; font-size:13.5px;
  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:13px; color:var(--muted);
  text-decoration:none; }

.reportBtn{ background:#b3412f; }
:root[data-theme="dark"] .reportBtn{ color:#fff; }
.reportBox label{ display:block; font-size:13px; color:var(--muted);
  margin:12px 0 4px; }
.reportBox input, .reportBox textarea{ width:100%; font-family:var(--ui);
  border:1px solid var(--line); border-radius:10px; padding:9px 11px;
  background:var(--surface); color:var(--ink); }
.reportBox .rQuote{ margin:8px 0 0; padding:9px 12px; border-left:3px solid var(--gold);
  background:var(--paper2); border-radius:6px; font-family:var(--serif);
  line-height:1.9; max-height:30vh; overflow:auto; }
.shareActions .go{ background:var(--gold); color:#fff; border-color:var(--gold);
  font-weight:700; }
:root[data-theme="dark"] .shareActions .go{ color:#1a140c; }
.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:8px 0 0;
  border-top:1px solid var(--line2); text-indent:0; }
.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-soft); text-decoration:none; margin-right:.3em;
  font-family:var(--ui); }
.fnback:hover{ color:var(--gold); }

/* footnote pop-up on tapping a reference */
.fnpop{ position:absolute; z-index:95; background:var(--paper2);
  border:1px solid var(--line); border-radius:12px; padding:12px 14px;
  box-shadow:var(--shadow-lg); font-family:var(--ui); font-size:13.5px;
  line-height:1.7; color:var(--ink); }
.fnpop p{ margin:0 0 8px; }
.fnpop a{ color:var(--gold); font-size:12.5px; text-decoration:none;
  font-weight:700; }

/* 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; }
.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:8px;
  white-space:nowrap; }
.pnpop button:hover{ background:var(--surface); }

/* embedded Pāli (in Khmer script) — set apart from the translation */
.pali{ font-family:var(--serif); color:var(--accent); }
.para.paliB{ text-align:center; text-indent:0; font-family:var(--serif);
  color:var(--ink2); max-width:40ch; margin-left:auto; margin-right:auto; }
.para.paliB .pali{ color:inherit; }

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

/* bookmarks + folders (home #/bm view) */
.contCard.bmc .t{ font-weight:600; }
details.fld{ border:1px solid var(--line); border-radius:var(--r);
  background:var(--surface); margin:8px 0; overflow:hidden; }
details.fld > summary{ display:flex; align-items:center; gap:8px;
  padding:11px 14px; cursor:pointer; list-style:none; font-size:14.5px; }
details.fld > summary::-webkit-details-marker{ display:none; }
details.fld > summary::before{ content:"▸"; color:var(--gold); font-size:11px; }
details.fld[open] > summary::before{ content:"▾"; }
details.fld > summary > span{ font-family:var(--mono); font-size:11px;
  color:var(--muted); }
.fBtn{ border:0; background:none; cursor:pointer; font-size:13px;
  color:var(--muted); padding:2px 5px; border-radius:6px; }
.fBtn:hover{ background:var(--paper2); color:var(--ink); }
details.fld > summary .fBtn:last-of-type{ margin-left:auto; }
.fldBody{ padding:2px 0 6px 14px; border-top:1px solid var(--line2); }
.bmRow{ display:flex; align-items:center; gap:6px; padding:2px 10px 2px 0; }
.bmL{ flex:1; min-width:0; text-decoration:none; color:var(--ink);
  padding:8px 4px; border-radius:8px; }
.bmL:hover{ background:var(--paper2); }
.bt{ font-size:13.5px; line-height:1.5; overflow:hidden; text-overflow:ellipsis;
  white-space:nowrap; }
.bm2{ font-size:11px; color:var(--muted); margin-top:1px; }
.bmEdit, .bmDel{ flex:0 0 auto; border:1px solid var(--line);
  background:var(--surface); color:var(--muted); width:26px; height:26px;
  border-radius:6px; font-size:12px; cursor:pointer; }
.bmDel:hover{ color:#b3412f; border-color:#b3412f; }
.empty2{ font-size:12px; color:var(--muted); padding:8px 10px; }

/* verse / gāthā */
.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:34ch; white-space:normal; color:var(--ink);
  scroll-margin-top:70px; }

/* 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:100;
  display:flex; align-items:center; gap:6px; padding:8px 10px;
  background:var(--paper2); border-bottom:1px solid var(--line);
  box-shadow:var(--shadow-lg); }
.findBar input{ flex:1; min-width:0; font-size:16px; padding:8px 10px;
  border:1px solid var(--line); border-radius:8px; background:var(--surface);
  color:var(--ink); }
.findBar .fcount{ font-family:var(--mono); font-size:12px; color:var(--muted);
  min-width:3.2em; text-align:center; }
.findBar button{ flex:0 0 auto; width:34px; height:34px; border-radius:8px;
  border:1px solid var(--line); background:var(--surface); color:var(--ink);
  font-size:15px; cursor:pointer; }
.findBar button:hover{ border-color:var(--gold-soft); }
mark{ background:var(--gold-soft); color:inherit; border-radius:2px;
  padding:0 1px; }
mark.on{ background:var(--gold); color:#fff; }

/* 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:12.5px; 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:16px; }
.ftHead{ display:flex; align-items:baseline; justify-content:space-between;
  flex-wrap:wrap; gap:6px 10px;
  font-size:15px; font-weight:700; margin-bottom:8px; }
.ftHead .linkBtn{ color:var(--gold); font-weight:700; }
.ftHint{ color:var(--muted); font-size:13px; margin:6px 0; }
.ftList{ display:flex; flex-direction:column; gap:2px; }
.ftItem{ display:block; text-decoration:none; color:var(--ink);
  padding:12px 12px; border-radius:var(--r); }
.ftItem:hover{ background:var(--surface); }
.ftT{ font-weight:700; font-size:14px; }
.ftT span{ font-weight:400; color:var(--muted); font-size:12px; }
.ftS{ font-family:var(--serif); font-size:13.5px; color:var(--muted);
  line-height:1.75; margin-top:3px; }
.ftS mark{ background:var(--gold-soft); color:var(--ink); }

/* ---------- account menu (replaces the browser confirm) ---------- */
.authHost{ position:relative; }
.authMenu{ position:absolute; top:calc(100% + 8px); right:0; z-index:120;
  min-width:180px; background:var(--surface); border:1px solid var(--line);
  border-radius:12px; box-shadow:var(--shadow-lg); overflow:hidden; }
.authWho{ padding:10px 14px; font-size:12.5px; 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:14px; 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:20px; padding:18px;
  box-shadow:var(--shadow-lg); overflow:hidden; }
.sheet2 h3{ margin:0 0 10px; font-size:16px; }
.sheet2 .rQuote{ margin:0 0 4px; padding:10px 12px; overflow:auto;
  flex:0 1 auto; max-height:34vh;
  border-left:3px solid var(--gold); background:var(--surface);
  border-radius:8px; font-family:var(--serif); line-height:1.9; font-size:15px; }
.sheet2 label{ display:block; font-size:13px; color:var(--muted);
  margin:12px 0 4px; }
.sheet2 label span{ opacity:.7; }
.sheet2 input, .sheet2 textarea{ width:100%; font-family:var(--ui);
  border:1px solid var(--line); border-radius:10px; padding:10px 12px;
  background:var(--surface); color:var(--ink); }
.sheet2 textarea{ resize:vertical; min-height:44px; }
.s2msg{ font-size:13px; margin:10px 0 0; min-height:1.2em; line-height:1.6; }
.s2msg.err{ color:#b3412f; font-weight:700; }
.s2msg.ok{ color:var(--gold); font-weight:700; }
.s2act{ display:flex; gap:8px; margin-top:14px; flex:0 0 auto; }
.s2act button{ flex:1; border-radius:12px; padding:13px; font-size:14.5px;
  border:1px solid var(--line); background:var(--surface); cursor:pointer; }
.s2act .go{ background:var(--gold); color:#fff; border-color:var(--gold);
  font-weight:700; }
:root[data-theme="dark"] .s2act .go{ color:#1a140c; }
.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:20px; }
}
@media(min-width:560px){ .shareModal{ align-items:center; } }
