@import url('/theme.css');
/* Página do jogo. Marca, cores, abas, cartões e controles vêm de theme.css (identidade da proposta). */

.game-shell { max-width: 1220px; margin: auto; padding: 0 28px; }

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 28px;
  align-items: start;
  padding: 24px 0 32px;
}

/* ---------- palco 3D ---------- */

#stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  overflow: hidden;
  background: var(--sand);
  touch-action: none;
  cursor: grab;
}
#stage:active { cursor: grabbing; }
#stage canvas { display: block; width: 100%; height: 100%; }

/* Tempo e placar como selos sobre a cena. */
.hud {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}
.chip {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(19, 32, 43, .78);
  color: #fff7ea;
  font-size: .82rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(4px);
}

/* Clarão vermelho nas bordas quando você leva um golpe. */
#hurt {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(220, 30, 30, 0.55) 100%);
  transition: opacity 0.35s ease-out;
}
#hurt.on { opacity: 1; transition: none; animation: hurt-fade 0.35s ease-out forwards; }
@keyframes hurt-fade { to { opacity: 0; } }

/* Aviso central (aguardando jogadores, fim de partida), no estilo dos cartões. */
#overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: min(440px, calc(100% - 32px));
  padding: 14px 20px;
  border-radius: var(--radius-lg);
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-top: 6px solid var(--brand);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
  font-weight: 800;
  font-size: 1.05rem;
  text-align: center;
  pointer-events: none;
}

/* Crédito exigido pela licença dos dados do mapa (ODbL). */
#credits {
  position: absolute;
  right: 8px;
  bottom: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(19, 32, 43, .55);
  color: #fff;
  font-size: .68rem;
  pointer-events: none;
}

.keys {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 14px 2px 0;
  color: var(--muted);
  font-size: .78rem;
}
.keys span { display: inline-flex; align-items: center; gap: 4px; }

/* Feed de abates no canto superior direito, abaixo do placar. */
#feed {
  position: absolute;
  top: 48px;
  right: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  pointer-events: none;
}
#feed p {
  margin: 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(19, 32, 43, .74);
  color: #fff7ea;
  font-size: .76rem;
  animation: feed-in .2s ease-out;
}
@keyframes feed-in { from { opacity: 0; transform: translateY(-4px); } }

/* ---------- painel de entrada ---------- */

.load-bar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; margin-bottom: 14px; }
.load-bar span { display: block; height: 100%; width: var(--pct, 0%); background: var(--brand); transition: width .2s; }
.play-now { min-height: 58px; font-size: 1.25rem; font-weight: 800; font-variation-settings: "wdth" 80; letter-spacing: .01em; box-shadow: 0 4px 0 rgba(0, 0, 0, .14); }
.play-note { margin: -6px 0 0; text-align: center; }
.customize { border-top: 1px solid var(--line); padding-top: 12px; }
.customize summary { cursor: pointer; font-size: .78rem; font-weight: 700; color: var(--ink); list-style: none; }
.customize summary::-webkit-details-marker { display: none; }
.customize summary::before { content: '+ '; color: var(--brand); font-weight: 900; }
.customize[open] summary::before { content: '– '; }
.customize[open] { display: flex; flex-direction: column; gap: 14px; }

.entry { position: sticky; top: 18px; }
.entry-body { padding: 18px; }
#join-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: .66rem; letter-spacing: .12em; font-weight: 800; text-transform: uppercase; color: var(--muted); }
.team-tabs.stacked { flex-direction: column; gap: 8px; }
.team-tabs.stacked button { padding: 11px 14px; }
#look-description { margin: -4px 0 0; }
#join-btn { width: 100%; }
#status { min-height: 2.6em; margin: 14px 0 10px; font-size: .86rem; font-weight: 600; color: var(--ink); }
.play-options { display: flex; gap: 8px; }
.play-options button { flex: 1; min-height: 42px; font-size: .74rem; padding: 8px; }
.panel-link { display: block; margin-top: 14px; color: var(--brand); text-align: center; font-weight: 750; font-size: .8rem; }

/* ---------- toque ---------- */

