/*
Theme Name: Novel Reader
Theme URI: https://example.com
Author: Your Site
Description: WordPress theme for large-scale novel/webnovel reading sites, rebuilding the original site's teal card-based design. Chapter text is stored on S3-compatible object storage (e.g. N0C Storage) rather than in the database.
Version: 1.0
Text Domain: novel-reader
*/

/* ==========================================================================
   Self-hosted Open Sans (replaces the Google Fonts CSS request — see
   functions.php, novelreader_assets())
   ========================================================================== */
@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('assets/fonts/open-sans/open-sans-v44-latin-regular.woff2') format('woff2');
}
@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('assets/fonts/open-sans/open-sans-v44-latin-600.woff2') format('woff2');
}
@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('assets/fonts/open-sans/open-sans-v44-latin-700.woff2') format('woff2');
}

/* ==========================================================================
   Design tokens (matched from the original site)
   ========================================================================== */
:root {
    --accent: #007ead;
    --accent-dark: #006a92;
    --bg: #f2f3f4;
    --card-bg: #fff;
    --footer-bg: #f7f8f9;
    --text: #333;
    --text-muted: #757575;
    --border: #eaeaea;
    --border-strong: #dfdfdf;
    --border-header: #ccd0d3;
    --radius: 3px;

    --status-ongoing: #0f0;
    --status-ongoing-bg: #c4f3c4;
    --status-hiatus: #ff0;
    --status-hiatus-bg: #ff0;
    --status-dropped: #a208ff;
    --status-dropped-bg: #e6c3ff;
    --status-completed: #f00;
    --status-completed-bg: #fab8b4;

    /* Solid-card variant (used where the badge sits on a plain card
       background instead of a dark image overlay, e.g. My Library) */
    --status-ongoing-solid: #2e7d32;
    --status-ongoing-solid-bg: #e6f4ea;
    --status-hiatus-solid: #a6790a;
    --status-hiatus-solid-bg: #fff3d6;
    --status-dropped-solid: #a208ff;
    --status-dropped-solid-bg: #f3e0ff;
    --status-completed-solid: #c62828;
    --status-completed-solid-bg: #fdecea;

    --font-body: "Open Sans", -apple-system, sans-serif;
    --content-width: 760px;
    --sidebar-width: 332px;
    --page-width: 1140px;
}

[data-theme="night"] {
    --bg: #000;
    --card-bg: #1f2129;
    --footer-bg: #16171c;
    --text: #ccc;
    --text-muted: #757575;
    --border: #5f6169;
    --border-strong: #5f6169;
    --border-header: #5f6169;

    --status-ongoing-solid: #7cd47f;
    --status-ongoing-solid-bg: rgba(46, 125, 50, .22);
    --status-hiatus-solid: #e0b23c;
    --status-hiatus-solid-bg: rgba(166, 121, 10, .22);
    --status-dropped-solid: #d089ff;
    --status-dropped-solid-bg: rgba(162, 8, 255, .22);
    --status-completed-solid: #ef6b6b;
    --status-completed-solid-bg: rgba(198, 40, 40, .22);
}

* { box-sizing: border-box; }

html {
    font: 400 .9375rem var(--font-body);
    line-height: 1.5;
    min-height: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    transition: background 0.25s ease, color 0.25s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    max-width: 100vw;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: all .35s ease;
}

img { max-width: 100%; display: block; }
.clear { clear: both; }

.wrap {
    max-width: var(--page-width);
    margin: 0 auto;
    padding: 0 15px;
    box-sizing: border-box;
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
    background: var(--accent);
    width: 100%;
    padding: 18px 0;
    color: #fff;
    position: fixed;
    top: 0;
    z-index: 25;
    box-sizing: border-box;
    box-shadow: 0 2px 6px rgba(0,0,0,.3);
}

[data-theme="night"] .site-header { background: var(--card-bg); }

.site-header a { color: #fff; }

.site-header .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.site-title {
    font-size: 20px;
    font-weight: bold;
    border-right: 1px solid var(--border-header);
    padding-right: 15px;
}

[data-theme="night"] .site-title { border-color: var(--border); }

.site-logo {
    display: flex;
    align-items: center;
    border-right: 1px solid var(--border-header);
    padding-right: 15px;
    line-height: 0;
}

[data-theme="night"] .site-logo { border-color: var(--border); }

.site-logo a {
    display: block;
}

.site-logo img {
    display: block;
    height: 30px;
    width: auto;
    max-width: 220px; /* keep an oversized upload from stretching the header */
    object-fit: contain;
}

.site-nav ul {
    list-style: none;
    display: flex;
    gap: 4px;
    margin: 0;
    padding: 0;
    font-size: 14px;
}

.site-nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 8px;
}

.menu-icon {
    flex-shrink: 0;
}

