/* ===========================================================
   Monkey Analyst — blog stylesheet
   =========================================================== */

:root {
  color-scheme: light;
  --bg: #fbfbf9;
  --surface: #ffffff;
  --text: #1b1d21;
  --text-soft: #3f444c;
  --muted: #6f7680;
  --border: #e5e4df;
  --border-strong: #d3d2cb;
  --accent: #1f6f5c;
  --accent-soft: #eaf4f0;
  --danger: #b4342b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 22, 26, .04), 0 8px 24px -12px rgba(20, 22, 26, .12);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --serif: Georgia, "Times New Roman", "Songti SC", "Noto Serif SC", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #131519;
    --surface: #191c21;
    --text: #e9e9e5;
    --text-soft: #c6c9cd;
    --muted: #959aa2;
    --border: #2a2e35;
    --border-strong: #3a3f47;
    --accent: #7fc9ad;
    --accent-soft: #1d2b27;
    --danger: #e58076;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -16px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

img { max-width: 100%; height: auto; }

.wrap {
  width: min(100% - 40px, 880px);
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  padding: 8px 14px;
  z-index: 99;
}
.skip:focus { left: 12px; top: 12px; }

/* ---------------- header ---------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 64px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  letter-spacing: -.01em;
  font-size: 16px;
}
.brand:hover { color: inherit; }

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  display: inline-grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1;
}

.nav {
  display: flex;
  gap: 18px;
  font-size: 14.5px;
  color: var(--muted);
  margin-left: auto;
}
.nav a { padding: 4px 0; position: relative; }
.nav a:hover { color: var(--text); }
.nav a.on { color: var(--text); }
.nav a.on::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.search input {
  width: 170px;
  padding: 7px 12px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: border-color .15s, width .2s;
}
.search input:focus {
  outline: none;
  border-color: var(--accent);
  width: 210px;
}

/* ---------------- hero / page head ---------------- */

.hero { padding: 56px 0 28px; }

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(30px, 5vw, 42px);
  line-height: 1.2;
  letter-spacing: -.02em;
  margin: 0 0 12px;
  font-weight: 600;
}

.hero-desc {
  margin: 0 0 10px;
  color: var(--text-soft);
  font-size: 17px;
}

.hero-meta {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  letter-spacing: .01em;
}

