/* ============================================================
   咸鱼社区 全站样式 style.css  v2.0「翻身的咸鱼」重设计
   纯手写 · 零依赖 · emoji 即图标
   ------------------------------------------------------------
   设计方向：现代 SaaS/社区风
   · 大圆角卡片(16px) + 柔和多层阴影
   · 玻璃拟态 sticky 导航（backdrop-filter，含 @supports 回退）
   · 胶囊按钮 + 微交互（hover 上浮 150-200ms ease）
   · 主色鲜亮靛蓝 #3b5bdb（白字对比 5.6:1 ≥ AA）
   · 品牌强调色保留咸鱼干橙 #ff9f27
   · 8px 网格间距 · 三级字阶 13/15/20 · 断点 768px
   ============================================================ */

/* ============================================================
   1. 设计 Token
   ============================================================ */
:root {
  /* —— 品牌色 —— */
  --c-primary: #3b5bdb;          /* 主色·靛蓝（白字 5.6:1） */
  --c-primary-dark: #2f4bc0;     /* 主色 hover */
  --c-primary-soft: rgba(59, 91, 219, .09);   /* 主色淡底（hover/选中） */
  --c-primary-ring: rgba(59, 91, 219, .22);   /* 聚焦光环 */

  --c-accent: #ff9f27;           /* 强调·咸鱼干橙（品牌） */
  --c-accent-bright: #ffb340;    /* 橙渐变亮端 */
  --c-accent-deep: #ff8c1a;      /* 橙渐变深端 */
  --c-accent-ink: #4a2600;       /* 橙底上的深字（对比 6.5:1） */
  --c-accent-soft: rgba(255, 159, 39, .13);

  /* —— 语义色 —— */
  --c-ok: #0d8a5f;               /* 成功（白字 ≥4.5:1） */
  --c-ok-soft: rgba(13, 138, 95, .11);
  --c-err: #c73a3f;              /* 危险（白字 5.1:1） */
  --c-err-soft: rgba(199, 58, 63, .10);

  /* —— 中性色阶（冷灰蓝，11 级） —— */
  --n-0: #ffffff;
  --n-50: #f7f8fc;               /* 页面底 */
  --n-100: #f0f2f8;              /* 淡底/日历格 */
  --n-200: #e5e8f1;              /* 边线 */
  --n-300: #d3d8e6;              /* 深边线 */
  --n-400: #a3abc0;              /* 占位符/装饰 */
  --n-500: #737d96;              /* 辅助文字（4.5:1+） */
  --n-600: #5b6478;              /* 次要文字 */
  --n-700: #3c4358;              /* 深次要 */
  --n-800: #232a3d;              /* 正文 */
  --n-900: #141a2c;              /* 标题/深底 */

  --c-bg: var(--n-50);
  --c-card: var(--n-0);
  --c-text: var(--n-800);
  --c-sub: var(--n-600);
  --c-faint: var(--n-500);
  --c-line: rgba(35, 42, 61, .09);
  --c-main: var(--n-900);        /* 深底（页脚/深色块） */

  /* —— 圆角 —— */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-card: 16px;                /* 卡片 */
  --r-lg: 20px;
  --r-full: 999px;               /* 胶囊 */

  /* —— 阴影（多层柔和） —— */
  --shadow-xs: 0 1px 2px rgba(20, 26, 44, .05);
  --shadow-sm: 0 1px 2px rgba(20, 26, 44, .04), 0 2px 8px rgba(20, 26, 44, .05);
  --shadow-md: 0 2px 4px rgba(20, 26, 44, .05), 0 8px 24px rgba(20, 26, 44, .09);
  --shadow-lg: 0 4px 12px rgba(20, 26, 44, .08), 0 20px 48px rgba(20, 26, 44, .16);
  --shadow-primary: 0 4px 14px rgba(59, 91, 219, .32);
  --shadow-accent: 0 4px 14px rgba(255, 140, 26, .38);

  /* —— 间距（8px 网格） —— */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;

  /* —— 动效 —— */
  --t-fast: 150ms;
  --t-med: 200ms;
  --ease: cubic-bezier(.33, 1, .68, 1);        /* easeOutCubic */
  --ease-spring: cubic-bezier(.34, 1.4, .64, 1);

  /* —— 字体 —— */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;

  /* —— 字阶（三级） —— */
  --fs-sm: 13px;                 /* 辅助/meta */
  --fs-md: 15px;                 /* 正文 */
  --fs-lg: 20px;                 /* 标题 */

  /* —— 层级 —— */
  --z-nav: 100;
  --z-dropdown: 200;
  --z-mobile-nav: 300;
  --z-modal: 9000;
  --z-toast: 9999;
}

/* ============================================================
   2. 基础 / 重置
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 400px at 85% -120px, rgba(59, 91, 219, .06), transparent 60%),
    radial-gradient(900px 320px at 5% -80px, rgba(255, 159, 39, .05), transparent 55%),
    var(--c-bg);
  background-attachment: fixed;
  color: var(--c-text);
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;              /* 移动端禁横向滚动 */
  word-break: break-word;
}

h1, h2, h3, h4, h5 {
  margin: 0 0 .5em;
  line-height: 1.35;
  font-weight: 700;
  color: var(--n-900);
  letter-spacing: -.01em;
}
h1 { font-size: var(--fs-lg); }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
p { margin: 0 0 .8em; }

a {
  color: var(--c-primary);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease);
}
a:hover { color: var(--c-primary-dark); }

a, button, input, select, textarea { outline-color: var(--c-primary); }
:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

img { max-width: 100%; border: 0; }
input, button, textarea, select { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
b, strong { font-weight: 700; }

hr { border: 0; border-top: 1px solid var(--c-line); margin: var(--sp-4) 0; }

::selection { background: rgba(59, 91, 219, .18); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb {
  background: rgba(35, 42, 61, .18);
  border-radius: var(--r-full);
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: rgba(35, 42, 61, .3); }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   3. 布局
   ============================================================ */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--sp-4);
}

.main-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--sp-5);
  align-items: start;
  padding-top: var(--sp-5);
  padding-bottom: var(--sp-8);
  min-height: 62vh;
}

/* ---- 无侧栏页面：横跨两列并居中（签到/发帖/聊天等） ---- */
.page-full {
  grid-column: 1 / -1;
  width: 100%;
  max-width: 860px;
  margin-inline: auto;
}

/* ---- 认证页（登录 / 注册）---- */
.auth-wrap {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--sp-8) 0 var(--sp-6);
}
.auth-card { width: 100%; max-width: 460px; }
.auth-card .card-hd {
  flex-direction: column;
  justify-content: center;
  text-align: center;
  gap: var(--sp-2);
  padding-top: var(--sp-6);
  margin-bottom: 0;
  font-size: var(--fs-lg);
}
.auth-card .hd-emoji { font-size: 38px; line-height: 1; }
.auth-card .hd-sub { font-size: var(--fs-sm); font-weight: 400; color: var(--n-500); }
.auth-card form { padding: var(--sp-5) var(--sp-6) var(--sp-4); }
.auth-foot { text-align: center; padding: 0 var(--sp-5) var(--sp-5); margin: 0; }

.sidebar {
  position: sticky;
  top: 84px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  min-width: 0;
}

.page-title {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--n-900);
  margin: var(--sp-1) 0 var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  letter-spacing: -.01em;
}
.page-title a { color: var(--c-faint); font-weight: 500; }
.page-title a:hover { color: var(--c-primary); }
.page-title b { color: var(--n-900); }
.page-title .btn { margin-left: auto; }

/* 小字辅助 */
.ts { font-size: var(--fs-sm); color: var(--c-faint); }
a.ts:hover { color: var(--c-primary); }

/* ============================================================
   4. 导航栏（玻璃拟态）
   ============================================================ */
.navbar {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  background: rgba(255, 255, 255, .72);
  border-bottom: 1px solid rgba(35, 42, 61, .07);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
}
/* 不支持 backdrop-filter 的浏览器：提高不透明度保证可读 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .navbar { background: rgba(255, 255, 255, .97); }
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  height: 60px;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: 800;
  font-size: 17px;
  color: var(--n-900);
  white-space: nowrap;
  letter-spacing: -.01em;
}
.logo:hover { color: var(--n-900); }
.logo-fish {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  font-size: 19px;
  line-height: 1;
  background: linear-gradient(135deg, var(--c-accent-bright), var(--c-accent-deep));
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-accent);
}
.logo-text { background: linear-gradient(120deg, var(--n-900) 55%, var(--c-primary-dark)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

.nav-links { display: flex; align-items: center; gap: var(--sp-1); }
.nav-links a {
  color: var(--n-600);
  padding: 7px 12px;
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.nav-links a:hover {
  color: var(--c-primary);
  background: var(--c-primary-soft);
}

.nav-search { flex: 1; max-width: 280px; }
.nav-search .input {
  width: 100%;
  height: 38px;
  background: rgba(35, 42, 61, .05);
  border-color: transparent;
  border-radius: var(--r-full);
}
.nav-search .input::placeholder { color: var(--n-400); }
.nav-search .input:focus {
  background: var(--c-card);
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-ring);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
}

#userMenuBtn, .nav-avatar-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: transparent;
  border: 1px solid transparent;
  color: var(--n-700);
  padding: 4px 8px 4px 4px;
  border-radius: var(--r-full);
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
#userMenuBtn:hover, .nav-avatar-btn:hover { background: rgba(35, 42, 61, .05); border-color: var(--c-line); }
.nav-username { font-weight: 600; font-size: 14px; color: var(--n-800); }

.credits-num {
  color: var(--c-accent-deep);
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.signin-btn { white-space: nowrap; }
.signin-btn.signed { opacity: .7; cursor: default; box-shadow: none; }

/* 下拉菜单 */
.dropdown { position: relative; }

.dropdown-menu, #userMenu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 180px;
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  color: var(--c-text);
  border: 1px solid rgba(35, 42, 61, .08);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: var(--z-dropdown);
  animation: dropdownIn var(--t-med) var(--ease);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .dropdown-menu { background: var(--c-card); }
}
.dropdown-menu[hidden], #userMenu[hidden] { display: none; }
.dropdown-menu a {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: var(--c-text);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.dropdown-menu a:hover { background: var(--c-primary-soft); color: var(--c-primary); }

.nav-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: auto;
  background: var(--c-err);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--r-full);
  font-style: normal;
  line-height: 1;
}

/* ============================================================
   5. 按钮（胶囊 + 微交互）
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: var(--r-full);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease),
              opacity var(--t-fast) var(--ease);
  user-select: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled, .btn[disabled] {
  opacity: .55;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-dark));
  color: #fff;
  box-shadow: var(--shadow-primary);
}
.btn-primary:hover { color: #fff; box-shadow: 0 6px 18px rgba(59, 91, 219, .42); }

.btn-ghost {
  background: transparent;
  color: var(--n-700);
  border-color: var(--n-300);
}
.btn-ghost:hover { color: var(--c-primary); border-color: var(--c-primary); background: var(--c-primary-soft); }
.navbar .btn-ghost { color: var(--n-700); }
.navbar .btn-ghost:hover { color: var(--c-primary); background: var(--c-primary-soft); }

.btn-warn {
  background: linear-gradient(135deg, var(--c-accent-bright), var(--c-accent-deep));
  color: var(--c-accent-ink);
  box-shadow: var(--shadow-accent);
}
.btn-warn:hover { color: var(--c-accent-ink); box-shadow: 0 6px 20px rgba(255, 140, 26, .5); }

.btn-danger { background: var(--c-err); color: #fff; }
.btn-danger:hover { background: #ad2f34; color: #fff; }

.btn-sm { padding: 5px 14px; font-size: 13px; }
.btn-sm.btn-ghost, .navbar .btn-sm.btn-ghost { padding: 4px 12px; }

/* ============================================================
   6. 卡片
   ============================================================ */
.card {
  background: var(--c-card);
  border: 1px solid rgba(35, 42, 61, .06);
  border-radius: var(--r-card);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.card-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding-bottom: var(--sp-3);
  margin-bottom: var(--sp-3);
  border-bottom: 1px solid var(--c-line);
  font-size: 16px;
  font-weight: 700;
  color: var(--n-900);
  letter-spacing: -.01em;
}
.card-hd .ts { font-weight: 400; }
.card-hd .btn { margin-left: auto; }
.card-hd > a:not(.btn) { margin-left: auto; }

/* ============================================================
   7. 首页
   ============================================================ */
.site-notice {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--c-accent-soft);
  border: 1px solid rgba(255, 159, 39, .3);
  color: #8a5410;
  border-radius: var(--r-md);
  padding: 11px var(--sp-4);
  margin-bottom: var(--sp-4);
  font-size: 14px;
}

/* 统计条：渐变品牌条 */
.stat-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  background: linear-gradient(120deg, #1c2542 0%, #2c3a6e 60%, #3b4f96 100%);
  border: 0;
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-4);
  box-shadow: var(--shadow-md);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.stat-bar::after {
  content: "🐟";
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%) rotate(-12deg);
  font-size: 52px;
  opacity: .12;
  pointer-events: none;
}
.stat-bar .stat {
  flex: 1;
  min-width: 88px;
  text-align: center;
}
.stat-bar .stat b {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.stat-bar .stat span {
  display: block;
  font-size: 12px;
  color: rgba(255, 255, 255, .62);
  margin-top: 2px;
}
.stat-bar .stat b.credits-num { color: var(--c-accent-bright); }

.grid-cats { display: flex; flex-direction: column; gap: var(--sp-4); }

.cat-block { margin-bottom: 0; }
.cat-block .card-hd > span:last-of-type { font-weight: 400; }

.forum-card {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: var(--n-50);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  padding: 13px var(--sp-4);
  transition: transform var(--t-med) var(--ease),
              box-shadow var(--t-med) var(--ease),
              background var(--t-med) var(--ease),
              border-color var(--t-med) var(--ease);
}
.forum-card:hover {
  transform: translateY(-2px);
  background: var(--c-card);
  border-color: rgba(59, 91, 219, .22);
  box-shadow: var(--shadow-md);
}
.forum-card + .forum-card { margin-top: var(--sp-2); }

.f-icon {
  flex: none;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: linear-gradient(135deg, rgba(59, 91, 219, .12), rgba(59, 91, 219, .05));
  border-radius: var(--r-md);
  transition: transform var(--t-med) var(--ease-spring);
}
.forum-card:hover .f-icon { transform: scale(1.08) rotate(-4deg); }

.f-info, .f-main { flex: 1; min-width: 0; display: block; }
.f-name {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--n-900);
  transition: color var(--t-fast) var(--ease);
}
.forum-card:hover .f-name { color: var(--c-primary); }
.f-desc {
  display: block;
  font-size: var(--fs-sm);
  color: var(--c-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.f-nums {
  flex: none;
  text-align: right;
  font-size: 12px;
  color: var(--c-faint);
  line-height: 1.7;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.f-nums b { color: var(--c-primary); font-size: 15px; font-weight: 800; }

/* ============================================================
   8. 帖子列表
   ============================================================ */
.thread-list {
  background: var(--c-card);
  border: 1px solid rgba(35, 42, 61, .06);
  border-radius: var(--r-card);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.thread-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 14px var(--sp-4);
  border-bottom: 1px solid var(--c-line);
  transition: background var(--t-fast) var(--ease);
  position: relative;
}
.thread-item:last-child { border-bottom: 0; }
.thread-item:hover { background: var(--c-primary-soft); }
.thread-item .avatar { flex: none; }

.t-main { flex: 1; min-width: 0; }

.t-title {
  display: block;
  color: var(--n-800);
  font-size: var(--fs-md);
  font-weight: 600;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--t-fast) var(--ease);
}
.t-title:hover { color: var(--c-primary); }

.t-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--c-faint);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.t-meta a { color: var(--c-faint); font-weight: 500; }
.t-meta a:hover { color: var(--c-primary); }
.t-meta .sep { opacity: .5; }

.item-title {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--n-800);
  display: block;
}
.item-title:hover { color: var(--c-primary); }

.t-side {
  flex: none;
  text-align: center;
  font-size: 12px;
  color: var(--c-faint);
  line-height: 1.6;
  min-width: 44px;
}

/* ============================================================
   9. 徽章 / 标签
   ============================================================ */
.badge-group, .badge-title {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1.5px 9px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
  vertical-align: middle;
  border: 1px solid currentColor;
}
.badge-group .badge-star { font-size: 10px; letter-spacing: 1px; opacity: .8; }

.tag-top, .tag-best, .tag-lock {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--r-xs);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.7;
  color: #fff;
  white-space: nowrap;
  vertical-align: middle;
  margin-right: 2px;
}
.tag-top  { background: linear-gradient(135deg, #e05560, var(--c-err)); }
.tag-best { background: linear-gradient(135deg, var(--c-accent-bright), var(--c-accent-deep)); color: var(--c-accent-ink); }
.tag-lock { background: var(--n-400); }

/* ============================================================
   10. 用户 / 头像
   ============================================================ */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 50%;
  flex: none;
  vertical-align: middle;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(35, 42, 61, .06);
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.user-name {
  color: var(--n-700);
  font-weight: 600;
  font-size: 14px;
  transition: color var(--t-fast) var(--ease);
}
.user-name:hover { color: var(--c-primary); }

/* ============================================================
   11. 帖子详情页
   ============================================================ */
.thread-hd {
  background: var(--c-card);
  border: 1px solid rgba(35, 42, 61, .06);
  border-radius: var(--r-card);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.thread-hd::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--c-accent), var(--c-primary));
  opacity: .85;
}
.thread-hd h1 { margin-bottom: var(--sp-2); font-size: 22px; line-height: 1.4; }
.thread-hd .t-meta { margin: 0; }

.thread-body {
  font-size: var(--fs-md);
  line-height: 1.75;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.thread-body p { margin: 0 0 1em; }
.thread-body img { max-width: 100%; border-radius: var(--r-sm); }
.thread-body a { color: var(--c-primary); }
.thread-body a:hover { text-decoration: underline; }
.thread-body blockquote { margin: 0; }
.thread-body pre { margin: 0; white-space: pre-wrap; word-break: break-word; }
.thread-body u { text-underline-offset: 3px; }

.bb-quote {
  margin: var(--sp-3) 0;
  padding: 12px var(--sp-4);
  background: var(--n-100);
  border-left: 3px solid var(--c-primary);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  color: var(--n-700);
  font-size: 14px;
}

.bb-code {
  display: block;
  margin: var(--sp-3) 0;
  padding: 14px var(--sp-4);
  background: #10182b;
  color: #d6e2ff;
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
}

.bb-img {
  display: block;
  max-width: 100%;
  border-radius: var(--r-sm);
  cursor: zoom-in;
  margin: var(--sp-2) 0;
  transition: box-shadow var(--t-med) var(--ease), transform var(--t-med) var(--ease);
}
.bb-img:hover { box-shadow: var(--shadow-md); }

/* 楼层 */
.floor {
  background: var(--c-card);
  border: 1px solid rgba(35, 42, 61, .06);
  border-radius: var(--r-card);
  margin-bottom: var(--sp-3);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--t-med) var(--ease);
}
.floor:hover { box-shadow: var(--shadow-md); }
.floor:target { border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-ring); }

.floor-hd {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  padding: 12px var(--sp-4);
  border-bottom: 1px solid var(--c-line);
  background: rgba(240, 242, 248, .5);
}
.floor-hd .ts { margin-left: auto; }
.floor-hd .floor-no {
  margin-left: auto;
  font-size: 12px;
  color: var(--c-faint);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.floor-bd { padding: var(--sp-4); font-size: var(--fs-md); line-height: 1.75; }
.floor-bd p { margin: 0 0 .8em; }
.floor-bd p:last-child { margin-bottom: 0; }

.floor-ft {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  padding: 10px var(--sp-4);
  border-top: 1px solid var(--c-line);
}

/* 点赞 / 收藏 / 打赏 */
.like-btn, .fav-btn, .tip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 5px 15px;
  border-radius: var(--r-full);
  border: 1px solid var(--n-200);
  background: var(--c-card);
  color: var(--n-600);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: all var(--t-fast) var(--ease);
}
.like-btn:hover, .fav-btn:hover {
  border-color: var(--c-primary);
  color: var(--c-primary);
  background: var(--c-primary-soft);
  transform: translateY(-1px);
}
.tip-btn:hover {
  border-color: var(--c-accent-deep);
  color: var(--c-accent-deep);
  background: var(--c-accent-soft);
  transform: translateY(-1px);
}

.like-btn .count, .like-btn .like-count {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 1em;
}

/* JS 依赖选择器（显式声明，保证存在与行为样式正确） */
.reply-btn { min-height: 34px; }
.js-confirm { display: inline; margin: 0; }
#replyToHint { font-size: var(--fs-sm); color: var(--c-faint); }
#replyToHint a, #replyToCancel { color: var(--c-primary); font-weight: 600; }
#reply { scroll-margin-top: 76px; }
#reply .textarea { background: var(--n-50); }
#tipAmount { margin-top: 2px; }
#tipCancel, #tipOk { min-height: 40px; }
#replyToInput { display: none; }  /* hidden input，声明以保证选择器存在 */

.like-btn.liked {
  background: var(--c-err-soft);
  border-color: rgba(199, 58, 63, .4);
  color: var(--c-err);
  animation: popIn var(--t-med) var(--ease-spring);
}
.fav-btn.liked {
  background: var(--c-accent-soft);
  border-color: rgba(255, 140, 26, .45);
  color: var(--c-accent-deep);
  animation: popIn var(--t-med) var(--ease-spring);
}

/* ============================================================
   12. 表单
   ============================================================ */
.form-group { margin-bottom: var(--sp-4); }
.form-group > label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--n-700);
  margin-bottom: 7px;
}

.input, .textarea, .select {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--n-300);
  border-radius: var(--r-sm);
  background: var(--c-card);
  color: var(--c-text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 42px;              /* 触控目标 ≥44px（含边线≈42+焦点环） */
  transition: border-color var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--n-400); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-ring);
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.7; }
.select { appearance: auto; }

.form-err { color: var(--c-err); font-size: var(--fs-sm); margin-top: 6px; }
.form-hint { color: var(--c-faint); font-size: 12px; margin-top: 5px; }

/* 发帖工具栏 */
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: var(--sp-2);
  padding: 5px;
  background: var(--n-100);
  border: 1px solid var(--c-line);
  border-radius: var(--r-sm);
  width: fit-content;
  max-width: 100%;
}
.editor-toolbar button {
  min-width: 36px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--n-700);
  font-size: 13px;
  font-weight: 700;
  transition: all var(--t-fast) var(--ease);
}
.editor-toolbar button:hover {
  border-color: rgba(59, 91, 219, .3);
  color: var(--c-primary);
  background: var(--c-card);
}

/* ============================================================
   13. 反馈（toast / 空态 / 通知 / 私信 / 搜索）
   ============================================================ */
#toastBox {
  position: fixed;
  top: 72px;
  right: 18px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
}

.toast {
  background: var(--n-900);
  color: #fff;
  padding: 11px 20px;
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  max-width: 340px;
  animation: toastIn var(--t-med) var(--ease-spring);
  transition: opacity .4s var(--ease), transform .4s var(--ease);
}
.toast.ok { background: var(--c-ok); }
.toast.err { background: var(--c-err); }
.toast.out { opacity: 0; transform: translateY(-10px) scale(.96); }

.empty-state {
  text-align: center;
  color: var(--c-faint);
  padding: 52px var(--sp-4);
  font-size: 14px;
}
.empty-state .empty-ico { font-size: 36px; display: block; margin-bottom: var(--sp-2); }

.unread { font-weight: 600; position: relative; }
.unread::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-primary);
  margin-right: 7px;
  vertical-align: middle;
  box-shadow: 0 0 0 3px var(--c-primary-ring);
}

.notice-item {
  display: flex;
  gap: var(--sp-2);
  align-items: flex-start;
  padding: 13px var(--sp-2);
  border-bottom: 1px solid var(--c-line);
  font-size: 14px;
  border-radius: var(--r-sm);
  transition: background var(--t-fast) var(--ease);
}
.notice-item:last-child { border-bottom: 0; }
.notice-item:hover { background: var(--n-100); }
.notice-item.unread { background: var(--c-primary-soft); }
.notice-item.unread:hover { background: rgba(59, 91, 219, .13); }
.notice-item .n-time, .notice-item .ts { color: var(--c-faint); font-size: 12px; white-space: nowrap; }

.search-hit { padding: 13px var(--sp-2); }
.search-hit:last-child { border-bottom: 0; }

mark, .mark {
  background: linear-gradient(transparent 55%, rgba(255, 179, 64, .55) 55%);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
  font-weight: 700;
}

/* 私信列表 */
.msg-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 13px var(--sp-2);
  border-bottom: 1px solid var(--c-line);
  border-radius: var(--r-sm);
  color: inherit;
  transition: background var(--t-fast) var(--ease);
}
.msg-item:last-child { border-bottom: 0; }
.msg-item:hover { background: var(--n-100); color: inherit; }

.msg-item .m-main { flex: 1; min-width: 0; }
.msg-item .m-last {
  font-size: var(--fs-sm);
  color: var(--c-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg-item .m-time { flex: none; font-size: 12px; color: var(--c-faint); }
.msg-item .m-badge,
.msg-item b[style*="border-radius"] {
  flex: none;
  min-width: 19px;
  height: 19px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--c-err);
  color: #fff;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 700;
  font-style: normal;
}

/* 聊天气泡 */
.chat-box {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-4);
  max-height: 60vh;
  overflow-y: auto;
}

.chat-me, .chat-item, .chat-you {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.chat-me { justify-content: flex-end; }
.chat-item, .chat-you { justify-content: flex-start; }

.chat-me > div, .chat-item > div, .chat-you > div {
  max-width: 72%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
  box-shadow: var(--shadow-xs);
}
.chat-me > div {
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-dark));
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-item > div, .chat-you > div {
  background: var(--n-100);
  color: var(--n-800);
  border-bottom-left-radius: 4px;
}
.chat-me .ts, .chat-item .ts { color: inherit; opacity: .7; }

/* ============================================================
   14. 签到
   ============================================================ */
.sign-card {
  background: var(--c-card);
  border: 1px solid rgba(35, 42, 61, .06);
  border-radius: var(--r-card);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
}

/* JS 依赖：#signinBtn / #signStreak */
#signinBtn {
  font-size: 17px;
  padding: 13px 52px;
  border-radius: var(--r-full);
}
#signinBtn.signed { opacity: .75; cursor: default; transform: none; }
#signStreak { color: var(--c-accent-deep); font-size: 1.15em; }

.sign-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: var(--sp-3);
}
.sign-calendar .sc-head {
  text-align: center;
  font-size: 12px;
  color: var(--c-faint);
  padding: 4px 0;
}
.sign-calendar .sc-day {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px 0;
  min-height: 38px;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--n-500);
  background: var(--n-100);
  border: 1.5px solid transparent;
  font-variant-numeric: tabular-nums;
  transition: all var(--t-fast) var(--ease);
}
.sign-calendar .sc-day.empty { background: transparent; }
.sign-calendar .sc-day.on {
  background: linear-gradient(135deg, #10a06f, var(--c-ok));
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(13, 138, 95, .35);
}
.sign-calendar .sc-day.today {
  border-color: var(--c-primary);
  color: var(--c-primary);
}

/* ============================================================
   15. 分页
   ============================================================ */
.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: var(--sp-5) 0;
}
.pager a, .pager span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--r-full);
  background: var(--c-card);
  border: 1px solid var(--n-200);
  color: var(--n-700);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--t-fast) var(--ease);
}
.pager a:hover {
  border-color: var(--c-primary);
  color: var(--c-primary);
  background: var(--c-primary-soft);
  transform: translateY(-1px);
}
.pager .cur {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: #fff;
  font-weight: 700;
  box-shadow: var(--shadow-primary);
}
.pager .dots { border: 0; background: transparent; color: var(--c-faint); }

/* ============================================================
   16. 表格 / 进度条（后台与资料页复用）
   ============================================================ */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  background: var(--c-card);
}
.table th, .table td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--c-line);
  word-break: break-word;
}
.table th {
  background: var(--n-100);
  font-weight: 700;
  color: var(--n-900);
  white-space: nowrap;
}
.table tr:hover td { background: var(--c-primary-soft); }
.table tr:last-child td { border-bottom: 0; }

.progress-bar {
  height: 8px;
  background: var(--n-100);
  border-radius: var(--r-full);
  overflow: hidden;
}
.progress-in, .progress-bar > div {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--c-primary), #5f7cf0);
  border-radius: var(--r-full);
  transition: width .4s var(--ease);
}

/* ============================================================
   17. 弹层（打赏 / 图片放大）
   ============================================================ */
.tip-modal-mask, #tipModalMask {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 36, .5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn var(--t-fast) var(--ease);
  padding: var(--sp-5);
}
.tip-modal, #tipModal {
  background: var(--c-card);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  width: min(340px, 100%);
  box-shadow: var(--shadow-lg);
  animation: modalIn var(--t-med) var(--ease-spring);
}
.tip-modal h3, #tipModal h3 { margin-bottom: var(--sp-3); font-size: 17px; }
.tip-modal .tip-actions, #tipModal .tip-actions {
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
  margin-top: var(--sp-4);
}

.img-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 24, .9);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: calc(var(--z-modal) + 100);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: fadeIn var(--t-fast) var(--ease);
  padding: var(--sp-4);
}
.img-overlay img {
  max-width: 94vw;
  max-height: 92vh;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  animation: modalIn var(--t-med) var(--ease-spring);
}

/* ============================================================
   18. 页脚
   ============================================================ */
.site-footer {
  background: var(--c-main);
  color: rgba(255, 255, 255, .72);
  padding: var(--sp-6) 0 calc(var(--sp-6) + 4px);
  text-align: center;
  font-size: var(--fs-sm);
  margin-top: var(--sp-6);
}
.site-footer p { margin: 0 0 5px; }
.site-footer a { color: rgba(255, 255, 255, .88); }
.site-footer a:hover { color: #fff; }
.site-footer .ts { color: rgba(255, 255, 255, .5); font-size: 12px; }

/* ============================================================
   19. 响应式显隐
   ============================================================ */
.hide-m { display: initial; }
.hide-pc { display: none !important; }

/* ============================================================
   20. 动画
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-12px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes popIn {
  0%   { transform: scale(.85); }
  60%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   21. 移动端 ≤768px
   ============================================================ */
@media (max-width: 768px) {
  body { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }

  .container { padding: 0 var(--sp-3); }

  .main-wrap {
    grid-template-columns: 1fr;
    gap: var(--sp-3);
    padding-top: var(--sp-3);
    padding-bottom: var(--sp-5);
  }
  .sidebar { position: static; }

  .hide-m { display: none !important; }
  .hide-pc { display: initial; }

  /* 导航 */
  .nav-inner { gap: var(--sp-2); height: 54px; }
  .nav-links, .nav-search { display: none; }
  .nav-username { display: none; }
  .nav-avatar-btn { padding: 4px; }
  .dropdown-menu { min-width: 160px; top: calc(100% + 8px); }
  .navbar .btn-sm { padding: 6px 14px; min-height: 36px; }

  .site-notice { font-size: 13px; padding: 9px var(--sp-3); border-radius: var(--r-sm); }
  .stat-bar { padding: var(--sp-3); gap: var(--sp-1); border-radius: var(--r-md); }
  .stat-bar .stat b { font-size: 18px; }
  .stat-bar .stat { min-width: calc(20% - 4px); }

  .card { padding: var(--sp-4); border-radius: var(--r-md); }
  .card-hd { font-size: 15px; }

  .thread-item { padding: 12px var(--sp-3); gap: var(--sp-2); }
  .t-title { white-space: normal; font-size: 14px; }
  .t-meta { font-size: 12px; }

  .thread-hd { padding: var(--sp-4); }
  .thread-hd h1 { font-size: 19px; }
  .thread-hd, .floor-hd, .floor-bd, .floor-ft { padding-left: var(--sp-3); padding-right: var(--sp-3); }
  .floor-bd { font-size: 15px; }

  /* 触控目标 ≥44px */
  .btn { min-height: 42px; }
  .btn-sm { min-height: 38px; }
  .like-btn, .fav-btn, .tip-btn { min-height: 40px; }
  .input, .textarea, .select { font-size: 16px; }  /* 防 iOS 聚焦缩放 */
  .pager a, .pager span { min-width: 40px; height: 40px; }

  .chat-me > div, .chat-item > div, .chat-you > div { max-width: 85%; }

  #toastBox {
    top: 64px;
    right: var(--sp-3);
    left: var(--sp-3);
    align-items: flex-end;
  }
  .toast { max-width: 100%; }

  /* 底部导航：毛玻璃 */
  .mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-mobile-nav);
    display: flex;
    background: rgba(255, 255, 255, .82);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    backdrop-filter: saturate(180%) blur(16px);
    border-top: 1px solid rgba(35, 42, 61, .08);
    padding: 5px 0 max(5px, env(safe-area-inset-bottom));
  }
  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .mobile-nav { background: rgba(255, 255, 255, .98); }
  }
  .mobile-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--n-500);
    font-size: 11px;
    font-weight: 500;
    min-height: 50px;
    padding: 5px 0;
    text-decoration: none;
    transition: color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
  }
  .mobile-nav a:active { transform: scale(.94); }
  .mobile-nav a span { font-size: 20px; line-height: 1.2; filter: grayscale(.35); }
  .mobile-nav a:hover, .mobile-nav a.cur { color: var(--c-primary); }
  .mobile-nav a.cur { font-weight: 700; }
  .mobile-nav a.cur span { filter: none; }

  /* 发帖悬浮按钮 */
  .m-nav-post { color: var(--n-500); position: relative; }
  .m-nav-post span {
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--c-accent-bright), var(--c-accent-deep));
    color: var(--c-accent-ink);
    border-radius: 50%;
    font-size: 21px;
    margin-top: -24px;
    box-shadow: var(--shadow-accent), 0 0 0 4px rgba(255, 255, 255, .9);
    filter: none !important;
    transition: transform var(--t-med) var(--ease-spring);
  }
  .m-nav-post:active span { transform: scale(.92); }
  .m-nav-post.cur { color: var(--c-accent-deep); font-weight: 700; }

  .site-footer { margin-top: var(--sp-4); }
}
