/* ============================================================
   2047STUDIO Forum — community stylesheet
   Reuses design tokens from style.css (loaded on every forum page)
   ============================================================ */

/* ---------- page shell ---------- */
.frm-main { min-height: calc(100dvh - var(--header-h)); }

/* 顶部细工具条：右对齐「发表新帖」（页头已下线，顶部导航高亮作为页面标识） */
.frm-topbar { display: flex; align-items: center; justify-content: flex-end; margin-bottom: 18px; }

.frm-section { padding: calc(var(--header-h) + clamp(20px, 3.5vw, 36px)) 0 72px; }
.frm-grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: start; }
@media (max-width: 900px) { .frm-grid-2 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- generic card ---------- */
.frm-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); }
.frm-card-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.frm-card-head h2, .frm-card-head h3 { font-size: 1.03rem; }
.frm-card-head .sp { flex: 1; }
.frm-card-body { padding: 22px; }

/* ---------- board grid ---------- */
.board-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 640px) { .board-grid { grid-template-columns: minmax(0, 1fr); } }
.board-card {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 22px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius-lg); transition: all .25s var(--ease);
}
.board-card:hover { border-color: var(--ink); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.board-card .bc-ic {
  flex: none; width: 52px; height: 52px; border-radius: 14px;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent);
}
.board-card .bc-ic svg { width: 26px; height: 26px; }
.board-card .bc-main { flex: 1; min-width: 0; }
.board-card .bc-main b { display: block; font-size: 1.02rem; font-weight: 650; }
.board-card .bc-main span { display: block; color: var(--muted); font-size: .9rem; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-card .bc-meta { flex: none; text-align: right; }
.board-card .bc-meta b { display: block; font-size: 1.1rem; font-weight: 750; }
.board-card .bc-meta span { font-size: .8rem; color: var(--muted); }

/* ---------- thread list ---------- */
.thread-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.thread-item {
  display: flex; gap: 16px; padding: 18px 22px;
  border-bottom: 1px solid var(--line); align-items: center;
  transition: background .18s var(--ease);
}
.thread-item:last-child { border-bottom: 0; }
.thread-item:hover { background: var(--bg-soft); }
.thread-item .ti-cover {
  flex: none; width: 64px; height: 64px; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--line); background: var(--bg-soft);
}
.thread-item .ti-cover img { width: 100%; height: 100%; object-fit: contain; }
.thread-item .ti-cover { cursor: zoom-in; }
.thread-item .ti-ic {
  flex: none; width: 64px; height: 64px; border-radius: 12px;
  display: grid; place-items: center; background: var(--bg-soft); color: var(--muted);
}
.thread-item .ti-ic svg { width: 28px; height: 28px; }
.thread-item .ti-main { flex: 1; min-width: 0; }
.thread-item .ti-title {
  font-weight: 600; font-size: 1rem; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.thread-item .ti-title:hover { color: var(--accent); }
.thread-item .ti-meta { display: flex; align-items: center; gap: 12px; margin-top: 7px; color: var(--muted); font-size: .84rem; flex-wrap: wrap; }
.thread-item .ti-meta .dot::before { content: "·"; margin-right: 12px; color: var(--line); }
.thread-item .ti-stats { flex: none; text-align: right; color: var(--muted); font-size: .82rem; line-height: 1.9; }
.thread-item .ti-stats b { color: var(--ink); font-weight: 650; }
@media (max-width: 640px) {
  .thread-item { padding: 14px 16px; gap: 12px; }
  .thread-item .ti-cover, .thread-item .ti-ic { width: 48px; height: 48px; border-radius: 10px; }
  .thread-item .ti-stats { display: none; }
}

/* ---------- badges / tags ---------- */
.frm-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: .76rem; font-weight: 600; letter-spacing: .02em;
}
.frm-tag--soft { background: var(--bg-soft); color: var(--muted); }

