/* 大锤游戏好友系统插件样式（适配奶油浅色画室与大厅深浅双色主题） */
.xh-fr-ico {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -2px;
}

/* 顶部/按钮红点微标 */
.xh-fr-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e11d48;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
}
.xh-fr-badge[hidden] { display: none !important; }

/* 好友中心弹窗（更高优先级避免被深色游戏的 .merge-dialog 样式覆盖） */
body.merge-page .xh-friends-dialog,
.xh-friends-dialog {
  width: min(460px, calc(100vw - 24px));
  max-height: min(84dvh, 660px);
  padding: 16px 18px 18px;
  border-radius: 20px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 22px 54px rgba(15, 23, 42, 0.28);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
body.merge-page .xh-friends-dialog p { color: inherit; }
.xh-friends-dialog:not([open]) { display: none !important; }
.xh-friends-dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
.xh-fr-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.xh-fr-head-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.xh-fr-head h2 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 900;
  color: inherit;
}
.xh-fr-close {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}
.xh-fr-close:hover { background: #e2e8f0; }

/* 个人好友码条 */
.xh-fr-me-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 11px;
  margin-bottom: 10px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 0.78rem;
  font-weight: 700;
  color: #334155;
}
.xh-fr-me-strip strong { color: #0f172a; }
.xh-fr-me-copy {
  padding: 3px 9px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #1d4ed8;
  font-size: 0.73rem;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
}

/* 房间邀请模式横幅 */
.xh-fr-room-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 11px;
  margin-bottom: 10px;
  border-radius: 12px;
  background: #eff6ff;
  border: 1.5px solid #93c5fd;
  color: #1e40af;
  font-size: 0.78rem;
  font-weight: 800;
}
.xh-fr-room-banner[hidden] { display: none; }

/* 3 分段 Tab */
.xh-fr-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 4px;
  border-radius: 13px;
  background: #f1f5f9;
  margin-bottom: 10px;
}
.xh-fr-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 34px;
  padding: 0 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #475569;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.xh-fr-tab[aria-selected="true"] {
  background: #ffffff;
  color: #1d4ed8;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

/* 内容滚区 */
.xh-fr-body {
  flex: 1 1 auto;
  min-height: 160px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}

/* 搜索表单 */
.xh-fr-search-form {
  display: flex;
  gap: 6px;
  margin-bottom: 4px;
}
.xh-fr-search-form input {
  flex: 1 1 0;
  min-width: 0;
  width: 0;
  height: 38px;
  padding: 0 11px;
  border-radius: 11px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  font-size: 16px;
  font-weight: 600;
}
@media (min-width: 700px) {
  .xh-fr-search-form input { font-size: 0.84rem; }
}
.xh-fr-search-form button {
  height: 38px;
  padding: 0 14px;
  border-radius: 11px;
  border: 1.5px solid #1d4ed8;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
}

/* 玩家行卡片 */
.xh-fr-sec-label {
  margin: 4px 0 0;
  font-size: 0.72rem;
  font-weight: 800;
  color: #64748b;
  letter-spacing: 0.02em;
}
.xh-fr-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 13px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.xh-fr-av-wrap {
  position: relative;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}
