/* ============ 设计令牌 ============ */
:root {
  --bg:        #05070d;
  --bg-soft:   #0a0e18;
  --bg-card:   #0d1320;   /* 卡片/钉住列的实底色，之前只有引用没定义 */
  --panel:     rgba(14, 20, 34, .72);
  --panel-solid:#0c1120;
  --border:    rgba(90, 160, 255, .14);
  --border-hot:rgba(0, 229, 255, .45);

  --fg:        #dbe6f5;
  --fg-dim:    #7d8ba3;
  --fg-faint:  #78859d;   /* 原 #4a5568 对比度只有 2.68:1，低于 AA 的 4.5；现 4.99(#05070d)/4.60(#0d1320) */

  --accent:    #00e5ff;
  --accent-2:  #7c5cff;
  --accent-3:  #00ffa3;
  --danger:    #ff4d6d;

  --radius:    14px;
  --radius-sm: 9px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --shadow: 0 8px 32px rgba(0,0,0,.5);
  --glow: 0 0 24px rgba(0,229,255,.25);
  --topbar-bg: rgba(5,7,13,.78);
  --sel-bg: rgba(0,229,255,.28);
  --sel-fg: #eaf6ff;
  /* 代码块：深色下用更深的底 */
  --code-bg:      rgba(0,0,0,.34);
  --code-inline:  rgba(255,255,255,.07);
  --code-border:  var(--border);
  --table-head:   rgba(255,255,255,.045);
  --table-zebra:  rgba(255,255,255,.018);
  --quote-bg:     rgba(0,229,255,.045);
}

/* ============ 基础重置 ============
   站点从没给 <a> 设过基准色，于是「没被单独指定颜色」的链接
   （卡片标题、页脚「关于」等）直接用浏览器默认的 rgb(0,0,238)。
   浅色主题下它恰好不明显，深色主题下这一抹深蓝对比度只有 1.96:1 —— 等于看不见。
   统一让它继承周围文字颜色，需要强调的链接由更具体的规则覆盖。 */
a { color: inherit; }

/* ============ 浅色模式 ============ */
:root[data-mode="light"] {
  --ok-fg: #17795a;
  --bg:        #f6f8fc;
  --bg-soft:   #eef2f9;
  --bg-card:   #ffffff;
  --panel:     rgba(255,255,255,.82);
  --panel-solid:#ffffff;
  --border:    rgba(30, 70, 140, .16);
  --border-hot:rgba(0, 130, 200, .5);

  --fg:        #10192b;
  --fg-dim:    #53617a;
  --fg-faint:  #606c7b;   /* 原 #8b97ac 只有 2.77:1；现 4.73(#f6f8fc)/5.03(#fff) */

  --accent:    #006cb0;
  --accent-2:  #6d3ff0;
  --accent-3:  #00966b;
  --danger:    #d92d4b;

  --shadow: 0 8px 28px rgba(20,40,90,.13);
  --glow: 0 0 22px rgba(0,119,194,.18);
  --topbar-bg: rgba(255,255,255,.82);
  --sel-bg: rgba(0,119,194,.22);
  --sel-fg: #0b1524;

    /* 代码块：浅色下要浅底深字，不能用透明黑 */
    --code-bg:      #eef2f8;
    --code-inline:  rgba(0,60,140,.075);
    --code-border:  rgba(30,70,140,.16);
    --table-head:   rgba(0,60,140,.06);
    --table-zebra:  rgba(0,60,140,.025);
    --quote-bg:     rgba(0,119,194,.055);
}
:root[data-mode="light"][data-theme="magenta"] {
  --accent:   #b81a66;
  --accent-2: #7c3aed;
  --accent-3: #b45309;
  --border-hot: rgba(214,35,122,.45);
  --glow: 0 0 22px rgba(214,35,122,.18);
}
:root[data-mode="light"][data-theme="lime"] {
  --accent:   #087a50;
  --accent-2: #0369a1;
  --accent-3: #a16207;
  --border-hot: rgba(10,143,95,.45);
  --glow: 0 0 22px rgba(10,143,95,.18);
}

/* 浅色模式下背景装饰收敛，否则文字读不清 */
:root[data-mode="light"] .bg-grid      { opacity: .30; }
:root[data-mode="light"] .bg-glow      { opacity: .22; }
:root[data-mode="light"] .bg-particles { opacity: .28; }

/* 备用配色（点击 ◐ 切换） */
:root[data-theme="magenta"] {
  --accent:   #ff2d95;
  --accent-2: #a855f7;
  --accent-3: #fbbf24;
  --border-hot: rgba(255,45,149,.45);
  --glow: 0 0 24px rgba(255,45,149,.25);
}
:root[data-theme="lime"] {
  --accent:   #00ffa3;
  --accent-2: #00d4ff;
  --accent-3: #ffe600;
  --border-hot: rgba(0,255,163,.45);
  --glow: 0 0 24px rgba(0,255,163,.25);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ============ 背景层 ============ */
.bg-grid {
  position: fixed; inset: 0; z-index: -3;
  background-image:
    linear-gradient(rgba(90,160,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(90,160,255,.045) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 40%, transparent 100%);
}

.bg-glow {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 40% at 50% -10%, rgba(0,229,255,.13), transparent 70%),
    radial-gradient(ellipse 50% 35% at 85% 15%, rgba(124,92,255,.10), transparent 70%);
}

.bg-particles { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5; }

/* ============ 顶栏 ============ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 14px max(20px, env(safe-area-inset-left));
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--fg);
  font-weight: 650; letter-spacing: .02em; font-size: 1rem;
}
.brand-mark {
  color: var(--accent); font-size: 1.25rem;
  text-shadow: var(--glow);
  animation: brandSpin 9s linear infinite;
  display: inline-block;
}
@keyframes brandSpin { to { transform: rotate(360deg); } }

.nav { display: flex; align-items: center; gap: 6px; }
.nav-item {
  padding: 7px 13px; border-radius: var(--radius-sm);
  color: var(--fg-dim); text-decoration: none; font-size: .9375rem;
  border: 1px solid transparent; background: none; cursor: pointer;
  font-family: inherit;
  transition: color .18s, border-color .18s, background .18s;
}
.nav-item:hover { color: var(--accent); border-color: var(--border-hot); background: rgba(0,229,255,.05); }
.theme-btn { font-size: 1rem; line-height: 1; }

/* ============ 容器 ============ */
.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 40px max(20px, env(safe-area-inset-left)) 80px;
  animation: fadeUp .5s cubic-bezier(.16,1,.3,1);
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } }

/* 访问日志是 6 列数据表，780px 的正文宽度塞不下：
   时间 + IP/地区 + 访客 + 设备 + 路径 + 状态，
   硬挤的结果是路径列被压成一列竖排的字。
   用 :has() 认出来单独放宽，不支持的浏览器只是维持正文宽度，不会坏。 */
@media (min-width: 900px) {
  .container:has(.visit-table-wrap) { max-width: 1180px; }
}

/* ============ 首页头图 ============ */
.hero { margin-bottom: 44px; }
.hero-title {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 750; letter-spacing: -.02em; line-height: 1.15;
  margin: 0 0 12px;
  background: linear-gradient(100deg, var(--fg) 10%, var(--accent) 55%, var(--accent-2) 90%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-sub { color: var(--fg-dim); font-family: var(--mono); font-size: .8125rem; margin: 0; }
.hero-sub::before { content: "$ "; color: var(--accent-3); }

/* ============ 文章卡片 ============ */
.post-list { display: flex; flex-direction: column; gap: 14px; }

.post-card {
  position: relative;
  display: block; text-decoration: none; color: inherit;
  padding: 20px 22px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform .22s cubic-bezier(.16,1,.3,1), border-color .22s, box-shadow .22s;
  overflow: hidden;
}
.post-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  opacity: 0; transition: opacity .22s;
}
.post-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-hot);
  box-shadow: var(--shadow), var(--glow);
}
.post-card:hover::before { opacity: 1; }

.post-card h2 {
  margin: 0 0 8px; font-size: 1.25rem; font-weight: 650; letter-spacing: -.01em;
}
.post-card .summary { margin: 0 0 14px; color: var(--fg-dim); font-size: .9375rem; }

.post-meta {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  font-family: var(--mono); font-size: .75rem; color: var(--fg-faint);
}
.tag {
  padding: 2px 8px; border-radius: 4px;
  background: rgba(0,229,255,.08); color: var(--accent);
  border: 1px solid rgba(0,229,255,.2);
}
.meta-comments { color: var(--accent-3); }

/* ============ 文章详情 ============ */
.article-head { margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.article-head h1 {
  font-size: clamp(1.6rem, 5vw, 2.3rem); font-weight: 720; letter-spacing: -.02em;
  margin: 0 0 14px; line-height: 1.25;
}
.article-body { font-size: 1rem; }
.article-body p { margin: 0 0 18px; }
.article-body strong { color: var(--accent); font-weight: 640; }
.article-body code {
  font-family: var(--mono); font-size: .8125em;
  padding: 2px 6px; border-radius: 4px;
  background: rgba(0,229,255,.09); color: var(--accent-3);
  border: 1px solid rgba(0,229,255,.14);
}
.article-body a { color: var(--accent); text-decoration: none; border-bottom: 1px solid rgba(0,229,255,.3); }

.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--fg-dim); text-decoration: none;
  font-family: var(--mono); font-size: .8125rem;
  margin-bottom: 22px; transition: color .18s;
}
.back-link:hover { color: var(--accent); }

/* ============ 评论 ============ */
.comments-section { margin-top: 56px; }
.comments-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 24px;
}
.comments-head h3 { margin: 0; font-size: 1rem; font-weight: 650; }
.comments-count {
  font-family: var(--mono); font-size: .8125rem; color: var(--accent);
  padding: 2px 9px; border-radius: 14px;
  background: rgba(0,229,255,.1); border: 1px solid rgba(0,229,255,.22);
}

