/* 画面の見た目。色・角丸・影・文字・大きさは、いちばん上の変数 (デザインの決まり) で決める。
   決まりと部品の考え方は docs/design/ にある。見た目を変えるときは、まず変数を直す。
   構成: 決まり → 基本の部品 → 上の帯 → 左の欄/シート → 結果 → 地図の上の部品 → ダイアログ → ピクセル調 → スマホ幅 */

/* ---- 決まり (変数) ---------------------------------------------------------------------- */
:root {
  /* 配色: 高対比 (紺 × 生成り。黒の文字・はっきりした罫線と枠)。画面の地は、地図の陸の色 (basemap.js の land) に合わせる。
     文字は 4.5:1 以上、枠・主役の色・フォーカスは 3:1 以上 (docs/design/TOKENS.md)。ver4 で8つの配色を試し、見やすい高対比に決めた */
  --bg: #f6f3ec; --surface: #ffffff; --surface-2: #faf8f3; --sunken: #eeeade;
  --ink: #000000; --ink-2: #1a1a1a; --muted: #363b48;
  --line: #8c887c; --line-strong: #4a4a4a;
  --control: #333333;  /* 入力欄・選択・＋−の枠線 (飾りの罫線 --line とは別) */
  --primary: #0b2a8f; --primary-hover: #061d6b; --on-primary: #ffffff; --primary-weak: #dce3fa; --primary-ink: #0b2a8f;
  --focus: #0b2a8f;
  --ok: #0e5a33; --ok-weak: #e2f3ea; --warn: #6b3a00; --warn-weak: #fbefd9; --danger: #8f1a12; --danger-weak: #fbe4e1;
  --scrim: rgba(20, 24, 36, .45);
  /* 形: 角丸 (小・中・大・特大・丸薬)、線の太さ、影 */
  --r-s: 8px; --r-m: 12px; --r-l: 16px; --r-xl: 22px; --r-pill: 999px; --bw: 1px;
  --shadow-1: 0 1px 2px rgba(29, 35, 51, .10), 0 1px 3px rgba(29, 35, 51, .08);
  --shadow-2: 0 4px 16px rgba(29, 35, 51, .16), 0 1px 3px rgba(29, 35, 51, .10);
  --shadow-sheet: 0 -6px 24px rgba(29, 35, 51, .18);
  /* 文字: 段階で決める (部品の CSS に px を直接書かない)。スマホ幅 (860px 以下) は 1px ずつ大きくする */
  --font: system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", "Meiryo", sans-serif;
  --fs-xs: 13px;   /* いちばん小さい字: バッジ・注記・タイルの見出し */
  --fs-s: 14px;    /* 補助: 説明・単位・候補の中身・凡例 */
  --fs-ctl: 15px;  /* 操作部品・表: 切り替え・札・選択肢・詳細の表 */
  --fs: 16px;      /* 本文・ボタン・入力 */
  --fs-m: 17px;    /* やや強調: 件数・タイルの値 */
  --fs-l: 19px;    /* 見出し */
  --fs-xl: 22px;   /* ダイアログの見出し */
  --fs-num: 32px;  /* 結果の大きな数 */
  /* 余白: 入れ子 (欄 → カード → 行) で重なるので、1つずつ小さめにする */
  --pad-panel: 10px; --pad-card: 12px; --pad-row: 10px; --gap: 8px;
  /* 大きさ */
  /* 左の欄の幅は、利用者が境目をつかんで変えられる (boot.js / ui.js が --panel-w-user に入れる)。範囲は 320px〜720px、地図が 360px は残す。スマホ幅は下の @media が決める */
  --bar-h: 56px; --panel-w: clamp(320px, var(--panel-w-user, 440px), min(720px, calc(100vw - 360px))); --detail-w: 420px; --tap: 40px; --run-h: 72px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23363b48' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
:root.dark {
  --bg: #0f1620; --surface: #1b2430; --surface-2: #17202b; --sunken: #121a24;
  --ink: #ffffff; --ink-2: #f0f0f0; --muted: #d0d4dc;
  --line: #6b7587; --line-strong: #aeb6c4;
  --control: #c9d0dc;
  --primary: #a9c4ff; --primary-hover: #c4d6ff; --on-primary: #000000; --primary-weak: #1b2b57; --primary-ink: #c9dbff;
  --focus: #ffffff;
  --ok: #7fe3ae; --ok-weak: #15301f; --warn: #ffc766; --warn-weak: #35280f; --danger: #ff9b92; --danger-weak: #3a1a18;
  --scrim: rgba(0, 0, 0, .6);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-2: 0 4px 16px rgba(0, 0, 0, .5);
  --shadow-sheet: 0 -6px 24px rgba(0, 0, 0, .55);
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d0d4dc' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

/* ---- 基本 ------------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }  /* display を指定した部品でも、hidden で必ず隠れるように */
html, body { height: 100%; }
body { margin: 0; font: var(--fs)/1.6 var(--font); color: var(--ink); background: var(--bg); overflow: hidden; overscroll-behavior: none;
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p, ul, ol { margin: 0; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.noscript { padding: 16px; background: var(--warn-weak); color: var(--warn); }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hint { color: var(--muted); font-size: var(--fs-s); margin: 0 0 8px; line-height: 1.5; }

button, input, select { font: inherit; color: inherit; }
button { min-height: var(--tap); padding: 0 14px; border: var(--bw) solid var(--line-strong); border-radius: var(--r-m); background: var(--surface);
  cursor: pointer; transition: background-color .12s, border-color .12s, color .12s, transform .08s; }
button:hover { background: var(--sunken); }
button:active { transform: scale(.97); }  /* 押した瞬間に反応する */
button:disabled { opacity: .55; cursor: default; transform: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
button.primary { min-height: 48px; padding: 0 18px; background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 700; }
button.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
button.link { min-height: 0; padding: 6px 4px; border: 0; background: none; color: var(--muted); text-decoration: underline; }
button.link:hover { background: none; color: var(--ink); }
input, select { min-height: var(--tap); padding: 0 10px; border: var(--bw) solid var(--control); border-radius: var(--r-m); background: var(--surface); }
select { appearance: none; padding-right: 30px; background: var(--surface) var(--chev) right 10px center / 12px no-repeat; text-overflow: ellipsis; }
input[type=number] { width: 84px; }
input::placeholder { color: var(--muted); }
input[type=checkbox] { min-height: 0; width: 18px; height: 18px; padding: 0; accent-color: var(--primary); }

/* ---- 上の帯 ----------------------------------------------------------------------------- */
.bar { position: relative; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 12px; height: var(--bar-h);
  padding: 0 14px; background: var(--surface); border-bottom: var(--bw) solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { width: 30px; height: 30px; flex: none; }
.logo .lg-bg { fill: var(--primary); } .logo .lg-pin { fill: var(--on-primary); } .logo .lg-dot { fill: var(--primary); }
.bar h1 { font-size: var(--fs-l); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .sub { margin-left: 8px; font-size: var(--fs-s); font-weight: 400; color: var(--muted); }
.bar-actions { display: flex; gap: 4px; flex: none; }
.bar-actions button { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; font-size: var(--fs-ctl); border-color: transparent; background: transparent; color: var(--ink-2); white-space: nowrap; }
.bar-actions button:hover { background: var(--sunken); color: var(--ink); }

/* ---- 全体の並び (PC 幅: 左に欄、右に地図) -------------------------------------------------- */
#app { display: grid; grid-template-columns: var(--panel-w) minmax(0, 1fr); height: calc(100vh - var(--bar-h)); height: calc(100dvh - var(--bar-h)); }
#side { position: relative; z-index: 10; display: flex; flex-direction: column; min-height: 0; background: var(--bg); border-right: var(--bw) solid var(--line); }
#panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#mapWrap { position: relative; min-width: 0; overflow: hidden; background: var(--bg); }
#map, #baseMap { position: absolute; inset: 0; }  /* #map (ラベル・検索結果) を #baseMap の上に重ねる */
#pixelCanvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; pointer-events: none; }
/* 左の欄の幅をつかんで変えている間は、地図の大きさを今のままにして、描き直さない (離したときに1度だけ合わせる) */
#app.resizing { cursor: col-resize; user-select: none; -webkit-user-select: none; }
#app.resizing #map, #app.resizing #baseMap, #app.resizing #pixelCanvas { right: auto; width: var(--frozen-w); }
#app.resizing #map, #app.resizing #baseMap { pointer-events: none; }

/* 左の欄と地図の境目のつまみ (PC 幅だけ)。欄の右の縁にまたがる細い帯。いつも見える小さな持ち手と、触れたときの線 */
.resizer { position: absolute; top: 0; bottom: 0; right: -7px; z-index: 12; width: 14px; cursor: col-resize; touch-action: none; }
.resizer::before { content: ""; position: absolute; top: 0; bottom: 0; left: 6px; width: 2px; background: var(--primary); opacity: 0; transition: opacity .12s; }
.resizer::after { content: ""; position: absolute; top: 50%; left: 4px; width: 6px; height: 44px; margin-top: -22px; border: var(--bw) solid var(--control); border-radius: var(--r-pill); background: var(--surface); }
.resizer:hover::before, .resizer:focus-visible::before, #app.resizing .resizer::before { opacity: .55; }
.resizer:focus-visible { outline: none; }
.resizer:focus-visible::after { border-color: var(--primary); box-shadow: 0 0 0 2px var(--focus); }

/* ---- 左の欄 / シート: タブ ----------------------------------------------------------------- */
.sheet-head { flex: none; background: var(--surface); border-bottom: var(--bw) solid var(--line); }
.grip { display: none; }
.ptabs { display: flex; padding: 0 8px; }
.ptabs button { flex: 1; display: inline-flex; justify-content: center; align-items: center; gap: 6px; min-height: 48px; padding: 0 6px;
  border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; color: var(--muted); font-weight: 700; white-space: nowrap; }
.ptabs button:hover { background: none; color: var(--ink); }
.ptabs button[aria-selected="true"] { color: var(--primary-ink); border-bottom-color: var(--primary); }
.n { min-width: 22px; padding: 0 7px; border-radius: var(--r-pill); background: var(--primary-weak); color: var(--primary-ink); font-size: var(--fs-s); font-weight: 700; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.n:empty { display: none; }
.pscroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--pad-panel) var(--pad-panel) 20px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

.card { margin-bottom: 10px; padding: var(--pad-card); background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-l); }
.card > h2 { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: var(--fs-m); font-weight: 700; }
.card > h2 .ic { margin: 0; color: var(--muted); }
.ic { display: inline-flex; vertical-align: -3px; margin-right: 5px; flex: none; }
.ic svg { display: block; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 0 14px; border-radius: var(--r-pill); background: var(--surface-2); font-size: var(--fs-ctl); }
.chip:hover { background: var(--primary-weak); border-color: var(--primary); color: var(--primary-ink); }

/* 押して切り替える部品 (2〜3択)。地図の「表示」・施設の行・お気に入りと履歴で使う */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-m); background: var(--sunken); }
.seg button { min-height: 36px; padding: 0 12px; border: 0; border-radius: calc(var(--r-m) - 3px); background: transparent; color: var(--ink-2); font-size: var(--fs-ctl); font-weight: 600; white-space: nowrap; }
.seg button:hover { background: transparent; color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--primary-ink); box-shadow: var(--shadow-1); }
.seg.sm button { min-height: 36px; padding: 0 9px; }

/* 施設は「近くにほしい」と「遠ざけたい」の2つのまとまりに分ける。見出しの札・行の左の帯・行の地の色で区別する (色だけに頼らず、札に文字と記号も付ける) */
.fgroup { margin-top: 14px; }
.fgroup:first-child { margin-top: 4px; }
.fg-title { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: var(--fs-ctl); font-weight: 700; color: var(--ink); }
.fg-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px 2px 8px; border-radius: var(--r-pill); background: var(--primary-weak); color: var(--primary-ink); font-size: var(--fs-xs); font-weight: 700; }
.fg-tag .i { width: 16px; height: 16px; }
.fgroup.far .fg-tag { background: var(--warn-weak); color: var(--warn); }
.fg-rows:empty::before { content: attr(data-empty); display: block; margin-bottom: var(--gap); padding: 10px var(--pad-row); border: var(--bw) dashed var(--line-strong); border-radius: var(--r-m); color: var(--muted); font-size: var(--fs-s); }
.fgroup button.add { width: 100%; }
.fgroup.far button.add { color: var(--warn); border-color: var(--warn); }
.fgroup.far button.add:hover { background: var(--warn-weak); }

/* 施設の行: 施設 / 移動手段 / 何分 / 必須か希望か */
.frow { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); margin-bottom: var(--gap); padding: var(--pad-row); background: var(--surface-2); border: var(--bw) solid var(--line); border-radius: var(--r-l); }
.frow.near { border-left: 4px solid var(--primary); }
.frow.far { border-left: 4px solid var(--warn); background: var(--warn-weak); }
.frow-head { display: flex; align-items: center; gap: 8px; }
.frow-head .ic { margin: 0; }
.frow-head select { flex: 1; min-width: 0; font-weight: 600; }
.frow .x { flex: none; display: inline-grid; place-items: center; width: 40px; min-height: 40px; padding: 0; border: 0; border-radius: var(--r-s); background: transparent; color: var(--muted); }
.frow .x:hover { background: var(--danger-weak); color: var(--danger); }
.frow-body { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.frow .unit { color: var(--ink-2); font-size: var(--fs-ctl); }
/* 必須か希望か: 押すと切り替わる札。必須は塗り、希望は枠だけ */
button.need { flex: none; min-height: 38px; padding: 0 12px; border-color: var(--primary); border-radius: var(--r-pill); background: var(--primary-weak); color: var(--primary-ink); font-size: var(--fs-ctl); font-weight: 700; }
button.need[data-v="want"] { border-color: var(--line-strong); border-style: dashed; background: transparent; color: var(--ink-2); }
.stepper { display: inline-flex; align-items: center; overflow: hidden; border: var(--bw) solid var(--control); border-radius: var(--r-m); background: var(--surface); }
.stepper button { display: grid; place-items: center; width: 38px; min-height: 40px; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--ink-2); font-size: 20px; }
.stepper .unit { white-space: nowrap; padding-right: 2px; }
.stepper input { width: 40px; min-height: 40px; padding: 0; border: 0; border-radius: 0; background: transparent; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; appearance: textfield; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
/* 重複・矛盾の注意 (行の下に1行。conflicts.js / docs/design/CONFLICTS.md)。記号と文字で伝え、色だけに頼らない。入力は止めない */
.frow-note { display: flex; align-items: flex-start; gap: 6px; margin: 0; padding: 6px 8px; border: var(--bw) solid var(--line); border-radius: var(--r-s); background: var(--surface); font-size: var(--fs-s); line-height: 1.45; }
.frow-note .ui-i { flex: none; display: inline-flex; margin-top: 2px; }
.frow-note .i { width: 16px; height: 16px; }
.frow-note.warn { color: var(--warn); border-color: var(--warn); font-weight: 600; }  /* 利用者の意図と違う結果になる: 矛盾・同じ条件 */
.frow-note.info { color: var(--muted); }  /* 効いていないだけ */
.row-actions { display: flex; gap: 8px; margin-top: 4px; }
button.add { flex: 1; min-height: 44px; border-style: dashed; background: transparent; color: var(--primary-ink); font-weight: 600; }
button.add:hover { background: var(--primary-weak); }

/* ハザード: 水害・土砂・地震ごとに折りたたむ。選んだ数は見出しのバッジに出る */
#hazards { display: grid; gap: 8px; }
.hgroup, details.field { border: var(--bw) solid var(--line); border-radius: var(--r-m); background: var(--surface-2); }
.hgroup > summary, details.field > summary { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 var(--pad-row); cursor: pointer; list-style: none; font-weight: 700; }
.hgroup > summary::-webkit-details-marker, details.field > summary::-webkit-details-marker { display: none; }
.hgroup > summary::after, details.field > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; flex: none;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translate(-2px, -2px); transition: transform .2s; }
.hgroup[open] > summary::after, details.field[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.hgroup[open] > summary, details.field[open] > summary { border-bottom: var(--bw) solid var(--line); }
.hgroup > summary .ic, details.field > summary .ic { margin: 0; color: var(--muted); }
.hgroup > summary .gname { flex: none; }
.hgroup > summary .badge { margin-left: 2px; }
.hgroup .hrow { margin: 0; padding: 8px 12px; }
.hrow { display: grid; grid-template-columns: minmax(0, 1fr) 164px; align-items: center; gap: 8px; }
.hrow .hname { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: var(--fs-ctl); }
.hrow .hname .ic { margin: 0; color: var(--muted); }
.hname .scope { display: block; font-size: var(--fs-xs); color: var(--muted); }  /* 一部の地域しか調べていないハザードの注記 (「東京都のみ」など, #18) */
.hrow select { min-height: 40px; font-size: var(--fs-ctl); }
.hrow select.active { border-color: var(--primary); background-color: var(--primary-weak); color: var(--primary-ink); font-weight: 700; }
.badge { display: inline-block; min-width: 20px; padding: 0 7px; border-radius: var(--r-pill); background: var(--primary); color: var(--on-primary); font-size: var(--fs-xs); font-weight: 700; line-height: 20px; text-align: center; }
.badge:empty { display: none; }

.field { display: block; margin-top: 12px; font-size: var(--fs-ctl); font-weight: 600; color: var(--ink-2); }
.field .ic { margin: 0 6px 0 0; color: var(--muted); }
.flabel { display: flex; align-items: center; }
.field .inline { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-weight: 400; }

/* ⓘ ヒントのボタン。見た目は小さく、押せる範囲は 44px 近くまで広げる。押すと ui.js が吹き出しを出す */
.hint-btn { position: relative; display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; min-height: 0; margin-left: 2px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); vertical-align: middle; }
.hint-btn::after { content: ""; position: absolute; inset: -8px; }
.hint-btn .i { width: 18px; height: 18px; }
.hint-btn:hover, .hint-btn[aria-expanded="true"] { background: var(--primary-weak); color: var(--primary-ink); }
.hintpop { position: fixed; top: 0; left: 0; z-index: 95; width: min(320px, calc(100vw - 16px)); padding: 12px 14px; border-radius: var(--r-m); background: var(--ink); color: var(--bg); box-shadow: var(--shadow-2); font-size: var(--fs-s); line-height: 1.55; }
.hintpop b { display: block; margin-bottom: 2px; font-size: var(--fs-ctl); }
.hintpop p { margin: 0; }
.hintpop small { display: block; margin-top: 6px; opacity: .85; font-size: var(--fs-xs); }
.hintpop::before { content: ""; position: absolute; top: -5px; left: calc(var(--ax, 24px) - 6px); width: 12px; height: 12px; background: inherit; transform: rotate(45deg); }
.hintpop.up::before { top: auto; bottom: -5px; }
.field input:not([type=number]):not([type=checkbox]) { width: 100%; margin-top: 6px; }
#priceMax { flex: 1; max-width: 190px; }
details.field > div { padding: 6px 12px 12px; }
.zgroup { margin: 6px 0; }
.zgroup b { display: block; font-size: var(--fs-s); color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; margin: 0 12px 0 0; font-size: var(--fs-ctl); font-weight: 400; color: var(--ink); }
label.check.field { display: flex; margin: 14px 0 0; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
.grid3 .wgroup { grid-column: 1 / -1; margin: 8px 0 2px; font-size: var(--fs-s); font-weight: 700; color: var(--muted); }  /* 市区町村の一覧の都県の見出し (首都圏, #18) */
/* データの作成日: 目立たない一行 (スマホ幅だけ。PC 幅は上の帯の小さな文字)。出典と注意へのリンク付き */
.datastamp { margin: 8px 4px 0; color: var(--muted); font-size: var(--fs-xs); text-align: center; }
.datastamp .link { min-height: 0; padding: 6px 4px; font-size: inherit; }
@media (min-width: 861px) { .datastamp { display: none; } }

/* 広告枠: 普段は出さない (場所も取らない)。出すときは、高さを決めた枠 (300×250 + 「広告」の札) だけ。
   広告が入っても、画面がずれない。置く場所と決まりは docs/design/ADS.md */
.ad-slot { display: none; }
:root[data-ads] .ad-slot { display: block; width: min(100%, 336px); height: 280px; margin: 18px auto 4px; overflow: hidden; contain: layout; }
.ad-label { display: block; margin-bottom: 4px; color: var(--muted); font-size: var(--fs-xs); line-height: 1.5; }
.ad-body { display: grid; place-items: center; height: 250px; border: var(--bw) dashed var(--line-strong); border-radius: var(--r-m); background: var(--sunken); color: var(--muted); font-size: var(--fs-s); }

/* 「探す」の帯: いつでも押せるよう、下に固定。条件の数と、探したあとは該当数を出す */
.runbar { flex: none; display: flex; align-items: center; gap: 12px; min-height: var(--run-h); padding: 10px 14px calc(10px + var(--safe-b)); background: var(--surface); border-top: var(--bw) solid var(--line); }
.run-info { flex: 1; min-width: 0; line-height: 1.35; }
.run-main { display: block; font-size: var(--fs-m); font-variant-numeric: tabular-nums; }
.run-text { display: block; overflow: hidden; font-size: var(--fs-s); color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.dirty { display: inline-block; margin-left: 8px; padding: 0 8px; border-radius: var(--r-pill); background: var(--warn-weak); color: var(--warn); font-size: var(--fs-xs); font-weight: 700; line-height: 20px; vertical-align: 1px; }
.runbar .primary { flex: none; }
/* 下の帯の中身は、タブで変わる (ui.js の showTab が data-tab を切り替える)。
   条件: [リセット] [お気に入り] [この条件で探す] (件数の表示は隠す)
   結果: [件数・変更あり ……… リセット お気に入り] (探すは出さない。探すのは「条件」のタブ)
   お気に入り・履歴: 帯なし (探す・リセット・お気に入りのどれも、ここでは使わない) */
.run-tools { display: none; flex: none; gap: 4px; }
.runbar[data-tab="cond"] .run-tools, .runbar[data-tab="result"] .run-tools { display: flex; }
.runbar[data-tab="cond"] .run-info { display: none; }
.runbar[data-tab="cond"] .primary { flex: 1; }
.runbar[data-tab="result"] .primary { display: none; }
.runbar[data-tab="result"] .run-tools { order: 2; }
.runbar[data-tab="saved"] { display: none; }
.tool { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-width: 60px; min-height: 52px; padding: 4px 6px; border: 0; border-radius: var(--r-m); background: transparent; color: var(--ink-2); font-size: var(--fs-xs); font-weight: 700; line-height: 1.3; white-space: nowrap; }
.tool:hover { background: var(--sunken); color: var(--ink); }
.tool.main { color: var(--primary-ink); }
.tool .i { width: 22px; height: 22px; }

/* ---- 結果 ------------------------------------------------------------------------------- */
#summary { padding: var(--pad-card); background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-l); }
#summary .big { font-size: var(--fs-num); font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.notice { margin-top: 6px; color: var(--warn); font-size: var(--fs-s); }
#relax .hint { margin: 14px 0 6px; font-weight: 700; }
.relax { margin: 0; padding: 0; overflow: hidden; list-style: none; background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-l); }
.relax li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border-bottom: var(--bw) solid var(--line); font-size: var(--fs-ctl); }
.relax li:last-child { border-bottom: 0; }
.relax .plus { color: var(--ok); font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
#resultSection h3 { margin: 18px 0 8px; color: var(--ink-2); font-size: var(--fs-ctl); }
.top { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; counter-reset: rank; }
.top li { position: relative; counter-increment: rank; padding: 12px 12px 12px 50px; background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-l); cursor: pointer; }
.top li::before { content: counter(rank); position: absolute; left: 12px; top: 12px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary-weak); color: var(--primary-ink); font-size: var(--fs-s); font-weight: 700; }
.top li:hover { border-color: var(--primary); }
.top .where { font-weight: 700; }
.top .metrics { margin-top: 2px; color: var(--muted); font-size: var(--fs-s); }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.empty b { color: var(--ink); }
#resultSection:not([hidden]) ~ .empty { display: none; }

