/* ============================================
   GoBlog 前台样式 —— TDesign 蓝色风格
   ============================================ */
:root {
  --td-brand: #0052D9;
  --td-brand-hover: #366EF4;
  --td-brand-active: #003CAB;
  --td-brand-light: #ECF2FE;
  --td-brand-light-2: #F5F8FF;
  --td-text: #1D2129;
  --td-text-2: #4E5969;
  --td-text-3: #86909C;
  --td-border: #E7E9EA;
  --td-bg: #F3F3F3;
  --td-bg-1: #FFFFFF;
  --td-success: #00A870;
  --td-warning: #E37318;
  --td-danger: #D54941;
  --td-radius: 6px;
  --td-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.03);
  --td-shadow-lg: 0 4px 10px rgba(0,0,0,.08);
  --sidebar-w: 232px;
  --topbar-h: 56px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--td-text);
  background: var(--td-bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--td-brand); text-decoration: none; }
a:hover { color: var(--td-brand-hover); }
img { max-width: 100%; }

/* ---------- 顶栏 ---------- */
.topbar {
  height: var(--topbar-h);
  background: var(--td-bg-1);
  border-bottom: 1px solid var(--td-border);
  position: sticky; top: 0; z-index: 100;
}
.topbar-inner {
  height: 100%;
  display: flex; align-items: center; gap: 20px;
  padding: 0 20px;
  overflow: hidden;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--td-text); font-weight: 600; font-size: 16px; min-width: 0; }
.brand:hover { color: var(--td-text); }
.brand-logo { width: 28px; height: 28px; border-radius: var(--td-radius); object-fit: cover; flex: none; }
.brand-mark {
  width: 28px; height: 28px; border-radius: var(--td-radius);
  background: var(--td-brand); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; flex: none;
}
.brand-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-search { flex: 1; max-width: 420px; display: flex; }
.topbar-search input {
  flex: 1; height: 34px; padding: 0 12px;
  border: 1px solid var(--td-border); border-right: none;
  border-radius: var(--td-radius) 0 0 var(--td-radius);
  background: #F7F8FA; font-size: 13px; outline: none;
}
.topbar-search input:focus { background: #fff; border-color: var(--td-brand); }
.topbar-search button {
  height: 34px; padding: 0 16px; border: none; cursor: pointer;
  background: var(--td-brand); color: #fff; font-size: 13px;
  border-radius: 0 var(--td-radius) var(--td-radius) 0;
}
.topbar-search button:hover { background: var(--td-brand-hover); }
.topbar-nav { margin-left: auto; display: flex; align-items: center; gap: 18px; min-width: 0; flex-shrink: 1; }
.topbar-nav a { color: var(--td-text-2); font-size: 13px; white-space: nowrap; }
.topbar-nav .btn-admin {
  background: var(--td-brand); color: #fff !important;
  padding: 6px 14px; border-radius: var(--td-radius);
}
.topbar-nav .btn-admin:hover { background: var(--td-brand-hover); }

/* ---------- 布局 ---------- */
.layout {
  display: flex; align-items: flex-start;
  max-width: 1400px; margin: 0 auto; gap: 16px;
  padding: 16px 20px 40px;
}

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--td-bg-1);
  border: 1px solid var(--td-border);
  border-radius: var(--td-radius);
  padding: 12px 0;
  position: sticky; top: calc(var(--topbar-h) + 16px);
  max-height: calc(100vh - var(--topbar-h) - 32px);
  display: flex; flex-direction: column;
}
.side-search { padding: 0 12px 10px; }
.side-search input {
  width: 100%; height: 30px; padding: 0 10px; font-size: 12px;
  border: 1px solid var(--td-border); border-radius: var(--td-radius);
  background: #F7F8FA; outline: none;
}
.side-search input:focus { border-color: var(--td-brand); background: #fff; }
.side-menu { flex: 1; overflow-y: auto; padding: 0 8px; }
.menu-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--td-radius);
  color: var(--td-text-2); font-size: 13px; cursor: pointer;
  transition: all .15s;
}
.menu-item:hover { background: var(--td-bg); color: var(--td-text); }
.menu-item.active { background: var(--td-brand-light); color: var(--td-brand); font-weight: 500; }
.mi-icon { font-size: 10px; color: var(--td-text-3); transition: transform .15s; }
.menu-item.active .mi-icon { color: var(--td-brand); }
.mi-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-caret { font-size: 11px; color: var(--td-text-3); }
.menu-children { display: none; padding-left: 18px; }
.menu-group.open .menu-children { display: block; }
.menu-child {
  display: block; padding: 6px 10px; border-radius: var(--td-radius);
  color: var(--td-text-2); font-size: 12.5px;
}
.menu-child:hover { background: var(--td-bg); color: var(--td-brand); }
.menu-child.active { color: var(--td-brand); background: var(--td-brand-light); font-weight: 500; }
.side-foot {
  padding: 10px 14px 4px; margin-top: 8px;
  border-top: 1px solid var(--td-border);
  font-size: 11px; color: var(--td-text-3);
}
.side-foot a { color: var(--td-text-3); }

