:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f9fafc;
  --text: #1d2330;
  --muted: #6b7280;
  --border: #e6e9f0;
  --field-bg: #f5f7fc;
  --field-border: #ccd4e4;
  --field-border-hover: #a9b5cc;
  --field-shadow: inset 0 1px 2px rgba(20, 30, 60, .07);
  --brand: #2f6fed;
  --brand-soft: #eaf1ff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 60, .04), 0 8px 24px rgba(20, 30, 60, .05);
}

[hidden] { display: none !important; }

html.dark {
  --bg: #12151c;
  --surface: #1a1f29;
  --surface-2: #212733;
  --text: #e7ebf3;
  --muted: #98a2b3;
  --border: #2a3140;
  --field-bg: #232b38;
  --field-border: #3b4658;
  --field-border-hover: #55637a;
  --field-shadow: inset 0 1px 2px rgba(0, 0, 0, .35);
  --brand: #6c9bff;
  --brand-soft: #1e2a44;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.75 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
code { background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 5px; font-size: 13px; }

.container { width: min(1160px, 100% - 40px); margin: 0 auto; }

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 18px; min-height: 64px; }

.brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.brand-logo { width: 34px; height: 34px; border-radius: 9px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title { font-weight: 700; font-size: 17px; letter-spacing: .2px; }
.brand-sub { font-size: 11.5px; color: var(--muted); }

.nav { display: flex; align-items: center; gap: 4px; flex: 1 1 auto; }
.nav-link {
  padding: 7px 11px; border-radius: 9px; font-size: 14px; color: var(--muted);
  white-space: nowrap; transition: background .18s, color .18s;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

.header-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.search-mini { display: flex; align-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 2px 4px 2px 10px; }
.search-mini input { border: 0; background: transparent; color: var(--text); outline: none; width: 130px; font-size: 13.5px; padding: 6px 0; }
.search-mini button { border: 0; background: transparent; cursor: pointer; font-size: 13px; padding: 6px; }

.icon-btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); width: 34px; height: 34px; border-radius: 10px; cursor: pointer; font-size: 15px; }
.icon-btn:hover { background: var(--surface-2); }
.nav-toggle { display: none; }