/* 评论表单 */
.comment-form {
  padding: 18px; margin-bottom: 30px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.form-row { display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.comment-form input[type="text"],
.comment-form textarea {
  width: 100%; padding: 11px 13px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg); font-family: inherit; font-size: .9375rem;
  transition: border-color .18s, box-shadow .18s;
  resize: vertical;
}
.comment-form input[type="text"]:focus,
.comment-form textarea:focus {
  outline: none; border-color: var(--border-hot);
  box-shadow: 0 0 0 3px rgba(0,229,255,.09);
}
.comment-form input::placeholder,
.comment-form textarea::placeholder { color: var(--fg-faint); }
.comment-form textarea { min-height: 96px; margin-bottom: 12px; }

.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.form-hint { font-family: var(--mono); font-size: .75rem; color: var(--fg-faint); }

.btn {
  padding: 10px 22px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-hot);
  background: linear-gradient(100deg, rgba(0,229,255,.14), rgba(124,92,255,.14));
  color: var(--accent); font-family: inherit; font-size: .9375rem; font-weight: 600;
  cursor: pointer; transition: all .18s;
}
.btn:hover:not(:disabled) {
  background: linear-gradient(100deg, rgba(0,229,255,.24), rgba(124,92,255,.24));
  box-shadow: var(--glow); transform: translateY(-1px);
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost {
  background: none; border-color: var(--border); color: var(--fg-dim);
  padding: 6px 14px; font-size: .8125rem;
}
.btn-ghost:hover { border-color: var(--border-hot); color: var(--accent); }

/* 评论列表 */
.comment-list { display: flex; flex-direction: column; gap: 4px; }

.comment {
  display: flex; gap: 12px;
  padding: 15px 0;
  border-bottom: 1px solid rgba(90,160,255,.07);
  animation: fadeUp .35s cubic-bezier(.16,1,.3,1);
}
.comment:last-child { border-bottom: none; }

.avatar {
  flex: 0 0 38px; width: 38px; height: 38px; border-radius: 9px;
  display: grid; place-items: center;
  font-weight: 700; font-size: .9375rem;
  background: linear-gradient(135deg, rgba(0,229,255,.18), rgba(124,92,255,.18));
  border: 1px solid var(--border-hot);
  color: var(--accent);
  font-family: var(--mono);
}

.comment-main { flex: 1; min-width: 0; }
.comment-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 5px; }
.comment-author { font-weight: 640; font-size: .9375rem; color: var(--fg); }
.comment-time { font-family: var(--mono); font-size: .75rem; color: var(--fg-faint); }
.comment-body { margin: 0 0 8px; font-size: .9375rem; color: var(--fg-dim); white-space: pre-wrap; word-break: break-word; }

.reply-btn {
  background: none; border: none; padding: 0;
  color: var(--fg-faint); font-family: var(--mono); font-size: .75rem;
  cursor: pointer; transition: color .18s;
}
.reply-btn:hover { color: var(--accent); }

/* 嵌套回复 */
.comment-children {
  margin-top: 6px; padding-left: 18px;
  border-left: 2px solid rgba(0,229,255,.14);
}

.reply-form-wrap { margin-top: 12px; }
.reply-form-wrap .comment-form { padding: 14px; margin-bottom: 0; }

/* ============ 状态 ============ */
.loading {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 80px 0; color: var(--fg-faint);
  font-family: var(--mono); font-size: .8125rem;
}
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(0,229,255,.2);
  border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty { text-align: center; padding: 60px 0; color: var(--fg-faint); }
.empty-icon { font-size: 2.3rem; margin-bottom: 12px; opacity: .4; }

/* Toast */
/* ============ 页脚 ============ */
.footer {
  max-width: 780px; margin: 0 auto;
  padding: 34px max(20px, env(safe-area-inset-left)) 46px;
  text-align: center; color: var(--fg-faint); font-size: .8125rem;
}
.footer-line {
  height: 1px; margin-bottom: 22px;
  background: linear-gradient(90deg, transparent, var(--border-hot), transparent);
}
.footer p { margin: 5px 0; }
.mono { font-family: var(--mono); color: var(--fg-dim); }
.dim { opacity: .62; }

/* ============ 响应式 ============ */
@media (max-width: 560px) {
  .container { padding-top: 28px; }
  .post-card { padding: 17px 18px; }
  .comment-children { padding-left: 11px; }
  .avatar { flex-basis: 32px; width: 32px; height: 32px; font-size: .8125rem; }
  .form-foot { flex-direction: column-reverse; align-items: stretch; }
  /* 原本这里有一条 `.btn { width: 100% }`，本意是让登录/注册的提交按钮撑满。
     但 .form-foot 已经是 column + stretch，子元素自动撑满，这条规则多余；
     而它对**行内**按钮是灾难：搜索栏的「搜索」按钮占满整行，
     把输入框挤成 20px；评论区、写文章页、后台操作组同样受损。
     改成只保留真正需要的竖排表单。 */
  .form-foot .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .bg-particles { display: none; }
}

::selection { background: var(--sel-bg); color: var(--sel-fg); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(90,160,255,.2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,229,255,.35); }

/* ============ 顶栏账号区 ============ */
.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  background: var(--panel); border: 1px solid var(--border);
  color: var(--fg-dim); border-radius: 9px; cursor: pointer;
  font-size: 1rem; transition: .18s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--border-hot); background: rgba(0,229,255,.06); }

.user-slot { display: flex; align-items: center; gap: 8px; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04121d; font-weight: 700; font-size: .8125rem;
  border: 1px solid var(--border-hot); transition: .18s;
  user-select: none;
}
:root[data-mode="light"] .avatar { color: #fff; }
.avatar:hover { transform: scale(1.06); }

.btn {
  padding: 8px 16px; border-radius: 9px; cursor: pointer;
  font-size: .8125rem; font-family: inherit; transition: .18s;
  border: 1px solid var(--border); background: var(--panel); color: var(--fg);
}
.btn:hover { border-color: var(--border-hot); color: var(--accent); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04121d; border: none; font-weight: 650;
}
:root[data-mode="light"] .btn-primary { color: #fff; }
.btn-primary:hover { filter: brightness(1.1); color: #04121d; }
:root[data-mode="light"] .btn-primary:hover { color: #fff; }
.btn-danger { color: var(--danger); border-color: rgba(255,77,109,.35); }
.btn-danger:hover { background: rgba(255,77,109,.1); color: var(--danger); border-color: var(--danger); }
.btn-sm { padding: 8px 12px; font-size: .8125rem; }

/* ============ 下拉菜单 ============ */
.menu {
  position: absolute; top: 56px; right: 24px; z-index: 60;
  background: var(--panel-solid); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  min-width: 190px; padding: 7px; backdrop-filter: blur(14px);
}
.menu-head { padding: 9px 12px; border-bottom: 1px solid var(--border); margin-bottom: 5px; }
.menu-head .mn { font-weight: 650; font-size: .9375rem; }
.menu-head .mr { font-size: .75rem; color: var(--fg-faint); font-family: var(--mono); margin-top: 2px; }
.menu-item {
  display: block; width: 100%; text-align: left; padding: 9px 12px;
  background: none; border: none; color: var(--fg); cursor: pointer;
  border-radius: 9px; font-size: .8125rem; font-family: inherit; transition: .14s;
}
.menu-item:hover { background: rgba(0,229,255,.09); color: var(--accent); }

/* ============ 分类导航条 ============ */
.cat-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 26px; }
.cat-chip {
  padding: 6px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--panel);
  color: var(--fg-dim); font-size: .8125rem; text-decoration: none; transition: .18s;
}
.cat-chip:hover { color: var(--accent); border-color: var(--border-hot); }
.cat-chip.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04121d; border-color: transparent; font-weight: 600;
}
:root[data-mode="light"] .cat-chip.active { color: #fff; }
.cat-chip .cnt { opacity: .62; font-size: .75rem; margin-left: 5px; }

/* ============ 表单 ============ */
.form-wrap { max-width: 460px; margin: 20px auto 60px; }
.form-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 30px; backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}
.form-title { margin: 0 0 6px; font-size: 1.25rem; }
.form-sub { margin: 0 0 24px; color: var(--fg-dim); font-size: .8125rem; }

.field { margin-bottom: 17px; }
.field label {
  display: block; margin-bottom: 7px; font-size: .8125rem;
  color: var(--fg-dim); font-family: var(--mono);
}
.field label .opt { color: var(--fg-faint); font-size: .75rem; }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 14px; font-size: .9375rem; font-family: inherit;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--fg); transition: .18s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,229,255,.13);
}
:root[data-mode="light"] .field input:focus,
:root[data-mode="light"] .field textarea:focus { box-shadow: 0 0 0 3px rgba(0,119,194,.15); }
.field textarea { resize: vertical; min-height: 96px; line-height: 1.65; }
.field .hint { margin-top: 6px; font-size: .75rem; color: var(--fg-faint); }

.form-foot { margin-top: 24px; display: flex; gap: 10px; align-items: center; }
.form-switch { margin-top: 18px; text-align: center; font-size: .8125rem; color: var(--fg-dim); }
.form-switch a { color: var(--accent); cursor: pointer; text-decoration: none; }
.form-switch a:hover { text-decoration: underline; }

