:root {
  color-scheme: light dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.7;
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1d2433;
  --muted: #5f6b7a;
  --accent: #3b82f6;
  --border: #e5e9f2;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 20px;
  padding: 14px 28px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-search-wrap {
  flex: 1;
  min-width: 180px;
  max-width: 440px;
}

.topbar-search {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font: inherit;
  font-size: 0.9rem;
  background: var(--bg);
  color: var(--text);
  outline: none;
}

.topbar-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.nav-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal[hidden] {
  display: none;
}

.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
}

.modal-panel {
  position: relative;
  width: min(400px, calc(100vw - 32px));
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-head h2 {
  margin: 0;
  font-size: 1rem;
}

.modal-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-note {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.88rem;
}

.modal-field input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  background: var(--bg);
  color: var(--text);
}

.modal-field input:focus {
  outline: none;
  border-color: var(--accent);
}

.modal-err {
  margin: 0;
  color: #dc2626;
  font-size: 0.85rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
}

/* ---------- 专栏弹窗 ---------- */

.column-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  box-sizing: border-box;
}

.column-modal[hidden] {
  display: none !important;
}

.column-modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.column-modal-panel {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(88vh, 720px);
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.2);
  overflow: hidden;
}

.column-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.column-modal-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.column-modal-body {
  padding: 14px 16px 18px;
  overflow-y: auto;
  flex: 1;
}

.column-modal-err {
  color: #b91c1c;
  font-size: 0.85rem;
  margin: 0 0 10px;
}

.column-modal-intro-read {
  white-space: pre-wrap;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text);
  margin-bottom: 12px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.column-modal-intro-admin {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.column-modal-intro-admin[hidden] {
  display: none !important;
}

.column-modal-intro-edit-wrap[hidden] {
  display: none !important;
}

.column-modal-order-admin[hidden] {
  display: none !important;
}

.column-modal-intro-edit-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.column-modal-intro-edit {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.88rem;
  resize: vertical;
  min-height: 120px;
  background: var(--bg);
  color: var(--text);
}

.column-modal-hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0 0 8px;
}

.column-modal-posts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.column-modal-post-li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.column-modal-idx {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  min-width: 1.25rem;
  text-align: center;
}

.column-modal-post-link {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent);
  text-decoration: none;
}

.column-modal-post-link:hover {
  text-decoration: none;
  opacity: 0.88;
}

.column-modal-post-tools {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.column-modal-move {
  padding: 2px 8px !important;
  font-size: 0.75rem !important;
  min-width: 2rem;
}

.column-modal-post-empty {
  color: var(--muted);
  font-size: 0.88rem;
  padding: 12px;
  text-align: center;
  list-style: none;
  border: 1px dashed var(--border);
  border-radius: 10px;
}

.column-modal-order-admin {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.column-name-link {
  cursor: pointer;
  color: var(--accent);
  text-decoration: none;
}

.column-name-link:hover {
  opacity: 0.88;
}

.post-tag-col-link {
  cursor: pointer;
}

.post-tag-col-link:hover {
  opacity: 0.92;
}

.column-info-link {
  display: inline;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  text-align: left;
}

.column-info-link:hover {
  opacity: 0.88;
}

.post-card-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.post-admin-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  padding: 0 10px 4px;
}

.tiny-btn {
  padding: 4px 12px !important;
  font-size: 0.8rem !important;
  border-radius: 8px !important;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.danger-btn:hover {
  color: #dc2626 !important;
  border-color: rgba(220, 38, 38, 0.45) !important;
}

.column-pin-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  line-height: 0;
}

.brand-link {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.brand-link:hover {
  opacity: 0.88;
}

.brand-logo {
  display: block;
  height: 32px;
  width: auto;
  max-width: min(200px, 38vw);
  object-fit: contain;
  object-position: left center;
}

.nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}
.nav-link:hover {
  color: var(--accent);
}

.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.hero {
  background: linear-gradient(135deg, #eff4ff, #f8faff);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 28px;
  margin-bottom: 24px;
}

.hero-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
}

.page-title {
  margin: 0 0 24px;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 16px;
}

.post-list .post-item {
  display: block;
  background: var(--card);
  border-radius: 16px;
  padding: 22px 24px;
  text-decoration: none;
  color: var(--text);
  box-shadow: 0 10px 30px rgba(28, 39, 60, 0.05);
  border: 1px solid var(--border);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.post-list .post-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 40px rgba(28, 39, 60, 0.1);
}

.post-item h2 {
  margin: 0 0 6px;
  font-size: 1.2rem;
}

.post-item .meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 24px 0;
  list-style: none;
}

