/*
 * 本文件被两个弹窗共用，规则按根节点隔离，改前必读：
 *   #game-announcement-overlay —— 武将公告弹窗（抖音 NoticeDialog 款）
 *   #game-shop-overlay         —— 套餐购买弹窗（保持旧版设计，GameShop.js 复用
 *                                 .game-announcement-* 类名，见其 ensureRoot）
 * 改公告样式只准动 #game-announcement-overlay 前缀的规则；
 * #game-shop-overlay 前缀与 .game-shop-* 是套餐弹窗的，动了会带偏套餐。
 * 套餐 JS 的 syncBounds 按 520×560 设计稿算缩放，别改它的窗口尺寸。
 */

/* ============ 公告弹窗（抖音款）根节点 ============ */
#game-announcement-overlay {
  --announcement-scale: 1;
  position: fixed;
  z-index: 100010;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-sizing: border-box;
  color: #000;
  background: rgba(0, 0, 0, 0.5);
  font-family: Arial, "Microsoft YaHei", "PingFang SC", sans-serif;
  letter-spacing: 0;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: none;
  touch-action: none;
}

#game-announcement-overlay.is-visible,
#game-shop-overlay.is-visible {
  display: flex;
  pointer-events: auto;
}

/* ============ 套餐弹窗根节点（旧版设计） ============ */
#game-shop-overlay {
  --announcement-scale: 1;
  position: fixed;
  z-index: 100010;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-sizing: border-box;
  color: #3a2519;
  background: rgba(22, 15, 10, 0.72);
  font-family: "STKaiti", "KaiTi", "Kaiti SC", serif;
  letter-spacing: 0;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: none;
  touch-action: none;
}

.game-shop-body { padding-bottom: 4px; }

.game-shop-status,
.game-shop-feedback,
.game-shop-note {
  margin: 0 0 10px;
  color: #765035;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}

.game-shop-feedback { color: #8e3026; }
.game-shop-feedback.is-ok { color: #37653b; }

.game-shop-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.game-shop-card {
  display: grid;
  /* 名字 / 描述 / 库存(可选) / 底栏。库存行不渲染时 grid 自动少一行，不用改这里。 */
  grid-template-rows: auto 1fr auto auto;
  min-height: 92px;
  padding: 10px 12px 9px;
  border: 3px solid #654029;
  border-radius: 6px;
  background: #efd9a7;
  box-shadow: inset 0 3px 0 #fff1c8, 0 3px 0 #8b5b36;
}

.game-shop-card.is-vip {
  border-color: #8d3b31;
  background: #f0c9a0;
}

.game-shop-name { color: #4b2a1b; font-size: 22px; font-weight: 900; }
.game-shop-desc {
  margin: 4px 0 8px;
  color: #765035;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

/*
 * 激活码剩余库存（只有 invite 套餐渲染）。
 * ★ 数字用等宽+贴右，避免每次刷新库存位数变化时整行左右跳。
 * ★ 布局压在描述下方、底栏上方；不要用 position:absolute —— 卡片高度是
 *   内容撑开的，绝对定位会盖住「购买」按钮。
 */
.game-shop-stock {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin: 0 0 8px;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(101, 64, 41, 0.12);
  color: #6a422c;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}
.game-shop-stock strong {
  color: #a33728;
  font: 900 18px/1 Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}
/* 售罄：整体压灰，数字仍可读（运营补货回来就恢复正常色） */
.game-shop-stock.is-empty {
  background: rgba(101, 64, 41, 0.2);
  color: #8a6a55;
}
.game-shop-stock.is-empty strong { color: #8a6a55; }
/*
 * 权益有效期行（刀币权益 / 体力上限权益）。
 * ★ 复用 .game-shop-stock 的版式，但换成绿色系 —— 它表示「已生效」，
 *   跟「剩余库存」的红字语义相反，同色会读成告警。
 * ★ 到期时间是 16 位字符串，font-size 压到 14px 才能在一行内放下。
 */
.game-shop-stock.is-perk {
  background: rgba(55, 101, 59, 0.13);
  color: #37653b;
}
.game-shop-stock.is-perk strong {
  color: #2c5a30;
  font: 900 14px/1.2 Arial, sans-serif;
}

.game-shop-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.game-shop-foot strong { color: #a33728; font: 900 22px/1 Arial, sans-serif; }
.game-shop-buy {
  width: 72px;
  height: 36px;
  border: 3px solid #4e2c1c;
  border-radius: 5px;
  color: #fff5d4;
  background: #a84638;
  box-shadow: inset 0 2px 0 #e88c6f, 0 3px 0 #5a2f20;
  font-family: inherit;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
}
.game-shop-buy:active { transform: translateY(2px); box-shadow: inset 0 2px 0 #e88c6f; }
/* 修改器玩家看自选阵容周卡：已自带最高权限，整卡置灰、按钮禁用 */
.game-shop-card.is-owned { filter: grayscale(0.7); opacity: 0.75; }
.game-shop-card.is-owned .game-shop-buy {
  width: auto;
  padding: 0 8px;
  font-size: 14px;
  background: #8a8078;
  box-shadow: inset 0 2px 0 #a89e96, 0 3px 0 #5a534d;
  cursor: default;
}

.game-shop-weapons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-bottom: 6px;
}

.game-shop-weapon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 8px 6px 7px;
  border: 3px solid #654029;
  border-radius: 6px;
  background: #efd9a7;
  box-shadow: inset 0 3px 0 #fff1c8, 0 3px 0 #8b5b36;
  color: #4b2a1b;
  font-family: inherit;
  cursor: pointer;
}

.game-shop-weapon img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  pointer-events: none;
}

.game-shop-weapon strong {
  font-size: 15px;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
}

.game-shop-weapon span {
  color: #a33728;
  font-size: 13px;
  font-weight: 800;
}

.game-shop-weapon:active { transform: translateY(2px); box-shadow: inset 0 2px 0 #fff1c8, 0 1px 0 #8b5b36; }
#game-announcement-overlay * ,
#game-shop-overlay * { box-sizing: border-box; letter-spacing: 0; }

/* ============ 套餐弹窗骨架（旧版，作用域限定在套餐根节点） ============ */
/* 设计稿固定尺寸，整体用 --announcement-scale 适配画布，避免各设备字号忽大忽小。 */
#game-shop-overlay .game-announcement-shell {
  width: 520px;
  flex: 0 0 520px;
  transform: scale(var(--announcement-scale));
  transform-origin: center;
  pointer-events: none;
}

#game-shop-overlay .game-announcement-window {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 520px;
  height: 560px;
  max-height: 560px;
  min-height: 0;
  padding: 70px 58px 42px;
  overflow: hidden;
  pointer-events: auto;
  touch-action: pan-y;
  background: url("../../../resources/img/battleUI/giveUpDialog/bg.png") center / 100% 100% no-repeat;
  filter: drop-shadow(0 14px 12px rgba(20, 10, 5, 0.5));
  animation: game-announcement-enter 220ms ease-out both;
}

#game-shop-overlay .game-announcement-body {
  flex: 1 1 0;
  min-height: 0;
  max-height: 100%;
  margin: 0 -8px;
  padding: 0 8px 4px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  pointer-events: auto;
}

#game-shop-overlay .game-announcement-body::-webkit-scrollbar {
  width: 8px;
}

#game-shop-overlay .game-announcement-body::-webkit-scrollbar-thumb {
  border-radius: 8px;
  background: rgba(122, 74, 48, 0.55);
}

#game-shop-overlay .game-announcement-close {
  position: absolute;
  top: 28px;
  right: 31px;
  width: 50px;
  height: 48px;
  padding: 0;
  border: 0;
  background: url("../../../resources/img/pvpUI/close.png") center / contain no-repeat;
  cursor: pointer;
}

#game-shop-overlay .game-announcement-seal {
  position: absolute;
  top: 30px;
  left: 46px;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 4px solid #4b2b1d;
  border-radius: 50%;
  color: #fff3c9;
  background: #a94435;
  font-size: 28px;
  font-weight: 700;
  box-shadow: inset 0 0 0 3px #d77a55;
}

