/* ============================================================================
   LORD HENTAI / SARRAST / AKUMABOX — Best-in-Class Webtoon Reader (v2.0)
   Authoritative Ultra-Responsive UX, Turbo Streaming, Zero-Blur, Smart Jump
   ============================================================================ */

:root {
    --reader-bg: #000000;
    --reader-card: #0E0916;
    --reader-border: rgba(255, 255, 255, 0.12);
    --reader-border-accent: rgba(255, 42, 122, 0.4);
    --reader-accent: #FF2A7A;
    --reader-accent-gradient: linear-gradient(135deg, #FF2A7A 0%, #D81B60 100%);
    --reader-purple: #9D4EDD;
    --reader-purple-gradient: linear-gradient(135deg, #9D4EDD 0%, #6B21A8 100%);
    --reader-text: #F1F5F9;
    --reader-text-muted: #94A3B8;
    --reader-max-width: 820px;
    --reader-brightness: 1;
    --reader-sepia: 0;
    --reader-top-h: 54px;
    --reader-dock-h: 60px;
}

* { 
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    background: var(--reader-bg, #000000) !important;
    color: var(--reader-text, #F1F5F9);
    font-family: "A Negaar", "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    -webkit-touch-callout: none !important;
    transition: background 0.3s ease;
}

/* ── Top Scroll Progress Bar ── */
.reader-progress-wrap {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3.5px;
    background: rgba(255, 255, 255, 0.08);
    z-index: 1000;
    pointer-events: none;
}

.reader-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--reader-accent-gradient);
    box-shadow: 0 0 12px rgba(255, 42, 122, 0.85);
    transition: width 0.1s ease-out;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FLOATING ROUNDED CAPSULE TOP BAR
   ═══════════════════════════════════════════════════════════════════════════ */
.reader-top-bar {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 24px);
    max-width: 780px;
    height: 52px;
    background: #0E0916;
    border: 1px solid var(--reader-border);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.85), 0 0 20px rgba(255, 42, 122, 0.15);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}

.reader-top-bar.ui-hidden {
    transform: translateX(-50%) translateY(-90px);
    opacity: 0;
    pointer-events: none;
}

.reader-top-right,
.reader-top-left {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.reader-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--reader-border);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
}

.reader-icon-btn:hover,
.reader-icon-btn.active {
    background: rgba(255, 42, 122, 0.2);
    border-color: var(--reader-accent);
    color: var(--reader-accent);
    transform: translateY(-1px);
}

.reader-title-info {
    text-align: center;
    min-width: 0;
    flex: 1;
    padding: 0 0.6rem;
}