/* お気に入り (保存した条件)・履歴 (#15) */
.tabs { display: flex; gap: 2px; margin: 0 0 10px; padding: 3px; border-radius: var(--r-m); background: var(--sunken); }
.tabs button { flex: 1; min-height: 40px; padding: 0 8px; border: 0; border-radius: calc(var(--r-m) - 3px); background: transparent; color: var(--muted); font-weight: 700; }
.tabs button:hover { background: transparent; color: var(--ink); }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.tabs .count { font-size: var(--fs-xs); font-weight: 400; color: var(--muted); }
.slist { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.slist li { display: grid; gap: 4px; padding: 10px 12px; background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-m); }
.slist li.empty { padding: 20px 8px; background: none; border: 0; font-size: var(--fs-s); }
.slist .sname { font-weight: 700; }
.slist .sname input { width: 100%; }
.slist .ssum { font-size: var(--fs-s); color: var(--muted); overflow-wrap: anywhere; }
.slist .when { margin-right: 6px; color: var(--ink); font-variant-numeric: tabular-nums; }
.slist .acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.slist .ask { font-size: var(--fs-s); color: var(--danger); font-weight: 700; }
button.mini { min-height: 36px; padding: 0 10px; border-radius: var(--r-s); font-size: var(--fs-s); }
button.mini.go { border-color: var(--primary); color: var(--primary-ink); }
button.mini.danger { border-color: var(--danger); color: var(--danger); }

