/* styles.css — AI 提示词页（参考图风格） */
:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #eef2ff;
  --text: #1f2937;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(99, 102, 241, 0.08);
  --max-width: 960px;
  --card: var(--surface);
  --text-secondary: #374151;
  --surface-2: #f9fafb;
  --surface-3: #f3f4f6;
  --border-soft: #e0e2ff;
  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --badge-green-bg: #ecfdf5;
  --badge-green-text: #047857;
  --badge-orange-bg: #fff7ed;
  --badge-orange-text: #c2410c;
  --badge-red-bg: #fef2f2;
  --badge-red-text: #dc2626;
  --danger: #dc2626;
  --white: #ffffff;
}
:root[data-theme="dark"] {
  --bg: #0f1117;
  --surface: #1a1d27;
  --primary: #818cf8;
  --primary-dark: #6366f1;
  --primary-light: #1e2140;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --border: #2d3148;
  --shadow: 0 10px 30px rgba(0,0,0,0.3);
  --card: var(--surface);
  --text-secondary: #9ca3af;
  --surface-2: #16181f;
  --surface-3: #1e2029;
  --border-soft: #2d3148;
  --code-bg: #0a0d14;
  --code-text: #e2e8f0;
  --badge-green-bg: rgba(5, 150, 105, 0.15);
  --badge-green-text: #34d399;
  --badge-orange-bg: rgba(234, 88, 12, 0.15);
  --badge-orange-text: #fb923c;
  --badge-red-bg: rgba(220, 38, 38, 0.15);
  --badge-red-text: #f87171;
  --danger: #f87171;
  --white: #f1f5f9;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* 顶部导航 */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 56px;
}
.brand {
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-logo { height: 28px; width: 28px; display: block; }
.topnav {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.topnav::-webkit-scrollbar { display: none; }
.topnav a {
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.topnav a:hover { color: var(--primary); background: var(--primary-light); }
.topnav a.active { color: var(--white); background: var(--primary); }
.nav-account { flex-shrink: 0; min-width: 42px; }

/* 顶部右侧统一头像入口 */
.nav-user-wrap { position: relative; display: inline-flex; align-items: center; flex-shrink: 0; margin-left: 12px; }
.nav-avatar-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; padding: 4px; border-radius: 999px;
  cursor: pointer; line-height: 1;
}
.nav-avatar-btn:hover { background: var(--primary-light); }
/* 当前在「我的」页时，头像入口高亮（与 topnav a.active 一致） */
.nav-user-wrap.active .nav-avatar-btn {
  background: var(--primary);
  box-shadow: 0 0 0 2px var(--primary);
}
.nav-avatar {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover;
  display: block;
}
.nav-avatar-badge {
  position: absolute; top: -2px; right: -2px;
  min-width: 14px; height: 14px; line-height: 14px; padding: 0 3px;
  background: var(--danger); color: var(--white); border-radius: 999px;
  font-size: 10px; text-align: center; pointer-events: none;
}
.nav-user-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 190px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 10px 30px rgba(40,44,80,.12);
  padding: 6px 0; z-index: 1000;
}
.nav-user-menu.hidden { display: none !important; }
.nav-user-header {
  padding: 10px 14px; border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
.nav-user-header strong { display: block; font-size: 14px; color: var(--text); }
.nav-user-header span { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.nav-user-menu a,
.nav-user-menu button {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 9px 14px; font-size: 13px;
  color: var(--text); background: none; border: none;
  text-align: left; text-decoration: none; cursor: pointer;
}
.nav-user-menu a:hover,
.nav-user-menu button:hover { background: var(--primary-light); color: var(--primary); }
.nav-user-menu .nav-logout { color: var(--danger); }
.menu-badge {
  margin-left: auto;
  min-width: 14px; height: 14px; line-height: 14px; padding: 0 4px;
  background: var(--danger); color: var(--white); border-radius: 999px;
  font-size: 10px; text-align: center;
}

/* 子导航栏 */
.subnav-bar {
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.subnav-bar .wrap {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.subnav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.subnav::-webkit-scrollbar { display: none; }
.subnav a {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  transition: color .15s, background .15s;
}
.subnav a:hover { color: var(--primary); background: var(--primary-light); }
.subnav a.active { color: var(--primary); background: var(--primary-light); font-weight: 600; }

/* 暗色模式切换按钮 */
.theme-toggle {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }

/* 全站搜索（导航栏内） */
.nav-search {
  flex-shrink: 0;
  position: relative;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-search-input {
  width: 180px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  outline: none;
  background: var(--bg);
  color: var(--text);
  transition: all .2s ease;
}
.nav-search-input:focus {
  border-color: var(--primary);
  width: 220px;
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.nav-search-btn {
  width: 30px; height: 30px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  flex-shrink: 0;
}
.nav-search-btn:hover { border-color: var(--primary); color: var(--primary); }
.nav-search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(40,44,80,.15);
  padding: 12px;
  z-index: 1000;
}
.nav-search-dropdown.hidden { display: none; }
.nav-search-results {
  max-height: 300px;
  overflow-y: auto;
  margin-top: 8px;
}
.nav-search-item {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  transition: background .15s;
}
.nav-search-item:hover { background: var(--primary-light); }
.nav-search-item .sr-type {
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
}
.nav-search-item .sr-title { display: block; margin-top: 2px; }
.nav-search-empty {
  text-align: center;
  padding: 16px;
  color: var(--text-muted);
  font-size: 13px;
}

/* 页面标题 */
.page-title {
  text-align: center;
  margin: 40px 0 28px;
}
.page-title h1 {
  font-size: 36px;
  margin: 0 0 10px;
  letter-spacing: -0.5px;
}
.page-title .muted { font-size: 16px; color: var(--text-muted); margin: 0; }

/* 提示词生成器卡片 */
.generator-card {
  background: linear-gradient(180deg, var(--primary-light) 0%, var(--surface) 100%);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 48px;
  overflow: hidden;
}
.generator-head {
  padding: 22px 24px 10px;
}
.generator-head h2 {
  margin: 0;
  font-size: 20px;
  color: var(--text);
}

/* 分类 Tab */
.template-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 24px 16px;
}
.template-tabs::-webkit-scrollbar { display: none; }
.template-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.template-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.template-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

/* 生成器主体 */
.generator-body {
  background: var(--surface);
  border-top: 1px solid var(--border-soft);
  padding: 24px;
}
.topic-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  margin-bottom: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.topic-input:focus { border-color: var(--primary); }
.prompt-editor {
  width: 100%;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.7;
  resize: vertical;
  min-height: 220px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
}
.prompt-editor:focus { border-color: var(--primary); }

.generator-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 22px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--primary);
  color: var(--white);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
  background: var(--primary);
  color: var(--white);
}
.btn-secondary:hover { background: var(--primary-dark); }
.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.error {
  color: var(--danger);
  font-size: 14px;
  margin: 10px 0 0;
}

/* 提示词场景区域 */
.prompts-section { margin-bottom: 48px; }
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}
.section-title { font-size: 22px; margin: 0; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
}
.chip.active { background: var(--primary); color: var(--white); border-color: var(--primary); }

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.prompt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
  display: flex;
  flex-direction: column;
}
.prompt-card h3 { margin: 0 0 8px; font-size: 17px; }
.prompt-card .scene {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 10px;
}
.prompt-card .ptext {
  flex: 1;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--surface-2);
  border-radius: 8px;
  padding: 10px;
  white-space: pre-wrap;
  max-height: 140px;
  overflow: auto;
  margin-bottom: 12px;
}
.prompt-card .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tag {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary-dark);
}
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 14px;
  font-size: 13px;
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }

