/* ==========================================================================
   micro-wiki · 站点统一样式
   - CSS 变量管理主题（亮/暗）
   - 移动端优先
   - 设计语言：渐变 + 卡片 + emoji
   ========================================================================== */

:root {
  /* 颜色 - 亮色 */
  --color-bg: #fafbfc;
  --color-bg-soft: #f3f4f6;
  --color-surface: #ffffff;
  --color-text: #111827;
  --color-text-soft: #6b7280;
  --color-border: #e5e7eb;
  --color-primary: #3b82f6;
  --color-primary-bg: #eff6ff;
  --color-accent: #8b5cf6;

  --color-green: #10b981;
  --color-green-bg: #ecfdf5;
  --color-red: #ef4444;
  --color-red-bg: #fef2f2;
  --color-amber: #fbbf24;

  /* cheat 卡片主题色（亮色：浅底深字）*/
  --cheat-bg: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  --cheat-text: #1e293b;
  --cheat-border: #cbd5e1;
  --cheat-hl-green: #059669;
  --cheat-hl-red:   #dc2626;
  --cheat-hl-blue:  #2563eb;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.08);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --header-h: 60px;
  --content-max: 720px;

  --font-sans: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
}

[data-theme='dark'] {
  --color-bg: #0f172a;
  --color-bg-soft: #1e293b;
  --color-surface: #1e293b;
  --color-text: #f1f5f9;
  --color-text-soft: #94a3b8;
  --color-border: #334155;
  --color-primary: #60a5fa;
  --color-primary-bg: #1e3a8a;
  --color-accent: #a78bfa;

  --color-green: #34d399;
  --color-green-bg: #064e3b;
  --color-red: #f87171;
  --color-red-bg: #7f1d1d;
  --color-amber: #fbbf24;

  /* cheat 卡片主题色（暗色：深底浅字）*/
  --cheat-bg: linear-gradient(135deg, #1e293b, #0f172a);
  --cheat-text: #ffffff;
  --cheat-border: #334155;
  --cheat-hl-green: #86efac;
  --cheat-hl-red:   #fca5a5;
  --cheat-hl-blue:  #93c5fd;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.5);
}

/* 跟随系统 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --color-bg: #0f172a;
    --color-bg-soft: #1e293b;
    --color-surface: #1e293b;
    --color-text: #f1f5f9;
    --color-text-soft: #94a3b8;
    --color-border: #334155;
    --color-primary: #60a5fa;
    --color-primary-bg: #1e3a8a;
    --color-accent: #a78bfa;
    --color-green: #34d399;
    --color-green-bg: #064e3b;
    --color-red: #f87171;
    --color-red-bg: #7f1d1d;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.5);

    /* cheat 卡片（暗色）*/
    --cheat-bg: linear-gradient(135deg, #1e293b, #0f172a);
    --cheat-text: #ffffff;
    --cheat-border: #334155;
    --cheat-hl-green: #86efac;
    --cheat-hl-red:   #fca5a5;
    --cheat-hl-blue:  #93c5fd;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  padding-top: var(--header-h);
  transition: background-color 0.2s, color 0.2s;
}

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

/* ============== Header ============== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: color-mix(in srgb, var(--color-surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--color-border);
  z-index: 100;
  transition: background-color 0.2s, border-color 0.2s;
}

.site-header nav {
  max-width: 960px;
  margin: 0 auto;
  height: 100%;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.logo:hover { text-decoration: none; }

.nav-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.15s;
}
.icon-btn:hover { background: var(--color-bg-soft); }

/* ============== Container ============== */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 24px 16px 60px;
}

.container-wide {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

/* ============== Hero ============== */
.hero {
  text-align: center;
  margin-bottom: 28px;
  padding: 40px 20px 36px;
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  transition: background-color 0.2s;
}

.hero-emoji {
  font-size: 56px;
  display: block;
  margin-bottom: 14px;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.12));
}

.hero h1 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  color: var(--color-text-soft);
  font-size: 15px;
}

/* ============== Search ============== */
.search {
  display: block;
  width: 100%;
  max-width: 420px;
  margin: 18px auto 0;
  padding: 12px 16px;
  font-size: 15px;
  font-family: inherit;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-bg-soft);
  color: var(--color-text);
  outline: none;
  transition: border-color 0.15s, background-color 0.15s;
}
.search:focus { border-color: var(--color-primary); background: var(--color-surface); }

