/* geo-arg 芯プロトタイプ スタイル */
/* スマホ縦持ち主体。全画面地図にUIを重ねる単一画面構成。 */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN",
    "Hiragino Sans", Meiryo, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

/* 全画面地図 */
#map {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #aadaff; /* タイル読込前の海色フォールバック（灰色で詰まらせない） */
}

/* 現在地に戻るボタン（下部の機能バー(高さ約58px)の上に乗せる） */
#recenter-btn {
  position: absolute;
  right: 16px;
  bottom: 74px;
  z-index: 1000;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

#recenter-btn:active {
  background: #f0f0f0;
}

.recenter-icon {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid #1a73e8;
  position: relative;
}

.recenter-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  background: #1a73e8;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

/* ステータスバー（現在地・誤差表示） */
#status-bar {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  max-width: 90%;
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 13px;
  border-radius: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

/* デバッグ位置指定の切替ボタン（F08）。左下、機能バーの上に配置。 */
#debug-toggle-btn {
  position: absolute;
  left: 12px;
  bottom: 74px;
  z-index: 1000;
  max-width: calc(100% - 96px);
  padding: 9px 14px;
  border: none;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#debug-toggle-btn.debug-on {
  background: #e8511a;
}

#debug-toggle-btn:active {
  opacity: 0.85;
}

/* 現在地マーカー（青点）。MapLibre Marker のルート要素。 */
.me-marker {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #1a73e8;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.5);
  cursor: default;
}

/* 配置物(POI)マーカー（F04）。MapLibre Marker のルート要素。見た目はpayload依存だが共通の既定ピン。 */
/* MapLibre は要素を translate で配置するため margin は使わず anchor:"bottom" で先端を座標に合わせる。 */
.poi-marker {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 50% 50% 50% 0;
  background: #e8511a;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  transform: rotate(-45deg);
  cursor: pointer;
}

/* POIマーカー内側の点 */
.poi-marker::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

/* 訪問済み表示（Sprint 3 で付与する想定。表示の土台を用意） */
.poi-marker.poi-visited {
  background: #9aa0a6;
}

/* 権限案内オーバーレイ */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 24, 30, 0.92);
  padding: 24px;
}

.overlay.hidden {
  display: none;
}

.overlay-card {
  background: #fff;
  border-radius: 16px;
  padding: 28px 24px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.overlay-title {
  margin: 0 0 12px;
  font-size: 19px;
  color: #1a1a1a;
}

.overlay-message {
  margin: 0 0 22px;
  font-size: 14px;
  line-height: 1.7;
  color: #444;
  white-space: pre-line;
  text-align: left;
}

.overlay-btn {
  display: inline-block;
  border: none;
  border-radius: 10px;
  padding: 13px 28px;
  background: #1a73e8;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.overlay-btn:active {
  background: #1557b0;
}

/* トースト（近接フィードバック用、Sprint 3 で利用） */
#toast-container {
  position: absolute;
  bottom: 132px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  pointer-events: none;
}

.toast {
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 12px 20px;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 600;
  max-width: 90%;
  text-align: center;
  animation: toast-in 0.25s ease-out;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 自動消滅時のフェードアウト */
.toast.toast-out {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ============================================================
   Sprint 5: 設定パネル（F10）・プロフィール（F09）・オンボーディング（F11）
   ============================================================ */

/* 設定を開く歯車ボタン（右上、ナビコントロールと重ならない位置） */
#settings-open-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1600;
  padding: 9px 14px;
  border: none;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

#settings-open-btn:active {
  opacity: 0.85;
}

/* 設定パネルの暗幕 */
.settings-backdrop {
  position: absolute;
  inset: 0;
  z-index: 2400;
  background: rgba(20, 24, 30, 0.55);
}

.settings-backdrop.hidden {
  display: none;
}

/* 設定パネル本体（モバイルは右からスライドイン相当の固定パネル） */
.settings-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 2500;
  width: 320px;
  max-width: 88%;
  background: #ffffff;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.settings-panel.hidden {
  display: none;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid #eceff1;
}

.settings-title {
  margin: 0;
  font-size: 18px;
  color: #1a1a1a;
}

.settings-close-btn {
  border: none;
  background: #f1f3f4;
  color: #333;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.settings-close-btn:active {
  background: #e3e6e8;
}

.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 18px 24px;
  -webkit-overflow-scrolling: touch;
}

.settings-section {
  padding: 14px 0;
  border-bottom: 1px solid #f1f3f4;
}

