:root {
  --accent: #7c3aed;
  --accent-soft: rgba(124, 58, 237, 0.12);
  --bg: #faf9ff;
  --card: #ffffff;
  --ink: #1f1b2e;
  --ink-soft: #6b6478;
  --line: #ece9f5;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(31, 27, 46, 0.08);
  --font: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 22px; }

/* ---------- 导航栏 ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250, 249, 255, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand { font-weight: 800; font-size: 20px; letter-spacing: 0.5px; display: flex; align-items: center; gap: 6px; }
.brand-icon { font-size: 1.25em; line-height: 1; display: inline-flex; }
.brand-icon img { width: 22px; height: 22px; border-radius: 6px; object-fit: cover; display: block; }
.brand-dot { color: var(--accent); }
.nav-links { display: flex; gap: 26px; }
.nav-links a { font-size: 15px; color: var(--ink-soft); font-weight: 500; transition: color .2s; }
.nav-links a:hover { color: var(--accent); }
.nav-links a.active { color: var(--accent); }
.nav-right { display: flex; align-items: center; gap: 16px; }
.auth-btn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 6px 16px; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: all .2s; white-space: nowrap;
}
.auth-btn:hover { border-color: var(--accent); color: var(--accent); }
.auth-btn.logged { color: var(--accent); border-color: var(--accent); }

/* ---------- 登录/注册弹窗 ---------- */
.hidden { display: none !important; }
.auth-overlay {
  position: fixed; inset: 0; background: rgba(20,16,32,.5); display: grid;
  place-items: center; padding: 20px; z-index: 100;
}
.auth-card {
  background: var(--card); border-radius: 18px; width: 100%; max-width: 380px;
  padding: 26px 28px; box-shadow: 0 20px 50px rgba(31,27,46,.18);
}
.auth-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.auth-head h3 { font-size: 20px; }
.auth-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--ink-soft); }
.auth-tabs { display: flex; background: var(--bg); border-radius: 10px; padding: 4px; margin-bottom: 18px; }
.auth-tab {
  flex: 1; border: none; background: transparent; padding: 8px; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer; color: var(--ink-soft); font-family: inherit;
}
.auth-tab.active { background: var(--card); color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.auth-form input { font-weight: 400; }
.auth-error { color: var(--danger); font-size: 13px; min-height: 18px; }

/* ---------- 评论区 ---------- */
.comments { max-width: 760px; margin: -30px auto 80px; padding: 0 0 40px; }
.comments-title { font-size: 22px; font-weight: 800; margin-bottom: 20px; }
.comment-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 26px; }
.emoji-bar { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-btn {
  border: 1px solid var(--line); background: var(--card); border-radius: 10px;
  padding: 4px 9px; font-size: 18px; cursor: pointer; line-height: 1; transition: all .15s;
}
.emoji-btn:hover { border-color: var(--accent); transform: scale(1.12); }
.comment-form textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  font-size: 15px; font-family: inherit; background: var(--card); color: var(--ink); resize: vertical;
}
.comment-form textarea:focus { outline: none; border-color: var(--accent); }
.comment-form button { align-self: flex-end; }
.comment-login {
  background: var(--card); border: 1px dashed var(--line); border-radius: 12px;
  padding: 18px; text-align: center; margin-bottom: 26px; color: var(--ink-soft);
}
.comment-login a { color: var(--accent); font-weight: 600; }
.comment-list { display: flex; flex-direction: column; gap: 14px; }
.comment-item {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 18px;
}
.comment-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.comment-author { font-weight: 700; color: var(--accent); }
.comment-time { font-size: 12px; color: var(--ink-soft); }
.comment-body { font-size: 15px; color: #3a3448; white-space: pre-wrap; word-break: break-word; }
.comment-empty { text-align: center; color: var(--ink-soft); padding: 30px 0; }

/* ---------- 文章锁定页 ---------- */
.post-lock {
  max-width: 480px; margin: 60px auto 80px; text-align: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 48px 34px; box-shadow: var(--shadow);
}
.post-lock .lock-icon { font-size: 52px; margin-bottom: 14px; }
.post-lock h2 { font-size: 24px; margin-bottom: 10px; }
.post-lock p { color: var(--ink-soft); margin-bottom: 24px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: #1f1b2e; color: #fff; padding: 11px 22px; border-radius: 999px;
  font-size: 14px; z-index: 200; box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.toast.ok { background: #0f9d6e; }
.toast.err { background: var(--danger); }

/* ---------- Hero ---------- */
.hero { padding: 88px 0 56px; text-align: center; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(600px 300px at 20% 20%, var(--accent-soft), transparent 60%),
    radial-gradient(500px 260px at 80% 10%, rgba(16, 185, 129, 0.10), transparent 60%);
}
.hero h1 { font-size: clamp(32px, 6vw, 56px); font-weight: 800; line-height: 1.2; letter-spacing: -1px; }
.hero h1 .hi { background: linear-gradient(120deg, var(--accent), #16b981); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .tagline { margin-top: 18px; font-size: 18px; color: var(--ink-soft); }
.hero .hero-text { margin: 18px auto 0; max-width: 560px; color: var(--ink-soft); }

/* ---------- 区块标题 ---------- */
.section { padding: 24px 0 64px; }
.section-title { font-size: 28px; font-weight: 800; margin-bottom: 6px; }
.section-sub { color: var(--ink-soft); margin-bottom: 28px; }

/* ---------- 文章卡片 ---------- */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.post-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: transform .25s, box-shadow .25s;
  display: flex; flex-direction: column;
  cursor: pointer;
}
.post-card:hover { transform: translateY(-5px); box-shadow: 0 18px 40px rgba(31,27,46,.14); }
.post-cover { aspect-ratio: 16/9; background: var(--accent-soft); position: relative; overflow: hidden; }
.post-cover img { width: 100%; height: 100%; object-fit: cover; }
.post-cover .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--accent); font-size: 40px; font-weight: 800; }
.post-body { padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.post-meta { font-size: 13px; color: var(--ink-soft); display: flex; gap: 12px; flex-wrap: wrap; }
.post-title { font-size: 20px; font-weight: 800; line-height: 1.35; }
.post-excerpt { font-size: 14px; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tag { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* ---------- 关于 ---------- */
.about-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 34px 36px; box-shadow: var(--shadow);
}
.about-card h2 { font-size: 26px; font-weight: 800; margin-bottom: 14px; }
.about-card p { color: var(--ink-soft); white-space: pre-line; }

/* ---------- 文章详情 ---------- */
.article { max-width: 760px; margin: 0 auto; padding: 44px 0 80px; }
.article .crumb { color: var(--ink-soft); font-size: 14px; margin-bottom: 18px; }
.article .crumb a:hover { color: var(--accent); }
.article h1 { font-size: clamp(28px, 5vw, 40px); font-weight: 800; line-height: 1.25; margin-bottom: 14px; }
.article .art-meta { display: flex; gap: 14px; color: var(--ink-soft); font-size: 14px; margin-bottom: 26px; flex-wrap: wrap; }
.article .cover { border-radius: var(--radius); margin-bottom: 30px; box-shadow: var(--shadow); }
.article-content { font-size: 17px; }
.article-content h1, .article-content h2, .article-content h3 { margin: 1.6em 0 .6em; font-weight: 800; line-height: 1.3; }
.article-content h2 { font-size: 26px; }
.article-content h3 { font-size: 21px; }
.article-content p { margin-bottom: 1.2em; color: #3a3448; }
.article-content ul, .article-content ol { margin: 0 0 1.2em 1.4em; }
.article-content li { margin-bottom: .4em; }
.article-content strong { color: var(--accent); }
.article-content blockquote {
  border-left: 4px solid var(--accent); padding: 12px 18px; margin: 1.4em 0;
  background: var(--accent-soft); border-radius: 0 12px 12px 0; color: var(--ink-soft);
}
.article-content code { background: var(--accent-soft); color: var(--accent); padding: 2px 6px; border-radius: 6px; font-size: .9em; }
.article-content pre { background: #1f1b2e; color: #e8e6f4; padding: 18px; border-radius: 12px; overflow-x: auto; margin: 1.4em 0; }
.article-content pre code { background: none; color: inherit; padding: 0; }
.article-content img { border-radius: 12px; margin: 1.4em auto; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; color: var(--ink-soft); padding: 60px 0; }
.empty .big { font-size: 46px; margin-bottom: 12px; }

/* ---------- 页脚 ---------- */
.footer { border-top: 1px solid var(--line); padding: 30px 0; margin-top: 40px; text-align: center; color: var(--ink-soft); font-size: 14px; }

/* ---------- 加载中 ---------- */
.loading { text-align: center; padding: 60px 0; color: var(--ink-soft); }

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .hero { padding: 60px 0 40px; }
  .nav-links { gap: 16px; }
  .about-card { padding: 24px; }
}