.reader { position: fixed; inset: 0; z-index: 100; background: #07070b; display: flex; flex-direction: column; }
/* No 300ms tap delay / accidental double-tap zoom on reader controls (mobile). */
.reader button, .reader .tap-zone, .reader-slider, .bottomnav a, .bottomnav button { touch-action: manipulation; }
.reader:fullscreen { width: 100vw; height: 100vh; }
.reader.ui-hidden { cursor: none; }
.reader-viewport { flex: 1; overflow-y: auto; overflow-x: hidden; scroll-behavior: auto; -webkit-overflow-scrolling: touch; overflow-anchor: auto; overscroll-behavior: contain; }


.reader-strip { display: flex; flex-direction: column; align-items: center; }
.reader-strip img, .reader-paged img { background: var(--surface); }
.reader-strip img { width: 100%; max-width: var(--reader-width, 720px); height: auto; animation: rImgIn 0.4s ease; }

.reader-strip img:not(.loaded) { aspect-ratio: 70 / 100; }

.reader-paged img.turn { animation: pageTurn 0.28s var(--ease); }
@keyframes pageTurn { from { opacity: 0.35; transform: translateX(14px); } to { opacity: 1; transform: translateX(0); } }

.reader-paged { height: 100%; display: flex; align-items: center; justify-content: center; }
.reader-paged img { max-width: 100%; max-height: 100%; width: auto; height: auto; margin: 0 auto; }
.reader-paged.fit-width img { width: 100%; max-height: none; }
.reader-paged.fit-height img { height: 100%; }

.page-loader { width: 100%; max-width: var(--reader-width, 720px); aspect-ratio: 2/3; display: grid; place-items: center; color: var(--faint); }


.tap-zones { position: absolute; inset: 0; z-index: 5; display: flex; }
.tap-zone { flex: 1; }
.tap-zone.center { flex: 1.2; }

.reader-bar { position: absolute; left: 0; right: 0; z-index: 20; background: rgba(10,10,16,0.92); backdrop-filter: blur(12px); transition: transform 0.3s var(--ease), opacity 0.3s; }
.reader-bar.top { top: 0; border-bottom: 1px solid var(--border-soft); padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); display: flex; align-items: center; gap: 12px; }
.reader-bar.bottom { bottom: 0; border-top: 1px solid var(--border-soft); padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.reader.ui-hidden .reader-bar.top { transform: translateY(-100%); opacity: 0; }
.reader.ui-hidden .reader-bar.bottom { transform: translateY(100%); opacity: 0; }

.reader-back { flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--surface-2); display: grid; place-items: center; }
.reader-back svg { width: 20px; height: 20px; }
.reader-titles { flex: 1; min-width: 0; }
.reader-titles .rt-series { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-titles .rt-chapter { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-tools { display: flex; gap: 6px; flex-shrink: 0; }
.rtool { width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--surface-2); display: grid; place-items: center; transition: 0.15s; }
.rtool:hover { background: var(--surface-3); color: #fff; }
.rtool svg { width: 20px; height: 20px; }

.reader-nav { display: flex; align-items: center; gap: 12px; }
.reader-nav .btn { padding: 10px 16px; flex-shrink: 0; }
.reader-progress { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.reader-progress .rp-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.reader-slider { width: 100%; -webkit-appearance: none; appearance: none; height: 6px; border-radius: 999px; background: var(--surface-3); outline: none; }
.reader-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,0.5); cursor: pointer; }
.reader-slider::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: var(--accent); cursor: pointer; }


.read-progress-bar { position: absolute; top: 0; left: 0; height: 3px; background: var(--accent-grad); z-index: 25; transition: width 0.1s linear; }

.reader-settings {
  position: absolute; z-index: 30; top: 64px; right: 12px; width: min(300px, calc(100vw - 24px));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 16px; transform-origin: top right; animation: pop 0.18s var(--ease);
}
.reader-settings[hidden] { display: none; }
.rs-group { margin-bottom: 16px; }
.rs-group:last-child { margin-bottom: 0; }
.rs-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--faint); margin-bottom: 8px; font-weight: 700; }
.seg { display: flex; background: var(--surface-2); border-radius: 10px; padding: 4px; gap: 4px; }
.seg button { flex: 1; padding: 8px; border: 0; border-radius: 7px; background: none; color: var(--muted); font-size: 13px; font-weight: 600; transition: 0.15s; }
.seg button.active { background: var(--accent); color: #fff; }
.rs-range { display: flex; align-items: center; gap: 10px; }
.rs-range input { flex: 1; }

.chapter-select {
  position: absolute; z-index: 30; top: 64px; right: 12px; width: min(320px, calc(100vw - 24px)); max-height: 60vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px;
  transform-origin: top right; animation: pop 0.18s var(--ease);
}
.chapter-select[hidden] { display: none; }
.cs-item { display: block; padding: 11px 14px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--muted); }
.cs-item:hover { background: var(--surface-2); color: var(--text); }
.cs-item.current { background: var(--accent-soft); color: #fff; }


.chapter-end { padding: 60px 20px; text-align: center; background: var(--surface); margin-top: 20px; }
.chapter-end h3 { font-size: 20px; margin: 0 0 6px; }
.chapter-end p { color: var(--muted); margin: 0 0 20px; }
.chapter-end .btn { margin: 0 auto; }


