/* 公開地図レイアウト（けものナビ新UI + 既存catch-map等） */
:root {
  --knav-green: #1f5c3a;
  --knav-green-deep: #174a2e;
  --knav-green-soft: #e8f2ec;
  --knav-ink: #1c2b22;
  --knav-muted: #6b7a70;
  --knav-panel: #ffffff;
  --knav-contact: #f3ead8;
  --knav-shadow: 0 10px 30px rgba(28, 43, 34, 0.14);
}

.knav-map-body {
  background: #eef2ef;
  overflow: hidden;
}

.knav-navbar-light {
  background: rgba(255, 255, 255, 0.94) !important;
  border-bottom: 1px solid rgba(31, 92, 58, 0.12);
  backdrop-filter: blur(8px);
  z-index: 20;
}

.knav-navbar-light .navbar-brand,
.knav-navbar-light .nav-link {
  color: var(--knav-green) !important;
}

.knav-navbar-light .nav-link.active {
  font-weight: 700;
  border-bottom: 2px solid var(--knav-green);
}

.knav-navbar-light .navbar-toggler {
  border-color: rgba(31, 92, 58, 0.35);
}

.knav-navbar-light .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(31, 92, 58, 0.9)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.knav-brand-mark {
  display: inline-flex;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
  background: var(--knav-green-soft);
  color: var(--knav-green);
  font-size: 0.95rem;
}

.knav-map-page {
  position: relative;
  height: calc(100vh - 56px);
  min-height: 420px;
  overflow: hidden;
}

.knav-map-canvas,
#map.knav-map-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.knav-panel {
  position: absolute;
  z-index: 5;
  left: 1rem;
  top: 1rem;
  width: min(340px, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  background: var(--knav-panel);
  border-radius: 1rem;
  box-shadow: var(--knav-shadow);
  overflow: auto;
}

.knav-panel-inner {
  padding: 1.1rem 1.15rem 1.2rem;
}

.knav-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--knav-ink);
  margin: 0 0 0.2rem;
}

.knav-lead {
  margin: 0 0 1rem;
  color: var(--knav-muted);
  font-size: 0.86rem;
}

.knav-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--knav-muted);
  margin-bottom: 0.3rem;
}

.knav-year-form .form-select {
  border-radius: 0.65rem;
  border-color: #d5e0d9;
}

.knav-period {
  margin-top: 0.4rem;
  margin-bottom: 0.9rem;
  font-size: 0.78rem;
  color: var(--knav-muted);
}

.knav-summary {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  background: #f3f6f4;
  border-radius: 0.75rem;
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.9rem;
}

.knav-summary > i {
  color: var(--knav-green);
  font-size: 1.1rem;
  margin-top: 0.1rem;
}

.knav-summary-main {
  font-weight: 700;
  color: var(--knav-ink);
  font-size: 0.95rem;
}

.knav-summary-sub {
  font-size: 0.75rem;
  color: var(--knav-muted);
  margin-top: 0.15rem;
}

.knav-legend-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--knav-muted);
  margin-bottom: 0.45rem;
}

.knav-legend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin-bottom: 0.95rem;
}

.knav-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #f6f8f7;
  border-radius: 0.55rem;
  padding: 0.45rem 0.55rem;
  font-size: 0.76rem;
  color: #3d4a42;
}

.knav-loc-btn {
  width: 100%;
  border: 0;
  border-radius: 0.8rem;
  background: var(--knav-green);
  color: #fff;
  font-weight: 700;
  padding: 0.75rem 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  box-shadow: 0 6px 16px rgba(31, 92, 58, 0.28);
}

.knav-loc-btn:hover {
  background: var(--knav-green-deep);
  color: #fff;
}

.knav-geo-status {
  min-height: 1.1rem;
  margin: 0.4rem 0 0.75rem;
  font-size: 0.78rem;
  color: var(--knav-muted);
}

.knav-geo-status.text-danger {
  color: #b42318 !important;
}

.knav-contact {
  background: var(--knav-contact);
  border-radius: 0.75rem;
  padding: 0.8rem 0.9rem;
  margin-bottom: 0.75rem;
}

.knav-contact-title {
  font-weight: 700;
  font-size: 0.84rem;
  color: var(--knav-ink);
  margin-bottom: 0.25rem;
}

