/* Material 3（Material You）のデザイントークンで組んだ画面。ライト固定（POLICY #7）。 */
:root {
  /* color roles */
  --md-primary: #0b57d0; --md-on-primary: #ffffff;
  --md-primary-container: #d3e3fd; --md-on-primary-container: #041e49;
  --md-secondary-container: #c2e7ff; --md-on-secondary-container: #001d35;
  --md-tertiary: #146c2e; --md-tertiary-container: #c4eed0; --md-on-tertiary-container: #072711;
  --md-error: #b3261e;
  --md-surface: #f8fafd; --md-surface-bright: #ffffff;
  --md-surface-container-low: #f2f6fc; --md-surface-container: #edf2fa;
  --md-surface-container-high: #e7edf6; --md-surface-container-highest: #dfe5ee;
  --md-on-surface: #1b1c1f; --md-on-surface-variant: #44474e;
  --md-outline: #74777f; --md-outline-variant: #c4c6d0;
  --md-inverse-surface: #2f3033; --md-inverse-on-surface: #f1f0f4;
  /* shape */
  --sh-xs: 4px; --sh-sm: 8px; --sh-md: 12px; --sh-lg: 16px; --sh-xl: 28px; --sh-full: 999px;
  /* elevation */
  --el-1: 0 1px 2px rgba(0,0,0,.3), 0 1px 3px 1px rgba(0,0,0,.15);
  --el-2: 0 1px 2px rgba(0,0,0,.3), 0 2px 6px 2px rgba(0,0,0,.15);
  --el-3: 0 1px 3px rgba(0,0,0,.3), 0 4px 8px 3px rgba(0,0,0,.15);
  /* app colours for transport modes */
  --a: #146c2e; --b: #b3261e;
  --bus: #e8710a; --rail: #1967d2; --subway: #8430ce; --tram: #188038; --ferry: #00838f;
  --walk: #6b7686; --bike: #c2185b; --taxi: #3c4043; --other: #5f6368;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; overscroll-behavior: none; }
body {
  background: var(--md-surface); color: var(--md-on-surface);
  font: 400 14px/1.45 Roboto, "Noto Sans JP", -apple-system, "Hiragino Sans", sans-serif; letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
a { color: var(--md-primary); }
.ms {
  font-family: "Material Symbols Outlined"; font-weight: normal; font-style: normal;
  font-size: 20px; line-height: 1; letter-spacing: normal; text-transform: none;
  display: inline-block; white-space: nowrap; direction: ltr; vertical-align: middle; flex: none;
  -webkit-font-feature-settings: "liga"; font-feature-settings: "liga";
}
.ms.sm { font-size: 18px; color: var(--md-on-surface-variant); }
:focus-visible { outline: 2px solid var(--md-primary); outline-offset: 2px; }

/* state layer: hover / press を色の重ねで表す */
.row, .btn, .chip, .icon-btn, .od-field, .itin-h, .cmp .c, .seg button, .qres button, .fab { position: relative; overflow: hidden; }
.row::after, .btn::after, .chip::after, .icon-btn::after, .od-field::after, .itin-h::after, .cmp .c::after, .seg button::after, .qres button::after, .fab::after {
  content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0; transition: opacity .15s; pointer-events: none;
}
@media (hover: hover) { button.row:hover::after, .btn:hover::after, .chip:hover::after, .icon-btn:hover::after, .od-field:hover::after, .itin-h:hover::after, .cmp .c:hover::after, .seg button:hover::after, .qres button:hover::after, .fab:hover::after { opacity: .08; } }
button.row:active::after, .btn:active::after, .chip:active::after, .icon-btn:active::after, .od-field:active::after, .itin-h:active::after, .cmp .c:active::after, .seg button:active::after, .qres button:active::after, .fab:active::after { opacity: .12; }

/* ---------- layout (desktop) ---------- */
#app { display: grid; grid-template-columns: 412px 1fr; height: 100dvh; }
#panel { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; min-height: 0; background: var(--md-surface); z-index: 3; box-shadow: var(--el-1); }
#mapwrap { grid-column: 2; grid-row: 1; position: relative; min-width: 0; }
#handle { display: none; }
#top { padding: 16px 16px 8px; }
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.brand-ic { font-size: 30px; color: var(--md-primary); }
.brand h1 { font: 500 20px/1.3 Roboto, "Noto Sans JP", sans-serif; margin: 0; }
.brand p { margin: 0; font-size: 12px; color: var(--md-on-surface-variant); }
#scroll { flex: 1; overflow: auto; min-height: 0; padding: 4px 16px calc(16px + var(--safe-b)); overscroll-behavior: contain; }
#foot { padding: 20px 0 4px; font-size: 11px; color: var(--md-on-surface-variant); line-height: 1.6; }

/* search bar (M3 Search bar) */
.search { position: relative; display: flex; align-items: center; gap: 12px; height: 52px; background: var(--md-surface-container-high); border-radius: var(--sh-full); padding: 0 16px; color: var(--md-on-surface-variant); }
.search input { flex: 1; border: 0; outline: 0; background: transparent; min-width: 0; font-size: 16px; color: var(--md-on-surface); }
.search input::placeholder { color: var(--md-on-surface-variant); }
.qres { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--md-surface-container-high); border-radius: var(--sh-lg); box-shadow: var(--el-2); z-index: 20; max-height: 340px; overflow: auto; padding: 8px 0; }
.qres button { display: flex; gap: 14px; align-items: center; width: 100%; min-height: 56px; text-align: left; border: 0; background: none; padding: 6px 16px; }
.qres small { display: block; color: var(--md-on-surface-variant); }

/* origin / destination */
.od { margin-top: 10px; display: grid; gap: 6px; }
.od-row { display: flex; align-items: center; gap: 8px; }
.dot { width: 24px; height: 24px; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; flex: none; }
.dot-a { background: var(--a); } .dot-b { background: var(--b); }
.od-field { flex: 1; min-width: 0; height: 40px; text-align: left; border: 1px solid var(--md-outline-variant); background: transparent; border-radius: var(--sh-sm); padding: 0 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--md-on-surface-variant); }
.od-field.set { color: var(--md-on-surface); font-weight: 500; border-color: var(--md-outline); }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center; flex: none; color: var(--md-on-surface-variant); }
.icon-btn .ms { font-size: 22px; }
.time-row { display: flex; align-items: center; gap: 8px; padding: 4px 0 8px; }
.time-row select, .time-row input { height: 36px; border: 1px solid var(--md-outline-variant); border-radius: var(--sh-sm); padding: 0 8px; background: transparent; font-size: 14px; }

