:root {
  --primary: #10b3a3;
  --primary-dark: #0e8a7e;
  --text: #2b2b2b;
  --muted: #8a8f98;
  --line: #e6e9ee;
  --card: #ffffff;
  --bg: #f6f7f9;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
img { display: block; }

/* ---------- header ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--primary);
  color: #fff;
  height: 60px;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .08);
}

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

.logo {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: .4px;
}

.logo-tag {
  font-size: 11px;
  font-weight: 500;
  opacity: .85;
  letter-spacing: .6px;
  text-transform: uppercase;
}

.menu-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: background .25s ease;
}

.menu-btn:hover { background: rgba(255, 255, 255, .26); }
.menu-btn span { display: block; width: 18px; height: 2px; background: #fff; border-radius: 2px; }

.back-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .25s ease, transform .25s ease;
}

.back-btn:hover { background: rgba(255, 255, 255, .26); transform: translateX(-2px); }

/* ---------- search ---------- */
.searchbar { background: #fff; padding: 16px 0; border-bottom: 1px solid var(--line); }

.search-wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: center;
}

.search-box { position: relative; width: 100%; max-width: 800px; }

.search-input {
  width: 100%;
  padding: 13px 46px 13px 20px;
  border: 2px solid var(--primary);
  border-radius: 25px;
  font-size: 16px;
  outline: none;
  color: var(--text);
  background: #fff;
  transition: box-shadow .25s ease;
}

.search-input:focus { box-shadow: 0 0 0 4px rgba(237, 152, 116, .16); }
.search-input::placeholder { color: #b3b8c0; }

.search-icon {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary);
  pointer-events: none;
}

.search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: #f0f2f5;
  color: #777;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
}

.search-clear.show { display: flex; }