.site-nav a:hover { background: #fff; color: var(--accent); }

.search-form {
    display: flex;
    align-items: center;
    border: 1px solid rgba(255,255,255,.4);
    border-radius: 20px;
    padding: 0 4px 0 12px;
    background: rgba(255,255,255,.08);
    transition: border-color .2s ease, background .2s ease;
}

.search-form:focus-within {
    border-color: #fff;
    background: rgba(255,255,255,.14);
}

.search-form input[type="search"] {
    background: none;
    border: none;
    color: #fff;
    padding: 6px 4px;
    font-family: var(--font-body);
    font-size: 14px;
    width: 160px;
}

.search-form input[type="search"]:focus { outline: none; }

.search-form input[type="search"]::placeholder { color: rgba(255,255,255,.75); }

.search-form button {
    border: none;
    background: none;
    color: #fff;
    cursor: pointer;
    padding: 6px 10px;
    font-size: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s ease;
}

.search-form button:hover { background: rgba(255,255,255,.18); }

/* ==========================================================================
   Main layout
   ========================================================================== */
main.container {
    margin: 96px auto 16px;
    min-height: 300px;
    width: 100%;
    max-width: var(--page-width);
    box-sizing: border-box;
    padding: 0 15px;
    flex: 1 0 auto;
}

article.content {
    width: 100%;
    max-width: var(--content-width);
    box-sizing: border-box;
    float: left;
    margin-right: 18px;
}

.sidebar-container {
    width: 100%;
    max-width: var(--sidebar-width);
    float: right;
    box-sizing: border-box;
}

.m-card {
    position: relative;
    box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.24);
    border-radius: var(--radius);
    width: 100%;
    color: var(--text);
    background-color: var(--card-bg);
    padding: 16px;
    box-sizing: border-box;
    margin: 24px 0;
}

.main-title {
    margin: 0 0 10px;
    border-bottom: 1px solid var(--border-strong);
    padding-bottom: 5px;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   Page content (page.php) — plain text pages: Contact, About, Privacy, etc.
   ========================================================================== */
.page-body {
    color: var(--text);
    font-size: 15px;
    line-height: 1.7;
}
.page-body p { margin: 0 0 1em; }
.page-body h1, .page-body h2, .page-body h3,
.page-body h4, .page-body h5, .page-body h6 {
    margin: 1.4em 0 .6em;
    line-height: 1.3;
    font-weight: 600;
}
.page-body h1 { font-size: 22px; }
.page-body h2 { font-size: 19px; }
.page-body h3 { font-size: 17px; }
.page-body ul, .page-body ol { margin: 0 0 1em; padding-left: 1.4em; }
.page-body li { margin-bottom: .4em; }
.page-body a { color: var(--accent); text-decoration: underline; }
.page-body a:hover { text-decoration: none; }
.page-body img { max-width: 100%; height: auto; border-radius: var(--radius); margin: .5em 0; }
.page-body blockquote {
    margin: 1em 0;
    padding: 10px 16px;
    border-left: 3px solid var(--accent);
    background: rgba(0,0,0,.03);
    color: var(--text-muted);
}
[data-theme="night"] .page-body blockquote { background: rgba(255,255,255,.04); }
.page-body table { width: 100%; border-collapse: collapse; margin: 1em 0; }
.page-body table th, .page-body table td {
    border: 1px solid var(--border-strong);
    padding: 6px 10px;
}
.page-links { margin-top: 1.5em; font-size: 14px; color: var(--text-muted); }

.main-title .menu-icon {
    width: 18px;
    height: 18px;
}

/* ==========================================================================
   Novel grid ("box" cards, matches original)
   ========================================================================== */
.novel-grid {
    padding: 10px 0;
    display: flex;
    flex-wrap: wrap;
}

.novel-card.box {
    padding: 10px;
    width: calc(50% - 8px);
    max-width: 174px;
    box-sizing: border-box;
    text-align: center;
    display: block;
    border: 1px solid var(--border);
    margin: 4px;
    box-shadow: 0 0 8px rgba(0,0,0,.1);
    position: relative;
    background: var(--card-bg);
}

.novel-card.box:hover { background: #fafafa; }
[data-theme="night"] .novel-card.box:hover { background: #26282f; }

.novel-card .cover {
    height: 152px;
    max-width: 120px;
    margin: 0 auto 8px;
    overflow: hidden;
    background: var(--border);
    position: relative; /* containing block for .status-label below */
}

.novel-card .cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.novel-card .cover img:hover { transform: scale(1.1); }

.novel-card .status-label {
    position: absolute;
    inset: 0;
    pointer-events: none; /* clicks pass through to the cover link */
}

.novel-card .status {
    position: absolute;
    top: 0;
    left: 0;
    padding: 3px 6px;
    background: rgba(0,0,0,.7);
    font-size: 11px;
    white-space: nowrap;
}

.novel-card .ch {
    position: absolute;
    bottom: 0;
    right: 0;
    left: auto;
    color: #fff;
    border: 1px solid #fff;
    padding: 3px 6px;
    background: rgba(0,0,0,.7);
    font-size: 11px;
    white-space: nowrap;
}

.status.ongoing   { color: var(--status-ongoing-bg); border: 1px solid var(--status-ongoing); }
.status.hiatus     { color: var(--status-hiatus-bg); border: 1px solid var(--status-hiatus); }
.status.dropped   { color: var(--status-dropped-bg); border: 1px solid var(--status-dropped); }
.status.completed { color: var(--status-completed-bg); border: 1px solid var(--status-completed); }

.novel-card .list-title {
    max-height: 40px;
    display: block;
    overflow: hidden;
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
}

.novel-card .genre {
    color: var(--text-muted);
    font-size: 13px;
}

.tag-card {
    padding-bottom: 12px;
}

.tag-card .list-title {
    margin-bottom: 4px;
}

.tag-card .views {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 2px;
}

.tag-card .rating-summary.compact {
    display: block;
    font-size: 12px;
}

.tag-card .rating-summary.compact .rating-avg-number {
    color: var(--text-muted);
    margin-left: 2px;
}

@media only screen and (min-width: 760px) {
    .tag-grid .novel-card.box {
        width: calc(25% - 16px);
        max-width: 220px;
    }
    .tag-grid .novel-card .cover {
        max-width: 160px;
        height: 210px;
    }
}

/* ==========================================================================
   New Novels slider
   ========================================================================== */
.novel-slider {
    position: relative;
    padding: 0;
    box-sizing: border-box;
    transition: padding .2s ease;
}

.novel-slider.has-prev { padding-left: 34px; }
.novel-slider.has-next { padding-right: 6px; }

.slider-viewport {
    overflow: hidden;
    width: 100%;
}

.slider-track {
    display: flex;
    transition: transform .35s ease;
    will-change: transform;
}

.box.car.slide-item {
    flex: 0 0 auto;
    width: 150px;
    max-width: 150px;
    margin: 4px;
    padding: 8px;
    box-sizing: border-box;
    text-align: left;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
    display: flex;
    flex-direction: column;
}

.box.car.slide-item:hover {
    box-shadow: 0 4px 10px rgba(0,0,0,.18), 0 1px 2px rgba(0,0,0,.1);
}

.box.car .list-a {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: var(--border);
    position: relative;
}

.box.car .list-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s;
}

.box.car .list-a:hover .list-img { transform: scale(1.08); }

/* Status + chapter-count badge, overlaid on the bottom of the cover */
.box.car .status-label {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.box.car .status-label .status {
    position: absolute;
    top: 0;
    left: 0;
    padding: 3px 6px;
    background: rgba(0,0,0,.75);
    font-size: 11px;
    white-space: nowrap;
}

.box.car .status-label .ch {
    position: absolute;
    bottom: 0;
    right: 0;
    left: auto;
    color: #fff;
    border: 1px solid #fff;
    padding: 3px 6px;
    background: rgba(0,0,0,.75);
    font-size: 11px;
    white-space: nowrap;
}

.box.car .caption {
    padding-top: 4px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.box.car .caption .list-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    min-height: 2.6em;
    color: var(--text);
    margin-bottom: 4px;
}

.box.car .caption .list-title:hover { color: var(--accent); }

.box.car .caption .genre { color: var(--text-muted); font-size: 12px; }
.box.car .caption .right { float: right; color: var(--text-muted); font-size: 12px; }
.box.car .caption em { display: block; clear: both; margin-top: auto; padding-top: 3px; color: var(--text-muted); font-size: 12px; font-style: italic; }

.box.car.view-more-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--border-strong);
    background: var(--bg);
}

[data-theme="night"] .box.car.view-more-slide { background: rgba(255,255,255,.03); }

.small-btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border-radius: 4px;
    padding: 8px 14px;
    font-size: 13px;
    text-align: center;
}

