/* 思政e家 · 虚拟社区 —— 全局样式（移动端优先） */
:root {
  --brand: #B4231F;
  --brand-dark: #8A1512;
  --brand-soft: #FBEDEA;
  --gold: #C08A2E;
  --gold-soft: #FBF3E2;
  --ink: #1D2129;
  --ink-2: #4E5969;
  --ink-3: #86909C;
  --bg: #F6F4F0;
  --card: #FFFFFF;
  --line: #ECE7DF;
  --green: #2F7A52;
  --blue: #2C6499;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(29, 33, 41, .05);
  --shadow-lg: 0 12px 32px rgba(29, 33, 41, .12);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; font-size: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: 15px; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(78px + env(safe-area-inset-bottom));
  background: var(--bg);
  position: relative;
}
.wrap { padding: 0 16px; }

/* ---------- 顶部 Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 22px 16px 18px;
  color: #fff;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(255, 214, 150, .30) 0%, rgba(255, 214, 150, 0) 55%),
    linear-gradient(150deg, #C02C26 0%, #A01815 52%, #7C110F 100%);
}
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(45deg, rgba(255,255,255,.05) 0 1px, transparent 1px 12px);
  pointer-events: none;
}
.hero-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; position: relative; z-index: 1; }
.hero-eyebrow { font-size: 11px; letter-spacing: 2px; color: rgba(255, 255, 255, .72); }
.hero-title {
  font-size: 33px; letter-spacing: 3px; line-height: 1.25; margin-top: 4px;
  font-weight: 800; text-shadow: 0 2px 8px rgba(0, 0, 0, .18);
}
.hero-sub { font-size: 12.5px; letter-spacing: 1.5px; color: rgba(255, 255, 255, .85); margin-top: 6px; }
.hero-seal {
  flex: none; width: 48px; height: 48px; border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .45);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; line-height: 1.25; text-align: center; letter-spacing: 1px;
  color: #FFE9C7; background: rgba(255, 255, 255, .08);
}
.hero-stats {
  position: relative; z-index: 1;
  margin-top: 18px; display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 14px; padding: 12px 4px; backdrop-filter: blur(4px);
}
.hero-stats .hs { text-align: center; border-right: 1px solid rgba(255, 255, 255, .16); }
.hero-stats .hs:last-child { border-right: none; }
.hero-stats b { display: block; font-size: 19px; line-height: 1.2; font-weight: 800; color: #FFF3DE; }
.hero-stats span { font-size: 10.5px; color: rgba(255, 255, 255, .78); }

/* ---------- 通用卡片 / 标题 ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
  border: 1px solid rgba(236, 231, 223, .9);
}
.sec-head { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 0 12px; }
.sec-head h2 { font-size: 17px; letter-spacing: .5px; position: relative; padding-left: 11px; }
.sec-head h2::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 4px; height: 15px; border-radius: 3px;
  background: linear-gradient(180deg, #C9302A, #8A1512);
}
.sec-tip { font-size: 11.5px; color: var(--ink-3); }
.sec-link { font-size: 12.5px; color: var(--ink-3); }
.sec-link:active { color: var(--brand); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 42px; padding: 0 18px; border-radius: 12px;
  font-size: 14.5px; font-weight: 600; transition: .15s;
  background: #F2EFE9; color: var(--ink-2);
}
.btn:active { transform: scale(.98); opacity: .9; }
.btn-primary { background: linear-gradient(135deg, #C32C26, #96150F); color: #fff; box-shadow: 0 6px 16px rgba(180, 35, 31, .24); }
.btn-gold { background: linear-gradient(135deg, #D19B3C, #B07A1E); color: #fff; box-shadow: 0 6px 16px rgba(192, 138, 46, .24); }
.btn-ghost { background: #fff; border: 1px solid var(--line); color: var(--ink-2); }
.btn-block { width: 100%; }
.btn-sm { height: 32px; padding: 0 12px; border-radius: 9px; font-size: 12.5px; }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* ---------- 板块网格 ---------- */
.board-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.board-item {
  position: relative; background: #fff; border-radius: 14px; padding: 14px 13px;
  box-shadow: var(--shadow); border: 1px solid rgba(236, 231, 223, .9);
  display: flex; flex-direction: column; gap: 6px; overflow: hidden;
  transition: .15s;
}
.board-item:active { transform: scale(.985); }
.board-item::before {
  content: ""; position: absolute; right: -22px; top: -22px; width: 58px; height: 58px;
  border-radius: 50%; opacity: .09; background: currentColor;
}
.board-ico { font-size: 21px; line-height: 1; }
.board-name { font-size: 14.5px; font-weight: 700; letter-spacing: .3px; }
.board-desc { font-size: 11px; color: var(--ink-3); line-height: 1.45; }
.board-meta { font-size: 10.5px; color: var(--ink-3); margin-top: 2px; }

