:root {
  --bg: #F7F5F0;
  --surface: #FFFFFF;
  --primary: #2E7D52;
  --primary-dark: #20302A;
  --primary-light: #E8F3EC;
  --text: #1F2A24;
  --text-muted: #6B7A70;
  --border: #E3E0D6;
  --chip-stroke: #D9D5C8;
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", "WenQuanYi Micro Hei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 24px; }

/* ============ Header ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 72px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 700; color: var(--text); flex-shrink: 0; }
.brand h1 { margin: 0; font-size: inherit; }
.nav { display: flex; align-items: center; gap: 20px; margin-left: auto; font-size: 15px; }
.nav a { color: var(--text-muted); transition: color .15s; }
.nav a:hover { color: var(--primary); }
.nav .user { color: var(--text-muted); font-size: 15px; }
.nav .btn-login { color: var(--text-muted); font-weight: 400; }
.nav .nav-register { color: var(--primary); font-weight: 700; }

.search-form { position: relative; flex: 0 0 300px; }
.search-icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; display: flex; }
.search-input {
  width: 100%;
  height: 42px;
  padding: 0 70px 0 42px;
  border: none;
  border-radius: 22px;
  background: #F2EFE8;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: box-shadow .2s;
}
.search-input:focus { box-shadow: 0 0 0 2px rgba(46,125,82,.22); }
.search-input::placeholder { color: #9AA39B; }
.search-btn {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 16px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s;
}
.search-btn:hover { background: #245F40; }

/* ============ Index bar (letter nav) ============ */
.index-bar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 14px 0; }
.index-bar-inner { max-width: 1280px; margin: 0 auto; padding: 0 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.index-label { font-size: 14px; font-weight: 700; color: var(--text); margin-right: 8px; }
.index-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 34px; padding: 0 12px;
  border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--chip-stroke);
  color: var(--primary); font-weight: 600; font-size: 14px;
  transition: all .15s;
}
.index-chip:hover { border-color: var(--primary); background: var(--primary-light); }
.index-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ============ Main ============ */
.site-main { display: block; }
main { max-width: 1280px; margin: 0 auto; padding: 28px 24px 60px; }

.section-title {
  font-size: 20px; font-weight: 700; color: var(--text);
  margin: 28px 0 14px; display: flex; align-items: center; gap: 10px;
}
.section-title::before { content: ''; width: 5px; height: 20px; background: var(--primary); border-radius: 3px; }