/* ---- 地図の上の部品 ---------------------------------------------------------------------- */
.mapctl { position: absolute; top: 12px; left: 12px; z-index: 15; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }  /* スマホ幅でシートを高くしたときは、シートが手前 */
.mapctl.open { z-index: 45; }  /* メニューを開いている間は、シートより手前 */
.mapbtn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border: 0; border-radius: var(--r-pill); background: var(--surface); box-shadow: var(--shadow-2); font-weight: 700; }
/* 「表示」メニュー (#mapPop)。クラス名を .pop にすると、検索したときに跳ねて出るマーカー (.markerBounce .pop) にも当たって、白い大きな箱になるため、別の名前 */
.mapmenu { display: grid; gap: 12px; width: min(360px, calc(100vw - 24px)); max-height: calc(100vh - var(--bar-h) - 80px); max-height: calc(100dvh - var(--bar-h) - 80px); overflow-y: auto; padding: var(--pad-card); background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow-2); }
.pop-label { margin-bottom: 6px; font-size: var(--fs-s); font-weight: 700; color: var(--muted); }
.mapmenu .seg { display: flex; }
.mapmenu .seg button { flex: 1; }
.mapmenu .seg.grid2 { display: grid; grid-template-columns: 1fr 1fr; }
.mapmenu .seg.toggles { gap: 8px; padding: 0; background: none; }
.mapmenu .seg.toggles button { border: var(--bw) solid var(--line-strong); border-radius: var(--r-m); background: var(--surface-2); }
.mapmenu .seg.toggles button.on { border-color: var(--primary); background: var(--primary-weak); color: var(--primary-ink); box-shadow: none; }

