/* Mobile chapter reader: compact controls and edge-to-edge pages. */
body.reader-ui-active {
    overflow-x: hidden !important;
}

@media (max-width: 768px) {
    body.reader-ui-active .th {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 100500 !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
        transform: translateY(0);
        transition: transform .2s ease, opacity .2s ease;
        pointer-events: none !important;
    }

    body.reader-ui-active .th .centernav.bound {
        position: relative !important;
        display: grid !important;
        grid-template-columns: 42px minmax(0, 1fr) !important;
        grid-template-rows: 48px 44px !important;
        align-items: center !important;
        gap: 10px !important;
        width: 100% !important;
        max-width: none !important;
        min-height: 96px !important;
        height: auto !important;
        margin: 0 !important;
        padding: 4px 14px !important;
        box-sizing: border-box !important;
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
        pointer-events: none !important;
    }

    body.reader-ui-active .th .centernav.bound > header {
        display: none !important;
    }

    body.reader-ui-active .th .centernav.bound > .shme {
        grid-column: 1 !important;
        grid-row: 1 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 42px !important;
        height: 42px !important;
        margin: 0 !important;
        padding: 0 !important;
        color: #edf3f8 !important;
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
        font-size: 23px !important;
        line-height: 1 !important;
        pointer-events: auto !important;
        cursor: pointer !important;
    }

    body.reader-ui-active .th .centernav.bound > .searchx.minmb {
        position: relative !important;
        grid-column: 1 / -1 !important;
        grid-row: 2 !important;
        display: block !important;
        width: 100% !important;
        max-width: none !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        transform: none !important;
        pointer-events: auto !important;
    }

    body.reader-ui-active .th .searchx.minmb #form {
        display: flex !important;
        align-items: center !important;
        width: 100% !important;
        height: 42px !important;
        margin: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        border: 0 !important;
        border-bottom: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    body.reader-ui-active .th .searchx.minmb #s {
        flex: 1 1 auto !important;
        width: 100% !important;
        min-width: 0 !important;
        height: 42px !important;
        margin: 0 !important;
        padding: 0 6px !important;
        color: #f1f5f9 !important;
        background: transparent !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        font-size: 15px !important;
        line-height: 1.3 !important;
        outline: none !important;
    }

    body.reader-ui-active .th .searchx.minmb #s::placeholder {
        color: rgba(210, 222, 235, .68) !important;
        opacity: 1 !important;
    }

    body.reader-ui-active .th .searchx.minmb #submit {
        flex: 0 0 40px !important;
        width: 40px !important;
        height: 40px !important;
        margin: 0 !important;
        padding: 0 !important;
        color: #d9e5f0 !important;
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
        font-size: 18px !important;
    }

    body.reader-ui-active .th .searchx .srcmob,
    body.reader-ui-active .th .centernav.bound > .srcmob {
        display: none !important;
    }

    body.reader-ui-active .th .centernav.bound > nav.mm {
        pointer-events: auto !important;
    }

    body.reader-ui-active #content.readercontent {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding-top: 110px !important;
        overflow: visible !important;
    }

    body.reader-ui-active #content.readercontent > .wrapper,
    body.reader-ui-active #content.readercontent .chapterbody,
    body.reader-ui-active #content.readercontent .postarea,
    body.reader-ui-active #content.readercontent article.post {
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        box-sizing: border-box !important;
    }

    body.reader-ui-active #content.readercontent > .wrapper,
    body.reader-ui-active #content.readercontent .chapterbody,
    body.reader-ui-active #content.readercontent .postarea,
    body.reader-ui-active #content.readercontent .entry-content-single.maincontent {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    body.reader-ui-active #content.readercontent .entry-content-single.maincontent {
        width: 100% !important;
        max-width: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        box-sizing: border-box !important;
    }

    body.reader-ui-active #content.readercontent .headpost,
    body.reader-ui-active #content.readercontent .ts-breadcrumb,
    body.reader-ui-active #content.readercontent .chdesc,
    body.reader-ui-active #content.readercontent .chnav {
        box-sizing: border-box !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 14px !important;
        padding-right: 14px !important;
    }

    body.reader-ui-active #readerarea {
        position: relative !important;
        left: 50% !important;
        width: 100vw !important;
        max-width: 100vw !important;
        min-width: 100vw !important;
        margin-left: -50vw !important;
        margin-right: -50vw !important;
        padding: 0 !important;
        overflow: visible !important;
        box-sizing: border-box !important;
    }

    body.reader-ui-active #readerarea img {
        display: block !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        object-fit: contain !important;
    }

    body.reader-ui-active .readingnav.rnavtop,
    body.reader-ui-active .readingnav.rnavbot {
        z-index: 100400 !important;
        transition: transform .2s ease, opacity .2s ease !important;
    }

    /* Put the chapter label in its own row above the reader search field. */
    body.reader-ui-active .readingnav.rnavtop {
        position: fixed !important;
        top: 0 !important;
        left: 56px !important;
        right: 14px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: auto !important;
        height: 48px !important;
        min-height: 48px !important;
        margin: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
        pointer-events: none !important;
    }

    body.reader-ui-active .readingnav.rnavtop .readingnavtop {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        height: 48px !important;
        margin: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
    }

    body.reader-ui-active .readingnav.rnavtop .backseries,
    body.reader-ui-active .readingnav.rnavtop .rdnmx.rdtop {
        display: none !important;
    }

    body.reader-ui-active .readingnav.rnavtop .chpnw {
        display: block !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 8px !important;
        overflow: hidden !important;
        color: #edf3f8 !important;
        text-align: center !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        pointer-events: none !important;
    }

    body.reader-ui-active .scrollToTop {
        position: fixed !important;
        z-index: 100300 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 44px !important;
        height: 44px !important;
        right: 14px !important;
        bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
        box-sizing: border-box !important;
        color: #fff !important;
        background: #3268d2 !important;
        border: 1px solid rgba(255, 255, 255, .18) !important;
        border-radius: 50% !important;
        box-shadow: 0 8px 22px rgba(0, 0, 0, .24) !important;
        transition: transform .2s ease, opacity .2s ease !important;
    }

    body.reader-ui-active .scrollToTop > span {
        display: none !important;
    }

    body.reader-ui-active .scrollToTop::before {
        position: absolute !important;
        top: 13px !important;
        left: calc(50% - 5px) !important;
        width: 9px !important;
        height: 9px !important;
        content: "" !important;
        border-top: 2px solid currentColor !important;
        border-left: 2px solid currentColor !important;
        transform: rotate(45deg) !important;
    }

    body.reader-ui-active .scrollToTop::after {
        position: absolute !important;
        top: 19px !important;
        left: calc(50% - 1px) !important;
        width: 2px !important;
        height: 12px !important;
        content: "" !important;
        background: currentColor !important;
        border-radius: 2px !important;
    }

    body.reader-ui-hidden .th {
        opacity: 0 !important;
        transform: translateY(-110%) !important;
        pointer-events: none !important;
    }

    body.reader-ui-hidden .readingnav.rnavtop {
        opacity: 0 !important;
        transform: translateY(-110%) !important;
        pointer-events: none !important;
    }

    body.reader-ui-hidden .readingnav.rnavbot {
        opacity: 0 !important;
        transform: translateY(110%) !important;
        pointer-events: none !important;
    }

    body.reader-ui-hidden .scrollToTop {
        opacity: 0 !important;
        transform: translateY(140%) !important;
        pointer-events: none !important;
    }

}

