html {
  scroll-behavior: smooth;
}
html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Helvetica Neue", sans-serif;
}
/* 折り返しの下（マップの外）の地の色。設定しないと環境により暗く見える */
body { background: #fff; }

/* #app = マップ＋オーバーレイのラッパー。ファーストビュー＝全画面の地図。
   100dvh: iOS Safariの下部バー被り対策。非対応ブラウザは100vhにフォールバック */
#app {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
}
#map {
  width: 100%;
  height: 100%;
}

/* ---- サイトタイトル（左上） ---- */
#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: #5a1738;
  text-decoration: none;
}
#site-title .beta {
  font-size: 11px;
  font-weight: 600;
  color: #e67e22;
  vertical-align: super;
}

/* ---- 地名検索（タイトル直下の🔍。開くと入力欄＋候補リスト） ---- */
#place-search {
  position: absolute;
  top: calc(54px + env(safe-area-inset-top, 0px));
  left: calc(10px + env(safe-area-inset-left, 0px));
  z-index: 1001; /* 候補リストが凡例等より手前に来るように */
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
#ps-toggle {
  border: none;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  font-size: 15px;
  padding: 7px 10px;
  cursor: pointer;
}
#ps-box { position: relative; }
#ps-box[hidden] { display: none; }
#ps-input {
  width: min(240px, calc(100vw - 90px));
  font-size: 16px; /* 16px未満だとiOS Safariがフォーカス時に画面ズームしてしまう */
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  background: #fff;
  box-sizing: border-box;
}
#ps-results {
  list-style: none;
  margin: 4px 0 0;
  padding: 4px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
  max-height: 40vh;
  overflow-y: auto;
}
#ps-results li {
  padding: 7px 10px;
  font-size: 13px;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
#ps-results li:hover { background: #fdeef4; }
#ps-results .ps-empty { color: #888; cursor: default; }

/* ---- 表示切り替え凡例（右上） ---- */
#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: 170px;
  max-width: 220px;
  overflow: hidden;
}
#legend-toggle {
  display: block;
  width: 100%;
  border: none;
  background: #5a1738;
  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; }

/* ---- 現在地ボタン（右下・ズームの上） ---- */
#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;
}

/* ---- データ読み込みエラー（下・中央） ---- */
#load-error {
  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;
}
#load-error[hidden] { display: none; }

/* ---- ホテルピン（ティアドロップ型・名称ありはローズ / 未確認はグレー） ---- */
.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-tooltip.pin-tip {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  /* Leafletのtooltip-paneは幅0のため、width:max-contentで自然な1行幅を確保し、
     max-widthで頭打ちにして長い名前だけ折り返す（ビジホ版の知見） */
  width: max-content;
  max-width: 170px;
  white-space: normal;
  text-align: center;
  line-height: 1.35;
  max-height: calc(1.35em * 3); /* 3行を超えたぶんはクリップ */
  overflow: hidden;
}
.pin-tip::before { display: none !important; } /* Leafletのしっぽ三角形を消す */

/* ---- ポップアップ ---- */
/* ポップアップ表示中(body.popup-open)は上部チップ側をフェードアウトさせる
   （スマホでポップアップ上部がタイトル・凡例の下に潜る問題のビジホ版対策を踏襲） */
#site-title, #place-search, #legend { transition: opacity 0.15s ease-out; }
body.popup-open #site-title,
body.popup-open #place-search,
body.popup-open #legend {
  opacity: 0;
  pointer-events: none;
}
.leaflet-popup-content { margin: 12px 14px; line-height: 1.5; }
.pp { font-size: 13px; min-width: 210px; }
.pp-area {
  display: inline-block;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 10px;
  margin-bottom: 4px;
  background: #5a1738;
}
.pp-name { font-size: 14px; font-weight: 700; margin: 0 0 4px; color: #222; }
.pp-name a { color: #a52964; text-decoration: none; }
.pp-name a:hover { text-decoration: underline; }
.pp-unknown { color: #888; font-size: 11px; margin: 2px 0 4px; }
.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-web { background: #e0447c; color: #fff; }
.btn-gmap { background: #fff; color: #3367d6; border: 2px solid #4285f4; }
.pp-src { 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; }

/* ---- 下部SEOコンテンツ（折り返しの下・クロール用の説明＋内部リンク） ---- */
.home-intro {
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 20px 8px;
  color: #222;
  background: #fff;
  line-height: 1.9;
}
.home-intro h1 { font-size: 24px; margin: 0 0 16px; color: #5a1738; }
.home-intro h2 {
  font-size: 18px;
  margin: 32px 0 10px;
  border-left: 4px solid #5a1738;
  padding-left: 10px;
}
.home-intro p { font-size: 15px; }
.home-intro a { color: #a52964; }
.home-tips {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 6px;
}
.home-tips li { font-size: 14px; }
.home-links { display: flex; flex-wrap: wrap; gap: 10px 18px; font-size: 15px; }
.home-footer {
  border-top: 1px solid #e5e5e5;
  margin-top: 24px;
  padding: 20px 16px 40px;
  text-align: center;
  font-size: 13px;
  background: #fff;
  color: #666;
}
.home-footer a { color: #a52964; text-decoration: none; }
.home-footer .data-credit { font-size: 11px; color: #888; }

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