/* ============================================================
   前台账号体系样式：注册 / 登录 / 写文章 / 评论 / 前台管理
   独立文件，只在 public_shell() 中加载，不进入后台。
   禁用内联样式与内联事件（CSP script-src 'self'）。
   ============================================================ */

/* ---- 前台基础按钮（后台 .btn 在 admin.css，前台需要独立一份） ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: 7px; font-size: 14px; font-family: inherit;
  line-height: 1.5; cursor: pointer; white-space: nowrap;
  color: var(--fg); background: var(--bg); border: 1px solid var(--border);
  transition: border-color .15s, background-color .15s, opacity .15s;
}
.btn:hover { border-color: var(--fg-muted); text-decoration: none; }
.btn:active { transform: scale(.985); }
.btn:disabled, .btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--link); border-color: var(--link); color: #fff; }
.btn-primary:hover { opacity: .92; border-color: var(--link); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--bg-subtle); }
.btn-danger { color: #cf222e; border-color: #cf222e; background: transparent; }
.btn-danger:hover { background: #cf222e; color: #fff; }
.btn-small { padding: 3px 10px; font-size: 12.5px; border-radius: 6px; }
.btn-block { width: 100%; }
[data-theme="dark"] .btn-danger { color: #ff7b72; border-color: #ff7b72; }
[data-theme="dark"] .btn-danger:hover { background: #ff7b72; color: #0d1117; }

/* ---- 提示条 ---- */
.flash {
  padding: 10px 14px; border-radius: 8px; margin: 0 0 16px;
  font-size: 14px; line-height: 1.6; border: 1px solid;
}
.flash-ok {
  color: #1a7f37; border-color: #1a7f37;
  background: color-mix(in srgb, #1a7f37 8%, transparent);
}
.flash-err {
  color: #cf222e; border-color: #cf222e;
  background: color-mix(in srgb, #cf222e 8%, transparent);
}
.flash-warn {
  color: #9a6700; border-color: #d4a72c;
  background: color-mix(in srgb, #d4a72c 14%, transparent);
}
[data-theme="dark"] .flash-ok { color: #3fb950; border-color: #3fb950; }
[data-theme="dark"] .flash-err { color: #ff7b72; border-color: #ff7b72; }
[data-theme="dark"] .flash-warn { color: #e3b341; border-color: #bb8009; }

.dev-code {
  display: inline-block; padding: 1px 8px; border-radius: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px; letter-spacing: .12em; font-weight: 700;
  background: var(--code-bg); border: 1px solid var(--border); color: var(--fg);
}

/* ---- 认证页骨架 ---- */
.auth-page { max-width: 420px; margin: 0 auto; padding-bottom: 8px; }
.auth-head { margin: 4px 0 22px; text-align: center; }
.auth-head h1 { margin: 0 0 8px; font-size: 26px; letter-spacing: -.01em; }
.auth-head p { margin: 0; color: var(--fg-muted); font-size: 14px; line-height: 1.6; }

.auth-card {
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 22px 24px; box-shadow: 0 1px 4px var(--shadow);
}
/* 一个卡片内叠加两张表单时用虚线断开 */
.auth-form + .auth-form {
  margin-top: 20px; padding-top: 20px; border-top: 1px dashed var(--border);
}
.auth-form label {
  display: block; margin-bottom: 14px;
  font-size: 13.5px; font-weight: 600; color: var(--fg);
}
.auth-form label:last-of-type { margin-bottom: 18px; }
.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="number"],
.auth-form input[type="url"] {
  display: block; width: 100%; margin-top: 6px;
  padding: 9px 11px; font-size: 14.5px; font-family: inherit; font-weight: 400;
  color: var(--fg); background: var(--bg);
  border: 1px solid var(--border); border-radius: 7px;
  transition: border-color .15s, box-shadow .15s;
}
.auth-form input:focus,
.auth-form textarea:focus,
.auth-form select:focus {
  outline: none; border-color: var(--link);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--link) 18%, transparent);
}
.auth-form input::placeholder,
.auth-form textarea::placeholder { color: var(--fg-muted); opacity: .7; }
.auth-form textarea {
  display: block; width: 100%; margin-top: 6px; padding: 9px 11px;
  font-size: 14.5px; font-family: inherit; font-weight: 400; line-height: 1.65;
  color: var(--fg); background: var(--bg); resize: vertical;
  border: 1px solid var(--border); border-radius: 7px;
}
.auth-form select {
  display: block; width: 100%; margin-top: 6px; padding: 9px 11px;
  font-size: 14.5px; font-family: inherit; color: var(--fg); background: var(--bg);
  border: 1px solid var(--border); border-radius: 7px;
}
.auth-hint { display: block; margin-top: 5px; font-size: 12.5px; font-weight: 400; color: var(--fg-muted); }
.auth-alt { margin: 18px 0 0; text-align: center; font-size: 13.5px; color: var(--fg-muted); }
.auth-row { display: flex; gap: 10px; flex-wrap: wrap; }
.auth-row > * { flex: 1 1 auto; }

/* ---- 密码强度条 ---- */
.pwd-meter { height: 4px; margin-top: 8px; border-radius: 999px; background: var(--border); overflow: hidden; }
.pwd-meter-bar {
  height: 100%; width: 0; border-radius: 999px;
  background: var(--fg-muted); transition: width .2s, background-color .2s;
}
.pwd-meter-bar.lv-weak { background: #cf222e; }
.pwd-meter-bar.lv-mid { background: #d4a72c; }
.pwd-meter-bar.lv-good { background: #218bff; }
.pwd-meter-bar.lv-strong { background: #1a7f37; }

/* ---- 顶栏账号区 ---- */
.nav-account {
  display: flex; align-items: center; gap: 8px;
  padding-left: 9px; margin-left: 4px;
  border-left: 1px solid var(--border);
}

/* 登录后：头像 + 下拉菜单（GitHub 风格） */
.acct-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 3px 7px 3px 3px; margin: 0;
  font-family: inherit; font-size: 13.5px; color: var(--fg);
  background: transparent; border: 1px solid transparent;
  border-radius: 999px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .15s, border-color .15s;
}
.acct-btn:hover { background: var(--bg-subtle); border-color: var(--border); }
.acct-btn:focus-visible {
  outline: none; border-color: var(--link);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--link) 18%, transparent);
}
.acct-avatar {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; line-height: 1;
  color: #fff; background: var(--link);
  user-select: none;
}
.acct-name {
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.acct-caret { width: 14px; height: 14px; flex: 0 0 auto; color: var(--fg-muted); }

.nav-account { position: relative; }
.acct-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 90;
  min-width: 208px; padding: 6px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgb(0 0 0 / 16%);
}
.acct-menu[hidden] { display: none; }
.acct-head { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 9px; }
.acct-head b { font-size: 13.5px; color: var(--fg); overflow-wrap: anywhere; }
.acct-mail { font-size: 12px; color: var(--fg-muted); overflow-wrap: anywhere; }
.acct-badge {
  align-self: flex-start; margin-top: 4px;
  font-size: 11px; font-weight: 600; line-height: 1;
  padding: 3px 7px; border-radius: 999px; color: var(--link);
  background: color-mix(in srgb, var(--link) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--link) 25%, transparent);
}
.acct-sep { height: 1px; margin: 5px 6px; background: var(--border); }
.acct-item {
  display: block; padding: 8px 10px; border-radius: 6px;
  font-size: 13.5px; color: var(--fg);
}
.acct-item:hover { background: var(--bg-subtle); text-decoration: none; }
.acct-danger { color: #cf222e; }
.acct-danger:hover { background: color-mix(in srgb, #cf222e 10%, transparent); }

.nav-signin, .nav-signout, .nav-join {
  font-size: 13.5px; padding: 3px 9px; border-radius: 6px;
  color: var(--fg-muted); white-space: nowrap;
}
.nav-signin:hover, .nav-signout:hover {
  color: var(--fg); background: var(--bg-subtle); text-decoration: none;
}
.nav-join {
  color: var(--link); font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--link) 40%, transparent);
}
.nav-join:hover { background: color-mix(in srgb, var(--link) 10%, transparent); text-decoration: none; }

/* 注册页：单表单内的「获取验证码 / 注册并登录」分隔线 */
.auth-split {
  display: flex; align-items: center; gap: 10px;
  margin: 6px 0 2px; color: var(--fg-muted); font-size: 12.5px;
}
.auth-split::before, .auth-split::after {
  content: ""; flex: 1 1 auto; height: 1px; background: var(--border);
}

/* ============================================================
   评论区
   ============================================================ */
.cmt-section {
  margin-top: 44px; padding-top: 26px;
  border-top: 1px solid var(--border);
}
.cmt-head {
  display: flex; align-items: baseline; gap: 10px;
  margin: 0 0 20px;
}
.cmt-head h2 { margin: 0; font-size: 19px; letter-spacing: -.01em; }
.cmt-count { font-size: 13px; color: var(--fg-muted); font-variant-numeric: tabular-nums; }

.cmt-empty {
  padding: 26px 16px; text-align: center;
  color: var(--fg-muted); font-size: 14px;
  background: var(--bg-subtle); border: 1px dashed var(--border); border-radius: 10px;
}

.cmt-list { list-style: none; margin: 0 0 26px; padding: 0; }
.cmt-item { padding: 16px 0; border-bottom: 1px solid var(--border); }
.cmt-item:last-child { border-bottom: none; }
.cmt-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 7px; }
.cmt-avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  background: var(--link); text-transform: uppercase; user-select: none;
}
.cmt-name { font-size: 13.5px; font-weight: 600; color: var(--fg); }
.cmt-time { font-size: 12.5px; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.cmt-body { margin: 0; font-size: 15px; line-height: 1.72; white-space: pre-wrap; word-break: break-word; }
.cmt-del { margin-left: auto; }

.cmt-form-wrap { margin-top: 4px; }
.cmt-login-tip {
  padding: 20px 16px; text-align: center;
  font-size: 14px; color: var(--fg-muted);
  background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 10px;
}

/* ---- 点赞按钮（已点赞高亮） ---- */
.action-btn.liked {
  color: #cf222e;
  border-color: color-mix(in srgb, #cf222e 40%, transparent);
  background: color-mix(in srgb, #cf222e 8%, transparent);
}
[data-theme="dark"] .action-btn.liked { color: #ff7b72; border-color: #ff7b72; }
.action-btn.liked:hover { color: #cf222e; }
[data-theme="dark"] .action-btn.liked:hover { color: #ff7b72; }
.action-btn.like-pop { animation: likePop .34s ease; }
@keyframes likePop {
  0% { transform: scale(1); }
  40% { transform: scale(1.14); }
  70% { transform: scale(.97); }
  100% { transform: scale(1); }
}

/* ---- 评论：两级结构（顶层 + 回复） ---- */
.cmt-threads { list-style: none; margin: 0 0 26px; padding: 0; }
.cmt-thread { border-bottom: 1px solid var(--border); padding: 0; }
.cmt-thread:last-child { border-bottom: none; }

/* 顶层评论所在的列表：去掉自己的边框，由 .cmt-thread 统一控制 */
.cmt-thread > .cmt-list { margin: 0; }
.cmt-thread > .cmt-list > .cmt-item {
  border-bottom: none; padding-bottom: 6px;
}

/* 回复列表：左侧竖线形成层级 */
.cmt-sublist {
  list-style: none; margin: 0 0 14px; padding: 0 0 0 14px;
  border-left: 2px solid var(--border);
}
.cmt-item.cmt-reply {
  padding: 8px 0 10px; border-bottom: none;
}
.cmt-item.cmt-reply:first-child { padding-top: 4px; }
.cmt-item.cmt-reply .cmt-avatar {
  width: 22px; height: 22px; font-size: 11px;
  opacity: .9;
}
.cmt-item.cmt-reply .cmt-body { font-size: 14.5px; }

/* "回复 @某人" 标记 */
.cmt-reply-to {
  font-size: 12.5px; color: var(--fg-muted);
}
.cmt-reply-to b { color: var(--link); font-weight: 600; }

/* 评论操作区（回复 / 删除） */
.cmt-acts {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  flex-shrink: 0;
}
.cmt-acts .cmt-del { margin-left: 0; }
.cmt-reply-btn {
  padding: 2px 8px; font-size: 12.5px; font-family: inherit;
  color: var(--fg-muted); background: transparent;
  border: 1px solid transparent; border-radius: 6px; cursor: pointer;
  line-height: 1.6;
}
.cmt-reply-btn:hover {
  color: var(--link); border-color: var(--border); background: var(--bg-subtle);
}

/* 被删除评论的占位提示 */
.cmt-deleted {
  margin: 0; font-size: 13.5px; font-style: italic; color: var(--fg-muted);
  padding: 4px 0 4px 32px;
}

/* 内联回复框 */
.cmt-reply-slot { margin: 0 0 14px 14px; }
.cmt-reply-slot[hidden] { display: none; }
.cmt-reply-slot .cmt-form {
  padding: 12px 14px; border-radius: 9px;
  background: var(--bg-subtle); border: 1px solid var(--border);
}
.cmt-reply-slot .cmt-form label { margin-bottom: 10px; }
.cmt-form-acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* 新评论定位高亮 */
.cmt-flash {
  animation: cmtFlash 2.2s ease;
  border-radius: 8px;
}
@keyframes cmtFlash {
  0% { background: color-mix(in srgb, var(--link) 18%, transparent); }
  100% { background: transparent; }
}

@media (max-width: 600px) {
  .cmt-sublist { padding-left: 10px; }
  .cmt-reply-slot { margin-left: 10px; }
  .cmt-acts { width: 100%; justify-content: flex-start; margin: 6px 0 0 32px; }
  .cmt-deleted { padding-left: 28px; }
}

/* ============================================================
   前台管理面板 /manage、写文章 /write
   ============================================================ */
.panel-page { max-width: 900px; }
.panel-tabs {
  display: flex; gap: 2px; margin: 0 0 24px;
  border-bottom: 1px solid var(--border); overflow-x: auto;
  /* overflow-x:auto 会把 overflow-y 隐式变 auto；tab 的 -1px 负边框技巧
     又让内容高度恰好超出 1px —— 右侧就冒出一个几像素高的微型纵向滚动条
     （Windows 明显）。纵向本来就不需要滚动，明确禁掉。（2026-10-24） */
  overflow-y: hidden; scrollbar-width: none;
}
.panel-tabs::-webkit-scrollbar { display: none; }
.panel-tab {
  padding: 9px 14px; font-size: 14px; color: var(--fg-muted);
  border: none; background: transparent; font-family: inherit; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
  text-decoration: none;
}
.panel-tab:hover { color: var(--fg); text-decoration: none; }
.panel-tab.active { color: var(--fg); font-weight: 600; border-bottom-color: var(--link); }

.panel-card {
  background: var(--bg); border: 1px solid var(--border); border-radius: 11px;
  padding: 20px 22px; margin-bottom: 18px;
}
.panel-card h2 { margin: 0 0 4px; font-size: 17px; letter-spacing: -.01em; }
.panel-card > p.desc { margin: 0 0 16px; font-size: 13.5px; color: var(--fg-muted); }

/* 面板内搜索工具条：横向左对齐 */
.panel-toolbar { margin: 0 0 14px; }
.filter-form {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  justify-content: flex-start; margin: 0;
}
.filter-form input[type="search"] {
  display: inline-block; width: auto; min-width: 220px; margin-top: 0;
  padding: 7px 11px; font-size: 13.5px; font-family: inherit;
  color: var(--fg); background: var(--bg);
  border: 1px solid var(--border); border-radius: 7px;
}
.filter-form input[type="search"]:focus {
  outline: none; border-color: var(--link);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--link) 16%, transparent);
}
.search-meta { margin: 0 0 12px; font-size: 13px; color: var(--fg-muted); }
.search-meta b { color: var(--fg); }

@media (max-width: 600px) {
  .filter-form input[type="search"] { min-width: 0; flex: 1 1 100%; }
}

.rows { list-style: none; margin: 0; padding: 0; }
.row-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 0; border-top: 1px solid var(--border);
}
.row-item:first-child { border-top: none; padding-top: 0; }
.row-main { flex: 1; min-width: 0; }
.row-main b { display: block; font-size: 14.5px; font-weight: 600; word-break: break-all; }
.row-main span { font-size: 12.5px; color: var(--fg-muted); }
.row-acts { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.row-empty { padding: 22px 0; text-align: center; color: var(--fg-muted); font-size: 13.5px; }
.inline-form { display: inline; }

/* 评论区引文（管理面板里显示评论摘要） */
.cmt-quote {
  margin: 8px 0 0; padding: 8px 12px; font-size: 13.5px; line-height: 1.65;
  color: var(--fg-muted); background: var(--bg-subtle);
  border-left: 3px solid var(--border); border-radius: 0 6px 6px 0;
  white-space: pre-wrap; word-break: break-word;
}

/* 写文章页的"允许评论"勾选（独立成行，不挤在按钮组里） */
.write-check {
  display: flex; align-items: center; gap: 6px;
  margin: 14px 0 4px; font-size: 13.5px; font-weight: 400; color: var(--fg-muted);
  cursor: pointer; white-space: nowrap;
}
.write-check input { margin: 0; }

/* 会员管理里的角色下拉 */
.role-select {
  padding: 3px 6px; font-size: 12.5px; font-family: inherit;
  color: var(--fg); background: var(--bg);
  border: 1px solid var(--border); border-radius: 6px;
}

.badge {
  display: inline-block; font-size: 11px; font-weight: 600; line-height: 1;
  padding: 3px 7px; border-radius: 999px;
  color: var(--fg-muted); border: 1px solid var(--border); background: var(--bg-subtle);
  vertical-align: middle;
}
.badge-ok {
  color: #1a7f37; border-color: color-mix(in srgb, #1a7f37 40%, transparent);
  background: color-mix(in srgb, #1a7f37 10%, transparent);
}
.badge-warn {
  color: #9a6700; border-color: color-mix(in srgb, #d4a72c 45%, transparent);
  background: color-mix(in srgb, #d4a72c 14%, transparent);
}
.badge-danger {
  color: #cf222e; border-color: color-mix(in srgb, #cf222e 40%, transparent);
  background: color-mix(in srgb, #cf222e 10%, transparent);
}
[data-theme="dark"] .badge-ok { color: #3fb950; }
[data-theme="dark"] .badge-warn { color: #e3b341; }
[data-theme="dark"] .badge-danger { color: #ff7b72; }

/* ---- 写文章编辑器 ---- */
.write-page { max-width: 900px; }
.write-form label { display: block; margin-bottom: 16px; font-size: 13.5px; font-weight: 600; }
.write-form input[type="text"],
.write-form textarea,
.write-form select {
  display: block; width: 100%; margin-top: 6px;
  padding: 9px 11px; font-size: 14.5px; font-family: inherit; font-weight: 400;
  color: var(--fg); background: var(--bg);
  border: 1px solid var(--border); border-radius: 7px;
}
.write-form textarea { line-height: 1.7; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.write-form input:focus, .write-form textarea:focus, .write-form select:focus {
  outline: none; border-color: var(--link);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--link) 18%, transparent);
}
.write-toolbar {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  margin-top: 8px;
}
.write-tools { display: flex; gap: 6px; border: 1px solid var(--border); border-radius: 7px 7px 0 0; border-bottom: none; padding: 6px; flex-wrap: wrap; }
.write-tools + textarea { border-radius: 0 0 7px 7px; margin-top: 0; }
.write-tool {
  padding: 4px 9px; font-size: 13px; font-family: inherit; cursor: pointer;
  color: var(--fg-muted); background: transparent;
  border: 1px solid transparent; border-radius: 5px;
}
.write-tool:hover { color: var(--fg); background: var(--bg-subtle); border-color: var(--border); }
.write-count { font-size: 12.5px; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.write-acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-top: 6px; }

@media (max-width: 600px) {
  .auth-card { padding: 18px 16px; }
  .auth-head h1 { font-size: 22px; }
  .nav-account { padding-left: 6px; gap: 6px; }
  /* 手机上只留头像，昵称与箭头收起，给导航腾出宽度 */
  .acct-name, .acct-caret { display: none; }
  .acct-btn { padding: 3px; }
  .acct-menu { min-width: 196px; right: -4px; }
  .panel-card { padding: 16px 14px; }
  .row-item { flex-wrap: wrap; }
  .row-acts { width: 100%; justify-content: flex-start; }
  .cmt-section { margin-top: 34px; }
}
/* ===== 注册页图形验证码：输入框 + 验证码图 + 换一张 横排 ===== */
.auth-form .captcha-row {
  display: flex; align-items: center; gap: 8px; margin-top: 6px;
}
.auth-form .captcha-row input[type="text"] {
  flex: 1; min-width: 0; width: auto; margin-top: 0;
}
.auth-form .captcha-row img {
  flex: none; border: 1px solid var(--border); border-radius: 7px;
}
.auth-form .captcha-refresh {
  flex: none; padding: 8px 12px; font-size: 13px; font-family: inherit;
  color: var(--fg-muted); background: var(--bg); cursor: pointer;
  border: 1px solid var(--border); border-radius: 7px;
}
.auth-form .captcha-refresh:hover { color: var(--fg); border-color: var(--link); }

/* ===== 行操作按钮基线统一（2026-10-24）=====
   「查看」等是 <a>，「删除」等是 <button>，浏览器对两者的 UA 盒模型有细微差异，
   肉眼可见大小不一。固定高度 + 显式内边距后完全一致。 */
.row-acts .btn { height: 28px; padding: 0 12px; box-sizing: border-box; }

/* ===== 写文章页：字段标题（编辑器区不用 <label> 包裹，避免点工具栏聚焦正文） ===== */
.write-field-head {
  margin: 14px 0 6px; font-size: 13.5px; font-weight: 600; color: var(--fg);
}

/* ===== 写文章页：分屏 Markdown 编辑器（样式与后台一致，作用域仅前台） ===== */
.editor-toolbar {
  display: flex; flex-wrap: wrap; gap: 4px; padding: 8px;
  background: var(--bg-subtle); border: 1px solid var(--border); border-bottom: none;
  border-radius: 8px 8px 0 0; align-items: center;
}
.editor-toolbar button {
  border: 1px solid transparent; background: transparent; color: var(--fg-muted);
  padding: 4px 9px; border-radius: 5px; cursor: pointer; font-size: 13px; font-family: inherit;
}
.editor-toolbar button:hover { background: var(--bg); color: var(--fg); border-color: var(--border); }
.editor-toolbar button.active { background: var(--link); color: #fff; }
.toolbar-right { margin-left: auto; display: flex; gap: 4px; }
.editor-wrap {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  border: 1px solid var(--border); border-radius: 0 0 8px 8px; overflow: hidden;
  min-height: 420px;
}
.editor-wrap.mode-write { grid-template-columns: 1fr; }
.editor-wrap.mode-write .editor-preview { display: none; }
.editor-wrap.mode-preview { grid-template-columns: 1fr; }
.editor-wrap.mode-preview #editor { display: none; }
#editor {
  border: none; border-radius: 0; resize: vertical; min-height: 420px; margin-top: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px; line-height: 1.7; padding: 14px;
}
#editor:focus { outline: none; }
.editor-preview {
  padding: 14px 18px; border-left: 1px solid var(--border);
  overflow-y: auto; max-height: 640px; background: var(--bg);
}
.editor-preview h1, .editor-preview h2, .editor-preview h3 { line-height: 1.4; }
.editor-preview pre { background: var(--bg-subtle); padding: 10px 12px; border-radius: 6px; overflow-x: auto; border: 1px solid var(--border); }
.editor-preview img { max-width: 100%; }
.editor-preview table { border-collapse: collapse; }
.editor-preview th, .editor-preview td { border: 1px solid var(--border); padding: 5px 10px; }
.editor-preview blockquote { border-left: 3px solid var(--border); margin: 0; padding: 2px 12px; color: var(--fg-muted); }

@media (max-width: 720px) {
  .editor-wrap { grid-template-columns: 1fr; }
  .editor-preview { border-left: none; border-top: 1px solid var(--border); }
}

/* ===== 评论高亮：新评论/锚点定位的渐隐提示 =====
   post.js 一直在加 .cmt-flash 类但此前无定义——高亮从未生效，
   移动端露出浏览器对 :target 的系统默认蓝底（站长反馈 2026-10-24）。 */
.cmt-item:target,
.cmt-thread:target { background: transparent; }   /* 覆盖 UA 默认蓝底 */
/* 新评论提示：左侧竖线渐隐（不占布局的 inset 阴影实现）。
   2026-10-24 二次调整：此前用淡蓝整块背景高亮，站长两次反馈误认为
   "蓝色背景异常"——背景类高亮全部移除，只保留竖线。 */
.cmt-flash { animation: cmtFlash 2.4s ease-out; }
@keyframes cmtFlash {
  0%, 25% { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--link) 60%, transparent); }
  100%    { box-shadow: inset 3px 0 0 transparent; }
}
.cmt-err-view { margin-bottom: 10px; }


/* ===== 编辑器工具栏 v2（2026-10-24 重做）：统一图标/文字按钮 + 分组分隔 =====
   图标为单色线条 SVG（feather/lucide 风格，currentColor 随主题），
   文字按钮统一等宽小号字重，替换原先文字与彩色 emoji 混排。 */
.editor-toolbar { gap: 2px; padding: 6px 8px; }
.editor-toolbar button {
  min-width: 30px; height: 28px; padding: 0 6px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; letter-spacing: .02em; line-height: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--fg-muted); background: transparent;
  border: 1px solid transparent; cursor: pointer;
}
.editor-toolbar button:hover { background: var(--bg); color: var(--fg); border-color: var(--border); }
.editor-toolbar button:active { transform: none; }
.editor-toolbar button.active { background: var(--link); color: #fff; border-color: var(--link); }
.editor-toolbar .toolbar-right { gap: 2px; }
.editor-toolbar .toolbar-right button { font-family: inherit; font-weight: 500; }
.tb-ic { width: 15px; height: 15px; }
.tb-sep { width: 1px; height: 18px; background: var(--border); margin: 0 5px; align-self: center; flex: none; }
