/* ============================================================
 * 91-ui-actions.css —— 按钮排版（从 94-ui-fix.css 拆出来，保持每文件 ≤500 行）
 * ============================================================ */


/* ============================================================
 * 主页底部按钮：等宽 + 居中（用户反馈"做得不太对称"）
 *
 * 原来这排按钮宽度各不相同（发私聊/加好友/转账/装扮/编辑资料/关闭），
 * 按钮个数还随身份变化，看起来就参差不齐。
 * 改成：每个按钮最小宽度一致、能伸缩、整排居中。
 * ============================================================ */
#modal-homepage .modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
#modal-homepage .modal-actions .btn {
  flex: 1 1 auto;
  min-width: 84px;
  max-width: 148px;
  text-align: center;
  justify-content: center;
}
/* 关闭按钮单独一行时也居中，不要被拉得特别宽 */
#modal-homepage .modal-actions .btn:last-child { flex: 0 1 auto; min-width: 96px; }

/* 名片弹窗同理 */
#modal-card .modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
#modal-card .modal-actions .btn { flex: 1 1 auto; min-width: 84px; max-width: 148px; }

/* ============================================================
 * 私信返回键：原来只有一个字符 ‹ ，有的字体渲染成空白
 * ============================================================ */
#dm-back.small-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  /* ★ 要放得下「← 返回」四个字符：之前只给 46px，"返回"两个字竖排了 */
  min-width: 74px;
  padding: 0 12px;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;      /* 不许换行 */
  flex: 0 0 auto;
}
#dm-back.small-back::before {
  content: '←';              /* 用明确的方向箭头，不依赖特殊字符 */
  font-size: 15px;
  line-height: 1;
}
/* 原来那个可能是空白的字符藏掉 */
#dm-back .small-back-glyph { display: none; }

/* ============================================================
 * 27-market-quiet.js 用的样式
 * ============================================================ */
/* 关掉行情消息时把它们收起来（不是删除，随时能恢复） */
.msg.system.market-hidden { display: none !important; }

/* 拖动中的面板：抬高层级、别被遮住，并给个抓取光标 */
.modal[draggable], .modal[data-draggable="1"] { z-index: 90; }
.modal[data-draggable="1"] h3,
.modal[data-draggable="1"] .modal-head { cursor: move; user-select: none; }


/* ============================================================
 * "看信息"类面板：不挡聊天（用户要求：大部分界面不该影响聊天）
 *
 * .mask 原来是全屏半透明黑遮罩，会把聊天区整个盖住。
 * 加了 mask-nonblock 之后：遮罩透明、不吃点击，只有面板本身能点。
 * → 面板开着也能滚消息、发消息、点房间。
 * ============================================================ */
.mask.mask-nonblock {
  background: transparent !important;
  backdrop-filter: none !important;
  pointer-events: none !important;     /* 遮罩不再拦截点击 */
  z-index: 60;
}
.mask.mask-nonblock > .modal {
  pointer-events: auto !important;      /* 面板本身照常能点 */
  box-shadow: 0 10px 40px rgba(0, 0, 0, .18);
  max-height: min(78vh, 640px);
  overflow: auto;
}
/* 面板开了也别把聊天区压暗 */
body.has-nonblock-modal .messages { filter: none !important; }

/* 拖动中的面板要高过其它层 */
.mask.mask-nonblock > .modal[data-draggable="1"] { z-index: 61; }

/* ============================================================
 * 拖动中的面板：轻微抬起（让"正在拖"这件事看得见）
 * ============================================================ */
.mask.mask-nonblock > .modal.panel-dragging {
  box-shadow: 0 18px 60px rgba(0, 0, 0, .26) !important;
  cursor: grabbing !important;
  transition: box-shadow .12s ease;
  will-change: transform;
}
/* 面板内文字在拖动时不要被选中（松手恢复） */
body:has(.panel-dragging) { user-select: none; }

/* ============================================================
 * 面板缩放：右下角的小拖拽块
 * ============================================================ */
.mask.mask-nonblock > .modal { position: relative; }
/* 右下角缩放块。
 * ★ 它是绝对定位、会吃点击 —— 所以要小、要贴在角上、层级放低，
 *   免得盖住面板右下角的按钮（这是"绝对定位元素挡住内容"的同一类问题）。 */
