/* =====================================================
   業務用Webマップ - スタイルシート
   方針: 業務ソフト風。落ち着いた配色。派手さは不要。
   ===================================================== */

/* --- リセット・基本設定 --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: "Meiryo", "メイリオ", "Yu Gothic", sans-serif;
  font-size: 13px;
  color: #333;
  background: #e8e8e8;
}

/* --- 全体レイアウト: 左パネル | 地図 | 右パネル --- */
body {
  display: flex;
  flex-direction: row;
  height: 100vh;
  overflow: hidden;
}

/* =====================================================
   左パネル
   ===================================================== */
#left-panel {
  width: 240px;
  min-width: 240px;
  background: #fff;
  border-right: 1px solid #ccc;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 10;
}

/* =====================================================
   右パネル
   ===================================================== */
#right-panel {
  width: 260px;
  min-width: 260px;
  background: #fff;
  border-left: none;
  box-shadow: -2px 0 6px rgba(0,70,110,0.16);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
  transition: width 0.15s ease, min-width 0.15s ease;
}

#right-panel.is-collapsed {
  width: 0;
  min-width: 0;
  overflow: hidden;
  box-shadow: none;
}

.right-panel-ribbon {
  appearance: none;
  -webkit-appearance: none;
  position: absolute;
  right: 0;
  top: 220px;
  width: 26px;
  height: 136px;
  background: #0b6fae;
  border: 0;
  border-radius: 8px 0 0 8px;
  box-shadow: -2px 0 6px rgba(0,0,0,0.22);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  padding: 0;
  outline: none;
}

.right-panel-ribbon:focus-visible {
  outline: 2px solid #5ab0e8;
  outline-offset: 2px;
}

/* open状態: 少し濃くしてパネルと接続して見せる */
.right-panel-ribbon.is-open {
  background: #084f7a;
}

/* 三角矢印: 閉じているとき ▶ */
.right-panel-ribbon::after {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid #ffffff;
}

/* 三角矢印: 開いているとき ◀ */
.right-panel-ribbon.is-open::after {
  border-left: none;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-right: 7px solid #ffffff;
}



.right-panel-ribbon:hover {
  background: #0d86d8;
}

/* =====================================================
   パネル共通パーツ
   ===================================================== */

/* パネル上部ヘッダー */
.panel-header {
  background: #2c3e50;
  color: #ecf0f1;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 0.03em;
  flex-shrink: 0;
  position: relative;
}

