:root{
  --bg:#070a14;
  --bg2:#0b1020;
  --card: rgba(15,23,42,.72);
  --cardSolid:#0f172a;
  --border: rgba(148,163,184,.16);
  --border2: rgba(148,163,184,.22);
  --muted:#9aa4b2;
  --text:#e5e7eb;
  --text2:#cbd5e1;
  --input: rgba(2,6,23,.55);
  --primary:#38bdf8;
  --primaryText:#001018;
  --danger:#fb7185;

  --shadow: 0 18px 60px rgba(0,0,0,.45);
  --shadowSoft: 0 12px 35px rgba(0,0,0,.28);

  --fz: 19px;
  --lh: 2.0;
  --readerMax: 780px;
}

/* ===== 白天模式变量覆盖 ===== */
body.theme-light{
  --bg:#f5f1e6;
  --bg2:#efe7d6;
  --card: rgba(255,255,255,.88);
  --cardSolid:#ffffff;
  --border: rgba(120,120,120,.14);
  --border2: rgba(120,120,120,.20);
  --muted:#6b7280;
  --text:#111827;
  --text2:#374151;
  --input: rgba(255,255,255,.92);
  --primary:#2563eb;
  --primaryText:#ffffff;
  --danger:#dc2626;

  --shadow: 0 18px 60px rgba(0,0,0,.12);
  --shadowSoft: 0 12px 35px rgba(0,0,0,.08);
}

*{ box-sizing:border-box }
html,body{ height:100% }

body{
  margin:0;
  font-family: system-ui,-apple-system,Segoe UI,Roboto, "PingFang SC","Microsoft YaHei",sans-serif;
  color:var(--text);
  background:
    radial-gradient(1200px 650px at 50% -120px, rgba(56,189,248,.18), transparent 55%),
    radial-gradient(900px 500px at 85% 0px, rgba(251,113,133,.12), transparent 55%),
    linear-gradient(180deg, var(--bg), var(--bg2));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background .22s ease, color .22s ease;
}

body.theme-light{
  background:
    radial-gradient(1200px 650px at 50% -120px, rgba(37,99,235,.06), transparent 55%),
    linear-gradient(180deg, var(--bg), var(--bg2));
}

/* 顶部栏 */
header{
  position:sticky; top:0; z-index:20;
  padding: 12px 14px;
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  background: rgba(2,6,23,.72);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(148,163,184,.18);
  transition: background .22s ease, border-color .22s ease;
}
body.theme-light header{
  background: rgba(255,255,255,.82);
  border-bottom: 1px solid rgba(120,120,120,.14);
}

.brand{
  font-weight: 900;
  letter-spacing:.5px;
  display:flex; align-items:center; gap:8px;
  user-select:none;
}
.brand .dot{
  width:10px;height:10px;border-radius:999px;background:var(--primary);
  box-shadow: 0 0 0 6px rgba(56,189,248,.14);
}
.pill{
  font-size:12px;
  padding:6px 10px;
  border:1px solid rgba(148,163,184,.22);
  border-radius:999px;
  color:#cbd5e1;
  background: rgba(148,163,184,.06);
  white-space:nowrap;
  user-select:none;
}
body.theme-light .pill{
  color:#374151;
  background: rgba(0,0,0,.03);
  border-color: rgba(120,120,120,.18);
}

.top-actions{ margin-left:auto; display:flex; gap:10px; flex-wrap:wrap; align-items:center; }

.btn{
  padding:10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,.22);
  background: rgba(148,163,184,.06);
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .05s ease, background .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover{ background: rgba(56,189,248,.10); border-color: rgba(56,189,248,.38); }
.btn:active{ transform: translateY(1px); }
.btn.primary{
  border:0;
  background: var(--primary);
  color: var(--primaryText);
  box-shadow: 0 10px 30px rgba(56,189,248,.18);
}
.btn.secondary{
  background: rgba(148,163,184,.10);
  border-color: rgba(148,163,184,.25);
}

/* 布局 */
.wrap{
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px;
  display:grid;
  grid-template-columns: 260px 360px 1fr;
  gap: 14px;
  min-height: calc(100vh - 70px);
}
@media (max-width: 1100px){
  .wrap{ grid-template-columns: 260px 1fr; }
  .right{ grid-column: 1 / -1; }
}
@media (max-width: 860px){
  .wrap{ grid-template-columns: 1fr; }
}