.editor {
  display: grid;
  gap: 18px;
  background: var(--card);
  padding: 24px;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(28, 39, 60, 0.05);
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  font-size: 0.9rem;
  color: var(--muted);
}

.field input,
.field textarea {
  font: inherit;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: inherit;
  width: 100%;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.field textarea {
  font-family: ui-monospace, "JetBrains Mono", "Cascadia Code", Menlo, monospace;
  min-height: 280px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

button.primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 10px;
  font: inherit;
  cursor: pointer;
}
button.primary:hover {
  filter: brightness(1.05);
}
button.primary:disabled {
  opacity: 0.6;
  cursor: progress;
}

button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 20px;
  border-radius: 10px;
  font: inherit;
  cursor: pointer;
}
button.secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.status {
  color: var(--muted);
  font-size: 0.9rem;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.editor-toolbar button {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

.tiptap-editor {
  min-height: 320px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--bg);
}

.tiptap-editor .ProseMirror {
  min-height: 280px;
  outline: none;
}

.tiptap-editor .ProseMirror p {
  margin: 0.6em 0;
}

.drafts {
  margin-top: 24px;
}

.post-list.compact .post-item {
  padding: 14px 16px;
}

.draft-list-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.draft-list-row .post-item {
  flex: 1;
  min-width: 0;
}

.draft-delete-btn {
  flex-shrink: 0;
  align-self: center;
}

.post {
  background: var(--card);
  padding: 32px;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(28, 39, 60, 0.05);
}

.post h1 {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

.post .meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.post .body {
  word-wrap: break-word;
  font-size: 1.05rem;
}

.post .body p {
  margin: 0.7em 0;
}

.post .body h2,
.post .body h3 {
  margin-top: 1.1em;
}

.post .body blockquote {
  border-left: 3px solid var(--accent);
  margin: 1em 0;
  padding: 0.2em 0 0.2em 0.8em;
  color: var(--muted);
}

/* 阅读页正文代码块（编辑器里已有样式，此处补齐避免看起来「没了」） */
.post .body pre,
.reader-post .body pre {
  background: #0f172a;
  color: #e6ecf5;
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 1em 0;
  font-size: 0.92rem;
  line-height: 1.55;
  tab-size: 4;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", monospace;
}

.post .body code,
.reader-post .body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", monospace;
  font-size: 0.9em;
  background: rgba(148, 163, 184, 0.18);
  padding: 1px 5px;
  border-radius: 4px;
}

.post .body pre code,
.reader-post .body pre code {
  display: block;
  background: transparent;
  padding: 0;
  font-size: inherit;
  color: inherit;
  white-space: inherit;
}

.back-link {
  display: inline-block;
  margin-top: 20px;
  color: var(--accent);
  text-decoration: none;
}
.back-link:hover {
  text-decoration: underline;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --card: #1a2238;
    --text: #e6ecf5;
    --muted: #94a3b8;
    --border: #243049;
  }
  .topbar {
    background: rgba(15, 23, 42, 0.85);
  }
  .hero {
    background: linear-gradient(135deg, #15203a, #182741);
  }
  .field input,
  .field textarea,
  .tiptap-editor {
    background: #0f1a31;
  }
}

/* ---------- 编辑器页（CSDN / 公众号 风格） ---------- */

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

.editor-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.editor-bar-left,
.editor-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.editor-brand-mark {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  border-radius: 8px;
}
.editor-brand-mark:hover {
  background: var(--border);
}
.editor-brand-logo {
  display: block;
  height: 28px;
  width: auto;
  max-width: min(160px, 36vw);
  object-fit: contain;
  object-position: left center;
}

.editor-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 6px 10px;
  border-radius: 8px;
}
.editor-back:hover {
  background: var(--border);
}

.editor-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
}

.editor-status {
  color: var(--muted);
  font-size: 0.88rem;
}
.editor-status[data-kind="ok"] {
  color: #16a34a;
}
.editor-status[data-kind="warn"] {
  color: #d97706;
}
.editor-status[data-kind="err"] {
  color: #dc2626;
}

