/* TROCA AO VIVO (js/ui/troca-viva.js): a janela (.jn, moldura em pixel de css/molduras-pixel.css), a mesa dos dois lados e os
   cartões do canto (convite, esperando resposta, fim). Cores só por token (css/paleta.css). Sem animação. */

/* ---------- cartões do canto: um em cima do outro, sem se cobrir ---------- */
.tv-avisos{position:fixed;right:12px;bottom:96px;z-index:53;display:flex;flex-direction:column;align-items:flex-end;gap:8px;pointer-events:none}
.tv-avisos:empty{display:none}
.tv-pop{pointer-events:auto;width:min(310px,calc(100vw - 24px));display:flex;flex-direction:column;align-items:stretch;gap:8px;padding:10px 12px;font-size:12.5px;color:var(--dz-txt)}
.tv-pop-tit{display:flex;align-items:center;gap:8px;line-height:1.3}
.tv-pop-nome{flex:1;min-width:0}
.tv-pop-ico,.tv-seta{flex:none;width:28px;height:28px;display:grid;place-items:center;padding:0;line-height:0;color:var(--dz-laranja)}
.tv-pop-ico{background:var(--dz-painel-fundo);border:1px solid var(--dz-borda)}
.tv-pop-ico svg,.tv-seta svg{display:block}
.tv-pop small{color:var(--dz-txt-2)}
.tv-prazo{color:var(--dz-ouro)}
.tv-pop-acoes{display:flex;gap:8px;justify-content:flex-end}
.tv-pop-acoes .botao-ki{padding:6px 12px;font-size:12.5px}
.tv-pop-fim.ok .tv-pop-nome>b:first-child{color:var(--dz-ok)}
.tv-pop .tv-pop-x{width:24px;height:24px;background-size:12px 12px}
.tv-pop-txt{margin:0;line-height:1.4}
/* cada pedaço do resumo ("Cristal ×4", "Luvas Bronze +3") vai inteiro para a linha seguinte */
.tv-pop-txt b>span,.tv-resumo b>span{white-space:nowrap}

/* ---------- janela: por cima das outras (a do menu fecha quando ela abre) ---------- */
.jn.tv-jn{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);width:min(860px,calc(100vw - 16px));max-height:min(88vh,760px);z-index:52}
.jn.tv-jn[hidden]{display:none}
.tv-corpo{display:flex;flex-direction:column;gap:10px}

/* a mesa: o que eu dou | o que o outro dá */
.tv-mesa{display:grid;grid-template-columns:1fr auto 1fr;gap:8px;align-items:stretch}
.tv-lado{min-width:0;display:flex;flex-direction:column;align-items:stretch;gap:6px;padding:8px}
.tv-lado-cab{display:flex;align-items:center;gap:6px;font-size:13px}
.tv-lado-cab .tv-selo{margin-left:auto}
.tv-seta{align-self:center}
.tv-lista{display:flex;flex-direction:column;gap:5px;min-height:54px;max-height:300px;overflow-y:auto}
.tv-vazio{margin:6px 0;color:var(--dz-txt-2);font-size:12px}
.tv-selo.ok{color:var(--dz-ok);border-color:var(--dz-ok)}

/* uma peça na mesa (item ou equipamento): todas com a mesma altura */
.tv-peca{display:flex;align-items:center;gap:8px;min-height:52px;padding:4px 6px;background:var(--dz-painel-fundo);border:1px solid var(--dz-borda);clip-path:var(--px-canto)}
.tv-ico{flex:none;width:36px;height:36px;display:grid;place-items:center;font-size:24px;line-height:0}
.tv-ico img{width:32px;height:32px;image-rendering:pixelated}
.tv-peca .eq-ico{width:44px;height:44px}
.tv-txt{flex:1;min-width:0;display:flex;flex-direction:column}
.tv-txt b{font-size:12.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tv-txt small{font-size:11px;color:var(--dz-txt-2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tv-qtd-bts{flex:none;display:flex;gap:3px}
.tv-q{min-width:28px;height:26px;padding:0 6px;font-size:11px}
.tv-qtd{width:74px}
.tv-qtd-txt{flex:none;font-size:13px;color:var(--dz-ouro)}
/* tirar da mesa: o X em pixel das janelas (--px-xis), no centro do botão */
.tv-tirar{flex:none;width:26px;height:26px;padding:0;line-height:0;display:grid;place-items:center;cursor:pointer;
  border:1px solid var(--dz-px-contorno);background:var(--px-xis) center/12px 12px no-repeat var(--dz-perigo);clip-path:var(--px-canto)}
.tv-tirar:hover{background-color:var(--dz-perigo-claro)}

/* ações e resumo */
.tv-acoes{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.tv-acoes .botao-ki{padding:8px 16px;font-size:14px}
.tv-nota,.tv-dica{color:var(--dz-txt-2);font-size:11.5px}
.tv-dica{grid-column:1/-1}
.tv-espera{font-size:12.5px;color:var(--dz-ouro)}
.tv-resumo{padding:8px 10px;background:var(--dz-painel-fundo);border:1px solid var(--dz-ouro);font-size:12.5px;clip-path:var(--px-canto)}
.tv-resumo p{margin:2px 0}

/* o que dá para pôr: itens da bolsa e equipamentos */
.tv-sel{display:flex;flex-direction:column;gap:6px;min-height:0}
.tv-sel-cab{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.tv-sel-cab .abas-px{margin-bottom:0}
.tv-busca{flex:1 1 160px;width:auto;min-width:0}
.tv-grade{display:grid;grid-template-columns:repeat(auto-fill,minmax(170px,1fr));gap:6px;max-height:240px;overflow-y:auto;padding-right:2px}
.tv-opcao{display:grid;grid-template-columns:auto 1fr;grid-template-rows:auto auto;column-gap:8px;align-items:center;min-height:52px;padding:4px 8px;text-align:left;
  cursor:pointer;font:inherit;color:var(--dz-txt);background:var(--dz-painel-2);border:1px solid var(--dz-borda);clip-path:var(--px-canto)}
.tv-opcao:hover{border-color:var(--dz-laranja)}
.tv-opcao.na-mesa{border-color:var(--dz-laranja);background:var(--dz-painel-fundo);box-shadow:inset 0 0 0 1px var(--dz-laranja)}
.tv-opcao>.tv-ico,.tv-opcao>.eq-ico{grid-row:1/3}
.tv-opcao .eq-ico{width:40px;height:40px}
.tv-op-nome{font-size:12px;font-weight:800;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tv-opcao small{font-size:11px;color:var(--dz-txt-2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tv-mais{grid-column:1/-1;justify-self:center}

/* celular: um lado embaixo do outro, as setas deitadas */
@media (max-width:700px){
  .jn.tv-jn{max-height:calc(100vh - 80px)}
  .tv-mesa{grid-template-columns:1fr}
  .tv-seta{justify-self:center;transform:rotate(90deg)}
  .tv-lista{max-height:180px}
  .tv-grade{grid-template-columns:repeat(2,minmax(0,1fr));max-height:200px}
  .tv-qtd{width:60px}
  .tv-avisos{right:8px;left:8px;bottom:84px;align-items:stretch}
  .tv-pop{width:auto}
}
