* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  background: #f0f0f0;
  overflow: hidden;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.map-container {
  width: 100vw;
  height: 100dvh; /* use dynamic viewport to avoid iOS bottom toolbar cropping */
  position: relative;
  overflow: hidden;
  background: #e0e0e0;
  cursor: grab;
}

.map-container:active {
  cursor: grabbing;
}

/* Vignette overlay on edges */
.map-container::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 140px rgba(0, 0, 0, 0.35);
  z-index: 8;
}

.map-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  transform-origin: center center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-content {
  transform-origin: center center;
  height: 100%;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform;
  position: relative;
}

/* Orientation warning overlay */
.orientation-warning {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  z-index: 1100;
}

.orientation-warning.active {
  display: flex;
}

.orientation-content {
  max-width: 420px;
}

.rotate-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.map-image {
  width: auto;
  height: 100%;
  object-fit: contain;
  display: block;
  user-drag: none;
  -webkit-user-drag: none;
  user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  pointer-events: none;
}

.map-controls {
  position: absolute;
  right: calc(12px + env(safe-area-inset-right));
  bottom: calc(12px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
  padding: 6px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.map-controls button {
  width: 36px;
  height: 36px;
  border-radius: 50rem; /* round buttons */
  border: none;
  background: #63a956; /* primary green (slightly darker) */
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(99, 169, 86, 0.35);
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
  outline: none;
}

.map-controls button:active {
  transform: scale(0.96);
  box-shadow: 0 3px 10px rgba(99, 169, 86, 0.4);
}

.map-controls button:hover {
  background: #559a49; /* primary green hover (darker) */
  box-shadow: 0 10px 24px rgba(99, 169, 86, 0.45);
}

.map-controls button:focus-visible {
  box-shadow: 0 0 0 3px rgba(99, 169, 86, 0.35),
    0 6px 16px rgba(99, 169, 86, 0.35);
}

/* Bottom-center usage hint */
.map-hint {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(8px + env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.55);
  color: #ffffff;
  font-size: 11px;
  line-height: 1;
  padding: 6px 8px;
  border-radius: 10px;
  z-index: 12;
  pointer-events: none;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

/* Disabled zoom buttons visual cue */
.map-controls button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

@media (hover: none) and (pointer: coarse) {
  .map-controls {
    padding: 8px;
    gap: 10px;
  }
  .map-controls button {
    width: 40px;
    height: 40px;
    font-size: 17px;
  }
}

/* OCR removido */

/* Ponto de interesse */
.poi {
  position: absolute;
  z-index: 10;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45));
  animation: poi-bounce 1.8s ease-in-out infinite;
}

/* Eleva o ponto ativo acima dos demais; volta ao normal ao desativar */
.poi.active {
  z-index: 1010;
}

/* Eleva o ponto sob hover acima do ativo para priorizar o foco visual */
.poi:hover {
  z-index: 1011;
}

/* Hide POIs until the map image/layout is ready to avoid misplacement on first paint */
.map-content:not(.is-ready) .poi {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.map-content.is-ready .poi {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.poi .poi-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: url("images/icon-default.svg") center / 75% no-repeat,
    radial-gradient(
      circle,
      rgba(255, 255, 255, 0.95) 0%,
      rgba(255, 255, 255, 0.65) 60%,
      rgba(255, 255, 255, 0) 100%
    );
  border: 2px solid rgba(0, 0, 0, 0.65);
  box-shadow: 0 0 0 2px #fff, 0 4px 10px rgba(0, 0, 0, 0.4),
    0 0 12px rgba(255, 238, 0, 0.35);
  will-change: transform, box-shadow, filter;
  transform-origin: 50% 50%;
  animation: poi-rotate 2.4s linear infinite, poi-glow 2.4s ease-in-out infinite;
}
/* Variante para Posto Médico */
.poi--posto .poi-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: url("images/icon-posto-medico.svg") center / contain no-repeat,
    radial-gradient(
      circle,
      rgba(255, 255, 255, 0.95) 0%,
      rgba(255, 255, 255, 0.65) 60%,
      rgba(255, 255, 255, 0) 100%
    );
  border: none;
  box-shadow: none;
  animation: poi-glow 2.4s ease-in-out infinite;
}

/* Variante para Banheiro (acessibilidade) */
.poi--banheiro .poi-icon {
  width: 97px;
  height: 35px;
  border-radius: 0;
  background: url("images/icons-acessibilidade.svg") center / contain no-repeat;
  border: none;
  box-shadow: none;
  animation: poi-glow 2.4s ease-in-out infinite;
}

/* Variante para Restaurantes */
.poi--restaurantes .poi-icon {
  width: 72px;
  height: 36px;
  border-radius: 0;
  background: url("images/icon-restaurantes.svg") center / contain no-repeat;
  border: none;
  box-shadow: none;
  animation: poi-glow 2.4s ease-in-out infinite;
}

/* Variante para Quadra */
.poi--quadra .poi-icon {
  width: 36px;
  height: 80px;
  border-radius: 8px;
  background: url("images/quadra-1.svg") center / contain no-repeat;
  border: none;
  box-shadow: none;
  animation: poi-glow 2.4s ease-in-out infinite; /* manter apenas glow */
}

/* Específico para Quadra 2 */
#poiQuadra2 .poi-icon {
  background: url("images/quadra-2.svg") center / contain no-repeat;
}