.knav-contact-title i {
  color: #c62828;
  margin-right: 0.25rem;
}

.knav-contact-body {
  font-size: 0.82rem;
  color: #4a3f2e;
}

.knav-contact-body a {
  color: inherit;
  font-weight: 700;
  text-decoration: none;
}

.knav-hp-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--knav-green);
  font-size: 0.84rem;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.knav-mobile-chips {
  display: none;
}

.legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  vertical-align: middle;
  border: 1px solid rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.legend-sighting,
.status-sighting {
  background: #222222;
}

.status-recent {
  background: #c62828;
}

.status-current {
  background: #1e88e5;
}

.legend-boundary {
  display: inline-block;
  width: 18px;
  height: 0;
  margin-right: 2px;
  vertical-align: middle;
  border-top: 2px dashed #198754;
  flex-shrink: 0;
}

.map-page {
  display: flex;
  height: calc(100vh - 56px);
  min-height: 400px;
}

.map-sidebar {
  width: 260px;
  flex-shrink: 0;
  padding: 1rem;
  overflow-y: auto;
  background: #f8f9fa;
  border-right: 1px solid #dee2e6;
}

#map,
#catch-map,
.map-canvas {
  flex: 1;
  min-width: 0;
  height: 100%;
}

.edit-map {
  width: 100%;
  height: 520px;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
}

.catch-map-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.catch-map-wrap .map-canvas {
  flex: 1;
  min-height: 0;
}

.catch-adjust-banner {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  max-width: min(560px, calc(100% - 24px));
  pointer-events: auto;
}

.catch-adjust-banner-inner {
  background: rgba(33, 37, 41, 0.92);
  color: #fff;
  padding: 0.65rem 0.9rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  line-height: 1.45;
}

#catch-map.catch-map-adjusting {
  cursor: crosshair;
}

.maplibregl-popup-content {
  font-size: 0.9rem;
  line-height: 1.45;
  border-radius: 0.75rem;
}

.osm-marker {
  cursor: pointer;
}

.osm-marker-inner {
  line-height: 0;
}

.osm-marker-inner svg {
  display: block;
}

@media (max-width: 991.98px) {
  .knav-map-body {
    overflow: auto;
  }

  .knav-map-page {
    height: calc(100dvh - 56px);
  }

  .knav-mobile-chips {
    display: flex;
    gap: 0.45rem;
    position: absolute;
    z-index: 6;
    top: 0.75rem;
    left: 0.75rem;
    right: 3.5rem;
    pointer-events: none;
  }

  .knav-mobile-chips > * {
    pointer-events: auto;
  }

  .knav-chip-year .form-select {
    width: auto;
    min-width: 6.5rem;
    border: 0;
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    font-weight: 650;
    font-size: 0.82rem;
    padding-right: 1.8rem;
  }

  .knav-chip-count {
    background: #fff;
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--knav-ink);
    white-space: nowrap;
  }

  .knav-panel {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    max-height: min(58vh, 520px);
    border-radius: 1.1rem 1.1rem 0 0;
    transition: transform 0.28s ease;
    will-change: transform;
    touch-action: pan-y;
  }

  .knav-panel.is-dragging {
    transition: none;
  }

  .knav-panel.is-collapsed {
    /* ハンドル＋案内だけ残して地図を広げる */
    transform: translateY(calc(100% - 4.6rem));
  }

  .knav-panel-grab {
    padding-bottom: 0.15rem;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
  }

  .knav-panel-handle {
    width: 42px;
    height: 4px;
    border-radius: 999px;
    background: #d5ddd8;
    margin: 0.55rem auto 0.25rem;
  }

  .knav-panel-peek-hint {
    text-align: center;
    font-size: 0.72rem;
    font-weight: 650;
    color: var(--knav-muted);
    min-height: 1rem;
    margin-bottom: 0.15rem;
    opacity: 0.9;
    pointer-events: none;
  }

  .knav-panel.is-collapsed .knav-panel-inner {
    pointer-events: none;
  }

  .knav-panel-inner {
    padding-top: 0.35rem;
  }

  .map-page {
    flex-direction: column;
    height: auto;
  }

  .map-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #dee2e6;
  }

  #map:not(.knav-map-canvas) {
    height: 60vh;
    min-height: 320px;
  }

  .edit-map {
    height: 360px;
  }
}
