/* 匿名论坛 · Threads/ins 风 · 黑白灰（点赞红 #ff3040 例外） */
:root {
  color-scheme: light;
  --ink: #000;
  --sub: #777777;
  --faint: #989898;
  --line: #e5e5e5;
  --thread-line: #d8d8d8;
  --bg: #fff;
  --wash: #f5f5f5;
  --like: #ff3040;
  --danger: #d92d20;
  --col: 620px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Segoe UI", sans-serif;
  background: var(--wash);
  color: var(--ink);
  font-size: 15px;
  line-height: 20px;
}
button { font: inherit; background: none; border: none; color: inherit; cursor: pointer; }
.hidden { display: none !important; }

#app { max-width: var(--col); margin: 0 auto; background: var(--bg); min-height: 100dvh; position: relative; }

/* 顶栏 */
#topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; padding: 0 16px;
  background: rgba(255,255,255,.92); backdrop-filter: blur(12px);
}
.top-avatar { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; flex: none; padding: 0; }
.top-logo { font-size: 34px; font-weight: 800; line-height: 1; letter-spacing: -1px; }
.top-icon { width: 34px; height: 34px; display: grid; place-items: center; color: var(--ink); }

/* 最新/热门页签 */
.feed-tabs {
  position: sticky; top: 56px; z-index: 29;
  display: flex; height: 48px;
  background: rgba(255,255,255,.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.feed-tab { flex: 1; font-size: 15px; font-weight: 600; color: var(--faint); }
.feed-tab.active { color: var(--ink); }
.tab-underline {
  position: absolute; bottom: -1px; left: 0; width: 50%; height: 2px;
  background: var(--ink); transition: transform .25s ease;
}
.feed-tabs[data-active="hot"] .tab-underline { transform: translateX(100%); }

/* 主区域 */
#main { padding-bottom: 110px; }
.view-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px 6px; }
.view-head .back-btn { font-size: 20px; width: 32px; height: 32px; }
.view-title { font-size: 17px; font-weight: 700; }
.section-title { font-size: 15px; font-weight: 700; padding: 18px 16px 8px; }
.empty { padding: 48px 16px; text-align: center; color: var(--sub); font-size: 14px; }

/* 头像：灰盘 + 白色剪影 */
.avatar { border-radius: 50%; flex: none; display: inline-block; vertical-align: middle; }
.avatar-admin { background: #000 !important; }

/* 发帖入口行 */
.compose-entry {
  display: flex; gap: 12px; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid var(--line); width: 100%; text-align: left;
}
.compose-entry .ph { color: var(--faint); font-size: 15px; }

/* 帖子 */
.post { display: flex; gap: 12px; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.post-left { display: flex; flex-direction: column; align-items: center; }
.thread-line { width: 2px; flex: 1; min-height: 12px; background: var(--thread-line); border-radius: 2px; margin-top: 6px; }
.post-main { flex: 1; min-width: 0; }
.post-head { display: flex; align-items: baseline; gap: 8px; }
.post-handle { font-weight: 700; font-size: 15px; }
.post-time { color: var(--sub); font-size: 15px; }
.admin-badge {
  font-size: 11px; font-weight: 700; color: #fff; background: #000;
  border-radius: 4px; padding: 1px 5px; line-height: 16px;
}
.post-more { margin-left: auto; color: var(--sub); font-size: 18px; padding: 0 2px; }
.post-body { font-size: 15px; line-height: 20px; margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.post-actions { display: flex; gap: 4px; margin-top: 8px; margin-left: -8px; }
.action-btn {
  display: inline-flex; align-items: center; gap: 5px;
  min-width: 36px; height: 36px; padding: 0 8px; border-radius: 50%;
  color: var(--ink);
}
.action-btn:active { background: var(--wash); }
.action-btn .count { font-size: 15px; color: var(--sub); font-weight: 400; }
.action-btn.liked svg { fill: var(--like); stroke: var(--like); }
.action-btn.liked .count { color: var(--like); }
.hidden-tag { font-size: 12px; color: var(--danger); border: 1px solid var(--danger); border-radius: 4px; padding: 0 4px; margin-left: 8px; }
.banned-tag { font-size: 12px; color: var(--danger); border: 1px solid var(--danger); border-radius: 4px; padding: 0 4px; margin-left: 8px; }
.locked-tag { font-size: 12px; color: var(--sub); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; margin-left: 8px; }

/* 转发条目：横幅 + 原帖卡（整块只有一条底边线） */
.repost-entry { border-bottom: 1px solid var(--line); }
.repost-entry > .post { border-bottom: none; }
.repost-banner {
  display: flex; align-items: center; gap: 6px;
  padding: 12px 16px 0 64px; color: var(--sub); font-size: 13px;
}
.repost-banner svg { width: 16px; height: 16px; }
.action-btn.reposted { background: var(--wash); }
.action-btn.reposted svg { stroke-width: 2.4; }
.action-btn.reposted .count { color: var(--ink); font-weight: 600; }
.action-btn.frozen { opacity: .35; }

/* 引用嵌入卡（帖子内嵌 + 发帖面板预览共用） */
.quote-embed { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 8px; }
.qe-head { display: flex; align-items: center; gap: 8px; }
.qe-body {
  margin-top: 4px; font-size: 14px; line-height: 19px;
  white-space: pre-wrap; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.quote-gone { color: var(--sub); font-size: 14px; text-align: center; }
.qe-remove { margin-left: auto; width: 28px; height: 28px; font-size: 18px; line-height: 1; color: var(--sub); }
.composer-quote { padding-top: 8px; }
.composer-quote .quote-embed { margin-top: 0; }

/* 回复 */
.reply { display: flex; gap: 12px; padding: 12px 16px 8px; }
.reply .post-body { margin-top: 1px; }

/* 详情页回复栏 */
.reply-bar {
  position: sticky; bottom: 92px; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  margin: 10px 16px 0; padding: 10px 14px;
  background: var(--wash); border-radius: 999px; color: var(--faint);
  width: calc(100% - 32px); text-align: left; font-size: 15px;
}

/* 详情页：已锁定提示条（替代回复栏） */
.locked-notice {
  margin: 10px 16px 0; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 12px;
  color: var(--sub); font-size: 14px; text-align: center;
}

/* 详情页：管理员操作行 */
.thread-admin-row { display: flex; gap: 8px; padding: 10px 16px 2px; }

/* 底部悬浮胶囊导航 */
#bottomNav {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 40;
  width: min(560px, calc(100vw - 48px));
  display: flex; justify-content: space-around; align-items: center;
  background: rgba(255,255,255,.9); backdrop-filter: blur(16px);
  border: 1px solid var(--line); border-radius: 999px;
  box-shadow: 0 8px 30px rgba(0,0,0,.12);
  padding: 8px 10px;
}
.nav-btn { position: relative; width: 52px; height: 44px; display: grid; place-items: center; color: #bdbdbd; border-radius: 999px; }
.nav-btn.active { color: var(--ink); }
.nav-compose { font-size: 30px; font-weight: 300; line-height: 1; }
.nav-dot { position: absolute; top: 6px; right: 10px; width: 9px; height: 9px; border-radius: 50%; background: var(--like); border: 2px solid #fff; }

/* 发帖面板 */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; }
.composer {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 0; z-index: 51;
  width: min(var(--col), 100vw);
  background: #fff; border-radius: 16px 16px 0 0;
  padding: 10px 16px calc(14px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(0,0,0,.15);
}
.composer-head { display: flex; align-items: center; justify-content: space-between; height: 40px; }
.composer-title { font-weight: 700; }
.text-btn { color: var(--ink); font-size: 15px; }
.publish-btn {
  height: 36px; padding: 0 18px; border-radius: 999px;
  background: var(--ink); color: #fff; font-weight: 700; font-size: 15px;
}
.publish-btn:disabled { opacity: .35; }
.composer-identity { display: flex; gap: 8px; flex-wrap: wrap; padding: 6px 0 2px; }
.id-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px 4px 4px;
  font-size: 13px; color: var(--sub);
}
.id-chip.active { border-color: var(--ink); color: var(--ink); font-weight: 600; }
#composerInput {
  width: 100%; border: none; outline: none; resize: none; color: var(--ink);
  font: inherit; font-size: 16px; line-height: 22px; padding: 10px 0; background: transparent;
}
.composer-foot { display: flex; justify-content: space-between; align-items: center; min-height: 20px; }
.composer-error { color: var(--danger); font-size: 13px; flex: 1; }
.composer-count { color: var(--faint); font-size: 13px; }

/* 搜索 */
.search-box { padding: 12px 16px; }
.search-box input {
  width: 100%; height: 52px; border: 1.5px solid var(--line); border-radius: 16px;
  padding: 0 16px; font: inherit; font-size: 16px; outline: none; background: #fff;
}
.search-box input:focus { border-color: var(--ink); }

/* 我的 / 身份 */
.profile-card { padding: 20px 16px 8px; }
.profile-top { display: flex; justify-content: space-between; align-items: flex-start; }
.profile-name { font-size: 24px; font-weight: 800; line-height: 30px; }
.profile-sub { color: var(--sub); margin-top: 2px; }
.profile-stats { display: flex; gap: 18px; margin-top: 12px; color: var(--ink); font-size: 14px; }
.profile-stats b { font-weight: 700; }
.gray-btn {
  display: block; width: calc(100% - 32px); margin: 14px 16px 4px;
  background: var(--wash); border-radius: 12px; padding: 11px 0;
  font-weight: 600; font-size: 15px; text-align: center;
}
.gray-btn:disabled { opacity: .45; }
.black-btn { background: var(--ink); color: var(--bg); }
.admin-pill { margin-top: 10px; border: .5px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.identity-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 16px; border-bottom: 1px solid var(--line); text-align: left;
}
.identity-row .handle { font-weight: 600; }
.identity-row .meta { color: var(--sub); font-size: 13px; }
.identity-row .current-tag { margin-left: auto; font-size: 12px; color: var(--sub); }
.ban-notice {
  margin: 14px 16px; padding: 12px 14px; border: 1px solid var(--danger);
  color: var(--danger); border-radius: 12px; font-size: 14px;
}
.appeal-box { margin: 0 16px 4px; }
.appeal-title { font-size: 14px; font-weight: 700; margin: 4px 0 8px; }
.appeal-box textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink);
  padding: 10px 12px; font: inherit; font-size: 14px; resize: vertical; outline: none; box-sizing: border-box;
}
.appeal-box .gray-btn { margin: 10px 0 0; width: 100%; }
.appeal-hint { color: var(--sub); font-size: 12px; margin-top: 6px; }
.claim-box { padding: 6px 16px 10px; display: flex; gap: 8px; }
.claim-box input {
  flex: 1; height: 42px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink);
  padding: 0 12px; font: inherit; outline: none;
}
.claim-box button { height: 42px; padding: 0 16px; border-radius: 10px; background: var(--ink); color: #fff; font-weight: 600; }

/* 动态 */
.event-row { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.event-row .sample { color: var(--sub); font-size: 14px; margin-top: 2px; }

/* 管理后台 */
.admin-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 12px 16px; }
.stat-box { background: var(--wash); border-radius: 12px; padding: 12px; text-align: center; }
.stat-box .num { font-size: 20px; font-weight: 800; }
.stat-box .lbl { color: var(--sub); font-size: 12px; margin-top: 2px; }
.flag-card { border-bottom: 1px solid var(--line); padding: 12px 16px; }
.flag-type { font-size: 12px; font-weight: 700; border: 1px solid var(--ink); border-radius: 4px; padding: 1px 5px; }
.flag-detail { margin-top: 6px; font-size: 14px; }
.flag-sample { margin-top: 4px; color: var(--sub); font-size: 14px; background: var(--wash); border-radius: 8px; padding: 8px 10px; white-space: pre-wrap; word-break: break-word; }
.flag-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.mini-btn { border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600; }
.mini-btn.danger { border-color: var(--danger); color: var(--danger); }
.flag-status { font-size: 12px; color: var(--faint); margin-left: 8px; }

/* 加载更多 / toast / 弹层菜单 */
.load-more { display: block; margin: 8px auto 20px; color: var(--sub); font-size: 14px; padding: 10px 20px; }
.feed-end { text-align: center; color: var(--faint); font-size: 13px; padding: 14px 0 22px; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 110px; z-index: 60; background: rgba(0,0,0,.88); color: #fff;
  padding: 10px 18px; border-radius: 999px; font-size: 14px; max-width: 86vw; text-align: center;
}
.menu-sheet {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 55;
  width: min(var(--col), 100vw); background: #fff; border-radius: 16px 16px 0 0;
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
}
.menu-item { display: block; width: 100%; text-align: left; padding: 14px 4px; font-size: 16px; border-bottom: 1px solid var(--line); }
.menu-item:last-child { border-bottom: none; }
.menu-item.danger { color: var(--danger); }

@media (prefers-color-scheme: dark) {
  :root { color-scheme: dark; --ink: #f5f5f5; --sub: #8e8e8e; --faint: #808080; --danger: #ff7a6e; --line: #333; --thread-line: #313639; --bg: #101010; --wash: #1c1c1c; }
  body { background: #000; }
  #topbar, .feed-tabs { background: rgba(16,16,16,.92); }
  #bottomNav { background: rgba(28,28,28,.92); }
  .nav-dot { border-color: #1c1c1c; }
  .composer, .menu-sheet { background: #1c1c1c; }
  .search-box input { background: #101010; color: var(--ink); }
  .admin-badge { background: #f5f5f5; color: #000; }
  .publish-btn, .claim-box button { background: #f5f5f5; color: #000; }
  .toast { border: 1px solid rgba(255,255,255,.25); }
}

/* 兑换码（「我的」页） */
.redeem-msg { margin-top: 8px; font-size: 13px; color: var(--ink); }
.redeem-hint { margin-top: 4px; font-size: 12px; color: var(--sub); }

/* 管理后台兑换码 */
.code-gen { display: flex; gap: 8px; align-items: center; }
.code-gen input { width: 72px; border: .5px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font: inherit; font-size: 15px; padding: 6px 10px; }
.code-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: .5px solid var(--line); }
.code-text { font-family: ui-monospace, Menlo, monospace; font-size: 16px; letter-spacing: 1.5px; cursor: pointer; }
.code-status { font-size: 12px; color: var(--sub); border: .5px solid var(--line); border-radius: 999px; padding: 2px 8px; }
.code-status.used { opacity: .55; }
.code-item .meta { margin-left: auto; }
