
html, body { height: 100%; overflow: hidden; }

#world-map { position: fixed; inset: 0; background: #f6efdf; font-family: inherit; }
.nav { position: absolute; left: 0; right: 0; }

.panel {
  position: absolute; top: 96px; right: 16px; bottom: 16px; width: 340px; z-index: 1000;
  display: flex; flex-direction: column; overflow: hidden;
  background: rgba(255, 250, 240, 0.94); backdrop-filter: blur(10px);
  border: var(--b); border-radius: 22px; box-shadow: var(--s-lg);
  transition: transform 0.22s ease, opacity 0.22s ease;
}
.panel.collapsed { transform: translateX(calc(100% + 40px)); opacity: 0; pointer-events: none; }
.panel-head { padding: 1rem 1.1rem 0.9rem; border-bottom: var(--b); background: var(--yellow); }
.panel-head .count { display: flex; align-items: baseline; gap: 0.45rem; margin: 0.5rem 0 0.7rem; }
.panel-head .count b { font-size: 2.1rem; line-height: 1; }
.panel-head .count span { font-weight: 800; }
.legend { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.7rem; }

.legend .chip { cursor: pointer; font-family: inherit; transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease; }
.legend .chip:hover { transform: translateY(-1px); }
.legend .chip[aria-pressed="true"] { transform: rotate(-4deg) translateY(-2px); box-shadow: 3px 3px 0 var(--ink); }
.legend .chip[aria-pressed="true"]:nth-child(even) { transform: rotate(4deg) translateY(-2px); }
.legend .chip[aria-pressed="true"]::before { content: "\f633"; font-family: "bootstrap-icons"; font-weight: normal; line-height: 1; -webkit-text-stroke: 0.6px currentColor; }
.legend.filtering .chip[aria-pressed="false"] { opacity: 0.45; }
.filter-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0.7rem;
  background: var(--ink); color: var(--yellow); border-radius: 10px; padding: 0.3rem 0.4rem 0.3rem 0.75rem;
  font-weight: 800; font-size: 0.8rem;
}
.filter-bar[hidden] { display: none; }
.filter-bar button { background: var(--paper); color: var(--ink); border: 2px solid var(--paper); border-radius: 8px; padding: 0 0.5rem; font-weight: 800; cursor: pointer; white-space: nowrap; }
.grab { display: none; }
.list { overflow-y: auto; flex: 1; padding: 0.7rem; display: flex; flex-direction: column; gap: 0.55rem; }
.item {
  display: flex; align-items: center; gap: 0.65rem; width: 100%; text-align: left; cursor: pointer;
  background: #fff; border: 2.5px solid var(--ink); border-radius: 14px; box-shadow: 2px 2px 0 var(--ink);
  padding: 0.45rem 0.6rem; transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.item:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.item:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
.item .thumb { width: 42px; height: 42px; flex-shrink: 0; border-radius: 50%; border: 2.5px solid var(--ink); object-fit: cover; background: var(--ring); }
.item .thumb.ph { display: flex; align-items: center; justify-content: center; }
.item .info { flex: 1; min-width: 0; }
.item .nm { display: block; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .meta { font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.empty { text-align: center; font-weight: 800; padding: 2rem 0.5rem; color: var(--muted); }

.panel-toggle { position: absolute; top: 96px; right: 372px; z-index: 1001; transition: right 0.22s ease, transform 0.08s ease, box-shadow 0.08s ease; }
.panel-toggle.collapsed { right: 16px; }
.locate { position: absolute; left: 16px; bottom: 24px; z-index: 1000; }
.loading {
  position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1000;
  background: var(--paper); border: var(--b); border-radius: 999px; box-shadow: var(--s-sm);
  padding: 0.35rem 1rem; font-weight: 800; display: none;
}
.loading.on { display: block; }
.loading .paw { display: inline-block; animation: wiggle 0.6s ease-in-out infinite alternate; }
@keyframes wiggle { to { transform: rotate(-20deg); } }

.leaflet-control-zoom { border: none !important; margin: 0 0 76px 16px !important; }
.leaflet-control-zoom a {
  width: 44px !important; height: 44px !important; line-height: 38px !important; margin-top: 8px;
  border: var(--b) !important; border-radius: 12px !important; box-shadow: var(--s-sm);
  background: var(--paper) !important; color: var(--ink) !important; font: 800 1.4rem "Baloo 2", sans-serif !important;
}
.leaflet-control-attribution { border-radius: 8px 0 0 0; font-family: inherit; }
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background: transparent !important; }
.marker-cluster div {
  background: var(--coral) !important; color: #fff; border: var(--b); box-shadow: var(--s-sm);
  font: 800 0.95rem "Baloo 2", sans-serif; display: flex; align-items: center; justify-content: center;
}
.marker-cluster-medium div { background: var(--yellow) !important; color: var(--ink); }
.marker-cluster-large div { background: var(--teal) !important; color: var(--ink); }
.marker-cluster span { line-height: 1; }

.spawn-marker {
  width: 48px; height: 48px; border-radius: 50%; overflow: hidden; background: var(--ring);
  border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink);
  display: flex; align-items: center; justify-content: center; transition: transform 0.12s ease;
}
.spawn-marker:hover { transform: scale(1.12); }
.spawn-marker img { width: 100%; height: 100%; object-fit: cover; }

.cat-pop .leaflet-popup-content-wrapper { padding: 0; border: var(--b); border-radius: 18px; box-shadow: var(--s); background: var(--paper); overflow: hidden; }
.cat-pop .leaflet-popup-content { margin: 0; width: 230px !important; font-family: "Baloo 2", sans-serif; }
.cat-pop .leaflet-popup-tip { background: var(--paper); border: var(--b); box-shadow: none; }
.cat-pop a.leaflet-popup-close-button { top: 6px; right: 6px; width: 28px; height: 28px; font: 800 20px/26px sans-serif; color: var(--ink); background: var(--paper); border: 2.5px solid var(--ink); border-radius: 50%; z-index: 2; }
.pop-art { height: 140px; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle, rgba(255,255,255,0.7) 0 25%, transparent 65%), var(--ring); border-bottom: var(--b); }
.pop-art img { max-height: 90%; max-width: 90%; object-fit: contain; }
.pop-body { padding: 0.7rem 0.85rem 0.85rem; }
.pop-body h3 { margin: 0 0 0.3rem; font-size: 1.3rem; line-height: 1.1; }
.pop-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.3rem; margin: 0.6rem 0 0.5rem; }
.pop-stats div { border: 2px solid var(--ink); border-radius: 9px; text-align: center; padding: 0.15rem 0; background: #fff; }
.pop-stats small { display: block; font-size: 0.62rem; font-weight: 800; color: var(--muted); line-height: 1.2; }
.pop-stats b { font-size: 0.85rem; line-height: 1.1; }
.pop-exp { font-size: 0.78rem; font-weight: 700; color: var(--muted); }

.panel-toggle .lbl { display: none; }

@media (max-width: 640px) {
  .panel { top: auto; left: 12px; right: 12px; bottom: 12px; width: auto; height: var(--sheet-h, 50vh); transition: transform 0.22s ease, opacity 0.22s ease, height 0.22s ease; }
  .panel.collapsed { transform: translateY(calc(100% + 30px)); }
  .panel-head { padding-top: 0.2rem; touch-action: none; }
  .grab { display: flex; justify-content: center; padding: 0.55rem 0 0.35rem; background: var(--yellow); cursor: grab; touch-action: none; }
  .grab span { width: 46px; height: 6px; border-radius: 999px; background: var(--ink); opacity: 0.75; }
  .panel-toggle { top: auto; right: 18px; bottom: calc(var(--sheet-h, 50vh) - 10px); width: 40px; height: 40px; transition: bottom 0.22s ease; }
  .panel-toggle.collapsed {
    right: auto; left: 50%; bottom: 24px; transform: translateX(-50%);
    width: auto; height: 46px; padding: 0 1.1rem; border-radius: 999px;
  }
  .panel-toggle.collapsed:hover { transform: translateX(-50%) translate(-1px, -1px); }
  .panel-toggle.collapsed:active { transform: translateX(-50%) translate(2px, 2px); }
  .panel-toggle.collapsed .lbl { display: inline; }
  .locate { left: 12px; bottom: calc(var(--sheet-h, 50vh) + 24px); transition: bottom 0.22s ease; }
  body:has(.panel.collapsed) .locate { bottom: 24px; }
  body.sheet-full .locate { display: none; }
  body.dragging .panel, body.dragging .panel-toggle, body.dragging .locate { transition: none; }
  .leaflet-control-zoom { display: none; }
  .loading { bottom: 82px; }
}

.pop-addr { display: flex; gap: 0.35rem; align-items: flex-start; margin-top: 0.45rem; font-size: 0.78rem; font-weight: 700; line-height: 1.3; }
.pop-addr .bi { color: var(--coral); margin-top: 0.1rem; }
.pop-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; margin-top: 0.65rem; }
.pop-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.25rem; padding: 0.35rem 0.3rem; white-space: nowrap;
  font: 800 0.74rem "Baloo 2", sans-serif; color: var(--ink) !important; text-decoration: none; cursor: pointer;
  background: #fff; border: 2px solid var(--ink); border-radius: 10px; box-shadow: 2px 2px 0 var(--ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.pop-btn.gmaps { background: var(--yellow); }
.pop-btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.pop-btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