.xh-fr-av-wrap img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: #e2e8f0;
  border: 1.5px solid #cbd5e1;
  display: block;
}
.xh-fr-dot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  background: #94a3b8;
}
.xh-fr-dot.is-online { background: #22c55e; }
.xh-fr-meta {
  flex: 1 1 auto;
  min-width: 0;
}
.xh-fr-meta strong {
  display: block;
  font-size: 0.86rem;
  font-weight: 800;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.xh-fr-meta small {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.xh-fr-meta small.is-online { color: #16a34a; }
.xh-fr-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.xh-fr-btn {
  height: 30px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #1e293b;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.xh-fr-btn.is-primary {
  border-color: #1d4ed8;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #ffffff;
}
.xh-fr-btn.is-ok {
  border-color: #16a34a;
  background: #dcfce7;
  color: #166534;
}
.xh-fr-btn.is-danger {
  border-color: #fda4af;
  background: #fff1f2;
  color: #be123c;
}
.xh-fr-btn:disabled {
  opacity: 0.56;
  cursor: default;
}
.xh-fr-tag {
  padding: 3px 8px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 800;
}
.xh-fr-tag.is-friend {
  background: #dcfce7;
  color: #166534;
}
.xh-fr-empty {
  padding: 24px 14px;
  text-align: center;
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.55;
}
.xh-fr-guest-box {
  padding: 20px 14px;
  border-radius: 15px;
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  text-align: center;
}
.xh-fr-guest-box p {
  margin: 0 0 12px;
  font-size: 0.84rem;
  font-weight: 700;
  color: #475569;
  line-height: 1.55;
}
.xh-fr-msg {
  margin: 8px 0 0;
  min-height: 16px;
  font-size: 0.76rem;
  font-weight: 800;
  color: #1d4ed8;
  text-align: center;
}
.xh-fr-msg.is-err { color: #e11d48; }

/* 大厅顶栏好友按钮防换行与防挤压 */
.hall-friends-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  width: auto !important;
  min-width: auto !important;
  padding-inline: 11px !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}
.hall-friends-btn span {
  white-space: nowrap;
}

/* 实时进房邀请悬浮通知条（悬停在顶栏正下方，绝不遮挡导航与搜索栏） */
.xh-fr-invite-toast {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 80px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 140;
  width: min(410px, calc(100vw - 20px));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  border: 2px solid #3b82f6;
  box-shadow: 0 16px 40px rgba(37, 99, 235, 0.24);
  color: #0f172a;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: xhFrSlideDown 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
@media (max-width: 699px) {
  .xh-fr-invite-toast {
    top: calc(env(safe-area-inset-top, 0px) + 78px);
  }
}
.xh-fr-invite-toast[hidden] { display: none !important; }
@keyframes xhFrSlideDown {
  from { opacity: 0; transform: translate(-50%, -14px) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
.xh-fr-invite-toast img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #93c5fd;
  flex-shrink: 0;
}
.xh-fr-invite-copy {
  flex: 1 1 auto;
  min-width: 0;
}
.xh-fr-invite-copy strong {
  display: block;
  font-size: 0.84rem;
  font-weight: 900;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.xh-fr-invite-copy span {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.xh-fr-invite-btns {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

/* 大厅深色主题适配 */
html[data-game-theme="dark"] .xh-friends-dialog {
  background: #141c2e;
  color: #f8fafc;
  border-color: rgba(255, 255, 255, 0.14);
}
html[data-game-theme="dark"] .xh-fr-close,
html[data-game-theme="dark"] .xh-fr-btn:not(.is-primary):not(.is-ok):not(.is-danger) {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.14);
  color: #f1f5f9;
}
html[data-game-theme="dark"] .xh-fr-me-strip,
html[data-game-theme="dark"] .xh-fr-row,
html[data-game-theme="dark"] .xh-fr-guest-box {
  background: #1b253b;
  border-color: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}
html[data-game-theme="dark"] .xh-fr-me-strip strong,
html[data-game-theme="dark"] .xh-fr-meta strong { color: #f8fafc; }
html[data-game-theme="dark"] .xh-fr-tabs { background: #0f1626; }
html[data-game-theme="dark"] .xh-fr-tab { color: #94a3b8; }
html[data-game-theme="dark"] .xh-fr-tab[aria-selected="true"] {
  background: #1e293b;
  color: #93c5fd;
}
html[data-game-theme="dark"] .xh-fr-search-form input {
  background: #0f1626;
  border-color: rgba(255, 255, 255, 0.16);
  color: #f8fafc;
}
html[data-game-theme="dark"] .xh-fr-invite-toast {
  background: rgba(20, 28, 46, 0.96);
  border-color: #60a5fa;
  color: #f8fafc;
}
html[data-game-theme="dark"] .xh-fr-invite-copy strong { color: #f8fafc; }
html[data-game-theme="dark"] .xh-fr-invite-copy span { color: #94a3b8; }

/* 在线/离线统计条与离线好友柔和区分 */
.xh-fr-presence-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 4px 6px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #64748b;
}
.xh-fr-p-on,
.xh-fr-p-off {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.xh-fr-p-on { color: #15803d; }
.xh-fr-p-on i,
.xh-fr-p-off i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.xh-fr-p-on i { background: #22c55e; }
.xh-fr-p-off i { background: #94a3b8; }
.xh-fr-row.is-offline {
  opacity: 0.72;
}
.xh-fr-row.is-offline .xh-fr-av-wrap img {
  filter: grayscale(0.65);
}
html[data-game-theme="dark"] .xh-fr-presence-bar { color: #94a3b8; }
html[data-game-theme="dark"] .xh-fr-p-on { color: #4ade80; }
body.merge-page html[data-game-theme="dark"] .xh-friends-dialog,
html[data-game-theme="dark"] body.merge-page .xh-friends-dialog {
  background: #141c2e;
  color: #f8fafc;
  border-color: rgba(255, 255, 255, 0.14);
}

/* 联机房成员栏内联好友操作（兼容深色/浅色所有联机房间） */
.xh-fr-inline-btn {
  display: inline-flex;
  align-items: center;
  margin-inline-start: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #60a5fa;
  background: rgba(37, 99, 235, 0.14);
  color: #3b82f6;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.3;
  cursor: pointer;
  vertical-align: middle;
}
.xh-fr-inline-btn:hover { background: #2563eb; color: #ffffff; border-color: #2563eb; }
.xh-fr-inline-btn:disabled { opacity: 0.55; cursor: default; }
.xh-fr-inline-tag {
  display: inline-flex;
  align-items: center;
  margin-inline-start: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  color: #94a3b8;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.3;
  vertical-align: middle;
}
.xh-fr-inline-tag.is-friend {
  background: rgba(34, 197, 94, 0.18);
  color: #22c55e;
}
.room-friends-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