/* ---------- avatars ---------- */
.avt { border-radius: 50%; overflow: hidden; flex: none; display: grid; place-items: center; color: #fff; font-weight: 700; }
.avt img { width: 100%; height: 100%; object-fit: cover; }
.avt--s { width: 30px; height: 30px; font-size: .78rem; }
.avt--m { width: 42px; height: 42px; font-size: 1rem; }
.avt--l { width: 76px; height: 76px; font-size: 1.7rem; }
.avt--xl { width: 108px; height: 108px; font-size: 2.4rem; }

/* ---------- post (thread view) ---------- */
.post { padding: 22px; }
.post + .post { border-top: 1px solid var(--line); }
.post-head { display: flex; align-items: center; gap: 12px; }
.post-head .ph-main { flex: 1; min-width: 0; }
.post-head .ph-name { font-weight: 650; font-size: .95rem; }
.post-head .ph-name a:hover { color: var(--accent); }
.post-head .ph-time { color: var(--muted); font-size: .8rem; }
.post-body { margin-top: 14px; font-size: .98rem; line-height: 1.8; word-wrap: break-word; white-space: pre-wrap; }
.post-imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 14px; }
.post-imgs .pi {
  border-radius: 10px; overflow: hidden; border: 1px solid var(--line);
  cursor: zoom-in; background: var(--bg-soft); aspect-ratio: 4 / 3;
}
.post-imgs .pi img { width: 100%; height: 100%; object-fit: contain; }
.post-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.post-foot .sp { flex: 1; }
.post-idx { flex: none; color: var(--muted); font-size: .82rem; font-weight: 600; min-width: 42px; }

/* ---------- editor / composer ---------- */
.frm-editor { border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; overflow: hidden; }
.frm-editor textarea {
  width: 100%; border: 0; outline: none; resize: vertical;
  min-height: 120px; padding: 16px 18px; font-size: .98rem; line-height: 1.75;
  background: transparent;
}
.frm-field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.frm-field label { font-size: .86rem; font-weight: 600; color: var(--ink-soft); }
.frm-input, .frm-select {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; outline: none; font-size: .98rem; transition: border-color .2s;
}
.frm-input:focus, .frm-select:focus, .frm-editor:focus-within { border-color: var(--ink); }
.frm-editor-bar { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--bg-soft); flex-wrap: wrap; }
.frm-editor-bar .sp { flex: 1; }
.frm-imgbtn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  font-size: .88rem; font-weight: 600; cursor: pointer; transition: all .2s;
}
.frm-imgbtn:hover { border-color: var(--ink); }
.frm-imgbtn svg { width: 17px; height: 17px; }
.frm-imgbtn input { display: none; }