/* ============ 写作页 ============ */
.write-wrap { max-width: 860px; margin: 0 auto 70px; }
.write-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 14px; flex-wrap: wrap; }
.write-title-input {
  width: 100%; padding: 14px 0; font-size: 1.75rem; font-weight: 680;
  background: none; border: none; border-bottom: 2px solid var(--border);
  color: var(--fg); font-family: inherit; transition: .2s;
}
.write-title-input:focus { outline: none; border-bottom-color: var(--accent); }
.write-title-input::placeholder { color: var(--fg-faint); }
.write-body-input {
  width: 100%; min-height: 400px; margin-top: 18px; padding: 18px;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--fg); font-size: .9375rem;
  line-height: 1.85; font-family: inherit; resize: vertical; transition: .18s;
}
.write-body-input:focus { outline: none; border-color: var(--accent); }
.write-meta { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.write-meta .field { flex: 1; min-width: 170px; margin-bottom: 0; }
.write-actions { display: flex; gap: 10px; margin-top: 22px; align-items: center; flex-wrap: wrap; }
.counter { margin-left: auto; font-family: var(--mono); font-size: .75rem; color: var(--fg-faint); }

/* ---- 我的文章：草稿分区 ---- */
.mine-section {
  display: flex; align-items: center; gap: 10px;
  font-size: .9375rem; font-weight: 700; margin: 34px 0 14px;
  color: var(--fg-dim); letter-spacing: .02em;
}
.mine-section:first-of-type { margin-top: 8px; }
.mine-count {
  font-family: var(--mono); font-size: .75rem; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--fg-faint);
}
/* 草稿卡片：整体压暗 + 虚线边框，一眼能看出"还没发出去" */
.post-card.is-draft {
  border-style: dashed;
  background: color-mix(in srgb, var(--bg-soft) 60%, transparent);
}
.post-card.is-draft .post-card-title a { color: var(--fg-dim); }
.draft-badge {
  font-size: .75rem; font-weight: 700; letter-spacing: .06em;
  padding: 2px 8px; border-radius: 4px;
  background: var(--accent); color: var(--sel-fg, #06101f);
}

/* ---- 写作页：编辑 / 预览 切换 ---- */
.write-tabs {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 999px;
}
.write-tab {
  padding: 6px 18px; border: none; background: none; cursor: pointer;
  color: var(--fg-dim); font: inherit; font-size: .8125rem; font-weight: 600;
  border-radius: 999px; transition: .18s;
}
.write-tab:hover { color: var(--fg); }
.write-tab.is-on { background: var(--accent); color: var(--sel-fg, #fff); }

/* 预览区：套用 .post-body 的正文排版，外加一层边框表示"这不是编辑框" */
.write-wrap:has(#w-pane-preview:not([hidden])) .form-title { font-size: 1rem; opacity: .6; }
.preview-title {
  font-size: 1.75rem; font-weight: 680; margin: 0 0 18px;
  padding-bottom: 14px; border-bottom: 2px solid var(--border);
}
.preview-body {
  min-height: 400px; padding: 18px;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 22px;   /* 和下方"分类/摘要/标签"拉开距离 */
}
.preview-empty { color: var(--fg-faint); font-size: .8125rem; margin: -46px 0 0 18px; }

/* 草稿状态提示 */
.write-status { margin: 12px 0 0; font-size: .8125rem; min-height: 1.2em; color: var(--fg-faint); }
.write-status.draft { color: var(--accent); }


/* ============ 文章正文增强 ============ */
/* 正文：已由 marked 渲染成 HTML，不能再用 pre-wrap（否则源码换行/缩进会变成空白） */
.post-body { line-height: 1.9; font-size: 1rem; word-break: break-word; }

/* ---------- Markdown 排版 ---------- */
.post-body > *:first-child { margin-top: 0; }
.post-body > *:last-child { margin-bottom: 0; }
.post-body p { margin: 0 0 1.15em; }
.post-body h1, .post-body h2, .post-body h3,
.post-body h4, .post-body h5, .post-body h6 {
  line-height: 1.35; margin: 1.7em 0 .7em; font-weight: 700; letter-spacing: -.01em;
}
.post-body h1 { font-size: 1.75rem; }
.post-body h2 { font-size: 1.5rem; padding-bottom: .3em; border-bottom: 1px solid var(--border); }
.post-body h3 { font-size: 1.25rem; }
.post-body h4, .post-body h5, .post-body h6 { font-size: 1rem; color: var(--fg-dim); }
.post-body strong { color: var(--fg); font-weight: 700; }
.post-body em { color: var(--fg); }
.post-body del { color: var(--fg-faint); }
.post-body a {
  color: var(--accent); text-decoration: none;
  border-bottom: 1px solid rgba(0,229,255,.28);
  transition: border-color .15s, color .15s;
}
.post-body a:hover { border-bottom-color: var(--accent); }
.post-body hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }

.post-body ul, .post-body ol { margin: 0 0 1.15em; padding-left: 1.5em; }
.post-body li { margin: .35em 0; }
.post-body li > p { margin: .3em 0; }
.post-body ul { list-style: disc; }
.post-body ol { list-style: decimal; }
.post-body li::marker { color: var(--accent); }

.post-body blockquote {
  margin: 1.3em 0; padding: .7em 1.1em;
  border-left: 3px solid var(--accent);
  background: var(--quote-bg);
  border-radius: 0 6px 6px 0;
  color: var(--fg-dim);
}
.post-body blockquote > *:last-child { margin-bottom: 0; }

.post-body code {
  font-family: var(--mono); font-size: .8125em;
  padding: .16em .42em; border-radius: 4px;
  background: var(--code-inline);
  border: 1px solid var(--code-border);
  word-break: break-word;
}
.post-body pre {
  margin: 1.3em 0; padding: 15px 17px; overflow-x: auto;
  background: var(--code-bg); border: 1px solid var(--code-border);
  border-radius: 9px; line-height: 1.65;
}
.post-body pre code {
  padding: 0; background: none; border: 0; font-size: .8125em;
  white-space: pre; word-break: normal;
}

.post-body img { max-width: 100%; height: auto; border-radius: 9px; margin: .6em 0; }

.post-body table {
  /* 关键：不能用 table-layout:auto。中文每个字之间都可断行，auto 布局
     会把第一列判成"可压缩的弹性列"，吃光剩余宽度，后两列被挤出容器。
     固定布局 + 内容自适应滚动才是稳的。 */
  border-collapse: collapse;
  font-size: .9375em;
  table-layout: auto;
  /* 由 min-width 撑到容器宽；列多时按内容自然变宽并横向滚动 */
  min-width: 100%;
  margin: 0;
  /* 不要 white-space: nowrap —— 实测它会禁止中文在单元格内折行，
     让表格撑到 897px（容器 740），剩余宽度全给首列，后两列被挤到边上。
     允许折行后表格正好等于容器宽。 */
  white-space: normal;
}
.post-body table th, .post-body table td {
  padding: 9px 13px; border: 1px solid var(--code-border);
  text-align: left; vertical-align: top;
  min-width: 3.2em; word-break: break-word; overflow-wrap: anywhere;
}
.post-body table th { background: var(--table-head); font-weight: 700; }
/* 自动布局按内容分配，首列（描述性文字）常占去一半以上，
   数字列被挤到「80%」都折行。给首列一个上限，把余量让给其余列。

   但宽度提示必须按列数给：40% + 30% × 2 = 100% 正好是三列表；
   套到四列表就是 130%，浏览器会去压缩其余列，压到只剩一个字宽，
   读起来像竖排。所以列数由 JS 标到 data-cols 上，只对 3 列生效。 */
.post-body table[data-cols="3"] th:first-child,
.post-body table[data-cols="3"] td:first-child { width: 40%; }
.post-body table[data-cols="3"] th:not(:first-child),
.post-body table[data-cols="3"] td:not(:first-child) { width: 30%; }
/* 四列及以上：不设宽度，全部交给内容自适应，只保证别挤成一列字 */
.post-body table:not([data-cols="3"]) th,
.post-body table:not([data-cols="3"]) td { min-width: 4.6em; }
.post-body table tr:nth-child(even) td { background: var(--table-zebra); }

/* 表格外层容器：宽表横向滚动，窄表不撑破版面 */
.table-wrap { width: 100%; margin: 1.4em 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }

.post-body input[type="checkbox"] { margin-right: .5em; accent-color: var(--accent); }

.post-meta-line { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; color: var(--fg-faint); font-family: var(--mono); font-size: .8125rem; margin-bottom: 26px; }
.post-meta-line .author { color: var(--accent); }
.tag-pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: rgba(0,229,255,.09); color: var(--accent);
  font-family: var(--mono); font-size: .75rem; text-decoration: none;
}
.post-actions { display: flex; gap: 9px; margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--border); }

/* ============ 作者徽标 ============ */
.byline-op { color: var(--accent-3); font-family: var(--mono); font-size: .75rem; }

/* ============ 空状态 ============ */
.empty {
  text-align: center; padding: 70px 20px; color: var(--fg-dim);
}
.empty .big { font-size: 2.3rem; margin-bottom: 14px; opacity: .55; }
.empty p { margin: 6px 0; font-size: .9375rem; }

/* ============ Toast ============ */
.toast-wrap {
  position: fixed; top: 76px; right: 24px; z-index: 200;
  display: flex; flex-direction: column; gap: 9px; pointer-events: none;
}
.toast {
  padding: 12px 18px; border-radius: 9px; font-size: .8125rem;
  background: var(--panel-solid); border: 1px solid var(--border);
  box-shadow: var(--shadow); animation: toastIn .26s ease;
  /* 进场动画结束后要停在「可见」——之前旧规则里的 opacity:0 把它拽回去了，
     结果所有提示只在 0.26 秒的动画里闪一下。 */
  opacity: 1;
  max-width: min(330px, calc(100vw - 48px));
  backdrop-filter: blur(14px);
}
.toast.ok  { border-color: rgba(0,255,163,.45); color: var(--accent-3); }
.toast.err { border-color: rgba(255,77,109,.45); color: var(--danger); }
.toast.out { animation: toastOut .26s ease forwards; }
@keyframes toastIn  { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(26px); } }

/* ============ 评论身份标识 ============ */
.cmt-mine { border-left: 2px solid var(--accent) !important; }
.cmt-badge {
  font-size: .75rem; padding: 2px 7px; border-radius: 999px;
  background: rgba(0,229,255,.12); color: var(--accent);
  font-family: var(--mono); margin-left: 7px;
}

/* ============ 响应式 ============ */
@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  .brand-text { display: none; }
  .nav { gap: 3px; }
  .nav-item { padding: 7px 10px; font-size: .8125rem; }
  /* 窄屏按钮不许折行：「登录」两个字被挤成两行，顶栏会撑成两层。
     注意登录/注册按钮在 .user-slot 里，不在 .nav 里。 */
  .btn, .nav-item { white-space: nowrap; }
  .user-slot { display: flex; gap: 6px; align-items: center; }
  .user-slot .btn { padding: 7px 11px; font-size: .8125rem; }
  .menu { right: 12px; left: 12px; min-width: 0; }
  .form-card { padding: 22px; }
  .write-title-input { font-size: 1.25rem; }
  .toast-wrap { right: 12px; left: 12px; }
  .toast { max-width: none; }
}

/* ============ 文章详情 ============ */
.post { max-width: 640px; margin: 34px auto 0; }
.post-head { margin-bottom: 8px; }
.post-title {
  font-size: clamp(1.6rem, 4.2vw, 2.3rem); line-height: 1.28;
  margin: 0 0 16px; font-weight: 700; letter-spacing: -.02em;
  overflow-wrap: anywhere;
}
/* .post-body 已在上面定义，此处补齐段落间距 */
.post-body { color: var(--fg); }

/* ============ 评论区 ============ */
.comments { max-width: 640px; margin: 60px auto 70px; }
.csec-title {
  font-size: 1rem; font-weight: 660; margin: 0 0 20px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.csec-title .cnt { color: var(--fg-faint); font-family: var(--mono); font-size: .8125rem; font-weight: 400; }

.cmt-form-wrap { margin-bottom: 30px; }
.cmt-form {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; backdrop-filter: blur(12px);
}
.cmt-as { font-size: .8125rem; color: var(--fg-dim); margin-bottom: 11px; }
.cmt-as b { color: var(--accent); }

.cmt-input {
  width: 100%; padding: 10px 13px; font-size: .9375rem; font-family: inherit;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--fg);
  transition: .18s; margin-bottom: 10px; resize: vertical; line-height: 1.6;
}
.cmt-input:focus { outline: none; border-color: var(--accent); }
.cmt-input::placeholder { color: var(--fg-faint); }
textarea.cmt-input { min-height: 88px; }

.cmt-form-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cmt-hint { font-size: .75rem; color: var(--fg-faint); }

.cmt-list { display: flex; flex-direction: column; gap: 2px; }
.cmt-empty { color: var(--fg-faint); font-size: .8125rem; text-align: center; padding: 26px 0; }

.cmt { padding: 15px 16px; border-bottom: 1px solid var(--border); }
.cmt:last-child { border-bottom: none; }
.cmt-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.cmt-author { font-weight: 640; font-size: .9375rem; color: var(--fg); }
.cmt-time { font-family: var(--mono); font-size: .75rem; color: var(--fg-faint); }
.cmt-reply {
  margin-left: auto; background: none; border: none; cursor: pointer;
  color: var(--fg-faint); font-size: .75rem; font-family: inherit;
  padding: 2px 7px; border-radius: 9px; transition: .15s;
}
.cmt-reply:hover { color: var(--accent); background: rgba(0,229,255,.08); }
.cmt-body { font-size: .9375rem; color: var(--fg-dim); white-space: pre-wrap; word-break: break-word; line-height: 1.75; }

/* ============ 首页卡片补充 ============ */
.post-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.post-card-date { margin-left: auto; font-family: var(--mono); font-size: .75rem; color: var(--fg-faint); }
.post-card-foot { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: .75rem; color: var(--fg-faint); flex-wrap: wrap; }
.dot { opacity: .5; }

@media (max-width: 640px) {
  .comment, .cmt { padding: 13px 4px; }
  .cmt[style*="margin-left"] { margin-left: 0 !important; }
}

