/* =============================================================
 * 暖屿 - 徽章样式
 * 由 assets/badge.js 动态生成节点，类名前缀统一 nxb-
 * 颜色全部来自徽章自身，通过内联 CSS 变量 --nxb-c / --nxb-bg 传递
 * ============================================================= */

.nxb-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

/* ---------- 药丸 ---------- */
.nxb-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--nxb-c, #64748b);
  background: var(--nxb-bg, rgba(100, 116, 139, .1));
  color: var(--nxb-c, #64748b);
  font-size: 11px;
  line-height: 1.6;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
  vertical-align: middle;
  -webkit-tap-highlight-color: transparent;
}

.nxb-pill .nxb-ico {
  font-size: 11px;
  line-height: 1;
  flex: none;
}

.nxb-pill .nxb-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.nxb-row {
  margin-top: 8px;
  display: block;
}

.nxb-pill.nxb-more {
  border-style: dashed;
  color: var(--text-sub, #64748b);
  border-color: var(--border-color, #e2e8f0);
  background: transparent;
  font-weight: 500;
}

/* ---------- 卡片右上角标（替代原 badge-hot / badge-new） ---------- */
.nxb-corner {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 6px 14px;
  border-bottom-left-radius: 20px;
  border-top-right-radius: 20px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  background: linear-gradient(135deg, var(--nxb-c, #64748b), var(--nxb-c2, #475569));
  box-shadow: 0 4px 10px rgba(0, 0, 0, .1);
  cursor: default;
  max-width: 78%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nxb-corner .nxb-ico { font-size: 12px; flex: none; }

/* ---------- 头像旁的小圆点角标 ---------- */
.nxb-dotwrap { position: relative; display: inline-flex; }
.nxb-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--nxb-c, #64748b);
  color: #fff;
  font-size: 9px;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--card-bg, #fff);
  cursor: default;
}

/* ---------- 详情页头部：一排更大的药丸 ---------- */
.nxb-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.nxb-head .nxb-pill {
  font-size: 12px;
  padding: 3px 10px;
}

/* ---------- 聊天窗口：名字旁一行、气泡旁一排 ---------- */
.nxb-inline {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

.nxb-inline .nxb-pill {
  font-size: 10px;
  padding: 1px 6px;
}

.nxb-bubble-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 3px 36px;
}

.nxb-bubble-badges .nxb-pill {
  font-size: 10px;
  padding: 1px 6px;
}

/* ---------- 个人中心：我的徽章墙 ---------- */
.nxb-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.nxb-wall-empty {
  padding: 18px 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-sub, #64748b);
}

.nxb-tile {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--nxb-c, #64748b);
  background: var(--nxb-bg, rgba(100, 116, 139, .08));
  min-width: 0;
}

.nxb-tile .nxb-tile-ico {
  font-size: 20px;
  line-height: 1.1;
  flex: none;
}

.nxb-tile .nxb-tile-body { min-width: 0; }

.nxb-tile .nxb-tile-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--nxb-c, #334155);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nxb-tile .nxb-tile-desc {
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-sub, #64748b);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nxb-tile .nxb-tile-rarity {
  display: inline-block;
  margin-top: 4px;
  font-size: 10px;
  padding: 0 6px;
  border-radius: 999px;
  color: #fff;
  background: var(--nxb-c, #64748b);
  line-height: 1.7;
}

/* ---------- 后台：表格里的紧凑徽章 ---------- */
.nxb-wrap.nxb-flat {
  flex-wrap: nowrap;
  white-space: nowrap;
}
.nxb-wrap.nxb-flat .nxb-pill { flex: none; }

.nxb-admin-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 220px;
}

.nxb-admin-cell .nxb-pill {
  font-size: 10px;
  padding: 1px 6px;
}

/* 深色主题下浅色文字/描边不易辨认，统一提亮一档 */
[data-theme="dark"] .nxb-pill,
html[data-theme="dark"] .nxb-pill {
  filter: brightness(1.25);
}

@media (max-width: 480px) {
  .nxb-corner { font-size: 11px; padding: 5px 11px; max-width: 72%; }
  .nxb-wall { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
