/* 用户中心 / 评论 / AI 问答：前台新增模块样式。
   与 base.css、pc.css 共用变量；不覆盖既有选择器。 */

/* ---------------- 顶栏用户入口 ---------------- */
/* position:relative 供未读角标绝对定位到头像右上角。 */
.user-entry a { position: relative; display: inline-flex; align-items: center; gap: 4px; min-height: 22px; line-height: 1; color: var(--text-3); }
.user-entry a:hover { color: var(--brand); }
/* 用户功能区 hover 只换文字色，不铺底色；否则会命中顶栏通用链接的浅红胶囊背景。 */
.top-bar .site-link .user-entry a:hover { background: none; }
.user-avatar-mini {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: inline-block; text-align: center;
  /* 用行高而不是 flex 居中：CJK 字形在 flex 基线里容易偏下。 */
  line-height: 22px;
  background: var(--brand); color: #fff; font-size: var(--fs-2xs);
}
/* 未读角标：叠在头像右上角（PC 顶栏 .user-entry / 移动端 .header-user 共用）。
   白描边用 box-shadow 而不是 border，避免 13px 的盒子里再挤出 4px 给边框。
   right:6px 是扣掉顶栏链接的 10px 左右内边距后的位置，让角标贴住头像右上角。 */
.user-unread {
  position: absolute; top: -4px; right: 6px;
  display: inline-block; min-width: 13px; height: 13px; line-height: 13px;
  padding: 0 3px; border-radius: 7px;
  background: var(--brand); color: #fff; font-size: var(--fs-3xs); text-align: center;
  box-shadow: 0 0 0 2px #fff;
}
/* 这两个元素自带的 display 会覆盖 [hidden]，没有未读时不能留下空红点。 */
.user-avatar-mini[hidden], .user-unread[hidden] { display: none !important; }

/* 移动端头部登录入口：PC 隐藏，wap 下显示在 Logo 与汉堡按钮之间。 */
.header-user { display: none; }
html[data-dev="wap"] .header-user {
  position: relative;
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  margin-left: auto; color: var(--text); font-size: var(--fs-sm); text-decoration: none;
}
/* 移动端入口没有内边距，角标从头像右边缘再外扩 4px。 */
html[data-dev="wap"] .header-user .user-unread { right: -4px; }
html[data-dev="wap"] .header-user .user-avatar-mini { width: 28px; height: 28px; line-height: 28px; font-size: var(--fs-xs); }

/* 首屏登录态占位（见 js/auth-state.js）。
   模板里的入口只能写「登录 / 注册」，登录态要等 member.js 调 /auth/me 水合，
   接口回来前的那一帧就是已登录用户切页看到的闪烁。auth-state.js 在 <head> 里同步
   把 localStorage 快照写成 html[data-auth]，这里在首次绘制前就把头像画出来；
   member.js 水合完成后打上 html[data-auth-ready]，本段规则整体失效、交回真实 DOM。
   两边画的是同一套头像字符，切换时看不出跳变。
   —— data-auth="unknown"：本浏览器没有快照（首次访问），宁可先留空也不要画错状态。
   —— data-auth="in"：快照里有合法头像标识，头像字符用 ::before 补（固定八个，可穷举）。
   —— data-auth="out"：游客，模板默认的「登录 / 注册」本来就是对的，无需处理。 */
html[data-auth="unknown"]:not([data-auth-ready]) [data-user-entry] { visibility: hidden; }
html[data-auth="in"]:not([data-auth-ready]) [data-user-entry] [data-user-name] { display: none !important; }
html[data-auth="in"]:not([data-auth-ready]) [data-user-entry] .user-avatar-mini { display: inline-block !important; }
html[data-auth="in"][data-avatar="a1"]:not([data-auth-ready]) [data-user-entry] .user-avatar-mini::before { content: '彩'; }
html[data-auth="in"][data-avatar="a2"]:not([data-auth-ready]) [data-user-entry] .user-avatar-mini::before { content: '运'; }
html[data-auth="in"][data-avatar="a3"]:not([data-auth-ready]) [data-user-entry] .user-avatar-mini::before { content: '福'; }
html[data-auth="in"][data-avatar="a4"]:not([data-auth-ready]) [data-user-entry] .user-avatar-mini::before { content: '喜'; }
html[data-auth="in"][data-avatar="a5"]:not([data-auth-ready]) [data-user-entry] .user-avatar-mini::before { content: '财'; }
html[data-auth="in"][data-avatar="a6"]:not([data-auth-ready]) [data-user-entry] .user-avatar-mini::before { content: '赢'; }
html[data-auth="in"][data-avatar="a7"]:not([data-auth-ready]) [data-user-entry] .user-avatar-mini::before { content: '顺'; }
html[data-auth="in"][data-avatar="a8"]:not([data-auth-ready]) [data-user-entry] .user-avatar-mini::before { content: '发'; }

