[hidden] { display: none !important; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  overscroll-behavior: none;
}

#map {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}

/* ---------- 上部：時代パネル ---------- */
#era-panel {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  left: 10px;
  right: 10px;
  max-width: 480px;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  font-size: 13px;
  line-height: 1.5;
  color: #222;
  z-index: 5;
}

#era-panel h1 {
  font-size: 15px;
  margin: 0 0 4px 0;
}

#era-panel .era-badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 10px;
  margin-right: 6px;
  color: #fff;
}
.badge-確認済み { background: #1a7a3c; }
.badge-推定 { background: #b5820a; }
.badge-準備中 { background: #888; }

#era-panel .era-source {
  font-size: 11px;
  color: #555;
  margin-top: 6px;
  border-top: 1px solid #ddd;
  padding-top: 4px;
}

#era-panel .era-note {
  font-size: 11.5px;
  color: #444;
  margin-top: 4px;
}

#era-panel .prep-reason {
  font-size: 11.5px;
  color: #a33;
  margin-top: 4px;
}

/* 標高しきい値スライダー（縄文・弥生のみ表示） */
#dem-control {
  margin-top: 8px;
  display: none;
}
#dem-control label {
  font-size: 12px;
  color: #e8e8e8;
}
#dem-control input[type="range"] {
  width: 100%;
  height: 28px;
}
#dem-status {
  font-size: 11.5px;
  color: #cfcfcf;
}

/* ---------- 下部：時代スライダー ---------- */
#era-slider-wrap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(20, 20, 25, 0.92);
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px)) 10px;
  z-index: 5;
}

#era-slider-label {
  color: #fff;
  font-size: 12px;
  text-align: center;
  margin-bottom: 6px;
}

#era-buttons {
  display: flex;
  gap: 4px;
}

.era-btn {
  flex: 1 1 0;
  min-width: 0;
  height: 48px;
  border: none;
  border-radius: 8px;
  background: #3a3a45;
  color: #ddd;
  font-size: 11.5px;
  line-height: 1.25;
  padding: 2px;
  white-space: normal;
  word-break: keep-all;
}

.era-btn.active {
  background: #ffb703;
  color: #1a1a1a;
  font-weight: bold;
}

.era-btn:active {
  filter: brightness(0.9);
}

/* MapLibre の attribution を見やすく */
.maplibregl-ctrl-attrib {
  font-size: 10.5px;
}

@media (max-width: 420px) {
  #era-panel {
    font-size: 12px;
  }
  #era-panel h1 {
    font-size: 14px;
  }
  .era-btn {
    font-size: 10.5px;
    height: 46px;
  }
}

#meiji-control { margin-top: 8px; }
#meiji-control label { font-size: 12px; color: #e8e8e8; }
#meiji-control input[type="range"] { width: 100%; height: 28px; }

.jump-btn { margin-top: 8px; min-height: 44px; padding: 0 14px; border-radius: 8px; border: 0; background: #c0392b; color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; }

#footer-links { margin-left: 8px; font-size: 11px; }
#footer-links a { color: #bbb; }

/* ズーム・現在地のボタンは説明欄の下、時代バーの上（右下）に置く */
.maplibregl-ctrl-top-right { top: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + 150px); }
.maplibregl-ctrl-group button { width: 40px; height: 40px; }

#city-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; color: #e8e8e8; font-size: 13px; }
#city-select { flex: 2; min-height: 40px; font-size: 16px; border-radius: 8px; border: 0; padding: 0 10px; background: #3a3a44; color: #fff; }

