/* 论坛模块样式：首页版块行、主题列表、帖子页、BBCode 正文、编辑器、后台。只用 base.css 的变量和组件。 */

/* ---------- 首页：分组 + 版块行 ---------- */
.fgroup > .block-sub { margin: 0; }
.frow {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) 112px minmax(0, 270px); gap: 14px; align-items: center;
  padding: 12px 14px;
}
.node-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  border: 1px solid var(--line); border-radius: var(--r-block); color: var(--steel); background: var(--surface);
}
.node-icon svg { width: 22px; height: 22px; display: block; }
/* 跑道黄只用来标「有新回复」 */
.node-icon.is-new { background: var(--taxiway); border-color: #d99a14; color: var(--night); }
.frow-title { font-size: var(--fs-m); font-weight: 600; }
.frow-desc { margin: 2px 0 0; font-size: var(--fs-s); color: var(--ink-2); }
.frow-stats, .trow-stats { margin: 0; font-size: var(--fs-s); }
.frow-stats > div, .trow-stats > div { display: flex; justify-content: space-between; gap: 8px; }
.frow-stats dt, .trow-stats dt { color: var(--ink-3); }
.frow-stats dd, .trow-stats dd { margin: 0; text-align: right; color: var(--ink); font-weight: 500; }
.frow-last { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: var(--fs-s); }
.frow-last-text { min-width: 0; }
.frow-last-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 500; }
.frow-last-title:hover { color: var(--roundel); }
.frow-none { color: var(--ink-3); }
.frow-last .row-meta { display: flex; flex-wrap: wrap; gap: 0 10px; }