.ghost-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font: inherit;
}
.ghost-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.05rem;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 6px;
}
.icon-btn:hover {
  color: var(--text);
  background: var(--border);
}

.editor-main {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 120px;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.editor-side {
  position: sticky;
  top: 78px;
}

.editor-side-card {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.editor-side-card h3 {
  margin: 0 0 12px;
  font-size: 0.95rem;
}

@media (max-width: 980px) {
  .editor-main {
    grid-template-columns: minmax(0, 1fr);
    padding: 24px 16px 80px;
  }
  .editor-side {
    position: static;
    order: 2;
  }
  .editor-side-card {
    max-height: none;
  }
}

@media (prefers-color-scheme: dark) {
  .editor-side-card {
    background: rgba(26, 34, 56, 0.78);
  }
}

.editor-canvas {
  background: var(--card);
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow: 0 18px 60px rgba(28, 39, 60, 0.06);
  padding: 28px 32px 24px;
  display: flex;
  flex-direction: column;
  min-height: 70vh;
}

.title-input {
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: clamp(1.6rem, 3.4vw, 2.2rem);
  font-weight: 700;
  color: var(--text);
  padding: 8px 0 16px;
  width: 100%;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}
.title-input::placeholder {
  color: var(--muted);
  font-weight: 600;
}
.title-input:focus {
  border-bottom-color: var(--border);
}

.post-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 20px;
  padding: 0 0 14px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.post-meta-field {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.post-meta-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.post-meta-field input[type="text"] {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  font-size: 0.92rem;
  background: var(--bg);
  color: var(--text);
  outline: none;
}

.post-meta-field input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.post-meta-field select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  font-size: 0.92rem;
  background: var(--bg);
  color: var(--text);
  outline: none;
  max-width: 100%;
}

.post-meta-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.post-meta-hint {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
  margin: 0;
}

.editor-page .editor-toolbar {
  position: sticky;
  top: 56px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 6px 0 18px;
  padding: 6px 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(28, 39, 60, 0.04);
}

.tb-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 0 6px;
  position: relative;
}
.tb-group + .tb-group::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 18%;
  bottom: 18%;
  width: 1px;
  background: var(--border);
}

.tb-spacer {
  flex: 1;
}

.editor-page .editor-toolbar button {
  height: 32px;
  min-width: 32px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.editor-page .editor-toolbar button .tb-text {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.editor-page .editor-toolbar button:hover {
  background: var(--bg);
  color: var(--text);
}
.editor-page .editor-toolbar button.is-active {
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent);
}
.editor-page .editor-toolbar button svg {
  display: block;
}

.editor-page .tiptap-editor {
  flex: 1;
  min-height: 60vh;
  border: none;
  background: transparent;
  padding: 8px 0;
  font-size: 1.05rem;
}

.editor-page .tiptap-editor .ProseMirror {
  min-height: 60vh;
  outline: none;
}
.editor-page .tiptap-editor .ProseMirror p {
  margin: 0.7em 0;
}
.editor-page .tiptap-editor .ProseMirror h1 {
  font-size: 1.8rem;
  margin: 1em 0 0.4em;
}
.editor-page .tiptap-editor .ProseMirror h2 {
  font-size: 1.4rem;
  margin: 1em 0 0.4em;
}
.editor-page .tiptap-editor .ProseMirror h3 {
  font-size: 1.15rem;
  margin: 0.9em 0 0.3em;
}
.editor-page .tiptap-editor .ProseMirror blockquote {
  border-left: 3px solid var(--accent);
  margin: 1em 0;
  padding: 0.2em 0 0.2em 0.8em;
  color: var(--muted);
}
.editor-page .tiptap-editor .ProseMirror pre {
  background: #0f172a;
  color: #e6ecf5;
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
}
.editor-page .tiptap-editor .ProseMirror code {
  background: rgba(148, 163, 184, 0.18);
  padding: 1px 5px;
  border-radius: 4px;
}
.editor-page .tiptap-editor .ProseMirror pre code {
  background: transparent;
  padding: 0;
}
.editor-page .tiptap-editor .ProseMirror a {
  color: var(--accent);
  text-decoration: underline;
}
.editor-page .tiptap-editor .ProseMirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  color: var(--muted);
  float: left;
  height: 0;
  pointer-events: none;
}

.editor-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.85rem;
}

.drawer {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 30;
}
.drawer.open {
  display: block;
}

