/* ============================================================
   Mahjong Pal 邀请管理样式（八哥令 2026-10-23 · #408/#409）
   ① 好友录顶区：预览卡（猴子下最多 2 条）+ 粉色空心齿轮（与加号同大）
      + 未处理绿点呼吸徽标
   ② 管理汇总页：双边 tab（同数据区子页签滑块样式）+ 列表滑动删除
   色板全部走 pal.css 既有 CSS 变量，粉红 = 邀请条同款（#FF7AB0→#FF4D88）
   ============================================================ */

/* ---------- 好友录顶区：预览卡容器（猴子行之下、列表之上）---------- */
/* 【八哥令 2026-10-28】①去掉下面那条分隔线（粗糙感来源）；
   ②横幅已挪进 .fr-scroll 内、成为列表第一项——跟内容一起滑走，
   不再钉在顶端，列表也不再从它背后穿过（遮挡感根治）。 */
#frInvPrev {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 16px 0;
}
#frInvPrev[hidden] { display: none; }
/* 八哥令 2026-10-29：横幅出现时，抹平其与首卡之间的多余内边距，
   使「紫框→首卡」间距等于「卡与卡」标准 8px（不动卡间间距、不影响无横幅布局） */
#frInvPrev:not([hidden]) + .fr-list { padding-top: 0; }

/* 达成提示条的右上角小叉：点了本会话内不再出现（sessionStorage 记忆） */
.iv-note { position: relative; }
.iv-x {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: transparent;
  color: rgba(255, 143, 186, .85);
  font-size: 15px;
  line-height: 24px;
  text-align: center;
  cursor: pointer;
  border-radius: 50%;
}
.iv-x:active { background: rgba(255, 122, 176, .16); }

/* ---------- 好友达成提示条（八哥令 2026-10-26 · #445）----------
   "粉红色保留……不要有任何按钮……永远提示最新一条……框做矮一点……只留一天。"
   同粉渐变、同头像形态，但只有一半高：纯提示，零交互。 */
.iv-note {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 122, 176, .38);
  background: linear-gradient(100deg, rgba(255, 122, 176, .14), rgba(255, 77, 136, .05));
}
.iv-note-av { width: 26px; height: 26px; font-size: 11px; }
.iv-note-av .real-check { width: 10px; height: 10px; }
.iv-note .iv-meta b { font-size: 12.5px; }
.iv-note .iv-meta > span { font-size: 10px; }

/* 待处理邀请卡：头像 + 名字 + 一句话 + Accept/Ignore
   【八哥令 2026-10-26 深测（#439）】窄屏不撑头部：允许换行兜底 + 按钮收紧 +
   meta 弹性占满，名字/副行省略号只在自己行内截，绝不横向溢出卡片。 */
.iv-card {
  display: flex;
  align-items: center;
  flex-wrap: wrap;        /* 极窄屏兜底：按钮行换行，绝不把头部撑破 */
  row-gap: 6px;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 122, 176, .38);
  background: linear-gradient(100deg, rgba(255, 122, 176, .14), rgba(255, 77, 136, .05));
}
.iv-av {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #FF7AB0 0%, #FF4D88 100%);
  color: #fff;
  font-family: var(--pal-serif);
  font-size: 15px;
  font-weight: 700;
  position: relative;   /* 八哥令 2026-10-25：真人绿勾 .real-check 的定位基准 */
  overflow: visible;
}
/* 【#437】真人真头像：圆形裁切铺满，字母兜底态不受影响 */
.iv-av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.iv-meta {
  flex: 1 1 110px;        /* 弹性占满；低于 110px 时按钮行自动换行，不挤名字 */
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-align: left;
}
.iv-meta b {
  font-family: var(--pal-serif);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--pal-txt, #F6EFE0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.iv-meta > span {
  font-family: Nunito, system-ui, sans-serif;
  font-size: 11px;
  color: var(--pal-mut);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.iv-btns { flex: none; display: inline-flex; gap: 6px; margin-left: auto; }
.iv-accept {
  appearance: none;
  border: none;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #FF7AB0 0%, #FF4D88 100%);
  color: #fff;
  font-family: Nunito, system-ui, sans-serif;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .02em;
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s ease;
}
.iv-ignore {
  appearance: none;
  cursor: pointer;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--pal-line);
  background: transparent;
  color: var(--pal-mut);
  font-family: Nunito, system-ui, sans-serif;
  font-size: 11.5px;
  font-weight: 700;
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s ease;
}
.iv-accept:active, .iv-ignore:active { transform: scale(.94); }

