* { box-sizing: border-box; }
:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #1f2329;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #dc2626;
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
.wrap { max-width: 860px; margin: 0 auto; padding: 24px 20px 60px; }
.site-header { border-bottom: 2px solid var(--border); padding-bottom: 16px; margin-bottom: 28px; }
.site-title { font-size: 24px; font-weight: 600; margin: 0; }
.site-title a { color: var(--text); }
.site-desc { color: var(--muted); font-size: 14px; margin: 4px 0 0; }
.post-list { list-style: none; padding: 0; margin: 0; }
.post-item { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 16px 20px; margin-bottom: 12px; }
.post-item h2 { font-size: 18px; margin: 0 0 6px; font-weight: 600; }
.post-item h2 a { color: var(--text); }
.post-meta { color: var(--muted); font-size: 13px; }
.pin { color: var(--accent); font-size: 12px; border: 1px solid var(--accent); border-radius: 4px; padding: 0 6px; margin-right: 6px; }
.post { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 28px 32px; }
.post h1 { font-size: 24px; margin: 0 0 8px; }
.post .post-meta { margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.post-content h1, .post-content h2, .post-content h3 { margin-top: 1.6em; }
.post-content img { max-width: 100%; height: auto; border-radius: 6px; }
.post-content pre { background: #f3f4f6; padding: 14px; border-radius: 6px; overflow-x: auto; }
.post-content code { background: #f3f4f6; padding: 1px 5px; border-radius: 4px; font-size: 0.92em; }
.post-content pre code { background: none; padding: 0; }
.post-content blockquote { border-left: 3px solid var(--border); margin: 0; padding-left: 16px; color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 60px 0; }
.back { display: inline-block; margin-bottom: 16px; font-size: 14px; }

/* 后台 */
.admin-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--border); padding-bottom: 14px; margin-bottom: 24px; }
.admin-head h1 { font-size: 20px; margin: 0; }
.admin-head .head-actions { display: flex; gap: 18px; align-items: center; font-size: 14px; }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.theme-form { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.theme-form select { padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; font-family: inherit; background: #fff; color: var(--text); }
.theme-note { font-size: 13px; color: var(--muted); }
.btn { display: inline-block; background: var(--accent); color: #fff; border: none; border-radius: 6px; padding: 8px 16px; font-size: 14px; cursor: pointer; }
.btn:hover { background: var(--accent-hover); color: #fff; text-decoration: none; }
.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #f3f4f6; color: var(--text); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.form-card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 24px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; margin-bottom: 6px; font-weight: 500; }
.field input[type=text], .field input[type=password], .field input[type=date], .field textarea, .field select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
}
.field textarea { min-height: 380px; font-family: ui-monospace, Menlo, Consolas, monospace; line-height: 1.6; resize: vertical; }
.field .check { display: flex; align-items: center; gap: 8px; }
.field .check input { width: auto; }
.row { display: flex; gap: 16px; }
.row .field { flex: 1; }
.actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.admin-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.admin-table th, .admin-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
.admin-table th { background: #f9fafb; font-weight: 600; }
.admin-table tr:last-child td { border-bottom: none; }
.upload-box { border: 1px dashed var(--border); border-radius: 6px; padding: 16px; margin-top: 8px; }
.upload-box input[type=file] { font-size: 13px; }
.upload-box.drag-over { border-color: var(--accent); background: #eff6ff; }
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
/* 单选卡片：内容类型 / 卡片图标 */
.radio-row { display: flex; gap: 10px; flex-wrap: wrap; }
.field label.radio-card { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; padding: 7px 14px; border: 1px solid var(--border); border-radius: 6px; background: #fff; cursor: pointer; font-size: 14px; }
.field label.radio-card input { margin: 0; }
.field label.radio-card:has(input:checked) { border-color: var(--accent); background: #eff6ff; color: var(--accent); }
.icon-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field label.icon-option { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 0; font-weight: 400; padding: 8px; border: 1px solid var(--border); border-radius: 6px; background: #fff; cursor: pointer; font-size: 12px; color: var(--muted); min-width: 76px; }
.field label.icon-option input { margin: 0; }
.field label.icon-option img { width: 36px; height: 36px; object-fit: contain; }
.field label.icon-option:has(input:checked) { border-color: var(--accent); background: #eff6ff; color: var(--accent); }
/* 正文简易编辑器 */
.editor-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.editor-tab { padding: 5px 12px; font-size: 13px; border: 1px solid var(--border); border-bottom: none; background: #f3f4f6; border-radius: 6px 6px 0 0; cursor: pointer; color: var(--muted); }
.editor-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.md-toolbar { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px; border: 1px solid var(--border); border-bottom: none; background: #f9fafb; }
.md-toolbar button { padding: 4px 10px; font-size: 13px; border: 1px solid var(--border); background: #fff; border-radius: 4px; cursor: pointer; color: var(--text); }
.md-toolbar button:hover { background: #eff6ff; border-color: var(--accent); color: var(--accent); }
.md-editor { min-height: 380px; max-height: 600px; overflow-y: auto; padding: 12px 14px; border: 1px solid var(--border); border-radius: 0 0 6px 6px; background: #fff; font-size: 14px; line-height: 1.7; outline: none; }
.md-editor h2 { font-size: 21px; margin: .7em 0 .3em; }
.md-editor h3 { font-size: 18px; margin: .6em 0 .3em; }
.md-editor p { margin: 0 0 .8em; }
.md-editor ul { padding-left: 1.6em; margin: 0 0 .8em; }
.md-editor img { max-width: 100%; max-height: 160px; border-radius: 6px; margin: .3em 0; }
.md-editor a { color: var(--accent); }
.login-card { max-width: 380px; margin: 80px auto; }
.footer { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; text-align: center; }
