/* V14.66 — portão mobile (ca-mobile-gate-v1466.js): só horizontal + tela cheia.
   Reaproveita o cobertor #ca-v9931-rotate (V9.9.31); o fundo e o "display" base estão no <style> do index.html. */

/* Enquanto o script ainda não decidiu (celular): nada do jogo aparece — evita piscar o login na vertical. */
html[data-ca-gate="pending"]{background:#164b80!important}
html[data-ca-gate="pending"] body>*:not(#ca-v9931-rotate):not(script):not(style){visibility:hidden!important}

/* Portão ligado: o jogo inteiro (login incluído) fica escondido e sem foco/toque por baixo. */
body.ca-mobile-gated{overflow:hidden!important}
body.ca-mobile-gated>*:not(#ca-v9931-rotate):not(#ca-gate-toast):not(script):not(style){visibility:hidden!important;pointer-events:none!important}
body.ca-mobile-gated #ca-v9931-rotate{visibility:visible!important}

html body #ca-v9931-rotate{
  flex-direction:column;align-items:center;justify-content:center;gap:10px;
  padding:max(10px,env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) max(10px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left));
  box-sizing:border-box;overflow:hidden;touch-action:manipulation;-webkit-tap-highlight-color:transparent;
  font-family:inherit;
}
html body #ca-v9931-rotate .cag-card{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:clamp(6px,1.6vh,12px);max-width:100%;max-height:100%;text-align:center}
html body #ca-v9931-rotate .cag-art,
html body #ca-v9931-rotate .cag-logo{user-select:none;-webkit-user-select:none;pointer-events:none}

/* Botão dourado */
html body #ca-v9931-rotate .cag-btn{
  appearance:none;-webkit-appearance:none;cursor:pointer;
  min-height:52px;padding:10px clamp(22px,6vw,44px);border:3px solid #fff3b0;border-radius:999px;
  background:linear-gradient(180deg,#ffd75e,#f2a30f);color:#3a2300;
  font-weight:900;font-size:clamp(17px,4.6vw,24px);line-height:1.1;font-family:inherit;letter-spacing:.2px;
  box-shadow:0 6px 0 #b9730a,0 10px 22px #041d4466;
  transition:transform .08s ease,box-shadow .08s ease;
}
html body #ca-v9931-rotate .cag-btn:active{transform:translateY(4px);box-shadow:0 2px 0 #b9730a,0 4px 12px #041d4466}
html body #ca-v9931-rotate .cag-btn[hidden]{display:none!important}
html body #ca-v9931-rotate .cag-hint{margin:0;max-width:min(92vw,520px);color:#fff;font-weight:700;font-size:clamp(12px,3.4vw,15px);line-height:1.3;font-family:inherit;text-shadow:0 1px 3px #041d44cc}
html body #ca-v9931-rotate .cag-hint:empty{display:none}

/* Em pé: a arte "Vire para a aventura!" + botão */
html body #ca-v9931-rotate[data-mode="rotate"] .cag-art{display:block;max-width:min(88vw,460px);max-height:58vh;width:auto;height:auto;object-fit:contain;filter:drop-shadow(0 10px 28px #041d4488)}
html body #ca-v9931-rotate[data-mode="rotate"] .cag-logo,
html body #ca-v9931-rotate[data-mode="rotate"] .cag-title{display:none}

/* Deitado, fora da tela cheia: cartão com logo + "Toque para jogar" */
html body #ca-v9931-rotate[data-mode="fullscreen"] .cag-art{display:none}
html body #ca-v9931-rotate[data-mode="fullscreen"] .cag-card{
  width:min(88vw,560px);padding:clamp(8px,2.4vh,18px) clamp(14px,3vw,28px);box-sizing:border-box;
  background:linear-gradient(180deg,#143a73,#0c2550);border:4px solid #f6c343;border-radius:24px;
  box-shadow:0 0 0 3px #0a1f45,0 14px 36px #041d4499,inset 0 0 0 2px #ffffff22;
}
html body #ca-v9931-rotate[data-mode="fullscreen"] .cag-logo{display:block;height:clamp(40px,22vh,120px);width:auto;max-width:90%;object-fit:contain;filter:drop-shadow(0 4px 8px #0006)}
html body #ca-v9931-rotate[data-mode="fullscreen"] .cag-title{display:block;margin:0;color:#fff3b0;font-weight:900;font-size:clamp(15px,5.4vh,26px);line-height:1.15;font-family:inherit;text-shadow:0 2px 0 #0a1f45}
html body #ca-v9931-rotate[data-mode="fullscreen"] .cag-btn{min-height:clamp(40px,13vh,56px);font-size:clamp(15px,5vh,24px)}
html body #ca-v9931-rotate[data-mode="fullscreen"] .cag-hint{font-size:clamp(11px,3.6vh,15px)}

/* Aviso quando o navegador não liberou a tela cheia */
#ca-gate-toast{position:fixed;left:50%;bottom:max(10px,env(safe-area-inset-bottom));transform:translateX(-50%);z-index:2147483646;max-width:min(92vw,560px);padding:8px 14px;border-radius:14px;background:#0c2550ee;color:#fff;border:2px solid #f6c343;font:700 13px/1.3 system-ui,sans-serif;text-align:center;display:none;pointer-events:none}
#ca-gate-toast[data-show="true"]{display:block}

/* ---- Login na horizontal (V14.67): o jogo agora abre SEMPRE deitado, mesmo com a janela baixa (~295 px quando o
   navegador mostra barra de título/URL). Layout em duas colunas: logo à esquerda, formulário à direita, tudo sem rolar.
   Só vale em tela de toque deitada e baixa — computador e celular em pé (que o portão bloqueia) não mudam. ---- */
@media (pointer:coarse) and (orientation:landscape) and (max-height:520px){
  html body:has(#login:not(.hidden)) .wrap{
    display:grid!important;grid-template-columns:minmax(0,35%) minmax(0,1fr)!important;grid-template-rows:auto!important;
    align-items:center!important;align-content:center!important;column-gap:clamp(8px,2vw,18px)!important;row-gap:0!important;
    min-height:100dvh!important;box-sizing:border-box!important;max-width:none!important;margin:0!important;
    padding:max(6px,env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) max(6px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left))!important;
  }
  html body:has(#login:not(.hidden)) .wrap>header.top{
    grid-column:1!important;grid-row:1!important;position:static!important;width:auto!important;min-height:0!important;
    margin:0!important;padding:0!important;background:none!important;border:0!important;box-shadow:none!important;
    display:flex!important;align-items:center!important;justify-content:center!important;
  }
  html body:has(#login:not(.hidden)) .wrap>header.top .brand{display:flex!important;justify-content:center!important;align-items:center!important;width:100%!important;min-height:0!important;margin:0!important;padding:0!important}
  html body:has(#login:not(.hidden)) .wrap>header.top .brand .brand-logo{
    width:min(100%,clamp(150px,42vh,340px))!important;height:auto!important;max-width:100%!important;max-height:none!important;margin:0 auto!important;transform:none!important;
  }
  html body:has(#login:not(.hidden)) .wrap>#login{grid-column:2!important;grid-row:1!important;width:100%!important;max-width:none!important;margin:0!important;padding:0!important;min-width:0}
  html body .wrap>#login>.panel{width:100%!important;max-width:none!important;max-height:none!important;min-height:0!important;height:auto!important;overflow:visible!important;margin:0!important;padding:clamp(6px,2vh,12px) clamp(10px,2vw,18px)!important;box-sizing:border-box!important}
  html body #login .panel>h2{margin:0 0 clamp(2px,1vh,6px)!important;font-size:clamp(15px,5vh,19px)!important;line-height:1.1!important}
  html body #login .ca-login-role-choice{gap:10px!important;margin:0 0 clamp(2px,1vh,6px)!important}
  /* V14.69: a arte dos botões (664×253) NUNCA é esticada — a altura manda e a largura vem da proporção da arte */
  html body #login .ca-login-role-choice{justify-content:center!important;justify-items:center!important;display:flex!important;flex-wrap:nowrap!important}
  html body #login .ca-login-role-choice>button[data-login-mode],
  html body:has(#login:not(.hidden)) #login #loginFields>button.btn{height:var(--ca-lbh,52px)!important;width:auto!important;min-height:0!important;max-height:none!important;min-width:0!important;max-width:none!important;aspect-ratio:664/253!important;padding:0!important;flex:0 0 auto!important}
  html body #login{--ca-lbh:clamp(40px,13.5vh,56px)}
  html body #login #loginFields{display:grid!important;grid-template-columns:minmax(80px,auto) minmax(0,1fr)!important;column-gap:10px!important;row-gap:clamp(3px,1vh,6px)!important;align-items:center!important}
  html body #login #loginFields>label{margin:0!important;text-align:right;font-size:clamp(11px,3.5vh,13px)!important;line-height:1.1!important}
  html body #login #loginFields>:is(select,input){height:clamp(30px,9.5vh,40px)!important;min-height:0!important;padding-top:0!important;padding-bottom:0!important;font-size:clamp(13px,4.2vh,15px)!important;margin:0!important;width:100%!important;box-sizing:border-box!important}
  html body #login #loginFields>:not(label):not(select):not(input):not(button){grid-column:1/-1}
  html body #login #loginFields>p:empty{display:none!important}
  html body:has(#login:not(.hidden)) #login #loginFields>button.btn{grid-column:1/-1;justify-self:center;margin:clamp(2px,1vh,6px) 0 0!important}
}

/* ---- V14.68 — Botão Minimizar / Maximizar tela cheia (canto inferior direito, discreto) ---- */
#ca-gate-fs-toggle{
  position:fixed;right:max(8px,env(safe-area-inset-right));bottom:max(8px,env(safe-area-inset-bottom));z-index:2147483000;
  height:36px;min-width:0;min-height:0;padding:0 14px;margin:0;box-sizing:border-box;white-space:nowrap;
  display:flex;align-items:center;justify-content:center;gap:6px;
  /* V14.69: mesmo estilo do botão dourado de tela cheia do portão, com texto */
  border:2px solid #fff3b0;border-radius:999px;background:linear-gradient(180deg,#ffd75e,#f2a30f);color:#3a2300;
  font:900 13px/1 system-ui,sans-serif;letter-spacing:.2px;cursor:pointer;opacity:.9;
  box-shadow:0 3px 0 #b9730a,0 5px 12px #041d4466;touch-action:manipulation;-webkit-tap-highlight-color:transparent;
  transition:opacity .15s ease,transform .08s ease,box-shadow .08s ease;
}
#ca-gate-fs-toggle:hover,#ca-gate-fs-toggle:focus-visible,#ca-gate-fs-toggle:active{opacity:1}
#ca-gate-fs-toggle:active{transform:translateY(3px);box-shadow:0 0 0 #b9730a,0 2px 8px #041d4466}
#ca-gate-fs-toggle[hidden]{display:none!important}
/* só celular/tablet de toque, e fora de janelas por cima do jogo (vídeo do tutorial) */
@media not all and (pointer:coarse){#ca-gate-fs-toggle{display:none!important}}
html body.ca-tvid-open #ca-gate-fs-toggle{display:none!important}

/* ---- Login com a tela MUITO baixa (teclado aberto em tela cheia deixa ~200 px): tudo compacto, o Entrar continua à vista ---- */
@media (pointer:coarse) and (orientation:landscape) and (max-height:300px){
  html body .wrap>#login>.panel{padding:4px 10px!important}
  html body #login .panel>h2{display:none!important}
  html body #login .ca-login-role-choice{gap:8px!important;margin:0 0 3px!important}
  html body #login{--ca-lbh:40px}
  html body #login #loginFields{row-gap:3px!important}
  html body #login #loginFields>label{font-size:10px!important}
  html body #login #loginFields>:is(select,input){height:26px!important;font-size:12px!important}
  html body #login #loginFields>p{margin:0!important;padding:0!important;min-height:0!important;font-size:10px!important;line-height:1.1!important}
  html body:has(#login:not(.hidden)) #login #loginFields>button.btn{margin:2px 0 0!important}
}
/* V14.69: janela MUITO baixa (teclado aberto em tela cheia): botões de arte menores, na mesma proporção, para o Entrar continuar à vista */
@media (pointer:coarse) and (orientation:landscape) and (max-height:230px){
  html body #login{--ca-lbh:30px}
  html body #login .ca-login-role-choice{gap:6px!important;margin:0 0 2px!important}
}
