/* =========================================================
   源码贴 CodePaste — 视觉规范参考 VS Code Dark+
   ========================================================= */

:root {
  --bg:            #181818;
  --surface:       #1E1E1E;
  --surface-2:     #252526;
  --surface-3:     #2D2D30;
  --sheet-bg:      #232326;
  --drawer-bg:     #202023;
  --input-bg:      #1A1A1C;
  --kbd-bg:        #2A2A2D;
  --toggle-bg:     #3A3A3E;
  --toggle-knob:   #B4B4B4;
  --border:        #2B2B2E;
  --border-strong: #3C3C40;

  --text:          #E7E7E7;
  --text-soft:     #A5A5A5;
  --text-dim:      #757575;
  --dot:           #4A4A4A;

  --code-fg:       #D4D4D4;
  --gutter-fg:     #5C5C5C;
  --caret:         #AEAFAD;
  --placeholder:   #5E5E5E;
  --sel-bg:        rgba(38, 79, 120, 0.72);

  --accent:        #007ACC;
  --accent-hover:  #1A8CD8;
  --accent-soft:   rgba(0, 122, 204, 0.14);
  --btn-bg:        #007ACC;
  --btn-bg-hover:  #1A8CD8;
  --link-fg:       #9CDCFE;

  --topbar-bg:     rgba(24, 24, 24, 0.86);
  --mask-bg:       rgba(0, 0, 0, 0.6);
  --hover:         rgba(255, 255, 255, 0.05);
  --hover-soft:    rgba(255, 255, 255, 0.02);
  --glow:          rgba(0, 122, 204, 0.10);
  --hero-glow:     rgba(0, 122, 204, 0.20);
  --hero-a:        #6FD1FF;
  --hero-b:        #9CDCFE;

  --mark-bg-a:     #232326;
  --mark-bg-b:     #171719;
  --mark-fg:       #4FC1FF;
  --chip-ok-fg:    #7FD1B9;
  --chip-ok-bg:    rgba(78, 201, 176, 0.12);
  --chip-ok-bd:    rgba(78, 201, 176, 0.22);
  --badge-fg:      #4FC1FF;
  --badge-bg:      rgba(0, 122, 204, 0.14);
  --badge-bd:      rgba(0, 122, 204, 0.28);

  --code-size:     14px;
  --code-lh:       1.62;
  --code-pad-y:    14px;
  --code-pad-x:    16px;

  --radius:        12px;
  --shadow:        0 18px 40px -18px rgba(0, 0, 0, 0.75), 0 1px 0 rgba(255,255,255,0.03) inset;
  --shadow-lg:     0 26px 60px -28px rgba(0, 0, 0, 0.8);

  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
             "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  --font-code: Consolas, "Cascadia Mono", "JetBrains Mono", "SFMono-Regular",
               Menlo, Monaco, "Liberation Mono", "Courier New", monospace;
}

/* =========================================================
   背景主题
   ========================================================= */

html[data-theme="obsidian"] {
  --bg: #0B0B0C;  --surface: #131315;  --surface-2: #19191C;  --surface-3: #232327;
  --sheet-bg: #17171A; --drawer-bg: #141416; --input-bg: #0E0E10;
  --kbd-bg: #1F1F23; --toggle-bg: #2E2E34;
  --border: #212125; --border-strong: #35353C;
  --text: #EDEDEF; --text-soft: #A2A2AB; --text-dim: #6E6E78; --dot: #3E3E46;
  --gutter-fg: #55555E; --placeholder: #57575F;
  --accent: #4F8CFF; --accent-hover: #6E9FFF; --accent-soft: rgba(79,140,255,0.16);
  --btn-bg: #3568D4; --btn-bg-hover: #4277E6;
  --link-fg: #8FB8FF;
  --topbar-bg: rgba(11, 11, 12, 0.86);
  --glow: rgba(79, 140, 255, 0.10); --hero-glow: rgba(79, 140, 255, 0.22);
  --hero-a: #8FB8FF; --hero-b: #BBD1FF;
  --mark-fg: #8FB8FF; --chip-ok-fg: #7FD1B9;
  --badge-fg: #8FB8FF; --badge-bg: rgba(79,140,255,0.14); --badge-bd: rgba(79,140,255,0.28);
}

html[data-theme="midnight"] {
  --bg: #0B1220;  --surface: #0F1728;  --surface-2: #152036;  --surface-3: #1D2B45;
  --sheet-bg: #142033; --drawer-bg: #101A2B; --input-bg: #0A101C;
  --kbd-bg: #1B2A42; --toggle-bg: #2A3B57;
  --border: #1B2740; --border-strong: #2E4062;
  --text: #E6EDF7; --text-soft: #A0B0C9; --text-dim: #6C7E9B; --dot: #3A4C6A;
  --gutter-fg: #4E6180; --placeholder: #566A87;
  --accent: #3B82F6; --accent-hover: #5B98FF; --accent-soft: rgba(59,130,246,0.18);
  --btn-bg: #2563C9; --btn-bg-hover: #2F73DA;
  --link-fg: #9CC6FF;
  --topbar-bg: rgba(11, 18, 32, 0.86);
  --glow: rgba(59, 130, 246, 0.14); --hero-glow: rgba(59, 130, 246, 0.28);
  --hero-a: #7DB4FF; --hero-b: #A9CBFF;
  --mark-fg: #7DB4FF; --badge-fg: #7DB4FF;
  --badge-bg: rgba(59,130,246,0.16); --badge-bd: rgba(59,130,246,0.32);
}

html[data-theme="violet"] {
  --bg: #120F1A;  --surface: #181322;  --surface-2: #201A2E;  --surface-3: #2A223C;
  --sheet-bg: #1F1830; --drawer-bg: #191323; --input-bg: #0F0C16;
  --kbd-bg: #29203A; --toggle-bg: #3A2E51;
  --border: #251D36; --border-strong: #3E3059;
  --text: #EDE9F7; --text-soft: #ADA4C4; --text-dim: #7A7093; --dot: #4A3D63;
  --gutter-fg: #5E5378; --placeholder: #665C7D;
  --accent: #A855F7; --accent-hover: #BC74FF; --accent-soft: rgba(168,85,247,0.18);
  --btn-bg: #7C3AED; --btn-bg-hover: #8B4BF0;
  --link-fg: #D0A9FF;
  --topbar-bg: rgba(18, 15, 26, 0.86);
  --glow: rgba(168, 85, 247, 0.14); --hero-glow: rgba(168, 85, 247, 0.28);
  --hero-a: #C89BFF; --hero-b: #E2C7FF;
  --mark-fg: #C89BFF; --badge-fg: #C89BFF;
  --badge-bg: rgba(168,85,247,0.16); --badge-bd: rgba(168,85,247,0.32);
}

html[data-theme="forest"] {
  --bg: #0A1210;  --surface: #0E1815;  --surface-2: #14211D;  --surface-3: #1C2C27;
  --sheet-bg: #14201C; --drawer-bg: #0F1917; --input-bg: #08100E;
  --kbd-bg: #1A2A25; --toggle-bg: #2B403A;
  --border: #1A2926; --border-strong: #2C413C;
  --text: #E4F0EC; --text-soft: #9DB4AE; --text-dim: #6B837D; --dot: #3A4F49;
  --gutter-fg: #4E6660; --placeholder: #566E68;
  --accent: #10B981; --accent-hover: #26C893; --accent-soft: rgba(16,185,129,0.16);
  --btn-bg: #0B7D5A; --btn-bg-hover: #0F9068;
  --link-fg: #7FE0C0;
  --topbar-bg: rgba(10, 18, 16, 0.86);
  --glow: rgba(16, 185, 129, 0.12); --hero-glow: rgba(16, 185, 129, 0.24);
  --hero-a: #6EE7B7; --hero-b: #A7F3D0;
  --mark-fg: #6EE7B7; --badge-fg: #6EE7B7;
  --badge-bg: rgba(16,185,129,0.14); --badge-bd: rgba(16,185,129,0.30);
}

