:root {
  --bg: #f7f8fc;
  --surface: #ffffff;
  --text: #2b2f38;
  --text-soft: #6b7280;
  --primary: #6a8dff;
  --primary-dark: #4f6fe0;
  --border: #e7e9f0;
  --shadow: 0 8px 30px rgba(60, 80, 160, 0.08);
  --radius: 14px;
}

/* ===== 深色模式 ===== */
[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #1a1d24;
  --text: #e6e8ee;
  --text-soft: #9aa1b1;
  --primary: #8aa2ff;
  --primary-dark: #6a8dff;
  --border: #2a2e38;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] body { background: var(--bg); color: var(--text); }
[data-theme="dark"] .nav-wrap { background: rgba(26, 29, 36, 0.72); }
[data-theme="dark"] .site-nav a:hover,
[data-theme="dark"] .site-nav a.active { color: var(--primary); background: rgba(138, 162, 255, 0.12); }
[data-theme="dark"] .btn-ghost { background: var(--surface); color: var(--text); }
[data-theme="dark"] .site-footer { background: #14171c; border-color: var(--border); }
[data-theme="dark"] .post-cat { background: rgba(138, 162, 255, 0.15); }
[data-theme="dark"] .hero {
  background: radial-gradient(1200px 400px at 50% -10%, #1c2233 0%, transparent 70%);
}
[data-theme="dark"] .nav-toggle span { background: var(--text); }
[data-theme="dark"] .site-nav.open { background: var(--surface); }
[data-theme="dark"] .sub-menu { background: var(--surface); border-color: var(--border); }

/* 主题切换按钮 */
.theme-toggle {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; font-size: 17px;
  transition: all .2s;
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }

/* 平滑过渡 */
body, .site-header, .site-footer, .post-card, .about-card,
.gb-form, .gb-item, .friend-list a, .btn-ghost, .sub-menu {
  transition: background .3s, color .3s, border-color .3s, box-shadow .3s;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container {
  width: min(1080px, 92%);
  margin: 0 auto;
}

/* ===== 顶部导航（置顶悬空 + 横向排布） ===== */
.site-header {
  position: sticky;
  top: 12px;
  z-index: 50;
}
.nav-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  max-width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.nav-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex: 0 0 auto; min-width: 0; }
.brand { display: flex; flex-direction: row; align-items: center; gap: 10px; font-weight: 700; flex: 0 0 auto; white-space: nowrap; }
.brand-logo {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), #9b6bff);
  color: #fff; border-radius: 10px; font-weight: 800;
}
.brand-name { font-size: 18px; white-space: nowrap; }

.nav-center { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; gap: 10px; min-width: 0; }
.site-nav { display: flex; justify-content: center; }
.site-nav ul { list-style: none; display: flex; flex-direction: row; flex-wrap: nowrap; gap: 6px; align-items: center; }
.site-nav > ul > li { position: relative; }
.site-nav a {
  display: block;
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--text-soft);
  font-size: 15px;
  white-space: nowrap;
  transition: all .2s;
}
.site-nav a:hover, .site-nav a.active { color: var(--primary); background: #eef2ff; }
.caret { font-size: 11px; }

.sub-menu {
  position: absolute;
  top: 100%; left: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 8px;
  opacity: 0; visibility: hidden;
  transform: translateY(6px);
  transition: all .2s;
}
.has-sub:hover .sub-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.sub-menu li a { padding: 6px 12px; white-space: nowrap; }

.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: 0; cursor: pointer; }
.nav-toggle span { width: 24px; height: 2px; background: var(--text); border-radius: 2px; }

/* ===== Hero ===== */
.hero {
  padding: 90px 0 70px;
  text-align: center;
  background: radial-gradient(1200px 400px at 50% -10%, #e8eeff 0%, transparent 70%);
}
.hero-greet { letter-spacing: 4px; color: var(--primary); font-weight: 700; font-size: 14px; }
.hero-title { font-size: 40px; margin: 10px 0 16px; }
.hero-sub { color: var(--text-soft); font-size: 17px; }
.hero-actions { margin-top: 28px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-block; padding: 11px 24px; border-radius: 999px;
  font-weight: 600; font-size: 15px; cursor: pointer; border: 1px solid transparent;
  transition: all .2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { border-color: var(--border); color: var(--text); background: #fff; }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }

/* ===== 内容区 ===== */
.main-content { padding: 50px 0 70px; }
.section-title { font-size: 24px; margin-bottom: 22px; position: relative; padding-left: 12px; }
.section-title::before {
  content: ""; position: absolute; left: 0; top: 4px; bottom: 4px;
  width: 4px; border-radius: 4px; background: linear-gradient(var(--primary), #9b6bff);
}

.post-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.post-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.post-card:hover { transform: translateY(-4px); box-shadow: 0 14px 40px rgba(60,80,160,.14); }
.post-cover { height: 130px; display: grid; place-items: center; font-size: 44px; }
.post-body { padding: 18px 20px 22px; }
.post-meta { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--text-soft); margin-bottom: 8px; }
.post-cat { background: #eef2ff; color: var(--primary); padding: 2px 10px; border-radius: 999px; }
.post-title { font-size: 19px; margin-bottom: 8px; }
.post-title a:hover { color: var(--primary); }
.post-excerpt { color: var(--text-soft); font-size: 14px; }

/* ===== 关于 / 留言板 ===== */
.about-card { display: flex; gap: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 36px; }
.avatar { width: 80px; height: 80px; flex: 0 0 80px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), #9b6bff); display: grid; place-items: center; font-size: 40px; }
.about-text h3 { margin-bottom: 8px; }
.about-text p { color: var(--text-soft); margin-bottom: 6px; }

.friend-list { list-style: none; display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 36px; }
.friend-list a { display: inline-block; padding: 8px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; color: var(--text); }
.friend-list a:hover { border-color: var(--primary); color: var(--primary); }
.rss-link { color: var(--primary); }

.guestbook-tip { color: var(--text-soft); margin-bottom: 18px; }
.gb-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 26px; display: grid; gap: 12px; }
.gb-form input, .gb-form textarea { width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; font: inherit; resize: vertical; }
.gb-form input:focus, .gb-form textarea:focus { outline: none; border-color: var(--primary); }
.gb-list { display: grid; gap: 14px; }
.gb-item { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px; }
.gb-item strong { color: var(--primary); }
.gb-time { color: var(--text-soft); font-size: 13px; margin-left: 10px; }

/* ===== 页脚 ===== */
.site-footer { border-top: 1px solid var(--border); background: #fff; padding: 36px 0 30px; margin-top: 30px; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; margin-bottom: 16px; }
.footer-nav a { color: var(--text-soft); font-size: 14px; }
.footer-nav a:hover { color: var(--primary); }
.footer-meta { text-align: center; color: var(--text-soft); font-size: 13px; }
.footer-meta p { margin: 4px 0; }
.powered { color: #9aa1b1; }
.beian { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: center; }
.beian-link { color: var(--text-soft); display: inline-flex; align-items: center; gap: 4px; }
.beian-link:hover { color: var(--primary); }
.beian-icon { width: 14px; height: 14px; }
.beian-sep { color: var(--border); }

/* ===== 响应式 ===== */
@media (max-width: 760px) {
  .nav-toggle { display: flex; }
  .nav-center {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0; transform: none;
    flex-direction: column; align-items: stretch; gap: 4px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 14px; box-shadow: var(--shadow);
    max-height: 0; overflow: hidden; transition: max-height .3s;
  }
  .nav-center.open { max-height: 80vh; overflow-y: auto; padding: 8px; }
  .site-nav { flex: none; width: 100%; justify-content: flex-start; }
  .site-nav > ul { flex-direction: column; padding: 0; gap: 2px; align-items: stretch; }
  .site-nav > ul > li { width: 100%; }
  .site-nav a { white-space: normal; }
  .sub-menu { position: static; flex-direction: column; opacity: 1; visibility: visible; transform: none; box-shadow: none; border: 0; padding-left: 14px; }
  .has-sub:hover > a .caret { transform: none; }
  .nav-login, .nav-user { width: 100%; justify-content: center; }
  .nav-actions { flex-direction: row; align-items: center; gap: 8px; margin-left: auto; flex: 0 0 auto; }
  .brand { flex: 1 1 auto; }
  .hero-title { font-size: 30px; }
  .post-grid { grid-template-columns: 1fr; }
  .about-card { flex-direction: column; align-items: center; text-align: center; }
}

/* ===== 文章详情页（Halo post/page） ===== */
.post-detail {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow);
}
.post-detail-title { font-size: 30px; margin: 10px 0 18px; }
.post-content { color: var(--text); font-size: 16px; line-height: 1.8; }
.post-content h2, .post-content h3 { margin: 24px 0 12px; }
.post-content p { margin-bottom: 14px; }
.post-content img { border-radius: 10px; margin: 14px 0; max-width: 100%; }
.post-content pre {
  background: #0f1115; color: #e6e8ee;
  padding: 16px; border-radius: 10px; overflow: auto;
}
.post-content a { color: var(--primary); text-decoration: underline; }
[data-theme="dark"] .post-content pre { background: #000; }

/* ===== moesora 风格两栏布局 ===== */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 28px;
  padding: 50px 0 70px;
  align-items: start;
}
.main-col { min-width: 0; }
.main-content { padding: 50px 0 70px; }

/* ===== 侧边栏 ===== */
.sidebar { position: sticky; top: 84px; display: grid; gap: 18px; }
.side-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
  transition: background .3s, border-color .3s, box-shadow .3s;
}
.side-profile { text-align: center; }
.side-avatar {
  width: 64px; height: 64px; margin: 0 auto 10px;
  display: grid; place-items: center; font-size: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #ff9ecd, #a78bff);
}
.side-name { font-size: 17px; }
.side-loc { color: var(--text-soft); font-size: 13px; margin-top: 4px; }
.side-title { font-size: 14px; margin-bottom: 12px; color: var(--primary); }
.side-cat { list-style: none; display: grid; gap: 8px; }
.side-cat a { color: var(--text); font-size: 14px; display: flex; justify-content: space-between; }
.side-cat a:hover { color: var(--primary); }
.side-count { background: #ffe6f2; color: #d6499a; font-size: 12px; padding: 1px 8px; border-radius: 999px; }
[data-theme="dark"] .side-count { background: rgba(214,73,154,.2); color: #ff9ecd; }
.side-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.side-tags a { font-size: 13px; color: var(--text-soft); background: #f3eaff; padding: 3px 10px; border-radius: 999px; }
.side-tags a:hover { color: var(--primary); }
[data-theme="dark"] .side-tags a { background: rgba(167,139,255,.18); color: #c7b8ff; }
.side-notice, .side-about { color: var(--text-soft); font-size: 14px; line-height: 1.7; }
.side-links { list-style: none; display: grid; gap: 8px; }
.side-links a { color: var(--text); font-size: 14px; }
.side-links a:hover { color: var(--primary); }
.side-empty { color: var(--text-soft); font-size: 13px; }

/* ===== 打字机效果（halosb 风格） ===== */
.typed-cursor { color: var(--primary); font-weight: 700; animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ===== 滚动渐显（halosb 风格） ===== */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ===== 看板娘（Live2D，由 live2d-widget 负责立绘/闭眼/跟随）+ AI 问答 =====
 * 看板娘 #waifu 由 live2d-widget 注入并固定在【右下角】。其自带 waifu.css
 * 默认把 #waifu 放在 left:0（左下角），这里用 !important 覆盖到右下角。
 * #kanban 仅作为气泡 / AI 面板的定位锚点（同样固定在右下角）。 */
#kanban {
  position: fixed; right: 16px; bottom: 16px; z-index: 60;
  width: 1px; height: 1px; pointer-events: none;
  user-select: none; -webkit-tap-highlight-color: transparent;
}

/* 强制看板娘立在右下角（覆盖 live2d-widget 自带 waifu.css 的 left:0） */
#waifu {
  left: auto !important; right: 0 !important; bottom: 0 !important;
  z-index: 60 !important;
}

/* 对话气泡（live2d-widget 自带气泡优先；此为兜底，置于看板娘左上方） */
.kanban-bubble {
  position: absolute; right: 300px; bottom: 220px; max-width: 200px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  padding: 8px 12px; border-radius: 12px; font-size: 13px; line-height: 1.5;
  box-shadow: var(--shadow); opacity: 0; transform: translateY(8px) scale(.96);
  transition: opacity .25s, transform .25s; pointer-events: none; z-index: 61;
}
.kanban-bubble::after {
  content: ""; position: absolute; right: -6px; bottom: 18px;
  border: 6px solid transparent; border-left-color: var(--surface);
}
.kanban-bubble.show { opacity: 1; transform: none; }

/* ===== 看板娘 AI 问答面板（位于看板娘左侧，避免重叠） ===== */
/* ===== 音乐播放器（左下角，lixingyong 风格点歌台） ===== */
.aplayer-fixed { position: fixed; left: 14px; bottom: 200px; z-index: 61; width: 290px; max-width: calc(100vw - 28px); box-shadow: var(--shadow); border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }

/* ===== Hero 霓虹渐变（halosb Aurora 风格） ===== */
.hero { background: radial-gradient(900px 360px at 20% -10%, rgba(255,158,205,.35) 0%, transparent 60%), radial-gradient(900px 360px at 80% -10%, rgba(167,139,255,.35) 0%, transparent 60%); }
[data-theme="dark"] .hero { background: radial-gradient(900px 360px at 20% -10%, rgba(255,158,205,.18) 0%, transparent 60%), radial-gradient(900px 360px at 80% -10%, rgba(167,139,255,.18) 0%, transparent 60%); }
.hero-title { background: linear-gradient(120deg, #ff7eb3, #a78bff, #6a8dff); -webkit-background-clip: text; background-clip: text; color: transparent; background-size: 200% auto; animation: hue 6s linear infinite; }
[data-theme="dark"] .hero-title { background: linear-gradient(120deg, #ff9ecd, #c7b8ff, #8aa2ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
@keyframes hue { to { background-position: 200% center; } }

/* 两栏响应式 */
@media (max-width: 920px) { .layout { grid-template-columns: 1fr; } .sidebar { position: static; order: 2; } .aplayer-fixed { width: 250px; bottom: 188px; } }
@media (max-width: 760px) {
  .post-grid { grid-template-columns: 1fr; }
  .about-card { flex-direction: column; align-items: center; text-align: center; }
  #kanban { width: 1px; bottom: 16px; }
  .kanban-bubble { left: auto; right: 8px; max-width: 150px; bottom: 220px; }
  .aplayer-fixed { width: calc(100vw - 28px); bottom: 160px; left: 14px; }
  .kb-ai-log { height: 200px; }
  .aplayer-fixed { width: calc(100vw - 28px); bottom: 160px; left: 14px; }
}

/* ===== 品牌 logo 图片（替换默认 M 文字） ===== */
.brand-logo-img {
  width: 34px; height: 34px;
  border-radius: 10px; object-fit: cover;
  display: block;
}

/* ===== 侧边栏博主头像图片（替换默认 emoji 字符） ===== */
.side-avatar-img {
  width: 64px; height: 64px; margin: 0 auto 10px;
  border-radius: 50%; object-fit: cover;
  display: block;
}

/* ===== 背景视频（mp4/webm 自动铺底） ===== */
.site-bg-video {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: -2;
}