/* typography */
h2 { font: 400 22px/1.3 Roboto, "Noto Sans JP", sans-serif; margin: 4px 0 2px; }
h3 { font: 500 14px/1.4 Roboto, "Noto Sans JP", sans-serif; letter-spacing: .01em; margin: 24px 0 8px; display: flex; align-items: center; gap: 8px; }
h3 .ms { color: var(--md-primary); }
h3 small { font-weight: 400; color: var(--md-on-surface-variant); margin-left: auto; font-size: 12px; }
h4 { font: 500 12px/1.4 Roboto, "Noto Sans JP", sans-serif; color: var(--md-on-surface-variant); margin: 12px 0 2px 8px; letter-spacing: .04em; }
.sub { color: var(--md-on-surface-variant); font-size: 12.5px; }
.muted { color: var(--md-on-surface-variant); }
.hint { background: var(--md-surface-container); border-radius: var(--sh-md); padding: 12px 16px; color: var(--md-on-surface-variant); font-size: 13px; }
.hint b { color: var(--md-on-surface); }
.err { color: var(--md-error); font-size: 13px; }

/* cards */
.welcome { display: grid; gap: 8px; }
.wcard { display: flex; gap: 16px; align-items: flex-start; background: var(--md-surface-container-low); border-radius: var(--sh-md); padding: 14px 16px; }
.wcard .ms { font-size: 24px; color: var(--md-primary); margin-top: 2px; }
.wcard b { display: block; font-weight: 500; font-size: 15px; }
.wcard span.t { color: var(--md-on-surface-variant); font-size: 13px; }