.legend { position: fixed; left: calc(var(--panel-w) + 12px); bottom: 34px; z-index: 5; padding: 8px 12px; background: var(--surface); border-radius: var(--r-m); box-shadow: var(--shadow-2); font-size: var(--fs-s); }
.ramp { width: 140px; height: 10px; margin: 4px 0 2px; border-radius: 3px; opacity: .85; }  /* 色は app.js が resultRamp から入れる。地図の塗りの濃さ (85%) に合わせる */
.ramp-labels { display: flex; justify-content: space-between; color: var(--muted); }
/* いまいる場所: スマホ幅のときだけ出す (下の @media) */
.locate { display: none; position: absolute; right: 12px; bottom: calc(100% + 12px); z-index: 5; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px;
  border: 0; border-radius: var(--r-pill); background: var(--surface); box-shadow: var(--shadow-2); font-weight: 700; }
.status { position: absolute; top: 12px; left: 50%; z-index: 46; display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: var(--r-pill);
  background: var(--surface); box-shadow: var(--shadow-2); font-weight: 700; transform: translateX(-50%); }
.status::before { content: ""; width: 14px; height: 14px; border: 2px solid var(--line-strong); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; bottom: 24px; left: 50%; z-index: 80; max-width: min(92vw, 520px); padding: 10px 18px; border-radius: var(--r-pill);
  background: var(--ink); color: var(--bg); box-shadow: var(--shadow-2); font-size: var(--fs-ctl); font-weight: 700; text-align: center; transform: translateX(-50%); }