/* 卡片 */
.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow:hidden;
  box-shadow: var(--shadowSoft);
  min-width:0;
  transition: background .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.card h3{
  margin:0;
  padding: 12px 12px;
  font-size: 13px;
  color: var(--text2);
  border-bottom: 1px solid rgba(148,163,184,.14);
  display:flex; align-items:center; justify-content:space-between;
  gap:10px;
}
.body{ padding: 12px; }

input{
  width:100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,.18);
  background: rgba(2,6,23,.45);
  color: var(--text);
  outline:none;
}
input:focus{
  border-color: rgba(56,189,248,.55);
  box-shadow: 0 0 0 6px rgba(56,189,248,.12);
}

.muted{ color: var(--muted); font-size: 13px; }
.small{ color: var(--muted); font-size: 12px; }
.mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }

/* 列表 */
.list{
  max-height: calc(100vh - 210px);
  overflow:auto;
  -webkit-overflow-scrolling: touch;
}
.item{
  padding: 10px 12px;
  border-top: 1px solid rgba(148,163,184,.12);
  cursor:pointer;
  transition: background .12s ease;
}
.item:hover{ background: rgba(56,189,248,.06); }
.item.active{ background: rgba(56,189,248,.12); }
.title{ font-weight: 900; margin-bottom: 4px; }

/* 阅读器 */
.reader-shell{
  position: relative;
  padding: 0;
}
.readbar{
  position: sticky;
  top: 62px;
  z-index: 15;
  margin: 12px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(148,163,184,.18);
  background: rgba(2,6,23,.55);
  backdrop-filter: blur(12px);
  display:flex;
  gap: 8px;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  transition: background .22s ease, border-color .22s ease;
}
body.theme-light .readbar{
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(120,120,120,.16);
}

.readbar .left, .readbar .right{
  display:flex; gap:8px; flex-wrap:wrap; align-items:center;
}

.btnx{
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,.22);
  background: rgba(148,163,184,.06);
  color: var(--text);
  font-weight: 900;
  cursor:pointer;
  font-size: 12px;
  user-select:none;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btnx:hover{ border-color: rgba(56,189,248,.40); background: rgba(56,189,248,.10); }
.btnx.primary{
  border:0;
  background: var(--primary);
  color: var(--primaryText);
}
.btnx.danger{
  border-color: rgba(251,113,133,.45);
  background: rgba(251,113,133,.10);
  color: #fecdd3;
}

body.theme-light .btn,
body.theme-light .btnx,
body.theme-light .fab button{
  color: var(--text);
  background: rgba(0,0,0,.03);
  border-color: rgba(120,120,120,.18);
}
body.theme-light .btn:hover,
body.theme-light .btnx:hover,
body.theme-light .fab button:hover{
  background: rgba(37,99,235,.08);
  border-color: rgba(37,99,235,.28);
}
body.theme-light .btn.primary,
body.theme-light .btnx.primary{
  background: var(--primary);
  color: var(--primaryText);
}

.reader{
  max-width: var(--readerMax);
  margin: 0 auto;
  padding: 110px 18px 56px;
  line-height: var(--lh);
  font-size: var(--fz);
  letter-spacing: .02em;
  word-break: break-word;
}
.reader h1{
  margin: 10px 0 18px;
  font-size: 26px;
  line-height: 1.35;
  text-align:center;
  font-weight: 1000;
}
.reader .meta{
  text-align:center;
  margin-top: -8px;
  margin-bottom: 14px;
  color: rgba(148,163,184,.9);
  font-size: 12px;
}
.reader h2{
  margin: 28px 0 12px;
  font-size: 18px;
  font-weight: 900;
  border-left: 4px solid rgba(56,189,248,.9);
  padding-left: 10px;
}
body.theme-light .reader h2{
  border-left: 4px solid rgba(37,99,235,.88);
}
.reader p{
  margin: 12px 0;
  white-space: pre-wrap;
}
.reader pre{
  margin: 12px 0;
  white-space: pre-wrap;
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 14px;
  padding: 12px;
  background: rgba(2,6,23,.38);
  overflow:auto;
}
body.theme-light .reader pre{
  background: rgba(0,0,0,.03);
  border-color: rgba(120,120,120,.16);
}
.reader .empty{
  color: rgba(148,163,184,.9);
  text-align:center;
  padding: 26px 0;
}

