html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Helvetica Neue", sans-serif;
}

/* 100dvh: iOS Safariの下部バー被り対策。非対応ブラウザは100vhにフォールバック */
#map {
  width: 100%;
  height: 100vh;
  height: 100dvh;
}

/* ---- サイトタイトル（左上） ---- */
#site-title {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top, 0px));
  left: calc(10px + env(safe-area-inset-left, 0px));
  z-index: 1000;
  background: rgba(255, 255, 255, 0.94);
  padding: 8px 14px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  font-size: 15px;
  font-weight: 700;
  color: #1a2b49;
  text-decoration: none;
}
#site-title .beta {
  font-size: 11px;
  font-weight: 600;
  color: #e67e22;
  vertical-align: super;
}

/* ---- チェーン凡例・フィルタ（右上） ---- */
#legend {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top, 0px));
  right: calc(10px + env(safe-area-inset-right, 0px));
  z-index: 1000;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  min-width: 180px;
  max-width: 220px;
  overflow: hidden;
}
#legend-toggle {
  display: block;
  width: 100%;
  border: none;
  background: #1a2b49;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  cursor: pointer;
  text-align: left;
}
#legend-count { font-weight: 400; opacity: 0.85; }
#legend.collapsed #legend-body { display: none; }
#legend-body { padding: 6px 10px 10px; }
.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.legend-row input { margin: 0; }
.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}
.legend-name { flex: 1; }
.legend-n { color: #888; font-size: 11px; }
#legend-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  border-top: 1px solid #eee;
  padding-top: 8px;
}
#legend-actions button {
  flex: 1;
  font-size: 11px;
  padding: 4px 0;
  border: 1px solid #ccc;
  border-radius: 5px;
  background: #f7f7f7;
  cursor: pointer;
}

/* ---- 現在地ボタン（右下・ズームの上） ---- */
#locate-btn {
  position: absolute;
  right: calc(10px + env(safe-area-inset-right, 0px));
  bottom: calc(110px + env(safe-area-inset-bottom, 0px));
  z-index: 1000;
  border: none;
  background: rgba(255, 255, 255, 0.96);
  padding: 9px 12px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* ---- 広告表記（左下） ---- */
#ad-note {
  position: absolute;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  left: calc(10px + env(safe-area-inset-left, 0px));
  z-index: 1000;
  background: rgba(255, 255, 255, 0.9);
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 10px;
  color: #666;
  text-decoration: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

/* ---- サンプルデータ告知（下・中央） ---- */
#sample-banner {
  position: absolute;
  bottom: calc(40px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: #fff3cd;
  border: 1px solid #ffcf66;
  color: #7a5b00;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  max-width: calc(100vw - 32px);
  box-sizing: border-box;
  text-align: center;
}

/* ---- ホテルピン（チェーン色のティアドロップ型） ---- */
.hpin {
  background: none;
  border: none;
}
.hpin-body {
  width: 26px;
  height: 26px;
  box-sizing: border-box;
  border-radius: 50% 50% 50% 0; /* 左下角だけ尖らせ、回転して下向きの「ピン」に */
  transform: rotate(-45deg);
  transform-origin: center;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  /* 出現時に一度だけ「ジワッ」。常時アニメーションはチカチカするので無し */
  animation: hpin-in 0.22s ease-out;
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out;
}
.hpin-dot {
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
}
.hpin-body:hover,
.hpin--active .hpin-body {
  transform: rotate(-45deg) scale(1.2);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}
@keyframes hpin-in {
  from { opacity: 0; transform: rotate(-45deg) scale(0.6); }
  to   { opacity: 1; transform: rotate(-45deg) scale(1); }
}

/* ---- ポップアップ ---- */
.leaflet-popup-content { margin: 12px 14px; line-height: 1.5; }
.pp { font-size: 13px; min-width: 210px; }
.pp-chain {
  display: inline-block;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 10px;
  margin-bottom: 4px;
}
.pp-name { font-size: 14px; font-weight: 700; margin: 0 0 4px; }
.pp-img {
  width: 100%;
  /* 高さは固定にする: 画像の遅延読み込みでポップアップが後から伸びると、
     Leafletの位置自動調整(autoPan)が画像なしの高さで計算済みのため
     画面上部にはみ出す。固定高なら開いた瞬間にサイズが確定する */
  height: 130px;
  object-fit: cover;
  border-radius: 6px;
  margin: 4px 0;
  background: #e9e9e9; /* 読み込み中のプレースホルダ */
}
.pp-meta { color: #444; margin: 2px 0; }
.pp-meta .rv-count { color: #888; font-size: 11px; }
.pp-access { color: #666; font-size: 12px; margin: 2px 0 8px; }
.pp-btns { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.pp-btns .btn {
  display: block;
  text-align: center;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.btn-rakuten { background: #bf0000; color: #fff; }
.btn-jalan { background: #fff; color: #e05a00; border: 2px solid #f08300; }
.pp-adnote { color: #999; font-size: 10px; margin: 6px 0 0; text-align: center; }

/* ---- PC用ホテル詳細カード（地図を動かさないポップアップ代替） ---- */
#hotel-card {
  position: fixed;
  z-index: 1100;
  width: 280px;
  box-sizing: border-box;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.28);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
}
#hotel-card .card-close {
  position: absolute;
  top: 6px;
  right: 8px;
  z-index: 1;
  border: none;
  background: none;
  font-size: 18px;
  color: #999;
  cursor: pointer;
  line-height: 1;
  padding: 2px 4px;
}
#hotel-card .card-close:hover { color: #333; }

/* ---- モバイル ---- */
@media (max-width: 600px) {
  #site-title { font-size: 13px; padding: 7px 10px; }
  #legend { max-width: 180px; }
}