html[data-theme="paper"] {
  --bg: #F2EFE8;  --surface: #FFFFFF;  --surface-2: #F8F6F1;  --surface-3: #EDE9E1;
  --sheet-bg: #FFFFFF; --drawer-bg: #FBFAF6; --input-bg: #F6F4EF;
  --kbd-bg: #EDE9E1; --toggle-bg: #C9C3B7; --toggle-knob: #FFFFFF;
  --border: #E3DED4; --border-strong: #D0C9BC;

  --text: #23211D; --text-soft: #5C5850; --text-dim: #8A857B; --dot: #BDB6A8;

  --code-fg: #1F1F1F; --gutter-fg: #A9A399; --caret: #23211D;
  --placeholder: #A9A399; --sel-bg: #BBD9FF;

  --accent: #0B69C7; --accent-hover: #0A5AA8; --accent-soft: rgba(11,105,199,0.14);
  --btn-bg: #0B69C7; --btn-bg-hover: #0A5AA8;
  --link-fg: #0B69C7;

  --topbar-bg: rgba(248, 246, 241, 0.85);
  --mask-bg: rgba(35, 33, 29, 0.42);
  --hover: rgba(0, 0, 0, 0.05); --hover-soft: rgba(0, 0, 0, 0.02);
  --glow: rgba(11, 105, 199, 0.07); --hero-glow: rgba(11, 105, 199, 0.16);
  --hero-a: #0B69C7; --hero-b: #7C3AED;

  --mark-bg-a: #FFFFFF; --mark-bg-b: #F0EDE6; --mark-fg: #0B69C7;
  --chip-ok-fg: #0F766E; --chip-ok-bg: rgba(15,118,110,0.09); --chip-ok-bd: rgba(15,118,110,0.22);
  --badge-fg: #0B69C7; --badge-bg: rgba(11,105,199,0.09); --badge-bd: rgba(11,105,199,0.24);

  --shadow: 0 18px 40px -22px rgba(60, 50, 35, 0.35), 0 1px 0 rgba(255,255,255,0.9) inset;
  --shadow-lg: 0 22px 46px -26px rgba(70, 60, 45, 0.4);
}