/* Each portion of a manga card has a distinct, keyboard-accessible destination. */
.bsx .ms-series-cover-link,
.bsx .ms-chapter-read-link {
    display: block !important;
    color: inherit !important;
    text-decoration: none !important;
}

.bsx .ms-chapter-read-link .bigor {
    cursor: pointer;
}

/* Keep home cards still; only the small chapter label reacts to hover. */
.listupd .bsx:hover,
.listupd .bs .bsx:hover {
    transform: none !important;
}

.listupd .bsx:hover .limit img,
.listupd .bs .bsx:hover .limit img {
    transform: none !important;
}

.listupd .bsx .ms-chapter-read-link .bigor .adds .epxs {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: fit-content !important;
    max-width: 100% !important;
    min-height: 34px !important;
    box-sizing: border-box !important;
    padding: 7px 11px !important;
    color: #c6d1df !important;
    background: rgba(17, 25, 36, .78) !important;
    border: 1px solid rgba(153, 174, 199, .22) !important;
    border-radius: 9px !important;
    box-shadow: none !important;
    line-height: 1.2 !important;
    transition: color .18s ease, background .18s ease, border-color .18s ease, font-size .18s ease !important;
}

@media (hover: hover) and (pointer: fine) {
    .listupd .bsx .ms-chapter-read-link .bigor .adds .epxs:hover {
        color: #fff !important;
        background: linear-gradient(135deg, #3979e6 0%, #173d91 100%) !important;
        border-color: rgba(118, 164, 255, .9) !important;
        font-size: 1.06em !important;
    }

    .listupd .bsx .ms-chapter-read-link:focus-visible .bigor .adds .epxs {
        color: #fff !important;
        background: linear-gradient(135deg, #3979e6 0%, #173d91 100%) !important;
        border-color: rgba(118, 164, 255, .9) !important;
    }
}

/* Keep the cover and chapter interactions separate. The image reacts only
   inside its own link; the latest chapter/date tile reacts only on that tile. */
body .listupd .bs .bsx .ms-series-cover-link .limit img,
body .listupd .bsx .ms-series-cover-link .limit img {
    transform: none !important;
    transition: transform .2s ease !important;
}

@media (hover: hover) and (pointer: fine) {
    body .listupd .bs .bsx .ms-series-cover-link:hover .limit img,
    body .listupd .bs .bsx .ms-series-cover-link:focus-visible .limit img,
    body .listupd .bsx .ms-series-cover-link:hover .limit img,
    body .listupd .bsx .ms-series-cover-link:focus-visible .limit img {
        transform: scale(1.045) !important;
    }
}

.listupd .bs.styletere .bsx .ms-chapter-read-link .bigor .adds {
    position: relative !important;
    z-index: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 10px 12px !important;
    color: #c6d1df !important;
    background: rgba(17, 25, 36, .78) !important;
    border: 1px solid rgba(153, 174, 199, .22) !important;
    border-radius: 10px !important;
    box-shadow: none !important;
    transform: none !important;
    transform-origin: center center !important;
    transition: color .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease !important;
}

.listupd .bs.styletere .bsx .ms-chapter-read-link .bigor .adds .epxs,
.listupd .bs.styletere .bsx .ms-chapter-read-link .bigor .adds .epxs:hover {
    display: block !important;
    width: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    color: inherit !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    font-size: inherit !important;
    transform: none !important;
}

.listupd .bs.styletere .bsx .ms-chapter-read-link .bigor .adds .epxdate {
    margin: 0 !important;
    color: #93a3b4 !important;
    transition: color .16s ease !important;
}

@media (hover: hover) and (pointer: fine) {
    .listupd .bs.styletere .bsx .ms-chapter-read-link .bigor .adds:hover,
    .listupd .bs.styletere .bsx .ms-chapter-read-link:focus-visible .bigor .adds {
        z-index: 2 !important;
        color: #fff !important;
        background: linear-gradient(135deg, #3979e6 0%, #173d91 100%) !important;
        border-color: rgba(118, 164, 255, .9) !important;
        box-shadow: 0 8px 18px rgba(4, 14, 40, .24) !important;
        transform: scale(1.02) !important;
    }

    .listupd .bs.styletere .bsx .ms-chapter-read-link .bigor .adds:hover .epxdate {
        color: rgba(255, 255, 255, .78) !important;
    }
}

@media (max-width: 768px) {
    /* Remove the stray underline/focus ring beneath the compact mobile search. */
    body .th .centernav .searchx:focus-within,
    body.darkmode .th .centernav .searchx:focus-within {
        box-shadow: none !important;
        border-color: rgba(114, 215, 208, .38) !important;
    }

    body .th .centernav .searchx form,
    body.darkmode .th .centernav .searchx form {
        border: 0 !important;
        outline: 0 !important;
        box-shadow: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.reader-ui-active .th,
    body.reader-ui-active .readingnav.rnavtop,
    body.reader-ui-active .readingnav.rnavbot,
    body.reader-ui-active .scrollToTop,
    .listupd .bsx .ms-chapter-read-link .bigor .adds .epxs,
    .listupd .bs.styletere .bsx .ms-series-cover-link .limit img,
    .listupd .bs.styletere .bsx .ms-chapter-read-link .bigor .adds,
    .listupd .bsx .ms-series-cover-link .limit img {
        transition: none !important;
    }
}

/* Theme-tinted glass controls, matched in tone and spacing. */
@media (max-width: 768px) {
    body.reader-ui-active .th .centernav.bound {
        background: transparent !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
    }

    body.reader-ui-active .th .centernav.bound > .shme {
        color: #f1f5fb !important;
        background: rgba(38, 50, 70, .64) !important;
        border: 1px solid rgba(195, 214, 240, .26) !important;
        border-radius: 12px !important;
        box-shadow: 0 3px 10px rgba(3, 8, 18, .15), inset 0 1px 0 rgba(255, 255, 255, .08) !important;
        -webkit-backdrop-filter: blur(18px) saturate(150%) !important;
        backdrop-filter: blur(18px) saturate(150%) !important;
    }

    body.reader-ui-active .th .searchx.minmb #form {
        background: rgba(38, 50, 70, .64) !important;
        border: 1px solid rgba(195, 214, 240, .26) !important;
        border-radius: 14px !important;
        box-shadow: 0 3px 10px rgba(3, 8, 18, .15), inset 0 1px 0 rgba(255, 255, 255, .08) !important;
        -webkit-backdrop-filter: blur(18px) saturate(150%) !important;
        backdrop-filter: blur(18px) saturate(150%) !important;
    }

    body.reader-ui-active .th .searchx.minmb:focus-within #form {
        border-color: rgba(139, 176, 236, .48) !important;
        box-shadow: 0 0 0 2px rgba(80, 132, 218, .12), 0 3px 10px rgba(3, 8, 18, .15) !important;
    }

    body.reader-ui-active .th .searchx.minmb #s {
        color: #f5f8fc !important;
        caret-color: #9bbdff !important;
    }

    body.reader-ui-active .th .searchx.minmb #s::placeholder {
        color: rgba(231, 238, 248, .8) !important;
    }

    body.reader-ui-active .th .searchx.minmb #submit {
        color: #edf3fb !important;
    }

    /* Center the chapter chip alongside the menu, with matching glass and height. */
    body.reader-ui-active .readingnav.rnavtop {
        z-index: 100600 !important;
    }

    body.reader-ui-active .readingnav.rnavtop .chpnw {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: calc(100% - 10px) !important;
        max-width: none !important;
        min-width: 0 !important;
        min-height: 42px !important;
        height: 42px !important;
        box-sizing: border-box !important;
        margin: 4px 0 0 10px !important;
        padding: 0 14px !important;
        overflow: hidden !important;
        color: #f1f5fb !important;
        background: rgba(38, 50, 70, .64) !important;
        border: 1px solid rgba(195, 214, 240, .26) !important;
        border-radius: 11px !important;
        box-shadow: 0 3px 10px rgba(3, 8, 18, .15), inset 0 1px 0 rgba(255, 255, 255, .08) !important;
        -webkit-backdrop-filter: blur(18px) saturate(150%) !important;
        backdrop-filter: blur(18px) saturate(150%) !important;
        font-weight: 600 !important;
        text-shadow: 0 1px 3px rgba(0, 0, 0, .24) !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }
}