/* buttons (M3 common buttons) */
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 2px; }
.btn { height: 40px; border: 1px solid var(--md-outline); background: transparent; border-radius: var(--sh-full); padding: 0 16px 0 12px; display: inline-flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; color: var(--md-primary); text-decoration: none; white-space: nowrap; }
.btn .ms { font-size: 18px; }
.btn.primary { background: var(--md-primary); border-color: transparent; color: var(--md-on-primary); }
.btn.tonal { background: var(--md-secondary-container); border-color: transparent; color: var(--md-on-secondary-container); }
.back { border: 0; background: none; color: var(--md-primary); padding: 6px 8px 6px 0; margin-bottom: 4px; display: inline-flex; align-items: center; gap: 4px; font-weight: 500; }
.fab { position: absolute; right: 16px; bottom: 28px; z-index: 2; width: 56px; height: 56px; border: 0; border-radius: var(--sh-lg); background: var(--md-primary-container); color: var(--md-on-primary-container); box-shadow: var(--el-3); display: grid; place-items: center; }
.fab .ms { font-size: 24px; }

/* segmented buttons */
.seg { display: inline-flex; border: 1px solid var(--md-outline); border-radius: var(--sh-full); overflow: hidden; }
.seg button { height: 40px; border: 0; background: none; padding: 0 16px; font-weight: 500; }
.seg button + button { border-left: 1px solid var(--md-outline); }
.seg button.on { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }

/* lists (M3 list items) */
.list { display: grid; }
.row { display: flex; align-items: center; gap: 16px; width: 100%; min-height: 56px; text-align: left; border: 0; background: none; padding: 8px 8px; border-radius: var(--sh-md); }
.row .main { flex: 1; min-width: 0; }
.row .main b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; font-size: 15px; }
.row .main small { color: var(--md-on-surface-variant); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; }
.row .end { text-align: right; flex: none; font-variant-numeric: tabular-nums; }
.row .end b { font-size: 15px; font-weight: 500; } .row .end small { display: block; color: var(--md-on-surface-variant); font-size: 12px; }
.row.sub-row { min-height: 40px; padding: 2px 8px 2px 62px; }
.mi { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; }
.mi .ms { font-size: 22px; }
.m-bus { background: var(--bus); } .m-rail { background: var(--rail); } .m-subway { background: var(--subway); }
.m-tram { background: var(--tram); } .m-ferry { background: var(--ferry); } .m-walk { background: var(--walk); }
.m-bike { background: var(--bike); } .m-taxi { background: var(--taxi); } .m-other { background: var(--other); }
.badge { display: inline-block; border-radius: var(--sh-xs); padding: 0 6px; font-size: 12px; font-weight: 700; line-height: 1.6; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.rt { color: var(--md-tertiary); font-weight: 700; font-size: 11px; border: 1px solid var(--md-tertiary); border-radius: var(--sh-xs); padding: 0 4px; margin-left: 4px; }
.late { color: var(--md-error); }

/* comparison */
.cmp { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0 8px; }
.cmp .c { border: 1px solid var(--md-outline-variant); border-radius: var(--sh-md); padding: 10px 2px; text-align: center; background: transparent; }
.cmp .c.best { border-color: transparent; background: var(--md-tertiary-container); color: var(--md-on-tertiary-container); }
.cmp .c .ms { font-size: 22px; }
.cmp .c b { display: block; font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; }
.cmp .c small { display: block; font-size: 11px; line-height: 1.35; opacity: .8; }

/* itineraries (outlined cards) */
.itin { border: 1px solid var(--md-outline-variant); border-radius: var(--sh-md); margin-top: 8px; background: var(--md-surface); overflow: hidden; }
.itin.on { border-color: var(--md-primary); background: var(--md-surface-bright); box-shadow: var(--el-1); }
.itin-h { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 12px 16px 8px; text-align: left; }
.itin-h .times { font-weight: 500; font-size: 16px; font-variant-numeric: tabular-nums; }
.itin-h .dur { margin-left: auto; text-align: right; }
.itin-h .dur b { font-size: 16px; font-weight: 500; }
.bar { display: flex; gap: 2px; padding: 0 16px 12px; align-items: center; flex-wrap: wrap; }
.bar .seg-l { height: 24px; border-radius: var(--sh-xs); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; gap: 2px; padding: 0 6px; min-width: 26px; white-space: nowrap; overflow: hidden; }
.bar .seg-l .ms { font-size: 15px; }
.legs { border-top: 1px solid var(--md-outline-variant); padding: 10px 16px 14px; display: none; }
.itin.on .legs { display: block; }
.leg { display: grid; grid-template-columns: 48px 14px 1fr; gap: 8px; padding: 4px 0; }
.leg .t { font-variant-numeric: tabular-nums; color: var(--md-on-surface-variant); font-size: 12.5px; text-align: right; }
.leg .ln { border-radius: 4px; width: 5px; margin: 3px auto; min-height: 34px; }
.leg .ln.dash { background: repeating-linear-gradient(to bottom, var(--walk) 0 4px, transparent 4px 8px) !important; }
.leg .d b { display: block; font-weight: 500; } .leg .d small { color: var(--md-on-surface-variant); display: block; }

.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--md-outline-variant); border-top-color: var(--md-primary); border-radius: 50%; animation: sp .8s linear infinite; vertical-align: -2px; margin-right: 8px; }
@keyframes sp { to { transform: rotate(360deg); } }
.progress { height: 4px; border-radius: 2px; background: var(--md-surface-container-highest); overflow: hidden; margin: 8px 0; }
.progress i { display: block; height: 100%; background: var(--md-primary); border-radius: 2px; transition: width .2s; }