.drawer-mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 92vw);
  background: var(--card);
  border-left: 1px solid var(--border);
  box-shadow: -20px 0 60px rgba(15, 23, 42, 0.18);
  padding: 18px 18px 32px;
  overflow-y: auto;
  transform: translateX(100%);
  animation: drawer-in 0.18s ease forwards;
}

@keyframes drawer-in {
  to {
    transform: translateX(0);
  }
}

.drawer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.drawer-head h2 {
  margin: 0;
  font-size: 1.1rem;
  flex: 1;
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 6px;
  font-weight: 600;
}
.badge-draft {
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
}
.badge-pub {
  background: rgba(16, 163, 74, 0.12);
  color: #15803d;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}

.badge-row .badge {
  margin-bottom: 0;
}

.badge-pin {
  background: rgba(59, 130, 246, 0.14);
  color: var(--accent);
}

.badge-col {
  background: rgba(147, 51, 234, 0.12);
  color: #7c3aed;
}

@media (prefers-color-scheme: dark) {
  .editor-bar {
    background: rgba(15, 23, 42, 0.9);
  }
  .editor-page .tiptap-editor .ProseMirror pre {
    background: #0b1226;
  }
  .editor-back:hover,
  .icon-btn:hover {
    background: rgba(255, 255, 255, 0.06);
  }
  .badge-draft {
    background: rgba(217, 119, 6, 0.18);
    color: #fbbf24;
  }
  .badge-pub {
    background: rgba(16, 163, 74, 0.18);
    color: #4ade80;
  }
}

@media (max-width: 720px) {
  .editor-bar {
    padding: 8px 12px;
  }
  .editor-bar-left .editor-status {
    display: none;
  }
  .editor-main {
    padding: 16px 12px 80px;
  }
  .editor-canvas {
    padding: 18px 18px 16px;
  }
  .editor-page .editor-toolbar {
    top: 50px;
  }
}

/* ---------- 首页 ---------- */

.home-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 40px 24px 60px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 28px;
  align-items: start;
}

.home-main {
  min-width: 0;
}

.home-side {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 20px;
}

.ai-chat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(28, 39, 60, 0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: min(640px, calc(100vh - 120px));
}

.ai-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.08),
    rgba(168, 85, 247, 0.06)
  );
}

.ai-chat-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-chat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  display: inline-block;
}

.ai-chat-status {
  font-size: 0.78rem;
  color: var(--muted);
}

.ai-chat-body {
  flex: 1;
  padding: 10px 12px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.ai-msg {
  display: inline-block;
  width: fit-content;
  max-width: 75%;
  /* 与 .ai-chat-input-shell + textarea 的视觉密度对齐（略紧于原先 8px 12px） */
  padding: 6px 14px;
  border-radius: 4px;
  line-height: 1.45;
  font-size: 0.94rem;
  white-space: pre-wrap;
  word-break: break-word;
  text-align: left;
  box-sizing: border-box;
}

.ai-msg-welcome {
  align-self: flex-start;
  /* 静态 HTML 若换行缩进，pre-wrap 会把空白算进宽度；欢迎语单行，与动态消息视觉一致 */
  white-space: normal;
}

.ai-msg.from-bot {
  align-self: flex-start;
}

.ai-msg.from-user {
  align-self: flex-end;
}

.ai-msg.from-bot,
.ai-msg.from-user,
.ai-msg.ai-msg-welcome {
  background: #95ec69;
  color: #111;
  border: none;
}

.ai-chat-tip {
  align-self: center;
  color: var(--muted);
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
}

.ai-chat-input {
  border-top: 1px solid var(--border);
  padding: 10px 12px 12px;
  background: var(--card);
}

.ai-chat-input-shell {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 6px 6px 6px 14px;
  background: var(--bg);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ai-chat-input-shell:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.ai-chat-input textarea {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.94rem;
  line-height: 1.45;
  padding: 8px 0;
  max-height: 132px;
  overflow-y: hidden;
  display: block;
  min-height: 22px;
}

.ai-chat-send {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease, opacity 0.15s ease;
  padding: 0;
}

.ai-chat-send svg {
  width: 16px;
  height: 16px;
}

.ai-chat-send:hover:not(:disabled) {
  background: #1d4ed8;
  transform: scale(1.05);
}

.ai-chat-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ai-chat-hint {
  margin: 6px 4px 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.3;
}

/* ---------- 首页 · 专栏（AI 下方） ---------- */

.columns-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 10px 34px rgba(28, 39, 60, 0.05);
  padding: 14px 16px 16px;
}

.columns-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding: 0 2px;
}

