:root {
    --bg: #f5f5f4;
    --card: #ffffff;
    --text: #1f2328;
    --muted: #6b7280;
    --brand: #7c3aed;
    --brand-2: #a78bfa;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.04);
    --radius: 12px;
    --reader-font-size: 19px;
    --reader-font-family: "Georgia", "Songti SC", "SimSun", serif;
}

html[data-reader-theme="eye"] {
    --bg: #cbd9bd;
    --card: #e7eedf;
    --text: #253322;
    --muted: #5c6c56;
    --brand: #527342;
    --brand-2: #7f9d6c;
    --border: #b4c5a6;
    --shadow: 0 1px 3px rgba(42,63,35,.08), 0 8px 24px rgba(42,63,35,.05);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
    line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header {
    position: sticky; top: 0; z-index: 10;
    background: rgba(255,255,255,.9);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--border);
}
html[data-reader-theme="eye"] .site-header { background: rgba(231,238,223,.92); }
.header-inner { display: flex; align-items: center; gap: 20px; height: 60px; }
.brand {
    font-size: 20px; font-weight: 700; letter-spacing: .5px;
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
    -webkit-background-clip: text; background-clip: text; color: transparent;
    white-space: nowrap;
}
.search { margin-left: auto; display: flex; gap: 8px; }
.search input {
    width: min(52vw, 320px); padding: 9px 14px; border: 1px solid var(--border);
    border-radius: 999px; background: var(--card); color: var(--text); font-size: 14px; outline: none;
}
.search input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(167,139,250,.25); }
.search button {
    padding: 9px 18px; border: none; border-radius: 999px; cursor: pointer;
    background: var(--brand); color: #fff; font-size: 14px;
}
.search button:hover { background: #6d28d9; }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; align-items: center; margin: 22px 0 6px; }
.cats { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    padding: 5px 12px; border-radius: 999px; font-size: 13px; color: var(--muted);
    background: var(--card); border: 1px solid var(--border);
}
.chip:hover { color: var(--brand); border-color: var(--brand-2); }
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.sorts { display: flex; gap: 4px; }
.sort { padding: 5px 10px; font-size: 13px; color: var(--muted); border-radius: 8px; }
.sort:hover { color: var(--brand); }
.sort.active { color: var(--brand); font-weight: 600; }
.result-tip { color: var(--muted); font-size: 14px; margin: 8px 0; }

/* Novel grid */
.novel-grid {
    list-style: none; padding: 0; margin: 16px 0 30px;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px;
}
.novel-card { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease; }
.novel-card:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0,0,0,.12); }
.cover {
    aspect-ratio: 3/4; display: flex; align-items: center; justify-content: center; padding: 14px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1); color: #fff; text-align: center;
}
.cover .cover-title { font-size: 16px; font-weight: 700; line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
.cover[data-cat="校园"] { background: linear-gradient(135deg,#f472b6,#db2777); }
.cover[data-cat="都市"] { background: linear-gradient(135deg,#60a5fa,#2563eb); }
.cover[data-cat="玄幻"] { background: linear-gradient(135deg,#34d399,#059669); }
.cover[data-cat="古风"] { background: linear-gradient(135deg,#f59e0b,#d97706); }
.cover[data-cat="乡野"] { background: linear-gradient(135deg,#a3e635,#65a30d); }
.cover[data-cat="异国"] { background: linear-gradient(135deg,#22d3ee,#0891b2); }
.cover[data-cat="伦理"] { background: linear-gradient(135deg,#fb7185,#e11d48); }
.cover.big { aspect-ratio: auto; width: 160px; height: 213px; border-radius: var(--radius); flex: none; }

.meta { padding: 10px 12px 14px; }
.meta .title { margin: 0 0 4px; font-size: 15px; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.meta .author { margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.meta .sub { margin: 0; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tag { background: #ede9fe; color: var(--brand); padding: 1px 7px; border-radius: 6px; }
.done { color: #059669; }
.ing { color: #d97706; }

/* Pager */
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 10px 0 40px; }
.pg { padding: 8px 16px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.pg:hover { border-color: var(--brand-2); color: var(--brand); }
.pg.disabled { color: #c4c4c4; pointer-events: none; }
.pg-info { color: var(--muted); font-size: 14px; }
.empty { text-align: center; color: var(--muted); padding: 60px 0; }

/* Breadcrumb */
.crumb { font-size: 13px; color: var(--muted); margin: 20px 0; }
.crumb a:hover { color: var(--brand); }
.crumb span { margin: 0 6px; }

/* Novel head */
.novel-head { display: flex; gap: 24px; background: var(--card); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.novel-head .info h1 { margin: 0 0 8px; font-size: 24px; }
.novel-head .author { color: var(--muted); margin: 0 0 12px; }
.badges { display: flex; gap: 10px; align-items: center; margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.intro { color: var(--text); margin: 0 0 18px; max-width: 640px; }
.read-btn { display: inline-block; background: var(--brand); color: #fff; padding: 10px 24px; border-radius: 999px; font-size: 15px; }
.read-btn:hover { background: #6d28d9; }

/* TOC */
.toc { background: var(--card); border-radius: var(--radius); padding: 20px 24px; box-shadow: var(--shadow); margin: 22px 0 40px; }
.toc h2 { font-size: 18px; margin: 0 0 14px; }
.toc h2 small { color: var(--muted); font-weight: 400; font-size: 13px; }
.chapter-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 20px; }
.chapter-list li a { display: block; padding: 8px 6px; font-size: 14px; color: var(--text); border-bottom: 1px dashed var(--border); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chapter-list li a:hover { color: var(--brand); }

/* Reader */
.reader { background: var(--card); border-radius: var(--radius); padding: 32px clamp(20px, 6vw, 64px) 48px; box-shadow: var(--shadow); margin: 12px auto 40px; max-width: 820px; }
.chapter-title { font-size: 24px; margin: 6px 0 6px; text-align: center; }
.chapter-meta { text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 24px; }
.content {
    font-size: var(--reader-font-size); line-height: 2; color: var(--text);
    white-space: pre-wrap; word-break: break-word;
    font-family: var(--reader-font-family);
}
html[data-reader-font="sans"] { --reader-font-family: "Microsoft YaHei", "PingFang SC", sans-serif; }
html[data-reader-font="kai"] { --reader-font-family: "KaiTi", "STKaiti", serif; }
html[data-reader-font="system"] { --reader-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif; }
.reader-settings {
    display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px 14px;
    margin: 0 0 20px; padding: 12px; border: 1px solid var(--border); border-radius: 10px;
    background: var(--bg); color: var(--muted); font-size: 13px;
}
.reader-settings .setting-group { display: inline-flex; align-items: center; gap: 6px; }
.reader-settings .setting-label { margin-right: 2px; }
.reader-settings button, .reader-settings select {
    min-height: 32px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 7px;
    background: var(--card); color: var(--text); font: inherit; cursor: pointer;
}
.reader-settings button:hover, .reader-settings select:hover { border-color: var(--brand-2); color: var(--brand); }
.reader-settings button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.reader-settings button:disabled { cursor: not-allowed; opacity: .45; }
.reader-settings output { min-width: 38px; text-align: center; color: var(--text); font-variant-numeric: tabular-nums; }
.chapter-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 22px 0; }
.chapter-nav.bottom { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border); }
.chapter-nav a { padding: 8px 18px; background: var(--bg); border-radius: 8px; font-size: 14px; color: var(--text); }
.chapter-nav a:hover { background: #ede9fe; color: var(--brand); }
.chapter-nav .disabled { padding: 8px 18px; color: #c4c4c4; font-size: 14px; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 24px 0; margin-top: 20px; }
.site-footer p { text-align: center; color: var(--muted); font-size: 13px; margin: 0; }

@media (max-width: 640px) {
    .novel-head { flex-direction: column; align-items: center; text-align: center; }
    .badges { justify-content: center; }
    .reader { padding-left: 18px; padding-right: 18px; }
    .reader-settings { align-items: stretch; }
}

/* Feedback (报错反馈) */
.feedback { background: var(--card); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); margin: 16px 0 40px; }
.feedback summary { cursor: pointer; color: var(--brand); font-size: 14px; font-weight: 600; }
.fb-ok { margin: 0 0 12px; padding: 10px 14px; background: #ecfdf5; color: #047857; border-radius: 8px; font-size: 14px; }
.fb-form { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; max-width: 560px; }
.fb-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.fb-form select, .fb-form textarea { padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; color: var(--text); background: var(--card); }
.fb-form textarea { resize: vertical; }
.fb-form button { align-self: flex-start; padding: 9px 22px; border: none; border-radius: 8px; background: var(--brand); color: #fff; font-size: 14px; cursor: pointer; }
.fb-form button:hover { background: #6d28d9; }

/* Admin 反馈管理 */
.admin { background: var(--card); border-radius: var(--radius); padding: 24px clamp(16px,4vw,32px) 40px; box-shadow: var(--shadow); margin: 12px 0 40px; }
.admin h1 { font-size: 22px; margin: 0 0 8px; }
.admin h1 small, .toc h2 small { color: var(--muted); font-size: 14px; font-weight: 400; }
.admin h2 { font-size: 16px; margin: 26px 0 10px; }
.admin table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin th, .admin td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.admin th { color: var(--muted); font-weight: 600; background: #fafafa; }
.fb-stats td.num-pending { color: #b45309; font-weight: 600; }
.fb-stats td.num-resolved { color: #047857; }
.fb-stats td.num-ignored { color: var(--muted); }
.admin .empty { text-align: center; color: var(--muted); padding: 20px; }
.fb-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 6px 0 14px; font-size: 14px; }
.fb-filters a { padding: 4px 12px; border: 1px solid var(--border); border-radius: 999px; color: #374151; }
.fb-filters a.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.fb-filters .cur-type { color: var(--muted); font-size: 13px; }
.fb-desc { max-width: 360px; word-break: break-word; white-space: pre-wrap; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; }
.status-pending { background: #fef3c7; color: #b45309; }
.status-resolved { background: #d1fae5; color: #047857; }
.status-ignored { background: #f3f4f6; color: var(--muted); }
.fb-actions form { display: flex; gap: 6px; }
.fb-actions button { padding: 5px 12px; border: none; border-radius: 6px; font-size: 13px; cursor: pointer; }
.btn-ok { background: #059669; color: #fff; }
.btn-ok:hover { background: #047857; }
.btn-mute { background: #e5e7eb; color: #374151; }
.btn-mute:hover { background: #d1d5db; }