/* 属性情報ヘッダ: 「属性情報」表記 + 全選択/全解除/再読込 の赤ボタン3つ */
.attr-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.attr-header-actions {
  margin-left: auto;
  display: flex;
  gap: 4px;
}
.attr-action-btn {
  font-size: 11px;
  font-weight: normal;
  font-family: inherit;
  color: #fff;
  background: #d98a82;            /* 強すぎない柔らかい赤 (2026-05-21) */
  border: 1px solid #cf7b72;
  border-radius: 3px;
  padding: 3px 8px;
  cursor: pointer;
  letter-spacing: 0;
}
.attr-action-btn:hover { background: #cf7b72; }
.attr-action-btn:disabled,
.attr-action-btn.is-disabled {
  background: #e2c4c0;
  border-color: #e2c4c0;
  cursor: not-allowed;
}

/* URL screenshot の 3択メニュー (URLを取得 / QRコード生成 / screenshot) */
.share-menu {
  position: fixed;
  z-index: 4000;
  background: #fff;
  border: 1px solid #9ab;
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 140px;
}
.share-menu button {
  font-size: 12px;
  font-family: inherit;
  text-align: left;
  background: #fff;
  color: #2c3e50;
  border: none;
  border-radius: 3px;
  padding: 7px 10px;
  cursor: pointer;
}
.share-menu button:hover { background: #eaf0f8; }

/* QRコード表示モーダル */
.share-qr-overlay {
  position: fixed; inset: 0; z-index: 4100;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
}
.share-qr-box {
  background: #fff; border-radius: 6px; padding: 18px 20px;
  text-align: center; max-width: 88vw;
}
.share-qr-title { font-size: 13px; font-weight: bold; color: #2c3e50; margin-bottom: 10px; }
#share-qr-canvas { display: inline-block; }
.share-qr-url { font-size: 10px; color: #667; word-break: break-all; margin: 10px 0; max-width: 260px; }
.share-qr-close {
  font-size: 12px; font-family: inherit; cursor: pointer;
  background: #2c3e50; color: #fff; border: none; border-radius: 3px; padding: 6px 16px;
}
.share-qr-close:hover { background: #34495e; }

/* 共有URL表示モーダル */
.share-url-note { font-size: 12px; color: #445; margin: 8px 0; text-align: left; line-height: 1.5; }
.share-url-text {
  width: 100%; box-sizing: border-box; font-size: 12px; font-family: monospace;
  border: 1px solid #9ab; border-radius: 4px; padding: 8px; resize: vertical; color: #222;
}
.share-url-actions { margin-top: 12px; display: flex; gap: 8px; justify-content: center; }
.share-url-copy {
  font-size: 12px; font-family: inherit; cursor: pointer;
  background: #2c3e50; color: #fff; border: none; border-radius: 3px; padding: 6px 16px;
}
.share-url-copy:hover { background: #34495e; }

/* バージョン表記（タイトル枠右下） */
.title-version {
  position: absolute;
  right: 8px;
  bottom: 4px;
  font-size: 10px;
  color: #bbb;
  font-weight: normal;
  letter-spacing: 0;
}

/* セクション区切り */
.panel-section {
  padding: 10px 12px;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
}

/* 属性情報エリア: DLボタン下に固定、残り高さを占有してスクロール */
#attr-section {
  flex: 1 1 0;
  flex-shrink: 1;
  overflow-y: auto;
  min-height: 80px;
}

/* セクションタイトル */
.section-title {
  font-size: 11px;
  color: #444;
  font-weight: bold;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #eee;
}

/* タイトルと解除ボタンを横並びにするラッパー
   section-title の border-bottom / margin-bottom をラッパー側で担う */
.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #eee;
}

/* ラッパー内では section-title 自身の下余白・ボーダーを無効化して重複を防ぐ */
.section-header-row .section-title {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

/* 選択解除ボタン */
.btn-clear-selection {
  font-size: 11px;
  color: #c0392b;
  background: #ffe8e8;
  border: 1px solid #e0a0a0;
  padding: 3px 10px;
  min-width: 81px;
  cursor: pointer;
  font-family: inherit;
  border-radius: 2px;
}

.btn-clear-selection:hover {
  background: #fff;
  border-color: #c0392b;
}

/* =====================================================
   検索
   ===================================================== */
.search-wrap {
  position: relative;
}

.geocode-dropdown {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 200;
  background: #fff;
  border: 1px solid #bbb;
  border-top: none;
  max-height: 180px;
  overflow-y: auto;
  box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

.geocode-dropdown.is-open {
  display: block;
}

.geocode-item {
  padding: 5px 8px;
  font-size: 12px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  line-height: 1.4;
  color: #333;
}

.geocode-item:last-child {
  border-bottom: none;
}

.geocode-item:hover {
  background: #edf3fb;
}

.search-input {
  width: 100%;
  padding: 5px 7px;
  font-size: 12px;
  border: 1px solid #bbb;
  background: #fafafa;
  color: #333;
  outline: none;
  margin-bottom: 5px;
}

.search-input:focus {
  border-color: #5a7fa8;
  background: #fff;
}

/* アクションボタン: 業務ソフト風の控えめなボタン */
.btn-action {
  display: block;
  width: 100%;
  padding: 5px 0;
  background: #5a7fa8;
  color: #fff;
  border: none;
  font-size: 12px;
  cursor: pointer;
  letter-spacing: 0.05em;
}

.btn-action:hover {
  background: #4a6f98;
}

/* 検索結果メッセージの共通レイアウト（色はis-success / is-errorで上書きする） */
.search-result-text {
  margin-top: 6px;
  font-size: 11px;
  min-height: 18px;
  padding: 3px 6px;
  line-height: 1.4;
}

/* 検索成功 */
.search-result-text.is-success {
  color: #1e5e22;
  background: #eaf4ea;
  border-left: 3px solid #4caf50;
}

/* 未検出・エラー */
.search-result-text.is-error {
  color: #8b1a08;
  background: #fdecea;
  border-left: 3px solid #c0392b;
}

/* =====================================================
   背景地図切替ラジオボタン
   ===================================================== */
.radio-row {
  display: flex;
  align-items: center;
  gap: 6px;
  /* padding-left を広めに取り、選択時の左ボーダーでレイアウトがずれないようにする */
  padding: 4px 4px 4px 9px;
  font-size: 12px;
  cursor: pointer;
  color: #444;
  border-left: 3px solid transparent;  /* 非選択時は透明で幅を確保 */
}

.radio-row:hover {
  background: #f5f5f5;
  color: #2c3e50;
}

/* 選択中の背景地図ラベルを強調表示 */
.radio-row:has(input:checked) {
  background: #eaf0f8;
  color: #1a3a5c;
  font-weight: bold;
  border-left-color: #5a7fa8;
}

/* =====================================================
   レイヤ管理
   ===================================================== */

/* レイヤグループ: 分類見出し + その配下のレイヤ行をまとめる単位 */
.layer-group {
  margin-bottom: 6px;
}

/* レイヤ分類見出し: セクションタイトルより小さく、補助的な位置づけ */
.layer-group-title {
  font-size: 10px;
  color: #555;
  letter-spacing: 0.05em;
  padding: 4px 0 3px 0;
  border-bottom: 1px dotted #e0e0e0;
  margin-bottom: 3px;
}

.layer-row {
  padding: 4px 0;
}

.layer-row-sub {
  padding-left: 12px;
}

/* 開閉式ツリー（公共基準点など） */
.layer-tree {
  margin: 0;
  padding: 0;
  border: none;
}

.layer-tree-title {
  font-size: 12px;
  color: #444;
  padding: 4px 0;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.layer-tree-title::-webkit-details-marker {
  display: none;
}

.layer-tree-title::before {
  content: '▶ ';
  font-size: 12px;
  color: #555;
}

.layer-tree[open] .layer-tree-title::before {
  content: '▼ ';
}

.layer-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
  color: #444;
}

.layer-label:hover {
  color: #2c3e50;
}


/* レイヤ凡例シンボル（基底クラス）
   ポリゴン用 .layer-symbol-polygon や点用 .layer-symbol-point と組み合わせて使う */
.layer-symbol {
  display: inline-block;
  width: 14px;
  height: 10px;
  flex-shrink: 0;
}

/* ポリゴンレイヤ用シンボル（塗り＋輪郭の矩形） */
.layer-symbol-polygon {
  background: rgba(255, 255, 0, 0.35);
  border: 1px solid #cc0000;
}

/* 地番図レイヤ用シンボル（青系で筆界の黄色・赤と区別する） */
.layer-symbol-polygon-chiban {
  background: rgba(100, 180, 255, 0.45);
  border: 1px solid #1a5fa0;
}

/* 点レイヤ用シンボル（円形）
   公共基準点など点データのレイヤ行で使う。
   width/height を上書きして正方形にしてから border-radius で円形にする。 */
.layer-symbol-point {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #5a7fa8;
  border: 1.5px solid #2c5f8a;
}

/* 透明度スライダー行 */
.layer-opacity-row {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 0 4px 0;
}

.opacity-label {
  font-size: 11px;
  color: #555;
  white-space: nowrap;
}

.layer-opacity-row input[type="range"] {
  flex: 1;
  height: 3px;
  cursor: pointer;
  accent-color: #5a7fa8;
}

/* =====================================================
   中央：地図コンテナ
   ===================================================== */
#map-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
}

#map-crosshair {
  position: absolute;
  top: 50%; left: 50%;
  pointer-events: none;
  z-index: 10;
}
#map-crosshair::before {
  content: '';
  position: absolute;
  width: 32px; height: 3px;
  top: -1.5px; left: -16px;
  background: rgba(0,0,0,0.85);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.65);
}
#map-crosshair::after {
  content: '';
  position: absolute;
  width: 3px; height: 32px;
  top: -16px; left: -1.5px;
  background: rgba(0,0,0,0.85);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.65);
}

#zoom-display {
  position: absolute;
  bottom: 28px;
  left: 8px;
  background: rgba(255,255,255,0.85);
  border: 1px solid #bbb;
  border-radius: 2px;
  padding: 2px 6px;
  font-size: 11px;
  font-family: monospace;
  color: #333;
  pointer-events: none;
  z-index: 10;
  line-height: 1.4;
  white-space: nowrap;
}
#coord-display {
  margin-left: 8px;
  color: #444;
}