/* 浅色下换成 VS Code Light+ 的配色，保证可读 */
html[data-theme="paper"] .hljs-comment,
html[data-theme="paper"] .hljs-quote        { color: #008000; }
html[data-theme="paper"] .hljs-keyword,
html[data-theme="paper"] .hljs-literal,
html[data-theme="paper"] .hljs-type,
html[data-theme="paper"] .hljs-doctag,
html[data-theme="paper"] .hljs-template-tag,
html[data-theme="paper"] .hljs-template-variable { color: #0000FF; }
html[data-theme="paper"] .hljs-string,
html[data-theme="paper"] .hljs-regexp       { color: #A31515; }
html[data-theme="paper"] .hljs-number,
html[data-theme="paper"] .hljs-symbol,
html[data-theme="paper"] .hljs-bullet,
html[data-theme="paper"] .hljs-link         { color: #098658; }
html[data-theme="paper"] .hljs-built_in,
html[data-theme="paper"] .hljs-title.class_,
html[data-theme="paper"] .hljs-class .hljs-title,
html[data-theme="paper"] .hljs-selector-class { color: #267F99; }
html[data-theme="paper"] .hljs-title.function_,
html[data-theme="paper"] .hljs-function .hljs-title,
html[data-theme="paper"] .hljs-section,
html[data-theme="paper"] .hljs-name         { color: #795E26; }
html[data-theme="paper"] .hljs-variable,
html[data-theme="paper"] .hljs-attr,
html[data-theme="paper"] .hljs-attribute,
html[data-theme="paper"] .hljs-params,
html[data-theme="paper"] .hljs-property,
html[data-theme="paper"] .hljs-selector-id  { color: #001080; }
html[data-theme="paper"] .hljs-meta,
html[data-theme="paper"] .hljs-meta .hljs-keyword { color: #AF00DB; }
html[data-theme="paper"] .hljs-subst        { color: #1F1F1F; }
html[data-theme="paper"] .hljs-tag,
html[data-theme="paper"] .hljs-tag .hljs-name { color: #800000; }
html[data-theme="paper"] .hljs-tag .hljs-attr { color: #001080; }
html[data-theme="paper"] .hljs-tag .hljs-string { color: #A31515; }
html[data-theme="paper"] .hljs-addition     { color: #098658; }
html[data-theme="paper"] .hljs-deletion     { color: #A31515; }

* { box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 340px;
  background: radial-gradient(80% 100% at 50% 0%, var(--glow), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

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

/* ------------------------------------------------ 顶栏 */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 58px;
  padding: 0 18px;
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  padding: 4px 6px;
  border-radius: 8px;
  transition: background 0.15s ease;
}
.brand:hover { background: var(--hover); }

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: var(--mark-fg);
  background: linear-gradient(160deg, var(--mark-bg-a), var(--mark-bg-b));
  border: 1px solid var(--border-strong);
  box-shadow: 0 1px 0 var(--hover) inset;
}

.brand-text {
  display: flex;
  align-items: baseline;
  gap: 7px;
  line-height: 1;
}
.brand-text strong {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.brand-text em {
  font-style: normal;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.topbar-spacer { flex: 1; }

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

/* ------------------------------------------------ 按钮 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-soft);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(0.5px); }
.btn svg { flex: none; opacity: 0.95; }

.btn-ghost:hover { background: var(--surface-3); color: var(--text); }

.btn-primary {
  background: var(--btn-bg);
  border-color: var(--btn-bg-hover);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.16) inset, 0 6px 16px -8px var(--btn-bg);
}
.btn-primary:hover { background: var(--btn-bg-hover); }

.btn-outline {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--hover-soft);
}
.btn-outline:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
}

.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 7px; }

.lbl-short { display: none; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

/* ------------------------------------------------ 主体 */

main {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 22px 20px 56px;
}

.view { animation: fadeUp 0.28s ease both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ------------------------------------------------ 标题行 */

.meta-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.meta-title, .meta-author {
  height: 42px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.meta-title { flex: 1; min-width: 0; font-size: 15px; font-weight: 500; }
.meta-author { width: 190px; flex: none; }

.meta-title::placeholder, .meta-author::placeholder { color: var(--text-dim); font-weight: 400; }

.meta-title:focus, .meta-author:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ------------------------------------------------ 编辑器卡片 */

.editor-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.editor-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 46px;
  padding: 0 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.editor-bar-left, .editor-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* 下拉 */
.select-wrap { position: relative; display: inline-flex; align-items: center; }

#langSelect {
  appearance: none;
  -webkit-appearance: none;
  height: 30px;
  padding: 0 28px 0 10px;
  border-radius: 7px;
  border: 1px solid var(--border-strong);
  background: var(--surface-3);
  color: var(--text);
  font-family: var(--font-code);
  font-size: 12.5px;
  cursor: pointer;
  outline: none;
  max-width: 200px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
#langSelect:hover { border-color: var(--border-strong); }
#langSelect:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.select-caret {
  position: absolute;
  right: 10px;
  color: var(--text-dim);
  pointer-events: none;
}

.detect-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 20px;
  font-size: 11.5px;
  color: var(--chip-ok-fg);
  background: var(--chip-ok-bg);
  border: 1px solid var(--chip-ok-bd);
  white-space: nowrap;
}

/* 行号开关 */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-soft);
  cursor: pointer;
  user-select: none;
  padding: 3px 4px;
}
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-box {
  position: relative;
  width: 26px;
  height: 15px;
  border-radius: 20px;
  background: var(--toggle-bg);
  transition: background 0.16s ease;
}
.toggle-box::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--toggle-knob);
  transition: transform 0.16s ease, background 0.16s ease;
}
.toggle input:checked + .toggle-box { background: var(--accent); }
.toggle input:checked + .toggle-box::after { transform: translateX(11px); background: #fff; }

/* 字号 */
.fontsize {
  display: inline-flex;
  align-items: center;
  height: 28px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  overflow: hidden;
}
.fontsize button {
  width: 26px;
  height: 100%;
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.fontsize button:hover { background: var(--surface-3); color: var(--text); }
.fontsize span {
  min-width: 26px;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  line-height: 26px;
}

/* 编辑区 */
.editor-body {
  display: flex;
  height: clamp(340px, calc(100vh - 330px), 720px);
  background: var(--surface);
  overflow: hidden;
}

.gutter {
  flex: none;
  min-width: 46px;
  padding: var(--code-pad-y) 10px var(--code-pad-y) 14px;
  overflow: hidden;
  text-align: right;
  color: var(--gutter-fg);
  background: var(--surface);
  border-right: 1px solid var(--border);
  font-family: var(--font-code);
  font-size: var(--code-size);
  line-height: var(--code-lh);
  user-select: none;
  white-space: pre;
  font-variant-numeric: tabular-nums;
}
.gutter-inner { will-change: transform; }

.code-scroll {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.hl-layer, #src {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: var(--code-pad-y) var(--code-pad-x);
  border: 0;
  font-family: var(--font-code);
  font-size: var(--code-size);
  line-height: var(--code-lh);
  letter-spacing: 0;
  tab-size: 4;
  -moz-tab-size: 4;
  white-space: pre;
  word-wrap: normal;
  overflow-wrap: normal;
}

.hl-layer {
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
  color: var(--code-fg);
  background: transparent;
  will-change: transform;
}
.hl-layer code {
  font: inherit;
  background: none;
  padding: 0;
  white-space: inherit;
  display: block;
}

#src {
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  resize: none;
  outline: none;
  overflow: auto;
  background: transparent;
  color: transparent;
  caret-color: var(--caret);
  -webkit-text-fill-color: transparent;
}
#src::placeholder {
  color: var(--placeholder);
  -webkit-text-fill-color: var(--placeholder);
}
#src::selection {
  background: var(--sel-bg);
}

/* 底部信息条 */
.editor-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 34px;
  padding: 0 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 11.5px;
  color: var(--text-dim);
}
.foot-stats { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.foot-stats .dot { color: var(--dot); }
.foot-tips { display: inline-flex; align-items: center; gap: 4px; }
.foot-tips span { color: var(--text-dim); }
kbd {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  background: var(--kbd-bg);
  color: var(--text-soft);
  font-family: var(--font-code);
  font-size: 10.5px;
  line-height: 1.5;
}

/* ------------------------------------------------ 底部操作行 */

.action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.action-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-left: auto;
}

/* ------------------------------------------------ 只读视图 */

.read-head { margin-bottom: 16px; }

.read-title {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.2px;
  line-height: 1.35;
  word-break: break-word;
}

.read-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-dim);
}
.meta-item { display: inline-flex; align-items: center; gap: 5px; }
.meta-item::before {
  content: "";
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--dot);
  margin-right: 3px;
}
.lang-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 5px;
  font-family: var(--font-code);
  font-size: 11.5px;
  color: var(--badge-fg);
  background: var(--badge-bg);
  border: 1px solid var(--badge-bd);
}

.read-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 44px;
  padding: 0 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.read-toolbar-actions { display: flex; align-items: center; gap: 4px; }

.read-code {
  max-height: calc(100vh - 300px);
  min-height: 160px;
  overflow: auto;
  background: var(--surface);
}
.read-code .hl-layer.static {
  position: static;
  transform: none !important;
  overflow: visible;
  padding: var(--code-pad-y) var(--code-pad-x);
}
.read-code .hl-layer.static code { padding-left: 0; }

.read-foot-note {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.7;
}

/* ------------------------------------------------ 弹窗 / 抽屉 */

.sheet-mask, .drawer-mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--mask-bg);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fadeIn 0.18s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.sheet-mask {
  display: grid;
  place-items: center;
  padding: 20px;
}

.sheet {
  width: 100%;
  max-width: 580px;
  padding: 20px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--sheet-bg);
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.9);
  animation: popIn 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.97) translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.sheet-head h2 { margin: 0; font-size: 16px; font-weight: 600; }

.sheet-desc {
  margin: 8px 0 14px;
  font-size: 12.5px;
  color: var(--text-soft);
  line-height: 1.6;
}

.link-box { display: flex; gap: 8px; }
.link-box input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--input-bg);
  color: var(--link-fg);
  font-family: var(--font-code);
  font-size: 12px;
  outline: none;
}
.link-box input:focus { border-color: var(--accent); }

.sheet-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.sheet-len { font-size: 11.5px; color: var(--text-dim); }
.sheet-foot-actions { display: flex; gap: 6px; }

/* 抽屉 */
.drawer-mask { display: flex; justify-content: flex-end; }

.drawer {
  width: 100%;
  max-width: 400px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--drawer-bg);
  border-left: 1px solid var(--border-strong);
  box-shadow: -24px 0 60px -20px rgba(0, 0, 0, 0.8);
  animation: slideIn 0.24s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes slideIn {
  from { transform: translateX(24px); opacity: 0.4; }
  to   { transform: none; opacity: 1; }
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.drawer-head h2 { margin: 0; font-size: 15px; font-weight: 600; }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.drawer-foot {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.6;
}

.hist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.14s ease;
}
.hist-item:hover { background: var(--hover); }

.hist-main { flex: 1; min-width: 0; }
.hist-title {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.hist-sub {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-code);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hist-del {
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.hist-item:hover .hist-del { opacity: 1; }
.hist-del:hover { background: rgba(255, 80, 80, 0.14); color: #FF7B72; }

.empty-state {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.8;
}

/* ------------------------------------------------ Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  z-index: 90;
  transform: translate(-50%, 14px);
  padding: 9px 16px;
  border-radius: 9px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 12.5px;
  box-shadow: 0 16px 34px -12px rgba(0, 0, 0, 0.85);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  max-width: min(90vw, 420px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* =========================================================
   代码高亮：VS Code Dark+
   ========================================================= */

.hljs-comment,
.hljs-quote                       { color: #6A9955; font-style: italic; }

.hljs-keyword,
.hljs-literal,
.hljs-type,
.hljs-doctag,
.hljs-template-tag,
.hljs-template-variable           { color: #569CD6; }

.hljs-string,
.hljs-doctag .hljs-type,
.hljs-regexp                      { color: #D69D85; }

.hljs-number,
.hljs-symbol,
.hljs-bullet,
.hljs-link,
.hljs-selector-attr,
.hljs-selector-pseudo             { color: #B5CEA8; }

.hljs-built_in,
.hljs-title.class_,
.hljs-class .hljs-title,
.hljs-selector-class              { color: #4EC9B0; }

.hljs-title.function_,
.hljs-function .hljs-title,
.hljs-section,
.hljs-name                        { color: #DCDCAA; }

.hljs-variable,
.hljs-attr,
.hljs-attribute,
.hljs-params,
.hljs-property,
.hljs-selector-id                 { color: #9CDCFE; }

.hljs-meta,
.hljs-meta .hljs-keyword          { color: #C586C0; }

.hljs-subst                       { color: #D4D4D4; }

.hljs-tag                         { color: #569CD6; }
.hljs-tag .hljs-name              { color: #569CD6; }
.hljs-tag .hljs-attr              { color: #9CDCFE; }
.hljs-tag .hljs-string            { color: #D69D85; }

.hljs-addition                    { color: #B5CEA8; }
.hljs-deletion                    { color: #FF7B72; }

.hljs-emphasis { font-style: italic; }
.hljs-strong   { font-weight: 700; }

.hljs-formula  { color: #D4D4D4; }

/* =========================================================
   响应式
   ========================================================= */

@media (max-width: 860px) {
  main { padding: 16px 14px 44px; max-width: 100%; }
  .meta-row { flex-direction: column; }
  .meta-author { width: 100%; }
  .editor-body { height: clamp(300px, calc(100vh - 380px), 560px); }
  .action-hint { display: none; }
  .brand-text em { display: none; }
  .editor-card, .view, main { min-width: 0; max-width: 100%; }
}

@media (max-width: 620px) {
  .topbar { padding: 0 10px; height: 54px; gap: 4px; }
  .brand { padding: 2px; flex: 0 1 auto; min-width: 0; }
  .brand-text strong { font-size: 14px; }
  .topbar-spacer { min-width: 0; flex: 1 1 0; }
  .topbar-actions { flex: 0 0 auto; gap: 2px; }

  .topbar-actions .btn { padding: 0 9px; gap: 5px; }
  .topbar-actions .btn > span { display: none; }
  .topbar-actions .btn > span.lbl-short { display: inline; }

  .foot-tips { display: none; }
  .editor-bar { gap: 6px; padding: 0 8px; }
  .editor-bar-right { gap: 4px; flex: 0 0 auto; }
  .toggle span:last-child, .fontsize { display: none; }
  .detect-chip { display: none !important; }
  #langSelect { max-width: 118px; }
  .meta-title, .meta-author { height: 40px; font-size: 13.5px; }
  .read-title { font-size: 18px; }
  .read-toolbar { height: auto; flex-wrap: wrap; padding: 8px 10px; gap: 8px; }
  .read-code { max-height: none; }
  .sheet { padding: 16px; }
  .sheet-foot { flex-direction: column; align-items: stretch; gap: 8px; }
  .sheet-foot-actions { justify-content: flex-end; }
  .drawer { max-width: 100%; }
  .action-row .btn { flex: 1 1 auto; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* =========================================================
   主题选择器
   ========================================================= */

.theme-wrap { position: relative; display: inline-flex; }

.theme-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--text-soft);
}
.theme-btn:hover { color: var(--text); }

.theme-pop {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 80;
  width: 236px;
  padding: 8px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--sheet-bg);
  box-shadow: var(--shadow-lg);
  animation: popIn 0.16s cubic-bezier(0.2, 0.9, 0.3, 1.1) both;
}

.theme-pop-head {
  padding: 4px 8px 7px;
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--text-dim);
}

.theme-list { display: flex; flex-direction: column; gap: 2px; }

.theme-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 6px 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  font-family: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.theme-item:hover { background: var(--hover); color: var(--text); }
.theme-item.is-on { background: var(--accent-soft); color: var(--text); }

.theme-sw {
  position: relative;
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: #1E1E1E;
}
.theme-sw i {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.theme-item .tick { margin-left: auto; opacity: 0; color: var(--accent); flex: none; }
.theme-item.is-on .tick { opacity: 1; }

.theme-pop-foot {
  margin-top: 6px;
  padding: 7px 8px 2px;
  border-top: 1px solid var(--border);
  font-size: 10.5px;
  color: var(--text-dim);
}

/* =========================================================
   首页
   ========================================================= */

.view-home { padding-top: 10px; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.02fr);
  gap: 48px;
  align-items: center;
  padding: 30px 0 8px;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 25px;
  padding: 0 11px;
  border-radius: 20px;
  border: 1px solid var(--border-strong);
  background: var(--hover-soft);
  font-size: 11.5px;
  color: var(--text-soft);
  letter-spacing: 0.2px;
}
.hero-tag .pulse {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.hero h1 {
  margin: 16px 0 0;
  font-size: clamp(29px, 3.5vw, 44px);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.6px;
}

.hero .grad {
  background: linear-gradient(100deg, var(--hero-a), var(--hero-b));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-sub {
  margin: 15px 0 0;
  max-width: 470px;
  font-size: 14px;
  line-height: 1.9;
  color: var(--text-soft);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.btn-lg {
  height: 42px;
  padding: 0 20px;
  font-size: 13.5px;
  border-radius: 10px;
}

.resume-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--accent);
  cursor: pointer;
}
.resume-link::before { content: "↩"; font-size: 13px; opacity: 0.85; }
.resume-link:hover { text-decoration: underline; }

.hero-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 26px;
  font-size: 12px;
  color: var(--text-dim);
}
.hero-meta b { color: var(--text); font-weight: 600; }
.hero-meta i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--dot);
}

/* 演示窗口 */
.hero-art { position: relative; }

.hero-glow {
  position: absolute;
  inset: -12% -6% auto -6%;
  height: 70%;
  background: radial-gradient(60% 60% at 50% 0%, var(--hero-glow), transparent 72%);
  filter: blur(18px);
  pointer-events: none;
}

.demo {
  position: relative;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-lg), 0 1px 0 var(--hover) inset;
  overflow: hidden;
}

.demo-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.demo-dot { width: 9px; height: 9px; border-radius: 50%; opacity: 0.85; }
.demo-dot.r { background: #FF5F57; }
.demo-dot.y { background: #FEBC2E; }
.demo-dot.g { background: #28C840; }

.demo-name {
  margin-left: 8px;
  font-family: var(--font-code);
  font-size: 11.5px;
  color: var(--text-dim);
}
.demo-badge {
  margin-left: auto;
  padding: 1px 8px;
  border-radius: 20px;
  border: 1px solid var(--badge-bd);
  background: var(--badge-bg);
  color: var(--badge-fg);
  font-family: var(--font-code);
  font-size: 10.5px;
}

.demo-code {
  margin: 0;
  padding: 14px 16px 16px;
  overflow: auto;
  font-family: var(--font-code);
  font-size: 12.5px;
  line-height: 1.68;
  color: var(--code-fg);
  tab-size: 4;
}
.demo-code code { font: inherit; background: none; padding: 0; white-space: pre; }

.demo-tail {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 9px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  background: var(--hover-soft);
  font-size: 11.5px;
  color: var(--text-dim);
}
.demo-tail-k { flex: none; }
.demo-tail-url {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: var(--font-code);
  font-size: 11px;
  color: var(--link-fg);
}
.demo-tail-n { flex: none; }

/* 特性 */
.features {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 52px;
}

.feature {
  padding: 17px 16px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color 0.16s ease, transform 0.16s ease;
}
.feature:hover { border-color: var(--border-strong); transform: translateY(-1px); }

.feature-ico {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
}

.feature h3 {
  margin: 12px 0 6px;
  font-size: 13.5px;
  font-weight: 600;
}
.feature p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--text-soft);
}
.feature p code {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--surface-3);
  font-family: var(--font-code);
  font-size: 11.5px;
}

/* 精选代码 */
.picks { margin-top: 54px; }

.picks-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.picks-intro h2 {
  margin: 0 0 5px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.1px;
}
.picks-intro p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-soft);
}

.picks-stats {
  display: flex;
  align-items: stretch;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
}

.pstat {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 15px 7px;
  min-width: 74px;
}
.pstat + .pstat::before {
  content: "";
  position: absolute;
  left: 0;
  top: 22%;
  height: 56%;
  width: 1px;
  background: var(--border);
}
.pstat b {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.pstat span {
  font-size: 11px;
  line-height: 1.3;
  color: var(--text-soft);
  white-space: nowrap;
}

.pick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.pick {
  display: flex;
  flex-direction: column;
  padding: 14px 15px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}
.pick:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: 0 14px 28px -18px rgba(0, 0, 0, 0.55);
}
.pick:active { transform: translateY(0); }
.pick:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.pick-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pick-lang {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 5px;
  border: 1px solid var(--badge-bd);
  background: var(--badge-bg);
  color: var(--badge-fg);
  font-family: var(--font-code);
  font-size: 10.5px;
  letter-spacing: 0.2px;
}

.pick-lines {
  font-size: 10.5px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.pick-title {
  margin: 9px 0 4px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}
.pick-desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.65;
  color: var(--text-soft);
}

.pick-pre {
  position: relative;
  margin: 10px 0 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text-dim);
  font-family: var(--font-code);
  font-size: 10.5px;
  line-height: 1.62;
  white-space: pre;
  overflow: hidden;
  text-overflow: clip;
  transition: color 0.16s ease;
}
.pick-pre::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 26px;
  background: linear-gradient(90deg, transparent, var(--input-bg));
  pointer-events: none;
}
.pick:hover .pick-pre { color: var(--text-soft); }

.pick-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 10.5px;
  color: var(--text-dim);
}

.pick-go {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 500;
}
.pick-go svg { transition: transform 0.16s ease; }
.pick:hover .pick-go svg { transform: translateX(2px); }

.picks-note {
  margin: 13px 0 0;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--text-dim);
}

/* 步骤 */
.steps { margin-top: 46px; }

.steps-title {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 600;
}

.step-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.step-list li {
  display: flex;
  gap: 11px;
  padding: 15px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.step-n {
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--badge-bd);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
}
.step-list h4 { margin: 2px 0 4px; font-size: 13px; font-weight: 600; }
.step-list p { margin: 0; font-size: 12.5px; line-height: 1.7; color: var(--text-soft); }

.home-foot {
  margin: 44px 0 0;
  text-align: center;
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--text-dim);
}

@media (max-width: 980px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 32px; padding-top: 16px; }
  .hero-sub { max-width: none; }
  .features { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 40px; }
  .pick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .step-list { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .hero h1 { font-size: 26px; letter-spacing: -0.3px; }
  .hero-sub { font-size: 13.5px; line-height: 1.85; }
  .hero-actions .btn { flex: 1 1 auto; justify-content: center; }
  .hero-meta { font-size: 11.5px; flex-wrap: wrap; }
  .demo-code { font-size: 11.5px; padding: 12px; }
  .demo-tail-url { font-size: 10.5px; }
  .features { grid-template-columns: 1fr; }
  .picks { margin-top: 40px; }
  .picks-head { align-items: flex-start; }
  .picks-stats { width: 100%; }
  .pstat { flex: 1; min-width: 0; padding: 6px 6px 7px; }
  .pick-grid { grid-template-columns: 1fr; }
  .home-foot { margin-top: 32px; }
  .theme-pop { width: 210px; }
}


/* =========================================================
   v2：账号 / 帖子流 / 详情 / 我的 / 登录
   ========================================================= */

/* ---------------- 导航栏 ---------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1160px;
  margin: 0 auto;
  height: 58px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav .brand { padding: 4px 8px; margin-left: -8px; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1px;
  margin-left: 6px;
}

.nav-link {
  position: relative;
  height: 32px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  font-family: inherit;
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.nav-link:hover { background: var(--hover); color: var(--text); }
.nav-link.is-on { color: var(--text); background: var(--hover); }
.nav-link.is-on::after {
  content: "";
  position: absolute;
  left: 11px;
  right: 11px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.nav-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 1 230px;
  height: 32px;
  margin-left: auto;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--input-bg);
  color: var(--text-dim);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.nav-search:focus-within { border-color: var(--border-strong); background: var(--surface-2); }
.nav-search-form { display: contents; }
.nav-search svg { flex: none; }
.nav-search input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
}
.nav-search input::placeholder { color: var(--text-dim); }
.nav-search input::-webkit-search-cancel-button { display: none; }

.nav-search-clear {
  flex: none;
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}
.nav-search-clear:hover { color: var(--text); }

.nav-user { position: relative; display: flex; align-items: center; }
.nav-login { flex: none; }

.nav-avatar {
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  line-height: 0;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.nav-avatar:hover { border-color: var(--accent); transform: translateY(-1px); }

.nav-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 90;
  width: 200px;
  padding: 6px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: var(--sheet-bg);
  box-shadow: var(--shadow-lg);
  animation: popIn 0.14s ease both;
}
.nav-menu-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 9px 9px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.nav-menu-head strong { font-size: 13px; color: var(--text); font-weight: 600; }
.nav-menu-head span { font-size: 11px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; }

.nav-menu-item {
  display: block;
  width: 100%;
  padding: 8px 9px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-soft);
  font-family: inherit;
  font-size: 12.5px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.nav-menu-item:hover { background: var(--hover); color: var(--text); }
.nav-menu-item.danger:hover { background: rgba(239, 68, 68, 0.12); color: #F87171; }

/* ---------------- 主题面板（跟随按钮定位） ---------------- */

.theme-pop {
  position: fixed;
  top: 66px;
  right: auto;
  left: 16px;
  width: 244px;
  max-height: calc(100vh - 88px);
  overflow-y: auto;
  z-index: 95;
}

.theme-custom {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.theme-custom-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.theme-custom-toggle:hover { background: var(--hover); color: var(--text); }
.theme-custom-toggle .chev { margin-left: auto; transition: transform 0.18s ease; }
.theme-custom-toggle.is-open .chev { transform: rotate(180deg); }

.theme-custom-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  padding: 8px 4px 4px;
}

.theme-custom-body label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 11px;
  color: var(--text-soft);
}

.theme-custom-body input[type="color"] {
  width: 22px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.theme-custom-body input[type="color"]::-webkit-color-swatch-wrapper { padding: 1px; }
.theme-custom-body input[type="color"]::-webkit-color-swatch { border: none; border-radius: 3px; }

.theme-custom-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  margin-top: 2px;
}

/* ---------------- 编辑器：简介输入 ---------------- */

.meta-row { display: flex; flex-direction: column; gap: 8px; }

.meta-intro {
  width: 100%;
  min-height: 38px;
  max-height: 120px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s ease;
}
.meta-intro::placeholder { color: var(--text-dim); }
.meta-intro:focus { border-color: var(--accent); }

/* ---------------- 帖子流 ---------------- */

.feed { margin-top: 48px; scroll-margin-top: 80px; }

.feed-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.feed-title-wrap h2 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.2px;
}
.feed-title-wrap p { margin: 0; font-size: 12.5px; color: var(--text-dim); }

.feed-sort {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--input-bg);
}
.feed-sort button {
  padding: 5px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-soft);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}
.feed-sort button.is-on { background: var(--surface-3); color: var(--text); }

.feed-list,
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 12px;
}

.post-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 15px 16px 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  outline: none;
  transition: border-color 0.16s ease, transform 0.16s ease, background 0.16s ease;
}
.post-card:hover,
.post-card:focus-visible {
  border-color: var(--border-strong);
  background: var(--surface-2);
  transform: translateY(-2px);
}

.pc-top { display: flex; align-items: center; gap: 8px; }

.pc-lang {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 5px;
  background: var(--badge-bg);
  color: var(--badge-fg);
  font-family: var(--font-code);
  font-size: 10.5px;
}

.pc-lines, .pc-time { font-size: 10.5px; color: var(--text-dim); }
.pc-time { margin-left: auto; }

.pc-del {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.post-card:hover .pc-del { opacity: 1; }
.pc-del:hover { color: #F87171; background: rgba(239, 68, 68, 0.12); }

.pc-title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.pc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 9px;
  border-top: 1px solid var(--border);
}

.pc-author {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--text-soft);
  font-size: 11.5px;
  text-decoration: none;
}
.pc-author span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-author:hover { color: var(--text); }

.pc-stats { display: flex; align-items: center; gap: 10px; flex: none; }

.pc-stat {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.pc-stat.is-on { color: #F06A6A; }

/* 头像 */
.av {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  flex: none;
  user-select: none;
}
.av-xs { width: 19px; height: 19px; font-size: 9.5px; }
.av-sm { width: 28px; height: 28px; font-size: 12px; }
.av-lg { width: 46px; height: 46px; font-size: 18px; }

/* 骨架 / 空态 / 错误 */
.feed-skel { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.skel-card {
  height: 132px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size: 240% 100%;
  animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { from { background-position: 140% 0; } to { background-position: -40% 0; } }

.feed-empty,
.feed-empty-inline,
.feed-err {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 40px 20px;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  color: var(--text-dim);
  font-size: 12.5px;
  text-align: center;
}
.feed-empty p { margin: 0; }
.feed-empty-inline { padding: 28px 16px; }
.feed-err { color: #F87171; }

.feed-more { display: flex; justify-content: center; margin-top: 18px; }
.feed-sentinel { height: 1px; }

/* 页脚 */
.site-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 26px 20px 34px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11.5px;
}
.site-foot i { opacity: 0.5; font-style: normal; }
.site-foot a { color: var(--text-soft); text-decoration: none; }
.site-foot a:hover { color: var(--text); }

/* ---------------- 帖子详情 ---------------- */

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

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

.post-head { margin-bottom: 14px; }

.post-badges { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
.post-time { font-size: 11.5px; color: var(--text-dim); }

.post-title {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: -0.4px;
}

.post-intro {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--text-soft);
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
}

.act-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  font-family: inherit;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: color 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}
.act-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--hover); }
.act-btn.is-on { color: #F06A6A; border-color: rgba(240, 106, 106, 0.35); background: rgba(240, 106, 106, 0.10); }
#btnFav.is-on { color: #E8B44A; border-color: rgba(232, 180, 74, 0.35); background: rgba(232, 180, 74, 0.10); }
.act-btn:disabled { opacity: 0.6; cursor: default; }

.act-spacer { flex: 1; }
.post-views { font-size: 11.5px; color: var(--text-dim); }

/* 作者卡 */
.author-card {
  position: sticky;
  top: 78px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.author-skel { height: 150px; border-radius: 8px; background: var(--surface-2); }

.ac-head { display: flex; align-items: center; gap: 10px; }
.ac-av { text-decoration: none; }
.ac-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ac-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ac-name:hover { color: var(--accent); }
.ac-sub { font-size: 11px; color: var(--text-dim); }
.ac-bio { margin: 10px 0 0; font-size: 12px; line-height: 1.7; color: var(--text-soft); }

.ac-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 12px 0;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.ac-stats div { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ac-stats b { font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ac-stats span { font-size: 10px; color: var(--text-dim); }

/* 评论 */
.comments { margin-top: 30px; }

.cmt-head {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
}
.cmt-head span { color: var(--text-dim); font-weight: 400; font-size: 13px; }

.cmt-composer {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
}
.cmt-composer textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.7;
  resize: vertical;
  outline: none;
}
.cmt-composer textarea:focus { border-color: var(--accent); }
.cmt-composer textarea::placeholder { color: var(--text-dim); }

.cmt-composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 9px;
}
.cmt-composer-foot span { font-size: 11px; color: var(--text-dim); }

.cmt-list { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; }

.cmt {
  display: flex;
  gap: 10px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--border);
}
.cmt:last-child { border-bottom: none; }
.cmt-av { padding-top: 1px; }
.cmt-body { flex: 1; min-width: 0; }
.cmt-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.cmt-meta b { font-size: 12.5px; font-weight: 600; color: var(--text); }
.cmt-meta span { font-size: 11px; color: var(--text-dim); }
.cmt-body p { margin: 0; font-size: 13px; line-height: 1.75; color: var(--text-soft); white-space: pre-wrap; word-break: break-word; }

.cmt-del {
  margin-left: auto;
  padding: 1px 6px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
}
.cmt:hover .cmt-del { opacity: 1; }
.cmt-del:hover { color: #F87171; background: rgba(239, 68, 68, 0.1); }

.cmt-empty { padding: 24px 0; text-align: center; font-size: 12.5px; color: var(--text-dim); }

/* ---------------- 我的 / 用户主页 ---------------- */

.me-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.me-avatar {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 23px;
  font-weight: 600;
  flex: none;
  user-select: none;
}

.me-info { flex: 1; min-width: 0; }
.me-info h1 { margin: 0 0 4px; font-size: 19px; font-weight: 600; letter-spacing: -0.3px; }
.me-bio { margin: 0 0 3px; font-size: 12.5px; line-height: 1.6; color: var(--text-soft); }
.me-mail { margin: 0; font-size: 11.5px; color: var(--text-dim); }

.me-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1px;
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--border);
  overflow: hidden;
}
.stat-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 13px 6px;
  background: var(--surface);
}
.stat-cell b { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-cell span { font-size: 10.5px; color: var(--text-dim); }

.tabs {
  display: flex;
  gap: 3px;
  margin: 20px 0 14px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  width: fit-content;
}
.tabs button {
  padding: 7px 15px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-soft);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.tabs button:hover { color: var(--text); }
.tabs button.is-on { background: var(--surface-3); color: var(--text); }

/* 设置 */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
}

.set-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.set-card h3 { margin: 0 0 13px; font-size: 14px; font-weight: 600; }
.set-note { margin: -6px 0 12px; font-size: 11.5px; color: var(--text-dim); }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 11px; }
.field > span { font-size: 11.5px; color: var(--text-soft); }
.field input,
.field textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.6;
  outline: none;
  resize: vertical;
  transition: border-color 0.15s ease;
}
.field input:focus,
.field textarea:focus { border-color: var(--accent); }
.field input[readonly] { color: var(--text-dim); cursor: default; }
.field input::placeholder,
.field textarea::placeholder { color: var(--text-dim); }

