/* ============================================================
   zchblog · 样式
   设计：暖纸色 + 森林绿，亮/暗两套变量；无外部字体与图片依赖。
   ============================================================ */

:root {
  color-scheme: light;

  --bg: #f6f4ee;
  --bg-soft: #efede5;
  --surface: #fffdf8;
  --surface-2: #f4f1e8;
  --text: #1f1e1a;
  --text-soft: #4c4941;
  --muted: #78736a;
  --border: #e4dfd3;
  --border-strong: #cec7b7;
  --accent: #2c6e4f;
  --accent-hover: #235a40;
  --accent-soft: #e3efe7;
  --accent-text: #fffdf8;
  --danger: #b42318;
  --danger-hover: #95180f;
  --danger-soft: #fbe9e7;
  --on-danger: #fffaf8;

  --shadow-sm: 0 1px 2px rgba(31, 30, 26, .05);
  --shadow: 0 2px 4px rgba(31, 30, 26, .04), 0 16px 40px rgba(31, 30, 26, .07);
  --shadow-modal: 0 28px 90px rgba(20, 20, 16, .28);

  --header-bg: rgba(246, 244, 238, .82);
  --glow: rgba(44, 110, 79, .10);
  --scrim: rgba(20, 22, 18, .42);

  --radius: 18px;
  --radius-sm: 12px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua",
    "Noto Serif SC", "Songti SC", "SimSun", Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas, monospace;
}

html[data-theme="dark"] {
  color-scheme: dark;

  --bg: #111411;
  --bg-soft: #171b16;
  --surface: #191e19;
  --surface-2: #222821;
  --text: #eae8de;
  --text-soft: #c3c0b4;
  --muted: #918e82;
  --border: #2b312a;
  --border-strong: #3c4339;
  --accent: #7ec99c;
  --accent-hover: #9ad9b2;
  --accent-soft: #20342a;
  --accent-text: #102016;
  --danger: #e5534b;
  --danger-hover: #f27069;
  --danger-soft: #3a201e;
  --on-danger: #fffaf8;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 2px 4px rgba(0, 0, 0, .25), 0 18px 44px rgba(0, 0, 0, .35);
  --shadow-modal: 0 28px 90px rgba(0, 0, 0, .55);

  --header-bg: rgba(17, 20, 17, .82);
  --glow: rgba(126, 201, 156, .08);
  --scrim: rgba(0, 0, 0, .58);
}

/* ---------- 基础 ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1000px 560px at 88% -14%, var(--glow), transparent 64%),
    radial-gradient(760px 420px at -10% 8%, var(--glow), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[hidden] {
  display: none !important;
}

main {
  flex: 1;
  width: 100%;
}

h1, h2, h3, p {
  margin-top: 0;
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

::selection {
  background: var(--accent-soft);
  color: var(--text);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 10px;
  z-index: 300;
  background: var(--surface);
  color: var(--text);
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
}

.skip-link:focus {
  left: 12px;
}

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

/* ---------- 通用控件 ---------- */

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 1.05em;
  height: 1.05em;
  line-height: 1;
}

.icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 9px 17px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s ease, border-color .18s ease, color .18s ease,
    transform .18s ease, box-shadow .18s ease;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  box-shadow: var(--shadow-sm);
}

.btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn.ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-soft);
}

.btn.ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--on-danger);
}

.btn.danger:hover {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
}

.btn.small {
  padding: 6px 12px;
  font-size: 13px;
}

.btn.block {
  width: 100%;
}

.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none !important;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: none;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.icon-btn .icon {
  width: 18px;
  height: 18px;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 0 24px;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.42rem;
  font-weight: 600;
  letter-spacing: -.045em;
  line-height: 1;
  padding: 6px 0;
}

.brand span {
  font-style: italic;
  color: var(--accent);
}

.brand-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: 6px;
  transform: translateY(-1px);
}

.brand:hover span {
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-right: 4px;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  min-width: 0;
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border-strong);
  flex: none;
  transition: background .2s ease, box-shadow .2s ease;
}

.sync-status[data-mode="ok"] .sync-dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.sync-status[data-mode="syncing"] .sync-dot {
  background: #d99a2b;
  animation: pulse 1s ease-in-out infinite;
}

.sync-status[data-mode="offline"] .sync-dot {
  background: var(--danger);
}

.account-btn {
  padding: 5px 12px 5px 6px;
  gap: 8px;
  font-weight: 500;
  border-color: transparent;
}

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

.account-btn.is-user {
  color: var(--text-soft);
}

.account-btn .avatar {
  width: 27px;
  height: 27px;
  font-size: 11px;
}

.account-label {
  max-width: 11ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#newPostBtn .icon {
  width: 15px;
  height: 15px;
}

/* ---------- 页面容器 ---------- */

.page {
  width: min(780px, 100%);
  margin: 0 auto;
  padding: 34px 24px 88px;
}

.boot-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 55vh;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- 首屏 ---------- */

.hero {
  padding: 16px 0 30px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .17em;
  text-transform: uppercase;
  color: var(--accent);
}

.eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--accent);
  flex: none;
}

.hero h1 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: clamp(2.05rem, 5.4vw, 3.35rem);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -.038em;
}

.hero h1 em {
  font-style: italic;
  color: var(--accent);
}

.hero-sub {
  margin: 0;
  max-width: 33rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

/* ---------- 发帖框 ---------- */

.composer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 32px;
  overflow: hidden;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.composer:focus-within {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.composer-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: text;
  transition: background .18s ease;
}

.composer-trigger:hover {
  background: var(--surface-2);
}

.composer-trigger-text {
  flex: 1;
  font-size: 14.5px;
  min-width: 0;
}

.composer-trigger-kbd {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  border-radius: 6px;
  padding: 2px 6px;
  white-space: nowrap;
}

.draft-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.composer-form {
  display: flex;
  flex-direction: column;
  padding: 18px;
}

.composer-title {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  padding: 2px 0 10px;
  font-family: var(--font-display);
  font-size: 1.32rem;
  font-weight: 600;
  letter-spacing: -.02em;
  outline: none;
  transition: border-color .18s ease;
}

.composer-title:focus {
  border-bottom-color: var(--accent);
}

.composer-title::placeholder,
.composer-textarea::placeholder {
  color: var(--muted);
  opacity: .8;
}

.composer-textarea {
  width: 100%;
  min-height: 124px;
  margin-top: 12px;
  border: 0;
  background: transparent;
  resize: vertical;
  outline: none;
  font-size: 15px;
  line-height: 1.7;
}

.composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 12px;
  padding-top: 13px;
  border-top: 1px solid var(--border);
}

.composer-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  min-width: 0;
}

.composer-hint .icon {
  width: 14px;
  height: 14px;
  color: var(--accent);
}

.composer-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.char-count {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--muted);
}

.char-count.is-near {
  color: var(--danger);
}

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

/* 未登录时的发帖框 */
.composer--guest {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
}

.composer-guest-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.composer-guest-text strong {
  font-size: 14.5px;
  font-weight: 600;
}

.composer-guest-text span {
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------- 列表标题 ---------- */

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

.feed-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  font-size: 1.02rem;
  font-weight: 650;
  letter-spacing: -.01em;
}

.feed-count {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 400;
}

.feed-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ---------- 帖子卡片 ---------- */

.post-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.post-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.post-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.post-meta-main {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  line-height: 1.3;
}

.post-author {
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-time {
  font-size: 11.5px;
  color: var(--muted);
}

.post-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.post-title {
  margin: 0 0 7px;
  font-family: var(--font-display);
  font-size: 1.27rem;
  font-weight: 600;
  line-height: 1.38;
  letter-spacing: -.018em;
  overflow-wrap: anywhere;
  transition: color .16s ease;
}

.post-card:hover .post-title {
  color: var(--accent);
}

.post-excerpt {
  margin: 0;
  color: var(--text-soft);
  font-size: .93rem;
  line-height: 1.68;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-foot {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 15px;
}

.post-foot-spacer {
  flex: 1;
}

.post-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  text-decoration: none;
  cursor: pointer;
  transition: background .16s ease, color .16s ease;
}

.post-action .icon {
  width: 15px;
  height: 15px;
}

.post-action:hover {
  background: var(--surface-2);
  color: var(--accent);
}

.post-action.danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ---------- 空状态 / 骨架 / 错误 ---------- */

.empty {
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 52px 24px;
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 15px;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent);
}

.empty-icon .icon {
  width: 23px;
  height: 23px;
}

.empty h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
}

.empty p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
}

.empty .btn {
  margin-top: 18px;
}

.sk-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}

.sk-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.sk-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex: none;
  background: var(--surface-2);
  animation: shimmer-pulse 1.4s ease-in-out infinite;
}

.sk-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.sk-line {
  display: block;
  width: 100%;
  height: 11px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

.sk-line + .sk-line {
  margin-top: 9px;
}

.sk-line--w20 { width: 20%; }
.sk-line--w30 { width: 30%; }
.sk-line--w40 { width: 40%; }
.sk-line--w60 { width: 60%; }
.sk-line--w75 { width: 75%; }
.sk-line--w90 { width: 90%; }
.sk-line--title {
  height: 19px;
  width: 62%;
  margin: 4px 0 16px;
}

.error-state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center;
}

.error-state h2 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.error-state p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13.5px;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.notice .icon {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  color: var(--accent);
}

.load-more {
  margin: 20px auto 0;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex: none;
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 64px 0;
  color: var(--muted);
  font-size: 13.5px;
}

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

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  transition: color .16s ease;
}

.back-link:hover {
  color: var(--accent);
}

.back-link .icon {
  width: 15px;
  height: 15px;
}

.post-full {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px 32px;
  box-shadow: var(--shadow-sm);
}

.post-full .post-meta {
  margin-bottom: 18px;
}

.post-full-title {
  margin: 0 0 20px;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 4.2vw, 2.4rem);
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -.03em;
  overflow-wrap: anywhere;
}

