/* ===== map search ===== */
.map-screen { position: relative; height: calc(100dvh - 58px); overflow: hidden; background: var(--paper); }

/* この要素はMapLibreの .maplibregl-map も付くので、詳細度で勝てる書き方にしておく。
   同じ詳細度だと maplibre-gl.css の position:relative に負けて高さが0になる */
.map-screen > .map-canvas { position: absolute; inset: 0; }
/* 地図が描かれるまでのつなぎ。JSとタイルの取得中に真っ白に見えないようにする */
.map-canvas::after {
  content: "地図を読み込み中…"; position: absolute; inset: 0; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper); color: var(--gray); font-size: 12px;
  transition: opacity .3s;
}
.map-screen.map-ready .map-canvas::after { opacity: 0; visibility: hidden; }
.map-canvas .maplibregl-ctrl-bottom-right { bottom: 190px; }

/* ピン(MapLibreのMarkerとして配置。位置はMapLibreが制御するためtransformは持たない) */
.mpin { text-align: center; cursor: pointer; transition: opacity .25s; border: none; background: none; padding: 0; }
.mpin .ph { display: block; width: 46px; height: 46px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(26,26,24,.28); background-size: cover; background-position: center; margin: 0 auto; transition: width .18s, height .18s, border-color .18s; }
.mpin .pr { display: inline-block; margin-top: 3px; background: var(--ink); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; font-family: var(--num); transition: background .18s; }
.mpin.sel .ph { width: 62px; height: 62px; border-color: var(--g700); }
.mpin.sel .pr { background: var(--g700); }
.mpin.hidden { opacity: 0; pointer-events: none; }

/* ロゴを持つ店のピン。写真ピンと同じ円に収める。
   ロゴは横組みが多く円だと小さくなるため、内側の余白を詰めて目一杯に見せる */