/* ---------------- 表单 ---------------- */
.auth-form { max-width: 460px; }
.auth-field { display: block; margin-bottom: 14px; }
/* .auth-field 的 display:block 会覆盖 [hidden]，登录方式切换必须显式隐藏。 */
.auth-field[hidden] { display: none !important; }
/* 只作用于字段标签，避免把验证码/短信验证码的横向行也变成 block。 */
.auth-field > span:first-child { display: block; margin-bottom: 6px; color: var(--text-2); font-size: var(--fs-sm); }
.auth-field input[type="text"],
.auth-field input[type="tel"],
.auth-field input[type="password"] {
  width: 100%; height: var(--ctl-h); padding: 0 12px; box-sizing: border-box;
  border: 1px solid #dfe3ea; border-radius: var(--ctl-radius); background: #fff; font-size: var(--fs-base);
}
.auth-field input:focus { border-color: var(--brand); outline: none; }
.auth-code-row { display: flex; gap: 10px; align-items: center; }
.auth-code-row input { flex: 1; min-width: 0; }
.auth-code-row .layui-btn { flex: none; height: var(--ctl-h); line-height: var(--ctl-h); }
.captcha-row { display: flex; gap: 10px; align-items: center; }
.captcha-row input { flex: 1; min-width: 0; }
.captcha-img { width: 132px; height: var(--ctl-h); border: 1px solid #dfe3ea; border-radius: var(--ctl-radius); cursor: pointer; }
.auth-links { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; font-size: var(--fs-sm); }
.auth-remember { color: var(--text-2); }
.auth-submit { width: 100%; height: 42px; line-height: 42px; }
/* 找回密码等独立流程的返回入口：重置按钮下方并排「返回登录 / 注册新账号」 */
.auth-alt-actions { display: flex; gap: 10px; margin-top: 12px; }
.auth-alt-actions .layui-btn { flex: 1; height: 38px; line-height: 38px; margin: 0; }
.auth-alt { margin-top: 14px; color: var(--text-2); font-size: var(--fs-sm); }
.auth-tip { margin-top: 10px; color: var(--brand); font-size: var(--fs-sm); }
.auth-tip.ok { color: var(--success); }
/* 密码登录 / 验证码登录：沿用评论排序的分段控件，整条浅灰轨道 + 白色选中块，
   不再让两个按钮各带描边拼接，避免选中态边框与相邻项割裂。 */
.auth-tabs {
  display: inline-flex; gap: 2px; padding: 4px;
  background: #eef1f5; border-radius: 10px; margin-bottom: 18px;
}
.auth-tabs button {
  border: 0; background: transparent; padding: 7px 18px; border-radius: 8px;
  font-size: var(--fs-base); line-height: 1.5; color: var(--text-2); cursor: pointer;
}
.auth-tabs button:hover { color: var(--brand); }
.auth-tabs button.active {
  background: #fff; color: var(--brand); font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}

/* ---------------- 用户中心布局 ---------------- */
.user-layout { display: grid; grid-template-columns: 220px 1fr; gap: var(--card-gap) var(--card-gap-x); }
/* 左右两栏都是 .card，全局 .card + .card 的 margin-top 会把右栏往下推。 */
.user-layout > .card + .card { margin-top: 0; }
.user-nav { display: flex; flex-direction: column; }
.user-nav a {
  padding: 10px 12px; border-radius: 8px; color: var(--text-2); font-size: var(--fs-base);
  display: flex; justify-content: space-between; align-items: center;
}
.user-nav a:hover { background: #f6f7f9; }
.user-nav a.active { background: #fdecec; color: var(--brand); font-weight: 600; }
.user-nav-badge {
  min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--brand); color: #fff; font-size: var(--fs-2xs); text-align: center;
}
.user-nav-badge[hidden] { display: none !important; }
.user-main .card-bd { padding: var(--pad-y) var(--pad-x); }
.user-profile { display: flex; align-items: center; gap: 14px; padding-bottom: 16px; }
.user-avatar {
  width: 56px; height: 56px; border-radius: 50%; background: var(--brand); color: #fff;
  font-size: var(--fs-2xl); display: flex; align-items: center; justify-content: center;
}
.user-profile-name { margin: 0 0 4px; font-size: var(--fs-lg); font-weight: 600; }
.user-profile-phone, .user-profile-date { margin: 0; color: var(--text-3); font-size: var(--fs-sm); }
.avatar-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.avatar-picker button {
  width: 40px; height: 40px; border-radius: 50%; border: 2px solid transparent;
  background: #f2f3f5; color: var(--text-2); cursor: pointer; font-size: var(--fs-base);
}
.avatar-picker button.active { border-color: var(--brand); color: var(--brand); background: #fdecec; }
.user-hr { margin: var(--gap-lg) 0; border: 0; border-top: 1px solid #eef0f3; }
.user-subtitle { margin: 0 0 12px; font-size: var(--fs-lg); }
.user-loading { color: var(--text-3); }

/* ---------------- 我的评论 / 通知 ---------------- */
.user-comments .uc-item { padding: 14px 0; border-bottom: 1px solid #f0f1f4; }
.user-comments .uc-head { display: flex; justify-content: space-between; font-size: var(--fs-sm); color: var(--text-3); }
.user-comments .uc-group-count { color: var(--brand); font-weight: 600; }
.user-comments .uc-content { margin: 8px 0; color: var(--text); line-height: 1.7; }
.user-comments .uc-article a { color: var(--link); }
.badge-status { padding: 1px 8px; border-radius: 10px; font-size: var(--fs-xs); }
.badge-status.s0 { background: #fff4e5; color: #8a5200; }
.badge-status.s1 { background: #e8f7f1; color: #1d7d64; }
.badge-status.s2 { background: #fdecec; color: #c62828; }
.badge-status.s3 { background: #f0f1f4; color: var(--text-3); }
.notify-tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
/* 「全部已读」：靠右的明确按钮样式，带双勾图标。 */
.notify-read-all {
  margin-left: auto; display: inline-flex; align-items: center; gap: 5px;
  height: 30px; padding: 0 12px; border: 1px solid var(--btn-border); border-radius: 15px;
  background: #fff; color: var(--text-2); font-size: var(--fs-sm); line-height: 1; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.notify-read-all svg { width: 14px; height: 14px; flex: none; }
.notify-read-all:hover { color: var(--brand); border-color: #f0b4b4; background: #fff7f7; }
.notify-tabs button {
  padding: 5px 12px; border: 1px solid var(--btn-border); background: #fff; border-radius: 14px;
  font-size: var(--fs-sm); cursor: pointer; color: var(--text-2);
}
.notify-tabs button.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.nf-item { padding: 12px 0; border-bottom: 1px solid #f0f1f4; }
.nf-item .nf-title { font-weight: 600; color: var(--text); margin: 0 0 4px; font-size: var(--fs-base); }
.nf-item.unread .nf-title::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px;
  border-radius: 50%; background: var(--brand); vertical-align: middle;
}
.nf-item .nf-body { margin: 0; color: var(--text-2); font-size: var(--fs-sm); line-height: 1.6; }
.nf-item .nf-time { color: var(--text-3); font-size: var(--fs-xs); }
/* 可复制文本（兑换码）：码本身用等宽字体给用户看，右侧一个小「复制」按钮。
   整条通知不跳转，所以这里承担了主要操作入口。 */
.nf-copy { display: flex; align-items: center; gap: 10px; margin: 8px 0 2px; flex-wrap: wrap; }
.nf-code {
  padding: 3px 10px; border-radius: 6px; background: #f5f6f8; border: 1px solid #e8eaef;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--fs-base); letter-spacing: .06em; color: var(--text);
}
.nf-copy-btn {
  height: 26px; padding: 0 12px; border-radius: 13px; cursor: pointer;
  border: 1px solid #f0c7c3; background: #fff; color: var(--brand);
  font-size: var(--fs-xs); line-height: 1; transition: background .15s, color .15s;
}
.nf-copy-btn:hover { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------------- 文章评论 ---------------- */
/* 评论区在文章主列（.art-main）内、正文卡片之后，与上方文章保持全站统一的 --gap；
   这样移动端单列时评论紧跟正文，不会落到侧栏卡片后面。
   外观与 .card 同一条语言：白底、直角、无描边、无投影 —— 上方正文本身就是这样的
   白块，评论区再画一圈 1px 边框 + 14px 圆角会凭空多出一个「卡中卡」的层级。 */
.comment-section { margin: var(--card-gap) 0 0; background: #fff; border: 0; border-radius: 0; padding: var(--pad-y) var(--pad-x); box-shadow: none; }
.comment-hd { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.comment-hd h2 { margin: 0; font-size: var(--fs-xl); }
.comment-count { color: var(--text-3); font-size: var(--fs-base); font-weight: 400; }
/* 最新 / 最早：沿用走势图那种分段控件，整条浅灰轨道 + 白色选中块，
   不再用拼接边框，避免选中项红框与相邻项错位、看起来被割裂。 */
.comment-order {
  display: inline-flex; gap: 2px; padding: 3px;
  background: #eef1f5; border-radius: 9px;
}
.comment-order button {
  border: 0; background: transparent; padding: 4px 12px; cursor: pointer;
  font-size: var(--fs-sm); color: var(--text-2); border-radius: 7px; line-height: 1.5;
}
.comment-order button:hover { color: var(--brand); }
.comment-order button.active {
  background: #fff; color: var(--brand); font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}
.comment-login-tip { color: var(--text-3); font-size: var(--fs-base); padding: 14px 0; }
.comment-login-tip a { color: var(--link); }
.comment-form-wrap textarea {
  width: 100%; min-height: 88px; box-sizing: border-box; padding: 10px 12px;
  border: 1px solid #dfe3ea; border-radius: var(--ctl-radius); resize: vertical; font-size: var(--fs-base);
}
.comment-form-wrap textarea:focus,
.cm-reply-form textarea:focus {
  outline: none; border-color: var(--brand);
}
.comment-editor-ft { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; }
.comment-ft-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.comment-emoji { position: relative; display: inline-flex; }
.comment-emoji-btn {
  border: 0; background: none; padding: 0; cursor: pointer;
  color: var(--text-3); font-size: var(--fs-sm); line-height: 1.6;
}
.comment-emoji-btn:hover { color: var(--brand); }
.comment-emoji-pop {
  position: absolute; left: 0; bottom: 28px; z-index: 30;
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px;
  width: 252px; max-width: calc(100vw - 40px); padding: 8px;
  background: #fff; border: 1px solid #e5e6eb; border-radius: 10px;
  box-shadow: var(--shadow-md);
}
.comment-emoji-pop[hidden] { display: none !important; }
.comment-emoji-pop button {
  border: 0; background: none; padding: 3px 0; border-radius: 6px;
  font-size: var(--fs-xl); line-height: 1.35; cursor: pointer;
}
.comment-emoji-pop button:hover { background: #f2f3f5; }
.comment-counter { color: var(--text-3); font-size: var(--fs-xs); }
/* 发表 / 回复 / 保存资料按钮的提交中状态：转圈 + 文案，避免重复点击。 */
.comment-editor-ft button.is-loading,
.cm-reply-ft button.is-loading,
.user-edit button.is-loading {
  display: inline-flex; align-items: center; opacity: .8; cursor: wait;
}
.comment-editor-ft button.is-loading::before,
.cm-reply-ft button.is-loading::before,
.user-edit button.is-loading::before {
  content: ''; width: 12px; height: 12px; margin-right: 5px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: comment-spin .7s linear infinite;
}
@keyframes comment-spin { to { transform: rotate(360deg); } }
.comment-tip { margin: 10px 0; font-size: var(--fs-sm); color: var(--brand); }
.comment-tip.ok { color: var(--success); }
.comment-list { margin-top: 8px; }
.comment-loading { color: var(--text-3); }
.cm-item { padding: 16px 0; border-top: 1px solid #f0f1f4; }
.cm-head { display: flex; align-items: center; gap: 10px; }
.cm-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: #f2f3f5; color: var(--text-2);
  display: flex; align-items: center; justify-content: center; font-size: var(--fs-base); flex: none;
}
.cm-meta { flex: 1; min-width: 0; }
.cm-name { font-size: var(--fs-base); color: var(--text); font-weight: 600; }
.cm-time { font-size: var(--fs-xs); color: var(--text-3); margin-left: 8px; }
.cm-content { margin: 10px 0 8px; color: var(--text); line-height: 1.75; word-break: break-word; }
.cm-actions { display: flex; gap: 14px; font-size: var(--fs-sm); }
.cm-actions button { border: 0; background: none; color: var(--text-3); cursor: pointer; padding: 0; }
.cm-actions button:hover { color: var(--brand); }
.cm-replies { margin: 10px 0 0 44px; padding: 10px 12px; background: #f8f9fb; border-radius: 4px; }
.cm-reply { padding: 6px 0; font-size: var(--fs-sm); color: var(--text-2); line-height: 1.65; }
.cm-reply .cm-reply-name { color: var(--link); margin-right: 6px; }
.cm-reply-form { margin: 10px 0 0 44px; }
.cm-reply-form textarea {
  width: 100%; min-height: 62px; box-sizing: border-box; padding: 8px 10px;
  border: 1px solid #dcdfe6; border-radius: var(--ctl-radius); resize: vertical; font-size: var(--fs-sm);
}
.cm-reply-form .cm-reply-ft { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; }
.cm-reply-ft .comment-ft-right { display: inline-flex; gap: 8px; }
.comment-more { text-align: center; padding: 14px 0 0; }
/* layui 的 .layui-btn 会设置 display，覆盖 [hidden] 默认样式；必须显式隐藏。 */
.comment-more [hidden], [data-comment-more][hidden] { display: none !important; }

/* ---------------- AI 悬浮入口与面板 ---------------- */
/* .ai-fab/.ai-panel 自带 display:flex，会覆盖 [hidden] 的浏览器默认样式，
   必须显式声明，否则 AI 关闭时入口和面板仍会显示。 */
.ai-fab[hidden], .ai-panel[hidden], .ai-mask[hidden], .ai-inline[hidden] { display: none !important; }
.ai-fab {
  position: fixed; right: 22px; bottom: 96px; z-index: 900;
}
.ai-fab-btn {
  width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(135deg, var(--brand), #b71c1c); color: #fff;
  font-size: var(--fs-xl); font-weight: 700; box-shadow: 0 6px 18px rgba(230, 63, 63, .35);
}
.ai-mask {
  position: fixed; inset: 0; z-index: 940; background: rgba(0, 0, 0, .28);
}
.ai-panel {
  position: fixed; right: 22px; bottom: 96px; z-index: 950;
  width: 380px; max-height: 72vh; display: flex; flex-direction: column;
  background: #fff; border-radius: 10px; box-shadow: 0 12px 40px rgba(0, 0, 0, .18);
  overflow: hidden;
}
.ai-panel-hd {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid #f0f1f4;
}
.ai-panel-title strong { display: block; font-size: var(--fs-md); color: var(--text); }
.ai-panel-title span { font-size: var(--fs-xs); color: var(--text-3); }
.ai-icon-btn {
  width: 26px; height: 26px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 6px; background: none; color: var(--text-3); cursor: pointer;
  transition: background .15s, color .15s;
}
.ai-icon-btn svg { width: 15px; height: 15px; }
.ai-icon-btn:hover { background: #fdecec; color: var(--brand); }
.ai-panel-actions { display: flex; align-items: center; gap: 2px; }
/* 浮窗工具条：左侧彩种切换、右侧「新对话」，与标题区分开，避免头部拥挤。 */
.ai-panel-tools {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 14px; border-bottom: 1px solid #f8dcdc;
}
/* 「新对话」：浮动面板、整页与内嵌卡片共用，胶囊描边 + 加号，避免像普通输入框。 */
.ai-reset-btn {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  height: 28px; padding: 0 12px 0 10px; border: 1px solid #f1d2d2; border-radius: 14px;
  background: #fff; color: var(--brand); font-size: var(--fs-xs); line-height: 1; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.ai-reset-btn::before { content: "+"; font-size: 13px; font-weight: 700; line-height: 1; }
.ai-reset-btn:hover { background: #fff2f2; border-color: var(--brand); }
.ai-inline-reset { margin-left: auto; }
.ai-msgs {
  flex: 1; overflow-y: auto; padding: 12px 14px; min-height: 140px;
  display: flex; flex-direction: column; gap: 10px;
}
.ai-empty { color: var(--text-3); font-size: var(--fs-sm); line-height: 1.7; }
.ai-msg { max-width: 92%; padding: 9px 12px; border-radius: 8px; font-size: var(--fs-base); line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.ai-msg.user { align-self: flex-end; background: #fdecec; color: var(--text); border-top-right-radius: 2px; }
.ai-msg.assistant { align-self: flex-start; background: #f5f6f8; color: var(--text); border-top-left-radius: 2px; }
.ai-msg.assistant .ai-disc { display: block; margin-top: 6px; color: var(--text-3); font-size: var(--fs-xs); }
.ai-msg.pending::after { content: "▍"; animation: ai-blink 1s steps(2) infinite; }
/* 失败 / 无权限提示：与普通回答气泡区分开——浅暖底 + 细描边，正文与操作按钮分两层，
   登录入口做成描边胶囊而不是裸下划线链接，字号统一到 --fs-sm，和全站元信息同一档。 */
.ai-msg.assistant.ai-msg-fail { background: #fff8f7; border: 1px solid #f6e1de; color: var(--text-2); }
.ai-msg-fail .ai-text { display: block; font-size: var(--fs-sm); line-height: 1.7; }
.ai-login-link {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 8px;
  height: 26px; padding: 0 12px; border-radius: 13px;
  border: 1px solid #f0c7c3; background: #fff;
  color: var(--brand); font-size: var(--fs-xs); line-height: 1; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}
.ai-login-link::after { content: "→"; font-size: 12px; line-height: 1; }
.ai-login-link:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
@keyframes ai-blink { 50% { opacity: 0; } }
.ai-suggest { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 8px; }
/* 会话开始后隐藏推荐问题；display:flex 会覆盖 hidden 的默认样式，需显式处理。 */
.ai-suggest[hidden] { display: none; }
.ai-suggest button {
  border: 1px solid var(--btn-border); background: #fff; color: var(--text-2); border-radius: 14px;
  padding: 4px 10px; font-size: var(--fs-xs); cursor: pointer;
}
.ai-suggest button:hover { border-color: var(--brand); color: var(--brand); }
.ai-form { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid #f0f1f4; }
.ai-form textarea {
  flex: 1; min-height: 40px; max-height: 110px; padding: 8px 10px; box-sizing: border-box;
  border: 1px solid #dcdfe6; border-radius: var(--ctl-radius); resize: none; font-size: var(--fs-sm);
}
.ai-form textarea:focus { outline: none; border-color: var(--brand); }
.ai-form .layui-btn { flex: none; align-self: flex-end; }
.ai-note { margin: 0; padding: 8px 14px 12px; color: var(--text-3); font-size: var(--fs-xs); line-height: 1.6; }
.ai-page .ai-surface { padding: 18px 20px; }
.ai-page .ai-msgs { min-height: 260px; max-height: 52vh; }
.ai-inline { margin: var(--card-gap) 0; }
.ai-inline-sub { color: var(--text-3); font-size: var(--fs-xs); margin-left: 8px; font-weight: 400; }
.ai-inline .ai-surface { padding: 14px 16px; }
.ai-inline .ai-msgs { min-height: 120px; max-height: 320px; display: flex; }
.ai-page-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
/* AI 彩票助手：页面内嵌卡片保持白色内容区，只在标题栏铺浅红渐变，
   避免聊天记录区域被渐变色影响可读性；浮动面板仍保留整体渐变。 */
.ai-page > .card.layui-card,
.ai-inline.card.layui-card {
  background: #fff;
  box-shadow: inset 0 2px 0 var(--brand), 0 6px 18px rgba(211, 47, 47, .06);
}
.ai-page > .card.layui-card .card-hd,
.ai-inline.card.layui-card .card-hd {
  background: linear-gradient(180deg, #ffecec 0%, #fff6f6 100%);
}
.ai-page .card-hd h1,
.ai-inline .card-hd h2 { color: var(--brand); }
.ai-panel { background: linear-gradient(180deg, #fff0f0 0%, #fff 34%); }
.ai-panel-hd { border-bottom-color: #f8dcdc; }
.ai-panel-title strong { color: var(--brand); }
.ai-lot-select { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-2); }
/* 自建彩种下拉：与开奖列表页年份下拉同一套视觉，details 原生展开/收起。
   高度走紧凑档 --ctl-h-sm，和旁边的「新对话」胶囊同高；直角同全站控件。 */
.ai-lot-dd { position: relative; }
.ai-lot-btn {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 12px;
  min-width: 118px; height: var(--ctl-h-sm); padding: 0 9px 0 11px;
  border: 1px solid var(--btn-border); border-radius: var(--ctl-radius); background: #fff;
  color: var(--text-2); font-size: var(--fs-sm); cursor: pointer; list-style: none;
  transition: border-color .2s;
}
.ai-lot-btn::-webkit-details-marker { display: none; }
.ai-lot-btn::marker { content: ""; }
.ai-lot-btn:hover { border-color: #c4c4c4; }
.ai-lot-dd[open] .ai-lot-btn { border-color: var(--brand); }
.ai-caret {
  width: 0; height: 0; flex: none;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #999;
  transition: transform .2s;
}
.ai-lot-dd[open] .ai-caret { transform: rotate(180deg); }
.ai-lot-menu {
  position: absolute; left: 0; top: calc(100% + 4px); z-index: 30;
  min-width: 100%; max-height: 280px; overflow-y: auto;
  padding: 4px 0; background: #fff; border: 1px solid #e5e6eb;
  border-radius: 6px; box-shadow: 0 8px 24px rgba(16, 24, 40, .12);
}
.ai-lot-menu button {
  display: block; width: 100%; padding: 7px 14px;
  border: 0; background: none; text-align: left; white-space: nowrap;
  color: var(--text-2); font-size: var(--fs-sm); cursor: pointer;
}
.ai-lot-menu button:hover { background: #f6f7f9; color: var(--brand); }
.ai-lot-menu button.on { background: #fdecec; color: var(--brand); font-weight: 600; }

/* AI 整页：左侧「最近对话」+ 右侧问答区。
   侧栏只放标题与更新时间，宽度固定 208px；主区 min-width:0 防止长回答把栅格撑开。 */
.ai-page-body { display: grid; grid-template-columns: 208px minmax(0, 1fr); gap: 20px; }
.ai-chat { display: flex; flex-direction: column; min-width: 0; }
.ai-history {
  display: flex; flex-direction: column; min-width: 0;
  padding-right: 16px; border-right: 1px solid #f0f1f4;
}
.ai-history-hd {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 2px 8px;
}
.ai-history-hd h2 { margin: 0; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.ai-history-all { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; }
.ai-history-all:hover { color: var(--brand); }
.ai-history-all[hidden] { display: none !important; }
.ai-history-list {
  display: flex; flex-direction: column; gap: 2px;
  min-height: 120px; max-height: 52vh; overflow-y: auto; padding-right: 2px;
}
.ai-history-item {
  display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px;
  background: none; text-align: left; cursor: pointer; transition: background .15s;
}
.ai-history-item:hover { background: #f6f7f9; }
.ai-history-item.on { background: #fdecec; }
.ai-history-title {
  display: block; font-size: var(--fs-sm); color: var(--text); line-height: 1.5;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ai-history-item.on .ai-history-title { color: var(--brand); font-weight: 600; }
.ai-history-meta {
  display: block; margin-top: 2px; font-size: var(--fs-xs); color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ai-history-empty { margin: 0; padding: 10px 2px; color: var(--text-3); font-size: var(--fs-xs); line-height: 1.6; }

/* ---------------- AI 对话记录（用户中心） ---------------- */
.ai-rec-tip { margin: 0 0 4px; color: var(--text-3); font-size: var(--fs-sm); line-height: 1.7; }
.ar-item { border-bottom: 1px solid #f0f1f4; }
.ar-head {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 14px 0; border: 0; background: none; text-align: left; cursor: pointer;
}
.ar-main { flex: 1; min-width: 0; }
.ar-title {
  display: block; color: var(--text); font-size: var(--fs-base); font-weight: 600;
  line-height: 1.55; word-break: break-word;
}
.ar-head:hover .ar-title { color: var(--brand); }
.ar-meta { display: block; margin-top: 3px; color: var(--text-3); font-size: var(--fs-xs); }
.ar-toggle { flex: none; color: var(--text-3); font-size: var(--fs-xs); }
.ar-item.on .ar-toggle { color: var(--brand); }
.ar-body { padding: 2px 0 14px; }
.ar-msg { margin: 0 0 8px; padding: 10px 12px; border-radius: 8px; }
.ar-msg.user { background: #fdecec; }
.ar-msg.assistant { background: #f6f7f9; }
.ar-role { display: block; margin-bottom: 4px; color: var(--text-3); font-size: var(--fs-xs); }
.ar-text {
  margin: 0; color: var(--text); font-size: var(--fs-sm); line-height: 1.75;
  white-space: pre-wrap; word-break: break-word;
}
.ar-actions { display: flex; align-items: center; gap: 10px; padding-top: 4px; }
.ar-continue {
  display: inline-flex; align-items: center; height: 30px; padding: 0 14px;
  border-radius: 15px; background: var(--brand); color: #fff; font-size: var(--fs-sm); line-height: 1;
}
.ar-continue:hover { color: #fff; opacity: .9; }
.ar-del {
  height: 30px; padding: 0 12px; border: 1px solid var(--btn-border); border-radius: 15px;
  background: #fff; color: var(--text-3); font-size: var(--fs-sm); line-height: 1; cursor: pointer;
  transition: color .15s, border-color .15s;
}
.ar-del:hover { color: var(--brand); border-color: #f0b4b4; }

/* ---------------- 我的积分 ---------------- */
/* 标题栏右侧余额：与「全部已读」同一种弱化胶囊，不再抢 h1 的视觉权重。 */
.points-hd-balance {
  margin-left: auto; color: var(--text-3); font-size: var(--fs-sm);
  display: inline-flex; align-items: center; gap: 4px;
}
.points-hd-balance b { color: var(--brand); font-size: var(--fs-lg); font-weight: 700; }
.points-panel { display: block; }
/* 余额区：浅红渐变卡片，数字用等宽感的粗体，一眼看到「我还有多少」。 */
.points-hero {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 16px 18px; margin-bottom: var(--gap-lg);
  border: 1px solid #f6dcdc; border-radius: 12px;
  background: linear-gradient(135deg, #fff5f5 0%, #fff 70%);
}
.points-hero-num { display: flex; align-items: baseline; gap: 6px; flex: none; }
.points-hero-num b { font-size: 38px; line-height: 1; font-weight: 800; color: var(--brand); }
.points-hero-num span { color: var(--text-3); font-size: var(--fs-sm); }
.points-hero-tip { margin: 0; flex: 1 1 260px; color: var(--text-2); font-size: var(--fs-sm); line-height: 1.7; }
/* auto-fit：只有兑换码一块时自动占满整行，两块都在时并排等宽，
   不写死两列是为了避免「手机验证奖励已领」时右侧留一大片空白。 */
.points-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--card-gap) var(--card-gap-x); }
.points-box {
  border: 1px solid #eef0f3; border-radius: 10px; padding: 14px 16px; background: #fcfcfd;
}
/* 两个操作区高度不同（验证手机号那块更高），顶部对齐而不是被 stretch 拉长。 */
.points-actions > .points-box { align-self: start; }
.points-box[hidden] { display: none !important; }
.points-box-title { margin: 0 0 6px; font-size: var(--fs-base); color: var(--text); }
.points-box-tip { margin: 0 0 12px; color: var(--text-3); font-size: var(--fs-xs); line-height: 1.7; }
.points-form { display: block; }
/* 兑换码输入 + 按钮合成一个「输入框内嵌按钮」的整体：
   描边只在最外层，输入框自身无边框，聚焦时整块亮起品牌色光圈。
   比「一个大红块按钮并排一个输入框」轻得多，也不会在窄屏把输入框挤没。 */
.redeem-field {
  display: flex; align-items: center; gap: 8px; height: var(--ctl-h); padding: 0 4px 0 0;
  border: 1px solid #e2e5ea; border-radius: var(--ctl-radius); background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.redeem-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(211, 47, 47, .1); }
.redeem-field input {
  flex: 1; min-width: 0; height: 100%; padding: 0 14px; box-sizing: border-box;
  border: 0; background: transparent; outline: none; color: var(--text);
  /* 兑换码固定是「大写字母 + 数字」，等宽字体让 0/O、1/I 之类一眼能分，
     用户抄码、客服读码都不容易错。 */
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--fs-base); letter-spacing: .06em; text-transform: uppercase;
}
.redeem-field input::placeholder { text-transform: none; letter-spacing: 0; color: var(--text-3); }
/* 兑换按钮：此处只负责「尺寸 + 内嵌位置 + 加载态」，
   红渐变 / 圆角 / hover / active / disabled 的皮肤全站统一在 layui-site.css
   的「主操作皮肤」里（与 layui-btn-danger、.zq-btn 共用同一份声明），改颜色只改那一处。 */
.redeem-btn {
  flex: none; height: 34px; padding: 0 18px; border: 0; cursor: pointer;
  /* 定宽：提交中按钮文案会变成「兑换中…」，不定宽会让按钮突然变长、输入框跟着缩一下。 */
  min-width: 88px;
  font-size: var(--fs-sm); letter-spacing: .02em;
}
/* 提交中：按钮内转圈 + 文案，与登录按钮同一套 */
.redeem-btn.is-loading {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; cursor: wait;
}
.redeem-btn.is-loading::before {
  content: ''; width: 12px; height: 12px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: comment-spin .7s linear infinite;
}
/* 验证手机号表单是竖排的，沿用用户中心 .auth-field 的外观，只把宽度放开。 */
.points-verify-form { display: block; max-width: none; }
.points-verify-form .auth-field { margin-bottom: 12px; }
.points-verify-form .layui-btn[type="submit"] { width: 100%; }
/* 积分明细面板：标题栏 / 列表 / 分页三段，和上方兑换区块用描边分开层次。 */
.points-history {
  margin-top: var(--gap-lg); border: 1px solid #eef0f3; border-radius: 12px;
  background: #fff; overflow: hidden;
}
.ph-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 16px; background: #fbfcfd; border-bottom: 1px solid #f2f3f6;
}
.ph-head h2 { margin: 0; font-size: var(--fs-base); font-weight: 600; color: var(--text); }
.ph-count { color: var(--text-3); font-size: var(--fs-xs); }
.pts { padding: 0 16px; }
.pts-empty { padding: 30px 0; text-align: center; color: var(--text-3); font-size: var(--fs-sm); }
/* 明细行：桌面和手机同一套结构 —— 左「说明」一行、「胶囊 + 时间·余额」一行，
   右侧只留金额。早先是桌面单行台账（胶囊 | 说明 ……… 时间·余额 | 金额），
   在 1000px+ 的宽度里三块元素被拉散，说明和金额之间隔着一大片空白，
   读一行要在屏幕上从左扫到右，反而不如手机端的「左边聚成一坨」清楚。 */
.pt-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid #f4f5f7;
}
.pt-item:last-child { border-bottom: 0; }
.pt-item:hover { background: #fcfcfd; }
/* 两行两列：说明独占第一行；第二行是胶囊 + 时间·余额，都靠左。 */
.pt-body {
  flex: 1; min-width: 0;
  display: grid; grid-template-columns: auto minmax(0, 1fr);
  align-items: center; column-gap: 10px; row-gap: 5px;
}
.pt-remark {
  grid-row: 1; grid-column: 1 / -1;
  color: var(--text); font-size: var(--fs-base); font-weight: 500; line-height: 1.45;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* 兑换码的说明是码值，用等宽字体，便于和站内信里的码逐字核对。 */
.pt-remark.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .04em; }
.pt-kind {
  flex: none; padding: 0 7px; height: 19px; line-height: 19px; border-radius: 10px;
  grid-row: 2; grid-column: 1;
  background: #f4f5f7; color: var(--text-2); font-size: var(--fs-2xs);
  /* 定宽 + 居中：不同类型名长短不一（退还 / 运营调整 / AI 问答），
     不定宽的话每行说明的起始位置会错开，扫读时像锯齿。 */
  min-width: 56px; text-align: center;
  justify-self: start;
}
/* 类型胶囊按业务着色：进账用品牌红系、消耗用中性灰、退还绿、运营调整橙。
   只做弱底 + 深字，避免一屏里出现四块高饱和色。 */
.pt-kind.k-register, .pt-kind.k-phone_verify, .pt-kind.k-redeem { background: #fdecec; color: #c62828; }
.pt-kind.k-ai_chat { background: #eef1f5; color: #5a6270; }
.pt-kind.k-refund { background: #e8f7f1; color: #1d7d64; }
.pt-kind.k-admin { background: #fff4e5; color: #8a5200; }
.pt-meta {
  grid-row: 2; grid-column: 2; justify-self: start;
  color: var(--text-3); font-size: var(--fs-xs); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pt-amount {
  flex: none; min-width: 76px; text-align: right;
  font-size: 17px; font-weight: 700; line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
/* 收入用品牌红（中式配色里红色是「进账」），消耗用中性灰，避免整页红绿打架。 */
.pt-amount.in { color: var(--brand); }
.pt-amount.out { color: var(--text-2); }

/* 分页器：上一页 / 页码 / 下一页，贴面板底部，与标题栏同底色。 */
.ph-pager {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 16px; border-top: 1px solid #f2f3f6; background: #fbfcfd;
  flex-wrap: wrap;
}
.ph-pager[hidden] { display: none !important; }
.ph-pager button {
  min-width: 30px; height: 28px; padding: 0 9px; cursor: pointer;
  border: 1px solid #e5e7ec; border-radius: 7px; background: #fff;
  color: var(--text-2); font-size: var(--fs-xs); line-height: 26px;
  transition: color .15s, border-color .15s, background .15s;
}
.ph-pager button:hover:not(:disabled):not(.on) { border-color: var(--brand); color: var(--brand); }
.ph-pager button.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.ph-pager button:disabled { cursor: default; }
.ph-pager button:disabled:not(.on) { color: #c2c6cd; background: #fbfcfd; }
.ph-dots { color: var(--text-3); font-size: var(--fs-xs); padding: 0 2px; }

/* AI 入口的积分提示：贴在工具条下方的一条浅色说明，不占按钮位置。 */
.ai-points {
  display: block; padding: 6px 14px 0; color: var(--text-3); font-size: var(--fs-xs);
}
.ai-points b { color: var(--brand); font-size: var(--fs-sm); }
.ai-points[hidden] { display: none !important; }
.ai-page .ai-points { padding: 0 0 10px; }
.ai-page .ai-points b { font-size: var(--fs-base); }

/* ---------------- 移动端 ---------------- */
@media (max-width: 768px) {
  .user-layout { grid-template-columns: 1fr; gap: var(--card-gap); }
  /* 手机端导航置顶为横向 Tab：隐藏重复的「用户中心」标题，用下划线标识当前项。 */
  .user-side { order: 0; }
  .user-main { order: 1; }
  .user-side.card { border-radius: 0; overflow: hidden; }
  .user-side .card-hd { display: none; }
  .user-side .card-bd { padding: 0; }
  .user-nav {
    flex-direction: row; gap: 0; overflow-x: auto;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; padding: 0 4px;
  }
  .user-nav::-webkit-scrollbar { display: none; }
  .user-nav a {
    flex: 1 0 auto; justify-content: center; white-space: nowrap;
    padding: 8px 12px; border-radius: 0; font-size: var(--fs-sm); color: var(--text-2);
    position: relative;
  }
  .user-nav a:hover { background: none; }
  .user-nav a.active { background: none; color: var(--brand); font-weight: 600; }
  .user-nav a.active::after {
    content: ''; position: absolute; left: 12px; right: 12px; bottom: 3px;
    height: 2px; border-radius: 2px; background: var(--brand);
  }
  .user-nav-badge { margin-left: 4px; }
  .ai-panel {
    right: 0; bottom: 0; left: 0; width: auto; max-height: 86vh;
    border-radius: 12px 12px 0 0;
  }
  .ai-fab { right: 14px; bottom: 84px; }
  /* AI 页：左侧栏在手机上折成横向滚动的「最近对话」胶囊条，放在问答区上方，
     不占垂直空间也不影响输入框位置；时间等次要信息在胶囊里省略。 */
  .ai-page-body { grid-template-columns: 1fr; gap: 12px; }
  .ai-history { padding: 0 0 8px; border-right: 0; border-bottom: 1px solid #f0f1f4; }
  .ai-history-hd { padding-bottom: 6px; }
  .ai-history-list {
    flex-direction: row; gap: 6px; min-height: 0; max-height: none;
    overflow-x: auto; overflow-y: hidden; padding-bottom: 2px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .ai-history-list::-webkit-scrollbar { display: none; }
  .ai-history-item {
    flex: none; width: auto; max-width: 190px; padding: 6px 12px;
    border: 1px solid #eef0f3; border-radius: 14px;
  }
  .ai-history-title { max-width: 164px; }
  .ai-history-meta { display: none; }
  .ai-history-empty { padding: 4px 2px; }
  .comment-section { padding: var(--pad-y) var(--pad-x); }
  .cm-replies, .cm-reply-form { margin-left: 0; }
  /* 积分页：两块操作区并排会挤成两列窄条，手机上改成上下叠。 */
  .points-actions { grid-template-columns: 1fr; }
  .points-hero { padding: 14px; gap: 10px; }
  .points-hero-num b { font-size: 32px; }
  /* 兑换输入框在手机上一行放得下（输入框 + 34px 小按钮），与常规控件同高。 */
  .redeem-field { height: var(--ctl-h); }
  .redeem-btn { padding: 0 14px; }
  /* 明细面板：手机上只压内边距与金额列宽，行内结构（说明 / 胶囊 + 时间·余额 /
     金额）与桌面完全一致，不再单独折行。 */
  .points-history { margin-top: var(--gap); border-radius: 10px; }
  .ph-head { padding: 10px 12px; }
  .pts { padding: 0 12px; }
  .pt-item { gap: 10px; padding: 11px 0; }
  .pt-body { column-gap: 8px; row-gap: 5px; }
  .pt-remark { font-size: var(--fs-base); }
  .pt-amount { min-width: 62px; font-size: 16px; }
  .ph-pager { padding: 10px 12px; gap: 5px; }
  .ph-pager button { min-width: 27px; height: 27px; padding: 0 7px; line-height: 25px; }
}
