/* ===== Universal correction matrix (the user, 2026-11-17): on every ground the ink is its opposite.
   Light ground → dark ink; dark ground (site Night, reader Night, dark book tints) → light ink, and the cover red
   becomes the light accent. Found by an automated pass over every page × theme × panel (tools: /tmp/gx/audit.js).
   Loaded LAST so no earlier !important can split a ground from its ink. ===== */

/* the reader's title block, previous/next and margin bubbles on dark grounds */
html:root:is(.night) body #app .ahead :is(h1,.subt,a.subt,.byline b){color:var(--ink)!important}
html:root:is(.night) body #app .ahead :is(.kick,.byline small){color:var(--ink3)!important}
html:root:is(.night) body .readp .rdnav :is(.rdlink,.rdk,.rdk svg){color:var(--red-dk)!important;stroke:currentColor}
html:root:is(.night) body .readp .rdnav .rdt{color:var(--ink2)!important}
html:root:is(.night) body #art .rbub{color:var(--ink2)!important}
html:root:is(.night) body #art .rbub svg{color:inherit!important;stroke:currentColor!important}
html:root:is(.night) body #art .rbub b{color:var(--red-dk)!important}

/* the reader's bottom bar: every icon takes its button's ink; Next stays the accent */
html.night:root body .dock .dk :is(button,a){color:#E8E1D5!important}
html:root:is(.night) body .dock .dk :is(button,a) svg{color:inherit!important}
html:root:is(.night) body .dock .dk :is(button,a) svg :is(path,line,polyline,circle,rect){stroke:currentColor}
html:root:is(.night) body button.rb-aa svg.aa-ic text{fill:currentColor!important}
html:root:is(.night) body .dock .dk :is(.nx,.nx *){color:var(--red-dk)!important}
html:root:is(.night) body .railbtn{color:var(--ink)!important}

/* the note's "Only you / Everyone" chips: the chosen one is a veil of the ground, never a white tile under light ink */
html:root:is(.night) body .rbn-f .rbn-vis button{color:var(--ink2)!important}
html:root:is(.night) body .rbn-f .rbn-vis button.on{background:rgba(255,255,255,.16)!important;color:var(--ink)!important;box-shadow:none!important}
html:root:is(.night) body :is(.rbn-done,.rbt-more,.rbt-more svg){color:var(--red-dk)!important}

/* an avatar's letter sits on its own pale disc: always dark ink */
.rbt-av,.rbt-me .av{color:#1C1B19!important}

/* the Aa panel's Customize section */
html:root:is(.night) body .rs-widths button{color:var(--ink2)!important}
html:root:is(.night) body .rs-widths button.on{color:var(--ink)!important}
html:root body .rs-widths svg path{stroke:currentColor!important}
html:root body .rs-sliders.off{opacity:1!important}
html:root body .rs-sliders.off :is(.rs-h,output){color:var(--ink3)!important}
html:root body .rs-sliders.off input{opacity:.7}
html:root:is(.night) body :is(.rs-open,.rs-reset,.rs-font .rs-tick){color:var(--red-dk)!important}
html:root:is(.night) body .rs-open > span:first-child{color:var(--ink)!important}

/* disabled menu items and buttons: faded, but still readable (3:1) */
.rbpalmenu button[disabled]{opacity:.62!important}
html body #app .setgo:disabled,html body #app .setgo[disabled]{color:var(--ink3)!important;opacity:1!important}

/* site Night: the word buttons (Continue, Collections, Sign out, Save…) are light ink; never black on black */
html.night:root body #app#app :is(.libsort button,.abview button,.bookp .btns .btn,.prof .btn,.pf-btns .btn,.setr.out,.setgo,main.home .row.cont .resume .btn.pri,a.resume .btn.pri){color:#EDE6DA!important;-webkit-text-fill-color:currentColor!important}
html.night:root body #app#app :is(.libsort button[aria-pressed="true"],.abview button[aria-pressed="true"]){color:var(--red-dk)!important}