.mpin.haslogo .lg {
  display: flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; padding: 4px; margin: 0 auto;
  background: #fff; border: 3px solid #fff; border-radius: 50%; overflow: hidden;
  box-shadow: 0 2px 8px rgba(26,26,24,.28);
  transition: width .18s, height .18s, border-color .18s;
}
.mpin.haslogo .lg img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.mpin.haslogo.sel .lg { width: 68px; height: 68px; border-color: var(--g700); }
.mpin.unpublished.haslogo .lg { border-color: #D96D4B; border-style: dashed; opacity: .82; }
/* 白抜きのロゴ。白い円では消えてしまうので、店の見た目に近い濃い地に敷く */
.mpin.logo-dark .lg { background: #3A3632; border-color: #3A3632; }
.mpin.logo-dark.sel .lg { border-color: var(--g700); }

/* 有料の広告枠。地図では枠の色と影で目立たせる。
   「PR」の文字はカードとシートに出すので、ピンには入れない(潰れて読めないため)。
   ロゴピンの指定と詳細度が同じなので、必ずそれより後ろに置く */
.mpin.ad .ph, .mpin.ad .lg { border-color: var(--coral); box-shadow: 0 3px 12px rgba(212,115,106,.5); }
.mpin.ad .pr { background: var(--coral); }
/* 背景が焼き込まれた正方形の画像。余白を残すと円の中に帯が出るので敷き詰める。
   横長のロゴは同じことをすると文字が端から欠けるため、対象から外してある */
.mpin.logo-fill .lg { padding: 0; }
.mpin.logo-fill .lg img { width: 100%; height: 100%; object-fit: cover; }

.mme { width: 16px; height: 16px; border-radius: 50%; background: #4A90D9; border: 3px solid #fff; }
.mme { position: relative; }
.mme::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; background: rgba(74,144,217,.18); animation: mpulse 2.4s ease-out infinite; }
@keyframes mpulse { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .mme::after { animation: none; } }

.map-top { position: absolute; top: 0; left: 0; right: 0; padding: 14px 14px 18px; z-index: 10; background: linear-gradient(var(--paper) 40%, rgba(251,251,250,0)); pointer-events: none; }
.map-search { pointer-events: auto; max-width: 560px; margin: 0 auto; display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 0 14px 0 0; font-size: 13px; color: var(--gray); box-shadow: 0 2px 10px rgba(26,26,24,.08); }
.map-search b { color: var(--ink); }
.map-search.filled { border-color: var(--g500); }
.ms-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 11px 4px 11px 16px; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.ms-label { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ms-count { flex: none; font-size: 11.5px; color: var(--gray); font-variant-numeric: tabular-nums; }
.ms-clear { flex: none; width: 21px; height: 21px; border-radius: 50%; border: 0; background: var(--line); color: var(--gray); font-size: 10px; line-height: 1; cursor: pointer; }
.ms-clear:hover { background: var(--ink); color: #fff; }

/* ══ キーワード検索シート ══ */
.search-sheet { position: absolute; inset: 0; z-index: 50; visibility: hidden; pointer-events: none; }
.search-sheet.open { visibility: visible; pointer-events: auto; }
.search-sheet::before { content: ""; position: absolute; inset: 0; background: rgba(26,26,24,.28); opacity: 0; transition: opacity .18s; }
.search-sheet.open::before { opacity: 1; }
.ss-panel { position: absolute; background: #fff; display: flex; flex-direction: column; overflow: hidden; }
.ss-field { flex: none; display: flex; align-items: center; gap: 9px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.ss-fico { font-size: 14px; }
/* 16px未満だとiOSが自動でズームするので下げない */
.ss-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-family: inherit; font-size: 16px; color: var(--ink); }
.ss-cancel { flex: none; border: 0; background: none; font-family: inherit; font-size: 12px; font-weight: 700; color: var(--g700); cursor: pointer; }
.ss-results { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.ss-group { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; color: var(--gray); margin: 0; padding: 11px 14px 5px; background: var(--paper); }
.ss-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line); background: #fff; font-family: inherit; text-align: left; cursor: pointer; }
.ss-item:hover, .ss-item.on { background: var(--g100); }
.ss-ico { flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--g100); font-size: 12px; display: flex; align-items: center; justify-content: center; }
.ss-ico.station { background: var(--paper); }
.ss-thumb { flex: none; width: 34px; height: 34px; border-radius: 8px; background: #EFEAE1 center/cover no-repeat; }
.ss-b { flex: 1; min-width: 0; }
.ss-n { display: block; font-size: 13px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-m { display: block; font-size: 10.5px; color: var(--gray); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-c { flex: none; font-size: 11px; color: var(--gray); font-variant-numeric: tabular-nums; }
.ss-item mark, .ss-n mark, .ss-m mark { background: var(--coral1); color: inherit; border-radius: 3px; }
.ss-chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 14px 14px; }
.ss-chip { font-family: inherit; font-size: 11.5px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; background: #fff; color: var(--ink); cursor: pointer; }
.ss-chip:hover { background: var(--g100); border-color: var(--g500); }
.ss-chip b { font-weight: 400; color: var(--gray); font-size: 10.5px; }
.ss-none { padding: 26px 18px; text-align: center; }
.ss-none .t { font-size: 12.5px; font-weight: 700; margin: 0; }
.ss-none .m { font-size: 11.5px; color: var(--gray); margin: 5px 0 0; line-height: 1.85; }
.map-chips { pointer-events: none; max-width: 560px; margin: 10px auto 0; display: flex; gap: 7px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.map-chips .mchip { pointer-events: auto; }
.map-chips::-webkit-scrollbar { display: none; }
.mchip { white-space: nowrap; font-size: 11px; font-weight: 700; padding: 8px 15px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(26,26,24,.06); transition: background .15s, color .15s; }
.mchip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.map-redo { position: absolute; top: 128px; left: 50%; transform: translateX(-50%) translateY(-8px); background: #fff; border: 1px solid var(--line); box-shadow: 0 3px 12px rgba(26,26,24,.14); font-size: 12px; font-weight: 700; padding: 9px 18px; border-radius: 999px; color: var(--g700); z-index: 9; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.map-redo.show { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
.map-count { position: absolute; right: 14px; top: 138px; z-index: 9; background: var(--ink); color: #fff; font-size: 11px; font-weight: 700; padding: 6px 12px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.map-locate { position: absolute; right: 14px; bottom: 218px; width: 44px; height: 44px; border-radius: 50%; background: #fff; border: 1px solid var(--line); box-shadow: 0 2px 10px rgba(26,26,24,.15); display: flex; align-items: center; justify-content: center; font-size: 18px; z-index: 9; }

.map-carousel { position: absolute; left: 0; right: 0; bottom: 18px; z-index: 10; display: flex; gap: 12px; overflow-x: auto; padding: 6px 16px 4px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.map-carousel::-webkit-scrollbar { display: none; }
/* カード全体がリンク。リンクの既定の下線と文字色は打ち消す。
   1,500枚規模を並べるので、画面外のカードは描画をスキップする(content-visibility)。
   サイズは確保しておかないとスクロール位置とoffsetLeft同期が壊れるためintrinsic-sizeを指定 */
.mcard { content-visibility: auto; contain-intrinsic-size: 360px 128px; color: inherit; text-decoration: none; scroll-snap-align: center; flex: 0 0 min(86%, 360px); background: #fff; border-radius: 18px; box-shadow: 0 6px 24px rgba(26,26,24,.16); overflow: hidden; display: flex; border: 2px solid transparent; transition: border-color .18s; }
.mcard.sel { border-color: var(--g700); }
.mcard.hidden { display: none; }
.mcard .thumb { width: 112px; flex-shrink: 0; position: relative; min-height: 128px; }
.mcard .thumb.as-logo { padding: 14px; }
.mcard .tag { position: absolute; top: 8px; left: 8px; background: var(--coral); color: #fff; font-size: 9px; font-weight: 700; padding: 3px 7px; border-radius: 4px; }
.mcard .cb { padding: 11px 13px 12px; flex: 1; min-width: 0; }
.mcard h3 { font-size: 13px; font-weight: 700; margin: 0 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcard .cm { font-size: 10px; color: var(--gray); margin-bottom: 6px; }
.mcard .cm b { color: var(--g700); }
.mcard .msuits { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 7px; }
.mcard .cf { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mcard .price { font-size: 10px; color: var(--gray); }
.mcard .price b { font-family: var(--num); font-size: 14px; color: var(--ink); }
.map-toast { position: absolute; left: 50%; bottom: 170px; transform: translateX(-50%); background: rgba(26,26,24,.92); color: #fff; font-size: 12px; padding: 11px 18px; border-radius: 12px; z-index: 60; opacity: 0; pointer-events: none; transition: opacity .25s; max-width: 82%; text-align: center; }
.map-toast.show { opacity: 1; }

/* 管理者向けプレビュー(未公開のスタジオも表示するモード) */
.preview-bar { background: #2B2B28; color: #fff; font-size: 12.5px; padding: 9px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.preview-bar a { color: #fff; text-decoration: underline; margin-left: auto; }
.map-screen.with-preview-bar { height: calc(100dvh - 58px - 38px); }
.mpin.unpublished .ph { border-color: #D96D4B; border-style: dashed; opacity: .82; }
.mpin.unpublished .pr { background: #D96D4B; }
.mcard.unpublished { border-color: #D96D4B; }
.pv-status { display: inline-block; font-size: 9.5px; font-weight: 700; padding: 1px 7px; border-radius: 4px; background: #FBE9E0; color: #9a4a28; margin-bottom: 4px; }
.pv-status.rejected { background: #EDEAE3; color: #6E6A63; }

/* ══ スタジオシート(中間情報) ══
   カードのタップで開く。地図を残したまま比較できるようにする */
.studio-sheet { position: absolute; inset: 0; z-index: 40; visibility: hidden; pointer-events: none; }
.studio-sheet.open { visibility: visible; pointer-events: auto; }
.studio-sheet::before {
  content: ""; position: absolute; inset: 0; background: rgba(26,26,24,.18);
  opacity: 0; transition: opacity .2s;
}
.studio-sheet.open::before { opacity: 1; }

.sheet-panel {
  position: absolute; background: #fff; overflow-y: auto;
  transition: transform .24s ease;
}
.sheet-grip { display: none; }
.sheet-inner { position: relative; }
.sheet-close {
  position: absolute; right: 10px; top: 10px; z-index: 2;
  width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.92);
  border: 1px solid var(--line); font-size: 13px; color: var(--gray); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
/* 写真はシートの上端いっぱいまで出す。グリップと✕は写真に重ねる */
.sheet-photo { position: relative; height: 160px; }
.sheet-photo::after {   /* 白い✕とグリップを写真の上でも読めるようにする薄い影 */
  content: ""; position: absolute; inset: 0 0 auto; height: 56px;
  background: linear-gradient(rgba(26,26,24,.22), rgba(26,26,24,0));
}
.sheet-body { padding: 16px 18px 20px; }
.sheet-name { font-family: var(--serif); font-size: 18px; font-weight: 700; color: var(--g900); margin: 0; line-height: 1.45; }
.sheet-meta { font-size: 12px; color: var(--gray); margin: 4px 0 0; line-height: 1.7; }
.sheet-meta b { color: var(--g700); }
.sheet-chips { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 10px; }
.sheet-prices { margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.sheet-prices .r { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 8px 13px; font-size: 12.5px; border-top: 1px solid var(--line); }
.sheet-prices .r:first-child { border-top: 0; }
.sheet-prices .r b { font-size: 15px; font-variant-numeric: tabular-nums; }
.sheet-info { font-size: 11.5px; color: var(--gray); margin: 9px 0 0; line-height: 1.75; }
.sheet-cta { display: flex; gap: 8px; margin-top: 14px; }
.sheet-cta .btn-cta { flex: 1; text-align: center; padding: 12px; }
.sheet-cta .tel { padding: 12px 15px; font-size: 15px; line-height: 1; }
.sheet-loading { padding: 40px 18px; text-align: center; font-size: 12.5px; color: var(--gray); }

/* デスクトップ: 検索バーの直下にドロップダウン(全画面にしない) */
@media (min-width: 561px) {
  .search-sheet::before { display: none; }
  .ss-panel {
    top: 56px; left: 50%; transform: translateX(-50%);
    width: min(560px, calc(100% - 28px)); max-height: min(60%, 460px);
    border: 1px solid var(--line); border-radius: 14px;
    box-shadow: 0 12px 34px rgba(26,26,24,.18);
  }
  .ss-cancel { display: none; }   /* Esc・外クリックで閉じられるので出さない */
}

/* モバイル: 全画面(キーボードが出るぶん、候補の領域を広く取る) */
@media (max-width: 560px) {
  .ss-panel { inset: 0; padding-bottom: env(safe-area-inset-bottom); }
}

/* デスクトップ: 右サイドパネル(地図を隠さない) */
@media (min-width: 561px) {
  .studio-sheet { pointer-events: none; }
  .studio-sheet::before { display: none; }   /* 地図を暗くしない */
  .studio-sheet.open .sheet-panel { pointer-events: auto; transform: translateX(0); }
  .sheet-panel {
    top: 0; right: 0; bottom: 0; width: 340px;
    border-left: 1px solid var(--line); box-shadow: -6px 0 24px rgba(26,26,24,.12);
    transform: translateX(100%);
  }
}

/* モバイル: ボトムシート(地図を上に残す) */
@media (max-width: 560px) {
  .sheet-panel {
    left: 0; right: 0; bottom: 0; max-height: 76%;
    border-radius: 18px 18px 0 0; box-shadow: 0 -8px 30px rgba(26,26,24,.2);
    transform: translateY(100%);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .studio-sheet.open .sheet-panel { transform: translateY(0); }
  .sheet-grip { display: block; width: 38px; height: 4px; border-radius: 99px; background: var(--line); margin: 9px auto 2px; }
  /* 写真がある店は写真の上に重ね、ない店はそのまま上部に置く */
  .sheet-panel:has(.sheet-photo) .sheet-grip {
    position: absolute; z-index: 3; left: 50%; top: 8px; margin: 0;
    transform: translateX(-50%); background: rgba(255,255,255,.9);
  }
  .sheet-photo { height: 150px; }
}

@media (prefers-reduced-motion: reduce) {
  .sheet-panel { transition: none; }
}
