/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Base（loan/style.css と共通のリセット＆レイアウト）
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
* { margin: 0; padding: 0; box-sizing: border-box; }
button { touch-action: manipulation; }

body {
  font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.7;
  overflow-x: hidden;
}

header {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}
.header-inner { max-width: 800px; margin: 0 auto; padding: 0 1.5rem; }
.logo { font-size: 1.2rem; font-weight: bold; color: #1a73e8; text-decoration: none; }

main { max-width: 800px; margin: 2rem auto; padding: 0 1.5rem; }

h1 { font-size: 1.8rem; font-weight: bold; margin-bottom: .5rem; }
h2 { font-size: 1.2rem; font-weight: bold; margin-bottom: 1rem; }
.description { color: #666; margin-bottom: 1.5rem; }

.card {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid #e0e0e0;
}

.hidden { display: none !important; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   ヒーロー
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.hero {
  text-align: center;
  padding: 28px 0 20px;
  margin-bottom: 1.5rem;
}
.hero-icon { font-size: 3rem; margin-bottom: 10px; }
.hero h1 { font-size: 1.8rem; font-weight: bold; margin-bottom: 6px; color: #1e293b; }
.hero .description { color: #666; font-size: .95rem; line-height: 1.7; margin-bottom: 0; }
.hero-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}
.badge {
  display: inline-block;
  padding: 5px 13px;
  background: #dbeafe;
  color: #1a73e8;
  border: 1.5px solid #bfdbfe;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   検索 + GPS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.search-card { padding: 1rem 1.5rem; position: relative; }

.search-wrap {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.search-icon-inner {
  font-size: 1rem;
  flex-shrink: 0;
  color: #999;
}
.search-wrap input[type="search"] {
  flex: 1;
  min-width: 0;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  padding: .55rem .8rem;
  font-size: .95rem;
  font-family: inherit;
  background: #f8fbff;
  transition: border-color .15s;
}
.search-wrap input[type="search"]:focus {
  outline: none;
  border-color: #1a73e8;
  background: #fff;
}

#gps-btn {
  flex-shrink: 0;
  padding: .55rem 1rem;
  border: 1.5px solid #1a73e8;
  border-radius: 8px;
  background: #fff;
  color: #1a73e8;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: background .15s, color .15s;
}
#gps-btn:hover { background: #1a73e8; color: #fff; }
#gps-btn:disabled { opacity: .6; cursor: default; }

.search-results {
  position: absolute;
  top: calc(100% - .5rem);
  left: 1.5rem;
  right: 1.5rem;
  background: #fff;
  border: 1.5px solid #e0e0e0;
  border-top: none;
  border-radius: 0 0 10px 10px;
  z-index: 800;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  max-height: 220px;
  overflow-y: auto;
}
.search-result-item {
  padding: .55rem 1rem;
  font-size: .85rem;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  color: #333;
  line-height: 1.4;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: #f0f6ff; color: #1a73e8; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   地図
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.map-card { padding: 0; overflow: hidden; position: relative; }

#map {
  height: 460px;
  width: 100%;
  position: relative;
  z-index: 1;
  cursor: crosshair;
}

.map-hint {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.6);
  color: #fff;
  font-size: .78rem;
  padding: .4rem .85rem;
  border-radius: 20px;
  pointer-events: none;
  z-index: 500;
  white-space: nowrap;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   操作パネル
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.controls-card { padding: 1rem 1.5rem; }

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: .75rem;
}
.ctrl-btn {
  padding: .5rem .9rem;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  background: #fff;
  color: #333;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s, background .15s, color .15s;
  white-space: nowrap;
}
.ctrl-btn:hover { border-color: #1a73e8; color: #1a73e8; background: #f0f6ff; }
.ctrl-btn:disabled { opacity: .5; cursor: default; }
.ctrl-danger:hover { border-color: #ea4335; color: #ea4335; background: #fff5f5; }

.options-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.option-label { font-size: .82rem; color: #666; white-space: nowrap; }

.km-toggle { display: flex; gap: .25rem; }
.km-btn {
  padding: .3rem .65rem;
  border: 1.5px solid #e0e0e0;
  border-radius: 6px;
  background: #fff;
  color: #888;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.km-btn:hover  { border-color: #1a73e8; color: #1a73e8; }
.km-btn.active { border-color: #1a73e8; background: #1a73e8; color: #fff; }

.loop-label {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .85rem;
  color: #555;
  cursor: pointer;
  user-select: none;
}
.loop-label input { cursor: pointer; accent-color: #1a73e8; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   計測結果
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.no-route-msg {
  text-align: center;
  color: #bbb;
  font-size: .9rem;
  padding: 1.2rem 0;
}

/* 主要指標 */
.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.metric {
  background: #f8fbff;
  border-radius: 12px;
  padding: 1rem;
  border: 1px solid #e0e0e0;
  text-align: center;
}
.metric-label { font-size: .78rem; color: #888; margin-bottom: .4rem; }
.metric-value { font-size: 1.2rem; font-weight: bold; }
.metric-value.highlight { color: #1a73e8; font-size: 1.5rem; }

/* セクション区切り */
.section-divider {
  font-size: .8rem;
  color: #888;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .02em;
  margin: 1.25rem 0 .65rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #f0f0f0;
}

/* 移動時間グリッド */
.time-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .6rem;
  margin-bottom: .5rem;
}
.time-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .65rem .8rem;
  background: #f8fbff;
  border-radius: 10px;
  border: 1px solid #e8f0fe;
}
.time-icon { font-size: 1.2rem; flex-shrink: 0; }
.time-label { font-size: .75rem; color: #666; flex: 1; line-height: 1.3; }
.time-value { font-size: .95rem; font-weight: 700; color: #1a73e8; white-space: nowrap; }

/* 消費カロリー */
/* body-weight input を自然にインライン表示 */
.section-divider #body-weight,
#stats-content .section-divider input[type="number"] {
  width: 52px;
  border: 1.5px solid #e0e0e0;
  border-radius: 6px;
  padding: 1px 5px;
  font-size: .85rem;
  font-weight: bold;
  text-align: center;
  color: #1a73e8;
  background: #f8fbff;
  font-family: inherit;
  -moz-appearance: textfield;
}
#body-weight::-webkit-inner-spin-button,
#body-weight::-webkit-outer-spin-button { -webkit-appearance: none; }
#body-weight:focus { outline: none; border-color: #1a73e8; }

.calorie-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .6rem;
  margin-bottom: .75rem;
}
.calorie-item {
  text-align: center;
  padding: .65rem .5rem;
  background: #fff8f0;
  border-radius: 10px;
  border: 1px solid #fde68a;
}
.calorie-mode { display: block; font-size: .75rem; color: #888; margin-bottom: .25rem; }
.calorie-val { font-size: 1.05rem; font-weight: 700; color: #d97706; }

/* 歩数 */
.steps-row {
  font-size: .85rem;
  color: #666;
  padding: .55rem 0;
  border-top: 1px solid #f0f0f0;
}
.steps-row strong { color: #333; font-size: .95rem; }

/* 面積 */
.area-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: 10px;
  margin-top: .75rem;
}
.area-label { font-size: .88rem; font-weight: 600; color: #166534; }
.area-value { font-size: 1.1rem; font-weight: 700; color: #16a34a; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   標高グラフ
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.elev-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .5rem;
  margin-bottom: 1.1rem;
}
.elev-stat {
  text-align: center;
  padding: .6rem .4rem;
  background: #f8fbff;
  border-radius: 10px;
  border: 1px solid #e8f0fe;
}
.elev-stat-label { display: block; font-size: .73rem; color: #888; margin-bottom: .2rem; }
.elev-stat-val { font-size: 1rem; font-weight: 700; color: #333; }
.elev-gain { color: #e53e3e; }
.elev-loss { color: #3182ce; }

.elev-chart-wrap {
  position: relative;
  height: 180px;
}

.elev-note {
  font-size: .73rem;
  color: #bbb;
  margin-top: .65rem;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Tips / 使い方
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.tips-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.tip-item { display: flex; gap: .65rem; }
.tip-icon { font-size: 1.4rem; flex-shrink: 0; }
.tip-text strong { display: block; font-weight: 700; margin-bottom: .15rem; font-size: .88rem; }
.tip-text p { font-size: .8rem; color: #78716c; line-height: 1.55; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   活用シーン
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.scene-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .75rem;
}
.scene-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .85rem 1rem;
  background: #f0f6ff;
  border: 1.5px solid #bfdbfe;
  border-radius: 12px;
}
.scene-icon { font-size: 1.7rem; flex-shrink: 0; }
.scene-body strong { display: block; font-size: .88rem; font-weight: 700; color: #1a56db; margin-bottom: .2rem; }
.scene-body p { font-size: .78rem; color: #4b5563; line-height: 1.55; margin: 0; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Amazon
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.amazon-card h2 { margin-bottom: .25rem; }
.amazon-note { font-size: .82rem; color: #999; margin-bottom: 1rem; }
.amazon-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
.amazon-item {
  display: block;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: .9rem;
  text-decoration: none;
  color: inherit;
  transition: border-color .2s, box-shadow .2s, transform .1s;
}
.amazon-item:hover {
  border-color: #FF9900;
  box-shadow: 0 2px 8px rgba(255,153,0,.15);
  transform: translateY(-1px);
}
.amazon-item-icon { font-size: 1.7rem; margin-bottom: .35rem; }
.amazon-item-name { font-size: .88rem; font-weight: bold; margin-bottom: .2rem; }
.amazon-item-desc { font-size: .76rem; color: #888; line-height: 1.5; margin-bottom: .45rem; }
.amazon-item-link { font-size: .78rem; color: #FF9900; font-weight: bold; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   関連ツール
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.related-tools {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .75rem;
}
.related-tool-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .85rem 1rem;
  border: 1.5px solid #e8edf5;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.related-tool-item:hover { border-color: #1a73e8; box-shadow: 0 2px 8px rgba(26,115,232,.1); }
.related-tool-icon { font-size: 1.6rem; flex-shrink: 0; }
.related-tool-item strong { display: block; font-size: .88rem; font-weight: 700; color: #1a73e8; margin-bottom: .2rem; }
.related-tool-item p { font-size: .76rem; color: #888; line-height: 1.5; margin: 0; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   FAQ
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.faq-list { display: flex; flex-direction: column; }
.faq-item { padding: .9rem 0; border-bottom: 1px solid #f0f0f0; }
.faq-item:last-child { border-bottom: none; padding-bottom: 0; }
.faq-q { font-size: .9rem; font-weight: 700; color: #1a73e8; margin-bottom: .35rem; }
.faq-a { font-size: .85rem; color: #555; line-height: 1.75; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   フッター
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
footer {
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: .82rem;
  color: #a8a29e;
  border-top: 1px solid #e7e5e4;
  margin-top: auto;
}
footer a { color: #ea580c; text-decoration: none; }
footer a:hover { text-decoration: underline; }
footer p + p { margin-top: .3rem; }
.amazon-notice { font-size: .72rem; color: #bbb; margin-top: .2rem; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   トースト通知
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: rgba(30, 30, 30, .9);
  color: #fff;
  padding: .55rem 1.25rem;
  border-radius: 8px;
  font-size: .88rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 9999;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Leaflet 調整
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.leaflet-container { font-family: inherit; }
.leaflet-control-zoom a {
  font-size: 1.1rem;
  line-height: 28px;
}
/* Leaflet 内部の z-index はそのまま保持（上書き不可）
   検索結果ドロップダウン(.search-results z-index:800)は
   #map が z-index:1 の独立スタッキングコンテキストを持つため
   自然に地図の上に重なる */

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   モバイル対応
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
@media (max-width: 640px) {
  main { margin: 1rem auto; padding: 0 .9rem; }
  .hero h1 { font-size: 1.4rem; }
  .hero .description { font-size: .88rem; }

  #map { height: 310px; }
  .map-hint { font-size: .7rem; padding: .3rem .7rem; }

  .metrics { grid-template-columns: 1fr 1fr; }
  .metrics .metric:first-child { grid-column: 1 / -1; }

  .time-grid { grid-template-columns: 1fr; }
  .calorie-grid { grid-template-columns: repeat(3, 1fr); }

  .elev-stats { grid-template-columns: repeat(2, 1fr); }

  .scene-grid { grid-template-columns: 1fr; }
  .amazon-grid { grid-template-columns: 1fr; }
  .related-tools { grid-template-columns: 1fr; }

  .controls-row { gap: .3rem; }
  .ctrl-btn { font-size: .78rem; padding: .45rem .65rem; }
}

@media (max-width: 420px) {
  .calorie-grid { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr; }
  .metrics .metric:first-child { grid-column: auto; }
}