/* ---------------- 登录 ---------------- */

.view-login { display: flex; justify-content: center; padding-top: 26px; }

.auth-card {
  width: 100%;
  max-width: 384px;
  padding: 26px 24px 22px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.auth-title { margin: 0 0 6px; font-size: 20px; font-weight: 600; letter-spacing: -0.3px; }
.auth-sub { margin: 0 0 18px; font-size: 12px; line-height: 1.7; color: var(--text-dim); }

.auth-tabs {
  display: flex;
  gap: 3px;
  margin-bottom: 16px;
  padding: 3px;
  border-radius: 9px;
  background: var(--input-bg);
  border: 1px solid var(--border);
}
.auth-tabs button {
  flex: 1;
  padding: 7px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-soft);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.auth-tabs button.is-on { background: var(--surface-3); color: var(--text); }

.code-row { display: flex; gap: 8px; margin-bottom: 11px; }
.code-row input {
  flex: 1;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-family: var(--font-code);
  font-size: 15px;
  letter-spacing: 3px;
  outline: none;
}
.code-row input:focus { border-color: var(--accent); }
.code-row input::placeholder { color: var(--text-dim); letter-spacing: 0; font-size: 13px; }
.code-row .btn { height: 38px; flex: none; }

.btn-block { width: 100%; justify-content: center; height: 38px; }
.btn:disabled { opacity: 0.55; cursor: default; }

.auth-dev {
  margin: 0 0 12px;
  padding: 9px 11px;
  border: 1px dashed var(--chip-ok-bd);
  border-radius: 8px;
  background: var(--chip-ok-bg);
  color: var(--chip-ok-fg);
  font-size: 11.5px;
  line-height: 1.7;
}
.auth-dev b { font-family: var(--font-code); font-size: 14px; letter-spacing: 2px; }

.auth-or {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  color: var(--text-dim);
  font-size: 11px;
}
.auth-or::before,
.auth-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-foot { margin: 14px 0 0; font-size: 10.5px; line-height: 1.7; color: var(--text-dim); }

#btnWechat { gap: 8px; color: var(--text-soft); }
#btnWechat:disabled { opacity: 0.5; }

/* ---------------- 响应式 ---------------- */

@media (max-width: 1000px) {
  .post-wrap { grid-template-columns: minmax(0, 1fr); }
  .author-card { position: static; }
  .post-side { order: -1; }
}

@media (max-width: 900px) {
  .nav-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 8px 14px;
    row-gap: 8px;
  }
  .nav .brand { margin-left: -6px; }
  .nav-search { flex: 1 1 150px; margin-left: auto; }
  .nav-links {
    order: 4;
    width: 100%;
    margin: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-link { padding: 0 10px; font-size: 12.5px; }
  .nav-link.is-on::after { left: 10px; right: 10px; }
  .theme-pop { top: 104px; }
}

@media (max-width: 720px) {
  .feed-list,
  .post-grid,
  .feed-skel { grid-template-columns: 1fr; }
  .me-stats { grid-template-columns: repeat(3, 1fr); }
  .me-head { flex-wrap: wrap; }
  .me-head .btn { order: 3; width: 100%; justify-content: center; }
  .post-title { font-size: 19px; }
  .post-actions { flex-wrap: wrap; }
  .act-spacer { display: none; }
  .post-views { width: 100%; padding-top: 4px; }
  .auth-card { padding: 20px 16px; border-radius: 12px; }
  .comments { margin-top: 22px; }
  .tabs { width: 100%; }
  .tabs button { flex: 1; }
}

@media (max-width: 420px) {
  .nav-search { flex: 1 1 100%; order: 3; }
  .nav-links { order: 5; }
  .nav-inner { row-gap: 6px; }
  .theme-pop { top: 142px; }
  .me-stats { grid-template-columns: repeat(2, 1fr); }
  .post-card { padding: 13px; }
}

/* 修：我的页面右上按钮被 flex 压缩后换行 */
.me-head > .btn,
.me-head > a.btn {
  flex: none;
  white-space: nowrap;
  align-self: flex-start;
  margin-top: 2px;
}

/* 主按钮文字色跟随底色亮度（自定义亮色主色时自动转深色字） */
.btn-primary { color: var(--btn-fg, #fff); }

/* =========================================================
   编辑器增强：工具组 / 大纲 / 查找 / 预览 / 全屏
   ========================================================= */

.editor-body { position: relative; }

.eb-group {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-right: 8px;
  margin-right: 2px;
  border-right: 1px solid var(--border);
}

/* ---------- 大纲 ---------- */
.outline-pane {
  flex: none;
  width: 216px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--surface-2);
  min-height: 0;
}

.outline-head,
.preview-head {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 8px 0 12px;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  flex: none;
}

.outline-head span, .preview-head span { flex: 1; }

.mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--text-soft);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}