/* 表示中ポリゴンの全選択/全解除は属性情報ヘッダ(.attr-header-actions)へ移設
   (2026-05-21)。地図上の #select-all-tools / #select-all-hint は廃止。 */

/* =====================================================
   地番検索UI（地番検索ボタン / ポップアップ / 4層コンボボックス）
   ===================================================== */

/* 地番検索ボタン: 住所検索セクション内。住所の検索ボタン(青)と区別する
   ため緑系。押すと地図上に地番検索パネルがポップアップする。 */
.btn-chiban-search {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 5px 0;
  background: #4f9d6b;
  color: #fff;
  border: none;
  font-size: 12px;
  cursor: pointer;
  letter-spacing: 0.05em;
}
.btn-chiban-search:hover {
  background: #438a5d;
}

/* 地番検索ポップアップ: 地図左上にオーバーレイ。常駐しない (×で閉じる)。 */
#search-panel {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 256px;
  max-height: calc(100% - 20px);
  background: #fff;
  border: 1px solid #bbb;
  border-radius: 4px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 15;
}

/* ①②③ 検索パネル改善 (2026-05-22):
   ① 二重スクロール解消 — 地番一覧が開いている時はパネル自身のスクロールを止め、
      一覧(.dd-options-chiban)だけが残り高さを埋めてスクロールする(縦スクロール1本)。
   ② 右に幅を広げられる(resize: horizontal)。
   ③ パネルは max-height で常に画面内に収まり(既存 calc(100%-20px))、一覧が縮むので
      下部のアクション(地図で表示/canvas/全解除 等)が隠れない。左上配置のため右下の
      ズームコントロールにも被らない。
   :has 非対応ブラウザでは従来どおりパネルスクロール(無回帰)。 */
