/* ========================================================= */
/* TEMA AUTOMÁTICO: CÉU DE DIA (6h–18h) & MODO NOITE (18h–6h) */
/* ========================================================= */
:root {
  --c-paper: 238 246 253;      /* azul-nuvem bem suave */
  --c-ivory: 255 255 255;      /* branco limpo */
  --c-sand: 207 227 242;       /* borda céu claro */
  --c-sand-dark: 148 184 212;
  --c-mata: 14 116 144;        /* azul-mar / turquesa do litoral */
  --c-mata-dark: 11 91 114;
  --c-mata-light: 224 244 249;
  --c-duna: 217 119 6;         /* âmbar solar */
  --c-duna-dark: 146 64 14;    /* texto âmbar legível sobre o duna-light (avisos de atenção) */
  --c-duna-light: 254 246 230;
  --c-baia: 29 78 216;         /* azul-oceano */
  --c-baia-light: 235 243 255;
  --c-basalto: 15 23 42;       /* texto principal nítido */
  --c-ardosia: 71 85 105;      /* texto secundário suave */

  /* Cor dos pontos do mapa por status do abrigo (UI.SHELTER_STYLES). Vêm do mata, baia, duna e
     ardosia do tema claro e NÃO mudam no tema escuro: o fundo do mapa é sempre claro. */
  --c-abrigo-excelente: 14 116 144;
  --c-abrigo-bom: 29 78 216;
  --c-abrigo-atencao: 217 119 6;
  --c-abrigo-neutro: 71 85 105;
}

html.dark {
  --c-paper: 15 26 46;         /* azul-noite profundo */
  --c-ivory: 22 35 60;         /* cartões noturnos */
  --c-sand: 42 61 94;          /* bordas noturnas */
  --c-sand-dark: 68 92 132;
  --c-mata: 14 165 233;        /* azul-céu luminoso */
  --c-mata-dark: 125 211 252;
  --c-mata-light: 16 48 76;
  --c-duna: 245 158 11;        /* âmbar lunar */
  --c-duna-dark: 253 230 138;
  --c-duna-light: 54 38 14;
  --c-baia: 96 165 250;
  --c-baia-light: 21 40 72;
  --c-basalto: 241 245 249;    /* texto claro */
  --c-ardosia: 148 163 184;    /* texto secundário claro */
}

body {
  background-color: #EFF7FD;
  background-image: linear-gradient(180deg, #D9EEFC 0%, #EEF7FE 38%, #F8FBFF 100%);
  background-attachment: fixed;
  color: rgb(var(--c-basalto));
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: background-color 0.25s ease, color 0.25s ease;
}

html.dark body {
  background-color: #091324;
  background-image:
    radial-gradient(circle at 18% 12%, rgba(56, 189, 248, 0.12), transparent 36%),
    radial-gradient(circle at 82% 8%, rgba(99, 102, 241, 0.10), transparent 34%),
    linear-gradient(180deg, #070E1C 0%, #0B1528 48%, #0F1C33 100%);
}

/* Ajustes finos de contraste para alertas e selos no modo noite */
html.dark select option {
  background-color: #0F1A2E;
  color: #F1F5F9;
}
html.dark .bg-amber-50,
html.dark .bg-amber-100 {
  background-color: rgba(180, 83, 9, 0.22) !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
}
html.dark .text-amber-900 {
  color: #FDE68A !important;
}
html.dark .bg-emerald-100 {
  background-color: rgba(16, 185, 129, 0.2) !important;
}
html.dark .text-emerald-800 {
  color: #6EE7B7 !important;
}
html.dark .bg-sky-100 {
  background-color: rgba(14, 165, 233, 0.22) !important;
}
html.dark .text-sky-800 {
  color: #7DD3FC !important;
}
html.dark .bg-rose-100 {
  background-color: rgba(244, 63, 94, 0.22) !important;
}
html.dark .text-rose-800 {
  color: #FDA4AF !important;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgb(var(--c-paper));
}
::-webkit-scrollbar-thumb {
  background: rgb(var(--c-sand-dark));
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgb(var(--c-mata));
}

.leaflet-popup-content-wrapper {
  background: rgb(var(--c-ivory)) !important;
  color: rgb(var(--c-basalto)) !important;
  border: 1px solid rgb(var(--c-sand)) !important;
  border-radius: 12px !important;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.18) !important;
  padding: 0 !important;
  overflow: hidden;
}
.leaflet-popup-tip {
  background: rgb(var(--c-ivory)) !important;
}
.leaflet-popup-content {
  margin: 0 !important;
  width: 260px !important;
}
.leaflet-container {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: rgb(var(--c-paper));
}

/* O Leaflet usa camadas com z-index 400 a 1000. "isolation: isolate" prende essas camadas
   dentro do mapa, para que as janelas do app (z-50) e o cabeçalho fixo fiquem sempre por cima. */
#leaflet-map {
  isolation: isolate;
  z-index: 0;
}

