:root {
  --paper: #f7f4ee;
  --paper-2: #fffdf8;
  --ink: #23201b;
  --muted: #8d867a;
  --faint: #b7b0a3;
  --line: #e6e0d3;
  --accent: #a05b2c;
  --accent-soft: #f3e6d8;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", STSong, serif;
  --sans: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

.page { max-width: 1100px; margin: 0 auto; padding: 0 28px; min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- 头部 ---------- */
.site-header { border-bottom: 1px solid var(--line); }
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { color: var(--accent); font-size: 15px; }
.brand-name { font-size: 17px; font-weight: 600; letter-spacing: 1px; }
.site-nav { display: flex; gap: 26px; }
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-family: var(--sans);
  font-size: 13.5px;
  letter-spacing: 1px;
  transition: color 0.2s;
}
.site-nav a:hover, .site-nav a.active { color: var(--ink); }

/* ---------- 布局 ---------- */
.app { flex: 1; padding: 56px 0 20px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 56px; }
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; gap: 36px; } }

/* ---------- 首页 Hero ---------- */
.hero { margin-bottom: 56px; text-align: center; }
.hero-avatar {
  width: 88px; height: 88px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 22px;
  display: block;
  border: 3px solid var(--paper-2);
  box-shadow: 0 0 0 1px var(--line);
}
.hero h1 { font-size: 40px; font-weight: 600; letter-spacing: 4px; }
.hero .subtitle { margin-top: 12px; color: var(--muted); font-size: 15px; letter-spacing: 2px; }
.hero .ornament { margin-top: 26px; color: var(--faint); font-size: 13px; letter-spacing: 14px; }

/* ---------- 文章列表 ---------- */
.posts h2, .aside h2, .about-page h2 { font-size: 13px; font-weight: 600; letter-spacing: 3px; color: var(--muted); margin-bottom: 24px; }
.post-item {
  padding: 30px 0;
  border-bottom: 1px solid var(--line);
  display: block;
  text-decoration: none;
  color: var(--ink);
}
.post-item:first-of-type { padding-top: 0; }
.post-item .date { font-family: var(--sans); font-size: 12px; color: var(--faint); letter-spacing: 1.5px; }
.post-item h3 {
  font-size: 24px;
  font-weight: 600;
  margin: 10px 0 8px;
  letter-spacing: 1px;
  transition: color 0.2s;
}
.post-item:hover h3 { color: var(--accent); }
.post-item .excerpt { color: var(--muted); font-size: 14.5px; }
.post-item .meta { margin-top: 12px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.tag {
  font-family: var(--sans);
  font-size: 11.5px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 10px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}
.tag-link { cursor: pointer; transition: opacity 0.2s; }
.tag-link:hover { opacity: 0.7; }

.empty { color: var(--muted); padding: 40px 0; text-align: center; }

/* ---------- 侧边栏 ---------- */
.aside { position: sticky; top: 40px; align-self: start; }
.widget { margin-bottom: 40px; }
.widget .about-avatar {
  width: 56px; height: 56px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--paper-2); box-shadow: 0 0 0 1px var(--line);
  margin-bottom: 14px;
}
.widget p, .widget div { font-size: 13.5px; color: var(--muted); }
.widget .tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.widget-custom { font-size: 13.5px; color: var(--muted); }
.widget-custom a { color: var(--accent); }

/* ---------- 文章页 ---------- */
.post-page { max-width: 760px; margin: 0 auto; }
.back-link { color: var(--muted); text-decoration: none; font-family: var(--sans); font-size: 13px; letter-spacing: 1px; }
.back-link:hover { color: var(--accent); }
.post-header { margin: 34px 0 40px; }
.post-header h1 { font-size: 34px; font-weight: 600; letter-spacing: 2px; line-height: 1.4; }
.post-header .post-meta { margin-top: 16px; display: flex; gap: 14px; align-items: center; font-family: var(--sans); font-size: 12.5px; color: var(--faint); letter-spacing: 1px; }
.post-cover { width: 100%; border-radius: 14px; margin-bottom: 36px; border: 1px solid var(--line); }

/* 文章正文排版 */
.article { font-size: 16px; line-height: 2; }
.article h2 { font-size: 24px; margin: 40px 0 16px; letter-spacing: 1px; padding-left: 14px; border-left: 3px solid var(--accent); }
.article h3 { font-size: 20px; margin: 32px 0 12px; letter-spacing: 1px; }
.article p { margin-bottom: 18px; }
.article a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.article img { max-width: 100%; border-radius: 12px; margin: 20px 0; border: 1px solid var(--line); }
.article blockquote {
  margin: 24px 0;
  padding: 14px 22px;
  background: var(--paper-2);
  border-left: 3px solid var(--accent);
  color: var(--muted);
  font-style: italic;
}
.article code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.88em;
  background: var(--paper-2);
  border: 1px solid var(--line);
  padding: 2px 7px;
  border-radius: 6px;
  color: var(--accent);
}
.article pre {
  background: #2b2823;
  color: #e8e3da;
  padding: 20px 22px;
  border-radius: 12px;
  overflow-x: auto;
  margin: 24px 0;
  line-height: 1.7;
}
.article pre code { background: transparent; border: 0; color: inherit; padding: 0; }
.article ul, .article ol { margin: 0 0 18px 24px; }
.article li { margin-bottom: 6px; }
.article hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }

/* ---------- 关于页 ---------- */
.about-page { max-width: 720px; margin: 0 auto; }
.about-page .about-avatar { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 3px solid var(--paper-2); box-shadow: 0 0 0 1px var(--line); margin-bottom: 24px; }
.about-content { font-size: 15.5px; color: #4a463e; }
.about-content a { color: var(--accent); }

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 40px;
  text-align: center;
  color: var(--faint);
  font-family: var(--sans);
  font-size: 12.5px;
  letter-spacing: 1px;
}

/* ---------- 通用按钮与表单 ---------- */
.btn {
  font-family: var(--sans);
  font-size: 13.5px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--ink);
  padding: 9px 22px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.5px;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #8a4e25; color: #fff; }
.btn-danger { color: #b3342a; }
.btn-danger:hover { border-color: #b3342a; color: #b3342a; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.muted { color: var(--muted); font-size: 13.5px; }
.form-msg { margin-top: 12px; font-size: 13px; color: #b3342a; min-height: 18px; }
.form-msg.ok { color: #3e7d4f; }

/* ---------- 登录页 ---------- */
.login-wrap { flex: 1; display: grid; place-items: center; padding: 60px 0; }
.login-card {
  width: 100%; max-width: 360px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 40px 34px;
  text-align: center;
}
.login-card h2 { font-size: 22px; letter-spacing: 2px; margin-bottom: 6px; }
.login-card input {
  width: 100%;
  margin-top: 22px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  font-family: var(--sans);
  font-size: 14px;
  outline: none;
  color: var(--ink);
}
.login-card input:focus { border-color: var(--accent); }
.login-card .btn { width: 100%; margin-top: 16px; }

/* ---------- 管理后台 ---------- */
.admin-body { background: var(--paper); }
.admin-header { border-bottom: 1px solid var(--line); }
.admin-main { flex: 1; padding: 40px 0 60px; }
.admin-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 26px; }
.admin-toolbar h2 { font-size: 20px; letter-spacing: 1px; }
.post-table { width: 100%; border-collapse: collapse; background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.post-table th, .post-table td { text-align: left; padding: 14px 18px; border-bottom: 1px solid var(--line); font-family: var(--sans); font-size: 13.5px; }
.post-table th { background: var(--accent-soft); color: var(--accent); font-weight: 600; letter-spacing: 1px; font-size: 12px; }
.post-table tr:last-child td { border-bottom: 0; }
.post-table .row-actions { display: flex; gap: 10px; }
.post-table .row-actions button { border: 0; background: none; cursor: pointer; color: var(--muted); font-family: var(--sans); font-size: 13px; padding: 0; }
.post-table .row-actions button:hover { color: var(--accent); }
.post-table .row-actions button.danger:hover { color: #b3342a; }
.badge { font-family: var(--sans); font-size: 11px; padding: 2px 10px; border-radius: 20px; }
.badge.on { background: #e3efe6; color: #3e7d4f; }
.badge.off { background: #f2e2de; color: #a5534a; }

/* ---------- 编辑器 ---------- */
.editor-card { background: var(--paper-2); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.editor-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.editor-head h2 { font-size: 20px; letter-spacing: 1px; }
.field { margin-bottom: 20px; }
.field label { display: block; font-family: var(--sans); font-size: 12px; color: var(--muted); letter-spacing: 1.5px; margin-bottom: 8px; }
.field input[type="text"], .field input[type="url"], .field select, .field textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field textarea { resize: vertical; line-height: 1.7; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13.5px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) { .field-row { grid-template-columns: 1fr; } }
.checkbox-field { display: flex; align-items: center; gap: 10px; font-family: var(--sans); font-size: 14px; }
.checkbox-field input { width: 16px; height: 16px; accent-color: var(--accent); }

.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
@media (max-width: 900px) { .editor-grid { grid-template-columns: 1fr; } }
.editor-pane { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--paper); }
.editor-pane .pane-label { font-family: var(--sans); font-size: 12px; color: var(--muted); padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--paper-2); letter-spacing: 1px; }
.editor-pane textarea { border: 0; border-radius: 0; width: 100%; min-height: 420px; resize: vertical; background: var(--paper); padding: 14px; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; line-height: 1.7; outline: none; color: var(--ink); }
.editor-pane .preview { padding: 18px 22px; min-height: 420px; font-size: 15px; line-height: 1.9; overflow-y: auto; max-height: 70vh; }
.editor-actions { display: flex; gap: 12px; margin-top: 22px; }
.hidden { display: none !important; }

.settings-grid { display: grid; gap: 20px; }
.settings-grid textarea { min-height: 120px; }