:root {
  --primary: #6c5ce7;
  --primary-2: #8e7cf3;
  --grad: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1c1f2e;
  --text-2: #5a6072;
  --line: #e6e8f0;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(28, 31, 46, .06);
  --shadow-h: 0 10px 28px rgba(102, 126, 234, .18);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  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.7; font-size: 15px;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 18px; }

/* ============ 头部 ============ */
.site-header {
  position: sticky; top: 0; z-index: 100; background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 18px; height: 60px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; color: var(--text); flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand-logo {
  width: 32px; height: 32px; border-radius: 9px; background: var(--grad); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700;
}
.main-nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.main-nav::-webkit-scrollbar { display: none; }
.main-nav a { color: var(--text-2); padding: 6px 11px; border-radius: 8px; font-size: 14px; white-space: nowrap; }
.main-nav a:hover { color: var(--primary); background: #f0efff; text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.search-box { position: relative; }
.search-box input {
  width: 230px; height: 36px; border: 1px solid var(--line); border-radius: 18px;
  padding: 0 16px; font-size: 13px; background: var(--bg); outline: none; transition: .2s;
}
.search-box input:focus { border-color: var(--primary); background: #fff; width: 280px; }
.nav-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; font-size: 18px; padding: 4px 10px; cursor: pointer; }

/* 搜索结果下拉 */
.search-results {
  position: absolute; top: 42px; right: 0; width: 340px; max-height: 420px; overflow-y: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 36px rgba(0,0,0,.14);
  display: none; z-index: 200;
}
.search-results.open { display: block; }
.sr-item { display: block; padding: 10px 14px; border-bottom: 1px solid #f2f3f8; color: var(--text); }
.sr-item:hover { background: #f7f7ff; text-decoration: none; }
.sr-item:last-child { border-bottom: none; }
.sr-cat { font-size: 11px; color: var(--primary); background: #f0efff; border-radius: 4px; padding: 1px 6px; margin-right: 6px; }
.sr-title { font-size: 14px; font-weight: 600; }
.sr-desc { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-empty { padding: 16px; text-align: center; color: var(--text-2); font-size: 13px; }

/* ============ Hero ============ */
.hero { background: var(--grad); color: #fff; padding: 64px 0 56px; text-align: center; }
.hero h1 { font-size: 34px; line-height: 1.35; margin-bottom: 14px; font-weight: 800; }
.hero-sub { font-size: 16px; opacity: .92; max-width: 760px; margin: 0 auto 26px; }
.hero-search { position: relative; max-width: 620px; margin: 0 auto 26px; }
.hero-search input {
  width: 100%; height: 52px; border: none; border-radius: 26px; padding: 0 24px; font-size: 15px;
  box-shadow: 0 8px 30px rgba(0,0,0,.18); outline: none;
}
.hero-search .search-results { left: 0; right: auto; width: 100%; text-align: left; }
.hero-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.stat {
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25); border-radius: 12px;
  padding: 8px 16px; color: #fff; display: flex; flex-direction: column; align-items: center; min-width: 92px;
}
.stat:hover { background: rgba(255,255,255,.24); text-decoration: none; }
.stat b { font-size: 20px; }
.stat span { font-size: 12px; opacity: .85; }

/* ============ 区块 ============ */
.section { margin: 40px 0; }
.section-title { font-size: 22px; margin-bottom: 18px; padding-left: 12px; border-left: 4px solid var(--primary); }

/* 分类卡片 */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(212px, 1fr)); gap: 14px; }
.cat-card {
  background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
  color: var(--text); display: flex; flex-direction: column; gap: 6px; transition: .18s; border: 1px solid transparent;
}
.cat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-h); text-decoration: none; border-color: #d9d4f7; }
.cat-icon { font-size: 28px; }
.cat-card h3 { font-size: 16px; }
.cat-card p { font-size: 12.5px; color: var(--text-2); flex: 1; }
.cat-count { font-size: 12px; color: var(--primary); font-weight: 600; }

/* 咒语卡片 */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(252px, 1fr)); gap: 16px; }
.card {
  background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  color: var(--text); display: flex; flex-direction: column; transition: .18s; border: 1px solid transparent;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-h); text-decoration: none; border-color: #d9d4f7; }
.card-img { aspect-ratio: 1/1; background: #eef0f7; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: .3s; }
.card:hover .card-img img { transform: scale(1.04); }
.card-body { padding: 13px 14px 14px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.card-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: 11px; border-radius: 5px; padding: 1.5px 7px; font-weight: 600; }
.badge-image { background: #fdeef2; color: #d63384; }
.badge-video { background: #eef4ff; color: #3b6fd4; }
.badge-writing { background: #fff4e0; color: #c47b12; }
.badge-coding { background: #e8f8f0; color: #12966b; }
.badge-office { background: #f0eeff; color: #6c5ce7; }
.badge-edu { background: #eaf6fd; color: #1c8ec9; }
.badge-roleplay { background: #fdeefb; color: #b33fc0; }
.badge-business { background: #fdf0e8; color: #d46a2a; }
.badge-life { background: #edf7e8; color: #4e9626; }
.badge-meta { background: #f3f3f5; color: #5a6072; }
.badge-sub { background: #f3f4fa; color: #6a7089; }
.card-title { font-size: 15px; font-weight: 700; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-desc { font-size: 12.5px; color: var(--text-2); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; flex: 1; }
.card-foot { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.tag { font-size: 11px; color: #6a7089; background: #f2f3f8; border-radius: 4px; padding: 1px 7px; }
.copy-hint { margin-left: auto; font-size: 11px; color: var(--primary); font-weight: 600; }

/* 教程卡片 */
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.guide-card {
  background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
  color: var(--text); display: flex; flex-direction: column; gap: 8px; transition: .18s; border: 1px solid transparent;
}
.guide-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-h); text-decoration: none; border-color: #d9d4f7; }
.guide-card h3 { font-size: 16px; line-height: 1.5; }
.guide-card p { font-size: 13px; color: var(--text-2); flex: 1; }
.guide-card span { font-size: 13px; color: var(--primary); font-weight: 600; }

/* ============ 分类页 ============ */
.breadcrumb { font-size: 13px; color: var(--text-2); padding: 18px 0 10px; }
.breadcrumb a { color: var(--text-2); }
.breadcrumb a:hover { color: var(--primary); }
.cat-head { background: var(--card); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 20px; }
.cat-head h1 { font-size: 24px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cat-n { font-size: 13px; color: var(--primary); background: #f0efff; border-radius: 20px; padding: 2px 12px; font-weight: 600; }
.cat-intro { color: var(--text-2); font-size: 14px; margin-top: 8px; }
.subcat-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.subcat-bar a { font-size: 12.5px; color: var(--text-2); background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 3px 12px; }
.subcat-bar a:hover { color: var(--primary); border-color: var(--primary); text-decoration: none; }
.tag-filter { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.tag-btn {
  font-size: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text-2);
  border-radius: 15px; padding: 3px 12px; cursor: pointer; transition: .15s;
}
.tag-btn:hover, .tag-btn.active { color: var(--primary); border-color: var(--primary); background: #f0efff; }
.tag-all { font-weight: 600; }
.empty { text-align: center; color: var(--text-2); padding: 60px 0; }

/* ============ 详情页 ============ */
.detail { background: var(--card); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); margin: 8px 0 40px; }
.detail-head h1 { font-size: 25px; line-height: 1.4; margin-bottom: 12px; }
.detail-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 16px; }
.models { font-size: 12px; color: var(--text-2); }
.detail-img { max-width: 480px; border-radius: 12px; overflow: hidden; margin: 0 auto 18px; border: 1px solid var(--line); }
.detail-img img { width: 100%; }
.detail-desc { color: var(--text-2); font-size: 14.5px; margin-bottom: 18px; }
.prompt-box { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 18px; }
.prompt-box-head {
  display: flex; justify-content: space-between; align-items: center; padding: 10px 16px;
  background: #f8f8fd; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--text-2);
}
.copy-btn {
  background: var(--grad); color: #fff; border: none; border-radius: 8px; padding: 6px 16px;
  font-size: 13px; font-weight: 600; cursor: pointer; transition: .15s;
}
.copy-btn:hover { opacity: .88; }
.copy-btn.copied { background: #12966b; }
.prompt-box pre {
  padding: 18px; font-size: 13.5px; line-height: 1.75; white-space: pre-wrap; word-break: break-word;
  font-family: "SF Mono", Consolas, "Courier New", monospace; max-height: 460px; overflow-y: auto;
  background: #fbfbfe;
}
.detail-tips { background: #fbf9ef; border: 1px solid #f0e6c8; border-radius: 12px; padding: 16px 18px; margin-bottom: 18px; }
.detail-tips h3 { font-size: 15px; margin-bottom: 6px; }
.detail-tips p { font-size: 13.5px; color: #6b6248; }
.vars { margin-top: 8px; }
.vars code { background: #fff; border: 1px solid #e8dfc4; border-radius: 4px; padding: 1px 6px; font-size: 12px; margin-right: 4px; }
.source { font-size: 12.5px; color: var(--text-2); margin-bottom: 24px; }
.related h2 { font-size: 19px; margin-bottom: 16px; padding-left: 10px; border-left: 4px solid var(--primary); }

/* ============ 教程详情 ============ */
.guide-detail { background: var(--card); border-radius: var(--radius); padding: 30px 34px; box-shadow: var(--shadow); margin: 8px 0 40px; }
.guide-detail h1 { font-size: 26px; line-height: 1.4; margin-bottom: 8px; }
.guide-lead { color: var(--text-2); font-size: 14.5px; border-bottom: 1px dashed var(--line); padding-bottom: 14px; margin-bottom: 18px; }
.guide-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; flex-wrap: wrap; }
.btn { background: var(--grad); color: #fff; border-radius: 10px; padding: 9px 20px; font-size: 14px; font-weight: 600; display: inline-block; }
.btn:hover { opacity: .9; text-decoration: none; }

/* ============  prose 富文本 ============ */
.prose h2 { font-size: 20px; margin: 26px 0 12px; padding-left: 10px; border-left: 4px solid var(--primary); }
.prose h3 { font-size: 17px; margin: 20px 0 10px; }
.prose p { margin-bottom: 13px; color: #333748; }
.prose ul, .prose ol { margin: 0 0 14px 22px; }
.prose li { margin-bottom: 7px; color: #333748; }
.prose strong { color: var(--text); }
.prose code { background: #f2f3f8; border-radius: 4px; padding: 1.5px 7px; font-size: 13px; font-family: "SF Mono", Consolas, monospace; color: #b03fc0; }
.prose blockquote { border-left: 4px solid var(--primary-2); background: #f8f8fd; padding: 10px 16px; border-radius: 0 8px 8px 0; margin: 14px 0; color: var(--text-2); }
.static-page { background: var(--card); border-radius: var(--radius); padding: 28px 32px; box-shadow: var(--shadow); margin: 8px 0 40px; }
.static-page h1 { font-size: 24px; margin-bottom: 14px; }

/* ============ 广告位 ============ */
.ad-wrap { margin: 26px 0; text-align: center; min-height: 0; overflow: hidden; }
.feed-ad { grid-column: 1 / -1; }

/* ============ 页脚 ============ */
.site-footer { background: #1c1f2e; color: #b9bdce; margin-top: 50px; padding: 44px 0 26px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1.4fr 1fr; gap: 28px; }
.footer-brand { color: #fff; margin-bottom: 12px; }
.footer-desc { font-size: 12.5px; line-height: 1.8; }
.site-footer h4 { color: #fff; font-size: 14px; margin-bottom: 12px; }
.site-footer a { display: block; color: #b9bdce; font-size: 13px; padding: 3px 0; }
.site-footer a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid #2e3346; margin-top: 26px; padding-top: 18px; font-size: 12px; color: #7d8296; }
.footer-note { margin-top: 5px; }

/* ============ 响应式 ============ */
@media (max-width: 960px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .hero { padding: 44px 0 40px; }
  .hero h1 { font-size: 25px; }
  .main-nav {
    display: none; position: absolute; top: 60px; left: 0; right: 0; background: #fff;
    border-bottom: 1px solid var(--line); flex-direction: column; padding: 10px 18px; gap: 2px;
  }
  .main-nav.open { display: flex; }
  .nav-toggle { display: block; }
  .search-box input { width: 150px; }
  .search-box input:focus { width: 190px; }
  .search-results { width: 86vw; right: auto; left: 0; }
  .detail, .guide-detail, .static-page { padding: 20px 16px; }
  .guide-detail h1 { font-size: 22px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .card-title { font-size: 13.5px; }
  .card-desc { font-size: 12px; }
  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
}