.post-content {
  color: var(--text-soft);
  font-size: 1.01rem;
  line-height: 1.85;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.post-full-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 26px;
  padding-top: 15px;
  border-top: 1px solid var(--border);
}

/* ---------- 回复 ---------- */

.replies {
  margin-top: 34px;
}

.replies-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 16px;
}

.replies-title {
  margin: 0;
  font-size: 1.06rem;
  font-weight: 650;
}

.replies-count {
  color: var(--muted);
  font-size: 12.5px;
}

.reply-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 8px;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.reply-form:focus-within {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.reply-form textarea {
  width: 100%;
  min-height: 74px;
  border: 0;
  background: transparent;
  resize: vertical;
  outline: none;
  font-size: 14.5px;
  line-height: 1.7;
}

.reply-form textarea::placeholder {
  color: var(--muted);
  opacity: .8;
}

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

.reply-form-hint {
  color: var(--muted);
  font-size: 11.5px;
}

.reply-list {
  display: flex;
  flex-direction: column;
}

.reply-empty {
  margin: 0;
  padding: 30px 0 24px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.reply {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.reply:last-child {
  border-bottom: 0;
}

.reply-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 7px;
}

.reply-head .avatar {
  width: 30px;
  height: 30px;
  font-size: 11px;
}

.reply-author {
  font-size: 13px;
  font-weight: 600;
}

.reply-time {
  font-size: 11.5px;
  color: var(--muted);
}

.reply-head .post-action {
  margin-left: auto;
  padding: 5px 7px;
}

.reply-body {
  padding-left: 39px;
  color: var(--text-soft);
  font-size: .94rem;
  line-height: 1.72;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.reply.is-new {
  animation: flashIn .9s ease;
}

.login-prompt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  margin-bottom: 8px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}

.login-prompt .icon {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.login-prompt .btn {
  margin-left: auto;
}

/* ---------- 弹窗 ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--scrim);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  animation: fadeIn .16s ease;
}

.modal {
  width: min(500px, 100%);
  max-height: min(88vh, 780px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow-modal);
  padding: 24px;
  animation: rise .2s ease;
  overscroll-behavior: contain;
}

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

.modal-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.025em;
}

.modal-sub {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.modal-close {
  margin: -4px -4px 0 0;
}

.modal-text {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.75;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-soft);
}

.tab {
  flex: 1;
  padding: 8px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, box-shadow .16s ease;
}

.tab:hover {
  color: var(--text);
}

.tab.is-active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 14px;
}

.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-soft);
}

.field input,
.field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 14.5px;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field-hint {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.form-error {
  margin: 0 0 14px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12.5px;
  line-height: 1.5;
}

.form-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
  text-align: center;
}

/* 账号面板 */

.account-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.account-hero .avatar {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  font-size: 20px;
}

.account-name {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 650;
  line-height: 1.3;
}

.account-meta {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.account-rows {
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.account-row:last-child {
  border-bottom: 0;
}

.account-row-label {
  color: var(--muted);
}

.account-row-value {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.account-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.account-actions .btn {
  justify-content: flex-start;
}

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

.toast-host {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  max-width: min(370px, calc(100vw - 40px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 14px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 14px 44px rgba(0, 0, 0, .24);
  animation: toastIn .2s ease;
  pointer-events: auto;
}

.toast .icon {
  width: 15px;
  height: 15px;
  margin-top: 2px;
}

.toast--success .icon {
  color: #7ee2a8;
}

.toast--error .icon {
  color: #ff9b93;
}

.toast--info .icon {
  color: #a9c9ff;
}

.toast.is-leaving {
  animation: toastOut .2s ease forwards;
}

/* ---------- 页脚 ---------- */

.site-footer {
  width: min(780px, 100%);
  margin: 0 auto;
  padding: 26px 24px 42px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.site-footer p {
  margin: 0;
}

.footer-sub {
  opacity: .8;
}

.noscript {
  position: fixed;
  inset: auto 16px 16px;
  z-index: 300;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--danger);
  color: #fff;
  text-align: center;
}

/* ---------- 动画 ---------- */

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

@keyframes shimmer-pulse {
  0%, 100% { opacity: .6; }
  50% { opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px) scale(.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(6px); }
}

@keyframes flashIn {
  0% { background: var(--accent-soft); }
  100% { background: transparent; }
}

@media (hover: hover) and (pointer: fine) {
  .btn.primary:hover,
  .btn.danger:hover {
    transform: translateY(-1px);
  }

  .post-card:hover {
    transform: translateY(-1px);
  }
}

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

@media (max-width: 720px) {
  .sync-text {
    display: none;
  }

  .sync-status {
    margin-right: 0;
  }

  .header-inner {
    padding: 0 18px;
    gap: 10px;
  }

  .page {
    padding: 26px 18px 72px;
  }
}

@media (max-width: 560px) {
  .account-label {
    display: none;
  }

  .account-btn {
    padding: 4px;
    width: 36px;
    height: 36px;
    justify-content: center;
  }

  .account-btn .avatar {
    width: 28px;
    height: 28px;
  }

  .hero {
    padding-top: 8px;
  }

  .post-card {
    padding: 17px 17px 15px;
  }

  .post-full {
    padding: 22px 19px;
  }

  .post-full-title {
    margin-bottom: 16px;
  }

  .post-excerpt {
    -webkit-line-clamp: 4;
  }

  .reply-body {
    padding-left: 0;
  }

  .modal {
    padding: 20px;
    border-radius: 18px;
  }

  .composer-foot {
    align-items: flex-start;
    flex-direction: column;
  }

  .composer-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .composer-trigger-kbd {
    display: none;
  }
}

@media (max-width: 420px) {
  #newPostBtn {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 50%;
  }

  #newPostBtn .btn-label {
    display: none;
  }

  #newPostBtn .icon {
    width: 17px;
    height: 17px;
  }

  .header-inner {
    padding: 0 14px;
  }

  .page {
    padding-left: 14px;
    padding-right: 14px;
  }

  .site-footer {
    padding-left: 14px;
    padding-right: 14px;
  }

  .toast-host {
    left: 14px;
    right: 14px;
    bottom: 14px;
    max-width: none;
    align-items: stretch;
  }

  .composer--guest {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .composer--guest .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ============================================================
   讨论区 / 个人主页 / 发帖区（第二版布局）
   ============================================================ */

/* ---------- 顶部主导航 ---------- */

.main-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-right: auto;
  margin-left: -2px;
}

.main-nav a {
  padding: 7px 13px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
  transition: background .16s ease, color .16s ease;
}

.main-nav a:hover {
  background: var(--surface-2);
  color: var(--text);
}

.main-nav a.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}

/* ---------- 头像 ---------- */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  user-select: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
}

.avatar--xs {
  width: 22px;
  height: 22px;
  font-size: 9.5px;
}

.avatar--sm {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

.avatar--lg {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  font-size: 20px;
}

.avatar--xl {
  width: 78px;
  height: 78px;
  border-radius: 22px;
  font-size: 30px;
}

.avatar--c0 { background: linear-gradient(135deg, #3d7d5b, #235a41); }
.avatar--c1 { background: linear-gradient(135deg, #3b6ea5, #274a70); }
.avatar--c2 { background: linear-gradient(135deg, #a9712d, #7a4d18); }
.avatar--c3 { background: linear-gradient(135deg, #a34b65, #72293f); }
.avatar--c4 { background: linear-gradient(135deg, #6b5aa6, #443873); }
.avatar--c5 { background: linear-gradient(135deg, #2f7f80, #1c5657); }

.avatar-link {
  display: inline-flex;
  flex: none;
  border-radius: 50%;
  text-decoration: none;
}

.author-link {
  color: var(--text-soft);
  text-decoration: none;
  font-weight: 600;
}

.author-link:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- 页面宽度修饰 ---------- */

.page--wide {
  width: min(960px, 100%);
}

.page--editor {
  width: min(1120px, 100%);
}

/* ---------- 讨论区标题 / 筛选 ---------- */

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 26px;
  padding-top: 6px;
}

.section-head > div {
  min-width: 0;
}

.section-title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.8vw, 2.75rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -.035em;
}

.section-sub {
  margin: 0;
  max-width: 38rem;
  color: var(--muted);
  font-size: .94rem;
  line-height: 1.7;
}

.section-head > .btn {
  flex: none;
  margin-bottom: 3px;
}

.discussion-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.filter-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  padding: 6px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.4;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}

.chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.chip.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 1 278px;
  min-width: 190px;
}

.search-box > .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 15px;
  height: 15px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 9px 13px 9px 35px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-input::placeholder {
  color: var(--muted);
  opacity: .8;
}

.discussion-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.discussion-meta-tools {
  display: flex;
  align-items: center;
  gap: 2px;
}

/* ---------- 主题列表（洛谷式列表） ---------- */

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

.topic-list--empty {
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.topic-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .16s ease;
}

.topic-row:last-child {
  border-bottom: 0;
}

.topic-row:hover {
  background: var(--surface-2);
}

.topic-main {
  flex: 1;
  min-width: 0;
}

.topic-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}

.topic-title {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.42;
  letter-spacing: -.012em;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: color .16s ease;
}

.topic-title:hover {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.topic-excerpt {
  display: -webkit-box;
  margin: 0 0 9px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.topic-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 11.5px;
}

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

.topic-author:hover {
  color: var(--accent);
}

.topic-author .avatar {
  width: 22px;
  height: 22px;
  font-size: 9.5px;
}

.topic-meta-replies {
  padding-left: 3px;
  color: var(--muted);
}

.topic-time-inline {
  color: var(--muted);
}

.topic-side {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 68px;
}

.topic-reply-count {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  color: var(--text-soft);
}

.topic-reply-count strong {
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.topic-reply-count small {
  color: var(--muted);
  font-size: 10.5px;
}

.topic-activity {
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.topic-list--compact .topic-row {
  gap: 14px;
  padding: 13px 16px;
}

.topic-list--compact .topic-title {
  font-size: 1rem;
}

.offline-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.offline-note .icon {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  flex: none;
  color: var(--accent);
}

.meta-dot {
  width: 3px;
  height: 3px;
  flex: none;
  border-radius: 50%;
  background: var(--border-strong);
}

.category-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.65;
  white-space: nowrap;
}

.category-badge--general {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent);
}

.category-badge--tech {
  background: rgba(59, 110, 165, .12);
  color: #2f6da6;
}

.category-badge--life {
  background: rgba(169, 113, 45, .14);
  color: #8a5a1d;
}

.category-badge--help {
  background: rgba(163, 75, 101, .13);
  color: #9b3d57;
}

html[data-theme="dark"] .category-badge--tech {
  background: rgba(100, 160, 230, .15);
  color: #8fc4f5;
}

html[data-theme="dark"] .category-badge--life {
  background: rgba(220, 170, 90, .14);
  color: #e3b66e;
}

html[data-theme="dark"] .category-badge--help {
  background: rgba(220, 120, 145, .14);
  color: #f09aae;
}

/* 列表骨架 */

.sk-topic {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.sk-topic:last-child {
  border-bottom: 0;
}

.sk-topic .sk-stack {
  flex: 1;
}

.sk-topic > .sk-line {
  width: 54px;
  flex: none;
}

.load-more-host {
  display: flex;
  justify-content: center;
}

.load-more {
  margin: 20px auto 0;
}

/* ---------- 个人主页 ---------- */

.profile-hero {
  position: relative;
  overflow: hidden;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.profile-hero::before {
  content: "";
  position: absolute;
  top: -170px;
  right: -120px;
  width: 460px;
  height: 340px;
  pointer-events: none;
  background: radial-gradient(circle, var(--accent-soft), transparent 66%);
  opacity: .95;
}

.profile-hero > * {
  position: relative;
}

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

.profile-identity {
  min-width: 0;
}

.profile-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.15rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.03em;
  overflow-wrap: anywhere;
}

.profile-handle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.profile-join {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.profile-bio-host {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.profile-bio {
  margin: 0;
  color: var(--text-soft);
  font-size: .95rem;
  line-height: 1.78;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.profile-bio--empty {
  color: var(--muted);
  font-style: italic;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 20px;
}

.profile-stat {
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
}

.profile-stat strong {
  display: block;
  color: var(--text);
  font-size: 1.08rem;
  font-weight: 650;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}

.profile-stat span {
  color: var(--muted);
  font-size: 11px;
}

.profile-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.profile-section {
  margin-top: 30px;
}

.profile-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.profile-section-title {
  margin: 0;
  font-size: 1.06rem;
  font-weight: 650;
}

.profile-section-count {
  color: var(--muted);
  font-size: 12px;
}

.profile-more-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11.5px;
}

.sk-profile {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 28px;
  margin-bottom: 22px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
}

.sk-avatar--xl {
  width: 78px;
  height: 78px;
  border-radius: 22px;
}

.bio-editor {
  margin-top: 4px;
}

.bio-editor textarea {
  width: 100%;
  min-height: 96px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
  resize: vertical;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.bio-editor textarea:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.bio-editor-foot {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-top: 9px;
}

.bio-editor-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.bio-editor-actions {
  display: flex;
  flex: none;
  gap: 8px;
}

.empty--slim {
  padding: 34px 20px;
}

/* 登录门 */

.login-gate {
  max-width: 540px;
  margin: 36px auto;
  padding: 40px 30px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.login-gate h1 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 1.95rem);
  font-weight: 600;
  letter-spacing: -.025em;
}

.login-gate p {
  margin: 0 auto 20px;
  max-width: 30rem;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.7;
}

.login-gate-link {
  display: inline-block;
  margin-top: 16px;
  color: var(--muted);
  font-size: 12.5px;
  text-decoration: none;
}

.login-gate-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ---------- 帖子详情补充 ---------- */

.post-meta-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.post-meta-muted {
  color: var(--muted);
  font-size: 11.5px;
}

.post-meta-main .post-author {
  font-size: 13.5px;
}

.post-markdown {
  margin: 2px 0 4px;
}

/* ---------- 发帖区 / Markdown 编辑器 ---------- */

.compose-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 272px;
  gap: 22px;
  align-items: start;
}

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

.compose-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.compose-category {
  flex: none;
  width: 108px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

.compose-category:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.compose-title {
  flex: 1;
  min-width: 0;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.38rem;
  font-weight: 600;
  letter-spacing: -.02em;
  outline: none;
}

.compose-title::placeholder {
  color: var(--muted);
  opacity: .8;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 7px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}

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

.tool-btn .icon {
  width: 15px;
  height: 15px;
}

.tool-bold {
  font-weight: 800;
}

.tool-italic {
  font-style: italic;
}

.tool-mono {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
}

.toolbar-divider {
  width: 1px;
  height: 18px;
  margin: 0 5px;
  background: var(--border);
}

.toolbar-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.editor-tabs {
  display: none;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.editor-tab {
  padding: 5px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.editor-tab.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.editor-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 470px;
}

.editor-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.editor-pane + .editor-pane {
  border-left: 1px solid var(--border);
}

.compose-content {
  flex: 1;
  width: 100%;
  min-height: 470px;
  padding: 18px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.75;
  resize: vertical;
  outline: none;
  tab-size: 2;
}

.compose-content::placeholder {
  color: var(--muted);
  opacity: .75;
}

.editor-preview-body {
  max-height: 700px;
  padding: 18px 20px;
  overflow: auto;
}

.editor-preview-empty {
  margin: 0;
  padding: 40px 12px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

.compose-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.compose-status {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
  flex-wrap: wrap;
}

.compose-status .icon {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--accent);
}

.compose-status-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.markdown-help {
  position: sticky;
  top: 84px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.markdown-help-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 6px;
  font-size: .98rem;
  font-weight: 650;
}

.markdown-help-title .icon {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.markdown-help-sub {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
}

.markdown-help-row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 11.5px;
}

.markdown-help-row:last-of-type {
  border-bottom: 0;
}

.markdown-help-row code {
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg-soft);
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 10.5px;
  overflow-wrap: anywhere;
}

.markdown-help-row span {
  color: var(--muted);
}

.markdown-help-tip {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

/* ---------- Markdown 正文 ---------- */

.markdown-body {
  color: var(--text-soft);
  font-size: 1rem;
  line-height: 1.85;
  overflow-wrap: anywhere;
}

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

.markdown-body > :last-child {
  margin-bottom: 0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin: 1.45em 0 .55em;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -.02em;
}

.markdown-body h1 { font-size: 1.75em; }
.markdown-body h2 { font-size: 1.42em; }
.markdown-body h3 { font-size: 1.2em; }
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 { font-size: 1.05em; }

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

.markdown-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.markdown-body a:hover {
  color: var(--accent-hover);
}

.markdown-body strong {
  color: var(--text);
  font-weight: 650;
}

.markdown-body em {
  font-style: italic;
}

.markdown-body del {
  color: var(--muted);
}

.markdown-body ul,
.markdown-body ol {
  margin: 0 0 1em;
  padding-left: 1.55em;
}

.markdown-body li {
  margin: .24em 0;
}

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

.markdown-body blockquote p {
  margin: 0;
}

.markdown-body code {
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg-soft);
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: .86em;
}

.markdown-body pre {
  margin: 0 0 1em;
  padding: 14px 16px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
}

.markdown-body pre code {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-soft);
  font-size: 12.8px;
  line-height: 1.65;
  white-space: pre;
}

.markdown-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1em 0;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.markdown-body hr {
  margin: 1.6em 0;
  border: 0;
  border-top: 1px solid var(--border);
}

/* ---------- 响应式（新布局） ---------- */

@media (max-width: 1000px) {
  .compose-layout {
    grid-template-columns: 1fr;
  }

  .markdown-help {
    position: static;
  }

  .markdown-help-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  }
}

@media (max-width: 860px) {
  .header-inner {
    flex-wrap: wrap;
    min-height: 0;
    padding: 9px 18px 0;
    gap: 6px 12px;
  }

  .brand {
    order: 1;
  }

  .header-right {
    order: 2;
    margin-left: auto;
  }

  .main-nav {
    order: 3;
    flex-basis: 100%;
    margin: 0;
    padding: 4px 0 6px;
    border-top: 1px solid var(--border);
    gap: 4px;
  }

  .main-nav a {
    flex: 1;
    padding: 8px 6px;
    text-align: center;
  }

  .sync-status {
    margin-right: 0;
  }

  .section-head {
    align-items: flex-start;
  }
}

@media (max-width: 720px) {
  .discussion-toolbar {
    align-items: stretch;
  }

  .search-box {
    flex-basis: 100%;
    max-width: none;
  }

  .section-head {
    gap: 12px;
  }

  .section-sub {
    font-size: .9rem;
  }

  .topic-row {
    gap: 12px;
    padding: 15px 16px;
  }

  .topic-side {
    min-width: 54px;
  }

  .topic-activity {
    font-size: 10px;
  }

  .profile-hero {
    padding: 24px 20px;
  }

  .compose-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .compose-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .editor-tabs {
    display: flex;
  }

  .editor-shell {
    grid-template-columns: 1fr;
    min-height: 380px;
  }

  .editor-pane--preview {
    display: none;
  }

  .editor-shell[data-mode="preview"] .editor-pane--write {
    display: none;
  }

  .editor-shell[data-mode="preview"] .editor-pane--preview {
    display: flex;
  }

  .compose-content {
    min-height: 380px;
  }

  .editor-preview-body {
    max-height: none;
    min-height: 380px;
  }
}

@media (max-width: 560px) {
  .header-inner {
    padding-left: 14px;
    padding-right: 14px;
  }

  .profile-top {
    align-items: flex-start;
    gap: 14px;
  }

  .profile-stats {
    gap: 8px;
  }

  .profile-stat {
    padding: 9px 10px;
  }

  .profile-stat strong {
    font-size: .98rem;
  }

  .topic-row {
    gap: 10px;
    padding: 14px;
  }

  .topic-title {
    font-size: 1rem;
  }

  .topic-meta-replies {
    display: none;
  }

  .category-badge {
    font-size: 10px;
    padding: 1px 7px;
  }

  .topic-side {
    min-width: 42px;
  }

  .topic-activity {
    display: none;
  }

  .topic-reply-count {
    flex-direction: column;
    align-items: center;
    gap: 0;
  }

  .topic-reply-count strong {
    font-size: .96rem;
  }

  .compose-top {
    flex-wrap: wrap;
    padding: 14px;
  }

  .compose-category {
    width: 100%;
  }

  .compose-title {
    width: 100%;
    font-size: 1.22rem;
  }

  .editor-toolbar {
    padding: 6px 8px;
  }

  .toolbar-label {
    display: none;
  }

  .compose-footer {
    padding: 11px 14px;
  }

  .section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .section-head > .btn {
    width: 100%;
  }

  .login-gate {
    margin: 20px auto;
    padding: 32px 20px;
  }

  .bio-editor-foot {
    flex-direction: column;
  }

  .bio-editor-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 420px) {
  .header-inner {
    padding: 9px 14px 0;
  }

  .main-nav a {
    font-size: 13px;
    padding: 8px 2px;
  }

  .topic-excerpt {
    -webkit-line-clamp: 2;
  }
}

/* 弹窗打开时锁住背景滚动 */
body.modal-open {
  overflow: hidden;
}

/* 登录门底部链接单独占一行 */
.login-gate-link {
  display: block;
}

/* Markdown 表格 */
.markdown-body .md-table-wrap {
  overflow-x: auto;
  margin: 0 0 1em;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
  line-height: 1.6;
}

.markdown-body th,
.markdown-body td {
  padding: 8px 11px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.markdown-body th {
  background: var(--bg-soft);
  color: var(--text);
  font-weight: 650;
  white-space: nowrap;
}

.markdown-body tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
}

/* 顶栏空间足够时，移动端仍然显示同步文字 */
@media (max-width: 720px) {
  .sync-text {
    display: inline;
  }

  .sync-status {
    gap: 6px;
    font-size: 11.5px;
  }
}

@media (max-width: 380px) {
  .sync-text {
    display: none;
  }
}

/* ---------- 私信入口 / 未读角标 ---------- */

.messages-btn {
  position: relative;
}

.messages-btn.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.messages-badge {
  position: absolute;
  top: 1px;
  right: 0;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--header-bg);
}

/* ---------- 私信页面 ---------- */

.page--messages {
  width: min(1000px, 100%);
}

.messages-layout {
  display: grid;
  grid-template-columns: 284px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.message-conversations {
  overflow: hidden;
  align-self: start;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.conversation {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background .16s ease;
}

.conversation:last-child {
  border-bottom: 0;
}

.conversation:hover {
  background: var(--surface-2);
}

.conversation.is-active {
  background: var(--accent-soft);
}

.conversation-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.conversation-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.conversation-name {
  font-size: 13px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-time {
  flex: none;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.conversation-last {
  overflow: hidden;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-prefix {
  color: var(--text-soft);
}

.conversation-unread {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  flex: none;
}

.sk-conversation {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.sk-conversation:last-child {
  border-bottom: 0;
}

.sk-avatar--sm {
  width: 28px;
  height: 28px;
}

.message-thread {
  display: flex;
  flex-direction: column;
  min-height: 560px;
  max-height: 70vh;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.message-thread-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}

.message-back {
  display: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-left: -4px;
  border-radius: 50%;
  color: var(--muted);
  text-decoration: none;
}

.message-back:hover {
  background: var(--surface-2);
  color: var(--text);
}

.message-back .icon {
  width: 15px;
  height: 15px;
}

.message-thread-name {
  color: var(--text);
  font-size: 13.5px;
  font-weight: 650;
}

.message-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  overflow-y: auto;
  background: var(--bg-soft);
}

.message-row {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  max-width: 100%;
}

.message-row.is-mine {
  justify-content: flex-end;
}

.message-row > .avatar {
  margin-bottom: 16px;
}

.message-bubble-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: min(72%, 520px);
}

.message-bubble {
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 14px 14px 14px 5px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 13.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-row.is-mine .message-bubble {
  border-color: var(--accent);
  border-radius: 14px 14px 5px 14px;
  background: var(--accent);
  color: var(--accent-text);
}

.message-time {
  color: var(--muted);
  font-size: 10px;
}

.message-row.is-mine .message-time {
  text-align: right;
}

.message-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 11px 13px;
  border-top: 1px solid var(--border);
}

.message-input {
  flex: 1;
  min-height: 40px;
  max-height: 140px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.55;
  resize: vertical;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.message-input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.message-input::placeholder {
  color: var(--muted);
  opacity: .8;
}

.message-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 34px 18px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

.message-empty p {
  margin: 0;
}

.message-empty .icon {
  width: 22px;
  height: 22px;
  color: var(--border-strong);
}

.message-empty--list {
  min-height: 120px;
}

.message-empty--thread {
  flex: 1;
}

.message-thread-loading,
.message-thread-error {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

.message-thread-error {
  flex-direction: column;
}

.message-thread-error p {
  margin: 0;
}

/* 关注标记 / 四列统计 */

.follows-you {
  display: inline-flex;
  align-items: center;
  margin-left: 7px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  vertical-align: 2px;
}

.profile-handle {
  display: flex;
  align-items: center;
}

.profile-stats {
  grid-template-columns: repeat(4, 1fr);
}

.btn.is-following {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

@media (max-width: 760px) {
  .messages-layout {
    grid-template-columns: 1fr;
  }

  .message-conversations {
    align-self: stretch;
  }

  .messages-page:not(.messages-page--thread) .message-thread {
    display: none;
  }

  .messages-page--thread .message-conversations {
    display: none;
  }

  .message-thread {
    min-height: calc(100vh - 220px);
    max-height: none;
  }

  .message-back {
    display: inline-flex;
  }

  .message-bubble-wrap {
    max-width: 82%;
  }

  .profile-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 420px) {
  .messages-badge {
    top: 0;
    right: -1px;
  }
}

/* 回复框只有发送按钮时靠右 */
.reply-form-foot {
  justify-content: flex-end;
}

/* 标题区现在只有标题，不需要下边距 */
.section-head .section-title {
  margin-bottom: 0;
}

/* ---------- 更大的私信界面 + 附件 ---------- */

.page--messages {
  width: min(1120px, 100%);
}

.messages-layout {
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 20px;
}

.message-conversations {
  align-self: stretch;
  max-height: calc(100vh - 210px);
  overflow-y: auto;
}

.message-thread {
  height: calc(100vh - 210px);
  min-height: 620px;
  max-height: 900px;
}

.message-thread-head {
  padding: 15px 20px;
}

.message-list {
  gap: 12px;
  padding: 20px;
}

.message-bubble-wrap {
  max-width: min(76%, 620px);
  gap: 5px;
}

.message-bubble {
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.7;
}

.message-form {
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
}

.message-form-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
}

.message-attach {
  width: 40px;
  height: 40px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
}

.message-attach:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.message-attach .icon {
  width: 17px;
  height: 17px;
}

.message-input {
  min-height: 44px;
  font-size: 14px;
}

.message-form.is-dragging {
  background: var(--accent-soft);
}

.message-file-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  background: var(--bg-soft);
  font-size: 12px;
}

.message-file-preview > .icon {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--accent);
}

.message-file-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-file-size {
  flex: none;
  color: var(--muted);
  font-size: 11px;
}

.message-file-remove {
  width: 26px;
  height: 26px;
  flex: none;
}

.message-file-remove .icon {
  width: 13px;
  height: 13px;
}

.message-file {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease;
}

.message-file:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.message-file-icon {
  width: 20px;
  height: 20px;
  flex: none;
  color: var(--accent);
}

.message-file-info {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.message-file-info strong {
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-file-info small {
  color: var(--muted);
  font-size: 10.5px;
}

.message-file-download {
  width: 15px;
  height: 15px;
  flex: none;
  color: var(--muted);
}

.message-row.is-mine .message-file {
  border-color: var(--accent);
  background: var(--surface);
}

@media (max-width: 760px) {
  .message-conversations {
    max-height: none;
  }

  .message-thread {
    height: calc(100vh - 190px);
    min-height: 500px;
    max-height: none;
  }

  .message-list {
    padding: 14px;
  }

  .message-bubble-wrap {
    max-width: 84%;
  }

  .message-form {
    padding: 10px;
  }

  .message-attach {
    width: 38px;
    height: 38px;
  }
}

/* 私信布局微调：与顶栏对齐，附件条占满宽度 */
.page--messages {
  width: min(1080px, 100%);
}

.message-form {
  align-items: stretch;
}

.message-file-preview {
  width: 100%;
}

/* ---------- 在线状态 ---------- */

.presence {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.presence.is-online {
  color: var(--accent);
}

.presence-dot {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--border-strong);
}

.presence-dot.is-online {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.conversation-name {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.conversation-name .presence-dot {
  width: 7px;
  height: 7px;
}

.profile-presence-row {
  margin: 7px 0 0;
}

.message-thread-head .message-presence {
  margin-left: auto;
  font-size: 11px;
}

@media (max-width: 760px) {
  .message-thread-head .message-presence {
    margin-left: auto;
  }

  .message-thread-head .message-presence .presence-text {
    display: none;
  }

  .message-thread-head .message-presence .presence-dot {
    width: 8px;
    height: 8px;
  }
}

/* ---------- 注册 / 手机号登录 ---------- */

.auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 12px;
  font-size: 12px;
}

.auth-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.auth-link:hover {
  text-decoration: underline;
}

.code-row {
  display: flex;
  gap: 8px;
}

.code-row input {
  flex: 1;
  min-width: 0;
}

.code-row .btn {
  flex: none;
  white-space: nowrap;
}

.register-form .field-hint {
  margin-top: 4px;
}
