/* ============ 稻米之家 主题 ============ */
:root {
  --bg: #f5f0e6;
  --card: #fffdf8;
  --ink: #24302a;
  --ink-soft: #55604f;
  --primary: #2f5d44;
  --primary-dark: #244a35;
  --accent: #b08a4e;
  --accent-soft: #e9d9bc;
  --seal: #a63d2f;
  --line: #e3d9c6;
  --muted: #8a8374;
  --shadow: 0 1px 3px rgba(60, 50, 30, .08), 0 4px 14px rgba(60, 50, 30, .06);
  --radius: 12px;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", STSong, SimSun, serif;
  --sans: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); line-height: 1.6; font-size: 15px;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 700; line-height: 1.3; margin: 0 0 .5em; }
img { max-width: 100%; }
code { background: #f0ead9; padding: 2px 6px; border-radius: 6px; font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hidden { display: none !important; }
.empty { color: var(--muted); text-align: center; padding: 28px 10px; }

/* ---------- 顶栏 ---------- */
.topbar {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary) 60%, #3d6b4e);
  color: #f6f1e4; position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow);
}
.topbar-inner {
  max-width: 1120px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 8px; color: #f6f1e4; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 34px; height: 34px; display: block; }
.brand-logo.lg { width: 72px; height: 72px; }
.brand-name { font-family: var(--serif); font-size: 21px; letter-spacing: 2px; font-weight: 700; }
.main-nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.main-nav a {
  color: #e8e2d2; padding: 6px 12px; border-radius: 8px; font-size: 14.5px;
}
.main-nav a:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.main-nav a.on { background: rgba(255,255,255,.18); color: #fff; }
.user-actions { display: flex; align-items: center; gap: 12px; }
.user-actions .bell { position: relative; color: #f6f1e4; font-size: 14px; }
.badge {
  background: var(--seal); color: #fff; font-size: 11px; border-radius: 10px;
  padding: 1px 7px; margin-left: 4px; vertical-align: 1px;
}
.uname { display: flex; align-items: center; gap: 6px; color: #f6f1e4; font-size: 14px; }
.mini-avatar { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; vertical-align: -5px; margin-right: 3px; }
.inline { display: inline; }
.inline-form, .grid-form, .inline-search { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- 容器 ---------- */
.container { max-width: 1120px; margin: 0 auto; padding: 18px 16px 40px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head h3 { margin: 0; font-size: 17px; color: var(--primary-dark); }

/* ---------- 按钮 / 标签 ---------- */
.btn {
  display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 7px 16px; border-radius: 9px; font-size: 14px; cursor: pointer;
  font-family: var(--sans); transition: all .15s; text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(.96); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--seal); border-color: var(--seal); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-ghost.active { background: var(--accent-soft); border-color: var(--accent); color: #7a5a24; }
.btn-block { width: 100%; }
.btn-sm { padding: 4px 10px; font-size: 13px; border-radius: 7px; }
.link-btn {
  background: none; border: none; color: var(--primary); cursor: pointer;
  font-size: 13px; padding: 0; font-family: var(--sans);
}
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--seal); }
.tag {
  display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 8px;
  margin-right: 5px; vertical-align: 2px; font-weight: 600;
}
.tag-pin { background: #3d5a44; color: #fff; }
.tag-hot { background: var(--seal); color: #fff; }
.tag-del { background: #b0aaa0; color: #fff; }
.role-badge {
  display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 8px;
  margin-left: 5px; vertical-align: 1px; font-weight: 600;
}
.r-super_admin { background: #5c3a21; color: #ffe1b3; }
.r-admin { background: #244a66; color: #d5ecff; }
.r-moderator { background: #6b5a2c; color: #fff0c2; }

/* ---------- 登录页 ---------- */
.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background:
  radial-gradient(1200px 600px at 20% -10%, #3d6b4e55, transparent),
  radial-gradient(900px 500px at 110% 110%, #b08a4e33, transparent), var(--bg); }
.auth-wrap {
  width: min(920px, 94vw); display: grid; grid-template-columns: 1.1fr 1fr;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  overflow: hidden; box-shadow: 0 20px 50px rgba(60,50,30,.18);
}
.auth-brand {
  background: linear-gradient(150deg, var(--primary-dark), var(--primary));
  color: #f6f1e4; padding: 44px 38px; display: flex; align-items: center;
}
.auth-brand-inner { text-align: center; width: 100%; }
.auth-title { font-size: 34px; letter-spacing: 8px; margin: 10px 0 8px; }
.auth-slogan { font-family: var(--serif); font-size: 18px; color: var(--accent-soft); margin-bottom: 22px; }
.auth-desc { font-size: 13.5px; line-height: 2; color: #d8d2c0; }
.auth-card { padding: 34px 30px; }
.auth-tip { margin-top: 14px; font-size: 12.5px; color: var(--muted); text-align: center; }
.tabs { display: flex; gap: 6px; margin-bottom: 18px; background: #f2ecdd; border-radius: 10px; padding: 4px; }
.tab {
  flex: 1; text-align: center; padding: 8px 0; border-radius: 8px; cursor: pointer;
  border: none; background: transparent; font-size: 15px; font-family: var(--serif);
  color: var(--ink-soft); letter-spacing: 4px;
}
.tab.on { background: var(--card); box-shadow: 0 1px 4px rgba(0,0,0,.08); color: var(--primary); font-weight: 700; }
.tab-panel { }
.tab-panel.hidden { display: none; }

/* ---------- 表单 ---------- */
.form { display: flex; flex-direction: column; gap: 13px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 13px; color: var(--ink-soft); }
input, select, textarea {
  font-family: var(--sans); font-size: 14.5px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px;
  background: #fff; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; }
select { width: auto; }
input[type="file"] { padding: 6px; }

/* ---------- 首页 hero ---------- */
.hero {
  text-align: center; padding: 46px 16px 30px;
  background:
    radial-gradient(700px 240px at 50% 0%, #b08a4e22, transparent);
}
.hero-title { font-size: clamp(26px, 5vw, 40px); color: var(--primary-dark); letter-spacing: 3px; margin-bottom: 8px; }
.hero-sub { color: var(--muted); margin-bottom: 22px; }
.hero-search { display: flex; gap: 8px; max-width: 560px; margin: 0 auto; }
.hero-search input { flex: 1; padding: 11px 14px; font-size: 15px; }

/* ---------- 板块树 ---------- */
.sec-tree { display: flex; flex-direction: column; gap: 12px; }
.sec-cat { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fffbf3; }
.sec-cat-head { display: flex; align-items: baseline; gap: 10px; padding: 11px 14px; background: #f6efdd; }
.sec-cat-name { font-family: var(--serif); font-size: 16.5px; font-weight: 700; color: var(--primary-dark); }
.sec-desc { color: var(--muted); font-size: 12.5px; }
.sec-cat-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; padding: 10px; }
.sec-board {
  display: flex; align-items: center; gap: 8px; padding: 10px 13px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff;
  transition: all .15s;
}
.sec-board:hover { border-color: var(--accent); box-shadow: var(--shadow); text-decoration: none; transform: translateY(-1px); }
.sec-board-name { font-weight: 600; color: var(--ink); }
.sec-board-meta { margin-left: auto; color: var(--muted); font-size: 12px; }
.rules-board { background: #faf3e4; }

/* ---------- 帖子卡片 ---------- */
.feed { display: flex; flex-direction: column; }
.post-card {
  display: flex; padding: 12px 4px; border-bottom: 1px solid #eee6d5; gap: 10px;
}
.post-card:last-child { border-bottom: none; }
.post-card-main { flex: 1; min-width: 0; }
.post-card-title { margin-bottom: 4px; }
.title-link { color: var(--ink); font-size: 15.5px; font-weight: 600; word-break: break-word; }
.title-link:hover { color: var(--primary); }
.post-card-sub { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 12.5px; }
.post-card.post-pinned { background: #faf5e8; border-radius: 8px; padding: 10px 8px; }
.post-deleted .title-link { color: #a39b8a; text-decoration: line-through; }
.stat { white-space: nowrap; }

/* ---------- 板块 / 面包屑 ---------- */
.crumbs { font-size: 13px; margin: 4px 2px 12px; color: var(--muted); }
.crumbs a { color: var(--primary); }
.crumb-sep { margin: 0 6px; color: #c9c0ab; }
.section-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.section-head-main h2 { margin-bottom: 2px; }
.section-head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.child-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.child-board {
  display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line);
  border-radius: 10px; padding: 14px 16px; background: #fffbf3;
}
.child-board:hover { border-color: var(--accent); box-shadow: var(--shadow); text-decoration: none; }
.child-name { font-family: var(--serif); font-weight: 700; font-size: 16px; color: var(--primary-dark); }
.child-desc { font-size: 12.5px; color: var(--muted); min-height: 2.4em; }
.child-meta { font-size: 12px; color: var(--accent); }

/* ---------- 帖子详情 ---------- */
.post-view { padding: 22px 24px; }
.banner-warn {
  background: #f8e8e0; color: #8a3a2a; border: 1px solid #ecc6b8; border-radius: 9px;
  padding: 9px 14px; font-size: 13.5px; margin-bottom: 14px;
}
.post-title { font-size: 24px; margin-bottom: 8px; }
.post-meta { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 16px; }
.post-meta .author b { color: var(--ink); }
.post-content { white-space: pre-wrap; word-break: break-word; font-size: 15.5px; line-height: 1.85; }
.post-images { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.post-images img { max-height: 320px; border-radius: 10px; border: 1px solid var(--line); object-fit: cover; }
.post-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 20px; border-top: 1px dashed var(--line); padding-top: 14px; }

/* ---------- 回复 ---------- */
.reply-item { padding: 13px 4px; border-bottom: 1px solid #eee6d5; }
.reply-head { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; }
.reply-head .author b { font-size: 14px; }
.reply-ref { font-size: 12.5px; color: var(--muted); background: #f6f1e4; border-radius: 6px; padding: 2px 9px; display: inline-block; margin-bottom: 5px; }
.reply-body { white-space: pre-wrap; word-break: break-word; font-size: 14.5px; }
.reply-actions { display: flex; gap: 12px; margin-top: 6px; }
.reply-box-title { margin-bottom: 10px; font-size: 16px; }
.quote-hint { background: var(--accent-soft); border-radius: 8px; padding: 6px 12px; font-size: 13px; margin-bottom: 8px; }
.reply-actions-bar { display: flex; justify-content: flex-end; margin-top: 8px; }

/* ---------- 加载更多 ---------- */
.load-more { text-align: center; padding: 12px 0 4px; color: var(--muted); font-size: 13px; cursor: pointer; }

/* ---------- 个人空间 ---------- */
.profile-head { display: flex; gap: 16px; align-items: center; }
.profile-avatar img, .profile-avatar .avatar-placeholder {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
  background: var(--accent-soft); display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: var(--accent); font-family: var(--serif);
}
.me-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.me-tabs .tab { flex: none; padding: 8px 16px; }
.mini-row { padding: 11px 4px; border-bottom: 1px solid #eee6d5; }
.mini-title { font-size: 14px; }
.mini-body { color: var(--ink-soft); font-size: 13.5px; margin-top: 2px; word-break: break-word; }
.mini-meta { color: var(--muted); font-size: 12px; margin-left: 8px; }
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.profile-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.invite-code-box { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.invite-code-box code { font-size: 16px; letter-spacing: 1px; }

/* ---------- 消息 ---------- */
.msg-group { margin-bottom: 18px; }
.msg-group-title { font-size: 14.5px; color: var(--primary-dark); border-left: 4px solid var(--accent); padding-left: 10px; margin-bottom: 8px; }
.msg-item { border: 1px solid var(--line); border-radius: 9px; padding: 10px 13px; margin-bottom: 8px; background: #fffbf3; }
.msg-item.unread { border-color: var(--accent); }
.msg-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; font-size: 14px; }
.msg-body { font-size: 13.5px; color: var(--ink-soft); white-space: pre-wrap; word-break: break-word; }

/* ---------- 管理后台 ---------- */
.admin-layout { display: grid; grid-template-columns: 180px 1fr; gap: 16px; align-items: start; }
.admin-nav { padding: 14px; position: sticky; top: 70px; }
.admin-nav h4 { margin: 0 0 10px; color: var(--primary-dark); }
.admin-nav a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--ink-soft); font-size: 14px; margin-bottom: 2px; }
.admin-nav a:hover { background: #f2ecdd; text-decoration: none; }
.admin-nav a.on { background: var(--primary); color: #fff; }
.admin-main { min-width: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; text-align: center; }
.stat-card b { display: block; font-size: 26px; color: var(--primary); font-family: var(--serif); }
.stat-card span { color: var(--muted); font-size: 13px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { border-bottom: 1px solid #eee6d5; padding: 8px 10px; text-align: left; vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; background: #faf6ea; }
.op-cells { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.seg { display: flex; gap: 4px; background: #f2ecdd; border-radius: 8px; padding: 3px; }
.seg a { padding: 5px 12px; border-radius: 7px; font-size: 13px; color: var(--ink-soft); }
.seg a.on { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.report-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.report-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.report-reason { margin: 6px 0 2px; font-size: 14px; }
.report-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.report-form select, .report-form input { width: auto; flex: 1; min-width: 120px; }
.section-admin-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.sec-adm-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.sec-adm-mods { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.word-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.word-chip { background: #f2ecdd; border-radius: 8px; padding: 4px 10px; font-size: 13.5px; display: inline-flex; gap: 6px; align-items: center; }
.user-msg-list { display: flex; flex-direction: column; gap: 8px; }
.user-msg-item { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.user-msg-item .inline-form { flex: 1; }

/* ---------- Toast / Flash ---------- */
.toast {
  position: fixed; top: 68px; left: 50%; transform: translateX(-50%);
  background: #24302a; color: #fff; padding: 10px 20px; border-radius: 10px;
  font-size: 14px; z-index: 99; opacity: 0; pointer-events: none;
  transition: opacity .25s; max-width: 86vw; box-shadow: 0 6px 24px rgba(0,0,0,.25);
}
.toast.show { opacity: 1; }
.toast.err { background: var(--seal); }
.flash-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.flash { border-radius: 9px; padding: 9px 14px; font-size: 14px; border: 1px solid; }
.flash-ok { background: #e8f2e4; border-color: #bcd8b2; color: #2f5d44; }
.flash-err { background: #f8e8e0; border-color: #ecc6b8; color: #8a3a2a; }

/* ---------- 上传预览 ---------- */
.upload-previews { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.upload-previews .up-item { position: relative; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; width: 110px; height: 110px; background: #faf6ea; }
.upload-previews .up-item img { width: 100%; height: 100%; object-fit: cover; }
.upload-previews .up-item .up-del {
  position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.55); color: #fff;
  border: none; border-radius: 50%; width: 20px; height: 20px; cursor: pointer; font-size: 12px; line-height: 1;
}
.upload-previews .up-item .up-name { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(0,0,0,.5); color: #fff; font-size: 10px; padding: 2px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 页脚 / 错误 ---------- */
.footer { text-align: center; padding: 26px 16px 40px; border-top: 1px solid var(--line); }
.footer-slogan { font-family: var(--serif); color: var(--primary-dark); letter-spacing: 2px; margin-bottom: 4px; }
.error-card { text-align: center; padding: 60px 20px; }
.error-code { font-size: 64px; color: var(--accent); font-family: var(--serif); margin: 0; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-brand { padding: 26px 20px; }
  .auth-card { padding: 24px 20px; }
  .topbar-inner { gap: 10px; }
  .main-nav { order: 3; flex-basis: 100%; justify-content: space-between; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-nav { position: static; display: flex; flex-wrap: wrap; gap: 6px; }
  .admin-nav a { display: inline-block; padding: 6px 10px; }
  .admin-nav h4 { display: none; }
  .hero { padding: 30px 8px 20px; }
  .section-head { flex-direction: column; }
  .post-view { padding: 16px 14px; }
  .post-title { font-size: 19px; }
  .post-actions .btn { font-size: 13px; padding: 6px 10px; }
}
