/* ==========================================================================
   歩く街京都 ― スタイル
   レイアウトは画面の幅と折りたたみ端末の画面の分かれ方で切り替わる。
     ・〜359px        折りたたみスマホの外側の画面（Galaxy Z Fold のカバー画面など）
     ・〜599px        ふつうのスマホ（下から引き出すパネル）   ← js/app.js の SHEET_QUERY と同じ値
     ・600px〜        開いた折りたたみスマホ・横向き・タブレット・PC（左右に並べる）
     ・画面が2枚      Surface Duo や半分開いた Fold：折り目をよけてパネルと地図を別の画面に置く
   ========================================================================== */
:root {
  /* 色 */
  --c-main: #7a2e2e;        /* 弁柄色 */
  --c-main-deep: #5c2020;
  --c-main-soft: #f4e9e4;
  --c-accent: #b8902a;      /* 金茶 */
  --c-accent-soft: #fbf4e2;
  --c-bg: #f6f2ea;          /* 生成り */
  --c-card: #ffffff;
  --c-text: #26211e;
  --c-sub: #6f665f;
  --c-line: #e6dfd1;
  --c-walk: #2f6f4e;        /* 常磐色 */
  --c-bus: #9a948d;
  --c-error: #b3261e;

  /* 形 */
  --radius: 14px;
  --radius-s: 10px;
  --shadow-1: 0 1px 2px rgba(40, 25, 15, .06), 0 2px 8px rgba(40, 25, 15, .06);
  --shadow-2: 0 4px 20px rgba(40, 25, 15, .16);
  --ease: cubic-bezier(.2, .8, .2, 1);

  /* 大きさ */
  --panel-w: clamp(320px, 38vw, 420px);
  --pad: 16px;
  --header-h: 60px;

  --font-ui: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --font-title: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
  font-family: var(--font-ui);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--c-bg); color: var(--c-text); }
body { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--c-accent) 70%, transparent); outline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--font-title); font-weight: 600; }

/* ---------- 全体の並び（600px以上：左にパネル、右に地図） ---------- */
body {
  display: grid;
  grid-template-columns: var(--panel-w) 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas: "head map" "panel map";
  height: 100dvh; overflow: hidden;
}
.layout { display: contents; }
.app-header { grid-area: head; }
.panel { grid-area: panel; }
#map { grid-area: map; min-height: 0; position: relative; z-index: 0; }