/* ---------- 内容区 ---------- */
.content {
  flex: 1; min-width: 0;
  background: var(--td-bg-1);
  border: 1px solid var(--td-border);
  border-radius: var(--td-radius);
  padding: 20px 24px 32px;
  min-height: calc(100vh - var(--topbar-h) - 40px);
}

/* ---------- 文章列表 ---------- */
.post-list { display: flex; flex-direction: column; gap: 14px; }
.post-card {
  display: flex; gap: 16px;
  padding: 16px;
  border: 1px solid var(--td-border);
  border-radius: var(--td-radius);
  background: #fff;
  transition: all .18s;
}
.post-card:hover { box-shadow: var(--td-shadow-lg); border-color: #C9D8F5; transform: translateY(-1px); }
.post-cover { flex: 0 0 168px; height: 106px; border-radius: 4px; overflow: hidden; background: var(--td-bg); }
.post-cover img { width: 100%; height: 100%; object-fit: cover; }
.post-body { flex: 1; min-width: 0; }
.post-title { font-size: 17px; font-weight: 600; line-height: 1.4; margin-bottom: 8px; }
.post-title a { color: var(--td-text); }
.post-title a:hover { color: var(--td-brand); }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; font-size: 12px; color: var(--td-text-3); }
.meta-item { display: inline-flex; align-items: center; gap: 4px; }
.cat-chip {
  display: inline-block; padding: 1px 9px; border-radius: 10px;
  background: var(--td-brand-light); color: var(--td-brand); font-size: 12px;
}
.cat-chip:hover { background: var(--td-brand); color: #fff; }
.tag-chip {
  display: inline-block; padding: 1px 9px; border-radius: 10px;
  border: 1px solid var(--td-brand); font-size: 12px;
}
.tag-chip.big { padding: 5px 14px; font-size: 14px; border-radius: 14px; }
.tag-count { opacity: .65; font-size: 11px; }
.post-summary {
  margin-top: 9px; font-size: 13px; color: var(--td-text-2);
  line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.more-link { display: inline-block; margin-top: 10px; font-size: 13px; }

/* ---------- 文章详情 ---------- */
.post-detail-head { border-bottom: 1px solid var(--td-border); padding-bottom: 14px; margin-bottom: 20px; }
.post-detail-head h1 { font-size: 26px; line-height: 1.35; margin-bottom: 12px; }
.section-title {
  font-size: 15px; font-weight: 600; margin: 24px 0 12px;
  padding-left: 10px; border-left: 3px solid var(--td-brand);
}

/* ---------- Markdown 正文 ---------- */
.markdown-body { font-size: 14.5px; line-height: 1.85; color: var(--td-text); word-wrap: break-word; }
.markdown-body h1, .markdown-body h2, .markdown-body h3,
.markdown-body h4, .markdown-body h5, .markdown-body h6 {
  margin: 26px 0 12px; font-weight: 600; line-height: 1.4; position: relative;
}
.markdown-body h1 { font-size: 24px; padding-bottom: 8px; border-bottom: 1px solid var(--td-border); }
.markdown-body h2 { font-size: 20px; }
.markdown-body h3 { font-size: 17px; }
.markdown-body h4 { font-size: 15px; }
.markdown-body .heading-anchor { color: inherit; }
.markdown-body .heading-anchor:hover::after { content: " #"; color: var(--td-brand); opacity: .6; }
.markdown-body p { margin: 12px 0; }
.markdown-body ul, .markdown-body ol { margin: 12px 0; padding-left: 26px; }
.markdown-body li { margin: 5px 0; }
.markdown-body li.task-list-item { list-style: none; margin-left: -20px; }
.markdown-body a { text-decoration: none; border-bottom: 1px solid rgba(0,82,217,.25); }
.markdown-body a:hover { border-bottom-color: var(--td-brand); }
.markdown-body blockquote {
  margin: 16px 0; padding: 10px 16px;
  background: var(--td-brand-light-2);
  border-left: 3px solid var(--td-brand);
  border-radius: 0 var(--td-radius) var(--td-radius) 0;
  color: var(--td-text-2);
}
.markdown-body blockquote p { margin: 4px 0; }
.markdown-body hr { margin: 24px 0; border: none; border-top: 1px solid var(--td-border); }
.markdown-body code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px; background: rgba(0,82,217,.08);
  color: #d63384; padding: 2px 6px; border-radius: 4px;
}
.markdown-body pre {
  margin: 16px 0; padding: 0; overflow: hidden;
  background: #282c34; border-radius: var(--td-radius);
}
.markdown-body pre code {
  display: block; padding: 16px; background: transparent;
  color: #abb2bf; font-size: 13px; line-height: 1.65;
  overflow-x: auto; border-radius: 0;
}
.code-block { margin: 16px 0; border-radius: var(--td-radius); overflow: hidden; border: 1px solid #1e2229; }
.code-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 14px; background: #21252b; color: #8b949e; font-size: 12px;
}
.code-lang { text-transform: uppercase; letter-spacing: .5px; font-size: 11px; }
.code-copy {
  background: #3a4048; color: #c9d1d9; border: none; cursor: pointer;
  font-size: 11px; padding: 3px 10px; border-radius: 4px;
}
.code-copy:hover { background: #4a5159; color: #fff; }
.markdown-body .table-wrap { overflow-x: auto; margin: 16px 0; }
.markdown-body table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.markdown-body th, .markdown-body td {
  border: 1px solid var(--td-border); padding: 8px 13px; text-align: left;
}
.markdown-body th { background: var(--td-brand-light-2); font-weight: 600; }
.markdown-body tbody tr:nth-child(even) { background: #FAFBFC; }
.markdown-body img {
  border-radius: var(--td-radius); cursor: zoom-in;
  box-shadow: var(--td-shadow); display: block; margin: 16px 0;
}
.markdown-body input[type=checkbox] { margin-right: 6px; }

/* 灯箱 */
.lightbox-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.88);
  display: none; align-items: center; justify-content: center;
  z-index: 9999; cursor: zoom-out; padding: 30px;
}
.lightbox-overlay.active { display: flex; }
.lightbox-overlay img {
  max-width: 92vw; max-height: 88vh; border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0,0,0,.5); cursor: zoom-out;
}
.lightbox-close {
  position: absolute; top: 18px; right: 24px;
  color: #fff; font-size: 32px; cursor: pointer; line-height: 1;
  opacity: .8;
}
.lightbox-close:hover { opacity: 1; }