/* ---------- #441 确认弹窗：同邀请卡形态、无按钮、只带一个 × ---------- */
.iv-mask {
  position: fixed;
  inset: 0;
  z-index: 90080;
  background: rgba(0, 0, 0, .62);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.iv-mask.is-on { opacity: 1; pointer-events: auto; }
.iv-pop {
  position: fixed;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%) scale(.96);
  z-index: 90090;
  width: min(320px, 86vw);
  border-radius: 18px;
  border: 1px solid rgba(255, 122, 176, .45);
  background: var(--pal-ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
  padding: 28px 18px 20px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}
.iv-pop.is-on {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}
/* 唯一的控件：右上角 ×（八哥令：上面不需要有任何的选择） */
.iv-pop-x {
  position: absolute;
  top: 6px;
  right: 8px;
  appearance: none;
  border: none;
  background: transparent;
  color: var(--pal-mut, #9A9A9A);
  font-size: 26px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.iv-pop-av {
  width: 56px !important;
  height: 56px !important;
  margin: 0 auto 10px;
  font-size: 22px;
}
.iv-pop-av .real-check { width: 18px; height: 18px; }
.iv-pop-name {
  display: block;
  font-family: var(--pal-serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--pal-txt, #F6EFE0);
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.iv-pop-txt {
  display: block;
  font-family: Nunito, system-ui, sans-serif;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--pal-mut);
}

/* ---------- 粉红色空心齿轮（与加号同大 42px 正圆）+ 绿点呼吸徽标 ---------- */
#frInvGear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  position: relative;        /* 绿点定位基准 */
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1.5px solid var(--pal-line);
  background: var(--pal-panel);
  color: #FF7AB0;            /* 八哥令：粉红色空心齿轮 */
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s ease, background .12s ease;
}
#frInvGear svg { width: 24px; height: 24px; }
#frInvGear:active { transform: scale(.92); background: var(--pal-panel-2); }
/* 绿点呼吸徽标：有未处理邀请时亮起 */
#frInvGear .iv-dot {
  display: none;
  position: absolute;
  top: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 0 2px var(--pal-bg, #000), 0 0 8px rgba(16, 185, 129, .7);
}
#frInvGear.has-pending .iv-dot { display: block; animation: ivBreathe 1.6s ease-in-out infinite; }
@keyframes ivBreathe {
  0%, 100% { transform: scale(1);    opacity: 1; }
  50%      { transform: scale(1.35); opacity: .55; }
}
@media (prefers-reduced-motion: reduce) {
  #frInvGear.has-pending .iv-dot { animation: none; }
}

/* ---------- 管理汇总页（双边）---------- */
#invites-view {
  /* 八哥令 2026-10-23（同一塌陷病根）：必须 flex:1 参与 body flex 挤压，
     否则高度归 0、内容塌成一条线。与 friends-view 写法对齐。 */
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  background: var(--pal-bg, #000);
}
/* 顶栏：标题 + 白色大叉（八哥令：不许有 Back；叉样式复用 pal-circle.css 的 .cd-x） */
.iv-top {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--pal-hair);
}
.iv-title {
  margin: 0;
  font-family: var(--pal-serif);
  font-size: 17px;
  font-weight: 700;
  background: linear-gradient(100deg, var(--pal-gold-l) 0%, var(--pal-gold) 55%, var(--pal-gold-d) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
/* 双边 tab 已取消（八哥令 2026-11-12）：接收与发送按时间倒序合并 */

/* 列表：滑动删除（结构同好友录行——底层 Delete、前景 .iv-fore） */
.iv-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 10px 16px 24px;
}
.iv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.iv-row { position: relative; border-radius: 14px; overflow: hidden; }
.iv-actions {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 14px;
  background: linear-gradient(90deg, rgba(255, 59, 48, .12), rgba(255, 59, 48, .3));
}
.iv-del {
  appearance: none;
  border: none;
  cursor: pointer;
  width: 72px;
  height: 44px;
  border-radius: 12px;
  background: #FF3B30;
  color: #fff;
  font-family: Nunito, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 800;
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s ease;
}
.iv-del:active { transform: scale(.94); }
.iv-fore {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--pal-line);
  background: var(--pal-panel);
  touch-action: pan-y;
  transition: transform .6s cubic-bezier(.22, .8, .3, 1);
}
.iv-row.is-open .iv-fore { transition: transform .6s cubic-bezier(.22, .8, .3, 1); }
.iv-time {
  flex: none;
  font-family: Nunito, system-ui, sans-serif;
  font-size: 11px;
  color: var(--pal-mut);
  font-variant-numeric: tabular-nums;
}
.iv-pend {
  flex: none;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 122, 176, .18);
  border: 1px solid rgba(255, 122, 176, .45);
  color: #FF9DC0;
  font-family: Nunito, system-ui, sans-serif;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .04em;
}
.iv-ok {
  flex: none;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(16, 185, 129, .14);
  border: 1px solid rgba(16, 185, 129, .45);
  color: #10B981;
  font-family: Nunito, system-ui, sans-serif;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .04em;
}
/* 空态 */
.iv-empty {
  margin: 40px auto 0;
  max-width: 300px;
  text-align: center;
  font-family: Nunito, system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.7;
  color: var(--pal-mut);
}
.iv-empty[hidden] { display: none; }

/* ============================================================
   合并列表（八哥令 2026-11-12）
   通过 = 整行绿色结局；我发出未通过 = 红框 + Resend（蓝）；
   名字后 R（粉）/ S（蓝）身份标，大小与名字同级。
   ============================================================ */
.iv-row.is-ok .iv-fore {
  border-color: rgba(16, 185, 129, .5);
  background: linear-gradient(180deg, rgba(16, 185, 129, .10), rgba(16, 185, 129, .03)), var(--pal-panel);
}
.iv-row.is-bad .iv-fore {
  border-color: rgba(255, 59, 48, .52);
  background: linear-gradient(180deg, rgba(255, 59, 48, .09), rgba(255, 59, 48, .03)), var(--pal-panel);
}
.iv-meta b.iv-person { display: flex; align-items: center; gap: 5px; min-width: 0; }
.iv-meta .iv-nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iv-role {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  color: #fff;
  font-family: Nunito, system-ui, sans-serif;
  font-size: 9.5px;
  font-weight: 900;
  font-style: normal;
  line-height: 1;
  letter-spacing: 0;
}
.iv-role-r { background: #FF4D88; }   /* 接收：粉 */
.iv-role-s { background: #2F6BFF; }   /* 发送：蓝 */

/* Resend：与主页铅笔编辑同款蓝底白字 */
.iv-resend {
  flex: none;
  appearance: none;
  border: none;
  cursor: pointer;
  padding: 0 12px;
  height: 30px;
  border-radius: 999px;
  background: #2F6BFF;
  color: #fff;
  font-family: Nunito, system-ui, sans-serif;
  font-size: 12px;
  font-weight: 800;
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s ease, opacity .12s ease;
}
.iv-resend:active { transform: scale(.94); }
.iv-resend[disabled] { opacity: .55; }

/* ============================================================
   首页 Pal Invites 浮层（八哥令 2026-11-12）
   不铺全屏遮罩、上下居中；多条向下排、内部滚动；只有右上角 ×。
   ============================================================ */
.ivp {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 90075;
  display: flex;
  flex-direction: column;
  width: min(360px, calc(100vw - 32px));
  max-height: min(72vh, 560px);
  border-radius: 18px;
  border: 1px solid rgba(255, 122, 176, .42);
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255, 122, 176, .10), transparent 60%),
    var(--pal-panel, #121014);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .03);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transform: translate(-50%, calc(-50% + 10px)) scale(.97);
  transition: opacity .2s ease, transform .22s cubic-bezier(.22, .8, .3, 1), visibility .2s;
}
.ivp.is-on { opacity: 1; pointer-events: auto; visibility: visible; transform: translate(-50%, -50%) scale(1); }
.ivp-top {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 10px 16px;
  border-bottom: 1px solid var(--pal-hair, rgba(255, 255, 255, .08));
}
.ivp-gear { flex: none; display: inline-flex; width: 19px; height: 19px; color: #FF4D88; }
.ivp-gear svg { width: 100%; height: 100%; display: block; }
.ivp-title {
  flex: none;
  font-family: var(--pal-serif, Georgia, serif);
  font-size: 17px;
  font-weight: 700;
  background: linear-gradient(100deg, var(--pal-gold-l, #F3DEA2) 0%, var(--pal-gold, #E3C77C) 55%, var(--pal-gold-d, #B99444) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.ivp-x {
  flex: none;
  margin-left: auto;
  appearance: none;
  border: none;
  background: transparent;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}
.ivp-x:active { background: rgba(255, 255, 255, .08); }
.ivp-list {
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 10px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ivp .iv-card { margin: 0; }
