*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:        #1abc9c;
  --primary-hover:  #16a085;
  --bg-body:        #0d0d0d;
  --bg-nav:         #1a1a1a;
  --bg-card:        #1a1a1a;
  --text-main:      #e0e0e0;
  --text-sub:       #777777;
  --border:         #2a2a2a;
  --overlay:        rgba(0,0,0,0.65);
  --nav-height:     60px;
  --ticker-height:  36px;
}

body.dark-mode {
  --bg-body:   #121212;
  --bg-nav:    #1e1e1e;
  --bg-card:   #1e1e1e;
  --text-main: #e0e0e0;
  --text-sub:  #777;
  --border:    #2e2e2e;
  --overlay:   rgba(0,0,0,0.65);
}

body {
  font-family: "PingFang SC","Microsoft YaHei","Helvetica Neue",sans-serif;
  background: var(--bg-body);
  color: var(--text-main);
  font-size: 14px;
  transition: background .3s, color .3s;
  line-height: 1.6;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; }

/* ════ NAVBAR ════ */
#navbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--bg-nav);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  z-index: 999;
  transition: background .3s, box-shadow .3s;
}
#navbar.scrolled { box-shadow: 0 4px 18px rgba(0,0,0,.15); }

.navbar-inner {
  width: 100%; max-width: 1200px;
  margin: 0 auto; height: 100%;
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 0 20px; gap: 12px;
}

.site-logo img { height: 40px; width: auto; display: block; }
.site-logo-text {
  font-size: 20px; font-weight: 700;
  color: var(--primary); letter-spacing: 1px;
}

/* 导航菜单 */
.nav-menu { display: flex; list-style: none; gap: 2px; flex-shrink: 0; }
.nav-menu > li { position: relative; }
.nav-menu > li > a {
  display: block; padding: 0 13px;
  line-height: var(--nav-height);
  font-size: 15px; color: var(--text-main);
  transition: color .2s; white-space: nowrap;
}
.nav-menu > li > a:hover,
.nav-menu > li.current-menu-item > a,
.nav-menu > li.current-menu-ancestor > a { color: var(--primary); }
.nav-menu > li.current-menu-item > a { border-bottom: 2px solid var(--primary); }

.sub-menu {
  display: none; position: absolute;
  top: var(--nav-height); left: 0;
  min-width: 130px; background: var(--bg-nav);
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  border-radius: 6px; overflow: hidden;
  list-style: none; z-index: 999;
}
.nav-menu > li:hover > .sub-menu { display: block; }
.sub-menu li a {
  display: block; padding: 10px 16px;
  font-size: 14px; color: var(--text-main);
  transition: background .15s;
}
.sub-menu li a:hover { background: var(--primary); color: #fff; }

/* 工具栏 */
.nav-tools { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.search-wrap { display: flex; align-items: center; position: relative; }
.search-wrap input {
  width: 0; opacity: 0; height: 32px;
  border: 1px solid var(--border); border-radius: 16px;
  padding: 0; font-size: 13px;
  color: var(--text-main); background: var(--bg-card);
  transition: width .3s, opacity .3s, padding .3s; outline: none;
}
.search-wrap.open input { width: 160px; opacity: 1; padding: 0 36px 0 14px; }
.search-wrap input:focus { border-color: var(--primary); }
.search-btn {
  position: absolute; right: 0;
  width: 32px; height: 32px; border: none;
  background: none; cursor: pointer;
  color: var(--text-sub); font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: color .2s;
}
.search-wrap.open .search-btn { color: var(--primary); }

.dark-btn { display: none !important; }

.hamburger {
  display: none; flex-direction: column;
  gap: 5px; cursor: pointer; padding: 4px;
}
.hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--text-main); border-radius: 2px;
}

/* 导航图标按钮 */
.nav-icon-btn {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-sub); border-radius: 6px;
  transition: color .2s, background .2s;
}
.nav-icon-btn:hover { color: var(--primary); background: rgba(26,188,156,.08); }