/* ---------- 视频 ---------- */
.video-wrap { margin: 16px 0; border-radius: var(--td-radius); overflow: hidden; background: #000; }
.video-wrap iframe, .video-wrap video { width: 100%; display: block; aspect-ratio: 16/9; max-height: 70vh; border: none; }
.video-note { padding: 8px 12px; background: var(--td-bg-1); color: var(--td-text-2); font-size: 12.5px; margin: 0; }
.video-item { margin-bottom: 20px; }
.video-title { font-size: 13.5px; color: var(--td-text-2); margin-bottom: 6px; font-weight: 500; }

/* ---------- 附件 ---------- */
.attach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.attach-card {
  border: 1px solid var(--td-border); border-radius: var(--td-radius);
  overflow: hidden; background: #fff; transition: all .15s;
}
.attach-card:hover { box-shadow: var(--td-shadow-lg); }
.attach-img { display: block; height: 110px; overflow: hidden; background: var(--td-bg); }
.attach-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-file { height: 110px; display: flex; align-items: center; justify-content: center; font-size: 38px; background: var(--td-brand-light-2); }
.attach-meta { padding: 9px 11px; }
.attach-name { font-size: 12.5px; font-weight: 500; word-break: break-all; line-height: 1.4; }
.attach-size { font-size: 11.5px; color: var(--td-text-3); margin: 3px 0 7px; }
.btn-download {
  display: inline-block; font-size: 12px; padding: 3px 12px;
  border: 1px solid var(--td-brand); color: var(--td-brand); border-radius: 4px;
}
.btn-download:hover { background: var(--td-brand); color: #fff; }

/* ---------- 评论 ---------- */
.comment-section { margin-top: 34px; border-top: 1px solid var(--td-border); padding-top: 8px; }
.comment-form { margin: 14px 0 22px; }
.comment-form textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--td-border);
  border-radius: var(--td-radius); font-size: 13.5px; font-family: inherit;
  outline: none; resize: vertical;
}
.comment-form textarea:focus { border-color: var(--td-brand); }
.form-row { display: flex; gap: 10px; margin-bottom: 10px; }
.form-row input {
  flex: 1; height: 34px; padding: 0 12px; font-size: 13px;
  border: 1px solid var(--td-border); border-radius: var(--td-radius); outline: none;
}
.form-row input:focus { border-color: var(--td-brand); }
.comment-item { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--td-border); }
.comment-children { margin-top: 10px; padding-left: 16px; border-left: 2px solid var(--td-brand-light); }
.comment-avatar {
  flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%;
  background: var(--td-brand-light); color: var(--td-brand);
  display: flex; align-items: center; justify-content: center; font-weight: 600;
}
.comment-main { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: baseline; gap: 10px; }
.comment-nick { font-weight: 600; font-size: 13.5px; }
.comment-time { font-size: 12px; color: var(--td-text-3); }
.comment-body { font-size: 13.5px; line-height: 1.7; margin: 5px 0; word-break: break-word; }
.comment-reply { background: none; border: none; color: var(--td-text-3); font-size: 12px; cursor: pointer; padding: 0; }
.comment-reply:hover { color: var(--td-brand); }

