/* Tela de autenticação (ver js/autenticacao.js) */
#tela-autenticacao {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  /* o brilho acompanha a mesma cor do anel (amarelo -> verde), não a cor "Destaque" fixa */
  background:
    radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--auth-anel-cor, var(--auth-destaque)) 22%, transparent), transparent 55%),
    var(--auth-fundo);
  opacity: 0;
  transition: opacity .45s var(--ease-out);
}
/* a classe é ligada pelo JS um instante depois de montar a tela — funciona em qualquer navegador,
   diferente do recurso novo @starting-style, que browser antigo não tem. */
#tela-autenticacao.visivel { opacity: 1; }
#tela-autenticacao.saindo { opacity: 0; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  #tela-autenticacao, .auth-anel { transition-duration: .01ms; }
}

/* Card editável acima do cadeado */
.auth-card {
  box-sizing: border-box;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  font: 600 16px/1.5 Inter, system-ui, sans-serif;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.auth-card img { display: block; max-width: 100%; margin: 0 auto; object-fit: contain; }
.auth-card.com-fade { opacity: 0; transform: translateY(8px); transition: opacity .8s ease, transform .8s ease; }
.auth-card.com-fade.visivel { opacity: 1; transform: none; }

/* Ícone do cadeado: pequeno, 1 cor só (verde), com sombra leve — não é botão, só decoração ao lado do texto */
.icone-cadeado {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: inherit; /* acompanha a cor do texto do card, não uma cor fixa */
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .35));
}
.icone-cadeado-argola { fill: none; stroke: currentColor; stroke-width: 4; stroke-linecap: round; }
.icone-cadeado-corpo { fill: currentColor; }

/* posição "rodape": fixo embaixo da tela, 100px da base, independente do cadeado */
.auth-card--rodape { position: absolute; left: 0; right: 0; bottom: 100px; margin: 0 auto; }

/* Cadeado/logo 70% menor (pedido do dono): 240px -> 72px, mantendo as proporções entre as peças. */
.auth-palco { flex-shrink: 0; position: relative; width: 72px; height: 72px; display: grid; place-items: center; }
.auth-palco > * { position: absolute; }
.auth-palco canvas, .auth-custom { width: 60px; height: 60px; }
.auth-palco canvas, .auth-plano, .auth-custom { transition: opacity .25s ease, transform .35s ease; }
.auth-palco.aberto canvas, .auth-palco.aberto .auth-plano, .auth-palco.aberto .auth-custom { opacity: 0; transform: scale(.92); }

.auth-anel {
  width: 83px;
  height: 83px;
  transform: rotate(-90deg);
  fill: none;
  opacity: 0;
  transition: opacity .4s var(--ease-out);
}
/* entra com fade igual sai: mostra e depois apaga, como uma máscara (classe ligada pelo JS) */
.auth-anel.visivel { opacity: 1; }
.auth-palco.aberto .auth-anel { opacity: 0; }
.auth-trilho { stroke: rgba(255, 255, 255, .1); stroke-width: 1.2; }
.auth-progresso {
  /* a cor vem do JS (autenticacao.js): amarelo carregando -> verde liberado, sempre (não segue "Destaque") */
  stroke: var(--auth-anel-cor, var(--auth-destaque));
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
}
.auth-palco.aberto .auth-progresso { stroke: #34d399; }

.auth-plano { overflow: visible; width: 39px; height: 39px; color: #dfe5ee; opacity: var(--auth-leitura, 1); transition: color .3s ease; }
.auth-argola { fill: none; stroke: currentColor; stroke-width: 3.6; stroke-linecap: round; }
.auth-corpo { fill: currentColor; }
.auth-palco.aberto .auth-plano { opacity: 0; }
/* Acesso liberado: o cadeado também fica verde (igual o texto e o anel), antes de sumir ao abrir */
#tela-autenticacao[data-fase="liberacao"] .auth-plano { color: #34d399; }
#tela-autenticacao.fundo-claro[data-fase="liberacao"] .auth-plano { color: #047857; }

.auth-check {
  width: 36px;
  height: 36px;
  fill: none;
  stroke: #34d399;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* opacidade 0 até abrir: a ponta arredondada do traço apareceria como um ponto */
.auth-check path { opacity: 0; stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset .35s ease .1s; }
.auth-palco.aberto .auth-check path { opacity: 1; stroke-dashoffset: 0; }

.auth-texto {
  min-height: 1.4em;
  color: rgba(255, 255, 255, .88);
  font: 500 13px/1.4 Inter, system-ui, sans-serif;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-align: center;
  padding: 0 16px;
}
#tela-autenticacao[data-fase="verificacao"] .auth-texto {
  color: #f5b301;
  animation: auth-pulso 1s ease-in-out infinite;
}
#tela-autenticacao[data-fase="liberacao"] .auth-texto { color: #34d399; font-weight: 700; }

@keyframes auth-pulso {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}
@media (prefers-reduced-motion: reduce) {
  #tela-autenticacao[data-fase="verificacao"] .auth-texto { animation: none; }
}

/* Opção "uma cor só": a cor escolhida vale apenas para o cadeado */
.uma-cor .auth-plano { color: var(--auth-cadeado); }

/* Fundo claro: texto e trilho escurecem; o verde de status fica mais fechado */
.fundo-claro .auth-trilho { stroke: rgba(0, 0, 0, .12); }
.fundo-claro .auth-texto { color: rgba(0, 0, 0, .75); }
.fundo-claro .auth-palco.aberto .auth-progresso, .fundo-claro .auth-check { stroke: #047857; }
#tela-autenticacao.fundo-claro[data-fase="verificacao"] .auth-texto { color: #b45309; }
#tela-autenticacao.fundo-claro[data-fase="liberacao"] .auth-texto { color: #047857; font-weight: 700; }
.fundo-claro .auth-plano { color: #475569; }
.fundo-claro.uma-cor .auth-plano { color: var(--auth-cadeado); }