.mini-btn:hover { background: var(--hover); color: var(--text); border-color: var(--border-strong); }

.outline-filter {
  flex: none;
  margin: 8px 8px 4px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  outline: none;
}

.outline-filter:focus { border-color: var(--accent); }

.outline-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 4px 10px;
  scrollbar-width: thin;
}

.outline-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 4px 6px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-soft);
  font-size: 12px;
  font-family: var(--font-code);
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
}

.outline-item:hover { background: var(--hover); color: var(--text); }

.oi-kind {
  flex: none;
  min-width: 18px;
  color: var(--accent);
  font-size: 10.5px;
  opacity: .9;
}

.outline-item.k-def .oi-kind { color: #4FC1FF; }
.outline-item.k-class .oi-kind { color: #E5C07B; }
.outline-item.k-tag .oi-kind { color: #C586C0; }
.outline-item.k-sel .oi-kind { color: #9CDCFE; }

.oi-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.oi-line {
  flex: none;
  color: var(--text-dim);
  font-size: 11px;
}

.outline-empty {
  padding: 10px 12px;
  color: var(--text-dim);
  font-size: 12px;
}

/* ---------- 预览 ---------- */
.preview-pane {
  flex: 0 0 48%;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-left: 1px solid var(--border);
  background: #fff;
}

.preview-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
}

/* ---------- 查找替换 ---------- */
.find-bar {
  position: absolute;
  top: 8px;
  right: 12px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface-2);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .38);
}

.find-input {
  width: 132px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  outline: none;
}

.find-input:focus { border-color: var(--accent); }
.find-input-wide { width: 150px; }

.find-count {
  min-width: 42px;
  color: var(--text-dim);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

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

.find-case {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-dim);
  font-size: 11.5px;
  cursor: pointer;
  user-select: none;
}

.find-case input { accent-color: var(--accent); }

/* ---------- 缩进选择 ---------- */
.indent-pick select {
  height: 24px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 11.5px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}

.indent-pick select:hover { border-color: var(--border-strong); color: var(--text); }

/* ---------- 全屏编辑 ---------- */
body.editor-focus { overflow: hidden; }

/* .view 上有 fadeUp 动画（animation-fill-mode: both），会形成 transform 定位基准，
   让里面的 position:fixed 按 .view 的盒子定位而不是视口 —— 全屏时必须关掉 */
#viewEdit.focus-mode { animation: none; }

/* 全屏时让出整个视口，隐藏顶部导航，避免挡住编辑器工具栏 */
body.editor-focus .nav,
body.editor-focus .site-foot { display: none; }

#viewEdit.focus-mode .meta-row,
#viewEdit.focus-mode .action-row { display: none; }

#viewEdit.focus-mode .editor-card {
  position: fixed;
  inset: 10px;
  z-index: 90;
  margin: 0;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
}

