/* ===========================================================
   全球 AI 工具免费公益站 · 设计系统
   =========================================================== */
:root {
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --brand-3: #06b6d4;
  --brand-soft: #eef2ff;
  --ink: #0f172a;
  --ink-2: #475569;
  --ink-3: #94a3b8;
  --bg: #fbfbfd;
  --surface: #ffffff;
  --line: #e8eaf0;
  --line-2: #f1f3f7;
  --ok: #059669;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, .05), 0 10px 24px -6px rgba(15, 23, 42, .08);
  --shadow-lg: 0 20px 48px -12px rgba(79, 70, 229, .18);
  --maxw: 1200px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
               'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select { font: inherit; color: inherit; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------------- 顶部导航 ---------------- */
.nav {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav-in { display: flex; align-items: center; gap: 28px; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -.2px; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-size: 16px; box-shadow: 0 4px 12px rgba(79, 70, 229, .32);
}
.logo small { display: block; font-size: 10px; font-weight: 600; color: var(--ink-3); letter-spacing: .8px; }
.nav-links { display: flex; gap: 4px; margin-left: 8px; flex: 1; }
.nav-links a {
  padding: 8px 14px; border-radius: 9px; font-size: 14.5px; font-weight: 500;
  color: var(--ink-2); transition: .18s;
}
.nav-links a:hover { background: var(--line-2); color: var(--ink); }
.nav-links a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-right { display: flex; align-items: center; gap: 10px; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-size: 13px; font-weight: 700; cursor: pointer;
}
.burger { display: none; background: none; border: 0; font-size: 22px; cursor: pointer; padding: 4px 8px; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 20px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14.5px; font-weight: 600; cursor: pointer; transition: .18s; white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, .28);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(79, 70, 229, .36); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.btn-lg { padding: 14px 30px; font-size: 15.5px; border-radius: 12px; }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }
.btn-block { width: 100%; }

/* ---------------- Hero ---------------- */
.hero { position: relative; padding: 76px 0 60px; overflow: hidden; }
.hero::before {
  content: ''; position: absolute; inset: -220px 0 auto; height: 560px; z-index: -1;
  background:
    radial-gradient(650px 320px at 18% 28%, rgba(124, 58, 237, .13), transparent 62%),
    radial-gradient(700px 340px at 82% 12%, rgba(6, 182, 212, .13), transparent 62%),
    radial-gradient(500px 260px at 50% 60%, rgba(79, 70, 229, .10), transparent 65%);
}
.badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  font-size: 13px; color: var(--ink-2); box-shadow: var(--shadow-sm); margin-bottom: 22px;
}
.badge b { color: var(--brand); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(5, 150, 105, .16); }
.hero h1 {
  font-size: clamp(30px, 5vw, 50px); line-height: 1.2; font-weight: 800;
  letter-spacing: -1px; max-width: 800px;
}
.grad {
  background: linear-gradient(120deg, var(--brand), var(--brand-2) 45%, var(--brand-3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { margin-top: 18px; font-size: 17px; color: var(--ink-2); max-width: 640px; }
.hero-actions { display: flex; gap: 12px; margin-top: 30px; flex-wrap: wrap; }

/* ---------------- 统计条 ---------------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 52px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow-sm); transition: .2s;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat b { display: block; font-size: 30px; font-weight: 800; letter-spacing: -1px; line-height: 1.2; }
.stat span { font-size: 13px; color: var(--ink-3); }

/* ---------------- 区块标题 ---------------- */
section { padding: 56px 0; }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.sec-head h2 { font-size: 27px; font-weight: 800; letter-spacing: -.6px; }
.sec-head p { color: var(--ink-3); font-size: 14.5px; margin-top: 6px; }
.link-more { color: var(--brand); font-weight: 600; font-size: 14px; }
.link-more:hover { text-decoration: underline; }

/* ---------------- 分类卡 ---------------- */
.cats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.cat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; transition: .22s; position: relative; overflow: hidden;
}
.cat::after {
  content: ''; position: absolute; inset: auto -30% -60% auto; width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(79, 70, 229, .10), transparent 70%);
  opacity: 0; transition: .3s;
}
.cat:hover { transform: translateY(-3px); border-color: #d9dcf5; box-shadow: var(--shadow); }
.cat:hover::after { opacity: 1; }
.cat-icon {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  font-size: 22px; background: var(--brand-soft); margin-bottom: 14px;
}
.cat h3 { font-size: 16px; font-weight: 700; }
.cat p { font-size: 13px; color: var(--ink-3); margin-top: 6px; min-height: 38px; }
.cat .count { font-size: 12.5px; color: var(--brand); font-weight: 600; }

/* ---------------- 工具卡 ---------------- */
.tools-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.tool {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; display: flex; flex-direction: column; transition: .22s; position: relative;
}
.tool:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: #dcdff2; }
.tool-top { display: flex; align-items: flex-start; gap: 13px; }
.tool-icon {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  font-size: 23px; background: linear-gradient(135deg, #f5f6ff, #eef2ff);
  border: 1px solid #e7e9fb; flex-shrink: 0;
}
.tool h3 { font-size: 16.5px; font-weight: 700; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.tool .tagline { font-size: 13.5px; color: var(--ink-2); margin-top: 4px; }
.tool .desc {
  font-size: 13.5px; color: var(--ink-3); margin-top: 12px; flex: 1; line-height: 1.7;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.tool-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tool-foot {
  display: flex; align-items: center; gap: 8px; margin-top: 16px;
  padding-top: 15px; border-top: 1px solid var(--line-2);
}
.tool-foot .btn { flex: 1; }

.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 6px;
  font-size: 11.5px; font-weight: 600; background: var(--line-2); color: var(--ink-2);
}
.chip-free { background: #ecfdf5; color: var(--ok); }
.chip-hot { background: #fff1f2; color: #e11d48; }
.chip-os { background: var(--brand-soft); color: var(--brand); }
.chip-off { background: #fffbeb; color: var(--warn); }

.fav-btn {
  width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; display: grid; place-items: center;
  font-size: 15px; transition: .18s; flex-shrink: 0;
}
.fav-btn:hover { border-color: #fda4af; background: #fff1f2; }
.fav-btn.on { border-color: #fb7185; background: #fff1f2; }

/* ---------------- 筛选器 ---------------- */
.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; margin-bottom: 26px; box-shadow: var(--shadow-sm);
}
.search {
  flex: 1; min-width: 220px; display: flex; align-items: center; gap: 9px;
  background: var(--line-2); border-radius: 9px; padding: 8px 13px;
  border: 1px solid transparent; transition: .18s;
}
.search:focus-within { background: var(--surface); border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79, 70, 229, .1); }
.search input { flex: 1; border: 0; background: none; outline: none; font-size: 14.5px; }
.pill {
  padding: 7px 15px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font-size: 13.5px; font-weight: 500; color: var(--ink-2); cursor: pointer; transition: .18s;
}
.pill:hover { border-color: var(--brand); color: var(--brand); }
.pill.on { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }

/* ---------------- 资讯 ---------------- */
.news-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.news {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; display: flex; flex-direction: column; transition: .2s;
}
.news:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #dcdff2; }
.news-src { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); }
.news-src b { color: var(--brand); font-weight: 600; }
.news h3 {
  font-size: 16px; font-weight: 700; margin: 10px 0 8px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.news p {
  font-size: 13.5px; color: var(--ink-3); flex: 1; line-height: 1.7;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.news-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--ink-3);
}
.news-list .news { flex-direction: row; align-items: flex-start; gap: 18px; }

/* ---------------- 表单 / 卡片 ---------------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow-sm);
}
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 7px; }
.field input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); outline: none; transition: .18s; font-size: 15px;
}
.field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79, 70, 229, .1); }
.field .hint { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }
.code-input { letter-spacing: 8px; font-size: 20px !important; font-weight: 700; text-align: center; }

.alert { padding: 12px 15px; border-radius: 10px; font-size: 13.5px; margin-bottom: 16px; line-height: 1.6; }
.alert-info { background: var(--brand-soft); color: #4338ca; }
.alert-ok { background: #ecfdf5; color: var(--ok); }
.alert-err { background: #fef2f2; color: var(--danger); }
.alert-warn { background: #fffbeb; color: var(--warn); }

/* ---------------- 页脚 ---------------- */
footer { border-top: 1px solid var(--line); background: var(--surface); padding: 46px 0 30px; margin-top: 40px; }
.foot-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 34px; }
.foot-grid h4 { font-size: 13.5px; font-weight: 700; margin-bottom: 13px; }
.foot-grid a, .foot-grid p { display: block; font-size: 13.5px; color: var(--ink-3); margin-bottom: 9px; }
.foot-grid a:hover { color: var(--brand); }
.foot-bottom {
  margin-top: 32px; padding-top: 22px; border-top: 1px solid var(--line-2);
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--ink-3);
}

/* ---------------- 杂项 ---------------- */
.empty { text-align: center; padding: 70px 20px; color: var(--ink-3); }
.empty .ico { font-size: 46px; margin-bottom: 14px; }

.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 26px);
  background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 11px;
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg); z-index: 200;
  opacity: 0; pointer-events: none; transition: .28s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.skeleton {
  background: linear-gradient(90deg, #f1f3f7 25%, #e8eaf0 50%, #f1f3f7 75%);
  background-size: 200% 100%; animation: sk 1.3s infinite; border-radius: var(--radius); height: 200px;
}
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.notice-bar {
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  color: #fff; font-size: 13px; text-align: center; padding: 8px 16px;
}
.notice-bar a { text-decoration: underline; font-weight: 600; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1000px) {
  .cats, .stats { grid-template-columns: repeat(2, 1fr); }
  .tools-grid, .news-grid { grid-template-columns: repeat(2, 1fr); }
  .foot-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .nav-links {
    position: absolute; top: 64px; left: 0; right: 0; flex-direction: column;
    background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px 16px; gap: 2px;
    display: none; box-shadow: var(--shadow);
  }
  .nav-links.open { display: flex; }
  .burger { display: block; }
  .hero { padding: 46px 0 34px; }
  .cats, .stats, .tools-grid, .news-grid { grid-template-columns: 1fr; }
  .news-list .news { flex-direction: column; gap: 10px; }
  section { padding: 38px 0; }
}