.reader-title-main {
    font-size: 0.90rem;
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reader-title-sub {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--reader-accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CONTINUOUS SEAMLESS WEBTOON CANVAS & TURBO STREAMING
   ═══════════════════════════════════════════════════════════════════════════ */
.reader-canvas {
    width: 100%;
    max-width: var(--reader-max-width, 820px);
    margin: 0 auto;
    padding: 76px 0 120px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--reader-bg, #000000);
    min-height: 100vh;
    line-height: 0;
    box-shadow: none !important;
    filter: brightness(var(--reader-brightness, 1)) sepia(var(--reader-sepia, 0));
    transition: filter 0.35s cubic-bezier(0.16, 1, 0.3, 1), -webkit-filter 0.35s cubic-bezier(0.16, 1, 0.3, 1), max-width 0.3s ease;
}

.reader-canvas.stealth-blur {
    filter: blur(34px) grayscale(60%) !important;
    -webkit-filter: blur(34px) grayscale(60%) !important;
}

@keyframes readerSkeletonShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes spinMiniLoader {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.reader-page-item {
    width: 100%;
    position: relative;
    background: linear-gradient(90deg, #09060f 0%, #160d26 50%, #09060f 100%);
    background-size: 200% 100%;
    animation: readerSkeletonShimmer 2.0s infinite ease-in-out;
    min-height: 480px;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 0;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    overflow: hidden;
    box-shadow: none !important;
    content-visibility: auto;
    contain-intrinsic-size: 800px 1200px;
}

.reader-page-item.loaded {
    min-height: auto;
    background: var(--reader-bg, #000000);
    animation: none;
}

.reader-page-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 34px;
    height: 34px;
    border: 3px solid rgba(255, 42, 122, 0.2);
    border-top-color: var(--reader-accent);
    border-radius: 50%;
    animation: spinMiniLoader 0.75s linear infinite;
    pointer-events: none;
    z-index: 2;
    transition: opacity 0.25s ease;
}

.reader-page-item.loaded .reader-page-loader {
    opacity: 0;
    display: none;
}

.reader-page-item img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    opacity: 1 !important;
    content-visibility: auto;
    pointer-events: none !important;
    -webkit-user-drag: none !important;
    -webkit-touch-callout: none !important;
    user-select: none !important;
}

/* Page Error / Retry Fallback State */
.reader-page-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    min-height: 300px;
    width: 100%;
    background: #0D0914;
    border: 1px dashed rgba(239, 68, 68, 0.4);
    color: #F87171;
    font-size: 0.88rem;
    line-height: 1.5;
    text-align: center;
    z-index: 4;
}

.reader-page-error .btn-retry-page {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fff;
    border-radius: 12px;
    font-size: 0.80rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reader-page-error .btn-retry-page:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: #EF4444;
}

.reader-page-tag {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: rgba(10, 6, 16, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    pointer-events: none;
    line-height: 1.4;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
    z-index: 3;
}

body.hide-page-tags .reader-page-tag {
    display: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TWO-WAY SMART FLOATING JUMP CAPSULE (#smartJumpBtn)
   ═══════════════════════════════════════════════════════════════════════════ */
.smart-jump-capsule {
    position: fixed;
    bottom: 84px;
    left: 20px;
    z-index: 99;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    background: #0E0916;
    border: 1px solid var(--reader-border-accent);
    border-radius: 30px;
    color: #fff;
    font-size: 0.84rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.85), 0 0 16px rgba(255, 42, 122, 0.25);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
}

.smart-jump-capsule:hover {
    transform: translateY(-2px) scale(1.03);
    background: #160D24;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.9), 0 0 24px rgba(255, 42, 122, 0.4);
}

.smart-jump-capsule i {
    font-size: 1.05rem;
    transition: transform 0.25s ease;
}

.smart-jump-capsule.mode-comments i {
    color: #A855F7;
}

.smart-jump-capsule.mode-top i {
    color: #FF2A7A;
}

@media (max-width: 768px) {
    .smart-jump-capsule {
        bottom: 88px !important;
        left: 14px !important;
        padding: 7px 13px !important;
        font-size: 0.78rem !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   FLOATING ROUNDED CAPSULE BOTTOM CONTROL DOCK
   ═══════════════════════════════════════════════════════════════════════════ */
.reader-dock-container {
    position: fixed;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 24px);
    max-width: 780px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    background: #0E0916;
    border: 1px solid var(--reader-border);
    border-radius: 26px;
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.85), 0 0 25px rgba(157, 78, 221, 0.15);
    overflow: hidden;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}

.reader-dock-container.ui-hidden {
    transform: translateX(-50%) translateY(115%);
    opacity: 0;
    pointer-events: none;
}

/* Tier 1: Quick Chapter Paginator Carousel */
.reader-carousel-row {
    width: 100%;
    padding: 7px 10px;
    background: rgba(18, 12, 28, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 7px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.reader-carousel-row::-webkit-scrollbar { display: none; }

.ch-pill-jump {
    flex-shrink: 0;
    padding: 4px 13px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    color: #94A3B8;
    font-size: 0.80rem;
    font-weight: 800;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.ch-pill-jump:hover {
    background: rgba(255, 42, 122, 0.15);
    color: #fff;
    border-color: var(--reader-accent);
}
.ch-pill-jump.active {
    background: var(--reader-accent-gradient);
    color: #fff;
    border-color: #FF2A7A;
    box-shadow: 0 0 14px rgba(255, 42, 122, 0.45);
}

/* Tier 2: Functional Navigation Controls */
.reader-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px;
    gap: 8px;
}

.reader-dock-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 13px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--reader-border);
    border-radius: 16px;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.reader-dock-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}
.reader-dock-btn.disabled {
    opacity: 0.35;
    pointer-events: none;
}
.reader-dock-btn.primary {
    background: linear-gradient(135deg, rgba(157, 78, 221, 0.35) 0%, rgba(107, 33, 168, 0.45) 100%);
    border-color: rgba(157, 78, 221, 0.5);
    color: #D8B4FE;
}

.reader-ch-indicator {
    flex: 1;
    text-align: center;
    font-size: 0.82rem;
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SETTINGS & DRAWERS
   ═══════════════════════════════════════════════════════════════════════════ */
.reader-settings-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 82vh;
    background: #0E0916;
    border-top: 2px solid var(--reader-purple);
    border-radius: 28px 28px 0 0;
    z-index: 205;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.95);
}
.reader-settings-drawer.open { transform: translateY(0); }

.settings-drawer-header {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--reader-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.settings-drawer-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-drawer-body {
    padding: 1.2rem 1.5rem 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.settings-label {
    font-size: 0.86rem;
    font-weight: 800;
    color: #CBD5E1;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.settings-sub {
    font-size: 0.74rem;
    font-weight: 600;
    color: #64748B;
    margin-top: 2px;
}

/* Custom Cyberpunk Toggle Switch */
.custom-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}
.custom-switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 26px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.switch-slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #94A3B8;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}
.custom-switch input:checked + .switch-slider {
    background: var(--reader-accent-gradient);
    border-color: #FF2A7A;
    box-shadow: 0 0 14px rgba(255, 42, 122, 0.45);
}
.custom-switch input:checked + .switch-slider::before {
    transform: translateX(22px);
    background: #FFFFFF;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.9);
}

/* Custom Neon Range Slider */
.settings-slider-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 10px 14px;
}
.custom-range-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.12);
    outline: none;
    transition: all 0.2s ease;
}
.custom-range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--reader-accent-gradient);
    border: 2px solid #FFFFFF;
    box-shadow: 0 0 12px rgba(255, 42, 122, 0.7);
    cursor: pointer;
    transition: transform 0.15s ease;
}

