/* SAWA v177: スマホ・PWA・Googleマップ連携（上書きのみ） */
:root { --m7-blue: #1a73e8; --m7-shadow: 0 2px 10px rgba(20, 30, 40, .22); }

/* ---- 現在地ボタン（スマホ） ---- */
#m7Loc { display: none; position: fixed; right: 12px; bottom: calc(214px + env(safe-area-inset-bottom)); z-index: 63;
  width: 58px; height: 58px; border-radius: 50%; border: 0; background: #fff; color: var(--ink, #1c2733);
  box-shadow: var(--m7-shadow); padding: 0; cursor: pointer; flex-direction: column; align-items: center; justify-content: center;
  font: 600 9.5px var(--sans); letter-spacing: .04em; -webkit-tap-highlight-color: transparent; }
#m7Loc svg { width: 26px; height: 26px; margin-bottom: 1px; }
#m7Loc svg .core { fill: transparent; }
#m7Loc[data-state="wait"] { color: var(--m7-blue); }
#m7Loc[data-state="wait"] svg { animation: m7spin 1.1s linear infinite; }
#m7Loc[data-state="lock"] { color: #fff; background: var(--m7-blue); }
#m7Loc[data-state="lock"] svg .core { fill: #fff; }
#m7Loc[data-state="bg"] { color: var(--m7-blue); }
#m7Loc[data-state="bg"] svg .core { fill: var(--m7-blue); }
#m7Loc:active { transform: scale(.96); }
@keyframes m7spin { to { transform: rotate(360deg); } }
.m7-touch #m7Loc { display: flex; }
@media (max-width: 820px) { #m7Loc { display: flex; } }
body:has(#card.show) #m7Loc { bottom: calc(62dvh + 12px); }
body:has(#fieldSheet.open) #m7Loc { display: none; }

/* 地図右上の標準の現在地ボタンはスマホでは隠す（大きいボタンに置き換え。動作は同じコントロール） */
.m7-touch .maplibregl-ctrl-group:has(.maplibregl-ctrl-geolocate) { display: none; }
@media (max-width: 820px) { .maplibregl-ctrl-group:has(.maplibregl-ctrl-geolocate) { display: none; } }

/* 現在地の青い点を大きく・方位を見やすく */
.maplibregl-user-location-dot { width: 18px !important; height: 18px !important; }
.maplibregl-user-location-dot::after { width: 22px !important; height: 22px !important; top: -4px !important; left: -4px !important; border-width: 3px !important; }
.maplibregl-user-location-dot::before { width: 18px !important; height: 18px !important; }
.maplibregl-user-location-show-heading .maplibregl-user-location-heading { border-bottom-width: 12px !important; }
.maplibregl-user-location-accuracy-circle { background-color: rgba(26, 115, 232, .14) !important; border: 1px solid rgba(26, 115, 232, .45); }

/* ---- 現在地チップ ---- */
#m7LocChip { position: fixed; z-index: 64; top: calc(60px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  max-width: calc(100vw - 20px); display: flex; align-items: center; gap: 8px; padding: 7px 8px 7px 12px; border-radius: 22px;
  background: #fff; box-shadow: var(--m7-shadow); font: 12.5px/1.35 var(--sans); color: var(--ink, #1c2733); }
#m7LocChip[hidden] { display: none; }
#m7LocChip .pulse { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--m7-blue); box-shadow: 0 0 0 0 rgba(26, 115, 232, .5); animation: m7pulse 1.8s infinite; }
@keyframes m7pulse { 70% { box-shadow: 0 0 0 9px rgba(26, 115, 232, 0); } 100% { box-shadow: 0 0 0 0 rgba(26, 115, 232, 0); } }
#m7LocTxt { display: flex; flex-wrap: wrap; column-gap: 8px; min-width: 0; flex: 1 1 auto; }
#m7LocTxt .acc { color: #5a6572; font-family: var(--mono); font-size: 11.5px; }
#m7LocTxt .to { flex-basis: 100%; color: #36424f; font-size: 11.5px; }
#m7LocChip button { flex: none; border: 1px solid #c9c2b4; background: #fff; border-radius: 16px; padding: 5px 10px; font: 600 11.5px var(--sans); color: var(--ink, #1c2733); }
#m7LocOpen { border-color: var(--m7-blue) !important; color: var(--m7-blue) !important; }
#m7LocStop { padding: 3px 9px !important; font-size: 15px !important; line-height: 1; }
@media (max-width: 820px) { #m7LocChip { left: 10px; right: 56px; transform: none; max-width: none; } }
@media (min-width: 821px) { #m7LocChip { left: calc(340px + (100vw - 340px) / 2); top: 64px; width: max-content; max-width: min(620px, calc(100vw - 380px)); } }

/* ---- 筆カードの Googleマップ／経路／共有 ---- */
.m7-gbar { position: sticky; top: 0; z-index: 3; display: grid; grid-template-columns: 1.25fr 1fr .8fr; gap: 6px;
  margin: -10px -12px 10px; padding: 8px 12px; background: var(--panel, #fffdf8); border-bottom: 1px solid #e6e0d4; }
.m7-gbar button { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 40px; padding: 6px 8px;
  border: 1px solid #c9c2b4; border-radius: 20px; background: #fff; color: var(--ink, #1c2733); font: 600 12.5px var(--sans); cursor: pointer; white-space: nowrap; }
.m7-gbar button svg { width: 17px; height: 17px; fill: currentColor; flex: none; }
.m7-gbar button.pri { background: var(--m7-blue); border-color: var(--m7-blue); color: #fff; }
.m7-gbar button[data-a="dir"] { color: var(--m7-blue); border-color: var(--m7-blue); }
.m7-gbar.wait button { opacity: .55; }
@media (min-width: 821px) { .m7-gbar button { min-height: 32px; font-size: 12px; } }

/* ---- 長押し（右クリック）の地点メニュー ---- */
.m7-pop .maplibregl-popup-content { padding: 10px 12px 10px; border-radius: 10px; box-shadow: var(--m7-shadow); font: 12px/1.45 var(--sans); }
.m7-pt .ll { font-family: var(--mono); font-size: 12px; color: #36424f; padding-right: 14px; }
.m7-pt .pc { font-weight: 600; margin-top: 2px; }
.m7-pt .dd { color: #5a6572; font-size: 11.5px; }
.m7-pt .bt { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.m7-pt .bt button { border: 1px solid #c9c2b4; background: #fff; border-radius: 16px; padding: 7px 11px; font: 600 12px var(--sans); color: var(--ink, #1c2733); }
.m7-pt .bt button.pri { background: var(--m7-blue); border-color: var(--m7-blue); color: #fff; }
.maplibregl-canvas-container { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }

/* ---- Googleマップから受け取った地点のピン ---- */
.m7-gmpin { width: 26px; height: 36px; background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 36'%3E%3Cpath d='M13 0C5.8 0 0 5.6 0 12.6 0 22 13 36 13 36s13-14 13-23.4C26 5.6 20.2 0 13 0z' fill='%23ea4335'/%3E%3Ccircle cx='13' cy='12.6' r='4.6' fill='%23fff'/%3E%3C/svg%3E"); filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); }

/* ---- PWA インストール案内 ---- */
#m7Install { position: fixed; z-index: 90; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 12px; border-radius: 14px; background: #fff;
  box-shadow: 0 4px 18px rgba(20, 30, 40, .28); font: 12.5px/1.45 var(--sans); color: var(--ink, #1c2733); }
#m7Install img { border-radius: 9px; flex: none; }
#m7Install .tx { display: flex; flex-direction: column; min-width: 0; flex: 1; }
#m7Install .tx span { color: #4a5563; font-size: 12px; }
#m7Install .tx svg { vertical-align: -2px; color: var(--m7-blue); }
#m7Install .add { border: 0; background: var(--m7-blue); color: #fff; border-radius: 18px; padding: 9px 16px; font: 600 13px var(--sans); }
#m7Install .x { border: 0; background: none; font-size: 20px; color: #5a6572; padding: 4px 6px; }
@media (min-width: 821px) { #m7Install { left: auto; width: 380px; } }

/* ---- トースト ---- */
#m7Toast { position: fixed; z-index: 95; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  max-width: calc(100vw - 32px); padding: 9px 14px; border-radius: 10px; background: rgba(28, 39, 51, .94); color: #fff;
  font: 12.5px/1.5 var(--sans); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
#m7Toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---- スマホの細かな整理 ---- */
@media (max-width: 820px) {
  #chipA { display: none !important; }          /* 「左: 航空写真…」は2画面比較のときだけ意味がある */
}