.page-head { padding: 44px 0 20px; }
.page-head h1 {
  font-family: var(--serif);
  font-size: clamp(24px, 3.4vw, 30px);
  margin: 0 0 6px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.page-sub { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------------- post list ---------------- */

.post-list { list-style: none; margin: 0; padding: 0; }

.post-item {
  border-top: 1px solid var(--border);
}
.post-item:first-child { border-top: none; }

.post-link {
  display: block;
  padding: 26px 4px 24px;
  border-radius: var(--radius-sm);
  transition: background .15s;
}
.post-link:hover { background: color-mix(in srgb, var(--surface) 60%, transparent); }
.post-link:hover .post-title { color: var(--accent); }

.post-title {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.4;
  margin: 0 0 8px;
  font-weight: 600;
  letter-spacing: -.01em;
  transition: color .15s;
}

.post-excerpt {
  margin: 0 0 12px;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.75;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12.5px;
}

.dot { opacity: .5; }

.chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  line-height: 1.7;
  letter-spacing: .01em;
}
.chip:hover { background: var(--accent); color: var(--bg); }
.chip.tiny { font-size: 11px; padding: 1px 8px; }

.empty {
  padding: 60px 0;
  text-align: center;
  color: var(--muted);
}
.empty a { color: var(--accent); text-decoration: underline; }

/* ---------------- pager ---------------- */

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 32px 0 56px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.pager-btn {
  padding: 8px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 13.5px;
  color: var(--text-soft);
  transition: all .15s;
}
.pager-btn:hover { border-color: var(--accent); color: var(--accent); }
.pager-btn.disabled { opacity: .38; pointer-events: none; }
.pager-info { color: var(--muted); font-size: 13px; }

/* ---------------- article ---------------- */

.article { padding: 48px 0 12px; }

.article-head { margin-bottom: 34px; }

.article-head h1 {
  font-family: var(--serif);
  font-size: clamp(27px, 4.4vw, 38px);
  line-height: 1.25;
  letter-spacing: -.02em;
  margin: 0 0 16px;
  font-weight: 600;
}

.article-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.draft-flag {
  display: inline-block;
  margin: 0 0 14px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #fdf0dc;
  color: #8a5a12;
  font-size: 12px;
  letter-spacing: .02em;
}
@media (prefers-color-scheme: dark) {
  .draft-flag { background: #33291a; color: #e0b978; }
}

.prose {
  font-size: 16.5px;
  line-height: 1.9;
  color: var(--text-soft);
}

.prose > *:first-child { margin-top: 0; }

.prose h2 {
  font-family: var(--serif);
  font-size: 23px;
  color: var(--text);
  margin: 2.1em 0 .7em;
  font-weight: 600;
  letter-spacing: -.01em;
  scroll-margin-top: 80px;
}

.prose h3 {
  font-size: 18.5px;
  color: var(--text);
  margin: 1.8em 0 .6em;
  font-weight: 650;
  scroll-margin-top: 80px;
}

.prose h4 {
  font-size: 16.5px;
  color: var(--text);
  margin: 1.6em 0 .5em;
  font-weight: 650;
}

.prose p { margin: 0 0 1.15em; }

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.prose a:hover { text-decoration-thickness: 2px; }

.prose ul, .prose ol { margin: 0 0 1.15em; padding-left: 1.4em; }
.prose li { margin: .35em 0; }
.prose li::marker { color: var(--muted); }

.prose blockquote {
  margin: 1.6em 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  font-style: normal;
}
.prose blockquote p:last-child { margin-bottom: 0; }

.prose code {
  font-family: var(--mono);
  font-size: .875em;
  background: color-mix(in srgb, var(--text) 7%, transparent);
  padding: .16em .42em;
  border-radius: 5px;
  color: var(--text);
  word-break: break-word;
}

.prose pre {
  background: #1c2027;
  color: #e6e8ea;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.7;
  margin: 1.5em 0;
  border: 1px solid rgba(255, 255, 255, .06);
}
.prose pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
  border-radius: 0;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6em 0;
  font-size: 14.5px;
  display: block;
  overflow-x: auto;
}
.prose th, .prose td {
  border: 1px solid var(--border);
  padding: 9px 13px;
  text-align: left;
}
.prose th {
  background: color-mix(in srgb, var(--text) 4%, transparent);
  font-weight: 600;
  color: var(--text);
}

.prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.4em 0;
}

.prose img {
  border-radius: var(--radius-sm);
  margin: 1.4em 0;
  box-shadow: var(--shadow);
}

/* ---------------- post nav / admin bar ---------------- */

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 48px 0 0;
  padding: 26px 0 56px;
  border-top: 1px solid var(--border);
}

.post-nav-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .15s, background .15s;
}
.post-nav-item:hover { border-color: var(--accent); }
.post-nav-item.right { text-align: right; }
.post-nav-label { font-size: 12px; color: var(--muted); }
.post-nav-title { font-size: 14.5px; color: var(--text); }

.article-admin { padding: 0 0 56px; }

/* ---------------- archive / tags ---------------- */

.archive-group { margin-bottom: 34px; }

