/* ===== 全局 ===== */
:root {
  --primary: #4f6ef7;
  --primary-dark: #3b57d9;
  --bg: #f5f7fb;
  --card-bg: #ffffff;
  --text: #1f2329;
  --text-2: #646a73;
  --text-3: #8f959e;
  --border: #e8eaf0;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(31, 35, 41, 0.05);
  --shadow-hover: 0 8px 24px rgba(31, 35, 41, 0.12);
}

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

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { text-decoration: none; color: inherit; }

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

/* ===== 顶部导航 ===== */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; gap: 32px;
  height: 60px;
}
.logo {
  font-size: 20px; font-weight: 700;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
}
.nav { display: flex; gap: 24px; flex: 1; }
.nav a { font-size: 14px; color: var(--text-2); transition: color 0.2s; }
.nav a:hover { color: var(--primary); }

/* ===== Hero ===== */
.hero {
  background: linear-gradient(135deg, #4f6ef7 0%, #7c5cf0 50%, #a855f7 100%);
  padding: 64px 0 72px;
  text-align: center;
  color: #fff;
}
.hero h1 { font-size: 34px; margin-bottom: 12px; letter-spacing: 1px; }
.hero p { font-size: 16px; opacity: 0.9; margin-bottom: 32px; }

.search-box {
  display: flex; max-width: 560px; margin: 0 auto;
  background: #fff; border-radius: 999px; padding: 6px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
}
.search-box input {
  flex: 1; border: none; outline: none;
  padding: 10px 20px; font-size: 15px; border-radius: 999px;
}
.search-box button {
  border: none; cursor: pointer;
  background: var(--primary); color: #fff;
  padding: 10px 28px; font-size: 15px;
  border-radius: 999px; transition: background 0.2s;
}
.search-box button:hover { background: var(--primary-dark); }

/* ===== 搜索结果 ===== */
.search-results {
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 24px 0;
}
.search-results-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.search-results-head h2 { font-size: 18px; }
.search-close {
  border: 1px solid var(--border); background: #fff; cursor: pointer;
  padding: 4px 14px; border-radius: 999px; font-size: 13px; color: var(--text-2);
}
.no-result { color: var(--text-3); padding: 20px 0; text-align: center; }

/* ===== 通用区块 ===== */
.section { padding: 40px 0 8px; }
.section-head {
  display: flex; align-items: baseline; gap: 12px;
  margin-bottom: 20px;
}
.section-head h2 { font-size: 22px; }
.section-head .count { color: var(--text-3); font-size: 14px; }

/* ===== 精选推荐 ===== */
.featured-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(4, 1fr);
}
.featured-card {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid var(--border);
}
.featured-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.featured-tag {
  display: inline-block; font-size: 12px; color: var(--primary);
  background: #eef2ff; padding: 2px 10px; border-radius: 999px;
  margin-bottom: 10px;
}
.featured-card h3 { font-size: 15px; margin-bottom: 6px; line-height: 1.4; }
.featured-card p { font-size: 13px; color: var(--text-2); }

/* ===== 工具大全 ===== */
.tool-tabs {
  display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px;
}
.tab {
  border: 1px solid var(--border); background: #fff;
  padding: 6px 16px; border-radius: 999px;
  font-size: 14px; color: var(--text-2); cursor: pointer;
  transition: all 0.2s;
}
.tab:hover { border-color: var(--primary); color: var(--primary); }
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.tool-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(4, 1fr);
}
.tool-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.tool-avatar {
  flex-shrink: 0; width: 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px; font-weight: 700;
}
.tool-info { display: flex; flex-direction: column; min-width: 0; }
.tool-name { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.tool-category {
  font-size: 11px; font-weight: 400; color: var(--primary);
  background: #eef2ff; padding: 1px 8px; border-radius: 999px;
}
.tool-desc {
  font-size: 12px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ===== 社区 + 资讯 双栏 ===== */
.two-col {
  display: grid; gap: 20px;
  grid-template-columns: 1.5fr 1fr;
  align-items: start;
}
.post-list { display: flex; flex-direction: column; gap: 14px; }
.post-item {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow); transition: box-shadow 0.2s;
  display: block;
}
.post-item:hover { box-shadow: var(--shadow-hover); }
.post-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.post-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 600;
}
.post-author { font-size: 13px; color: var(--text-2); }
.post-time { font-size: 12px; color: var(--text-3); }
.post-title { font-size: 15px; line-height: 1.5; margin-bottom: 6px; }
.post-item:hover .post-title { color: var(--primary); }
.post-excerpt {
  font-size: 13px; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-likes { font-size: 12px; color: var(--text-3); margin-top: 8px; display: inline-block; }

.news-panel {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 18px;
  box-shadow: var(--shadow);
}
.news-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--border);
}
.news-item:last-child { border-bottom: none; }
.news-rank {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.rank-top { background: #fee2e2; color: #ef4444; }
.rank-normal { background: #f2f3f5; color: var(--text-3); }
.news-title {
  font-size: 14px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.news-item:hover .news-title { color: var(--primary); }

/* ===== 提示词 ===== */
.prompt-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(3, 1fr);
}
.prompt-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
}
.prompt-head { display: flex; align-items: center; gap: 10px; }
.prompt-head h3 { font-size: 15px; }
.prompt-type {
  flex-shrink: 0; font-size: 12px; padding: 2px 10px; border-radius: 999px;
}
.type-image { background: #fef3c7; color: #d97706; }
.type-text { background: #dcfce7; color: #16a34a; }
.prompt-text {
  font-size: 13px; color: var(--text-2); flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.prompt-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.prompt-tags em {
  font-style: normal; font-size: 12px; color: var(--primary); margin-right: 8px;
}
.copy-btn {
  flex-shrink: 0; border: 1px solid var(--primary); color: var(--primary);
  background: #fff; border-radius: 999px; padding: 3px 14px;
  font-size: 12px; cursor: pointer; transition: all 0.2s;
}
.copy-btn:hover { background: var(--primary); color: #fff; }

/* ===== 教程 ===== */
.tutorial-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(3, 1fr);
}
.tutorial-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.tutorial-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.tutorial-source {
  display: inline-block; font-size: 12px; color: #0ea5e9;
  background: #e0f2fe; padding: 2px 10px; border-radius: 999px;
  margin-bottom: 10px;
}
.tutorial-card h3 { font-size: 15px; margin-bottom: 6px; line-height: 1.5; }
.tutorial-card p {
  font-size: 13px; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===== 页脚 ===== */
.footer {
  margin-top: 56px; padding: 32px 0;
  border-top: 1px solid var(--border);
  text-align: center; color: var(--text-3); font-size: 13px;
}
.footer-name { font-weight: 600; color: var(--text-2); }

/* ===== 错误提示 ===== */
.app-error {
  max-width: 600px; margin: 60px auto; padding: 24px;
  background: #fef2f2; border: 1px solid #fecaca; border-radius: var(--radius);
  color: #b91c1c; text-align: center;
}

/* ===== 响应式 ===== */
@media (max-width: 992px) {
  .featured-grid, .tool-grid { grid-template-columns: repeat(2, 1fr); }
  .prompt-grid, .tutorial-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .nav { display: none; }
  .hero h1 { font-size: 24px; }
  .featured-grid, .tool-grid, .prompt-grid, .tutorial-grid { grid-template-columns: 1fr; }
}
