:root {
  --ceu-cima: #8CC8EE;
  --ceu-baixo: #BFE3F5;
  --tinta: #1D2433;
  --tinta-2: #4B5568;
  --papel: #FFFFFF;
  --papel-2: #F4F6FA;
  --amarelo: #FFD23F;
  --rosa: #F26BC6;
  --borda: rgba(29, 36, 51, 0.12);
  --sombra: 0 8px 28px rgba(20, 30, 60, 0.18);
  --raio: 18px;
  --margem: 16px;
}
body.noite {
  --ceu-cima: #0B1430;
  --ceu-baixo: #1B2A55;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--tinta);
  background: linear-gradient(var(--ceu-cima), var(--ceu-baixo));
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
button { font: inherit; cursor: pointer; }

#cena { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }

/* @ em cima das casas */
#etiquetas { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.etiqueta {
  position: absolute; left: 0; top: 0;
  padding: 2px 7px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.92); color: var(--tinta);
  font-size: 11px; font-weight: 700; white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  transform: translate(-50%, -100%);
  will-change: transform;
}
.etiqueta.achada { background: var(--amarelo); font-size: 17px; padding: 6px 13px; z-index: 2; border: 2px solid #1E1E32; }

/* topo: marca e busca */
#topo {
  position: fixed; top: 0; left: 0; right: 0;
  padding: calc(env(safe-area-inset-top) + 12px) var(--margem) 0;
  display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap;
  pointer-events: none;
}
#topo > * { pointer-events: auto; }
.marca {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, 0.9); border-radius: var(--raio); padding: 6px 14px 6px 6px;
  box-shadow: var(--sombra); max-width: 100%;
}
.marca img { border-radius: 12px; display: block; }
.marca h1 { margin: 0; font-size: 18px; line-height: 1.1; font-weight: 800; letter-spacing: -0.01em; }
.marca p { margin: 2px 0 0; font-size: 12px; color: var(--tinta-2); font-weight: 600; }

/* embaixo: a busca, perto do polegar (Cleber, 24/nov: "o achar pode ir pra baixo e não lá em cima") */
#baixo {
  position: fixed; left: var(--margem); right: var(--margem);
  bottom: calc(env(safe-area-inset-bottom) + 14px);
  display: flex; justify-content: center; pointer-events: none;
}
#baixo > * { pointer-events: auto; }
#busca {
  position: relative; flex: 1 1 auto; max-width: 520px;
  display: flex; align-items: center; gap: 4px;
  background: var(--papel); border-radius: var(--raio); padding: 6px 6px 6px 14px; box-shadow: var(--sombra);
}
.arroba { font-weight: 800; color: var(--tinta-2); }
#campo {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 16px; padding: 8px 2px; color: var(--tinta);
}
#campo::-webkit-search-cancel-button { display: none; }
#busca button {
  border: 0; border-radius: 12px; padding: 10px 14px; font-weight: 800;
  background: var(--tinta); color: var(--papel);
}
#sugestoes {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 6px);
  margin: 0; padding: 6px; list-style: none;
  background: var(--papel); border-radius: 14px; box-shadow: var(--sombra);
  max-height: 50vh; overflow: auto;
}
#sugestoes li { padding: 10px 12px; border-radius: 10px; font-weight: 700; cursor: pointer; }
#sugestoes li span { color: var(--tinta-2); font-weight: 500; font-size: 13px; margin-left: 6px; }
#sugestoes li:hover, #sugestoes li[aria-selected="true"] { background: var(--papel-2); }