#viewEdit.focus-mode .editor-body {
  flex: 1;
  height: auto;
  min-height: 0;
}

/* ---------- 窄屏 ---------- */
@media (max-width: 900px) {
  .outline-pane { width: 172px; }
  .preview-pane { flex-basis: 50%; }
  .find-bar { left: 8px; right: 8px; flex-wrap: wrap; }
  .find-input, .find-input-wide { flex: 1; min-width: 90px; }
}

@media (max-width: 720px) {
  .outline-pane {
    position: absolute;
    inset: 0 25% 0 0;
    z-index: 8;
    width: auto;
    background: var(--surface-2);
    box-shadow: 8px 0 24px rgba(0, 0, 0, .35);
  }
  .preview-pane {
    position: absolute;
    inset: 0;
    z-index: 9;
    flex-basis: auto;
    border-left: 0;
  }
  .eb-group { padding-right: 6px; }
}

/* =========================================================
   博客：主页专栏 / 列表 / 详情 / 写作
   ========================================================= */

.pc-lang-blog {
  color: #E5C07B;
  border-color: rgba(229, 192, 123, .35);
  background: rgba(229, 192, 123, .10);
}

.blog-col { margin-top: 26px; }

.blog-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.blog-actions .btn { height: 30px; padding: 0 12px; font-size: 12.5px; }

