#game-mail-overlay {
  --mail-scale: 1;
  position: fixed;
  z-index: 100020;
  display: none;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-sizing: border-box;
  color: #3a2519;
  background: rgba(24, 17, 12, 0.72);
  font-family: "STKaiti", "KaiTi", "Kaiti SC", serif;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

#game-mail-overlay.is-visible {
  display: flex;
}

#game-mail-overlay * { box-sizing: border-box; letter-spacing: 0; }

.game-mail-shell {
  width: 560px;
  flex: 0 0 560px;
  transform: scale(var(--mail-scale));
  transform-origin: center;
}

.game-mail-window {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 560px;
  height: 760px;
  padding: 58px 42px 28px;
  overflow: hidden;
  background: url("../../../resources/img/battleUI/giveUpDialog/bg.png") center / 100% 100% no-repeat;
  filter: drop-shadow(0 16px 12px rgba(24, 13, 7, 0.48));
}

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

.game-mail-window h2 {
  margin: 4px 48px 10px;
  color: #4a2b1d;
  font-size: 32px;
  line-height: 1.2;
  text-align: center;
}

.game-mail-list {
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 4px 8px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.game-mail-list::-webkit-scrollbar { width: 8px; }
.game-mail-list::-webkit-scrollbar-thumb {
  border-radius: 8px;
  background: rgba(122, 74, 48, 0.55);
}

.game-mail-empty,
.game-mail-status {
  margin: 48px 12px 0;
  color: #876d5c;
  font-size: 22px;
  text-align: center;
}

.game-mail-item {
  margin: 0 0 12px;
  padding: 14px 16px 12px;
  border: 3px solid #5a3726;
  border-radius: 8px;
  background: rgba(255, 244, 214, 0.72);
  box-shadow: inset 0 0 0 2px rgba(215, 154, 88, 0.35);
  cursor: pointer;
}

.game-mail-item.is-open {
  background: rgba(255, 236, 188, 0.9);
}

.game-mail-item.is-claimed {
  color: #7a7168;
  border-color: #8a8076;
  background: rgba(210, 204, 196, 0.62);
  box-shadow: inset 0 0 0 2px rgba(150, 142, 132, 0.28);
  filter: grayscale(0.55);
}

.game-mail-item.is-claimed.is-open {
  background: rgba(206, 200, 192, 0.78);
}

.game-mail-item.is-claimed .game-mail-item-head strong {
  color: #6f675e;
}

.game-mail-claimed-flag {
  display: block;
  margin-top: 4px;
  color: #8a5a3a;
  font-size: 16px;
  font-style: normal;
  font-weight: 700;
}

.game-mail-item.is-claimed .game-mail-claimed-flag {
  color: #7a7168;
}

.game-mail-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.game-mail-item-head strong {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: #3f271b;
  font-size: 22px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-mail-dot {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #c44732;
  box-shadow: 0 0 0 2px #f3d7a4;
}

.game-mail-item time {
  display: block;
  margin-top: 4px;
  color: #876d5c;
  font-family: sans-serif;
  font-size: 12px;
}

.game-mail-body {
  display: none;
  margin: 10px 0 0;
  color: #4b382c;
  font-size: 18px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.game-mail-item.is-open .game-mail-body { display: block; }

.game-mail-rewards {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.game-mail-reward {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 86px;
  padding: 4px 8px 4px 4px;
  border: 2px solid #6a4330;
  border-radius: 8px;
  background: rgba(255, 250, 235, 0.92);
}

.game-mail-reward img,
.game-mail-reward .game-mail-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

/*
 * 无贴图时的纯文字图标（阵法目录里查不到 art.mech 才走到这里）。
 * ★ 不要给它绑 data-skin：空 skin 绑上去会去请求一个空 URL（控制台一串 404）。
 */
.game-mail-reward .game-mail-icon.is-text {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #b8874f;
  color: #fff6e0;
  font-size: 20px;
  font-weight: 900;
}

.game-mail-reward span {
  color: #4a2b1d;
  font-size: 18px;
  font-weight: 700;
}

.game-mail-item-actions {
  display: none;
  margin-top: 12px;
}

.game-mail-item.is-open .game-mail-item-actions { display: flex; }

.game-mail-foot {
  display: flex;
  gap: 12px;
  flex: 0 0 auto;
  margin-top: 10px;
}

.game-mail-btn {
  flex: 1 1 0;
  height: 56px;
  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: 22px;
  font-weight: 700;
  cursor: pointer;
}

.game-mail-btn.is-ghost {
  color: #5a3726;
  background: #e8d3a4;
  box-shadow: inset 0 -7px 0 rgba(90, 55, 38, 0.18), 0 4px 0 #8a6244;
}

.game-mail-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.game-mail-btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: inset 0 -4px 0 rgba(104, 42, 27, 0.25), 0 1px 0 #452419;
}

.game-mail-confirm {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  background: rgba(24, 17, 12, 0.55);
}

.game-mail-confirm.is-visible { display: flex; }

.game-mail-confirm-card {
  width: 360px;
  padding: 28px 24px 22px;
  border: 4px solid #5a3726;
  border-radius: 10px;
  background: #f7ead0;
  text-align: center;
}

.game-mail-confirm-card p {
  margin: 0 0 18px;
  color: #4a2b1d;
  font-size: 20px;
  line-height: 1.5;
}

.game-mail-confirm-card .game-mail-foot { margin-top: 0; }