/* cartão da casa */
#cartao {
  position: fixed; left: var(--margem); right: var(--margem);
  bottom: calc(env(safe-area-inset-bottom) + 84px);   /* logo acima da busca */
  max-width: 520px; margin: 0 auto;
  background: var(--papel); border-radius: 22px; box-shadow: var(--sombra);
  padding: 18px 18px 16px;
  animation: sobe 0.28s ease-out;
}
@keyframes sobe { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
#fechar {
  position: absolute; top: 8px; right: 10px; width: 36px; height: 36px;
  border: 0; border-radius: 50%; background: var(--papel-2); font-size: 22px; line-height: 1; color: var(--tinta-2);
}
#cartao h2 { margin: 0 44px 6px 0; font-size: 20px; overflow-wrap: anywhere; }
.nivel { display: flex; align-items: center; gap: 8px; margin: 4px 0 10px; font-weight: 700; color: var(--tinta-2); font-size: 14px; flex-wrap: wrap; }
.degraus { display: inline-flex; gap: 3px; }
.degraus i { width: 14px; height: 8px; border-radius: 3px; background: #E3E7EF; display: block; }
.degraus i.ok { background: var(--amarelo); }
.pedido { margin: 0 0 8px; font-size: 15px; line-height: 1.35; }
.pedido b { color: var(--tinta-2); font-weight: 600; }
.info { margin: 0 0 12px; font-size: 13px; color: var(--tinta-2); line-height: 1.4; }
.chamada {
  display: block; text-align: center; text-decoration: none;
  background: linear-gradient(90deg, #F26BC6, #9B4FDB); color: #fff;
  font-weight: 800; border-radius: 14px; padding: 13px 14px; font-size: 15px;
}
.aviso { background: #FFF5D6; border-radius: 12px; padding: 10px 12px; font-size: 14px; margin: 0 0 12px; line-height: 1.35; }

/* botões (noite e cidade toda): no topo, à direita da marca */
#botoes {
  margin-left: auto; display: flex; gap: 8px;
}
#botoes button {
  border: 0; border-radius: 999px; padding: 10px 14px;
  background: rgba(255, 255, 255, 0.92); box-shadow: var(--sombra); font-weight: 800; color: var(--tinta);
}
#noite { width: 46px; padding: 11px 0 !important; font-size: 18px; }

/* carregando */
#carregando {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: linear-gradient(#8CC8EE, #BFE3F5); transition: opacity 0.5s; z-index: 10;
}
#carregando img { border-radius: 20px; box-shadow: var(--sombra); }
#carregando p { margin: 0; font-weight: 800; font-size: 17px; }
.barra { width: min(240px, 70vw); height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.6); overflow: hidden; }
#progresso { display: block; height: 100%; width: 0; background: var(--tinta); border-radius: 99px; transition: width 0.2s; }
#carregando.fora { opacity: 0; pointer-events: none; }

/* gravação do Reel (?gravar=1): sem os botões de baixo e o cartão mais alto (embaixo fica o texto do Reels) */
body.gravando #botoes { display: none; }
body.gravando #baixo { bottom: 22px; }      /* quase no pé, como no celular (Cleber, 24/nov) */
body.gravando #cartao { bottom: 134px; }
body.gravando #cartao .info { display: none; }   /* cartão compacto no vídeo: a casa aparece no espaço de baixo */

@media (max-width: 640px) {
  #topo { gap: 8px; }
  .marca { padding: 4px 12px 4px 4px; }
  .marca img { width: 34px; height: 34px; }
  .marca h1 { font-size: 16px; }
  #tudo { padding: 9px 12px !important; font-size: 13px; }
  #cartao { bottom: calc(env(safe-area-inset-bottom) + 80px); }
  /* cartão enxuto no celular (Cleber, 24/nov: "diminui o cartão no mobile, tá muito grande") */
  #cartao { padding: 12px 14px 10px; border-radius: 18px; }
  #cartao h2 { font-size: 17px; margin: 0 40px 2px 0; }
  #fechar { width: 30px; height: 30px; font-size: 19px; top: 6px; right: 8px; }
  .nivel { font-size: 12.5px; margin: 2px 0 6px; gap: 6px; }
  .degraus i { width: 11px; height: 6px; }
  .pedido { font-size: 13.5px; margin: 0 0 8px; line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .info { display: none; }
  .aviso { font-size: 12.5px; padding: 7px 10px; margin: 0 0 8px; }
  .chamada { padding: 9px 12px; font-size: 13.5px; border-radius: 12px; }
}