.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.blog-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 16px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}

.blog-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .18);
}

.bc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.bc-badge {
  font-size: 10.5px;
  letter-spacing: .04em;
  padding: 1px 7px;
  border-radius: 999px;
  color: #E5C07B;
  background: rgba(229, 192, 123, .12);
  border: 1px solid rgba(229, 192, 123, .3);
}

.bc-time { font-size: 11.5px; color: var(--text-dim); }

.bc-title {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.45;
  color: var(--text);
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bc-intro {
  margin: 0;
  font-size: 12.8px;
  line-height: 1.6;
  color: var(--text-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bc-tags { display: flex; flex-wrap: wrap; gap: 5px; }

.b-tag {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 5px;
  color: var(--text-soft);
  background: var(--surface-2);
  border: 1px solid var(--border);
  text-decoration: none;
}

.bc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-dim);
}

.bc-author { display: inline-flex; align-items: center; gap: 6px; }

.blog-empty {
  padding: 22px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  margin-top: 14px;
}

/* ---------- 列表页 ---------- */
.blog-list-head { margin-top: 6px; }

.view-blogs { padding-top: 18px; }

.view-blogs .blog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ---------- 详情页 ---------- */
.view-blog {
  max-width: 1080px;
  margin: 0 auto;
  padding-top: 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 268px;
  grid-template-areas: "article side" "comments side";
  gap: 22px 26px;
  align-items: start;
}

.blog-article { grid-area: article; min-width: 0; }

.blog-head { margin-bottom: 18px; }

.blog-title {
  margin: 10px 0 8px;
  font-size: 27px;
  line-height: 1.35;
  letter-spacing: -.01em;
  color: var(--text);
}

.blog-intro {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-soft);
}

.blog-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

.blog-byline {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-dim);
}

.byline-author {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}

.byline-bio { color: var(--text-dim); font-size: 12px; }

.blog-actions-bar {
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.blog-side { grid-area: side; position: sticky; top: 74px; }

.blog-comments { grid-area: comments; }

/* ---------- Markdown 正文 ---------- */
.md-body {
  font-size: 14.5px;
  line-height: 1.85;
  color: var(--text);
  word-break: break-word;
}

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

.md-h { margin: 26px 0 10px; line-height: 1.4; font-weight: 650; color: var(--text); }
.md-h1 { font-size: 23px; }
.md-h2 { font-size: 20px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.md-h3 { font-size: 17px; }
.md-h4, .md-h5, .md-h6 { font-size: 15px; color: var(--text-soft); }

.md-p { margin: 12px 0; }

.md-body a { color: var(--link-fg); text-decoration: none; border-bottom: 1px solid rgba(156, 220, 254, .35); }
.md-body a:hover { border-bottom-color: currentColor; }

.md-body img { max-width: 100%; border-radius: 8px; margin: 8px 0; }

.md-list { margin: 12px 0; padding-left: 22px; }
.md-list li { margin: 4px 0; }
.md-li-sub { margin-left: 14px; list-style-type: circle; }

.md-quote {
  margin: 14px 0;
  padding: 8px 14px;
  border-left: 3px solid var(--accent);
  background: var(--surface-2);
  border-radius: 0 8px 8px 0;
  color: var(--text-soft);
}

.md-hr { margin: 22px 0; border: 0; border-top: 1px solid var(--border); }

.md-code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-3);
  font-family: var(--font-code);
  font-size: .92em;
  color: #E5C07B;
}

.md-pre {
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--input-bg);
}

.md-pre-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 30px;
  padding: 0 10px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-code);
}

.md-copy {
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.md-copy:hover { background: var(--hover); color: var(--text); }

.md-pre pre {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
  font-family: var(--font-code);
  font-size: 13px;
  line-height: 1.7;
  color: var(--code-fg);
}

.md-table-wrap { margin: 16px 0; overflow-x: auto; }

.md-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.md-table th, .md-table td { padding: 6px 10px; border: 1px solid var(--border); text-align: left; }
.md-table th { background: var(--surface-2); font-weight: 600; }

/* ---------- 写作页 ---------- */
.view-write { padding-top: 18px; }

.write-head { display: flex; gap: 10px; align-items: center; }

.write-title { flex: 1; font-size: 17px; font-weight: 600; }

.write-line {
  display: block;
  width: 100%;
  margin-top: 8px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.write-line:focus, .write-title:focus { border-color: var(--accent); }

.write-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.write-body.only-preview { grid-template-columns: minmax(0, 1fr); }
.write-body.only-preview .write-pane:first-child { display: none; }

.write-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  height: clamp(360px, calc(100vh - 320px), 720px);
}

.write-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 32px;
  padding: 0 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 11.5px;
  letter-spacing: .03em;
  color: var(--text-dim);
  flex: none;
}

