:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #23262b;
  --muted: #6b7280;
  --border: #e3e6ea;
  --accent: #1f6f8b;
  --accent-soft: #e8f3f7;
  --code-bg: #f3f5f7;
  --radius: 12px;
}
:root[data-theme="dark"] {
  --bg: #16191d;
  --surface: #1e2228;
  --text: #e6e8eb;
  --muted: #9aa3ad;
  --border: #30363d;
  --accent: #79c6dd;
  --accent-soft: #213743;
  --code-bg: #242a31;
  --radius: 12px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.75 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.muted, .empty { color: var(--muted); }

.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; gap: 18px; min-height: 62px; flex-wrap: wrap; }
.brand { font-size: 18px; font-weight: 600; color: var(--text); letter-spacing: .02em; }
.nav { display: flex; gap: 16px; flex-wrap: wrap; }
.nav a { color: var(--muted); font-size: 14px; }
.nav a:hover { color: var(--accent); }
.search { margin-left: auto; }
.search input {
  width: 180px; padding: 7px 12px; border: 1px solid var(--border);
  border-radius: 20px; background: var(--bg); color: var(--text); font-size: 13px; outline: none;
}
.search input:focus { border-color: var(--accent); }
.theme-btn, .react, button[type="submit"], #upload-btn {
  padding: 7px 14px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font-size: 13px; cursor: pointer;
}
button[type="submit"] { background: var(--accent); border-color: var(--accent); color: #fff; }
button[type="submit"]:hover { opacity: .9; }
.link-danger { background: none !important; border: none !important; color: #b4524d !important; padding: 0 !important; cursor: pointer; font-size: 13px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 32px; padding-top: 32px; padding-bottom: 48px; }
.main { min-width: 0; }

.intro { padding: 22px 0 26px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.intro h1 { margin: 0 0 6px; font-size: 26px; }
.intro p, .list-head p { margin: 0; color: var(--muted); font-size: 14px; }
.list-head { padding: 8px 0 22px; }
.list-head h1 { font-size: 24px; margin: 0 0 4px; }

.card { padding: 22px 0; border-bottom: 1px solid var(--border); position: relative; }
.card h2 { margin: 0 0 8px; font-size: 20px; line-height: 1.45; }
.card h2 a { color: var(--text); }
.card h2 a:hover { color: var(--accent); }
.summary { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.badge { display: inline-block; margin-bottom: 6px; padding: 1px 8px; font-size: 12px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); }
.meta { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: 12.5px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; font-size: 13px; }
.card-tags a { color: var(--muted); }

.pager { display: flex; gap: 8px; flex-wrap: wrap; padding: 26px 0; }
.pager a, .pager .current { padding: 5px 11px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.pager .current { background: var(--accent); border-color: var(--accent); color: #fff; }

.sidebar .widget { margin-bottom: 26px; }
.sidebar h3 { margin: 0 0 10px; font-size: 14px; color: var(--muted); font-weight: 600; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: 13.5px; border-bottom: 1px dashed var(--border); }
.sidebar li a { color: var(--text); }
.sidebar li span { color: var(--muted); font-size: 12px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; }

.article { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 30px 34px; }
.article-head h1 { margin: 6px 0 12px; font-size: 28px; line-height: 1.4; }
.collection { margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.cover { width: 100%; height: auto; margin: 20px 0; border-radius: 8px; }
.prose { font-size: 15.5px; line-height: 1.85; overflow-wrap: break-word; }
.prose h1, .prose h2, .prose h3 { margin: 1.6em 0 .6em; line-height: 1.4; }
.prose h2 { font-size: 21px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.prose h3 { font-size: 17px; }
.prose p { margin: 0 0 1em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose blockquote { margin: 1.2em 0; padding: 4px 16px; border-left: 3px solid var(--accent); background: var(--accent-soft); color: var(--muted); }
.prose table { width: 100%; border-collapse: collapse; margin: 1.2em 0; font-size: 14px; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
.prose th { background: var(--code-bg); }
.prose img { max-width: 100%; height: auto; border-radius: 6px; }
.prose :not(pre) > code { padding: 2px 5px; background: var(--code-bg); border-radius: 4px; font-size: 13px; }
.prose pre { padding: 14px 16px; background: var(--code-bg); border-radius: 8px; overflow-x: auto; font-size: 13px; line-height: 1.6; }
.prose .toc { background: var(--code-bg); border-radius: 8px; padding: 12px 18px; margin: 0 0 1.5em; }
.prose .toc ul { margin: 0; }
.codehilite .k, .codehilite .kd { color: #a24b8e; }
.codehilite .s, .codehilite .s1 { color: #2f8a5b; }
.codehilite .c, .codehilite .c1 { color: var(--muted); }
.codehilite .nf, .codehilite .nb { color: var(--accent); }
.article-tags { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border); }

.actions { display: flex; gap: 12px; margin: 24px 0; }
.react.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.post-nav { display: flex; justify-content: space-between; gap: 20px; padding-top: 18px; border-top: 1px solid var(--border); font-size: 13.5px; }

.comments { margin-top: 32px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px 30px; }
.comments h2 { margin: 0 0 18px; font-size: 19px; }
.comments h2 small { color: var(--muted); font-size: 13px; }
.comment { padding: 14px 0; border-bottom: 1px solid var(--border); }
.comment-head { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.comment-head strong { font-size: 14px; }
.comment-head time, .floor { color: var(--muted); }
.comment-body { white-space: pre-wrap; overflow-wrap: break-word; margin: 8px 0; font-size: 14px; }
.reply-to { margin: 4px 0; color: var(--muted); font-size: 12.5px; }
.reply-btn { border: none; background: none; color: var(--muted); font-size: 12.5px; cursor: pointer; padding: 0; }
.reply-btn:hover { color: var(--accent); }
.comment-form { margin-top: 22px; }
.comment-form .row, .editor .row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.comment-form .row input { flex: 1 1 160px; }
.comment-form textarea, .editor input, .editor select, .editor textarea, .login-form input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); font: inherit; font-size: 14px; outline: none;
}
.comment-form textarea:focus, .editor textarea:focus, .editor input:focus { border-color: var(--accent); }
.comment-form button { margin-top: 12px; }
.hp { position: absolute !important; left: -9999px !important; width: 1px !important; height: 1px !important; }
.reply-hint { margin: 0 0 8px; font-size: 13px; color: var(--accent); }
.notice { padding: 9px 14px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 13.5px; }
.notice.ok { color: #2f8a5b; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 26px; margin-bottom: 24px; }
.panel h2 { margin: 0 0 18px; font-size: 18px; }
.panel.narrow { max-width: 420px; }
.page-title { margin: 0 0 4px; font-size: 24px; }
.hint { margin: 0 0 22px; color: var(--muted); font-size: 13px; }
.editor label, .login-form label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.editor label > input, .editor label > select, .editor label > textarea, .login-form label > input { margin-top: 5px; }
.editor textarea { resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.upload { display: flex; align-items: center; gap: 10px; margin: 8px 0 16px; font-size: 13px; }
.checks { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 18px; }
.checks label { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--text); }
.checks input { width: auto; }
.form-actions { display: flex; align-items: center; gap: 16px; font-size: 13px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.table th { color: var(--muted); font-weight: 500; }
.ops { display: flex; gap: 12px; align-items: center; }
.ops form { margin: 0; }
.pending-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.pending-item p { margin: 0 0 8px; font-size: 13.5px; }
.pending-item form { display: inline-block; margin-right: 8px; }
.pending-item button[type="submit"] { padding: 4px 10px; font-size: 12px; }

.site-footer { border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 12.5px; }
.site-footer .wrap { padding-top: 20px; padding-bottom: 20px; }
.site-footer p { margin: 0 0 4px; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; gap: 20px; }
  .sidebar { order: 2; }
  .article, .comments, .panel { padding: 20px 18px; }
  .search input { width: 130px; }
  .nav { gap: 12px; }
}