#search-panel {
  resize: horizontal;
  min-width: 256px;
  max-width: 90vw;
}
#search-panel:has(.dd-options-chiban.is-open) { overflow: hidden; }
#search-panel:has(.dd-options-chiban.is-open) > .panel-section {
  flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
}
#search-panel:has(.dd-options-chiban.is-open) #dd-chiban-field {
  flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
}
#search-panel:has(.dd-options-chiban.is-open) #dd-chiban {
  flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
}
#search-panel:has(.dd-options-chiban.is-open) .dd-options-chiban.is-open {
  flex: 1 1 auto; min-height: 0; max-height: none;
}

/* ポップアップのヘッダ（タイトル + ×閉じるボタン） */
.search-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.search-panel-close {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  color: #ecf0f1;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}
.search-panel-close:hover {
  color: #fff;
}

/* 4層コンボボックス: ラベル + 窓 (input + 候補ドロップダウン)。 */
.dd-field {
  margin-bottom: 9px;
}
.dd-label {
  display: block;
  font-size: 11px;
  color: #555;
  margin-bottom: 2px;
}
.dd-combo {
  position: relative;
}
/* ④地番選択後の挙動を示す注記 (旧「図郭から選択して確認」ボタンの跡地)。 */
.dd-note {
  margin: 10px 2px 0;
  font-size: 11px;
  line-height: 1.5;
  color: #667;
}
.dd-status {
  margin: 8px 2px 0;
  padding: 7px 8px;
  border: 1px solid #cfd8e3;
  background: #f5f8fb;
  color: #334155;
  font-size: 11px;
  line-height: 1.45;
  display: none;
}
.dd-status:not(:empty) {
  display: block;
}
.dd-status.is-warn {
  border-color: #e7c96f;
  background: #fff8db;
  color: #5d4800;
}
.dd-status.is-error {
  border-color: #e08a8a;
  background: #fff0f0;
  color: #8a1f1f;
}
/* 窓: 1つで「プルダウン表示」と「絞り込み入力」を兼ねる。 */
.dd-input {
  width: 100%;
  padding: 5px 7px;
  font-size: 12px;
  border: 1px solid #bbb;
  background: #fafafa;
  color: #333;
  outline: none;
}
.dd-input:focus {
  border-color: #5a7fa8;
  background: #fff;
}
.dd-combo.is-disabled .dd-input {
  background: #ececec;
  color: #aaa;
  cursor: not-allowed;
}
/* 候補ドロップダウン: 窓クリックで開閉する。 */
.dd-options {
  display: none;
  margin-top: 2px;
  border: 1px solid #bbb;
  background: #fff;
  max-height: 200px;
  overflow-y: auto;
}
.dd-options.is-open {
  display: block;
}
.dd-option {
  padding: 4px 8px;
  font-size: 12px;
  color: #333;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  line-height: 1.4;
}
.dd-option:last-child {
  border-bottom: none;
}
.dd-option:hover {
  background: #eaf0f8;
}
.dd-option.is-empty {
  color: #999;
  cursor: default;
}
.dd-option.is-empty:hover {
  background: #fff;
}
/* ④地番の候補は一覧性のため4列グリッドで表示する。 */
.dd-options-chiban.is-open {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 6px;
  max-height: min(520px, 58vh);
  overflow-y: auto;
}
.dd-options-chiban .dd-option {
  border: 1px solid #ddd;
  border-radius: 3px;
  text-align: center;
  padding: 4px 2px;
}
/* ④地番: 複数選択中の候補に視覚チェックを付ける (UX redesign: 2026-05-21)。
   左側に ✓ を CSS で付与し、即時 flyTo/canvas を廃止して「選択溜め」状態を
   明示する。is-selected は src/search-panel.js _renderChibanRows が toggle する。 */
.dd-option.is-selected {
  background: #fff3e0;
  border-color: #e67e22;
  color: #c0392b;
  font-weight: bold;
  position: relative;
}
.dd-option.is-selected::before {
  content: '✓';
  position: absolute;
  left: 4px; top: 50%; transform: translateY(-50%);
  color: #c0392b; font-size: 11px;
}
.dd-options-chiban .dd-option.is-selected {
  padding-left: 14px;
}

/* 地番選択 → アクション (地図で表示 / canvasで確認 / クリア) パネルのボタン */
.dd-action-btn {
  font-size: 12px;
  padding: 5px 10px;
  cursor: pointer;
  font-family: inherit;
  background: #2c3e50;
  color: #fff;
  border: none;
  border-radius: 3px;
}
.dd-action-btn:hover { background: #34495e; }
.dd-action-btn[disabled] { background: #999; cursor: not-allowed; }

/* 全図郭キャンバスを開くボタン（ポップアップ内） */
.btn-canvas-open {
  margin-top: 4px;
  background: #4f9d6b;
}
.btn-canvas-open:hover {
  background: #438a5d;
}

/* MapLibre のデフォルトコントロールを業務ソフト風に調整 */
.maplibregl-ctrl-group {
  border-radius: 0 !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2) !important;
}

.maplibregl-ctrl-group button {
  border-radius: 0 !important;
}

/* Narrow non-drawer layouts: shrink MapLibre controls to fit small screens. */
@media (min-width: 700px) and (max-width: 900px) {
  .maplibregl-ctrl-group button {
    width: 40px;
    height: 40px;
  }
}

/* Short / landscape windows: keep MapLibre bottom-right controls clear of the
   right-panel ribbon. The ribbon is a fixed vertical band (top:220px, height:136px
   => y 220-356). Bottom-anchored controls rise into that band only when the window
   is SHORT, regardless of width -- so the clearance is height-based, not width-based.
   (Verified: under the old width-only rule, w=1000/1300/1600 at h<=500 still overlapped;
   widening the width cap merely defers the same overlap to the next breakpoint.) */
@media (min-width: 700px) and (max-height: 600px) {
  .maplibregl-ctrl-bottom-right {
    right: 38px;
  }
}

@media (max-width: 900px) {
  #zoom-display {
    bottom: 255px;
  }
}

/* =====================================================
   右パネル：属性情報
   ===================================================== */

/* 地物未選択時のプレースホルダーテキスト */
.attr-placeholder {
  color: #333;
  font-size: 12px;
  line-height: 1.7;
  padding: 4px 0;
}

/* 属性表示上部のレイヤ由来ラベル（どのレイヤの地物かを示す） */
.attr-layer-label {
  font-size: 11px;
  color: #5a7fa8;
  font-weight: bold;
  letter-spacing: 0.05em;
  padding: 2px 0 6px 0;
  margin-bottom: 4px;
  border-bottom: 1px solid #e0e0e0;
}

/* 属性テーブル */
.attr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  line-height: 1.6;   /* 行間を広げて複数行でも読みやすくする */
}