/* 区画の詳細: PC 幅は右に浮かぶカード (ズームボタンの下・出典の上。閉じるボタンがいつも見える) */
.detail { position: absolute; top: 76px; right: 12px; bottom: 40px; z-index: 8; display: flex; flex-direction: column; width: var(--detail-w); overflow: hidden;
  background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow-2); }
.detail-head { flex: none; position: relative; display: flex; justify-content: flex-end; padding: 6px 6px 0; }
.grip-bar { display: none; }
.detail .close { display: grid; place-items: center; width: 40px; min-height: 40px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
#detailBody { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 16px 18px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.detail h2 { margin-bottom: 2px; font-size: var(--fs-l); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 4px; }
.tile { padding: 10px 12px; background: var(--surface-2); border: var(--bw) solid var(--line); border-radius: var(--r-m); }
.tile small { display: block; color: var(--muted); font-size: var(--fs-xs); }
.tile b { display: block; font-size: var(--fs-m); line-height: 1.4; overflow-wrap: anywhere; }
.tile.warn b { color: var(--danger); }  /* ▲ が1件以上。0件のときは文字の色のまま (「安全」とは言わない) */
.tile b + small { margin-top: 2px; }
.tile.wide { grid-column: 1 / -1; }  /* 最寄りの駅: 一行まるごと (名前と距離が欠けないように) */
.tile .hint-btn { width: 24px; height: 24px; margin: -4px 0 -4px 2px; }
.tile .hint-btn .i { width: 16px; height: 16px; }
.tile .hint-btn::after { inset: -10px; }
.dsec { margin-top: 14px; border-bottom: var(--bw) solid var(--line); }
.dsec > summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; list-style: none; color: var(--ink-2); font-size: var(--fs-ctl); font-weight: 700; }
.dsec > summary::-webkit-details-marker { display: none; }
.dsec > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translate(-2px, -2px); transition: transform .2s; }
.dsec > summary::after { margin-right: 4px; }  /* 回した印が右へはみ出さないように */
.dsec[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.dsec > table { margin-bottom: 10px; }
.detail h3 { margin: 18px 0 6px; padding-bottom: 4px; border-bottom: var(--bw) solid var(--line); color: var(--ink-2); font-size: var(--fs-ctl); }
.detail table { width: 100%; border-collapse: collapse; font-size: var(--fs-ctl); }
.detail th, .detail td { padding: 6px 4px; text-align: left; vertical-align: top; border-bottom: var(--bw) solid var(--line); }
.detail th { padding-right: 10px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.detail th .ic { margin-right: 4px; vertical-align: -2px; }
.detail td.num { text-align: right; font-variant-numeric: tabular-nums; }
.lvl0 { color: var(--ok); } .lvl1 { color: var(--warn); font-weight: 600; } .lvl2 { color: var(--danger); font-weight: 700; }
.lvl0::before { content: "✓ "; } .lvl1::before { content: "△ "; } .lvl2::before { content: "▲ "; }  /* 色だけに頼らない */
.nodata { color: var(--muted); }

/* 地図の吹き出し・ズームボタン */
.maplibregl-ctrl button { min-height: 0; border-radius: 0; }
.maplibregl-ctrl-group { border-radius: var(--r-m); box-shadow: var(--shadow-2); }
.maplibregl-popup-content { padding: 10px 12px; color: var(--ink); background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-m); box-shadow: var(--shadow-2); }
.maplibregl-popup-close-button { min-height: 0; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 0 var(--r-m) 0 var(--r-s); background: transparent; color: var(--muted); font-size: 18px; }
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip, .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip, .maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip { border-top-color: var(--surface); }
.maplibregl-popup-anchor-top .maplibregl-popup-tip, .maplibregl-popup-anchor-top-left .maplibregl-popup-tip, .maplibregl-popup-anchor-top-right .maplibregl-popup-tip { border-bottom-color: var(--surface); }
.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--surface); }
.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--surface); }
.mpop { display: flex; gap: 6px; align-items: flex-start; padding-right: 22px; font-size: var(--fs-ctl); line-height: 1.4; }  /* 閉じるボタンと重ならないように */
.mpop small { color: var(--muted); }
.mpop .ic { margin: 0; }

