/* ---- 中文排版 ---- */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans CJK SC',
    sans-serif;
  line-height: 1.8;
}
pre, code, kbd, samp {
  font-family: ui-monospace, 'Cascadia Code', 'JetBrains Mono', Consolas,
    'Courier New', monospace;
}
.content h1, .content h2, .content h3, .content h4 {
  line-height: 1.5;
}

/* ---- 侧栏布局（Codex 风格，亮暗双主题） ----
   注意：Coder 设 html{font-size:62.5%}（1rem=10px），本文件所有 font-size
   一律用 px 显式声明，避免 rem 基准歧义（间距类 rem 沿用主题基准无碍） */
.site-layout {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  min-height: 100vh;
}
.sidebar {
  width: 220px;
  flex-shrink: 0;
  padding: 3.5rem 0;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
}
.sidebar-inner { display: flex; flex-direction: column; gap: 2rem; }
.site-name {
  font-family: Georgia, 'Songti SC', SimSun, serif;
  font-size: 30px;
  font-weight: 700;
}
.site-name a { color: inherit; text-decoration: none; }
.sidebar-nav { display: flex; flex-direction: column; gap: 0.65rem; }
.sidebar-nav .sidebar-link { color: #2f7f6f; text-decoration: none; font-size: 16px; }
.colorscheme-dark .sidebar-nav .sidebar-link { color: #8fd0c0; }
.sidebar-nav .sidebar-link:hover { text-decoration: underline; }
.sidebar-social { display: flex; gap: 1rem; }
.sidebar-social a { color: inherit; opacity: 0.55; }
.sidebar-social a:hover { opacity: 1; }
.sidebar-social i { font-size: 22px; }
.sidebar-toggle { color: inherit; opacity: 0.55; }
.sidebar-toggle:hover { opacity: 1; }
main.wrapper {
  flex: 1;
  min-width: 0;
  width: auto;
  max-width: 760px;
  padding: 3.5rem 0 3.5rem 4rem;
}

/* ---- 首页摘要流 ---- */
.home-wrap { width: 100%; }
.home-tagline {
  font-style: italic;
  opacity: 0.65;
  font-size: 17px;
  margin-bottom: 3rem;
}
.home-post {
  margin-bottom: 2.6rem;
  padding-bottom: 2.4rem;
  border-bottom: 1px solid rgba(128, 128, 128, 0.35);
}
.home-feed .home-post:last-child { border-bottom: none; }
.home-post-title {
  font-family: Georgia, 'Songti SC', SimSun, serif;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.4;
}
.home-post-title a { color: inherit; text-decoration: none; }
.colorscheme-dark .home-post-title a { color: inherit; }
.home-post-title a:hover { color: #2f7f6f; }
.colorscheme-dark .home-post-title a:hover { color: #8fd0c0; }
.home-post-summary { margin: 0.7rem 0 0.9rem; opacity: 0.85; font-size: 16px; }
.home-post-meta { font-size: 14px; opacity: 0.65; display: flex; gap: 1.1rem; }
.home-post-tags a { color: #2f7f6f; text-decoration: none; }
.colorscheme-dark .home-post-tags a { color: #8fd0c0; }

/* 移动端：侧栏折叠为顶部块 */
@media (max-width: 768px) {
  .site-layout { flex-direction: column; padding: 0 1.2rem; }
  .sidebar { position: static; width: 100%; height: auto; padding: 1.6rem 0 0; }
  .sidebar-inner { gap: 1rem; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; gap: 1.3rem; }
  main.wrapper { padding: 1.5rem 0 0; }
}

/* ---- 保留页面通用 ---- */
.page-desc {
  opacity: 0.65;
  text-align: center;
  margin-bottom: 2rem;
}

/* ---- fragments 时间线 ---- */
.timeline {
  margin-top: 1.5rem;
  padding-left: 1.4rem;
  border-left: 1px solid rgba(128, 128, 128, 0.35);
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}
.fragment-item time {
  font-size: 12px;
  letter-spacing: 0.08em;
  opacity: 0.65;
  display: block;
  margin-bottom: 0.25rem;
}
.fragment-item p { font-size: 15px; }

/* ---- topics 分组列表 ---- */
.topic-group { margin-bottom: 2rem; }
.topic-group h2 {
  font-size: 18px;
  margin-bottom: 0.8rem;
  text-align: left;
}
.topic-group ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.topic-group li a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  color: inherit;
  text-decoration: none;
  font-size: 15px;
  padding: 0.65rem 0.95rem;
  border: 1px solid rgba(128, 128, 128, 0.35);
  border-radius: 10px;
  transition: border-color 0.2s;
}
.topic-group li a:hover { border-color: rgba(56, 189, 248, 0.45); }
.topic-group li small { opacity: 0.65; white-space: nowrap; }

/* ---- live2d 小猫（右下角浮动，桌面端） ---- */
#live2d-cat-container {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 200px;
  height: 260px;
  pointer-events: none;
  z-index: 60;
}
#live2d-cat-container canvas {
  pointer-events: auto;
  cursor: pointer;
  display: block;
  margin: 0 auto;
}
@media (max-width: 768px) { #live2d-cat-container { display: none; } }

/* 桌面端：点小猫聊天，剑灵 fab 隐藏（移动端仍用 fab），气泡悬浮在小猫上方 */
@media (min-width: 769px) {
  .pet-fab { display: none; }
  .pet-widget .pet-fab { display: none; }
  .pet-widget .pet-bubble {
    left: auto;
    right: 16px;
    bottom: 276px;
    top: auto;
  }
}

/* 桌面端：点小猫聊天，剑灵 fab 隐藏（移动端仍用 fab），气泡悬浮在小猫上方
   （旧版侧栏定位规则已删除，统一走上方 @media 里的 right/bottom 定位） */
@media (min-width: 769px) {
  .pet-fab { display: none; }
}

/* ---- pet 挂件适配：回填 pet.css 依赖的变量（主题中立，双主题可读） ---- */
.pet-bubble,
.pet-fab {
  --bg-card: rgba(127, 127, 127, 0.08);
  --border: rgba(128, 128, 128, 0.35);
  --text: currentColor;
  --text-muted: rgba(127, 127, 127, 1);
}

/* 浅色主题：assistant 气泡与输入框为硬编码深色底，保持深底配浅色文字 */
.colorscheme-light .pet-bubble .pet-msg.assistant { background: rgba(15, 23, 42, 0.85); color: #e5e7eb; }
.colorscheme-light .pet-bubble .pet-input-row input { background: rgba(15, 23, 42, 0.85); color: #e5e7eb; }

/* 浅色主题：错误气泡与快捷 chips 的浅色文字在浅底上不可读，仅调文字色 */
.colorscheme-light .pet-bubble .pet-msg.error { color: #b91c1c; }
.colorscheme-light .pet-bubble .pet-chips button { color: #0369a1; }

/* 深色主题：聊天气泡文字对比度补足（复审建议，约 6.9:1；须按模式作用域，全局提升会伤浅色消费方） */
.colorscheme-dark .pet-bubble { --text-muted: #9ca3af; }

/* ---- pet 挂件避让主题右下角悬浮切换按钮（.float-container: bottom/right 2rem） ----
   pet.css 由 pet.js 在 custom.css 之后注入 head，同特异性必输，
   故加 .pet-widget 前缀提高特异性（0,2,0 > 0,1,0），同时压过 pet.css 的 640px 断点 */
.pet-widget .pet-fab { bottom: calc(2rem + 48px); }
.pet-widget .pet-bubble { bottom: calc(2rem + 112px); }