/* ---------- 博主名片 ---------- */
.blogger-card {
  padding: 6px 14px 16px;
  border-bottom: 1px solid var(--td-border);
  margin-bottom: 10px;
  text-align: center;
}
.blogger-avatar, .blogger-avatar-placeholder {
  width: 64px; height: 64px; border-radius: 50%;
  margin: 8px auto 10px; display: block; object-fit: cover;
  border: 2px solid var(--td-brand-light);
  box-shadow: 0 2px 8px rgba(0,82,217,.14);
}
.blogger-avatar-placeholder {
  background: var(--td-brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; border: none;
}
.blogger-name { font-size: 15px; font-weight: 600; color: var(--td-text); margin-bottom: 5px; }
.blogger-bio {
  font-size: 12px; color: var(--td-text-3); line-height: 1.6;
  padding: 0 4px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.blogger-web {
  display: inline-block; margin-top: 7px; font-size: 11.5px; color: var(--td-brand);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- 侧栏统计 ---------- */
.side-stats {
  display: flex; align-items: center; justify-content: space-around;
  margin: 10px 12px 0; padding: 11px 0;
  background: var(--td-brand-light-2);
  border-radius: var(--td-radius);
  border: 1px solid #E3ECFD;
}
.stat-item { text-align: center; flex: 1; }
.stat-num { display: block; font-size: 17px; font-weight: 700; color: var(--td-brand); line-height: 1.2; }
.stat-label { display: block; font-size: 11px; color: var(--td-text-3); margin-top: 3px; }
.stat-divider { width: 1px; height: 26px; background: #D5E1FA; }

/* ---------- ICP 徽章 ---------- */
.icp-badge {
  font-size: 12px; color: var(--td-text-2);
  background: #F7F8FA; border: 1px solid var(--td-border);
  padding: 4px 11px; border-radius: 12px;
  white-space: nowrap; max-width: 260px;
  overflow: hidden; text-overflow: ellipsis; display: inline-block;
}
.icp-badge:hover { border-color: var(--td-brand); color: var(--td-brand); background: var(--td-brand-light); }

/* ---------- 工具栏 / 排序 ---------- */
.list-toolbar {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 18px;
  padding-bottom: 14px; border-bottom: 1px solid var(--td-border);
}
.toolbar-title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.toolbar-title h1 { font-size: 22px; font-weight: 600; }
.sort-tabs {
  display: inline-flex; background: #EEF0F3; border-radius: var(--td-radius);
  padding: 3px; gap: 2px;
}
.sort-tab {
  padding: 5px 15px; font-size: 13px; color: var(--td-text-2);
  border-radius: 4px; white-space: nowrap; transition: all .15s;
}
.sort-tab:hover { color: var(--td-brand); }
.sort-tab.active {
  background: #fff; color: var(--td-brand); font-weight: 500;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

/* ---------- 相关文章卡片 ---------- */
.related-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}
.related-card {
  display: flex; flex-direction: column;
  border: 1px solid var(--td-border); border-radius: var(--td-radius);
  overflow: hidden; background: #fff; color: var(--td-text);
  transition: all .18s;
}
.related-card:hover {
  box-shadow: var(--td-shadow-lg); border-color: #C9D8F5;
  transform: translateY(-2px); color: var(--td-text);
}
.related-thumb { height: 116px; overflow: hidden; background: var(--td-bg); }
.related-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.related-body { padding: 11px 13px 13px; flex: 1; display: flex; flex-direction: column; }
.related-body h4 {
  font-size: 14px; font-weight: 600; line-height: 1.5; margin-bottom: 7px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.related-meta {
  display: flex; gap: 12px; font-size: 11.5px; color: var(--td-text-3);
  margin-top: auto; margin-bottom: 6px;
}
.related-body p {
  font-size: 12.5px; color: var(--td-text-3); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---------- 验证码 ---------- */
.captcha-row { display: flex; gap: 10px; align-items: stretch; }
.captcha-input { flex: 1; min-width: 0; }
.captcha-img {
  width: 120px; height: 40px; border: 1px solid var(--td-border);
  border-radius: var(--td-radius); cursor: pointer; flex: 0 0 120px;
  background: #F7F8FA; object-fit: cover;
}
.captcha-img:hover { border-color: var(--td-brand); }

/* ---------- 列表页 ---------- */
.list-page { }
.list-head { margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--td-border); }
.list-head h1 { font-size: 22px; margin-bottom: 6px; }
.sub-cats { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 12px; }
.muted { color: var(--td-text-3); }
.small { font-size: 12px; }
.empty { text-align: center; padding: 60px 20px; color: var(--td-text-3); }
.empty-icon { font-size: 52px; margin-bottom: 12px; }
.error-page h1 { font-size: 40px; color: var(--td-text); }
.err-detail { text-align: left; background: #fff1f0; color: #a8071a; padding: 12px; border-radius: 4px; font-size: 12px; overflow-x: auto; margin: 14px 0; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 26px; }
.page-btn {
  padding: 6px 16px; border: 1px solid var(--td-border); border-radius: var(--td-radius);
  color: var(--td-text-2); font-size: 13px; background: #fff;
}
.page-btn:hover { border-color: var(--td-brand); color: var(--td-brand); }
.page-info { font-size: 13px; color: var(--td-text-3); }

.btn-primary {
  display: inline-block; padding: 7px 18px; border: none; cursor: pointer;
  background: var(--td-brand); color: #fff; font-size: 13px;
  border-radius: var(--td-radius); font-family: inherit;
}
.btn-primary:hover { background: var(--td-brand-hover); color: #fff; }
.btn-ghost {
  display: inline-block; padding: 7px 18px; border: 1px solid var(--td-border);
  background: #fff; color: var(--td-text-2); border-radius: var(--td-radius);
  font-size: 13px; cursor: pointer; font-family: inherit; text-align: center;
}
.btn-ghost:hover { border-color: var(--td-brand); color: var(--td-brand); }
.btn-block { display: block; width: 100%; text-align: center; margin-top: 10px; }
.btn-lg { width: 100%; padding: 11px; font-size: 15px; margin-top: 20px; }
.empty-state { text-align: center; padding: 40px 0; color: var(--td-text-3); }

/* ---------- 页脚 ---------- */
.footer { background: #fff; border-top: 1px solid var(--td-border); padding: 16px 0; }
.footer-inner {
  max-width: 1400px; margin: 0 auto; padding: 0 20px;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  font-size: 12.5px; color: var(--td-text-3);
}
.footer a { color: var(--td-text-3); }
.footer a:hover { color: var(--td-brand); }

/* ---------- 安装页 ---------- */
.install-body { background: linear-gradient(160deg, #EAF1FF 0%, #F7F9FC 45%, #F3F3F3 100%); min-height: 100vh; }
.install-wrap { max-width: 720px; margin: 0 auto; padding: 40px 20px 60px; }
.install-head { text-align: center; margin-bottom: 28px; }
.install-logo { font-size: 44px; }
.install-head h1 { font-size: 26px; margin: 10px 0 6px; }
.install-head p { color: var(--td-text-2); font-size: 14px; }
.install-form { display: flex; flex-direction: column; gap: 18px; }
.form-card {
  background: #fff; border: 1px solid var(--td-border);
  border-radius: 8px; padding: 22px 24px; box-shadow: var(--td-shadow);
}
.form-title { font-size: 15px; margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--td-border); }
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-size: 13px; color: var(--td-text-2); margin-bottom: 6px; }
.field input[type=text], .field input[type=password], .field input[type=email],
.field input[type=number], .field input[type=search], .field textarea, .field select {
  width: 100%; padding: 8px 12px; font-size: 13.5px; font-family: inherit;
  border: 1px solid var(--td-border); border-radius: var(--td-radius);
  outline: none; background: #fff; color: var(--td-text);
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--td-brand); }
.field textarea { resize: vertical; line-height: 1.7; }
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }
.hint { font-size: 11.5px; color: var(--td-text-3); margin-top: 5px; }
.req { color: var(--td-danger); }
.checkbox { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--td-text-2); margin-bottom: 9px; cursor: pointer; }
.checkbox input { width: 15px; height: 15px; accent-color: var(--td-brand); cursor: pointer; }
.install-tip { text-align: center; font-size: 12px; color: var(--td-text-3); margin-top: 14px; }
.alert { padding: 10px 14px; border-radius: var(--td-radius); font-size: 13px; margin-bottom: 16px; }
.alert.error { background: #FEF0F0; color: #D54941; border: 1px solid #FBD3D3; }
.alert.success { background: #E8F8F2; color: #00824F; border: 1px solid #B4E9D3; }

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  .related-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

@media (max-width: 900px) {
  .layout { flex-direction: column; padding: 12px; gap: 12px; }
  .sidebar {
    width: 100%; flex: none; position: static; max-height: none; padding: 0;
  }
  /* 移动端博主名片横向排列 */
  .blogger-card {
    display: grid; grid-template-columns: 56px 1fr;
    grid-template-areas: "avatar name" "avatar bio" "avatar web";
    gap: 0 14px; text-align: left; align-items: center;
    padding: 14px 16px; margin-bottom: 0;
  }
  .blogger-avatar, .blogger-avatar-placeholder {
    grid-area: avatar; width: 56px; height: 56px; margin: 0; font-size: 22px;
  }
  .blogger-name { grid-area: name; margin-bottom: 3px; }
  .blogger-bio { grid-area: bio; -webkit-line-clamp: 2; padding: 0; }
  .blogger-web { grid-area: web; margin-top: 4px; }
  .side-search { padding: 10px 12px; }
  .side-menu { max-height: 320px; }
  .side-stats { margin: 0 12px 12px; }

  .post-card { flex-direction: column; }
  .post-cover { flex: none; width: 100%; height: 160px; }
  .topbar-search { display: none; }
  /* 窄屏隐藏次要导航，保留 ICP 徽章 */
  .topbar-nav .nav-extra { display: none; }
  .icp-badge { max-width: 180px; }
  .content { padding: 16px; }
  .field-row { flex-direction: column; gap: 0; }

  .list-toolbar { flex-direction: column; align-items: stretch; gap: 12px; }
  .sort-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .sort-tab { padding: 5px 12px; font-size: 12.5px; }

  .post-detail-head h1 { font-size: 21px; }
  .markdown-body { font-size: 14px; line-height: 1.8; }
  .markdown-body h1 { font-size: 20px; }
  .markdown-body h2 { font-size: 17px; }
  .markdown-body h3 { font-size: 15.5px; }
  .markdown-body pre code { font-size: 12px; }
  .code-head { padding: 6px 12px; }

  .attach-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .related-grid { grid-template-columns: 1fr; }
  .related-thumb { height: 140px; }

  .comment-form .form-row { flex-direction: column; gap: 8px; }
  .form-row input { width: 100%; }
  .comment-children { padding-left: 10px; }
  .footer-inner { flex-direction: column; align-items: center; text-align: center; }
}

@media (max-width: 600px) {
  .topbar { height: 50px; }
  .topbar-inner { padding: 0 12px; gap: 10px; }
  .brand-text { font-size: 14px; max-width: 130px; }
  .topbar-nav { gap: 10px; }
  .icp-badge { font-size: 11px; padding: 3px 8px; max-width: 140px; }
  .topbar-nav a { font-size: 12px; }

  .layout { padding: 8px; }
  .content { padding: 12px; border-radius: 4px; }
  .post-card { padding: 12px; }
  .post-title { font-size: 15.5px; }
  .post-summary { font-size: 12.5px; }
  .toolbar-title h1 { font-size: 18px; }

  .markdown-body table { font-size: 12.5px; }
  .markdown-body th, .markdown-body td { padding: 6px 9px; }
  .video-wrap iframe, .video-wrap video { aspect-ratio: 16/9; }
  .pagination { gap: 8px; }
  .page-btn { padding: 5px 12px; font-size: 12.5px; }
}

/* ================================================================
   归档页 —— 时间线布局
   ================================================================ */
.archive-page { max-width: 100%; }
.archive-hero {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 22px; margin-bottom: 16px;
  background: linear-gradient(135deg, #F0F6FF 0%, #FAFBFD 100%);
  border: 1px solid #D6E4FF; border-radius: 12px;
}
.archive-hero-icon {
  width: 48px; height: 48px; flex: none; border-radius: 12px;
  background: #fff; border: 1px solid #D6E4FF;
  display: flex; align-items: center; justify-content: center; font-size: 23px;
  box-shadow: 0 2px 8px rgba(0,82,217,.08);
}
.archive-hero-body { flex: 1; min-width: 0; }
.archive-hero-body h1 { font-size: 20px; font-weight: 600; margin: 0 0 3px; }
.archive-hero-body p { margin: 0; font-size: 12.5px; }
.archive-hero-stats { display: flex; align-items: center; gap: 14px; flex: none; }
.archive-stat { text-align: center; }
.archive-stat-num { display: block; font-size: 21px; font-weight: 600; color: var(--td-brand); line-height: 1.2; }
.archive-stat-label { display: block; font-size: 11.5px; color: var(--td-text-3); margin-top: 2px; }
.archive-stat-divider { width: 1px; height: 28px; background: #D6E4FF; }

.archive-months {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px;
  padding-bottom: 16px; border-bottom: 1px solid var(--td-border);
}
.archive-month {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px; border-radius: 16px;
  background: #F7F8FA; border: 1px solid var(--td-border);
  font-size: 12.5px; color: var(--td-text-2);
  transition: all .15s;
}
.archive-month:hover { border-color: var(--td-brand); color: var(--td-brand); background: var(--td-brand-light); }
.archive-month-count { font-size: 11px; color: var(--td-text-3); }
.archive-month:hover .archive-month-count { color: var(--td-brand); }

.timeline { position: relative; }
.timeline-node { display: grid; grid-template-columns: 76px 22px 1fr; gap: 0; }
.timeline-date { text-align: right; padding: 2px 12px 22px 0; }
.timeline-day { font-size: 26px; font-weight: 600; color: var(--td-text); line-height: 1.05; }
.timeline-ym { font-size: 11.5px; color: var(--td-text-2); margin-top: 3px; }
.timeline-week { font-size: 11px; color: var(--td-text-3); margin-top: 1px; }

.timeline-line { position: relative; display: flex; justify-content: center; }
.timeline-line::before {
  content: ''; position: absolute; top: 8px; bottom: -6px; left: 50%;
  width: 2px; margin-left: -1px; background: #E3E8F0;
}
.timeline-node:last-child .timeline-line::before { bottom: 22px; }
.timeline-dot {
  position: relative; z-index: 1;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--td-brand); border: 2px solid #fff;
  box-shadow: 0 0 0 3px var(--td-brand-light);
  margin-top: 6px;
}

.timeline-body { padding: 0 0 26px 16px; }
.timeline-item {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 11px 14px; margin-bottom: 8px;
  background: #fff; border: 1px solid var(--td-border); border-radius: 9px;
  color: var(--td-text); transition: all .16s;
}
.timeline-item:hover {
  border-color: var(--td-brand); background: #F8FBFF;
  transform: translateX(3px);
  box-shadow: 0 2px 10px rgba(0,82,217,.08);
}
.timeline-item-dot { width: 6px; height: 6px; border-radius: 50%; background: #C6D8F5; flex: none; }
.timeline-item:hover .timeline-item-dot { background: var(--td-brand); }
.timeline-item-title { font-size: 14px; font-weight: 500; color: var(--td-text); }
.timeline-item:hover .timeline-item-title { color: var(--td-brand); }
.timeline-badge {
  font-size: 10.5px; padding: 1px 7px; border-radius: 3px;
  background: #FEF3E6; color: #B76A00;
}
.timeline-item-meta { font-size: 11.5px; color: var(--td-text-3); margin-left: auto; }

.archive-empty { text-align: center; padding: 60px 20px; color: var(--td-text-3); }
.archive-empty-icon { font-size: 40px; margin-bottom: 12px; opacity: .55; }

@media (max-width: 900px) {
  .archive-hero { flex-wrap: wrap; padding: 16px; }
  .archive-hero-stats { width: 100%; justify-content: center; padding-top: 10px; border-top: 1px solid #D6E4FF; }
  .timeline-node { grid-template-columns: 58px 18px 1fr; }
  .timeline-date { padding-right: 8px; }
  .timeline-day { font-size: 21px; }
  .timeline-body { padding-left: 10px; }
  .timeline-item-meta { margin-left: 0; width: 100%; }
}

@media (max-width: 600px) {
  .archive-hero { padding: 14px; gap: 12px; }
  .archive-hero-icon { width: 40px; height: 40px; font-size: 19px; }
  .archive-hero-body h1 { font-size: 17px; }
  .timeline-node { grid-template-columns: 46px 14px 1fr; }
  .timeline-day { font-size: 18px; }
  .timeline-ym { font-size: 10.5px; }
  .timeline-item { padding: 9px 11px; }
  .timeline-item-title { font-size: 13px; }
}

/* ================================================================
   阅读进度条
   ================================================================ */
.read-progress {
  position: fixed; top: 0; left: 0; right: 0;
  height: 3px; z-index: 9999;
  background: transparent;
  pointer-events: none;
}
.read-progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--td-brand) 0%, #3E8BFF 60%, #56C7FF 100%);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 6px rgba(0, 82, 217, .35);
  transition: width .08s linear;
}
/* 顶栏是 sticky 的，进度条要盖在它上面 */
.topbar { z-index: 100; }

@media (max-width: 600px) {
  .read-progress { height: 2.5px; }
}

/* ================================================================
   正文内嵌媒体（视频 / 附件占位符渲染）
   ================================================================ */
.media-embed { margin: 20px 0; }
.media-embed-video .video-wrap { margin: 0; }
.media-embed-empty {
  padding: 18px; text-align: center; font-size: 13px; color: var(--td-text-3);
  background: #FAFBFD; border: 1px dashed var(--td-border); border-radius: 8px;
}

.attach-embed-card {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 16px;
  background: #FAFBFD; border: 1px solid var(--td-border); border-radius: 10px;
  color: var(--td-text); text-decoration: none;
  transition: all .16s;
}
.attach-embed-card:hover {
  border-color: var(--td-brand); background: #F8FBFF;
  transform: translateX(3px);
  box-shadow: 0 2px 10px rgba(0,82,217,.08);
}
.attach-embed-icon {
  width: 42px; height: 42px; flex: none; border-radius: 9px;
  background: #fff; border: 1px solid var(--td-border);
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.attach-embed-body { flex: 1; min-width: 0; }
.attach-embed-name {
  display: block; font-size: 14px; font-weight: 500; color: var(--td-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.attach-embed-card:hover .attach-embed-name { color: var(--td-brand); }
.attach-embed-size { display: block; font-size: 12px; color: var(--td-text-3); margin-top: 2px; }
.attach-embed-dl {
  flex: none; font-size: 12.5px; color: var(--td-brand);
  padding: 5px 12px; border-radius: 6px; background: var(--td-brand-light);
  white-space: nowrap;
}

@media (max-width: 600px) {
  .attach-embed-card { padding: 11px 12px; gap: 10px; }
  .attach-embed-icon { width: 36px; height: 36px; font-size: 17px; }
  .attach-embed-name { font-size: 13px; }
  .attach-embed-dl { padding: 4px 9px; font-size: 12px; }
}