/* ---------- 访问日志 ---------- */
.visit-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px; margin: 0 0 26px;
}
.visit-stat {
  padding: 16px 18px; border-radius: var(--radius);
  background: var(--bg-soft); border: 1px solid var(--border);
}
.visit-stat-num { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.visit-stat-key { font-size: .8125rem; color: var(--fg-dim); margin-top: 4px; }
.visit-stat-sub { font-size: .75rem; color: var(--fg-faint); margin-top: 2px; }

.visit-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 26px; }
/* grid 子项默认 min-width:auto，里面有一条不可断行的长路径时，
   列会被撑到内容宽度 —— 手机上直接把页面顶宽 204px。 */
.visit-col { min-width: 0; }
@media (max-width: 700px) { .visit-cols { grid-template-columns: 1fr; } }
.visit-col-title { font-size: .8125rem; font-weight: 650; margin: 0 0 10px; color: var(--fg-dim); }
.visit-rank { display: flex; flex-direction: column; gap: 3px; }
.visit-rank-row {
  position: relative; display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 9px; overflow: hidden;
  font-size: .8125rem;
}
.visit-rank-bar {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--sel-bg); border-radius: 9px; z-index: 0;
}
.visit-rank-label {
  position: relative; z-index: 1; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--mono, ui-monospace, monospace);
}
.visit-rank-num { position: relative; z-index: 1; color: var(--fg-faint); font-variant-numeric: tabular-nums; }

.visit-filter {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px;
}
.v-input {
  padding: 7px 10px; font-size: .8125rem; border-radius: 9px;
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--fg);
  font-family: inherit;
}
.v-input:focus { outline: none; border-color: var(--accent); }
#v-ip, #v-path { min-width: 130px; flex: 1 1 130px; }

.visit-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.visit-table { width: 100%; border-collapse: collapse; font-size: .75rem; }
.visit-table th {
  text-align: left; padding: 9px 12px; white-space: nowrap;
  background: var(--table-head); font-weight: 650; color: var(--fg-dim);
  border-bottom: 1px solid var(--border);
}
.visit-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.visit-table tbody tr:last-child td { border-bottom: none; }
.visit-table tbody tr:hover { background: var(--table-zebra); }
.vt-time {
  white-space: nowrap; color: var(--fg-dim);
  font-variant-numeric: tabular-nums; font-size: .75rem; width: 1%;
}
/* IP 列：固定宽度。
   之前写 width:1% 想让它按内容收缩，但格子里是三行 block，
   表格算「最小内容宽度」时按最长的运营商名来算，
   运营商一动辄 20 个字符，路径列就被压成 0 了。 */
