/* v175 (2026-10-25): 地図画面の見直し。style.css ほか既存の CSS の後に読み、上書きだけをする（ID・JS は変えない）。
   ・ヘッダーは1段で折り返さない。幅が足りないときは、使う頻度の低いものから隠す（隠したものは左パネルか右下から使える）
   ・左パネルは「いま使う操作」を上に、他県のレイヤーと更新履歴は折りたたみに
   ・モバイルの登記キューはヘッダーではなく地図の左下へ（ヘッダーのボタンと重なっていた） */
:root { --ink2: #5a6572; --btn-h: 30px; --radius: 6px; --accent-ink: #085a69; }

/* ---------------- ヘッダー ---------------- */
header { flex-wrap: nowrap; gap: 10px; overflow: hidden; white-space: nowrap; }
header h1.brand { flex: none; }
header h1.brand .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 24em; }
#hdrFavs { display: none !important; }            /* お気に入りは右下の「★ お気に入り」から（ヘッダーでは潰れて読めなかった） */
header .stamp { display: none !important; }        /* 解析データの版は左パネルの末尾へ（ui-v175.js が写す） */
.hdr-tools { display: flex; align-items: center; gap: 6px; margin-left: auto; flex: none; }
.hdr-main { display: flex; align-items: center; gap: 8px; flex: none; padding-left: 10px; border-left: 1px solid var(--rule); }
header button, #recoBtn {
  height: var(--btn-h); display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; flex: none;
  font: 12.5px/1 var(--sans); padding: 0 12px; border: 1px solid #8f99a3; border-radius: var(--radius);
  background: #fff; color: var(--ink); cursor: pointer; text-decoration: none;
}
header button:hover { border-color: var(--ink); background: #f4f6f7; }
header button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
#recoBtn { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
#recoBtn:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
#authBtn { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
#authBtn.on { background: #fff; color: var(--ink); border-color: #8f99a3; }   /* ログイン中を黒塗りにしない（候補一覧の方を目立たせる） */
#authBtn.on:hover { border-color: var(--ink); }
header :focus-visible, aside :focus-visible { outline: 2px solid #1971c2; outline-offset: 1px; }
@media (max-width: 1240px) { header h1.brand .sub { display: none; } }
@media (max-width: 1060px) {
  #dualBtn, #exportBtn { display: none !important; }          /* 書き出しは左パネル末尾のボタンから */
  #exportRowM { display: flex !important; }
}

/* ---------------- 左パネル ---------------- */
aside { padding: 12px 14px 40px; }
aside h2 { font-size: 12.5px; letter-spacing: .04em; color: var(--ink); font-weight: 600; margin: 20px 0 8px; }
aside nav.region-nav { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 0 0 6px; }
aside nav.region-nav button {
  font: 12.5px var(--sans); padding: 0; height: 32px; border: 1px solid #8f99a3; border-radius: var(--radius);
  background: #fff; color: var(--ink); cursor: pointer;
}
aside nav.region-nav button:hover { border-color: var(--ink); background: #f4f6f7; }
aside nav.region-nav button.cur { background: var(--ink); color: #fff; border-color: var(--ink); }
.search-row input#q { border: 1px solid #8f99a3; border-radius: var(--radius); }
.search-row #qBtn { border-radius: var(--radius); }
select, .bg-select { border: 1px solid #8f99a3; border-radius: var(--radius); }
details.lyr { border-top: 1px solid var(--rule); margin: 0; }
details.lyr:last-of-type { border-bottom: 1px solid var(--rule); }
details.lyr > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px;
  font: 600 12.5px var(--sans); color: var(--ink); padding: 9px 2px;
}
details.lyr > summary::-webkit-details-marker { display: none; }
details.lyr > summary::before {
  content: ""; width: 7px; height: 7px; border-right: 1.5px solid var(--ink2); border-bottom: 1.5px solid var(--ink2);
  transform: rotate(-45deg); transition: transform .15s; flex: none; margin-left: 2px;
}
details.lyr[open] > summary::before { transform: rotate(45deg); }
details.lyr > summary .lyr-hint { margin-left: auto; font-weight: 400; font-size: 11px; color: var(--ink2); }
details.lyr > .lyr-body { padding: 0 2px 10px; }
.lyr-group-title { margin-top: 22px !important; }
aside .coverage-now { font-size: 11.5px; color: var(--ink); line-height: 1.6; margin: 4px 0 0; }
#exportRowM { display: none; }
@media (max-width: 760px) { #exportRowM { display: flex !important; } }
.footer-note .stamp-line { display: block; margin-top: 6px; font-family: var(--mono); font-size: 10px; color: #8a94a0; word-break: break-all; }

/* ---------------- モバイル ---------------- */
@media (max-width: 760px) {
  header { gap: 6px; }
  .hdr-tools { margin-left: auto; gap: 5px; }
  .hdr-main { padding-left: 0; border-left: none; gap: 5px; }
  #tdBtn { margin: 0 !important; }
  header button, #recoBtn { height: 32px; padding: 0 9px !important; font-size: 12px !important; }
  #menuBtn { height: 32px; padding: 0 10px !important; font-size: 17px !important; }
  #recoBtn { display: inline-flex !important; }
  #recoBtn .lbl-long { display: none; }
  #authBtn { max-width: 92px; }
  /* 登記キューは地図の左下（右下の「★ お気に入り」と同じ段） */
  #tqBadge { top: auto !important; right: auto !important; left: 10px !important;
    bottom: calc(48px + env(safe-area-inset-bottom)) !important; z-index: 46; padding: 7px 11px; font-size: 12px; }
  #tqPanel { top: auto !important; right: 6px !important; left: 6px !important;
    bottom: calc(92px + env(safe-area-inset-bottom)) !important; width: auto !important; max-height: calc(100dvh - 160px) !important; }
  aside nav.region-nav button { height: 38px; }
}
@media (min-width: 761px) { #recoBtn .lbl-short { display: none; } }
/* モバイルのログイン中はアイコンだけ（名前が「kamim…」と切れていた）。名前は title と読み上げ名に入れる（ui-v175.js） */
@media (max-width: 760px) {
  #authBtn.on { font-size: 0 !important; gap: 2px; padding: 0 9px !important; }
  #authBtn.on svg { width: 15px; height: 15px; margin-right: 0 !important; }
  #authBtn.on::after { content: "▾"; font-size: 11px; }
}
@media (max-width: 340px) { #multiBtn { display: none !important; } }

/* ---------------- 調査票と右下ボタンの重なり ---------------- */
/* PC: 調査票（右上・幅330px）を開いている間は、AI検索と★お気に入りを調査票の左へ */
@media (min-width: 761px) {
  body:has(#card.show) #aiChatBtn { right: 356px; }
  body:has(#card.show) #favBadge, body:has(#card.show) #favPanel { right: 356px !important; }
}
/* モバイル: 下からの調査票を開いている間は、浮いているボタンを隠す（記録中の「記録」ボタンだけは残す） */
@media (max-width: 760px) {
  body:has(#card.show) #aiChatBtn, body:has(#card.show) #fieldFab:not(.rec) { display: none !important; }
  body:has(#card.show) #fieldFab.rec { bottom: calc(62dvh + 12px) !important; }
}
@media (prefers-reduced-motion: reduce) { details.lyr > summary::before { transition: none; } }
