/* =============================================================================
   Ajustes do site inteiro, sem mexer no desenho das telas:
   1) celular: as telas foram desenhadas para computador com estilos na própria tag; aqui elas
      empilham, os títulos diminuem e nada passa da largura da tela (o seletor procura o estilo como
      o navegador o escreve: "propriedade: valor");
   2) modo noturno (classe pxb-escuro no <html>, ligada pelo botão lua/sol ou pela preferência do
      aparelho): a página inteira é invertida e as imagens, vídeos e o 3D são "desinvertidos", então
      fotos e modelos ficam com as cores de verdade.
   ============================================================================= */

html, body { max-width: 100%; }
body { overflow-x: clip; }   /* clip (e não hidden): não cria outra área de rolagem, o topo e o "voltar ao início" continuam funcionando */

/* loading automático (páginas com data-splash-auto): nada da página aparece antes da capa */
html.pxb-carregando body > *:not(.pxb-splash-auto) { visibility: hidden !important; }
html.pxb-carregando { background: #F2F5FA; }
html.pxb-carregando.pxb-escuro[data-identidade] { background: #05101F; }

/* ------------------------------------------------------------------ modo noturno */
html.pxb-escuro:not([data-identidade]) { filter: invert(1) hue-rotate(180deg); background: #fff; }
html.pxb-escuro:not([data-identidade]) img,
html.pxb-escuro:not([data-identidade]) video,
html.pxb-escuro:not([data-identidade]) canvas,
html.pxb-escuro:not([data-identidade]) iframe,
html.pxb-escuro:not([data-identidade]) [style*="background-image: url"],
html.pxb-escuro:not([data-identidade]) .pxs-wa,
html.pxb-escuro:not([data-identidade]) .pxs-tema { filter: invert(1) hue-rotate(180deg); }
/* o nome "PandaXBrain" é uma imagem de letras: acompanha a inversão (letra escura vira clara e vice-versa) */
html.pxb-escuro:not([data-identidade]) img[src*="pandaxbrain-wordmark"] { filter: none; }
/* ícones de perfil (desenhos como fundo) e o chat: cores de verdade */
html.pxb-escuro:not([data-identidade]) [style*="background-image:url"] { filter: invert(1) hue-rotate(180deg); }

.pxs-tema {
  position: fixed; right: 150px; bottom: 20px; z-index: 2147483000; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(19, 32, 34, .14); background: #fff; color: #0C7D90; cursor: pointer; display: none;
  align-items: center; justify-content: center; box-shadow: 0 8px 22px rgba(14, 20, 40, .14);
}
.pxs-tema svg { width: 20px; height: 20px; }

/* botão lua/sol animado (tema.js): a lua e o sol estão no mesmo desenho; cada traço tem comprimento 1
   (pathLength), então "dashoffset 1" = apagado e "0" = desenhado. Na troca: um se desfaz, o outro se
   desenha (o sol: o círculo primeiro, depois os raios um a um), o ícone gira e o fundo pisca mais escuro. */
.pxs-tema svg { overflow: visible; transition: transform .7s cubic-bezier(.2, .7, .2, 1); }
.pxs-tema .lua, .pxs-tema .nucleo, .pxs-tema .raio { stroke-dasharray: 1; stroke-dashoffset: 1; }
/* lua à mostra */
.pxs-tema[data-icone="lua"] .lua { stroke-dashoffset: 0; transition: stroke-dashoffset .5s cubic-bezier(.4, 0, .2, 1) .28s; }
.pxs-tema[data-icone="lua"] .nucleo { transition: stroke-dashoffset .3s ease-in; }
.pxs-tema[data-icone="lua"] .raio { transition: stroke-dashoffset .18s ease-in calc((7 - var(--i)) * .025s); }
/* sol à mostra */
.pxs-tema[data-icone="sol"] svg { transform: rotate(90deg); }
.pxs-tema[data-icone="sol"] .lua { transition: stroke-dashoffset .32s ease-in; }
.pxs-tema[data-icone="sol"] .nucleo { stroke-dashoffset: 0; transition: stroke-dashoffset .45s cubic-bezier(.4, 0, .2, 1) .26s; }
.pxs-tema[data-icone="sol"] .raio { stroke-dashoffset: 0; transition: stroke-dashoffset .22s ease-out calc(.5s + var(--i) * .05s); }
/* o fundo escurece por um instante durante a troca */
.pxs-tema.trocando { animation: pxs-tema-pulso .7s ease-out; }
@keyframes pxs-tema-pulso { 0% { filter: brightness(1); } 30% { filter: brightness(.72); transform: scale(.94); } 100% { filter: brightness(1); transform: scale(1); } }
/* primeiro desenho e "menos movimento": sem animar */
.pxs-tema.sem-animacao svg, .pxs-tema.sem-animacao svg * { transition: none !important; }
@media (prefers-reduced-motion: reduce) { .pxs-tema svg, .pxs-tema svg * { transition: none !important; } .pxs-tema.trocando { animation: none; } }
html.pxb-escuro:not([data-identidade]) .pxs-tema { background: #10282B; color: #F2C14E; border-color: rgba(255, 255, 255, .18); }

/* ------------------------------------------------------------------ celular */
@media (max-width: 760px) {
  .pxs-tema { right: 136px; bottom: 14px; width: 40px; height: 40px; }

  /* menu do topo (início e preços): fica só o botão principal */
  [style*="backdrop-filter: blur(14px)"] > nav { display: none !important; }
  [style*="backdrop-filter: blur(14px)"] { gap: 8px !important; padding-left: 10px !important; padding-right: 6px !important; justify-content: space-between; }
  [style*="backdrop-filter: blur(14px)"] > a:first-child img:last-child { height: 13px !important; }
  [style*="backdrop-filter: blur(14px)"] > a:first-child img:first-child { height: 30px !important; }
  [style*="backdrop-filter: blur(14px)"] > a:last-child { margin-left: auto !important; padding: 9px 14px !important; font-size: 12.5px !important; white-space: nowrap; }

  /* colunas viram uma só */
  [style*="grid-template-columns: 1.04fr 1fr"],
  [style*="grid-template-columns: repeat(12, 1fr)"],
  [style*="grid-template-columns: 1fr 520px"],
  [style*="grid-template-columns: 1.4fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns: repeat(3, 1fr)"],
  [style*="grid-template-columns: repeat(4, 1fr)"] { grid-template-columns: minmax(0, 1fr) !important; }
  [style*="grid-template-columns: repeat(12, 1fr)"] > * { grid-column: 1 / -1 !important; grid-row: auto !important; min-width: 0 !important; }
  [style*="minmax(300px, 1fr)"], [style*="minmax(280px, 1fr)"], [style*="minmax(260px, 1fr)"], [style*="minmax(240px, 1fr)"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  /* títulos grandes */
  [style*="font-size: 68px"] { font-size: 40px !important; line-height: 1.08 !important; }
  [style*="font-size: 56px"] { font-size: 38px !important; line-height: 1.1 !important; }
  [style*="font-size: 52px"] { font-size: 34px !important; line-height: 1.1 !important; }
  [style*="font-size: 50px"] { font-size: 32px !important; line-height: 1.1 !important; }
  [style*="font-size: 40px"] { font-size: 30px !important; }
  [style*="font-size: 36px"] { font-size: 28px !important; }
  [style*="font-size: 34px"] { font-size: 26px !important; }

  /* espaços internos grandes */
  [style*="padding: 56px 48px"], [style*="padding: 48px 56px"], [style*="padding: 36px 56px"] { padding: 26px 18px !important; }
  [style*="padding: 32px;"] { padding: 20px !important; }

  /* tabela de preços: rola de lado dentro do cartão, sem empurrar a página */
  :has(> [style*="min-width: 640px"]) { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }

  /* entrar: o formulário vem primeiro */
  [style*="grid-template-columns: 1fr 520px"] > :last-child { order: -1; }

  /* espaço de trabalho: painéis um embaixo do outro */
  [data-screen-label="Workspace PandaXBrain"] { min-width: 0 !important; height: auto !important; min-height: 100vh; overflow: visible !important; }
  [data-screen-label="Workspace PandaXBrain"] > header { flex-wrap: wrap !important; gap: 10px !important; }
  [data-screen-label="Workspace PandaXBrain"] > header > nav { order: 9; width: 100%; margin-left: 0 !important; overflow-x: auto; gap: 16px !important; }
  [data-screen-label="Workspace PandaXBrain"] > div { flex-direction: column !important; min-height: 0 !important; }
  [data-screen-label="Configuração da conversão"], [data-screen-label="Meus ativos"] {
    width: 100% !important; border-left: 0 !important; border-right: 0 !important; overflow-y: visible !important; max-height: none !important;
  }
  [data-screen-label="Viewport 3D"] { min-height: 58vh; flex: none !important; }
  [data-screen-label="Minha conta"] > div { border-radius: 18px !important; }
}
