/* ===== 缅讯 · 设计系统 ===== */
:root {
  --bg: #f6f2ea;
  --surface: #fffdf8;
  --surface-2: #fbf8f0;
  --ink: #1f1c17;
  --ink-2: #57514a;
  --ink-3: #8b847a;
  --ink-4: #b8b1a6;
  --line: #e7dfd1;
  --line-soft: #efe9dc;
  --line-strong: #d7cebc;
  --gold: #a67c1f;
  --gold-soft: #c9a34c;
  --gold-bg: #f3ead7;
  --jade: #2f7a63;
  --jade-bg: #e3efe9;
  --ruby: #b23a3a;
  --ruby-bg: #f6e5e5;
  --saffron: #c97a2a;
  --serif: "Playfair Display", "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", Georgia, serif;
  --sans: "Inter", "PingFang SC", "Noto Sans SC", "Source Han Sans SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgba(31, 28, 23, .04), 0 4px 16px rgba(31, 28, 23, .05);
  --header-h: 56px;
}

[data-theme="dark"] {
  --bg: #141210;
  --surface: #1d1a16;
  --surface-2: #221e19;
  --ink: #ece7dd;
  --ink-2: #b8b0a4;
  --ink-3: #8a8378;
  --ink-4: #5f5a51;
  --line: #322d26;
  --line-soft: #2a2620;
  --line-strong: #443d33;
  --gold: #cf9e3a;
  --gold-soft: #b8862c;
  --gold-bg: #2c2517;
  --jade: #56b090;
  --jade-bg: #1d2b25;
  --ruby: #e06b6b;
  --ruby-bg: #2e1f1f;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 18px rgba(0,0,0,.35);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .3s ease, color .3s ease;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { max-width: 100%; display: block; }
h1,h2,h3,h4 { margin: 0; font-weight: 700; line-height: 1.3; }

/* ===== 布局 ===== */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 980px) {
  .wrap { padding: 0 24px; }
  .home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: start; }
}

/* ===== 顶栏 masthead ===== */
.masthead {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.masthead-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--header-h); max-width: 1180px; margin: 0 auto; padding: 0 16px;
}
.brand { display: flex; align-items: baseline; gap: 9px; }
.brand .logo {
  font-family: var(--serif); font-weight: 800; font-size: 26px; letter-spacing: .5px;
  color: var(--ink); line-height: 1;
}
.brand .logo em { font-style: normal; color: var(--gold); }
.brand .sub {
  font-size: 11px; color: var(--ink-3); letter-spacing: 2px; font-weight: 500;
  white-space: nowrap;
}
.brand .diamond { color: var(--gold); font-size: 10px; align-self: center; transform: translateY(-2px); }
.mast-actions { display: flex; align-items: center; gap: 4px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; font-size: 19px; color: var(--ink-2);
  transition: background .15s;
}
.icon-btn:active { background: var(--line-soft); }
.gold-rule { height: 2px; background: linear-gradient(90deg, var(--gold), var(--gold-soft), var(--gold)); border: none; margin: 0; }

/* 菜单弹出 */
.menu-pop {
  position: absolute; top: 46px; right: 12px; z-index: 60;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 10px 34px rgba(31,28,23,.16); padding: 6px; min-width: 168px; display: flex; flex-direction: column;
}
.menu-pop button { text-align: left; padding: 11px 14px; font-size: 14.5px; color: var(--ink-2); border-radius: 8px; }
.menu-pop button:active { background: var(--line-soft); }