.user-menu { position: relative; }
.user-menu-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 5px;
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px;
  cursor: pointer; color: var(--text); font: inherit;
}
.user-menu-btn:hover { background: var(--surface-2); }
.user-menu-avatar {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 13px; flex: 0 0 28px;
}
.user-menu-init { background: var(--surface-2); color: var(--muted); }
.user-menu-name { font-size: 13.5px; max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-btn .caret { font-size: 11px; color: var(--muted); }
.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 168px; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.user-dropdown a {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 8px;
  font-size: 13.5px; color: var(--text); text-decoration: none;
}
.user-dropdown a:hover { background: var(--surface-2); }
.user-dropdown-danger { color: #b3261e !important; }

.btn { display: inline-flex; align-items: center; justify-content: center; padding: 7px 14px; border-radius: 10px; font-size: 13.5px; border: 1px solid transparent; cursor: pointer; transition: .18s; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { border-color: var(--border); background: var(--surface); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: #d93025; color: #fff; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; padding: 28px 0 56px; }
.layout.single { grid-template-columns: minmax(0, 1fr); }

.post-card {
  display: flex; gap: 18px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin-bottom: 18px; box-shadow: var(--shadow);
  transition: transform .18s, box-shadow .18s;
}
.post-card:hover { transform: translateY(-2px); }
.card-cover { flex: 0 0 190px; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.card-cover img { width: 100%; height: 130px; object-fit: cover; }
.card-body { flex: 1 1 auto; min-width: 0; }
.card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.tag { background: var(--brand-soft); color: var(--brand); padding: 2px 8px; border-radius: 6px; font-size: 12px; }
.badge { padding: 1px 7px; border-radius: 6px; font-size: 11.5px; }
.badge-top { background: #fff1e6; color: #b45309; }
.badge-hot { background: #ffe9ea; color: #c0392b; }
html.dark .badge-top { background: #3a2a1a; color: #f5b775; }
html.dark .badge-hot { background: #3a1e21; color: #f09a9a; }

.card-title { margin: 0 0 6px; font-size: 18px; line-height: 1.45; font-weight: 700; }
.card-title a:hover { color: var(--brand); }
.card-excerpt { margin: 0 0 10px; color: var(--muted); font-size: 13.5px; }
.card-foot { display: flex; align-items: center; gap: 14px; font-size: 12.5px; color: var(--muted); }
.card-foot .more { margin-left: auto; color: var(--brand); font-weight: 600; }

.sidebar { position: sticky; top: 84px; align-self: start; display: flex; flex-direction: column; gap: 18px; }
.widget { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.widget h3 { margin: 0 0 10px; font-size: 14px; font-weight: 700; color: var(--text); letter-spacing: .3px; }
.widget-list { margin: 0; padding: 0; list-style: none; font-size: 13.5px; }
.widget-list li { position: relative; margin-bottom: 8px; padding-left: 18px; overflow: hidden; }
.widget-list li::before { content: "•"; position: absolute; left: 2px; top: 0; color: var(--brand); font-weight: 700; }
.widget-list a { display: block; color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.widget-list a:hover { color: var(--brand); }
.widget-list.numbered { counter-reset: wl; }
.widget-list.numbered li { padding-left: 22px; }
.widget-list.numbered li::before { content: counter(wl) "."; counter-increment: wl; color: var(--brand); font-weight: 700; }
.widget-list.cats { padding: 0; }
.widget-list.cats li { padding-left: 0; overflow: visible; }
.widget-list.cats li::before { content: none; }
.widget-list.cats li a { display: flex; justify-content: space-between; white-space: normal; }
.widget-list.cats li a > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.widget-list .count { color: var(--muted); font-size: 12px; flex: 0 0 auto; }

.post-sidebar { display: flex; flex-direction: column; gap: 16px; }
.rel-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.rel-list li { position: relative; padding-left: 16px; }
.rel-list li::before { content: "•"; position: absolute; left: 0; top: 8px; color: var(--brand); font-weight: 700; }
.rel-item { display: flex; gap: 10px; align-items: flex-start; text-decoration: none; color: inherit; padding: 4px; margin: -4px; border-radius: 9px; }
.rel-item:hover { background: var(--surface-2); }
.rel-thumb { width: 52px; height: 52px; flex: 0 0 52px; border-radius: 8px; object-fit: cover; }
.rel-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rel-title { font-size: 13.5px; font-weight: 600; line-height: 1.5; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rel-meta { font-size: 11.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }

.pagination { display: flex; gap: 8px; justify-content: center; margin: 26px 0 0; flex-wrap: wrap; }
.page-btn { min-width: 36px; height: 36px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font-size: 13.5px; color: var(--muted); }
.page-btn:hover { border-color: var(--brand); color: var(--brand); }
.page-btn.current { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }

.article { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); }
.article-head { margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.article-title { font-size: 28px; line-height: 1.35; margin: 0 0 12px; font-weight: 800; letter-spacing: -.3px; }
.article-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.article-body { font-size: 16px; line-height: 1.9; word-break: break-word; }
.article-body h2 { font-size: 20px; margin: 30px 0 12px; padding-left: 12px; border-left: 4px solid var(--brand); }
.article-body h3 { font-size: 17px; margin: 24px 0 10px; }
.article-body p { margin: 0 0 16px; }
.article-body img { border-radius: 10px; margin: 18px auto; }
.article-body ul, .article-body ol { padding-left: 22px; margin: 0 0 16px; }
.article-body blockquote { margin: 18px 0; padding: 12px 16px; background: var(--surface-2); border-left: 3px solid var(--border); border-radius: 8px; color: var(--muted); }
.article-body pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px; overflow-x: auto; font-size: 13.5px; }
.article-body table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; }
.article-body th, .article-body td { border: 1px solid var(--border); padding: 8px 10px; }
.article-body a { color: var(--brand); text-decoration: underline; }

.article-body .codeblock { margin: 18px 0; border: 1px solid #d7dde8; border-radius: 12px; overflow: hidden; background: #f2f4f9; box-shadow: 0 1px 3px rgba(20,30,60,.06); }
.article-body .codeblock-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 14px; border-bottom: 1px solid #d7dde8; background: #fafbfe; }
html.dark .article-body .codeblock { background: var(--surface-2); border-color: var(--border); box-shadow: none; }
html.dark .article-body .codeblock-bar { background: var(--surface); border-bottom-color: var(--border); }
.codeblock-lang { font-size: 12px; color: var(--muted); letter-spacing: .5px; text-transform: uppercase; }
.codeblock-copy { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); border-radius: 8px; padding: 5px 12px; font-size: 12.5px; cursor: pointer; transition: .18s; }
.codeblock-copy svg { display: block; flex: 0 0 auto; }
.codeblock-copy:hover { border-color: var(--brand); color: var(--brand); }
.codeblock-copy.copied { color: #16a34a; border-color: #16a34a; }
.article-body .codeblock pre { border: 0; border-radius: 0; margin: 0; background: transparent; }
.article-body .codeblock code { background: transparent; border: 0; padding: 0; }
.article-body .codeblock pre, .article-body .codeblock code { font-family: ui-monospace, "SF Mono", SFMono-Regular, Consolas, "Courier New", monospace; }

.react-bar { display: flex; gap: 12px; margin: 26px 0 0; flex-wrap: wrap; }
.react-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 14px; color: var(--muted); transition: .18s; }
.react-btn:hover { border-color: var(--brand); color: var(--brand); }
.react-btn.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); font-weight: 600; }

.ad-box { margin: 24px 0; padding: 14px; border: 1px dashed var(--border); border-radius: 10px; text-align: center; font-size: 13.5px; color: var(--muted); background: var(--surface-2); }
.ad-slot { position: relative; margin: 18px 0; padding: 14px 16px; border: 1px dashed var(--border); border-radius: 12px; background: var(--surface-2); }
.ad-label { position: absolute; top: 8px; right: 12px; font-size: 11px; color: var(--muted); letter-spacing: 1px; }
.ad-body a { display: block; text-decoration: none; }
.ad-body img { max-width: 100%; border-radius: 8px; display: block; }
.ad-text { color: var(--muted); font-size: 14px; }
.ad-body a:hover .ad-text { color: var(--brand); }
.ad-box img { margin: 0 auto; border-radius: 8px; }

.comments { margin-top: 28px; }
.comments h3 { font-size: 16px; margin: 0 0 14px; }
.comment { padding: 14px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: 0; }
.comment-author { font-weight: 600; font-size: 13.5px; }
.comment-time { font-size: 12px; color: var(--muted); margin-left: 8px; }
.comment-text { margin: 6px 0 0; font-size: 14px; color: var(--text); }
.comment-form { margin-top: 18px; display: flex; flex-direction: column; gap: 12px; }
.comment-form textarea { width: 100%; min-height: 96px; padding: 12px; border: 1px solid var(--field-border); border-radius: 10px; background: var(--field-bg); box-shadow: var(--field-shadow); color: var(--text); font: inherit; resize: vertical; }
.comment-form .row { display: flex; gap: 10px; align-items: center; }
.comment-form button { margin-left: auto; }

.comment-head { display: flex; align-items: center; gap: 12px; }
.comment-avatar { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px; color: var(--muted); background: var(--surface-2, #f1f3f7); border: 1px solid var(--border); }
.comment-head .field-input { flex: 1 1 auto; min-width: 0; padding: 11px 13px; border: 1px solid var(--field-border); border-radius: 10px; background: var(--field-bg); box-shadow: var(--field-shadow); color: var(--text); font: inherit; }
.comment-head .field-input:disabled { background: var(--surface-2, #f1f3f7); color: var(--muted); cursor: not-allowed; }
.comment-head .field-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent); }

.comment-toolbar { display: flex; align-items: center; gap: 12px; }
.emoji-picker-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px; cursor: pointer; }
.emoji-picker-btn:hover { border-color: var(--brand); color: var(--brand); }

.emoji-drawer { position: relative; z-index: 20; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 12px; box-shadow: var(--shadow); }
.emoji-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; max-height: 168px; overflow-y: auto; }
.emoji-cell { font-size: 20px; line-height: 1; padding: 9px 0; border: 0; border-radius: 8px; background: transparent; cursor: pointer; }
.emoji-cell:hover { background: var(--brand-soft, rgba(99,102,241,.12)); transform: scale(1.1); }
@media (min-width: 560px) { .emoji-grid { grid-template-columns: repeat(9, 1fr); } }

.page-title { font-size: 22px; font-weight: 800; margin: 26px 0 4px; }
.page-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 20px; }
.archive-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 22px; margin-bottom: 16px; box-shadow: var(--shadow); }
.archive-group h3 { margin: 0 0 10px; font-size: 15px; color: var(--brand); }
.archive-group ul { margin: 0; padding-left: 18px; font-size: 14px; }
.archive-group li { margin-bottom: 7px; }
.archive-group li span { color: var(--muted); font-size: 12px; margin-left: 8px; }
mark { background: #fff3a3; color: inherit; padding: 0 2px; border-radius: 3px; }
html.dark mark { background: #6b5a10; }

.page-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); }
.page-panel .article-body { font-size: 15.5px; }

.auth-wrap { max-width: 420px; margin: 44px auto 72px; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 30px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 22px; margin: 0 0 6px; }
.auth-card .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 20px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; padding: 11px 13px; border: 1px solid var(--field-border); border-radius: 10px; background: var(--field-bg); box-shadow: var(--field-shadow); color: var(--text); font: inherit; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.email-field { position: relative; }
.email-suggest { position: absolute; left: 0; top: 100%; z-index: 30; margin-top: 0; width: 168px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); overflow-y: auto; max-height: 232px; padding: 4px; }
.email-field.suggest-open .hint { visibility: hidden; }
.email-suggest-item { display: block; width: 100%; padding: 9px 12px; text-align: left; background: none; border: 0; border-radius: 7px; color: var(--text); font-size: 13.5px; cursor: pointer; }
.email-suggest-item:hover { background: var(--surface-2); color: var(--brand); }
.form-btn { width: 100%; padding: 12px; border: 0; border-radius: 10px; background: var(--brand); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; }
.captcha-row { display: flex; gap: 10px; align-items: center; }
.captcha-row img { border-radius: 8px; cursor: pointer; border: 1px solid var(--border); height: 42px; width: auto; }
.auth-links { margin-top: 16px; font-size: 13px; color: var(--muted); display: flex; gap: 14px; justify-content: center; }
.auth-links a { color: var(--brand); }

.flash { padding: 11px 15px; border-radius: 10px; font-size: 13.5px; margin-bottom: 16px; }
.flash-success { background: #e9f7ef; color: #0b6b3a; border: 1px solid #c3e8d3; }
.flash-error { background: #fdecea; color: #b3261e; border: 1px solid #f7c6c2; }
.flash-info { background: var(--brand-soft); color: var(--brand); border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent); }
.flash-warn { background: #fff6e5; color: #8a5300; border: 1px solid #f3d9a4; }

.profile-card { margin-bottom: 20px; }
.profile { display: grid; grid-template-columns: 160px 1fr; gap: 28px; align-items: start; }
.avatar-box { text-align: center; }
.avatar-box img { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; margin: 0 auto 10px; border: 3px solid var(--surface-2); }
.avatar-tip { font-size: 12px; }
.profile-form { display: flex; flex-direction: column; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field input[type=file] { padding: 9px 10px; }
.profile-divider {
  margin: 18px 0 4px; padding-top: 16px; border-top: 1px dashed var(--border);
  font-size: 14px; font-weight: 600; color: var(--text);
}
.profile-pw-hint { margin: 0 0 12px; }

.bind-card { margin-bottom: 20px; }
.bind-list { display: flex; flex-direction: column; gap: 10px; }
.bind-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.bind-icon { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 15px; }
.bind-info { flex: 1; min-width: 0; }
.bind-name { font-size: 14px; font-weight: 600; }
.bind-state { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.bind-item .btn { flex: 0 0 auto; }

.social-login { margin-top: 22px; }
.social-sep { position: relative; text-align: center; margin: 0 0 14px; }
.social-sep::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--border); }
.social-sep span { position: relative; padding: 0 10px; background: var(--surface); color: var(--muted); font-size: 12.5px; }
.social-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.social-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font-size: 13.5px; text-decoration: none; }
.social-btn:hover { border-color: var(--brand); color: var(--brand); }
.social-ico { width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--brand-soft); color: var(--brand); font-size: 11px; font-weight: 700; }
@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
  .user-menu-name { display: none; }
}

.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 22px 0; margin-top: 36px; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.footer-right { display: flex; gap: 14px; }
.footer-right a:hover { color: var(--brand); }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; order: 2; }
  .nav-toggle { display: inline-block; }
  .nav {
    position: absolute; left: 0; right: 0; top: 64px; background: var(--surface);
    border-bottom: 1px solid var(--border); flex-direction: column; align-items: stretch;
    padding: 10px 20px 16px; gap: 2px; display: none;
  }
  .nav.open { display: flex; }
  .search-mini { display: none; }
  .post-card { flex-direction: column; }
  .card-cover { flex: none; }
  .card-cover img { height: 180px; }
  .article { padding: 20px; }
  .article-title { font-size: 22px; }
  .profile { grid-template-columns: 1fr; }
  .comment-form .row { flex-wrap: wrap; }
}

.site-header {
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--brand) 10%, transparent);
}
.site-header::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 35%, #7c5cff), var(--brand));
  opacity: .9;
}
.brand-logo { box-shadow: 0 4px 14px color-mix(in srgb, var(--brand) 28%, transparent); }
.brand-title {
  background: linear-gradient(120deg, var(--text), var(--brand));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.nav-link { position: relative; }
.nav-link.active::after {
  content: ""; position: absolute; left: 11px; right: 11px; bottom: 2px; height: 2px;
  border-radius: 2px; background: var(--brand); opacity: .85;
}
.search-mini { border-radius: 999px; padding-left: 14px; }
.search-mini:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent); }
.icon-btn { border-radius: 999px; }
.btn-primary { box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 26%, transparent); }

