/* ============================================================
   微坛 WeForum · 公共样式（前台 + 后台共用）
   设计变量 / 重置 / 通用类 / 按钮 / 表单 / 头像 / Toast / 浮层
   ============================================================ */
:root {
  --brand: #07C160;
  --brand-dark: #06AD56;
  --brand-weak: #E8F8EF;
  --link: #576B95;
  --bg: #EDEDED;
  --panel: #FFFFFF;
  --panel-2: #F7F7F7;
  --text: #191919;
  --text-2: #7F7F7F;
  --text-3: #B2B2B2;
  --line: #E5E5E5;
  --line-2: #F0F0F0;
  --danger: #FA5151;
  --orange: #FA9D3B;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.12);
  --nav-h: 44px;
  --tab-h: 50px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111111;
    --panel: #1E1E1E;
    --panel-2: #252525;
    --text: #EDEDED;
    --text-2: #9A9A9A;
    --text-3: #6B6B6B;
    --line: #2E2E2E;
    --line-2: #262626;
    --brand-weak: #12301F;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; font-size: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
img { display: block; max-width: 100%; }
a { color: var(--link); text-decoration: none; }
svg { display: block; }

/* ---------- 启动页 ---------- */
.boot {
  height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
}
.boot-logo {
  width: 76px; height: 76px; border-radius: 18px; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: 26px; font-weight: 600; letter-spacing: 1px;
  box-shadow: 0 10px 30px rgba(7,193,96,.3);
}
.boot-tip { color: var(--text-2); font-size: 13px; }

/* ---------- 通用 ---------- */
.hidden { display: none !important; }
.muted { color: var(--text-2); }
.tiny { font-size: 12px; }
.row { display: flex; align-items: center; }
.between { display: flex; align-items: center; justify-content: space-between; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.divider { height: 8px; background: var(--bg); }
.spin {
  width: 22px; height: 22px; border: 2px solid var(--line); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .7s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 头像 */
.avatar {
  width: 40px; height: 40px; border-radius: 6px; flex: 0 0 auto; overflow: hidden;
  display: grid; place-items: center; color: #fff; font-size: 16px; font-weight: 500;
  background: #C9C9C9; position: relative; user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 30px; height: 30px; font-size: 13px; border-radius: 5px; }
.avatar.lg { width: 64px; height: 64px; font-size: 24px; border-radius: 10px; }
.avatar.xl { width: 76px; height: 76px; font-size: 30px; border-radius: 12px; }
.avatar.vip {
  box-shadow: 0 0 0 2px #FA9D3B, 0 0 8px rgba(250, 157, 59, 0.5);
}

/* 徽标 */
.badge {
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--danger);
  color: #fff; font-size: 11px; line-height: 17px; text-align: center; font-weight: 500;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  height: 36px; padding: 0 16px; border-radius: 6px; font-size: 14px; font-weight: 500;
  background: var(--panel-2); color: var(--text); transition: opacity .15s, filter .15s;
  white-space: nowrap;
}
.btn:active { opacity: .7; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:disabled { background: #9EDFBA; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.danger { color: var(--danger); }
.btn.sm { height: 28px; padding: 0 12px; font-size: 13px; border-radius: 5px; }
.btn.block { width: 100%; height: 44px; font-size: 16px; border-radius: 8px; }
.btn.link { background: none; color: var(--link); padding: 0; height: auto; }

/* 输入 */
.field {
  width: 100%; height: 46px; padding: 0 14px; border-radius: 8px; border: 1px solid transparent;
  background: var(--panel); outline: none; transition: border-color .15s;
}
.field:focus { border-color: var(--brand); }
textarea.field { height: auto; padding: 12px 14px; line-height: 1.6; resize: vertical; min-height: 90px; }
.field::placeholder { color: var(--text-3); }
.input-inline {
  flex: 1; height: 34px; background: var(--panel-2); border-radius: 6px; border: 0; padding: 0 12px; outline: none;
}

/* ============================================================
   浮层：弹窗 / 抽屉 / 底部面板
   ============================================================ */
.mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 101;
  background: var(--panel); border-radius: 14px 14px 0 0; padding-bottom: var(--safe-b);
  max-height: 88dvh; display: flex; flex-direction: column;
  animation: slideUp .22s cubic-bezier(.3,.9,.4,1);
}
@keyframes slideUp { from { transform: translateY(100%); } }
.sheet-head {
  height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px;
  border-bottom: .5px solid var(--line-2); flex: 0 0 auto;
}
.sheet-head b { font-size: 16px; font-weight: 600; }
.sheet-body { overflow-y: auto; padding: 14px 18px calc(18px + var(--safe-b)); }
.sheet .handle {
  width: 34px; height: 4px; border-radius: 2px; background: var(--line); margin: 8px auto 0;
}

/* 居中对话框 */
.dialog {
  position: fixed; z-index: 101; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(340px, 86vw); background: var(--panel); border-radius: 12px; overflow: hidden;
  animation: pop .18s ease;
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, -46%) scale(.96); } }
.dialog-body { padding: 24px 22px 20px; text-align: center; }
.dialog-body h3 { margin: 0 0 8px; font-size: 17px; }
.dialog-body p { margin: 0; color: var(--text-2); font-size: 14px; }
.dialog-foot { display: flex; border-top: .5px solid var(--line); }
.dialog-foot button {
  flex: 1; height: 50px; font-size: 16px; color: var(--text-2);
}
.dialog-foot button + button { border-left: .5px solid var(--line); color: var(--brand); font-weight: 500; }
.dialog-foot button.danger { color: var(--danger); }

/* 桌面端弹窗居中 */
@media (min-width: 1024px) {
  .sheet {
    left: 50%; right: auto; bottom: auto; top: 50%; width: 460px; border-radius: 12px;
    transform: translate(-50%, -50%); animation: pop .18s ease; max-height: 82dvh;
  }
  .sheet .handle { display: none; }
  .sheet-head { border-top-left-radius: 12px; border-top-right-radius: 12px; }
}

/* 图片查看器 */
.viewer {
  position: fixed; inset: 0; background: #000; z-index: 200; display: grid; place-items: center;
  animation: fade .15s;
}
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer .close { position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 16px; color: #fff; }

/* 编辑器 */
.editor-sheet .sheet-body { padding: 0; }
.editor-bar {
  display: flex; align-items: center; justify-content: space-between; padding: 10px 16px;
  border-bottom: .5px solid var(--line-2);
}
.board-picker { display: flex; gap: 7px; overflow-x: auto; padding: 12px 16px; scrollbar-width: none; }
.board-picker::-webkit-scrollbar { display: none; }
.board-picker button {
  height: 30px; padding: 0 12px; border-radius: 15px; background: var(--panel-2); font-size: 13px;
  color: var(--text-2); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px;
}
.board-picker button.on { background: var(--brand-weak); color: var(--brand-dark); font-weight: 500; }
.editor-title {
  width: 100%; border: 0; outline: none; background: transparent; padding: 6px 16px;
  font-size: 18px; font-weight: 600;
}
.editor-body {
  width: 100%; border: 0; outline: none; background: transparent; padding: 8px 16px 16px;
  font-size: 15.5px; line-height: 1.72; resize: none; min-height: 180px; display: block;
}
.editor-attach { display: flex; gap: 8px; padding: 0 16px 12px; flex-wrap: wrap; }
.thumb-attach {
  width: 74px; height: 74px; border-radius: 8px; overflow: hidden; position: relative; background: var(--panel-2);
}
.thumb-attach img { width: 100%; height: 100%; object-fit: cover; }
.thumb-attach .x {
  position: absolute; top: 3px; right: 3px; width: 19px; height: 19px; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; font-size: 12px;
}
.attach-btn {
  width: 74px; height: 74px; border-radius: 8px; border: 1px dashed var(--line); display: flex;
  flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--text-3); font-size: 11px;
}
.editor-tools {
  display: flex; align-items: center; gap: 14px; padding: 10px 16px calc(10px + var(--safe-b));
  border-top: .5px solid var(--line-2); color: var(--text-2); font-size: 11px;
}
.editor-tools .tool { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--text-2); }
.editor-tools .tool.on { color: var(--brand); }
.audio-mini { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--panel-2); border-radius: 16px; font-size: 12px; }

