/* ---- reader: page furniture ------------------------------------------------ */
.reader .sheet .hl, .reader .sheet .textLayer { position: absolute; left: 0; top: 0; }
.reader .sheet .hl { pointer-events: none; z-index: 1; }
.reader .hb { position: absolute; background: var(--c); }
.reader .hb.lighten { opacity: 0.55; mix-blend-mode: multiply; border-radius: 2px; }
.reader .hb.underscore { background: none; border-bottom: 2.5px solid var(--c); }
.reader .hb.strikeout { background: none; }
.reader .hb.strikeout::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 2px solid var(--c); }
.reader .hb.invert { background: #000; mix-blend-mode: difference; }
.reader .notemark { position: absolute; width: 9px; height: 9px; margin: -4px 0 0 2px; border-radius: 2px; background: var(--ink); }
.reader .stage.night { background: #1b1b1b; }
.reader .dogear { position: absolute; right: 2px; top: 0; color: var(--ink); z-index: 4; pointer-events: none; }
.reader .fx { position: absolute; width: 0; height: 0; }
.reader .dogear .kosvg { width: 30px; height: 34px; }
.popmenu .notepv { max-width: 300px; max-height: 120px; overflow: auto; padding: 6px 8px; margin: 2px; background: #fffbd0; border-radius: 8px; font-size: 13.5px; white-space: pre-wrap; }
.reader .dogear[hidden] { display: none; }
.reader .footer { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 12px; padding: 3px 12px 4px; font-size: 13px; color: #111; pointer-events: none; z-index: 3; }
.reader .footer .chap { display: none; }
.reader .stage.night .footer { color: #ddd; }
.reader .footer .chap { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.reader .footer .pg { font-variant-numeric: tabular-nums; flex: none; }

.textLayer { position: absolute; text-align: initial; inset: 0; overflow: clip; opacity: 1; line-height: 1; -webkit-text-size-adjust: none; text-size-adjust: none; forced-color-adjust: none; transform-origin: 0 0; z-index: 2; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.reader .sellayer { position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; }
.reader .sellayer div { position: absolute; background: rgba(120, 170, 255, 0.35); mix-blend-mode: multiply; border-radius: 2px; }
.textLayer :is(span, br) { color: transparent; position: absolute; white-space: pre; cursor: default; transform-origin: 0% 0%; }
.textLayer span.markedContent { top: 0; height: 0; }
.textLayer ::selection { background: rgba(0, 0, 255, 0.22); }
.textLayer br::selection { background: transparent; }
.textLayer .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: 0; cursor: default; user-select: none; }

/* top menu (swipe down) and settings bar (swipe up), as in KOReader */
.reader .topmenu { position: absolute; left: 0; right: 0; top: 0; z-index: 8; background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12); animation: down 0.16s ease-out; }
.reader .bottombar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 8; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.12); padding: 8px 12px 12px; animation: up 0.16s ease-out; max-height: 70%; overflow-y: auto; }
.reader .topmenu[hidden], .reader .bottombar[hidden] { display: none; }
@keyframes down { from { transform: translateY(-100%); } }
@keyframes up { from { transform: translateY(100%); } }
.tm-row { display: flex; align-items: center; gap: 4px; padding: 6px 8px; }
.tm-row button { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; }
.tm-row button.on, .tm-row button:active { background: var(--accent-soft); }
.tm-row .tm-title { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; }
.bb-row { display: flex; align-items: center; gap: 8px; padding: 2px 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.bb-row button { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; }
.bb-row input { flex: 1; accent-color: var(--ink); }
.bb-row .skim-n { font-size: 13px; color: var(--ink-2); min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; }
.bb-grid { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; }
.bb-grid > label { font-size: 13px; color: var(--ink-2); }
.seg { display: flex; gap: 4px; flex-wrap: wrap; }
.seg button { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 9px; font-size: 13px; color: var(--ink-2); border: 1px solid var(--line); }
.seg button .ic { width: 18px; height: 18px; }
.seg button.on { background: var(--accent-soft); color: var(--ink); border-color: transparent; }
.slider { display: flex; align-items: center; gap: 10px; }
.slider input { flex: 1; accent-color: var(--ink); }
.slider span { font-size: 13px; width: 36px; font-variant-numeric: tabular-nums; }

/* selection and highlight popups */
.popmenu { position: absolute; z-index: 9; background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 6px; display: flex; gap: 4px; }
.popmenu.hl { flex-direction: column; }
.popmenu > button, .popmenu .acts button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 9px; font-size: 14px; }
.popmenu .acts { display: flex; gap: 2px; }
.popmenu button:active { background: var(--bg); }
.popmenu .ic { width: 20px; height: 20px; }
.popmenu .colors { display: flex; gap: 2px; padding: 2px; }
.popmenu .colors button { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; }
.popmenu .colors span { width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2); }
.popmenu .colors button.sel span { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--ink); }

/* lists */
.sheet-modal header .chip { display: inline-flex; align-items: center; gap: 4px; margin-right: 4px; padding: 5px 10px; border-radius: 999px; background: var(--bg); font-size: 13px; width: auto; height: auto; }
.sheet-modal header .chip .ic { width: 18px; height: 18px; }
.sheet-modal header b { margin-right: auto; }
.sheet-modal .list { overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; padding: 0; }
.toc-item { cursor: pointer; align-items: center; }
.toc-item.cur { background: var(--accent-soft); font-weight: 600; }
.toc-item button { width: 32px; height: 32px; display: grid; place-items: center; color: var(--ink-3); }
.toc-item mark { background: #fff59d; }
.tabs { display: flex; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.tabs button { padding: 6px 12px; border-radius: 999px; font-size: 13px; color: var(--ink-2); }
.tabs button.on { background: var(--accent-soft); color: var(--ink); }
.bm-item { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.bm-item:active { background: var(--bg); }
.bm-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.bm-ic.highlight, .bm-ic.note { background: color-mix(in srgb, var(--c) 45%, #fff); }
.bm-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bm-t b { font-weight: 500; font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bm-t small, .bm-t em { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bm-t em { font-style: normal; color: var(--ink-2); }
.bm-t small:empty, .bm-t em:empty { display: none; }
.bm-item i { font-style: normal; color: var(--ink-3); font-size: 13px; font-variant-numeric: tabular-nums; }
.bm-item button { width: 32px; height: 32px; display: grid; place-items: center; color: var(--ink-3); }
.searchbar { display: flex; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.searchbar input { flex: 1; font: inherit; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; -webkit-user-select: text; user-select: text; }
.panel.edit { padding: 0 0 14px; }
.panel.edit label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); padding: 10px 18px 0; }
.panel.edit input, .panel.edit textarea { margin: 0; font: inherit; font-size: 16px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; -webkit-user-select: text; user-select: text; resize: vertical; }
.panel.edit blockquote { margin: 12px 18px 0; padding: 8px 12px; background: #fffbd0; border-radius: 8px; font-size: 14px; max-height: 120px; overflow: auto; }
.panel.edit .two { display: flex; }
.panel.edit .two label { flex: 1; }
.danger { color: var(--red); padding: 9px 4px !important; }