/* 登录/注册按钮 */
.nav-login-btn {
  padding: 5px 14px; border-radius: 5px;
  font-size: 13px; color: var(--text-main);
  border: 1px solid var(--border);
  transition: all .2s; white-space: nowrap;
}
.nav-login-btn:hover { border-color: var(--primary); color: var(--primary); }

.nav-reg-btn {
  padding: 5px 14px; border-radius: 5px;
  font-size: 13px; color: #fff;
  background: var(--primary);
  transition: background .2s; white-space: nowrap;
}
.nav-reg-btn:hover { background: var(--primary-hover); }

/* 用户头像下拉 */
.nav-user { position: relative; cursor: pointer; }
.nav-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid var(--primary); display: block;
}
.user-dropdown {
  display: none; position: absolute; top: 42px; right: 0;
  min-width: 130px; background: var(--bg-nav);
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.1);
  z-index: 999; overflow: hidden;
}
.user-dropdown.open { display: block; }
.user-dropdown a {
  display: block; padding: 10px 16px;
  font-size: 13px; color: var(--text-main);
  transition: background .15s;
}
.user-dropdown a:hover { background: rgba(26,188,156,.08); color: var(--primary); }

/* 暗黑按钮已隐藏 */

/* ════ 滚动公告栏 ════ */
.ticker-bar {
  height: var(--ticker-height);
  background: var(--primary);
  display: flex; align-items: center; overflow: hidden;
}
.ticker-label {
  flex-shrink: 0; background: #16a085; color: #fff;
  font-size: 12px; font-weight: 700;
  padding: 0 14px; height: 100%;
  display: flex; align-items: center; letter-spacing: 1px;
}
.ticker-track { flex: 1; overflow: hidden; position: relative; height: 100%; }
.ticker-inner {
  display: flex; align-items: center; height: 100%;
  white-space: nowrap; animation: ticker-scroll 35s linear infinite;
}
.ticker-inner a { color: #fff; font-size: 13px; margin-right: 60px; opacity: .92; }
.ticker-inner a:hover { opacity: 1; text-decoration: underline; }
@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ════ PAGE BANNER ════ */
.page-banner {
  position: relative;
  width: 100%;
  height: 34vh;
  min-height: 160px;
  max-height: 280px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: #111111;
}

/* 背景图（分类页有封面图时使用） */
.page-banner .banner-bg {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: opacity .4s;
}

/* 遮罩（仅分类有封面图时生效） */
.page-banner .banner-mask {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.0);
}

/* 文字内容 */
.page-banner .banner-content {
  position: relative; z-index: 2;
  text-align: center;
  width: 100%;
  padding: 0 20px;
}

.page-banner h1 {
  color: #fff;
  font-size: clamp(16px, 2.5vw, 26px);
  font-weight: 700;
  letter-spacing: 2px;
  margin: 0 0 4px;
  text-shadow: 0 1px 6px rgba(0,0,0,.4);
}

.page-banner .banner-sub {
  color: rgba(255,255,255,.82);
  font-size: clamp(11px, 1.2vw, 14px);
  letter-spacing: .5px;
  text-shadow: 0 1px 4px rgba(0,0,0,.3);
}

@media (max-width: 768px) {
  .page-banner { height: 34vh; min-height: 120px; }
}

/* ════ 分类筛选 ════ */
.filter-bar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: var(--nav-height); z-index: 90;
}
.filter-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 16px;
  display: flex; gap: 0; overflow-x: auto; scrollbar-width: none;
}
.filter-inner::-webkit-scrollbar { display: none; }
.filter-tab {
  flex-shrink: 0; padding: 12px 18px;
  font-size: 14px; color: var(--text-sub);
  cursor: pointer; border-bottom: 2px solid transparent;
  transition: color .2s, border-color .2s; white-space: nowrap;
}
.filter-tab:hover { color: var(--primary); }
.filter-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ════ CONTAINER ════ */
.container { max-width: 1200px; margin: 0 auto; padding: 24px 16px; }