/* ===== 栏目导航 ===== */
.catnav {
  position: sticky; top: var(--header-h); z-index: 40;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.catnav-scroll { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; padding: 8px 0; }
.catnav-scroll::-webkit-scrollbar { display: none; }
.catnav-scroll a {
  flex: 0 0 auto; padding: 6px 14px; border-radius: 999px; font-size: 14.5px; font-weight: 500;
  color: var(--ink-2); white-space: nowrap; transition: all .18s;
}
.catnav-scroll a.on { background: var(--ink); color: var(--bg); font-weight: 600; }
.catnav-scroll a:active { transform: scale(.96); }

/* ===== 内容区 ===== */
.page { padding: 14px 0 90px; min-height: 70vh; }
.page-title { display: flex; align-items: baseline; gap: 10px; margin: 6px 0 14px; }
.page-title h1 { font-family: var(--serif); font-size: 23px; letter-spacing: .3px; }
.page-title .cnt { color: var(--ink-4); font-size: 13px; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 26px 0 10px; padding-bottom: 8px; border-bottom: 2px solid var(--ink);
}
.section-head h2 { font-family: var(--serif); font-size: 19px; letter-spacing: .5px; display: flex; align-items: center; gap: 8px; }
.section-head h2::before { content: ""; width: 7px; height: 7px; background: var(--gold); transform: rotate(45deg); }
.section-head .more { font-size: 13px; color: var(--ink-3); display: flex; align-items: center; gap: 3px; }

/* ===== 新闻列表（报纸风，高密度） ===== */
.news-item {
  display: block; padding: 14px 2px; border-bottom: 1px solid var(--line-soft);
}
.news-item:last-child { border-bottom: none; }
.news-item .meta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.tag {
  display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600; letter-spacing: .5px; line-height: 1.7;
  background: var(--gold-bg); color: var(--gold);
}
.tag.jade { background: var(--jade-bg); color: var(--jade); }
.tag.ruby { background: var(--ruby-bg); color: var(--ruby); }
.tag.plain { background: var(--line-soft); color: var(--ink-3); }
.news-item .time { font-size: 12px; color: var(--ink-4); }
.news-item h3 {
  font-family: var(--serif); font-size: 17.5px; font-weight: 700; line-height: 1.42;
  margin-bottom: 5px; letter-spacing: .2px;
}
.news-item .src-line { font-size: 12.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.news-item .src-line .dot { color: var(--ink-4); }
.news-item .summary { font-size: 13px; color: var(--ink-3); margin-top: 4px; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* 大图卡片（头条/hero） */
.hero { display: block; margin-bottom: 18px; border-bottom: 1px solid var(--line); padding-bottom: 18px; }
.hero .cover { border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; background: var(--surface-2); }
.hero .cover img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.hero h2 { font-family: var(--serif); font-size: 22px; font-weight: 800; line-height: 1.35; margin: 8px 0 7px; }
.hero .summary { font-size: 14px; color: var(--ink-2); line-height: 1.6; }

/* 紧凑双列卡片 */
.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mini-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: var(--surface); }
.mini-card .cover { border-radius: 7px; overflow: hidden; margin-bottom: 8px; background: var(--surface-2); }
.mini-card .cover img { aspect-ratio: 16/10; object-fit: cover; width: 100%; }
.mini-card h3 { font-family: var(--serif); font-size: 15px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mini-card .meta { font-size: 11.5px; color: var(--ink-4); margin-top: 6px; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 999px; font-size: 14.5px; font-weight: 600;
  background: var(--ink); color: var(--bg); transition: transform .15s, opacity .15s;
}
.btn:active { transform: scale(.97); opacity: .85; }
.btn.gold { background: var(--gold); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink-2); border: 1px solid var(--line-strong); }
.btn.sm { padding: 7px 14px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.fab {
  position: fixed; right: 18px; bottom: 24px; z-index: 60;
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--gold); color: #fff; font-size: 26px; font-weight: 400;
  box-shadow: 0 6px 20px rgba(166,124,31,.35); display: grid; place-items: center;
  transition: transform .15s;
}
.fab:active { transform: scale(.92); }

/* ===== 文章详情 ===== */
.article { padding-bottom: 40px; }
.article .back {
  display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--ink-3);
  margin-bottom: 14px; padding: 4px 0;
}
.article .kicker { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.article h1 { font-family: var(--serif); font-size: 27px; font-weight: 800; line-height: 1.35; letter-spacing: .3px; margin-bottom: 14px; }
.article .lead {
  font-size: 16px; color: var(--ink-2); line-height: 1.7; padding: 12px 16px;
  border-left: 3px solid var(--gold); background: var(--surface-2); border-radius: 0 8px 8px 0;
  margin-bottom: 18px; font-weight: 500;
}
.article .byline { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; font-size: 12.5px; color: var(--ink-3); margin-bottom: 18px; }
.article .byline .sep { color: var(--line-strong); }
.article .cover-img { border-radius: var(--radius); overflow: hidden; margin-bottom: 22px; background: var(--surface-2); }
.article .cover-img img { width: 100%; }
.article .body { font-size: 17px; line-height: 1.85; color: var(--ink); }
.article .body p { margin: 0 0 18px; }
.article .body img { border-radius: 8px; margin: 4px auto; }
.article .body strong { color: var(--ink); }
.article .body table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 14px; }
.article .body td, .article .body th { border: 1px solid var(--line); padding: 6px 9px; }
.article .src-link {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 18px; font-size: 13px;
  color: var(--jade); border-bottom: 1px dashed var(--jade); padding-bottom: 1px;
}
.reading-tools { display: flex; align-items: center; gap: 8px; margin: 18px 0; }
.reading-tools button { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); font-size: 15px; color: var(--ink-2); display: grid; place-items: center; }