.post-card { border-radius: 16px; overflow: hidden; }
.post-card:hover {
  box-shadow: 0 10px 28px color-mix(in srgb, var(--brand) 12%, transparent), var(--shadow);
  border-color: color-mix(in srgb, var(--brand) 30%, var(--border));
}
.card-cover img { transition: transform .35s ease; }
.post-card:hover .card-cover img { transform: scale(1.04); }

.article { border-radius: 18px; }
.article-body { max-width: 46em; }
.article-body h2 {
  border-left: 0; padding-left: 0; position: relative;
  padding-bottom: 8px;
}
.article-body h2::after {
  content: ""; position: absolute; left: 0; bottom: 0; width: 46px; height: 3px;
  border-radius: 3px; background: linear-gradient(90deg, var(--brand), transparent);
}
.article-body blockquote { border-left: 3px solid var(--brand); background: var(--brand-soft); color: var(--text); }
.article-body pre { border-radius: 12px; line-height: 1.7; }
.article-body table th { background: var(--surface-2); font-weight: 600; }

.emoji-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 22px 0 0; padding: 14px 16px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px;
}
.emoji-bar .label { font-size: 12.5px; color: var(--muted); margin-right: 2px; }
.emoji-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-size: 15px; color: var(--muted);
  transition: transform .14s, border-color .14s, color .14s, background .14s;
  line-height: 1;
}
.emoji-btn:hover { transform: translateY(-1px); border-color: var(--brand); }
.emoji-btn:active { transform: scale(.97); }
.emoji-btn.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); font-weight: 600; }
.emoji-btn .n { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.emoji-btn[disabled] { opacity: .75; cursor: default; transform: none; }
.emoji-bar .thanks { font-size: 12px; color: var(--muted); margin-left: auto; }

.site-footer {
  margin-top: 56px;
  padding: 34px 0 30px;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 60%, transparent), var(--surface));
}
.footer-inner { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
.footer-links { display: flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 10px; font-size: 13px; color: var(--muted); }
.footer-links a { padding: 4px 2px; }
.footer-links a:hover { color: var(--brand); }
.footer-legal { display: flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 8px; font-size: 12.5px; color: var(--muted); line-height: 1.9; }
.footer-legal a:hover { color: var(--brand); }
.footer-legal .sep, .footer-links .sep { color: color-mix(in srgb, var(--muted) 55%, transparent); }

@media (max-width: 640px) {
  .footer-inner { gap: 10px; }
  .footer-links { gap: 6px; font-size: 12.5px; }
  .footer-legal { font-size: 12px; }
  .emoji-bar { padding: 12px; }
  .emoji-btn { padding: 6px 10px; }
  .article-body { max-width: 100%; }
}

html body input[type="text"], html body input[type="search"], html body input[type="email"],
html body input[type="password"], html body input[type="url"], html body input[type="number"],
html body input[type="tel"], html body input:not([type]),
html body textarea, html body select {
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  border-radius: 10px;
  color: var(--text);
  box-shadow: var(--field-shadow);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
html body input[type="text"]:hover, html body input[type="search"]:hover, html body input[type="email"]:hover,
html body input[type="password"]:hover, html body input[type="url"]:hover, html body input[type="number"]:hover,
html body input[type="tel"]:hover, html body textarea:hover, html body select:hover {
  border-color: var(--field-border-hover);
}
html body input[type="text"]:focus, html body input[type="search"]:focus, html body input[type="email"]:focus,
html body input[type="password"]:focus, html body input[type="url"]:focus, html body input[type="number"]:focus,
html body input[type="tel"]:focus, html body textarea:focus, html body select:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
html body input::placeholder, html body textarea::placeholder { color: var(--muted); opacity: .9; }
html body input:disabled, html body textarea:disabled, html body select:disabled {
  background: var(--surface-2); color: var(--muted); box-shadow: none; cursor: not-allowed;
}

.search-mini {
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  box-shadow: var(--field-shadow);
}
.search-mini:focus-within { border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.search-mini input {
  border: 0 !important; background: transparent !important; box-shadow: none !important;
  width: 130px; padding: 6px 0; border-radius: 0; font-size: 13.5px;
}
.search-mini input:focus { box-shadow: none !important; }

.comment-head .field-input { border-radius: 10px; }

.article-body img { cursor: zoom-in; }
.imgviewer {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(8, 10, 16, .96);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 58px 70px;
  animation: ivFade .18s ease both;
}
@keyframes ivFade { from { opacity: 0; } to { opacity: 1; } }
.iv-stage { margin: 0; display: flex; flex-direction: column; align-items: center; max-width: 100%; }
.iv-img {
  max-width: min(94vw, 1400px); max-height: 78vh;
  border-radius: 12px; background: #0b0d12;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .6);
  cursor: default;
}
.iv-cap {
  margin-top: 12px; display: flex; align-items: center; gap: 12px;
  color: rgba(255, 255, 255, .78); font-size: 13px; text-align: center;
}
.iv-count { padding: 2px 10px; border-radius: 999px; background: rgba(255, 255, 255, .14); color: #fff; font-variant-numeric: tabular-nums; }
.iv-title { max-width: 60vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iv-btn {
  position: absolute; border: 0; cursor: pointer; color: #fff;
  background: rgba(255, 255, 255, .12); border-radius: 999px;
  width: 46px; height: 46px; font-size: 22px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background .16s ease, transform .16s ease;
  -webkit-tap-highlight-color: transparent;
}
.iv-btn:hover { background: rgba(255, 255, 255, .26); }
.iv-btn:active { transform: scale(.95); }
.iv-prev { left: 14px; top: 50%; margin-top: -23px; }
.iv-next { right: 14px; top: 50%; margin-top: -23px; }
.iv-close { right: 14px; top: 14px; width: 40px; height: 40px; font-size: 20px; }
.iv-btn[disabled] { opacity: .3; cursor: default; }
body.iv-lock { overflow: hidden; }

@media (max-width: 640px) {
  .imgviewer { padding: 54px 10px 64px; }
  .iv-img { max-height: 70vh; border-radius: 8px; }
  .iv-prev { left: 6px; }
  .iv-next { right: 6px; }
  .iv-title { display: none; }
  .iv-cap { font-size: 12px; }
}

.back-top {
  position: fixed; right: 22px; bottom: 26px; z-index: 60;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font-size: 19px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow); opacity: 0; transform: translateY(10px);
  pointer-events: none; transition: opacity .2s ease, transform .2s ease, color .16s;
}
.back-top.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.back-top:hover { color: var(--brand); border-color: var(--brand); }
@media (max-width: 640px) {
  .back-top { right: 16px; bottom: 20px; width: 40px; height: 40px; }
}

.load-more {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 22px 0 4px; min-height: 38px; font-size: 13.5px; color: var(--muted);
}
.load-more .lm-btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 10px; padding: 9px 18px; font-size: 13.5px; cursor: pointer;
}
.load-more .lm-btn:hover { border-color: var(--brand); color: var(--brand); }
.load-more.is-loading { pointer-events: none; opacity: .7; }
.load-more.is-end { color: var(--muted); }
.load-more.is-error { color: #d97706; }

/* ============================================================
 * v1.8.0 多语言 / RTL / 移动端 / 404 / 视觉打磨
 * ============================================================ */

/* ---- 语言切换器（桌面顶栏） ---- */
.lang-menu { position: relative; }
.lang-btn { display: inline-flex; align-items: center; justify-content: center; }
.lang-btn svg { display: block; }
.lang-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 184px; z-index: 70;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
  animation: langPop .16s ease both;
}
@keyframes langPop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.lang-dd-title {
  font-size: 11.5px; color: var(--muted); letter-spacing: .5px;
  padding: 6px 12px 4px; border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
.lang-option {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px; border-radius: 8px; font-size: 13.5px; color: var(--text);
  transition: background .15s, color .15s;
}
.lang-option:hover { background: var(--brand-soft); color: var(--brand); }
.lang-option.current { color: var(--brand); font-weight: 600; background: var(--brand-soft); }
.lang-option .lo-check { color: var(--brand); font-size: 13px; flex: 0 0 auto; }

/* ---- 语言切换器（移动端：折进导航面板里） ---- */
.lang-mobile-inline { display: none; }
.lang-chip {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 8px 0 4px; padding: 8px 14px; width: fit-content;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 13px;
  cursor: pointer;
}
.lang-chip:hover { border-color: var(--brand); color: var(--brand); }
@media (max-width: 900px) {
  .lang-mobile-inline { display: block; }
  .lang-mobile-inline .lang-dropdown {
    position: static; margin-top: 8px; min-width: 0; width: 100%;
    box-shadow: none; background: var(--surface-2);
  }
}
.search-mobile-inline { display: none; }
@media (max-width: 900px) {
  .search-mobile-inline { display: flex; margin: 10px 0 6px; width: 100%; }
  .search-mobile-inline input { width: 100%; flex: 1; }
}

/* ---- 移动导航面板优化：阴影 + 动画 + 更顺滑 ---- */
@media (max-width: 900px) {
  .site-header { position: sticky; }
  .header-inner { min-height: 58px; gap: 10px; }
  .nav {
    position: absolute; left: 0; right: 0; top: 100%; z-index: 65;
    background: var(--surface); border-bottom: 1px solid var(--border);
    flex-direction: column; align-items: stretch;
    padding: 12px 20px 18px; gap: 2px; display: none;
    box-shadow: 0 18px 40px rgba(20, 30, 60, .14);
  }
  .nav.open { display: flex; animation: navPop .18s ease both; }
  @keyframes navPop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
  .nav-link { padding: 11px 12px; font-size: 14.5px; }
  .brand-sub { display: none; }
  .header-actions .btn { padding: 7px 12px; }
  .search-mini.header-actions-form, .header-actions .search-mini { display: none; }
  .card-cover { flex: none; width: 100%; }
  .card-cover img { height: 200px; }
  .article { padding: 20px; }
  .article-title { font-size: 22px; }
  .profile { grid-template-columns: 1fr; }
  .auth-wrap { margin: 24px auto 48px; }
  .auth-card { padding: 22px; }
  .react-bar { gap: 8px; }
  .react-btn { padding: 8px 14px; font-size: 13.5px; }
  .comments h3 { font-size: 15.5px; }
}

/* 触屏设备：去掉悬停位移，避免“粘滞悬停” */
@media (hover: none) {
  .post-card:hover { transform: none; }
  .card-cover img { transition: none; }
  .post-card:hover .card-cover img { transform: none; }
}

/* ---- 安全区（刘海屏 / Home Indicator） ---- */
@supports (padding: max(0px)) {
  body { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .site-footer { padding-bottom: max(22px, env(safe-area-inset-bottom)); }
  .back-top { right: max(22px, env(safe-area-inset-right)); }
}

/* ---- 键盘可达性：焦点环 ---- */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px;
}

/* ---- 404 页（多语言） ---- */
.nf-wrap { min-height: 60vh; display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.nf-box { text-align: center; max-width: 440px; }
.nf-code {
  font-size: 88px; font-weight: 800; letter-spacing: -3px; line-height: 1;
  background: linear-gradient(120deg, var(--brand), color-mix(in srgb, var(--brand) 40%, #7c5cff));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: 10px;
}
.nf-box h1 { font-size: 20px; margin: 0 0 8px; }
.nf-box p { color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.nf-box a { display: inline-block; padding: 11px 24px; }

/* ---- RTL（阿拉伯语等从右向左） ---- */
[dir="rtl"] .header-inner { flex-direction: row-reverse; }
[dir="rtl"] .nav { flex-direction: row-reverse; }
[dir="rtl"] .header-actions { flex-direction: row-reverse; }
[dir="rtl"] .user-dropdown, [dir="rtl"] .lang-dropdown { right: auto; left: 0; }
[dir="rtl"] .card-foot .more { margin-left: 0; margin-right: auto; }
[dir="rtl"] .pagination { direction: ltr; }
[dir="rtl"] .article-body { text-align: right; }
[dir="rtl"] .widget-list li { padding-left: 0; padding-right: 18px; }
[dir="rtl"] .widget-list li::before { left: auto; right: 2px; }
[dir="rtl"] .rel-list li { padding-left: 0; padding-right: 16px; }
[dir="rtl"] .rel-list li::before { left: auto; right: 0; }
[dir="rtl"] .emoji-bar .thanks { margin-left: 0; margin-right: auto; }
[dir="rtl"] .iv-prev { left: auto; right: 14px; }
[dir="rtl"] .iv-next { right: auto; left: 14px; }
[dir="rtl"] .back-top { right: auto; left: max(22px, 22px); }
[dir="rtl"] .article-body h2 { padding-left: 0; padding-right: 12px; border-left: 0; border-right: 4px solid var(--brand); }
[dir="rtl"] .article-body blockquote { border-left: 0; border-right: 3px solid var(--brand); }
[dir="rtl"] .captcha-row { flex-direction: row-reverse; }
[dir="rtl"] .comment-form button { margin-left: 0; margin-right: auto; }

/* ---- 视觉打磨 ---- */
.post-card {
  border-left: 3px solid transparent;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.post-card:hover { border-left-color: var(--brand); }
html.dark .post-card { border-left-color: transparent; }
html.dark .post-card:hover { border-left-color: var(--brand); }

.page-title {
  position: relative; padding-left: 14px;
}
.page-title::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 4px;
  border-radius: 4px; background: linear-gradient(180deg, var(--brand), color-mix(in srgb, var(--brand) 30%, transparent));
}
[dir="rtl"] .page-title { padding-left: 0; padding-right: 14px; }
[dir="rtl"] .page-title::before { left: auto; right: 0; }

.widget h3 {
  display: flex; align-items: center; gap: 8px;
}
.widget h3::after {
  content: ""; flex: 1; height: 1px; margin-left: 4px;
  background: linear-gradient(90deg, var(--border), transparent);
}

.form-btn { transition: filter .16s, transform .16s; }
.form-btn:hover { filter: brightness(1.07); }
.form-btn:active { transform: scale(.985); }

.auth-card { position: relative; overflow: hidden; }
.auth-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 35%, #7c5cff), var(--brand));
}

/* ---- v1.8.1 机器翻译提示条 ---- */
.mt-note {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 0 18px; padding: 8px 14px;
  border: 1px dashed var(--border); border-radius: 10px;
  background: var(--surface-2); color: var(--muted); font-size: 12.5px;
}
.mt-note a { color: var(--brand); font-weight: 600; white-space: nowrap; }
[dir="rtl"] .mt-note { flex-direction: row-reverse; }

/* 移动端触控目标 ≥44px */
@media (max-width: 900px) {
  .icon-btn { width: 40px; height: 40px; }
  .page-btn { min-width: 44px; height: 44px; }
  .nav-toggle { font-size: 18px; }
  .back-top { width: 46px; height: 46px; }
  .captcha-row img { height: 46px; }
}