/* Pontos do mapa: área de toque invisível de 28px com o ponto colorido (cor do vento) e o
   desenho branco do tipo de lugar no centro. */
.marker-hit {
  display: flex;
  align-items: center;
  justify-content: center;
}
.marker-hit:hover {
  z-index: 9999 !important;
}
.custom-marker {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1.5px solid #fff;
  box-shadow: 0 1px 3px rgba(28, 38, 35, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, width 0.2s ease, height 0.2s ease;
}
.custom-marker svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.zoom-longe .custom-marker {
  width: 16px;
  height: 16px;
  border-width: 1px;
}
.zoom-longe .custom-marker svg {
  width: 10px;
  height: 10px;
  stroke-width: 2.8;
}
.zoom-perto .custom-marker {
  width: 26px;
  height: 26px;
}
.zoom-perto .custom-marker svg {
  width: 16px;
  height: 16px;
}
.marker-hit:hover .custom-marker {
  transform: scale(1.4);
}

/* ========================================================= */
/* ESTRUTURA DO APP NO CELULAR (passo 4b, tela S01)           */
/* ========================================================= */
/* Até 767 px: barra curta em cima, navegação embaixo (#nav-inferior) e folhas que sobem de baixo.
   A partir de 768 px vale o layout de site, com as abas no topo. As margens "env(safe-area-inset-*)"
   deixam o app fora da barra de status e da barra de gestos do celular. */
.app-corpo {
  padding-bottom: calc(4rem + env(safe-area-inset-bottom) + 1.5rem);
}
.app-topo {
  padding-top: env(safe-area-inset-top);
}
@media (min-width: 768px) {
  .app-corpo {
    padding-bottom: 3rem;
  }
}

/* Navegação de baixo: a aba aberta fica na cor "mata", com a pílula clara atrás do desenho */
.nav-inferior {
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
.nav-item {
  -webkit-tap-highlight-color: transparent;
  transition: color 150ms ease;
}
.nav-indicador {
  transition: background-color 200ms ease;
}
.nav-item[aria-current="page"] {
  color: rgb(var(--c-mata));
}
.nav-item[aria-current="page"] .nav-indicador {
  background-color: rgb(var(--c-mata-light));
}
.nav-item:active .nav-indicador {
  background-color: rgb(var(--c-sand) / 0.6);
}
.nav-item:focus-visible .nav-indicador {
  box-shadow: 0 0 0 2px rgb(var(--c-mata));
}

/* Avisos curtos (toast): no celular, centralizados acima da navegação de baixo */
.toast-area {
  left: 1rem;
  right: 1rem;
  bottom: calc(4rem + env(safe-area-inset-bottom) + 0.75rem);
  align-items: center;
}
@media (min-width: 768px) {
  .toast-area {
    left: auto;
    right: 1rem;
    bottom: 1rem;
    align-items: flex-end;
  }
}
/* O aviso é um "popover" (para ficar por cima da ficha aberta): tira o jeito de caixa que o navegador dá */
.toast-area[popover] {
  top: auto;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  overflow: visible;
}

/* Folhas (js/telas/folhas.js): sobem de baixo no celular; no computador, janela centralizada */
dialog.folha {
  margin: auto 0 0;
  padding: 0;
  border: 0;
  width: 100%;
  max-width: 100%;
  max-height: 92vh;
  max-height: 92dvh;
  background: transparent;
  color: inherit;
  overflow: visible;
}
dialog.folha::backdrop {
  background: rgb(15 23 42 / 0.45);
}
html.dark dialog.folha::backdrop {
  background: rgb(2 6 23 / 0.62);
}
.folha-corpo {
  max-height: 92vh;
  max-height: 92dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 1.5rem 1.5rem 0 0;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -10px 30px -12px rgb(15 23 42 / 0.35);
  transition: transform 200ms cubic-bezier(0.4, 0, 1, 1), opacity 200ms ease-in;
}
.folha-topo {
  touch-action: none;
  cursor: grab;
}
dialog.folha[open] .folha-corpo {
  animation: folha-sobe 260ms cubic-bezier(0.16, 1, 0.3, 1);
}
dialog.folha[open]::backdrop {
  animation: folha-fundo 200ms ease-out;
}
dialog.folha.folha-saindo .folha-corpo {
  transform: translateY(100%);
}
dialog.folha.folha-saindo::backdrop {
  opacity: 0;
  transition: opacity 200ms ease-in;
}
@keyframes folha-sobe {
  from { transform: translateY(100%); }
}
@keyframes folha-fundo {
  from { opacity: 0; }
}
@keyframes folha-aparece {
  from { opacity: 0; transform: translateY(12px); }
}
/* Com uma folha aberta, a página de trás não rola */
html:has(dialog.folha[open]) {
  overflow: hidden;
}
@media (min-width: 768px) {
  dialog.folha {
    margin: auto;
    max-width: 28rem;
  }
  .folha-corpo {
    border-radius: 1.5rem;
    padding-bottom: 0;
    box-shadow: 0 24px 60px -20px rgb(15 23 42 / 0.45);
  }
  .folha-topo {
    touch-action: auto;
    cursor: auto;
  }
  .folha-alca {
    display: none;
  }
  dialog.folha[open] .folha-corpo {
    animation-name: folha-aparece;
  }
  dialog.folha.folha-saindo .folha-corpo {
    transform: translateY(12px);
    opacity: 0;
  }
}

/* Tema na folha "Ajustes": a opção escolhida fica destacada */
.tema-opcao {
  transition: background-color 150ms ease, color 150ms ease;
}
.tema-opcao[aria-pressed="true"] {
  background-color: rgb(var(--c-ivory));
  color: rgb(var(--c-mata));
  box-shadow: 0 1px 3px rgb(15 23 42 / 0.14);
}

/* ========================================================= */
/* FICHA DO LUGAR (passo 4b, tela S05)                         */
/* ========================================================= */
/* No celular a ficha (<dialog class="folha folha-ficha">) ocupa a tela toda; a partir de 768 px é uma
   janela centralizada. A foto rola junto com o texto; as abas grudam embaixo da barra de cima, que fica
   opaca com o nome do lugar quando a foto sai da tela (UI.atualizarBarraFicha liga as classes
   "ficha-rolou" e "ficha-barra-cheia"). Os botões de "como chegar" ficam fixos embaixo. */
dialog.folha.folha-ficha {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  max-height: none;
}
.folha-ficha .folha-corpo {
  --ficha-barra: calc(3.5rem + env(safe-area-inset-top));
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: none;
  overflow: hidden;
  border-radius: 0;
  padding-bottom: 0;
  box-shadow: none;
}
.ficha-rolagem {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Barra de cima: transparente sobre a foto (só o "x" recebe toques); opaca depois que a foto sai */
.ficha-barra {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  height: var(--ficha-barra);
  padding: env(safe-area-inset-top) 0.5rem 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
  transition: background-color 150ms ease, box-shadow 150ms ease;
}
.ficha-barra-titulo {
  flex: 1 1 auto;
  min-width: 0;
  opacity: 0;
  transition: opacity 150ms ease;
}
.ficha-fechar {
  pointer-events: auto;
  /* sobre a foto o "x" é sempre claro num círculo escuro, nos dois temas */
  background-color: rgb(2 6 23 / 0.55);
  color: #fff;
  transition: background-color 150ms ease, color 150ms ease;
}
.ficha-fechar:hover {
  background-color: rgb(2 6 23 / 0.75);
}
.folha-ficha.ficha-barra-cheia .ficha-barra {
  background-color: rgb(var(--c-ivory));
  box-shadow: inset 0 -1px 0 rgb(var(--c-sand));
  pointer-events: auto;
}
.folha-ficha.ficha-barra-cheia .ficha-barra-titulo {
  opacity: 1;
}
.folha-ficha.ficha-barra-cheia .ficha-fechar {
  background-color: transparent;
  color: rgb(var(--c-basalto));
}
.folha-ficha.ficha-barra-cheia .ficha-fechar:hover {
  background-color: rgb(var(--c-paper));
}

/* Foto: fundo escuro enquanto carrega e véu escuro para o texto branco, nos dois temas.
   No topo da ficha, dedo para cima rola e dedo para baixo arrasta a ficha (folhas.js);
   depois de rolar, a foto rola nos dois sentidos. */
.ficha-foto {
  flex-shrink: 0;
  height: calc(15rem + env(safe-area-inset-top));
  background-color: rgb(15 23 42);
  -webkit-user-select: none;
  user-select: none;
  touch-action: pan-y;
  touch-action: pan-down;
}
.folha-ficha.ficha-rolou .ficha-foto {
  touch-action: pan-y;
}
.ficha-foto-veu {
  background-image:
    linear-gradient(to top, rgb(2 6 23) 0%, rgb(2 6 23 / 0.35) 50%, rgb(2 6 23 / 0) 100%),
    linear-gradient(to bottom, rgb(2 6 23 / 0.35) 0, rgb(2 6 23 / 0) 5rem);
}
.ficha-foto.ficha-foto-ampliavel {
  cursor: zoom-in;
}
.ficha-ampliar {
  position: absolute;
  top: calc(0.5rem + env(safe-area-inset-top));
  left: 0.75rem;
  z-index: 15;
  background-color: rgb(2 6 23 / 0.55);
  color: #fff;
  transition: background-color 150ms ease;
}
.ficha-ampliar:hover {
  background-color: rgb(2 6 23 / 0.75);
}

/* Visor de foto limpa em tela cheia (#visor-foto): sem texto na frente da imagem */
dialog.visor-foto {
  margin: 0;
  padding: 0;
  border: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: 100vw;
  max-height: 100vh;
  max-height: 100dvh;
  background: transparent;
  overflow: hidden;
}
dialog.visor-foto::backdrop {
  background: rgb(2 6 23 / 0.94);
}
dialog.visor-foto[open] .visor-foto-palco {
  animation: folha-fundo 180ms ease-out;
}
dialog.visor-foto.folha-saindo .visor-foto-palco,
dialog.visor-foto.folha-saindo::backdrop {
  opacity: 0;
  transition: opacity 180ms ease-in;
}
.visor-foto-palco {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(4rem + env(safe-area-inset-top)) 1rem calc(1.5rem + env(safe-area-inset-bottom));
}
.visor-foto-fechar {
  position: absolute;
  top: calc(0.75rem + env(safe-area-inset-top));
  right: 0.75rem;
  background-color: rgb(255 255 255 / 0.16);
  color: #fff;
  transition: background-color 150ms ease;
}
.visor-foto-fechar:hover {
  background-color: rgb(255 255 255 / 0.28);
}
.visor-foto-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 0.5rem;
  box-shadow: 0 20px 50px -15px rgb(0 0 0 / 0.7);
  -webkit-user-select: none;
  user-select: none;
}

/* Abas "Planejar a visita" / "Conheça o lugar": grudam embaixo da barra de cima */
.ficha-abas {
  position: sticky;
  top: var(--ficha-barra);
  z-index: 10;
}
.aba-segmento {
  color: rgb(var(--c-ardosia));
  transition: background-color 150ms ease, color 150ms ease;
}
.aba-segmento:hover {
  color: rgb(var(--c-basalto));
}
.aba-segmento[aria-selected="true"] {
  background-color: rgb(var(--c-ivory));
  color: rgb(var(--c-mata));
  box-shadow: 0 1px 3px rgb(15 23 42 / 0.14);
}

/* Previsão de 3 dias: rola para o lado no celular, sem a barra de rolagem à vista */
.rolagem-lateral {
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.rolagem-lateral::-webkit-scrollbar {
  display: none;
}

/* Botões de "como chegar", fixos embaixo, acima da barra de gestos */
.ficha-acoes {
  flex-shrink: 0;
  padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
}

@media (min-width: 768px) {
  dialog.folha.folha-ficha {
    margin: auto;
    height: auto;
    max-width: min(48rem, calc(100% - 2rem));
    max-height: 92vh;
    max-height: 92dvh;
  }
  .folha-ficha .folha-corpo {
    --ficha-barra: 3.5rem;
    height: auto;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 1rem;
    box-shadow: 0 24px 60px -20px rgb(15 23 42 / 0.45);
  }
  .ficha-foto,
  .folha-ficha.ficha-rolou .ficha-foto {
    height: 15rem;
    touch-action: auto;
  }
  .ficha-acoes {
    padding-bottom: 0.75rem;
  }
}

/* ========================================================= */
/* ABA AGORA (passo 4b, tela S02)                              */
/* ========================================================= */
/* Chips "Como vou" e "Clima" (e outros que usarem .chip): a escolha fica marcada pelo aria-pressed */
.chip {
  -webkit-tap-highlight-color: transparent;
  background-color: rgb(var(--c-paper));
  color: rgb(var(--c-basalto));
  box-shadow: inset 0 0 0 1px rgb(var(--c-sand));
  transition: background-color 150ms ease, color 150ms ease;
}
.chip:hover {
  background-color: rgb(var(--c-sand) / 0.4);
}
.chip[aria-pressed="true"] {
  background-color: rgb(var(--c-mata));
  color: #fff;
  box-shadow: none;
}
html.dark .chip[aria-pressed="true"] {
  color: rgb(var(--c-paper));   /* no escuro o "mata" é claro: texto escuro para ler bem */
}

/* Foto dos cartões: fundo escuro enquanto carrega e véu para o texto branco, nos dois temas */
.cartao-foto {
  background-color: rgb(15 23 42);
}
.cartao-foto-veu {
  background-image: linear-gradient(to top, rgb(2 6 23 / 0.8) 0%, rgb(2 6 23 / 0) 50%);
}

/* Botão invisível que cobre o cartão inteiro (UI.renderAgoraTab): toque em qualquer parte abre a ficha */
.cartao-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  border-radius: inherit;
  -webkit-tap-highlight-color: transparent;
}
.cartao-link:focus {
  outline: none;
}
.cartao-link:focus-visible {
  box-shadow: 0 0 0 3px rgb(var(--c-mata));
}

/* ========================================================= */
/* ABA EXPLORAR (passo 4b, tela S03)                           */
/* ========================================================= */
/* No celular, a busca gruda logo abaixo da barra de cima ao rolar. Quando gruda (UI.prepararExplorar
   marca .busca-presa), ganha o fundo e a linha da barra de cima, como se fizesse parte dela. */
@media (max-width: 767px) {
  .explorar-busca {
    position: sticky;
    top: calc(3.5rem + 1px + env(safe-area-inset-top));
    z-index: 20;
    transition: background-color 150ms ease, box-shadow 150ms ease;
  }
  .explorar-busca.busca-presa {
    background-color: rgb(var(--c-ivory));
    box-shadow: 0 1px 0 rgb(var(--c-sand)), 0 8px 16px -12px rgb(15 23 42 / 0.4);
  }
  .busca-presa .explorar-campo {
    background-color: rgb(var(--c-paper));
  }
}

/* "Só protegidos" sem previsão do vento: apagado; o toque mostra a dica (AppState.toggleShelteredFilter) */
.chip[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}
.chip[aria-disabled="true"]:hover {
  background-color: rgb(var(--c-paper));
}

/* ========================================================= */
/* ABA MAPA (passo 4b, tela S04)                               */
/* ========================================================= */
/* A partir de 768 px: caixa arredondada que vai até o fim da tela (no mínimo 420 px de altura).
   No celular, com a aba Mapa aberta (html.aba-mapa, AppState.setActiveTab), o mapa ocupa todo o
   espaço entre a barra de cima (e a faixa de aviso, se houver) e a navegação de baixo; a página não rola. */
.mapa-caixa {
  height: calc(100vh - 14.25rem);
  height: calc(100dvh - 14.25rem);
  min-height: 420px;
}
@media (max-width: 767px) {
  html.aba-mapa body {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    padding-bottom: calc(4rem + env(safe-area-inset-bottom));
  }
  html.aba-mapa main {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0;
  }
  html.aba-mapa #tab-mapa {
    flex: 1;
    min-height: 0;
  }
  .mapa-caixa {
    height: 100%;
    min-height: 0;
  }
}

/* Enquanto o fundo do mapa abre (MapEngine.marcarCarregando): cinza claro piscando por baixo dos pontos */
#leaflet-map.mapa-carregando {
  animation: mapa-pulsa 1.4s ease-in-out infinite;
}
@keyframes mapa-pulsa {
  0%, 100% { background-color: rgb(var(--c-sand) / 0.6); }
  50% { background-color: rgb(var(--c-sand) / 0.25); }
}