.muted { color: var(--text-muted); }

/* 页脚 */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  text-align: center;
  font-size: 13px;
}
.site-footer a {
  color: var(--text-muted); text-decoration: none;
  padding: 0 4px; transition: color .15s;
}
.site-footer a:hover { color: var(--primary); }
.site-footer a.active { color: var(--primary); font-weight: 600; }

/* 静态内容页（关于 / 隐私） */
.static-page h2 {
  font-size: 17px; color: var(--text); margin: 24px 0 8px;
}
.static-page p, .static-page li {
  font-size: 14px; color: var(--text-muted); margin: 0 0 10px;
}
.static-page ul { padding-left: 20px; margin: 0 0 12px; }
.static-page ul li { margin-bottom: 6px; }

/* 响应式 */
@media (max-width: 640px) {
  .site-header .wrap { flex-direction: column; height: auto; padding: 10px 20px; gap: 8px; }
  .page-title h1 { font-size: 28px; }
  .generator-head { padding: 18px 18px 8px; }
  .template-tabs { padding: 0 18px 14px; }
  .generator-body { padding: 18px; }
  .generator-actions { flex-direction: column; }
  .btn { width: 100%; }
}

/* ===== AI 工具集页面 ===== */

/* 工具栏：分类 + 搜索 */
.tool-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.tool-toolbar .chips { flex: 1 1 auto; }
.search-box {
  flex: 0 0 240px;
  max-width: 100%;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.search-box:focus { border-color: var(--primary); }

/* 工具卡片网格 */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
  display: flex;
  flex-direction: column;
  transition: transform 0.12s ease, box-shadow 0.15s ease, border-color 0.15s;
}
.tool-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 8px 22px rgba(99,102,241,0.1);
}
.tool-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.tool-icon {
  font-size: 28px;
  line-height: 1;
  flex: 0 0 auto;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}
