*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'PingFang SC', 'Microsoft YaHei', ui-sans-serif, system-ui, sans-serif;
  color: #1f2937;
  background: linear-gradient(to bottom, #fffbeb, #fff, #fffbeb);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

.site-header {
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid #fde68a;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
}
.site-header .inner {
  max-width: 64rem; margin: 0 auto; padding: .75rem 1rem;
  display: flex; align-items: center; justify-content: space-between;
}
.logo { font-size: 1.125rem; font-weight: 800; color: #b45309; }
.nav a { font-size: .875rem; color: #4b5563; margin-left: 1rem; }
.nav a:hover, .nav a.active { color: #b45309; font-weight: 600; }

.site-footer {
  border-top: 1px solid #e5e7eb;
  background: rgba(255,255,255,.8);
  padding: 1.5rem 1rem;
  text-align: center;
}
.site-footer p { margin: 0 0 .5rem; font-size: .75rem; color: #9ca3af; }

.container { max-width: 64rem; margin: 0 auto; padding: 2rem 1rem; }
.container-narrow { max-width: 56rem; margin: 0 auto; padding: 1.5rem 1rem 1.5rem; }

.text-center { text-align: center; }
.h1 { font-size: clamp(1.875rem, 4vw, 3rem); font-weight: 800; margin: 0 0 1rem; letter-spacing: -.02em; }
.h2 { font-size: 1.5rem; font-weight: 700; margin: 0 0 1rem; padding-bottom: .75rem; border-bottom: 2px solid #fde68a; color: #1f2937; }
.h3 { font-size: 1.25rem; font-weight: 700; margin: 0 0 .75rem; }
.lead { font-size: 1.05rem; color: #4b5563; max-width: 36rem; margin: 0 auto; }
.muted { color: #6b7280; font-size: .875rem; }
.meta-row { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center; font-size: .75rem; color: #9ca3af; margin-top: 1rem; }

.badges { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-top: .75rem; }
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .25rem .75rem; border-radius: 9999px; font-size: .75rem; font-weight: 500;
}
.badge-green { background: #f0fdf4; color: #15803d; }
.badge-blue { background: #eff6ff; color: #1d4ed8; }
.badge-amber { background: #fffbeb; color: #b45309; }
.badge-red { background: #fef2f2; color: #dc2626; }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; }
.badge-dot.green { background: #22c55e; }
.badge-dot.blue { background: #3b82f6; }
.badge-dot.amber { background: #f59e0b; }

.card {
  background: #fff;
  border: 1px solid #fde68a;
  border-radius: .75rem;
  padding: 1.25rem;
  transition: box-shadow .2s, border-color .2s;
}
a.card { display: block; color: inherit; }
.card:hover { border-color: #fcd34d; box-shadow: 0 10px 25px rgba(180,83,9,.08); }
.card-gradient {
  background: linear-gradient(135deg, #fffbeb, #ffedd5);
  border: 2px solid #fde68a;
}
.card-red { border: 2px solid #fecaca; background: linear-gradient(135deg, #fef2f2, #fffbeb, #fef9c3); }
.card-purple { border: 2px solid #e9d5ff; background: linear-gradient(135deg, #faf5ff, #eef2ff); }

.grid-2 { display: grid; gap: 1rem; }
.grid-3 { display: grid; gap: 1rem; }
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

.service-icon {
  width: 2.5rem; height: 2.5rem; border-radius: .5rem;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 1.125rem;
  background: linear-gradient(135deg, #fbbf24, #ef4444);
  flex-shrink: 0;
}
.service-icon.blue { background: linear-gradient(135deg, #60a5fa, #a855f7); }

.breadcrumb { font-size: .75rem; color: #6b7280; padding: .5rem 1rem; max-width: 56rem; margin: 0 auto; }
.breadcrumb a:hover { color: #b45309; text-decoration: underline; }

.intro-box {
  border-radius: .75rem;
  border: 1px solid #fde68a;
  background: linear-gradient(to right, #fffbeb, #ffedd5);
  padding: 1.25rem 1.5rem;
}
.intro-box p { margin: 0; line-height: 1.75; color: #374151; }
.intro-box strong { color: #1f2937; }

.form-card { border: 2px solid #fde68a; border-radius: .75rem; background: linear-gradient(135deg, #fffbeb, #ffedd5); padding: 1.5rem; }
.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
label { display: block; font-size: .875rem; font-weight: 500; color: #b45309; margin-bottom: .35rem; }
select, input[type="number"] {
  width: 100%; padding: .5rem .75rem; border: 1px solid #fcd34d;
  border-radius: .5rem; background: #fff; font-size: .95rem;
}
.radio-row { display: flex; gap: 1.5rem; margin-top: .5rem; }
.btn-primary {
  display: inline-block; padding: .75rem 3rem; font-size: 1.05rem; font-weight: 700;
  color: #fff; border: none; border-radius: .5rem; cursor: pointer;
  background: linear-gradient(to right, #f59e0b, #f97316);
  box-shadow: 0 4px 14px rgba(249,115,22,.35);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-secondary {
  display: inline-block; padding: .6rem 1.25rem; font-size: .9rem; font-weight: 600;
  color: #92400e; border: 1px solid #fcd34d; border-radius: .5rem; cursor: pointer;
  background: #fff;
}
.btn-secondary:hover { background: #fffbeb; }

.pillars { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; text-align: center; }
.pillar-box {
  display: block;
  border: 2px solid #fecaca; background: #fff; border-radius: .5rem;
  padding: .75rem .5rem; font-size: 1.75rem; font-weight: 800; color: #b91c1c;
  text-align: center; margin: 0;
}
.wuxing-row { display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; flex-wrap: wrap; }
.wuxing-row .wuxing-bar { flex: 1; min-width: 120px; }
.wuxing-bar { flex: 1; height: 1rem; background: #f3f4f6; border-radius: 9999px; overflow: hidden; }
.wuxing-fill { height: 100%; border-radius: 9999px; transition: width .5s; }
.wuxing-fill.metal { background: #facc15; }
.wuxing-fill.wood { background: #22c55e; }
.wuxing-fill.water { background: #3b82f6; }
.wuxing-fill.fire { background: #ef4444; }
.wuxing-fill.earth { background: #f59e0b; }

details.faq {
  border: 1px solid #fde68a; border-radius: .5rem; background: #fff; margin-bottom: .75rem;
}
details.faq summary {
  cursor: pointer; padding: 1rem 1.25rem; font-weight: 700; list-style: none;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq[open] summary { color: #b45309; }
details.faq p { padding: 0 1.25rem 1rem; margin: 0; color: #4b5563; font-size: .9rem; }

.almanac-live { display: inline-flex; align-items: center; gap: .25rem; font-size: .75rem; color: #15803d; border: 1px solid #86efac; background: #f0fdf4; padding: .15rem .5rem; border-radius: 9999px; }
.pulse { width: 6px; height: 6px; border-radius: 50%; background: #22c55e; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

.zodiac-tabs { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: 1rem; }
.zodiac-tab {
  border: none; border-radius: 9999px; padding: .25rem .75rem; font-size: .75rem;
  cursor: pointer; background: #f3f4f6; color: #4b5563;
}
.zodiac-tab.active { background: #ef4444; color: #fff; }

.prose p { margin: 0 0 .75rem; line-height: 1.75; color: #4b5563; font-size: .9rem; }
.prose strong { color: #1f2937; }
.prose table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.prose th, .prose td { padding: .5rem 1rem; border-bottom: 1px solid #fef3c7; text-align: left; }
.prose thead tr { background: #fffbeb; }

.disclaimer { font-size: .75rem; color: #9ca3af; text-align: center; padding: 1rem; border: 1px solid #e5e7eb; border-radius: .5rem; background: #f9fafb; margin-top: 1rem; }

.section { margin-bottom: 2.5rem; }
.article-list-section .h2 { margin-bottom: .5rem; }
.section-lead {
  font-size: .875rem;
  margin: 0 0 1.25rem;
  padding-left: .75rem;
  border-left: 3px solid #f59e0b;
}
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-8 { margin-top: 2rem; }

/* Admin */
.admin-header { background: #b45309; color: #fff; padding: 1rem; }
.admin-layout { max-width: 80rem; margin: 0 auto; padding: 1.5rem 1rem; display: flex; gap: 1.5rem; }
.admin-nav { width: 12rem; flex-shrink: 0; }
.admin-nav button {
  width: 100%; text-align: left; padding: .6rem 1rem; border: none; border-radius: .5rem;
  background: transparent; cursor: pointer; font-size: .875rem; margin-bottom: .25rem;
}
.admin-nav button.active { background: #fef3c7; color: #92400e; font-weight: 600; }
.admin-main { flex: 1; min-width: 0; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.admin-table th, .admin-table td { border: 1px solid #e5e7eb; padding: .5rem; text-align: left; }
.admin-table th { background: #f9fafb; }
.admin-input { width: 100%; padding: .4rem .6rem; border: 1px solid #d1d5db; border-radius: .25rem; margin-bottom: .5rem; }
.admin-textarea { width: 100%; min-height: 120px; padding: .5rem; border: 1px solid #d1d5db; border-radius: .25rem; font-family: inherit; }
.admin-msg { padding: .5rem 1rem; border-radius: .25rem; margin-bottom: 1rem; font-size: .875rem; }
.admin-msg.ok { background: #f0fdf4; color: #166534; }
.admin-msg.err { background: #fef2f2; color: #991b1b; }
.wenxin-item {
  border: 1px solid #fde68a; background: #fffbeb; border-radius: .5rem;
  padding: 1rem; margin-bottom: 1rem;
}
.wenxin-item-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: .75rem;
}
.wenxin-remove {
  border: none; background: transparent; color: #b91c1c; cursor: pointer; font-size: .875rem;
}
.wenxin-remove:hover { text-decoration: underline; }
.autogen-stats {
  padding: .75rem 1rem;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: .5rem;
}
.autogen-stats code { background: #fef3c7; padding: .1rem .35rem; border-radius: .2rem; }
.autogen-batch {
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid #fcd34d;
  border-radius: .5rem;
  background: #fff;
}
.autogen-batch-row {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  margin-bottom: .5rem;
}
.btn-sm { padding: .4rem .75rem; font-size: .8rem; }
#btn-run-batch:disabled { opacity: .6; cursor: wait; }

/* 文章列表（首页 / 栏目页） */
.article-list-wrap { margin-top: .25rem; }

.article-list-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .5rem 1rem;
  margin-bottom: 1rem;
  padding: .65rem 1rem;
  background: linear-gradient(90deg, #fffbeb, #fff);
  border: 1px solid #fde68a;
  border-radius: .5rem;
  font-size: .8125rem;
  color: #6b7280;
}
.article-list-count strong { color: #b45309; font-weight: 700; }
.article-list-page-hint {
  padding: .2rem .65rem;
  border-radius: 9999px;
  background: #fef3c7;
  color: #92400e;
  font-weight: 500;
}

.article-list-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .875rem;
}

.article-list-item { margin: 0; }

.article-card {
  position: relative;
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 0 1rem;
  align-items: start;
  padding: 1.15rem 1.25rem 1.15rem 1rem;
  background: #fff;
  border: 1px solid #fde68a;
  border-radius: .75rem;
  box-shadow: 0 1px 3px rgba(180, 83, 9, .06);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: border-color .2s, box-shadow .25s, transform .2s;
}
.article-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  opacity: .85;
  transition: width .2s;
}
.article-card:hover {
  border-color: #fcd34d;
  box-shadow: 0 12px 28px rgba(180, 83, 9, .12);
  transform: translateY(-2px);
}
.article-card:hover::before { width: 6px; }
.article-card:hover .article-card-cta { color: #b45309; gap: .45rem; }
.article-card:hover .article-card-title { color: #b45309; }

.article-card-index {
  grid-column: 1;
  align-self: center;
  font-size: .7rem;
  font-weight: 700;
  color: #d97706;
  opacity: .55;
  font-variant-numeric: tabular-nums;
  min-width: 1.5rem;
  text-align: center;
}
.article-card-icon {
  grid-column: 2;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: .65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: #fff;
  background: linear-gradient(145deg, #fbbf24, #ea580c);
  box-shadow: 0 4px 12px rgba(234, 88, 12, .25);
  flex-shrink: 0;
}
.article-card-body {
  grid-column: 3;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.article-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.45;
  color: #1f2937;
  transition: color .15s;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.article-card-subtitle {
  font-size: .875rem;
  font-weight: 500;
  color: #b45309;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.article-card-desc {
  font-size: .8125rem;
  line-height: 1.65;
  color: #6b7280;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.article-card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .75rem;
  margin-top: .35rem;
  padding-top: .5rem;
  border-top: 1px dashed #fde68a;
  font-size: .75rem;
  color: #9ca3af;
}
.article-card-tag {
  padding: .15rem .5rem;
  border-radius: 9999px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-weight: 500;
}
.article-card-date { font-variant-numeric: tabular-nums; }
.article-card-cta {
  margin-left: auto;
  font-weight: 600;
  color: #9ca3af;
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  transition: color .15s, gap .15s;
}
.article-card-cta::after {
  content: '→';
  font-size: .9em;
}

.article-list-empty {
  text-align: center;
  padding: 2.5rem 1.5rem;
  background: linear-gradient(180deg, #fffbeb, #fff);
  border: 1px dashed #fcd34d;
  border-radius: .75rem;
}
.article-list-empty-icon { font-size: 2.5rem; display: block; margin-bottom: .75rem; opacity: .9; }
.article-list-empty-title { margin: 0 0 .35rem; font-size: 1.1rem; font-weight: 700; color: #92400e; }
.article-list-empty-desc { margin: 0; font-size: .875rem; color: #6b7280; max-width: 24rem; margin-inline: auto; }
.article-list-error {
  border-color: #fecaca;
  background: linear-gradient(180deg, #fef2f2, #fff);
}
.article-list-error .article-list-empty-title { color: #b91c1c; }

@media (min-width: 768px) {
  .article-list-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  .article-card {
    min-height: 10.5rem;
    align-content: start;
  }
  .article-card-icon {
    width: 3rem;
    height: 3rem;
  }
}

@media (min-width: 1024px) {
  .article-list-grid { gap: 1.125rem; }
  .article-card-title { font-size: 1.1rem; }
}

.pagination {
  margin-top: 1.75rem;
  padding: 1.25rem 1rem;
  background: #fff;
  border: 1px solid #fde68a;
  border-radius: .75rem;
  text-align: center;
}
.pagination-summary {
  font-size: .8125rem;
  color: #6b7280;
  margin: 0 0 1rem;
}
.pagination-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  align-items: center;
  justify-content: center;
}
.pagination-list a,
.pagination-list .current,
.pagination-list .disabled,
.pagination-list .ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  padding: .45rem .8rem;
  border-radius: 9999px;
  font-size: .8125rem;
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
}
.pagination-list a {
  border: 1px solid #fcd34d;
  color: #92400e;
  background: #fffbeb;
}
.pagination-list a:hover {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #b45309;
}
.pagination-list .current {
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #fff;
  font-weight: 700;
  border: none;
  box-shadow: 0 4px 12px rgba(234, 88, 12, .3);
}
.pagination-list .disabled {
  color: #d1d5db;
  border: 1px solid #f3f4f6;
  background: #f9fafb;
}
.pagination-list .ellipsis {
  color: #9ca3af;
  padding: .45rem .35rem;
  min-width: auto;
}

/* ===== 图片轮播 ===== */
.carousel {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  border-radius: .75rem;
  overflow: hidden;
  margin: 1.5rem 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.carousel-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform .6s cubic-bezier(.4,0,.2,1);
}
.carousel-slide {
  min-width: 100%;
  height: 100%;
}
.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.carousel-dots {
  position: absolute;
  bottom: .75rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: .5rem;
}
.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,.5);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background .3s, transform .3s;
}
.carousel-dot.active {
  background: #fff;
  transform: scale(1.3);
}
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,.25);
  color: #fff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .3s;
  opacity: 0;
}
.carousel:hover .carousel-btn { opacity: 1; }
.carousel-btn:hover { background: rgba(0,0,0,.5); }
.carousel-btn.prev { left: .5rem; }
.carousel-btn.next { right: .5rem; }

/* === 内链优化 === */
.prev-next-nav { display: flex; gap: 1rem; margin: 2rem 0; }
.prev-next-nav a {
  flex: 1; display: flex; flex-direction: column; gap: .25rem;
  padding: 1rem; border-radius: .5rem; border: 1px solid #fde68a;
  text-decoration: none; color: #1f2937; transition: all .2s;
}
.prev-next-nav a:hover { background: #fffbeb; border-color: #f59e0b; }
.prev-next-nav .label { font-size: .75rem; color: #92400e; font-weight: 600; }
.prev-next-nav .title { font-size: .875rem; font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prev-next-nav .next { text-align: right; }

.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem; }
.related-card {
  display: block; padding: .875rem; border-radius: .5rem;
  border: 1px solid #e5e7eb; text-decoration: none; color: #1f2937;
  transition: all .2s;
}
.related-card:hover { border-color: #f59e0b; background: #fffbeb; box-shadow: 0 2px 8px rgba(245,158,11,.1); }
.related-card .rc-title { font-size: .875rem; font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.related-card .rc-intro { font-size: .75rem; color: #6b7280; margin-top: .375rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.random-picks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .5rem; }
.random-pick-item {
  display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem;
  border-radius: .375rem; text-decoration: none; color: #1f2937;
  transition: background .15s;
}
.random-pick-item:hover { background: #fffbeb; }
.random-pick-item .idx { flex-shrink: 0; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: #fef3c7; color: #92400e; display: flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 700; }
.random-pick-item .txt { font-size: .8125rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }

.internallink { color: #b91c1c; text-decoration: underline; text-decoration-color: rgba(185,28,28,.3); text-underline-offset: 2px; transition: all .15s; }
.internallink:hover { color: #991b1b; text-decoration-color: #b91c1c; }

@media (max-width: 640px) {
  .prev-next-nav { flex-direction: column; }
  .prev-next-nav .next { text-align: left; }
  .related-grid { grid-template-columns: 1fr 1fr; }
  .random-picks-grid { grid-template-columns: 1fr; }
}
