/* 个人站全局样式：干净现代，浅色主题 */
:root {
  --bg: #fafafa;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --border: #e5e7eb;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.05);
}
* { 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;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 横版布局：左侧栏 + 右侧内容 */
.layout { display: flex; min-height: 100vh; }
/* 内容区占满剩余宽度，container 才能在宽屏下真正居中 */
.main { flex: 1; min-width: 0; }
.container { max-width: 900px; margin: 0 auto; padding: 0 24px; }

/* 左侧栏 */
.sidebar {
  width: 230px; flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 28px 20px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
}
.sidebar .logo { font-weight: 800; font-size: 19px; color: var(--text); margin-bottom: 30px; }
.sidebar .logo:hover { text-decoration: none; }
.side-links { display: flex; flex-direction: column; gap: 6px; }
.side-links a {
  padding: 10px 14px; border-radius: 10px;
  color: var(--muted); font-size: 15px; font-weight: 500;
  border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.side-links a:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); text-decoration: none; }
.side-links a.active { background: var(--accent); color: #fff; font-weight: 600; border-color: var(--accent); }

/* 侧栏左下角：Skill 工具入口 + 用户区（吸底） */
.side-bottom { margin-top: auto; }
.side-skill {
  display: block; padding: 8px 12px; margin-bottom: 10px; border-radius: 10px;
  color: var(--muted); font-size: 14px; font-weight: 500;
  transition: background .15s, color .15s;
}
.side-skill:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.side-user-box { padding-top: 14px; border-top: 1px solid var(--border); }
.side-user {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text); cursor: pointer; text-decoration: none;
}
.side-user:hover { text-decoration: none; border-color: var(--accent); background: var(--accent-soft); }
.side-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.avatar-fallback {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #0d9488); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; flex-shrink: 0;
}
.side-user .name { flex: 1; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user .logout-link { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.side-login { justify-content: center; background: var(--accent); color: #fff; font-weight: 600; }
.side-login:hover { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }

/* 侧栏底部版权（已移入页面底部页脚，此样式保留备用） */

/* Hero */
.hero { padding: 56px 0 40px; }
.hero .avatar {
  width: 88px; height: 88px; border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #0d9488);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 34px; font-weight: 700;
  margin-bottom: 20px; box-shadow: var(--shadow);
}
.hero h1 { font-size: 32px; font-weight: 800; letter-spacing: -.5px; }
.hero .slogan { color: var(--muted); font-size: 18px; margin-top: 6px; }

/* 区块 */
.section { padding: 40px 0; }
.section h2 {
  font-size: 20px; font-weight: 700; margin-bottom: 18px;
  display: flex; align-items: center; gap: 10px;
}
.section h2::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* 关于 */
.about p { color: var(--text); white-space: pre-line; max-width: 640px; }
.about .contact-line { margin-top: 10px; color: var(--muted); font-size: 14px; }
.about .contact-line a { color: var(--accent); }

/* 项目卡片 */
.projects { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.project-card {
  display: block;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
  color: inherit; text-decoration: none;
}
.project-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.project-card h3 { font-size: 16px; margin-bottom: 6px; }
.project-card .desc { font-size: 14px; color: var(--muted); }
.project-card .tag {
  display: inline-block; margin-top: 10px; padding: 2px 10px;
  font-size: 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent);
}

/* 文章列表 */
.post-list { display: flex; flex-direction: column; gap: 14px; }
.post-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
  cursor: pointer; transition: transform .15s ease;
}
.post-item:hover { transform: translateY(-2px); }
.post-item h3 { font-size: 16px; margin-bottom: 4px; }
.post-item .meta { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.post-item .summary { font-size: 14px; color: var(--text); }
.empty { color: var(--muted); padding: 20px 0; }

/* 页脚：版权 + 版本号，横屏/竖屏都在页面最底部，内容居中 */
.footer { border-top: 1px solid var(--border); padding: 24px 0 40px; color: var(--muted); font-size: 14px; }
.footer .container { text-align: center; }
.footer .version { font-weight: 600; color: var(--text); }

/* 移动端：侧栏折叠为顶部横条 */
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: sticky; top: 0; z-index: 10;
    flex-direction: row; align-items: center; gap: 16px;
    padding: 12px 16px; border-right: none; border-bottom: 1px solid var(--border);
  }
  .sidebar .logo { margin-bottom: 0; font-size: 16px; }
  .side-links { flex-direction: row; gap: 2px; overflow-x: auto; }
  .side-links a { padding: 6px 12px; font-size: 14px; white-space: nowrap; }
  .side-links a.active { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 600; }
  .side-bottom { margin-top: 0; margin-left: auto; display: flex; align-items: center; gap: 6px; }
  .side-skill { margin-bottom: 0; padding: 6px 10px; font-size: 13px; white-space: nowrap; }
  .side-user-box { margin-top: 0; padding-top: 0; border-top: none; }
  .side-user { padding: 5px 10px; border-radius: 999px; }
  .side-avatar, .avatar-fallback { width: 26px; height: 26px; font-size: 12px; }
  .side-user .name { display: none; }
  .container { padding: 0 16px; }
}

/* 按钮 */
.btn {
  display: inline-block; padding: 8px 18px; border-radius: 999px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  font-size: 14px; cursor: pointer; transition: opacity .15s;
}
.btn:hover { opacity: .9; text-decoration: none; }
.btn.secondary { background: #fff; color: var(--accent); }
.btn.danger { background: #dc2626; border-color: #dc2626; }

/* 表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 14px; font-family: inherit; background: #fff;
}
.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }

/* 文章详情 */
.article { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); }
.article h1 { font-size: 26px; margin-bottom: 8px; }
.article .meta { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.article-body { font-size: 16px; }
.article-body h2 { font-size: 22px; margin: 28px 0 10px; }
.article-body h3 { font-size: 18px; margin: 22px 0 8px; }
.article-body p { margin-bottom: 14px; }
.article-body ul, .article-body ol { margin: 0 0 14px 22px; }
.article-body code { background: #f3f4f6; padding: 2px 6px; border-radius: 6px; font-size: 14px; }
.article-body pre { background: #111827; color: #e5e7eb; padding: 16px; border-radius: 10px; overflow-x: auto; margin-bottom: 14px; }
.article-body pre code { background: none; padding: 0; color: inherit; }
.article-body blockquote { border-left: 4px solid var(--accent); padding-left: 14px; color: var(--muted); margin: 0 0 14px; }
.article-body a { text-decoration: underline; }
.article-body img { max-width: 100%; border-radius: 10px; }

/* 管理页 */
.admin-wrap { max-width: 760px; margin: 0 auto; padding: 32px 20px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.toolbar h1 { font-size: 20px; }
.admin-list { display: flex; flex-direction: column; gap: 10px; }
.admin-item { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; }
.admin-item .title { flex: 1; font-size: 15px; }
.admin-item .badge { font-size: 12px; padding: 2px 10px; border-radius: 999px; background: #f3f4f6; color: var(--muted); }
.admin-item .badge.pub { background: #d1fae5; color: #065f46; }
.admin-item .badge.draft { background: #fef3c7; color: #92400e; }
.admin-item .ops button { margin-left: 8px; font-size: 13px; padding: 4px 12px; border-radius: 8px; border: 1px solid var(--border); background: #fff; cursor: pointer; color: var(--text); }
.admin-item .ops button:hover { border-color: var(--accent); color: var(--accent); }
.admin-item .ops button.del:hover { border-color: #dc2626; color: #dc2626; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #fff; border-radius: var(--radius); padding: 24px; width: 92%; max-width: 640px; max-height: 88vh; overflow-y: auto; }
.modal h2 { font-size: 18px; margin-bottom: 16px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 10px; }

/* 加载/错误 */
.loading { color: var(--muted); padding: 16px 0; }
.error-box { background: #fef2f2; color: #991b1b; padding: 12px 16px; border-radius: 10px; margin: 10px 0; }
.ok-box { background: #ecfdf5; color: #065f46; padding: 12px 16px; border-radius: 10px; margin: 10px 0; }

/* Tab */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab {
  padding: 10px 18px; font-size: 15px; border: none; background: none; cursor: pointer;
  color: var(--muted); border-bottom: 2px solid transparent; font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); font-weight: 600; border-bottom-color: var(--accent); }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
thead th { background: #f9fafb; text-align: left; padding: 9px 10px; font-weight: 600; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f9fafb; }

/* 美签状态 */
.health-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; font-size: 14px; }
.chip { display: inline-block; margin: 0 6px 4px 0; padding: 3px 12px; border-radius: 999px; font-size: 13px; }
.chip-ok { background: #d1fae5; color: #065f46; }
.chip-bad { background: #fef3c7; color: #92400e; }

/* 评估项编辑 */
.w-input, .m-select { border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; font-size: 13px; font-family: inherit; background: #fff; }
.e-check { width: auto; }
.save-item { font-size: 13px; padding: 4px 12px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent); cursor: pointer; }

/* ===== 点赞条 ===== */
.like-bar { display: flex; align-items: center; gap: 12px; margin: 26px 0 4px; }
.like-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 999px; padding: 8px 18px; font-size: 15px; cursor: pointer; transition: all .15s; }
.like-btn:hover { border-color: #f472b6; color: #db2777; }
.like-btn.liked { background: #fdf2f8; border-color: #f472b6; color: #db2777; }
.like-tip { font-size: 13px; color: var(--muted); }

/* ===== 评论区 ===== */
.comments { margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--border); }
.comments h2 { font-size: 18px; margin-bottom: 16px; }
.comments h2 span { color: var(--muted); font-weight: 400; font-size: 14px; }
.c-form textarea, .reply-input { width: 100%; box-sizing: border-box; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 14px; font-family: inherit; background: var(--card); resize: vertical; }
.c-form { margin-bottom: 24px; }
.c-form .row-actions { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.c-login-tip { background: var(--bg); border: 1px dashed var(--border); border-radius: 10px; padding: 14px 16px; font-size: 14px; color: var(--muted); margin-bottom: 20px; }
.c-login-tip a { color: var(--accent); font-weight: 600; }

.comment { display: flex; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.comment.pinned { background: var(--accent-soft); border-radius: 10px; padding: 14px 14px; }
.c-avatar { border-radius: 50%; object-fit: cover; flex: none; }
.c-avatar-fallback { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #6366f1, #a855f7); color: #fff; font-weight: 600; }
.c-main { flex: 1; min-width: 0; }
.c-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.c-name { font-weight: 600; font-size: 14px; }
.c-pin { font-size: 12px; color: #b45309; background: #fef3c7; border-radius: 999px; padding: 1px 8px; }
.c-time { font-size: 12.5px; color: var(--muted); }
.c-content { font-size: 14.5px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.c-ops { display: flex; gap: 12px; margin-top: 6px; }
.c-op { font-size: 13px; color: var(--muted); background: none; border: none; padding: 0; cursor: pointer; }
.c-op:hover { color: var(--accent); }
.c-op.del:hover { color: #dc2626; }
.c-replies { margin-top: 12px; padding-left: 14px; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.c-reply { display: flex; gap: 10px; background: var(--bg); border-radius: 8px; padding: 10px 12px; }
.reply-box { margin-top: 8px; display: flex; gap: 8px; align-items: flex-start; }
.reply-box .reply-input { flex: 1; }
.reply-box .btn { flex: none; }