.tool-id { flex: 1 1 auto; min-width: 0; }
.tool-id h3 {
  margin: 0;
  font-size: 17px;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.tool-vendor {
  font-size: 12px;
  color: var(--text-muted);
}
.price-badge {
  flex: 0 0 auto;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}
.price-badge.free { background: var(--badge-green-bg); color: var(--badge-green-text); }
.price-badge.plus { background: var(--primary-light); color: var(--primary-dark); }
.price-badge.paid { background: var(--badge-orange-bg); color: var(--badge-orange-text); }

.tool-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin: 0 0 12px;
  flex: 1;
}
.tool-card .tags { margin-bottom: 12px; }
.tool-cat {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-3);
  border-radius: 999px;
  padding: 3px 10px;
}

/* ===== AI 应用页面（复用 .tool-card，扩展平台 / 亮点） ===== */
.app-highlight {
  font-size: 13px;
  color: var(--primary-dark);
  background: var(--primary-light);
  border-radius: 10px;
  padding: 7px 10px;
  margin-bottom: 10px;
  line-height: 1.5;
}
.app-platform {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.pf-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-right: 2px;
}
.pf-chip {
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 9px;
}

@media (max-width: 640px) {
  .tool-toolbar { flex-direction: column; align-items: stretch; }
  .search-box { flex: 1 1 auto; width: 100%; }
}

/* ===== AI 工具测评页面 ===== */
/* 评分徽章（嵌在卡片右上角，与价格徽章同级） */
.rating-badge {
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
}
.rating-badge small { font-size: 11px; font-weight: 500; opacity: 0.85; }
.rating-badge.good { background: var(--badge-green-bg); color: var(--badge-green-text); }
.rating-badge.mid  { background: var(--primary-light); color: var(--primary-dark); }
.rating-badge.low  { background: var(--badge-orange-bg); color: var(--badge-orange-text); }

/* 优点 / 缺点 对照区 */
.review-points {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0 0 12px;
}
.review-col-title {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}
.review-col.pros .review-col-title { color: var(--badge-green-text); }
.review-col.cons .review-col-title { color: var(--badge-orange-text); }
.review-col ul {
  margin: 0;
  padding-left: 16px;
}
.review-col li {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 3px;
}

@media (max-width: 480px) {
  .review-points { grid-template-columns: 1fr; }
}

/* ===== 免费 AI API 页面 ===== */
/* 免费额度 / 是否需 Key / 调用方式 三项信息区 */
.api-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 0 0 12px;
}
.api-meta-item { display: flex; align-items: baseline; gap: 8px; }
.api-meta-label {
  flex: 0 0 76px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}
.api-meta-val { font-size: 13px; color: var(--text-secondary); line-height: 1.5; flex: 1 1 auto; }
.api-meta-val.need-key { color: var(--badge-orange-text); font-weight: 600; }
.api-meta-val.no-key { color: var(--badge-green-text); font-weight: 600; }