.archive-year {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.archive-list { list-style: none; margin: 0; padding: 0; }
.archive-list li { border-bottom: 1px dashed var(--border); }
.archive-list li:last-child { border-bottom: none; }
.archive-list a {
  display: flex;
  gap: 16px;
  align-items: baseline;
  padding: 10px 2px;
  transition: color .12s;
}
.archive-list a:hover .archive-title { color: var(--accent); }
.archive-date { flex: 0 0 52px; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.archive-title { font-size: 15.5px; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 10px; padding: 8px 0 56px; }

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 15px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 14px;
  transition: all .15s;
}
.tag-pill:hover { border-color: var(--accent); color: var(--accent); }
.tag-count {
  font-size: 11.5px;
  color: var(--muted);
  background: color-mix(in srgb, var(--text) 6%, transparent);
  padding: 0 7px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.about-body { padding-bottom: 56px; }

/* ---------------- error ---------------- */

.error-page {
  padding: 110px 0 120px;
  text-align: center;
}
.error-code {
  font-family: var(--serif);
  font-size: 68px;
  line-height: 1;
  margin: 0 0 14px;
  color: var(--border-strong);
  letter-spacing: -.03em;
}
.error-message { color: var(--muted); margin: 0 0 26px; }

/* ---------------- footer ---------------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 30px 0 44px;
  margin-top: 20px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-line { margin: 0; font-size: 13px; color: var(--muted); }
.footer-line.dim { margin-top: 4px; font-size: 13px; color: var(--text-soft); }
.footer-line a:hover { color: var(--accent); }

.footer-links { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); }

/* ---------------- buttons & forms ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
  transition: all .15s;
  background: none;
  color: var(--text);
  white-space: nowrap;
}
.btn.primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.btn.primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost {
  border-color: var(--border-strong);
  color: var(--text-soft);
}
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.small { padding: 6px 13px; font-size: 13px; }

.btn:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.inline-form { display: inline; }

.field { display: block; margin-bottom: 18px; }
.field > span {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 7px;
  letter-spacing: .01em;
}
.hint { font-style: normal; color: var(--muted); opacity: .8; font-size: 12px; }

.field input[type="text"],
.field input[type="password"],
.field input[type="number"],
.field input[type="search"],
.field select,
.field textarea {
  width: 100%;
  padding: 10px 13px;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.field textarea { resize: vertical; line-height: 1.75; }

/* ---------------- flashes ---------------- */

.flashes { margin: 22px 0 0; }

.flash {
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.flash.ok {
  border-color: #b7ddc9;
  background: #eef8f2;
  color: #1c6b46;
}
.flash.error {
  border-color: #e8bdb8;
  background: #fdf1f0;
  color: var(--danger);
}
@media (prefers-color-scheme: dark) {
  .flash.ok { border-color: #2c4a3a; background: #16241c; color: #86d6a8; }
  .flash.error { border-color: #4a2c2a; background: #241716; color: var(--danger); }
}

/* ---------------- login ---------------- */

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 30px 20px;
  background:
    radial-gradient(720px 420px at 50% -10%, color-mix(in srgb, var(--accent) 10%, transparent), transparent),
    var(--bg);
}

.login-card {
  width: min(100%, 380px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 34px 30px 26px;
  box-shadow: var(--shadow);
}

.login-brand { margin-bottom: 16px; }

.login-card h1 {
  font-family: var(--serif);
  font-size: 23px;
  margin: 0 0 4px;
  font-weight: 600;
}
.login-sub { margin: 0 0 22px; color: var(--muted); font-size: 13.5px; }

.login-form label { display: block; margin-bottom: 15px; }
.login-form label span {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 6px;
}
.login-form input {
  width: 100%;
  padding: 10px 13px;
  font-size: 14.5px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}
.login-form input:focus { outline: none; border-color: var(--accent); }
.login-form .btn { width: 100%; margin-top: 6px; }

.login-foot { margin: 18px 0 0; font-size: 12.5px; color: var(--muted); }

/* ---------------- admin shell ---------------- */

.admin-body { background: var(--bg); }

.admin-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.admin-header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 60px;
  flex-wrap: wrap;
}

.admin-nav {
  display: flex;
  gap: 16px;
  margin-left: auto;
  font-size: 14px;
  color: var(--muted);
}
.admin-nav a:hover { color: var(--text); }

.admin-main { padding-bottom: 60px; }

.admin-body .wrap { width: min(100% - 40px, 1180px); }

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 26px 0 22px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-num {
  font-size: 25px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.stat-label { font-size: 12.5px; color: var(--muted); }

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar-search { display: flex; gap: 8px; flex: 1; min-width: 220px; }
.toolbar-search input {
  flex: 1;
  padding: 8px 13px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
}
.toolbar-search input:focus { outline: none; border-color: var(--accent); }

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--text) 2.5%, transparent);
}
.table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: color-mix(in srgb, var(--text) 1.8%, transparent); }

.table-title { font-weight: 550; color: var(--text); }
.table-title:hover { color: var(--accent); }
.table-tags { display: flex; gap: 5px; margin-top: 5px; flex-wrap: wrap; }

.col-status { width: 96px; }
.col-date { width: 118px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.col-num { width: 72px; color: var(--muted); font-variant-numeric: tabular-nums; }
.col-ops { width: 168px; white-space: nowrap; }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  background: color-mix(in srgb, var(--text) 7%, transparent);
  color: var(--muted);
}
.badge.ok { background: var(--accent-soft); color: var(--accent); }

.link-sm {
  font-size: 13px;
  color: var(--muted);
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  cursor: pointer;
  margin-right: 10px;
}
.link-sm:hover { color: var(--accent); }
.link-sm.danger:hover { color: var(--danger); }

/* ---------------- editor ---------------- */

.editor, .settings-form { margin-top: 26px; }

.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.editor-head h1 {
  font-family: var(--serif);
  font-size: 24px;
  margin: 0;
  font-weight: 600;
}
.editor-actions { display: flex; gap: 9px; align-items: center; }

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 22px;
  align-items: start;
}

