body.page-map {
  margin: 0;
  overflow: hidden;
  background: #E8EEF0;
  height: 100%;
  overscroll-behavior: none;
}
html { height: 100%; }

.app-frame {
  height: 100dvh;
  height: 100svh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.map-app {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

.map-canvas {
  position: absolute;
  inset: 0;
  background: #D9E3E6;
  z-index: 1;
}

/* Leaflet default divIcon box must be invisible */
.ogi-marker-icon {
  background: transparent !important;
  border: none !important;
}
.ogi-marker-icon svg,
.ogi-pin {
  display: block;
  width: 28px;
  height: 40px;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.28));
  pointer-events: none;
}

.map-topbar {
  position: absolute;
  z-index: 500;
  left: .75rem; right: .75rem; top: .75rem;
  display: grid;
  gap: .5rem;
  pointer-events: none;
}
.map-topbar > * { pointer-events: auto; }

.brand-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  width: fit-content;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .4rem .75rem;
  box-shadow: var(--shadow);
  font-size: .85rem;
  letter-spacing: -.02em;
}
.brand-chip strong { color: var(--primary); }
.brand-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #38BDF8);
}

.map-search { position: relative; }
.map-search input {
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: .9rem 1rem;
  background: rgba(255,255,255,.96);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.map-filter-row {
  display: flex; gap: .45rem; overflow: auto;
  scrollbar-width: none;
}
.map-filter-row::-webkit-scrollbar { display: none; }
.map-filter-row select, .chip-btn {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.96);
  border-radius: 999px;
  padding: .55rem .85rem;
  box-shadow: var(--shadow);
  white-space: nowrap;
}
.chip-btn { cursor: pointer; font-weight: 650; color: var(--text); }

