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

:root {
  --c-bg: #fafafa;
  --c-white: #fff;
  --c-text: #1a1a2e;
  --c-text-light: #555;
  --c-primary: #2563eb;
  --c-primary-dark: #1d4ed8;
  --c-border: #e5e7eb;
  --c-accent: #f59e0b;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.7;
  font-size: 16px;
}

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.site-header {
  background: var(--c-white);
  border-bottom: 1px solid var(--c-border);
  position: sticky; top: 0; z-index: 100;
}
.site-header .container {
  display: flex; align-items: center; gap: 24px;
  padding-top: 12px; padding-bottom: 12px;
  flex-wrap: wrap;
}
.logo { font-size: 1.25rem; font-weight: 700; color: var(--c-text); white-space: nowrap; }
.logo:hover { text-decoration: none; color: var(--c-primary); }

.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a {
  padding: 4px 12px; border-radius: 20px;
  font-size: .875rem; color: var(--c-text-light);
  transition: all .15s;
}
.site-nav a:hover { background: #eff6ff; color: var(--c-primary); text-decoration: none; }

.search-box { display: flex; margin-left: auto; }
.search-box input {
  border: 1px solid var(--c-border); border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  padding: 6px 12px; font-size: .875rem; width: 160px; outline: none;
}
.search-box input:focus { border-color: var(--c-primary); }
.search-box button {
  border: 1px solid var(--c-primary); background: var(--c-primary);
  color: #fff; padding: 6px 14px; border-radius: 0 var(--radius) var(--radius) 0;
  font-size: .875rem; cursor: pointer;
}
.search-box button:hover { background: var(--c-primary-dark); }

/* Hero */
.hero { text-align: center; padding: 60px 20px 40px; }
.hero h1 { font-size: 2.5rem; margin-bottom: 12px; letter-spacing: -.02em; }
.hero-desc { font-size: 1.15rem; color: var(--c-text-light); max-width: 560px; margin: 0 auto; }

/* Section headings */
section h2 { font-size: 1.35rem; margin-bottom: 20px; }

/* Article Grid */
.article-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.article-card {
  background: var(--c-white); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
  transition: box-shadow .2s;
}
.article-card:hover { box-shadow: var(--shadow-md); }
.card-category {
  display: inline-block; background: #eff6ff; color: var(--c-primary);
  padding: 2px 10px; border-radius: 12px; font-size: .75rem; margin-bottom: 10px;
}
.article-card h3, .article-item h3 { font-size: 1.1rem; margin-bottom: 8px; line-height: 1.5; }
.article-card p, .article-item p { font-size: .9rem; color: var(--c-text-light); margin-bottom: 10px; }
.article-card time, .article-item time { font-size: .8rem; color: #999; }

/* Featured card accent */
.featured-card { border-left: 3px solid var(--c-accent); }

/* Category Grid */
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.category-card {
  display: block; background: var(--c-white); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); transition: all .2s;
}
.category-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }
.category-card h3 { font-size: 1rem; color: var(--c-text); margin-bottom: 6px; }
.category-card p { font-size: .82rem; color: var(--c-text-light); line-height: 1.5; }

/* Article List */
.article-list { display: flex; flex-direction: column; gap: 12px; }
.article-item {
  background: var(--c-white); border-radius: var(--radius);
  padding: 20px 24px; box-shadow: var(--shadow);
}
.item-category {
  display: inline-block; font-size: .75rem; color: var(--c-primary);
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: .03em;
}