.small-btn:hover { color: #fff; box-shadow: 0 0 8px 0 rgba(0,0,0,.3); }

#load-more-updates {
    display: block;
    background: var(--accent);
    color: #fff;
    border-radius: 4px;
    padding: 8px 14px;
    font-size: 13px;
    text-align: center;
    border: none;
    cursor: pointer;
    margin: 15px auto 0;
}

#load-more-updates:hover {
    box-shadow: 0 0 8px 0 rgba(0,0,0,.3);
}

#load-more-updates:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(0,0,0,.55);
    color: #fff;
    border: none;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    line-height: 1;
    padding: 0;
}

.slider-arrow:hover { background: var(--accent); }
.slider-arrow.prev { left: 0; display: none; }
.slider-arrow.next { right: 4px; }

@media only screen and (max-width: 548px) {
    .novel-slider.has-prev { padding-left: 26px; }
    .novel-slider.has-next { padding-right: 6px; }
    .box.car.slide-item { width: 128px; max-width: 128px; }
}

/* ==========================================================================
   Recently updated list
   ========================================================================== */
.update-box {
    padding: 10px;
    margin: 10px 0;
    border-bottom: 1px solid var(--border);
    min-height: 100px;
    overflow: hidden; /* contain the floated thumbnail so it can never poke out of the box */
}

.load-more-container {
    text-align: center;
    margin-top: 15px;
    padding: 10px 0;
}

.update-box .update-tmb {
    display: block;
    width: 60px;
    height: 80px;
    float: left;
    margin: 6px 16px 10px 0;
    object-fit: cover;
    object-position: center top; /* keep the top of the cover (title/face) visible when cropping */
    border-radius: var(--radius);
    background: var(--border); /* avoids a flash of empty space while the image loads */
}

.update-box h3 {
    margin: 0 0 4px 76px;
    font-size: 15px;
}

.update-box .chapter-links {
    margin: 0 0 0 76px;
}

.update-box .chapter-links a {
    display: flex;
    align-items: baseline;
    color: var(--text-muted);
    font-size: 13px;
    margin: 4px 0;
}

.update-box .chapter-links a b {
    flex-shrink: 0;
    margin-right: 8px;
}