/* Botões do mapa (aproximar, afastar e centralizar), em cima à direita, logo abaixo dos chips e da pílula do
   vento (altura medida por MapEngine.posicionarBotoes): 44 px para o dedo e as cores do app */
#leaflet-map .leaflet-top.leaflet-right {
  top: var(--mapa-botoes-topo, 7rem);
}
#leaflet-map .leaflet-top.leaflet-right .leaflet-control {
  margin-top: 0;
  margin-bottom: 8px;
}
#leaflet-map .leaflet-bar {
  border: 1px solid rgb(var(--c-sand));
  border-radius: 0.875rem;
  overflow: hidden;
  box-shadow: 0 6px 16px -6px rgb(15 23 42 / 0.4);
  background-clip: padding-box;
}
#leaflet-map .leaflet-bar a,
#leaflet-map .leaflet-bar button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid rgb(var(--c-sand));
  border-radius: 0;
  background-color: rgb(var(--c-ivory));
  color: rgb(var(--c-basalto));
  font: 500 22px/1 'Plus Jakarta Sans', sans-serif;
  cursor: pointer;
  transition: background-color 150ms ease;
}
#leaflet-map .leaflet-bar a:last-child,
#leaflet-map .leaflet-bar button:last-child {
  border-bottom: 0;
}
#leaflet-map .leaflet-bar a:hover,
#leaflet-map .leaflet-bar button:hover {
  background-color: rgb(var(--c-paper));
}
#leaflet-map .leaflet-bar a:active,
#leaflet-map .leaflet-bar button:active {
  background-color: rgb(var(--c-sand) / 0.6);
}
#leaflet-map .leaflet-bar a:focus-visible,
#leaflet-map .leaflet-bar button:focus-visible {
  outline: 2px solid rgb(var(--c-mata));
  outline-offset: -2px;
}
#leaflet-map .leaflet-bar a.leaflet-disabled {
  background-color: rgb(var(--c-ivory));
  color: rgb(var(--c-ardosia) / 0.45);
  cursor: default;
}
#leaflet-map .mapa-centralizar svg {
  width: 22px;
  height: 22px;
}