/* 通知 */
.notice-tabs {
  display: flex; gap: 4px; padding: 10px 12px; background: var(--panel);
  border-bottom: .5px solid var(--line-2); overflow-x: auto; scrollbar-width: none;
}
.notice-tabs::-webkit-scrollbar { display: none; }
.notice-tab {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 12px;
  border-radius: 15px; background: var(--panel-2); color: var(--text-2); font-size: 13px; white-space: nowrap;
  transition: background .15s, color .15s;
}
.notice-tab.on { background: var(--brand-weak); color: var(--brand-dark); font-weight: 500; }
@media (prefers-color-scheme: dark) { .notice-tab.on { color: var(--brand); } }
.notice-tab b {
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff;
  font-size: 10.5px; font-weight: 500; line-height: 16px; text-align: center; font-variant-numeric: tabular-nums;
}
.notice-tab.on b { background: var(--brand); }
.notice-item { display: flex; gap: 12px; padding: 14px 16px; background: var(--panel); position: relative; text-align: left; width: 100%; }
.notice-item + .notice-item::before { content:""; position:absolute; left:16px; right:0; top:0; height:.5px; background: var(--line-2); }
.notice-body { flex: 1; min-width: 0; }
.notice-body .t { font-size: 14px; }
.notice-body .q { margin-top: 4px; font-size: 13px; color: var(--text-2); background: var(--panel-2); padding: 7px 10px; border-radius: 6px; }
.notice-body .w { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.notice-item.unread .t::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); margin-left: 6px; vertical-align: 2px; }