.settings-label {
  font-size: 13px;
  font-weight: 700;
  color: #5f6368;
  margin-bottom: 10px;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.settings-toggle-row {
  cursor: pointer;
}

.settings-sub {
  font-size: 14px;
  color: #333;
}

.settings-id-row {
  justify-content: space-between;
}

.settings-id-value {
  font-size: 12px;
  color: #80868b;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  word-break: break-all;
  text-align: right;
}

.settings-nickname-input {
  flex: 1;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cfd4d9;
  border-radius: 8px;
  font-size: 15px;
  color: #1a1a1a;
}

.settings-nickname-input:focus {
  outline: none;
  border-color: #1a73e8;
}

.settings-radius-range {
  flex: 1;
}

.settings-range-value {
  font-size: 14px;
  font-weight: 600;
  color: #1a73e8;
  min-width: 48px;
  text-align: right;
}

.settings-mapstyle-select {
  flex: 1;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cfd4d9;
  border-radius: 8px;
  font-size: 15px;
  color: #1a1a1a;
  background: #fff;
}

.settings-replay-btn {
  width: 100%;
  border: 1px solid #1a73e8;
  background: #fff;
  color: #1a73e8;
  border-radius: 10px;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.settings-replay-btn:active {
  background: #eef4fe;
}

/* オンボーディング（F11）。権限案内オーバーレイ(.overlay)とは別レイヤー。 */
.onboarding-overlay {
  position: absolute;
  inset: 0;
  z-index: 2200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 24, 30, 0.92);
  padding: 24px;
}

.onboarding-card {
  background: #fff;
  border-radius: 16px;
  padding: 26px 22px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.onboarding-title {
  margin: 0 0 16px;
  font-size: 20px;
  color: #1a1a1a;
  text-align: center;
}

.onboarding-steps {
  margin: 0 0 16px;
  padding-left: 20px;
}

.onboarding-steps li {
  font-size: 14px;
  line-height: 1.7;
  color: #333;
  margin-bottom: 8px;
}

.onboarding-note {
  margin: 0 0 20px;
  font-size: 12px;
  line-height: 1.6;
  color: #80868b;
}

.onboarding-btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 14px;
  background: #1a73e8;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.onboarding-btn:active {
  background: #1557b0;
}

/* ============================================================
   Sprint 6 上物: ナビHUD（F16）・機能バー＋ボトムシート（F12/F13/F14）
   ============================================================ */

/* POI kind 別の見た目（★表示分岐のみ。挙動は変えない）。色だけ差し替える。 */
.poi-marker.poi-kind-default { background: #e8511a; }
.poi-marker.poi-kind-treasure { background: #f4b400; }
.poi-marker.poi-kind-landmark { background: #1a73e8; }
.poi-marker.poi-kind-shop { background: #0f9d58; }
.poi-marker.poi-kind-secret { background: #9334e6; }
/* 訪問済み(.poi-visited)は kind 色より優先してグレーにする（既存の訪問済み表示を維持）。 */
.poi-marker.poi-visited { background: #9aa0a6; }

/* ナビHUD（最寄り未訪問POIの距離・方角）。ステータスバーの下、常駐。 */
.nav-hud {
  position: absolute;
  top: 52px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 92%;
  padding: 7px 14px;
  background: rgba(26, 115, 232, 0.92);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

/* 方角矢印（北基準で回転）。三角形を CSS で描く。 */
.nav-hud-arrow {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 12px solid #fff;
  transition: transform 0.3s ease;
  flex: 0 0 auto;
}

.nav-hud-arrow.nav-hud-arrow-off {
  border-bottom-color: rgba(255, 255, 255, 0.5);
}

.nav-hud-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 下部機能バー（図鑑・クエスト・エリアの開閉ボタン）。スマホ縦で破綻しないよう等幅3分割。 */
.feature-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1400;
  display: flex;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.18);
  border-top: 1px solid #e3e6e8;
}

.feature-tab-btn {
  flex: 1 1 0;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 9px 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: #5f6368;
}

.feature-tab-btn.active {
  color: #1a73e8;
}

.feature-tab-label {
  font-size: 13px;
  font-weight: 700;
}

.feature-tab-badge {
  font-size: 11px;
  font-weight: 600;
  color: #80868b;
}

.feature-tab-btn.active .feature-tab-badge {
  color: #1a73e8;
}

.feature-tab-btn:active {
  background: #f1f3f4;
}

/* ボトムシートの暗幕 */
.feature-backdrop {
  position: absolute;
  inset: 0;
  z-index: 1700;
  background: rgba(20, 24, 30, 0.5);
}

.feature-backdrop.hidden {
  display: none;
}

/* ボトムシート本体（下から立ち上がる固定パネル） */
.feature-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1800;
  max-height: 70%;
  background: #fff;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.feature-sheet.hidden {
  display: none;
}

.feature-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #eceff1;
}

.feature-sheet-title {
  margin: 0;
  font-size: 17px;
  color: #1a1a1a;
}

.feature-sheet-close {
  border: none;
  background: #f1f3f4;
  color: #333;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.feature-sheet-close:active {
  background: #e3e6e8;
}

.feature-sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px 28px;
  -webkit-overflow-scrolling: touch;
}

.feature-summary {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 8px;
}

.feature-empty {
  font-size: 14px;
  color: #80868b;
}

/* 進捗バー（図鑑達成率・クエスト・エリア共通） */
.progress-bar {
  width: 100%;
  height: 8px;
  background: #eceff1;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-fill {
  height: 100%;
  background: #1a73e8;
  border-radius: 4px;
  transition: width 0.25s ease;
}

/* 図鑑グリッド（F12）。収集済みは色付き、未収集はグレー・シルエット。 */
.dex-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.dex-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 6px;
  border-radius: 10px;
  background: #f8f9fa;
  text-align: center;
}

.dex-dot {
  width: 26px;
  height: 26px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: #e8511a;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.dex-name {
  font-size: 12px;
  line-height: 1.3;
  color: #333;
  word-break: break-word;
}

/* 未収集はシルエット（グレー・名前伏せ） */
.dex-cell.uncollected .dex-dot {
  background: #c4c8cc;
  border-color: #e3e6e8;
  box-shadow: none;
}

.dex-cell.uncollected .dex-name {
  color: #aeb3b8;
}

/* クエスト行（F13） */
.quest-row,
.area-row {
  padding: 12px 0;
  border-bottom: 1px solid #f1f3f4;
}

.quest-head,
.area-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.quest-title,
.area-label {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
}

.quest-status,
.area-status {
  font-size: 13px;
  font-weight: 600;
  color: #5f6368;
  white-space: nowrap;
}

.quest-row.done .quest-status,
.area-row.cleared .area-status {
  color: #0f9d58;
}

.quest-row.done .progress-fill,
.area-row.cleared .progress-fill {
  background: #0f9d58;
}

/* ============================================================
   Sprint 7: F17 POI詳細シート（画像・テキスト）／F18 周辺POI自動生成パネル
   ============================================================ */

/* --- F17: POI詳細シート（タイトル・説明・画像） --- */
.poi-detail-backdrop {
  position: absolute;
  inset: 0;
  z-index: 2600;
  background: rgba(20, 24, 30, 0.5);
}

.poi-detail-backdrop.hidden {
  display: none;
}

.poi-detail-sheet {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2700;
  width: 340px;
  max-width: 90%;
  max-height: 80%;
  overflow-y: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  -webkit-overflow-scrolling: touch;
}

.poi-detail-sheet.hidden {
  display: none;
}

.poi-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 8px;
}

.poi-detail-title {
  margin: 0;
  font-size: 17px;
  color: #1a1a1a;
  word-break: break-word;
}

.poi-detail-close {
  flex: 0 0 auto;
  border: none;
  background: #f1f3f4;
  color: #333;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.poi-detail-close:active {
  background: #e3e6e8;
}

/* 画像枠。画像読込失敗/無しの時はプレースホルダ模様を出す（クラッシュさせない）。 */
.poi-detail-img-wrap {
  margin: 4px 16px 12px;
  border-radius: 12px;
  overflow: hidden;
  background: #eceff1;
  min-height: 60px;
}

.poi-detail-img {
  display: block;
  width: 100%;
  height: auto;
}

.poi-detail-img-wrap.placeholder {
  height: 120px;
  background-image: linear-gradient(135deg, #e3e6e8 25%, #eceff1 25%, #eceff1 50%, #e3e6e8 50%, #e3e6e8 75%, #eceff1 75%, #eceff1 100%);
  background-size: 24px 24px;
}

.poi-detail-badge {
  margin: 0 16px 8px;
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: #0f9d58;
}

.poi-detail-desc {
  margin: 0 16px 18px;
  font-size: 14px;
  line-height: 1.7;
  color: #444;
  white-space: pre-line;
  word-break: break-word;
}

/* --- F18: 周辺POI自動生成パネル --- */
/* 開閉トグル（左上。ステータスバー＝上中央、歯車＝右上と衝突しない位置）。 */
.spawn-toggle-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1600;
  padding: 9px 14px;
  border: none;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.spawn-toggle-btn:active {
  opacity: 0.85;
}

/* パネル本体（トグルの下に折りたたみ式で出す）。 */
.spawn-panel {
  position: absolute;
  top: 52px;
  left: 12px;
  z-index: 1650;
  width: 280px;
  max-width: calc(100% - 24px);
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  padding: 14px 16px 16px;
}

.spawn-panel.hidden {
  display: none;
}

.spawn-title {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 10px;
}

.spawn-row {
  margin-bottom: 10px;
}

.spawn-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #5f6368;
  margin-bottom: 4px;
}

.spawn-select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #cfd4d9;
  border-radius: 8px;
  font-size: 14px;
  color: #1a1a1a;
  background: #fff;
}

.spawn-gen-btn {
  width: 100%;
  border: none;
  background: #1a73e8;
  color: #fff;
  border-radius: 10px;
  padding: 11px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 2px;
}

.spawn-gen-btn:active {
  background: #1557b0;
}

.spawn-gen-btn:disabled {
  background: #9aa0a6;
  cursor: default;
}

.spawn-note {
  margin: 12px 0 0;
  font-size: 11px;
  line-height: 1.5;
  color: #80868b;
}

.spawn-status {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.5;
  color: #333;
  min-height: 1em;
  word-break: break-word;
}
