:root {
  --bg: #141311;
  --bg-card: #1c1a17;
  --bg-hover: #25221d;
  --border: #2a2722;
  --text: #ddd6cb;
  --text-dim: #968f84;
  --accent: #e8a850;
  --accent-soft: rgba(232,168,80,0.15);
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans SC', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', 'Cascadia Code', monospace;
}

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

html { scroll-behavior:smooth; -webkit-tap-highlight-color:transparent; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height:1.7;
  min-height:100vh;
  overflow-x:hidden;
  -webkit-font-smoothing:antialiased;
}

.container { max-width:1080px; margin:0 auto; padding:0 22px; position:relative; z-index:1; }

/* 头部 - 去掉毛玻璃，就简单实色 */
.header {
  position:sticky; top:0; z-index:100;
  background: rgba(20,19,17,0.92);
  border-bottom:1px solid var(--border);
}

.header-inner {
  display:flex; align-items:center; justify-content:space-between;
  height:56px;
}

.logo {
  font-size:18px; font-weight:650; color:var(--accent);
  text-decoration:none; letter-spacing:-0.3px;
  transition:color .2s;
}
.logo:hover { color:#f5c070; }

.nav { display:flex; align-items:center; gap:2px; }

.nav-link {
  padding:6px 14px; border-radius:6px; font-size:14px; font-weight:500;
  color:var(--text-dim); text-decoration:none;
  transition:color .2s, background .2s;
}
.nav-link:hover { color:var(--text); background:var(--bg-hover); }

.search-btn {
  background:none; border:none; color:var(--text-dim); cursor:pointer;
  padding:7px; border-radius:6px; display:flex; align-items:center;
  transition:color .2s, background .2s; margin-left:2px;
}
.search-btn:hover { color:var(--text); background:var(--bg-hover); }

/* 搜索覆盖层 */
.search-overlay {
  position:fixed; top:0; left:0; right:0; bottom:0;
  background:rgba(0,0,0,.75);
  display:flex; align-items:flex-start; justify-content:center;
  padding-top:120px;
  z-index:200;
  opacity:0; pointer-events:none;
  transition:opacity .25s;
}
.search-overlay.open { opacity:1; pointer-events:auto; }

.search-box {
  width:500px; max-width:90vw;
  background:var(--bg-card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:0 16px 48px rgba(0,0,0,.55);
  overflow:hidden;
}

.search-box input {
  width:100%; padding:14px 18px;
  background:transparent; border:none; outline:none;
  color:var(--text); font-size:15px; font-family:inherit;
}
.search-box input::placeholder { color:var(--text-dim); }

.search-results { max-height:380px; overflow-y:auto; }
.search-results a {
  display:block; padding:12px 18px; color:var(--text); text-decoration:none;
  border-top:1px solid var(--border); font-size:14px;
  transition:background .15s;
}
.search-results a:hover { background:var(--bg-hover); }
.search-results .result-meta { font-size:12px; color:var(--text-dim); margin-top:2px; }

/* 主内容 */
.main-content { padding:40px 0 80px; min-height:70vh; }

/* Hero */
.hero { text-align:center; padding:56px 0 36px; }
.hero-title { font-size:38px; font-weight:700; margin-bottom:10px; letter-spacing:-0.5px; color:var(--text); }
.hero-sub { color:var(--text-dim); font-size:15px; font-weight:400; }

/* 分类筛选 */
.category-filter { display:flex; flex-wrap:wrap; gap:7px; margin-bottom:28px; }
.cat-tag {
  padding:5px 16px; border-radius:20px; border:1px solid var(--border);
  font-size:13px; cursor:pointer; background:transparent; color:var(--text-dim);
  transition:border-color .2s, color .2s, background .2s;
  user-select:none;
}
.cat-tag:hover { border-color:var(--accent); color:var(--accent); }
.cat-tag.active { background:var(--accent); border-color:var(--accent); color:#1a1510; font-weight:600; }

/* 文章网格 */
.post-grid {
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(320px, 1fr));
  gap:18px;
}

.post-card {
  background:var(--bg-card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:22px;
  cursor:pointer;
  transition:border-color .25s, background .25s;
  text-decoration:none; color:inherit; display:block;
  position:relative;
}
.post-card:hover { border-color:var(--accent); background:#1f1c17; }
.post-card:active { transform:scale(.985); }

.post-card .card-cat {
  display:inline-block; padding:3px 11px; border-radius:12px;
  font-size:11px; font-weight:600; letter-spacing:.3px;
  background:var(--accent-soft); color:var(--accent);
  margin-bottom:12px;
}
.post-card .card-title { font-size:17px; font-weight:650; margin-bottom:6px; line-height:1.4; }
.post-card .card-date { font-size:12px; color:var(--text-dim); }

/* 分页 */
.pagination { display:flex; justify-content:center; gap:7px; margin-top:36px; }
.pagination button {
  padding:9px 16px; border-radius:7px; border:1px solid var(--border);
  background:transparent; color:var(--text); cursor:pointer; font-size:13px;
  transition:border-color .2s, color .2s, background .2s; font-family:inherit;
}
.pagination button:hover { border-color:var(--accent); color:var(--accent); }
.pagination button.active { background:var(--accent); border-color:var(--accent); color:#1a1510; }
.pagination button:disabled { opacity:.35; cursor:default; }

/* 文章详情 */
.post-detail { max-width:740px; margin:0 auto; }
.post-detail h1 { font-size:30px; font-weight:700; margin-bottom:6px; line-height:1.3; }
.post-detail .post-meta { color:var(--text-dim); font-size:13px; margin-bottom:30px; }
.post-detail .post-body { font-size:16px; line-height:1.85; }
.post-detail .post-body h2 { margin:32px 0 14px; font-size:22px; }
.post-detail .post-body h3 { margin:26px 0 10px; font-size:18px; }
.post-detail .post-body p { margin-bottom:14px; }
.post-detail .post-body ul,.post-detail .post-body ol { margin:12px 0 14px 24px; }
.post-detail .post-body li { margin-bottom:5px; }
.post-detail .post-body pre {
  background: #151310; border:1px solid var(--border); border-radius:8px; padding:15px 18px;
  overflow-x:auto; font-size:13px; margin:16px 0; line-height:1.6;
}
.post-detail .post-body code {
  font-family:var(--font-mono); font-size:13px;
  background:rgba(255,255,255,0.04); padding:2px 6px; border-radius:4px;
}
.post-detail .post-body pre code { background:none; padding:0; border-radius:0; }
.post-body a { color:var(--accent); text-decoration:none; border-bottom:1px solid rgba(232,168,80,0.3); }
.post-body a:hover { border-bottom-color:var(--accent); }
.post-body strong { color:#f0e4ce; }
.post-body img { max-width:100%; border-radius:8px; margin:12px 0; }
.post-body blockquote {
  border-left:3px solid var(--accent); padding:8px 16px; margin:16px 0;
  color:var(--text-dim); background:var(--bg-card); border-radius:0 8px 8px 0;
}
.post-body hr { border:none; border-top:1px solid var(--border); margin:24px 0; }

.page-title { font-size:26px; font-weight:700; margin-bottom:22px; }

/* 资源网格 */
.resource-grid {
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(290px, 1fr));
  gap:14px;
}
.resource-card {
  background:var(--bg-card); border:1px solid var(--border);
  border-radius:var(--radius); padding:18px;
  transition:border-color .2s, background .2s;
  text-decoration:none; color:inherit; display:block;
}
.resource-card:hover { border-color:var(--accent); background:#1f1c17; }
.resource-card .res-type {
  font-size:11px; letter-spacing:.5px; color:var(--accent); font-weight:600; margin-bottom:8px;
  text-transform:uppercase;
}
.resource-card .res-title { font-weight:650; font-size:15px; margin-bottom:4px; }
.resource-card .res-desc { font-size:13px; color:var(--text-dim); line-height:1.5; }

/* 404 */
.not-found { text-align:center; padding:80px 0; }
.not-found h1 { font-size:90px; font-weight:800; color:var(--accent); line-height:1; }
.not-found p { color:var(--text-dim); margin:12px 0 20px; }
.not-found a { color:var(--accent); text-decoration:none; font-weight:500; }

/* 页脚 */
.footer {
  border-top:1px solid var(--border); padding:22px 0;
  text-align:center; color:var(--text-dim); font-size:13px;
}

/* 骨架屏 */
.skeleton {
  background:var(--bg-card);
  border-radius:var(--radius);
  animation:skeleton-pulse 1.5s ease-in-out infinite;
}
@keyframes skeleton-pulse { 0%,100% { opacity:0.5; } 50% { opacity:0.8; } }

/* 响应式 */
@media (max-width:768px) {
  .hero { padding:36px 0 20px; }
  .hero-title { font-size:26px; }
  .post-grid { grid-template-columns:1fr; }
  .resource-grid { grid-template-columns:1fr; }
  .header-inner { height:50px; }
  .logo { font-size:16px; }
  .nav-link { font-size:13px; padding:5px 10px; }
  .post-detail h1 { font-size:24px; }
  .not-found h1 { font-size:64px; }
}

/* ===== AI 全页面 QQ/微信风格布局 ===== */
/* AI页面隐藏header和footer */
body.ai-page-body {
  overflow: hidden;
}
body.ai-page-body .header,
body.ai-page-body .footer {
  display: none;
}
body.ai-page-body .main-content {
  padding: 0;
  margin: 0;
  max-width: none;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
body.ai-page-body .container {
  max-width: none;
  padding: 0;
}

.ai-fullpage {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* 顶部栏 */
.ai-top-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.ai-bar-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
}
.ai-bar-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.ai-bar-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.ai-bar-status {
  font-size: 11px;
  color: #4ade80;
}

/* 聊天区域 */
.ai-chat-area {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 消息滚动区 - 唯一可滚动 */
.ai-messages-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px;
}

.ai-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 输入栏 */
.ai-input-bar {
  flex-shrink: 0;
  padding: 10px 12px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.ai-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.ai-input-row input {
  flex: 1;
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.ai-input-row input:focus { border-color: var(--accent); }
.ai-input-row input::placeholder { color: var(--text-dim); }

.ai-send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #1a1510;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: filter .2s;
}
.ai-send-btn:hover { filter: brightness(1.1); }

.ai-not-configured {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
  font-size: 15px;
  background: var(--bg);
  z-index: 100;
}

/* 气泡消息 */
.ai-msg {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.ai-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.ai-msg-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 16px;
  line-height: 1.5;
  word-wrap: break-word;
  font-size: 14px;
}
.ai-msg-bubble a {
  color: #f0c060;
  text-decoration: underline;
}
.ai-msg-bubble a:hover { color: #e8a850; }

.ai-msg.bot .ai-msg-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  color: var(--text);
}

.ai-msg.user {
  flex-direction: row-reverse;
}
.ai-msg.user .ai-msg-avatar {
  display: none;
}
.ai-msg.user .ai-msg-bubble {
  background: var(--accent);
  color: #1a1510;
  border-bottom-right-radius: 4px;
}

.ai-msg.ai-error .ai-msg-bubble {
  background: rgba(229, 62, 62, 0.1);
  border: 1px solid #e53e3e;
  color: #e53e3e;
}

/* 移动端适配 */
@media (max-width: 640px) {
  .ai-top-bar {
    padding: 8px 12px;
    gap: 8px;
  }
  .ai-bar-avatar {
    width: 32px;
    height: 32px;
  }
  .ai-bar-name { font-size: 14px; }
  .ai-bar-status { font-size: 10px; }
  .ai-messages-scroll {
    padding: 10px 10px;
  }
  .ai-msg-bubble {
    max-width: 82%;
    font-size: 14px;
  }
  .ai-msg-avatar {
    width: 28px;
    height: 28px;
  }
  .ai-input-bar {
    padding: 8px 10px;
  }
  .ai-input-row input {
    padding: 8px 14px;
    font-size: 14px;
  }
  .ai-send-btn {
    width: 38px;
    height: 38px;
  }
}

/* AI页返回按钮 */
.ai-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}
.ai-back-btn:hover {
  background: var(--bg-card);
}