.attr-table th,
.attr-table td {
  text-align: left;
  padding: 6px 8px;   /* 余白を少し広げて窮屈さを解消 */
  border-bottom: 1px solid #eee;
  vertical-align: top;
  overflow-wrap: anywhere;  /* break-all を廃止。必要なときだけ折り返す */
}

/* 属性名（th）: やや小さめのラベル文字として区別する */
.attr-table th {
  font-size: 11px;
  color: #555;
  font-weight: normal;
  letter-spacing: 0.03em;
  width: 72px;
  min-width: 72px;
  background: #f5f5f5;
}

/* 属性値（td）: th より少し濃くして値として読みやすくする */
.attr-table td {
  color: #222;
}

/* 正式値未登録の属性値。実測値との混同を防ぐために斜体で表示する */
.attr-unregistered {
  color: #777;
  font-style: italic;
  font-size: 11px;
}

/* policy 29: 空値 (null/空文字/空配列) の明示表示。値が無いことが
   一目で分かるよう、実値とは別の見た目（淡色・斜体）にする */
.attr-empty {
  color: #999;
  font-style: italic;
}

/* =====================================================
   右パネル：出力（将来実装の受け皿）
   ===================================================== */

/* 出力形式ボタン 4列×2行グリッド */
.output-format-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 2px 0;
}

