/* AIOKY 社区 · 纸感编辑风格
   与门户首页、登录页共用一套视觉语言：米白纸面、深绿强调、衬线标题、细线直角。 */

:root {
  --paper: #f4f1e8;
  --paper-2: #fbf8f1;
  --paper-3: #efeadd;
  --ink: #171814;
  --text: #171814;
  --muted: #706e64;
  --dim: #8b8679;
  --line: #d9d3c4;
  --line-soft: #e7e2d7;
  --line-strong: #c9c2b3;
  --green: #194e3b;
  --green-soft: rgba(25, 78, 59, .08);
  --orange: #c95e35;
  --danger: #a33f2a;

  /* 兼容旧变量名，避免散落在模板里的内联样式失效 */
  --bg: var(--paper);
  --bg-soft: var(--paper-3);
  --panel: var(--paper-2);
  --panel-2: #f7f3ea;
  --panel-3: #eee8db;
  --brand: var(--green);
  --brand-2: #2f6b53;
  --mint: var(--green);
  --amber: var(--orange);
  --radius: 0;

  --sans: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", sans-serif;
  --serif: "Noto Serif SC", "Songti SC", SimSun, serif;
  --mono: "Cascadia Code", "Consolas", "SFMono-Regular", monospace;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background-color: var(--paper);
  background-image:
    radial-gradient(1100px 620px at 88% -10%, rgba(255, 255, 255, .7), transparent 60%),
    linear-gradient(rgba(23, 24, 20, .018) 1px, transparent 1px);
  background-size: auto, 100% 32px;
  background-attachment: fixed;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
::selection { background: rgba(25, 78, 59, .18); color: var(--ink); }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 10px;
  text-align: center;
}
.boot-mark {
  font-family: var(--serif);
  font-size: 40px;
  font-weight: 600;
  letter-spacing: .18em;
  color: var(--green);
}
.boot-text {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .14em;
}

/* ── 顶部导航 ───────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 80px;
  padding: 22px max(28px, calc((100% - 1296px) / 2)) 18px;
  background: linear-gradient(to bottom, rgba(244, 241, 232, .98) 0%, rgba(244, 241, 232, .92) 76%, rgba(244, 241, 232, 0) 100%);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 178px; color: var(--ink); flex: 0 0 auto; }
.brand-mark {
  width: 36px;
  height: 36px;
  border: 1px solid var(--green);
  border-radius: 0;
  display: grid;
  place-items: center;
  background: var(--green);
  color: #f7f3e7;
  box-shadow: none;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
  flex: 0 0 auto;
}
.brand-name { display: block; font-size: 18px; line-height: 1.1; font-weight: 700; letter-spacing: .08em; }
.brand-name span {
  display: block;
  margin-top: 4px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: .14em;
}

.topnav { display: flex; align-items: center; gap: 4px; counter-reset: nav; }
.mobile-nav { display: none; }
.topnav a {
  position: relative;
  padding: 8px 12px 9px;
  border-bottom: 1px solid transparent;
  color: #4d4b43;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  transition: color .15s ease, border-color .15s ease;
}
.topnav a::before {
  counter-increment: nav;
  content: counter(nav, decimal-leading-zero);
  margin-right: 7px;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 400;
  letter-spacing: .04em;
  color: #a19b8e;
}
.topnav a:hover { color: var(--green); }
.topnav a.on { color: var(--green); font-weight: 600; border-bottom-color: var(--green); }
.topnav a.on::before { color: var(--green); }
.topnav a.nav-portal span { margin-left: 1px; font-family: var(--mono); font-size: 9px; opacity: .72; }
.brand-portal:hover { opacity: .78; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.top-actions { display: flex; align-items: center; gap: 5px; }
.icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  color: #777268;
  display: grid;
  place-items: center;
  position: relative;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
  flex: 0 0 auto;
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink); background: rgba(255, 255, 255, .32); }
.icon-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 0;
  background: var(--orange);
  color: #fffaf3;
  font-family: var(--mono);
  font-size: 8px;
  line-height: 15px;
  display: grid;
  place-items: center;
  font-weight: 600;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 2px 0;
  border-radius: 0;
  color: var(--ink);
  transition: opacity .15s ease;
}
.user-chip:hover { opacity: .78; }
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
  color: #3b4138;
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 600;
  background: #e1dac9;
  border: 1px solid #cfc6b3;
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar > span { line-height: 1; }
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.avatar.lg { width: 66px; height: 66px; font-size: 26px; }
.user-meta { display: flex; flex-direction: column; line-height: 1.1; }
.user-meta b { display: block; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; color: var(--ink); }
.user-meta small { display: block; margin-top: 3px; color: var(--dim); font-family: var(--mono); font-size: 8px; letter-spacing: .1em; }

/* ── 页面骨架 ───────────────────────────────────────────── */
.page {
  position: relative;
  z-index: 1;
  max-width: 1296px;
  margin: 0 auto;
  padding: 34px 28px 80px;
}
.grid-main { display: grid; grid-template-columns: 228px minmax(0, 1fr) 264px; gap: 28px; align-items: start; }
.grid-two { display: grid; grid-template-columns: minmax(0, 1fr) 286px; gap: 28px; align-items: start; }
.side { display: grid; gap: 16px; position: sticky; top: 106px; }
.panel {
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper-2);
  box-shadow: none;
}
.panel-pad { padding: 20px; }
.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}
.panel-head h3 {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.5;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 500;
}
.panel-head .spacer { flex: 1; }
.section-title {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ink);
}
.section-title h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -.025em;
  color: var(--ink);
}
.section-title p {
  margin: 0 0 3px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.5;
  letter-spacing: .06em;
}
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.tiny { font-size: 11px; }
.mono { font-family: var(--mono); }
.grow { flex: 1; min-width: 0; }