/* 页面内插入的标签区块样式 */
.tag-wrap{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
  margin:10px 0 14px 0;
}
.tag-chip{
  display:inline-block;
  padding:4px 10px;
  border:1px solid rgba(148,163,184,.35);
  border-radius:999px;
  font-size:12px;
  opacity:.95;
}
.tag-input{
  flex:1;
  min-width:160px;
  padding:8px 10px;
  border-radius:10px;
  border:1px solid rgba(148,163,184,.35);
  background:rgba(2,6,23,.35);
  color:#e5e7eb;
  outline:none;
}
.tag-btn{
  padding:8px 12px;
  border-radius:10px;
  border:1px solid rgba(148,163,184,.35);
  background:rgba(56,189,248,.18);
  color:#e5e7eb;
  cursor:pointer;
}
.tag-btn:hover{ background:rgba(56,189,248,.28); }

body.theme-light input,
body.theme-light .tag-input{
  background: rgba(255,255,255,.95) !important;
  color: #111827 !important;
  border-color: rgba(120,120,120,.18) !important;
}
body.theme-light .tag-btn{
  background: rgba(37,99,235,.10);
  color: #111827;
  border-color: rgba(120,120,120,.18);
}
body.theme-light .tag-btn:hover{
  background: rgba(37,99,235,.16);
}

.meta-line{ margin:-6px 0 10px 0; opacity:.85; }
.mode-tip{
  margin:-2px 0 12px 0;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(56,189,248,.22);
  background:rgba(56,189,248,.10);
}
body.theme-light .mode-tip{
  border:1px solid rgba(37,99,235,.18);
  background:rgba(37,99,235,.07);
}

/* Toast */
.toast{
  position:fixed; left:50%; transform:translateX(-50%);
  bottom:18px; z-index:99;
  background:rgba(2,6,23,.92);
  border:1px solid rgba(148,163,184,.25);
  color:#e2e8f0;
  padding:10px 12px;
  border-radius:12px;
  font-size:13px;
  display:none;
  max-width:min(900px,92vw);
  box-shadow: var(--shadowSoft);
}
body.theme-light .toast{
  background: rgba(255,255,255,.96);
  color: #111827;
  border: 1px solid rgba(120,120,120,.18);
}

/* 悬浮按钮 */
.fab{
  position: fixed;
  right: 14px;
  bottom: 16px;
  z-index: 30;
  display:flex;
  flex-direction:column;
  gap:10px;
}
.fab button{
  width: 48px;
  height: 48px;
  border-radius: 16px;
  border: 1px solid rgba(148,163,184,.18);
  background: rgba(2,6,23,.70);
  color: var(--text);
  cursor:pointer;
  box-shadow: var(--shadowSoft);
  backdrop-filter: blur(10px);
  font-size: 18px;
}
.fab button:hover{
  border-color: rgba(56,189,248,.45);
  background: rgba(56,189,248,.10);
}

/* 抽屉（章节目录） */
.drawer{
  position: fixed;
  inset: 0;
  z-index: 40;
  display:none;
}
.drawer.show{ display:block; }
.drawer .mask{
  position:absolute; inset:0;
  background: rgba(0,0,0,.55);
}
body.theme-light .drawer .mask{
  background: rgba(0,0,0,.25);
}
.drawer .panel{
  position:absolute;
  right:0; top:0; bottom:0;
  width: min(420px, 88vw);
  background: rgba(2,6,23,.88);
  border-left: 1px solid rgba(148,163,184,.18);
  backdrop-filter: blur(14px);
  box-shadow: -20px 0 60px rgba(0,0,0,.45);
  display:flex;
  flex-direction:column;
}
body.theme-light .drawer .panel{
  background: rgba(255,255,255,.96);
  border-left: 1px solid rgba(120,120,120,.16);
}
.drawer .panel header{
  position:static;
  border-bottom: 1px solid rgba(148,163,184,.16);
  background: transparent;
  backdrop-filter: none;
}
.drawer .panel .content{
  padding: 10px;
  overflow:auto;
  -webkit-overflow-scrolling: touch;
}
.chapter-item{
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,.14);
  background: rgba(148,163,184,.06);
  margin-bottom: 10px;
  cursor:pointer;
}
.chapter-item:hover{
  border-color: rgba(56,189,248,.40);
  background: rgba(56,189,248,.10);
}
.chapter-item .t{ font-weight: 900; }
.chapter-item .s{ font-size: 12px; color: rgba(148,163,184,.9); margin-top:4px; }

