/* Biwa の画面スタイル。index.html から 2026-10-04 に切り出し（内容は同じ）。
   凡例・左ペイン・詳細カード・ダイアログ・ポップアップなど画面全体 */
  /* ブランドパレット（等高線ロゴ由来）:
     インク=ダークプラム、プライマリ=パープル、コーラル=ロゴ核の強調色(Pro専用)。
     ニュートラルも青灰ではなくプラム寄りに振る。
     ステータス色・レイヤカテゴリ色・コロプレス階級はデータの意味を持つため対象外 */
  :root {
    --accent: #6a51dc;
    --accent-soft: rgba(122, 102, 224, 0.16);
    --accent-strong: #5539c9;
    --coral: #f4613d;
    --coral-soft: #fff1ec;
    --coral-strong: #c43a17;   /* コーラル系の文字・枠色（Pro専用アクセントの濃色） */
    --coral-border: #ffc5ae;
    --coral-hover: #ffe4d9;
    --ctrl-bg: #efedf5;        /* 丸ボタン（ダイアログ×・ポップアップ閉じる）の地色 */
    --ctrl-bg-hover: #e3dfee;
    --ink: #1d1730;
    --muted: #6e6885;
    --panel: #ffffff;
    --border: #e8e5f1;
    --hover: #f4f2fa;
  }
  * { box-sizing: border-box; }
  .sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
  html, body { margin: 0; height: 100%; font-family: "Hiragino Sans", "Noto Sans JP", sans-serif; color: var(--ink); }
  ::selection { background: rgba(122, 102, 224, 0.25); }
  /* キーボード操作時のフォーカスリング（ポインタ操作では出さない） */
  :where(a, button, input, summary, [tabindex], [role="option"], [role="button"]):focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px;
  }
  /* タップの300ms遅延を避ける（対象は自前のUIのみ。地図キャンバスのジェスチャは触らない） */
  button, .chip, .area-item, .search-hit, .pp-x, .dist-chip, .upd-item, #legend { touch-action: manipulation; }
  /* 内部スクロール領域（サイドバー・ポップアップ・ダイアログ）の
     細身プラム系スクロールバーを一括定義 */
  #area-list, #filter-scroll, .maplibregl-popup-content, #detail-card-body,
  #price-dialog, #login-dialog, #pro-dialog, #info-dialog .info-body {
    scrollbar-width: thin; scrollbar-color: #d9d4e6 transparent;
  }
  #area-list::-webkit-scrollbar, #filter-scroll::-webkit-scrollbar,
  .maplibregl-popup-content::-webkit-scrollbar, #detail-card-body::-webkit-scrollbar, #price-dialog::-webkit-scrollbar,
  #login-dialog::-webkit-scrollbar, #pro-dialog::-webkit-scrollbar,
  #info-dialog .info-body::-webkit-scrollbar { width: 8px; }
  #area-list::-webkit-scrollbar-thumb, #filter-scroll::-webkit-scrollbar-thumb,
  .maplibregl-popup-content::-webkit-scrollbar-thumb, #detail-card-body::-webkit-scrollbar-thumb, #price-dialog::-webkit-scrollbar-thumb,
  #login-dialog::-webkit-scrollbar-thumb, #pro-dialog::-webkit-scrollbar-thumb,
  #info-dialog .info-body::-webkit-scrollbar-thumb {
    background: #d9d4e6; border-radius: 999px; border: 2px solid #fff;
  }
  #area-list::-webkit-scrollbar-track, #filter-scroll::-webkit-scrollbar-track,
  .maplibregl-popup-content::-webkit-scrollbar-track, #detail-card-body::-webkit-scrollbar-track, #price-dialog::-webkit-scrollbar-track,
  #login-dialog::-webkit-scrollbar-track, #pro-dialog::-webkit-scrollbar-track,
  #info-dialog .info-body::-webkit-scrollbar-track { background: transparent; }
  :root { color-scheme: light; }
  /* 左ペインは地図の上に重ねる（地図は全幅）。地図の中心計算は map.setPadding で左 300px を除く。
     凡例・つまみなど地図上の左寄せ要素は --map-pad-left ぶん右へ寄せる */
  #app { display: flex; height: 100%; position: relative; --map-pad-left: 300px; }
  #app.sidebar-off { --map-pad-left: 0px; }

  /* ---- sidebar ---- */
  #sidebar {
    position: absolute; left: 0; top: 0; bottom: 0; z-index: 8;
    width: 300px; flex: none;
    background: rgba(255,255,255,0.86);
    -webkit-backdrop-filter: blur(14px) saturate(1.15); backdrop-filter: blur(14px) saturate(1.15);
    border-right: 1px solid rgba(255,255,255,0.75);
    box-shadow: 4px 0 24px rgba(24,17,45,0.08);
    display: flex; flex-direction: column;
  }
  /* パネルの開閉（デスクトップ）。地図の左端に付いたつまみで閉じ／開きを兼ねる。
     閉じると地図が全幅になり、つまみの向きが「›」に変わって元に戻せる */
  #app.sidebar-off #sidebar { display: none; }
  #sidebar-toggle {
    position: absolute; left: var(--map-pad-left, 0px); top: 50%; transform: translateY(-50%); z-index: 9;
    width: 20px; height: 62px; padding: 0; display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); border-left: none; border-radius: 0 9px 9px 0;
    background: rgba(255,255,255,0.94); color: var(--muted);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    box-shadow: 0 3px 12px rgba(24,17,45,0.12); cursor: pointer; font-family: inherit;
  }
  #sidebar-toggle:hover { background: #fff; color: var(--accent); }
  #app.sidebar-off #sidebar-toggle { color: var(--accent); }
  /* 閉じているときは「›」、開いているときは「‹」を出す（同じ位置で向きだけ変える） */
  #sidebar-toggle .sb-open { display: none; }
  #app.sidebar-off #sidebar-toggle .sb-open { display: block; }
  #app.sidebar-off #sidebar-toggle .sb-close { display: none; }
  #sidebar header { padding: 12px 18px 12px; border-bottom: 1px solid var(--border); }
  /* ヘッダ右上のアカウント表示（未ログイン=ログインボタン / ログイン中=名前+ログアウト） */
  #account { display: flex; justify-content: flex-end; align-items: center; gap: 8px; min-height: 22px; margin-bottom: 2px; }
  #account:empty { display: none; }
  #account .acct-email { font-size: 11.5px; color: var(--muted); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #account button { display: inline-flex; align-items: center; min-height: 26px; border: 1px solid var(--border); background: none; color: var(--accent); font-size: 11px; padding: 3px 11px; border-radius: 999px; cursor: pointer; font-family: inherit; }
  #account button:hover { background: var(--hover); }
  #header-top { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
  /* Pro はロゴ核のコーラルを専用色として使う（他では使わない希少色に保つ） */
  .pro-chip { display: inline-flex; align-items: center; min-height: 26px; border: 1px solid var(--coral-border); background: var(--coral-soft); color: var(--coral-strong); font-size: 11px; font-weight: 700;
    padding: 3px 11px; border-radius: 999px; cursor: pointer; font-family: inherit; }
  .pro-chip:hover { background: var(--coral-hover); }
  #account button.acct-plan-badge { font-size: 10px; font-weight: 700; color: var(--coral-strong); background: var(--coral-soft);
    border: 1px solid var(--coral-border); padding: 1px 8px; border-radius: 999px; cursor: pointer; min-height: 24px; }
  #account button.acct-plan-badge:hover { background: var(--coral-hover); }
  /* ログインダイアログ */
  #login-dialog { border: none; border-radius: 14px; padding: 0; width: min(380px, 92vw); box-shadow: 0 20px 60px rgba(24,17,45,0.28); }
  #login-dialog::backdrop { background: rgba(23, 16, 42, 0.42); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
  /* login/pro はダイアログ側 padding:0 で本文が余白を持つ構成のため、ヘッダに余白を付与
     （price/info はダイアログ自体の padding が効くので不要） */
  #login-dialog .dlg-head, #pro-dialog .dlg-head { padding: 16px 16px 0 20px; margin-bottom: 4px; }
  .login-body { padding: 8px 20px 22px; }
  .login-btn-google, .login-btn-primary { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
    font-family: inherit; font-size: 13px; font-weight: 600; padding: 10px 12px; border-radius: 9px; cursor: pointer; }
  .login-btn-google { background: #fff; border: 1px solid var(--border); color: var(--ink); }
  .login-btn-google:hover { background: #faf9fd; }
  .login-btn-primary { background: var(--accent); border: 1px solid var(--accent); color: #fff; margin-top: 4px; }
  .login-btn-primary:hover { filter: brightness(1.05); }
  .login-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11px; margin: 14px 0; }
  .login-or::before, .login-or::after { content: ''; flex: 1; height: 1px; background: var(--border); }
  .login-label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
  #login-email { width: 100%; padding: 9px 11px; font-size: 13px; font-family: inherit; border: 1px solid var(--border); border-radius: 8px; outline: none; margin-bottom: 8px; }
  #login-email:focus { border-color: var(--accent); }
  .login-msg { font-size: 11.5px; line-height: 1.6; margin: 10px 0 0; min-height: 1em; }
  .login-msg.ok { color: #2b8a3e; }
  .login-msg.error { color: #c92a2a; }
  .login-note { font-size: 10.5px; color: var(--muted); line-height: 1.6; margin: 14px 0 0; }
  .login-note a { color: var(--accent); }
  /* 新着・更新情報ダイアログ（Pro） */
  #updates-dialog { border: none; border-radius: 14px; padding: 18px 20px; width: min(460px, 92vw);
    box-shadow: 0 20px 60px rgba(24,17,45,0.28); max-height: min(80vh, 640px); }
  #updates-dialog[open] { display: flex; flex-direction: column; }
  #updates-dialog::backdrop { background: rgba(23, 16, 42, 0.42); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
  .updates-list { overflow-y: auto; min-height: 0; overscroll-behavior: contain;
    scrollbar-width: thin; scrollbar-color: #d9d4e6 transparent; }
  .upd-item { display: flex; gap: 10px; align-items: baseline; width: 100%; text-align: left;
    padding: 9px 8px; border: none; border-bottom: 1px solid var(--border); background: none;
    border-radius: 0; cursor: pointer; font-family: inherit; }
  .upd-item:last-child { border-bottom: none; }
  .upd-item:hover { background: var(--hover); }
  .upd-date { flex: none; width: 78px; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
  .upd-main { flex: 1; min-width: 0; }
  .upd-name { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink); }
  .upd-meta { display: block; font-size: 10.5px; color: var(--muted); margin-top: 1px; }
  .upd-badge { flex: none; font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
  .upd-badge.new { background: var(--coral-soft); color: var(--coral-strong); border: 1px solid var(--coral-border); }
  .upd-badge.change { background: var(--accent-soft); color: var(--accent-strong); }
  .upd-empty { font-size: 12px; color: var(--muted); margin: 8px 0; }
  /* トースト通知（ログイン・ログアウト・決済戻り等の操作フィードバック） */
  #toast-host { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 4000; pointer-events: none; }
  .toast { max-width: min(88vw, 420px); padding: 9px 16px; border-radius: 8px; font-size: 12.5px; line-height: 1.5;
    background: #2b2836; color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.25);
    opacity: 0; transform: translateY(6px); transition: opacity .25s ease, transform .25s ease; }
  .toast.show { opacity: 1; transform: none; }
  .toast.ok { background: #2b8a3e; }
  .toast.error { background: #b23c2e; }
  /* Pro ダイアログ */
  #pro-dialog { border: none; border-radius: 14px; padding: 0; width: min(430px, 92vw); box-shadow: 0 20px 60px rgba(24,17,45,0.28); }
  #pro-dialog::backdrop { background: rgba(23, 16, 42, 0.42); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
  .pro-body { padding: 4px 20px 22px; }
  .pro-context { font-size: 12px; font-weight: 700; color: var(--accent); margin: 0 0 10px; }
  .pro-lead { font-size: 12px; color: #443c5c; line-height: 1.7; margin: 0 0 12px; }
  .pro-stats { display: flex; gap: 14px; font-size: 11px; color: #443c5c; margin: 0 0 12px;
    padding: 8px 12px; background: var(--coral-soft, #fff0eb); border-radius: 8px; }
  .pro-stats b { font-size: 15px; color: var(--coral-strong); display: block; line-height: 1.3; }
  .pro-features { margin: 0 0 14px; padding: 0; list-style: none; font-size: 12px; line-height: 1.7; color: #443c5c; }
  .pro-features li { padding-left: 18px; text-indent: -18px; margin-bottom: 6px; }
  .pro-features li::before { content: '✦'; color: var(--coral); margin-right: 7px; }
  .pro-soon { font-size: 10px; font-weight: 700; color: var(--coral-strong); background: var(--coral-soft); border: 1px solid var(--coral-border);
    padding: 0 6px; border-radius: 999px; margin-left: 6px; text-indent: 0; display: inline-block; }
  .pro-price { font-size: 13px; color: var(--ink); padding: 10px 12px; background: #faf9fd;
    border: 1px solid var(--border); border-radius: 9px; }
  .pro-price b { font-size: 19px; }
  .pro-price-sub { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
  .pro-price-note { font-size: 10.5px; color: var(--muted); margin: 6px 0 14px; }
  .pro-biz-note { font-size: 10.5px; color: #443c5c; line-height: 1.7; margin: 0 0 14px; padding: 8px 12px;
    border: 1px dashed var(--border); border-radius: 8px; }
  .pro-biz-note a { color: var(--accent); }
  .pro-price-note a { color: var(--accent); }
  #pro-actions { display: flex; flex-direction: column; gap: 8px; }
  #pro-actions .login-btn-primary { margin-top: 0; }
  #pro-actions .pro-btn-secondary { width: 100%; display: flex; align-items: center; justify-content: center;
    font-family: inherit; font-size: 13px; font-weight: 600; padding: 10px 12px; border-radius: 9px;
    cursor: pointer; background: #fff; border: 1px solid var(--accent); color: var(--accent); }
  #pro-actions .pro-btn-secondary:hover { background: var(--hover); }
  #pro-actions button:disabled { opacity: 0.55; cursor: default; }
  #sidebar h1 { margin: 0; line-height: 0; }
  #sidebar h1 .logo { height: 26px; width: auto; display: block; }
  #brand-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  #sidebar p.catch { margin: 10px 0 0; font-size: 15px; font-weight: 700; color: var(--ink); letter-spacing: 0.01em; }
  #sidebar p.lead { margin: 4px 0 0; font-size: 11px; color: var(--muted); line-height: 1.55; }
  /* 地図を動かす・検索する・タブを切り替えるなど最初の操作でキャッチ文を畳み、道具の画面にする */
  #sidebar.compact p.catch, #sidebar.compact p.lead { display: none; }
  #search-box { margin-top: 10px; }
  /* 一覧／レイヤのタブ */
  #pane-tabs { display: flex; margin: 10px -18px 0; border-top: 1px solid var(--border); }
  #pane-tabs [role="tab"] { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 6px; border: none; border-bottom: 2px solid transparent; background: none; color: var(--muted);
    font-family: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
  #pane-tabs [role="tab"]:hover { color: var(--ink); background: var(--hover); }
  #pane-tabs [role="tab"][aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
  #tab-list-count { font-weight: 600; color: #574f6e; font-size: 11px; }
  #tab-list-count:empty { display: none; }
  /* 表示中レイヤの帯（両タブで常に見える。× で個別OFF、名前で該当行へ） */
  #active-layers { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 7px 14px;
    border-bottom: 1px solid var(--border); background: rgba(250,249,253,0.6); font-size: 10.5px; color: var(--muted); }
  #active-layers[hidden] { display: none; }
  #active-layers-chips { display: contents; }
  .al-chip { display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 8px; border-radius: 999px;
    border: 1px solid var(--border); background: #fff; color: var(--ink); font-family: inherit; font-size: 10.5px; font-weight: 600; }
  .al-chip .al-name { cursor: pointer; }
  .al-chip .al-name:hover { color: var(--accent); }
  .al-chip .al-x { border: none; background: none; color: var(--muted); font-family: inherit; font-size: 12px; line-height: 1;
    width: 18px; height: 18px; border-radius: 999px; cursor: pointer; padding: 0; }
  .al-chip .al-x:hover { background: var(--hover); color: var(--ink); }
  #active-layers-off { margin-left: auto; border: none; background: none; color: var(--accent); font-family: inherit;
    font-size: 10.5px; font-weight: 600; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
  #active-layers-off:hover { background: var(--hover); }
  /* タブ本体はサイドバーの残りの高さを使い、それぞれ内部スクロール */
  #pane-list, #pane-layers { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  #pane-list[hidden], #pane-layers[hidden] { display: none; }
  #list-tools { flex: none; display: flex; flex-direction: column; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
  #list-bar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 6px 8px 6px 12px; font-size: 10.5px; color: var(--muted); border-bottom: 1px solid var(--border); }
  #list-count { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #list-count b { font-weight: 600; color: #574f6e; }
  .area-cap { font-size: 10.5px; color: var(--muted); line-height: 1.6; text-align: center; padding: 10px 8px 12px; }
  #list-ctl { display: flex; align-items: center; gap: 6px; }
  #list-sort { font-family: inherit; font-size: 10.5px; color: var(--ink); border: 1px solid var(--border); border-radius: 6px;
    background: #fff; padding: 3px 2px; max-width: 112px; }
  #list-follow { font-family: inherit; font-size: 10.5px; font-weight: 600; border: 1px solid var(--border); border-radius: 999px;
    background: #fff; color: var(--muted); padding: 3px 9px; cursor: pointer; white-space: nowrap; }
  #list-follow[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
  #list-follow:hover { background: var(--hover); }
  /* レイヤタブ: 検索欄と、カテゴリのアコーディオン */
  #layer-search-box { flex: none; padding: 8px 12px; border-bottom: 1px solid var(--border); }
  #layer-search { width: 100%; padding: 6px 10px; font-size: 12px; font-family: inherit; border: 1px solid var(--border); border-radius: 8px; outline: none; }
  #layer-search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
  .lcat { border-bottom: 1px solid var(--border); }
  .lcat-head { display: flex; align-items: center; gap: 7px; width: 100%; padding: 9px 14px; background: none; border: none;
    text-align: left; font-family: inherit; font-size: 11.5px; font-weight: 700; color: #574f6e; cursor: pointer; }
  .lcat-head:hover { color: var(--ink); background: var(--hover); }
  .lcat-head .lm-caret { flex: none; transition: transform 0.15s; color: var(--muted); transform: rotate(90deg); }
  .lcat[data-open="false"] .lcat-head .lm-caret { transform: none; }
  .lcat[data-open="false"] > .lcat-body { display: none; }
  .lcat-count { margin-left: auto; background: var(--accent); color: #fff; border-radius: 999px; font-size: 9.5px; font-weight: 700; padding: 1px 7px; }
  .lcat-count:empty { display: none; }
  /* レイヤ行（チップを行の形で並べる。チェック印＋名前＋色の見本、下に一行説明） */
  #pane-layers .chip { display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; row-gap: 1px; width: 100%;
    min-height: 30px; padding: 6px 12px 6px 14px; border-radius: 8px; border: none; background: none;
    font-size: 12px; font-weight: 500; color: var(--ink); text-align: left; }
  #pane-layers .chip:hover { background: var(--hover); }
  #pane-layers .chip::before { content: ""; width: 14px; height: 14px; border-radius: 4px; margin-right: 0; flex: none;
    border: 1.5px solid #b9b1d3; background: #fff; font-size: 10px; line-height: 12px; text-align: center; }
  #pane-layers .chip.on { background: none; border-color: transparent; }
  #pane-layers .chip.on:hover { background: var(--hover); }
  #pane-layers .chip.on::before { content: ""; background-color: currentColor; border-color: currentColor;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='5 12 10 17 19 7'/%3E%3C/svg%3E");
    background-size: 11px 11px; background-position: center; background-repeat: no-repeat; }
  #pane-layers .chip.on .chip-label { color: currentColor; }
  #pane-layers .chip:not(.on) .chip-label { color: var(--ink); }
  .chip-label { font-weight: 600; }
  .chip-sw { display: inline-flex; gap: 2px; margin-left: auto; }
  .chip-sw i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; border: 1px solid rgba(0,0,0,0.08); }
  .chip-sw i.line { height: 3px; border-radius: 2px; align-self: center; border: none; }
  .chip-sw i.dot { border-radius: 999px; }
  .chip-desc { flex-basis: 100%; padding-left: 22px; font-size: 10.5px; font-weight: 400; color: var(--muted); line-height: 1.4; }
  #pane-layers .chip[hidden] { display: none; }
  /* 帯の名前から飛んできた行を一瞬ハイライト */
  #pane-layers .chip.flash { background: var(--accent-soft); }
  .lcat[hidden], #disaster-toggle[hidden] { display: none; }
  #search-input {
    width: 100%; padding: 7px 10px; font-size: 12px; font-family: inherit;
    border: 1px solid var(--border); border-radius: 8px; outline: none;
    transition: border-color 0.12s, box-shadow 0.12s;
  }
  #search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
  .search-hit { padding: 6px 8px; font-size: 11.5px; border-radius: 6px; cursor: pointer; }
  .search-hit:hover { background: var(--hover); }
  .search-sec { font-size: 9.5px; color: var(--muted); padding: 8px 8px 2px; font-weight: 600; }
  .search-starters { display: flex; flex-wrap: wrap; gap: 5px; padding: 4px 8px 6px; }
  .search-hit[aria-selected="true"] { background: var(--accent-soft); }
  /* 行き止まりを作らない: 0件のときは次の一手を示す */
  .search-empty, .area-empty { font-size: 11.5px; color: var(--muted); line-height: 1.7; padding: 10px 10px 12px; }
  .search-empty b, .area-empty b { color: var(--ink); font-weight: 600; }
  .area-empty { text-align: center; }
  .area-empty-btn { margin-top: 8px; font-family: inherit; font-size: 11.5px; font-weight: 600;
    display: inline-flex; align-items: center; min-height: 30px; padding: 5px 14px; border-radius: 999px;
    border: 1px solid var(--accent); background: #fff; color: var(--accent); cursor: pointer; }
  .area-empty-btn:hover { background: var(--accent-soft); }
  /* 一覧はタブの残りの高さをすべて使う（内部スクロール）。レイヤ側も同様 */
  #area-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 8px; }
  #filter-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
  .area-item {
    display: block; width: 100%; text-align: left; background: none; color: inherit; font-family: inherit;
    padding: 10px 12px; border-radius: 8px; cursor: pointer;
    border: 1px solid transparent; transition: background 0.12s, border-color 0.12s;
  }
  .area-item:hover { background: #f7f5fb; }
  .area-item.active { background: var(--accent-soft); border-color: var(--accent); }
  .area-item .name { font-size: 13.5px; font-weight: 600; }
  .area-item .meta { font-size: 11px; color: var(--muted); margin-top: 2px; display: flex; gap: 6px; align-items: center; }
  .badge {
    display: inline-block; font-size: 10px; padding: 1px 7px; border-radius: 999px;
    font-weight: 600; letter-spacing: 0.03em;
  }
  /* 文字色は地の淡色に対して 4.5:1 以上（10px級の小さい文字のため AA を厳密に満たす）。
     枠線・地図側の色は視認上の同一性を保つため元のトーンのまま */
  .badge.竣工   { background: #d3f9d8; color: #277c38; }
  .badge.工事中 { background: #ffe8cc; color: #bc3f0d; }
  .badge.着工前 { background: #d0ebff; color: #1769b4; }
  .badge.構想中 { background: #e5dbff; color: #6741d9; }

  /* ---- filter chips ---- */
  #filters, #pro-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
  #pro-filters:empty { display: none; }
  .chip {
    display: inline-flex; align-items: center; min-height: 26px;
    font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
    border: 1.5px solid var(--border); background: #fff; color: var(--muted);
    font-family: inherit; cursor: pointer; user-select: none;
    transition: color 0.12s, background 0.12s, border-color 0.12s, transform 0.06s;
  }
  .chip::before { content: "●"; margin-right: 4px; font-size: 9px; }
  .chip.竣工.on   { border-color: #2b8a3e; color: #277c38; background: #d3f9d8; }
  .chip.工事中.on { border-color: #d9480f; color: #bc3f0d; background: #ffe8cc; }
  .chip.着工前.on { border-color: #1971c2; color: #1769b4; background: #d0ebff; }
  .chip.構想中.on { border-color: #6741d9; color: #6741d9; background: #e5dbff; }
  /* OFF は以前 opacity:0.55 で薄くしていたが、文字コントラストが 2.2:1 まで落ちて
     AA を満たさなかった。色を明示して 5.3:1 を確保し、ON/OFF は塗り＋●/○で示す */
  .chip:not(.on) { color: var(--muted); border-color: #ddd8ec; }
  .chip:not(.on)::before { content: "○"; color: #a49dba; }
  .chip:not(.on):hover { color: var(--ink); border-color: #b9b1d3; background: var(--hover); }
  .chip:active { transform: scale(0.96); }
  /* 遅延データのロード中はパルスで「反応している」ことを示す */
  .chip.loading { animation: chip-loading 0.9s ease-in-out infinite; }
  /* 読み込み中のピル（地図下部中央。トーストより上に重ならない位置） */
  #load-status { position: absolute; left: 50%; bottom: 64px; transform: translate(-50%, 8px); z-index: 6;
    display: flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; font-size: 12px;
    color: var(--ink); background: rgba(255,255,255,0.92); border: 1px solid var(--border);
    box-shadow: 0 6px 18px rgba(24,17,45,0.14); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    opacity: 0; pointer-events: none; transition: opacity 0.18s, transform 0.18s; }
  #load-status.show { opacity: 1; transform: translate(-50%, 0); }
  .ls-spin { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent);
    animation: ls-spin 0.8s linear infinite; }
  @keyframes ls-spin { to { transform: rotate(360deg); } }
  @keyframes chip-loading {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
  }

  /* ---- hazard / future chips ---- */
  /* レイヤのカテゴリ本体（行を縦に並べる） */
  .lcat-body { display: block; padding: 0 6px 6px; }
  /* 過去の災害はレイヤタブ末尾のカテゴリとして、カテゴリ見出しと同じ見た目にする */
  #disaster-toggle { display: flex; align-items: center; gap: 7px; width: 100%; padding: 9px 14px;
    background: none; border: none; border-bottom: 1px solid var(--border); text-align: left;
    font-family: inherit; font-size: 11.5px; font-weight: 700; color: #574f6e; cursor: pointer; }
  #disaster-toggle:hover { color: var(--ink); background: var(--hover); }
  #disaster-toggle .lm-caret { flex: none; transition: transform 0.15s; color: var(--muted); }
  #disaster-toggle[aria-expanded="true"] .lm-caret { transform: rotate(90deg); }
  #disaster-toggle > span { white-space: nowrap; }
  #disaster-toggle .lm-cats { font-weight: 400; font-size: 10px; color: var(--muted);
    flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  #disaster-toggle[aria-expanded="true"] .lm-cats { display: none; }
  /* レイヤタブのバッジ（ONの数） */
  #layer-more-count { background: var(--accent); color: #fff; border-radius: 999px;
    font-size: 9.5px; font-weight: 700; padding: 1px 7px; }
  #disaster-on { background: var(--accent); color: #fff; border-radius: 999px;
    font-size: 9.5px; font-weight: 700; padding: 1px 7px; }

  /* ---- 過去の災害メニュー ---- */
  #disaster-body { border-bottom: 1px solid var(--border); padding: 4px 0 8px; }
  .dis-note { font-size: 10px; color: var(--muted); line-height: 1.6; padding: 4px 18px 6px; margin: 0; }
  .dis-year { font-size: 10px; font-weight: 700; color: var(--muted); padding: 8px 18px 2px;
    letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
  .dis-item { display: block; width: 100%; text-align: left; background: none; color: inherit;
    font-family: inherit; padding: 7px 18px; border: none; cursor: pointer; }
  .dis-item:hover { background: var(--hover); }
  .dis-item.active { background: var(--accent-soft); }
  .dis-item .dis-name { font-size: 12px; font-weight: 600; line-height: 1.45; }
  .dis-item .dis-meta { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--muted); margin-top: 1px; }
  .dis-badge { flex: none; display: inline-block; font-size: 9.5px; font-weight: 700; color: #fff;
    padding: 0 6px; border-radius: 999px; line-height: 1.6; }
  .dis-detail { padding: 2px 18px 10px; font-size: 11px; line-height: 1.65; color: #443c5c;
    background: var(--accent-soft); border-bottom: 1px solid var(--border); }
  .dis-detail .dis-dead { font-weight: 700; color: var(--ink); margin: 4px 0 2px; }
  .dis-detail .dis-src { font-size: 10px; color: var(--muted); margin-top: 4px; }
  .dis-detail .dis-src a { color: var(--accent); }
  .dis-clear { margin: 6px 18px 0; font-family: inherit; font-size: 11px; font-weight: 600;
    display: inline-flex; align-items: center; min-height: 28px; padding: 3px 12px; border-radius: 999px;
    border: 1px solid var(--border); background: #fff; color: #574f6e; cursor: pointer; }
  .dis-clear:hover { border-color: var(--accent); color: var(--accent); }
  .hz-label { font-size: 10px; color: var(--muted); margin-right: 2px; }
  .chip.hz.on { border-color: #1971c2; color: #1769b4; background: #d0ebff; }
  .chip.ft.on { border-color: #0ca678; color: #097b59; background: #c3fae8; }
  .chip.sf.on { border-color: #c92a2a; color: #c92a2a; background: #ffe3e3; }
  .chip.lf.on { border-color: #9c36b5; color: #9a35b3; background: #f3d9fa; }
  .chip.tr.on { border-color: #364fc7; color: #364fc7; background: #dbe4ff; }
  .chip.tf.on { border-color: #8a6d3b; color: #7a5c2e; background: #f3e9d8; }
  .chip.pl.on { border-color: #e8590c; color: #d9480f; background: #ffe8cc; }
  .chip.mu.on { border-color: #1c7ed6; color: #1864ab; background: #d0ebff; }
  /* Pro チップはロゴ核のコーラル（希少色）。OFF時もうっすら金枠で有料機能と分かるように */
  .chip.pro { border-color: var(--coral-border); }
  .chip.pro.on { border-color: var(--coral-strong); color: var(--coral-strong); background: var(--coral-soft, #fff0eb); }
  /* アクションチップ（ON/OFF状態を持たず、押すとダイアログ等を開く）。状態ドットは出さない */
  .chip.act { opacity: 1; color: #8a4a2f; }
  .chip.act::before { content: none; }
  .chip.act:hover { background: var(--coral-soft); }
  /* 構想・準備段階のポップアップ */
  .pp-planned { font-size: 12px; line-height: 1.55; }
  .pp-planned .pp-name { font-weight: 700; font-size: 13px; }
  .pp-planned .pp-sub { color: var(--muted); font-size: 11px; margin-bottom: 6px; }
  .pp-planned .pp-status b { color: var(--coral-strong); }
  .pp-planned .pp-dormant { margin-left: 6px; font-size: 10px; color: #495057; background: #f1f3f5; border-radius: 999px; padding: 1px 7px; }
  .pp-planned .pp-statusdesc { color: var(--muted); font-size: 10.5px; }
  .pp-planned .pp-notes { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
  .pp-planned .pp-sources { margin-top: 6px; font-size: 10.5px; color: var(--muted); }
  .pp-planned .pp-sources a { color: var(--accent); }
  .pp-planned .pp-updated { margin-top: 4px; font-size: 10px; color: var(--muted); }
  .pp-planned .pp-updated.fr-stale { color: #b2541b; }
  .pp-planned .pp-updated.fr-old { color: #c92a2a; font-weight: 600; }
  /* ⓘ の補足説明（assets/app/00-ui.js の infoTip） */
  .itip { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; padding: 0;
    margin-left: 3px; vertical-align: -3px; border: none; border-radius: 999px; background: transparent;
    color: #8a84a3; cursor: help; font-family: inherit; }
  .itip:hover, .itip[aria-expanded="true"] { color: var(--accent); background: var(--accent-soft); }
  .itip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
  .itip-pop { position: fixed; z-index: 10000; max-width: min(280px, calc(100vw - 16px)); padding: 8px 11px;
    font-size: 11.5px; line-height: 1.65; color: var(--ink); background: #fff; border: 1px solid var(--border);
    border-radius: 8px; box-shadow: 0 8px 24px rgba(24,17,45,0.16); pointer-events: auto; white-space: normal; }
  /* 事業カード先頭の「位置は概略」バッジ */
  .pp-approx { display: inline-flex; align-items: center; gap: 2px; font-size: 10.5px; padding: 2px 4px 2px 9px;
    border-radius: 999px; border: 1px dashed #b9b2cc; color: #574f6e; margin: -2px 0 8px; }
  .pp-approx.zone { border-style: solid; border-color: #9aa5b1; }
  /* 周辺の店舗・施設（Pro の集計） */
  .poi-pro { font-size: 9px; font-weight: 700; color: #fff; background: var(--accent);
    border-radius: 999px; padding: 1px 6px; margin-left: 2px; vertical-align: 1px; }
  .poi-lock { display: flex; align-items: center; justify-content: space-between; gap: 8px;
    margin-top: 4px; font-size: 11px; color: var(--muted); }
  .poi-total { font-size: 11px; color: var(--muted); margin-top: 4px; }
  .poi-total b { font-size: 15px; color: var(--ink); }
  .poi-bars { margin-top: 4px; display: grid; gap: 3px; }
  .poi-bar { display: grid; grid-template-columns: 9.5em 1fr 3.2em; align-items: center; gap: 6px; font-size: 11px; }
  .poi-bar-label { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .poi-bar-track { height: 6px; border-radius: 3px; background: var(--hover); overflow: hidden; }
  .poi-bar-fill { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
  .poi-bar-n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
  .poi-cats { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
  .poi-cats span { font-size: 10.5px; padding: 2px 7px; border-radius: 999px;
    border: 1px solid var(--border); color: #574f6e; background: #fff; }
  .poi-note { font-size: 10px; color: var(--muted); line-height: 1.6; margin-top: 5px; }
  /* エリアレポート */
  .rp-sec { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
  .rp-sec:first-of-type { border-top: none; padding-top: 0; }
  .rp-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 4px; }
  .rp-title { font-size: 11.5px; font-weight: 700; color: var(--ink); }
  .rp-map { flex: none; font-size: 10.5px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--border); background: #fff; color: var(--accent); cursor: pointer; font-family: inherit; }
  .rp-map:hover, .rp-map.on { background: var(--accent-soft); }
  .rp-row { border-top: none !important; padding-top: 2px !important; margin-top: 2px !important; }
  .rp-row .value { font-size: 12.5px; }
  .rp-loading, .rp-note { font-size: 10.5px; color: var(--muted); line-height: 1.6; }
  .rp-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 6px; }
  .rp-item { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 5px 6px; margin: 0 -6px; border: none; background: none;
    border-radius: 6px; cursor: pointer; font-family: inherit; text-align: left; }
  .rp-item:hover { background: var(--hover); }
  .rp-item-name { font-size: 12px; font-weight: 600; color: var(--ink); }
  .rp-item-sub { font-size: 10.5px; color: var(--muted); }
  .rp-pro { margin-top: 6px; }
  .pp-explore-note { font-size: 10.5px; color: var(--muted); }
  /* ポップアップ末尾の関連レイヤ導線（この周辺を調べる） */
  .pp-explore { display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
    margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
  .pp-explore-label { font-size: 10px; color: var(--muted); margin-right: 2px; }
  .pp-x { display: inline-flex; align-items: center; min-height: 26px;
    font-size: 10.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
    border: 1px solid var(--border); background: #fff; color: #574f6e;
    cursor: pointer; font-family: inherit;
    transition: color 0.12s, background 0.12s, border-color 0.12s, transform 0.06s; }
  .pp-x:active { transform: scale(0.96); }
  .pp-x:hover { border-color: var(--accent); color: var(--accent); }
  .pp-x.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

  /* ---- map legend ---- */
  #map { position: relative; }
  #legend {
    position: absolute; left: calc(var(--map-pad-left, 0px) + 10px); bottom: 28px; z-index: 5;
    background: rgba(255,255,255,0.9); border-radius: 10px; padding: 8px 10px;
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.65);
    font-size: 10px; color: var(--ink); box-shadow: 0 4px 18px rgba(24,17,45,0.16);
    max-width: 190px;
    /* 表示時は JS が display:flex にする。レイヤを重ねて凡例が伸びても地図の高さを超えないよう、
       高さの上限は位置に応じて clampLegend が実際の px で入れ、本文だけ内部スクロールする */
    display: none; flex-direction: column;
  }
  #legend-body { overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
  /* 凡例のヘッダ: つまんで動かす取っ手 ＆ 最小化ボタン。ドラッグ中は選択・スクロールを止める */
  #legend-head {
    display: flex; align-items: center; gap: 6px; cursor: grab;
    touch-action: none; user-select: none; -webkit-user-select: none;
    margin: -2px -2px 2px; padding: 2px;
  }
  #legend.dragging #legend-head { cursor: grabbing; }
  #legend-head .lg-grip { flex: none; width: 10px; height: 12px; opacity: 0.45;
    background-image: radial-gradient(currentColor 1px, transparent 1px);
    background-size: 4px 4px; background-position: 0 2px; }
  #legend-head .lg-name { font-weight: 700; font-size: 10.5px; flex: 1; }
  #legend-min {
    flex: none; width: 20px; height: 20px; padding: 0; border: none; background: none;
    color: var(--muted); font-family: inherit; font-size: 14px; line-height: 1;
    cursor: pointer; border-radius: 6px;
  }
  #legend-min:hover { background: var(--hover); color: var(--ink); }
  #legend.min #legend-body { display: none; }
  #legend.min { padding: 5px 8px; }
  #legend.min #legend-head { margin-bottom: 0; }
  #legend .lg-title { font-weight: 700; margin: 3px 0 2px; }
  #legend .lg-hint { color: var(--accent); font-weight: 600; margin-top: 2px; }
  #legend .lg-row { display: flex; align-items: center; gap: 5px; margin: 1px 0; }
  #legend .lg-sw { width: 12px; height: 12px; border-radius: 3px; flex: none; border: 1px solid rgba(0,0,0,0.08); }
  /* 右下のⓘボタン（帰属・注記ダイアログを開く。標準の地図コントロールに合わせた見た目） */
  #map-info-btn { width: 29px; height: 29px; display: flex; align-items: center; justify-content: center;
    background: none; border: none; cursor: pointer; padding: 0; }
  #map-info-btn:hover { background: var(--hover); }
  #info-dialog .info-body { font-size: 11px; color: var(--muted); line-height: 1.7; }
  #info-dialog .info-body h3 { font-size: 12px; color: var(--ink); margin: 14px 0 4px; }
  #info-dialog .info-body ul.info-notes { margin: 0 0 10px; padding-left: 0; list-style: none; }
  #info-dialog .info-body ul.info-notes li { margin: 0 0 5px; padding-left: 12px; text-indent: -12px; }
  #info-dialog .info-body ul.info-notes b { color: #574f6e; }
  #info-dialog .info-legal { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); color: #574f6e; }
  #info-dialog .info-links { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 8px; }
  #info-dialog .info-links a { color: var(--accent); font-weight: 700; text-decoration: none; }
  #info-dialog .info-links a:hover { text-decoration: underline; }
  #info-dialog .info-body p { margin: 0 0 10px; }
  #info-dialog .info-body p:last-child { margin-bottom: 0; }

  /* ---- map ---- */
  #map { flex: 1; }

  /* ---- 詳細カード（地点の吹き出しの代わり。地図右上に固定、ドラッグ・最小化・×）---- */
  #detail-card {
    position: absolute; top: 10px; right: 52px; z-index: 7; width: 320px; max-width: calc(100% - 64px);
    display: none; flex-direction: column;
    background: rgba(255,255,255,0.86);
    -webkit-backdrop-filter: blur(14px) saturate(1.15); backdrop-filter: blur(14px) saturate(1.15);
    border: 1px solid rgba(255,255,255,0.75); border-radius: 12px; color: var(--ink);
    box-shadow: 0 10px 32px rgba(24,17,45,0.18), 0 2px 8px rgba(24,17,45,0.08);
    max-height: var(--card-max, 80vh); /* placeCard が地図の高さから px で入れる */
  }
  #detail-card-head { display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 10px; cursor: grab;
    user-select: none; -webkit-user-select: none; touch-action: none; border-bottom: 1px solid rgba(24,17,45,0.06); }
  #detail-card.dragging #detail-card-head { cursor: grabbing; }
  #detail-card-title { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #detail-card-save, #detail-card-share, #detail-card-min, #detail-card-close { flex: none; width: 28px; height: 28px; padding: 0; border: none; border-radius: 999px;
    background: var(--ctrl-bg); color: #574f6e; font-family: inherit; font-size: 17px; line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: background 0.12s, color 0.12s, transform 0.06s; }
  #detail-card-min { font-size: 15px; }
  #detail-card-share, #detail-card-save { display: inline-flex; align-items: center; justify-content: center; }
  #detail-card-save.on { color: #e8a000; }
  #detail-card-save.on svg path { fill: #ffcf33; stroke: #e8a000; }
  /* 保存した場所（ヘッダのチップとダイアログ） */
  .saved-chip { display: inline-flex; align-items: center; min-height: 26px; border: 1px solid var(--border); background: none;
    color: #7a5a00; font-size: 11px; padding: 3px 10px; border-radius: 999px; cursor: pointer; font-family: inherit; white-space: nowrap; }
  .saved-chip:hover { background: var(--hover); }
  .saved-chip[hidden], #detail-card-save[hidden] { display: none; }
  #saved-dialog { border: none; border-radius: 14px; padding: 18px 20px; width: min(460px, 92vw);
    box-shadow: 0 20px 60px rgba(24,17,45,0.28); max-height: min(80vh, 640px); }
  #saved-dialog[open] { display: flex; flex-direction: column; }
  #saved-dialog::backdrop { background: rgba(23, 16, 42, 0.42); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
  #saved-dialog .dlg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
  #saved-dialog h2 { font-size: 15px; margin: 0; }
  #saved-dialog .dlg-head p { margin: 2px 0 0; font-size: 11.5px; color: var(--muted); }
  .saved-item { display: flex; align-items: stretch; gap: 4px; border-bottom: 1px solid var(--border); }
  .saved-go { flex: 1; min-width: 0; display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; text-align: left;
    padding: 9px 6px; border: none; background: none; font-family: inherit; cursor: pointer; border-radius: 8px; }
  .saved-go:hover { background: var(--hover); }
  .saved-type { grid-row: 1 / span 2; font-size: 10px; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 2px 7px; white-space: nowrap; }
  .saved-name { font-size: 13px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .saved-sub:empty { display: none; }
  .saved-sub { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .saved-del { flex: none; width: 32px; border: none; background: none; color: var(--muted); font-size: 16px; cursor: pointer; border-radius: 8px; }
  .saved-del:hover { background: var(--hover); color: var(--ink); }
  .saved-empty { padding: 20px 8px; font-size: 12.5px; color: var(--muted); line-height: 1.7; }
  .saved-pick { flex: none; display: flex; align-items: center; padding: 0 4px; }
  .saved-pick input { width: 16px; height: 16px; accent-color: var(--accent); }
  .saved-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 10px; margin-top: 4px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--muted); }
  .saved-foot button { font-family: inherit; }
  /* 比較（Pro） */
  #compare-dialog { border: none; border-radius: 14px; padding: 18px 20px; width: min(820px, 96vw); max-height: min(86vh, 760px);
    box-shadow: 0 20px 60px rgba(24,17,45,0.28); }
  #compare-dialog[open] { display: flex; flex-direction: column; }
  #compare-dialog::backdrop { background: rgba(23, 16, 42, 0.42); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
  #compare-dialog .dlg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
  #compare-dialog h2 { font-size: 15px; margin: 0; }
  #compare-dialog .dlg-head p { margin: 2px 0 0; font-size: 11.5px; color: var(--muted); }
  #compare-body { overflow: auto; min-height: 0; }
  .cmp-wrap { overflow-x: auto; }
  table.cmp { border-collapse: collapse; width: 100%; min-width: 520px; font-size: 12.5px; }
  table.cmp th, table.cmp td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
  table.cmp thead th { position: sticky; top: 0; background: #fff; z-index: 1; }
  table.cmp .cmp-metric { position: sticky; left: 0; background: #fff; font-weight: 600; color: var(--muted); font-size: 11.5px; white-space: nowrap; width: 1%; }
  table.cmp td { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }
  .cmp-sub { font-size: 10.5px; font-weight: 400; color: var(--muted); margin-top: 1px; }
  .cmp-na { color: #adb5bd; font-weight: 400; }
  .cmp-place { border: none; background: none; font: inherit; font-weight: 700; color: var(--accent); cursor: pointer; padding: 0; text-align: left; }
  .cmp-place:hover { text-decoration: underline; }
  #detail-card-save:hover, #detail-card-share:hover, #detail-card-min:hover, #detail-card-close:hover { background: var(--ctrl-bg-hover); color: var(--ink); }
  #detail-card-share:active, #detail-card-min:active, #detail-card-close:active { transform: scale(0.92); }
  #detail-card-body { overflow-y: auto; overscroll-behavior: contain; min-height: 0; padding: 10px 14px 14px; font-size: 12px; }
  #detail-card-body .popup-name { display: none; } /* 見出しはヘッダに出す */
  #detail-card.min #detail-card-body { display: none; }
  #detail-card.min #detail-card-head { border-bottom: none; }
  /* 選択中の地点を示すリング（カードと地点の対応が分かるように） */
  .sel-marker { width: 18px; height: 18px; border-radius: 999px; border: 2.5px solid var(--accent);
    box-shadow: 0 0 0 4px rgba(106,81,220,0.22); background: rgba(255,255,255,0.35); pointer-events: none;
    animation: sel-pulse 1.6s ease-out infinite; }
  @keyframes sel-pulse { 0% { box-shadow: 0 0 0 3px rgba(106,81,220,0.35); } 100% { box-shadow: 0 0 0 12px rgba(106,81,220,0); } }

  /* ---- popup（旧: 地点の吹き出し。互換のため残す）---- */
  .maplibregl-popup { max-width: 300px; }
  /* ポップアップは常に画面内に収める。長文になる場合は本文がスクロール */
  .maplibregl-popup-content {
    padding: 14px 16px; border-radius: 12px;
    box-shadow: 0 8px 28px rgba(24,17,45,0.16), 0 2px 8px rgba(24,17,45,0.1);
    font-family: inherit;
    max-height: min(62vh, 540px);
    overflow-y: auto; overscroll-behavior: contain;
  }
  /* 地図隅の帰属表示。MapLibre標準(12px)より一段控えめな11pxに（OSMF帰属ガイドラインの
     「読める」要件は満たす業界標準サイズ）。ホバーで文字色を濃くしてリンクと分かるように */
  .maplibregl-ctrl-attrib { font-size: 11px; line-height: 1.5; padding: 1px 6px; background: rgba(255,255,255,0.75); }
  .maplibregl-ctrl-attrib a { color: #574f6e; text-decoration: none; }
  .maplibregl-ctrl-attrib a:hover { color: var(--ink); text-decoration: underline; }
  /* 地図コントロール（ズーム等）の質感をパネル類と揃える */
  .maplibregl-ctrl-group {
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(24,17,45,0.16) !important;
  }
  .maplibregl-ctrl-group button { width: 30px; height: 30px; }
  #map-share-btn { display: flex; align-items: center; justify-content: center; }
  #share-dialog { border: none; border-radius: 14px; padding: 18px 20px; width: min(460px, 92vw); box-shadow: 0 20px 60px rgba(24,17,45,0.28); }
  #share-dialog .dlg-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
  #share-dialog h2 { font-size: 15px; margin: 0; }
  .share-note { font-size: 12.5px; color: var(--muted); margin: 0 0 10px; }
  .share-row { display: flex; gap: 8px; align-items: center; }
  .share-row input { flex: 1; min-width: 0; font: inherit; font-size: 12.5px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
  .maplibregl-ctrl-group button + button { border-top-color: var(--border); }
  /* 閉じるボタンの基準を（スクロールする）本文ではなくポップアップ枠にして、
     本文をスクロールしてもボタンが右上に留まるようにする。
     枠は transform で位置決めされており absolute の包含ブロックになる */
  .maplibregl-popup-content { position: static; }
  /* 上アンカー時は枠上端に吹き出しの三角(約10px)が入るぶん下げる */
  .maplibregl-popup-anchor-top .maplibregl-popup-close-button,
  .maplibregl-popup-anchor-top-left .maplibregl-popup-close-button,
  .maplibregl-popup-anchor-top-right .maplibregl-popup-close-button { top: 16px; }
  /* ポップアップの閉じるボタンも、ダイアログのXと同じ押しやすいデザインに揃える */
  .maplibregl-popup-close-button {
    display: flex; align-items: center; justify-content: center;
    top: 6px; right: 6px; width: 30px; height: 30px; padding: 0;
    border: none; border-radius: 999px; background: var(--ctrl-bg); color: #574f6e;
    font-size: 20px; line-height: 1; cursor: pointer;
    transition: background 0.12s, color 0.12s, transform 0.06s;
  }
  .maplibregl-popup-close-button:hover { background: var(--ctrl-bg-hover); color: var(--ink); }
  .maplibregl-popup-close-button:active { transform: scale(0.92); }
  /* マスクのホバー補足ラベル（カーソル追従・クリックは透過）。
     ガラス調の黒 + エリア色のドット + 年バッジ + 2指標のメトリクス表示 */
  #crm-hover-tip {
    position: absolute; z-index: 5; display: none; pointer-events: none;
    max-width: 264px; padding: 9px 12px 8px; border-radius: 12px;
    background: rgba(24,17,40,0.84); color: #fff;
    -webkit-backdrop-filter: blur(10px) saturate(1.4);
    backdrop-filter: blur(10px) saturate(1.4);
    border: 1px solid rgba(255,255,255,0.13);
    box-shadow: 0 10px 28px rgba(4,10,20,0.35), 0 2px 8px rgba(4,10,20,0.22);
    font-size: 12px; line-height: 1.45;
    animation: crmtip-in 0.14s ease-out;
  }
  @keyframes crmtip-in {
    from { opacity: 0; transform: translateY(3px) scale(0.98); }
    to { opacity: 1; transform: none; }
  }
  #crm-hover-tip .cht-head { display: flex; align-items: center; gap: 7px; }
  #crm-hover-tip .cht-dot {
    width: 9px; height: 9px; border-radius: 50%; flex: none;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.12);
  }
  #crm-hover-tip .cht-name { font-weight: 700; font-size: 13px; letter-spacing: 0.01em; }
  #crm-hover-tip .cht-year {
    margin-left: auto; padding: 1px 7px; border-radius: 999px; flex: none;
    font-size: 10px; color: #b5adc9; background: rgba(255,255,255,0.09);
  }
  #crm-hover-tip .cht-stats {
    display: flex; gap: 16px; margin-top: 7px; padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.1);
  }
  #crm-hover-tip .cht-metric { display: flex; flex-direction: column; gap: 0; }
  #crm-hover-tip .cht-metric .v {
    font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2;
  }
  #crm-hover-tip .cht-metric .v em { font-style: normal; font-size: 10.5px; font-weight: 600; color: #cfc9dd; margin-left: 1px; }
  #crm-hover-tip .cht-metric .k { font-size: 10px; color: #b8b1c8; margin-top: 1px; }
  .popup-name { font-size: 14px; font-weight: 700; margin: 0 0 4px; padding-right: 26px; }
  .popup-meta { font-size: 11px; color: var(--muted); margin-bottom: 8px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
  .popup-summary { font-size: 12px; line-height: 1.65; margin: 0; }
  .popup-price {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border);
  }
  .popup-price .label { font-size: 10.5px; color: var(--muted); }
  .popup-price .value { font-size: 13px; font-weight: 700; }
  .popup-detail-btn {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    width: 100%; margin-top: 10px; padding: 9px 12px;
    font-size: 12.5px; font-weight: 700; font-family: inherit;
    color: #fff; background: var(--accent);
    border: none; border-radius: 9px; cursor: pointer;
    box-shadow: 0 1px 2px rgba(24,17,45,0.14);
    transition: background 0.12s, box-shadow 0.12s, transform 0.06s;
  }
  .popup-detail-btn:hover { background: var(--accent-strong); box-shadow: 0 2px 6px rgba(24,17,45,0.2); }

  .popup-detail-btn:active { transform: translateY(1px); }
  .popup-detail-btn .btn-arrow { transition: transform 0.14s; font-weight: 400; }
  .popup-detail-btn:hover .btn-arrow { transform: translateX(3px); }
  .trade-head { font-size: 10.5px; color: var(--muted); margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--border); font-weight: 600; }
  .dist-chips { display: flex; gap: 6px; margin: 2px 0 8px; flex-wrap: wrap; }
  .dist-chip {
    display: inline-flex; align-items: center; min-height: 26px;
    font-size: 11px; padding: 3px 11px; border-radius: 999px; cursor: pointer;
    border: 1px solid var(--border); background: #fff; color: var(--muted);
    font-family: inherit; transition: transform 0.06s;
  }
  .dist-chip:active { transform: scale(0.96); }
  .dist-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
  .fc-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 6px; font-size: 11px; color: #4a4363; }
  .fc-legend span { display: inline-flex; align-items: center; gap: 4px; }
  .fc-legend .fc-lg-line { width: 14px; height: 0; }
  .fc-table-wrap { margin-top: 10px; overflow-x: auto; }
  .fc-table { width: 100%; border-collapse: collapse; font-size: 11.5px; font-variant-numeric: tabular-nums; }
  .fc-table th { text-align: left; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--border); padding: 4px 6px; }
  .fc-table td { padding: 3px 6px; border-bottom: 1px solid #f1eff8; }
  .fc-table tr.top3 td { font-size: 13px; font-weight: 700; }
  .fc-table tr.top3 td:last-child { color: var(--ink); }
  .fc-table .fc-sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
  .fc-table tr.top3 .fc-sw { width: 12px; height: 12px; }

  /* ---- price / info dialog ---- */
  #price-dialog, #info-dialog {
    border: none; border-radius: 14px; padding: 22px 24px;
    width: min(540px, calc(100vw - 40px));
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    font-family: inherit; color: var(--ink);
    max-height: min(88vh, 760px);
  }
  /* 収まらない場合のスクロール: 情報ダイアログは見出しを固定して本文のみ、
     価格ダイアログは内容が可変（チャート/分布/治安）なので全体をスクロール */
  #price-dialog { overflow-y: auto; }
  #info-dialog[open] { display: flex; flex-direction: column; }
  #info-dialog .info-body { overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
  #login-dialog, #pro-dialog { max-height: 88vh; overflow-y: auto; }
  #price-dialog::backdrop, #info-dialog::backdrop { background: rgba(23, 16, 42, 0.42); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
  .dlg-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
  .dlg-head h2 { margin: 0; font-size: 16px; }
  .dlg-head p { margin: 4px 0 0; font-size: 11px; color: var(--muted); }
  .dlg-close {
    display: flex; align-items: center; justify-content: center; flex: none;
    border: none; background: var(--ctrl-bg); color: #574f6e;
    font-size: 22px; line-height: 1; width: 40px; height: 40px; margin: -4px -6px 0 0;
    border-radius: 999px; cursor: pointer;
    transition: background 0.12s, color 0.12s, transform 0.06s;
  }
  .dlg-close:hover { background: var(--ctrl-bg-hover); color: var(--ink); }
  .dlg-close:active { transform: scale(0.92); }
  #dlg-stats { display: flex; gap: 20px; margin-bottom: 14px; }
  #dlg-stats .stat .k { font-size: 10.5px; color: var(--muted); }
  #dlg-stats .stat .v { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
  #dlg-stats .stat .v.up { color: #2b8a3e; }
  #dlg-stats .stat .v.down { color: #c92a2a; }
  #dlg-chart svg { width: 100%; height: auto; display: block; }
  /* ドラッグ範囲選択がブラウザのテキスト選択・ページズームと衝突しないようにする */
  #dlg-chart, #dlg-stats { user-select: none; -webkit-user-select: none; }
  #dlg-chart { touch-action: none; }
  .dlg-note { margin: 10px 0 0; font-size: 10px; color: var(--muted); }
  /* 期間の選び直しはドラッグ以外でもできるようにする（WCAG 2.2 ドラッグ動作の代替）*/
  #dlg-ranges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0 0; }
  /* ID セレクタの display は UA の [hidden]{display:none} に勝つため、明示的に打ち消す */
  #dlg-ranges[hidden] { display: none; }
  #dlg-ranges .rng-label { font-size: 10px; color: var(--muted); margin-right: 2px; }
  .rng-btn { display: inline-flex; align-items: center; min-height: 26px;
    font-size: 11px; font-weight: 600; font-family: inherit; padding: 4px 11px; border-radius: 999px;
    border: 1px solid var(--border); background: #fff; color: #574f6e; cursor: pointer;
    transition: color 0.12s, background 0.12s, border-color 0.12s, transform 0.06s; }
  .rng-btn:hover { border-color: var(--accent); color: var(--accent); }
  .rng-btn:active { transform: scale(0.96); }
  .rng-btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: #fff; }

  /* ---- bottom sheet handle（モバイルのみ表示）---- */
  /* button 化したのでブラウザ既定の枠・地色を消す */
  #sheet-handle { display: none; width: 100%; background: none; border: none; font-family: inherit; }

  @media (max-width: 640px) {
    #app { flex-direction: column; --map-pad-left: 0px; }
    #map { flex: 1; height: 100%; }
    /* カードは上部いっぱいに（凡例のピルの下）。高さは地図の4割まで */
    /* 詳細カードは下からのシート。最初は要点の高さ、見出しをタップで全文。地図は上に残る */
    #detail-card { top: auto; bottom: 0; left: 0; right: 0; width: auto; max-width: none; max-height: 40vh;
      border-radius: 16px 16px 0 0; border-bottom: none; padding-bottom: env(safe-area-inset-bottom);
      box-shadow: 0 -6px 24px rgba(0,0,0,0.14); transition: max-height 0.22s ease; }
    #detail-card.expanded { max-height: 84vh; }
    #detail-card.min { right: 0; max-height: none; }
    #detail-card-head { cursor: pointer; padding-top: 10px; touch-action: none; }
    #detail-card-head::before { content: ""; position: absolute; left: 50%; top: 4px; width: 40px; height: 4px; margin-left: -20px;
      border-radius: 999px; background: #d5d0e2; }
    #detail-card-head { position: relative; }
    /* カードが開いている間、一覧のボトムシートは引っ込める（閉じると戻る） */
    body.card-open #sidebar { transform: translateY(100%); }
    body.card-open #load-status, body.card-open #toast-host { bottom: calc(40vh + 12px); }

    /* サイドバーを下からのボトムシートに。収納時は取っ手+検索+ステータスチップまで見せる */
    #sidebar {
      position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 20; /* top:auto: PC の top:0 を打ち消す */
      width: 100%; height: 72vh;
      border-right: none; border-top: 1px solid var(--border);
      border-radius: 16px 16px 0 0;
      box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.14);
      background: rgba(255,255,255,0.92);
      transform: translateY(calc(72vh - 232px));
      transition: transform 0.25s ease;
      padding-bottom: env(safe-area-inset-bottom);
    }
    #sidebar.expanded { transform: translateY(0); }

    #sheet-handle {
      display: flex; justify-content: center; align-items: center;
      padding: 12px 0 8px; cursor: pointer; flex: none;
    }
    #sheet-handle span {
      width: 40px; height: 4px; border-radius: 999px; background: #d5d0e2;
    }

    /* ヘッダを圧縮（リード文は隠す） */
    #sidebar header { padding: 4px 14px 0; }
    #sidebar h1 .logo { height: 24px; }
    #sidebar p.lead, #sidebar p.catch { display: none; }
    #search-box { margin-top: 8px; }
    #pane-tabs { margin: 8px -14px 0; }

    /* ステータス・Pro のチップ行は横スクロール1行に（レイヤ行は縦並びのまま） */
    #filters, #pro-filters { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    #filters::-webkit-scrollbar, #pro-filters::-webkit-scrollbar { display: none; }
    #list-tools .chip { flex: none; white-space: nowrap; min-height: 32px; padding: 6px 12px; }
    #pane-layers .chip { min-height: 40px; }
    .pp-x, .dist-chip, .rng-btn { min-height: 32px; }
    .area-item { padding: 12px; }
    .hz-label { flex: none; }
    #disaster-toggle { padding: 9px 14px; }
    .dis-item, .dis-year, .dis-detail, .dis-note { padding-left: 14px; padding-right: 14px; }
    /* モバイルは #filter-scroll が外側スクロールを持たない（一覧が担う）ため、
       長い災害リストはメニュー自身の内部スクロールにする */
    #disaster-body { max-height: 38vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
    .dis-item { min-height: 44px; }

    /* 凡例はシートに隠れないよう左上へ。地図を隠さないよう初期状態は最小化（ヘッダのみ） */
    #legend { bottom: auto; top: 10px; max-width: 200px; }
    #legend.min { border-radius: 999px; padding: 6px 11px; }
    /* パネルはボトムシートの取っ手で開閉するので、左端のつまみは出さない */
    #sidebar-toggle { display: none !important; }
    #app.sidebar-off #sidebar { display: flex; }

    /* トーストは既定で画面下端に出るが、モバイルではボトムシート（収納時232px）に
       重なって検索欄・チップを覆ってしまうため、シートの上に持ち上げる */
    #toast-host { bottom: calc(232px + env(safe-area-inset-bottom) + 12px); }
    #load-status { bottom: calc(232px + env(safe-area-inset-bottom) + 56px); }
    /* モバイルは最小 12px（PC の情報密度は据え置き） */
    .popup-meta, .popup-price .label, .trade-head, .poi-note, .poi-total, .poi-bar, .poi-cats span, .poi-lock,
    .pp-explore-label, .pp-x, .pp-approx, .pp-statusdesc, .pp-sources, .pp-updated, .lg-row, .lg-title, .lg-hint,
    .search-sec, .search-hit, .chip-desc, .itip-pop, .trade-note, .share-note, .popup-detail-btn, #legend-head .lg-name,
    .rp-loading, .rp-note, .rp-item-sub, .rp-map, .pp-explore-note { font-size: 12px; }
    /* インラインで小さくしている補足（混雑率の時間帯・人口の増減など）も 12px 以上に */
    #detail-card-body span[style*="font-size"], #detail-card-body button[style*="font-size"] { font-size: 12px !important; }
  }

  /* ---- モーション低減設定の尊重 ----
     状態が伝わる最小限（色・不透明度）は残し、移動・拡大縮小・反復アニメを止める。
     地図側の flyTo / easeTo も JS 側で duration:0 に落とす */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.001ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.001ms !important;
      scroll-behavior: auto !important;
    }
    #sidebar { transition: none !important; }
    .chip.loading { animation: none !important; opacity: 0.6; }
    .ls-spin { animation: none !important; }
    #detail-card { transition: none !important; }
    #load-status { transition: none; }
    .chip:active, .pp-x:active, .dist-chip:active, .rng-btn:active,
    .dlg-close:active, .maplibregl-popup-close-button:active,
    .popup-detail-btn:active { transform: none !important; }
    .popup-detail-btn:hover .btn-arrow { transform: none !important; }
  }