/* 出力形式タグ（SIMA / CSV / DXF / KML）
   クリック不可・操作不可であることをグレー表示で示す */
.output-format-tag {
  font-size: 11px;
  color: #555;
  background: #f5f5f5;
  border: 1px solid #ddd;
  padding: 2px 7px;
  letter-spacing: 0.04em;
  cursor: default;
  user-select: none;
}

/* 出力セクション内の選択中対象表示（showAttrContent から同期される） */
.output-target-label {
  font-size: 13px;
  color: #333;
  margin-bottom: 6px;
  padding-bottom: 5px;
  border-bottom: 1px dotted #e0e0e0;
}

.output-target-label.is-empty {
  color: #333;
}

/* 出力ボタン共通ベース
   .btn-export-sima / csv-math / csv-survey / dxf / kml / geojson / jww / placeholder
   すべてこの構造を継承する */
.btn-export-sima,
.btn-export-csv-math,
.btn-export-csv-survey,
.btn-export-dxf,
.btn-export-kml,
.btn-export-geojson,
.btn-export-jww,
.btn-export-url,
.btn-export-placeholder {
  font-size: 11px;
  color: #555;
  background: #f2f2f2;
  border: 1px solid #ddd;
  padding: 2px 7px;
  letter-spacing: 0.04em;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
}

/* 行3の空箱: 将来用 (印刷出力/シェープファイル等)。点線枠で「未割当」を示す。 */
.btn-export-placeholder {
  border-style: dashed;
  background: #fafafa;
  min-height: 28px;
}

.btn-export-sima:disabled,
.btn-export-csv-math:disabled,
.btn-export-csv-survey:disabled,
.btn-export-dxf:disabled,
.btn-export-kml:disabled,
.btn-export-geojson:disabled,
.btn-export-jww:disabled,
.btn-export-placeholder:disabled {
  color: #555;
  background: #f2f2f2;
  border-color: #ddd;
  cursor: default;
}

.btn-export-sima:not(:disabled),
.btn-export-csv-math:not(:disabled),
.btn-export-csv-survey:not(:disabled),
.btn-export-dxf:not(:disabled),
.btn-export-kml:not(:disabled),
.btn-export-geojson:not(:disabled),
.btn-export-jww:not(:disabled),
.btn-export-url:not(:disabled) {
  color: #333;
  border-color: #5a7fa8;
  background: #eaf0f8;
  cursor: pointer;
}