/* ---------- 版块页：筛选条 ---------- */
.tfilter { background: var(--surface-2); border-bottom: 1px solid var(--line-2); padding: 8px 14px; display: grid; gap: 6px; }
.tfilter-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tfilter-label { font-size: var(--fs-s); color: var(--ink-3); width: 2.6em; }
.chip {
  display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-tag);
  background: var(--surface); color: var(--ink-2); font-size: var(--fs-s);
}
.chip:hover { background: #fff; border-color: var(--steel-2); text-decoration: none; color: var(--ink); }
.chip[aria-current="true"] { background: var(--steel); border-color: var(--steel); color: #fff; }

/* ---------- 主题列表 ---------- */
.trow {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) 96px 148px; gap: 14px; align-items: center;
  padding: 10px 14px; border-top: 1px solid var(--line-2);
}
.trow:first-child { border-top: 0; }
.trow:hover { background: #fafbfc; }
/* 置顶：跑道黄竖条 */
.trow.is-sticky { background: #fffaf0; box-shadow: inset 3px 0 0 var(--taxiway); }
.trow-title { font-size: var(--fs); line-height: 1.5; overflow-wrap: anywhere; }
.trow-link { color: var(--ink); font-weight: 500; }
.trow-link:hover { color: var(--roundel); }
.trow-link:visited { color: var(--ink-2); }
.tflag { display: inline-flex; vertical-align: -2px; margin-right: 4px; }
.tflag svg { width: 15px; height: 15px; }
.tflag-sticky { color: #b07d0a; }
.tflag-lock { color: var(--ink-3); }
.trow-pages { margin-left: 8px; font-size: var(--fs-xs); display: inline-flex; gap: 4px; color: var(--ink-3); }
.trow-pages a { padding: 0 5px; border: 1px solid var(--line); border-radius: var(--r-tag); color: var(--ink-2); background: var(--surface); }
.trow-pages a:hover { background: var(--surface-2); text-decoration: none; }
.trow-meta { display: flex; flex-wrap: wrap; gap: 0 14px; font-size: var(--fs-s); color: var(--ink-3); }
.trow-meta a { color: var(--ink-2); }
.trow-meta-stats { display: none; }
.trow-last { font-size: var(--fs-s); text-align: right; min-width: 0; display: grid; justify-items: end; }
.trow-last-time { color: var(--ink-2); }
.trow-last-user { color: var(--ink-3); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 帖子页 ---------- */
.thread-meta { display: flex; flex-wrap: wrap; gap: 2px 16px; margin-top: 6px; }
.thread-state { border: 1px solid var(--line); border-radius: var(--r-tag); padding: 0 6px; color: var(--ink-2); }
.thread-posts { display: grid; gap: var(--gap); margin-bottom: var(--gap); }
.thread-posts .post { margin-bottom: 0; }
.post { display: grid; grid-template-columns: 140px minmax(0, 1fr); }
.post:target { box-shadow: 0 0 0 2px var(--taxiway); }
.post-user { background: var(--surface-2); border-right: 1px solid var(--line-2); padding: 14px 10px; text-align: center; display: grid; justify-items: center; align-content: start; gap: 10px; }
.post-user-name { font-weight: 600; overflow-wrap: anywhere; }
.post-user-title { font-size: var(--fs-s); color: var(--ink-2); margin-top: 2px; }
.post-user-stat { font-size: var(--fs-xs); color: var(--ink-3); margin-top: 2px; }
.post-main { min-width: 0; display: flex; flex-direction: column; }
.post-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 16px; border-bottom: 1px solid var(--line-2); font-size: var(--fs-s); color: var(--ink-3); }
.post-no { color: var(--ink-3); font-weight: 500; }
.post-body { padding: 14px 16px; max-width: 752px; flex: 1; }
.post-edited { margin: 0; padding: 0 16px 10px; font-size: var(--fs-xs); color: var(--ink-3); }
.post-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line-2); padding: 4px 10px 4px 16px; font-size: var(--fs-s); min-height: 36px; }
.post-foot-r { display: flex; gap: 2px; align-items: center; margin-left: auto; }
.post-act-form { margin: 0; display: inline; }
.post-act {
  background: none; border: 0; padding: 4px 8px; color: var(--ink-2); cursor: pointer; font-size: var(--fs-s); border-radius: var(--r-btn);
}
.post-act:hover { color: var(--roundel); background: var(--surface-2); text-decoration: none; }
button.post-act:hover { color: var(--danger); }
.mod-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mod-row form { margin: 0; display: flex; gap: 8px; }
.mod-move select { height: 34px; border: 1px solid var(--line); border-radius: var(--r-btn); background: var(--surface); padding: 0 8px; max-width: 220px; }

/* ---------- BBCode 正文 ---------- */
.bb { overflow-wrap: anywhere; line-height: 1.75; }
.bb a { text-decoration: underline; text-decoration-color: rgba(31, 111, 178, .4); text-underline-offset: 2px; }
.bb a:hover { text-decoration-color: currentColor; }
.bb-img { max-width: 100%; height: auto; border-radius: var(--r-btn); margin: 4px 0; vertical-align: bottom; }
.bb-size-1 { font-size: 11px; } .bb-size-2 { font-size: 13px; } .bb-size-3 { font-size: 15px; }
.bb-size-4 { font-size: 18px; } .bb-size-5 { font-size: 22px; line-height: 1.4; }
.bb-size-6 { font-size: 26px; line-height: 1.35; } .bb-size-7 { font-size: 32px; line-height: 1.3; }
.bb-align-center { text-align: center; } .bb-align-left { text-align: left; } .bb-align-right { text-align: right; }
.bb-list { margin: 6px 0; padding-left: 1.5em; }
.bb-mention { font-weight: 500; text-decoration: none !important; background: rgba(31, 111, 178, .1); border-radius: var(--r-tag); padding: 0 3px; }
.bb-quote { margin: 10px 0; padding: 8px 12px; background: var(--surface-2); border-left: 3px solid var(--steel-2); border-radius: 0 var(--r-btn) var(--r-btn) 0; color: var(--ink-2); font-size: var(--fs-s); line-height: 1.65; }
.bb-quote .bb-quote { background: var(--surface); }
.bb-quote-head { font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.bb-quote-head a { text-decoration: none; color: inherit; }
.bb-code {
  margin: 10px 0; padding: 10px 12px; background: var(--night); color: #e6edf3; border-radius: var(--r-btn);
  overflow-x: auto; white-space: pre; tab-size: 4; font-size: 13px; line-height: 1.55;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace; overflow-wrap: normal;
}
.bb-code code { font: inherit; }
.bb-spoiler { margin: 10px 0; border: 1px solid var(--line); border-radius: var(--r-btn); background: var(--surface); }
.bb-spoiler > summary { cursor: pointer; padding: 6px 12px; background: var(--surface-2); color: var(--ink-2); font-size: var(--fs-s); }
.bb-spoiler[open] > summary { border-bottom: 1px solid var(--line-2); }
.bb-spoiler-body { padding: 8px 12px; }

/* ---------- 发帖与编辑页 ---------- */
.compose-form.form { max-width: 920px; }
.compose-form textarea { min-height: 220px; }
.compose-form select { width: auto; min-width: 200px; }
.compose-form .form-hint { margin-top: 4px; }
#quick-reply textarea { min-height: 140px; }

/* ---------- 编辑器（editor.js 增强出来的） ---------- */
.ed { border: 1px solid var(--line); border-radius: var(--r-btn); background: var(--surface); }
.ed:focus-within { border-color: var(--roundel); box-shadow: var(--focus); }
.ed-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px; background: var(--surface-2); border-bottom: 1px solid var(--line-2); border-radius: var(--r-btn) var(--r-btn) 0 0; }
.ed-btn {
  min-width: 32px; height: 30px; padding: 0 8px; border: 1px solid transparent; border-radius: var(--r-btn); background: none;
  color: var(--ink-2); cursor: pointer; font-size: var(--fs-s); line-height: 1;
}
.ed-btn:hover { background: var(--surface); border-color: var(--line); color: var(--ink); }
.ed-btn[aria-pressed="true"] { background: var(--steel); color: #fff; }
.ed-btn:focus-visible { outline: none; box-shadow: var(--focus); }
.ed-sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.ed-spacer { flex: 1; }
.ed textarea, .form .ed textarea { border: 0 !important; border-radius: 0 0 var(--r-btn) var(--r-btn); box-shadow: none !important; display: block; width: 100%; }
.ed-preview { padding: 12px 14px; min-height: 160px; }
.ed-preview[hidden] { display: none; }
.ed-status { padding: 4px 10px; font-size: var(--fs-xs); color: var(--ink-3); border-top: 1px solid var(--line-2); min-height: 24px; }
.ed-status:empty { display: none; }
.ed-status.is-error { color: var(--danger); }
.ed.is-drag { border-color: var(--roundel); background: rgba(31, 111, 178, .06); }

/* ---------- 侧栏小部件 ---------- */
.side-latest .row { padding: 8px 0; gap: 8px; align-items: flex-start; border-top: 1px solid var(--line-2); }
.side .side-latest { padding: 0 12px; }
.side-latest-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink); line-height: 1.4; }
.side-latest-title:hover { color: var(--roundel); }
.side .block-head .block-head-aside { color: var(--ink-3); }
.side .block-head .block-head-aside:hover { color: var(--roundel); }

/* ---------- 后台 ---------- */
.admin-edit > summary { cursor: pointer; padding: 8px 14px; color: var(--roundel); font-size: var(--fs-s); }
.admin-edit[open] > summary { border-bottom: 1px solid var(--line-2); margin-bottom: 12px; }
.admin-edit-body { padding: 0 14px 14px; display: grid; gap: 10px; }
.admin-new { border-top: 1px solid var(--line-2); background: var(--surface-2); }
.admin-node { display: block; padding: 0; }
.admin-node-line { padding: 10px 14px 0; }
.admin-node .admin-edit > summary { padding-left: 14px; }
.admin-form { max-width: 560px; }
.admin-prefixes { border: 1px solid var(--line); border-radius: var(--r-btn); padding: 8px 12px; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.admin-prefixes legend { padding: 0 6px; font-weight: 500; }
.admin-prefix { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.admin-prefix form { margin: 0; }
.admin-prefix-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.admin-prefix-form .input { width: 180px; }
.admin-prefix-form .select { width: 90px; }
.admin-prefix-form .admin-sort { width: 80px; }
.admin-prefix-preview { min-width: 90px; }
.admin-prefix .row-meta { margin-right: auto; }

/* ---------- 窄屏 ---------- */
@media (max-width: 767px) {
  .frow { grid-template-columns: 36px minmax(0, 1fr); gap: 4px 12px; align-items: start; }
  .frow-stats { display: none; }
  .frow-last { grid-column: 2; margin-top: 4px; }
  .frow-title { font-size: var(--fs); }
  .trow { grid-template-columns: 36px minmax(0, 1fr); gap: 12px; align-items: start; }
  .trow-stats, .trow-last { display: none; }
  .trow-meta-stats { display: inline; }
  .tfilter-label { width: 100%; }

  .post { grid-template-columns: minmax(0, 1fr); }
  .post-user { grid-template-columns: 36px 1fr; justify-items: start; align-items: center; gap: 10px; border-right: 0; border-bottom: 1px solid var(--line-2); padding: 8px 12px; text-align: left; }
  .post-user .avatar { width: 36px; height: 36px; font-size: 16px; }
  .post-user-info { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; }
  .post-user-title, .post-user-stat { margin: 0; }
  .post-head, .post-body, .post-foot { padding-left: 12px; }
  .post-body { padding-right: 12px; }
  .post-edited { padding-left: 12px; }
  .mod-row form { flex-wrap: wrap; }
  .admin-prefix-form .input { width: 100%; }
}