/* ---------- map overlays ---------- */
#map { position: absolute; inset: 0; }
#reach { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; mix-blend-mode: multiply; opacity: .62; z-index: 1; }
#layers { position: absolute; top: 12px; left: 12px; right: 56px; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 6px; }
#layers::-webkit-scrollbar { display: none; }
/* M3 filter chips (elevated, because they sit on the map) */
.chip { height: 32px; border: 0; background: var(--md-surface-container-low); box-shadow: var(--el-1); border-radius: var(--sh-sm); padding: 0 14px 0 8px; display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 13px; color: var(--md-on-surface-variant); white-space: nowrap; flex: none; }
.chip .ms { font-size: 18px; }
.chip.on { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }
.chip.busy .ms { animation: sp 1s linear infinite; }
.chip.select { padding-right: 4px; }
.chip.select select { border: 0; background: transparent; font-weight: 500; font-size: 13px; outline: 0; }
.snack { position: absolute; left: 50%; transform: translateX(-50%); bottom: 28px; z-index: 2; background: var(--md-inverse-surface); color: var(--md-inverse-on-surface); border-radius: var(--sh-xs); box-shadow: var(--el-3); padding: 12px 16px; font-size: 14px; white-space: nowrap; max-width: calc(100% - 100px); overflow: hidden; text-overflow: ellipsis; }
.snack .spin { border-color: rgba(255,255,255,.3); border-top-color: #fff; }
.legend { position: absolute; left: 12px; bottom: 36px; z-index: 2; background: var(--md-surface-container-low); border-radius: var(--sh-md); box-shadow: var(--el-1); padding: 10px 12px; font-size: 12px; }
.legend .sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 6px; }
.legend div + div { margin-top: 3px; }
#hoverTip { position: absolute; z-index: 2; pointer-events: none; background: var(--md-inverse-surface); color: var(--md-inverse-on-surface); border-radius: var(--sh-xs); padding: 4px 8px; font-size: 12px; font-weight: 500; transform: translate(14px, 14px); white-space: nowrap; }
.pin { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); display: grid; place-items: center; box-shadow: var(--el-2); border: 2px solid #fff; }
.pin span { transform: rotate(45deg); color: #fff; font-weight: 700; font-size: 13px; }
.pin.a { background: var(--a); } .pin.b { background: var(--b); } .pin.f { background: var(--md-primary); }
.me { width: 16px; height: 16px; border-radius: 50%; background: var(--md-primary); border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(11, 87, 208, .22); }
.maplibregl-popup-content { border-radius: var(--sh-md); padding: 12px 16px; font: inherit; box-shadow: var(--el-2); background: var(--md-surface-container-low); }
.maplibregl-popup-tip { border-top-color: var(--md-surface-container-low) !important; border-bottom-color: var(--md-surface-container-low) !important; }
.pop b { display: block; font-weight: 500; font-size: 15px; } .pop small { color: var(--md-on-surface-variant); display: block; }
.maplibregl-ctrl-top-right { top: 0; }

/* ---------- phone: 地図を全面に、案内はボトムシート ---------- */
@media (max-width: 760px) {
  #app { display: block; position: fixed; inset: 0; }
  #mapwrap { position: absolute; inset: 0; }
  .brand { display: none; }
  #panel {
    position: absolute; left: 0; right: 0; bottom: 0; height: 52dvh; max-height: calc(100dvh - 76px - var(--safe-t));
    border-radius: var(--sh-xl) var(--sh-xl) 0 0; background: var(--md-surface-container-low); box-shadow: var(--el-3);
    transition: height .28s cubic-bezier(.2, 0, 0, 1);
  }
  #panel.dragging { transition: none; }
  #panel.sheet-peek { height: calc(148px + var(--safe-b)); }
  #panel.sheet-half { height: 52dvh; }
  #panel.sheet-full { height: calc(100dvh - 76px - var(--safe-t)); }
  #handle { display: grid; place-items: center; width: 100%; height: 28px; border: 0; background: none; flex: none; touch-action: none; cursor: grab; }
  #handle span { width: 32px; height: 4px; border-radius: 2px; background: var(--md-outline); opacity: .6; }
  #top { padding: 0 16px 4px; }
  .od { margin-top: 0; }
  /* 検索バーは地図の上に浮かせる */
  #searchbar { position: fixed; top: calc(10px + var(--safe-t)); left: 12px; right: 12px; z-index: 6; height: 52px; background: var(--md-surface-container-low); box-shadow: var(--el-2); }
  #layers { top: calc(70px + var(--safe-t)); left: 0; right: 0; padding: 2px 12px 6px; flex-wrap: nowrap; }
  .maplibregl-ctrl-top-right { display: none; }
  .legend { display: none; }
  .fab, .snack { transition: bottom .28s cubic-bezier(.2, 0, 0, 1); }
  .fab { bottom: calc(var(--sheet-h, 52dvh) + 16px); right: 12px; }
  .snack { bottom: calc(var(--sheet-h, 52dvh) + 16px); left: 12px; transform: none; max-width: calc(100% - 92px); }
  .snack { max-width: calc(100% - 32px); }
  h2 { font-size: 20px; }
  .cmp { gap: 6px; }
  #hoverTip { display: none; }
}