/* ---- ダイアログ ------------------------------------------------------------------------- */
dialog { max-width: min(640px, calc(100vw - 24px)); max-height: min(86vh, 820px); max-height: min(86dvh, 820px); padding: 22px 22px 18px; overflow: auto;
  color: var(--ink); background: var(--surface); border: 0; border-radius: var(--r-xl); box-shadow: var(--shadow-2); }
dialog[open] { animation: pop-in .18s ease-out; }
dialog::backdrop { background: var(--scrim); }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
dialog h2 { margin-bottom: 10px; font-size: var(--fs-xl); }
dialog h3 { margin: 16px 0 4px; font-size: var(--fs); }
dialog ul { padding-left: 18px; font-size: var(--fs-ctl); }
dialog li { margin: 4px 0; }
dialog .sources { max-height: 40vh; overflow: auto; font-size: var(--fs-s); }  /* 出典とライセンスの一覧 (パイプラインの attribution.json) */
dialog .sources li { margin: 2px 0; }
dialog .sources small { display: block; color: var(--muted); }
dialog .stamp { margin: 0 0 12px; padding: 10px 12px; border-radius: var(--r-m); background: var(--surface-2); font-size: var(--fs-ctl); }
dialog .stamp small { display: block; margin-top: 2px; color: var(--muted); font-size: var(--fs-s); line-height: 1.5; }
.dialog-actions, .welcome-actions { display: flex; justify-content: flex-end; margin-top: 12px; }
dialog.welcome { max-width: 660px; }
.steps { display: grid; gap: 10px; margin: 8px 0 14px; padding: 0; list-style: none; counter-reset: step; }
.steps li { position: relative; margin: 0; padding-left: 36px; font-size: var(--fs); counter-increment: step; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary); color: var(--on-primary); font-size: var(--fs-ctl); font-weight: 700; }
.usecases { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 8px 0; }
.usecase { display: flex; gap: 10px; align-items: flex-start; padding: 12px; text-align: left; background: var(--surface-2); border-radius: var(--r-l); }
.usecase:hover, .usecase:focus-visible { border-color: var(--primary); background: var(--primary-weak); }
.usecase b { display: block; }
.usecase small { display: block; margin-top: 2px; color: var(--muted); font-size: var(--fs-s); }
.usecase .ic { margin: 0; }

