/* Acesso ao cardápio (acesso.js; a «entrada» com o vídeo é a entrada.js): o ecrã da senha do restaurante, a escolha da mesa e os ecrãs do telemóvel (QR e GPS).
   Fica por cima de tudo (acima da faixa, z-index 1000, e do ecrã de configuração, 1100). */

/* Sem sessão o cardápio não se vê: fica escondido desde o primeiro desenho (o ecrã de entrada ainda nem
   existe) e só se mostra quando o acesso.js o liberta. Se o acesso.js falhar por completo, ao fim de 5 s o
   cardápio aparece na mesma (nunca fica um ecrã preto para sempre). */
html:not(.acesso-livre):not(.acesso-aberta) .app {
  visibility: hidden;
  animation: acesso-seguranca 0s linear 5s forwards;
}

html.acesso-aberta .app {
  visibility: hidden;
}

@keyframes acesso-seguranca {
  to {
    visibility: visible;
  }
}

.acesso {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  overflow-y: auto;
  background: radial-gradient(120% 90% at 50% 0%, #1d1710 0%, #0c0a08 55%, #050403 100%);
  color: var(--text, #f4efe6);
  user-select: text;
  -webkit-user-select: text;
}

.acesso__caixa {
  display: grid;
  gap: 18px;
  width: min(620px, 100%);
  margin: auto;
  text-align: center;
}

.acesso__logo {
  font-family: var(--serif, Georgia, serif);
  font-size: clamp(36px, 7vw, 56px);
  font-weight: 500;
  letter-spacing: 0.14em;
  line-height: 1.1;
  text-transform: uppercase;
}

.acesso__sub {
  margin-top: -10px;
  color: var(--gold, #d4ae68);
  font-size: 14px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.acesso__titulo {
  margin-top: 10px;
  font-size: clamp(24px, 4vw, 30px);
  font-weight: 600;
  line-height: 1.2;
}

.acesso__intro,
.acesso__estado {
  color: var(--muted, rgba(244, 239, 230, 0.78));
  font-size: 19px;
  line-height: 1.45;
}

.acesso__campo {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  text-align: left;
}

.acesso__rotulo {
  color: var(--text, #f4efe6);
  font-size: 17px;
  font-weight: 600;
}

.acesso__input {
  width: 100%;
  min-height: 64px;
  padding: 0 20px;
  border: 1px solid rgba(244, 239, 230, 0.4);
  border-radius: 14px;
  background: #0a0806;
  color: var(--text, #f4efe6);
  font: inherit;
  font-size: 22px;
}

.acesso__input:focus-visible {
  outline: 3px solid var(--gold, #d4ae68);
  outline-offset: 2px;
}

.acesso__input[aria-invalid="true"] {
  border-color: #ff9d9d;
}

.acesso__erro {
  min-height: 1.4em;
  color: #ffb4b4;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
}

.acesso__botao {
  min-height: 64px;
  padding: 0 32px;
  border: 1px solid rgba(244, 239, 230, 0.4);
  border-radius: 999px;
  font-size: 20px;
  font-weight: 700;
}

.acesso__botao--principal {
  border-color: transparent;
  background: var(--gold, #d4ae68);
  color: #140f06;
}

.acesso__botao--secundario {
  background: transparent;
  color: var(--text, #f4efe6);
}

/* O que se quer que o cliente leia (ecrã «A sessão terminou»). */
.acesso__destaque {
  color: var(--text, #f4efe6);
  font-size: clamp(22px, 5vw, 28px);
  font-weight: 600;
  line-height: 1.35;
}

/* Ação discreta para a equipa: parece uma ligação, mas tem 48 px de toque. */
.acesso__ligacao {
  min-height: 48px;
  padding: 0 16px;
  color: var(--muted, rgba(244, 239, 230, 0.78));
  font-size: 16px;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.acesso__botao:disabled,
.acesso__mesa:disabled {
  opacity: 0.55;
  cursor: default;
}

.acesso__botao:focus-visible,
.acesso__mesa:focus-visible {
  outline: 3px solid var(--gold, #d4ae68);
  outline-offset: 3px;
}

/* Escolher a mesa (V616): botões GRANDES (96 px de altura, número a 34 px), quatro por linha no tablet em pé, e a última linha ao centro. */
.acesso__mesas {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

.acesso__mesa {
  flex: 0 0 calc((100% - 42px) / 4);
  min-height: 96px;
  padding: 0 10px;
  border: 2px solid rgba(212, 174, 104, 0.6);
  border-radius: 18px;
  background: var(--surface, #141210);
  color: var(--text, #f4efe6);
  font-size: 34px;
  font-weight: 700;
  line-height: 1.1;
}

.acesso__mesa:active {
  background: rgba(212, 174, 104, 0.2);
}

@media (max-width: 700px) {
  .acesso__mesa {
    flex-basis: calc((100% - 28px) / 3);
    min-height: 88px;
    font-size: 30px;
  }
}

@media (max-width: 420px) {
  .acesso__mesa {
    flex-basis: calc((100% - 14px) / 2);
  }
}

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

/* Escolher a mesa: a caixa alarga para os 11 botões grandes caberem em 3 linhas. */
.acesso[data-tela="mesa"] .acesso__caixa {
  width: min(760px, 100%);
}

/* V633: mesa que já tem tablet: cinzento, com «ocupada», e não se deixa escolher. */
.acesso__mesa {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
}

.acesso__mesa-nota {
  display: block;
  font-size: 0.5em;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.acesso__mesa--ocupada,
.acesso__mesa--ocupada:disabled {
  background: #1f1c19;
  border-color: rgba(244, 239, 230, 0.14);
  color: rgba(244, 239, 230, 0.5);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 1;
}

/* V660: a versão da web, discreta, só no ecrã de escolher a mesa (pessoal). */
.acesso__versao {
  margin: 14px 0 0;
  font-size: 11px;
  line-height: 1.3;
  color: #8d8579;
  opacity: 0.8;
  text-align: center;
  user-select: none;
}

/* V673: mesa ocupada que se pode substituir (ainda cinzenta, mas toca-se) e o tempo sem sinal do tablet antigo. */
.acesso__mesa--substituivel,
.acesso__mesa--substituivel:disabled {
  cursor: pointer;
  border-style: dashed;
  border-color: rgba(212, 174, 104, 0.4);
  color: rgba(244, 239, 230, 0.7);
}

.acesso__mesa-nota--sinal {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  text-wrap: balance;
  color: #e8b667;
}

/* Substituir / à espera: o nome da mesa em destaque. */
.acesso__mesa-titulo {
  margin: 0;
  text-align: center;
  font-size: 34px;
  font-weight: 700;
  color: var(--gold, #d4ae68);
}
