:root {
    --reader-bg: #f0eee7;
    --reader-paper: #fffdf8;
    --reader-ink: #2d302e;
    --reader-muted: #7a7d78;
    --reader-line: #e3dfd5;
    --reader-accent: #13855d;
    --reader-panel: #f7f4ec;
    --reader-font-size: 18px;
}

body { background: var(--reader-bg); color: var(--reader-ink); }
body::before { display: none; }
.novel-reader ~ .footer-container { display: none; }
.novel-reader { min-height: 100vh; background: var(--reader-bg); color: var(--reader-ink); transition: background .25s ease, color .25s ease; }
.novel-reader[data-color-mode="dark"] { --reader-bg: #171b19; --reader-paper: #222725; --reader-ink: #d8ddd9; --reader-muted: #929a95; --reader-line: #353c38; --reader-accent: #55c996; --reader-panel: #2a302d; }
.reader-progress { position: fixed; z-index: 90; top: 0; right: 0; left: 0; height: 3px; background: transparent; }
.reader-progress span { display: block; width: 0; height: 100%; background: var(--reader-accent); transition: width .12s linear; }
.reader-topbar { position: sticky; z-index: 60; top: 0; border-bottom: 1px solid var(--reader-line); background: color-mix(in srgb, var(--reader-paper) 92%, transparent); backdrop-filter: blur(16px); }
.reader-topbar-inner { width: min(1180px, calc(100% - 36px)); min-height: 66px; margin: auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; }
.reader-back { display: inline-flex; align-items: center; gap: 8px; justify-self: start; color: var(--reader-muted); text-decoration: none; font-size: .8rem; font-weight: 850; }
.reader-book-name { min-width: 0; display: flex; flex-direction: column; align-items: center; }
.reader-book-name small { color: var(--reader-accent); font-size: .62rem; font-weight: 850; letter-spacing: .1em; }
.reader-book-name strong { max-width: 360px; overflow: hidden; color: var(--reader-ink); text-overflow: ellipsis; white-space: nowrap; font-family: "STSong", "SimSun", serif; font-size: 1rem; }
.reader-tools { justify-self: end; display: flex; gap: 6px; }
.reader-tools button { min-width: 38px; height: 36px; border: 1px solid var(--reader-line); border-radius: 9px; background: var(--reader-panel); color: var(--reader-ink); font-weight: 850; cursor: pointer; }

.reader-layout { width: min(1120px, calc(100% - 36px)); margin: 30px auto 72px; display: grid; grid-template-columns: 260px minmax(0, 760px); justify-content: center; gap: 28px; align-items: start; }
.reader-sidebar { position: sticky; top: 92px; max-height: calc(100vh - 122px); overflow: hidden; display: flex; flex-direction: column; border: 1px solid var(--reader-line); border-radius: 17px; background: var(--reader-paper); box-shadow: 0 12px 36px rgba(38,42,39,.06); }
.reader-book-card { display: grid; grid-template-columns: 58px minmax(0,1fr); gap: 12px; align-items: center; padding: 15px; border-bottom: 1px solid var(--reader-line); }
.reader-book-card img { width: 58px; height: 78px; object-fit: cover; border-radius: 5px; box-shadow: 0 6px 14px rgba(0,0,0,.16); }
.reader-book-card div { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.reader-book-card strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: "STSong", "SimSun", serif; font-size: 1rem; }
.reader-book-card span { color: var(--reader-muted); font-size: .68rem; }
.reader-toc-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 15px 8px; }
.reader-toc-head span { font-size: .78rem; font-weight: 900; }
.reader-toc-head small { color: var(--reader-muted); font-size: .65rem; }
.reader-toc { min-height: 0; overflow-y: auto; padding: 3px 8px 12px; }
.reader-toc button { width: 100%; min-height: 43px; display: grid; grid-template-columns: 24px minmax(0,1fr); gap: 8px; align-items: center; padding: 7px 8px; border: 0; border-radius: 9px; background: transparent; color: var(--reader-muted); text-align: left; cursor: pointer; }
.reader-toc button span { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--reader-panel); font-size: .62rem; }
.reader-toc button strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .72rem; }
.reader-toc button:hover, .reader-toc button.is-active { background: color-mix(in srgb, var(--reader-accent) 10%, transparent); color: var(--reader-accent); }