.write-hint { font-variant-numeric: tabular-nums; }

#wContent {
  flex: 1;
  width: 100%;
  padding: 14px;
  border: 0;
  resize: none;
  background: transparent;
  color: var(--code-fg);
  font-family: var(--font-code);
  font-size: 13.5px;
  line-height: 1.8;
  outline: none;
  tab-size: 2;
}

.write-preview { background: var(--surface); }
.write-preview .md-body { padding: 16px 18px; overflow-y: auto; flex: 1; font-size: 14px; }

.write-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-bottom: 30px;
}

.write-actions { display: flex; gap: 8px; }

.write-foot .action-hint code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-3);
  font-size: 11.5px;
  font-family: var(--font-code);
  color: var(--text-soft);
}

/* ---------- 响应式 ---------- */
@media (max-width: 1000px) {
  .view-blog { grid-template-columns: minmax(0, 1fr); grid-template-areas: "article" "side" "comments"; }
  .blog-side { position: static; }
  .blog-grid, .view-blogs .blog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .blog-grid, .view-blogs .blog-grid { grid-template-columns: minmax(0, 1fr); }
  .write-body { grid-template-columns: minmax(0, 1fr); }
  .write-pane { height: 46vh; }
  .blog-title { font-size: 22px; }
  .blog-actions { flex-wrap: wrap; }
}

/* =========================================================
   通知 / 标签 / 目录 / 代码运行
   ========================================================= */

/* ---------- 顶栏铃铛 ---------- */
.nav-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--text-soft);
  text-decoration: none;
  transition: background .12s, color .12s;
}

.nav-bell:hover { background: var(--hover); color: var(--text); }

.nav-bell-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #F87171;
  box-shadow: 0 0 0 2px var(--bg);
}

/* ---------- 标签行 ---------- */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color .12s, color .12s, background .12s;
}

.tag-chip:hover { border-color: var(--border-strong); color: var(--text); }
.tag-chip.is-on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.tag-chip i { font-style: normal; font-size: 10.5px; opacity: .7; }

/* ---------- 文章目录 ---------- */
.blog-toc {
  position: sticky;
  top: 74px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  max-height: 46vh;
  overflow-y: auto;
  scrollbar-width: thin;
}

.toc-head {
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.toc-item {
  display: block;
  padding: 3px 8px;
  border-left: 2px solid var(--border);
  color: var(--text-soft);
  font-size: 12.5px;
  line-height: 1.5;
  cursor: pointer;
  text-decoration: none;
}

.toc-item:hover { color: var(--text); }
.toc-item.lv3 { padding-left: 20px; font-size: 12px; }
.toc-item.is-on { color: var(--accent); border-left-color: var(--accent); background: var(--accent-soft); }

/* ---------- 通知列表 ---------- */
.view-notify { padding-top: 22px; max-width: 780px; margin: 0 auto; }

.notify-list { display: flex; flex-direction: column; gap: 2px; margin-top: 16px; }

.notify-item {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  transition: background .12s;
}

.notify-item:hover { background: var(--hover); }
.notify-item.is-unread { background: var(--accent-soft); }

.ni-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ni-text { font-size: 13.5px; line-height: 1.6; }
.ni-text b { font-weight: 600; }
.ni-body {
  font-size: 12.5px;
  color: var(--text-soft);
  background: var(--surface-2);
  border-radius: 6px;
  padding: 4px 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ni-time { font-size: 11.5px; color: var(--text-dim); }

/* ---------- 代码运行 ---------- */
.md-pre-acts { display: inline-flex; align-items: center; gap: 2px; }

.md-run {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.md-run:hover { background: var(--accent-soft); }

.run-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--mask-bg);
  backdrop-filter: blur(2px);
}

.run-box {
  display: flex;
  flex-direction: column;
  width: min(920px, 100%);
  height: min(640px, 100%);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .5);
}

.run-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 38px;
  padding: 0 8px 0 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-soft);
  flex: none;
}

.run-head-actions { display: flex; gap: 4px; }

.run-frame { flex: 1; width: 100%; border: 0; background: #fff; }

@media (max-width: 720px) {
  .run-modal { padding: 10px; }
  .run-box { height: min(560px, 100%); }
  .blog-toc { position: static; max-height: none; }
}

/* =========================================================
   可疑代码提醒
   ========================================================= */

.safety-note {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 14px;
  padding: 12px 40px 12px 14px;
  border: 1px solid rgba(250, 204, 21, .32);
  border-left: 3px solid #FACC15;
  border-radius: 10px;
  background: rgba(250, 204, 21, .07);
}

.safety-note.level-high {
  border-color: rgba(248, 113, 113, .34);
  border-left-color: #F87171;
  background: rgba(248, 113, 113, .08);
}

.sn-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: #FACC15;
}

.safety-note.level-high .sn-head { color: #F87171; }

.sn-icon { font-size: 14px; line-height: 1; }

.sn-body { font-size: 12.8px; line-height: 1.7; color: var(--text-soft); }

.sn-lead { margin: 0 0 6px; }

.sn-list {
  margin: 0 0 6px;
  padding-left: 18px;
}

.sn-list li { margin: 2px 0; }

.sn-foot { margin: 0; }
.sn-dim { display: block; margin-top: 4px; color: var(--text-dim); font-size: 11.5px; }

.sn-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.sn-close:hover { background: var(--hover); color: var(--text); }

/* =========================================================
   聊天室
   ========================================================= */

.chat-head { margin-bottom: 14px; }
.chat-title { font-size: 19px; font-weight: 600; letter-spacing: -0.2px; }
.chat-sub { margin-top: 4px; font-size: 12.5px; color: var(--text-dim); }

.chat-list {
  height: calc(100vh - 300px);
  min-height: 300px;
  overflow-y: auto;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.chat-empty { margin: auto; color: var(--text-dim); font-size: 13px; }

.chat-msg { display: flex; gap: 9px; }

.cm-av {
  flex: none;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
}

.cm-body { flex: 1; min-width: 0; }
.cm-head { display: flex; align-items: baseline; gap: 8px; }
.cm-name { font-size: 12.5px; color: var(--text-soft); text-decoration: none; }
.cm-name:hover { color: var(--text); }
.cm-time { font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

.cm-text {
  margin-top: 3px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text);
  word-break: break-word;
}

.chat-send {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.chat-send textarea {
  flex: 1;
  min-height: 38px;
  max-height: 120px;
  padding: 9px 10px;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.55;
}

.chat-send .btn { flex: none; }

/* =========================================================
   写作页：附带的代码区
   ========================================================= */

.write-code { margin-top: 12px; }

.write-code-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 7px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: 9px;
  background: transparent;
  color: var(--text-soft);
  font-family: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.write-code-toggle:hover { color: var(--text); }
.write-code-toggle.is-open { border-style: solid; color: var(--text); }
.wct-plus { font-size: 13px; line-height: 1; }

.write-code-box {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}

.write-code-box .write-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.wcode-lang {
  padding: 4px 8px;
  border: none;
  border-radius: 6px;
  outline: none;
  background: var(--surface-3);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}

.write-code-box textarea {
  display: block;
  width: 100%;
  min-height: 170px;
  max-height: 440px;
  padding: 12px 14px;
  border: none;
  outline: none;
  resize: vertical;
  background: transparent;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  tab-size: 2;
}

/* =========================================================
   文章末尾的完整代码
   ========================================================= */

.blog-code-block {
  margin-top: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.bcb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.bcb-title { font-size: 12.5px; color: var(--text-soft); }
.bcb-lang {
  font-size: 11.5px;
  color: var(--text-dim);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.blog-code-block .md-pre { margin: 0; border: none; border-radius: 0; }

/* 完整代码区已经有自己的语言标签，隐藏 markdown 代码块重复的那一行 */
.blog-code-block .md-pre-bar > span:first-child { display: none; }