/* 明治期の低湿地の凡例 */
.legend-toggle { margin-top: 6px; min-height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid #bbb; background: #fff; font-size: 12.5px; cursor: pointer; }
#legend-list { margin-top: 6px; }
.legend-scroll { max-height: 34vh; overflow-y: auto; }
.legend-row { display: flex; align-items: center; gap: 6px; font-size: 12px; padding: 2px 0; }
.legend-sw { width: 20px; height: 13px; border: 1px solid #999; flex: none; }
.legend-desc { color: #555; font-size: 11.5px; }
.legend-caution { margin-top: 6px; font-size: 11.5px; color: #8a3b2f; }

#terrain-select { flex: 1.2; min-height: 40px; font-size: 15px; border-radius: 8px; border: 0; padding: 0 8px; background: #3a3a44; color: #fff; }

.terrain-note { margin-top: 6px; padding-top: 6px; border-top: 1px solid #ddd; font-size: 11.5px; color: #333; }

.terrain-op { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.terrain-op label { font-size: 11.5px; white-space: nowrap; }
.terrain-op input[type="range"] { flex: 1; height: 26px; }
.rl-bar { display: flex; height: 14px; border: 1px solid #999; margin-top: 4px; }
.rl-cell { flex: 1; }
.rl-ticks { display: flex; justify-content: space-between; font-size: 9.5px; color: #555; }
.rl-note { font-size: 11px; color: #555; margin-top: 2px; }

.here-btn { margin-top: 8px; min-height: 40px; padding: 0 14px; border-radius: 8px; border: 0; background: #2f6fb5; color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; }
.slope-legend { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 11px; color: #555; }
.slope-bar { flex: 1; height: 10px; border: 1px solid #999; background: linear-gradient(to right, #fff, #000); }
.here-row { display: flex; flex-wrap: wrap; gap: 6px; }
.here-me { background: #fff; color: #2f6fb5; border: 1.5px solid #2f6fb5; }
.here-close { float: right; margin: -2px -2px 4px 8px; min-height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid #c9c0ae; background: #fff; color: #333; font-size: 13px; font-weight: 600; cursor: pointer; }
.here-card { margin-top: 6px; background: #f6f3ec; border: 1px solid #ddd6c8; border-radius: 8px; padding: 8px; font-size: 12px; }
.here-table { width: 100%; border-collapse: collapse; margin-top: 4px; }
.here-table th { text-align: left; white-space: nowrap; vertical-align: top; padding: 2px 6px 2px 0; color: #555; font-weight: 600; }
.here-table td { padding: 2px 0; }
.here-sw { display: inline-block; width: 16px; height: 11px; border: 1px solid #999; margin-right: 4px; vertical-align: middle; }
.here-src { margin-top: 4px; font-size: 11px; color: #666; }

/* 空中写真の年代：横にスクロールする帯（ボタンが増えても折り返さない） */
#showa-sub-row { display: flex; gap: 4px; margin-bottom: 6px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 22px), transparent 100%); mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 22px), transparent 100%); }
#showa-sub-row::-webkit-scrollbar { display: none; }
#showa-sub-row .sub-btn { flex: 0 0 auto; min-width: 76px; height: 40px; font-size: 10.5px; line-height: 1.2; padding: 2px 6px; white-space: pre-line; scroll-snap-align: start; }
#showa-sub-row .sub-btn.sub-na { opacity: 0.38; }
#showa-sub-row .sub-btn.sub-na.active { opacity: 0.7; }

/* 3Dの切り替え */
.maplibregl-ctrl-group button.btn-3d { font-size: 13px; font-weight: 700; color: #333; }
.maplibregl-ctrl-group button.btn-3d.on { background: #ffb703; color: #1a1a1a; }

/* 説明欄が長くなっても地図を覆いきらない */
#era-panel { max-height: 42vh; overflow-y: auto; }

.afm-caution { margin-top: 6px; font-size: 11.5px; color: #8a3b2f; }
.afm-ref { font-size: 10.5px; color: #555; margin-top: 2px; }
/* 「ここは昔どうだった？」で調べた場所の青い点（3Dでも建物の陰に隠れないよう地図の上に置く） */
.here-dot { width: 16px; height: 16px; border-radius: 50%; background: #2f6fb5; border: 3px solid #fff; box-shadow: 0 0 2px rgba(0,0,0,.4); pointer-events: none; }