.settings-pill-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.settings-pill-btn {
    flex: 1;
    min-width: 80px;
    padding: 9px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    color: #94A3B8;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}
.settings-pill-btn:hover {
    background: rgba(157, 78, 221, 0.15);
    border-color: var(--reader-purple);
    color: #fff;
}
.settings-pill-btn.active {
    background: linear-gradient(135deg, rgba(157, 78, 221, 0.35) 0%, rgba(107, 33, 168, 0.5) 100%);
    border-color: var(--reader-purple);
    color: #fff;
    box-shadow: 0 0 12px rgba(157, 78, 221, 0.3);
}

.settings-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 12px 14px;
}

/* ── TOC Drawer ── */
.reader-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(12px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 200;
}
.reader-drawer-overlay.open { opacity: 1; visibility: visible; }

.reader-toc-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 70vh;
    background: #0E0916;
    border-top: 2px solid var(--reader-accent);
    border-radius: 28px 28px 0 0;
    z-index: 201;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.9);
}
.reader-toc-drawer.open { transform: translateY(0); }

.reader-drawer-header {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--reader-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.reader-drawer-header h3 { margin: 0; font-size: 1.1rem; font-weight: 800; color: #fff; display: flex; align-items: center; gap: 8px; }

.reader-drawer-list {
    padding: 1rem 1.5rem;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.75rem;
}
.reader-drawer-item {
    padding: 0.8rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--reader-border);
    border-radius: 14px;
    color: #F1F5F9;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 700;
    text-align: center;
    transition: all 0.2s ease;
}
.reader-drawer-item:hover {
    background: rgba(255, 42, 122, 0.15);
    border-color: var(--reader-accent);
    color: #FF75A9;
}
.reader-drawer-item.active {
    background: var(--reader-accent-gradient);
    color: #fff;
    border-color: #FF2A7A;
}

/* ── Modal Dialog (Feedback / Report) ── */
.reader-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: calc(100% - 32px);
    max-width: 480px;
    background: #0E0916;
    border: 1px solid var(--reader-border-accent);
    border-radius: 24px;
    z-index: 300;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.95);
    display: none;
    flex-direction: column;
    gap: 16px;
    transition: transform 0.25s ease, opacity 0.25s ease;
    opacity: 0;
}
.reader-modal.open {
    display: flex;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}
.reader-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.reader-modal-header h4 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}