.columns-head h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
}

.columns-count {
  font-size: 0.78rem;
  color: var(--muted);
}

.columns-admin {
  display: none !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 2px 12px;
}

.columns-admin.columns-admin-visible {
  display: flex !important;
}

.columns-admin input[type="text"] {
  flex: 1;
  min-width: 120px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 10px;
  font: inherit;
  font-size: 0.86rem;
  background: var(--bg);
  color: var(--text);
}

.columns-admin input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.column-del-btn {
  padding: 4px 10px !important;
  font-size: 0.75rem !important;
  border-radius: 8px !important;
  color: #b91c1c !important;
}

.column-del-btn:hover {
  background: rgba(185, 28, 28, 0.08);
}

.columns-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
}

.columns-list .empty {
  color: var(--muted);
  font-size: 0.88rem;
  padding: 12px 6px;
  text-align: center;
}

.column-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.column-item.column-pinned {
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.06);
}

.column-name {
  font-weight: 600;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.column-count {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.column-pin {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(59, 130, 246, 0.12);
  padding: 2px 8px;
  border-radius: 999px;
}

.column-pin-btn {
  padding: 4px 10px !important;
  font-size: 0.75rem !important;
  border-radius: 8px !important;
}

.columns-more {
  width: 100%;
  margin-top: 12px;
  text-align: center;
}

@media (max-width: 1080px) {
  .home-container {
    grid-template-columns: minmax(0, 1fr);
    max-width: 880px;
  }
  .home-side {
    position: static;
  }
  .ai-chat-card {
    height: 520px;
  }
}

@media (prefers-color-scheme: dark) {
  .ai-chat-head {
    background: linear-gradient(
      135deg,
      rgba(59, 130, 246, 0.18),
      rgba(168, 85, 247, 0.12)
    );
  }
  .ai-msg.from-bot,
  .ai-msg.from-user,
  .ai-msg.ai-msg-welcome {
    background: rgba(149, 236, 105, 0.88);
    color: #0f172a;
    border: none;
  }
  .ai-chat-tip {
    background: rgba(148, 163, 184, 0.18);
  }
  .columns-card {
    background: rgba(26, 34, 56, 0.55);
  }
  .column-item {
    background: rgba(15, 23, 42, 0.4);
  }
}

.profile-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 32px;
  box-shadow: 0 18px 50px rgba(28, 39, 60, 0.06);
  margin-bottom: 36px;
  position: relative;
  overflow: hidden;
}

.profile-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.12), transparent 50%),
    radial-gradient(at 100% 100%, rgba(168, 85, 247, 0.08), transparent 50%);
  pointer-events: none;
}

.profile-avatar {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--card);
  box-shadow: 0 6px 18px rgba(28, 39, 60, 0.12);
}

.profile-info {
  position: relative;
}

.profile-name {
  margin: 0 0 6px;
  font-size: 1.5rem;
  font-weight: 700;
}

.profile-bio {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.98rem;
}

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.profile-tag {
  display: inline-block;
  font-size: 0.78rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent);
  font-weight: 600;
}

.profile-write {
  position: relative;
  white-space: nowrap;
  text-decoration: none;
  align-self: center;
  padding: 10px 18px;
}

.posts-section {
  margin-top: 8px;
}

.posts-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
  padding: 0 4px;
}

.posts-title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  position: relative;
  padding-left: 14px;
}
.posts-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 4px;
  border-radius: 3px;
  background: var(--accent);
}

.posts-count {
  color: var(--muted);
  font-size: 0.9rem;
}

.post-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.post-card {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 18px 22px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  text-decoration: none;
  color: var(--text);
  box-shadow: 0 6px 20px rgba(28, 39, 60, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.post-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(28, 39, 60, 0.08);
  border-color: rgba(59, 130, 246, 0.4);
}

.post-card-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
  border-right: 1px solid var(--border);
  color: var(--muted);
  line-height: 1.1;
}
.post-card-day {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}
.post-card-month {
  font-size: 0.72rem;
  margin-top: 4px;
}

.post-card-content {
  min-width: 0;
}

.post-card-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.post-card-title-row .post-card-title {
  margin: 0;
  flex: 1;
  min-width: 120px;
}