#game-shop-overlay .game-announcement-window h2 {
  margin: 7px 55px 0;
  color: #4a2b1d;
  font-size: 30px;
  line-height: 1.25;
  text-align: center;
}

#game-shop-overlay .game-announcement-divider {
  height: 3px;
  margin: 22px 4px 18px;
  background: linear-gradient(90deg, transparent, #9a6645 18%, #9a6645 82%, transparent);
}

#game-shop-overlay .game-announcement-content {
  min-height: 105px;
  margin: 0;
  overflow-wrap: anywhere;
  color: #4b382c;
  font-size: 20px;
  line-height: 1.6;
  text-align: left;
  white-space: pre-wrap;
  user-select: text;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

#game-shop-overlay .game-announcement-window h2,
#game-shop-overlay .game-announcement-divider,
#game-shop-overlay .game-announcement-time,
#game-shop-overlay .game-announcement-confirm {
  flex: 0 0 auto;
}

#game-shop-overlay .game-announcement-time {
  display: block;
  margin-top: 12px;
  color: #876d5c;
  font-family: sans-serif;
  font-size: 12px;
  text-align: right;
}

#game-shop-overlay .game-announcement-confirm {
  display: block;
  width: 190px;
  height: 62px;
  margin: 22px auto 0;
  border: 3px solid #56291c;
  border-radius: 6px;
  color: #fff8dc;
  background: #c75f43;
  box-shadow: inset 0 -7px 0 rgba(104, 42, 27, 0.25), 0 4px 0 #452419;
  font-family: inherit;
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
}

#game-shop-overlay .game-announcement-confirm:active { transform: translateY(3px); box-shadow: inset 0 -4px 0 rgba(104, 42, 27, 0.25), 0 1px 0 #452419; }

