/* Chapter reader */

/* Immersive bottom bar: fixed to the bottom, slides down while reading, tap/scroll to reveal */
.reader-bar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 45; background: rgba(9,8,14,0.94); backdrop-filter: blur(14px); border-top: 1px solid var(--line); transition: transform .25s ease; padding-bottom: env(safe-area-inset-bottom); }
.reader-bar.nav-hidden { transform: translateY(100%); }
.reader-bar .wrap { display: flex; align-items: center; gap: 12px; height: 58px; }
.rb-home { display: inline-grid; place-items: center; width: 42px; height: 38px; color: var(--muted); border-radius: 10px; border: 1px solid transparent; }
.rb-home:hover { color: var(--accent, #f0a92b); border-color: var(--line); }

.ch-select { position: relative; }
.ch-picker-btn { display: inline-flex; align-items: center; gap: 8px; background: var(--surface-solid); border: 1px solid var(--line); color: var(--text); padding: 9px 14px; border-radius: 10px; font-size: 14px; font-weight: 700; font-family: inherit; cursor: pointer; white-space: nowrap; }
.ch-picker-btn:hover { border-color: var(--accent, #f0a92b); }
.ch-picker-btn .caret { color: var(--muted); transition: transform .18s, color .18s; }
.ch-picker-btn.open .caret { transform: rotate(180deg); color: var(--accent, #f0a92b); }

/* Searchable chapter picker — opens upward, above the bottom bar */
.reader-picker { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 51; width: min(340px, calc(100vw - 28px)); max-height: 52vh; background: rgba(18,15,26,0.98); backdrop-filter: blur(16px); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 -14px 44px rgba(0,0,0,0.55); overflow: hidden; display: flex; flex-direction: column; }
.rp-search { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.rp-search svg { color: var(--muted-2); flex: none; }
.rp-search input { border: 0; background: transparent; color: var(--text); outline: none; width: 100%; font-size: 14px; font-family: inherit; }
.rp-search input::placeholder { color: var(--muted-2); }
.rp-list { overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.rp-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; border-radius: 9px; color: var(--text); font-size: 14px; font-weight: 600; transition: background .12s; }
.rp-item:hover { background: var(--surface-2); }
.rp-item.current { background: var(--accent-soft); color: var(--accent, #f0a92b); }
.rp-item .rp-d { color: var(--muted-2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.rp-empty { padding: 18px; text-align: center; color: var(--muted-2); font-size: 13px; }

.icon-btn { display: inline-flex; align-items: center; justify-content: center; height: 38px; padding: 0 13px; gap: 7px; background: var(--surface-solid); border: 1px solid var(--line); border-radius: 10px; color: var(--muted); font-size: 13px; font-weight: 600; transition: .16s; }
.icon-btn:hover { color: var(--text); border-color: var(--accent, #f0a92b); }
.rb-nav { display: inline-flex; gap: 6px; }
.rb-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.report-btn { color: var(--hot); }
.report-btn:hover { border-color: var(--hot); }
.ascroll-btn.on { color: #1a1200; background: var(--accent, #f0a92b); border-color: var(--accent, #f0a92b); }

/* Progress line — thin, always visible at the very top */
.progress { position: fixed; top: 0; left: 0; right: 0; z-index: 46; height: 3px; background: rgba(255,255,255,0.06); }
.progress .fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent-deep), var(--accent, #f0a92b)); box-shadow: 0 0 10px var(--accent, #f0a92b); }

.reader-title { text-align: center; padding: 26px 22px 6px; }
.reader-title .eyebrow { display: block; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent, #f0a92b); font-weight: 700; margin-bottom: 8px; }
.reader-title h1 { font-size: clamp(20px, 3vw, 28px); font-weight: 800; }

/* Long-strip pages. Width + brightness are set inline by reader.js (Reader Settings);
   they stay plain px/filter values so the transition animates them smoothly. */
.strip { margin: 20px auto 0; display: block; max-width: 720px; transition: max-width .2s ease, filter .15s ease; cursor: pointer; }
.strip p { margin: 0; }
.strip img { display: block; width: 100%; height: auto; margin: 0 auto; }
.no-content { text-align: center; color: var(--muted); padding: 40px 20px; }

/* Per-page wrapper + page-number badge (Page Numbering setting) */
.pg { position: relative; }
.pg-num { position: absolute; top: 8px; right: 8px; z-index: 2; display: none; padding: 2px 9px; border-radius: 999px; background: rgba(9,8,14,0.72); backdrop-filter: blur(4px); border: 1px solid var(--line); color: var(--text); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; pointer-events: none; }
.strip.numbered .pg-num { display: block; }

/* Paged mode: one page at a time, fit to the viewport, click halves to navigate */
.strip.paged { min-height: calc(100vh - 92px); margin-top: 0; display: flex; align-items: center; justify-content: center; cursor: default; }
.strip.paged .pg { display: none; }
.strip.paged .pg.pg-current { display: block; }
.strip.paged .pg img { width: auto; max-width: 100%; max-height: calc(100vh - 92px); margin: 0 auto; object-fit: contain; }
.strip.paged .pg-num { top: auto; bottom: 10px; right: 50%; transform: translateX(50%); }
/* In paged mode the page owns the viewport — hide the strip's title + end card */
.paged-mode .reader-title, .paged-mode .chapter-end { display: none; }

/* Paged-mode tap/click zones: left=prev, right=next, middle=toggle bar. Full-viewport
   (the page column is narrow, so clicks must be caught at viewport width, not on .strip). */
.pg-nav { position: fixed; inset: 0; z-index: 30; display: none; }
.paged-mode .pg-nav { display: flex; }
.pgz { display: flex; align-items: center; }
.pgz-prev { flex: 0 0 38%; justify-content: flex-start; padding-left: 18px; cursor: pointer; }
.pgz-next { flex: 0 0 38%; justify-content: flex-end; padding-right: 18px; cursor: pointer; }
.pgz-mid { flex: 1 1 24%; cursor: pointer; }
.pgz-chev { color: var(--accent, #f0a92b); opacity: 0; transition: opacity .16s; }
@media (hover: hover) { .pgz-prev:hover .pgz-chev, .pgz-next:hover .pgz-chev { opacity: 0.55; } }

/* Paged-mode navigation hint — keyboard pad (desktop) or single-tap (mobile), each
   time the reader switches to paged. Themed with --accent; deep dim behind. */
.paged-hint { position: fixed; inset: 0; z-index: 60; display: none; background: rgba(6,5,10,0.72); backdrop-filter: blur(2px); }
.paged-hint.show { display: block; animation: ph-fade .22s ease; }
.paged-hint .ph-desktop, .paged-hint .ph-mobile { display: none; }
.paged-hint.is-desktop .ph-desktop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; height: 100%; text-align: center; padding: 0 20px; }
.paged-hint.is-mobile .ph-mobile { display: flex; align-items: center; justify-content: space-between; height: 100%; }
.ph-tx { color: #f4eef8; font-size: 15px; font-weight: 600; line-height: 1.5; max-width: 230px; }
.ph-ok { background: #fff; color: #111; border: 0; border-radius: 999px; padding: 9px 26px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit; }
.ph-ok:hover { background: var(--accent-light, #ffe6b0); }
/* Desktop: two arrow-key caps that "press" in turn */
.ph-keys { display: flex; gap: 14px; }
.ph-key { width: 62px; height: 62px; border-radius: 12px; background: #241f2b; border: 1px solid var(--line); border-bottom: 3px solid var(--line); color: var(--text); display: grid; place-items: center; }
.ph-key-l { animation: ph-keyL 2s ease-in-out infinite; }
.ph-key-r { animation: ph-keyR 2s ease-in-out infinite; }
@keyframes ph-keyL { 0%,18%,42%,100% { transform: translateY(0); background: #241f2b; color: var(--text); } 24%,36% { transform: translateY(3px); background: var(--accent, #f0a92b); color: #1a1200; } }
@keyframes ph-keyR { 0%,58%,82%,100% { transform: translateY(0); background: #241f2b; color: var(--text); } 64%,76% { transform: translateY(3px); background: var(--accent, #f0a92b); color: #1a1200; } }
/* Mobile: single-tap targets on the sides that ripple in turn */
.ph-mobile .ph-mid-txt { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 0 8px; max-width: 190px; text-align: center; }
.ph-tap { flex: 1; display: grid; place-items: center; }
.ph-tap svg { width: 28px; height: 28px; color: #1a1200; background: var(--accent, #f0a92b); border-radius: 50%; padding: 15px; box-sizing: content-box; }
.ph-tap-l svg { animation: ph-tap 2s ease-in-out infinite; }
.ph-tap-r svg { animation: ph-tap 2s ease-in-out infinite 1s; }
@keyframes ph-tap { 0%,50%,100% { transform: scale(1); box-shadow: 0 0 0 0 var(--accent-glow, rgba(240,169,43,0.5)); } 15% { transform: scale(0.86); } 32% { transform: scale(1); box-shadow: 0 0 0 22px rgba(240,169,43,0); } }
@keyframes ph-fade { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 620px) { .ph-tx { font-size: 14px; } .ph-key { width: 54px; height: 54px; } }

/* Page indicator (paged mode) */
.page-indicator { position: fixed; bottom: calc(70px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 44; padding: 5px 14px; border-radius: 999px; background: rgba(9,8,14,0.8); backdrop-filter: blur(10px); border: 1px solid var(--line); color: var(--text); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; transition: opacity .2s; }

.chapter-end { max-width: 720px; margin: 26px auto 96px; padding: 0 22px; }
.next-card { display: block; padding: 24px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); text-align: center; transition: border-color .16s, transform .12s; }
.next-card:hover { border-color: var(--accent, #f0a92b); transform: translateY(-2px); }
.next-card .k { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted-2); }
.next-card .v { font-size: 22px; font-weight: 900; color: var(--accent, #f0a92b); margin-top: 6px; }

/* Report modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(6,5,10,0.72); backdrop-filter: blur(4px); z-index: 70; display: none; place-items: center; padding: 20px; }
.modal-overlay.open { display: grid; }
.modal { width: 100%; max-width: 440px; background: var(--surface-solid); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16px; }
.modal-head .x { background: none; border: 0; color: var(--muted); font-size: 22px; line-height: 1; }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-body label { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-2); font-weight: 700; display: block; margin-bottom: 6px; }
.modal-body select, .modal-body textarea { width: 100%; background: var(--ink, #0d0b13); border: 1px solid var(--line); border-radius: 9px; color: var(--text); padding: 11px 13px; font-family: inherit; font-size: 14px; outline: none; }
.modal-body select:focus, .modal-body textarea:focus { border-color: var(--accent, #f0a92b); }
.report-status { font-size: 14px; font-weight: 600; text-align: center; color: var(--good); }

/* ---- Reader Settings panel ---- */
.settings-body { gap: 20px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.set-block { display: flex; flex-direction: column; gap: 10px; }
.set-head { display: flex; align-items: center; justify-content: space-between; }
.settings-body .set-label { margin: 0; font-size: 13.5px; letter-spacing: 0; text-transform: none; color: var(--text); font-weight: 700; }
.set-val { color: var(--accent, #f0a92b); font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Segmented control (Strip / Paged) */
.seg { display: inline-flex; background: var(--ink, #0d0b13); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 7px 16px; border-radius: 7px; font-size: 13px; font-weight: 700; font-family: inherit; cursor: pointer; transition: .15s; }
.seg button.on { background: var(--accent, #f0a92b); color: #1a1200; }

/* Toggle switch (Page Numbering) */
.switch { position: relative; width: 46px; height: 26px; border-radius: 999px; border: 1px solid var(--line); background: var(--ink, #0d0b13); cursor: pointer; padding: 0; transition: background .18s, border-color .18s; }
.switch .knob { position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: transform .18s, background .18s; }
.switch.on { background: var(--accent, #f0a92b); border-color: var(--accent, #f0a92b); }
.switch.on .knob { transform: translateX(20px); background: #fff; }

/* Range sliders (accent fill applied inline by JS) */
.set-range { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px; background: var(--surface-2); outline: none; cursor: pointer; }
.set-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--accent, #f0a92b); border: 2px solid var(--surface-solid); box-shadow: 0 1px 4px rgba(0,0,0,0.5); cursor: pointer; }
.set-range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--accent, #f0a92b); border: 2px solid var(--surface-solid); cursor: pointer; }
.set-range::-moz-range-track { height: 6px; border-radius: 999px; background: transparent; }

/* Reset button */
.btn.ghost { align-self: flex-start; background: transparent; border: 1px solid var(--line); color: var(--muted); padding: 9px 16px; border-radius: 10px; font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer; transition: .15s; }
.btn.ghost:hover { color: var(--text); border-color: var(--accent, #f0a92b); }

/* Mobile: compact bar — icons only */
@media (max-width: 620px) {
  .reader-bar .wrap { gap: 8px; }
  .reader-bar .lbl { display: none; }
  .icon-btn { padding: 0 11px; }
  .ch-select select { max-width: 44vw; }
  .reader-title { padding-top: 22px; }
}
