:root {
  --bg: #fafafa;
  --card: #ffffff;
  --text: #1f2328;
  --muted: #6e7781;
  --accent: #0969da;
  --border: #d0d7de;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  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;
}

.wrap { max-width: 760px; margin: 0 auto; padding: 32px 20px 80px; }

header.site {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px;
}

header.site h1 { font-size: 22px; margin: 0; }
header.site h1 a { color: var(--text); text-decoration: none; }
header.site .sub { color: var(--muted); font-size: 14px; }

.btn {
  display: inline-block;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  transition: background 0.15s;
}
.btn:hover { background: #f3f4f6; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #0858b0; }
.btn.danger { color: #cf222e; }
.btn.danger:hover { background: #fdf1f2; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.list { display: flex; flex-direction: column; gap: 12px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

a.post { text-decoration: none; color: inherit; display: block; }
a.post:hover .card { border-color: var(--accent); }
.post .title { font-size: 17px; font-weight: 600; }
.post .meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.post .preview { color: var(--muted); font-size: 14px; margin-top: 6px; white-space: pre-line; }

.empty { text-align: center; color: var(--muted); padding: 60px 0; }

.article .date { color: var(--muted); font-size: 13px; margin: -12px 0 20px; }
.article .ops { margin: 0 0 20px; display: flex; gap: 8px; }

.markdown h1, .markdown h2, .markdown h3 { margin: 1.4em 0 0.6em; line-height: 1.3; }
.markdown h1 { font-size: 1.6em; padding-bottom: 0.3em; border-bottom: 1px solid var(--border); }
.markdown h2 { font-size: 1.35em; }
.markdown p, .markdown ul, .markdown ol { margin: 0.7em 0; }
.markdown code {
  background: #f0f2f5;
  border-radius: 4px;
  padding: 0.15em 0.4em;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9em;
}
.markdown pre {
  background: #0d1117;
  color: #e6edf3;
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
}
.markdown pre code { background: none; color: inherit; padding: 0; }
.markdown a { color: var(--accent); }
.markdown img { max-width: 100%; border-radius: 6px; }
.markdown blockquote {
  margin: 0.7em 0;
  padding: 2px 16px;
  border-left: 4px solid var(--border);
  color: var(--muted);
  background: #f6f8fa;
  border-radius: 0 6px 6px 0;
}
.markdown table { border-collapse: collapse; margin: 0.7em 0; }
.markdown th, .markdown td { border: 1px solid var(--border); padding: 6px 12px; }
.markdown hr { border: none; border-top: 1px solid var(--border); margin: 1.6em 0; }

/* 编辑器 */
.editor label { display: block; font-size: 14px; color: var(--muted); margin: 14px 0 6px; }
.editor input[type="text"], .editor .title-input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 16px;
  outline: none;
}
.editor input[type="text"]:focus, .editor .title-input:focus { border-color: var(--accent); }

.wrap.wide { max-width: 1200px; }
.head-ops { display: flex; align-items: center; gap: 10px; }
.draft-hint { color: var(--accent); font-size: 13px; }

.editor { padding: 0; overflow: hidden; }

.editor-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  background: #f6f8fa;
  flex-wrap: wrap;
}
.tb {
  min-width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  padding: 0 6px;
}
.tb:hover { background: #e6e9ee; }
.tb-sep { width: 1px; height: 20px; background: var(--border); margin: 0 6px; }

.editor-body { display: flex; height: 60vh; min-height: 380px; }
.pane { flex: 1; position: relative; display: flex; flex-direction: column; }
.pane + .pane { border-left: 1px solid var(--border); }
.pane textarea {
  flex: 1;
  width: 100%;
  border: none;
  border-radius: 0;
  padding: 14px 16px;
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  font-size: 14px;
  line-height: 1.7;
  outline: none;
  resize: none;
  background: var(--card);
}
.preview-pane { background: var(--card); }
.pane-title {
  padding: 6px 16px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: #f6f8fa;
}
.preview-pane .markdown { flex: 1; overflow-y: auto; padding: 14px 18px; }
.preview-pane .empty-tip { color: var(--muted); }

.drop-mask {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(9, 105, 218, 0.08);
  border: 2px dashed var(--accent);
  border-radius: 8px;
  color: var(--accent);
  font-size: 15px;
  pointer-events: none;
  z-index: 2;
}
.drop-mask.show { display: flex; }

.editor-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: #f6f8fa;
}
.editor-foot .title-input { flex: 1; }
.spacer { flex: 1; }
.editor-foot .hint { color: var(--muted); font-size: 13px; white-space: nowrap; }

.editor-tags {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: #f6f8fa;
}
.editor-tags label { font-size: 14px; color: var(--muted); white-space: nowrap; }
.tag-editor {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  padding: 6px 10px;
}
.tag-editor input {
  border: none;
  outline: none;
  flex: 1;
  min-width: 120px;
  font-size: 14px;
  padding: 4px;
  background: transparent;
}

/* 标签 chip / 标签云 */
.chip {
  display: inline-block;
  background: #eef1f4;
  color: var(--text);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  text-decoration: none;
  vertical-align: middle;
}
a.chip:hover { background: #dde3ea; }
.chip b { cursor: pointer; color: var(--muted); margin-left: 4px; font-weight: normal; }
.chip b:hover { color: #cf222e; }

.post-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 14px; }

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.tag-chip {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.tag-chip:hover { border-color: var(--accent); }
.tag-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tag-chip em { font-style: normal; font-size: 11px; opacity: 0.7; margin-left: 2px; }

/* 上传/弹层 */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 35, 40, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.modal {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px 24px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal label { display: block; font-size: 14px; color: var(--muted); margin: 12px 0 6px; }
.modal input[type="text"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 15px;
  outline: none;
}
.modal input[type="text"]:focus { border-color: var(--accent); }
.preview-box {
  max-height: 40vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  background: #fff;
}
.modal-foot { margin-top: 16px; display: flex; justify-content: flex-end; }

.deploy-info { color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.deploy-steps { margin: 8px 0 0; padding-left: 20px; line-height: 1.8; }
.deploy-steps a { color: var(--accent); }
.deploy-log {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f6f8fa;
  padding: 10px 12px;
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  font-size: 13px;
  max-height: 180px;
  overflow-y: auto;
  color: var(--text);
}
.deploy-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.deploy-panel { min-height: 60px; }

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 26px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 20px;
}
.drop-zone.drag, .drop-zone:hover { border-color: var(--accent); background: #f0f6ff; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  background: #1f2328;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 10;
}
.toast.show { opacity: 1; }

@media (max-width: 768px) {
  .editor-body { height: auto; flex-direction: column; }
  .pane + .pane { border-left: none; border-top: 1px solid var(--border); }
  .pane textarea { min-height: 40vh; }
  .preview-pane .markdown { min-height: 30vh; }
  .editor-foot { flex-wrap: wrap; }
  .editor-foot .spacer { display: none; }
  .editor-foot .hint { order: 3; width: 100%; }
}