/* ---------- category bar ---------- */
.catbar { background: #fff; border-bottom: 1px solid var(--line); }

.cat-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.cat-container::-webkit-scrollbar { display: none; }

.cat-btn {
  flex: 0 0 auto;
  padding: 9px 18px;
  border: 0;
  border-radius: 20px;
  background: #f4f5f7;
  color: #55595f;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .25s ease, color .25s ease, transform .2s ease, box-shadow .2s ease;
}

.cat-btn:hover { background: #eceef1; transform: translateY(-2px); }

.cat-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 14px rgba(237, 152, 116, .32);
}

/* ---------- layout ---------- */
.wrap { max-width: 860px; margin: 0 auto; padding: 18px 14px 40px; }

.result-bar { font-size: 13px; color: var(--muted); padding: 2px 4px 12px; }

/* ---------- article card ---------- */
.list { display: flex; flex-direction: column; gap: 12px; }

.card {
  display: flex;
  align-items: stretch;
  height: 140px;
  background: var(--card);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(20, 25, 40, .07);
  transition: transform .28s ease, box-shadow .28s ease;
}

.card:hover { transform: translateY(-4px); box-shadow: 0 12px 26px rgba(20, 25, 40, .13); }

.card-img { position: relative; width: 140px; min-width: 140px; height: 140px; overflow: hidden; background: #eceef1; }

.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.card:hover .card-img img { transform: scale(1.06); }

.card-body {
  flex: 1;
  min-width: 0;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: #26292e;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-excerpt {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; font-size: 12px; }

.card-type {
  background: #f4f6f8;
  color: var(--primary-dark);
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 600;
}

.card-date { color: #a2a7ae; font-size: 12px; }

.empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty h3 { font-size: 17px; color: #5b6068; margin-bottom: 6px; }

.load-more {
  display: block;
  margin: 22px auto 0;
  padding: 12px 34px;
  border: 0;
  border-radius: 25px;
  background: #fff;
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(20, 25, 40, .08);
  transition: transform .2s ease, background .2s ease, color .2s ease;
}

.load-more:hover { background: var(--primary); color: #fff; transform: translateY(-2px); }

/* ---------- sidebar ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .28s ease, visibility .28s ease;
  z-index: 1500;
}

.overlay.show { opacity: 1; visibility: visible; }

.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 82%;
  max-width: 340px;
  height: 100vh;
  background: #fff;
  z-index: 1600;
  transform: translateX(105%);
  transition: transform .3s ease;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 30px rgba(0, 0, 0, .16);
}

.sidebar.show { transform: translateX(0); }

.sidebar-head {
  padding: 22px 20px 18px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
}

.sidebar-head h3 { font-size: 18px; font-weight: 800; }
.sidebar-head p { font-size: 12px; opacity: .88; margin-top: 4px; }

.sidebar-nav { padding: 12px; overflow-y: auto; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #3a3f47;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}

.sidebar-nav a:hover { background: #fdf1eb; color: var(--primary-dark); transform: translateX(4px); }
.sidebar-nav a span { font-size: 12px; color: #a5aab2; font-weight: 500; }
.sidebar-nav hr { border: 0; border-top: 1px solid var(--line); margin: 10px 8px; }

/* ---------- detail ---------- */
.detail { max-width: 780px; margin: 0 auto; padding: 20px 16px 40px; }

.detail-hero {
  width: 100%;
  height: 240px;
  object-fit: cover;
  border-radius: 18px;
  box-shadow: 0 10px 26px rgba(20, 25, 40, .12);
}

.detail-head { padding: 20px 2px 6px; }

.detail-title { font-size: 24px; line-height: 1.35; font-weight: 800; color: #23262b; }

.detail-meta { display: flex; align-items: center; gap: 12px; margin-top: 12px; font-size: 12px; color: var(--muted); }

.detail-body { padding: 12px 2px 0; }

.detail-body p { font-size: 16.5px; line-height: 1.85; color: #35393f; margin: 16px 0; }

.detail-body h2 { font-size: 18.5px; font-weight: 800; color: #23262b; margin: 30px 0 6px; }

.related { margin-top: 40px; }

.related-title {
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--primary-dark);
  text-transform: uppercase;
  margin-bottom: 16px;
}

.related .card { height: 104px; }
.related .card-img { width: 104px; min-width: 104px; height: 104px; }
.related .card-title { font-size: 14.5px; -webkit-line-clamp: 2; }

/* ---------- static pages ---------- */
.page {
  max-width: 760px;
  margin: 20px auto 40px;
  padding: 26px 20px 34px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 4px 16px rgba(20, 25, 40, .06);
}

.page h1 { font-size: 24px; margin-bottom: 6px; }
.page h2 { font-size: 17px; margin: 22px 0 6px; }
.page p, .page li { font-size: 15px; line-height: 1.8; color: #44484f; }
.page ul { padding-left: 20px; }
.page .updated { font-size: 12px; color: var(--muted); margin-bottom: 18px; }

/* ---------- footer ---------- */
.footer { background: #101114; color: #fff; margin-top: 12px; }

.footer-content { max-width: 1000px; margin: 0 auto; text-align: center; padding: 26px 20px 30px; }

.footer-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 26px; margin-bottom: 14px; }

.footer-links a { color: #d6d8dc; font-weight: 500; transition: color .2s ease; }
.footer-links a:hover { color: var(--primary); }

.footer-copy { color: #8d9198; font-size: 13px; padding-top: 16px; border-top: 1px solid #26282d; }

/* ---------- responsive ---------- */
@media (max-width: 600px) {
  .header-content { padding: 0 14px; }
  .search-wrap, .cat-container { padding-left: 14px; padding-right: 14px; }
  .search-input { font-size: 15px; padding: 12px 42px 12px 16px; }
  .wrap { padding: 14px 12px 32px; }

  .card { flex-direction: column; height: auto; }
  .card-img { width: 100%; min-width: 100%; height: 180px; }
  .card-body { padding: 14px 16px 16px; }
  .card-title { font-size: 16.5px; }

  .related .card { flex-direction: row; height: 104px; }
  .related .card-img { width: 104px; min-width: 104px; height: 104px; }

  .detail-hero { height: 180px; }
  .detail-title { font-size: 21px; }
  .detail-body p { font-size: 16px; }
}

/* ---------- ads（广告位预留：仅占位边框，无背景色填充） ---------- */
.adbox { width: 300px; height: 250px; margin: 16px auto; position: relative; }
.ad-slot { width: 100%; height: 100%; }
/* 空槽占位标记：仅当 slot 为空时显示 "AD"，真实广告注入后自动消失（无背景色/边框） */
.ad-slot:empty::after {
  content: "";
  display: grid; place-items: center;
  width: 100%; height: 100%;
  color: #b3b8c0; font-size: 13px; font-weight: 700; letter-spacing: 2px;
}

.ad-close {
  position: absolute; top: -12px; right: 4px; z-index: 2;
  width: 28px; height: 28px; border: 0; border-radius: 50%;
  background: #fff; color: #333; font-size: 18px; line-height: 1; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}

/* 锚定广告：固定底部居中横幅 */
.ad-anchor {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: center;
  padding: env(safe-area-inset-bottom, 0px) 8px 0;
  z-index: 1200;
}
.ad-anchor .adbox { margin: 0; width: 100%; max-width: 320px; }
.adbox-anchor { height: 50px; }

/* 插页广告：全屏遮罩，居中 300x250 */
.ad-interstitial {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .6);
  display: none; align-items: center; justify-content: center;
  z-index: 2000; padding: 16px;
}
.ad-interstitial.show { display: flex; }
.ad-interstitial-inner { position: relative; }
.ad-interstitial .adbox { margin: 0; }