@keyframes game-announcement-enter {
  from { opacity: 0; transform: translateY(18px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============ 公告弹窗骨架（抖音 NoticeDialog 款） ============ */
/*
 * 样式对齐 other/douyin/dialog/NoticeDialog.lh：
 * infoBg1 九宫格底板 538×918（sizeGrid 50,50,50,50 → border-image slice 50 fill）、
 * 关闭钮 xBtn2 78×78 悬挑在底板左上角（Laya anchor 0.5，中心落在 (35,15)）、
 * 标题 48px 黑粗体居中、正文 32px 黑字行距 8、按钮 yellowBtn 242×104 白字 44px 黑描边。
 * 下面 left/top 都是抖音子件坐标减去 50px 边框后的 padding-box 坐标。
 * 注意：App WebView 不支持 paint-order，文字描边必须用 text-shadow（不能用
 * -webkit-text-stroke，8px 描边会把白色字芯盖成黑块）。
 */
#game-announcement-overlay .game-announcement-shell {
  width: 538px;
  flex: 0 0 538px;
  transform: scale(var(--announcement-scale));
  transform-origin: center;
  pointer-events: none;
}

#game-announcement-overlay .game-announcement-window {
  position: relative;
  width: 538px;
  height: 918px;
  box-sizing: border-box;
  border: 50px solid transparent;
  border-image: url("../../../resources/img/weaponBag/infoBg1.png") 50 fill stretch;
  pointer-events: auto;
  touch-action: pan-y;
  animation: game-announce-douyin-enter 220ms ease-out both;
}

#game-announcement-overlay .game-announcement-close {
  position: absolute;
  left: -15px;
  top: -15px;
  width: 78px;
  height: 78px;
  padding: 0;
  border: 0;
  transform: translate(-50%, -50%);
  background: url("../../../resources/img/rank/xBtn2.png") center / 100% 100% no-repeat;
  cursor: pointer;
}

#game-announcement-overlay .game-announcement-close:active { opacity: 0.75; }

/* 字号比抖音原稿收一档：原稿标题 48 / 正文 32 在手机上是「放大镜阅读」，
   长公告一屏只能放七八行。标题 42、正文 26 后同屏多出三行左右，
   标题高度/行高同步收（绝对定位，改了字号不改 height 会上下串位）。 */
#game-announcement-overlay .game-announcement-window h2 {
  position: absolute;
  left: 9px;
  top: -17px;
  width: 420px;
  height: 54px;
  margin: 0;
  color: #000;
  font-size: 42px;
  font-weight: 700;
  line-height: 54px;
  text-align: center;
}

#game-announcement-overlay .game-announcement-body {
  position: absolute;
  left: -17px;
  top: 60px;
  width: 472px;
  height: 599px;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  pointer-events: auto;
  scrollbar-width: none;
}

#game-announcement-overlay .game-announcement-body::-webkit-scrollbar { display: none; }

#game-announcement-overlay .game-announcement-content {
  width: 100%;
  min-height: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: #000;
  font-size: 26px;
  font-weight: 400;
  line-height: 34px;
  text-align: left;
  white-space: pre-wrap;
  user-select: text;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

#game-announcement-overlay .game-announcement-confirm {
  position: absolute;
  left: 50%;
  top: 695px;
  width: 242px;
  height: 104px;
  margin: 0;
  padding: 0;
  border: 0;
  transform: translateX(-50%);
  color: #fff;
  background: url("../../../resources/img/weaponBag/yellowBtn.png") center / 100% 100% no-repeat;
  font-family: inherit;
  font-size: 44px;
  font-weight: 400;
  line-height: 104px;
  text-align: center;
  cursor: pointer;
  /* 抖音 Text stroke 8 的 DOM 等价写法：text-shadow 四周边 outline，
     白字芯不被侵蚀，旧 WebView 也稳定 */
  text-shadow:
    3px 0 0 #000, -3px 0 0 #000, 0 3px 0 #000, 0 -3px 0 #000,
    2px 2px 0 #000, -2px 2px 0 #000, 2px -2px 0 #000, -2px -2px 0 #000,
    3px 2px 0 #000, -3px 2px 0 #000, 3px -2px 0 #000, -3px -2px 0 #000,
    2px 3px 0 #000, -2px 3px 0 #000, 2px -3px 0 #000, -2px -3px 0 #000;
}

#game-announcement-overlay .game-announcement-confirm:active { transform: translateX(-50%) scale(0.96); }

@keyframes game-announce-douyin-enter {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

/* 官方 QQ 群：一键加群 */
#game-announcement-overlay .game-qq-groups { margin: 18px 0 8px; }
#game-announcement-overlay .game-qq-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
#game-announcement-overlay .game-qq-join {
  flex: 1;
  display: block;
  padding: 8px 6px;
  border-radius: 10px;
  background: #12b76a;
  color: #fff;
  font-size: 22px;
  line-height: 30px;
  text-align: center;
  text-decoration: none;
}
#game-announcement-overlay .game-qq-join:active { filter: brightness(0.92); }
#game-announcement-overlay .game-qq-copy {
  flex: none;
  padding: 8px 12px;
  border: 2px solid #8a5a2b;
  border-radius: 10px;
  background: #ffe9c4;
  color: #5b3413;
  font-family: inherit;
  font-size: 20px;
  line-height: 30px;
  cursor: pointer;
}
#game-announcement-overlay .game-qq-copy:active { filter: brightness(0.95); }