/* "x" da janelinha de um ponto: área de toque de 44 px, cor do app */
#leaflet-map a.leaflet-popup-close-button {
  width: 44px;
  height: 44px;
  font: 400 24px/44px 'Plus Jakarta Sans', sans-serif;
  color: rgb(var(--c-ardosia));
}
#leaflet-map a.leaflet-popup-close-button:hover {
  color: rgb(var(--c-basalto));
}

/* ========================================================= */
/* SORTEIO (passo 4b, tela S06)                                */
/* ========================================================= */
/* Cada lugar sorteado entra com um leve deslizar (UI.openRandomizerModal), também no "Sortear Outro" */
.sorteio-entra {
  animation: sorteio-entra 220ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes sorteio-entra {
  from { opacity: 0; transform: translateY(8px); }
}

/* ========================================================= */
/* PASSAPORTE DE SELOS, PERFIL E EXPLORADORES                */
/* ========================================================= */
.selo-medalhao {
  border-radius: 9999px;
}
.selo-medalhao.selo-conquistado {
  filter: drop-shadow(0 2px 5px rgb(15 23 42 / 0.16));
}
.selo-medalhao.selo-ja-fui {
  filter: sepia(0.55) saturate(0.65) opacity(0.84);
}
.selo-medalhao.selo-falta {
  filter: grayscale(1) opacity(0.32);
}
html.dark .selo-medalhao.selo-falta {
  filter: grayscale(1) opacity(0.38);
}

/* Folhas mais largas no computador (Seu perfil e Passaporte do explorador) */
.folha-larga .folha-corpo {
  overflow: hidden;
}
@media (min-width: 768px) {
  dialog.folha.folha-larga {
    max-width: 34rem;
  }
}

/* Grade de escolha de avatar (folha "Seu perfil") */
.avatar-opcao {
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}
.avatar-opcao[aria-pressed="true"] {
  border-color: rgb(var(--c-mata));
  background-color: rgb(var(--c-mata-light));
  box-shadow: 0 0 0 1.5px rgb(var(--c-mata));
}

/* Chave liga/desliga de privacidade do passaporte (alvo de toque de 44 px) */
.chave-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.25rem;
  min-height: 2.75rem;
  padding: 0 0.125rem;
  border-radius: 9999px;
  cursor: pointer;
}
.chave-switch-trilho {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 3rem;
  height: 1.75rem;
  border-radius: 9999px;
  background-color: rgb(var(--c-sand-dark));
  transition: background-color 180ms ease;
}
.chave-switch-bolinha {
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 9999px;
  background-color: #FFFFFF;
  box-shadow: 0 1px 3px rgb(15 23 42 / 0.25);
  transform: translateX(0.1875rem);
  transition: transform 180ms ease;
}
.chave-switch[aria-checked="true"] .chave-switch-trilho {
  background-color: rgb(var(--c-mata));
}
.chave-switch[aria-checked="true"] .chave-switch-bolinha {
  transform: translateX(1.4375rem);
}

/* Quem pede menos movimento no aparelho: sem animação nas folhas, na ficha e na navegação */
@media (prefers-reduced-motion: reduce) {
  dialog.folha[open] .folha-corpo,
  dialog.folha[open]::backdrop,
  dialog.visor-foto[open] .visor-foto-palco,
  .sorteio-entra,
  #leaflet-map.mapa-carregando {
    animation: none;
  }
  .folha-corpo,
  .nav-item,
  .nav-indicador,
  .tema-opcao,
  .ficha-barra,
  .ficha-barra-titulo,
  .ficha-fechar,
  .aba-segmento,
  .chip,
  .explorar-busca,
  .selo-medalhao,
  .avatar-opcao,
  .chave-switch-trilho,
  .chave-switch-bolinha {
    transition: none;
  }
  #leaflet-map.mapa-carregando {
    animation: none;
    background-color: rgb(var(--c-sand) / 0.6);
  }
  .sorteio-entra {
    animation: none;
  }
}