/* Latest Update: isolate cover and chapter hover, and let their motion breathe.
   The homepage body uses only the "darkmode" class, so scope through its hot slider. */
body.darkmode #content > .wrapper:has(> .hotslid) > .postbody > .bixbox:not(.hothome) {
    overflow: visible !important;
}

body.darkmode #content > .wrapper:has(> .hotslid) > .postbody > .bixbox:not(.hothome) > .listupd {
    position: relative !important;
    overflow: visible !important;
    isolation: isolate !important;
}

body.darkmode #content > .wrapper:has(> .hotslid) > .postbody > .bixbox:not(.hothome) > .listupd > .bs,
body.darkmode #content > .wrapper:has(> .hotslid) > .postbody > .bixbox:not(.hothome) > .listupd > .bs:hover,
body.darkmode #content > .wrapper:has(> .hotslid) > .postbody > .bixbox:not(.hothome) > .listupd > .bs .bsx,
body.darkmode #content > .wrapper:has(> .hotslid) > .postbody > .bixbox:not(.hothome) > .listupd > .bs .bsx:hover {
    position: relative !important;
    overflow: visible !important;
    transform: none !important;
    transition: none !important;
}

body.darkmode #content > .wrapper:has(> .hotslid) > .postbody > .bixbox:not(.hothome) > .listupd > .bs {
    z-index: 0 !important;
}