.vt-ip {
  font-family: var(--mono, ui-monospace, monospace);
  white-space: nowrap;
  width: 192px; max-width: 192px;
}
.vt-who { white-space: nowrap; }
.visit-user { color: var(--accent); font-weight: 600; }
.visit-anon { color: var(--fg-faint); }
.vt-dev { white-space: nowrap; }
.vt-meta { display: block; font-size: .75rem; color: var(--fg-faint); margin-top: 1px; }
.vt-path {
  font-family: var(--mono, ui-monospace, monospace);
  word-break: break-word;
  width: 100%;                 /* 吃掉剩余空间，其它列都是 width:1% 的收缩列 */
}
.vt-method { color: var(--fg-faint); font-size: .75rem; }
.visit-dev { font-size: .75rem; }
.dev-bot, .dev-cli { color: var(--fg-faint); }
.st { padding: 1px 6px; border-radius: 4px; font-variant-numeric: tabular-nums; font-size: .75rem; }
.st-ok   { background: var(--sel-bg); color: var(--accent); }
.st-warn { background: rgba(214,158,46,.16); color: #b8860b; }
.st-err  { background: rgba(220,53,69,.14); color: #c9302c; }
.st-mute { color: var(--fg-faint); }

.visit-count { font-size: .75rem; color: var(--fg-faint); margin-top: 8px; }
.visit-pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin: 18px 0 60px; }
.visit-pageno { font-size: .8125rem; color: var(--fg-dim); font-variant-numeric: tabular-nums; }
.visit-empty, .visit-loading {
  padding: 40px 0; text-align: center; color: var(--fg-faint); font-size: .8125rem;
}

/* ============ 短链接管理 ============ */
.link-new {
  max-width: 1180px;
  margin: 0 0 22px;
  padding: 18px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.link-new-row { display: flex; gap: 10px; }
.link-new-row + .link-new-row { margin-top: 12px; }
.link-url { flex: 1; font-family: var(--mono, ui-monospace, monospace); font-size: .8125rem; }
.link-new-opt { flex-wrap: wrap; align-items: flex-end; }
.link-new-opt label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: .75rem; color: var(--fg-dim); letter-spacing: .04em;
}
.link-new-opt label:nth-child(2) { flex: 1; min-width: 180px; }
.link-new-opt .v-input { height: 34px; }

.link-stat {
  display: flex; gap: 24px;
  font-size: .8125rem; color: var(--fg-dim);
  margin: 0 0 14px;
}
.link-stat b { color: var(--fg); font-variant-numeric: tabular-nums; }

.link-table {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
}
.link-head, .link-row {
  display: grid;
  grid-template-columns: 190px 1fr 64px 130px 130px;
  gap: 12px;
  align-items: center;
  padding: 11px 16px;
}
.link-head {
  font-size: .75rem; color: var(--fg-faint);
  letter-spacing: .1em;
  border-bottom: 1px solid var(--border);
  background: var(--table-head, rgba(255,255,255,.02));
}
.link-row { border-bottom: 1px solid var(--border); font-size: .8125rem; }
.link-row:last-child { border-bottom: none; }
.link-row:hover { background: var(--table-zebra); }
.link-row-off { opacity: .55; }

.lk-short { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lk-code {
  font-family: var(--mono, ui-monospace, monospace);
  color: var(--accent); text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lk-code:hover { text-decoration: underline; }
.lk-copy {
  flex: none;
  font-size: .75rem; line-height: 1;
  padding: 4px 7px; border-radius: 4px;
  background: transparent; color: var(--fg-faint);
  border: 1px solid var(--border); cursor: pointer;
}
.lk-copy:hover { color: var(--accent); border-color: var(--border-hot); }

.lk-target { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lk-target b { font-weight: 600; font-size: .8125rem; }
.lk-url {
  font-family: var(--mono, ui-monospace, monospace);
  font-size: .75rem; color: var(--fg-faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lk-hits { font-variant-numeric: tabular-nums; color: var(--fg-dim); }

.lk-state { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.lk-badge {
  font-size: .75rem; padding: 2px 7px; border-radius: 4px;
  letter-spacing: .04em;
}
.lk-badge-live { background: rgba(46,204,113,.14); color: #2ecc71; }
.lk-badge-off  { background: rgba(140,150,165,.16); color: var(--fg-dim); }
.lk-badge-exp  { background: rgba(241,196,15,.15); color: #f1c40f; }
.lk-exp { font-size: .75rem; color: var(--fg-faint); }

.lk-act { display: flex; gap: 6px; justify-content: flex-end; }

@media (max-width: 900px) {
  .link-head { display: none; }
  /* 手机上改成卡片流：短码 + 操作一行，目标占满，点击数放到底部行 */
  .link-row {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "short  act"
      "target target"
      "state  hits";
    gap: 8px 12px;
    padding: 14px 16px;
    align-items: start;
  }
  .lk-short  { grid-area: short; flex-wrap: wrap; }
  .lk-act    { grid-area: act; justify-content: flex-end; }
  .lk-target { grid-area: target; }
  .lk-state  { grid-area: state; flex-direction: row; align-items: center; gap: 8px; }
  .lk-hits   { grid-area: hits; text-align: right; font-size: .75rem; }
  .lk-hits::after { content: " 次"; color: var(--fg-faint); }

  /* 表单在窄屏里竖排，标签文字和输入框同一行高度，别让「（选填）」单独占一行 */
  .link-new-opt { gap: 10px; }
  .link-new-opt label {
    flex: 1 1 100%;
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }
  .link-new-opt label:nth-child(2) { min-width: 0; }
  .link-new-opt .v-input { flex: 1; min-width: 0; }
}

/* 访问日志：地区 + 运营商 */
.vt-region {
  display: block;
  margin-top: 2px;
  font-family: var(--sans, system-ui, sans-serif);
  font-size: .75rem;
  color: var(--fg-dim);
  letter-spacing: .02em;
}
/* 运营商比地区再低一档：一行里信息密度已经够了，
   它只在你想知道「这是家宽还是机房」时才需要看清 */
.vt-org {
  display: block;
  margin-top: 1px;
  font-family: var(--sans, system-ui, sans-serif);
  font-size: .75rem;
  color: var(--fg-faint);
  letter-spacing: .01em;
  line-height: 1.3;
  /* 运营商名可能很长（"Hong Kong Broadband Network Ltd"），
     截断成一行，完整值放 title 里 —— 不让它撑开整列 */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vt-none { color: var(--fg-faint); }

/* 状态列钉在右边：横向滚动时不至于要先滑到尽头才知道 404 还是 200 */
.visit-table thead th:last-child,
.visit-table tbody td:last-child {
  position: sticky; right: 0;
  background: var(--bg-card);
  box-shadow: -8px 0 10px -10px rgba(0,0,0,.5);
}
.visit-table tbody tr:hover td:last-child { background: var(--table-zebra); }
.vt-status { text-align: right; }

/* ---------- 搜索页 ---------- */
.search-bar {
  display: flex; gap: 10px; margin: 22px 0 26px;
}
.search-input {
  flex: 1; min-width: 0;
  padding: 12px 16px;
  font-size: .9375rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  transition: border-color .15s;
}
.search-input:focus {
  outline: none;
  border-color: var(--accent);
}
.search-count {
  margin: 0 0 16px;
  font-size: .8125rem;
  color: var(--fg-dim);
}

/* ---------- 文章目录 ---------- */
.toc {
  position: fixed;
  top: 96px;
  left: calc(50% + 348px);
  width: 190px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  padding: 4px 0;
  font-size: .75rem;
  display: none;
}
/* 屏幕够宽才显示：窄屏放侧栏会把正文挤成一条线 */
@media (min-width: 1200px) {
  .toc { display: block; }
}
.toc-title {
  font-size: .75rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin: 0 0 10px 10px;
}
.toc-item {
  position: relative;
  display: block;
  padding: 5px 10px;
  color: var(--fg-dim);
  text-decoration: none;
  border-left: 2px solid transparent;
  line-height: 1.45;
  transition: color .15s, border-color .15s;
}
.toc-item:hover { color: var(--fg); }
.toc-item.active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}
.toc-h3 { padding-left: 24px; font-size: .75rem; }
.toc-num {
  position: absolute; left: -14px; top: 5px;
  font-size: .75rem; color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
  opacity: 0; transition: opacity .15s;
}
.toc-item:hover .toc-num, .toc-item.active .toc-num { opacity: 1; }

/* ---------- 阅读进度条 ---------- */
.read-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2, var(--accent)));
  transform: scaleX(0);
  transform-origin: 0 50%;
  opacity: 0;
  transition: opacity .25s;
  z-index: 999;
  pointer-events: none;
}
.read-bar.show { opacity: 1; }

/* ---------- 相关文章 ---------- */
.related {
  max-width: 780px;
  margin: 44px auto 0;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}
.related-title {
  font-size: .75rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin: 0 0 16px;
  font-weight: 600;
}
.related-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.related-item {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.related-item:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.related-name {
  display: block;
  font-weight: 600;
  color: var(--fg);
  font-size: .9375rem;
  margin-bottom: 6px;
  line-height: 1.4;
}
.related-sum {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: .75rem;
  color: var(--fg-dim);
  line-height: 1.55;
}

/* ================= 状态监控大屏 ================= */

.st-empty { color: var(--fg-faint); font-size: .8125rem; padding: 14px 0; }

/* 顶部四个数字 */
.st-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 22px 0 8px;
}
.st-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 18px;
  background: var(--bg-card, var(--panel-solid));
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.st-card-k { font-size: .75rem; color: var(--fg-faint); letter-spacing: .04em; }
.st-card-v {
  font-size: 1.75rem; font-weight: 680; line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.st-card-s { font-size: .75rem; color: var(--fg-dim); }
/* 整体状态卡用颜色说话，扫一眼就知道好坏 */
.st-card.good .st-card-v { color: #1a9c6b; }
.st-card.bad  .st-card-v { color: var(--danger, #d64545); }
.st-card.bad  { border-color: rgba(214,69,69,.42); }

.st-h2 {
  font-size: .75rem; font-weight: 600; color: var(--fg-faint);
  letter-spacing: .08em; text-transform: uppercase;
  margin: 30px 0 12px;
}

/* 服务列表 */
.st-svc {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 22px;
}
.st-svc-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
  font-size: .8125rem;
}
.st-svc-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex: none;
  background: #1a9c6b;
  box-shadow: 0 0 0 3px rgba(26,156,107,.16);
}
.st-svc-item.bad .st-svc-dot {
  background: var(--danger, #d64545);
  box-shadow: 0 0 0 3px rgba(214,69,69,.18);
}
.st-svc-name { flex: none; min-width: 76px; }
.st-svc-note {
  color: var(--fg-dim); font-size: .75rem;
  font-variant-numeric: tabular-nums;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 折线图 */
.st-chart { margin-top: 4px; }
.st-svg { display: block; width: 100%; }
.st-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
  /* viewBox 被横向拉伸，不加这个线宽会跟着变形 */
  vector-effect: non-scaling-stroke;
}
.st-area { fill: var(--accent); opacity: .1; }
.st-cap {
  margin: 8px 0 0;
  font-size: .75rem; color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
}

/* 每小时可用率：一排小格子 */
.st-bars {
  display: flex; align-items: flex-end; gap: 3px;
  height: 54px;
  padding: 0 1px;
}
.st-bar {
  flex: 1 1 0; min-width: 3px;
  display: flex; align-items: flex-end;
  height: 100%;
}
.st-bar span {
  display: block; width: 100%; height: 100%;
  border-radius: 4px;
  background: #1a9c6b;
  opacity: .82;
}
.st-bar.warn span { background: #d99a2b; opacity: .88; }
.st-bar.bad  span { background: var(--danger, #d64545); opacity: .92; }
.st-bar:hover span { opacity: 1; }

/* 事件列表 */
.st-inclist {
  list-style: none; margin: 0; padding: 0;
  border-top: 1px solid var(--border);
}
.st-inc {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: .8125rem;
}
.st-inc-dot {
  width: 7px; height: 7px; border-radius: 50%;
  flex: none; margin-top: 6px;
  background: #1a9c6b;
}
.st-inc.down .st-inc-dot { background: var(--danger, #d64545); }
.st-inc.warn .st-inc-dot { background: #d99a2b; }
.st-inc.done .st-inc-dot { background: var(--fg-faint); opacity: .5; }
.st-inc-body { flex: 1 1 auto; min-width: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.st-inc-body b { font-weight: 600; }
.st-inc-body span { color: var(--fg-dim); }
.st-inc-t {
  flex: none; color: var(--fg-faint); font-size: .75rem;
  font-variant-numeric: tabular-nums;
  padding-top: 1px;
}

@media (max-width: 720px) {
  .st-cards { grid-template-columns: repeat(2, 1fr); }
  .st-svc   { grid-template-columns: 1fr; }
  .st-card-v { font-size: 1.25rem; }
  .st-inc { flex-wrap: wrap; }
  .st-inc-t { width: 100%; padding-left: 17px; }
}

/* 无采样的小时：留一个浅色占位，表示「这段时间没有数据」而不是「故障」 */
.st-bar.none span { background: var(--border); opacity: .55; }
.st-bar.none:hover span { opacity: .8; }

/* 文章页 meta：创建时间之后补的「编辑于」，
   比正文浅一档，让人一眼分清哪个是首次发布 */
.meta-edited { color: var(--fg-faint); }

/* ---------- 后台统一入口 ---------- */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
  max-width: 780px;
  margin: 6px 0 30px;
}
.admin-card {
  display: block;
  padding: 20px 22px 18px;
  border-radius: var(--radius);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: border-color .16s, background .16s, transform .16s;
}
.admin-card:hover {
  border-color: var(--border-hot);
  background: var(--bg-elev, var(--bg-soft));
  transform: translateY(-2px);
}
.ac-head { display: flex; align-items: center; gap: 10px; }
.ac-ico {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: rgba(0, 119, 194, .10);
  color: var(--accent);
  font-size: .9375rem;
  line-height: 1;
}
.ac-name { font-size: 1rem; font-weight: 650; }
.ac-desc { margin: 10px 0 0; font-size: .8125rem; color: var(--fg-dim); line-height: 1.55; }
.ac-meta {
  margin-top: 12px;
  font-size: .75rem;
  color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
}

/* 后台子页面的返回链接 */
.ac-back {
  display: inline-block;
  margin-right: 10px;
  color: var(--fg-dim);
  text-decoration: none;
  white-space: nowrap;
}
.ac-back:hover { color: var(--accent); }

/* ---------- 后台入口的实时概览 ---------- */
.as-live { max-width: 780px; margin: 0 0 60px; }
.as-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 26px;
}
.as-item { background: var(--bg-soft); padding: 14px 18px; }
.as-k {
  font-size: .75rem;
  color: var(--fg-faint);
  letter-spacing: .04em;
  margin-bottom: 6px;
}
.as-v {
  font-size: .8125rem;
  color: var(--fg);
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  /* break-word 会在中文词中间断行（「已是最/新」），
     用 anywhere 只在实在放不下时才断 */
  overflow-wrap: anywhere;
}
.as-warn {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.w-chip {
  font-size: .75rem;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(240, 160, 40, .10);
  border: 1px solid rgba(240, 160, 40, .34);
  color: #8a5a00;
  line-height: 1.4;
}
:root[data-mode="dark"] .w-chip,
:root:not([data-mode="light"]) .w-chip {
  background: rgba(240, 170, 60, .10);
  border-color: rgba(240, 170, 60, .30);
  color: #e8b964;
}
@media (max-width: 640px) {
  .as-grid { grid-template-columns: 1fr; }
}

/* ── 访问日志表格：窄屏 ──
   必须放在文件末尾。与 .vt-ip 等基础规则同权重，
   放在前面会被后面的 width: 192px 反覆盖。 */
@media (max-width: 700px) {
  /* 六列在 390px 里塞不下。原先 width:100% 硬挤，IP 列吃掉 192px，
     路径列只剩 49px —— URL 逐字折行，一行变成两百多像素高。
     改成固定列宽 + 横向滚动：信息不丢，行高正常。 */
  .visit-table { min-width: 740px; table-layout: fixed; }
  .visit-table th:nth-child(1), .visit-table td:nth-child(1) { width: 112px; }
  .visit-table th:nth-child(2), .visit-table td:nth-child(2) { width: 164px; }
  /* 访客列要放得下「无 JS 痕迹」这类标记，52px 会被撑破 */
  .visit-table th:nth-child(3), .visit-table td:nth-child(3) { width: 88px; }
  .visit-table th:nth-child(4), .visit-table td:nth-child(4) { width: 140px; }
  .visit-table th:nth-child(6), .visit-table td:nth-child(6) { width: 58px; }
  .vt-ip { width: auto; max-width: none; }
  /* 已经要横滚了，再把状态列钉在右边只会压住访客/设备两列 */
  .visit-table thead th:last-child,
  .visit-table tbody td:last-child { position: static; box-shadow: none; }
  .vt-dev { white-space: normal; }   /* 设备信息允许折行，别再撑宽 */
  .vt-org { display: none; }         /* 运营商名在这个尺寸不值两行高度 */
}

/* ---------- 分类总览 ---------- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  max-width: 780px;
  margin: 6px 0 70px;
}
.cat-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 20px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  text-decoration: none;
  color: inherit;
  transition: border-color .16s, transform .16s;
}
.cat-card:hover { border-color: var(--border-hot); transform: translateY(-2px); }
.cat-card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.cat-card-name { font-size: 1rem; font-weight: 660; }
.cat-card-n {
  font-size: .75rem;
  color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
  /* 数字后面缀个「篇」，不然单独一个数看不懂是啥 */
}
.cat-card-n::after { content: ' 篇'; }
.cat-card-desc {
  margin: 0;
  font-size: .8125rem;
  color: var(--fg-dim);
  line-height: 1.6;
  /* 描述长短不一，固定两行高让卡片底边对齐 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}
.cat-card-foot { font-size: .75rem; color: var(--fg-faint); }

@media (max-width: 640px) {
  .cat-grid { grid-template-columns: 1fr; gap: 10px; }
}

/* ---------- 游戏卡片 ---------- */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.game-card {
  display: flex;
  flex-direction: column;
  padding: 18px 20px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
  transition: border-color .15s, transform .15s;
}
.game-card:hover { border-color: var(--border-hot); transform: translateY(-1px); }
.gm-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.gm-name { margin: 0; font-size: 1rem; font-weight: 660; }
.gm-en { margin: 2px 0 0; font-size: .75rem; color: var(--fg-faint); letter-spacing: .02em; }
.gm-size { font-size: .75rem; color: var(--fg-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.gm-desc { margin: 12px 0 0; font-size: .8125rem; line-height: 1.7; color: var(--fg-dim); }
.gm-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.gm-tag {
  padding: 2px 8px;
  font-size: .75rem;
  border-radius: 99px;
  color: var(--fg-dim);
  background: var(--bg-sunk, rgba(0,0,0,.16));
  border: 1px solid var(--border);
}
.gm-note { margin: 10px 0 0; font-size: .75rem; color: var(--fg-faint); }
.gm-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-top: auto; padding-top: 16px;
}
.gm-lic { font-size: .75rem; color: var(--fg-faint); }

.gm-tip {
  padding: 14px 18px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
}
.gm-tip p { margin: 0; font-size: .8125rem; line-height: 1.75; color: var(--fg-faint); }
.gm-tip p + p { margin-top: 6px; }
.gm-tip code {
  padding: 1px 5px;
  font-size: .9375em;
  border-radius: 4px;
  background: var(--code-inline);
  font-family: var(--mono, ui-monospace, monospace);
}

@media (max-width: 640px) {
  .game-grid { grid-template-columns: 1fr; }
  .game-card { padding: 16px 16px 14px; }
}

/* 游戏卡底部：窄屏那条 `.btn { width:100% }` 会让按钮撑满整行，
   把许可证挤到卡片外面去 —— 这里给它改回按内容宽度。 */
.gm-foot { flex-wrap: wrap; }
.gm-foot .btn { width: auto; flex: 0 0 auto; min-height: 40px; }
.gm-lic { white-space: nowrap; text-align: right; }

/* ---------- 游戏存档条 ---------- */
.gm-save {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 10px 0 2px; padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: .75rem; color: var(--fg-faint);
}
.gs-state { color: var(--fg-faint); }
.gs-ok { color: var(--ok-fg, #1a7f5a); font-weight: 600; }
.gs-meta { color: var(--fg-faint); }
.gs-btn {
  padding: 2px 8px; border-radius: 9px; cursor: pointer;
  font: inherit; font-size: .75rem;
  border: 1px solid var(--border); background: transparent; color: var(--fg-dim);
  transition: .15s;
}
.gs-btn:hover { border-color: var(--border-hot); color: var(--accent); }
.gs-danger:hover { border-color: rgba(220,60,80,.55); color: #d63c50; }

/* ---- 访问性质标记（真人 / 无 JS 痕迹 / 爬虫 / 扫描 / 命令行 / 本机）----
   放在「访客」那一格的名字下面一行。颜色只用来区分，不表示好坏：
   绿色是确认是人，灰色是不知道，红色才是明确的攻击探测。 */
.vk {
  display: inline-block;
  margin-top: 3px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: .75rem;
  line-height: 1.55;
  letter-spacing: .02em;
  white-space: nowrap;
  background: rgba(120, 135, 160, .16);
  color: var(--fg-dim);
}
.vt-who .vk { display: block; width: fit-content; }
.vk-human { background: rgba(23, 121, 90, .14);  color: #17795a; }
.vk-page  { background: rgba(120, 135, 160, .16); color: var(--fg-dim); }
.vk-bot   { background: rgba(0, 120, 200, .14);  color: #0b6fa4; }
.vk-scan  { background: rgba(220, 53, 69, .13);  color: #c9302c; }
.vk-tool  { background: rgba(124, 92, 255, .14); color: #6b4ee6; }
.vk-self  { background: rgba(0, 150, 136, .14);  color: #0f7f74; }

:root[data-mode="dark"] .vk-human { background: rgba(46, 230, 168, .14); color: #43d9a3; }
:root[data-mode="dark"] .vk-bot   { background: rgba(80, 170, 255, .14); color: #6bb6ff; }
:root[data-mode="dark"] .vk-scan  { background: rgba(255, 90, 110, .14); color: #ff7a8a; }
:root[data-mode="dark"] .vk-tool  { background: rgba(150, 120, 255, .16); color: #a08bff; }
:root[data-mode="dark"] .vk-self  { background: rgba(0, 200, 180, .14); color: #38d6c0; }

/* ── 双链 ─────────────────────────────────────────────── */
.wikilink {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  padding-bottom: 1px;
}
.wikilink:hover { border-bottom-color: var(--accent); }

/* 指向还不存在的文章：不做成死链，只是标一下 */
.wikilink-missing {
  color: var(--fg-faint);
  border-bottom: 1px dashed color-mix(in srgb, var(--fg-faint) 60%, transparent);
  cursor: help;
}

.link-broken-note {
  max-width: 780px; margin: 18px auto 0; padding: 10px 14px;
  font-size: .8125rem; color: var(--fg-dim); line-height: 1.7;
  background: rgba(240, 190, 90, .07);
  border: 1px dashed rgba(240, 190, 90, .32);
  border-radius: var(--radius-sm);
}
.link-broken-note code { font-size: .75em; }

.backlinks { max-width: 780px; margin: 44px auto 0; padding-top: 22px; border-top: 1px solid var(--border); }
.bl-title { font-size: .8125rem; font-weight: 600; color: var(--fg-dim); letter-spacing: .04em; margin: 0 0 12px; }
.bl-title .cnt { font-family: var(--mono, monospace); color: var(--fg-faint); font-weight: 400; }
.bl-list { list-style: none; margin: 0; padding: 0; }
.bl-item { padding: 9px 0; border-bottom: 1px dashed var(--border); }
.bl-item:last-child { border-bottom: none; }
.bl-name { color: var(--accent); text-decoration: none; font-size: .9375rem; }
.bl-name:hover { text-decoration: underline; }
.bl-sum { display: block; margin-top: 3px; font-size: .8125rem; color: var(--fg-faint); line-height: 1.6; }

/* 编辑页的双链用法提示 */
.write-tip {
  margin: 10px 0 0; font-size: .75rem; line-height: 1.85; color: var(--fg-faint);
}
.write-tip code {
  font-family: var(--mono, monospace); font-size: .9375em;
  padding: 1px 5px; border-radius: 4px;
  background: var(--code-inline); border: 1px solid var(--code-border);
  color: var(--fg-dim);
}

/* ================= 历史版本 ================= */
.write-hist-btn { margin-left: auto; }
.write-hist-btn.is-on {
  border-color: var(--border-hot);
  color: var(--accent);
}

.rev {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
}
.rev-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.rev-head strong { font-size: .9375rem; }
.rev-count { color: var(--fg-faint); font-size: .75rem; }
.rev-head .btn { margin-left: auto; }

.rev-list { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto; }
.rev-row {
  display: grid;
  grid-template-columns: 46px 52px 1fr auto auto auto;
  gap: 10px; align-items: center;
  width: 100%; padding: 7px 9px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--fg-dim);
  font: inherit; font-size: .75rem; text-align: left; cursor: pointer;
  transition: .15s;
}
.rev-row:hover { background: var(--panel); color: var(--fg); }
.rev-row.is-on { border-color: var(--border-hot); background: var(--panel); color: var(--fg); }
.rev-id { font-family: var(--mono); color: var(--fg-faint); }
.rev-act {
  font-size: .75rem; padding: 1px 7px; border-radius: 99px;
  border: 1px solid var(--border); color: var(--fg-dim); text-align: center;
}
.rev-act-create  { color: var(--accent-3); border-color: rgba(0,255,163,.35); }
.rev-act-publish { color: var(--accent);   border-color: rgba(0,229,255,.35); }
.rev-act-revert  { color: #ffb454;         border-color: rgba(255,180,84,.35); }
.rev-at { color: var(--fg-dim); font-variant-numeric: tabular-nums; }
.rev-who { color: var(--fg-faint); }
.rev-chars { color: var(--fg-faint); font-variant-numeric: tabular-nums; }
.rev-tag {
  font-size: .75rem; padding: 1px 7px; border-radius: 99px;
  background: rgba(0,229,255,.12); color: var(--accent);
}

.rev-diff { margin-top: 12px; }
.rev-diff-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 8px; font-size: .75rem; color: var(--fg-dim);
}
.rev-diff-id { font-family: var(--mono); }
.rev-diff-stat { color: var(--fg-faint); }
.rev-diff-head .btn { margin-left: auto; }
.rev-same { color: var(--fg-faint); font-size: .8125rem; padding: 6px 0; }

.diff {
  margin: 0; padding: 10px 12px;
  max-height: 420px; overflow: auto;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--code-bg);
  font-family: var(--mono); font-size: .75rem; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
}
.dl { display: block; padding: 0 4px; }
.dl-same { color: var(--fg-dim); }
.dl-ins  { background: rgba(0,255,163,.11); color: #7cf5c0; }
.dl-del  { background: rgba(255,77,109,.11); color: #ff9db0; }

/* ================= 操作日志 ================= */
.act-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 18px 0 12px;
}
.act-total { color: var(--fg-faint); font-size: .75rem; margin-left: auto; }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 99px; overflow: hidden; }
.seg-btn {
  padding: 6px 14px; border: 0; background: transparent;
  color: var(--fg-dim); font: inherit; font-size: .75rem; cursor: pointer;
}
.seg-btn.is-on { background: var(--panel); color: var(--accent); }

.act-list { display: flex; flex-direction: column; gap: 1px; }
.act-row {
  display: grid;
  grid-template-columns: 138px 88px 96px 1fr 1.2fr 26px;
  gap: 10px; align-items: center;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  font-size: .75rem;
}
.act-row:hover { background: var(--table-zebra); }
.act-at { color: var(--fg-dim); font-variant-numeric: tabular-nums; }
.act-who { color: var(--fg); }
.act-kind { color: var(--accent); }
.act-target, .act-detail {
  color: var(--fg-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.act-detail { color: var(--fg-faint); }
.act-del {
  border: 0; background: transparent; color: var(--fg-faint);
  font-size: 1rem; line-height: 1; cursor: pointer; padding: 2px 4px;
  border-radius: 9px;
}
.act-del:hover { color: var(--danger); background: rgba(255,77,109,.1); }

.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 22px 0 10px; }
.pager-n { color: var(--fg-dim); font-size: .8125rem; font-variant-numeric: tabular-nums; }

@media (max-width: 700px) {
  .rev-row { grid-template-columns: 42px 48px 1fr auto; }
  .rev-who, .rev-chars { display: none; }
  .act-row {
    grid-template-columns: 1fr 26px;
    grid-template-areas: "at del" "kind del" "target target" "detail detail";
    gap: 4px 8px;
  }
  .act-at { grid-area: at; }
  .act-del { grid-area: del; align-self: start; }
  .act-kind { grid-area: kind; }
  .act-target { grid-area: target; }
  .act-detail { grid-area: detail; white-space: normal; }
  .act-who { display: none; }
}

/* 任何自带 display 的元素都会盖掉浏览器的 [hidden]，
   .pager{display:flex} / .seg{display:inline-flex} 就吃过这个亏：
   设成 hidden 了还照常显示。统一收口。 */
[hidden] { display: none !important; }

/* 操作日志的表头 */
.act-head {
  display: grid;
  grid-template-columns: 138px 88px 96px 1fr 1.2fr 26px;
  gap: 10px; padding: 0 10px 7px;
  border-bottom: 1px solid var(--border);
  color: var(--fg-faint); font-size: .75rem; letter-spacing: .04em;
}
@media (max-width: 700px) { .act-head { display: none; } }

/* 操作日志的筛选控件：这里没有 .field 包着，样式得自己给，
   否则是浏览器原生的那个灰框下拉，和整站不是一个东西。 */
.act-bar select {
  padding: 7px 10px; font-size: .8125rem; border-radius: 9px;
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--fg);
  font-family: inherit;
}
.act-bar select:focus { outline: none; border-color: var(--accent); }

/* 窄屏顶栏：加了「游戏」之后 390px 放不下了，
   最右边的「注册」会被推出屏幕（bar.scrollWidth 422 > 390）。
   这里把内边距和间距收一收，再让导航自身可以横向滚动兜底。 */
@media (max-width: 480px) {
  .topbar { padding: 10px 12px; gap: 8px; }
  /* 六项 + 右侧三个按钮在 390px 下放不开，允许横向滑动；
     右边缘留一段渐隐，让「还能往右滑」这件事看得出来。 */
  .nav {
    gap: 0; min-width: 0; overflow-x: auto; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 26px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 26px), transparent);
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item { padding: 7px 5px; font-size: .75rem; white-space: nowrap; }
  .topbar-right { flex: 0 0 auto; gap: 6px; }
  .user-slot .btn { padding: 7px 10px; font-size: .8125rem; }
}

/* 历史面板在窄屏：标题和按钮别挤成一列 */
@media (max-width: 700px) {
  .rev-head { flex-wrap: wrap; row-gap: 6px; }
  .rev-head strong, .rev-count { white-space: nowrap; }
  .rev-head .btn { width: auto; margin-left: auto; }
  .rev-diff-head .btn { width: auto; }
}

/* 窄屏：提示改从底部升起。
   原来固定在 top:76px，390px 下会横跨整行、正好盖住页面标题。 */
@media (max-width: 640px) {
  .toast-wrap {
    top: auto; bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    left: 16px; right: 16px; align-items: center;
  }
  .toast { max-width: 100%; }
  @keyframes toastIn  { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
  @keyframes toastOut { to   { opacity: 0; transform: translateY(14px); } }
}

/* ============ 人机交互优化 ============ */

/* ── 1. 焦点环：只在键盘操作时出现，鼠标点击不闪框 ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
/* 深色主题下青色环贴着黑底，加一圈暗描边把它托起来 */
:root[data-mode="dark"] :focus-visible,
html[data-mode="dark"] :focus-visible {
  outline-color: #7ef0ff;
  box-shadow: 0 0 0 4px rgba(0, 0, 0, .55);
}
.brand:focus-visible,
.nav-item:focus-visible,
.post-card-title a:focus-visible { outline-offset: 3px; }

/* ── 2. 整卡可点：卡片就是按钮 ── */
.post-card[data-href] { cursor: pointer; transition: transform .16s, border-color .16s, background .16s; }
.post-card[data-href]:hover {
  border-color: var(--border-hot);
  background: var(--panel-solid);
  transform: translateY(-1px);
}
.post-card-title a { color: var(--fg); }
.post-card[data-href]:hover .post-card-title a { color: var(--accent); }
.post-card[data-href]:active { transform: none; }

/* ── 3. 回到顶部 ── */
.to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 90;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 1rem; line-height: 1;
  color: var(--fg-dim);
  background: var(--panel-solid);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  cursor: pointer;
  opacity: 0; transform: translateY(10px) scale(.92);
  pointer-events: none;
  transition: opacity .2s, transform .2s, color .18s, border-color .18s;
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { color: var(--accent); border-color: var(--border-hot); }

/* ── 4. 上一篇 / 下一篇 ── */
.post-nav {
  max-width: 780px; margin: 26px auto 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.pn-item {
  display: flex; flex-direction: column; gap: 5px;
  padding: 13px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--panel);
  text-decoration: none; min-width: 0;
  transition: border-color .16s, background .16s;
}
.pn-item:hover { border-color: var(--border-hot); background: var(--panel-solid); }
.pn-item:hover .pn-title { color: var(--accent); }
.pn-dir { font-size: .75rem; color: var(--fg-faint); letter-spacing: .02em; }
.pn-title {
  font-size: .9375rem; color: var(--fg); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pn-next { text-align: right; align-items: flex-end; }
.pn-gap { display: block; }

/* ── 5. 表单校验提示 ── */
.field.is-bad input,
.field.is-bad textarea,
.field.is-bad select {
  border-color: rgba(255, 77, 109, .75);
  background: rgba(255, 77, 109, .05);
}
.field-tip {
  margin: 6px 0 0; font-size: .75rem; line-height: 1.4;
  color: var(--danger);
}

/* ── 6. 触摸目标：窄屏下都撑到 44px ── */
@media (max-width: 640px) {
  .nav-item { min-height: 44px; display: inline-flex; align-items: center; }
  .cat-chip { min-height: 44px; display: inline-flex; align-items: center; }
  .icon-btn { min-width: 44px; min-height: 44px; }
  .user-slot .btn { min-height: 44px; }
  .post-card { padding-top: 16px; padding-bottom: 16px; }
  /* 提示从底部弹出，别和「回到顶部」按钮打架 */
  .to-top { right: 14px; bottom: 78px; }
  .post-nav { grid-template-columns: 1fr; }
  .pn-next { text-align: left; align-items: flex-start; }
}


/* ============ 首页多列 ============
   单列在 1440 屏上左右各留 350px 空白，一屏只看得见 4 篇。
   宽屏把容器放开、卡片改自适应网格；窄屏（手机、平板竖屏）
   仍然是单列，只是靠 auto-fill 自然退回去，不需要额外的断点覆盖。 */
/* 容器跟着视口长：1440 下 3 列、1920 下 4 列。
   1560 = 4×340 + 3×16 + 两侧 40 内边距，刚好能放下 4 列。 */
body[data-page="home"] .container { max-width: 1560px; }

/* 标题区和分类条不跟着变宽，否则居中失衡 */
body[data-page="home"] .hero,
body[data-page="home"] .cat-bar {
  max-width: 780px;
  margin-left: auto;
  margin-right: auto;
}

body[data-page="home"] .post-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  align-items: stretch;
}
/* 卡片在网格里要等高，摘要区吃掉剩余高度，底部信息才对齐 */
body[data-page="home"] .post-card { display: flex; flex-direction: column; }
/* 多列卡片的摘要统一最多两行：高度自然接近，
   脚注贴底之后不会出现「一行摘要 + 一大片空白」。 */
body[data-page="home"] .post-card .summary {
  flex: 1 1 auto;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden;
}
body[data-page="home"] .post-card-foot { margin-top: auto; }

/* 首页多列之后每张卡变窄，间距跟着收一点 */
body[data-page="home"] .post-card { padding: 18px 20px; }

/* ============ 标题行带操作按钮 ============
   账号设置页原来把「修改密码」做成第二张卡片，压在资料表单下面，
   不往下滚根本不知道有这功能。改成标题右侧一个按钮 + 弹层。 */
.form-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.form-head > div { min-width: 0; }
.form-head .form-sub { margin-bottom: 22px; }
.form-head > .btn { flex: 0 0 auto; margin-top: 4px; }

/* ============ 弹层（原生 <dialog>） ============
   用 dialog 而不是自己拼遮罩：Esc 关闭、焦点陷阱、backdrop 都不用写。 */
.modal {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-solid);
  color: var(--fg);
  padding: 22px 24px 20px;
  width: min(400px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  overflow: auto;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
}
.modal::backdrop {
  background: rgba(4, 8, 16, .62);
  backdrop-filter: blur(2px);
}
.modal .form-sub { margin-bottom: 18px; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

@media (max-width: 480px) {
  /* 窄屏按钮别和标题挤在一行 */
  .form-head { flex-wrap: wrap; }
  .form-head > .btn { margin-top: 0; }
}

/* ============================================================
   动效（一）：微交互 + 卡片聚光灯
   原则：只动 transform / opacity / background-position，
   不碰 width/height/top/left，避免每帧触发布局。
   ============================================================ */

/* ---------- 卡片光标聚光灯 ----------
   深色主题下给卡片加一层跟随指针的柔光。
   用 ::after 叠在内容之上但 pointer-events:none，
   所以不影响点击、选中和键盘焦点。 */
.post-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s ease;
  background: radial-gradient(
    260px circle at var(--mx, 50%) var(--my, 50%),
    rgba(0, 229, 255, .10),
    rgba(124, 92, 255, .05) 42%,
    transparent 72%
  );
}
:root[data-mode="dark"] .post-card:hover::after { opacity: 1; }

/* ---------- 按钮点击涟漪 ---------- */
.btn, .cat-chip { position: relative; overflow: hidden; }
.ripple {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  transform: scale(0);
  background: radial-gradient(circle, rgba(255, 255, 255, .45), rgba(255, 255, 255, 0) 70%);
  animation: rippleOut .55s cubic-bezier(.2, .6, .3, 1) forwards;
}
:root[data-mode="light"] .ripple {
  background: radial-gradient(circle, rgba(0, 80, 160, .22), rgba(0, 80, 160, 0) 70%);
}
@keyframes rippleOut {
  to { transform: scale(1); opacity: 0; }
}

/* ---------- 正文链接下划线从左滑出 ----------
   原来是一条静态 border-bottom，换成一条能横向生长的背景线。
   尺寸走 background-size，同样不触发布局。 */
.post-body a {
  border-bottom: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 1px;
  padding-bottom: 1px;
  transition: background-size .28s cubic-bezier(.16, 1, .3, 1), color .15s;
}
.post-body a:hover { background-size: 100% 1px; }

/* ---------- 滚动进场 ----------
   只给首页/分类页的卡片用。初始透明，进视口后浮上来。
   用 animation 而不是 transition：动画跑完就结束，不会和卡片
   本来那条 hover 用的 transition 抢同一组属性。 */
.post-card.fx-reveal:not(.fx-in) { opacity: 0; transform: translateY(14px); }
.post-card.fx-in {
  animation: fxRise .52s cubic-bezier(.2, .7, .3, 1) both;
  animation-delay: var(--fx-d, 0ms);
}
@keyframes fxRise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- 路由转场 ----------
   View Transitions 默认是整页十字淡入淡出，这里压短一点，
   只留一点方向感；真正的看点是卡片标题「飞」到文章页标题上。 */
::view-transition-old(root) { animation: vtOut .16s ease both; }
::view-transition-new(root) { animation: vtIn .24s ease both; }
@keyframes vtOut { to   { opacity: 0; } }
@keyframes vtIn  { from { opacity: 0; } }

::view-transition-group(post-morph) { animation-duration: .3s; z-index: 60; }
::view-transition-old(post-morph),
::view-transition-new(post-morph) { animation: none; }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root),
  ::view-transition-group(post-morph) { animation: none !important; }
  .post-card.fx-reveal:not(.fx-in) { opacity: 1; transform: none; }
  .post-card.fx-in { animation: none !important; }
}

/* ---------- 触摸目标：手机上把可点元素撑到 40px 以上 ----------
   WCAG 2.5.8 的 AA 线是 24×24，但手指实际按得舒服要 40+。
   正文里的行内链接不在此列（2.5.8 明确豁免 inline）。 */
.brand { min-height: 40px; }
@media (max-width: 700px) {
  .tag-pill { padding: 6px 12px; }
  .post-meta-line .tag-pill, .post-meta-line .author { display: inline-flex; align-items: center; min-height: 30px; }
  .cmt-form-foot .btn, #q-go, #l-go, #r-go { min-height: 42px; }
  .nav .btn { min-height: 40px; }
}

/* ---------- 搜索页空态 ---------- */
.search-idle { margin-top: 26px; }
.search-idle-t {
  font-family: var(--mono); font-size: .8125rem; color: var(--fg-faint);
  letter-spacing: .08em; margin: 22px 0 12px;
}
.search-idle-t:first-child { margin-top: 0; }
.search-idle-list { list-style: none; padding: 0; margin: 0; }
.search-idle-list li {
  display: flex; align-items: baseline; gap: 10px;
  padding: 11px 0; border-bottom: 1px solid var(--border);
}
.search-idle-list li:last-child { border-bottom: none; }
.search-idle-list a { color: var(--fg); text-decoration: none; font-weight: 550; }
.search-idle-list a:hover { color: var(--accent); }
.search-idle-list span { margin-left: auto; font-family: var(--mono); font-size: .75rem; color: var(--fg-faint); }

/* ---------- 浅色主题下的语义色兜底 ----------
   这三处颜色是硬编码的，在深色底上合适，放到浅色底上对比度只有 3.0~3.5。
   统一压深一档，浅色下都能过 4.5。 */
:root[data-mode="light"] .st-warn { color: #8a6508; }
:root[data-mode="light"] .st-err  { color: #a3231f; }
:root[data-mode="light"] .st-card.good .st-card-v { color: #127251; }
:root[data-mode="light"] { --danger: #c62840; }

/* ---------- 手机上把行内按钮撑到 40px ----------
   排除段落/表格里的文字链（WCAG 2.5.8 对 inline 有豁免）。 */
@media (max-width: 700px) {
  .btn:not(.btn-inline) { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
  .write-tab { min-height: 38px; }
}

/* 编辑/预览 切换的选中态：浅色主题下 --accent 是深蓝，
   而 --sel-fg 是为「文字选中」设计的深色，两者叠在一起只有 3.29。 */
:root[data-mode="light"] .write-tab.is-on { color: #fff; }

@media (max-width: 700px) {
  select, .v-input { min-height: 40px; }
  .seg-btn, .seg > button { min-height: 38px; }
  .act-del { min-width: 36px; min-height: 36px; display: inline-flex; align-items: center; justify-content: center; }
  .post-mine-link, .mine-edit { min-height: 34px; display: inline-flex; align-items: center; }
}

/* 「我的文章」卡片底部的编辑链接：行内高度只有 20px，补一点纵向空间 */
@media (max-width: 700px) {
  .post-card-foot a { display: inline-flex; align-items: center; min-height: 34px; }
  .post-card-foot .dot { min-height: 34px; display: inline-flex; align-items: center; }
}

/* 搜索空态的列表项：一行一个，不跟着文字流走，给足点击高度 */
@media (max-width: 700px) {
  .search-idle-list a { display: inline-flex; align-items: center; min-height: 34px; }
}

/* ============ 留言板 ============ */
/* 正文 740 那一套对「一条条短内容」太宽，这里收窄到 720 并自己居中。 */
.gb { max-width: 720px; margin: 0 auto; }
.gb .page-sub { margin: 8px 0 26px; color: var(--fg-dim); font-size: .9375rem; line-height: 1.7; }

.gb-form {
  padding: 22px 22px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  margin-bottom: 26px;
}
.gb-form .field { margin-bottom: 14px; }
.gb-form textarea { width: 100%; resize: vertical; min-height: 96px; line-height: 1.7; }
.gb-count {
  margin-left: auto; margin-right: 12px;
  color: var(--fg-faint); font-size: .8125rem;
  font-variant-numeric: tabular-nums;
}
.gb-form .form-foot { display: flex; align-items: center; gap: 10px; }

.gb-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.gb-item {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}
.gb-meta { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.gb-nick { font-weight: 640; color: var(--accent); }
.gb-time { color: var(--fg-faint); font-size: .8125rem; font-variant-numeric: tabular-nums; }
/* 留言里的换行要留着，但不能把长串英文撑破 */
.gb-text { color: var(--fg); line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- 后台：留言管理 ---------- */
.gba-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.gba-item {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}
.gba-item.is-hidden { opacity: .62; border-style: dashed; }
.gba-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.gba-nick { font-weight: 640; color: var(--accent); }
.gba-time { color: var(--fg-faint); font-size: .8125rem; font-variant-numeric: tabular-nums; }
.gba-tag {
  margin-left: auto; padding: 1px 8px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--fg-dim); font-size: .75rem;
}
.gba-text { color: var(--fg); line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 12px; }

.gba-facts {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px; margin: 0 0 14px;
  font-size: .8125rem;
}
.gba-facts > div { min-width: 0; display: flex; gap: 8px; }
.gba-facts dt { flex: 0 0 auto; color: var(--fg-faint); }
.gba-facts dd { margin: 0; min-width: 0; color: var(--fg-dim); overflow-wrap: anywhere; }
.gba-geo { color: var(--fg-faint); }
.gba-ua { font-family: var(--mono, ui-monospace, monospace); font-size: .75rem; }
.gba-acts { display: flex; gap: 10px; flex-wrap: wrap; }
.gba-acts .btn { min-height: 34px; }

@media (max-width: 640px) {
  .gb-form { padding: 18px 16px 14px; }
  /* 全局 .form-foot 在窄屏是 column-reverse，留言板这里保持一行：
     字数贴左、发布贴右，不然「0 / 1000」会孤零零掉到按钮下面 */
  .gb-form .form-foot { flex-direction: row; align-items: center; }
  .gb-form .form-foot .btn { width: auto; margin-left: auto; }
  .gba-facts { grid-template-columns: 1fr; }
  .gba-acts { gap: 8px; }
  .gba-acts .btn { min-height: 40px; }
}

/* 文章页「返回」：一条轻量文字链接，不抢标题的视觉优先级 */
.post-back {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 4px 2px; margin: 0 0 2px;
  font-size: .8125rem; color: var(--fg-dim);
  text-decoration: none; letter-spacing: .02em;
  transition: color .16s;
}
.post-back:hover { color: var(--accent); }
.post-back span { font-size: .9rem; line-height: 1; }

/* 蜜罐字段：人看不见，但不用 display:none ——
   太干净的隐藏有些脚本会跳过，挪出视口更可靠。 */
.hp-field {
  position: absolute; left: -9999px; top: auto;
  width: 1px; height: 1px; overflow: hidden; opacity: 0;
  pointer-events: none;
}

/* 读过的卡片压暗一档：一眼能看出哪几篇是新的，不额外加图标 */
.post-card.is-read { opacity: .74; }
.post-card.is-read:hover { opacity: 1; }
.post-card.is-read .post-card-title a { color: var(--fg-dim); }

/* ── 404：不是一堵墙，是一条岔路 ── */
.nf { max-width: 680px; margin: 0 auto; padding: 20px 0 64px; }
.nf-title { font-size: clamp(1.55rem, 5vw, 2.1rem); margin: 0 0 10px; letter-spacing: -.01em; }
.nf-sub { color: var(--fg-dim); margin: 0 0 24px; line-height: 1.75; }
.nf-form { display: flex; gap: 10px; margin-bottom: 8px; }
.nf-form input {
  flex: 1; min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--fg);
  font: inherit; font-size: .9375rem;
  outline: none;
}
.nf-form input:focus { border-color: var(--accent); }
.nf-form input::placeholder { color: var(--fg-faint); }
.nf-label { display: block; font-family: var(--mono); font-size: .75rem; color: var(--fg-faint);
            letter-spacing: .1em; margin: 26px 0 12px; }
.nf-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.nf-chip { padding: 7px 15px; border-radius: 999px; border: 1px solid var(--border); text-decoration: none;
           color: var(--fg-dim); font-size: .8125rem; }
.nf-chip:hover { border-color: var(--accent); color: var(--accent); }
.nf-list { display: flex; flex-direction: column; }
.nf-post { display: block; padding: 14px 0; border-bottom: 1px solid var(--border); text-decoration: none; }
.nf-post:first-of-type { border-top: 1px solid var(--border); }
.nf-post-title { display: block; font-weight: 600; line-height: 1.45; text-decoration: none; }
.nf-post-sum { display: block; color: var(--fg-dim); font-size: .875rem; line-height: 1.55; margin-top: 3px; }
.nf-back { margin: 32px 0 0; font-family: var(--mono); font-size: .8125rem; }
@media (max-width: 640px) {
  .nf-form { flex-direction: column; }
  .nf-form .btn { width: 100%; }
}

/* ── 窄屏目录：从侧栏变底部抽屉 ── */
.toc-fab, .toc-mask, .toc-close { display: none; }

@media (max-width: 1199px) {
  .toc-fab {
    display: grid; place-items: center;
    position: fixed; right: 22px; bottom: 78px; z-index: 94;
    width: 44px; height: 44px; border-radius: 50%;
    color: var(--fg-dim); background: var(--panel-solid);
    border: 1px solid var(--border); box-shadow: var(--shadow);
    font-size: .95rem; line-height: 1; cursor: pointer;
  }
  .toc-fab:active { transform: scale(.95); }

  .toc-mask {
    display: block; position: fixed; inset: 0; z-index: 95;
    background: rgba(0, 0, 0, .46);
    opacity: 0; pointer-events: none; transition: opacity .25s;
  }
  .toc-mask.is-open { opacity: 1; pointer-events: auto; }

  .toc {
    display: block;
    top: auto; left: 0; right: 0; bottom: 0;
    width: auto; max-height: 68vh; z-index: 96;
    padding: 16px 20px calc(22px + env(safe-area-inset-bottom));
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -20px 50px rgba(0, 0, 0, .3);
    overflow-y: auto; font-size: .875rem;
    transform: translateY(103%);
    transition: transform .3s cubic-bezier(.22, .61, .36, 1);
  }
  .toc.is-open { transform: none; }
  .toc-title {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 6px;
  }
  .toc-close {
    display: grid; place-items: center;
    width: 32px; height: 32px; border-radius: 50%;
    border: 1px solid var(--border); background: transparent;
    color: var(--fg-dim); font-size: .8rem; cursor: pointer;
  }
  .toc-item { padding: 10px 0; font-size: .875rem; }
  .toc-h3 { padding-left: 22px; font-size: .8125rem; }
}

/* ---------- 正文配图 ---------- */
.post-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.9em auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
}
.post-body figure {
  margin: 1.9em 0;
}
.post-body figure img {
  margin: 0 auto;
}
.post-body figcaption {
  margin-top: 0.7em;
  text-align: center;
  font-size: 0.85em;
  line-height: 1.6;
  color: var(--fg-faint);
}
@media (max-width: 640px) {
  .post-body img {
    margin: 1.4em auto;
    border-radius: 8px;
  }
}

/* ---------- 正文图片放大 ---------- */
.post-body img {
  cursor: zoom-in;
}
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 3vmin;
  background: rgba(6, 10, 18, 0.9);
  cursor: zoom-out;
}
.lightbox.on {
  display: flex;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  cursor: zoom-out;
}

/* 宽屏时让配图略微破出正文栏，架构图内的字才看得清 */
@media (min-width: 1024px) {
  .post-body figure {
    width: min(860px, calc(100vw - 120px));
    margin-left: 50%;
    transform: translateX(-50%);
  }
}

/* 手机上目录浮钮固定在右下，会给图注尾巴让位 */
@media (max-width: 640px) {
  .post-body figcaption {
    padding-right: 64px;
    padding-left: 8px;
  }
}