/* ---- ピクセル調 (#10) -------------------------------------------------------------------
   角を落とさず、影は ずらした塗り にする。決まり (変数) を差し替えるだけで、新しい部品も同じ見た目になる。
   body.px: ピクセル系の見た目すべて / body.pxdot: 文字も DotGothic16 にする */
@font-face { font-family: "DotGothic16"; src: url("/static/vendor/DotGothic16-Regular.ttf") format("truetype"); font-display: swap; }
body.px { --r-s: 0; --r-m: 0; --r-l: 0; --r-xl: 0; --r-pill: 0; --bw: 2px; --line: var(--line-strong);
  --shadow-1: 2px 2px 0 rgba(30, 36, 48, .35); --shadow-2: 4px 4px 0 rgba(30, 36, 48, .35); --shadow-sheet: 0 -4px 0 rgba(30, 36, 48, .25); }
:root.dark body.px { --shadow-1: 2px 2px 0 rgba(0, 0, 0, .5); --shadow-2: 4px 4px 0 rgba(0, 0, 0, .5); --shadow-sheet: 0 -4px 0 rgba(0, 0, 0, .5); }
body.px .logo .lg-bg { rx: 0; }
body.px button.primary { box-shadow: 3px 3px 0 rgba(30, 36, 48, .55); }
body.px button.primary:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(30, 36, 48, .55); }
body.px .stepper, body.px .seg { border-radius: 0; }
body.pxdot { font-family: "DotGothic16", var(--font); line-height: 1.5; }
body.pxdot h1, body.pxdot h2, body.pxdot h3, body.pxdot b, body.pxdot button, body.pxdot .top .where, body.pxdot #summary .big { font-weight: normal; }
body.pxdot .bar h1 { font-size: var(--fs-xl); }