.suggestions {
  position: absolute; left: 0; right: 0; top: calc(100% + .4rem); z-index: 20;
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); overflow: hidden;
}
.suggestions button {
  display: block; width: 100%; text-align: left; border: 0; background: #fff;
  padding: .8rem .95rem; cursor: pointer; border-bottom: 1px solid var(--line);
}
.suggestions button:hover { background: #F3FAF7; }
.suggestions small { display: block; color: var(--muted); }

.map-fabs {
  position: absolute;
  right: .85rem;
  bottom: .85rem;
  z-index: 500;
  display: grid; gap: .55rem;
}
.fab {
  width: 48px; height: 48px; border-radius: 16px;
  border: 1px solid var(--line); background: #fff;
  box-shadow: var(--shadow); color: var(--text);
  display: grid; place-items: center; cursor: pointer;
}

/* Bottom nav — always visible under the map, never covered */
body.page-map .bottom-nav {
  position: relative !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  transform: none !important;
  width: 100% !important;
  flex: 0 0 auto;
  z-index: 20;
  height: calc(var(--nav-h) + var(--safe-b));
  margin: 0;
  border-radius: 0;
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(11, 24, 32, 0.06);
  background: #fff;
}

/* Sheets & modals — above everything */
.ctx-sheet, .modal {
  position: fixed;
  inset: 0;
  z-index: 4000;
}
.ctx-sheet {
  inset: auto 0 0 0;
  background: rgba(255,255,255,.98);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -16px 40px rgba(0,0,0,.14);
  padding: .65rem 1rem calc(.85rem + var(--safe-b));
  animation: rise .2s ease;
}
.ctx-sheet[hidden], .modal[hidden] { display: none !important; }
.sheet-handle {
  width: 42px; height: 4px; border-radius: 99px; background: #D5DEDA;
  margin: .15rem auto .75rem;
}
.ctx-title { font-weight: 750; letter-spacing: -.02em; }
.ctx-coords { color: var(--muted); font-size: .85rem; margin: .2rem 0 .85rem; font-variant-numeric: tabular-nums; }
.ctx-hint { color: var(--muted); font-size: .8rem; margin: -.4rem 0 .8rem; }
.ctx-actions { display: grid; gap: .5rem; }

.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(8, 16, 24, .42);
  backdrop-filter: blur(2px);
}
.modal-card {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(440px, calc(100% - 1.25rem));
  max-height: min(86dvh, 860px);
  overflow: auto;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(0,0,0,.22);
  animation: pop .18s ease;
}
.sheet-modal .modal-card.sheet-card {
  top: auto; bottom: 0; left: 0; right: 0; transform: none;
  width: 100%; max-height: min(90dvh, 920px);
  border-radius: 24px 24px 0 0;
  padding: .5rem 1rem calc(1rem + var(--safe-b));
  animation: rise .2s ease;
}
.modal-x {
  position: absolute; top: .7rem; right: .7rem; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: rgba(255,255,255,.92); color: var(--text);
  font-size: 1.4rem; line-height: 1; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
.modal-media {
  position: relative;
  min-height: 190px;
  background: linear-gradient(160deg, #D7E8E2, #EEF3F6);
}
.modal-media img {
  width: 100%; height: 210px; object-fit: cover;
}
.modal-media-empty {
  min-height: 190px; display: grid; place-items: center;
  color: var(--muted); font-weight: 600;
}
.modal-body { padding: 1rem 1rem 1.2rem; }
.modal-meta { margin: 0; color: var(--muted); font-size: .82rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; }
.modal-body h2 { margin: .25rem 0 .4rem; font-size: 1.35rem; letter-spacing: -.03em; }
.modal-rating { color: #B45309; margin-bottom: .55rem; letter-spacing: .04em; }
.modal-desc { color: var(--muted); margin: 0 0 1rem; white-space: pre-wrap; }
.modal-actions { display: grid; grid-template-columns: 1fr auto auto; gap: .5rem; margin-bottom: 1rem; }
.star-rate { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.star-rate .stars button {
  border: 0; background: none; font-size: 1.35rem; color: #B45309; cursor: pointer; padding: 0 .1rem;
}
.modal-comments h3 { margin: 0 0 .65rem; font-size: 1rem; }
.comment-item { padding: .65rem 0; border-bottom: 1px solid var(--line); }
.comment-item strong { font-size: .92rem; }
.comment-item p { margin: .2rem 0 0; color: var(--text); }
.comment-box { display: grid; gap: .5rem; margin-top: .75rem; }
.comment-box textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: .7rem .8rem; resize: vertical;
}

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 1rem);
  transform: translateX(-50%);
  z-index: 5000;
  background: #0B1220; color: #fff;
  padding: .7rem 1rem; border-radius: 999px;
  font-size: .9rem; box-shadow: var(--shadow);
  max-width: calc(100% - 2rem);
}
.toast[hidden] { display: none !important; }

.leaflet-control-layers {
  border: 0 !important; border-radius: 14px !important; box-shadow: var(--shadow) !important;
  overflow: hidden;
}
.leaflet-bottom.leaflet-right { bottom: .5rem !important; right: .5rem !important; }
.leaflet-control-zoom a {
  width: 36px !important; height: 36px !important; line-height: 36px !important;
  color: var(--text) !important;
}

@keyframes rise {
  from { transform: translateY(18px); opacity: .6; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes pop {
  from { transform: translate(-50%, -46%) scale(.98); opacity: .5; }
  to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@media (min-width: 900px) {
  .map-topbar { max-width: 420px; right: auto; }
  .ctx-sheet {
    left: auto; right: 1rem; bottom: 1rem; width: min(320px, calc(100% - 2rem));
    border-radius: 20px; padding-bottom: 1rem;
  }
  .sheet-modal .modal-card.sheet-card {
    left: 50%; right: auto; bottom: 1rem; transform: translateX(-50%);
    width: min(420px, calc(100% - 2rem));
    border-radius: 22px;
    padding-bottom: 1rem;
  }
}