/* image previews in composer */
.img-drop { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; padding: 0 14px 14px; }
.img-drop:empty { display: none; }
.img-cell { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--bg-soft); }
.img-cell img { width: 100%; height: 100%; object-fit: cover; }
.img-cell .rm {
  position: absolute; top: 4px; right: 4px; width: 26px; height: 26px;
  border-radius: 50%; background: rgba(16,18,20,.72); color: #fff;
  display: grid; place-items: center; font-size: 14px; line-height: 1; cursor: pointer;
}
.img-cell.is-up::after {
  content: "…"; position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(255,255,255,.6); font-size: 22px; font-weight: 700; color: var(--ink);
}
.img-cell.is-err { outline: 2px solid #d33; }
.img-note { padding: 0 14px; margin: -2px 0 12px; color: var(--muted); font-size: .8rem; }

/* ---------- buttons ---------- */
.frm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: 8px; font-size: .92rem; font-weight: 600;
  transition: all .22s var(--ease); cursor: pointer; border: 1px solid transparent; white-space: nowrap;
}
.frm-btn svg { width: 18px; height: 18px; flex: none; }
.frm-btn--primary { background: var(--ink); color: #fff; }
.frm-btn--primary:hover { background: #000; }
.frm-btn--primary:disabled { opacity: .45; cursor: not-allowed; }
.frm-btn--ghost { border-color: var(--line); background: #fff; color: var(--ink); }
.frm-btn--ghost:hover { border-color: var(--ink); }
.frm-btn--danger { border-color: #e5c7c7; background: #fff; color: #b03636; }
.frm-btn--danger:hover { border-color: #b03636; background: #fdf6f6; }
.frm-btn--sm { padding: 7px 14px; font-size: .84rem; }
.frm-btn--block { width: 100%; }

/* ---------- lightbox（旧论坛简易灯箱已移除，全站统一用 assets/js/lightbox.js + style.css .nxlb） ---------- */

/* ---------- empty / loading ---------- */
.frm-empty { padding: 56px 24px; text-align: center; color: var(--muted); }
.frm-empty svg { width: 44px; height: 44px; margin: 0 auto 14px; color: var(--line); display: block; }
.frm-loading { padding: 40px; text-align: center; color: var(--muted); font-size: .9rem; }
.frm-more { display: flex; justify-content: center; padding: 18px; border-top: 1px solid var(--line); }

/* ---------- toast ---------- */
.frm-toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%) translateY(8px);
  background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 999px;
  font-size: .9rem; z-index: 90; opacity: 0; pointer-events: none;
  transition: all .3s var(--ease); max-width: min(86vw, 560px); text-align: center;
}
.frm-toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- header user chip ---------- */
.frm-userchip { position: relative; }
.frm-userchip .uc-btn {
  display: flex; align-items: center; gap: 9px; padding: 4px 6px; border-radius: 999px;
  transition: background .2s; cursor: pointer; min-height: 44px;
}
.frm-userchip .uc-btn:hover { background: var(--bg-soft); }
.frm-userchip .uc-badge {
  position: absolute; top: 0; right: 0; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: #e5484d; color: #fff; font-size: .68rem; font-weight: 700;
  display: grid; place-items: center; line-height: 1;
}
.frm-userchip .uc-menu {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 200px; z-index: 40;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-md); padding: 8px; display: none;
}
.frm-userchip.is-open .uc-menu { display: block; }
.frm-userchip .uc-menu a, .frm-userchip .uc-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 11px 12px; border-radius: 8px; font-size: .92rem; cursor: pointer;
}
.frm-userchip .uc-menu a:hover, .frm-userchip .uc-menu button:hover { background: var(--bg-soft); }
.frm-userchip .uc-menu svg { width: 17px; height: 17px; color: var(--muted); }
.frm-userchip .uc-menu .uc-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.frm-userchip .uc-menu .uc-n { margin-left: auto; background: #e5484d; color: #fff; border-radius: 999px; font-size: .7rem; font-weight: 700; padding: 1px 7px; }
.frm-login-link { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: .93rem; padding: 11px 4px; white-space: nowrap; }
.frm-login-link svg { width: 20px; height: 20px; }
.frm-login-link:hover { color: var(--accent); }
.frm-login-link .fl-sm { display: none; }
@media (max-width: 640px) {
  .frm-login-link { gap: 5px; padding: 11px 2px; }
  .frm-login-link .fl-lg { display: none; }
  .frm-login-link .fl-sm { display: inline; }
}

/* ---------- auth page ---------- */
.frm-auth { max-width: 440px; margin: 0 auto; }
.frm-auth-tabs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; background: var(--bg-soft); border-radius: 10px; padding: 5px; margin-bottom: 24px; }
.frm-auth-tabs button {
  padding: 10px; border-radius: 7px; font-weight: 600; font-size: .95rem; color: var(--muted);
  transition: all .2s;
}
.frm-auth-tabs button.is-on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.frm-auth form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.frm-auth .hint { color: var(--muted); font-size: .82rem; }
.frm-auth .err { color: #b03636; font-size: .86rem; min-height: 1.2em; }

/* ---------- profile ---------- */
.prof-head { display: flex; gap: 22px; align-items: center; padding: 26px 22px; flex-wrap: wrap; }
.prof-head .ph-info { flex: 1; min-width: 220px; }
.prof-head .ph-info h1 { font-size: 1.4rem; }
.prof-head .ph-sub { color: var(--muted); font-size: .86rem; margin-top: 6px; }
.prof-head .ph-bio { margin-top: 10px; color: var(--ink-soft); font-size: .93rem; }
.prof-stats { display: flex; gap: 26px; margin-top: 12px; }
.prof-stats b { display: block; font-size: 1.15rem; font-weight: 750; }
.prof-stats span { color: var(--muted); font-size: .8rem; }
.prof-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); padding: 0 22px; }
.prof-tabs button {
  padding: 13px 14px; font-weight: 600; font-size: .93rem; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer;
}
.prof-tabs button.is-on { color: var(--ink); border-bottom-color: var(--ink); }
.prof-item { padding: 15px 22px; border-bottom: 1px solid var(--line); display: flex; gap: 14px; align-items: baseline; }
.prof-item:last-child { border-bottom: 0; }
.prof-item .pi-t { font-weight: 600; font-size: .94rem; color: var(--ink); }
.prof-item .pi-t:hover { color: var(--accent); }
.prof-item .pi-x { color: var(--muted); font-size: .86rem; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prof-item .pi-date { flex: none; color: var(--muted); font-size: .8rem; margin-left: auto; }

/* ---------- messages ---------- */
.msg-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: #fff; min-height: 560px; }
.msg-side { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.msg-side-head { padding: 16px 18px; border-bottom: 1px solid var(--line); font-weight: 650; }
.msg-list { flex: 1; overflow-y: auto; max-height: 640px; }
.msg-item {
  display: flex; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line);
  cursor: pointer; transition: background .18s; align-items: center;
}
.msg-item:hover { background: var(--bg-soft); }
.msg-item.is-on { background: var(--accent-soft); }
.msg-item .mi-main { flex: 1; min-width: 0; }
.msg-item .mi-name { font-weight: 600; font-size: .92rem; display: flex; align-items: center; gap: 8px; }
.msg-item .mi-last { color: var(--muted); font-size: .82rem; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-item .mi-side { flex: none; text-align: right; }
.msg-item .mi-time { color: var(--muted); font-size: .74rem; }
.msg-item .mi-n { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #e5484d; color: #fff; font-size: .7rem; font-weight: 700; margin-top: 5px; }
.msg-chat { display: flex; flex-direction: column; min-height: 0; }
.msg-chat-head { display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.msg-chat-head .sp { flex: 1; }
.msg-back { display: none; width: 40px; height: 40px; border-radius: 8px; place-items: center; }
.msg-back:hover { background: var(--bg-soft); }
.msg-back svg { width: 20px; height: 20px; }
.msg-body { flex: 1; overflow-y: auto; padding: 20px 18px; display: flex; flex-direction: column; gap: 12px; max-height: 520px; background: var(--bg-soft); }
.bubble { max-width: min(78%, 560px); padding: 11px 15px; border-radius: 14px; font-size: .93rem; line-height: 1.65; white-space: pre-wrap; word-wrap: break-word; }
.bubble .bt { display: block; font-size: .72rem; color: var(--muted); margin-top: 5px; }
.bubble--me { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.bubble--me .bt { color: rgba(255,255,255,.6); }
.bubble--you { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }

/* ---------- 气泡上的「翻译」按钮（站内消息翻译，免费） ---------- */
.bubble { position: relative; }
.bub-tr {
  display: inline-flex; align-items: center; gap: 4px; margin-left: 8px;
  padding: 2px 9px; border-radius: 999px; border: 1px solid currentColor;
  background: transparent; color: inherit; opacity: .55; cursor: pointer;
  font-size: .72rem; line-height: 1.7; vertical-align: middle; white-space: nowrap;
  transition: opacity .15s ease;
}
.bub-tr:hover { opacity: 1; }
.bub-tr:disabled { opacity: .4; cursor: default; }
.bubble--me .bub-tr { border-color: rgba(255, 255, 255, .7); }
.bubble--me .bub-tr:hover { background: rgba(255, 255, 255, .16); }
.bubble--you .bub-tr:hover { background: var(--bg-soft); }
.bub-out {
  margin-top: 8px; padding: 8px 11px; border-radius: 9px;
  background: var(--bg-soft); border-left: 3px solid var(--ink);
  font-size: .87rem; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word;
  color: inherit;
}
.bubble--me .bub-out { background: rgba(255, 255, 255, .14); border-left-color: #fff; }
.bub-out--err { background: #fdecec; border-left-color: #d93b3b; color: #a12727; }
.bub-out--same { background: var(--bg-soft); border-left-color: var(--muted); color: var(--muted); }
.bub-out-x {
  display: block; margin-top: 4px; padding: 0; border: 0; background: none;
  color: var(--muted); font-size: .74rem; cursor: pointer; text-decoration: underline;
}
.bub-out-x:hover { color: var(--ink); }
@media (max-width: 860px) {
  .bub-tr { margin-left: 6px; padding: 2px 8px; font-size: .7rem; }
}
.msg-compose { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); align-items: flex-end; background: #fff; }
.msg-compose textarea {
  flex: 1; resize: none; min-height: 46px; max-height: 140px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px; outline: none; font-size: .93rem; line-height: 1.6;
}
.msg-compose textarea:focus { border-color: var(--ink); }
.msg-empty-chat { flex: 1; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 40px; }

@media (max-width: 860px) {
  .msg-layout { grid-template-columns: minmax(0, 1fr); min-height: 420px; }
  .msg-side { border-right: 0; max-height: none; }
  .msg-layout:not(.is-chat) .msg-chat { display: none; }
  .msg-layout.is-chat .msg-side { display: none; }
  .msg-layout.is-chat .msg-chat { display: flex; min-height: 70dvh; }
  .msg-back { display: grid; }
  .msg-body { max-height: none; min-height: 300px; }
}

/* ---------- breadcrumb ---------- */
.frm-crumb { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .86rem; flex-wrap: wrap; padding-top: 22px; }
.frm-crumb a:hover { color: var(--ink); }
.frm-crumb .sep { color: var(--line); }

/* ---------- thread head ---------- */
.thr-title { padding: 20px 22px 6px; }
.thr-title h1 { font-size: clamp(1.25rem, 2.4vw, 1.7rem); }
.thr-title .tm { display: flex; align-items: center; gap: 12px; margin-top: 10px; color: var(--muted); font-size: .84rem; flex-wrap: wrap; }

/* ---------- misc ---------- */
.frm-side-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.frm-side-item { display: flex; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line); align-items: baseline; }
.frm-side-item:last-child { border-bottom: 0; }
.frm-side-item .si-t { flex: 1; min-width: 0; font-size: .88rem; font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.frm-side-item .si-t:hover { color: var(--accent); }
.frm-side-item .si-time { flex: none; color: var(--muted); font-size: .76rem; }
.frm-note { color: var(--muted); font-size: .82rem; }
.center-row { display: flex; justify-content: center; }
.frm-narrow { max-width: 880px; margin: 0 auto; }
.frm-side-stats { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.frm-side-stats .fs-row { display: flex; align-items: baseline; gap: 10px; }
.frm-side-stats .fs-row b { font-size: 1.5rem; font-weight: 750; letter-spacing: -0.02em; }
.frm-side-stats .fs-row span { color: var(--muted); font-size: .86rem; }

/* ---------- account settings (settings.html) ---------- */
.set-av-row { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 14px; }
.set-av-main { flex: 1; min-width: 0; }
.set-av-main .frm-note { margin-top: 8px; }
@media (max-width: 560px) {
  .set-av-row { flex-direction: column; align-items: center; text-align: center; }
  .set-av-main { width: 100%; }
  .set-av-main [style*="display:flex"] { justify-content: center; }
}