.post-tag {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.3;
}

.post-tag-pin {
  background: rgba(59, 130, 246, 0.14);
  color: var(--accent);
}

.post-tag-col {
  background: rgba(147, 51, 234, 0.12);
  color: #7c3aed;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-pinned .post-card {
  border-color: rgba(59, 130, 246, 0.35);
  box-shadow: 0 8px 28px rgba(59, 130, 246, 0.08);
}

.post-more {
  list-style: none;
  display: flex;
  justify-content: center;
  padding: 8px 0 0;
}

.post-more .ghost-btn {
  min-width: 200px;
}

.post-card-title {
  margin: 0 0 6px;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.85rem;
  flex-wrap: wrap;
}

.post-card-meta .dot {
  opacity: 0.6;
}

.post-card-arrow {
  color: var(--muted);
  font-size: 1.1rem;
  transition: transform 0.15s ease, color 0.15s ease;
}
.post-card:hover .post-card-arrow {
  color: var(--accent);
  transform: translateX(4px);
}

.site-foot {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 24px 16px 40px;
}

.site-foot-icp {
  color: inherit;
  text-decoration: none;
}

.site-foot-icp:hover {
  color: var(--accent);
  text-decoration: underline;
}

@media (max-width: 720px) {
  .profile-card {
    grid-template-columns: auto 1fr;
    padding: 22px;
  }
  .profile-write {
    grid-column: 1 / -1;
    justify-self: stretch;
    text-align: center;
  }
  .post-card {
    grid-template-columns: 56px 1fr;
    padding: 14px 16px;
  }
  .post-card-arrow {
    display: none;
  }
}

@media (prefers-color-scheme: dark) {
  .profile-card::before {
    background:
      radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.22), transparent 50%),
      radial-gradient(at 100% 100%, rgba(168, 85, 247, 0.18), transparent 50%);
  }
  .profile-tag {
    background: rgba(59, 130, 246, 0.18);
  }
  .post-card:hover {
    border-color: rgba(96, 165, 250, 0.5);
  }
}

/* ---------- 图片、排序、阅读页 ---------- */

.tiptap-wrap {
  position: relative;
}

.editor-page .tiptap-editor .ProseMirror img,
.post .body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0;
}

.post .body img {
  margin: 18px auto;
  border-radius: 4px;
}

.editor-page .tiptap-editor .ProseMirror p::after {
  content: "";
  display: table;
  clear: both;
}

.editor-page .tiptap-editor .ProseMirror span.resizable-image {
  position: relative;
  display: inline-block;
  vertical-align: text-bottom;
  max-width: 100%;
  margin: 2px 4px;
  line-height: 0;
  box-sizing: border-box;
}

.editor-page .tiptap-editor .ProseMirror span.resizable-image > img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
  user-select: none;
}

.editor-page .tiptap-editor .ProseMirror span.resizable-image.align-left {
  float: left;
  margin: 4px 12px 8px 0;
}

.editor-page .tiptap-editor .ProseMirror span.resizable-image.align-right {
  float: right;
  margin: 4px 0 8px 12px;
}

.editor-page .tiptap-editor .ProseMirror span.resizable-image.align-center {
  float: none;
  display: block;
  margin: 12px auto;
  width: fit-content;
  clear: both;
}

.editor-page .tiptap-editor .ProseMirror figure.resizable-image,
.post .body figure.resizable-image {
  position: relative;
  display: block;
  margin: 20px auto;
  max-width: 100%;
  width: fit-content;
  box-sizing: border-box;
}

.editor-page .tiptap-editor .ProseMirror figure.resizable-image > img,
.post .body figure.resizable-image > img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
  user-select: none;
}