.reader-paper { min-width: 0; padding: 58px clamp(32px, 7vw, 76px) 42px; border: 1px solid var(--reader-line); border-radius: 20px; background: var(--reader-paper); box-shadow: 0 20px 55px rgba(38,42,39,.08); }
.reader-chapter-head { padding-bottom: 30px; border-bottom: 1px solid var(--reader-line); text-align: center; }
.reader-chapter-head > span { color: var(--reader-accent); font-size: .7rem; font-weight: 850; letter-spacing: .08em; }
.reader-chapter-head h1 { margin: 14px 0 9px; color: var(--reader-ink); font-family: "STSong", "SimSun", serif; font-size: clamp(1.65rem, 4vw, 2.15rem); font-weight: 900; }
.reader-chapter-head p { margin: 0; color: var(--reader-muted); font-size: .72rem; }
.reader-content { padding: 36px 0 18px; font-family: "STSong", "Songti SC", "SimSun", serif; font-size: var(--reader-font-size); line-height: 2.05; letter-spacing: .035em; }
.reader-content p { margin: 0 0 1.25em; text-align: justify; text-indent: 2em; }
.reader-chapter-nav { margin-top: 28px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding-top: 24px; border-top: 1px solid var(--reader-line); }
.reader-chapter-nav button { width: min(160px, 100%); min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 18px; border: 1px solid var(--reader-line); border-radius: 11px; background: var(--reader-panel); color: var(--reader-ink); font-size: .76rem; font-weight: 850; white-space: nowrap; cursor: pointer; transition: border-color .18s ease, background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease; }
.reader-chapter-nav button:first-child { justify-self: start; }
.reader-chapter-nav button:last-child { justify-self: end; }
.reader-chapter-nav button:hover:not(:disabled) { border-color: color-mix(in srgb, var(--reader-accent) 40%, var(--reader-line)); background: color-mix(in srgb, var(--reader-accent) 9%, var(--reader-paper)); color: var(--reader-accent); box-shadow: 0 7px 18px rgba(20,70,51,.08); transform: translateY(-1px); }
.reader-chapter-nav button:active:not(:disabled) { transform: translateY(0); }
.reader-chapter-nav button:disabled { opacity: .38; cursor: not-allowed; }
.reader-chapter-nav > span { min-width: 54px; padding: 6px 9px; border-radius: 999px; background: var(--reader-panel); color: var(--reader-muted); text-align: center; font-size: .68rem; font-weight: 800; }
.reader-promotion { margin-top: 32px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 17px 18px; border: 1px dashed color-mix(in srgb, var(--reader-accent) 35%, var(--reader-line)); border-radius: 13px; background: color-mix(in srgb, var(--reader-accent) 6%, var(--reader-paper)); }
.reader-promotion div { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.reader-promotion small { color: var(--reader-muted); font-size: .65rem; }
.reader-promotion strong { font-size: .78rem; }
.reader-promotion code { margin-top: 4px; color: var(--reader-accent); font-family: inherit; font-size: .75rem; font-weight: 900; word-break: break-all; }
.reader-promotion button { min-width: 136px; min-height: 44px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 17px; border: 1px solid transparent; border-radius: 11px; background: var(--reader-accent); color: #fff; box-shadow: 0 8px 18px color-mix(in srgb, var(--reader-accent) 22%, transparent); font-size: .75rem; font-weight: 900; white-space: nowrap; cursor: pointer; transition: filter .18s ease, transform .18s ease, box-shadow .18s ease; }
.reader-promotion button:hover { filter: brightness(.94); box-shadow: 0 10px 22px color-mix(in srgb, var(--reader-accent) 28%, transparent); transform: translateY(-1px); }
.reader-promotion button:active { transform: translateY(0); }
.reader-mobile-bar, .reader-drawer-backdrop { display: none; }
.reader-toast { position: fixed; z-index: 120; bottom: 24px; left: 50%; padding: 10px 15px; border-radius: 999px; background: #143e30; color: #fff; font-size: .75rem; font-weight: 850; opacity: 0; transform: translate(-50%,15px); pointer-events: none; transition: .2s ease; }
.reader-toast.is-visible { opacity: 1; transform: translate(-50%,0); }
.reader-toast i { margin-right: 6px; color: #6cdbad; }

@media (max-width: 760px) {
    .novel-reader { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
    .reader-topbar-inner { width: calc(100% - 24px); min-height: 54px; grid-template-columns: 38px minmax(0,1fr) auto; gap: 7px; }
    .reader-back { width: 36px; height: 36px; justify-content: center; border: 1px solid var(--reader-line); border-radius: 50%; }
    .reader-back span, .reader-tools button:not([data-reader-theme]) { display: none; }
    .reader-book-name { align-items: flex-start; }
    .reader-book-name small { font-size: .57rem; }
    .reader-book-name strong { max-width: 190px; font-size: .9rem; }
    .reader-tools button { min-width: 36px; height: 36px; }
    .reader-layout { width: 100%; margin: 0; display: block; }
    .reader-sidebar { display: none; }
    .reader-paper { padding: 30px 22px 34px; border: 0; border-radius: 0; box-shadow: none; }
    .reader-chapter-head { padding-bottom: 23px; }
    .reader-chapter-head h1 { margin-top: 11px; font-size: 1.6rem; }
    .reader-content { padding-top: 28px; line-height: 2; }
    .reader-chapter-nav { margin-top: 20px; }
    .reader-chapter-nav button { width: 100%; min-width: 0; padding: 0 12px; }
    .reader-chapter-nav button span { display: inline; }
    .reader-promotion { align-items: stretch; flex-direction: column; }
    .reader-promotion button { min-height: 46px; }
    .reader-mobile-bar { position: fixed; z-index: 70; right: 0; bottom: 0; left: 0; min-height: 58px; display: grid; grid-template-columns: repeat(4,1fr); padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--reader-line); background: color-mix(in srgb, var(--reader-paper) 96%, transparent); backdrop-filter: blur(16px); }
    .reader-mobile-bar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: transparent; color: var(--reader-muted); font-size: .6rem; font-weight: 800; }
    .reader-mobile-bar i { font-size: .9rem; }
    .reader-drawer-backdrop { position: fixed; z-index: 100; inset: 0; display: grid; align-items: end; background: rgba(8,14,11,.55); }
    .reader-drawer-backdrop[hidden] { display: none; }
    .reader-drawer { max-height: 72dvh; overflow: hidden; border-radius: 20px 20px 0 0; background: var(--reader-paper); color: var(--reader-ink); }
    .reader-drawer header { min-height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border-bottom: 1px solid var(--reader-line); }
    .reader-drawer header button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--reader-panel); color: var(--reader-ink); }
    .reader-drawer nav { max-height: calc(72dvh - 56px); overflow-y: auto; padding: 8px 12px calc(16px + env(safe-area-inset-bottom)); }
    .reader-drawer nav button { width: 100%; min-height: 48px; padding: 0 8px; border: 0; border-bottom: 1px solid var(--reader-line); background: transparent; color: var(--reader-muted); text-align: left; font-size: .78rem; }
    .reader-drawer nav button.is-active { color: var(--reader-accent); font-weight: 900; }
    .reader-toast { bottom: calc(70px + env(safe-area-inset-bottom)); white-space: nowrap; }
}