#touch-controls { position: absolute; inset: 0; pointer-events: none; user-select: none; -webkit-user-select: none; }
#move-pad { position: absolute; left: 14px; bottom: 34px; width: 116px; height: 116px; border-radius: 50%; border: 2px solid rgba(255,255,255,.75); background: rgba(19,32,43,.45); pointer-events: auto; touch-action: none; display: grid; place-items: center; }
#move-pad[aria-disabled="true"] { opacity: .45; }
.pad-arrows { text-align: center; color: rgba(255,255,255,.85); line-height: 1.8; font-size: 18px; }
#move-stick { position: absolute; width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.85); border: 2px solid #fff; pointer-events: none; }
.touch-actions { position: absolute; right: 14px; bottom: 34px; display: grid; grid-template-columns: repeat(2, 62px); gap: 8px; pointer-events: auto; }
.touch-actions button { height: 58px; padding: 0; border-radius: 50%; border: 2px solid rgba(255,255,255,.85); background: var(--brand); font-size: .78rem; font-weight: 800; touch-action: none; }
.touch-actions button[data-action="dodge"], .touch-actions button[data-action="grab"] { width: 100%; height: 40px; border-radius: 22px; background: rgba(19,32,43,.82); font-size: .7rem; }
.touch-actions button[data-action="grab"] { background: rgba(255,106,43,.88); }
.touch-actions button:active { filter: brightness(1.15); }
body.touch-mode #stage { min-height: 330px; }
body.touch-mode #credits { font-size: .62rem; }

/* ---------- telas menores ---------- */

@media (max-width: 1000px) {
  .game-layout { grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; }
}

@media (max-width: 760px) {
  .game-shell { padding: 0 16px; }
  .game-layout { display: flex; flex-direction: column; padding-top: 16px; }
  .arena, .entry { width: 100%; }
  .entry { position: static; }
  .team-tabs.stacked { flex-direction: row; }
  .team-tabs.stacked button { flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px; }
  .team-tabs.stacked button span { margin-left: 0; }
}

@media (max-width: 420px) {
  #move-pad { width: 104px; height: 104px; left: 10px; }
  .touch-actions { right: 10px; grid-template-columns: repeat(2, 56px); }
  .touch-actions button { height: 54px; }
  .chip { font-size: .72rem; padding: 5px 10px; }
}

@media (orientation: landscape) and (max-height: 550px) {
  .game-shell { padding: 0 max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)); }
  body.touch-mode #stage { height: 72svh; min-height: 240px; aspect-ratio: auto; }
}

/* ---------- escolha de lado (obrigatória para jogar) ---------- */

.choose-title { margin: 0; font-size: 1.35rem; }
.side-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.side-play {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 74px;
  padding: 12px 14px;
  border-radius: var(--radius);
  color: #fff;
  text-align: left;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .16);
}
.side-play span { display: flex; flex-direction: column; font-size: .74rem; font-weight: 600; line-height: 1.1; }
.side-play b { font-size: 1.35rem; font-weight: 800; font-variation-settings: "wdth" 78; letter-spacing: .01em; }
.side-left { background: var(--left); }
.side-right { background: var(--right); }
.side-play .red-dot, .side-play .green-dot { outline: 2px solid rgba(255, 255, 255, .85); }
.side-play .red-dot { background: #fff; }

/* Carteira no painel: vidas, Santinhos e atalho para a loja. */
.wallet { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.wallet-item { font-weight: 800; font-size: .88rem; padding: 6px 10px; border-radius: 999px; background: var(--wash); }
.wallet-shop { margin-left: auto; padding: 6px 12px; font-size: .8rem; }

/* ---------- modo de jogo: o jogo ocupa a tela, atalhos nas bordas ---------- */

.edge-actions, .edge-status, .edge-keys, #lives-chip { display: none; }

body.playing { overflow: hidden; }
body.playing .site-header, body.playing .calcadao, body.playing .site-footer,
body.playing .entry, body.playing #keyboard-help, body.playing #touch-help { display: none; }
body.playing .game-shell { max-width: none; padding: 0; }
body.playing .game-layout { display: block; padding: 0; }
body.playing #stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  z-index: 20;
}
body.playing #lives-chip { display: inline-block; }
body.playing .hud {
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
}
.hud-group { display: flex; gap: 6px; }
.chip-lives { background: rgba(217, 54, 62, .9); }
.chip-lives.is-low { animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { to { background: rgba(255, 106, 43, .95); } }

body.playing .edge-actions {
  display: flex;
  position: absolute;
  top: calc(max(12px, env(safe-area-inset-top)) + 40px);
  right: max(12px, env(safe-area-inset-right));
  gap: 6px;
}
.edge-button {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(19, 32, 43, .72);
  color: #fff7ea;
  border: 1px solid rgba(255, 247, 234, .35);
  font-size: .76rem;
  font-weight: 700;
}
body.playing #feed { top: calc(max(12px, env(safe-area-inset-top)) + 80px); right: max(12px, env(safe-area-inset-right)); }

body.playing .edge-status {
  display: block;
  position: absolute;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: min(520px, calc(100% - 300px));
  margin: 0;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(19, 32, 43, .66);
  color: #fff7ea;
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
body.playing .edge-status:empty { display: none; }
body.playing .edge-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  position: absolute;
  left: max(12px, env(safe-area-inset-left));
  bottom: max(12px, env(safe-area-inset-bottom));
  max-width: 300px;
  margin: 0;
  color: #fff7ea;
  font-size: .72rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
  pointer-events: none;
}
body.playing.touch-mode .edge-keys { display: none; }

/* Aviso rápido no topo, fora do centro da ação. */
.toast {
  position: absolute;
  top: calc(max(12px, env(safe-area-inset-top)) + 40px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 24px);
  padding: 7px 8px 7px 14px;
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .2);
  font-size: .82rem;
  font-weight: 700;
  z-index: 3;
}
.toast button { padding: 5px 12px; font-size: .78rem; border-radius: 999px; }

/* Tela de vidas esgotadas, no meio da cena. */
.lives-screen {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(400px, calc(100% - 32px));
  padding: 20px;
  z-index: 4;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .3);
}
.lives-screen { max-height: calc(100% - 24px); overflow: auto; }
.lives-screen h2 { margin: 6px 0 4px; font-size: 1.9rem; }
.access-form { display: flex; flex-direction: column; gap: 10px; text-align: left; margin: 12px 0; }
.access-form input { width: 100%; }
.lives-countdown { margin: 0 0 14px; font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; }
.lives-actions { display: flex; flex-direction: column; gap: 8px; }
.lives-actions button { min-height: 46px; }