/* ============ Hero (home) ============ */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #245F40 100%);
  color: #EAF4EE;
  border-radius: var(--radius);
  padding: 38px 32px;
  margin: 24px 0 8px;
}
.hero h2 { margin: 0 0 8px; font-size: 28px; color: #fff; font-weight: 700; }
.hero p { margin: 0; font-size: 15px; color: #CDE7D6; max-width: 720px; line-height: 1.7; }
.hero-stats { margin-top: 20px; display: flex; gap: 32px; flex-wrap: wrap; }
.hero-stats .stat .num { font-size: 28px; font-weight: 700; color: #fff; }
.hero-stats .stat .label { font-size: 13px; color: #B7D7C2; }

/* Home big search bar */
.home-search { margin: 22px 0 4px; }
.search-bar {
  display: flex; align-items: stretch; max-width: 760px; margin: 0 auto;
  background: #fff; border-radius: 999px; overflow: hidden;
  padding: 8px 8px 8px 26px; box-shadow: 0 12px 32px rgba(0,0,0,.18);
}
.search-bar input { flex: 1; border: 0; outline: 0; font-size: 17px; background: transparent; color: var(--text); font-family: inherit; min-width: 0; }
.search-bar button {
  background: var(--primary); color: #fff; border: 0; border-radius: 999px;
  padding: 0 36px; cursor: pointer; font-size: 16px; font-weight: 600;
  font-family: inherit; transition: background .18s; flex-shrink: 0;
}
.search-bar button:hover { background: #245F40; }

/* ============ Letter grid (home) ============ */
.letter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.letter-card {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  transition: box-shadow .18s, transform .18s, border-color .18s;
}
.letter-card:hover { box-shadow: 0 8px 24px rgba(46,125,82,.12); transform: translateY(-2px); border-color: #C8D8CD; }
.lc-overlay { position: absolute; inset: 0; z-index: 1; border-radius: var(--radius); }
.lc-content { position: relative; z-index: 2; display: flex; align-items: center; gap: 16px; flex: 1; min-width: 0; pointer-events: none; }
.lc-letter {
  width: 56px; height: 56px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary-light) 0%, #DDECE3 100%);
  color: var(--primary); border-radius: 50%; font-size: 26px; font-weight: 800; line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(46,125,82,.08);
}
.lc-info { min-width: 0; }
.lc-count { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.lc-action { margin-top: 4px; font-size: 15px; font-weight: 600; color: var(--primary); display: inline-flex; align-items: center; gap: 4px; transition: gap .15s; }
.letter-card:hover .lc-action { gap: 8px; }

/* ============ Breadcrumb (list page) ============ */
.breadcrumb { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.breadcrumb a { color: var(--primary); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { margin: 0 8px; color: #C2C9C4; }
.breadcrumb .cur { color: var(--text); font-weight: 600; }

/* ============ Letter section (list page) ============ */
.list-section { max-width: 1280px; margin: 0 auto; padding: 24px 24px 60px; }
.letter-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.letter-title h2 { margin: 0; font-size: 30px; font-weight: 700; color: var(--primary); line-height: 1.2; }
.letter-count { display: block; font-size: 14px; color: var(--text-muted); margin-top: 2px; }
.result-count { margin: 0 0 16px; font-size: 14px; color: var(--text-muted); }
.browse-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.browse-head .page-title { margin: 0; flex: 1; min-width: 0; }
.tree-tools { display: flex; gap: 10px; margin-bottom: 16px; }
.tree-tools button {
  background: var(--surface); border: 1px solid var(--chip-stroke); color: var(--primary);
  padding: 6px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: all .15s;
}
.tree-tools button:hover { background: var(--primary-light); border-color: var(--primary); }

/* ============ Topic card (folder hierarchy) ============ */
.topic-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.topic-card[hidden] { display: none; }
.topic-header {
  width: 100%; display: flex; align-items: center; flex-wrap: nowrap; gap: 10px; padding: 14px 18px;
  border: none; background: none; font: inherit; color: var(--text); text-align: left; cursor: pointer; transition: background .15s;
  user-select: none; -webkit-user-select: none; white-space: nowrap;
}
.topic-header:hover { background: #FAFAF8; }
.topic-header:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; border-radius: var(--radius); }
.topic-chevron { color: var(--text-muted); flex-shrink: 0; transition: transform .18s; display: flex; }
.topic-header[aria-expanded="true"] .topic-chevron { transform: rotate(90deg); }
.topic-folder { color: #AFCBB7; flex-shrink: 0; display: flex; }
.topic-title-row { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.topic-name { font-size: 16px; font-weight: 600; flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }
.topic-header-btn { font-size: 12px; padding: 3px 10px; flex-shrink: 0; }
.topic-count { margin-left: 8px; font-size: 12px; color: var(--text-muted); background: var(--bg); border-radius: 999px; padding: 2px 10px; flex-shrink: 0; }
.topic-body { background: var(--bg); border-top: 1px solid var(--border); padding: 10px 18px 14px; }
.topic-body[hidden] { display: none; }
.topic-empty { font-size: 13px; color: var(--text-muted); padding: 16px 12px; text-align: center; }

/* ============ Tree ============ */
.tree, .tree ul, .tree li { list-style: none; margin: 0; }
.tree li::marker { content: ""; }
.tree { padding: 0; }
.tree .tree { padding-left: 22px; margin-top: 4px; border-left: 1px dashed var(--border); }
.tree-item { margin-bottom: 4px; list-style: none; }
.tree-item.has-children { padding-bottom: 2px; }
.tree-node { display: flex; align-items: center; gap: 8px; padding: 5px 0; color: #3A463E; font-size: 14px; flex-wrap: wrap; }
.tree-node .ic-folder { color: #C9D8CC; flex-shrink: 0; }
.tree-label { word-break: break-all; }
.tree-item.has-children > .tree-node .tree-label { font-weight: 500; }
.tree-item.is-match > .tree-node .tree-label { background: #FFF3CD; border-radius: 3px; padding: 0 3px; }

/* ============ Baidu button (download) ============ */
.baidu-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 16px 6px 12px; border: none; border-radius: 999px;
  background: var(--primary); color: #fff; font-size: 13px; font-weight: 600;
  font-family: inherit; cursor: pointer; flex-shrink: 0; text-decoration: none;
  transition: background .15s, transform .15s;
}
.baidu-btn:hover { background: #245F40; transform: translateY(-1px); }
.baidu-btn.locked { background: #C7CDC8; color: #fff; cursor: pointer; }
.baidu-btn.locked:hover { background: #B5BCB6; }
.baidu-btn svg { flex-shrink: 0; }

/* ============ Search page list ============ */
.search-section { max-width: 1280px; margin: 0 auto; padding: 24px 24px 60px; }
.node-list { list-style: none; margin: 0; padding: 0; }
.node-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 8px;
}
.node-item .node-title {
  display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto;
}
.node-item .node-title > * { min-width: 0; }
.node-item .node-label { font-size: 15px; font-weight: 500; }
.node-item .node-folder { font-size: 15px; font-weight: 600; color: var(--primary); }
.node-item .node-folder:hover { text-decoration: underline; }
.node-item .cnt { font-size: 13px; color: var(--text-muted); flex-shrink: 0; }
.node-item .no-link { font-size: 13px; color: var(--text-muted); flex-shrink: 0; }
.node-item .baidu-btn { flex-shrink: 0; }
.empty { color: var(--text-muted); font-size: 14px; padding: 12px 0; }

/* ============ Login modal ============ */
.modal-mask {
  position: fixed; inset: 0; z-index: 1000; display: none;
  align-items: center; justify-content: center; padding: 16px;
  background: rgba(15, 28, 22, .55);
}
.modal-mask.open { display: flex; }
.modal {
  position: relative; width: 100%; max-width: 360px; background: var(--surface);
  border-radius: 16px; padding: 28px 24px 24px; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.25); animation: modalPop .18s ease-out;
}
@keyframes modalPop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h3 { margin: 0 0 12px; font-size: 19px; font-weight: 700; color: var(--text); }
.modal p { margin: 0 0 18px; font-size: 14px; color: var(--text-muted); line-height: 1.7; }
.modal-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.modal .btn {
  display: inline-block; padding: 9px 20px; border-radius: var(--radius-sm);
  border: 1px solid var(--primary); background: #fff; color: var(--primary);
  font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all .15s;
}
.modal .btn:hover { background: var(--primary-light); }
.modal .btn-primary { background: var(--primary); color: #fff; }
.modal .btn-primary:hover { background: #245F40; }
.modal .btn-ghost { border-color: var(--border); color: var(--text-muted); }
.modal .btn-ghost:hover { background: var(--bg); }

/* ============ Footer ============ */
.site-footer { background: var(--primary-dark); color: #9DB0A4; padding: 32px 24px; }
.footer-inner { max-width: 1280px; margin: 0 auto; }
.footer-title { color: #fff; font-size: 18px; font-weight: 700; margin: 0 0 6px; }
.footer-copy { font-size: 13px; margin: 0 0 14px; }
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-links a { font-size: 13px; color: #9DB0A4; }
.footer-links a:hover { color: #fff; }

/* ============ Auth pages ============ */
.auth-section { max-width: 420px; margin: 40px auto; padding: 0 24px; }
.auth-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text-muted); }
.auth-form input { width: 100%; height: 42px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 15px; font-family: inherit; outline: none; color: var(--text); background: #fff; }
.auth-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(46,125,82,.15); }
.btn { display: inline-block; padding: 10px 22px; border-radius: var(--radius-sm); border: 1px solid var(--primary); background: #fff; color: var(--primary); font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all .15s; text-align: center; }
.btn:hover { background: var(--primary-light); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #245F40; }
.success { color: var(--primary); font-size: 14px; }
.error { color: #C0392B; font-size: 14px; }
.tip { font-size: 13px; color: var(--text-muted); }
.tip a { color: var(--primary); }

.pending-tag {
  display: inline-block; margin-left: 6px; padding: 1px 6px;
  font-size: 12px; font-weight: 600; line-height: 1.4;
  color: #C0392B; background: #FDECEA; border: 1px solid #F1B0A6;
  border-radius: 4px; vertical-align: middle;
}

/* 前台用户名链接（账户设置入口） */
.nav .user.user-link { text-decoration: none; display: inline-flex; align-items: center; }
.nav .user.user-link:hover { color: var(--primary); }

/* 账户设置标签切换 */
.account-tabs { display: flex; gap: 8px; margin-top: 18px; border-bottom: 1px solid var(--border); }
.account-tabs .tab {
  padding: 10px 18px; font-size: 15px; color: var(--text-muted);
  text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.account-tabs .tab:hover { color: var(--primary); }
.account-tabs .tab.active { color: var(--primary); font-weight: 600; border-bottom-color: var(--primary); }

/* 账户设置页 */
.account-section { max-width: 720px; margin: 40px auto; padding: 0 24px; }
.account-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 24px; margin-top: 18px;
  display: flex; flex-direction: column; gap: 16px;
}
.account-row { display: flex; align-items: center; gap: 12px; }
.account-label { font-size: 14px; color: var(--text-muted); }
.account-card .auth-form { padding: 0; border: 0; max-width: 100%; }
.account-card .auth-form .btn { width: 100%; }
.account-intro {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 24px; margin-top: 18px;
  font-size: 14px; line-height: 1.7; color: var(--text);
}
.account-intro h3 { margin: 0 0 10px; font-size: 16px; color: var(--text); }
.account-intro .intro-list { margin: 12px 0; padding-left: 4px; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.account-intro .intro-list li { display: flex; align-items: flex-start; gap: 10px; }
.account-intro .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; flex-shrink: 0; }
.account-intro .tip { margin: 4px 0 0; }
.account-intro .pay-row { display: flex; gap: 12px; margin: 12px 0; flex-wrap: wrap; }
.account-intro .pay-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 18px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
  text-decoration: none; cursor: pointer; transition: opacity .15s;
}
.account-intro .pay-btn:hover { opacity: .9; }
.account-intro .pay-wx { background: #07C160; color: #fff; }
.account-intro .pay-ali { background: #1677FF; color: #fff; }

/* 待支付提示框可关闭 */
.pay-pending-box { position: relative; padding-right: 40px; }
.pay-pending-close {
  position: absolute; top: 8px; right: 10px;
  width: 26px; height: 26px; border: none; background: transparent;
  font-size: 20px; line-height: 1; color: #9AA39B; cursor: pointer;
  border-radius: 50%; transition: background .15s, color .15s;
}
.pay-pending-close:hover { background: rgba(0,0,0,.06); color: var(--text); }

/* 会员信息卡 */
.member-card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 18px;
  display: flex; flex-direction: column; gap: 8px;
}
.member-card .account-row { font-size: 14px; }
.member-card b { color: var(--text); }

/* 规则说明框 */
.rules-box {
  margin-top: 12px; padding: 20px 22px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.rules-box h3 { margin: 0 0 14px; font-size: 16px; color: var(--text); }
.rules-box .intro-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.rules-box .intro-list li { display: block; line-height: 1.75; }
.rules-box .intro-list li b { white-space: nowrap; color: var(--text); }
.rules-box .tip { margin-top: 12px; }

/* 我的下载明细表 */
.dl-list { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 14px; }
.dl-list th, .dl-list td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.dl-list th { color: var(--text-muted); font-weight: 600; background: var(--bg); }
.dl-list td { color: var(--text); }
.dl-list .link-btn { color: var(--primary); text-decoration: none; }
.dl-list .link-btn:hover { text-decoration: underline; }

/* 状态徽标 */
.status-badge {
  display: inline-block; padding: 2px 10px; border-radius: 12px;
  font-size: 13px; font-weight: 600; line-height: 1.5;
}
.status-badge.st-pending { color: #C0392B; background: #FDECEA; border: 1px solid #F1B0A6; }
.status-badge.st-normal  { color: #2E7D52; background: #EAF3ED; border: 1px solid #B7DCC6; }
.status-badge.st-banned  { color: #8A6D1B; background: #FFF7E0; border: 1px solid #EAD08A; }
.dot.st-pending { background: #C0392B; }
.dot.st-normal  { background: #2E7D52; }
.dot.st-banned  { background: #D9A400; }

/* ============ Responsive ============ */
@media (max-width: 768px) {
  .header-inner { height: auto; padding: 12px 16px; flex-wrap: wrap; gap: 12px; }
  .brand { font-size: 18px; }
  .nav { gap: 14px; font-size: 14px; }
  .search-form { flex: 1 1 100%; order: 3; }
  .search-input { height: 40px; }
  .index-bar { padding: 12px 0; }
  .index-bar-inner { padding: 0 16px; gap: 6px; }
  .index-chip { min-width: 32px; height: 30px; padding: 0 10px; font-size: 13px; }
  main { padding: 20px 16px 40px; }
  .hero { padding: 24px 20px; margin-top: 18px; }
  .hero h2 { font-size: 22px; }
  .hero p { font-size: 14px; }
  .hero-stats { gap: 18px; margin-top: 16px; }
  .hero-stats .stat .num { font-size: 22px; }
  .home-search { margin-top: 18px; }
  .search-bar { padding-left: 20px; }
  .search-bar input { font-size: 15px; }
  .search-bar button { padding: 0 22px; font-size: 15px; }
  .section-title { font-size: 18px; margin: 24px 0 12px; }
  .letter-grid { grid-template-columns: 1fr; gap: 12px; }
  .letter-card { padding: 14px; }
  .lc-letter { width: 46px; height: 46px; font-size: 22px; }
  .lc-count { font-size: 12px; }
  .lc-action { font-size: 14px; }
  .letter-title h2 { font-size: 24px; }
  .topic-header { padding: 12px 14px; }
  .topic-name { font-size: 15px; }
  .topic-body { padding: 10px 14px 12px; }
  .tree .tree { padding-left: 16px; }
  .tree-node { font-size: 13px; }
  .list-section, .search-section { padding: 20px 16px 40px; }
  .site-footer { padding: 24px 16px; }
  .footer-title { font-size: 16px; }
  .rules-box { padding: 16px; }
  .rules-box .intro-list { gap: 12px; }
}