.editor-page .tiptap-editor .ProseMirror figure.resizable-image.is-selected,
.editor-page .tiptap-editor .ProseMirror span.resizable-image.is-selected {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- 图片对齐（编辑器内 figure） ---- */
.editor-page .tiptap-editor .ProseMirror figure.resizable-image.align-left {
  margin-left: 0;
  margin-right: auto;
}
.editor-page .tiptap-editor .ProseMirror figure.resizable-image.align-center {
  margin-left: auto;
  margin-right: auto;
}
.editor-page .tiptap-editor .ProseMirror figure.resizable-image.align-right {
  margin-left: auto;
  margin-right: 0;
}

/* ---- 图片对齐（阅读页直接渲染 img） ---- */
.post .body img {
  display: block;
  margin-left: auto;
  margin-right: auto;
}
.post .body img.align-left {
  margin-left: 0;
  margin-right: auto;
}
.post .body img.align-center {
  margin-left: auto;
  margin-right: auto;
}
.post .body img.align-right {
  margin-left: auto;
  margin-right: 0;
}

/* ---- 图片浮动工具条 ---- */
.editor-page .tiptap-editor .ProseMirror figure.resizable-image .image-tools,
.editor-page .tiptap-editor .ProseMirror span.resizable-image .image-tools {
  position: absolute;
  top: -38px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  box-shadow: 0 6px 18px rgba(28, 39, 60, 0.18);
  display: none;
  gap: 2px;
  align-items: center;
  z-index: 6;
  white-space: nowrap;
}

.editor-page .tiptap-editor .ProseMirror figure.resizable-image:hover .image-tools,
.editor-page .tiptap-editor .ProseMirror figure.resizable-image.is-selected .image-tools,
.editor-page .tiptap-editor .ProseMirror span.resizable-image:hover .image-tools,
.editor-page .tiptap-editor .ProseMirror span.resizable-image.is-selected .image-tools {
  display: inline-flex;
}

.image-tools-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.image-tools-btn:hover {
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent);
}

.image-tools-btn[data-action="delete"]:hover {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
}

.image-tools-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 3px;
}

/* ---- 字体颜色按钮 & 色板 ---- */
.tb-color-wrap {
  position: relative;
  display: inline-block;
}

.tb-color-icon {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  gap: 2px;
}

.tb-color-A {
  font-weight: 700;
  font-size: 0.85rem;
}

.tb-color-bar {
  width: 16px;
  height: 4px;
  border-radius: 2px;
  background: #2563eb;
  display: inline-block;
}

.color-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 12px 30px rgba(28, 39, 60, 0.18);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.color-popover[hidden] {
  display: none;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(5, 22px);
  gap: 6px;
}

.color-grid button {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(15, 23, 42, 0.15);
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s ease;
}

.color-grid button:hover {
  transform: scale(1.12);
}

.color-clear {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  padding: 6px 10px;
  cursor: pointer;
}

.color-clear:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---- 空段落保留高度（即使整行没字也占一行） ---- */
.editor-page .tiptap-editor .ProseMirror p:empty,
.post .body p:empty {
  min-height: 1.6em;
}
.editor-page .tiptap-editor .ProseMirror p > br.ProseMirror-trailingBreak:only-child {
  display: inline-block;
}

.editor-page .tiptap-editor .ProseMirror figure.resizable-image .resize-handle,
.editor-page .tiptap-editor .ProseMirror span.resizable-image .resize-handle {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border: 2px solid var(--card);
  border-radius: 3px;
  cursor: nwse-resize;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 5;
}

.editor-page .tiptap-editor .ProseMirror figure.resizable-image:hover .resize-handle,
.editor-page .tiptap-editor .ProseMirror figure.resizable-image.is-selected .resize-handle,
.editor-page .tiptap-editor .ProseMirror span.resizable-image:hover .resize-handle,
.editor-page .tiptap-editor .ProseMirror span.resizable-image.is-selected .resize-handle {
  opacity: 1;
}

.post .body figure.resizable-image .resize-handle {
  display: none;
}

body.is-resizing-image,
body.is-resizing-image * {
  cursor: nwse-resize !important;
  user-select: none !important;
}

/* ---------- 链接选择弹窗 ---------- */

.link-picker {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
}

.link-picker[hidden] {
  display: none;
}

.link-picker-mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

.link-picker-panel {
  position: relative;
  width: min(520px, calc(100vw - 32px));
  max-height: 70vh;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.link-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.link-picker-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.link-picker-search {
  margin: 14px 18px 8px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  font-size: 0.95rem;
  background: var(--bg);
  color: var(--text);
  outline: none;
}

.link-picker-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.link-picker-list {
  list-style: none;
  margin: 0;
  padding: 6px 10px 14px;
  overflow-y: auto;
  display: grid;
  gap: 4px;
}

.link-picker-list li {
  margin: 0;
}

.link-picker-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text);
  font: inherit;
}

.link-picker-item:hover {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.25);
}

.link-picker-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.link-picker-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.link-picker-empty {
  list-style: none;
  text-align: center;
  color: var(--muted);
  padding: 24px 10px;
  font-size: 0.9rem;
}

