/* ===== イマココ地番マップ / 地図画面 ===== */
* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body {
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
  overflow: hidden;
}
#map { position: absolute; inset: 0; }

/* --- 上部バー --- */
#topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 1px 6px rgba(0,0,0,.18);
}
#brand {
  display: flex; align-items: center; gap: 4px;
  text-decoration: none; color: #1a6b46; font-weight: 700; white-space: nowrap;
}
.brand-name { font-size: 15px; }
#searchbox { position: relative; flex: 1; max-width: 420px; display: flex; }
#search-input {
  flex: 1; padding: 8px 10px; border: 1px solid #ccc; border-radius: 6px 0 0 6px;
  font-size: 14px; outline: none; min-width: 0;
}
#search-input:focus { border-color: #1a6b46; }
#search-btn {
  border: 1px solid #1a6b46; background: #1a6b46; color: #fff;
  border-radius: 0 6px 6px 0; padding: 0 14px; cursor: pointer; font-size: 14px;
}
#search-results {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 30;
  margin: 4px 0 0; padding: 0; list-style: none;
  background: #fff; border: 1px solid #ddd; border-radius: 6px;
  max-height: 260px; overflow-y: auto; box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
#search-results li { padding: 9px 12px; font-size: 13px; cursor: pointer; border-bottom: 1px solid #f0f0f0; }
#search-results li:hover { background: #eef7f2; }

/* --- 地番パネル --- */
#chiban-panel {
  position: absolute; z-index: 15;
  top: 58px; left: 12px;
  background: rgba(255,255,255,.95);
  border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.2);
  padding: 10px 14px; max-width: 320px;
}
#chiban-address { font-size: 11px; color: #666; }
#chiban-address .cross { color: #d33; font-weight: 700; }
#chiban-main { font-size: 20px; font-weight: 700; color: #143; line-height: 1.3; margin-top: 2px; }
#chiban-sub { font-size: 12px; color: #555; }
#copy-btn {
  margin-top: 6px; font-size: 12px; padding: 4px 10px;
  border: 1px solid #1a6b46; color: #1a6b46; background: #fff;
  border-radius: 999px; cursor: pointer;
}
#copy-btn:active { background: #1a6b46; color: #fff; }

/* --- 中心十字 --- */
#crosshair {
  position: absolute; z-index: 10; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  font-size: 26px; color: #d33; font-weight: 700;
  text-shadow: 0 0 3px #fff, 0 0 6px #fff;
  pointer-events: none;
}

/* --- レイヤー切替 --- */
#layer-ctrl {
  position: absolute; z-index: 15; bottom: 28px; left: 12px;
  display: flex; gap: 6px; align-items: center;
  background: rgba(255,255,255,.94); border-radius: 999px;
  padding: 6px 10px; box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.base-btn {
  border: 1px solid #ccc; background: #fff; border-radius: 999px;
  padding: 6px 12px; font-size: 12px; cursor: pointer; white-space: nowrap;
}
.base-btn.active { background: #1a6b46; border-color: #1a6b46; color: #fff; font-weight: 700; }
.layer-toggle {
  font-size: 12px; display: flex; align-items: center; gap: 4px;
  padding-left: 6px; border-left: 1px solid #ddd; cursor: pointer; user-select: none;
}

/* --- ツールバー --- */
#toolbar {
  position: absolute; z-index: 15; top: 58px; right: 10px;
  display: flex; flex-direction: column; gap: 6px;
  background: rgba(255,255,255,.94); border-radius: 12px;
  padding: 8px 6px; box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.tool-btn {
  width: 38px; height: 38px; border: 1px solid #ddd; border-radius: 9px;
  background: #fff; font-size: 17px; cursor: pointer; line-height: 1;
  display: flex; align-items: center; justify-content: center; font-weight: 700; color: #444;
}
.tool-btn:hover { background: #eef7f2; }
.tool-btn.active { background: #1a6b46; border-color: #1a6b46; color: #fff; }

/* --- 計測結果 --- */
#measure-readout {
  position: absolute; z-index: 15; bottom: 88px; left: 12px;
  background: rgba(255,255,255,.96); border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  padding: 10px 14px; font-size: 13px; max-width: 320px;
}
#measure-readout b { color: #005580; font-size: 15px; }
#measure-readout button {
  margin-left: 8px; font-size: 11px; padding: 3px 10px;
  border: 1px solid #999; background: #fff; border-radius: 999px; cursor: pointer;
}

/* --- ピン一覧パネル --- */
#pin-panel {
  position: absolute; z-index: 25; top: 0; right: 0; bottom: 0;
  width: min(320px, 88vw);
  background: #fff; box-shadow: -3px 0 14px rgba(0,0,0,.25);
  transform: translateX(105%); transition: transform .22s ease;
  display: flex; flex-direction: column;
}
#pin-panel.open { transform: translateX(0); }
#pin-panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; font-weight: 700; color: #1a6b46; border-bottom: 1px solid #eee;
}
#pin-panel-close { border: none; background: none; font-size: 16px; cursor: pointer; color: #888; }
#pin-panel-note { font-size: 11px; color: #999; margin: 8px 16px 0; }
#pin-list { list-style: none; margin: 8px 0 0; padding: 0 12px 20px; overflow-y: auto; flex: 1; }
#pin-list li { border-bottom: 1px solid #f0f0f0; padding: 10px 6px; }
.pin-memo { font-size: 14px; font-weight: 600; }
.pin-sub { font-size: 11px; color: #888; margin-top: 2px; }
.pin-acts { margin-top: 6px; display: flex; gap: 8px; }
.pin-acts button {
  font-size: 11px; padding: 3px 12px; border-radius: 999px;
  border: 1px solid #1a6b46; color: #1a6b46; background: #fff; cursor: pointer;
}
.pin-acts button[data-act="del"] { border-color: #c33; color: #c33; }
.pin-empty { font-size: 12px; color: #999; padding: 14px 6px; }

/* --- ズームヒント --- */
#zoom-hint {
  position: absolute; z-index: 15; bottom: 88px; left: 50%; transform: translateX(-50%);
  background: rgba(30,30,30,.8); color: #fff; font-size: 12px;
  padding: 8px 16px; border-radius: 999px; pointer-events: none;
}

/* --- ポップアップ --- */
.maplibregl-popup-content { font-size: 13px; line-height: 1.5; border-radius: 8px; }
.popup-chiban { font-size: 17px; font-weight: 700; color: #143; }
.popup-note { font-size: 10.5px; color: #999; margin-top: 6px; border-top: 1px dashed #eee; padding-top: 4px; }

/* --- 印刷 --- */
#print-header { display: none; }
@media print {
  #topbar, #toolbar, #layer-ctrl, #zoom-hint, #pin-panel, #measure-readout,
  #copy-btn, .maplibregl-control-container { display: none !important; }
  #print-header {
    display: block; position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    background: #fff; font-size: 10px; padding: 4px 8px; border-bottom: 1px solid #ccc;
  }
  #chiban-panel { top: 30px; box-shadow: none; border: 1px solid #ccc; }
  html, body, #app, #map { width: 100%; height: 100%; }
}

@media (max-width: 600px) {
  .brand-name { display: none; }
  #chiban-panel { max-width: calc(100vw - 24px); right: 12px; }
  #chiban-main { font-size: 17px; }
}