/* ---- 検索したときに跳ねるマーカー (app.js の bounceMarkers)。下の中央 (しずく型の先) を地点に合わせる ---- */
.markerBounce { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.markerBounce > div { position: absolute; transform: translate(-50%, -100%); }
.markerBounce .pop { position: relative; transform-origin: 50% 100%; animation: marker-pop ease-out both; }
.markerBounce .pop.px { animation-name: marker-pop-px; }
.markerBounce img { display: block; }
.markerBounce .px img { image-rendering: pixelated; }
/* 件数は、跳ね終わって戻す地図の文字 (細く、少し灰色がかって見える) に合わせ、細字で少し透かす。真っ白で太いと、戻したときに暗くなって見える */
.markerBounce span { position: absolute; transform: translate(-50%, 50%); color: rgba(255, 255, 255, .82); font: 400 11px/1 sans-serif; }
.markerBounce span.dot { font-family: "DotGothic16", sans-serif; }
@keyframes marker-pop {
  0% { opacity: 0; transform: translateY(-16px) scale(.75, 1.15); }
  35% { opacity: 1; transform: translateY(0) scale(1.18, .8); }
  55% { transform: translateY(-7px) scale(.94, 1.06); }
  75% { transform: translateY(0) scale(1.06, .95); }
  88% { transform: translateY(-2px); }
  100% { opacity: 1; transform: none; }
}
/* ドット絵は伸び縮みさせるとドットが崩れるので、上下に跳ねるだけ */
@keyframes marker-pop-px {
  0% { opacity: 0; transform: translateY(-16px); }
  35% { opacity: 1; transform: translateY(0); }
  55% { transform: translateY(-8px); }
  75% { transform: translateY(0); }
  88% { transform: translateY(-2px); }
  100% { opacity: 1; transform: none; }
}

/* ---- スマホ幅 (860px 以下): 大きさをタッチ向けにする ---------------------------------------------
   上の帯は記号だけ、タップは 44px、入力は 16px。横向きで高さが低いとき (下の シート の条件に当てはまらないとき) は、
   PC と同じ左の欄 + 地図のままで、この大きさだけ当てる */
@media (max-width: 860px) {
  :root { --bar-h: 52px; --tap: 44px; --panel-w: min(400px, 46vw); --detail-w: 380px;
    --fs-xs: 14px; --fs-s: 15px; --fs-ctl: 16px; --fs: 17px; --fs-m: 18px; --fs-l: 20px;
    --pad-panel: 8px; --pad-card: 10px; --pad-row: 8px; }
  .seg.sm button { padding: 0 8px; font-size: var(--fs-s); }  /* 施設の行の移動手段 (幅 390px でも「単位つきの分」と1行に並ぶ大きさ) */
  .stepper button { width: 36px; }
  .resizer { display: none; }  /* 欄の幅を変えるのは PC 幅だけ */
  .hint-btn { width: 32px; height: 32px; }  /* 押せる範囲は ::after で 44px 以上 */
  .hint-btn::after { inset: -6px; }
  .bar { gap: 8px; padding: 0 6px 0 12px; }
  .bar h1 { font-size: var(--fs-l); }
  .bar .sub, .bar-actions .lbl { display: none; }
  .bar-actions button { justify-content: center; width: 40px; min-height: 40px; padding: 0; }
  input, select { font-size: var(--fs); }  /* 16px 未満だと iPhone が入力のたびに拡大してしまう (スマホ幅の --fs は 17px) */
  .hrow select, .hrow { font-size: var(--fs-ctl); }
  .hrow { grid-template-columns: minmax(0, 1fr) 150px; }
  .toast { top: calc(var(--bar-h) + 10px); bottom: auto; }
  .maplibregl-ctrl-top-right .maplibregl-ctrl-group { display: none; }  /* ズームボタンは使わない (2本指で拡大縮小) */
  .mapctl { top: 10px; left: 10px; }
  .detail { top: 12px; }
  .locate { display: inline-flex; position: fixed; right: 12px; bottom: 44px; }  /* 左の欄のままのとき (横向き): 地図の右下 */
  dialog { width: 100%; max-width: none; margin: auto 0 0; border-radius: var(--r-xl) var(--r-xl) 0 0; padding-bottom: calc(18px + var(--safe-b)); }
  dialog[open] { animation: sheet-in .25s ease-out; }
  @keyframes sheet-in { from { transform: translateY(40px); opacity: .6; } }
}

/* 幅 380px 以下の小さな端末: 施設の行の移動手段と分が1行に並ぶよう、部品をわずかに詰める */
@media (max-width: 380px) {
  .seg.sm button { padding: 0 6px; }
  .stepper button { width: 32px; }
  .stepper input { width: 34px; }
}

/* ---- スマホ幅 (860px 以下) で、高さが十分あるとき: 地図を全面に、条件は下から引き出すシート ------------------
   シートは ui.js が transform だけで動かす (見える高さは sheet.js の 低・中・高 の3段)。ui.js の mobile と同じ条件。
   「探す」の帯は画面の下に固定、現在地ボタンと凡例はシートの上に乗って一緒に動く */
@media (max-width: 860px) and (min-height: 501px) {
  :root { --panel-w: 0px; --peek-h: calc(145px + var(--safe-b)); }  /* つまみ 24 + タブ 48 + 探す帯 72 (実際の高さは ui.js が測る) */
  #app { display: block; position: relative; }
  #mapWrap { position: absolute; inset: 0; }
  #side { display: contents; }
  #panel { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: calc(100vh - var(--bar-h) - 8px); height: calc(100dvh - var(--bar-h) - 8px);
    background: var(--bg); border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--shadow-sheet);
    transform: translate3d(0, calc(100% - var(--peek-h)), 0); }
  #panel.dragging, .detail.dragging { user-select: none; -webkit-user-select: none; }
  .sheet-head { border-bottom: 0; border-radius: var(--r-xl) var(--r-xl) 0 0; touch-action: none; }
  .grip { display: grid; place-items: center; width: 100%; height: 24px; min-height: 24px; padding: 0; border: 0; border-radius: var(--r-xl) var(--r-xl) 0 0; background: none; touch-action: none; }
  .grip:hover { background: none; }
  .grip:active { transform: none; }
  .grip span { width: 40px; height: 5px; border-radius: 3px; background: var(--line-strong); }
  .ptabs { border-bottom: var(--bw) solid var(--line); }
  .pscroll { padding-bottom: calc(var(--run-h) + var(--safe-b) + 20px); }
  .runbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; }
  .legend { position: absolute; left: 12px; bottom: calc(100% + 12px); }
  .locate { position: absolute; right: 12px; bottom: calc(100% + 12px); }

  .detail { position: fixed; top: auto; left: 0; right: 0; bottom: 0; z-index: 40; width: auto; height: calc(100vh - var(--bar-h) - 8px); height: calc(100dvh - var(--bar-h) - 8px);
    border: 0; border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--shadow-sheet); transform: translate3d(0, 100%, 0); }
  .detail-head { display: block; height: 44px; padding: 0; touch-action: none; }
  .grip-bar { display: block; width: 40px; height: 5px; margin: 10px auto 0; border-radius: 3px; background: var(--line-strong); }
  .detail .close { position: absolute; top: 4px; right: 6px; }
  #detailBody { padding-bottom: calc(24px + var(--safe-b)); }

  .maplibregl-ctrl-bottom-right { top: 58px; bottom: auto; right: 4px; }  /* 出典の表示をシートに隠れない上へ (「表示」ボタンの下) */
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
