/* O app dos jogos da call (Virtuoso, PWA): a tela inicial. Só esta página
   carrega este arquivo (ver servidor.py). As mesas das calls usam o CSS da
   Atividade, como sempre. */
body[data-app="jogos"] {
  --jg-fundo: #0b0a12; --jg-card: #15131f; --jg-alto: #1e1b2b; --jg-linha: rgba(255, 255, 255, .08);
  --jg-tx: #f5f2ea; --jg-tx2: #a8a2b6; --jg-tx3: #8c86a0; --jg-ouro: #f2c14e; --jg-ouro-tinta: #1a1405; --jg-vivo: #4ade80;
  background: var(--jg-fundo);
  -webkit-user-select: none; user-select: none;
}
html:has(body[data-app="jogos"]) { background: #0b0a12; min-height: calc(100% + env(safe-area-inset-top)); }

.jg { position: fixed; inset: 0; z-index: 5; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  background: var(--jg-fundo); color: var(--jg-tx); font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  padding: calc(env(safe-area-inset-top) + 14px) 20px calc(env(safe-area-inset-bottom) + 32px); box-sizing: border-box;
  display: flex; flex-direction: column; gap: 26px; animation: jg-entra .35s ease-out both; }
.jg[hidden] { display: none; }
.jg > * { width: 100%; max-width: 560px; margin-inline: auto; flex-shrink: 0; }
@keyframes jg-entra { from { opacity: 0; transform: translateY(8px); } }
.jg h1, .jg h2 { font-family: "Space Grotesk", Inter, system-ui, sans-serif; margin: 0; letter-spacing: -.02em; }
.jg a { color: inherit; text-decoration: none; }
.jg button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.jg svg { width: 18px; height: 18px; flex-shrink: 0; }

/* topo */
.jg-topo { display: flex; align-items: center; justify-content: space-between; }
.jg-marca { display: flex; align-items: center; gap: 10px; }
.jg-marca b { font-family: "Space Grotesk", Inter, sans-serif; font-size: 20px; letter-spacing: -.02em; }
.jg-logo { width: 32px; height: 32px; border-radius: 10px; background: var(--jg-alto); color: var(--jg-ouro); display: grid; place-items: center; }
.jg-logo svg { width: 30px; height: 30px; }
.jg-topo-acoes { display: flex; align-items: center; gap: 10px; }
.jg-redondo { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--jg-linha) !important; background: var(--jg-card) !important;
  display: grid; place-items: center; }
.jg-redondo svg { width: 20px; height: 20px; }