/* ===== 首页（AI 资讯 · 左右布局） ===== */
.home-hero { margin: 36px 0 28px; }
.hero-title {
  font-size: 34px;
  margin: 0 0 8px;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, var(--primary), #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-sub {
  font-size: 15px;
  color: var(--text-muted);
  margin: 0 0 18px;
}
.hero-search { max-width: 520px; }
.hero-search .search-box { width: 100%; padding: 11px 18px; font-size: 15px; }


/* 左右两栏布局 */
.layout-home {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 28px;
  align-items: start;
}
.home-main { min-width: 0; }

/* 左侧：分类 Tab + 新闻流 */
.news-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.tab {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.tab:hover { border-color: var(--primary); }
.tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
  font-weight: 600;
}

.news-list { display: flex; flex-direction: column; gap: 14px; }
.news-card {
  display: block;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
  transition: transform 0.12s ease, box-shadow 0.15s ease, border-color 0.15s;
}
.news-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 8px 22px rgba(99,102,241,0.1);
}
.news-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.news-cat {
  color: var(--primary-dark);
  background: var(--primary-light);
  border-radius: 999px;
  padding: 2px 10px;
  font-weight: 600;
}
.news-title { margin: 0 0 8px; font-size: 17px; line-height: 1.4; color: var(--text); }
.news-card:hover .news-title { color: var(--primary); }
.news-desc {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.65;
}
/* 整卡底部「查看来源」提示，强化跳转语义 */
.news-source {
  display: inline-block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-dark);
}
.news-card:hover .news-source { text-decoration: underline; }

/* ===== 排行榜 榜单风格 ===== */
.rank-table { display: flex; flex-direction: column; gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.rank-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--border); transition: background 0.15s; }
.rank-row:last-child { border-bottom: none; }
.rank-row:hover { background: var(--primary-light); }