/* ── 首页 ───────────────────────────────────────────────── */
.profile-sum { position: relative; padding: 20px; text-align: left; }
.profile-sum::before {
  content: "PROFILE / 001";
  display: block;
  margin-bottom: 15px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .12em;
}
.profile-sum .avatar { margin-bottom: 14px; }
.profile-sum h3 {
  margin: 0 0 3px;
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -.01em;
}
.profile-sum .handle { color: var(--dim); font-family: var(--mono); font-size: 9px; letter-spacing: .04em; }
.profile-sum p { color: var(--muted); font-size: 12px; line-height: 1.75; margin: 13px 0 15px; }
.profile-sum .btn { margin-bottom: 18px; }
.stats-row {
  display: flex;
  gap: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}
.stats-row div { display: grid; gap: 2px; }
.stats-row b { font-family: var(--serif); font-size: 20px; line-height: 1.2; font-weight: 600; }
.stats-row span { color: var(--dim); font-size: 10px; line-height: 1.4; }
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  padding: 0;
  width: fit-content;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}
.tabs button {
  position: relative;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #817c6e;
  padding: 8px 15px 10px;
  font-size: 12px;
  line-height: 1.2;
  transition: color .15s ease;
}
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); font-weight: 600; }
.tabs button.on::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--green);
}
.post-list { display: grid; gap: 0; }
.post-card {
  display: grid;
  grid-template-columns: 164px minmax(0, 1fr);
  gap: 20px;
  padding: 24px 12px;
  margin: 0 -12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  transition: background .18s ease;
}
.post-list > .post-card:first-child { border-top: 1px solid var(--line); }
.post-card:hover { border-color: var(--line); background: rgba(255, 255, 255, .34); }
.post-cover {
  height: 118px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #e9e3d5;
  display: grid;
  place-items: center;
  color: var(--green);
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1;
  overflow: hidden;
}
.post-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-body { min-width: 0; display: flex; flex-direction: column; }
.post-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.5;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.post-kicker .pin { color: var(--orange); font-weight: 600; }
.post-title {
  margin: 7px 0 6px;
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: -.015em;
  color: var(--ink);
  transition: color .15s ease;
}
.post-card:hover .post-title { color: var(--green); }
.post-summary {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.75;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-foot {
  margin-top: auto;
  padding-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.5;
  letter-spacing: .03em;
  flex-wrap: wrap;
}
.post-foot .author-mini { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.post-foot .spacer { flex: 1; }
.post-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.tag {
  padding: 3px 6px;
  border: 1px solid #bfd2c8;
  border-radius: 0;
  color: var(--green);
  background: transparent;
  font-size: 9px;
  line-height: 1.3;
  letter-spacing: .03em;
}
.empty { padding: 52px 20px; text-align: center; color: var(--muted); }
.empty b {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
}
.load-more { margin: 22px auto 0; display: block; }

/* ── 按钮 ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: var(--paper-2);
  color: var(--ink);
  min-height: 36px;
  padding: 7px 14px;
  font-size: 12px;
  line-height: 1.3;
  font-weight: 600;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.btn:hover { border-color: var(--ink); background: rgba(255, 255, 255, .4); }
.btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { border-color: var(--ink); background: var(--ink); color: #fbf8f0; }
.btn-primary:hover { border-color: var(--green); background: var(--green); color: #fbf8f0; }
.btn-mint { color: var(--green); border-color: #bfd2c8; background: rgba(25, 78, 59, .04); }
.btn-mint:hover { color: var(--green); border-color: var(--green); background: rgba(25, 78, 59, .08); }
.btn-danger { color: var(--danger); border-color: #e5b7a7; background: transparent; }
.btn-danger:hover { color: #8f2e41; border-color: var(--danger); background: #fbefe9; }
.btn-sm { min-height: 28px; padding: 4px 9px; font-size: 10.5px; }
.btn:disabled { opacity: .5; cursor: default; }

/* ── 文章阅读 ───────────────────────────────────────────── */
.reading {
  border: 1px solid var(--line);
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
  background: var(--paper-2);
  color: var(--ink);
}
.reading-head { padding: 46px max(50px, calc((100% - 780px) / 2)) 28px; border-bottom: 1px solid var(--line-soft); }
.reading-head h1 {
  margin: 12px 0 16px;
  font-family: var(--serif);
  font-size: 40px;
  line-height: 1.28;
  font-weight: 600;
  letter-spacing: -.03em;
  color: var(--ink);
}
.reading-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.5;
  letter-spacing: .03em;
}
.reading-meta .author { display: flex; align-items: center; gap: 8px; color: var(--ink); font-family: var(--sans); font-size: 11px; font-weight: 600; }
.reading-cover { max-height: 420px; overflow: hidden; border-bottom: 1px solid var(--line-soft); background: #e7e2d6; }
.reading-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.prose {
  padding: 34px max(50px, calc((100% - 780px) / 2)) 44px;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.95;
  color: #292a25;
}
.prose h1, .prose h2, .prose h3, .prose h4 {
  line-height: 1.35;
  margin: 1.5em 0 .55em;
  letter-spacing: -.015em;
  color: var(--ink);
}
.prose h2 { font-size: 26px; }
.prose h3 { font-size: 21px; }
.prose p { margin: 0 0 1.1em; }
.prose a { color: var(--green); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose img { display: block; max-width: 100%; margin: 24px auto; border-radius: 0; border: 1px solid var(--line); }
.prose blockquote { margin: 1.5em 0; padding: 4px 0 4px 20px; border-left: 2px solid var(--orange); color: #5c574d; }
.prose code {
  font-family: var(--mono);
  background: #ece6d8;
  color: #3b4138;
  padding: 1px 5px;
  border-radius: 0;
  font-size: .84em;
}
.prose pre {
  overflow: auto;
  padding: 16px 18px;
  border-radius: 0;
  border: 1px solid #262a35;
  background: #262a35;
  color: #e8eaf0;
  font-size: 12px;
  line-height: 1.8;
}
.prose pre code { background: transparent; padding: 0; color: inherit; }
.reading-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 16px max(50px, calc((100% - 780px) / 2)) 26px;
  border-top: 1px solid var(--line-soft);
}
.reading-actions .spacer { flex: 1; }
.like-btn { border-color: var(--line-strong); color: #4e5567; background: transparent; }
.like-btn:hover { border-color: var(--ink); background: rgba(40, 45, 60, .04); }
.like-btn.on { color: var(--orange); border-color: #e2b8a6; background: #fbefe9; }
.reading-actions .btn:not(.like-btn) { color: #4e5567; border-color: var(--line-strong); background: transparent; }
.reading-actions .btn:not(.like-btn):hover { color: var(--ink); border-color: var(--ink); background: rgba(255, 255, 255, .36); }
.reading-actions .btn-danger { color: var(--danger); border-color: #e5b7a7; background: transparent; }
.reading-actions .btn-danger:hover { color: #8f2e41; background: #fbefe9; border-color: var(--danger); }

.comments { margin-top: 20px; }
.comments .panel-head,
.comments > .panel-pad { padding-left: max(20px, calc((100% - 780px) / 2)); padding-right: max(20px, calc((100% - 780px) / 2)); }
.comment { display: flex; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.comment:last-child { border-bottom: 0; }
.comment-main { flex: 1; min-width: 0; }
.comment-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.5;
}
.comment-head b { color: var(--ink); font-family: var(--sans); font-size: 11px; font-weight: 600; }
.comment-text { margin: 5px 0 7px; font-size: 12.5px; line-height: 1.7; color: var(--muted); white-space: pre-wrap; }
.comment-actions { display: flex; gap: 12px; color: var(--dim); font-size: 10px; }
.comment-actions button { border: 0; background: transparent; color: inherit; padding: 0; }
.comment-actions button:hover { color: var(--green); }
.reply-hint { color: var(--green); font-size: 10px; margin-bottom: 7px; cursor: pointer; }

/* ── 写作与表单 ─────────────────────────────────────────── */
.editor { padding: 26px; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 24px; align-items: stretch; }
.editor-grid > div:first-child { display: flex; flex-direction: column; min-width: 0; }
.editor-grid > div:first-child > .field:nth-of-type(2) { flex: 1; display: flex; flex-direction: column; }
.editor-grid > aside { display: flex; flex-direction: column; min-width: 0; }
.field { display: grid; gap: 7px; margin-bottom: 15px; }
.field label { color: var(--muted); font-size: 11px; line-height: 1.4; letter-spacing: .03em; }
input, textarea, select {
  width: 100%;
  border: 1px solid #d6cfc0;
  border-radius: 0;
  background: #f7f4eb;
  color: var(--ink);
  padding: 10px 11px;
  font-size: 13px;
  line-height: 1.5;
  outline: none;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
input::placeholder, textarea::placeholder { color: #a7a195; }
input:focus, textarea:focus, select:focus {
  border-color: var(--green);
  background: #fffdf7;
  box-shadow: 0 0 0 3px rgba(25, 78, 59, .08);
}
textarea { resize: vertical; line-height: 1.75; }
textarea.content-input { min-height: 400px; font-family: var(--mono); font-size: 12.5px; line-height: 1.85; flex: 1; }
.editor-preview {
  min-height: 220px;
  max-height: 520px;
  flex: 1;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper-2);
  color: var(--ink);
  overflow: auto;
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.85;
}
.editor-toolbar { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.editor-toolbar .spacer { flex: 1; }
.hint { color: var(--dim); font-size: 10.5px; line-height: 1.5; }

/* ── 个人主页 ───────────────────────────────────────────── */
.profile-hero { display: flex; align-items: center; gap: 20px; padding: 28px; }
.profile-hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 30px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -.02em;
}
.profile-hero p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; max-width: 560px; }
.profile-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.profile-tabs { margin-top: 18px; }
.mini-list { display: grid; gap: 8px; }
.person-row { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.person-row:last-child { border-bottom: 0; }
.person-row .name { font-size: 12px; font-weight: 600; }
.person-row .sub { color: var(--dim); font-size: 10px; line-height: 1.5; }
.person-row .spacer { flex: 1; }

/* ── 消息 ───────────────────────────────────────────────── */
.msg-layout { display: grid; grid-template-columns: 292px minmax(0, 1fr); gap: 20px; min-height: 0; align-items: stretch; }
.msg-layout > .empty {
  min-height: clamp(520px, calc(100dvh - 200px), 760px);
  border: 1px solid var(--line);
  background: var(--paper-2);
  display: grid;
  place-content: center;
}
.conv-list { overflow-y: auto; overflow-x: hidden; }
.conv-item { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-bottom: 1px solid var(--line-soft); }
.conv-item:hover, .conv-item.on { background: rgba(25, 78, 59, .06); }
.conv-item.on { box-shadow: inset 2px 0 0 var(--green); }
.conv-item .spacer { flex: 1; }
.conv-item .preview { color: var(--dim); font-size: 10.5px; max-width: 130px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: clamp(520px, calc(100dvh - 200px), 760px); overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.chat-head .spacer { flex: 1; }
.chat-retention {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(25, 78, 59, .035);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  flex: 0 0 auto;
}
.chat-retention .retention-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--signal, #C95E35); flex: 0 0 auto; }
.chat-body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 20px; display: flex; flex-direction: column; gap: 12px; scrollbar-gutter: stable; overscroll-behavior: contain; }
.chat-body::before { content: ""; margin-top: auto; }
.chat-body::-webkit-scrollbar { width: 7px; }
.chat-body::-webkit-scrollbar-track { background: transparent; }
.chat-body::-webkit-scrollbar-thumb { background: #cfc7b7; border: 2px solid var(--paper-2); }
.bubble {
  max-width: 72%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #f7f3ea;
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre-wrap;
}
.bubble.mine { margin-left: auto; border-color: #bfd2c8; background: rgba(25, 78, 59, .07); }
.bubble time { display: block; margin-top: 4px; color: var(--dim); font-family: var(--mono); font-size: 8px; }
.chat-input { display: flex; gap: 8px; padding: 13px; border-top: 1px solid var(--line); flex: 0 0 auto; }
.chat-input textarea { min-height: 42px; max-height: 110px; resize: none; }
.notice-item { display: flex; gap: 10px; padding: 14px 17px; border-bottom: 1px solid var(--line-soft); }
.notice-item:last-child { border-bottom: 0; }
.notice-item.unread { background: rgba(25, 78, 59, .045); box-shadow: inset 2px 0 0 var(--green); }
.notice-item .grow { min-width: 0; }
.notice-title { color: var(--muted); font-size: 11px; line-height: 1.7; overflow-wrap: anywhere; }
.notice-title a { color: var(--ink); font-weight: 600; }
.notice-action { color: var(--dim); font-weight: 400; }
.notice-friend {
  display: inline-block;
  margin-right: 2px;
  padding: 0 4px;
  border: 1px solid #b8cdc1;
  color: var(--green);
  font-size: 8px;
  font-weight: 500;
  line-height: 1.5;
  vertical-align: 1px;
}
.notice-post { color: var(--green); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.notice-comment {
  margin-top: 5px;
  padding-left: 9px;
  border-left: 2px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.notice-comment.plain { border-left: 0; padding-left: 0; }
.notice-comment:not(.plain):not(.deleted) {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.notice-item.compact .notice-comment:not(.plain):not(.deleted) { -webkit-line-clamp: 1; }
.notice-comment.deleted { color: var(--dim); border-left-color: #d9b8a9; font-style: italic; }
.notice-foot { display: flex; align-items: center; gap: 8px; margin-top: 5px; color: var(--dim); font-family: var(--mono); font-size: 8.5px; }
.notice-state {
  padding: 2px 5px;
  border: 1px solid #e2b7a8;
  color: var(--signal, #C95E35);
  font-family: var(--sans);
  font-size: 9px;
  line-height: 1.4;
  white-space: nowrap;
}
.notice-item .spacer { flex: 1; }

/* ── 搜索 ───────────────────────────────────────────────── */
.searchbar { display: flex; gap: 8px; margin-bottom: 20px; }
.searchbar input { flex: 1; }
.result-user { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.result-user:last-child { border-bottom: 0; }
.result-user .spacer { flex: 1; }

/* ── 管理后台 ───────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.stat { padding: 16px 17px; }
.stat b { display: block; font-family: var(--serif); font-size: 30px; line-height: 1.2; font-weight: 600; letter-spacing: -.03em; }
.stat span { color: var(--dim); font-family: var(--mono); font-size: 8px; line-height: 1.5; letter-spacing: .06em; }
.admin-tabs { display: flex; gap: 4px; margin: 20px 0 16px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.admin-tabs button {
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #817c6e;
  padding: 8px 12px 9px;
  font-size: 11px;
}
.admin-tabs button:hover { color: var(--ink); }
.admin-tabs button.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--green); }
.admin-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); font-size: 11px; }
.admin-row:last-child { border-bottom: 0; }
.admin-row .spacer { flex: 1; }
.admin-row .grow { flex: 1; min-width: 0; }
.admin-row .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-status {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--muted);
  background: transparent;
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.3;
  letter-spacing: .03em;
}
.admin-status.published { color: var(--green); border-color: #bfd2c8; background: rgba(25, 78, 59, .05); }
.admin-status.hidden, .admin-status.deleted { color: var(--danger); border-color: #e5b7a7; background: #fbefe9; }
.table-note { color: var(--dim); font-family: var(--mono); font-size: 8px; line-height: 1.5; }

/* ── 登录门 ─────────────────────────────────────────────── */
.gate { min-height: calc(100vh - 80px); display: grid; place-items: center; padding: 40px 20px 64px; }
.gate-card { max-width: 600px; padding: 50px; text-align: center; position: relative; overflow: hidden; }
.gate-card::before, .gate-card::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--green);
  border-style: solid;
  opacity: .65;
  pointer-events: none;
}
.gate-card::before { left: -1px; top: -1px; border-width: 2px 0 0 2px; }
.gate-card::after { right: -1px; bottom: -1px; border-width: 0 2px 2px 0; }
.gate-mark {
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
  border-radius: 0;
  display: grid;
  place-items: center;
  background: var(--green);
  color: #f7f3e7;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: .02em;
}
.gate h1 {
  margin: 0 0 13px;
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -.025em;
}
.gate p { color: var(--muted); font-size: 13px; line-height: 1.9; max-width: 430px; margin: 0 auto 24px; }
.gate small { display: block; margin-top: 18px; color: var(--dim); font-family: var(--mono); font-size: 8px; letter-spacing: .04em; }

/* ── 提示与杂项 ─────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(12px);
  z-index: 90;
  padding: 10px 16px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--ink);
  color: #fbf8f0;
  font-size: 12px;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  box-shadow: 0 14px 40px rgba(23, 24, 20, .18);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--danger); background: #7f2f20; }
.skeleton { color: var(--dim); padding: 40px; text-align: center; font-size: 12px; }
.spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(23, 24, 20, .12);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--line); margin: 12px 0; }

/* ── 响应式 ─────────────────────────────────────────────── */
@media (max-width: 1120px) {
  .grid-main { grid-template-columns: 208px minmax(0, 1fr); }
  .grid-main > .side:last-child { display: none; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .topbar { gap: 18px; }
  .brand { min-width: 164px; }
  .topnav a { padding-left: 9px; padding-right: 9px; }
}

@media (max-width: 900px) {
  .topbar {
    min-height: 70px;
    padding: 16px 20px 14px;
    gap: 12px;
  }
  .brand { min-width: 0; }
  .brand-mark { width: 32px; height: 32px; font-size: 18px; }
  .brand-name { font-size: 16px; }
  .topnav a::before { display: none; }
  .topbar-right .user-meta { display: none; }
  .page { padding: 26px 20px 64px; }
  .grid-main, .grid-two { grid-template-columns: 1fr; }
  .grid-main > .side:first-child { display: none; }
  .side { position: static; }
  .post-card { grid-template-columns: 132px minmax(0, 1fr); gap: 17px; }
  .post-cover { height: 108px; }
  .reading-head, .prose, .reading-actions { padding-left: 28px; padding-right: 28px; }
  .comments .panel-head, .comments > .panel-pad { padding-left: 20px; padding-right: 20px; }
  .reading-head h1 { font-size: 34px; }
  .editor-grid { grid-template-columns: 1fr; }
  .editor-preview { display: none; }
  .msg-layout { grid-template-columns: 1fr; min-height: 0; }
  .conv-list { max-height: 340px; }
  .chat-panel { height: clamp(480px, calc(100dvh - 260px), 620px); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .profile-hero { flex-wrap: wrap; }
  .profile-actions { margin-left: 0; width: 100%; }
}

@media (max-width: 620px) {
  .topbar { padding: 12px 14px 11px; gap: 8px; }
  .brand { gap: 9px; }
  .brand-mark { width: 30px; height: 30px; font-size: 17px; }
  .brand-name { font-size: 15px; }
  .brand-name span { display: none; }
  .topnav { display: none; }
  .topbar-right { gap: 4px; }
  .topbar-right .btn-primary.btn-sm { min-height: 30px; padding: 4px 8px; font-size: 10.5px; }
  .icon-btn { width: 30px; height: 30px; }
  .avatar { width: 30px; height: 30px; font-size: 12px; }

  .mobile-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    padding: 5px 8px calc(5px + env(safe-area-inset-bottom));
    gap: 2px;
    border-top: 1px solid var(--line);
    border-radius: 0;
    background: rgba(251, 248, 241, .97);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 -8px 24px rgba(23, 24, 20, .05);
  }
  .mobile-nav a {
    position: relative;
    flex: 1;
    min-width: 0;
    text-align: center;
    padding: 8px 2px 7px;
    border-bottom: 2px solid transparent;
    color: #777268;
    font-size: 11px;
    line-height: 1.3;
    white-space: nowrap;
  }
  .mobile-nav a.on { color: var(--green); font-weight: 600; border-bottom-color: var(--green); }
  .page { padding: 22px 14px calc(76px + env(safe-area-inset-bottom)); }
  .grid-main, .grid-two { gap: 18px; }
  .section-title { gap: 9px; margin-bottom: 13px; padding-bottom: 10px; }
  .section-title h2 { font-size: 24px; }
  .tabs { margin-bottom: 16px; width: 100%; }
  .tabs button { flex: 1; padding-left: 6px; padding-right: 6px; }
  .post-card { grid-template-columns: 1fr; gap: 12px; padding: 20px 8px; margin: 0 -8px; }
  .post-cover { height: 168px; }
  .post-title { font-size: 20px; }
  .post-foot .spacer { display: none; }
  .reading-head, .prose, .reading-actions { padding-left: 20px; padding-right: 20px; }
  .comments .panel-head, .comments > .panel-pad { padding-left: 20px; padding-right: 20px; }
  .reading-head { padding-top: 27px; padding-bottom: 20px; }
  .reading-head h1 { font-size: 28px; line-height: 1.32; }
  .prose { padding-top: 25px; font-size: 15.5px; line-height: 1.9; }
  .prose h1 { font-size: 26px; }
  .prose h2 { font-size: 23px; }
  .prose h3 { font-size: 20px; }
  .editor { padding: 17px; }
  .editor-toolbar { flex-wrap: wrap; }
  .editor-toolbar .hint { width: 100%; }
  .profile-hero { padding: 19px; gap: 14px; }
  .profile-hero .avatar { width: 54px; height: 54px; font-size: 21px; }
  .profile-hero h1 { font-size: 24px; }
  .stats-row { gap: 14px; flex-wrap: wrap; }
  .gate { min-height: calc(100vh - 54px); padding: 28px 14px 50px; }
  .gate-card { padding: 30px 21px; }
  .gate h1 { font-size: 27px; }
  .gate p { font-size: 12px; }
  .searchbar { flex-direction: column; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-tabs { gap: 0; }
  .admin-tabs button { padding-left: 9px; padding-right: 9px; }
}

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

/* 跳蚤市场记录：只读展示，视觉上像一本旧货账本 */
.market-toolbar { display: flex; align-items: center; gap: 12px; justify-content: space-between; margin-bottom: 14px; }
.market-toolbar .tabs { margin: 0; }
.market-disclaimer { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin: 0 0 16px; border: 1px solid #e4d3b4; border-radius: 11px; background: #fffaf0; color: #7a5b34; font-size: 12px; line-height: 1.65; }
.market-disclaimer b { flex: 0 0 auto; color: #8b4f22; }
.market-disclaimer.compact { margin: 10px 0; padding: 9px 11px; }
.market-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.market-card { border: 1px solid var(--line); border-radius: 14px; background: var(--card); overflow: hidden; box-shadow: var(--shadow); transition: .18s; }
.market-card:hover { transform: translateY(-2px); border-color: #cdbda2; }
.market-card-link { display: block; text-decoration: none; color: inherit; }
.market-cover { aspect-ratio: 4 / 3; background: #ece5d6; display: grid; place-items: center; color: var(--muted); font-size: 26px; overflow: hidden; }
.market-cover img { width: 100%; height: 100%; object-fit: cover; }
.market-card-body { padding: 12px 13px 13px; }
.market-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.market-status { display: inline-flex; padding: 3px 8px; border-radius: 999px; font-size: 10px; border: 1px solid var(--line); color: var(--muted); background: #fffdf7; }
.market-status.ok { color: #36705a; background: #eaf5ef; border-color: #cfe6da; }
.market-status.wait { color: #946126; background: #fff3e1; border-color: #efdcbb; }
.market-status.bad { color: #a3453d; background: #fbe9e6; border-color: #efcfc9; }
.market-card-body h3 { margin: 8px 0 5px; font-size: 16px; line-height: 1.35; }
.market-price { color: var(--orange-dark); font-weight: 800; font-size: 17px; }
.market-price span { color: var(--muted); font-size: 11px; font-weight: 400; }
.market-exchange { margin-top: 4px; color: var(--ink-2); font-size: 12px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.market-parties { margin-top: 9px; color: var(--ink-2); font-size: 12px; }
.market-card-foot { display: flex; justify-content: space-between; margin-top: 9px; padding-top: 8px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 10px; }
.market-mini-list { display: grid; }
.market-row { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-bottom: 1px solid #eee7d8; text-decoration: none; color: inherit; }
.market-row:last-child { border-bottom: 0; }
.market-row:hover { background: #fffaf0; }
.market-row-cover { width: 42px; height: 38px; border-radius: 7px; background: #ece5d6; overflow: hidden; flex: 0 0 42px; display: grid; place-items: center; color: var(--muted); }
.market-row-cover img { width: 100%; height: 100%; object-fit: cover; }
.market-row .grow b { display: block; font-size: 13px; line-height: 1.35; }
.market-mini-note { font-size: 10px; color: var(--muted); border-top: 1px solid #eee7d8; }
.market-more { padding: 12px 14px; }
.market-detail { padding: 20px; }
.market-detail-head { display: flex; gap: 20px; }
.market-detail-cover { width: 220px; height: 165px; border-radius: 12px; overflow: hidden; background: #ece5d6; flex: 0 0 220px; display: grid; place-items: center; color: var(--muted); font-size: 30px; }
.market-detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.market-detail-head h1 { margin: 7px 0 8px; font-size: 29px; }
.market-detail-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 18px 0; padding: 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fffaf0; border-radius: 10px; }
.market-detail-meta div { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); }
.market-detail-meta b { color: var(--ink); font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.market-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

@media (max-width: 980px) {
  .market-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .market-detail-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .market-toolbar { align-items: flex-start; flex-direction: column; }
  .market-toolbar .btn { width: 100%; }
  .market-grid { grid-template-columns: 1fr; gap: 10px; }
  .market-card { display: grid; grid-template-columns: 110px minmax(0, 1fr); }
  .market-cover { height: 100%; aspect-ratio: auto; }
  .market-card-body { padding: 10px; }
  .market-card-body h3 { font-size: 14px; }
  .market-card-foot span:first-child { display: none; }
  .market-detail { padding: 13px; }
  .market-detail-head { flex-direction: column; gap: 12px; }
  .market-detail-cover { width: 100%; height: auto; aspect-ratio: 4 / 3; flex-basis: auto; }
  .market-detail-head h1 { font-size: 24px; }
  .market-detail-meta { grid-template-columns: 1fr 1fr; padding: 11px; }
  .market-disclaimer { font-size: 11px; }
}