.editor-main, .editor-side {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}

.editor-main .field:last-of-type { margin-bottom: 8px; }

#content {
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.85;
  min-height: 440px;
}

.editor-foot {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  padding-top: 4px;
}

.side-meta {
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 12px;
  font-size: 12.5px;
  color: var(--muted);
}
.side-meta p { margin: 0 0 3px; }

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.settings-grid .field.full { grid-column: 1 / -1; }

.settings-form.narrow { max-width: 480px; }
.settings-form.narrow .field {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
}

/* ---------------- 图片上传 ---------------- */

.md-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.md-toolbar-hint { font-size: 12px; color: var(--muted); }
.md-toolbar-hint kbd {
  font-family: var(--mono);
  font-size: 11px;
  padding: 1px 5px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-soft);
}

.md-toolbar-status { font-size: 12.5px; color: var(--muted); margin-left: auto; }
.md-toolbar-status.busy { color: var(--accent); }
.md-toolbar-status.ok { color: #1c6b46; }
.md-toolbar-status.err { color: var(--danger); }

@media (prefers-color-scheme: dark) {
  .md-toolbar-status.ok { color: #7fc9ad; }
}

.editor-main.drop-active {
  outline: 2px dashed var(--accent);
  outline-offset: -10px;
  background: var(--accent-soft);
}

.asset-summary { font-size: 13px; color: var(--muted); }

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.asset {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.asset-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.asset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.asset figcaption { padding: 10px 12px 12px; }

.asset-meta { font-size: 12px; color: var(--muted); }
.asset-refs { font-size: 12px; color: var(--text-soft); margin-top: 2px; }
.asset-refs.muted { color: var(--muted); opacity: .75; }

.asset-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font-size: 12.5px;
}
.asset-actions .link-sm { font-size: 12.5px; margin-right: 0; }

.asset-empty {
  margin-top: 22px;
  padding: 34px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-soft);
}
.asset-empty p { margin: 0 0 6px; }

/* ---------------- 编辑器工具栏 ---------------- */

.ed-box {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
  margin-bottom: 16px;
}

.ed-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 7px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.ed-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }

.ed-btn {
  min-width: 30px;
  height: 28px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  color: var(--text-soft);
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1;
  cursor: pointer;
  transition: all .12s;
}
.ed-btn:hover {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.ed-btn.accent { color: var(--accent); }
.ed-btn:disabled { opacity: .45; cursor: not-allowed; }

.ed-sep {
  width: 1px;
  height: 16px;
  margin: 0 5px;
  background: var(--border);
}

.ed-tabs {
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.ed-tab {
  padding: 4px 13px;
  border: none;
  border-radius: 999px;
  background: none;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
}
.ed-tab.on { background: var(--text); color: var(--bg); }

.ed-panes textarea,
.ed-preview {
  display: block;
  width: 100%;
  min-height: 460px;
  max-height: 760px;
  padding: 16px 18px;
  border: none;
  outline: none;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  line-height: 1.85;
}
.ed-panes textarea { font-family: var(--mono); resize: vertical; }
.ed-preview { overflow-y: auto; }
.ed-preview .poll-form { pointer-events: none; }  /* 预览里点投票不产生真实票 */

.ed-status {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 12px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.ed-hint { font-size: 12px; color: var(--muted); }

.ed-help { margin: 0 0 12px; }
.ed-help summary {
  cursor: pointer;
  font-size: 12.5px;
  color: var(--muted);
}
.ed-help summary:hover { color: var(--accent); }
.ed-help-body p {
  margin: 12px 0 5px;
  font-size: 12.5px;
  color: var(--text-soft);
}
.ed-help-body pre {
  margin: 0;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-soft);
}

/* ---------------- 正文组件：投票 / 提示 / 折叠 ---------------- */

.poll {
  margin: 28px 0;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.poll-q {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.poll-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.poll-opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14.5px;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: border-color .15s, color .15s;
}
.poll-opt:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.poll-opt:disabled { cursor: default; }

.poll-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
  background: var(--accent-soft);
  opacity: 0;
  transition: width .5s ease, opacity .3s;
}
.poll.revealed .poll-fill { opacity: 1; }

.poll-label, .poll-pct { position: relative; z-index: 1; }

.poll-pct {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--muted);
  opacity: 0;
  transition: opacity .3s;
  font-variant-numeric: tabular-nums;
}
.poll.revealed .poll-pct { opacity: 1; }

.poll-row.mine .poll-opt { border-color: var(--accent); }
.poll-row.mine .poll-label::after { content: " ✓"; color: var(--accent); }

.poll-meta { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); }
.poll-mine { color: var(--accent); }

.callout {
  margin: 26px 0;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--muted);
  border-radius: var(--radius-sm);
}
.callout-title { margin: 0 0 6px; font-size: 14px; font-weight: 600; }
.callout-body > :first-child { margin-top: 0; }
.callout-body > :last-child { margin-bottom: 0; }
.callout-note { border-left-color: var(--accent); }
.callout-tip { border-left-color: #5b86c9; }
.callout-warn { border-left-color: #cf8b3c; }

.fold {
  margin: 26px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.fold summary {
  padding: 12px 16px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
}
.fold summary:hover { color: var(--accent); }
.fold-body {
  padding: 0 16px 14px;
  border-top: 1px solid var(--border);
}
.fold-body > :first-child { margin-top: 14px; }

/* ---------------- responsive ---------------- */

@media (max-width: 860px) {
  .editor-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .wrap { width: calc(100% - 32px); }
  .header-inner { gap: 14px; padding: 10px 0; }
  .nav { order: 3; width: 100%; margin-left: 0; gap: 16px; font-size: 14px; }
  .search { order: 2; margin-left: auto; }
  .search input { width: 130px; }
  .search input:focus { width: 150px; }
  .hero { padding: 36px 0 20px; }
  .post-title { font-size: 20px; }
  .article { padding-top: 32px; }
  .prose { font-size: 16px; }
  .post-nav { grid-template-columns: 1fr; }
  .col-date, .col-num { display: none; }
  .col-ops { width: auto; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

@media print {
  .site-header, .site-footer, .post-nav, .article-admin, .pager { display: none; }
  .prose pre { background: #f4f4f4; color: #111; }
}