/* ============== Tags ============== */
.tags {
  margin-bottom: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tags::-webkit-scrollbar { display: none; }

.tag-row {
  display: flex;
  gap: 8px;
  padding: 4px 0;
  min-width: max-content;
}

.tag {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-soft);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.tag:hover { color: var(--color-text); }
.tag.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* ============== Section title ============== */
.section-title {
  font-size: 18px;
  font-weight: 700;
  margin: 24px 4px 16px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.section-title small {
  font-size: 13px;
  font-weight: 400;
  color: var(--color-text-soft);
}

/* ============== Card grid ============== */
.card-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}
@media (min-width: 600px) {
  .card-grid { grid-template-columns: 1fr 1fr; }
}

/* ============== Topic card ============== */
.topic-card {
  display: block;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.topic-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
  text-decoration: none;
}

.card-emoji {
  font-size: 40px;
  display: block;
  margin-bottom: 12px;
  line-height: 1;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--color-text-soft);
  margin-bottom: 8px;
}

.card-tag {
  background: var(--color-primary-bg);
  color: var(--color-primary);
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 500;
}

.card-time::before { content: '⏱'; margin-right: 3px; }

.card-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 6px;
}

.card-desc {
  font-size: 14px;
  color: var(--color-text-soft);
  line-height: 1.5;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-cta {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary);
}

/* ============== Verdict (科普核心结论卡片) ============== */
.verdict {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
  grid-template-columns: 1fr;
}
@media (min-width: 600px) {
  .verdict { grid-template-columns: 1fr 1fr; }
}

.verdict-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 22px 18px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border-top: 4px solid;
}
.verdict-card.yes { border-top-color: var(--color-green); background: linear-gradient(180deg, var(--color-green-bg) 0%, var(--color-surface) 70%); }
.verdict-card.no  { border-top-color: var(--color-red);   background: linear-gradient(180deg, var(--color-red-bg)   0%, var(--color-surface) 70%); }

.verdict-card .std {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: 0.3px;
}
.verdict-card .name { font-size: 13px; color: var(--color-text-soft); margin-bottom: 12px; }
.verdict-card .verdict-icon { font-size: 44px; margin-bottom: 6px; line-height: 1; }
.verdict-card .verdict-text { font-size: 16px; font-weight: 700; }
.verdict-card.yes .verdict-text { color: var(--color-green); }
.verdict-card.no  .verdict-text { color: var(--color-red); }

/* ============== Section ============== */
.section {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.2s;
}

.section h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tag-badge {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 6px;
  font-weight: 500;
}
.tag-badge.ok { background: var(--color-green-bg); color: var(--color-green); }
.tag-badge.bad { background: var(--color-red-bg); color: var(--color-red); }
.tag-badge.neutral { background: var(--color-primary-bg); color: var(--color-primary); }

.sub-head {
  font-size: 14px;
  font-weight: 600;
  margin: 16px 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ============== Std list ============== */
.std-list { list-style: none; }

.std-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}
.std-list li:last-child { border-bottom: none; }

.std-list .code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-text);
  min-width: 130px;
  background: var(--color-bg-soft);
  padding: 5px 10px;
  border-radius: 6px;
  text-align: center;
}
.std-list .info { flex: 1; min-width: 0; }
.std-list .info .name { font-size: 14px; font-weight: 500; }
.std-list .info .desc { font-size: 12px; color: var(--color-text-soft); margin-top: 2px; }

@media (max-width: 480px) {
  .std-list .code { min-width: 100px; font-size: 11.5px; }
}

/* ============== Tips (3 要素) ============== */
.tips { display: grid; gap: 12px; }

.tip {
  display: flex;
  gap: 14px;
  padding: 16px;
  background: var(--color-bg-soft);
  border-radius: var(--radius-md);
  align-items: flex-start;
}