/* Single Article */
.single-article { max-width: 760px; margin: 40px auto; }
.article-header { margin-bottom: 40px; }
.breadcrumb { font-size: .85rem; color: #999; margin-bottom: 16px; }
.breadcrumb a { color: #666; }
.article-header h1 { font-size: 2rem; line-height: 1.4; margin-bottom: 12px; }
.article-meta { display: flex; align-items: center; gap: 12px; font-size: .9rem; color: #999; }
.category-tag { background: #eff6ff; color: var(--c-primary); padding: 2px 12px; border-radius: 12px; font-size: .8rem; }

/* Article Content */
.article-content {
  background: var(--c-white); border-radius: var(--radius);
  padding: 40px; box-shadow: var(--shadow);
  line-height: 1.8;
}
.article-content h2 {
  font-size: 1.4rem; margin: 32px 0 14px; padding-bottom: 8px;
  border-bottom: 1px solid var(--c-border);
}
.article-content h2:first-child { margin-top: 0; }
.article-content h3 { font-size: 1.15rem; margin: 24px 0 10px; }
.article-content p { margin-bottom: 16px; }
.article-content ul, .article-content ol { margin: 0 0 16px 24px; }
.article-content li { margin-bottom: 6px; }
.article-content table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: .9rem; }
.article-content th, .article-content td {
  border: 1px solid var(--c-border);
  padding: 10px 14px; text-align: left;
}
.article-content th { background: #f8fafc; font-weight: 600; }
.article-content tr:nth-child(even) td { background: #fafafa; }
.article-content blockquote {
  border-left: 3px solid var(--c-primary); padding: 10px 20px;
  margin: 16px 0; background: #f8fafc; color: var(--c-text-light);
}
.article-content code {
  background: #f1f5f9; padding: 2px 6px; border-radius: 4px;
  font-size: .88em; font-family: "JetBrains Mono", "Fira Code", monospace;
}
.article-content pre {
  background: #1e293b; color: #e2e8f0; padding: 20px;
  border-radius: var(--radius); overflow-x: auto; margin: 16px 0;
  font-size: .88rem; line-height: 1.6;
}
.article-content pre code { background: none; padding: 0; color: inherit; }
.article-content strong { font-weight: 600; color: #111; }
.article-content img { max-width: 100%; border-radius: var(--radius); }

/* Related */
.related { max-width: 760px; margin: 60px auto; }
.related h2 { margin-bottom: 16px; }

/* Category Page */
.category-page { padding: 40px 0; }
.category-page h1 { font-size: 1.8rem; margin-bottom: 8px; }
.category-desc { color: var(--c-text-light); margin-bottom: 32px; }

/* Search */
.search-page { padding: 40px 0; }
.search-large { display: flex; margin: 24px 0 32px; max-width: 500px; }
.search-large input {
  flex: 1; border: 1px solid var(--c-border); border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  padding: 10px 16px; font-size: 1rem; outline: none;
}
.search-large input:focus { border-color: var(--c-primary); }
.search-large button {
  border: 1px solid var(--c-primary); background: var(--c-primary);
  color: #fff; padding: 10px 24px; border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 1rem; cursor: pointer;
}
.search-count { color: var(--c-text-light); margin-bottom: 20px; }

/* Empty & 404 */
.empty { color: var(--c-text-light); padding: 40px 0; text-align: center; }
.affiliate-section {
  max-width: 760px; margin: 32px auto;
  background: linear-gradient(135deg, #fff9eb, #fff5d6);
  border: 1px solid #f59e0b; border-radius: var(--radius);
  padding: 24px 28px;
}
.affiliate-section h3 { margin-bottom: 14px; color: #92400e; }
.affiliate-list { display: flex; flex-direction: column; gap: 10px; }
.affiliate-card {
  display: flex; align-items: center; gap: 14px;
  background: #fff; padding: 14px 18px; border-radius: 6px;
  color: var(--c-text); box-shadow: var(--shadow);
  flex-wrap: wrap; transition: all .15s;
}
.affiliate-card:hover { box-shadow: var(--shadow-md); text-decoration: none; border-left: 3px solid var(--c-accent); }
.aff-title { font-weight: 600; font-size: .95rem; }
.aff-desc { font-size: .82rem; color: var(--c-text-light); }
.aff-price { font-weight: 700; color: #dc2626; font-size: .9rem; margin-left: auto; }
.aff-btn { background: var(--c-accent); color: #fff; padding: 6px 16px; border-radius: 18px; font-size: .82rem; font-weight: 600; white-space: nowrap; }

.not-found { text-align: center; padding: 80px 20px; }
.not-found h1 { font-size: 5rem; color: #ddd; }
.not-found p { font-size: 1.2rem; color: var(--c-text-light); margin: 16px 0 24px; }

/* Footer */
.site-footer { border-top: 1px solid var(--c-border); margin-top: 60px; padding: 24px 0; text-align: center; color: #999; font-size: .85rem; }

@media (max-width: 768px) {
  .site-header .container { flex-direction: column; align-items: flex-start; }
  .search-box { margin-left: 0; width: 100%; }
  .search-box input { width: 100%; }
  .hero h1 { font-size: 1.8rem; }
  .article-grid { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: repeat(2, 1fr); }
  .article-content { padding: 24px; }
  .article-header h1 { font-size: 1.5rem; }
}