/* ---------- celular: nada cobrindo a cena ---------- */
/* O centro fica livre para o personagem; o rodapé, para os controles de toque.
   Status e avisos sobem para a faixa do topo, em letra pequena. */

@media (max-width: 760px), (pointer: coarse) {
  body.playing .hud { flex-wrap: wrap; row-gap: 4px; }
  body.playing .chip { font-size: .7rem; padding: 4px 9px; }
  body.playing .edge-actions { top: calc(max(8px, env(safe-area-inset-top)) + 34px); gap: 4px; }
  .edge-button { padding: 4px 9px; font-size: .66rem; }
  body.playing #feed { top: calc(max(8px, env(safe-area-inset-top)) + 64px); max-width: 52%; }
  body.playing #feed p { font-size: .64rem; padding: 3px 8px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.playing #feed p:nth-child(n + 3) { display: none; }
  body.playing .edge-status {
    left: max(12px, env(safe-area-inset-left));
    top: calc(max(8px, env(safe-area-inset-top)) + 34px);
    bottom: auto;
    transform: none;
    max-width: 44%;
    padding: 3px 9px;
    font-size: .64rem;
    white-space: normal;
  }
  body.playing #overlay { top: 30%; max-width: 240px; padding: 8px 14px; border-top-width: 4px; font-size: .82rem; }
  .toast {
    top: auto;
    bottom: calc(max(12px, env(safe-area-inset-bottom)) + 160px);
    font-size: .72rem;
    padding: 5px 6px 5px 12px;
  }
  .lives-screen { padding: 16px; max-height: calc(100% - 24px); overflow: auto; }
  .lives-screen h2 { font-size: 1.45rem; }
  .lives-countdown { margin-bottom: 10px; }
  .lives-actions button { min-height: 42px; }
}

/* Celular deitado: a altura é pouca, então a tela de vidas fica em duas colunas de botões. */
@media (orientation: landscape) and (max-height: 550px) {
  .lives-screen { width: min(520px, calc(100% - 32px)); }
  .lives-screen h2 { font-size: 1.2rem; margin: 2px 0; }
  .lives-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .lives-screen .note { display: none; }
}

/* ---------- loja por cima do jogo ---------- */