.panel-resize-grip {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 13px;
  height: 13px;
  cursor: nwse-resize;
  z-index: 1;                      /* 低于按钮，别抢点击 */
  opacity: .45;
  background:
    linear-gradient(135deg, transparent 0 45%, var(--muted, #999) 45% 55%, transparent 55% 70%,
                    var(--muted, #999) 70% 80%, transparent 80%);
}
.panel-resize-grip:hover { opacity: 1; }
.panel-resize-grip:hover { opacity: 1; }
.mask.mask-nonblock > .modal.panel-resizing { user-select: none; }
/* 缩放中的面板不要有过渡，跟着手走 */
.mask.mask-nonblock > .modal { transition: none; }

/* ============================================================
 * 主页/名片底部按钮：等宽网格，内容居中
 *
 * 之前的问题：图标按钮（装扮）里文字被图标挤掉，只剩一个符号孤零零在左边，
 * 一排看着参差不齐。现在改成等宽 + 居中，图标和文字都在。
 * ============================================================ */
#modal-homepage .modal-actions,
#modal-card .modal-actions {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
  align-items: stretch;
}
#modal-homepage .modal-actions .btn,
#modal-card .modal-actions .btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  max-width: none;
  width: 100%;
  white-space: nowrap;
}
#modal-homepage .modal-actions .btn svg,
#modal-card .modal-actions .btn svg { flex: 0 0 auto; }
/* 只有一个按钮时不要被拉得特别宽 */
#modal-homepage .modal-actions .btn:only-child { grid-column: 1 / -1; max-width: 200px; }

/* 面板里的通知开关（炒币 / 沙币库） */
.inline-quiet {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line, #e5e5e5);
  font-size: 12.5px;
  color: var(--muted, #888);
}
.inline-quiet label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.inline-quiet input { cursor: pointer; }

/* ============================================================
 * 面板：右上角的关闭叉叉（用户要求"关闭应该是右上角的叉叉，弄个小框围着"）
 * ============================================================ */
.mask.mask-nonblock > .modal { position: relative; padding-right: 40px; }

.panel-close-x {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* ★ 小方框：细细一圈边框 + 圆角 + 悬停变色 */
  border: 1px solid var(--line, #e2e2e2);
  border-radius: 7px;
  background: rgba(255, 255, 255, .92);
  color: var(--muted, #777);
  font-size: 17px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  z-index: 6;
  transition: background .12s ease, color .12s ease, border-color .12s ease, transform .08s ease;
}
.panel-close-x:hover {
  background: #f2f2f2;
  border-color: #cfcfcf;
  color: #333;
}
.panel-close-x:active { transform: scale(.94); }

/* ============================================================
 * 面板内容可滚动 —— 缩小之后也能看到/点到所有内容
 * （用户反馈：缩小了底部那个"接收播报"勾选框就点不到了）
 * ============================================================ */
.mask.mask-nonblock > .modal {
  overflow: auto !important;
  overscroll-behavior: contain;
  max-height: 92vh;
}
/* 面板里的内嵌开关。
 * ★ 注意：**不要**用 position: sticky —— 试过，它会浮在内容上面把卡片盖住
 *   （用户截图反馈过）。就按正常流排在标题后面，露出面板顶部时一直看得见。 */
.mask.mask-nonblock > .modal > .inline-quiet {
  display: block;
  margin: 2px 0 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, .03);
}

/* ============================================================
 * 机器人管理面板（29-bots.js）
 * ============================================================ */
.bots-tip { font-size: 12.5px; color: var(--muted, #888); margin: 2px 0 10px; line-height: 1.6; }

.bots-new { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.bots-new input, .bots-new select {
  flex: 1 1 120px; min-width: 0;
  padding: 6px 9px; font-size: 13px;
  border: 1px solid var(--line, #e2e2e2); border-radius: 8px;
  background: var(--input-bg, #fff); color: inherit;
}
.bots-new select { flex: 0 0 88px; }
.bots-new button { flex: 0 0 auto; }

.bots-new-result {
  margin: 8px 0;
  padding: 10px;
  border: 1px solid var(--brand-line, #bfe);
  border-radius: 10px;
  background: var(--brand-soft, #f2fff8);
  font-size: 13px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}
.bot-token {
  display: inline-block;
  padding: 4px 8px;
  background: rgba(0,0,0,.06);
  border-radius: 6px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
  word-break: break-all;
  user-select: all;
}

.bots-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 10px 0 6px; font-size: 13px;
}
.bots-head-right { display: inline-flex; gap: 6px; }

.bots-list { max-height: 46vh; overflow: auto; }

.bot-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line, #eee);
  border-radius: 10px;
  margin-bottom: 6px;
  background: var(--card, #fff);
}
.bot-row.bot-off { opacity: .55; }
.bot-row-main { display: flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; }
.bot-row-main b { font-size: 13.5px; }
.bot-row-meta { font-size: 12px; color: var(--muted, #888); }
.bot-row-acts { display: inline-flex; gap: 4px; flex: 0 0 auto; }
.bot-row-acts .btn { font-size: 12px; padding: 3px 8px; }
.bot-row-acts .btn.danger { color: #d9534f; }

.bots-plugins { margin-top: 10px; font-size: 13px; }
.bots-commands {
  margin-top: 4px; font-size: 12.5px; color: var(--muted, #888);
  word-break: break-all; line-height: 1.7;
}

/* ============================================================
 * 机器人接口调试台（30-bot-console.js）
 * ============================================================ */
.botapi-tip { font-size: 12.5px; color: var(--muted, #888); margin: 2px 0 10px; line-height: 1.6; }
.botapi-row { display: flex; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.botapi-row input, .botapi-row select {
  flex: 1 1 200px; min-width: 0;
  padding: 6px 9px; font-size: 13px;
  border: 1px solid var(--line, #e2e2e2); border-radius: 8px;
  background: var(--input-bg, #fff); color: inherit;
}
.botapi-row select { flex: 1 1 260px; }
.botapi-out {
  margin: 8px 0;
  padding: 10px;
  min-height: 160px;
  max-height: 42vh;
  overflow: auto;
  background: rgba(0, 0, 0, .04);
  border-radius: 10px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  user-select: text;
}
.botapi-help { font-size: 12px; color: var(--muted, #888); line-height: 1.7; }

/* ============================================================
 * 装扮商店：占位提示 + 确保列表正常显示
 * （商店曾经"打开是空的"—— 其实是渲染静默失败，这里补上可见提示）
 * ============================================================ */
.gift-placeholder {
  padding: 20px 8px;
  text-align: center;
  font-size: 13px;
  color: var(--muted, #999);
}
/* 商品列表：只保证它没被藏起来。
 * ★ 千万别在这里写 display: block —— 列表本来是 display: grid（多列排布），
 *   覆盖成 block 之后每个商品就会占一整行，变成又宽又高的一坨（已经踩过）。 */
.gift-list { display: grid; }
.gift-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }

/* ============================================================
 * 错误提示条（31-safe-guard.js）
 * 出错显示在页面顶部，而不是"什么都没发生"
 * ============================================================ */
.safe-error-bar {
  position: fixed;
  left: 50%;
  top: 10px;
  transform: translateX(-50%);
  max-width: min(90vw, 560px);
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: #fff4f4;
  border: 1px solid #f3c2c2;
  color: #b23b3b;
  font-size: 12.5px;
  line-height: 1.5;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .12);
  pointer-events: auto;
}
.safe-error-close {
  flex: 0 0 auto;
  width: 20px; height: 20px;
  border: none; background: none;
  color: inherit; font-size: 15px; line-height: 1;
  cursor: pointer; padding: 0;
}

/* ============================================================
 * 插件管理（32-plugins.js）
 * ============================================================ */
.bots-plugins-box { margin-top: 10px; }
.bots-plugins-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin: 8px 0 6px; font-size: 13px; flex-wrap: wrap;
}
.bots-plugins-acts { display: inline-flex; gap: 6px; align-items: center; }
.bots-plugins-acts select {
  padding: 4px 6px; font-size: 12.5px;
  border: 1px solid var(--line, #e2e2e2); border-radius: 7px;
  background: var(--input-bg, #fff); color: inherit;
}
.bot-plugin-form { margin-bottom: 6px; }
#bot-plugin-name {
  width: 100%; padding: 6px 9px; font-size: 13px;
  border: 1px solid var(--line, #e2e2e2); border-radius: 8px;
  background: var(--input-bg, #fff); color: inherit;
}
.bot-plugin-code {
  width: 100%;
  min-height: 180px;
  max-height: 40vh;
  padding: 9px 10px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  border: 1px solid var(--line, #e2e2e2);
  border-radius: 8px;
  background: rgba(0, 0, 0, .03);
  color: inherit;
  resize: vertical;
  white-space: pre;
  overflow: auto;
}
.bot-plugin-msg { font-size: 12.5px; color: var(--muted, #888); margin: 6px 0; line-height: 1.6; }
.bot-plugin-msg.bad { color: #c04a4a; }
.bot-plugin-list { max-height: 30vh; overflow: auto; }
.bot-plugin-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 6px 9px; margin-bottom: 5px;
  border: 1px solid var(--line, #eee); border-radius: 9px;
}
.bot-plugin-row.off { opacity: .6; }
.bot-plugin-row-main { display: flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; }
.bot-plugin-row-meta { font-size: 12px; color: var(--muted, #888); }
.bot-plugin-row-acts { display: inline-flex; gap: 4px; flex: 0 0 auto; }
.bot-plugin-row-acts .btn { font-size: 12px; padding: 3px 8px; }
.bot-plugin-row-acts .btn.danger { color: #d9534f; }
.bot-plugin-badge {
  font-size: 11px; padding: 1px 7px; border-radius: 999px;
  border: 1px solid var(--line, #e2e2e2); color: var(--muted, #888);
}
.bot-plugin-badge.on { color: #1f9d55; border-color: #b7e4c7; background: #f0fff6; }
.bot-plugin-badge.warn { color: #b7791f; border-color: #f5d79b; background: #fffaf0; }
.bot-plugin-badge.off { color: #999; }

/* ============================================================
 * 机器人（用户要求：看起来就是一个普通用户，头衔显示「机器人」）
 *
 * 所以这里**不改变排版**，只加一点很轻的标识：
 *   · 名字后面的小圆点（和普通用户区分，但不刺眼）
 *   · 头衔标签沿用系统里那套（title-tag），颜色由 titleCssOf 决定
 * ============================================================ */
.msg.msg-bot .name::after {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-left: 4px;
  border-radius: 50%;
  background: var(--brand, #22c55e);
  vertical-align: middle;
  opacity: .75;
}
/* 头像上也可以有个小标记（可选，很淡） */
.msg.msg-bot .avatar { box-shadow: 0 0 0 1.5px var(--brand, #22c55e); }