/* ════ 文章卡片网格 ════ */
.card-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; }
@media (max-width: 900px) { .card-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 560px) { .card-grid { grid-template-columns: 1fr; } }

.post-card {
  background: var(--bg-card); border-radius: 10px;
  overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.07);
  transition: transform .25s, box-shadow .25s;
  cursor: pointer; display: flex; flex-direction: column;
}
.post-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,.13); }

.post-card-mask {
  position: relative; width: 100%; padding-top: 60%; overflow: hidden;
}
.post-card-mask img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .35s;
}
.post-card:hover .post-card-mask img { transform: scale(1.06); }

.card-overlay {
  position: absolute; inset: 0;
  background: var(--overlay); transition: background .25s;
}
.post-card:hover .card-overlay { background: rgba(0,0,0,.28); }

.post-card-tag {
  position: absolute; top: 10px; left: 10px;
  background: var(--primary); color: #fff;
  font-size: 11px; padding: 2px 8px; border-radius: 3px; z-index: 2;
}
.badge {
  position: absolute; top: 10px; right: 10px;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 3px; z-index: 2;
}
.badge-hot { background: #e74c3c; color: #fff; }
.badge-new { background: #f39c12; color: #fff; }

.post-card-views {
  position: absolute; bottom: 8px; right: 10px;
  font-size: 11px; color: rgba(255,255,255,.85); z-index: 2;
}

.post-card-container {
  padding: 14px 14px 12px;
  flex: 1; display: flex; flex-direction: column; gap: 8px;
}
.post-card-title {
  font-size: 15px; font-weight: 600; line-height: 1.55;
  color: var(--text-main);
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.post-card-title a:hover { color: var(--primary); }
.post-card-meta {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--text-sub); margin-top: auto;
}
.post-card-meta .dot::before { content: "·"; margin-right: 2px; }

/* ════ 单页文章 ════ */
.single-wrap { max-width: 860px; margin: 0 auto; }
.single-header { margin-bottom: 24px; }
.single-cats { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.single-cat {
  background: var(--primary); color: #fff;
  font-size: 12px; padding: 3px 10px; border-radius: 3px;
}
.single-title {
  font-size: 26px; font-weight: 700;
  line-height: 1.4; color: var(--text-main); margin-bottom: 14px;
}
.single-meta {
  display: flex; align-items: center; gap: 16px;
  font-size: 13px; color: var(--text-sub);
  padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.single-thumb {
  width: 100%; border-radius: 10px;
  overflow: hidden; margin-bottom: 24px; aspect-ratio: 16/9;
}
.single-thumb img { width: 100%; height: 100%; object-fit: cover; }

.entry-content {
  font-size: 16px; line-height: 1.85;
  color: var(--text-main);
}
.entry-content p { margin-bottom: 18px; }
.entry-content img { border-radius: 8px; margin: 12px 0; }
.entry-content h2, .entry-content h3 {
  margin: 24px 0 12px; color: var(--text-main);
}

/* 付费墙遮罩 */
.paywall-mask {
  position: relative; margin-top: 24px;
}
.paywall-fade {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 120px;
  background: linear-gradient(transparent, var(--bg-body));
}
.paywall-box {
  margin-top: 32px; padding: 28px; text-align: center;
  background: var(--bg-card); border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0,0,0,.06);
}
.paywall-box h3 { font-size: 18px; margin-bottom: 10px; }
.paywall-box p { color: var(--text-sub); margin-bottom: 20px; font-size: 14px; }
.btn-primary {
  display: inline-block; padding: 10px 28px;
  background: var(--primary); color: #fff;
  border-radius: 6px; font-size: 15px; font-weight: 600;
  transition: background .2s;
}
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-outline {
  display: inline-block; padding: 10px 28px;
  border: 2px solid var(--primary); color: var(--primary);
  border-radius: 6px; font-size: 15px; font-weight: 600;
  margin-left: 10px; transition: all .2s;
}
.btn-outline:hover { background: var(--primary); color: #fff; }

/* ════ 评论区 ════ */
.comments-section { margin-top: 40px; padding-top: 32px; border-top: 1px solid var(--border); }
.comments-title { font-size: 18px; font-weight: 700; margin-bottom: 24px; }

.comment-list { list-style: none; }
.comment-item { padding: 16px 0; border-bottom: 1px solid var(--border); }
.comment-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; flex-shrink: 0; }
.comment-body { display: flex; gap: 12px; align-items: flex-start; }
.comment-content { flex: 1; }
.comment-author { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.comment-date { font-size: 12px; color: var(--text-sub); }
.comment-text { font-size: 14px; margin-top: 6px; line-height: 1.7; }

.comment-form { margin-top: 28px; }
.comment-form h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.form-row { display: flex; gap: 12px; margin-bottom: 12px; }
.form-row input, .comment-form textarea {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 14px; color: var(--text-main);
  background: var(--bg-card); outline: none;
  transition: border-color .2s;
}
.form-row input:focus, .comment-form textarea:focus { border-color: var(--primary); }
.comment-form textarea { height: 120px; resize: vertical; margin-bottom: 12px; }
.submit-btn {
  padding: 10px 24px; background: var(--primary);
  color: #fff; border: none; border-radius: 6px;
  font-size: 14px; cursor: pointer; transition: background .2s;
}
.submit-btn:hover { background: var(--primary-hover); }

/* ════ PAGINATION ════ */
.pagination {
  margin-top: 32px;
  display: flex; align-items: center; justify-content: center;
  gap: 8px; flex-wrap: wrap;
}
.pagination .page-numbers {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 6px;
  font-size: 14px; color: var(--text-main);
  background: var(--bg-card); border: 1px solid var(--border);
  transition: all .2s;
}
.pagination .page-numbers:hover,
.pagination .page-numbers.current {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.pagination .page-numbers.current { font-weight: 700; }

/* ════ FOOTER ════ */
#site-footer {
  margin-top: 48px;
  background: linear-gradient(-45deg, #1a1a2e, #16213e, #0f3460, #1a1a2e);
  background-size: 400% 400%;
  color: #aaa;
  padding: 36px 16px 24px;
  font-size: 13px;
}

.footer-inner { max-width: 1200px; margin: 0 auto; text-align: left; }

.footer-desc {
  color: #ccc; font-size: 14px;
  margin-bottom: 0; line-height: 1.8; text-align: left;
}
.footer-desc h3 {
  font-size: 15px; font-weight: 700; color: #e0e0e0;
  margin-bottom: 10px;
}
.footer-desc p { color: #aaa; margin-bottom: 6px; font-size: 13px; }
.footer-desc a { color: #1abc9c; text-decoration: none; }
.footer-desc a:hover { text-decoration: underline; }

.footer-links {
  display: flex; flex-direction: column;
  margin-bottom: 0;
}
.footer-links a {
  color: #bbb; font-size: 14px; transition: color .2s;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,.07);
  display: block;
}
.footer-links a:first-child { border-top: 1px solid rgba(255,255,255,.07); }
.footer-links a:hover { color: var(--primary); }

.footer-icons {
  display: flex; justify-content: center;
  gap: 14px; margin-bottom: 20px; margin-top: 24px;
}
.footer-icons a {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.1);
  color: #bbb;
  display: flex; align-items: center; justify-content: center;
  transition: all .25s;
}
.footer-icons a svg { width: 17px; height: 17px; }
.footer-icons a:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  transform: translateY(-2px);
}

.footer-divider { border: none; border-top: 1px solid rgba(255,255,255,.08); margin: 18px 0; }

.footer-copyright {
  color: #555; font-size: 12px; line-height: 2; text-align: center;
}

.footer-compliance {
  display: flex; justify-content: center;
  flex-wrap: wrap; gap: 6px 16px;
  margin-top: 12px; text-align: center;
}
.footer-compliance a {
  color: #444; font-size: 11px; transition: color .2s;
}
.footer-compliance a:hover { color: #666; }

/* ════ 底部固定导航栏（移动端）════ */
#bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 56px;
  background: var(--bg-nav);
  border-top: 1px solid var(--border);
  display: none;
  align-items: center;
  justify-content: space-around;
  z-index: 997;
  box-shadow: 0 -2px 10px rgba(0,0,0,.08);
}

.bottom-nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; padding: 6px 0;
  color: var(--text-sub); font-size: 10px;
  transition: color .2s;
}
.bottom-nav-item.active,
.bottom-nav-item:hover { color: var(--primary); }

.bottom-nav-icon { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }
.bottom-nav-icon svg { width: 24px; height: 24px; }

.bottom-nav-placeholder { display: none; }

@media (max-width: 767px) {
  #bottom-nav { display: flex; }
  .bottom-nav-placeholder { display: block; }
}

/* ════ 广告位 ════ */
.ad-slot { width: 100%; overflow: hidden; }
.ad-slot:empty { display: none; }

/* 顶部横幅广告 */
.ad-top-banner {
  max-width: 1200px; margin: 12px auto;
  padding: 0 16px; text-align: center;
}
.ad-top-banner img { max-width: 100%; height: auto; border-radius: 8px; display: block; margin: 0 auto; }

/* 信息流广告（卡片之间全行宽） */
.ad-infeed {
  max-width: 1200px; margin: 0 auto 24px;
  padding: 0 16px; text-align: center;
}
.ad-infeed img { max-width: 100%; height: auto; border-radius: 8px; display: block; margin: 0 auto; }

/* 底部横幅广告 */
.ad-bottom-banner {
  max-width: 1200px; margin: 24px auto;
  padding: 0 16px; text-align: center;
}
.ad-bottom-banner img { max-width: 100%; height: auto; border-radius: 8px; display: block; margin: 0 auto; }

/* 浮动广告（右下角） */
.ad-float {
  position: fixed; bottom: 80px; right: 16px;
  z-index: 996; max-width: 160px;
}
.ad-float img { width: 100%; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.25); }

/* 弹窗广告 */
.adspop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.7); z-index: 9999;
  align-items: center; justify-content: center;
}
.adspop .popup-container {
  position: relative; max-width: 480px; width: 90%;
}
.adspop .popup-close {
  position: absolute; top: -14px; right: -14px;
  width: 30px; height: 30px; border-radius: 50%;
  background: #fff; color: #333; border: none;
  font-size: 14px; cursor: pointer; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.adspop .popup-picture img { width: 100%; border-radius: 10px; display: block; }

@media (max-width: 767px) {
  .ad-float { max-width: 100px; bottom: 16px; }
}

/* 回到顶部 */
#back-top {
  position: fixed; bottom: 28px; right: 24px;
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--primary); color: #fff;
  border: none; font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(26,188,156,.4);
  opacity: 0; transform: translateY(20px);
  transition: opacity .3s, transform .3s; z-index: 998;
}
#back-top.show { opacity: 1; transform: translateY(0); }
#back-top:hover { background: var(--primary-hover); }

/* ════ MOBILE ════ */
@media (max-width: 767px) {
  .hamburger { display: flex; }
  .nav-menu {
    display: none; position: fixed;
    top: var(--nav-height); left: 0; right: 0;
    background: var(--bg-nav); flex-direction: column;
    padding: 10px 0 20px; z-index: 998;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
  }
  .nav-menu.open { display: flex; }
  .nav-menu > li > a { line-height: 48px; padding: 0 20px; }
  .sub-menu { display: none !important; }
  .single-title { font-size: 20px; }
  .form-row { flex-direction: column; }
}
