:root {
  --bg: #fafaf8; --fg: #1d2127; --muted: #747b86; --card: #f0f0ec; --accent: #3b82c4; --border: rgba(20,25,35,.12);
  --fs: 19px; --width: 680px; color-scheme: light;
}
:root[data-theme="sepia"] { --bg: #f4ecd8; --fg: #433422; --muted: #8a7a62; --card: #eadfc6; --accent: #8a5a2b; --border: rgba(67,52,34,.18); }
:root[data-theme="dark"] { --bg: #14171c; --fg: #d6dae0; --muted: #8a909b; --card: #1c2027; --accent: #5aa0e0; --border: rgba(255,255,255,.12); color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="sepia"]):not([data-theme="dark"]) { --bg: #14171c; --fg: #d6dae0; --muted: #8a909b; --card: #1c2027; --accent: #5aa0e0; --border: rgba(255,255,255,.12); color-scheme: dark; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; padding-bottom: env(safe-area-inset-bottom); }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 7px 14px; cursor: pointer; }
button:hover { border-color: var(--accent); }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: var(--accent); border-color: transparent; color: #fff; font-weight: 600; }
button.danger { color: #d84c4c; }
button.icon { padding: 6px 10px; }
.muted { color: var(--muted); font-size: 13px; }
.warn { color: #d9a23a; font-size: 13px; margin: 0; }
.warn:empty { display: none; }
.spacer { flex: 1; }

#bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); background: var(--bg); border-bottom: 1px solid var(--border); }
#brand { font-weight: 700; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#status { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; min-width: 0; }
#status .status-t { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#status .status-t b { font-weight: 600; color: var(--fg); font-variant-numeric: tabular-nums; }
@media (max-width: 420px) { #status .status-w, #moreBtn .caret { display: none; } }
/* the header's links: in the bar on a wide screen; on a narrow one, in a drawer the ☰ button opens (as on wtr-lab) */
#navLinks { display: contents; }
#navLinks a { font-size: 14px; color: var(--muted); padding: 4px 8px; border-radius: 8px; }
#navLinks a:hover, #navLinks a.on { color: var(--fg); background: var(--card); }
#menuBtn, #findBtn, #menuShade { display: none; }
#findBtn svg { display: block; }
/* the pages not in the bar: a menu at its right end (as on wtr-lab) */
#moreBox { position: relative; flex: none; }
#moreBtn { display: inline-flex; align-items: center; gap: 1px; padding: 3px 4px 3px 3px; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--muted); }
#moreBtn:hover { border-color: transparent; }
#moreBtn .avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--card); color: var(--fg); border: 1px solid var(--border); }
#moreBtn:hover .avatar, #moreBtn.on .avatar, #moreBtn[aria-expanded="true"] .avatar { color: var(--accent); border-color: var(--accent); }
#moreBtn svg { display: block; }
#moreBtn[aria-expanded="true"] .caret { transform: rotate(180deg); }
#bar #moreMenu { left: auto; right: 0; width: 280px; }
#moreMenu .lib-item.on { background: var(--card); box-shadow: inset 3px 0 0 var(--accent); }
#moreMenu .lib-item.on > .ico:first-child { color: var(--accent); }
/* the bell: how many notifications are new, and the list under it */
#bellBox { position: relative; flex: none; }
#bellBtn { position: relative; padding: 6px 8px; background: transparent; border-color: transparent; color: var(--muted); }
#bellBtn:hover, #bellBtn[aria-expanded="true"] { color: var(--fg); background: var(--card); }
#bellBtn svg { display: block; }
#bellBtn.paused svg { opacity: .4; }
#bellN { position: absolute; top: 0; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: #d84c4c; color: #fff; font-size: 11px; font-weight: 700; line-height: 17px; text-align: center; box-shadow: 0 0 0 2px var(--bg); }
#bar #bellPanel { left: auto; right: 0; width: 380px; max-height: min(72vh, 600px); overflow-y: auto; padding: 0; }
@media (max-width: 760px) { #bar #bellPanel { position: fixed; top: calc(var(--bar-h, 56px) + 4px); left: 12px; right: 12px; width: auto; max-width: none; } }
.nt-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px 16px; background: var(--bg); border-bottom: 1px solid var(--border); }
.nt-head b { flex: 1; font-size: 15px; }
.nt-head button, .nt-gear { padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.nt-gear { color: var(--muted); border: 1px solid var(--border); }
.nt-gear:hover { color: var(--fg); border-color: var(--accent); }
.nt-list { display: flex; flex-direction: column; gap: 2px; padding: 6px; }
.nt-item { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 11px; align-items: start; padding: 10px; border-radius: 9px; cursor: pointer; text-align: left; }
.nt-item:hover, .nt-item:focus-visible { background: var(--card); outline: none; }
.nt-item.unread { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.nt-ico { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--card); color: var(--accent); }
.nt-ico svg { width: 18px; height: 18px; }
.nt-ico.nt-join { color: #3fb871; }
.nt-ico.nt-pr { color: #b07ce0; }
.nt-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nt-body b { font-size: 14px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.nt-body span, .nt-body small { font-size: 13px; color: var(--muted); line-height: 1.4; }
.nt-body small { font-size: 12px; }
.nt-body .nt-done { color: var(--fg); }
.nt-acts { display: flex; gap: 8px; margin-top: 7px; }
.nt-setl { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nt-setl small { font-size: 12.5px; line-height: 1.4; }
.nt-acts button { padding: 5px 14px; font-size: 13px; }
.nt-empty { padding: 18px 16px; margin: 0; }
.nt-pause { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 6px; font-size: 13px; }
.nt-pause button { padding: 3px 10px; font-size: 13px; border-radius: 8px; }
#bellPanel .nt-pause { padding: 8px 16px; border-bottom: 1px solid var(--border); }
#ntToasts { position: fixed; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 45; display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100vw - 32px)); pointer-events: none; }
.nt-toast { position: relative; pointer-events: auto; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 28px rgba(0,0,0,.3); animation: libMenuIn .15s ease-out; }
.nt-toast .nt-item { padding: 12px 34px 12px 12px; }
.nt-toast .nt-item.unread { background: transparent; }
.nt-x { position: absolute; top: 6px; right: 6px; padding: 2px 7px; font-size: 12px; background: transparent; border-color: transparent; color: var(--muted); }
@media (max-width: 760px) {
  #bar { gap: 8px; padding-left: 12px; padding-right: 12px; transition: transform .2s ease; }
  #bar.bar-hidden { transform: translateY(-100%); } /* scrolling down: out of the way; up: back */
  #brand { max-width: none; flex: 0 1 auto; }
  #status { flex: 1 1 auto; font-size: 12px; }
  #bar > .spacer { display: none; }
  #menuBtn, #findBtn { display: inline-block; }
  #navLinks { display: none; }
  #bar.menu-open #navLinks { display: flex; flex-direction: column; gap: 2px; position: fixed; top: 0; left: 0; bottom: 0; z-index: 30; width: min(300px, 82vw); padding: calc(14px + env(safe-area-inset-top)) 12px 16px; overflow-y: auto; background: var(--card); border-right: 1px solid var(--border); box-shadow: 12px 0 32px rgba(0, 0, 0, .35); }
  #bar.menu-open #navLinks::before { content: "heavenlydao.com"; padding: 8px 14px 16px; font-weight: 700; font-size: 18px; }
  #bar.menu-open #navLinks a { display: block; padding: 13px 14px; font-size: 16px; color: var(--fg); border-radius: 10px; }
  #bar.menu-open #navLinks a.on { background: var(--bg); box-shadow: inset 3px 0 0 var(--accent); }
  #bar.menu-open #menuShade { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .5); }
}
.panel { position: sticky; top: var(--bar-h, 52px); z-index: 4; display: grid; gap: 12px; max-width: 360px; margin: 0 16px 0 auto; padding: 14px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.panel label { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 14px; }
.panel select, .panel input[type=range] { width: 55%; }
.panel select { padding: 5px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; }

main { max-width: 860px; margin: 0 auto; padding: 20px 16px 60px; }
h2 { margin: 4px 0 4px; font-size: 22px; }

/* connect screen */

/* library */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-top: 16px; }
.card { display: block; padding: 16px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; }
.card:hover { border-color: var(--accent); }
.card h3 { margin: 0 0 6px; font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
.bar { height: 4px; background: var(--border); border-radius: 2px; margin-top: 10px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.empty { text-align: center; margin: 12vh 0; }

/* novel page */
.actions { display: flex; gap: 10px; margin: 14px 0 6px; flex-wrap: wrap; }
.chlist { margin-top: 12px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.ch { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-top: 1px solid var(--border); cursor: pointer; }
.ch:first-child { border-top: 0; }
.ch:hover { background: var(--card); }
.ch .num { min-width: 3.2em; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.ch .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch.missing .t { opacity: .5; }
.ch.read .t { color: var(--muted); }
.ch .tag { font-size: 12px; color: var(--muted); }
.ch.now { border-left: 3px solid var(--accent); }

/* reader */
.reader { max-width: var(--width); margin: 0 auto; }
.reader h2 { font-size: calc(var(--fs) * 1.25); margin-bottom: 18px; }
.reader p { font-size: var(--fs); line-height: var(--lh, 1.75); font-family: var(--read-font, inherit); margin: 0 0 1.1em; overflow-wrap: anywhere; }
/* a chapter's bar, as on wtr-lab: ‹ Prev, where it is in the novel (it opens the chapter list), Next › */
.nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin: 28px 0; }
.reader h2 + .nav { margin: 14px 0 22px; }
.nav button { padding: 9px 16px; min-width: 92px; }
.nav .nv-prev { justify-self: start; }
.nav .nv-next { justify-self: end; }
.nav .nv-toc { display: grid; justify-items: center; gap: 1px; min-width: 0; padding: 4px 10px; background: transparent; border: 0; line-height: 1.25; }
.nav .nv-toc b { font-weight: 500; font-size: 15px; white-space: nowrap; }
.nav .nv-toc small { font-size: 12px; color: var(--muted); }
.nav .nv-toc:hover b { color: var(--accent); }
/* the novel's name over the chapter, as on wtr-lab: to the novel's page */
.uplink { display: block; margin: -6px 0 12px; padding: 0 0 12px; border-bottom: 1px solid var(--border); color: var(--fg); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uplink:hover { color: var(--accent); }

/* glossaries */
.actions input[type=text] { flex: 1; min-width: 180px; padding: 9px 12px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.actions .muted { align-self: center; }
.tablewrap { overflow-x: auto; margin-top: 8px; }
table.terms { width: 100%; border-collapse: collapse; font-size: 15px; }
table.terms th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 10px; }
table.terms td { padding: 8px 10px; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
table.terms td.src { white-space: nowrap; }


/* settings page: laid out as a novel's page (.np): a head card, then a card with a tab for each section */
main[data-route="settings"] { max-width: 800px; }
main[data-route="read"], main[data-route="source"], main[data-route="followRead"] { max-width: calc(var(--width) + 32px); } /* (the chapter's width setting is the chapter's: not held to the pages' 860) */
.setmain { min-width: 0; }
.setgroup { display: grid; gap: 12px; align-content: start; max-width: 860px; }
.setgroup h2 { margin: 0; font-size: 22px; }
.setgroup .muted { margin: 0; line-height: 1.5; }
.setrow { display: flex; justify-content: space-between; align-items: center; gap: 16px; font-size: 14px; padding: 10px 0; border-top: 1px solid var(--border); }
.setrow input[type=range], .setrow select { width: 50%; max-width: 280px; }
.setrow select { padding: 5px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; }
.setgroup .field { display: grid; gap: 6px; font-size: 14px; padding-top: 10px; border-top: 1px solid var(--border); }
.setgroup .field input { width: 100%; padding: 7px 9px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; }
.setgroup .field .setrow input[type=checkbox] { width: auto; }
.setbtns { display: flex; align-items: center; gap: 12px; }
.setgroup .danger { justify-self: start; }
.setgroup .actions { margin: 4px 0 0; }
.setgroup .actions input[type=search] { flex: 1; min-width: 180px; padding: 9px 12px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.np.settings .np-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 760px) {
  .np.settings .np-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* a group's rows in a box, as a novel's details are: one row each, a line between them */
.setgroup { max-width: none; gap: 10px; }
.setgroup + .setgroup { margin-top: 8px; }
.setgroup .np-sh { margin-bottom: 0; }
.setgroup .sethint { font-size: 13px; }
.np-details.setbox > * { margin: 0; padding: 11px 14px; border-top: 1px solid var(--border); }
.np-details.setbox > :first-child { border-top: 0; }
.np-details.setbox > .setrow { font-size: 14px; }
.np-details.setbox > p.muted, .np-details.setbox > span.muted { display: block; font-size: 13px; }
.np-details.setbox > span.muted:empty, .np-details.setbox > p:empty { display: none; }
.np-details.setbox .field > span:first-child { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.np-details.setbox > .field { padding-top: 11px; }
}
.panel .field { display: grid; gap: 6px; font-size: 14px; }
.panel .field input { width: 100%; padding: 7px 9px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; }
.addrow { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 6px; }
.addrow input { flex: 1; min-width: 140px; padding: 9px 12px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.note { margin: 6px 0; padding: 8px 12px; border-radius: 8px; background: var(--card); font-size: 14px; }
.note.err { color: #d84c4c; border: 1px solid #d84c4c; }
table.terms td.acts { white-space: nowrap; text-align: right; }
table.terms td input[type=text] { width: 100%; padding: 6px 8px; background: var(--card); border: 1px solid var(--accent); border-radius: 6px; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--card); color: var(--muted); border: 1px solid var(--border); }
.badge.you { color: var(--accent); border-color: var(--accent); }

.actions select { padding: 8px 10px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
table.terms td.users { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.terms th:nth-child(3) { text-align: right; }
@media (max-width: 600px) { /* a term is two lines: the word and its English; where it is from and how many chose it; the buttons beside */
  table.terms, table.terms tbody { display: block; }
  table.terms thead { display: none; }
  table.terms tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; align-items: center; gap: 4px 10px; padding: 9px 0; border-top: 1px solid var(--border); }
  table.terms td { padding: 0; border-top: 0; }
  table.terms td.src { grid-column: 1; grid-row: 1; white-space: normal; overflow-wrap: anywhere; }
  table.terms td:nth-child(2) { grid-column: 2; grid-row: 1; }
  table.terms td:nth-child(3) { grid-column: 2; grid-row: 2; text-align: left; font-size: 12px; color: var(--muted); }
  table.terms td.users::before { content: "users "; }
  table.terms td.users.none { visibility: hidden; }
  table.terms td:nth-child(4) { grid-column: 1; grid-row: 2; }
  table.terms td.acts { grid-column: 3; grid-row: 1 / span 2; }
}
.alts { font-size: 12px; margin-top: 2px; }
table.terms .badge { white-space: nowrap; }
.poolshare { flex-wrap: wrap; }
.poolreview { flex-basis: 100%; margin-top: 10px; padding: 12px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.poolreview input[type=text] { width: 100%; padding: 8px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
.poolpairs { max-height: 260px; overflow: auto; margin: 8px 0; font-size: 14px; }
.poolpairs > div { display: flex; gap: 14px; padding: 3px 0; border-top: 1px solid var(--border); }
.poolpairs .src { min-width: 90px; }
.gcard h3 { margin-bottom: 4px; }
.gcard h3 a:hover { color: var(--accent); }
.gcard .gcount { font-size: 15px; font-variant-numeric: tabular-nums; }
.gcard .gtabs { margin: 8px 0; }
.gtabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 6px; }
.gtab { display: inline-flex; align-items: baseline; gap: 6px; font-size: 13px; padding: 3px 11px; border-radius: 999px; background: var(--card); border: 1px solid var(--border); cursor: pointer; }
.gtab b { font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.gtab:hover, .gtab.on { border-color: var(--accent); }
.gtab.on { color: var(--accent); }
.gtab.on b { color: inherit; }
.actions .gfind { max-width: 320px; }

/* novel page */
main[data-route="novel"], main[data-route="followBook"] { max-width: 1040px; } /* (a novel someone shared: laid out as your own) */
.novel-page { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 32px; align-items: start; }
.np-side { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; position: sticky; top: 72px; } /* (minmax: a long name in the merge menu must not widen the column) */
.cover { aspect-ratio: 2 / 3; border-radius: 14px; overflow: hidden; background: linear-gradient(160deg, var(--card), var(--border)); display: grid; place-items: center; border: 1px solid var(--border); }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-ph { font-size: 44px; font-weight: 800; color: var(--muted); letter-spacing: .05em; }
.readcta { width: 100%; padding: 11px 14px; background: var(--accent); color: #fff; border: 0; border-radius: 10px; font-weight: 600; text-align: left; line-height: 1.3; }
.readcta:disabled { background: var(--card); color: var(--muted); }
.sidebtns { display: grid; gap: 8px; }
.sidebtn { width: 100%; padding: 10px 14px; text-align: left; background: transparent; border: 1px solid var(--border); border-radius: 10px; }
.np-title { font-size: 34px; line-height: 1.15; margin: 0 0 12px; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip { font-size: 13px; padding: 3px 11px; border-radius: 8px; background: var(--card); border: 1px solid var(--border); }
.chip.src { color: var(--accent); border-color: var(--accent); background: transparent; }
.chip.more { color: var(--muted); }
.stats { display: flex; flex-wrap: wrap; gap: 6px 22px; color: var(--muted); font-size: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.stats b { color: var(--fg); }
.stats .wtr { color: var(--muted); }
.metagrid { display: flex; flex-wrap: wrap; gap: 14px 40px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.metagrid .k { font-size: 11px; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
.metagrid .v { font-size: 15px; }
.synopsis { padding: 6px 0 14px; border-bottom: 1px solid var(--border); }
.synopsis p { margin: 12px 0; line-height: 1.6; }
.np-h { font-size: 24px; margin: 18px 0 12px; }
.np-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.np-tools input[type=text] { flex: 1; min-width: 160px; padding: 9px 12px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.np-tools .refreshrow { display: flex; gap: 10px; width: 100%; }
.np-tools .stopbtn { width: auto; flex: none; }
.ranges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.rangechip { border: 1px solid var(--border); background: var(--card); color: var(--muted); padding: 4px 11px; border-radius: 999px; font-size: 13px; }
.rangechip.on { background: var(--bg); color: var(--fg); border-color: var(--fg); }
.tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.tab { border: 0; background: transparent; padding: 6px 14px; border-radius: 8px; color: var(--muted); }
.tab.on { background: var(--bg); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.ch .readdot { width: 22px; height: 22px; min-width: 22px; padding: 0; border-radius: 50%; border: 1.5px solid var(--border); background: transparent; font-size: 13px; line-height: 1; color: #fff; }
.ch .readdot.on { background: var(--accent); border-color: var(--accent); }
.ch.empty-row { cursor: default; color: var(--muted); }
@media (max-width: 760px) {
  .novel-page { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  /* the cover beside "Continue" and the first buttons; the rest under them, the whole width */
  .np-side { position: static; grid-template-columns: 110px minmax(0, 1fr); align-items: start; gap: 10px 12px; }
  .np-side .cover { grid-row: span 2; }
  .np-side > :nth-child(n+4) { grid-column: 1 / -1; }
  .np-side .mergebox { margin-top: 4px; }
  .np-side .sidebtns { display: flex; flex-wrap: wrap; gap: 6px; }
  .np-side .sidebtn { width: auto; flex: 1 1 auto; padding: 7px 10px; font-size: 14px; text-align: center; }
  .np-title { font-size: 26px; }
  /* the tabs scroll sideways in their own row instead of widening the page */
  .tabs { display: flex; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: none; white-space: nowrap; padding: 6px 12px; }
}

.linkbox { margin: 8px 0; padding: 14px; border: 1px dashed var(--border); border-radius: 12px; }
.linkrow { display: flex; gap: 8px; flex-wrap: wrap; }
.linkrow select { flex: 1; min-width: 200px; padding: 9px 10px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font-size: inherit; }
.linkerr { color: #d84c4c; }

/* library: cover grid */
main[data-route="following"] { max-width: 1200px; }
main[data-route="library"], main[data-route="followLib"] { max-width: 1040px; } /* (laid out as a novel's page) */
main[data-route="followInbox"] { max-width: 900px; }
.lib-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.lib-head h2 { margin: 0; flex: 1; font-size: 26px; }
.lib-head input[type=text] { min-width: 200px; padding: 9px 12px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.lib-head select { padding: 9px 10px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.books { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 24px 18px; }
.bookcard { display: block; color: inherit; }
.bookcover { position: relative; aspect-ratio: 2 / 3; border-radius: 10px; overflow: hidden; background: var(--card); border: 1px solid var(--border); transition: transform .15s, box-shadow .15s; }
.bookcard:hover .bookcover { transform: translateY(-3px); box-shadow: 0 10px 22px rgba(0, 0, 0, .3); }
.bookcover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.bookcover .ph { position: absolute; inset: 0; display: grid; place-items: center; padding: 14px 12px 34px; text-align: center; font-weight: 800; font-size: 19px; line-height: 1.15; color: #fff; text-shadow: 0 2px 8px rgba(0, 0, 0, .55); overflow-wrap: anywhere; }
.badges { position: absolute; z-index: 2; left: 6px; right: 6px; bottom: 7px; display: flex; font-size: 11px; font-weight: 700; line-height: 1; }
.badges span { padding: 4px 5px; display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; min-width: 0; }
.badges span:last-child { overflow: hidden; }
.badges span:first-child { border-radius: 4px 0 0 4px; }
.badges span:last-child { border-radius: 0 4px 4px 0; }
.badges span:only-child { border-radius: 4px; }
.b-novel { background: #12a15a; color: #fff; }
.b-rate { background: #f5b301; color: #1b1b1b; }
.b-views { background: rgba(14, 16, 20, .85); color: #fff; }
.b-new { background: var(--accent); color: #fff; } /* chapters other editions have past your last one */
.bookcover .prog { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, .18); }
.bookcover .prog i { display: block; height: 100%; background: var(--accent); }
.booktitle { margin-top: 9px; font-size: 15px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
@media (max-width: 520px) { .books { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px; } }

/* glossaries used by a novel */
.glosssec { padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.glosssec .np-h { margin-top: 18px; }
.glossrow { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.glossinfo { flex: 1; min-width: 0; }
.glossname { font-weight: 600; overflow-wrap: anywhere; }
.glossname:hover { color: var(--accent); }
.glossremove { width: auto; padding: 6px 12px; }
.glosssec .linkrow { margin: 10px 0 12px; }

/* chapters from several sources */
.ch .srcs { display: inline-flex; gap: 6px; margin-right: 10px; }
.srcchip { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); cursor: pointer; white-space: nowrap; }
.srcchip.cur { border-color: var(--accent); color: var(--accent); }
.srcchip.off { opacity: .45; border-style: dashed; }
.srcchip:hover { border-color: var(--accent); }
.np-tools select { padding: 8px 10px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.srcswitch { display: flex; align-items: center; gap: 8px; margin: -6px 0 18px; }
.srcbtn { padding: 4px 12px; font-size: 13px; border-radius: 999px; }
.srcbtn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.genre { border-color: var(--accent); color: var(--accent); }
.srcfilter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.srcbtn.off { opacity: .5; border-style: dashed; }
@media (max-width: 760px) { .ch .srcs { display: none; } }

/* chapters that exist on the reader site but are not translated yet */
.ch.untranslated { opacity: .62; }
.ch.untranslated .tag { font-size: 12px; }
.ch.untranslated:hover { opacity: .9; }
.srcchip.none { border-style: dotted; }

/* the Ahead bar above a chapter: what is made ready after it */
.aheadbar { margin: -4px 0 14px; font-size: 13px; }
.ah-sum { padding: 3px 10px; border-radius: 999px; font-size: 13px; }
.ah-caret { color: var(--muted); }
.ah-panel { margin-top: 8px; padding: 10px 12px; display: grid; gap: 8px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.ah-row { display: grid; grid-template-columns: 190px 64px minmax(0, 1fr); align-items: center; gap: 4px 10px; cursor: default; }
.ah-row input[type=number] { width: 64px; padding: 4px 6px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; }
.ah-row input[type=number]:disabled { opacity: .45; }
.ah-name { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.ah-hint { font-size: 12px; line-height: 1.4; }
.ah-warn { margin: 0; font-size: 12px; line-height: 1.4; color: #c98a1a; }
@media (max-width: 600px) { .ah-row { grid-template-columns: 1fr 64px; } .ah-row .ah-hint { grid-column: 1 / -1; } }

/* glossary terms in the reader */
.termnote { font-size: 13px; margin: -6px 0 16px; }
/* a glossary term: always a link to its popup; how it looks is three switches (Display): bold, highlighted, coloured by where it comes from */
.reader .term { --th: var(--fg); cursor: pointer; border-radius: 3px; padding: 0 1px; }
.reader .term:hover, .reader .term:focus-visible { background: color-mix(in srgb, var(--th) 22%, transparent); outline: none; }
:root.t-bold .reader .term { font-weight: 650; }
:root.t-color .reader .term { --th: var(--tc, #4288c9); color: color-mix(in srgb, var(--tc, #4288c9) 70%, var(--fg)); }
:root.t-hl .reader .term { border-bottom: 2px solid color-mix(in srgb, var(--th) 55%, transparent); background: color-mix(in srgb, var(--th) 12%, transparent); }
:root.t-hl .reader .term:hover, :root.t-hl .reader .term:focus-visible { background: color-mix(in srgb, var(--th) 26%, transparent); }
.reader .term.novel { --tc: #4288c9; }
.reader .term.ai { --tc: #e08a2e; }
.reader .term.shared { --tc: #2f9e5c; }
.reader .term.gemini { --tc: #8a5cd6; }
.glang { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.reader .term.yours { --tc: #9456c4; }
.termpop { position: fixed; z-index: 20; width: 300px; max-width: calc(100vw - 16px); max-height: 70vh; overflow: auto; padding: 12px 14px; background: var(--card); color: var(--fg); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .35); font-size: 14px; }
.tp-block + .tp-block { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.tp-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tp-en { font-weight: 700; font-size: 16px; overflow-wrap: anywhere; }
.tp-src { font-size: 22px; margin: 4px 0 8px; }
.tp-label { font-size: 12px; margin-bottom: 4px; }
.tp-row { display: flex; gap: 10px; padding: 2px 0; }
.tp-row.cur { color: var(--accent); font-weight: 600; }
.tp-n { min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.tp-row.cur .tp-n { color: var(--accent); }
.tp-link { display: inline-block; margin-top: 8px; color: var(--accent); font-size: 13px; }
/* what a term can be shown as (wtr-lab's "To" chips): the one shown now is green, the translator's own is blue */
.tp-to { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; }
.tp-to > .muted { font-size: 12px; padding-top: 5px; }
.tp-chips { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.tp-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 3px 9px; font-size: 13px; border-radius: 6px; text-align: left; overflow-wrap: anywhere; }
.tp-chip .tp-n { min-width: 0; font-size: 12px; color: var(--muted); text-align: left; }
.tp-chip.on { background: #2f9e5c; border-color: transparent; color: #fff; font-weight: 600; }
.tp-chip.on .tp-n, .tp-chip.on .tp-tag { color: rgba(255, 255, 255, .85); }
.tp-chip.official { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.tp-chip.official.on { background: var(--accent); }
.tp-chip.busy { opacity: .6; }
.tp-tag { font-size: 11px; color: var(--muted); }
.tp-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.tp-src { font-size: 18px; }
/* where a term appears: the chapters it is in, each with the sentence of its first time there */
.tp-where { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.tp-where .tp-label { font-size: 13px; margin-bottom: 6px; }
.tp-places { display: grid; gap: 6px; }
.tp-place { display: block; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; color: inherit; text-decoration: none; font-size: 13px; }
.tp-place:hover { border-color: var(--accent); }
.tp-place.here { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.tp-ph { display: flex; justify-content: space-between; gap: 8px; }
.tp-pt { font-weight: 600; overflow-wrap: anywhere; }
.tp-ph .muted { white-space: nowrap; font-size: 12px; }
.tp-snip { margin-top: 2px; color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; }
.tp-snip b { color: var(--fg); }
.tp-more { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tp-links { display: flex; justify-content: space-between; gap: 10px; }
.tp-morelink { font-weight: 600; white-space: nowrap; }
/* a term's page: its notes, where it is mentioned, where it appears */
.termpage { max-width: var(--width); margin: 0 auto; }
.tm-head { margin: 10px 0 18px; }
.tm-src { font-size: 34px; line-height: 1.2; }
.tm-en { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 18px; margin: 4px 0; }
.tm-sec { margin-top: 16px; padding: 14px 16px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; }
.tm-sec.tp-where { margin-top: 16px; border-top: 1px solid var(--border); }
.tm-sec-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.tm-sec-head h3 { font-size: 16px; margin: 0; }
.tm-sec-head .muted { font-size: 13px; }
.tm-area { width: 100%; min-height: 150px; padding: 10px 12px; background: var(--bg); color: inherit; border: 1px solid var(--border); border-radius: 8px; font: inherit; font-size: 15px; line-height: 1.55; resize: vertical; }
.tm-area:focus { outline: none; border-color: var(--accent); }
.note-text { font-size: 15px; line-height: 1.6; }
.note-line { min-height: 1.6em; overflow-wrap: anywhere; }
.note-term { color: var(--accent); text-decoration: none; border-bottom: 1px dotted currentColor; }
.note-ch { color: var(--accent); text-decoration: none; font-size: 13px; }
.note-term:hover, .note-ch:hover { text-decoration: underline; }
.tm-mention + .tm-mention { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.tm-mention .note-text { margin-top: 2px; font-size: 14px; }
.tm-sec .tp-place { background: var(--bg); }
/* a term's page over the chapter ("More ›" in a term's popup) */
html.modal-open { overflow: hidden; }
.tmm-overlay { position: fixed; inset: 0; z-index: 30; overflow-y: auto; background: rgba(0, 0, 0, .55); padding: 4vh 16px; }
.tmm-dialog { max-width: 780px; margin: 0 auto; padding: 6px 22px 22px; background: var(--bg); color: var(--fg); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .45); }
.tmm-bar { position: sticky; top: -4vh; z-index: 1; display: flex; align-items: center; gap: 8px; margin: 0 -22px; padding: 8px 12px; background: var(--bg); border-bottom: 1px solid var(--border); border-radius: 14px 14px 0 0; }
.tmm-back, .tmm-x { background: none; border: none; font-size: 18px; color: var(--muted); }
.tmm-back:hover, .tmm-x:hover { color: var(--fg); }
.tmm-page { margin: 0; }
.tmm-body .tm-head { margin-top: 14px; }
@media (max-width: 600px) { .tmm-overlay { padding: 0; } .tmm-dialog { border-radius: 0; min-height: 100%; padding: 6px 14px 18px; } .tmm-bar { margin: 0 -14px; top: 0; border-radius: 0; } }
.reader .term.flash { animation: termflash 2.6s ease-out; }
@keyframes termflash { 0%, 40% { background: color-mix(in srgb, var(--tc, #4288c9) 70%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tc, #4288c9) 35%, transparent); } }

/* your own terms: select text, "+ Add Term" (as on wtr-lab) */
.reader .term.mine { --tc: #c4497a; }
:root.t-hl .reader .term.mine { border-bottom-style: dashed; }
.addterm { position: fixed; z-index: 21; padding: 6px 14px; border: none; border-radius: 999px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 600; box-shadow: 0 6px 18px rgba(0, 0, 0, .3); }
.addterm:hover { filter: brightness(1.08); }
.termedit { width: 360px; padding: 0 14px 12px; }
.te-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 -14px 10px; padding: 0 6px 0 8px; border-bottom: 1px solid var(--border); }
.te-tabs { display: flex; gap: 2px; }
.te-tab { background: none; border: none; border-bottom: 2px solid transparent; border-radius: 0; padding: 10px 8px 8px; color: var(--muted); font-size: 14px; }
.te-tab.on { color: var(--fg); border-bottom-color: var(--accent); }
.te-x { background: none; border: none; color: var(--muted); }
.te-form { display: grid; gap: 6px; }
.te-form input[type=text] { width: 100%; padding: 8px 11px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
.te-form input[type=text]:focus { outline: none; border-color: var(--accent); }
.te-label { display: flex; align-items: center; gap: 6px; font-size: 13px; margin-top: 4px; }
.te-label b { font-weight: 600; }
.te-label .te-small { margin-left: auto; }
.te-small { padding: 3px 9px; font-size: 12px; border-radius: 6px; }
.te-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }
.te-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.te-hint { font-size: 12px; line-height: 1.45; margin: 0; }
.te-status { font-size: 13px; color: #d84c4c; margin: 0; }
.te-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.te-grow { flex: 1; min-width: 0; }
.te-list { display: grid; gap: 8px; }
.te-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; font-size: 13px; overflow-wrap: anywhere; }
.te-where { font-size: 12px; margin-top: 2px; }
@media (max-width: 600px) {
  .termedit { left: 8px; right: 8px; bottom: 8px; width: auto; max-width: none; max-height: 75vh; }
}
.ch a.tag { color: var(--muted); text-decoration: underline; margin-left: 8px; }
.ch a.tag:hover { color: inherit; }
.actions { display: flex; gap: 12px; align-items: center; margin: 16px 0; }

/* Activity (activity.js): laid out as a novel's page; its rows as the Table of Contents' */
#view > h3 { margin: 14px 0 4px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--bg); border: 1px solid var(--border); color: var(--muted); }
.pill.ok { color: #2f9e5c; border-color: color-mix(in srgb, #2f9e5c 45%, transparent); background: color-mix(in srgb, #2f9e5c 12%, transparent); }
.pill.fail { color: #d84c4c; border-color: color-mix(in srgb, #d84c4c 45%, transparent); background: color-mix(in srgb, #d84c4c 12%, transparent); }
.pill.work { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
/* the library shown, in a library's head: a heading that opens the list of libraries */
.lib-switch { font: inherit; font-size: 1.35em; font-weight: 700; color: inherit; background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 2px 6px; margin-right: 6px; max-width: 100%; cursor: pointer; }
.lib-switch:hover, .lib-switch:focus { border-color: var(--border); }
.lib-add, .lib-said { margin: 0 0 12px; }
/* a library's head: the switcher on the left, Follow ▾ and Share on the right */
.library.followed .lib-head { margin-bottom: 6px; }
.lib-actions { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.ico { width: 17px; height: 17px; flex: none; }
.lib-split { display: inline-flex; border-radius: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.lib-split > button { display: inline-flex; align-items: center; gap: 7px; margin: 0; height: 38px; border-radius: 0; background: var(--accent); color: #fff; border: 1px solid transparent; font-weight: 600; }
.lib-split > .lib-follow { border-radius: 10px 0 0 10px; padding: 0 14px 0 12px; }
.lib-split > .lib-more { border-radius: 0 10px 10px 0; padding: 0 9px; border-left: 1px solid rgba(255,255,255,.28); }
.lib-split > button:hover { filter: brightness(1.08); }
.lib-split.on > button { background: var(--card); color: var(--fg); border-color: var(--border); font-weight: 500; }
.lib-split.on > .lib-follow .ico { color: var(--accent); }
.lib-split.on > .lib-more { border-left-color: var(--border); }
.lib-split.on > button:hover { border-color: var(--accent); filter: none; }
.lib-share { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px 0 12px; border-radius: 10px; }
.lib-followbox { position: relative; display: inline-flex; align-items: center; }
.lib-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; width: 300px; max-width: calc(100vw - 32px); display: flex; flex-direction: column; padding: 6px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.28); animation: libMenuIn .12s ease-out; }
.lib-menu[hidden] { display: none; }
@keyframes libMenuIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.lib-item { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; border: none; background: transparent; padding: 9px 10px; margin: 0; border-radius: 8px; color: var(--fg); font: inherit; cursor: pointer; text-decoration: none; }
.lib-item:hover, .lib-item:focus-visible { background: var(--card); outline: none; }
.lib-item > .ico { color: var(--muted); }
.lib-item.on > .ico:first-child, .lib-item:hover > .ico:first-child { color: var(--accent); }
.lib-item-t { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.lib-item-t b { font-weight: 600; font-size: 14.5px; }
.lib-item-t small { color: var(--muted); font-size: 12.5px; }
.lib-item-on { color: var(--accent); }
.lib-menu-sep { height: 1px; background: var(--border); margin: 5px 6px; }
.lib-note { margin-left: 8px; font-size: 13px; }
/* under the title: novels and connection; then what this device does with it */
.lib-sub { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; margin: 0 0 14px 8px; }
.lib-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); opacity: .6; flex: none; }
.lib-dot.live { background: #3fb871; opacity: 1; box-shadow: 0 0 0 3px rgba(63,184,113,.18); }
/* "● 4 online" beside a library's name */
.lib-online { display: inline-flex; align-items: center; gap: 7px; flex: none; height: 30px; padding: 0 11px 0 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); font-size: 13px; color: var(--muted); cursor: default; }
.lib-online b { color: var(--fg); font-size: 14px; font-variant-numeric: tabular-nums; }
.lib-online-sub { display: none; height: 24px; padding: 0 9px 0 8px; font-size: 12.5px; }
@media (max-width: 640px) { .lib-titlerow .lib-online { display: none; } .lib-online-sub:not([hidden]) { display: inline-flex; } }
.lib-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 16px; }
.lib-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; padding: 6px 11px; border-radius: 999px; background: var(--card); border: 1px solid var(--border); color: var(--fg); }
.lib-chip .ico { width: 15px; height: 15px; color: var(--muted); }
.lib-chip.on { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.lib-chip.on .ico, .lib-chip.busy .ico { color: var(--accent); }
.lib-chip.warn .ico { color: #d9a23a; }
.lib-bar { display: inline-block; width: 70px; height: 5px; border-radius: 3px; background: var(--border); overflow: hidden; }
.lib-bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s; }
.lib-choose { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin: 0 0 18px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 18px; }
.lib-choose-h { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.lib-choose-row { display: flex; align-items: center; gap: 9px; padding: 6px 4px; border-radius: 6px; cursor: pointer; }
.lib-choose-row:hover { background: var(--bg); }
.lib-choose-row .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-choose-row input { accent-color: var(--accent); width: 16px; height: 16px; }
@media (max-width: 640px) {
  .lib-actions { margin-left: 0; width: 100%; }
  .lib-menu { left: 0; right: auto; }
  .lib-sub { margin-left: 2px; }
}
.faq-item { border-bottom: 1px solid var(--border); padding: 10px 2px; }
.faq-item summary { cursor: pointer; font-weight: 600; }
.faq-item p { margin: 8px 0 2px; color: var(--muted); line-height: 1.5; }
.lib-said input { flex: 1; min-width: 0; }
.pill.direct { color: #9456c4; border-color: color-mix(in srgb, #9456c4 45%, transparent); }
.more { display: inline-block; margin-top: 8px; font-size: 13px; color: var(--accent); }
.act-row { display: grid; grid-template-columns: 4.2em minmax(0, 1fr) auto; grid-template-areas: "time body result"; align-items: start; cursor: default; gap: 4px 12px; }
.act-row .act-time { grid-area: time; min-width: 0; padding-top: 2px; }
.act-body { grid-area: body; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.act-row > .pill { grid-area: result; }
.act-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; }
.act-t a.chlink:hover { color: var(--accent); text-decoration: underline; }
.act-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 12.5px; color: var(--muted); }
.act-meta .act-novel { color: var(--fg); opacity: .85; }
.act-meta .act-lib.followed { color: var(--accent); }
.act-meta .act-err { color: #d84c4c; }
.act-running { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.act-tools select { max-width: 200px; font-size: 14px; }
.act-count { margin: 0 0 10px; display: flex; align-items: center; gap: 10px; }
.act-count .act-reset { padding: 3px 10px; font-size: 12.5px; }
.activity .tocgroups + .tocgroups { margin-top: 8px; }
.activity .tocgroups:empty { display: none; }
.activity .lstats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.act-upcoming .act-time { color: var(--accent); }
@media (max-width: 600px) { /* the time and how it went on one line, what it was under them; two menus a row; the figures 3 and 2 */
  .activity .lstats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .activity .lstats > * { grid-column: span 2; }
  .activity .lstats > :nth-child(n+4) { grid-column: span 3; }
  .act-tools select { flex: 1 1 40%; min-width: 0; width: 40%; max-width: none; }
  .act-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "time result" "body body"; }
  .act-t { white-space: normal; }
}
.rawtoggle { font-size: 13px; padding: 4px 12px; margin: 0 6px 12px 0; }
.rawnote { margin-left: 4px; }
.rawbox p { color: var(--fg); }
a.rawtoggle { display: inline-block; background: var(--card); border: 1px solid var(--border); border-radius: 8px; color: var(--fg); line-height: 1.4; cursor: pointer; }
a.rawtoggle:hover { border-color: var(--accent); }

/* New chapters tab */
.watchpanel { display: grid; gap: 10px; margin-top: 10px; }
.watchrow { display: grid; gap: 6px; padding: 12px 14px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.watchname { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.watchname input { width: 18px; height: 18px; accent-color: var(--accent); }
.watchsched { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.watchsched select, .watchsched input[type=time] { max-width: 100%; padding: 5px 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; }
.notice { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.notice.unseen { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.notice a { color: var(--accent); white-space: nowrap; }
.weekdays { display: inline-flex; gap: 3px; }
.daychip { width: 28px; height: 28px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: var(--bg); color: var(--muted, inherit); font-size: 12px; cursor: pointer; }
.daychip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.watchsched .sidebtn { width: auto; padding: 5px 12px; }

/* the novel page's Triggers tab: each trigger a card, its lines as the Details table; and Activity › Upcoming */
.trigbox { display: grid; gap: 10px; }
.trigbox > p { margin: 0; }
.trigbox > .np-sh { margin-bottom: 0; }
.watchrow.trig { gap: 10px; }
.watchrow.trig .watchname b { flex: 1; min-width: 0; }
.watchrow.trig > div:last-child:not(.np-details) .linkbtn, .trigbox > p .linkbtn { padding: 0; font-size: 13.5px; }
.trig-rows .np-drow { grid-template-columns: 110px minmax(0, 1fr); padding: 8px 12px; }
.trig-ext { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; }
.trig-now { padding: 10px 14px; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 8%, transparent); border-radius: 10px; font-size: 14px; }
.trig-now a { color: var(--accent); white-space: nowrap; }
/* the extension reloaded under this page: its link to it is gone until the page is reloaded */
.stale-ext { position: sticky; top: 0; z-index: 60; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px; padding: 10px 16px; background: color-mix(in srgb, #c98a14 22%, var(--card)); border-bottom: 1px solid color-mix(in srgb, #c98a14 55%, transparent); color: var(--fg); font-size: 14px; }
.stale-ext button { width: auto; padding: 6px 14px; }
.trig-paused { margin-top: 6px; color: #c98a14; }
.trig-paused a, .trig-paused .linkbtn { color: var(--accent); padding: 0; font-size: inherit; }
.pill.wait { color: #c98a14; border-color: color-mix(in srgb, #c98a14 45%, transparent); background: color-mix(in srgb, #c98a14 12%, transparent); }
.np-tabs.np-tabs5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 760px) {
  .np-tabs.np-tabs5 { grid-template-columns: repeat(6, minmax(0, 1fr)); } /* About and Table of Contents, then the other three */
  .np-tabs.np-tabs5 button { grid-column: span 2; }
  .np-tabs.np-tabs5 button:nth-child(-n+2) { grid-column: span 3; }
  .trig-rows .np-drow { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

.mergebox { min-width: 0; margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.mergebox h4 { margin: 4px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.mergebox select { width: 100%; min-width: 0; text-overflow: ellipsis; padding: 8px 10px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; color: var(--fg); max-width: 100%; }
.mergepart { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.partname { flex: 1; min-width: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); color: var(--fg); }
.partname.on { border-color: var(--accent); }
.partname.hid { opacity: .5; text-decoration: line-through; cursor: default; }
.mergepart .linkbtn { flex: none; }
.mergesuggest { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--accent); border-radius: 10px; font-size: 13px; }

/* search: the box in the header and the matches it lists */
#find { position: relative; flex: 0 1 300px; min-width: 130px; }
#findBox { width: 100%; padding: 7px 12px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
#findBox:focus { outline: none; border-color: var(--accent); }
#findList { position: absolute; top: calc(100% + 8px); left: 0; z-index: 10; width: min(400px, calc(100vw - 32px)); max-height: 72vh; overflow-y: auto; background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .35); }
.findrow { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.findrow:hover, .findrow.on, .findmore:hover, .findmore.on { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.findrow .bookcover { border-radius: 5px; }
.findrow .bookcover .ph { padding: 0; font-size: 0; }
.findname { display: grid; gap: 2px; min-width: 0; }
.findname b, .findname .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.findname b { font-size: 14px; font-weight: 600; }
.findmore { display: block; padding: 11px 12px; text-align: center; font-size: 14px; }
@media (max-width: 760px) { /* no room beside the links: the search button opens the box, in a row of its own under them */
  #find { display: none; position: absolute; left: 16px; right: 16px; bottom: 9px; min-width: 0; }
  #bar.find-open { padding-bottom: 56px; }
  #bar.find-open #find { display: block; }
  #findList { width: 100%; }
}

/* the Novel Finder: the box and the library to look in, then the novels found as cards */
main[data-route="search"] { max-width: 1280px; }
.finder h2 { margin: 0 0 14px; font-size: 20px; }
.finder-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.finder-bar input { flex: 1 1 280px; min-width: 0; padding: 10px 12px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.finder-bar input:focus { border-color: var(--accent); outline: none; }
.finder-bar select { flex: 0 1 240px; min-width: 0; padding: 10px 12px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.finder .books { margin-top: 14px; }
.booksub { margin-top: 3px; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin: 12px 0; }
.pr .pr-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--border); }
.pr .pr-item:first-of-type { border-top: 0; }
.pr .pr-item pre { white-space: pre-wrap; margin: 4px 0 0; font: inherit; font-size: 13px; color: var(--muted); max-height: 8em; overflow: auto; }
.pr textarea { width: 100%; min-height: 4em; padding: 8px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
.lib-head button { padding: 9px 14px; border-radius: 10px; }


/* the reader's footer (app.js): tap the text for it, as on wtr-lab */
#readFoot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; width: min(100%, calc(var(--width) + 32px)); margin: 0 auto; /* the reader's own width, as on wtr-lab */ background: var(--card); border-top: 1px solid var(--border); box-shadow: 0 -8px 24px rgba(0, 0, 0, .25); transform: translateY(calc(100% + 40px)); transition: transform .2s ease; padding-bottom: env(safe-area-inset-bottom); }
#readFoot.open { transform: none; }
body.rf-open main { padding-bottom: 380px; } /* the end of the chapter can still be scrolled above it */
.rf-hide { position: absolute; top: -30px; left: 50%; transform: translateX(-50%); width: 58px; height: 30px; padding: 0; display: grid; place-items: center; background: var(--card); border: 1px solid var(--border); border-bottom: 0; border-radius: 10px 10px 0 0; color: var(--fg); }
.rf-hide svg { width: 20px; height: 20px; }
.rf-inner { max-height: min(52vh, 460px); overflow-y: auto; }
@media (min-width: 761px) {
  #readFoot { border: 1px solid var(--border); border-bottom: 0; border-radius: 12px 12px 0 0; }
  .rf-body { gap: 10px; padding: 10px 12px; }
  .rf-card { min-height: 46px; font-size: 14px; }
  .rf-tabs button { padding: 6px 4px 7px; font-size: 11px; }
  .rf-tabs button svg { width: 18px; height: 18px; }
}
.rf-body { display: grid; gap: 12px; padding: 12px 16px; }
.rf-body .nav { margin: 0; }
.rf-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.rf-card { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 8px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; color: var(--fg); font-size: 15px; text-align: center; }
.rf-card svg { width: 20px; height: 20px; flex: none; }
.rf-novel { justify-content: flex-start; text-align: left; padding: 6px 10px 6px 6px; min-width: 0; }
.rf-thumb { width: 34px; flex: none; }
.rf-thumb .bookcover { border-radius: 5px; }
.rf-thumb .bookcover .ph { padding: 0; font-size: 0; }
.rf-nname { display: grid; min-width: 0; flex: 1; line-height: 1.25; }
.rf-nname small { font-size: 10px; letter-spacing: .08em; color: var(--muted); }
.rf-nname b { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rf-go { color: var(--muted); font-size: 22px; }
.rf-row { display: grid; gap: 6px; }
.rf-label { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.rf-langbox { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rf-lang { min-width: 200px; max-width: 100%; padding: 8px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; font: inherit; }
.langbanner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); }
.rf-link { color: var(--accent); font-size: 14px; }
.rf-body .aheadbar { margin: 0; }
/* the Settings tab's Ahead panel: a list of rows like a novel's details, a switch and a number on each */
.rf-body .ah-panel { margin: 0; padding: 0; gap: 0; background: transparent; }
.rf-body .ah-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 11px 14px; border-top: 1px solid var(--border); }
.rf-body .ah-row:first-child { border-top: 0; }
.rf-body .ah-row .ah-hint { grid-column: 1 / -1; grid-row: 2; }
.rf-body .ah-name { gap: 10px; font-size: 14px; font-weight: 500; }
.rf-body .ah-row input[type=number] { width: 64px; padding: 7px 6px; text-align: center; font-size: 14px; border-radius: 8px; }
.rf-body .ah-name input[type=checkbox] { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 34px; height: 20px; margin: 0; background: var(--border); border-radius: 999px; cursor: pointer; transition: background .15s; }
.rf-body .ah-name input[type=checkbox]::before { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform .15s; }
.rf-body .ah-name input[type=checkbox]:checked { background: var(--accent); }
.rf-body .ah-name input[type=checkbox]:checked::before { transform: translateX(14px); }
.rf-body .ah-name input[type=checkbox]:disabled { opacity: .5; cursor: default; }
.rf-body .ah-panel > .ah-hint, .rf-body .ah-warn { padding: 10px 14px; border-top: 1px solid var(--border); }
.rf-body .ah-panel > .ah-hint:empty { display: none; }
.rf-allset { justify-content: space-between; min-height: 46px; padding: 8px 14px; font-size: 14px; }
.rf-allset:hover { border-color: var(--accent); }
.seg { display: flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.seg button { flex: 1; min-width: 0; padding: 9px 6px; background: var(--bg); border: 0; border-left: 1px solid var(--border); border-radius: 0; color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg button:first-child { border-left: 0; }
.seg button.on { background: var(--card); color: var(--fg); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.rf-tabs { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--border); }
.rf-tabs button { display: grid; justify-items: center; gap: 3px; padding: 8px 4px 9px; background: transparent; border: 0; border-top: 2px solid transparent; border-radius: 0; color: var(--muted); font-size: 12px; }
.rf-tabs button svg { width: 22px; height: 22px; }
.rf-tabs button.on { color: var(--fg); border-top-color: var(--accent); background: var(--bg); }
/* the chapter's sources: a segmented control, as in Display */
.rf-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.rf-tools .rawtoggle { display: flex; align-items: center; justify-content: center; min-height: 46px; margin: 0; padding: 8px 12px; font-size: 14px; text-align: center; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; color: var(--fg); }
.rf-tools .rawtoggle:disabled { opacity: .55; }
.rf-tools .rawnote { grid-column: 1 / -1; margin: 0; }
.rf-tools .rawnote:empty { display: none; }

/* a chapter's table of contents (app.js openToc): a drawer from the left, as on wtr-lab */
#toc { position: fixed; inset: 0; z-index: 40; }
.toc-shade { position: absolute; inset: 0; background: rgba(0, 0, 0, .5); }
.toc-panel { position: absolute; top: 0; left: 0; bottom: 0; width: min(420px, 88vw); display: flex; flex-direction: column; background: var(--card); border-right: 1px solid var(--border); box-shadow: 12px 0 32px rgba(0, 0, 0, .35); padding-top: env(safe-area-inset-top); }
.toc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.toc-head b { font-size: 20px; }
.toc-x { font-size: 18px; background: transparent; border: 0; }
.toc-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding-bottom: env(safe-area-inset-bottom); }
.toc-row { display: grid; gap: 3px; width: 100%; padding: 12px 16px; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; color: var(--fg); }
.toc-row:hover { background: var(--bg); }
.toc-t { font-size: 15px; line-height: 1.35; }
.toc-d { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.toc-row.read .toc-t { color: var(--muted); }
.toc-row.off .toc-t { color: var(--muted); font-style: italic; }
.toc-row.on { background: color-mix(in srgb, var(--accent) 12%, transparent); box-shadow: inset 3px 0 0 var(--accent); }
.toc-row.on .toc-t { color: var(--accent); }
.lib-more { text-align: center; margin: 22px 0 8px; }

/* ---------- a novel's page, as on wtr-lab: a column of cards ---------- */
main[data-route="novel"], main[data-route="followBook"] { max-width: 800px; }
.np { display: grid; gap: 12px; }
.np-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; min-width: 0; }
.np-titlebar { margin-bottom: 10px; }
.np .np-title { font-size: 21px; line-height: 1.25; margin: 0; text-transform: uppercase; letter-spacing: .01em; overflow-wrap: anywhere; }
.np-raw { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.np-top { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 12px; align-items: stretch; }
.np-top .cover { border-radius: 8px; width: 100%; align-self: start; }
.np-right { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.np-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.np-stat { display: grid; justify-items: center; gap: 2px; padding: 7px 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; min-width: 0; }
.np-stat span { font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.np-stat b { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.np-stat.done b { color: #e5534b; }
.np-stat.done b::before { content: "● "; font-size: 10px; vertical-align: 2px; }
.np-stat.going b { color: #3fb950; }
.np-ctas { display: grid; gap: 8px; margin-top: auto; }
.np-cta-extra:empty { display: none; }
.np-cta2 { width: 100%; padding: 9px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
.np-read { display: grid; justify-items: center; gap: 1px; width: 100%; padding: 9px 12px; background: transparent; border: 1px solid var(--accent); border-radius: 8px; color: var(--accent); }
.np-read b { font-weight: 500; font-size: 15px; }
.np-read small { font-size: 12px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-read:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.np-read:disabled { border-color: var(--border); color: var(--muted); }
.np-chips { margin: 12px 0 0; gap: 6px; }
.np-chips .chip { font-size: 12px; padding: 3px 9px; border-radius: 6px; }
.np-progress .np-prog-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.np-prog-label { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.np-prog-n { color: var(--muted); }
.np-prog-n b { font-size: 22px; color: var(--accent); }
.np-bar { height: 6px; margin: 8px 0; background: var(--bg); border-radius: 3px; overflow: hidden; }
.np-bar i { display: block; height: 100%; background: #3fb950; border-radius: 3px; }
.np-progress .muted { font-size: 12px; }
.np-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 4px; background: var(--bg); border-radius: 10px; margin-bottom: 6px; }
.np-tabs button { padding: 9px 6px; background: transparent; border: 1px solid transparent; border-radius: 8px; color: var(--muted); font-size: 14px; }
.np-tabs button.on { background: var(--card); border-color: var(--border); color: var(--fg); }
.np-pane { min-width: 0; }
.np-sh { margin: 18px 0 10px; padding-left: 10px; border-left: 3px solid var(--accent); font-size: 17px; font-weight: 600; }
.np-pane > .np-sh:first-child { margin-top: 12px; }
.np .synopsis { padding: 0; border: 0; }
.np .synopsis p { margin: 0 0 10px; line-height: 1.6; color: color-mix(in srgb, var(--fg) 85%, var(--muted)); }
.np .synopsis.clamp { max-height: 9.6em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.np-more { margin: 2px 0 0; text-decoration: underline; }
.np-details { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.np-drow { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; padding: 11px 14px; border-top: 1px solid var(--border); align-items: center; }
.np-drow:first-child { border-top: 0; }
.np-dk { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.np-dk span { font-weight: 400; margin-left: 2px; }
.np-dv { font-size: 14px; overflow-wrap: anywhere; }
.np-tgroup { display: grid; gap: 8px; padding: 11px 14px; border-top: 1px solid var(--border); }
.np-tgroup:first-child { border-top: 0; }
.np-tgroup .chips { margin: 0; gap: 6px; }
.np-tgroup .chip { font-size: 12px; padding: 2px 8px; border-radius: 6px; }
.np .mergebox { margin-top: 14px; }
.np .np-tools { margin-top: 4px; }
.tocgroups { display: grid; gap: 8px; }
.tocgrp { border: 1px solid var(--border); border-radius: 10px; background: var(--bg); overflow: hidden; }
.tocgrp > summary { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 13px 16px; cursor: pointer; list-style: none; font-size: 15px; }
.tocgrp > summary::-webkit-details-marker { display: none; }
.tocgrp[open] > summary { border-bottom: 1px solid var(--border); }
.tocgrp .chlist { margin: 0; border: 0; border-radius: 0; }
.np-pane > .chlist { margin-top: 0; }
@media (max-width: 760px) {
  .np-card { padding: 10px; }
  .np .np-title { font-size: 18px; }
  .np-top { grid-template-columns: minmax(0, 40%) minmax(0, 1fr); gap: 10px; }
  .np-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .np-stat { padding: 6px 2px; }
  .np-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .np-chips::-webkit-scrollbar { display: none; }
  .np-chips .chip { flex: none; }
  .np-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .np-drow { grid-template-columns: minmax(0, 1fr); gap: 4px; }
}
.np-pane .sidebtns { display: flex; flex-wrap: wrap; gap: 8px; }
.np-pane .sidebtns .sidebtn { width: auto; padding: 7px 12px; font-size: 14px; }
/* the head's buttons: Refresh details, Share novel and its stop over Continue Reading and clear history */
.np-ctarow { display: flex; flex-wrap: wrap; gap: 6px; }
.np-share { display: contents; }
.np-cbtn { flex: 1 1 0; min-width: 0; padding: 8px 10px; font-size: 13px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
.np-cbtn.bad { color: #e5534b; }
.np-cnote { margin: 0; font-size: 12px; overflow-wrap: anywhere; }
.np-ibtn { flex: none; width: 40px; padding: 0; display: grid; place-items: center; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; color: var(--fg); }
.np-ibtn svg { width: 18px; height: 18px; }
.np-ibtn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.np-ibtn:disabled { color: var(--muted); }
.np-share .muted { flex-basis: 100%; font-size: 12px; overflow-wrap: anywhere; }
.np-readrow { display: flex; gap: 6px; }
.np-readrow .np-read { flex: 1; min-width: 0; }
.np-readrow .np-ibtn { width: 48px; }
@media (max-width: 760px) { /* the buttons get the whole width, under the cover and the figures */
  .np-right { display: contents; }
  .np-ctas { grid-column: 1 / -1; }
}
/* where a novel is from, on its cover */
.b-src { position: absolute; z-index: 2; top: 6px; left: 6px; max-width: calc(100% - 12px); padding: 3px 6px; border-radius: 4px; background: rgba(0, 0, 0, .72); color: #fff; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-src.wtr { background: #4f6bed; }
/* a shared novel's page while its details come: who it is asked of */
.np-wait { display: grid; justify-items: center; gap: 10px; max-width: 460px; margin: 14vh auto 0; text-align: center; }
.np-wait h2 { margin: 6px 0 0; font-size: 20px; }
.np-wait p { margin: 0; line-height: 1.55; }
.np-wait .np-cta2 { width: auto; padding: 9px 22px; margin-top: 6px; }
.np-spin { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: np-spin .9s linear infinite; }
@keyframes np-spin { to { transform: rotate(360deg); } }
.np-tabs.np-tabs2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lib-menu > .lib-item { padding: 9px 12px; }
.flash-note { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 10px; background: var(--card); color: var(--fg); border: 1px solid var(--border); box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: libMenuIn .15s ease-out; }

/* uploaded EPUBs: the tag beside the raw title, on the card, and what the latest uploads did */
.np-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.np-sub .np-raw { margin: 0; }
.chip.uptag { font-size: 11.5px; padding: 2px 8px; color: #c58a1a; border-color: #c58a1a; background: transparent; font-weight: 600; }
.b-src.up { background: #a8730f; }
.upnotes:empty { display: none; }
.upnotes { margin: -8px 0 14px; }
.upnotes p { margin: 2px 0; }
.empty .lib-head { justify-content: center; }

/* a novel's Download tab: the novel as an EPUB (the pieces of About and the Table of Contents: bars as Reading progress, a details table, rows) */
.dlbox { display: grid; gap: 12px; }
.dlbox > .np-sh { margin-bottom: 0; }
.dlbars { display: grid; gap: 14px; }
.dlbar .np-prog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.dlbar.grey { opacity: .45; filter: grayscale(1); }
.dlbarside { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.dlwhen { font-size: 12px; white-space: nowrap; }
.dlrefresh { width: 26px; height: 26px; padding: 0; border-radius: 7px; font-size: 14px; line-height: 1; flex: none; }
.dlspan { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.dlnum { width: 92px; flex: none; padding: 6px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; color: inherit; }
.dlnum:disabled { opacity: .55; }
.dlname { flex: 1; min-width: 160px; padding: 6px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; color: inherit; }
.dlswitch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.dlswitch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.dlswitch i { position: relative; width: 36px; height: 20px; flex: none; border-radius: 10px; background: var(--border); transition: background .15s; }
.dlswitch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.dlswitch input:checked + i { background: var(--accent); }
.dlswitch input:checked + i::after { transform: translateX(16px); }
.dlswitch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.dlswitch.off { opacity: .45; cursor: default; }
.dlhint { display: block; margin-top: 4px; font-size: 13px; }
.dlnotes { display: grid; gap: 4px; padding: 10px 14px; border-top: 1px solid var(--border); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.dlnotes p { margin: 0; font-size: 13px; }
.dlnotes p::before { content: "• "; color: var(--accent); }
.dlgo { padding: 12px; }
.dlgo:not(:disabled) { background: var(--accent); color: #fff; }
.dlgo:not(:disabled) small { color: rgba(255,255,255,.85); }
.dlgo:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, #000); }
.dljob { display: grid; gap: 10px; }
.dljob p { margin: 0; font-size: 13px; }
.dlagain { margin-top: 2px; }
.setnum { width: 90px; padding: 6px 10px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; }
@media (max-width: 560px) {
  .dlbox .np-drow { grid-template-columns: 1fr; gap: 6px; }
  .dlbar .np-prog-head { flex-wrap: wrap; }
}
.setnumrow { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.setstack { display: grid; gap: 28px; }
.setpromptlabel { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.setpromptlabel b { margin-right: 4px; }
.setpromptpick { flex: 1; min-width: 160px; max-width: 320px; padding: 5px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; }
.setpromptnaming { display: flex; align-items: center; gap: 8px; }
.setpromptnaming[hidden] { display: none; }
.setpromptname { flex: 1; max-width: 320px; padding: 6px 9px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; }
.setprompt { width: 100%; min-height: 8em; padding: 8px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; font: 13px/1.5 ui-monospace, Consolas, monospace; resize: vertical; }
/* Libraries (manage), as a novel's page: a head card with tiles, then tabs and the libraries as the Table of Contents' groups */
main[data-route="following"] { max-width: 860px; }
.manage .mstats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.manage .madd { margin-top: 12px; }
.manage .madd input { flex: 1; min-width: 0; }
.mlib { overflow: visible; }
.mlib > summary { padding: 11px 12px 11px 16px; }
.mlib.mine { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.mlib[open] > .chlist { border-radius: 0 0 10px 10px; overflow: hidden; }
.mlib-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.mlib-name a { color: inherit; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mlib-name a:hover { color: var(--accent); }
.mlib-name small { font-size: 12px; }
.mnums { display: grid; grid-template-columns: 52px 112px 58px 66px 50px; gap: 10px; flex: none; }
.mnum { display: grid; gap: 1px; min-width: 0; text-align: right; }
.mnum .np-dk { font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } /* (a label never runs into the next) */
.mnum b { font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mnum.on b { color: #3fb950; }
.mlib-more { position: relative; flex: none; }
.mlib-dots { margin: 0; padding: 2px 8px; font-size: 18px; line-height: 1.2; background: transparent; border: 1px solid transparent; border-radius: 8px; color: var(--muted); }
.mlib-dots:hover { border-color: var(--border); color: var(--fg); }
.mlib .mlib-menu { width: 190px; left: auto; right: 0; } /* (under its ⋯, on a phone too) */
.mlib-menu .lib-item.danger b { color: #d84c4c; }
/* (a long title is cut short, never widening the library: a grid item and a flex row keep to their box) */
.manage .tocgroups > .mlib, .mlib > .chlist, .mlib > summary { min-width: 0; }
.mbook { color: inherit; text-decoration: none; padding-left: 16px; min-width: 0; }
.mbook .t { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mbook .mnums { margin-right: 42px; }
.mbook .mnum b { font-size: 13px; font-weight: 500; }
.manage .mnote { font-size: 12.5px; margin: 10px 0 0; }
@media (max-width: 640px) {
  /* a library: its name and ⋯ on one line, its numbers under them; a novel the same */
  .manage .mstats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mlib > summary { flex-wrap: wrap; gap: 8px 10px; padding: 10px 10px 10px 12px; }
  .mlib > summary .mnums { order: 3; width: 100%; }
  .mnums { grid-template-columns: minmax(0, .8fr) minmax(0, 1.7fr) minmax(0, .9fr) minmax(0, 1fr) minmax(0, .8fr); gap: 6px; }
  .mnum { text-align: left; }
  .mbook { flex-wrap: wrap; gap: 6px; padding-left: 12px; }
  .mbook .t { flex-basis: 100%; }
  .mbook .mnums { width: 100%; margin-right: 0; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.6fr) minmax(0, .9fr) minmax(0, 1fr) minmax(0, .8fr); } /* (a novel's first number is Chapters, wider than Novels) */
}
/* Your library's page, as a novel's page: the head card (the library shown, its figures, Share and Upload), Continue reading, the tabs */
.lib-home .np-titlebar .lib-switch { margin-left: -6px; font-size: 21px; text-transform: uppercase; letter-spacing: .01em; }
.lib-home .np-sub { margin: 2px 0 0; }
.lib-home .lstats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.lib-home .lib-head { margin: 10px 0 0; }
.lib-home .lib-said { margin: 8px 0 0; }
.lib-home .np-tools { margin-bottom: 14px; }
.lib-cont-title { display: block; margin: 6px 0 0; color: inherit; font-size: 17px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-cont-title:hover { color: var(--accent); }
.lib-cont-read { margin-top: 4px; text-decoration: none; }
.lib-home .chlist a.ch { color: inherit; text-decoration: none; }
.lib-home .chlist .ch .t { min-width: 0; }
.lib-home .chlist .ch .tag { flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-aboutbtns { margin-top: 12px; }
a.np-cta2 { display: block; text-align: center; color: inherit; text-decoration: none; }
a.np-cta2:hover { border-color: var(--accent); }
@media (max-width: 640px) {
  .lib-home .lstats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lib-home .books { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
}
/* the library switch: a name and ▾ that opens a menu of the libraries (as Follow ▾ does) */
.lib-switchbox { position: relative; display: inline-flex; min-width: 0; max-width: 100%; flex: 0 1 auto; }
.lib-switch { display: inline-flex; align-items: center; gap: 6px; min-width: 0; text-align: left; }
.lib-switch-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-switch > .ico { width: 18px; height: 18px; color: var(--muted); }
.lib-switch[aria-expanded="true"] { border-color: var(--border); }
.lib-switch-menu { left: 0; right: auto; width: 300px; }
.lib-switch-menu .lib-item-t b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* your library's title row: the switch, then pull requests waiting and Share on the right (on a phone too) */
.lib-home .lib-titlerow { margin: 0; flex-wrap: nowrap; }
.lib-home .lib-titlerow .lib-actions { width: auto; margin-left: auto; flex: none; }
.lib-home .lib-add { margin: 8px 0 0; }
.lib-prs { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: inherit; text-decoration: none; font-size: 14px; }
.lib-prs[hidden] { display: none; }
.lib-prs:hover { border-color: var(--accent); }
.lib-prs b { min-width: 20px; padding: 1px 7px; border-radius: 999px; background: var(--bg); color: var(--muted); font-size: 12px; text-align: center; }
.lib-prs.waiting b { background: var(--accent); color: #fff; }
@media (max-width: 640px) {
  .lib-home .lib-titlerow .lib-share span, .lib-prs > span { display: none; } /* (their icon and count only: the name keeps the room) */
  .lib-home .lib-titlerow .lib-share { padding: 0 11px; }
  .lib-prs::before { content: "PR"; font-size: 12px; font-weight: 700; color: var(--muted); }
}
/* a library you follow, laid out as yours: its head card has Follow ▾ and Share on the title row, then whether it is online, its tiles, its chips */
.lib-home .lib-sub { margin: 2px 0 0; }
.lib-home .lib-chips { margin: 12px 0 0; }
.lib-home .np-titlebar .np-title { font-size: 21px; }
.lib-home.followed .lib-choose { margin: 0; }
.bookcard[hidden] { display: none; }
@media (max-width: 640px) {
  .lib-home .lib-titlerow .lib-follow span { display: none; } /* (Follow ▾ as its icon: the library's name keeps the room) */
  .lib-home .lib-titlerow .lib-split > .lib-follow { padding: 0 10px; }
  .lib-home .lib-titlerow .lib-actions { gap: 6px; }
}
@media (max-width: 640px) { .lib-home .np-titlebar .lib-switch { font-size: 18px; } }
/* the EPUB upload queue, in the Novels tab: how far it is, the counts, Pause / Stop */
.upq { margin: 0 0 14px; background: var(--bg); }
.upq[hidden] { display: none; }
.upq-now { margin: 4px 0 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upq .np-ctarow { margin-top: 2px; }
/* limits: a number of GB in a sentence (Settings › Library, a library's Limits…) */
.gbrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; }
.gbrow .gbin, .setgroup .field .gbrow .gbin { width: 90px; flex: none; }
.lib-limits { display: grid; gap: 10px; }
/* the reader's Custom prompt (custom-prompt.js) */
.cp-dialog { max-width: 640px; }
.cp-body { display: flex; flex-direction: column; gap: 12px; padding-top: 14px; }
.cp-row { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; }
.cp-pick { max-width: 100%; }
.cp-text { min-height: 12em; }
.cp-opt { display: inline-flex; align-items: center; gap: 5px; font-size: 14px; }
.cp-opt input:disabled + span { opacity: .6; }
.cp-go .primary { padding: 7px 18px; }