/* 我的 */
.profile-head {
  background: var(--panel); padding: 26px 18px 20px; display: flex; align-items: center; gap: 14px;
}
.profile-head .nm { font-size: 19px; font-weight: 600; letter-spacing: -.3px; }
.profile-head .bio { color: var(--text-2); font-size: 13px; margin-top: 4px; line-height: 1.45; }
.stat-row { display: flex; gap: 26px; padding: 0 18px 18px; background: var(--panel); }
.stat-row div { font-size: 12px; color: var(--text-2); }
.stat-row b { display: block; font-size: 17px; color: var(--text); font-weight: 600; }

/* 等级 / 用户组 / 经验 / 勋章 */
.profile-head .nm { display: flex; align-items: center; gap: 8px; }
.lv-badge {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 10px;
  font-size: 11px; font-weight: 700; color: #fff; letter-spacing: .3px; flex: 0 0 auto;
  box-shadow: 0 2px 6px rgba(0,0,0,.14);
}
.profile-sys { background: var(--panel); padding: 0 18px 16px; }
.ps-group { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.grp-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px 0 4px;
  border-radius: 13px; font-size: 12.5px; font-weight: 600;
}
.grp-ico { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; color: #fff; }
.ps-tag { font-size: 11px; color: var(--text-3); }
.exp-line { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.exp-label { display: inline-flex; align-items: center; gap: 5px; }
.exp-tip { color: var(--text-3); }
.exp-bar { height: 7px; border-radius: 4px; background: var(--panel-2); overflow: hidden; }
.exp-bar > i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--brand), #38d97e); transition: width .4s ease; }
.exp-next { font-size: 11.5px; color: var(--text-3); margin-top: 7px; }
.exp-next b { color: var(--brand); font-weight: 600; }

.badge-wall { background: var(--panel); padding: 4px 18px 18px; }
.bw-head { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.bw-count { font-size: 11px; color: #fff; background: var(--brand); border-radius: 9px; padding: 1px 7px; }
.bw-list { display: flex; flex-wrap: wrap; gap: 8px; }
.bw-item {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px 0 4px;
  border-radius: 15px; background: var(--panel-2); border: 1px solid transparent;
  font-size: 12.5px; font-weight: 500; color: var(--text);
}
.bw-ico { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; }
.menu-group { margin-top: 8px; }
.menu-group .cell .ico {
  width: 24px; height: 24px; display: grid; place-items: center; color: var(--brand);
}

/* 搜索结果 & 用户 */
.user-row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; background: var(--panel); }
.user-row + .user-row { border-top: .5px solid var(--line-2); }

/* Toast */
#toast-root { position: fixed; inset: 0; pointer-events: none; z-index: 300; display: flex; align-items: center; justify-content: center; }
.toast {
  background: rgba(0,0,0,.78); color: #fff; padding: 11px 18px; border-radius: 8px; font-size: 14px;
  max-width: 70vw; text-align: center; animation: toastIn .2s ease; margin-top: -12vh;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } }

/* 登录页 */
.auth-wrap {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 24px;
}
.auth-card {
  width: min(400px, 100%); background: var(--panel); border-radius: 16px; padding: 34px 26px 26px;
  box-shadow: var(--shadow-lg);
}
.auth-card .logo {
  width: 62px; height: 62px; border-radius: 15px; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: 22px; font-weight: 600; margin: 0 auto 16px;
}
.auth-card h2 { margin: 0 0 6px; text-align: center; font-size: 21px; }
.auth-card .sub { text-align: center; color: var(--text-2); font-size: 13px; margin-bottom: 24px; }
.auth-field { position: relative; margin-bottom: 12px; }
.auth-field .field { background: var(--panel-2); }
.auth-tip { font-size: 12px; color: var(--text-3); margin: 14px 0 0; text-align: center; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 14px; color: var(--text-2); }
.auth-switch button { color: var(--link); }
.demo-accounts { margin-top: 16px; padding: 12px; background: var(--panel-2); border-radius: 8px; font-size: 12px; color: var(--text-2); line-height: 1.8; }
.demo-accounts b { color: var(--text); font-weight: 500; }

/* 分段控件（我的-内容） */
.tabs-line { display: flex; gap: 20px; padding: 0 16px; background: var(--panel); border-bottom: .5px solid var(--line-2); }
.tabs-line button { height: 42px; font-size: 14px; color: var(--text-2); position: relative; }
.tabs-line button.on { color: var(--text); font-weight: 500; }
.tabs-line button.on::after {
  content: ""; position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 22px; height: 2.5px; border-radius: 2px; background: var(--brand);
}

/* ---------- Toast ---------- */
#toast-root { position: fixed; inset: 0; pointer-events: none; z-index: 300; display: flex; align-items: center; justify-content: center; }
.toast {
  background: rgba(0,0,0,.78); color: #fff; padding: 11px 18px; border-radius: 8px; font-size: 14px;
  max-width: 70vw; text-align: center; animation: toastIn .2s ease; margin-top: -12vh;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } }
