/* ============================================================
   吉数彩研院 · 全局设计系统 (global.css)
   设计目标：明亮 / 高端 / 正规 / 统一
   - 统一设计令牌 (design tokens)
   - 统一组件：顶栏 / 容器 / 卡片 / 按钮 / 标签 / 头像 / 评论 / 回复 / 底部导航
   - 所有页面引用本文件，消除"分不清哪个是你哪个"的混乱布局
   ============================================================ */

:root {
  /* ---- 明亮底色 ---- */
  --bg: #eef2f9;
  --bg-grad: linear-gradient(180deg, #f6f9fd 0%, #eef2f9 100%);
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --surface-3: #eef2f9;

  /* ---- 描边 ---- */
  --border: #e7ecf3;
  --border-strong: #d7dfeb;
  --border-soft: #f0f3f8;

  /* ---- 文字 ---- */
  --text: #18223a;
  --text-soft: #5a6678;
  --text-dim: #93a0b5;
  --text-invert: #ffffff;

  /* ---- 品牌色（高端蓝 + 彩票暖金点缀） ---- */
  --brand: #2f6bff;
  --brand-deep: #1b4fd6;
  --brand-soft: #e9f0ff;
  --brand-grad: linear-gradient(135deg, #3b7bff 0%, #2f6bff 55%, #1b4fd6 100%);
  --accent: #f5a623;       /* 暖金，用于强调/中奖 */
  --accent-soft: #fef3e0;
  --win: #e11d48;          /* 红，中奖/点赞 */
  --win-soft: #fdeaef;
  --ok: #16a34a;
  --ok-soft: #e7f6ed;
  --warn: #f59e0b;

  /* ---- 阴影 ---- */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .08);
  --shadow: 0 6px 20px rgba(16, 24, 40, .08);
  --shadow-lg: 0 14px 40px rgba(16, 24, 40, .12);
  --shadow-brand: 0 8px 22px rgba(47, 107, 255, .28);

  /* ---- 圆角 ---- */
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --r-pill: 999px;

  /* ---- 字号 ---- */
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 18px;

  /* ---- 布局 ---- */
  --nav-h: 56px;
  --tab-h: 50px;
  --maxw: 720px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg-grad);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}
a { color: var(--brand); text-decoration: none; }
img { max-width: 100%; }

/* ============ 顶栏 ============ */
.app-header {
  position: sticky; top: 0; z-index: 120;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.app-header .brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 800; font-size: 17px; letter-spacing: .3px;
  color: var(--text);
}
.app-header .brand .logo {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--brand-grad);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px; box-shadow: var(--shadow-brand);
}
.app-header .brand i { color: var(--brand); }
.app-header .actions { display: flex; align-items: center; gap: 10px; }
.app-header .pill-user {
  font-size: var(--fs-sm); color: var(--text-soft);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 5px 11px; border-radius: var(--r-pill); font-weight: 600;
}
.app-header .pill-user b { color: var(--brand-deep); }

/* ============ 容器 ============ */
.app-main { max-width: var(--maxw); margin: 0 auto; padding: 14px 14px calc(var(--nav-h) + 28px); }
.app-section-title {
  font-size: var(--fs-lg); font-weight: 800; color: var(--text);
  margin: 18px 2px 10px; display: flex; align-items: center; gap: 8px;
}
.app-section-title .bar { width: 4px; height: 16px; border-radius: 3px; background: var(--brand-grad); }

/* ============ 卡片 ============ */
.app-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  margin-bottom: 12px;
}
.app-card-flat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); margin-bottom: 12px; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--r-sm); border: 1px solid transparent;
  font-size: var(--fs-md); font-weight: 700; cursor: pointer;
  font-family: inherit; transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand-grad); color: #fff; box-shadow: var(--shadow-brand); }
.btn-primary:hover { box-shadow: 0 10px 26px rgba(47, 107, 255, .36); }
.btn-ghost { background: var(--surface); color: var(--text-soft); border-color: var(--border-strong); }
.btn-ghost:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.btn-gold { background: linear-gradient(135deg, #ffc24b, #f5a623); color: #5a3a00; box-shadow: 0 8px 20px rgba(245, 166, 35, .3); }
.btn-sm { padding: 6px 13px; font-size: var(--fs-sm); border-radius: 9px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ============ 标签 / 胶囊 ============ */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 700;
  background: var(--surface-2); color: var(--text-soft); border: 1px solid var(--border);
}
.chip-brand { background: var(--brand-soft); color: var(--brand-deep); border-color: transparent; }
.chip-gold { background: var(--accent-soft); color: #9a6300; border-color: transparent; }
.chip-win { background: var(--win-soft); color: var(--win); border-color: transparent; }
.chip-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }

/* ============ 头像 ============ */
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; color: #fff;
  background: var(--brand-grad);
  box-shadow: var(--shadow-xs);
}
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.avatar.xs { width: 24px; height: 24px; font-size: 11px; }
.avatar.grey { background: linear-gradient(135deg, #c7d0de, #aab6c8); }
.avatar.gold { background: linear-gradient(135deg, #ffc24b, #f5a623); color: #5a3a00; }

/* 头像配色按用户名哈希，保证同一用户颜色稳定 */
.av-0 { background: linear-gradient(135deg, #5b8cff, #2f6bff); }
.av-1 { background: linear-gradient(135deg, #7c5cff, #5b3df0); }
.av-2 { background: linear-gradient(135deg, #18b6c9, #0e8fa3); }
.av-3 { background: linear-gradient(135deg, #ff8a5b, #f5603a); }
.av-4 { background: linear-gradient(135deg, #ffb13d, #f5910a); }
.av-5 { background: linear-gradient(135deg, #34c77b, #16a34a); }
.av-6 { background: linear-gradient(135deg, #ff6b9d, #e11d8a); }
.av-7 { background: linear-gradient(135deg, #6b7bff, #3b4fd6); }
.av-8 { background: linear-gradient(135deg, #9aa7bd, #6b7890); }
.av-9 { background: linear-gradient(135deg, #f5a623, #d98300); }

/* ============ 分段 / 标签栏（吸顶）============ */
.seg-bar {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding: 2px 0 10px; position: sticky; top: var(--nav-h);
  background: var(--bg-grad); z-index: 90;
}
.seg-bar::-webkit-scrollbar { display: none; }
.seg {
  flex: 0 0 auto; padding: 7px 15px; border-radius: var(--r-pill);
  font-size: var(--fs-sm); font-weight: 700; white-space: nowrap; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-soft);
  transition: all .15s ease;
}
.seg .cnt { font-size: 10px; color: var(--text-dim); font-weight: 600; margin-left: 4px; }
.seg.active { background: var(--brand-grad); color: #fff; border-color: transparent; box-shadow: var(--shadow-brand); }
.seg.active .cnt { color: rgba(255, 255, 255, .85); }

/* ============ 帖子卡片 ============ */
.post {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow-sm);
  padding: 15px; margin-bottom: 13px; position: relative;
  transition: box-shadow .15s ease, transform .15s ease;
}
.post:hover { box-shadow: var(--shadow); }
.post.mine { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.post-head .meta { flex: 1; min-width: 0; }
.post-name { font-weight: 700; font-size: var(--fs-md); color: var(--text); display: flex; align-items: center; gap: 6px; }
.post-name .badge-me { font-size: 10px; background: var(--brand); color: #fff; padding: 1px 6px; border-radius: 6px; font-weight: 700; }
.post-sub { font-size: var(--fs-xs); color: var(--text-dim); margin-top: 1px; }
.post-type {
  font-size: var(--fs-xs); font-weight: 700; padding: 3px 10px; border-radius: var(--r-pill);
  background: var(--brand-soft); color: var(--brand-deep);
}
.post-body { font-size: var(--fs-md); line-height: 1.75; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.post-prize {
  margin-top: 9px; display: inline-flex; align-items: center; gap: 6px;
  background: var(--win-soft); color: var(--win); font-weight: 800; font-size: var(--fs-md);
  padding: 5px 12px; border-radius: var(--r-pill);
}
.post-actions {
  display: flex; gap: 6px; margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--border-soft);
}
.act {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 9px; cursor: pointer;
  font-size: var(--fs-sm); font-weight: 600; color: var(--text-soft);
  background: none; border: none; font-family: inherit; transition: all .12s ease;
}
.act:hover { background: var(--surface-2); color: var(--text); }
.act.liked { color: var(--win); }
.act.liked i { animation: pop .25s ease; }
.act .cnt { font-weight: 700; }
@keyframes pop { 0% { transform: scale(1); } 50% { transform: scale(1.35); } 100% { transform: scale(1); } }

/* 号码球 */
.balls { display: inline-flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.ball {
  width: 28px; height: 28px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-size: 13px; font-weight: 800; color: #fff;
}
.ball.red { background: radial-gradient(circle at 32% 30%, #ff8a80, #d32f2f); }
.ball.blue { background: radial-gradient(circle at 32% 30%, #6fb1ff, #1565c0); }
.ball.digit {
  min-width: 26px; padding: 0 6px; border-radius: 8px; height: 26px;
  background: linear-gradient(135deg, #ffd166, #f5a623); color: #5a3a00;
  box-shadow: var(--shadow-xs);
}
.ball.sm { width: 24px; height: 24px; font-size: 12px; }
.ball-xs { width: 20px; height: 20px; font-size: 11px; }

/* ============ 评论 / 回复（专业、有序）============ */
.comments { margin-top: 4px; }
.comment {
  display: flex; gap: 10px; padding: 11px 0; border-top: 1px solid var(--border-soft);
}
.comment:first-child { border-top: none; }
.comment .c-body { flex: 1; min-width: 0; }
.comment .c-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.comment .c-name { font-weight: 700; font-size: var(--fs-sm); color: var(--text); }
.comment .c-name.me { color: var(--brand-deep); }
.comment .c-tag { font-size: 10px; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); color: var(--text-dim); font-weight: 600; }
.comment .c-time { font-size: var(--fs-xs); color: var(--text-dim); margin-left: auto; }
.comment .c-text { font-size: var(--fs-sm); color: var(--text-soft); line-height: 1.7; margin-top: 3px; word-break: break-word; }
.comment .c-foot { display: flex; gap: 14px; margin-top: 5px; }
.comment .c-fn {
  font-size: var(--fs-xs); color: var(--text-dim); cursor: pointer; background: none; border: none;
  font-family: inherit; display: inline-flex; align-items: center; gap: 4px; padding: 2px 0;
}
.comment .c-fn:hover { color: var(--brand); }

/* 楼中楼回复：缩进 + 左侧引导线，干净专业 */
.replies { margin: 6px 0 2px 30px; padding-left: 12px; border-left: 2px solid var(--border); }
.reply { display: flex; gap: 8px; padding: 8px 0; }
.reply .c-body { flex: 1; min-width: 0; }
.reply .c-name { font-size: var(--fs-sm); }
.reply .c-text { font-size: var(--fs-sm); }

/* 评论输入 */
.c-input {
  display: flex; gap: 8px; margin-top: 10px; align-items: center;
}
.c-input input, .c-input textarea {
  flex: 1; min-width: 0; padding: 9px 13px; border: 1px solid var(--border-strong);
  border-radius: var(--r-pill); font-size: var(--fs-sm); font-family: inherit; outline: none;
  background: var(--surface-2); color: var(--text);
}
.c-input input:focus, .c-input textarea:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px var(--brand-soft); }
.c-input button {
  flex: 0 0 auto; padding: 9px 16px; border-radius: var(--r-pill); border: none;
  background: var(--brand-grad); color: #fff; font-weight: 700; font-size: var(--fs-sm);
  cursor: pointer; font-family: inherit; box-shadow: var(--shadow-brand);
}
.c-input button:disabled { opacity: .5; cursor: not-allowed; }

/* 空状态 */
.empty {
  text-align: center; padding: 48px 20px; color: var(--text-dim);
}
.empty i { font-size: 44px; opacity: .28; display: block; margin-bottom: 12px; }
.empty .t { font-size: var(--fs-md); font-weight: 600; color: var(--text-soft); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 24px); transform: translateX(-50%) translateY(16px);
  background: #18223a; color: #fff; padding: 11px 20px; border-radius: var(--r-pill);
  font-size: var(--fs-sm); font-weight: 600; opacity: 0; pointer-events: none;
  transition: all .26s ease; z-index: 999; box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 浮层（发帖）*/
.sheet-mask {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .45);
  z-index: 300; display: none; align-items: flex-end;
}
.sheet-mask.show { display: flex; }
.sheet {
  width: 100%; max-width: var(--maxw); margin: 0 auto; background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 18px; max-height: 86vh; overflow: auto;
  box-shadow: var(--shadow-lg);
}
.sheet h3 { font-size: var(--fs-lg); font-weight: 800; margin: 0 0 14px; display: flex; justify-content: space-between; align-items: center; }
.sheet h3 .x { font-size: 22px; color: var(--text-dim); cursor: pointer; line-height: 1; }
.sheet textarea {
  width: 100%; min-height: 96px; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  padding: 11px 13px; font-size: var(--fs-md); resize: vertical; outline: none; font-family: inherit;
  background: var(--surface-2); color: var(--text);
}
.sheet textarea:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px var(--brand-soft); }
.row { display: flex; gap: 8px; margin-top: 11px; flex-wrap: wrap; align-items: center; }
.row select, .row input[type=text] {
  padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  font-size: var(--fs-sm); background: var(--surface); font-family: inherit; color: var(--text); outline: none;
}
.row select:focus, .row input:focus { border-color: var(--brand); }

/* 浮动发帖按钮 */
.fab {
  position: fixed; right: 18px; bottom: calc(var(--nav-h) + 20px); z-index: 200;
  width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--brand-grad); color: #fff; font-size: 26px; box-shadow: var(--shadow-brand);
  display: flex; align-items: center; justify-content: center;
}
.fab:active { transform: scale(.94); }

/* 统计条 */
.stat-row { display: flex; gap: 10px; flex-wrap: wrap; }
.stat {
  flex: 1; min-width: 90px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 12px; text-align: center;
}
.stat .v { font-size: var(--fs-xl); font-weight: 800; color: var(--brand-deep); }
.stat .l { font-size: var(--fs-xs); color: var(--text-dim); margin-top: 2px; }

/* 加载 */
.loading { text-align: center; color: var(--text-dim); padding: 24px; font-size: var(--fs-sm); }
.loading i { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 脚部 */
.app-foot { text-align: center; color: var(--text-dim); font-size: var(--fs-sm); padding: 22px 16px calc(var(--nav-h) + 24px); }
.app-foot a { color: var(--text-soft); }

/* 滚动条美化 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d7dfeb; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #c2cde0; }
