/* Modo online: painel do menu e lobby da sala (src/online.js).
   O lobby é o aprovado em qa/lobby-previa.html: palco com os quatro
   jogadores, a partida à direita, chat, personagens e Pronto embaixo. O
   amarelo é o do site (botoes/bv-loja.css). */

/* ---------- Painel "Jogar online" do menu ---------- */
.online-apelido { display: grid; gap: 6px; max-width: 360px; margin-bottom: var(--s3); color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.online-apelido input, .online-codigo input {
  padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 3px; background: #090b0fdd; color: var(--ink);
  font: 600 14px Barlow, "Segoe UI", sans-serif; outline: none;
}
.online-apelido input:focus, .online-codigo input:focus { border-color: var(--amber); }
.online-opcoes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
.online-opcao { display: grid; align-content: start; gap: var(--s2); padding: var(--s3); border: 1px solid var(--line); border-radius: 5px; background: #0b0f15b8; }
.online-opcao h3 { margin: 0; font: 700 20px "Barlow Condensed", sans-serif; letter-spacing: .06em; text-transform: uppercase; }
.online-opcao p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.online-codigo { display: flex; gap: var(--s2); margin-top: 4px; }
.online-codigo input { width: 9ch; font: 700 20px "Barlow Condensed", sans-serif; letter-spacing: .3em; text-transform: uppercase; }
.online-estado { margin: var(--s3) 0 0; color: var(--amber); font-size: 13px; }
.online-estado.erro { color: #ff7b6b; }
.online-estado:empty { display: none; }
@media (max-width: 640px) { .online-opcoes { grid-template-columns: 1fr; } }

/* ---------- Lobby ---------- */
body.no-lobby #touchControls { display: none; }
.lobby {
  --lb-amber: #ffb000; --lb-laranja: #ee8f3d; --lb-ink: #f0f1f4; --lb-muted: #8c9099;
  --lb-vidro: #10151cd9; --lb-linha: #ffffff14; --lb-linha-forte: #ffffff2b; --lb-pronto: #4ade80;
  --lb-placa: 50px;
  position: fixed; inset: 0; z-index: 30; overflow-y: auto; overscroll-behavior: contain;
  background: radial-gradient(ellipse at 50% 55%, #1a2230 0%, #0b0f15 55%, #07080b 100%);
  color: var(--lb-ink); font-family: Barlow, "Segoe UI", sans-serif;
}
.lobby[hidden] { display: none; }
.lobby:focus { outline: none; }
.lobby button { font-family: inherit; }
.lobby-tela {
  width: min(1280px, 100%); min-height: 100%; margin: 0 auto; padding: clamp(12px, 2.4vh, 18px) clamp(14px, 2.2vw, 28px);
  display: grid; grid-template-rows: auto 1fr auto; gap: clamp(10px, 2vh, 14px);
}
.lobby-rotulo { color: var(--lb-muted); font: 600 11px Barlow, sans-serif; letter-spacing: .22em; text-transform: uppercase; }

/* Topo: a sala */
.lobby-topo { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; }
.lobby-sala { display: grid; }
.lobby-codigo { font: 700 34px/1 "Barlow Condensed", sans-serif; letter-spacing: .12em; user-select: all; }
.lobby-chip { padding: 4px 10px; border: 1px solid var(--lb-linha-forte); border-radius: 999px; color: var(--lb-muted); font-size: 12px; }
.lobby-espaco { flex: 1; }
.lobby-btn {
  position: relative; isolation: isolate; display: inline-flex; align-items: center; height: 34px; padding: 0 18px;
  border: 0; background: none; color: var(--lb-ink); cursor: pointer; font: 700 12px Barlow, sans-serif; letter-spacing: .16em; text-transform: uppercase;
}
.lobby-btn::before { content: ""; position: absolute; inset: 0; z-index: -1; transform: skewX(-12deg); border: 1px solid var(--lb-linha-forte); border-radius: 2px; background: #ffffff0d; transition: background .15s, border-color .15s; }
.lobby-btn:hover::before { background: #ffffff1c; border-color: #ffffff55; }
.lobby-btn[hidden] { display: none; }
#lobbyEncerrar { color: #ffb4a8; }
#lobbyEncerrar::before { border-color: #ff7b6b66; background: #ff7b6b14; }

/* Meio: palco + partida */
.lobby-meio { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; min-height: 0; }
.lobby-palco {
  position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; padding: 10px 10px 0; border-radius: 6px;
  background: linear-gradient(180deg, #ffffff05, transparent 60%), radial-gradient(ellipse at 50% 100%, #ee8f3d1c, transparent 60%);
}
.lobby-palco::after { content: ""; position: absolute; left: 4%; right: 4%; bottom: calc(var(--lb-placa) + 12px); height: 2px; background: linear-gradient(90deg, transparent, #ee8f3d55, transparent); pointer-events: none; }
/* Cada vaga: a plaquinha de estado em cima, o boneco no meio (ocupando a altura
   que sobrar) e a placa do nome embaixo, com a mesma altura em todas. */
.lobby-vaga { position: relative; display: grid; grid-template-rows: minmax(0, 1fr) auto; justify-items: center; min-width: 0; padding: 44px 0 12px; }
.lobby-figura { position: relative; width: 100%; height: 100%; min-height: 120px; }
.lobby-luz { position: absolute; left: 50%; bottom: -6px; width: min(150px, 90%); height: 36px; border-radius: 50%; transform: translateX(-50%); background: radial-gradient(ellipse, var(--cor) 0%, transparent 70%); opacity: .35; filter: blur(2px); }
/* O retrato (520 × 640) tem o boneco em 62% da altura, com 22% vazio em cima e
   17% embaixo: ampliado 162% e descido 17% da própria altura, o boneco enche a
   área e pisa na placa. Tela grande: no máximo 440 px de retrato (o boneco com
   uns 270). Coluna estreita: a largura manda e ele encolhe, sempre de pé. */
.lobby-boneco { position: absolute; left: 50%; bottom: calc(min(162%, 440px) * -.166); height: min(162%, 440px); width: auto; max-width: 208%; transform: translateX(-50%); object-fit: contain; object-position: 50% 100%; pointer-events: none; user-select: none; }
.lobby-placa {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 7px; width: min(190px, 100%); height: var(--lb-placa); padding: 0 12px;
  background: var(--lb-vidro); border: 1px solid var(--lb-linha-forte); border-top: 3px solid var(--cor); border-radius: 4px; color: inherit;
}
.lobby-placa b { overflow: hidden; font: 700 19px "Barlow Condensed", sans-serif; letter-spacing: .04em; text-overflow: ellipsis; white-space: nowrap; }
.lobby-vaga.eu .lobby-placa { box-shadow: 0 0 0 1px #ffb00055, 0 0 16px #ffb00026; }
/* O meu boneco gira com o dedo ou o mouse (os outros veem): ali a tela não rola. */
.lobby-palco .lobby-vaga.eu .lobby-figura { touch-action: none; cursor: grab; }
.lobby-palco .lobby-vaga.eu .lobby-figura:active { cursor: grabbing; }
.lobby-coroa { color: var(--lb-amber); font-size: 15px; }
.lobby-aparelho { flex: none; display: grid; color: var(--lb-muted); }
.lobby-aparelho svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
/* Opções de outro jogador (silenciar, denunciar, remover): o ⋯ no canto da placa. */
.lobby-opcoes {
  position: absolute; top: -12px; right: -8px; width: 24px; height: 24px; display: grid; place-items: center; padding: 0 0 4px;
  border: 1px solid var(--lb-linha-forte); border-radius: 50%; background: #1a2029; color: var(--lb-ink); cursor: pointer; font: 700 15px/1 Barlow, sans-serif;
}
.lobby-opcoes:hover { border-color: var(--lb-amber); color: var(--lb-amber); }
.lobby-mudo { font-size: 12px; }
.lobby-vaga.silenciado .lobby-placa b { opacity: .6; }
.lobby-estado { position: absolute; top: 10px; padding: 5px 12px; border-radius: 3px; background: #ffffff0a; border: 1px solid var(--lb-linha-forte); color: var(--lb-muted);
  font: 700 13px "Barlow Condensed", sans-serif; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; }
.lobby-estado.pronto { background: #4ade801f; color: var(--lb-pronto); border-color: #4ade8066; }
.lobby-estado.pronto::before { content: "✓ "; }
.lobby-estado.livre { background: #ffb00014; color: #ffcc4d; border-color: #ffb00055; }
/* Vaga livre: a silhueta de um personagem ainda sem dono e o convite. */
.lobby-vaga.livre { --cor: #ffb000; }
.lobby-vaga.livre .lobby-boneco { filter: brightness(0) drop-shadow(0 0 1px #ffb00088) drop-shadow(0 0 14px #ffb00033); opacity: .6; }
.lobby-vaga.livre .lobby-luz { opacity: .5; }
.lobby-mais {
  position: absolute; left: 50%; top: 45%; translate: -50% -50%; width: 50px; height: 50px; display: grid; place-items: center; padding: 0 0 3px;
  border: 0; border-radius: 50%; cursor: pointer; background: linear-gradient(135deg, #ffdc4d 0%, #ffb000 45%, #ff7400 100%); color: #1a0f00; font: 700 30px/1 Barlow, sans-serif;
  box-shadow: inset 0 1px 0 #ffffff90, inset 0 -3px 0 #00000026, 0 0 0 5px #ffb00022, 0 0 0 10px #ffb0000f, 0 5px 20px #ff7a0066;
  transition: transform .15s, box-shadow .15s;
}
.lobby-mais:hover { transform: scale(1.06); box-shadow: inset 0 1px 0 #ffffffb0, inset 0 -3px 0 #00000026, 0 0 0 6px #ffb0002e, 0 0 0 12px #ffb00014, 0 5px 24px #ff7a0088; }
.lobby-vaga.livre .lobby-placa { flex-direction: column; gap: 1px; cursor: pointer; }
.lobby-vaga.livre .lobby-placa b { color: #ffcc4d; text-transform: uppercase; }
.lobby-vaga.livre .lobby-placa small { color: var(--lb-muted); font-size: 12px; }
.lobby-vaga.livre .lobby-placa:hover { border-color: #ffb00088; }
/* Com a partida rolando ninguém entra: a vaga fica só como silhueta. */
.lobby.em-partida .lobby-mais, .lobby.em-partida .lobby-vaga.livre .lobby-placa { visibility: hidden; }
.lobby-estado.jogando { background: #6fd8ff14; color: #8fe2ff; border-color: #6fd8ff55; }

.lobby-partida { display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--lb-vidro); border: 1px solid var(--lb-linha); border-radius: 6px; }
/* Ao lado do palco, o painel não dita a altura da linha: quem dita é o palco,
   e o painel rola por dentro quando precisa. Assim trocar Corrida ↔ Rodada (o
   campo do tempo aparece e some) não mexe no tamanho dos personagens, e o
   lobby cabe em tela de notebook. Em coluna única (celular em pé) volta ao normal. */
.lobby-meio > .lobby-partida { contain: size; overflow-y: auto; overscroll-behavior: contain; }
.lobby-meio > .lobby-partida > * { flex-shrink: 0; }
/* Sem a barra do navegador: o painel foi feito para caber (abaixo) e, se uma
   tela muito baixa ainda pedir, rola com a roda ou o dedo, sem trilho cinza. */
.lobby-partida { scrollbar-width: none; }
.lobby-partida::-webkit-scrollbar { display: none; }
.lobby-partida h2 { margin: 0; display: flex; align-items: center; gap: 8px; font: 700 20px "Barlow Condensed", sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.lobby-partida h2 small { margin-left: auto; color: var(--lb-amber); font: 600 11px Barlow, sans-serif; letter-spacing: .06em; text-transform: none; }
.lobby-mapa { position: relative; display: block; width: 100%; padding: 0; overflow: hidden; border: 1px solid var(--lb-linha-forte); border-radius: 4px; background: #000; color: inherit; cursor: pointer; text-align: left; }
.lobby-mapa:disabled { cursor: default; }
.lobby-mapa:not(:disabled):hover { border-color: #ffb00088; }
.lobby-mapa img { display: block; width: 100%; height: clamp(80px, 16vh, 118px); object-fit: cover; }
.lobby-mapa > span { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: end; gap: 8px; padding: 18px 10px 7px; background: linear-gradient(transparent, #000c); }
.lobby-mapa b { font: 700 20px "Barlow Condensed", sans-serif; }
.lobby-mapa em { font-style: normal; color: #ffcf6b; font-size: 12px; text-align: right; }
.lobby-campo { display: grid; gap: 5px; }
.lobby-campo[hidden] { display: none; }
.lobby-campo > .lobby-rotulo { font-size: 10px; }
.lobby-seg { display: flex; border: 1px solid var(--lb-linha-forte); border-radius: 4px; overflow: hidden; }
.lobby-seg button { flex: 1; padding: 7px 6px; border: 0; background: none; color: var(--lb-muted); cursor: pointer; font-size: 13px; }
.lobby-seg button + button { border-left: 1px solid var(--lb-linha); }
.lobby-seg button:not(:disabled):hover { color: var(--lb-ink); background: #ffffff0a; }
.lobby-seg button:disabled { cursor: default; }
.lobby-seg button[aria-pressed="true"] { background: #ffb0001f; color: var(--lb-amber); font-weight: 700; box-shadow: inset 0 0 0 1px #ffb00073; }
.lobby-chave { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; cursor: pointer; }
/* O Bhop automático um pouco afastado das escolhas de cima. */
.lobby-partida .lobby-chave { margin-top: 10px; }
@media (max-height: 560px) { .lobby-partida .lobby-chave { margin-top: 2px; } }
.lobby-chave input { position: absolute; opacity: 0; pointer-events: none; }
.lobby-chave i { position: relative; flex: none; width: 38px; height: 20px; border-radius: 999px; background: #ffffff26; transition: background .15s; }
.lobby-chave i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--lb-ink); transition: left .15s, background .15s; }
.lobby-chave input:checked + i { background: var(--lb-amber); }
.lobby-chave input:checked + i::after { left: 21px; background: #150f00; }
.lobby-chave input:disabled + i { opacity: .7; }
.lobby-chave:has(input:disabled) { cursor: default; }
.lobby-chave input:focus-visible + i { box-shadow: 0 0 0 2px #07080b, 0 0 0 4px #ffd84a; }
/* Notebook (telas de 560 a 760 de altura): o painel da Partida mais justo,
   para caber inteiro ao lado do palco. */
@media (min-height: 561px) and (max-height: 760px) {
  .lobby-partida { gap: 7px; padding: 12px 14px; }
  .lobby-partida h2 { font-size: 17px; }
  .lobby-mapa img { height: clamp(64px, 12vh, 92px); }
  .lobby-mapa b { font-size: 17px; }
  .lobby-campo { gap: 3px; }
  .lobby-seg button { padding: 5px 6px; font-size: 12px; line-height: 1.15; }
  .lobby-chave { font-size: 13px; }
}

/* Base: chat, personagem, pronto */
.lobby-base { display: grid; grid-template-columns: minmax(240px, 330px) minmax(0, 1fr) auto; gap: 18px; align-items: end; }
.lobby-chat { height: 150px; display: grid; grid-template-rows: minmax(0, 1fr) auto; background: var(--lb-vidro); border: 1px solid var(--lb-linha); border-radius: 6px; overflow: hidden; }
.lobby-chat ol { margin: 0; padding: 10px 12px; list-style: none; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; font-size: 13px; overflow-wrap: anywhere; }
.lobby-chat li:first-child { margin-top: auto; }
.lobby-chat li b { font-weight: 700; margin-right: 5px; }
.lobby-chat li.sistema { color: var(--lb-muted); font-style: italic; }
.lobby-chat input { border: 0; border-top: 1px solid var(--lb-linha); background: #0006; color: var(--lb-ink); padding: 9px 12px; font: 13px Barlow, sans-serif; outline: none; }
.lobby-chat input:focus { background: #000a; }
.lobby-escolha { display: grid; gap: 8px; min-width: 0; }
.lobby-cartas { display: flex; gap: 10px; overflow-x: auto; }
/* Cinco personagens na fileira: as cartas encolhem juntas para caber, em vez de a última ficar cortada. */
.lobby-carta {
  position: relative; flex: 0 1 auto; min-width: 0; width: 112px; height: 120px; padding: 0; overflow: hidden; border: 2px solid var(--lb-linha-forte); border-radius: 6px; cursor: pointer; color: var(--lb-ink);
  background: radial-gradient(ellipse at 50% 80%, color-mix(in srgb, var(--cor) 35%, transparent), #0b0f15 75%);
  transition: border-color .15s, transform .15s;
}
.lobby-carta:not(:disabled):hover { border-color: #ffffff66; transform: translateY(-2px); }
.lobby-carta:disabled { cursor: default; }
.lobby-carta img { position: absolute; left: 50%; top: -6px; width: 170px; height: 210px; transform: translateX(-50%); object-fit: cover; object-position: 50% 30%; pointer-events: none; }
.lobby-carta span { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 6px; overflow: hidden; background: #000b; font: 600 12px Barlow, sans-serif; text-overflow: ellipsis; white-space: nowrap; }
.lobby-carta.minha { border-color: var(--lb-amber); box-shadow: 0 0 0 2px #ffb00055, 0 0 18px #ffb00044; }
.lobby-carta.tomada img { filter: grayscale(1) brightness(.45); }
.lobby-carta.tomada span { color: var(--lb-muted); }
.lobby-pronto-area { display: grid; justify-items: end; gap: 8px; }
.lobby-aviso { max-width: 340px; color: var(--lb-muted); font-size: 13px; text-align: right; }
.lobby-pronto {
  position: relative; isolation: isolate; min-width: 230px; padding: 18px 46px; border: 0; background: none; color: #1a0f00; cursor: pointer;
  font: 700 22px "Barlow Condensed", sans-serif; letter-spacing: .22em; text-transform: uppercase;
}
.lobby-pronto::before {
  content: ""; position: absolute; inset: 0; z-index: -1; transform: skewX(-12deg); border-radius: 2px;
  background: linear-gradient(100deg, #ffdc4d 0%, #ffb000 42%, #ff7400 100%);
  box-shadow: inset 0 1px 0 #ffffff80, inset 0 -3px 0 #00000026, 0 4px 22px #ff7a0055; transition: filter .15s, box-shadow .15s;
}
.lobby-pronto:hover:not(:disabled)::before { filter: brightness(1.08) saturate(1.1); box-shadow: inset 0 1px 0 #ffffffa0, inset 0 -3px 0 #00000026, 0 0 30px #ff8a0088; }
.lobby-pronto:active:not(:disabled) { transform: translateY(1px); }
.lobby-pronto:focus-visible { outline: none; }
.lobby-pronto:focus-visible::before { box-shadow: 0 0 0 2px #07080b, 0 0 0 4px #ffd84a; }
/* Cancelar: o mesmo botão, em vermelho (o texto claro lê melhor no vermelho). */
.lobby-pronto.cancelar { color: #fff; text-shadow: 0 1px 2px #0005; }
.lobby-pronto.cancelar::before { background: linear-gradient(100deg, #ff6a55 0%, #e8262c 45%, #a5101e 100%); box-shadow: inset 0 1px 0 #ffffff70, inset 0 -3px 0 #00000033, 0 4px 22px #e8262c55; }
.lobby-pronto.cancelar:hover:not(:disabled)::before { filter: brightness(1.08) saturate(1.1); box-shadow: inset 0 1px 0 #ffffff90, inset 0 -3px 0 #00000033, 0 0 30px #ff3b3b88; }
.lobby-pronto.cancelar:focus-visible::before { box-shadow: 0 0 0 2px #07080b, 0 0 0 4px #ff6b6b; }
.lobby-pronto:disabled { color: #1a0f0099; cursor: default; }
.lobby-pronto:disabled::before { filter: grayscale(.8) brightness(.6); box-shadow: none; }

/* Estado na corrida: carregando, na largada/correndo (azul) e chegou (verde). */
.lobby-estado.carregando { color: var(--lb-muted); border-style: dashed; }
.lobby-estado.chegou { background: #4ade801f; color: var(--lb-pronto); border-color: #4ade8066; }

/* Resultado da corrida, por cima do lobby. */
.lobby-resultado { position: fixed; inset: 0; z-index: 2; display: grid; place-items: center; padding: 16px; background: #000c; }
.lobby-resultado[hidden] { display: none; }
.lobby-resultado-caixa {
  width: min(560px, 100%); max-height: 100%; overflow-y: auto; display: grid; gap: 14px; padding: 22px 24px;
  border: 1px solid var(--lb-linha-forte); border-top: 3px solid var(--lb-amber); border-radius: 6px; background: #10151c; box-shadow: 0 20px 60px #000a;
}
.lobby-resultado-caixa h3 { margin: 0; display: flex; align-items: baseline; gap: 10px; font: 700 26px "Barlow Condensed", sans-serif; letter-spacing: .1em; text-transform: uppercase; }
.lobby-resultado-botoes { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; justify-content: center; }
.lobby-resultado-caixa h3 small { color: var(--lb-muted); font: 600 14px Barlow, sans-serif; letter-spacing: .04em; text-transform: none; }
.lobby-resultado-lista { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.lobby-resultado-lista li {
  --cor: var(--lb-muted);
  display: grid; grid-template-columns: 30px 44px minmax(0, 1fr) auto 70px; align-items: center; gap: 10px; height: 52px; padding: 0 12px 0 8px; overflow: hidden;
  border: 1px solid var(--lb-linha); border-left: 3px solid var(--personagem); border-radius: 4px; background: #ffffff08;
}
.lobby-resultado-lista li.eu { background: #ffb00012; border-color: #ffb00055; border-left-color: var(--personagem); }
.lobby-resultado-lista li.fora { opacity: .6; }
.lobby-resultado-lista .lugar { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: var(--lb-muted); font: 800 14px Barlow, sans-serif; }
.lobby-resultado-lista li.podio .lugar { background: var(--cor); color: #120d02; box-shadow: 0 0 10px color-mix(in srgb, var(--cor) 60%, transparent); }
.lobby-resultado-lista li.ouro { --cor: #ffc53d; }
.lobby-resultado-lista li.prata { --cor: #c9d2dc; }
.lobby-resultado-lista li.bronze { --cor: #d08a4e; }
/* O rosto do personagem: o retrato ampliado e cortado, como nas cartas do lobby. */
.lobby-resultado-lista .rosto { position: relative; width: 44px; height: 52px; overflow: hidden; }
.lobby-resultado-lista .rosto img { position: absolute; left: 50%; top: -2px; width: 68px; height: 84px; transform: translateX(-50%); object-fit: cover; object-position: 50% 30%; }
.lobby-resultado-lista b { overflow: hidden; font: 700 19px "Barlow Condensed", sans-serif; text-overflow: ellipsis; white-space: nowrap; }
.lobby-resultado-lista .tempo { font: 600 16px ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.lobby-resultado-lista li.podio .tempo { color: var(--cor); }
.lobby-resultado-lista li.fora .tempo { font: italic 13px Barlow, sans-serif; color: var(--lb-muted); }
.lobby-resultado-lista .diferenca { color: #ff9d90; font: 12px ui-monospace, monospace; text-align: right; }
.lobby-resultado-caixa .bv-loja { justify-self: center; height: 38px; padding-inline: 30px; font-size: 12px; }
/* Tela estreita: o nome precisa do espaço; a diferença para o primeiro sai. */
@media (max-width: 480px) {
  .lobby-resultado-caixa { padding: 16px 14px; }
  .lobby-resultado-lista li { grid-template-columns: 26px 36px minmax(0, 1fr) auto; gap: 8px; padding-right: 10px; }
  .lobby-resultado-lista .rosto { width: 36px; }
  .lobby-resultado-lista .diferenca { display: none; }
  .lobby-resultado-lista .tempo { font-size: 14px; }
}

/* Escolha do mapa (só o líder) */
.lobby-mapas { position: fixed; inset: 0; z-index: 1; display: grid; place-items: center; padding: 16px; background: #000b; }
.lobby-mapas[hidden] { display: none; }
.lobby-mapas-caixa { position: relative; width: min(900px, 100%); max-height: 100%; overflow-y: auto; padding: 18px; border: 1px solid var(--lb-linha-forte); border-radius: 6px; background: #10151c; }
.lobby-mapas-caixa h3 { margin: 0 0 14px; font: 700 22px "Barlow Condensed", sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.lobby-fechar { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border: 1px solid var(--lb-linha-forte); border-radius: 50%; background: none; color: var(--lb-ink); cursor: pointer; font-size: 20px; line-height: 1; }
.lobby-fechar:hover { border-color: #ffffff66; }
.lobby-mapas-grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.lobby-mapa-op { position: relative; padding: 0; overflow: hidden; border: 2px solid var(--lb-linha-forte); border-radius: 5px; background: #000; color: inherit; cursor: pointer; text-align: left; }
.lobby-mapa-op:hover { border-color: #ffffff66; }
.lobby-mapa-op.atual { border-color: var(--lb-amber); box-shadow: 0 0 16px #ffb00044; }
.lobby-mapa-op img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.lobby-mapa-op span { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: end; padding: 16px 8px 6px; background: linear-gradient(transparent, #000d); }
.lobby-mapa-op b { font: 700 17px "Barlow Condensed", sans-serif; }
.lobby-mapa-op em { font-style: normal; color: #ffcf6b; font-size: 11px; }

/* Telas menores: o palco encolhe antes de tudo. */
@media (max-width: 1100px) {
  .lobby-meio { grid-template-columns: minmax(0, 1fr) 260px; }
  .lobby-base { grid-template-columns: minmax(220px, 280px) minmax(0, 1fr) auto; }
  .lobby-carta { width: 92px; height: 104px; }
  .lobby-pronto { min-width: 190px; padding: 16px 32px; font-size: 20px; }
}
/* Celular deitado (e janelas baixas): tudo mais compacto, para o Pronto
   caber na tela sem rolar. */
@media (max-height: 560px) {
  .lobby { --lb-placa: 32px; }
  /* A tela inteira na altura do aparelho: a Partida rola por dentro, e o
     Pronto e as cartas nunca saem da tela. */
  .lobby-tela { gap: 6px; padding-block: 6px; height: 100%; min-height: 0; }
  .lobby-meio, .lobby-palco { min-height: 0; }
  .lobby-partida { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  /* Rola em vez de espremer: o mapa não pode virar uma faixa fina. */
  .lobby-partida > * { flex-shrink: 0; }
  .lobby-topo { gap: 6px 10px; }
  .lobby-rotulo { font-size: 9px; }
  .lobby-codigo { font-size: 22px; }
  .lobby-topo .bv-loja { height: 26px; }
  .lobby-btn { height: 26px; padding: 0 12px; font-size: 10px; }
  .lobby-meio { gap: 10px; }
  .lobby-palco { gap: 8px; padding-top: 4px; }
  .lobby-vaga { padding-top: 24px; padding-bottom: 4px; }
  .lobby-figura { min-height: 60px; }
  .lobby-estado { top: 2px; padding: 2px 8px; font-size: 10px; }
  .lobby-placa { padding: 0 8px; border-top-width: 2px; }
  .lobby-aparelho svg { width: 14px; height: 14px; }
  .lobby-placa b { font-size: 14px; }
  .lobby-vaga.livre .lobby-placa small { font-size: 10px; }
  .lobby-mais { width: 34px; height: 34px; font-size: 21px; box-shadow: inset 0 1px 0 #ffffff90, 0 0 0 4px #ffb00022, 0 3px 14px #ff7a0066; }
  .lobby-luz { height: 24px; }
  .lobby-palco::after { bottom: calc(var(--lb-placa) + 4px); }
  .lobby-partida { gap: 3px; padding: 8px 10px; }
  .lobby-partida h2 { font-size: 14px; }
  /* O mapa com altura de mapa, não de faixa. */
  .lobby-mapa img { height: clamp(44px, 14.5vh, 90px); }
  .lobby-mapa > span { padding: 4px 8px; }
  .lobby-mapa b { font-size: 14px; }
  .lobby-mapa em { font-size: 10px; }
  .lobby-campo { gap: 2px; }
  .lobby-campo > .lobby-rotulo { font-size: 8px; }
  .lobby-seg button { padding: 3px 4px; font-size: 11px; }
  .lobby-chave { font-size: 12px; }
  .lobby-base { grid-template-columns: minmax(170px, 250px) minmax(0, 1fr) auto; gap: 10px; }
  .lobby-chat { height: 78px; }
  .lobby-chat ol { padding: 4px 8px; font-size: 11px; gap: 2px; }
  .lobby-chat input { padding: 5px 8px; font-size: 11px; }
  .lobby-escolha { gap: 3px; }
  .lobby-cartas { gap: 6px; }
  .lobby-carta { width: 58px; height: 64px; }
  /* O boneco sobe na carta: o nome embaixo cobria o rosto. */
  .lobby-carta img { top: -11px; width: 96px; height: 120px; }
  .lobby-carta span { padding: 2px 3px; font-size: 9px; }
  .lobby-pronto-area { gap: 4px; }
  /* As dicas de sempre saem; fica só o que importa (contagem, partida). */
  .lobby-aviso { font-size: 11px; }
  .lobby-aviso:not(.importante) { display: none; }
  .lobby-pronto { min-width: 130px; padding: 10px 20px; font-size: 16px; }
}
/* Celular em pé e telas estreitas: uma coluna, rolando. Deitado, o celular
   fica no layout de cima, compacto. */
@media (max-width: 760px) and (orientation: portrait), (max-width: 520px) {
  .lobby-figura { min-height: clamp(120px, 26vh, 190px); }
  .lobby-meio, .lobby-base { grid-template-columns: 1fr; }
  .lobby-meio > .lobby-partida { contain: none; overflow-y: visible; }
  .lobby-palco { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lobby-palco::after { display: none; }
  .lobby-pronto-area { justify-items: stretch; }
  .lobby-aviso { max-width: none; text-align: center; }
  .lobby-pronto { width: 100%; }
}
/* Celular em pé: o lobby pede para deitar, como a partida (src/online.js monta). */
.lobby-girar { display: none; }
@media (orientation: portrait) and (any-pointer: coarse) {
  .lobby-girar {
    position: fixed; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    padding: 32px; text-align: center; background: #0b1015f7; color: var(--lb-ink); font: 16px Barlow, system-ui, sans-serif;
  }
  .lobby-girar .girar-arte { width: 96px; height: 96px; margin-bottom: 12px; color: #ee8f3d; }
  .lobby-girar .girar-celular { fill: currentColor; transform-box: view-box; transform-origin: 32px 33px; animation: girar-celular 2.8s ease-in-out infinite; }
  .lobby-girar .girar-seta { fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
  .lobby-girar strong { font: 700 30px "Barlow Condensed", system-ui, sans-serif; }
  .lobby-girar p { max-width: 30ch; margin: 0; line-height: 1.5; color: #b5c2cc; }
}
@media (prefers-reduced-motion: reduce) { .lobby-mais, .lobby-carta { transition: none; } .lobby-girar .girar-celular { animation: none; transform: rotate(-90deg); } }

/* ---------- HUD da corrida (src/corrida-online.js) ---------- */
#corrida[hidden] { display: none; }
#corridaAviso {
  position: absolute; top: 30%; left: 50%; transform: translate(-50%, -50%); max-width: 90%; text-align: center;
  color: #fff; font: 700 30px/1.1 "Barlow Condensed", "Arial Narrow", sans-serif; letter-spacing: .06em; text-transform: uppercase;
  text-shadow: 0 2px 14px #000, 0 0 2px #000;
}
#corridaAviso.numero { color: var(--amber); font-size: 120px; letter-spacing: 0; text-shadow: 0 4px 30px #000, 0 0 40px #ff7a0066; }
#corridaInfo { position: absolute; top: calc(var(--s5) + 78px); left: 50%; transform: translateX(-50%); color: var(--amber); font: 600 13px Barlow, sans-serif; letter-spacing: .06em; text-shadow: 0 1px 6px #000; }
#corridaNomes { position: absolute; inset: 0; overflow: hidden; }
#corridaNomes span {
  position: absolute; left: 0; top: 0; padding: 2px 8px; border-radius: 3px; border-bottom: 2px solid var(--cor);
  background: #07080bb3; color: #f0f1f4; font: 700 13px "Barlow Condensed", sans-serif; letter-spacing: .04em; white-space: nowrap; will-change: transform;
}
#corridaNomes span[hidden] { display: none; }
@media (max-height: 500px) {
  #corridaAviso { font-size: 22px; }
  #corridaAviso.numero { font-size: 80px; }
}

/* ---------- Amigos (src/amigos.js) ---------- */
.amigos { margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--line); display: grid; gap: var(--s2); }
.amigos-topo { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.amigos-topo h3 { margin: 0; font: 700 20px "Barlow Condensed", sans-serif; letter-spacing: .06em; text-transform: uppercase; }
.amigos-offline { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; cursor: pointer; }
.amigos-offline input { position: absolute; opacity: 0; pointer-events: none; }
.amigos-offline i { position: relative; width: 34px; height: 18px; border-radius: 999px; background: #ffffff26; transition: background .15s; }
.amigos-offline i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--ink); transition: left .15s; }
.amigos-offline input:checked + i { background: #8c9099; }
.amigos-offline input:checked + i::after { left: 19px; }
.amigos-offline input:focus-visible + i { box-shadow: 0 0 0 2px #07080b, 0 0 0 4px #ffd84a; }
/* "Você está aparecendo offline": o aviso enquanto a opção está ligada. */
.amigos-invisivel { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 0; padding: 8px 12px; border-radius: 4px; background: #ffb0001f; box-shadow: inset 0 0 0 1px #ffb00066; color: #ffd27a; font-size: 13px; }
.amigos-invisivel[hidden] { display: none; }
/* "Jogaram com você": os últimos com quem a pessoa correu, para virar amigos. */
.amigos-recentes-titulo { margin: 10px 0 2px; color: var(--muted); font: 700 12px "Barlow Condensed", sans-serif; letter-spacing: .12em; text-transform: uppercase; }
.amigos-recentes-titulo[hidden] { display: none; }
/* O botão do líder na tela da sala. */
.lobby-pronto.iniciar { filter: saturate(1.15); }
.amigos-invisivel button { flex: none; padding: 6px 12px; border: 0; border-radius: 3px; background: #4ade80; color: #06210f; font: 700 13px "Barlow Condensed", sans-serif; letter-spacing: .05em; text-transform: uppercase; cursor: pointer; }
.amigos-adicionar { display: flex; gap: var(--s2); max-width: 420px; }
.amigos-adicionar input { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 3px; background: #090b0fdd; color: var(--ink); font: 600 14px Barlow, "Segoe UI", sans-serif; outline: none; }
.amigos-adicionar input:focus { border-color: #4ade80; }
.amigos-estado, .amigos-aviso-apelido { margin: 0; font-size: 13px; }
.amigos-estado { color: #4ade80; }
.amigos-estado.erro { color: #ff7b6b; }
.amigos-aviso-apelido { color: var(--amber); }
.amigos-estado:empty, .amigos-aviso-apelido:empty { display: none; }
.amigos-vazio { margin: 0; color: var(--muted); font-size: 13px; }
.amigos-vazio[hidden] { display: none; }
.amigos-lista { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.amigos-lista:empty { display: none; }
.amigos-lista li { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 4px 8px 4px 12px; border: 1px solid var(--line); border-radius: 4px; background: #0b0f15b8; }
.amigos-lista li b { overflow: hidden; font: 700 16px "Barlow Condensed", sans-serif; letter-spacing: .03em; text-overflow: ellipsis; white-space: nowrap; }
.amigos-lista li small { color: var(--muted); font-size: 12px; }
.amigo-ponto { flex: none; width: 9px; height: 9px; border-radius: 50%; background: #4a4f57; }
/* Online: nome e ponto em verde. */
.amigos-lista li.online b { color: #4ade80; }
.amigos-lista li.online .amigo-ponto { background: #4ade80; box-shadow: 0 0 8px #4ade80aa; }
.amigos-lista li.pedido { border-color: #ffb00055; }
.amigos-lista li.pedido .amigo-ponto { background: var(--amber); }
.amigos-lista li.pedido b { font: 600 14px Barlow, sans-serif; }
.amigo-acoes { display: flex; gap: 6px; margin-left: auto; }
.amigo-acoes button.remover { width: 28px; padding: 0; color: var(--muted); font-size: 17px; line-height: 1; }
.amigo-acoes button.remover:hover { border-color: #ff7b6b; color: #ff7b6b; }
/* Pedido esperando resposta: bolinha no botão Online do menu. */
.menu #openOnline { position: relative; }
#openOnline[data-pedidos]:not([data-pedidos=""])::after {
  content: attr(data-pedidos); position: absolute; top: -6px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
  display: grid; place-items: center; background: #ff4d4d; color: #fff; font: 700 12px Barlow, sans-serif; box-shadow: 0 0 0 2px #07080b;
}

/* No lobby: o botão Amigos (com quantos estão online) e a lista para chamar. */
#lobbyAmigos b { margin-left: 8px; color: #4ade80; }
#lobbyAmigos b:empty { display: none; }
.lobby-amigos {
  position: absolute; top: 64px; left: clamp(14px, 2.2vw, 28px); z-index: 1; width: min(340px, calc(100% - 28px)); max-height: calc(100% - 80px); overflow-y: auto;
  display: grid; gap: 8px; padding: 14px; border: 1px solid var(--lb-linha-forte); border-top: 3px solid #4ade80; border-radius: 6px; background: #10151cf5; box-shadow: 0 16px 40px #000a;
}
.lobby-amigos[hidden] { display: none; }
.lobby-amigos h3 { margin: 0; font: 700 18px "Barlow Condensed", sans-serif; letter-spacing: .08em; text-transform: uppercase; }
@media (max-height: 560px) {
  .lobby-amigos { top: 40px; width: min(280px, calc(100% - 28px)); max-height: calc(100% - 50px); gap: 6px; padding: 8px 10px; }
  .lobby-amigos h3 { font-size: 14px; }
  .lobby-amigos .amigos-lista li { min-height: 30px; padding: 2px 6px 2px 10px; }
  .lobby-amigos .amigos-lista li b { font-size: 14px; }
  .lobby-amigos .amigo-acoes button { padding: 3px 10px; font-size: 11px; }
}

/* Avisos: alguém ficou online, pedido novo, convite para a sala. */
.avisos-amigos { position: fixed; top: 26%; right: 16px; z-index: 35; display: grid; gap: 8px; width: min(320px, calc(100vw - 32px)); pointer-events: none; }
.aviso-amigo {
  pointer-events: auto; display: grid; gap: 8px; padding: 10px 14px; border: 1px solid var(--line-strong); border-left: 3px solid var(--amber); border-radius: 5px;
  background: #10151cf2; color: var(--ink); box-shadow: 0 10px 30px #000a; font: 600 14px Barlow, "Segoe UI", sans-serif;
  animation: aviso-amigo-entra .25s ease-out;
}
.aviso-amigo p { margin: 0; line-height: 1.35; }
.aviso-amigo.online { border-left-color: #4ade80; }
.aviso-amigo.online p::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 8px #4ade80; vertical-align: 1px; }
.aviso-amigo.convite { border-left-color: #4ade80; background: #0f1a14f2; }
.aviso-amigo-acoes { display: flex; gap: 8px; }
.aviso-amigo-acoes button { padding: 6px 14px; border: 1px solid var(--line-strong); border-radius: 3px; background: none; color: var(--ink); cursor: pointer; font: 700 12px Barlow, sans-serif; letter-spacing: .06em; }
.aviso-amigo-acoes button.principal { border-color: #4ade80; background: #4ade80; color: #06210f; }
.aviso-amigo.saindo { opacity: 0; transform: translateX(20px); transition: opacity .25s, transform .25s; }
@keyframes aviso-amigo-entra { from { opacity: 0; transform: translateX(24px); } }
@media (prefers-reduced-motion: reduce) { .aviso-amigo { animation: none; } .aviso-amigo.saindo { transition: none; } }
/* Avisos no celular deitado: menores, no alto, sem cobrir o Pronto. */
@media (max-height: 560px) {
  .avisos-amigos { top: 8px; width: min(250px, calc(100vw - 32px)); gap: 6px; }
  .aviso-amigo { gap: 6px; padding: 7px 10px; font-size: 12px; }
  .aviso-amigo-acoes button { padding: 4px 10px; font-size: 11px; }
}

/* ---------- Salas públicas (fase 4) ---------- */
.online-publicas { display: grid; gap: var(--s2); margin-bottom: var(--s3); }
.online-jogar-agora {
  display: grid; justify-items: start; gap: 1px; justify-self: start; align-self: flex-start; width: min(100%, 360px); padding: 9px 16px; border: 0; border-radius: 5px; cursor: pointer; text-align: left;
  background: linear-gradient(100deg, #2fd46a 0%, #1fa855 55%, #137a3c 100%); color: #03160a;
  box-shadow: inset 0 1px 0 #ffffff66, inset 0 -3px 0 #00000026, 0 6px 22px #1fa85544; transition: filter .15s, transform .15s;
}
.online-jogar-agora:hover { filter: brightness(1.08); transform: translateY(-1px); }
.online-jogar-agora b { font: 700 19px "Barlow Condensed", sans-serif; letter-spacing: .1em; text-transform: uppercase; }
.online-jogar-agora small { font: 600 12px Barlow, sans-serif; opacity: .8; }
.online-lista-topo { display: flex; align-items: center; justify-content: space-between; margin-top: var(--s2); }
.online-lista-topo h3 { margin: 0; font: 700 18px "Barlow Condensed", sans-serif; letter-spacing: .06em; text-transform: uppercase; }
.online-atualizar { width: 32px; height: 32px; border: 1px solid var(--line-strong); border-radius: 50%; background: none; color: var(--ink); cursor: pointer; font-size: 17px; }
.online-atualizar:hover { border-color: #ffffff66; }
.online-salas { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; max-height: 260px; overflow-y: auto; }
.online-salas li { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 5px 8px 5px 5px; border: 1px solid var(--line); border-radius: 4px; background: #0b0f15b8; }
.online-salas img { width: 64px; height: 36px; object-fit: cover; border-radius: 3px; }
.online-sala-dados { display: grid; min-width: 0; }
.online-sala-dados b { overflow: hidden; font: 700 16px "Barlow Condensed", sans-serif; text-overflow: ellipsis; white-space: nowrap; }
.online-sala-dados small { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.online-sala-gente { color: var(--ink); font: 600 13px ui-monospace, monospace; }
.online-salas button { padding: 6px 14px; border: 1px solid #4ade80; border-radius: 3px; background: #4ade801f; color: #4ade80; cursor: pointer; font: 700 12px Barlow, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.online-salas button:hover:not(:disabled) { background: #4ade80; color: #06210f; }
.online-salas button:disabled { border-color: var(--line-strong); background: none; color: var(--muted); cursor: default; }
.online-salas-vazio { margin: 0; color: var(--muted); font-size: 13px; }
.online-salas-vazio[hidden] { display: none; }

/* Opções de um jogador (silenciar, denunciar, remover), por cima do lobby. */
.lobby-jogador { position: fixed; inset: 0; z-index: 2; display: grid; place-items: center; padding: 16px; background: #000a; }
.lobby-jogador[hidden] { display: none; }
.lobby-jogador-caixa { position: relative; width: min(360px, 100%); display: grid; gap: 12px; padding: 18px; border: 1px solid var(--lb-linha-forte); border-radius: 6px; background: #10151c; box-shadow: 0 16px 50px #000a; }
.lobby-jogador-caixa h3 { margin: 0 36px 0 0; font: 700 20px "Barlow Condensed", sans-serif; letter-spacing: .04em; }
.lobby-jogador-acoes { display: grid; gap: 8px; }
.lobby-jogador-acoes button { padding: 10px 14px; border: 1px solid var(--lb-linha-forte); border-radius: 4px; background: #ffffff08; color: var(--lb-ink); cursor: pointer; text-align: left; font: 600 14px Barlow, sans-serif; }
.lobby-jogador-acoes button:hover { border-color: #ffffff66; }
.lobby-jogador-acoes button.perigo { color: #ff9d90; border-color: #ff7b6b55; }
.lobby-jogador-acoes button.perigo:hover { background: #ff7b6b1f; }
@media (max-height: 560px) {
  .lobby-jogador-caixa { gap: 8px; padding: 12px; }
  .lobby-jogador-acoes button { padding: 7px 12px; font-size: 13px; }
}

/* ---------- Conexão caída (fase 5) ---------- */
.lobby-religando { display: none; }
.lobby.religando .lobby-religando {
  position: fixed; top: 10px; left: 50%; z-index: 3; display: block; padding: 8px 16px; transform: translateX(-50%);
  border: 1px solid #ffb00088; border-radius: 999px; background: #1c1608f2; color: #ffcc4d; font: 700 13px Barlow, sans-serif; letter-spacing: .04em;
  animation: religando 1.2s ease-in-out infinite alternate;
}
@keyframes religando { from { opacity: .65; } to { opacity: 1; } }
.lobby.religando .lobby-pronto { pointer-events: none; filter: grayscale(.6); }
.lobby-vaga.ausente .lobby-figura { opacity: .45; filter: grayscale(.6); }
@media (prefers-reduced-motion: reduce) { .lobby.religando .lobby-religando { animation: none; } }

/* ---------- Palco animado (src/palco-3d.js) ---------- */
/* A tela 3D fica entre a luz do chão e as placas; onde o boneco 3D já está de
   pé, o retrato parado some. */
/* O boneco fica na frente da moldura (z-index 1): a mão que acena e a faca passam por
   cima da borda dela, em vez de sumir atrás. As placas e os chips, por cima de tudo. */
.lobby-palco-3d { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none; }
.lobby-placa, .lobby-estado, .lobby-mais { z-index: 3; }
/* Essas camadas valem só dentro do palco: sem isto, o (+), as placas e os chips
   passavam por cima do seletor de mapa e das outras janelas do lobby. */
.lobby-palco { isolation: isolate; }
.lobby-vaga.com-3d .lobby-boneco { visibility: hidden; }

/* Moldura de perfil (src/molduras.js) em volta do personagem: a arte é 2:3,
   com o brasão em cima (atrás da etiqueta de estado) e a base embaixo (atrás da
   placa do nome). Estado e placa ficam por cima dela. */
/* A moldura fica inteira dentro da área do boneco: não passa da vaga nem cobre a
   etiqueta de estado, a placa do nome ou os botões. E sempre na proporção da
   arte (2:3), sem esticar: a imagem ocupa a área toda e a arte é desenhada
   na maior medida que cabe, centrada e apoiada embaixo. O boneco 3D encaixa na
   abertura da arte desenhada (palco-3d.js calcula onde ela fica). */
.lobby-figura > .lobby-moldura { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%; pointer-events: none; z-index: 1; filter: drop-shadow(0 4px 10px #000a); }
.lobby-vaga.com-moldura .lobby-estado, .lobby-vaga.com-moldura .lobby-placa, .lobby-vaga.com-moldura .lobby-mais { z-index: 4; }
.lobby-moldura.moldura-lendario { animation: moldura-brilho 3.2s ease-in-out infinite; }
@keyframes moldura-brilho { 50% { filter: drop-shadow(0 0 14px #ffb000aa) drop-shadow(0 4px 10px #000a); } }
@media (prefers-reduced-motion: reduce) { .lobby-moldura.moldura-lendario { animation: none; } }
/* A coluna da vaga não cresce para caber a placa: o texto corta com "…" (antes
   a placa passava da vaga e cobria a vizinha nos celulares menores). */
.lobby-vaga { grid-template-columns: minmax(0, 1fr); }
.lobby-placa { max-width: 100%; min-width: 0; }
.lobby-vaga.livre .lobby-placa b, .lobby-vaga.livre .lobby-placa small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Placas sem caixa, em todas as vagas: quem está na sala mostra só o apelido,
   a coroa do líder e o aparelho; a vaga livre, só o convite (segue clicável).
   A caixa ficava mais larga que a moldura. A sombra no texto o deixa legível
   sobre o palco. */
.lobby-vaga .lobby-placa, .lobby-vaga.eu .lobby-placa { width: auto; padding: 0 4px; background: none; border: 0; box-shadow: none; }
.lobby-vaga .lobby-placa b, .lobby-vaga .lobby-placa small { text-shadow: 0 2px 8px #000, 0 0 2px #000; }
.lobby-vaga.livre .lobby-placa:hover b { color: #ffe08a; }
.lobby-vaga.livre .lobby-placa:focus-visible { outline: 2px solid #ffb000; outline-offset: 2px; border-radius: 4px; }
.lobby-vaga:not(.livre) .lobby-opcoes { top: 50%; right: -26px; translate: 0 -50%; }
/* Vaga livre: a moldura de bronze escurecida, quase negra, em volta da
   silhueta — todas as vagas com o mesmo formato. */
.lobby-moldura.moldura-sombra { filter: sepia(.35) brightness(.34) contrast(1.35) drop-shadow(0 4px 10px #000a); opacity: .9; }
/* No painel Online: a sua moldura e quanto falta para a próxima. */
.minha-moldura { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; padding: 8px 12px; border: 1px solid #ffffff1a; border-radius: 6px; background: #ffffff08; }
.minha-moldura[hidden] { display: none; }
.minha-moldura img { flex: none; width: 40px; height: 60px; object-fit: contain; }
.minha-moldura img[hidden] { display: none; }
.minha-moldura b { display: block; font: 700 16px "Barlow Condensed", sans-serif; letter-spacing: .03em; }
.minha-moldura span { color: #a8b2bd; font-size: 13px; }
/* O retrato 2D (enquanto o 3D carrega, ou sem WebGL) também cabe na moldura:
   dentro da abertura, acima da base dela. */
.lobby-vaga.com-moldura .lobby-boneco { height: 70%; bottom: 17%; max-width: 80%; }

/* ---------- Painel Online: um padrão só ----------
   Cinco caixas iguais (Partida rápida, Salas públicas, Amigos, Criar sala,
   Entrar com código): mesmo fundo, borda, cantos e espaço; o mesmo título,
   subtítulo e rótulo de campo; campos e botões de 40 px (44 no toque) no
   formato do topo (botoes/bv-loja.css), cada um na cor da sua ação. As listas
   de salas e de amigos têm altura fixa e rolam por dentro: sala ou amigo novo
   não mexe no resto do painel. */
.online-grade { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px;
  grid-template-areas: "rapida amigos" "salas amigos" "criar entrar"; }
.online-card--rapida { grid-area: rapida; }
.online-card--salas { grid-area: salas; }
.online-card--amigos { grid-area: amigos; }
.online-card--criar { grid-area: criar; }
.online-card--entrar { grid-area: entrar; }
.online-grade > * { min-width: 0; }
.online-card { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 18px; border: 1px solid var(--line); border-radius: 6px; background: #0b0f15b8; }
.online-card h3 { margin: 0; font: 700 20px/1.1 "Barlow Condensed", sans-serif; letter-spacing: .06em; text-transform: uppercase; }
.online-dica { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.online-card-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; min-height: 32px; }
.online-campo { display: grid; gap: 6px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.online-card input[type="text"] { box-sizing: border-box; width: 100%; height: 40px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 3px;
  background: #090b0fdd; color: var(--ink); font: 600 14px Barlow, "Segoe UI", sans-serif; letter-spacing: normal; text-transform: none; outline: none; }
.online-card input[type="text"]:focus { border-color: var(--amber); }
.online-card--amigos input[type="text"]:focus { border-color: #4ade80; }
.online-linha { display: flex; gap: 10px; align-items: center; max-width: none; margin: 0; }
.online-linha input[type="text"] { flex: 1; min-width: 0; }
.online-codigo input[type="text"] { flex: 0 0 9ch; width: 9ch; font: 700 18px "Barlow Condensed", sans-serif; letter-spacing: .3em; text-transform: uppercase; text-align: center; }
.online-botao { flex: none; align-self: flex-start; height: 40px; padding: 0 calc(22px - .16em) 0 22px; font-size: 12px; letter-spacing: .16em; }
.online-linha .online-botao { align-self: auto; }
.online-botao--icone { width: 40px; height: 32px; padding: 0; }
.online-botao--icone svg { width: 16px; height: 16px; }
.touch-mode .online-card input[type="text"], .touch-mode .online-botao:not(.online-botao--icone) { height: 44px; min-height: 44px; }
.online-rolagem { display: grid; align-content: start; gap: 6px; height: 152px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #ffffff2e transparent; }
.online-rolagem > * { min-width: 0; }
.online-card--amigos .online-rolagem { flex: 1; height: auto; min-height: 120px; }
/* A caixa de Amigos ocupa as duas linhas da esquerda e não as estica: o que
   passa da altura rola por dentro. */
.online-card--amigos { contain: size; min-height: 100%; }
.online-salas { max-height: none; overflow: visible; }
/* Botões das listas (entrar numa sala, chamar, aceitar, recusar...): o mesmo
   formato, menor. */
.online-salas button, .amigo-acoes button {
  position: relative; isolation: isolate; flex: none; height: 30px; padding: 0 12px; border: 0; background: none; cursor: pointer;
  color: #4ade80; font: 700 11px "Segoe UI", system-ui, sans-serif; letter-spacing: .12em; text-transform: uppercase; }
.online-salas button::before, .amigo-acoes button::before {
  content: ""; position: absolute; inset: 0; z-index: -1; transform: skewX(-12deg); border-radius: 2px;
  background: #4ade801a; box-shadow: inset 0 0 0 1px #4ade80; transition: background .15s; }
.online-salas button:hover:not(:disabled), .amigo-acoes button:hover:not(:disabled) { color: #06210f; }
.online-salas button:hover:not(:disabled)::before, .amigo-acoes button:hover:not(:disabled)::before { background: #4ade80; }
.online-salas button:disabled { color: var(--muted); cursor: default; }
.online-salas button:disabled::before { background: none; box-shadow: inset 0 0 0 1px var(--line-strong); }
.amigo-acoes button:not(.principal) { color: var(--muted); }
.amigo-acoes button:not(.principal)::before { background: none; box-shadow: inset 0 0 0 1px var(--line-strong); }
.amigo-acoes button.remover { width: 30px; padding: 0; font-size: 16px; letter-spacing: 0; }
@media (max-width: 700px) {
  .online-grade { grid-template-columns: minmax(0, 1fr); grid-template-areas: "rapida" "salas" "amigos" "criar" "entrar"; }
  .online-card--amigos { contain: none; min-height: 0; }
  .online-card--amigos .online-rolagem { flex: none; height: 180px; }
}

/* Campo e botão lado a lado, sempre no pé da caixa: as linhas de ação das
   caixas vizinhas (Partida rápida/Amigos, Criar sala/Entrar com código)
   ficam na mesma altura. */
.online-acao { display: grid; gap: 6px; margin-top: auto; }
.online-card > .online-botao:last-child, .online-card > .online-linha:last-child { margin-top: auto; }
.online-card--rapida, .online-card--criar, .online-card--entrar { min-height: 150px; }
.online-codigo input[type="text"] { flex: 1 1 auto; width: auto; min-width: 0; }
.online-card--amigos .online-rolagem { order: 0; }
.online-linha.online-acao { display: flex; }

/* ---------- Fundo da moldura ----------
   A moldura não fica oca: por trás do boneco, as cores dela borradas e
   translúcidas (assets/molduras/fundo, feitas por scripts/molduras-fundo.mjs,
   no mesmo enquadramento da arte — encaixa com o mesmo "contain" apoiado
   embaixo). Fica abaixo da moldura (z-index 1) e do palco 3D (2). A vaga livre,
   de moldura escurecida, segue vazia. */
.lobby-figura:has(> .lobby-moldura:not(.moldura-sombra))::before { content: ""; position: absolute; inset: 0; z-index: 0; background-position: 50% 100%; background-size: contain; background-repeat: no-repeat; pointer-events: none; }
.lobby-figura:has(> .moldura-bronze:not(.moldura-sombra))::before { background-image: url("./assets/molduras/fundo/bronze.webp"); }
.lobby-figura:has(> .moldura-prata)::before { background-image: url("./assets/molduras/fundo/prata.webp"); }
.lobby-figura:has(> .moldura-ouro)::before { background-image: url("./assets/molduras/fundo/ouro.webp"); }
.lobby-figura:has(> .moldura-diamante)::before { background-image: url("./assets/molduras/fundo/diamante.webp"); }
.lobby-figura:has(> .moldura-mestre)::before { background-image: url("./assets/molduras/fundo/mestre.webp"); }
.lobby-figura:has(> .moldura-lendario)::before { background-image: url("./assets/molduras/fundo/lendario.webp"); }
/* Nas miniaturas (a sua moldura, a lista do Perfil, a conquista), o fundo vai na própria imagem. */
.minha-moldura img, .app-moldura-carta img, .conquista-icone img { background-position: center; background-size: contain; background-repeat: no-repeat; }
img[src$="molduras/bronze.webp"]:not(.lobby-moldura):not(.moldura) { background-image: url("./assets/molduras/fundo/bronze.webp"); }
img[src$="molduras/prata.webp"]:not(.lobby-moldura):not(.moldura) { background-image: url("./assets/molduras/fundo/prata.webp"); }
img[src$="molduras/ouro.webp"]:not(.lobby-moldura):not(.moldura) { background-image: url("./assets/molduras/fundo/ouro.webp"); }
img[src$="molduras/diamante.webp"]:not(.lobby-moldura):not(.moldura) { background-image: url("./assets/molduras/fundo/diamante.webp"); }
img[src$="molduras/mestre.webp"]:not(.lobby-moldura):not(.moldura) { background-image: url("./assets/molduras/fundo/mestre.webp"); }
img[src$="molduras/lendario.webp"]:not(.lobby-moldura):not(.moldura) { background-image: url("./assets/molduras/fundo/lendario.webp"); }

/* ---------- O online é só com a conta ----------
   Sem a conta entrada, o painel Online mostra só o convite para entrar com o
   Google (#onlineLogin, src/main.js exigirLogin): as salas, a partida rápida e
   os amigos aparecem depois do login. */
.online-login { display: grid; justify-items: center; gap: 12px; max-width: 580px; margin: 10px auto 6px; padding: 26px 22px; border: 1px solid #ffb00040; border-radius: 8px; background: #ffb0000d; text-align: center; }
.online-login[hidden] { display: none; }
.online-login h3 { margin: 0; color: var(--ink); font: 700 24px/1.15 "Barlow Condensed", sans-serif; letter-spacing: .04em; }
.online-login p { margin: 0; color: #b5c2cc; font-size: 13px; line-height: 1.55; }
.online-login-botao { display: grid; justify-items: center; min-height: 40px; }
.online-login-aviso { color: #ff9b8f !important; }
.online-login-aviso:empty { display: none; }

/* Gestos do lobby (src/gestos.js): acenar, sim e não. Só o emoji, sem caixa em volta. */
.gestos { display: inline-flex; gap: 8px; }
.gesto { width: 34px; height: 34px; padding: 0; border: 0; background: none; color: inherit; font-size: 24px; line-height: 1; cursor: pointer; filter: drop-shadow(0 2px 3px #000c); transition: transform .12s; -webkit-tap-highlight-color: transparent; }
.gesto:hover { transform: translateY(-2px) scale(1.12); }
.gesto:active { transform: scale(.86); }
/* Na sala: em cima do botão de iniciar, no meio dele (a área do botão alinha tudo à direita). */
.lobby-pronto-area > .lobby-gestos { justify-self: center; gap: 14px; }
@media (max-height: 520px) { .lobby-gestos .gesto { width: 24px; height: 24px; font-size: 17px; } }
