/* ============================================================
   个人博客前台样式：深色科技风为主 + 浅色切换，卡片式 + 毛玻璃侧栏
   ============================================================ */
:root {
  --bg: #0b1120;
  --bg2: #0f172a;
  --card: rgba(30, 41, 59, .55);
  --card-solid: #16213a;
  --border: rgba(148, 163, 184, .16);
  --text: #e2e8f0;
  --text2: #94a3b8;
  --text3: #64748b;
  --acc: #22d3ee;
  --acc2: #818cf8;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 16px;
  --shadow: 0 8px 32px rgba(0, 0, 0, .35);
}
html[data-theme="light"] {
  --bg: #f1f5f9;
  --bg2: #e2e8f0;
  --card: rgba(255, 255, 255, .72);
  --card-solid: #ffffff;
  --border: rgba(15, 23, 42, .12);
  --text: #0f172a;
  --text2: #475569;
  --text3: #94a3b8;
  --shadow: 0 8px 24px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.75 "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  transition: background .3s, color .3s;
  min-height: 100vh;
}
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1000px 500px at 15% -10%, rgba(34, 211, 238, .16), transparent 60%),
    radial-gradient(900px 500px at 90% 0%, rgba(129, 140, 248, .14), transparent 60%),
    radial-gradient(700px 700px at 50% 120%, rgba(52, 211, 153, .08), transparent 60%);
}
a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ============ 页头 ============ */
.site-head {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid var(--border);
}
.head-inner {
  max-width: 1180px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
}
.brand { display: flex; align-items: baseline; gap: 12px; flex: 1; min-width: 200px; }
.brand-name {
  font-size: 22px; font-weight: 800; letter-spacing: .5px;
  background: linear-gradient(135deg, var(--acc) 0%, #22d3ee 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  transition: filter .2s;
}
.brand-name::before {
  content: ">_";
  font-family: "JetBrains Mono", "Fira Code", Consolas, monospace;
  font-size: 18px; font-weight: 700;
  margin-right: 10px;
  -webkit-text-fill-color: var(--acc);
  color: var(--acc);
  animation: blink 1.2s step-end infinite;
}
@keyframes blink { 50% { opacity: .35; } }
.brand-name:hover { filter: brightness(1.2); }
.brand-sub { font-size: 13px; color: var(--text3); }
.head-nav { display: flex; gap: 4px; }
.head-nav a {
  padding: 8px 16px; border-radius: 999px; color: var(--text2); font-size: 14px;
}
.head-nav a:hover { background: var(--card); text-decoration: none; color: var(--text); }
.head-nav a.on { background: linear-gradient(135deg, var(--acc), var(--acc2)); color: #06121f; font-weight: 700; }
.theme-toggle {
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  border-radius: 999px; width: 40px; height: 40px; cursor: pointer; font-size: 17px;
}

/* ============ 布局 ============ */
.wrap {
  max-width: 1180px; margin: 0 auto; padding: 26px 20px 40px;
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 26px;
  align-items: start;
}
.main-col { min-width: 0; }
.side-col { position: sticky; top: 86px; display: flex; flex-direction: column; gap: 18px; }

/* ============ 卡片 / 玻璃 ============ */
.glass {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.side-card { padding: 18px 18px 16px; }
.side-title {
  margin: 0 0 12px; font-size: 15px; font-weight: 700; color: var(--text);
  padding-left: 10px; border-left: 3px solid var(--acc);
}

/* ============ 列表 / 文章卡片 ============ */
.list-head { display: flex; align-items: baseline; gap: 12px; margin: 6px 0 18px; }
.list-head h1 { margin: 0; font-size: 24px; }
.list-sub { color: var(--text3); font-size: 13px; }
.post-card { padding: 22px 24px; margin-bottom: 18px; }
.post-title { margin: 0 0 10px; font-size: 20px; line-height: 1.4; }
.post-title a { color: var(--text); }
.post-title a:hover { color: var(--acc); text-decoration: none; }
.tag {
  display: inline-block; font-size: 12px; padding: 1px 9px; border-radius: 999px;
  margin-right: 8px; vertical-align: 2px; font-weight: 600;
}
.tag.top { background: rgba(248, 113, 113, .16); color: var(--danger); border: 1px solid rgba(248, 113, 113, .4); }
.tag.pw { background: rgba(251, 191, 36, .14); color: var(--warn); border: 1px solid rgba(251, 191, 36, .4); }
.post-thumb { display: block; margin: 0 0 12px; }
.post-thumb img {
  display: block; max-width: 100%; height: auto; border-radius: 10px; margin: 0 auto;
  border: 1px solid var(--border); background: var(--bg2);
}
.post-summary { margin: 0 0 12px; color: var(--text2); font-size: 14.5px; }
.pw-tip { color: var(--warn); }
.post-meta {
  display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center;
  font-size: 13px; color: var(--text3); border-top: 1px dashed var(--border); padding-top: 12px;
}
.read-more { margin-left: auto; font-weight: 600; color: var(--acc); }

/* ============ 详情页 ============ */
.post-detail { padding: 28px 30px; }
.detail-title { margin: 0 0 12px; font-size: 27px; line-height: 1.4; }
.detail-meta {
  display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--text3);
  padding-bottom: 16px; margin-bottom: 18px; border-bottom: 1px dashed var(--border);
}
.ubb-body { font-size: 15.5px; line-height: 1.9; word-break: break-word; }
.ubb-body p { margin: 0 0 14px; }
.ubb-body img { border-radius: 10px; }
.ubb-body .ubb-img.left { float: left; margin: 4px 16px 10px 0; max-width: 46%; }
.ubb-body .ubb-img.right { float: right; margin: 4px 0 10px 16px; max-width: 46%; }
.ubb-body .ubb-img.center { display: block; margin: 10px auto; }
.ubb-body blockquote {
  margin: 14px 0; padding: 12px 16px; border-left: 4px solid var(--acc2);
  background: color-mix(in srgb, var(--bg2) 55%, transparent); border-radius: 0 10px 10px 0;
  color: var(--text2);
}
.q-author { font-weight: 700; color: var(--acc2); margin-bottom: 6px; }
.ubb-body ul, .ubb-body ol { padding-left: 26px; }
.ubb-body table { border-collapse: collapse; margin: 14px 0; max-width: 100%; }
.ubb-body th, .ubb-body td { border: 1px solid var(--border); padding: 8px 12px; font-size: 14px; }
.ubb-body th { background: var(--bg2); }
.ubb-body pre.ubb-code, .ubb-body code.ubb-code, pre.ubb-code {
  background: #0a0f1e; font: 13.5px/1.7 Consolas, "Courier New", monospace;
  color: #d6e2f0; margin: 0;
}
.ubb-code-wrap {
  position: relative; margin: 14px 0;
  border: 1px solid rgba(34, 211, 238, .25); border-radius: 12px; overflow: hidden;
}
.ubb-code-wrap .ubb-code-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: #0d1526; border-bottom: 1px solid rgba(34, 211, 238, .2);
  padding: 8px 16px;
}
/* 无语言标签时：复制按钮浮在代码块右上角 */
.ubb-code-wrap:not(:has(.ubb-code-bar)) .ubb-copy {
  position: absolute; top: 10px; right: 12px; z-index: 2;
}
.ubb-code-wrap:not(:has(.ubb-code-bar)) .ubb-code-bar { display: none; }
.ubb-code-wrap .ubb-code-lang {
  font: 11px/1.4 Consolas, "Courier New", monospace; color: #67e8f9;
  letter-spacing: 1.5px; text-transform: uppercase;
}
.ubb-code-wrap pre.ubb-code {
  padding: 14px 16px; overflow: auto; white-space: pre-wrap; word-break: break-all;
  max-height: 640px;
}
.ubb-copy {
  background: transparent; border: 1px solid rgba(34, 211, 238, .35);
  color: #67e8f9; padding: 1px 8px; border-radius: 5px; cursor: pointer;
  font-size: 11px; line-height: 1.5; transition: all .2s; white-space: nowrap;
}
.ubb-copy:hover { background: rgba(34, 211, 238, .15); }
.ubb-copy.copied { background: rgba(52, 211, 153, .15); border-color: rgba(52, 211, 153, .5); color: #34d399; }
.ubb-body .ubb-fly { display: inline-block; animation: ubbFly 12s linear infinite; color: var(--danger); }
@keyframes ubbFly { 0% { transform: translateX(100%); } 100% { transform: translateX(-100%); } }
.ubb-hidden {
  background: rgba(251, 191, 36, .08); border: 1px dashed rgba(251, 191, 36, .4);
  color: var(--warn); padding: 12px 14px; border-radius: 10px; margin: 12px 0; font-size: 14px;
}
.ubb-img-bad { color: var(--text3); font-size: 13px; }
.ubb-media { margin: 10px 0; }
.ubb-media a { color: var(--acc); }
.ubb-reply { border-left-color: var(--warn); }

/* 代码高亮（JS 就地着色，CSP 友好） */
.hl-c { color: #64748b; font-style: italic; }
.hl-s { color: #86efac; }
.hl-k { color: #c4b5fd; }
.hl-n { color: #fbbf24; }
.hl-t { color: #7dd3fc; }

/* ============ 点赞 / 评论 ============ */
.like-bar { margin: 26px 0 10px; }
.like-btn { border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 999px; padding: 10px 22px; cursor: pointer; font-size: 15px; transition: all .15s; }
.like-btn:hover { border-color: var(--acc); color: var(--acc); }
.like-btn.liked { background: linear-gradient(135deg, rgba(34,211,238,.18), rgba(129,140,248,.18)); color: var(--acc); }
.comments { margin-top: 30px; }
.sec-title { font-size: 18px; margin: 0 0 14px; }
.comment-item {
  padding: 14px 0; border-bottom: 1px dashed var(--border);
}
.c-head { display: flex; gap: 14px; align-items: baseline; font-size: 14px; }
.c-head b { color: var(--acc); }
.c-time { color: var(--text3); font-size: 12.5px; }
.c-body { margin-top: 6px; color: var(--text2); font-size: 14.5px; }
.c-empty { color: var(--text3); }
.cmt-tip { color: var(--ok); margin: 10px 0; }
.comment-form { margin-top: 18px; display: flex; flex-direction: column; gap: 12px; }
.cf-row { display: flex; gap: 12px; flex-wrap: wrap; }
.cf-row .input { flex: 1; min-width: 160px; }
.input, .textarea {
  width: 100%; border: 1px solid var(--border); background: var(--card-solid); color: var(--text);
  border-radius: 10px; padding: 10px 14px; font-size: 14.5px; outline: none; transition: border-color .15s;
}
.input:focus, .textarea:focus { border-color: var(--acc); }
.textarea { resize: vertical; min-height: 90px; font-family: inherit; }
.cf-captcha .input { flex: 0 0 110px; }
.captcha-img { border-radius: 8px; cursor: pointer; height: 40px; }
.btn {
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  border-radius: 10px; padding: 9px 20px; cursor: pointer; font-size: 14.5px; transition: all .15s;
}
.btn:hover { border-color: var(--acc); color: var(--acc); }
.btn.primary { background: linear-gradient(135deg, var(--acc), var(--acc2)); color: #06121f; font-weight: 700; border: none; }
.cf-hint { font-size: 12.5px; color: var(--text3); align-self: center; }

/* ============ 密码门 ============ */
.pw-gate { text-align: center; padding: 40px 0 20px; }
.pw-icon { font-size: 46px; }
.pw-gate h2 { margin: 10px 0 6px; font-size: 21px; }
.pw-tips { color: var(--text2); }
.pw-gate form { display: flex; gap: 10px; justify-content: center; max-width: 380px; margin: 18px auto 0; }
.pw-gate .input { flex: 1; }
.pw-err { color: var(--danger); margin-top: 12px; }

/* ============ 侧栏组件 ============ */
.side-search { display: flex; gap: 8px; }
.side-search .input { flex: 1; min-width: 0; }
.side-list { list-style: none; margin: 0; padding: 0; }
.side-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.side-list li:last-child { border-bottom: none; }
.side-list a { color: var(--text2); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-list a:hover { color: var(--acc); }
.side-list .cnt { color: var(--text3); font-size: 12px; }
.link-list a { display: flex; align-items: center; gap: 8px; }
.link-list img { width: 18px; height: 18px; border-radius: 4px; object-fit: contain; }
.stat-list { list-style: none; margin: 0; padding: 0; }
.stat-list li { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13.5px; color: var(--text2); }
.stat-list b { color: var(--acc); }

/* ============ 万年历 ============ */
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cal-ym { font-weight: 700; font-size: 14px; }
.cal-nav {
  color: var(--text2); font-size: 18px; padding: 2px 10px; line-height: 1;
  background: none; border: none; cursor: pointer; border-radius: 8px;
  font-family: inherit;
}
.cal-nav:hover { color: var(--acc); background: var(--bg2); }
.cal.loading .cal-grid { opacity: .45; pointer-events: none; }
.cal-grid { transition: opacity .15s ease; }
.cal-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal-table th { font-size: 11px; color: var(--text3); padding: 4px 0; font-weight: 600; }
.cal-table td { text-align: center; padding: 3px 0; font-size: 12.5px; color: var(--text2); }
.cal-table td.has-post a {
  display: inline-block; width: 24px; height: 24px; line-height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, var(--acc), var(--acc2)); color: #06121f; font-weight: 700;
  box-shadow: 0 0 10px rgba(34, 211, 238, .45);
}
.cal-table td.has-post a:hover { text-decoration: none; transform: scale(1.12); }
.cal-table td.today { font-weight: 800; color: var(--warn); }
.cal-table td.today a { color: #06121f; }

/* ============ 归档 / 空状态 / 分页 ============ */
.archive-tree { padding: 20px 24px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.arch-month {
  display: flex; justify-content: space-between; align-items: center;
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--bg2);
}
.arch-month:hover { border-color: var(--acc); text-decoration: none; }
.am-ym { font-weight: 700; }
.am-cnt { font-size: 12px; color: var(--text3); }
.empty-tip { padding: 40px 24px; text-align: center; color: var(--text3); margin-bottom: 18px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 16px; margin: 24px 0 10px; }
.pg { border: 1px solid var(--border); border-radius: 10px; padding: 8px 18px; color: var(--text2); }
.pg:hover { border-color: var(--acc); color: var(--acc); text-decoration: none; }
.pg-info { color: var(--text3); font-size: 13px; }
.side-search.big { margin-bottom: 20px; }

/* ============ 页脚 ============ */
.site-foot {
  border-top: 1px solid var(--border); margin-top: 30px; padding: 22px 20px 28px;
  text-align: center; color: var(--text3); font-size: 13px; display: flex; gap: 18px;
  justify-content: center; flex-wrap: wrap;
}
.site-foot a { color: var(--text3); }
.site-foot a:hover { color: var(--acc); }

/* ============ 响应式 ============ */
@media (max-width: 920px) {
  .wrap { grid-template-columns: 1fr; }
  .side-col { position: static; }
  .head-inner { gap: 14px; }
}
@media (max-width: 640px) {
  .post-detail { padding: 20px 16px; }
  .post-card { padding: 18px 16px; }
  .ubb-body .ubb-img.left, .ubb-body .ubb-img.right { float: none; max-width: 100%; margin: 10px 0; }
}

/* ============ 文章上下篇导航 ============ */
.post-nav {
  display: flex; justify-content: space-between; align-items: stretch; gap: 14px;
  margin: 10px 0 24px;
}
.nav-item {
  flex: 1; max-width: 48%; display: flex; flex-direction: column; gap: 4px;
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px;
  background: var(--bg2); transition: border-color .15s ease, transform .15s ease;
  min-width: 0;
}
.nav-item:hover { border-color: var(--acc); text-decoration: none; transform: translateY(-1px); }
.nav-prev { align-items: flex-start; text-align: left; }
.nav-next { align-items: flex-end; text-align: right; margin-left: auto; }
.nav-dir { font-size: 12px; color: var(--text3); }
.nav-title { font-size: 13.5px; color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.nav-item:hover .nav-title { color: var(--acc); }

/* ===== 搜索标题列表 ===== */
.search-hit {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px; margin-bottom: 8px; border-radius: 10px;
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  transition: border-color .2s, transform .15s;
}
.search-hit:hover { border-color: var(--acc); color: var(--acc); text-decoration: none; transform: translateX(3px); }
.sh-title { font-size: 15px; }
.sh-time { font-size: 12.5px; color: var(--text3); flex-shrink: 0; }


/* 居中 Toast（前台） */
#toastBox { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 9999; display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none; }
#toastBox .toast { background: rgba(18, 22, 32, .95); color: #fff; padding: 10px 24px; border-radius: 999px; font-size: 14px; box-shadow: 0 8px 30px rgba(0, 0, 0, .35); opacity: 0; transform: translateY(-10px); transition: all .3s; max-width: 80vw; }
#toastBox .toast.show { opacity: 1; transform: translateY(0); }
#toastBox .toast.toast-error { background: rgba(176, 44, 54, .96); }

/* 蜜罐字段：真人不可见，机器人会填 */
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