.tip-num {
  width: 32px;
  height: 32px;
  background: var(--color-primary);
  color: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.tip-content h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.tip-content p { font-size: 13px; color: var(--color-text-soft); }

.compare {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 12px;
  flex-wrap: wrap;
}
.lvl {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.lvl.top { background: var(--color-green); color: white; }
.lvl.mid { background: var(--color-amber); color: white; }
.lvl.low { background: var(--color-border); color: var(--color-text-soft); }

.raw-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  margin: 2px;
}
.raw-tag.good { background: var(--color-green-bg); color: var(--color-green); }
.raw-tag.mid  { background: var(--color-bg-soft); color: var(--color-text); }
.raw-tag.bad  { background: var(--color-red-bg); color: var(--color-red); }
.raw-tag.gt   { color: var(--color-text-soft); margin: 0 2px; }

.warn-line {
  color: var(--color-red);
  font-size: 12px;
  margin-top: 6px;
  background: var(--color-red-bg);
  padding: 6px 10px;
  border-radius: 6px;
  border-left: 3px solid var(--color-red);
}

/* ============== Cheat (口诀卡 · 跟随主题) ============== */
.cheat {
  background: var(--cheat-bg);
  color: var(--cheat-text);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 16px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--cheat-border);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.cheat h2 { color: var(--cheat-text); margin-bottom: 14px; }
.cheat p { font-size: 15px; line-height: 2; color: var(--cheat-text); }
.cheat .hl-green { color: var(--cheat-hl-green); font-weight: 700; }
.cheat .hl-red   { color: var(--cheat-hl-red);   font-weight: 700; }
.cheat .hl-blue  { color: var(--cheat-hl-blue);  font-weight: 700; }

/* 给 emoji 加个轻投影，在浅色背景下更立体 */
.section h2 > * { display: inline-block; }
.emoji-icon { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.12)); display: inline-block; }

/* ============== Chart container ============== */
.chart-wrap {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin: 16px 0;
  box-shadow: var(--shadow-sm);
}
.chart-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--color-text-soft);
}
.chart {
  width: 100%;
  height: 320px;
}
.chart.tall { height: 380px; }
@media (min-width: 600px) {
  .chart { height: 360px; }
  .chart.tall { height: 420px; }
}

/* ============== Breadcrumb ============== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--color-text-soft);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--color-text-soft); text-decoration: none; }
.breadcrumb a:hover { color: var(--color-primary); }
.breadcrumb .sep { opacity: 0.5; }
.breadcrumb .current { color: var(--color-text); font-weight: 500; }

/* ============== Footer ============== */
.site-footer {
  text-align: center;
  color: var(--color-text-soft);
  font-size: 12px;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
}
.site-footer a { color: var(--color-text-soft); }

/* ============== Stat mini ============== */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.stat {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-primary);
}
.stat-label {
  font-size: 12px;
  color: var(--color-text-soft);
  margin-top: 2px;
}

/* ============== Misc ============== */
.text-soft { color: var(--color-text-soft); }
.mt-2 { margin-top: 16px; }
.mb-2 { margin-bottom: 16px; }

/* ============== Figure (图文混排容器) ============== */
.figure {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 16px 12px;
  background: var(--color-bg-soft);
  border-radius: 14px;
  margin: 14px 0;
}
.figure-img {
  max-width: 100%;
  height: auto;
  max-height: 360px;
  border-radius: 8px;
  object-fit: contain;
  display: block;
}
.figure-caption {
  font-size: 12px;
  color: var(--color-text-soft);
  text-align: center;
  margin-top: 8px;
  line-height: 1.5;
}

/* ============== Lucide SVG (替换 emoji 的统一方案) ============== */
.lucide-icon {
  display: inline-block;
  vertical-align: middle;
  stroke-width: 2;
  flex-shrink: 0;
}
.lucide-green { color: var(--color-green); }
.lucide-red   { color: var(--color-red); }
.lucide-amber { color: var(--color-amber); }
.lucide-blue  { color: var(--color-primary); }
.lucide-soft  { color: var(--color-text-soft); }
.lucide-accent{ color: var(--color-accent); }

/* ============== Card emoji (主页卡片装饰,装 Lucide SVG) ============== */
.card-emoji {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  color: var(--color-primary);
}
.card-emoji > .lucide-icon { width: 40px; height: 40px; }
.card-emoji > svg { width: 40px; height: 40px; }

/* ============== Hero emoji (装 Lucide SVG 或自绘图) ============== */
.hero-emoji {
  font-size: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.12));
}
.hero-emoji > svg, .hero-emoji > img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

@media (max-width: 480px) {
  .hero h1 { font-size: 24px; }
  .hero-emoji { font-size: 48px; }
  .hero-emoji > svg, .hero-emoji > img { width: 56px; height: 56px; }
  .container, .container-wide { padding: 16px 12px 40px; }
  .chart, .chart.tall { height: 280px; }
  .figure { padding: 12px 8px; }
  .figure-img { max-height: 280px; }
}