@media (prefers-color-scheme: dark) {
  .link-picker-mask {
    background: rgba(2, 6, 23, 0.6);
  }
}

/* ProseMirror Gapcursor —— 光标可停留并闪烁在图片前后 */
.ProseMirror-gapcursor {
  display: none;
  pointer-events: none;
  position: absolute;
}
.ProseMirror-gapcursor::after {
  content: "";
  display: block;
  position: absolute;
  top: -2px;
  width: 24px;
  border-top: 2px solid currentColor;
  animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
}
.ProseMirror-focused .ProseMirror-gapcursor {
  display: block;
}
@keyframes ProseMirror-cursor-blink {
  to {
    visibility: hidden;
  }
}

.post-order-controls {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.post-order-controls button {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  border-radius: 8px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 0.82rem;
}

.post-order-controls button:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.reader-page {
  background:
    radial-gradient(at 10% 0%, rgba(59, 130, 246, 0.08), transparent 32%),
    var(--bg);
}

.reader-layout {
  width: min(1280px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 36px 0 80px;
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(0, 780px) minmax(180px, 240px);
  gap: 24px;
  align-items: start;
}

.reader-post {
  padding: 42px 48px;
  border-radius: 18px;
}

.reader-post h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.18;
  margin-bottom: 14px;
}

.reader-post .meta {
  border-bottom: 1px solid var(--border);
  padding-bottom: 20px;
  margin-bottom: 30px;
}

.reader-post .body {
  font-size: 1.06rem;
  line-height: 1.9;
}

.reader-post .body h2 {
  font-size: 1.55rem;
  margin: 2em 0 0.7em;
  padding-bottom: 0.25em;
  border-bottom: 1px solid var(--border);
}

.reader-post .body h3 {
  font-size: 1.25rem;
  margin: 1.6em 0 0.5em;
}

.reader-post .body p {
  margin: 1em 0;
}

.reader-post .body ul,
.reader-post .body ol {
  padding-left: 1.5em;
}

.reader-post .body li + li {
  margin-top: 0.35em;
}

.reader-side {
  position: sticky;
  top: 78px;
}

.reader-side-card {
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(28, 39, 60, 0.04);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.reader-side-card h3 {
  margin: 0 0 12px;
  font-size: 0.95rem;
}

.toc-list {
  display: grid;
  gap: 6px;
  position: relative;
  border-left: 1px solid var(--border);
  padding-left: 0;
}

.toc-list a {
  position: relative;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1.5;
  border-left: 2px solid transparent;
  margin-left: -1px;
  padding: 3px 8px 3px 12px;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.toc-list .toc-h1 {
  padding-left: 12px;
  font-weight: 600;
  font-size: 0.92rem;
}

.toc-list .toc-h2 {
  padding-left: 24px;
}

.toc-list .toc-h3 {
  padding-left: 38px;
  font-size: 0.84rem;
}

.toc-list .toc-h4 {
  padding-left: 52px;
  font-size: 0.82rem;
}

.toc-list a:hover {
  color: var(--accent);
  border-left-color: var(--accent);
}

.toc-list a.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(59, 130, 246, 0.08);
  font-weight: 600;
}

.toc-empty {
  color: var(--muted);
  font-size: 0.88rem;
}

.post-info {
  margin: 0;
  display: grid;
  gap: 8px;
}

.post-info dt {
  color: var(--muted);
  font-size: 0.78rem;
}

.post-info dd {
  margin: -6px 0 8px;
  font-size: 0.9rem;
  word-break: break-all;
}

.reader-info .back-link {
  margin-top: 10px;
}

@media (max-width: 1080px) {
  .reader-layout {
    grid-template-columns: minmax(0, 1fr);
    width: min(860px, calc(100vw - 32px));
  }
  .reader-side {
    position: static;
  }
  .reader-toc {
    order: 2;
  }
  .reader-info {
    order: 3;
  }
}

@media (max-width: 720px) {
  .reader-layout {
    width: calc(100vw - 24px);
    padding-top: 20px;
  }
  .reader-post {
    padding: 26px 20px;
  }
}

@media (prefers-color-scheme: dark) {
  .reader-side-card {
    background: rgba(26, 34, 56, 0.78);
  }
  .post .body pre,
  .reader-post .body pre {
    background: #0b1226;
  }
}