/* 阅读模式：全屏阅读 */
body.reading .wrap{
  grid-template-columns: 1fr !important;
  max-width: 980px;
}
body.reading .card:not(.right){ display:none !important; }
body.reading .card.right{
  background: rgba(15,23,42,.68);
  border-color: rgba(148,163,184,.18);
  box-shadow: var(--shadow);
}
body.reading .card.right h3{ display:none; }

/* 移动端 */
@media (max-width: 720px){
  header{ padding: 10px 12px; gap: 8px; }
  .pill{ font-size: 11px; padding: 5px 8px; }
  .wrap{ padding: 10px; }
  .readbar{ top: 56px; margin: 10px; }
  .reader{ padding: 96px 14px 56px; }
  .reader h1{ font-size: 22px; }
}

/* 筛选行 */
.filter-row{
  margin-top: 10px;
  display:flex;
  align-items:center;
  gap:10px;
  font-size: 13px;
  color: rgba(148,163,184,.95);
  user-select:none;
}
.filter-row input{
  width: 16px;
  height: 16px;
  padding:0;
  border-radius: 4px;
  box-shadow:none;
}
.filter-row .hint{
  margin-left:auto;
  font-size: 12px;
  color: rgba(148,163,184,.7);
}

@media (max-width: 860px){
  #dateList{
    max-height: 42vh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  #novelList{
    max-height: 42vh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ===== 作者显示强化 ===== */
.reader .meta{
  color: rgba(226,232,240,.92);
}
.reader .meta .author{
  display:inline-flex;
  align-items:center;
  gap:6px;
  color: #eaf4ff;
  font-weight: 900;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(56,189,248,.22);
  border: 1px solid rgba(56,189,248,.40);
  box-shadow: 0 10px 26px rgba(56,189,248,.14);
}
a.authorLink{
  color: rgba(226,232,240,.95);
  text-decoration: none;
  font-weight: 800;
}
a.authorLink:hover{
  text-decoration: underline;
}

/* Footer */
.site-footer{
  margin-top:16px;
  background:#0b1220;
  border-top:1px solid rgba(255,255,255,.08);
  color:#9aa4b2;
  font-size:14px;
  padding:26px 18px;
}
.site-footer .footer-inner{
  max-width:1200px;
  margin:0 auto;
  display:flex;
  flex-wrap:wrap;
  gap:16px 22px;
  align-items:center;
  justify-content:space-between;
}
.site-footer .footer-left{
  min-width:260px;
}
.site-footer .footer-copy{
  color:#e2e8f0;
  font-weight:700;
  margin-bottom:6px;
}
.site-footer .footer-support,
.site-footer .footer-scope{
  color:#9aa4b2;
  font-size:13px;
  line-height:1.6;
}
.site-footer a{
  color:#9aa4b2;
  text-decoration:none;
}
.site-footer a:hover{
  color:#ffffff;
  text-decoration:underline;
}
.site-footer .sep{opacity:.6;margin:0 8px;}
.site-footer .footer-links{
  display:flex;
  flex-wrap:wrap;
  gap:12px 18px;
  justify-content:flex-end;
}

/* =========================================================
   NOVEL_HOME_SMART_FILTER_DEDUPE_V1
   小说首页优化：
   1) 首页只保留浏览器外层滚动条
   2) 取消 bookList 内部滚动条
   3) 默认正文过滤 ≥50KB
   4) 增加“隐藏同名重复”开关样式
   ========================================================= */

body.page-library {
    overflow-y: auto;
}

    body.page-library #bookList.list {
        max-height: none !important;
        overflow: visible !important;
        -webkit-overflow-scrolling: auto !important;
    }

    body.page-library .library-filter-row {
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
        align-items: center;
    }

    body.page-library .library-search-input {
        flex: 1;
        min-width: 220px;
    }

    body.page-library .library-select {
        height: 42px;
        min-width: 128px;
        color: var(--text);
        background-color: rgba(15,23,42,.96);
        border-color: rgba(148,163,184,.25);
        color-scheme: dark;
    }

    body.page-library #selLanguage {
        display: none !important;
    }

    body.page-library .library-lang-tabs {
        display: inline-flex;
        gap: 6px;
        padding: 3px;
        border: 1px solid rgba(148,163,184,.25);
        border-radius: 14px;
        background: rgba(2,6,23,.50);
    }

    body.page-library .library-lang-tabs .btn {
        min-height: 36px;
        padding: 8px 11px;
        border-radius: 11px;
    }

    body.page-library .library-lang-tabs .btn.active {
        background: var(--primary);
        color: var(--primaryText);
        border-color: transparent;
    }

    body.page-library .language-picker {
        position: relative;
        display: inline-flex;
        min-width: 148px;
    }

    body.page-library .language-current {
        width: 100%;
        min-height: 42px;
        display: inline-flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }

    body.page-library .language-current::after {
        content: "▾";
        font-size: 12px;
        opacity: .75;
    }

    body.page-library .language-menu {
        position: absolute;
        top: calc(100% + 6px);
        left: 0;
        z-index: 80;
        min-width: 190px;
        display: none;
        padding: 6px;
        border: 1px solid rgba(148,163,184,.25);
        border-radius: 14px;
        background: #0f172a;
        box-shadow: 0 18px 50px rgba(0,0,0,.38);
    }

    body.page-library .language-picker.open .language-menu {
        display: grid;
        gap: 4px;
    }

    body.page-library .language-menu button {
        width: 100%;
        padding: 9px 11px;
        border: 0;
        border-radius: 10px;
        background: transparent;
        color: #e5e7eb;
        text-align: left;
        font-weight: 850;
        cursor: pointer;
    }

    body.page-library .language-menu button:hover,
    body.page-library .language-menu button.active {
        background: rgba(56,189,248,.16);
        color: #fff;
    }

    body.page-library .library-select option {
        color: #e5e7eb;
        background-color: #0f172a;
    }

    body.page-library .library-select option:checked {
        color: #ffffff;
        background-color: #2563eb;
    }

    body.page-library .filter-check {
        height: 42px;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 0 12px;
        border-radius: 12px;
        border: 1px solid rgba(148,163,184,.25);
        background: rgba(148,163,184,.10);
        color: var(--text);
        font-weight: 900;
        cursor: pointer;
        user-select: none;
        white-space: nowrap;
    }

        body.page-library .filter-check:hover {
            background: rgba(56,189,248,.10);
            border-color: rgba(56,189,248,.38);
        }

        body.page-library .filter-check input {
            width: 16px;
            height: 16px;
            padding: 0;
            margin: 0;
            box-shadow: none;
            cursor: pointer;
        }