.update-box .chapter-links a span {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.update-box .chapter-links a small {
    flex-shrink: 0;
    margin-left: 8px;
}

.update-box .chapter-links a:hover { text-decoration: underline; }

/* ==========================================================================
   Novel detail page
   ========================================================================== */
.novel-header {
    display: flex;
    gap: 20px;
    padding-bottom: 10px;
}

.novel-header .cover {
    width: 150px;
    height: 200px;
    flex-shrink: 0;
    border: 1px solid var(--border);
    overflow: hidden;
}

.novel-header .cover img { width: 100%; height: 100%; object-fit: cover; }

.novel-header h1 {
    font-size: 22px;
    margin: 0 0 8px;
}

.novel-meta-row {
    display: flex;
    gap: 14px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.novel-synopsis {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
}

.but {
    display: block;
    background: var(--accent);
    color: #fff;
    border-radius: 8px;
    padding: 8px 10px;
    margin: 16px 0 0;
    width: 150px;
    text-align: center;
}

.but:hover {
    box-shadow: 0 0 8px 0 rgba(0,0,0,.3);
    color: #fff;
}

.chapter-list ul {
    padding-left: 0;
    margin: 0;
}

.chapter-list li {
    list-style-type: none;
    border-bottom: 1px solid var(--border);
    margin: 4px 0;
    padding: 10px 0;
    line-height: 20px;
}

.chapter-list li a {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    gap: 12px;
}

.chapter-list li a strong {
    color: var(--text);
    font-weight: normal;
    flex: 1;
}

.chapter-list li small { color: var(--text-muted); white-space: nowrap; }

.pagination { display: flex; gap: 10px; margin-top: 16px; font-size: 14px; }
.pagination .current { font-weight: 700; color: var(--text); }

/* ==========================================================================
   Novel detail page (matches original: breadcrumbs, nov-head, tabs, info table)
   ========================================================================== */
.crumbs {
    font-size: 12px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-strong);
    color: var(--text-muted);
}

.crumbs a { color: var(--accent); }

.entry-title {
    margin: 10px 0;
    font-size: 22px;
    padding: 10px 14px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    background-color: #f2f3f4;
}

.nov-head { text-align: center; padding-bottom: 10px; }

.nov-head .main-tmb {
    margin: 16px auto;
    display: block;
    width: 180px;
    height: auto;
    box-shadow: 0 5px 15px -5px #000;
    border-radius: 5px;
}

.nov-head .but,
.nov-head .add2rl {
    display: inline-block;
    width: auto;
    margin: 4px;
}

.nov-head .stars { width: 120px; height: 24px; }
.nov-head .rating-info strong { font-size: 24px; }
.ratings { margin-bottom: 8px; }

/* Tabs */
.tabs {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
}

.tabs button {
    flex-grow: 1;
    text-align: center;
    padding: 8px 4px;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    font-size: 15px;
    cursor: pointer;
    font-family: var(--font-body);
}

.tabs button.active {
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
    font-weight: 600;
}

.tabs button .tab-icon {
    display: inline-block;
    vertical-align: -2px;
    margin-right: 5px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Info stats */
.info-wrap {
    width: 100%;
    padding: 10px 0;
    background: var(--bg);
    border-radius: 8px;
    display: flex;
    margin-top: 12px;
}

.info-wrap .i {
    width: 33%;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    line-height: 18px;
}

.info-wrap .i small {
    width: 100%;
    display: block;
    font-size: 12px;
    font-weight: 300;
    color: var(--text-muted);
}

.desc { text-align: left; }
.desc h2 { font-size: 18px; margin: 16px 0 4px; text-decoration: underline; }
.desc p { margin: 0 0 10px; line-height: 1.6; }

.center { text-align: center; }

.details-title {
    font-size: 16px;
    font-weight: 700;
    text-decoration: underline;
    margin: 18px 0 4px;
}

table.info { border-spacing: 0; width: 100%; box-sizing: border-box; margin-top: 10px; }
table.info td { vertical-align: top; padding: 6px 10px; font-size: 14px; }
table.info td.tbl-lbl { width: 110px; color: var(--text-muted); }
table.info tr.odd { background: rgba(0,0,0,.02); }
[data-theme="night"] table.info tr.odd { background: rgba(255,255,255,.03); }
table.info a { margin-right: 4px; }

.rank {
    background-color: #2c3e50;
    padding: 4px 9px;
    border-radius: 8px;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    display: inline-block;
    font-size: 13px;
}

/* ==========================================================================
   Star ratings (static display), tag badges, library button, reviews
   ========================================================================== */
.stars-display {
    position: relative;
    display: inline-block;
    font-size: 16px;
    line-height: 1;
    letter-spacing: 2px;
    vertical-align: middle;
}
.stars-display .stars-empty { color: #ddd; }
.stars-display .stars-fill {
    position: absolute;
    top: 0; left: 0;
    overflow: hidden;
    white-space: nowrap;
    color: #f5a623;
}

.rating-summary { margin: 8px 0; font-size: 14px; color: var(--text-muted); }
.rating-summary .rating-avg-number { font-weight: 700; color: var(--text); margin: 0 4px; }

.nov-head .rating-summary { font-size: 13px; }
.nov-head .rating-summary .stars-display { font-size: 15px; }
.nov-head .rating-summary .rating-avg-number { font-size: 15px; }

.nov-head-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.nov-head-actions .but { margin: 0; width: auto; padding: 8px 16px; }

.library-btn {
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.library-btn:hover { opacity: .9; }
.library-btn.in-library { background: var(--card-bg); color: var(--accent); }
.library-btn.in-library .library-btn-icon::before { content: "✓"; }
.library-btn .library-btn-icon { font-weight: 700; }

/* "My Library" page */
.library-remove-btn {
    display: inline-block;
    width: auto;
    margin: 10px 0 0;
    padding: 6px 14px;
    font-size: 13px;
    background: #e74c3c;
    color: #fff;
    border: 1px solid #e74c3c;
}
.library-remove-btn:hover { background: #c0392b; border-color: #c0392b; color: #fff; }

.library-latest-date { color: var(--text-muted); font-size: 12px; margin-left: 4px; }

.tag-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-badge {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent);
    border-radius: 14px;
    padding: 3px 10px;
    font-size: 12px;
}
.tag-badge:hover { background: var(--accent-dark); color: #fff; border-color: var(--accent-dark); }

/* Reviews tab (matches original .star-container layout) */
.star-container { width: 100%; max-width: 512px; margin: 4px auto 16px; }
.star-avg { width: 130px; text-align: center; float: left; padding-top: 8px; }
.star-avg strong { font-size: 44px; display: block; line-height: 1; }
.star-avg small { display: block; color: var(--text-muted); margin-top: 6px; }
.star-bars { width: calc(100% - 130px); float: right; }

.breakdown-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.breakdown-label { width: 12px; text-align: right; color: var(--text-muted); font-size: 13px; }
.breakdown-track { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.breakdown-fill { display: block; height: 100%; background: var(--accent); transition: width .3s ease; }

.rate-stars { display: flex; justify-content: center; gap: 6px; margin: 8px 0 16px; }
.rate-star {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 28px;
    color: #ddd;
    line-height: 1;
    padding: 0;
}
.rate-star.filled { color: #f5a623; }

.review-form { max-width: 512px; margin: 0 auto 24px; text-align: center; }
.nr-hp-wrap {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
.review-form input[type="text"],
.review-form textarea {
    width: 100%;
    max-width: 480px;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    padding: 8px 10px;
    font-family: var(--font-body);
    font-size: 14px;
    background: var(--card-bg);
    color: var(--text);
    box-sizing: border-box;
}
.review-form .but { display: inline-block; width: auto; padding: 8px 24px; cursor: pointer; border: none; }
.review-form-error { color: #c0392b; font-size: 13px; }
.review-form-success { color: #27ae60; font-size: 13px; }

.reviews-list { max-width: 700px; margin: 0 auto; }
.review-item { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.review-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--accent); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; flex-shrink: 0;
}
.review-body { flex: 1; }
.review-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.review-author { color: var(--text); }
.review-date { color: var(--text-muted); font-size: 12px; }
.review-text { margin: 6px 0 0; color: var(--text); font-size: 14px; line-height: 1.5; }

@media only screen and (max-width: 548px) {
    .star-avg, .star-bars { float: none; width: 100%; margin-bottom: 12px; }
}

/* Recent Chapters (5 latest, with publish date) */
.recent-ch-list { border-top: 1px solid var(--border); margin: 10px 0 4px; }

.recent-ch-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 4px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 14px;
}

.recent-ch-row:nth-child(odd) { background: rgba(0,0,0,.02); }
[data-theme="night"] .recent-ch-row:nth-child(odd) { background: rgba(255,255,255,.03); }

.recent-ch-row:hover { color: var(--accent); }

.recent-ch-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent-ch-title em { color: var(--text-muted); font-style: italic; margin-left: 4px; }

.recent-ch-date {
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 12px;
}

/* All Chapters accordion (collapsible ranges of `per_page` chapters) */
.ch-accordion { margin-top: 6px; }

.ch-group {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card-bg);
    margin-bottom: 10px;
    overflow: hidden; /* clips the summary's corners to match the group's rounded border */
}

.ch-group:last-child { margin-bottom: 0; }

.ch-group summary {
    cursor: pointer;
    list-style: none;
    padding: 10px 14px;
    font-weight: 600;
    font-size: 14px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ch-group summary::-webkit-details-marker { display: none; }

.ch-group summary::after {
    content: "\25BE";
    color: var(--text-muted);
    transition: transform .2s ease;
}

.ch-group[open] summary::after { transform: rotate(180deg); }

.view-all-chapters-link { text-align: center; margin-top: 14px; font-size: 13px; }

/* Chapter grid (matches original a.ch-link boxes) */
.ch-list { border-top: 1px solid var(--border); margin-top: 10px; }

.ch-link {
    color: var(--text);
    display: inline-block;
    width: 32%;
    overflow: hidden;
    height: 44px;
    line-height: 26px;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 8px;
    box-sizing: border-box;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.ch-link strong { font-weight: 600; margin-right: 6px; }
.ch-link:hover { color: var(--accent); }

@media only screen and (max-width: 640px) {
    .ch-link { width: 49%; }
}
@media only screen and (max-width: 464px) {
    .ch-link { width: 100%; }
}

/* ==========================================================================
   Novel list / archive page (matches original: filter form, wide boxes, pagination)
   ========================================================================== */
/* "Ranking type:" strip on /daily-rank/, /weekly-rank/, etc. */
.filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.filter h3 {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 600;
    margin: 0;
}
.filter strong {
    color: var(--accent);
}
.filter a {
    color: var(--text-muted);
}
.filter a:hover {
    color: var(--accent);
}
.filter a.r {
    margin-left: auto;
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
    align-items: flex-end;
}

.filter-field { display: flex; flex-direction: column; gap: 4px; }
.filter-field label { font-size: 13px; color: var(--text-muted); }
.filter-field select {
    padding: 6px 8px;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    background: var(--card-bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 14px;
}

.box.wide {
    width: 100%;
    box-sizing: border-box;
    max-width: none;
    height: auto;
    box-shadow: 0 1px 4px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.08);
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    padding: 16px;
    margin: 0 0 16px;
    float: none;
    text-align: left;
    display: block;
    transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}

.box.wide:hover {
    background: var(--card-bg);
    box-shadow: 0 4px 10px rgba(0,0,0,.1), 0 8px 20px rgba(0,0,0,.1);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.tmb-left {
    width: 100px;
    display: block;
    float: left;
    margin-right: 16px;
    border-radius: var(--radius);
}

.tmb-left > a {
    display: block;
    width: 100px;
    height: 150px;
    overflow: hidden;
    border-radius: 6px;
    position: relative;
    background: var(--border);
    box-shadow: 0 1px 4px rgba(0,0,0,.15);
}

.tmb-left img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 6px;
    transition: transform .3s ease;
}

.box.wide:hover .tmb-left img { transform: scale(1.04); }

/* Status + chapter-count badge, overlaid on the bottom of the cover
   (Novel List / Ranking pages). Colours come from the base .status.ongoing
   etc. rules — keep the solid-card variant below scoped to
   .wide-status-row only, or it'll bleed into this and break it again. */
.box.wide .status-label {
    position: absolute;
    inset: 0;
    pointer-events: none; /* let clicks reach the cover link underneath */
}

.box.wide .status-label .status {
    position: absolute;
    top: 0;
    left: 0;
    padding: 3px 6px;
    background: rgba(0,0,0,.75);
    font-size: 11px;
    white-space: nowrap;
    border-top-left-radius: 6px; /* matches .tmb-left > a's own radius, so it nests into the cover's corner */
}

.box.wide .status-label .ch {
    position: absolute;
    bottom: 0;
    right: 0;
    left: auto;
    color: #fff;
    border: 1px solid #fff;
    padding: 3px 6px;
    background: rgba(0,0,0,.75);
    font-size: 11px;
    white-space: nowrap;
    border-bottom-right-radius: 6px;
}

.rating-summary.compact { display: flex; align-items: center; gap: 4px; margin: 6px 0 0; flex-wrap: wrap; }
.rating-summary.compact .rating-avg-number { font-size: 12px; color: var(--text-muted); }
.tmb-left .rating-summary.compact .stars-display { font-size: 12px; }
.tmb-left .library-btn {
    width: 100px;
    margin: 6px 0 0;
    padding: 6px 4px;
    font-size: 11px;
    white-space: nowrap;
}

.data-r { overflow: hidden; }

.data-r .list-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    max-height: none;
    display: block;
    margin-bottom: 4px;
}

.data-r .list-title:hover { color: var(--accent); }

.data-r .meta {
    color: var(--text-muted);
    font-size: 13px;
    padding: 4px 0;
}

.data-r .meta span { margin-right: 4px; }

.library-latest-list { padding: 2px 0; }
.library-latest-row { padding: 2px 0; }
.library-latest-row:first-child { font-weight: 500; }

.data-r .genre-row a {
    color: #fff;
    background: var(--text-muted);
    border-radius: 12px;
    font-size: 12px;
    padding: 3px 10px;
    margin-right: 4px;
    display: inline-block;
    margin-bottom: 4px;
    transition: background .2s ease;
}

.data-r .genre-row a:hover { background: var(--accent); color: #fff; }

.data-r p { color: var(--text-muted); font-size: 14px; line-height: 1.6; margin: 10px 0 0; }
.data-r .show-more { color: var(--accent); cursor: pointer; }
.data-r .desc-more { display: none; }
.data-r .desc-more.open { display: inline; }

#pagination {
    margin: 16px 0 8px;
    width: 100%;
    text-align: center;
    clear: both;
}

#pagination a,
#pagination span.current {
    border: 1px solid var(--accent);
    padding: 2px 8px;
    margin: 2px;
    font-size: 14px;
    display: inline-block;
}

#pagination a { color: var(--accent); }
#pagination span.current { background: var(--accent); color: #fff; }

@media only screen and (max-width: 548px) {
    .tmb-left { float: none; margin: 0 auto 8px; }
    .data-r { text-align: center; }
    .data-r p, .data-r .meta { text-align: left; }
}

/* ==========================================================================
   Chapter reader (matches original: no sidebar, crumbs, chapter-nav, settings panel)
   ========================================================================== */
.no-sidebar { float: none; margin: 0 auto; max-width: var(--content-width); }

.chapter-nav {
    width: 100%;
    padding: 10px 0;
    background: var(--bg);
    border-radius: 8px;
    display: flex;
    margin-top: 12px;
    box-sizing: border-box;
}

.chapter-nav .prev,
.chapter-nav .next {
    color: var(--text);
    border-radius: 5px;
    display: block;
}

.chapter-nav .prev { float: left; width: 70px; padding-left: 10px; }
.chapter-nav .next { float: right; width: 70px; text-align: right; padding-right: 10px; }
.chapter-nav .toc { margin: 0 auto; width: 200px; overflow: hidden; text-align: center; color: var(--text); }
.chapter-nav .disabled { color: var(--border-strong); pointer-events: none; }

#settings-toggle {
    padding: 8px 12px 8px 30px;
    margin-top: 12px;
    float: right;
    background: var(--paper-raised, var(--card-bg)) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="%23757575"><path d="M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58a.5.5 0 0 0 .12-.61l-1.92-3.32a.5.5 0 0 0-.59-.22l-2.39.96a7.03 7.03 0 0 0-1.62-.94l-.36-2.54a.5.5 0 0 0-.5-.42h-3.84a.5.5 0 0 0-.5.42l-.36 2.54c-.59.24-1.14.56-1.62.94l-2.39-.96a.5.5 0 0 0-.59.22L2.78 8.87a.5.5 0 0 0 .12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58a.5.5 0 0 0-.12.61l1.92 3.32c.13.22.39.3.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.26.42.5.42h3.84c.24 0 .46-.18.5-.42l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32a.5.5 0 0 0-.12-.61l-2.01-1.58zM12 15.5a3.5 3.5 0 1 1 0-7 3.5 3.5 0 0 1 0 7z"/></svg>') 8px 8px no-repeat;
    background-size: 16px;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text);
}

.settings-panel {
    text-align: left;
    margin: 10px 0;
    padding: 10px;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    line-height: 1.8em;
    clear: both;
}

.settings-panel label:not(.switch) { display: inline-block; width: 100px; }

.switch { position: relative; display: inline-block; width: 44px; height: 22px; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--border-strong); transition: .3s; border-radius: 22px;
}
.switch .slider:before {
    position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px;
    background-color: #fff; transition: .3s; border-radius: 50%;
}
.switch input:checked + .slider { background-color: var(--accent); }
.switch input:checked + .slider:before { transform: translateX(22px); }

.font-controls { display: inline-flex; align-items: center; gap: 8px; }
.font-controls button {
    width: 28px; height: 28px; border: 1px solid var(--border-strong); background: none;
    border-radius: 4px; cursor: pointer; color: var(--text); font-size: 16px; line-height: 1;
}
.font-controls .font-number { min-width: 24px; text-align: center; display: inline-block; }

.par p {
    margin: 0 0 20px;
    line-height: 1.7;
    color: var(--text);
}
.read-box { position: relative; }
.bg-bar {
    display: block;
    width: 100%;
    height: 6px;
    background: var(--border);
    position: absolute;
    bottom: -1px;
}
.prog-bar { background: var(--accent); display: block; height: 6px; }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
    padding-top: 1.5em;
    background: var(--footer-bg);
    color: var(--text);
    clear: both;
    flex-shrink: 0;
    width: 100%;
}

.site-footer .container { padding: 1.5em; max-width: var(--page-width); margin: 0 auto; }

.copyright {
    color: var(--text);
    padding-top: 1.5em;
    margin-top: 0;
    border-top: 1px solid var(--border-header);
    text-align: center;
    line-height: 28px;
    font-size: 13px;
}

.footer-menu {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin: 0 0 1em;
    padding: 0;
}

.footer-menu li { display: inline; }

.copyright a { color: var(--text); padding: 0 5px; }

/* ==========================================================================
   Night mode toggle button state
   ========================================================================== */
[data-theme="night"] .m-card { background: var(--card-bg); }
[data-theme="night"] .site-footer { background: var(--footer-bg); }

/* ==========================================================================
   Sidebar: Novel Ranking (Day/Week/Month tabs)
   ========================================================================== */
.rank-tabs.tabs { margin-bottom: 4px; }
.rank-tabs.tabs button { font-size: 13px; padding: 8px 2px; }

.rank-list { padding-top: 4px; }

.rank-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--card-bg);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    transition: box-shadow .15s ease, border-color .15s ease;
    overflow: hidden;
    position: relative;
}
.rank-row:last-child { margin-bottom: 0; }
.rank-row:hover { border-color: var(--accent); box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.rank-row:hover .rank-title { color: var(--accent); }

.rank-row .rank-num {
    flex: 0 0 auto;
    width: 22px;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 13px;
}

.rank-row .rank-tmb {
    flex: 0 0 auto;
    width: 44px;
    height: 60px;
    overflow: hidden;
    border-radius: 3px;
    background: var(--border);
    display: block;
    line-height: 0;
}

.rank-row .rank-tmb img { display: block; width: 100%; height: 100%; max-width: 100%; max-height: 100%; object-fit: cover; }

.rank-row .rank-info {
    flex: 1;
    min-width: 0;
}

.rank-row .rank-title {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-row .rank-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.rank-row .rank-meta .stars-display { font-size: 12px; }
.rank-row .rank-avg { color: var(--text-muted); }

.see-more-btn {
    border-radius: 4px;
    padding: 8px 14px;
    font-size: 13px;
    margin: 12px auto 0;
}

/* ==========================================================================
   Sidebar: Recommendation / Random Novels
   Reuses the exact same .novel-card.box design as "Similar Novels"
   (.novel-grid) — only the column count/width differs.
   ========================================================================== */
.mini-novel-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding-top: 6px;
    overflow: hidden; /* filet de sécurité si un contenu imprévu reste trop large */
}

.mini-novel-grid .novel-card.box {
    width: 100%;
    max-width: none;
    min-width: 0; /* sans ça, un item de grille reprend la taille "naturelle" de son
                     contenu (image, texte) au lieu de respecter sa colonne 1fr,
                     ce qui fait déborder toute la grille du cadre */
    margin: 0;
    overflow: hidden;
}

.mini-novel-grid .novel-card .cover {
    max-width: none;
    width: 100%;
    height: auto;
    aspect-ratio: 120 / 152;
}

.mini-novel-grid .novel-card .status-label {
    max-width: none;
    width: 100%;
}

.mini-novel-grid .novel-card .status,
.mini-novel-grid .novel-card .ch {
    max-width: calc(100% - 8px); /* diagonal placement already prevents overlap; this just guards against absurdly long status text */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
    padding: 2px 4px;
}

.mini-novel-grid .novel-card .list-title,
.mini-novel-grid .novel-card .genre {
    overflow-wrap: anywhere;
}

.mini-rating {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 4px;
    font-size: 12px;
}

.mini-rating .stars-display { font-size: 12px; }
.mini-rating-num { color: var(--text-muted); }

/* ==========================================================================
   Responsive (breakpoints matched to original)
   ========================================================================== */
@media only screen and (max-width: 1140px) {
    article.content, .sidebar-container { float: none; margin: 0 auto; max-width: var(--content-width); }
    .site-header { padding: 8px 0; }
    .site-nav { display: none; }
    main.container { margin-top: 76px; }

    /* The sidebar goes from a narrow 332px column to full content width at
       this same breakpoint (see the rule just above), so there's room for
       a 3rd column in "Random Novels" instead of the 2 columns it's
       cramped into on desktop. */
    .mini-novel-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---- Tablet / large phone: header controls start competing for space
        with the hamburger button once the desktop nav is hidden ---- */
@media only screen and (max-width: 600px) {
    .site-header .wrap { gap: 10px; }
    .site-title { font-size: 17px; padding-right: 10px; }
    .site-logo { padding-right: 10px; }
    .site-logo img { height: 26px; max-width: 150px; }
    .search-form { flex: 1 1 auto; min-width: 0; }
    .search-form input[type="search"] {
        width: 100%;
        min-width: 0;
        flex: 1 1 auto;
    }
}

/* ---- Small phones: the header row (burger + logo + search) needs to
        stay on one line without pushing the page into horizontal scroll ---- */
@media only screen and (max-width: 420px) {
    .site-header { padding: 6px 0; }
    main.container { margin-top: 62px; }
    .site-header .wrap { gap: 6px; }
    .site-title { font-size: 14px; padding-right: 6px; }
    .site-logo { padding-right: 6px; }
    .site-logo img { height: 22px; max-width: 110px; }
    .search-form input[type="search"] { font-size: 13px; padding: 6px 2px; }
    .search-form button { padding: 6px 4px; font-size: 13px; }

    .entry-title { font-size: 18px; padding: 8px 10px; }
    .details-title, .desc h2 { font-size: 15px; }
    .info-wrap .i { font-size: 15px; }

    table.info td.tbl-lbl { width: auto; min-width: 84px; }
    table.info td { padding: 6px; font-size: 13px; }

    .novel-card.box { max-width: none; }
    .nov-head .main-tmb { width: 140px; }

    /* Prev / ToC / Next can no longer share one row at this width —
       let it wrap onto two centred rows instead of squeezing/overflowing. */
    .chapter-nav { flex-wrap: wrap; row-gap: 8px; justify-content: center; }
    .chapter-nav .prev,
    .chapter-nav .next { float: none; width: auto; flex: 0 0 auto; }
    .chapter-nav .toc { order: 3; width: 100%; margin: 0; }
}

/* ==========================================================================
   Mobile hamburger + off-canvas sidebar menu
   ========================================================================== */
.mobile-menu-toggle {
    display: none; /* shown only under the 1140px breakpoint below */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 32px;
    height: 32px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
}

/* This has to come AFTER the base ".mobile-menu-toggle { display: none }"
   rule above, source order — not just the media query — decides which one
   wins when both have the same specificity. */
@media only screen and (max-width: 1140px) {
    .mobile-menu-toggle { display: flex; }
}

.mobile-menu-toggle .bar {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
}

.mobile-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
}

.mobile-sidebar-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.mobile-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 82vw;
    background: var(--card-bg, #fff);
    z-index: 999;
    box-shadow: 2px 0 12px rgba(0, 0, 0, .2);
    transform: translateX(-100%);
    transition: transform .25s ease;
    overflow-y: auto;
    padding: 50px 0 20px;
    box-sizing: border-box;
}

.mobile-sidebar.is-open {
    transform: translateX(0);
}

.mobile-sidebar-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    line-height: 1;
    font-size: 24px;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
}

.mobile-sidebar-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    font-size: 15px;
}

.mobile-sidebar-nav a:hover { background: var(--hover-bg, rgba(0,0,0,.04)); }

body.mobile-sidebar-open { overflow: hidden; }

@media only screen and (max-width: 760px) {
    .m-card { margin-top: 10px; padding: 10px; }
    .chapter-body { padding-left: 10px; padding-right: 10px; }
    .novel-header { flex-direction: column; }
    .novel-header .cover { width: 120px; height: 160px; }
}

@media only screen and (max-width: 464px) {
    .novel-card.box { width: calc(50% - 8px); padding: 8px; }
}

.chapter-ad { margin: 16px 0; text-align: center; min-height: 100px; overflow: hidden; }