.shop-dialog {
  width: min(720px, calc(100% - 24px));
  max-height: min(86vh, 760px);
  padding: 0;
  border: 1px solid var(--line);
  border-top: 6px solid var(--brand);
  border-radius: var(--radius-lg);
  background: var(--bg);
  color: var(--ink);
  overflow: auto;
}
.shop-dialog::backdrop { background: rgba(19, 32, 43, .55); }
.shop-dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--card); position: sticky; top: 0; z-index: 1; }
.shop-dialog-head > div { display: flex; align-items: baseline; gap: 12px; }
.shop-balance { font-size: 1.3rem; font-weight: 800; }
.shop-tabs { display: flex; gap: 6px; padding: 12px 18px 0; flex-wrap: wrap; }
.shop-tabs button { padding: 7px 12px; font-size: .82rem; border-radius: 999px; }
.shop-body { padding: 14px 18px; }
.shop-lead { margin: 0 0 12px; color: var(--muted); font-size: .9rem; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.shop-card { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.shop-card.is-worn { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.shop-card.is-soon { opacity: .75; }
.shop-card .note { margin: 0; font-size: .74rem; }
.shop-card button { margin-top: auto; padding: 8px 10px; font-size: .8rem; }
.shop-card-title { font-size: .95rem; line-height: 1.2; }
.shop-price { font-weight: 800; color: var(--brand); font-size: .85rem; }
.shop-type { font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.shop-swatch { display: grid; place-items: center; height: 54px; border-radius: 8px; font-weight: 800; font-size: .72rem; text-align: center; padding: 4px; }
.shop-demo { margin-bottom: 12px; border-style: dashed; }
.shop-status { padding: 0 18px 14px; margin: 0; min-height: 1.4em; }
.shop-link-button { margin-top: 12px; }

/* Celular: a loja ocupa a tela inteira, em duas colunas. */
@media (max-width: 760px) {
  .shop-dialog { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; border-radius: 0; }
  .shop-dialog-head, .shop-tabs, .shop-body, .shop-status { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Janela muito estreita sem toque: a legenda de teclas cobriria o crédito do mapa. */
@media (max-width: 520px) {
  body.playing .edge-keys { display: none; }
}

/* Arma na mão: chip ao lado das vidas; a paga em dourado. */
.chip-weapon { background: rgba(255, 247, 234, .92); color: #13202b; }
.chip-weapon.is-paid { background: #ffd200; }

/* Pagamento por Pix dentro da loja. */
.pix-box { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.pix-qr { width: min(240px, 70vw); height: auto; aspect-ratio: 1; image-rendering: pixelated; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.pix-qr.is-expired { opacity: .25; }
.pix-amount { font-size: 1.8rem; font-weight: 800; }
.pix-code { width: 100%; font: .72rem/1.3 ui-monospace, Menlo, monospace; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); resize: none; }

/* Provocar: botão de toque que aparece só logo depois de derrubar alguém. */
.touch-actions .taunt-button { grid-column: span 2; height: 40px; border-radius: 22px; background: #ffd200; color: #13202b; font-size: .74rem; animation: pulse-taunt .6s ease-in-out infinite alternate; }
@keyframes pulse-taunt { to { transform: scale(1.06); } }

/* Faixa grande do espetáculo (fatality), no alto da tela, por um instante. */
.flash-banner { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); padding: 8px 18px; border-radius: 12px; background: #13202b; color: #ffd200; font-weight: 900; font-size: clamp(1.1rem, 4vw, 2rem); letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; pointer-events: none; animation: banner-in .25s ease-out; z-index: 3; }
@keyframes banner-in { from { transform: translateX(-50%) scale(1.4); opacity: 0; } }

/* Replay pronto para compartilhar. */
.replay-dialog { width: min(560px, calc(100% - 24px)); padding: 0; border: 1px solid var(--line); border-top: 6px solid var(--brand); border-radius: var(--radius-lg); background: var(--bg); color: var(--ink); }
.replay-dialog::backdrop { background: rgba(19, 32, 43, .55); }
.replay-body { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.replay-body video { width: 100%; border-radius: 10px; background: #000; }
.replay-body h2 { margin: 0; font-size: 1.4rem; }
.replay-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.replay-actions button { flex: 1 1 140px; }
@media (max-width: 760px) { .replay-dialog { width: 100%; max-width: none; margin: auto 0 0; border-radius: 16px 16px 0 0; } }
.edge-replay { background: #ffd200; color: #13202b; border-color: #ffd200; }