.rank-num {
  flex: 0 0 44px; width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; color: var(--text-muted);
  background: var(--bg);
}
.rank-num.gold   { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: var(--white); box-shadow: 0 2px 8px rgba(245,158,11,0.25); }
.rank-num.silver { background: linear-gradient(135deg, #cbd5e1, #94a3b8); color: var(--white); box-shadow: 0 2px 8px rgba(148,163,184,0.25); }
.rank-num.bronze { background: linear-gradient(135deg, #f59e0b, #d97706); color: var(--white); box-shadow: 0 2px 8px rgba(217,119,6,0.2); }

.rank-icon { flex: 0 0 36px; font-size: 26px; text-align: center; line-height: 1; }
.rank-logo { flex: 0 0 36px; width: 36px; height: 36px; object-fit: contain; border-radius: 8px; background: var(--card); box-shadow: 0 0 0 1px var(--border); }
.rank-info { flex: 1; min-width: 0; }
.rank-name  { font-size: 16px; font-weight: 700; color: var(--text); line-height: 1.3; }
.rank-desc  { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-meta  { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; }
.rank-cat   { font-size: 12px; font-weight: 600; color: var(--primary-dark); background: var(--primary-light); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.rank-link  { font-size: 13px; font-weight: 600; color: var(--primary); text-decoration: none; white-space: nowrap; padding: 6px 12px; border: 1px solid var(--primary); border-radius: 8px; transition: all 0.15s; }
.rank-link:hover { background: var(--primary); color: var(--white); }

/* 模型行 */
.rank-bar-wrap { flex: 1; min-width: 120px; display: flex; align-items: center; gap: 10px; }
.rank-bar-outer { flex: 1; height: 14px; background: var(--bg); border-radius: 7px; overflow: hidden; }
.rank-bar-inner { height: 100%; border-radius: 7px; background: linear-gradient(90deg, var(--primary), var(--primary-dark)); transition: width 0.6s ease; }
.rank-bar-val  { font-size: 14px; font-weight: 700; color: var(--primary); min-width: 60px; text-align: right; }
.rank-vendor   { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

/* 月度紧凑列表 */
.rank-monthly { display: flex; flex-direction: column; gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.rank-monthly .rank-row { padding: 12px 18px; }
.rank-monthly .rank-desc { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* 趋势标签 */
.rank-trend { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px; margin-left: 8px; vertical-align: middle; display: inline; }
.rank-trend.trend-up   { background: var(--badge-green-bg); color: var(--badge-green-text); }
.rank-trend.trend-down { background: var(--badge-red-bg); color: var(--danger); }
.rank-trend.trend-hot  { background: var(--badge-orange-bg); color: var(--badge-orange-text); }
.rank-trend.trend-new  { background: var(--primary-light); color: var(--primary); }
.rank-change { font-size: 10px; opacity: 0.7; }

/* 开源标签 */
.rank-os-badge { font-size: 10px; font-weight: 700; background: var(--badge-green-text); color: var(--white); padding: 1px 6px; border-radius: 4px; margin-left: 6px; vertical-align: middle; }

/* 模型排行扩展字段 */
.rank-model-info { flex: 0.6; min-width: 120px; }
.rank-model-specs { flex: 0.9; min-width: 120px; display: flex; gap: 6px; flex-wrap: wrap; }
.rank-spec { font-size: 11px; color: var(--text-muted); background: var(--bg); border-radius: 6px; padding: 2px 8px; white-space: nowrap; }

/* 性价比榜 */
.rank-value-meta { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; }
.rank-value-price { font-size: 16px; font-weight: 800; color: var(--primary); white-space: nowrap; }
.rank-value-quality { font-size: 11px; font-weight: 700; background: linear-gradient(135deg, #fbbf24, #f59e0b); color: var(--white); padding: 3px 10px; border-radius: 999px; white-space: nowrap; }

@media (max-width: 640px) {
  .rank-row { flex-wrap: wrap; gap: 8px; }
  .rank-meta { width: 100%; justify-content: flex-end; }
  .rank-model-specs { width: 100%; order: 3; }
  .rank-bar-wrap { min-width: 100%; }
  .rank-desc { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}

/* 右侧栏 */
.home-aside {
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 20px;
}
.aside-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.aside-block .section-title { margin: 0 0 14px; font-size: 17px; }

/* ===== 广告位 ===== */
.ad-unit {
  position: relative; overflow: hidden; border-radius: 12px;
  margin-bottom: 16px;
}
.ad-bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: 0;
}
.ad-overlay {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; height: 100%; min-height: inherit;
  background: linear-gradient(135deg, rgba(99,102,241,.55) 0%, rgba(139,92,246,.45) 100%);
  backdrop-filter: blur(1px); padding: 20px 18px; box-sizing: border-box;
}
.ad-cta { text-align: center; }
.ad-title {
  display: block; font-size: 20px; font-weight: 700; color: var(--white);
  letter-spacing: 2px; margin-bottom: 6px; text-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.ad-sub {
  display: block; font-size: 13px; color: rgba(255,255,255,.9);
  margin-bottom: 4px; font-weight: 500;
}
.ad-sub2 {
  display: block; font-size: 11px; color: rgba(255,255,255,.75);
}
.ad-action {
  margin-top: 10px; padding: 8px 20px;
  background: var(--surface); color: var(--primary); border-radius: 999px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.ad-action:hover { transform: scale(1.04); box-shadow: 0 4px 14px rgba(0,0,0,.18); }

/* 横幅版：横向排列 */
.ad-banner .ad-overlay {
  flex-direction: row; justify-content: space-between; padding: 12px 24px;
}
.ad-banner .ad-cta { text-align: left; }
.ad-banner .ad-title { font-size: 17px; letter-spacing: 1.5px; margin-bottom: 2px; }
.ad-banner .ad-sub { font-size: 12px; }

/* ===== 广告容器 ===== */
/* 所有广告容器固定推荐尺寸，让图片 cover 拉满后视觉上"占满框"，
   不再让图片按比例自然撑高容器（之前 .ad-placeholder 无固定高度，
   导致 slot-1/4 容器大小完全由图片决定，看起来图没"框"的边界感） */
.ad-placeholder {
  width: 100%;           /* 跟随父容器宽度（侧边栏自适应） */
  height: 250px;         /* 固定 250 高度，与 slot-1/4 推荐尺寸 300×250 一致 */
  border-radius: 10px;
  overflow: hidden;
  box-sizing: border-box;
  background: var(--surface-2);   /* 占位图加载前/失败时的兜底背景 */
}
.ad-banner {
  width: 100%;
  max-width: 728px;
  height: 90px;          /* 固定 90 高度，与 slot-2 推荐尺寸 728×90 一致 */
  margin: 0 auto 0 auto;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
  box-sizing: border-box;
  background: var(--surface-2);
}
.ad-banner:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
/* 所有 slot 的广告图：宽度/高度用 100% + object-fit:cover 强制铺满容器。
   之前 .ad-banner img / .ad-placeholder img 用 width:100%; height:auto，
   会让图片按比例自然高度 → 占位感弱、看起来"没拉满框"。
   cover 是行业标准做法（Google AdSense 等），可裁切但视觉上完全填满。 */
.ad-banner img,
.ad-placeholder img,
.ad-infeed img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  border-radius: 10px;
}
/* 广告链接（buildAdHTML 输出）撑满容器 */
.ad-real {
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: 10px;
  overflow: hidden;
}
.ad-placeholder .ad-real,
.ad-banner .ad-real,
.ad-infeed .ad-real {
  display: block;
  width: 100%;
  height: 100%;
  text-decoration: none;
  border-radius: 10px;
  overflow: hidden;
}

/* 信息流内嵌广告 (slot-3)：
   - 容器自动匹配所在列表的「一张文章卡片」高度（继承列表的卡片视觉密度）
   - 图片用 object-fit: cover 填满 + height:100% → 不管投放图是 300×250 / 16:9 / 21:9 都能裁切展示
   - grid 布局跨所有列；flex 布局强制 100% 宽度占满一行 */
.ad-infeed {
  grid-column: 1 / -1;     /* grid 布局：跨所有列 */
  flex: 0 0 100%;            /* flex 布局：占满一行 */
  max-width: 720px;
  width: 100%;
  /* 高度跟 list 上下文一致：列表卡片通常是 ~150-200px；min-height 给一个底线 */
  min-height: 160px;
  height: 200px;
  margin: 14px auto;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  display: block;
  box-sizing: border-box;
  background: var(--surface-2);
}
.ad-infeed > a {
  display: block;
  text-decoration: none;
  border-radius: 10px;
  overflow: hidden;
  width: 100%;
  height: 100%;
}
/* slot-3 实际广告链接：buildAdHTML 输出 <a class="ad-real ad-real-fill"> 时也撑满整个 720×200 框 */
.ad-infeed .ad-real.ad-real-fill {
  display: block;
  width: 100%;
  height: 100%;
  text-decoration: none;
  border-radius: 10px;
  overflow: hidden;
}

/* 图片加载失败的兜底卡片 */
.ad-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 200px;
  padding: 20px 16px;
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface-3) 100%);
  border: 1px dashed var(--border);
  border-radius: 10px;
  box-sizing: border-box;
  text-align: center;
}
.ad-fb-tag {
  display: inline-block;
  padding: 2px 10px;
  font-size: 11px;
  color: #94a3b8;
  background: #e2e8f0;
  border-radius: 10px;
  letter-spacing: 1px;
}
.ad-fb-title {
  font-size: 14px;
  color: #475569;
  font-weight: 500;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ad-fb-tip {
  font-size: 12px;
  color: #94a3b8;
}

/* 热点推荐（纵列，最多 10） */
.hot-list { display: flex; flex-direction: column; gap: 4px; }
.hot-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 8px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s ease;
}
.hot-item:hover { background: var(--primary-light); }
.hot-rank {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hot-item:nth-child(1) .hot-rank,
.hot-item:nth-child(2) .hot-rank,
.hot-item:nth-child(3) .hot-rank { background: var(--primary); color: var(--white); }
.hot-title { font-size: 14px; line-height: 1.45; }
.hot-item:hover .hot-title { color: var(--primary-dark); }

/* 板块导航小卡 */
.board-nav {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.board-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s ease;
}
.board-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.board-card.locked { opacity: 0.55; cursor: not-allowed; }
.board-card.locked:hover { transform: none; border-color: var(--border); }
.board-card.current { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); }
.bc-icon { font-size: 18px; }

/* ===== 站内文章详情页（article.html · 左右布局，宽度对齐主页 960px） ===== */
.layout-article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 28px;
  align-items: start;
  margin: 28px 0 40px;
}
.article-main { min-width: 0; }

.crumbs { font-size: 13px; color: var(--text-muted); margin-bottom: 18px; }
.crumbs a { color: var(--text-muted); text-decoration: none; }
.crumbs a:hover { color: var(--primary); }
.crumbs span { margin: 0 6px; }
.article-card-read {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 30px 32px;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.04);
}
.article-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.article-title { font-size: 26px; line-height: 1.35; margin: 4px 0 12px; color: var(--text); }
.article-lead { font-size: 15px; color: var(--text-muted); line-height: 1.7; margin: 0 0 14px; }
.article-body { margin-top: 18px; }
.article-body p { font-size: 15.5px; line-height: 1.9; color: var(--text-secondary); margin: 0 0 16px; }
.article-foot { margin-top: 26px; padding-top: 18px; border-top: 1px dashed var(--border); }
.source-btn {
  display: inline-block;
  padding: 10px 18px;
  background: var(--primary);
  color: var(--white);
  text-decoration: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s ease;
}
.source-btn:hover { background: var(--primary-dark); }

/* 响应式：移动端单列，右侧栏收到下方 */
@media (max-width: 920px) {
  .layout-home, .layout-article { grid-template-columns: 1fr; }
  .home-aside { position: static; }
}
/* 平板过渡：缩小侧栏宽度，避免 641-919px 范围过挤 */
@media (max-width: 768px) {
  .layout-home, .layout-article { grid-template-columns: 1fr; gap: 20px; }
  .home-aside { position: static; }
  .page-title h1 { font-size: 30px; }
  .hero-title { font-size: 28px; }
}
@media (max-width: 480px) {
  .article-card-read { padding: 20px 16px 24px; }
  .article-title { font-size: 22px; }
  .hero-title { font-size: 26px; }
  .board-nav { grid-template-columns: 1fr; }
}

/* ===== 文章内富文本 / 图文混搭 ===== */
.ab-cover { margin: 0 0 22px; }
.ab-cover img { width: 100%; max-height: 340px; object-fit: cover; border-radius: 12px; display: block; background: var(--primary-light); }
.ab-cover figcaption { font-size: 13px; color: var(--text-muted); margin-top: 8px; text-align: center; }
.ab-fig { margin: 24px 0; }
.ab-fig img { width: 100%; border-radius: 10px; display: block; border: 1px solid var(--border); }
.ab-fig svg { width: 100%; height: auto; display: block; }
.ab-fig figcaption { font-size: 13px; color: var(--text-muted); margin-top: 10px; text-align: center; }
.ab-h { font-size: 19px; line-height: 1.5; margin: 30px 0 10px; color: var(--text); }
.ab-code { background: var(--code-bg); color: var(--code-text); border-radius: 10px; padding: 14px 16px; overflow: auto; font-size: 13px; line-height: 1.6; font-family: ui-monospace, Menlo, Consolas, monospace; margin: 16px 0; }
.ab-code code { white-space: pre; }
.ab-ul, .ab-ol { margin: 14px 0; padding-left: 22px; color: var(--text-secondary); font-size: 15px; line-height: 1.8; }
.ab-ul li, .ab-ol li { margin-bottom: 6px; }
.ab-quote { background: var(--primary-light); border-left: 4px solid var(--primary); border-radius: 0 10px 10px 0; padding: 12px 16px; margin: 18px 0; font-size: 14.5px; color: var(--text-secondary); line-height: 1.7; }

/* 应用文章卡片封面（仅带 cover 的新文章显示，旧卡片不受影响） */
.news-cover { width: calc(100% + 36px); margin: -16px -18px 14px; height: 150px; overflow: hidden; border-radius: 16px 16px 0 0; }
.news-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