/* 全国バスデータの系統名（assist chip 風） */
.routes { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 8px 10px 62px; }
.pop .routes { padding: 8px 0 2px; max-height: 150px; overflow: auto; }
.routes span { border: 1px solid var(--md-outline-variant); border-radius: var(--sh-sm); padding: 2px 8px; font-size: 12px; color: var(--md-on-surface-variant); background: var(--md-surface); }

/* 系統チップ（押せる assist chip） */
.routes button { border: 1px solid var(--md-outline); border-radius: var(--sh-sm); min-height: 32px; padding: 4px 12px; font-size: 13px; font-weight: 500; color: var(--md-primary); background: var(--md-surface-bright); text-align: left; }
.routes button:hover { background: var(--md-primary-container); border-color: transparent; color: var(--md-on-primary-container); }

.row .sw { width: 14px; height: 14px; border-radius: 50%; flex: none; margin: 0 5px; }

/* ====================================================================
   Google マップに寄せた見た目（2026-11-13）。白い面・青のアクセント・丸いチップ・浮いた検索バー。
   Material 3 のトークンを Google マップの色に差し替え、部品を上書きする。
   ==================================================================== */
:root {
  --md-primary: #1a73e8; --md-on-primary: #fff;
  --md-primary-container: #e8f0fe; --md-on-primary-container: #174ea6;
  --md-secondary-container: #e8f0fe; --md-on-secondary-container: #1967d2;
  --md-tertiary: #188038; --md-tertiary-container: #e6f4ea; --md-on-tertiary-container: #137333;
  --md-error: #d93025;
  --md-surface: #fff; --md-surface-bright: #fff; --md-surface-container-low: #fff;
  --md-surface-container: #f1f3f4; --md-surface-container-high: #f1f3f4; --md-surface-container-highest: #e8eaed;
  --md-on-surface: #202124; --md-on-surface-variant: #5f6368;
  --md-outline: #dadce0; --md-outline-variant: #e8eaed;
  --el-1: 0 1px 2px rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
  --el-2: 0 1px 2px rgba(60,64,67,.3), 0 2px 6px 2px rgba(60,64,67,.15);
  --el-3: 0 1px 3px rgba(60,64,67,.3), 0 4px 8px 3px rgba(60,64,67,.15);
  --a: #188038; --b: #d93025;
}
body { font-size: 14px; }
#panel { box-shadow: 0 0 20px rgba(0,0,0,.2); }
#top { padding: 12px 16px 8px; }
.brand { margin-bottom: 10px; gap: 8px; }
.brand-ic { font-size: 24px; }
.brand h1 { font-size: 16px; font-weight: 500; color: var(--md-on-surface-variant); }
.search { height: 48px; border-radius: 24px; background: #fff; box-shadow: var(--el-2); padding: 0 16px; }
.search input { font-size: 15px; }
.qres { background: #fff; border-radius: 8px; }
.od { gap: 4px; margin-top: 12px; }
.od-field { height: 36px; border-radius: 8px; font-size: 13.5px; }
.dot { width: 20px; height: 20px; font-size: 11px; }
.time-row select, .time-row input { height: 32px; font-size: 13px; }

h2 { font-size: 22px; font-weight: 400; margin: 8px 0 0; }
#content h3 { font-size: 16px; font-weight: 500; margin: 16px -16px 8px; padding: 16px 16px 0; border-top: 1px solid var(--md-outline-variant); }
#content h3 small { font-size: 12px; }
h4 { margin: 12px 0 2px; font-size: 12px; letter-spacing: 0; }
.sub { font-size: 13px; }
.hint { background: var(--md-surface-container); border-radius: 8px; padding: 10px 12px; }

/* 場所カードの丸い操作ボタン（経路・目的地・出発地…） */
.acts { display: flex; gap: 6px; margin: 14px -4px 4px; overflow-x: auto; scrollbar-width: none; }
.acts::-webkit-scrollbar { display: none; }
.act { border: 0; background: none; display: grid; justify-items: center; gap: 6px; min-width: 64px; padding: 2px 4px; color: var(--md-primary); font-weight: 500; text-decoration: none; cursor: pointer; }
.act .ms { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--md-outline); display: grid; place-items: center; font-size: 20px; background: #fff; }
.act small { font-size: 12px; white-space: nowrap; }
.act.on .ms { background: var(--md-primary); color: #fff; border-color: transparent; }
.act:hover .ms { background: var(--md-primary-container); } .act.on:hover .ms { background: #1765cc; }

.btn { height: 36px; border-color: var(--md-outline); padding: 0 14px 0 10px; font-size: 13.5px; gap: 6px; }
.btn.primary { background: var(--md-primary); padding: 0 16px 0 12px; }
.btn.tonal { background: var(--md-primary-container); color: var(--md-on-primary-container); }
.seg { border-color: var(--md-outline); }
.seg button { height: 34px; padding: 0 14px; font-size: 13px; }
.seg button + button { border-left-color: var(--md-outline); }

.row { min-height: 52px; gap: 14px; padding: 6px 4px; border-radius: 8px; }
.row .main b { font-size: 14.5px; }
.mi { width: 36px; height: 36px; } .mi .ms { font-size: 20px; }
.row.sub-row { padding-left: 54px; }
.routes { padding-left: 54px; }
.cmp .c { border-radius: 8px; border-color: var(--md-outline); }
.itin { border-radius: 8px; border-color: var(--md-outline); }

.tips { display: grid; gap: 2px; margin-top: 4px; }
.tips div { display: flex; align-items: center; gap: 16px; min-height: 44px; color: var(--md-on-surface); font-size: 14.5px; }
.tips .ms { color: var(--md-on-surface-variant); font-size: 22px; }

#foot { padding: 20px 0 0; }
#foot summary { cursor: pointer; color: var(--md-on-surface-variant); font-size: 12px; }

/* 地図の上の部品 */
.chip { background: #fff; border-radius: 999px; height: 32px; padding: 0 12px 0 8px; color: #3c4043; box-shadow: var(--el-1); font-size: 13px; }
.chip.on { background: var(--md-primary-container); color: var(--md-on-secondary-container); }
.chip.select { padding-right: 4px; }
.fab { width: 44px; height: 44px; border-radius: 50%; background: #fff; color: var(--md-primary); box-shadow: var(--el-2); right: 12px; bottom: 32px; }
.fab .ms { font-size: 22px; }
.snack { border-radius: 8px; padding: 10px 14px; font-size: 13.5px; }
.legend { border-radius: 8px; }
.maplibregl-popup-content { background: #fff; border-radius: 8px; }
.maplibregl-popup-tip { border-top-color: #fff !important; border-bottom-color: #fff !important; }
.pin.f { background: #ea4335; }

@media (max-width: 760px) {
  #panel { background: #fff; border-radius: 16px 16px 0 0; box-shadow: 0 -2px 10px rgba(60,64,67,.25); }
  #handle span { width: 36px; background: var(--md-outline); opacity: 1; }
  #searchbar { height: 48px; background: #fff; }
  #layers { top: calc(66px + var(--safe-t)); }
  .fab { right: 12px; }
}

/* 道具（到達圏・自転車・タクシー）はボタンで開く箱の中 */
.tool-box { background: var(--md-surface-container); border-radius: 12px; padding: 12px; margin: 10px 0 2px; }
.tool-box .seg { background: #fff; max-width: 100%; overflow-x: auto; }
.tool-box .seg button { padding: 0 11px; white-space: nowrap; }
.act.tool.on .ms { background: var(--md-primary-container); color: var(--md-on-primary-container); border-color: transparent; }
#reach { opacity: .7; }
.legend { display: flex; gap: 10px; padding: 6px 10px; }
.legend div + div { margin-top: 0; }

/* ====================================================================
   地図を全面に。案内パネルは、何かを調べたときに左から出てくる（パソコン幅）。
   ==================================================================== */
.brand { cursor: pointer; width: fit-content; }
#homeBtn { width: 32px; height: 32px; margin-left: -6px; color: var(--md-primary); }
#homeBtn .ms { font-size: 24px; }
#panelTab { display: none; }
@media (min-width: 761px) {
  #app { display: block; position: fixed; inset: 0; }
  #mapwrap { position: absolute; inset: 0; }
  #panel { position: absolute; left: 0; top: 0; bottom: 0; width: 408px; transform: translateX(-100%); transition: transform .25s cubic-bezier(.2, 0, 0, 1); box-shadow: none; overflow: visible; }
  body.panel-open #panel { transform: none; box-shadow: 0 0 20px rgba(0,0,0,.2); }
  #top { padding-top: 70px; }
  .brand { display: flex; margin-bottom: 8px; }
  /* 検索バーは常に地図の左上に浮かせる（パネルが開いていても同じ位置） */
  #searchbar { position: fixed; top: 12px; left: 12px; width: 384px; z-index: 6; }
  #layers { left: 420px; right: 56px; transition: none; }
  /* パネルの右端のつまみ（開閉） */
  #panelTab { display: none; position: absolute; left: 100%; top: 50%; transform: translateY(-50%); width: 24px; height: 48px; border: 0; border-left: 1px solid var(--md-outline); border-radius: 0 8px 8px 0; background: #fff; box-shadow: 2px 1px 4px rgba(60,64,67,.3); color: var(--md-on-surface-variant); place-items: center; padding: 0; z-index: 4; }
  body.has-content #panelTab { display: grid; }
  .legend { left: 12px; transition: left .25s; }
  body.panel-open .legend { left: 420px; }
  body.panel-open .snack { left: calc(50% + 204px); }
}
@media (max-width: 760px) { .brand { display: none; } }

/* ====================================================================
   検索バーとサイドパネルは重ねない。どちらも角を丸くして地図の上に浮かせる。
   検索バーは常に左上。パネルはその下に、左から出てくる。
   ==================================================================== */
@media (min-width: 761px) {
  #searchbar { top: 12px; left: 12px; width: 384px; height: 48px; border-radius: 24px; }
  #panel { left: 12px; top: 72px; bottom: 12px; width: 384px; border-radius: 16px; background: #fff; transform: translateX(calc(-100% - 28px)); overflow: visible; }
  body.panel-open #panel { transform: none; box-shadow: var(--el-2); }
  #top { padding: 14px 16px 8px; }
  #scroll { border-radius: 0 0 16px 16px; }
  #panelTab { border-radius: 0 12px 12px 0; border-left: 0; height: 56px; }
  body:not(.panel-open) #panelTab { left: calc(100% + 28px); border-radius: 0 12px 12px 0; }
  #layers { left: 408px; }
  body.panel-open .legend { left: 408px; }
  body.panel-open .snack { left: calc(50% + 198px); }
}
@media (max-width: 760px) {
  /* スマホ：検索バーとチップは常に上。シートは下から出て、いちばん上げてもチップの下で止まる */
  #searchbar { border-radius: 24px; }
  #panel { border-radius: 20px 20px 0 0; max-height: calc(100dvh - 124px - var(--safe-t)); }
  #panel.sheet-full { height: calc(100dvh - 124px - var(--safe-t)); }
  #panel.sheet-peek { height: calc(132px + var(--safe-b)); }
  #top { padding: 0 12px 4px; }
  #scroll { padding: 4px 12px calc(16px + var(--safe-b)); }
  #content h3 { margin: 14px -12px 8px; padding: 14px 12px 0; }
  .acts { gap: 2px; }
  .act { min-width: 60px; }
}

/* ====================================================================
   レイヤーは1つのボタンにまとめる。出発地・目的地・時刻は経路を使うときだけ。縮尺は右下。
   ==================================================================== */
.od, .time-row { display: none; }
body.has-od .od { display: grid; }
body.has-od .time-row { display: flex; }
#top { padding-bottom: 0; }
body.has-od #top { padding-bottom: 8px; }
#layerBtn { position: absolute; top: 20px; left: 408px; z-index: 2; }
#layerPop { position: absolute; top: 60px; left: 408px; z-index: 5; width: 300px; max-width: calc(100% - 24px); background: #fff; border-radius: 16px; box-shadow: var(--el-3); padding: 6px 14px 14px; }
#layerPop h5 { font: 500 12px/1.4 Roboto, "Noto Sans JP", sans-serif; color: var(--md-on-surface-variant); margin: 12px 0 8px; }
#layerPop .chips { display: flex; flex-wrap: wrap; gap: 8px; }
#layerPop .chip { box-shadow: none; border: 1px solid var(--md-outline); }
#layerPop .chip.on { border-color: transparent; }
.fab { bottom: 72px; }
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-scale { margin-right: 10px; }
@media (max-width: 760px) {
  #layerBtn { top: calc(68px + var(--safe-t)); left: 12px; }
  #layerPop { top: calc(108px + var(--safe-t)); left: 12px; }
  .fab { bottom: calc(var(--sheet-h, 52dvh) + 16px); }
  .maplibregl-ctrl-bottom-right { display: none; }
  #panel.sheet-peek { height: calc(96px + var(--safe-b)); }
  body.has-od #panel.sheet-peek { height: calc(132px + var(--safe-b)); }
}

/* ====================================================================
   レイヤー：左下の角丸の四角いボタン。押す（パソコンは重ねる）と、その場から大きくなってボタンが並ぶ。
   ==================================================================== */
#layerWrap { position: absolute; left: 12px; bottom: 28px; z-index: 5; transition: left .25s cubic-bezier(.2, 0, 0, 1); }
#layerBtn { position: static; width: 64px; height: 64px; border: 2px solid #fff; border-radius: 14px; background: linear-gradient(135deg, #d7e7fb, #cfe9d6); color: #174ea6; box-shadow: var(--el-2); display: grid; place-items: center; align-content: center; gap: 2px; padding: 0; cursor: pointer; transition: transform .18s; }
#layerBtn .ms { font-size: 24px; }
#layerBtn small { font-size: 11px; font-weight: 500; }
#layerBtn:hover { transform: scale(1.04); }
#layerPop { position: absolute; left: 0; bottom: 0; top: auto; width: 328px; max-width: calc(100vw - 24px); background: #fff; border-radius: 18px; box-shadow: var(--el-3); padding: 4px 14px 14px;
  transform-origin: left bottom; transform: scale(.2); opacity: 0; pointer-events: none; transition: transform .22s cubic-bezier(.2, .9, .3, 1.15), opacity .14s; }
#layerWrap.open #layerPop { transform: scale(1); opacity: 1; pointer-events: auto; }
@media (hover: hover) and (min-width: 761px) { #layerWrap:hover #layerPop { transform: scale(1); opacity: 1; pointer-events: auto; } }
#layerPop .chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
/* 中のボタンは、アイコンの下に名前がつく四角いタイル */
#layerPop .chip { height: 66px; border-radius: 12px; padding: 4px 2px; flex-direction: column; justify-content: center; gap: 4px; font-size: 11.5px; border: 1px solid var(--md-outline); box-shadow: none; white-space: nowrap; }
#layerPop .chip .ms { font-size: 22px; }
#layerPop .chip.on { border: 2px solid var(--md-primary); background: var(--md-primary-container); color: var(--md-on-secondary-container); }
.legend { bottom: 104px; }
@media (min-width: 761px) { body.panel-open #layerWrap { left: 408px; } }
@media (max-width: 760px) {
  #layerWrap { left: 12px; top: auto; bottom: calc(var(--sheet-h, 52dvh) + 16px); transition: bottom .28s cubic-bezier(.2, 0, 0, 1); }
  #layerBtn { width: 56px; height: 56px; top: auto; left: auto; }
  #layerPop { top: auto; left: 0; }
}