body.darkmode #content > .wrapper:has(> .hotslid) > .postbody > .bixbox:not(.hothome) > .listupd > .bs:hover {
    z-index: 2 !important;
}

body.darkmode #content > .wrapper:has(> .hotslid) > .postbody > .bixbox:not(.hothome) > .listupd > .bs .ms-series-cover-link .limit img {
    transform: none !important;
    transition: transform .22s ease !important;
    transform-origin: center center !important;
}

@media (hover: hover) and (pointer: fine) {
    body.darkmode #content > .wrapper:has(> .hotslid) > .postbody > .bixbox:not(.hothome) > .listupd > .bs .ms-series-cover-link:hover .limit img,
    body.darkmode #content > .wrapper:has(> .hotslid) > .postbody > .bixbox:not(.hothome) > .listupd > .bs .ms-series-cover-link:focus-visible .limit img {
        transform: scale(1.035) !important;
    }

    body.darkmode #content > .wrapper:has(> .hotslid) > .postbody > .bixbox:not(.hothome) > .releases > .vl:hover,
    body.darkmode #content > .wrapper:has(> .hotslid) > .postbody > .bixbox:not(.hothome) > .releases > .vl:focus-visible {
        color: #fff !important;
        background: linear-gradient(135deg, #3979e6 0%, #173d91 100%) !important;
        border-color: rgba(118, 164, 255, .78) !important;
        box-shadow: 0 5px 14px rgba(37, 99, 235, .24) !important;
        transform: translateY(-1px) !important;
    }
}

body.darkmode #content > .wrapper:has(> .hotslid) > .postbody > .bixbox:not(.hothome) > .releases {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 16px !important;
}

body.darkmode #content > .wrapper:has(> .hotslid) > .postbody > .bixbox:not(.hothome) > .releases > .vl {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    float: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 auto !important;
    align-self: center !important;
    min-height: 36px !important;
    box-sizing: border-box !important;
    margin: 0 0 16px auto !important;
    padding: 0 15px !important;
    color: #dce8fb !important;
    background: rgba(23, 37, 59, .88) !important;
    border: 1px solid rgba(119, 153, 205, .34) !important;
    border-radius: 9px !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06) !important;
    font-size: 12px !important;
    font-weight: 650 !important;
    line-height: 1 !important;
    text-decoration: none !important;
    transition: color .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease !important;
}

@media (prefers-reduced-motion: reduce) {
    body.darkmode #content > .wrapper:has(> .hotslid) > .postbody > .bixbox:not(.hothome) > .listupd > .bs .ms-series-cover-link .limit img,
    body.darkmode #content > .wrapper:has(> .hotslid) > .postbody > .bixbox:not(.hothome) > .releases > .vl {
        transition: none !important;
    }
}