/* Variante para Quadra de Treino */
.poi--treino .poi-icon {
  width: 36px;
  height: 80px;
  border-radius: 8px;
  background: url("images/icon-quadra-treino.svg") center / contain no-repeat;
  border: none;
  box-shadow: none;
  animation: poi-glow 2.4s ease-in-out infinite;
}

/* Variante para Quadra Principal (Maria Esther Bueno) */
.poi--principal .poi-icon {
  width: 44px;
  height: 96px;
  border-radius: 10px;
  background: url("images/icon-quadra-principal.svg") center / contain no-repeat;
  border: none;
  box-shadow: none;
  animation: poi-glow 2.4s ease-in-out infinite;
}

/* Remover drop-shadow do container para tipos de quadra */
.poi.poi--quadra,
.poi.poi--treino,
.poi.poi--principal {
  filter: none;
}

.poi .poi-tooltip {
  position: absolute;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
  z-index: 1000;
}

/* Tooltip em hover tem z-index maior para ficar na frente */
.poi:hover .poi-tooltip,
.poi.active .poi-tooltip {
  opacity: 1;
  visibility: visible;
}

.poi .poi-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: rgba(0, 0, 0, 0.85) transparent transparent transparent;
}

.poi:hover .poi-tooltip,
.poi.active .poi-tooltip {
  opacity: 1;
  visibility: visible;
}

/* Painel de descrição do local */
.place-panel {
  position: absolute;
  left: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  right: 12px;
  max-width: 520px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  z-index: 20;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease;
  padding-bottom: 16px; /* extra breathing room from bottom edge */
}

.place-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #f5f7fa;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.place-header h3 {
  margin: 0;
  font-size: 16px;
  color: #0f172a;
}

.place-header button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #fff;
  cursor: pointer;
}

.place-body {
  padding: 12px;
}
.place-body p {
  margin: 0;
  color: #334155;
  line-height: 1.5;
}

.place-panel.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

@keyframes poi-bounce {
  0%,
  100% {
    transform: translate(-50%, -100%) translateY(0);
  }
  30% {
    transform: translate(-50%, -100%) translateY(-6px);
  }
  60% {
    transform: translate(-50%, -100%) translateY(-2px);
  }
}

@keyframes poi-glow {
  0%,
  100% {
    filter: drop-shadow(0 0 0 rgba(255, 238, 0, 0));
  }
  50% {
    filter: drop-shadow(0 0 10px rgba(255, 238, 0, 0.7));
  }
}

@keyframes poi-rotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