/* ---------- 帖子 ---------- */
.post {
  background: #fff; border-radius: var(--radius); padding: 15px;
  box-shadow: var(--shadow); border: 1px solid rgba(236, 231, 223, .9);
  margin-bottom: 11px;
}
.post-head { display: flex; align-items: center; gap: 9px; }
.avatar {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13.5px; font-weight: 700; letter-spacing: 0;
}
.post-meta { min-width: 0; }
.post-meta b { display: block; font-size: 13.5px; font-weight: 600; }
.post-meta span { font-size: 11px; color: var(--ink-3); }
.post-title { font-size: 15.5px; line-height: 1.45; margin-top: 10px; font-weight: 700; }
.post-body {
  font-size: 14px; color: var(--ink-2); line-height: 1.68; margin-top: 7px;
  white-space: pre-wrap; word-break: break-word;
}
.post-body.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-tag {
  display: inline-block; font-size: 10.5px; padding: 1px 7px; border-radius: 20px;
  background: var(--brand-soft); color: var(--brand); margin-top: 9px; font-weight: 600;
}
.post-media { margin-top: 10px; border-radius: 12px; overflow: hidden; background: #F3F0EA; }
.post-media img { width: 100%; max-height: 320px; object-fit: cover; }
.post-media video { width: 100%; max-height: 320px; background: #000; }
.post-media audio { width: 100%; padding: 6px; }
.file-chip {
  display: flex; align-items: center; gap: 9px; padding: 11px 13px;
  font-size: 13px; color: var(--ink-2); background: #F7F5F1;
}
.file-chip b { font-weight: 600; color: var(--ink); }
.post-actions { display: flex; gap: 8px; margin-top: 12px; padding-top: 11px; border-top: 1px solid #F4F1EB; }
.act {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink-3);
  padding: 5px 11px; border-radius: 20px; background: #F7F5F1;
}
.act.on { color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.act:active { opacity: .7; }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0;
  width: 100%; max-width: 560px;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(255, 255, 255, .96);
  border-top: 1px solid var(--line);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  backdrop-filter: blur(10px); z-index: 60;
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; color: var(--ink-3); font-size: 10.5px; }
.tab svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tab.on { color: var(--brand); font-weight: 600; }

/* ---------- 悬浮按钮 ---------- */
.fab {
  position: fixed; right: max(16px, calc(50% - 264px)); bottom: calc(90px + env(safe-area-inset-bottom));
  width: 54px; height: 54px; border-radius: 50%;
  background: linear-gradient(135deg, #C32C26, #96150F); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px rgba(180, 35, 31, .34); z-index: 50;
}
.fab svg { width: 25px; height: 25px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; }

/* ---------- 弹层 ---------- */
.sheet-mask {
  position: fixed; inset: 0; background: rgba(20, 18, 16, .45); z-index: 80;
  opacity: 0; pointer-events: none; transition: .2s;
}
.sheet-mask.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 50%; bottom: 0; transform: translate(-50%, 100%);
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  background: #fff; border-radius: 20px 20px 0 0; z-index: 90;
  transition: transform .26s cubic-bezier(.32, .72, 0, 1);
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}
.sheet.show { transform: translate(-50%, 0); }
.sheet-bar { width: 38px; height: 4px; border-radius: 3px; background: #E4E0D8; margin: 6px auto 12px; }
.sheet h3 { font-size: 17px; margin-bottom: 12px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 6px; font-weight: 600; }
.input, textarea.input, select.input {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 13px; background: #FBFAF8; color: var(--ink); outline: none;
  transition: .15s; resize: vertical;
}
.input:focus { border-color: #D8A9A6; background: #fff; box-shadow: 0 0 0 3px rgba(180, 35, 31, .07); }
textarea.input { min-height: 96px; line-height: 1.6; }
.tip { font-size: 11.5px; color: var(--ink-3); }
.err { font-size: 12px; color: #D93026; margin-top: 4px; min-height: 16px; }

/* ---------- 标签 ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; font-size: 12.5px; padding: 6px 13px; border-radius: 20px;
  background: #fff; border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap;
}
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.pill { display: inline-block; font-size: 10.5px; padding: 2px 8px; border-radius: 20px; font-weight: 600; }
.pill.open { background: #EAF6EE; color: var(--green); }
.pill.closed { background: #F2F1EE; color: var(--ink-3); }
.pill.upcoming { background: var(--gold-soft); color: #9A6B12; }

/* ---------- 数据 / 图表 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.stat-box { background: #fff; border-radius: 13px; padding: 12px 10px; text-align: center; box-shadow: var(--shadow); border: 1px solid rgba(236,231,223,.9); }
.stat-box b { display: block; font-size: 20px; font-weight: 800; color: var(--brand); line-height: 1.2; }
.stat-box span { font-size: 10.5px; color: var(--ink-3); }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.bar-label { flex: none; width: 46px; font-size: 11.5px; color: var(--ink-3); }
.bar-track { flex: 1; height: 9px; border-radius: 6px; background: #F2EFE9; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, #D4594F, #96150F); }
.bar-val { flex: none; width: 34px; text-align: right; font-size: 11.5px; color: var(--ink-2); font-weight: 600; }
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th { text-align: left; color: var(--ink-3); font-weight: 500; padding: 8px 6px; border-bottom: 1px solid var(--line); font-size: 11.5px; }
.table td { padding: 10px 6px; border-bottom: 1px solid #F6F3EE; }
.table tr:last-child td { border-bottom: none; }
.table td.num { font-weight: 700; color: var(--ink); }

/* ---------- AI 聊天 ---------- */
.chat-list { padding: 14px 16px 8px; display: flex; flex-direction: column; gap: 13px; }
.msg { display: flex; gap: 9px; align-items: flex-start; }
.msg .avatar { width: 30px; height: 30px; font-size: 12px; }
.bubble {
  max-width: 84%; padding: 11px 13px; border-radius: 14px; font-size: 14px;
  line-height: 1.68; white-space: pre-wrap; word-break: break-word;
}
.msg.bot .bubble { background: #fff; border: 1px solid var(--line); border-top-left-radius: 4px; }
.msg.user { flex-direction: row-reverse; }
.msg.user .bubble { background: linear-gradient(135deg, #C32C26, #96150F); color: #fff; border-top-right-radius: 4px; }
.chat-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(58px + env(safe-area-inset-bottom));
  width: 100%; max-width: 560px; display: flex; gap: 8px; padding: 9px 12px;
  background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line); z-index: 55;
  backdrop-filter: blur(10px);
}
.chat-bar input { flex: 1; border: 1px solid var(--line); background: #F8F6F2; border-radius: 22px; padding: 10px 15px; outline: none; }
.chat-bar input:focus { border-color: #D8A9A6; background: #fff; }
.send-btn {
  flex: none; width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, #C32C26, #96150F); display: flex; align-items: center; justify-content: center;
}
.send-btn svg { width: 19px; height: 19px; stroke: #fff; fill: none; stroke-width: 2; }
.send-btn[disabled] { opacity: .5; }

/* ---------- 其它 ---------- */
.empty { text-align: center; padding: 30px 10px; color: var(--ink-3); font-size: 13px; }
.empty .ico { font-size: 30px; display: block; margin-bottom: 8px; opacity: .5; }
.toast {
  position: fixed; left: 50%; top: 46%; transform: translate(-50%, -50%);
  background: rgba(29, 33, 41, .9); color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 13.5px; z-index: 200; max-width: 76%; text-align: center; line-height: 1.5;
  opacity: 0; pointer-events: none; transition: .2s;
}
.toast.show { opacity: 1; }
.loading { text-align: center; padding: 26px; color: var(--ink-3); font-size: 13px; }
.spin {
  width: 18px; height: 18px; border: 2px solid #E6E1D8; border-top-color: var(--brand);
  border-radius: 50%; animation: sp .8s linear infinite; display: inline-block; vertical-align: -3px; margin-right: 6px;
}
@keyframes sp { to { transform: rotate(360deg); } }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.foot-note { text-align: center; font-size: 11px; color: #B4B0A8; padding: 24px 16px 10px; line-height: 1.7; }
.rank-no {
  flex: none; width: 22px; height: 22px; border-radius: 7px; display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700; background: #F2EFE9; color: var(--ink-3);
}
.rank-no.top { background: linear-gradient(135deg, #D9A94A, #B5801C); color: #fff; }

/* ---------- 子页面顶栏 ---------- */
.subhead {
  position: sticky; top: 0; z-index: 40; color: #fff;
  padding: 13px 16px;
  background: linear-gradient(135deg, #B8241E 0%, #96150F 100%);
  box-shadow: 0 2px 10px rgba(150, 21, 15, .18);
}
.subhead-row { display: flex; align-items: center; gap: 8px; }
.subhead h1 { flex: 1; font-size: 16.5px; font-weight: 700; letter-spacing: .6px; text-align: center; }
.subhead .sub { display: block; font-size: 10.5px; font-weight: 400; opacity: .78; letter-spacing: 1px; margin-top: 1px; }
.back { flex: none; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; font-size: 22px; line-height: 1; color: #fff; opacity: .92; }
.back-slot { flex: none; width: 28px; }

/* ---------- 媒体选择 / 录音 ---------- */
.media-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mbtn {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px;
  background: #FBFAF8; border: 1px solid var(--line); border-radius: 12px; font-size: 11.5px; color: var(--ink-2);
}
.mbtn span:first-child { font-size: 17px; line-height: 1; }
.mbtn.rec { color: #C0271F; border-color: #F0CFCC; background: #FDF4F3; }
.picked { display: flex; align-items: center; gap: 8px; margin-top: 9px; font-size: 12px; color: var(--ink-2); background: #F7F5F1; padding: 8px 11px; border-radius: 10px; }
.picked .x { margin-left: auto; color: var(--ink-3); font-size: 15px; }
.recording { display: flex; align-items: center; gap: 8px; margin-top: 9px; font-size: 12.5px; color: #C0271F; }
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: #D93026; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* ---------- 评论 ---------- */
.cmt { display: flex; gap: 9px; padding: 11px 0; border-bottom: 1px solid #F6F3EE; }
.cmt:last-child { border-bottom: none; }
.cmt .avatar { width: 28px; height: 28px; font-size: 11.5px; }
.cmt-body b { font-size: 12.5px; font-weight: 600; }
.cmt-body p { font-size: 13.5px; color: var(--ink-2); margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.cmt-body span { font-size: 10.5px; color: var(--ink-3); }
.cmt-bar { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.cmt-bar input { flex: 1; border: 1px solid var(--line); background: #F8F6F2; border-radius: 10px; padding: 9px 12px; outline: none; }
.cmt-bar input:focus { border-color: #D8A9A6; background: #fff; }

/* ---------- 桌面适配 ---------- */
@media (min-width: 720px) {
  body { background: #EDEAE4; }
  .app { max-width: 760px; box-shadow: 0 0 40px rgba(0, 0, 0, .08); }
  .hero { padding: 30px 26px 22px; }
  .hero-title { font-size: 40px; }
  .wrap { padding: 0 24px; }
  .board-grid { grid-template-columns: repeat(4, 1fr); }
  .fab { right: max(24px, calc(50% - 356px)); }
  .chat-bar { max-width: 760px; }
  .tabbar { max-width: 760px; }
  .sheet { max-width: 760px; }
  .stat-grid { grid-template-columns: repeat(6, 1fr); }
}