/* avatares */
.jg-ava { position: relative; display: inline-grid; flex-shrink: 0; }
.jg-ava .ava { width: 32px; height: 32px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; position: relative;
  background: #3a2e5c; color: var(--jg-tx); font-weight: 700; font-size: 13px; box-shadow: 0 0 0 2px var(--jg-card); }
.jg-ava .ava img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.jg-ava.eu .ava { width: 44px; height: 44px; font-size: 16px; box-shadow: 0 0 0 2px var(--jg-fundo), 0 0 0 4px var(--jg-linha); }
.jg-ava.noctis .ava { box-shadow: 0 0 0 2px var(--jg-card), 0 0 0 4px var(--jg-ouro); }
.jg-ava.eu.noctis .ava { box-shadow: 0 0 0 2px var(--jg-fundo), 0 0 0 4px var(--jg-ouro); }
.jg-lua { position: absolute; right: -4px; bottom: -4px; width: 16px; height: 16px; border-radius: 50%; background: var(--jg-ouro);
  color: var(--jg-ouro-tinta); display: grid; place-items: center; border: 2px solid var(--jg-fundo); }
.jg-lua svg { width: 9px !important; height: 9px !important; }
.jg-ava.eu .jg-lua { width: 20px; height: 20px; }
.jg-ava.eu .jg-lua svg { width: 11px !important; height: 11px !important; }
.jg-pilha { display: flex; align-items: center; }
.jg-pilha .jg-ava + .jg-ava, .jg-pilha .jg-mais { margin-left: -10px; }
.jg-mais { width: 32px; height: 32px; border-radius: 50%; background: #24303f; color: var(--jg-tx2); font-size: 11px; font-weight: 700;
  display: grid; place-items: center; box-shadow: 0 0 0 2px var(--jg-card); }
.jg-pilha.mini .ava { width: 24px; height: 24px; font-size: 10px; }
.jg-pilha.mini .jg-ava + .jg-ava { margin-left: -8px; }
.jg-pilha.mini .jg-lua { display: none; }

/* saudação */
.jg-ola { display: flex; flex-direction: column; gap: 6px; }
.jg-ola h1 { font-size: 30px; line-height: 1.1; font-weight: 700; }
.jg-ola p { margin: 0; color: var(--jg-tx2); font-size: 15px; }
.jg-dourado { background: linear-gradient(90deg, #ffe7a8, #f2c14e 40%, #fff4d6 60%, #e0a93a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.jg-selo { position: relative; overflow: hidden; align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px;
  border-radius: 14px; background: #1a1538; border: 1px solid rgba(242, 193, 78, .55); color: #ffd873; font-size: 12px; font-weight: 700; letter-spacing: .3px; }
.jg-selo svg { width: 13px; height: 13px; }
.jg-selo::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent); animation: jg-reflexo 3.5s ease-in-out infinite; }
@keyframes jg-reflexo { 0% { transform: translateX(-120%); } 60%, 100% { transform: translateX(260%); } }

/* o card da call */
.jg-card { border-radius: 24px; background: var(--jg-card); border: 1px solid var(--jg-linha); padding: 18px; display: flex; flex-direction: column; gap: 16px;
  box-shadow: 0 20px 40px -24px rgba(0, 0, 0, .8); box-sizing: border-box; }
.jg-card-topo { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.jg-vivo { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--jg-vivo); }
.jg-vivo i { width: 8px; height: 8px; border-radius: 50%; background: var(--jg-vivo); animation: jg-pulso 1.8s infinite; }
.jg-vivo.mini { font-size: 11px; letter-spacing: 0; text-transform: none; font-weight: 600; flex-shrink: 0; }
.jg-vivo.mini i { width: 6px; height: 6px; }
@keyframes jg-pulso { 0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, .55); } 70% { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); } 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); } }
.jg-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--jg-tx2) !important; min-height: 32px; }
.jg-link svg { width: 15px; height: 15px; }
.jg-call-nome { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.jg-call-nome > div:first-child { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.jg-call-nome h2 { font-size: 22px; font-weight: 700; line-height: 1.15; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.jg-call-nome small { font-size: 13px; color: var(--jg-tx2); }
.jg-mesa { border-radius: 18px; background: var(--jg-alto); padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.jg-mesa-cab { display: flex; align-items: center; gap: 12px; }
.jg-mesa-cab > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.jg-mesa-cab b { font-size: 17px; font-weight: 600; }
.jg-mesa-cab small, .jg-nota { font-size: 13px; color: var(--jg-tx2); margin: 0; }
.jg-tag { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--jg-ouro); }
.jg-lugares { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 8px; }
.jg-lugar { height: 40px; border-radius: 12px; background: #3a2e5c; display: grid; place-items: center; font-size: 13px; font-weight: 600;
  padding: 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jg-lugar:nth-child(4n+2) { background: #1f4d45; } .jg-lugar:nth-child(4n+3) { background: #5c2e3a; } .jg-lugar:nth-child(4n+4) { background: #2e3f5c; }
.jg-lugar.livre { background: transparent !important; border: 1.5px dashed rgba(242, 193, 78, .6); color: var(--jg-ouro); animation: jg-pisca 2s infinite; }
@keyframes jg-pisca { 50% { opacity: .45; } }
.jg-bt { display: flex; align-items: center; justify-content: center; gap: 8px; height: 52px; border-radius: 26px; font-size: 16px; font-weight: 700;
  background: rgba(255, 255, 255, .1) !important; color: var(--jg-tx) !important; transition: transform .12s; }
.jg-bt.forte { background: var(--jg-ouro) !important; color: var(--jg-ouro-tinta) !important; }
.jg-bt:active, .jg-jogo:active, .jg-destaque:active, .jg-feira:active, .jg-call-linha:active { transform: scale(.98); }
.jg-vazio { align-items: flex-start; }
.jg-vazio h2 { font-size: 22px; }
.jg-vazio p { margin: -6px 0 0; color: var(--jg-tx2); font-size: 14px; line-height: 1.5; }
.jg-vazio .jg-bt { align-self: stretch; background: var(--jg-ouro) !important; color: var(--jg-ouro-tinta) !important; }
.jg-vazio-ico { width: 52px; height: 52px; border-radius: 16px; background: var(--jg-alto); color: var(--jg-tx2); display: grid; place-items: center; }
.jg-vazio-ico svg { width: 26px; height: 26px; }

/* ícone de cada jogo */
.jg-ico { width: 44px; height: 44px; border-radius: 13px; background: var(--f, var(--jg-alto)); color: var(--c, var(--jg-tx2)); display: grid; place-items: center; flex-shrink: 0; }
.jg-ico svg { width: 22px; height: 22px; }
.jg-mesa-cab .jg-ico { width: 52px; height: 52px; border-radius: 14px; }
.jg-mesa-cab .jg-ico svg { width: 28px; height: 28px; }

/* o banner do Feirão */
.jg-feira { position: relative; display: block; height: 196px; border-radius: 24px; overflow: hidden; background: #111833; border: 1px solid rgba(255, 255, 255, .06); }
.jg-feira-luzes { position: absolute; left: 0; right: 0; top: 18px; height: 30px; display: flex; justify-content: space-around; padding: 0 12px;
  border-top: 1px solid rgba(255, 255, 255, .14); border-radius: 50% 50% 0 0 / 30px 30px 0 0; }
.jg-feira-luzes i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); margin-top: calc(-4px + 9px * sin(var(--i) * 0.45));
  animation: jg-pisca 2.4s infinite; animation-delay: calc(var(--i) * -.3s); }
.jg-feira-lua { position: absolute; right: 26px; top: 30px; width: 60px; height: 60px; border-radius: 50%; background: #f6e7b0;
  box-shadow: 0 0 48px 14px rgba(246, 231, 176, .22); animation: jg-flutua 6s ease-in-out infinite; }
@keyframes jg-flutua { 50% { transform: translateY(-4px); } }
.jg-feira-toldo { position: absolute; left: 0; right: 0; bottom: 0; height: 26px;
  background: repeating-linear-gradient(90deg, #e5484d 0 30px, #f5e9d3 30px 60px);
  -webkit-mask: radial-gradient(circle at 15px 0, #000 15px, transparent 15.5px) 0 12px / 30px 15px repeat-x, linear-gradient(#000, #000) 0 0 / 100% 13px no-repeat;
  mask: radial-gradient(circle at 15px 0, #000 15px, transparent 15.5px) 0 12px / 30px 15px repeat-x, linear-gradient(#000, #000) 0 0 / 100% 13px no-repeat; }
.jg-feira-tx { position: absolute; left: 20px; top: 52px; display: flex; flex-direction: column; gap: 6px; max-width: 64%; }
.jg-feira-tx small { font-size: 11px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: #ffd873; }
.jg-feira-tx b { font-family: "Space Grotesk", Inter, sans-serif; font-size: 24px; line-height: 1.1; letter-spacing: -.02em; }
.jg-feira-tx em { font-style: normal; font-size: 13px; color: #b9c0de; }
.jg-feira-bt { position: absolute; right: 16px; bottom: 40px; height: 38px; padding: 0 16px; border-radius: 19px; background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .18); display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; }
.jg-feira-bt svg { width: 16px; height: 16px; }

/* seções */
.jg-secao { display: flex; flex-direction: column; gap: 14px; }
.jg-secao-cab { display: flex; align-items: baseline; justify-content: space-between; }
.jg-secao-cab h2 { font-size: 20px; font-weight: 700; }
.jg-secao-cab small { font-size: 13px; color: var(--jg-tx3); }
.jg-destaque { display: flex; gap: 14px; align-items: center; padding: 14px !important; border-radius: 20px; background: var(--jg-card) !important;
  border: 1px solid var(--jg-linha) !important; text-align: left; transition: transform .12s; }
.jg-destaque-tx { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.jg-destaque-tx b { font-size: 18px; }
.jg-destaque-tx small { font-size: 13px; line-height: 1.4; color: var(--jg-tx2); }
.jg-destaque-tx em { font-style: normal; font-size: 12px; color: var(--jg-tx3); }
.jg-jogo-arte { height: 92px; border-radius: 14px; background: var(--f); display: grid; place-items: center; }
.jg-jogo-arte .jg-ico { background: transparent; width: auto; height: auto; }
.jg-jogo-arte .jg-ico svg { width: 38px; height: 38px; }
.jg-jogo-arte.g { width: 84px; height: 84px; border-radius: 18px; flex-shrink: 0; }
.jg-jogo-arte.g .jg-ico svg { width: 42px; height: 42px; }
.jg-grade { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 520px) { .jg-grade { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.jg-jogo { display: flex; flex-direction: column; gap: 4px; padding: 12px !important; border-radius: 20px; background: var(--jg-card) !important;
  border: 1px solid var(--jg-linha) !important; text-align: left; transition: transform .12s; }
.jg-jogo .jg-jogo-arte { margin-bottom: 6px; }
.jg-jogo b { font-size: 15px; padding: 0 2px; }
.jg-jogo small { font-size: 12px; color: var(--jg-tx3); padding: 0 2px; }

/* outras calls */
.jg-lista { border-radius: 20px; background: var(--jg-card); border: 1px solid var(--jg-linha); display: flex; flex-direction: column; overflow: hidden; }
.jg-call-linha { display: flex; align-items: center; gap: 12px; padding: 14px 16px; transition: transform .12s; }
.jg-call-linha + .jg-call-linha { border-top: 1px solid rgba(255, 255, 255, .06); }
.jg-call-linha .jg-ico { width: 40px; height: 40px; border-radius: 12px; }
.jg-call-linha .jg-ico svg { width: 20px; height: 20px; }
.jg-call-tx { display: flex; flex-direction: column; gap: 2px; flex-grow: 1; min-width: 0; }
.jg-call-tx b { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jg-call-tx small { font-size: 12px; color: var(--jg-tx2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jg-n { min-width: 26px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--jg-alto); color: var(--jg-tx2); font-size: 12px; font-weight: 700;
  display: grid; place-items: center; flex-shrink: 0; box-sizing: border-box; }
.jg-rodape { text-align: center; font-size: 12px; color: var(--jg-tx3); }
.jg-rodape a { text-decoration: underline !important; }

/* a mesa da call aberta: o "Início" entra na barra de cima, no lugar do selo */
.jg-voltar { position: fixed; z-index: 25; left: calc(max(10px, var(--in-left, 0px)) + 9px); top: calc(max(10px, var(--in-top, 0px)) + 7px);
  height: 36px; padding: 0 12px 0 8px; border-radius: 11px; border: 1px solid rgba(230, 195, 106, .3); background: rgba(20, 16, 10, .85);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: #e6c36a; font: 700 12.5px Inter, system-ui, sans-serif; letter-spacing: .02em;
  display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.jg-voltar[hidden] { display: none; }
.jg-voltar svg { width: 17px; height: 17px; }
body.jg-na-call .im-topo { padding-left: 98px; }
body.jg-na-call .im-selo { display: none; }
/* Uma folha do jogo aberta (criar mesa, regras…) escurece a tela: o "Início" some junto. */
.jg-voltar { transition: opacity .2s; }
body:has(.im-folha:not([hidden])) .jg-voltar, body:has(#folha:not([hidden])) .jg-voltar { opacity: 0; pointer-events: none; }

/* ===== as mesas da call no visual do app =====
   No app, a mesma tela da Atividade com a cara do Virtuoso: fundo escuro liso,
   cartões com borda fina, dourado chapado, Space Grotesk nos títulos e Inter no
   resto. O tabuleiro e as cartas de cada jogo continuam os mesmos. */
body[data-app="jogos"] :is(.imperio, .ludo, .truco, .mentirosos, .domino, .jogo-ultima, .telepatia, .rabisco, .batata, .telefone, .re-camada, .im-folha, .im-guia) {
  --im-noite: #0b0a12; --im-laca: #15131f; --im-laca-2: #1e1b2b; --im-vidro: rgba(21, 19, 31, .94);
  --im-ouro: #f2c14e; --im-ouro-2: #f2c14e; --im-ouro-claro: #ffd873; --im-marfim: #f5f2ea; --im-cinza: #a8a2b6;
  --im-linha: rgba(255, 255, 255, .09);
  --im-deco: "Space Grotesk", Inter, system-ui, sans-serif;
  --im-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
}
body[data-app="jogos"]:is(.modo-imperio, .modo-ludo, .modo-truco, .modo-mentirosos, .modo-domino, .modo-ultima, .modo-telepatia, .modo-rabisco, .modo-batata, .modo-telefone) { background: #0b0a12; }
/* O vidro com fio de ouro vira o cartão do app. */
body[data-app="jogos"] :is(.im-vidro, .im-topo, .im-saguao, .im-placa, .im-cam-botoes button, .im-placar, .im-aviso, .im-log) {
  background: rgba(21, 19, 31, .94); border: 1px solid rgba(255, 255, 255, .08); box-shadow: 0 18px 40px -22px rgba(0, 0, 0, .85); }
/* Fundo liso: sem raios, sem a cidade, sem vinheta. */
body[data-app="jogos"] .im-fundo { background: #0b0a12; }
body[data-app="jogos"] :is(.im-raios, .im-skyline, .im-vinheta) { display: none; }
/* Títulos: Space Grotesk firme, sem o espaçamento largo do art déco. */
body[data-app="jogos"] :is(.im-marca-txt b, .im-sg-titulo b, .im-mesa-topo b, .im-folha-topo b, .im-guia h2, .im-doca-topo b,
  .im-tc-nome, .im-palco-rot, .lu-carta b, .lu-jogo-nome, .im-vezbox b, .im-rodada b) {
  font-weight: 700; letter-spacing: -.01em; text-transform: none; }
body[data-app="jogos"] .im-marca-txt b { background: none; -webkit-background-clip: border-box; background-clip: border-box; color: #f5f2ea; font-size: 17px; }
/* Botões: o dourado chapado do app (sem o brilho metálico), cantos mais redondos. */
body[data-app="jogos"] .im-btn { border-radius: 16px; border-color: rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .06); letter-spacing: 0; }
body[data-app="jogos"] .im-btn.ouro { background: #f2c14e; color: #1a1405; box-shadow: 0 10px 24px -14px rgba(242, 193, 78, .8); }
body[data-app="jogos"] .im-btn.ouro::after { display: none; }
body[data-app="jogos"] .im-topo-btn { border-radius: 12px; border-color: rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .05); color: #f5f2ea; }
/* Abas (Jogos, Perfil, Ranking). */
body[data-app="jogos"] .lu-abas { border-radius: 16px; border-color: rgba(255, 255, 255, .08); background: #15131f; }
body[data-app="jogos"] .lu-abas button { border-radius: 12px; }
body[data-app="jogos"] .lu-abas button.on { background: #2a2638; color: #f5f2ea; }
/* As folhas (criar mesa, regras, perfil de alguém): o cartão do app. */
body[data-app="jogos"] .im-folha { background: rgba(5, 5, 10, .7); }
body[data-app="jogos"] .im-folha-cartao { border-radius: 24px; border: 1px solid rgba(255, 255, 255, .09); background: #15131f;
  box-shadow: 0 40px 90px -24px #000; }
/* O saguão e o painel de baixo dos jogos: cartões do app, sem o fio de ouro. */
body[data-app="jogos"] :is(.im-saguao, .im-sg, .lu-painel, .im-doca) { border-color: rgba(255, 255, 255, .08); }

@media (prefers-reduced-motion: reduce) {
  .jg, .jg *, .jg-voltar { animation: none !important; transition: none !important; }
}