/* ===== 论坛 ===== */
.thread-item { display: block; padding: 15px 2px; border-bottom: 1px solid var(--line-soft); }
.thread-item h3 { font-family: var(--sans); font-size: 16px; font-weight: 600; line-height: 1.45; margin-bottom: 7px; }
.thread-item .t-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; font-size: 12.5px; color: var(--ink-4); }
.thread-item .t-meta .author { color: var(--ink-3); }
.thread-item .excerpt { font-size: 13px; color: var(--ink-3); margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.count-badge { display: inline-flex; align-items: center; gap: 3px; }
.count-badge b { font-weight: 600; color: var(--ink-2); }

.thread-view h1 { font-family: var(--serif); font-size: 23px; margin-bottom: 12px; line-height: 1.4; }
.thread-view .op { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 14px 0 20px; }
.thread-view .op .op-meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); margin-bottom: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--gold-bg); color: var(--gold);
  display: grid; place-items: center; font-weight: 700; font-size: 15px; flex: 0 0 auto;
}
.thread-view .op .op-body { font-size: 15.5px; line-height: 1.75; white-space: pre-wrap; word-break: break-word; }
.reply-item { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.reply-item .r-main { flex: 1; min-width: 0; }
.reply-item .r-meta { font-size: 12.5px; color: var(--ink-3); margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.reply-item .r-floor { color: var(--ink-4); }
.reply-item .r-body { font-size: 15px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }

/* ===== 表单 ===== */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface);
  font-size: 15px; color: var(--ink); font-family: inherit;
  transition: border .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 110px; line-height: 1.6; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-bg);
}
.hp-field { position: absolute; left: -9999px; opacity: 0; height: 0; }

/* ===== 底部弹层（发帖/回复） ===== */
.sheet-mask { position: fixed; inset: 0; background: rgba(20,17,13,.45); z-index: 90; opacity: 0; pointer-events: none; transition: opacity .25s; }
.sheet-mask.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 91;
  background: var(--surface); border-radius: 18px 18px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  transform: translateY(105%); transition: transform .28s cubic-bezier(.32,.72,.24,1);
  max-height: 88vh; overflow-y: auto; box-shadow: 0 -10px 40px rgba(0,0,0,.2);
}
.sheet.open { transform: translateY(0); }
.sheet .sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet .sheet-head h3 { font-family: var(--serif); font-size: 19px; }
.sheet .close { width: 32px; height: 32px; border-radius: 50%; background: var(--line-soft); display: grid; place-items: center; font-size: 16px; color: var(--ink-3); }

/* ===== 搜索 ===== */
.search-bar { display: flex; align-items: center; gap: 10px; margin: 10px 0 18px; }
.search-bar input {
  flex: 1; padding: 11px 16px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); font-size: 15px; font-family: inherit; color: var(--ink);
}
.search-bar input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-bg); }

/* ===== 管理端 ===== */
.admin-login { max-width: 360px; margin: 40px auto; }
.admin-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.admin-list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.admin-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.admin-row:last-child { border-bottom: none; }
.admin-row .a-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-row .a-del { color: var(--ruby); flex: 0 0 auto; }
.editor { max-width: 720px; }
.editor textarea.content { min-height: 260px; font-family: var(--sans); }

/* ===== 通用 ===== */
.empty { text-align: center; padding: 60px 20px; color: var(--ink-4); }
.empty .big { font-size: 40px; margin-bottom: 10px; }
.spinner {
  width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--line);
  border-top-color: var(--gold); animation: spin .7s linear infinite; margin: 30px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg); padding: 10px 20px; border-radius: 999px;
  font-size: 14px; z-index: 120; opacity: 0; pointer-events: none; transition: all .25s;
  max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.load-more { display: block; margin: 18px auto 0; }
.fade-in { animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.skeleton { background: linear-gradient(90deg, var(--line-soft) 25%, var(--surface) 50%, var(--line-soft) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* 桌面端侧栏 */
@media (min-width: 980px) {
  .sidebar { position: sticky; top: calc(var(--header-h) + 52px); }
  .article h1 { font-size: 34px; }
  .article .body { font-size: 18px; }
}