body.theme-light.page-library .filter-check {
    color: var(--text);
    background: rgba(0,0,0,.03);
    border-color: rgba(120,120,120,.18);
}

    body.theme-light.page-library .filter-check:hover {
        background: rgba(37,99,235,.08);
        border-color: rgba(37,99,235,.28);
    }

@media (max-width: 720px) {
    body.page-library .library-filter-row {
        align-items: stretch;
    }

    body.page-library .library-search-input {
        min-width: 100%;
    }

    body.page-library .library-select,
    body.page-library .filter-check,
    body.page-library .library-lang-tabs,
    body.page-library .language-picker,
    body.page-library #btnTags {
        width: 100%;
        justify-content: center;
    }

    body.page-library .language-menu {
        width: 100%;
    }
}

body.theme-light.page-library .library-select {
    color: var(--text);
    background-color: rgba(255,255,255,.96);
    border-color: rgba(120,120,120,.18);
    color-scheme: light;
}

body.theme-light.page-library .library-lang-tabs {
    background: rgba(0,0,0,.03);
    border-color: rgba(120,120,120,.18);
}

body.theme-light.page-library .language-menu {
    background: #ffffff;
    border-color: rgba(120,120,120,.18);
    box-shadow: 0 18px 50px rgba(0,0,0,.14);
}

body.theme-light.page-library .language-menu button {
    color: #111827;
}

body.theme-light.page-library .language-menu button:hover,
body.theme-light.page-library .language-menu button.active {
    background: rgba(37,99,235,.10);
    color: #111827;
}

body.theme-light.page-library .library-select option {
    color: #111827;
    background-color: #ffffff;
}