/* ---------- ヘッダー ---------- */
.app-header {
  display: flex; align-items: center; gap: 12px;
  min-height: var(--header-h);
  padding: env(safe-area-inset-top) var(--pad) 0 max(var(--pad), env(safe-area-inset-left));
  background: var(--c-main); color: #fff;
  position: relative; z-index: 1000;
}
.logo {
  margin: 0; font-size: 1.2rem; letter-spacing: .14em; white-space: nowrap;
  display: flex; align-items: center; gap: 10px;
}
.logo-mark {
  display: inline-grid; place-items: center; flex: none;
  width: 34px; height: 34px; border-radius: 50%;
  background: #fff; color: var(--c-main); font-size: 1.05rem; letter-spacing: 0;
}
.tagline { margin: 0; font-size: .78rem; opacity: .82; font-family: var(--font-title); letter-spacing: .08em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lang-btn {
  margin-left: auto; flex: none;
  border: 1px solid rgba(255,255,255,.55); background: transparent; color: #fff;
  border-radius: 999px; padding: 4px 12px; min-height: 32px; min-width: 52px;
  font-size: .78rem; font-weight: 600; letter-spacing: .04em;
}
.lang-btn:hover { background: rgba(255,255,255,.14); }

/* ---------- パネル ---------- */
.panel {
  min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  background: var(--c-bg); border-right: 1px solid var(--c-line);
  padding: 0 var(--pad) calc(32px + env(safe-area-inset-bottom)) max(var(--pad), env(safe-area-inset-left));
  scrollbar-width: thin; scrollbar-color: #d4cab8 transparent;
}
.panel-handle { display: none; }

/* ---------- モード切替 ---------- */
.mode-tabs {
  position: sticky; top: 0; z-index: 3;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  margin: 0 calc(var(--pad) * -1) 14px; padding: 12px var(--pad) 10px;
  background: var(--c-bg);
}
.mode-tabs::before {   /* 切替ボタンの下地 */
  content: ""; position: absolute; inset: 12px var(--pad) 10px;
  background: #ebe4d6; border-radius: 12px; z-index: -1;
}
.mode-tab {
  border: none; background: none; margin: 4px 0; padding: 9px 4px; min-height: 42px;
  border-radius: 9px; color: var(--c-sub); font-size: .84rem; font-weight: 600; line-height: 1.3;
  transition: background .2s, color .2s;
}
.mode-tab:first-child { margin-left: 4px; }
.mode-tab:last-child { margin-right: 4px; }
.mode-tab.active { background: #fff; color: var(--c-main); box-shadow: var(--shadow-1); }

/* ---------- 絞り込みボタン ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  border: 1px solid var(--c-line); background: var(--c-card); color: var(--c-text);
  border-radius: 999px; padding: 7px 14px; min-height: 38px; font-size: .86rem;
  transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: #cfc4b0; }
.chip.active { background: var(--c-main); border-color: var(--c-main); color: #fff; }

.list-tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .82rem; color: var(--c-sub); margin-bottom: 10px; }
.btn-text { border: none; background: none; color: var(--c-main); padding: 6px 2px; min-height: 40px; font-weight: 600; font-size: .85rem; white-space: nowrap; }

/* ---------- ルート一覧 ---------- */
.route-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.route-card {
  position: relative; overflow: hidden;
  background: var(--c-card); border-radius: var(--radius);
  border: 1px solid var(--c-line); padding: 14px 16px 14px 20px;
  box-shadow: var(--shadow-1);
  cursor: pointer; transition: transform .15s var(--ease), box-shadow .15s;
}
.route-card::before {   /* 道の色の帯 */
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px;
  background: var(--route-color, var(--c-main));
}
.route-card h3 { margin: 0 0 3px; font-size: 1.08rem; line-height: 1.45; }
.route-card .area { font-size: .76rem; color: var(--c-sub); }
.route-card .catch { margin: 8px 0 10px; font-size: .88rem; line-height: 1.7; }
.meta { display: flex; gap: 6px 12px; font-size: .8rem; color: var(--c-sub); flex-wrap: wrap; align-items: center; }
.meta b { color: var(--c-text); }
.dist-badge, .verified-badge {
  display: inline-block; vertical-align: middle; margin-left: 6px;
  font-family: var(--font-ui); font-weight: 600; font-size: .68rem; white-space: nowrap;
  padding: 2px 8px; border-radius: 999px;
}
.dist-badge { color: var(--c-walk); background: #e7f1eb; }
.verified-badge { color: var(--c-walk); background: #e7f1eb; }
@media (hover: hover) {
  .route-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
}
.route-card:active { background: #fdfbf6; }

/* ---------- 詳細 ---------- */
.btn-back {
  display: inline-flex; align-items: center; gap: 4px;
  border: none; background: none; color: var(--c-main); font-weight: 600;
  padding: 0 0 8px; min-height: 40px;
}
.detail-title { margin: 0; font-size: 1.45rem; line-height: 1.4; padding-bottom: 8px; border-bottom: 3px solid var(--route-color); }
.detail-area { color: var(--c-sub); font-size: .82rem; margin: 8px 0 14px; line-height: 1.7; }
.detail-desc { line-height: 1.9; font-size: .95rem; }

.compare {
  background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--radius);
  padding: 14px 16px; margin: 16px 0; box-shadow: var(--shadow-1);
}
.compare h4 { margin: 0 0 12px; font-size: .95rem; }
.compare-row { display: grid; grid-template-columns: 56px 1fr 68px; align-items: center; gap: 8px; font-size: .84rem; margin-bottom: 8px; }
.compare-row > span:last-child { text-align: right; }
.bar { height: 10px; border-radius: 5px; background: #efe9dd; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 5px; }
.bar.walk > span { background: var(--c-walk); }
.bar.ride > span { background: var(--c-bus); }
.compare-note { font-size: .8rem; color: var(--c-sub); line-height: 1.75; margin: 10px 0 0; }
.why, .nav-explain {
  background: var(--c-accent-soft); border-left: 4px solid var(--c-accent);
  padding: 12px 14px; font-size: .88rem; line-height: 1.8; border-radius: 0 var(--radius-s) var(--radius-s) 0;
}

.spots { list-style: none; padding: 0; margin: 20px 0; counter-reset: spot; }
.spot { position: relative; padding: 2px 0 18px 42px; cursor: pointer; border-radius: 8px; }
.spot::before {
  counter-increment: spot; content: counter(spot);
  position: absolute; left: 0; top: 0;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--route-color); color: #fff; font-size: .8rem; font-weight: 700;
  display: grid; place-items: center; box-shadow: 0 0 0 3px var(--c-bg);
}
.spot:not(:last-child)::after {
  content: ""; position: absolute; left: 13px; top: 32px; bottom: 2px;
  border-left: 2px dashed #d7cdbb;
}
.spot-name { font-weight: 700; font-family: var(--font-title); }
.spot-note { font-size: .85rem; color: var(--c-sub); line-height: 1.7; margin-top: 2px; }
.spot-view { font-size: .76rem; color: var(--c-walk); margin-top: 2px; }

.actions { display: grid; gap: 10px; margin-top: 14px; }
.btn {
  display: flex; align-items: center; justify-content: center; text-align: center; text-decoration: none;
  border-radius: 12px; padding: 12px 16px; min-height: 48px; font-size: .95rem; font-weight: 600; border: none;
  transition: background .15s, transform .1s;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn-primary { background: var(--c-main); color: #fff; box-shadow: 0 2px 8px rgba(122, 46, 46, .25); }
.btn-primary:hover:not(:disabled) { background: var(--c-main-deep); }
.btn-outline { background: var(--c-card); color: var(--c-main); border: 1.5px solid var(--c-main); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; box-shadow: none; }
.tips { font-size: .8rem; color: var(--c-sub); line-height: 1.75; }

/* ---------- 地図上の要素 ---------- */
.fab {
  position: absolute; right: 16px; bottom: calc(28px + env(safe-area-inset-bottom)); z-index: 900;
  width: 50px; height: 50px; border-radius: 50%; border: none;
  display: grid; place-items: center;
  background: #fff; color: var(--c-main); font-size: 1.4rem;
  box-shadow: var(--shadow-2);
}
.fab:active { transform: scale(.94); }
.leaflet-container { font-family: var(--font-ui); background: #ece8df; }
.leaflet-bar, .leaflet-control-layers { border: none !important; box-shadow: var(--shadow-1) !important; border-radius: 12px !important; overflow: hidden; }
.leaflet-control-layers-toggle { width: 44px !important; height: 44px !important; }
.leaflet-touch .leaflet-bar a { width: 40px; height: 40px; line-height: 40px; }
.leaflet-popup-content-wrapper { border-radius: 12px; box-shadow: var(--shadow-2); }
.leaflet-popup-content { font-family: var(--font-ui); line-height: 1.65; font-size: .85rem; }
.spot-marker {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff;
  color: #fff; font: 700 12px/20px var(--font-ui); text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.route-label {
  background: rgba(255,255,255,.95); border: none; box-shadow: var(--shadow-1);
  border-radius: 8px; padding: 3px 8px; font-size: 12px; white-space: nowrap;
  font-family: var(--font-ui);
}
.route-label-main { color: var(--c-main); font-weight: 700; }
.me-dot { width: 16px; height: 16px; border-radius: 50%; background: #1e74ff; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(30,116,255,.25); }

/* ---------- ナビ ---------- */
.nav-points { background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--radius); padding: 6px 14px; margin-bottom: 16px; box-shadow: var(--shadow-1); }
.nav-point { display: flex; align-items: center; gap: 12px; padding: 8px 0; min-height: 56px; }
.nav-point + .nav-point { border-top: 1px dashed var(--c-line); }
.nav-point-body { flex: 1; min-width: 0; }
.nav-label { font-size: .72rem; color: var(--c-sub); }
.nav-value { font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-hint { font-size: .76rem; color: var(--c-sub); margin: 4px 0 8px; line-height: 1.65; }
.pin { width: 30px; height: 30px; border-radius: 50%; color: #fff; font: 700 13px/26px var(--font-ui); text-align: center; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); flex: none; }
.pin-a { background: var(--c-walk); }
.pin-b { background: var(--c-main); }
.nav-section-title { font-family: var(--font-title); font-weight: 700; font-size: .95rem; margin: 8px 0 10px; }
.preset-desc { font-size: .8rem; color: var(--c-sub); margin: -2px 0 14px; min-height: 1.2em; line-height: 1.65; }
.detour { display: block; font-size: .85rem; margin-bottom: 16px; background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--radius); padding: 12px 14px; }
.detour b { color: var(--c-main); font-size: 1.05rem; }
.detour input { width: 100%; height: 32px; margin: 6px 0 0; accent-color: var(--c-main); }
.loading, .error, .thanks { font-size: .88rem; padding: 10px 0; }
.error { color: var(--c-error); }
.thanks { color: var(--c-walk); }

.nav-summary { margin-top: 18px; }
.nav-explain { margin: 0 0 12px; font-size: .9rem; }
.nav-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.nav-card { background: var(--c-card); border: 1px solid var(--c-line); border-radius: 12px; padding: 10px 12px; font-size: .8rem; color: var(--c-sub); box-shadow: var(--shadow-1); }
.nav-card.scenic { border-top: 4px solid var(--c-main); }
.nav-card.shortest { border-top: 4px dashed #8a847e; }
.nav-card-label { font-size: .74rem; }
.nav-card-main { font-size: 1.4rem; color: var(--c-text); font-weight: 700; line-height: 1.3; }
.nav-table { width: 100%; border-collapse: collapse; font-size: .8rem; background: var(--c-card); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-1); }
.nav-table th, .nav-table td { padding: 7px 8px; border-bottom: 1px solid var(--c-line); text-align: right; }
.nav-table tr:last-child th, .nav-table tr:last-child td { border-bottom: none; }
.nav-table th:first-child { text-align: left; font-weight: normal; color: var(--c-sub); }
.nav-table thead th { font-size: .7rem; color: var(--c-sub); font-weight: normal; background: #faf7f1; }
.nav-table td.up { color: var(--c-walk); font-weight: 700; }
.nav-table td.down { color: #9a6a00; }
.nav-zones, .nav-streets { font-size: .82rem; line-height: 1.75; margin: 10px 0 0; }

/* ほかの移動手段 */
#navModes:not(:empty) { margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--c-line); }
.mode-list { display: grid; gap: 6px; margin-bottom: 10px; }
.mode-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--radius-s); box-shadow: var(--shadow-1); font: inherit; font-size: .88rem; color: var(--c-text); text-align: left; text-decoration: none; cursor: pointer; }
.mode-row:disabled { cursor: default; }
.mode-row:not(:disabled):hover { border-color: var(--c-main); }
.mode-row.active { border-color: var(--c-main); background: var(--c-main-soft); }
.mode-icon { font-size: 1.15rem; width: 1.4em; text-align: center; }
.mode-name { flex: 1; }
.mode-val { display: flex; align-items: baseline; gap: 8px; }
.mode-val b { font-size: 1.05rem; }
.mode-dist, .mode-wait, .mode-none { color: var(--c-sub); font-size: .78rem; }
.mode-link { color: var(--c-main); font-size: .82rem; }
.mode-steps { margin: 4px 0 10px; font-size: .82rem; }
.mode-steps summary { cursor: pointer; color: var(--c-sub); margin-bottom: 4px; }
.mode-steps ol { margin: 0; padding-left: 1.4em; line-height: 1.7; max-height: 240px; overflow: auto; }
.feedback { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--c-line); }
.feedback-buttons { display: flex; gap: 8px; margin-bottom: 10px; }
.feedback-buttons .chip { flex: 1; justify-content: center; }
.feedback textarea { width: 100%; min-height: 64px; border: 1px solid var(--c-line); border-radius: 10px; padding: 10px; font: inherit; font-size: .88rem; margin-bottom: 10px; background: #fff; }

:lang(en) .logo { letter-spacing: .02em; }

/* 管理画面で確定した道 */
.verified { font-size: .8rem; color: var(--c-walk); margin: -4px 0 10px; }

/* 一覧と詳細の切り替えをやわらかく */
#listView:not([hidden]), #detailView:not([hidden]), #navView:not([hidden]) { animation: fade-in .22s var(--ease); }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* 指で操作する端末ではズームボタンは不要（つまんで拡大できる） */
@media (hover: none) and (pointer: coarse) {
  .leaflet-control-zoom { display: none; }
}

/* ==========================================================================
   開いた折りたたみスマホ・小さめのタブレット（600〜899px）
   Galaxy Z Fold を開いた状態（約 690〜880px）など、ほぼ正方形の画面で地図も広く見せる
   ========================================================================== */
@media (min-width: 600px) and (max-width: 899px) {
  :root { --panel-w: clamp(300px, 46vw, 380px); --pad: 14px; --header-h: 54px; }
  .tagline { display: none; }
}

/* 横向きのスマホ（高さが低い）：ヘッダーを細く */
@media (min-width: 600px) and (max-height: 520px) {
  :root { --header-h: 44px; --panel-w: clamp(300px, 42vw, 380px); }
  .logo { font-size: 1.02rem; }
  .logo-mark { width: 28px; height: 28px; font-size: .88rem; }
  .tagline { display: none; }
  .mode-tabs { padding-top: 8px; }
  .mode-tabs::before { top: 8px; }
}

/* ==========================================================================
   スマホ（〜599px）
   地図を画面いっぱいに出し、ヘッダーは地図の上に浮かべる。
   下のパネルは js/app.js の setSheet で「低い・半分・全画面」の3段階に止まる。
   高さは JS が --sheet-px（px）に入れ、現在地ボタンなどがそれに合わせて動く。
   ========================================================================== */
@media (max-width: 599px) {
  :root { --pad: 16px; --header-h: 44px; }
  body { display: block; overscroll-behavior: none; }
  .layout { display: block; position: relative; height: 100dvh; }
  #map { position: absolute; inset: 0; }

  /* 浮かぶヘッダー（ロゴだけの小さな札） */
  .app-header {
    position: fixed; z-index: 1000;
    top: calc(env(safe-area-inset-top) + 10px); left: 12px;
    min-height: var(--header-h); padding: 0 14px 0 6px;
    border-radius: 999px; box-shadow: var(--shadow-2);
    background: color-mix(in srgb, var(--c-main) 92%, transparent);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  }
  .logo { font-size: 1.02rem; gap: 8px; }
  .logo-mark { width: 32px; height: 32px; font-size: .95rem; }
  .app-header { gap: 8px; padding-right: 6px; }
  .lang-btn { margin-left: 4px; min-height: 30px; padding: 3px 10px; min-width: 0; }
  .tagline { display: none; }

  .leaflet-top { top: calc(env(safe-area-inset-top) + 10px); }
  .leaflet-top.leaflet-right { right: 2px; }
  .leaflet-control-attribution { font-size: 9px; }

  .panel {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 950;
    height: var(--sheet-px, 46%); border-right: none;
    border-radius: 22px 22px 0 0; box-shadow: 0 -6px 24px rgba(40, 25, 15, .18);
    padding: 0 var(--pad) calc(28px + env(safe-area-inset-bottom));
    transition: height .3s var(--ease);
  }
  .panel.dragging { transition: none; }

  /* 持ち手：パネル上端の帯全体をつかめる */
  .panel-handle {
    display: block; position: sticky; top: 0; z-index: 4;
    width: calc(100% + var(--pad) * 2); height: 22px; margin: 0 calc(var(--pad) * -1);
    border: none; padding: 0; background: var(--c-bg); touch-action: none; cursor: grab;
  }
  .panel-handle::before {
    content: ""; display: block; width: 40px; height: 5px; margin: 10px auto 0;
    border-radius: 3px; background: #cbc0ac;
  }
  .mode-tabs { top: 22px; padding-top: 6px; touch-action: none; box-shadow: 0 8px 8px -8px rgba(40, 25, 15, .15); }
  .mode-tabs::before { top: 6px; }
  .mode-tab { min-height: 44px; }

  /* 季節などのボタンは横に1行でスクロール */
  .filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--pad) * -1) 12px; padding: 2px var(--pad); scroll-padding: 0 var(--pad); }
  .filters::-webkit-scrollbar { display: none; }
  .chip { min-height: 40px; padding: 8px 15px; font-size: .9rem; }

  .btn { min-height: 50px; font-size: 1rem; }
  .btn-text { min-height: 44px; }
  input, select, textarea { font-size: 16px !important; }   /* iPhoneで入力時に拡大されないように */

  .detail-title { font-size: 1.28rem; }
  .nav-point .btn-text { min-width: 64px; }
  .pin { width: 32px; height: 32px; line-height: 28px; }

  .fab {
    right: 12px; width: 52px; height: 52px;
    bottom: calc(var(--sheet-px, 46vh) + 12px); transition: bottom .3s var(--ease);
  }
  .panel.dragging ~ .fab { transition: none; }
}

/* ==========================================================================
   とても細い画面（〜359px）：Galaxy Z Fold などの閉じた状態のカバー画面
   ========================================================================== */
@media (max-width: 359px) {
  :root { --pad: 12px; --radius: 12px; }
  .logo { font-size: .95rem; letter-spacing: .08em; }
  .logo-mark { width: 28px; height: 28px; font-size: .85rem; }
  .app-header { left: 8px; padding-right: 5px; }
  .lang-btn { padding: 2px 8px; font-size: .72rem; }
  .mode-tab { font-size: .82rem; padding: 8px 2px; }
  .chip { padding: 7px 12px; font-size: .84rem; }
  .route-card { padding: 12px 12px 12px 16px; }
  .route-card h3 { font-size: 1rem; }
  .route-card .catch { font-size: .85rem; }
  .list-tools { font-size: .76rem; }
  .btn-text { font-size: .8rem; }
  .compare-row { grid-template-columns: 44px 1fr 60px; font-size: .8rem; }
  .nav-cards { gap: 8px; }
  .nav-card-main { font-size: 1.2rem; }
  .nav-table th, .nav-table td { padding: 6px 4px; }
  .nav-point .btn-text { min-width: 52px; }
  .fab { width: 48px; height: 48px; right: 8px; }
}

/* ==========================================================================
   画面が左右2枚に分かれる端末（Surface Duo、開いた Fold を本のように使うとき）
   左の画面にヘッダーとパネル、右の画面に地図を置き、折り目の上には何も置かない
   ========================================================================== */
@media (horizontal-viewport-segments: 2) {
  body {
    grid-template-columns:
      env(viewport-segment-width 0 0)
      calc(env(viewport-segment-left 1 0) - env(viewport-segment-right 0 0))
      1fr;
    grid-template-areas: "head . map" "panel . map";
  }
  :root { --panel-w: env(viewport-segment-width 0 0); }
  .tagline { display: block; }
}
/* 旧方式（以前の Microsoft Edge / Surface Duo） */
@media (spanning: single-fold-vertical) {
  body {
    grid-template-columns: env(fold-left) env(fold-width) 1fr;
    grid-template-areas: "head . map" "panel . map";
  }
}

/* ==========================================================================
   画面が上下2枚に分かれる端末（Galaxy Z Fold / Flip を半分開いた「フレックスモード」）
   上の画面に地図、下の画面にヘッダーとパネルを置く
   ========================================================================== */
@media (vertical-viewport-segments: 2) {
  body {
    grid-template-columns: 1fr;
    grid-template-rows:
      env(viewport-segment-height 0 0)
      calc(env(viewport-segment-top 0 1) - env(viewport-segment-bottom 0 0))
      auto 1fr;
    grid-template-areas: "map" "." "head" "panel";
  }
  .layout { display: contents; }
  #map { position: relative; inset: auto; }
  .app-header { position: relative; top: auto; left: auto; border-radius: 0; box-shadow: none; padding: 0 var(--pad); min-height: 44px; }
  .panel { position: static; height: auto !important; border-radius: 0; box-shadow: none; border-right: none; }
  .panel-handle { display: none; }
  .mode-tabs { top: 0; }
  .fab { position: fixed; bottom: auto; top: calc(env(viewport-segment-bottom 0 0) - 64px); right: 12px; }
}
/* 下の画面は横に広いので、ナビの結果を左右2列に並べて、スクロールせずに読めるようにする */
@media (vertical-viewport-segments: 2) and (min-width: 600px) {
  .nav-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; align-items: start; }
  .nav-summary > * { grid-column: 1 / -1; }
  .nav-summary > .nav-explain { grid-column: 1; grid-row: 1; }
  .nav-summary > .nav-cards { grid-column: 1; grid-row: 2; }
  .nav-summary > .nav-table { grid-column: 2; grid-row: 1 / span 2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- 出発地・目的地の入力と候補 ---------- */
.nav-point-body { position: relative; }
.nav-input {
  width: 100%; border: 1px solid var(--c-line); border-radius: 8px; background: #fff;
  padding: 8px 10px; font: inherit; font-size: .95rem; color: var(--c-text); margin-top: 2px;
}
.nav-input:focus { outline: none; border-color: var(--c-main); box-shadow: 0 0 0 3px rgba(122, 46, 46, .15); }
.nav-input::placeholder { color: #a89f93; }
.suggest {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 1200; margin: 4px 0 0; padding: 4px 0;
  list-style: none; background: #fff; border: 1px solid var(--c-line); border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0,0,0,.15); max-height: 320px; overflow-y: auto;
}
.suggest li { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 10px 12px; cursor: pointer; }
.suggest li[aria-selected="true"], .suggest li:hover { background: #f6efe1; }
.suggest .s-name { font-size: .95rem; }
.suggest .s-name b { color: var(--c-main); font-weight: 700; }
.suggest .s-kind { font-size: .72rem; color: var(--c-sub); white-space: nowrap; }
.suggest .s-empty { color: var(--c-sub); font-size: .85rem; cursor: default; }
.suggest .s-empty:hover { background: none; }
@media (max-width: 760px) {
  .nav-input { min-height: 44px; }
  .suggest { max-height: 45vh; }
  .suggest li { min-height: 48px; }
}

/* バス・電車（乗り換え検索の結果） */
.transit-box { margin-top: 10px; padding: 10px 12px; background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--radius-s); font-size: .86rem; }
.transit-time { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.transit-time input { font: inherit; padding: 4px 6px; border: 1px solid var(--c-line); border-radius: 6px; }
.transit-choose { margin: 4px 0 8px; }
.transit-head { margin-bottom: 4px; }
.transit-compare { margin: 4px 0; color: var(--c-main); font-size: .8rem; }
.legs { list-style: none; margin: 8px 0; padding: 0; }
.leg { display: flex; gap: 8px; padding: 6px 0; }
.leg-icon { width: 1.4em; text-align: center; flex: none; }
.leg.walk { color: var(--c-sub); }
.leg.ride > div { border-left: 4px solid var(--leg-color); padding-left: 8px; }
.leg-badge { display: inline-block; padding: 0 6px; border-radius: 4px; background: var(--leg-color); color: #fff; font-size: .78rem; font-weight: 600; }
.leg-mid, .leg-plat { color: var(--c-sub); font-size: .76rem; }
.leg-mid { padding: 2px 0; }
@media (max-width: 767px) { .transit-time input { font-size: 16px; } }

/* ==========================================================================
   旅程をプランする（js/plan.js）
   ========================================================================== */
.plan-steps { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); position: relative; }
.plan-steps::before { content: ""; position: absolute; top: 12px; left: 10%; right: 10%; height: 2px; background: var(--c-line); }
.plan-steps li { position: relative; display: grid; justify-items: center; gap: 3px; font-size: .68rem; color: var(--c-sub); }
.plan-step-dot {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--c-bg); border: 2px solid var(--c-line); font: 700 11px/1 var(--font-ui); color: var(--c-sub);
}
.plan-steps li.done .plan-step-dot { background: var(--c-walk); border-color: var(--c-walk); color: #fff; }
.plan-steps li.current .plan-step-dot { background: var(--c-main); border-color: var(--c-main); color: #fff; }
.plan-steps li.current { color: var(--c-main); font-weight: 700; }

.plan-title { font-family: var(--font-title); font-size: 1.2rem; letter-spacing: .04em; margin: 4px 0 12px; }
.plan-lead { font-size: .85rem; color: var(--c-sub); margin: -4px 0 12px; }

/* 1. 季節 */
.season-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.season-card {
  position: relative; display: grid; justify-items: start; align-content: end; gap: 2px;
  min-height: 112px; padding: 12px 14px; border: none; border-radius: var(--radius); text-align: left;
  color: #fff; box-shadow: var(--shadow-1); overflow: hidden; transition: transform .1s, box-shadow .15s;
}
.season-card:active { transform: scale(.98); }
.season-card.active { box-shadow: 0 0 0 3px var(--c-accent), var(--shadow-1); }
.season-spring { background: linear-gradient(150deg, #f6c1cf, #d9718f); }
.season-summer { background: linear-gradient(150deg, #8fcf9a, #2f6f4e); }
.season-autumn { background: linear-gradient(150deg, #f0a35b, #a8322a); }
.season-winter { background: linear-gradient(150deg, #c9d8e6, #5d7690); }
.season-icon { position: absolute; top: 8px; right: 10px; font-size: 2.2rem; opacity: .9; }
.season-name { font-family: var(--font-title); font-size: 1.25rem; font-weight: 700; text-shadow: 0 1px 3px rgba(0,0,0,.25); }
.season-months { font-size: .8rem; opacity: .95; text-shadow: 0 1px 2px rgba(0,0,0,.25); }

/* 2. 場所 */
.plan-search { width: 100%; margin-bottom: 10px; }
.plan-cats { flex-wrap: nowrap; overflow-x: auto; margin: 0 calc(var(--pad) * -1) 12px; padding: 0 var(--pad) 2px; scrollbar-width: none; }
.plan-cats::-webkit-scrollbar { display: none; }
.pick-grid { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pick-empty { grid-column: 1 / -1; }
.pick-card { position: relative; }
.pick-main {
  width: 100%; display: grid; gap: 2px; padding: 0 0 10px; text-align: left;
  border: 1.5px solid var(--c-line); border-radius: var(--radius); background: var(--c-card);
  overflow: hidden; box-shadow: var(--shadow-1); transition: border-color .15s, box-shadow .15s;
}
.pick-card.picked .pick-main { border-color: var(--c-main); box-shadow: 0 0 0 1.5px var(--c-main), var(--shadow-1); }
.pick-tile {
  position: relative; display: grid; place-items: center; height: 78px; margin-bottom: 6px;
  font-size: 2rem; background: #efe7d8 center / cover no-repeat;
}
.pick-tile.cat-temple { background-color: #f1e1d6; }
.pick-tile.cat-street { background-color: #efe1c4; }
.pick-tile.cat-nature { background-color: #dcebd9; }
.pick-tile.cat-food { background-color: #f6e3cf; }
.pick-check {
  position: absolute; top: 6px; left: 6px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; background: var(--c-main); color: #fff; border: 2px solid #fff;
  font: 700 12px/1 var(--font-ui); box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.spot-rank { position: absolute; bottom: 6px; left: 8px; font: 700 .72rem var(--font-ui); color: var(--c-accent); background: #fff; border-radius: 6px; padding: 1px 6px; }
.pick-name { padding: 0 10px; font-weight: 700; font-size: .88rem; line-height: 1.4; font-family: var(--font-title); }
.pick-meta { padding: 0 10px; font-size: .72rem; color: var(--c-sub); }
.pick-best {
  justify-self: start; display: inline-block; margin: 3px 10px 0; padding: 1px 7px; border-radius: 999px;
  background: var(--c-accent-soft); color: #8a6a14; font-size: .68rem; font-weight: 600;
}
.tl-name .pick-best { margin: 0 0 0 8px; vertical-align: 2px; }
.fav-btn {
  position: absolute; top: 4px; right: 4px; width: 34px; height: 34px; border-radius: 50%; border: none;
  background: rgba(255,255,255,.9); color: var(--c-sub); font-size: 1.05rem; line-height: 1; box-shadow: var(--shadow-1);
}
.fav-btn.on { color: #c23b5a; }

.plan-footer {
  /* パネル下の余白（32px）まで覆って、後ろのカードが透けないようにする */
  position: sticky; bottom: calc(-32px - env(safe-area-inset-bottom)); z-index: 2;
  display: flex; align-items: center; gap: 10px;
  margin: 14px calc(var(--pad) * -1) calc(-32px - env(safe-area-inset-bottom));
  padding: 10px var(--pad) calc(10px + 32px + env(safe-area-inset-bottom));
  background: var(--c-bg); border-top: 1px solid var(--c-line);
}
.plan-footer .btn { min-height: 46px; }
.plan-back { flex: none; padding: 10px 14px; }
.plan-next { flex: 1; }
.plan-count { flex: none; font-size: .8rem; color: var(--c-main); font-weight: 700; }

.picked-list, .stay-list { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 8px; }
.picked-list li, .stay-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 12px;
  background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--radius-s); box-shadow: var(--shadow-1);
}
.picked-icon { font-size: 1.3rem; flex: none; }
.picked-name, .stay-name { flex: 1; min-width: 0; display: grid; font-weight: 700; font-family: var(--font-title); font-size: .92rem; }
.picked-name small, .stay-name small { font: 400 .72rem var(--font-ui); color: var(--c-sub); }
.picked-remove { color: var(--c-sub); min-width: 40px; }

.food-card {
  display: flex; gap: 12px; margin: 12px 0 4px; padding: 14px;
  border-radius: var(--radius); background: var(--c-accent-soft); border: 1px solid #ecdcae;
}
.food-card.done { align-items: center; padding: 10px 14px; }
.food-icon { font-size: 2rem; flex: none; }
.food-body { flex: 1; }
.food-body p { margin: 4px 0 10px; font-size: .84rem; color: var(--c-sub); line-height: 1.6; }
.food-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.food-btns .btn { min-height: 42px; padding: 8px 10px; font-size: .88rem; }

/* 3. 出発地 */
.start-list { display: grid; gap: 8px; margin-bottom: 14px; }
.start-opt, .start-hotel {
  position: relative; width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 10px 14px; min-height: 58px; border: 1.5px solid var(--c-line); border-radius: var(--radius-s);
  background: var(--c-card); box-shadow: var(--shadow-1);
}
.start-hotel { display: grid; gap: 6px; }
.start-opt-head { display: flex; align-items: center; gap: 12px; }
.start-opt.active, .start-hotel.active { border-color: var(--c-main); box-shadow: 0 0 0 1.5px var(--c-main), var(--shadow-1); }
.start-icon { font-size: 1.4rem; width: 28px; text-align: center; flex: none; }
.start-text { flex: 1; display: grid; font-size: .92rem; }
.start-text small { font-size: .72rem; color: var(--c-sub); line-height: 1.5; }
.start-on { color: var(--c-main); font-weight: 700; }
.start-hotel .nav-input { width: 100%; }
.start-hotel .btn-text { justify-self: start; }
.plan-opts { display: grid; gap: 10px; padding: 12px 14px; border-radius: var(--radius-s); background: var(--c-card); border: 1px solid var(--c-line); }
.plan-time { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .9rem; }
.plan-time input { font: inherit; padding: 6px 10px; border: 1px solid var(--c-line); border-radius: 8px; background: #fff; min-height: 40px; }
.plan-check { display: flex; align-items: center; gap: 8px; font-size: .88rem; min-height: 36px; }
.plan-check input { width: 20px; height: 20px; accent-color: var(--c-main); }

/* 4. 滞在時間 */
.stepper { display: flex; align-items: center; gap: 4px; flex: none; }
.stepper output { min-width: 64px; text-align: center; font-weight: 700; font-size: .88rem; }
.step-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--c-main);
  background: #fff; color: var(--c-main); font-size: 1.1rem; font-weight: 700; line-height: 1;
}
.step-btn:disabled { opacity: .35; }

.plan-loading { display: grid; justify-items: center; gap: 8px; padding: 48px 0; color: var(--c-sub); }
.walker { font-size: 2.4rem; animation: plan-walk 1.2s ease-in-out infinite; }
@keyframes plan-walk { 0%, 100% { transform: translateX(-24px); } 50% { transform: translateX(24px) ; } }
@media (prefers-reduced-motion: reduce) { .walker { animation: none; } }

/* 5. 旅程 */
.plan-summary {
  display: grid; grid-template-columns: 1.4fr 1fr .7fr; gap: 1px; margin-bottom: 12px;
  border-radius: var(--radius); overflow: hidden; background: var(--c-line); box-shadow: var(--shadow-1);
}
.plan-summary div { display: grid; gap: 2px; padding: 10px 12px; background: var(--c-card); }
.plan-summary b { font-size: 1.02rem; color: var(--c-main); }
.plan-summary span { font-size: .72rem; color: var(--c-sub); }

.timeline { list-style: none; margin: 0 0 10px; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 13px; top: 14px; bottom: 14px; width: 2px; background: var(--c-line); }
.tl-spot { position: relative; display: flex; gap: 12px; padding: 4px 0; }
.tl-spot .plan-pin { position: relative; z-index: 1; margin-top: 2px; }
.tl-body { flex: 1; min-width: 0; padding: 10px 12px; background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--radius-s); box-shadow: var(--shadow-1); }
.tl-start .tl-body { background: transparent; border: none; box-shadow: none; padding: 4px 0; }
.tl-time { font-weight: 700; font-size: .86rem; color: var(--c-main); }
.tl-time span { margin-left: 8px; font-weight: 400; font-size: .74rem; color: var(--c-sub); }
.tl-name { font-family: var(--font-title); font-weight: 700; font-size: 1rem; margin-top: 2px; cursor: pointer; }
.tl-note { margin: 4px 0 0; font-size: .8rem; color: var(--c-sub); line-height: 1.65; }
.tl-warn { margin: 6px 0; font-size: .78rem; color: #8a4b0f; background: #fdf1dc; border-radius: 8px; padding: 6px 10px; line-height: 1.6; }
.tl-route { display: block; min-height: 32px; padding: 4px 0 0; color: var(--c-walk); white-space: normal; text-align: left; }
.tl-leg { position: relative; display: flex; align-items: center; gap: 10px; padding: 2px 0 2px 40px; min-height: 44px; font-size: .82rem; }
.tl-leg-icon { position: absolute; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--c-bg); display: grid; place-items: center; font-size: .9rem; z-index: 1; }
.tl-leg-text { flex: 1; display: grid; color: var(--c-walk); font-weight: 600; }
.tl-leg.ride .tl-leg-text { color: #6f665f; }
.tl-leg-text small { font-weight: 400; font-size: .72rem; color: var(--c-sub); }
.tl-leg .btn-text { min-height: 36px; font-size: .8rem; }

/* 地図の印 */
.plan-pin {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--c-main); color: #fff; border: 2px solid #fff; font: 700 12px/1 var(--font-ui);
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.plan-pin.start { background: var(--c-walk); }
.plan-dot {
  width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--c-main);
  box-shadow: 0 1px 3px rgba(0,0,0,.3); cursor: pointer;
}
.plan-dot.picked {
  width: 24px; height: 24px; border: 2px solid #fff; background: var(--c-main); color: #fff;
  display: grid; place-items: center; font: 700 11px/1 var(--font-ui);
}

@media (max-width: 359px) {
  .pick-grid { gap: 8px; }
  .pick-tile { height: 64px; }
  .season-card { min-height: 96px; }
}

/* 旅程の写真（data/plan_spots.json の img） */
.season-card.has-photo { background-size: cover; background-position: center; }
.season-card.has-photo .season-icon { font-size: 1.5rem; opacity: .95; filter: drop-shadow(0 1px 2px rgba(0,0,0,.4)); }
.pick-tile[style*="background-image"] { height: 96px; }
.picked-photo { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex: none; }
.tl-photo { display: block; width: calc(100% + 24px); height: 120px; object-fit: cover; margin: -10px -12px 8px; border-radius: var(--radius-s) var(--radius-s) 0 0; }
.photo-credits { margin: 8px 0 4px; font-size: .72rem; color: var(--c-sub); line-height: 1.7; }
.photo-credits summary { cursor: pointer; padding: 6px 0; }
.photo-credits ul { margin: 4px 0; padding-left: 1.2em; }
.photo-credits a { color: var(--c-sub); }
.photo-credits p { margin: 4px 0 0; }

/* 選択クリア */
.plan-clear-row { margin: -4px 0 10px; }
.plan-clear-row .btn-text { color: var(--c-sub); }
#planUndo { color: var(--c-main); }

/* 旅程の実際の経路 */
.plan-real { font-size: .78rem; line-height: 1.6; border-radius: 8px; padding: 6px 10px; margin: 0 0 10px; }
.plan-real.busy { background: var(--c-accent-soft); color: #7a5e12; }
.plan-real.busy::before { content: "⏳ "; }
.plan-real.ok { background: #e8f1eb; color: var(--c-walk); }
.plan-real.warn { background: #fdf1dc; color: #8a4b0f; }
.tl-leg.pending { opacity: .6; }
.tl-pending { color: var(--c-accent); }
.tl-rides { display: grid; gap: 3px; margin-top: 4px; font-weight: 400; font-size: .74rem; color: var(--c-text); }
.tl-ride { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.tl-ride .leg-badge { background: var(--leg-color); color: #fff; border-radius: 5px; padding: 0 6px; font-size: .7rem; font-weight: 700; }
.tl-leg { align-items: flex-start; padding-top: 6px; padding-bottom: 6px; }
.tl-leg-icon { top: 8px; }
.tl-walkalt { justify-self: start; min-height: 30px; padding: 2px 0; font-size: .74rem; color: var(--c-walk); white-space: normal; text-align: left; }

/* 平日 / 土日祝日 */
.plan-day { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; font-size: .9rem; }
.day-chips { display: inline-flex; gap: 6px; }
.day-chips .chip { min-height: 36px; padding: 5px 14px; }
.result-day { margin: 0 0 8px; font-size: .82rem; color: var(--c-sub); }

/* 日ごとの旅程 */
.tl-day {
  position: relative; z-index: 1; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin: 14px 0 6px; padding: 8px 12px; border-radius: var(--radius-s);
  background: var(--day-color); color: #fff; scroll-margin-top: 70px;
}
.tl-day:first-child { margin-top: 0; }
.tl-day b { font-family: var(--font-title); font-size: 1rem; letter-spacing: .05em; }
.tl-day span { font-size: .78rem; opacity: .95; }
.plan-daytabs { flex-wrap: nowrap; overflow-x: auto; margin: 0 calc(var(--pad) * -1) 10px; padding: 0 var(--pad) 2px; scrollbar-width: none; }
.plan-daytabs .chip.active[style] { background: var(--day-color); border-color: var(--day-color); }
.plan-time small { display: block; font-size: .7rem; color: var(--c-sub); }
.tl-day em { flex-basis: 100%; font-style: normal; font-size: .74rem; background: rgba(255,255,255,.2); border-radius: 6px; padding: 2px 8px; }
