/* =====================================================================
   BATALHA PARTY — Rodada 49: janela "E-mail" (js/ui/screen-mail.js; docs/ROUND49-EMAIL-BANDEIRINHAS.md).
   Moldura = a do Centro de tarefas (css/tasks.css: .tk-backdrop/.tk-wrap/.tk-panel/.tk-ribbon/.tk-close) + dois varais de
   bandeirinhas coloridas (SVG) balançando no alto, presos nas pontas da fita. Abas laranja (ativa) / roxa como as do Ranking;
   e-mails em cartões brancos (o novo com fundo dourado claro e selo NOVO); a carta aberta num papel com borda de carta aérea
   e linhas de caderno. Palco fixo 1280x720 escalado: sem media queries.
   ===================================================================== */
.overlay.mail { position: absolute; inset: 0; }
.mb-wrap { width: 1040px; height: 600px; }
.mb-panel { background: #f8f1e1; }

/* ---------------------------------------------------------------- bandeirinhas */
.mb-bunting { position: absolute; left: 0; top: 0; width: 100%; height: 84px; z-index: 1; pointer-events: none; overflow: visible; }
.mb-string { fill: none; stroke: #8a5a2b; stroke-width: 2.6; stroke-linecap: round; }
.mb-pin { fill: #d9963f; stroke: #6b3f12; stroke-width: 2; }
.mb-flag { transform-box: fill-box; transform-origin: 50% 0; animation: mb-swing 2.6s ease-in-out infinite alternate; }
@keyframes mb-swing { from { transform: rotate(-6deg); } to { transform: rotate(6deg); } }

/* ---------------------------------------------------------------- corpo */
.mb-body {
  position: absolute; left: 0; right: 0; top: 76px; bottom: 10px; z-index: 2; padding: 0 24px 4px;
  display: flex; flex-direction: column; min-height: 0; color: #5a3a1a;
}
.mb-loading { margin: 0; padding: 150px 0; text-align: center; font-size: 20px; font-weight: 800; color: #9a7a4a; }
.mb-panel ::-webkit-scrollbar { width: 10px; }
.mb-panel ::-webkit-scrollbar-track { background: transparent; }
.mb-panel ::-webkit-scrollbar-thumb { background: #d9c9a3; border-radius: 5px; border: 2px solid #f8f1e1; }

/* ---------------------------------------------------------------- abas + ações */
.mb-top { flex: none; display: flex; align-items: flex-end; gap: 12px; height: 56px; }
.mb-tabs { display: flex; gap: 6px; align-self: stretch; align-items: flex-end; }
.mb-tab {
  display: inline-flex; align-items: center; gap: 8px; height: 54px; padding: 0 16px 0 12px; border: 0; cursor: pointer;
  border-radius: 14px 14px 0 0; font-family: inherit; font-size: 22px; font-weight: 900; letter-spacing: .2px; color: #fff; white-space: nowrap;
  background: linear-gradient(#a487ff 0%, #8a66f0 45%, #6c47d8 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35), inset 0 -3px 0 rgba(0, 0, 0, .15);
  -webkit-text-stroke: 1.2px #2e1478; paint-order: stroke fill; text-shadow: 0 2px 0 #2e1478; transition: filter .12s;
}
.mb-tab:hover { filter: brightness(1.08); }
.mb-tab .ico { flex: none; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .25)); }
.mb-tab.on {
  height: 56px; cursor: default; background: linear-gradient(#fff07a 0%, #ffd23c 40%, #ffaa22 100%);
  -webkit-text-stroke: 1.3px #8a3d00; text-shadow: 0 2px 0 #8a3d00;
}
.mb-count {
  min-width: 30px; height: 28px; padding: 0 8px; border-radius: 14px; background: rgba(0, 0, 0, .28); color: #fff;
  font-size: 17px; line-height: 28px; text-align: center; -webkit-text-stroke: 0; text-shadow: none;
}
.mb-count.hot { background: #ff3b3b; box-shadow: 0 2px 0 #a01010; }
.mb-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; padding-bottom: 8px; }
.mb-tool {
  display: inline-flex; align-items: center; gap: 6px; height: 42px; padding: 0 14px; border-radius: 12px; cursor: pointer;
  border: 2px solid #e6d9bd; background: #fff; color: #7a5326; font-family: inherit; font-size: 16px; font-weight: 900; white-space: nowrap;
  box-shadow: 0 3px 0 rgba(120, 90, 40, .15); transition: transform .06s;
}
.mb-tool:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 rgba(120, 90, 40, .15); }
.mb-tool.gold { border: 0; color: #3a1d00; background: linear-gradient(#ffd24a, #ff9c1a); box-shadow: 0 4px 0 #a05a00, 0 6px 8px rgba(0, 0, 0, .15); }
.mb-tool.gold:active:not(:disabled) { box-shadow: 0 1px 0 #a05a00; }
.mb-tool:disabled { cursor: wait; filter: grayscale(.4); }

/* ---------------------------------------------------------------- lista */
.mb-list {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px;
  background: #fbf6ea; border: 2px solid #ece3cf; border-top: 4px solid #ffaa22; border-radius: 0 16px 16px 16px;
  box-shadow: inset 0 2px 6px rgba(120, 90, 40, .08);
}
.mb-row {
  flex: none; display: grid; grid-template-columns: 74px minmax(0, 1fr) auto 150px; align-items: center; gap: 14px;
  min-height: 84px; padding: 8px 14px 8px 8px; background: #fff; border: 2px solid #ece3cf; border-radius: 16px; cursor: pointer;
  box-shadow: 0 3px 0 rgba(120, 90, 40, .12); transition: transform .06s, box-shadow .06s;
}
.mb-row:hover { border-color: #e2cf9f; }
.mb-row:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(120, 90, 40, .12); }
.mb-row:focus-visible { outline: 3px solid #ffb43a; outline-offset: 2px; }
.mb-row.unread { border-color: #ffd36a; background: linear-gradient(90deg, #fff6dc 0%, #ffffff 46%); }
.mb-env { position: relative; width: 74px; height: 66px; display: flex; align-items: center; justify-content: center; }
.mb-tag {
  position: absolute; top: -2px; right: -8px; padding: 1px 7px; border-radius: 8px; background: #ff3b3b; color: #fff;
  font-size: 12px; font-weight: 900; letter-spacing: .5px; box-shadow: 0 2px 0 #a01010; transform: rotate(10deg);
}
.mb-info { min-width: 0; }
.mb-title { font-size: 21px; font-weight: 900; color: #4a2d0e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mb-row:not(.unread) .mb-title { color: #7a5f3e; font-weight: 800; }
.mb-date { margin-top: 3px; font-size: 14px; font-weight: 800; color: #a58a5e; }
.mb-gift { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.mb-gift-items { display: flex; align-items: center; gap: 6px; font-size: 17px; font-weight: 900; color: #5a3a1a; white-space: nowrap; }
.mb-gift-st { padding: 1px 10px; border-radius: 999px; font-size: 13px; font-weight: 900; background: #fff4d6; color: #9a5a00; border: 2px solid #ffd36a; }
.mb-gift.done .mb-gift-st { background: #e3f8e6; color: #1f7a33; border-color: #8fdc9c; }
.mb-gift.done .mb-gift-items { opacity: .55; }
.mb-btn {
  width: 150px; height: 52px; border: 0; border-radius: 14px; cursor: pointer; font-family: inherit; font-size: 22px; font-weight: 900;
  color: #3a1d00; background: linear-gradient(#ffd24a, #ff9c1a); box-shadow: 0 5px 0 #a05a00, 0 8px 10px rgba(0, 0, 0, .18);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .35); transition: transform .06s, box-shadow .06s;
}
.mb-btn.read { color: #4a4a58; background: linear-gradient(#ffffff, #dcdce6); box-shadow: 0 5px 0 #9a9aa6, 0 8px 10px rgba(0, 0, 0, .12); }
.mb-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #a05a00; }
.mb-btn.read:active { box-shadow: 0 1px 0 #9a9aa6; }
.mb-empty { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; font-size: 21px; font-weight: 900; color: #8a7a58; }
.mb-empty .ico { opacity: .55; }
.mb-empty small { font-size: 16px; font-weight: 800; color: #a58a5e; }
.mb-empty.err { color: #c0392b; }

/* ---------------------------------------------------------------- carta */
.mb-letter { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.mb-lbar { flex: none; height: 52px; display: flex; align-items: center; }
.mb-back {
  height: 42px; padding: 0 16px; border-radius: 12px; border: 2px solid #e6d9bd; background: #fff; cursor: pointer;
  font-family: inherit; font-size: 18px; font-weight: 900; color: #7a5326; box-shadow: 0 3px 0 rgba(120, 90, 40, .15);
}
.mb-back:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(120, 90, 40, .15); }
.mb-paper {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px 24px 18px; border: 9px solid transparent; border-radius: 16px;
  background: linear-gradient(#fffdf8, #fffdf8) padding-box,
    repeating-linear-gradient(-45deg, #ff4d5e 0 14px, #fffdf8 14px 22px, #3fa9f5 22px 36px, #fffdf8 36px 44px) border-box;
  box-shadow: 0 4px 0 rgba(120, 90, 40, .15), 0 10px 18px rgba(0, 0, 0, .08);
}
.mb-phead { display: flex; align-items: center; gap: 16px; padding-bottom: 12px; border-bottom: 2px dashed #e6d9bd; }
.mb-stamp {
  flex: none; width: 78px; height: 78px; display: flex; align-items: center; justify-content: center;
  background: #fff4d6; border: 3px dashed #ffb43a; border-radius: 10px; transform: rotate(-5deg);
}
.mb-pt { min-width: 0; }
.mb-ptitle { font-size: 28px; font-weight: 900; line-height: 1.15; color: #4a2d0e; word-break: break-word; }
.mb-pmeta { margin-top: 4px; font-size: 15px; font-weight: 800; color: #a58a5e; }
.mb-ptext {
  margin-top: 12px; font-size: 20px; font-weight: 700; line-height: 30px; color: #3b2a14; white-space: pre-wrap; word-break: break-word;
  overflow-wrap: anywhere; -webkit-user-select: text; user-select: text;
  background-image: repeating-linear-gradient(transparent 0 29px, rgba(63, 169, 245, .2) 29px 30px);
}
.mb-gifts {
  margin-top: 16px; display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; padding: 12px 14px;
  background: #fff4d6; border: 2px solid #ffd36a; border-radius: 14px;
}
.mb-gifts.done { background: #eefaf0; border-color: #8fdc9c; }
.mb-gifts-lbl { display: inline-flex; align-items: center; gap: 8px; font-size: 19px; font-weight: 900; color: #9a5a00; }
.mb-gifts.done .mb-gifts-lbl { color: #1f7a33; }
.mb-gifts-items { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 900; color: #5a3a1a; }
.mb-claim {
  margin-left: auto; height: 54px; padding: 0 30px; border: 0; border-radius: 14px; cursor: pointer; font-family: inherit;
  font-size: 22px; font-weight: 900; color: #3a1d00; background: linear-gradient(#ffd24a, #ff9c1a);
  box-shadow: 0 5px 0 #a05a00, 0 8px 10px rgba(0, 0, 0, .18); text-shadow: 0 1px 0 rgba(255, 255, 255, .35);
  animation: mb-glow 1.4s ease-in-out infinite;
}
.mb-claim:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 #a05a00; }
.mb-claim:disabled { cursor: wait; animation: none; filter: grayscale(.4); }
@keyframes mb-glow { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.13); } }
.mb-done { margin-left: auto; font-size: 20px; font-weight: 900; color: #1f7a33; }