/* URL screenshot ボタンは他の出力ボタンと同一スタイル (2026-05-21 統一)。 */
.btn-export-url:not(:disabled):hover {
  background: #dce8f5;
}

.btn-export-sima:not(:disabled):hover,
.btn-export-csv-math:not(:disabled):hover,
.btn-export-csv-survey:not(:disabled):hover,
.btn-export-dxf:not(:disabled):hover,
.btn-export-kml:not(:disabled):hover,
.btn-export-geojson:not(:disabled):hover,
.btn-export-jww:not(:disabled):hover {
  background: #dce8f5;
}

/* 空き枠プレースホルダー：無地・枠線あり・操作不可 */
.btn-export-placeholder {
  background: #f2f2f2;
  border: 1px solid #ddd;
  cursor: default;
  pointer-events: none;
}

/* 出力セクションの補足説明文 */
.output-description {
  font-size: 11px;
  color: #555;
  font-style: italic;
  margin-top: 6px;
  line-height: 1.5;
}

/* =====================================================
   スクロールバー（Windows向けに細く整える）
   ===================================================== */
#left-panel::-webkit-scrollbar,
#right-panel::-webkit-scrollbar {
  width: 5px;
}

#left-panel::-webkit-scrollbar-track,
#right-panel::-webkit-scrollbar-track {
  background: #f0f0f0;
}

#left-panel::-webkit-scrollbar-thumb,
#right-panel::-webkit-scrollbar-thumb {
  background: #bbb;
}


#jww-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
#jww-modal-box {
  background: #fff;
  border-radius: 6px;
  padding: 20px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  min-width: 180px;
}
#jww-modal-msg {
  font-size: 14px;
  color: #333;
}
#jww-modal-cancel {
  font-size: 13px;
  padding: 5px 18px;
  cursor: pointer;
}

/* =====================================================
   モバイル(縦・狭幅)対応 — 幅699px以下のときだけ適用。
   左右パネルをオーバーレイのドロワーに変え、地図を全画面にする。
   700px以上(デスクトップ/タブレット/全端末横向き)は一切変更しない。
   ===================================================== */
.m-fab { display: none; }
#m-backdrop { display: none; }

@media (max-width: 699px) {
  /* 左右パネルをフローから外しオーバーレイ化 -> 地図が全幅になる */
  #left-panel, #right-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    height: 100vh;
    height: 100dvh;
    width: 86vw;
    max-width: 340px;
    min-width: 0;
    z-index: 1000;
    box-shadow: 0 0 16px rgba(0,0,0,0.3);
    transition: transform 0.2s ease;
  }
  #left-panel  { left: 0;  transform: translateX(-101%); }
  #right-panel { right: 0; transform: translateX(101%); }
  /* デスクトップ用の右パネル開閉(is-collapsed)はモバイルでは無効化 */
  #right-panel.is-collapsed { transform: translateX(101%); width: 86vw; min-width: 0; }
  body.m-left-open  #left-panel  { transform: translateX(0); }
  body.m-right-open #right-panel,
  body.m-right-open #right-panel.is-collapsed { transform: translateX(0); }

  /* デスクトップ用のリボンは隠す */
  #right-panel-ribbon { display: none; }

  /* フローティング開閉ボタン(地図の上に浮かせる。ノッチ回避) */
  .m-fab {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: calc(10px + env(safe-area-inset-top, 0px));
    height: 40px;
    border: 0;
    border-radius: 8px;
    background: #2c3e50;
    color: #fff;
    z-index: 1100;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    cursor: pointer;
  }
  .m-fab-left  { left:  calc(10px + env(safe-area-inset-left, 0px));  width: 44px; font-size: 20px; }
  .m-fab-right { right: calc(10px + env(safe-area-inset-right, 0px)); padding: 0 14px; font-size: 14px; }

  /* 地番検索ポップアップを画面内に収める(監査リスク#2: 極小幅でも縮む) */
  #search-panel { width: min(256px, 92vw); min-width: 0; max-width: 92vw; }

  /* 背景幕(タップで閉じる) */
  body.m-left-open #m-backdrop,
  body.m-right-open #m-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 900;
  }
}
