/* カラー: デジタル庁デザインシステム(DADS)のプリミティブトークンを採用
 * 出典: @digital-go-jp/design-tokens v2.0.1 (SIL/MIT系OSS)
 * blue-900 #0017C1 / blue-1000 #00118F / green-600 #259D63 / yellow-700 #B78F00 /
 * red-800 #EC0000 / solid-gray-900 #1A1A1A / 600 #666666 / 420 #949494 / focus: yellow-300+黒の二重 */
:root {
  --bg: #F8F8FB;
  --ink: #1A1A1A;
  --sub: #666666;
  --line: #D8D8DB;
  --line-strong: #949494;
  --line-soft: #E8E8EB;
  /* プライマリーは淡めの Light Blue-800/900(白文字コントラスト5.2:1でAA維持) */
  --blue: #0066BE;
  --blue-hover: #0055AD;
  --amber: #B78F00;
  --green: #259D63;
  --yellow: #B78F00;
  --red: #A90000; /* にぶめの赤 = Red-1000(彩度を落として地図上の圧を下げる) */
  --focus-y: #FFD43D;
}

/* フォーカスインジケータ(DADS: Yellow-300とBlackの2重構造) */
:focus-visible {
  outline: 2px solid #000;
  outline-offset: 1px;
  box-shadow: 0 0 0 5px var(--focus-y);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #E8E8EB;
  /* DADS標準: Noto Sans JP。オフライン時はシステムゴシックにフォールバック */
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  font-size: 16px; /* DADS: 本文は16px以上 */
  line-height: 1.6;
  color: var(--ink);
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 800;
}
.brand-icon { border-radius: 8px; display: block; }

.today-me-btn {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: none;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

.badge {
  background: #fff;
  color: var(--blue);
  border-radius: 999px;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
}

.searchbar-wrap { padding: 0 16px 10px; }

.searchbar {
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-radius: 14px;
  background: #fff;
  border: 1.5px solid var(--line-strong); /* 入力欄の枠はDADS基準の濃いグレー */
}

.searchbar input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px; /* 16px未満はiOSで自動ズームも起きる */
  font-family: inherit;
  color: var(--ink);
  background: transparent;
  min-width: 0;
}
.searchbar input::placeholder { color: #767676; }

#map {
  flex: 1 1 auto;
  min-height: 240px;
  z-index: 0;
}

/* レイヤー選択チップ(地図内・左上) */
.layer-chips {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 56px;
  z-index: 610;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.layer-chips::-webkit-scrollbar { display: none; }
.layer-chip {
  flex-shrink: 0;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(26,26,26,.25);
  border-radius: 999px;
  background: rgba(255,255,255,.65);
  color: #767676;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.layer-chip[aria-pressed="true"] {
  background: rgba(26,26,26,.88);
  border-color: rgba(26,26,26,.88);
  color: #fff;
  font-weight: 600;
}

/* 夜間ダークマップの注記(地図内・左下) */
.night-note {
  position: absolute;
  left: 10px;
  bottom: 26px;
  z-index: 600;
  background: rgba(20, 20, 25, 0.82);
  color: #FFE9B8;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 240px;
  pointer-events: none;
}

/* 現在地(GPS)ボタン */
.locate-btn {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.locate-btn:hover { background: #F0F9FF; }

/* map pins (Leaflet divIcon) */
.pin { display: block; }
.pin svg { display: block; filter: drop-shadow(0 1px 2px rgba(20,20,19,.3)); }

/* 現在地(オレンジ+白縁+波紋) */
.here-pin { position: relative; }
.here-dot {
  position: absolute;
  left: 0; top: 0;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #E25100; /* DADS orange-700(他要素と被らない色) */
  border: 3.5px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
  box-sizing: border-box;
}
.here-halo {
  position: absolute;
  left: -9px; top: -9px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(226, 81, 0, 0.35);
  animation: here-pulse 2s ease-out infinite;
}
@keyframes here-pulse {
  0% { transform: scale(0.5); opacity: 0.9; }
  70% { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.35); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .here-halo { animation: none; opacity: 0.35; }
}

/* 施設名ラベル(POI_CATALOG由来・タップで判断へ) */
.poi-label-wrap { pointer-events: auto; }
.poi-label {
  display: inline-block;
  white-space: nowrap;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(38,48,58,.18);
  border-radius: 8px;
  padding: 2px 7px;
  font-size: 13px;
  font-weight: 600;
  color: #3D4854;
  box-shadow: 0 1px 3px rgba(20,20,19,.18);
  cursor: pointer;
}
.poi-label:hover { background: #EDF2F6; border-color: var(--blue); color: var(--blue); }

.sheet {
  flex: 0 0 auto;
  height: 46dvh;
  overflow-y: auto;
  background: #fff;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -4px 16px rgba(20,20,19,.12);
  margin-top: -18px;
  position: relative;
  z-index: 500;
  padding: 0 16px calc(20px + env(safe-area-inset-bottom));
  transition: height .25s ease;
}
.sheet.collapsed {
  height: 92px;
  overflow: hidden;
}

.sheet-toggle {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 12px 0 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.sheet-handle {
  display: block;
  width: 40px;
  height: 4px;
  border-radius: 99px;
  background: #D8D2C6;
  margin: 0 auto;
}

.sheet-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 800;
}
.sheet-sub { color: var(--sub); font-weight: 600; font-size: 13px; }

.barrier-list { list-style: none; margin: 0; padding: 0; }

.barrier-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
  align-items: flex-start;
}
.barrier-item .pin-icon { flex-shrink: 0; }
.barrier-item .body { flex: 1; min-width: 0; }

.barrier-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.barrier-name { font-size: 14.5px; font-weight: 700; }
.barrier-dist { font-size: 13px; color: var(--sub); white-space: nowrap; }
.barrier-desc { font-size: 13px; color: var(--sub); line-height: 1.55; margin: 2px 0 0; }

.cond-tag {
  margin-top: 5px;
  display: inline-flex;
  align-items: center;
  background: #EDF2F6;
  color: var(--blue);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 700;
  margin-right: 6px;
}

.sheet-footnote {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--sub);
  line-height: 1.6;
}

.empty-note {
  padding: 14px 0;
  font-size: 13px;
  color: var(--sub);
}

/* ---- 判断カード(pane-judge) ---- */

.judge-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.judge-head .icon-btn { margin-left: 0; }

.judge-badge-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 8px;
}

.judge-badge {
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  background: #197A4B; /* 「いける」— green-600(#259D63)は白文字でAA不合格のため濃く */
}
.judge-badge.maybe { background: #B78F00; color: #1A1A1A; } /* 「いけるかも」— 琥珀+黒文字でAA確保。緑と混同させない */
.judge-badge.hard { background: var(--red); }
.judge-badge.light { background: var(--sub); }

.judge-line {
  margin: 0 0 8px;
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.6;
}

.judge-reasons {
  list-style: none;
  margin: 0;
  padding: 0;
}
.judge-reasons li {
  font-size: 13px;
  color: #46505B;
  line-height: 1.6;
  padding: 6px 0;
  border-bottom: 1px solid var(--line-soft);
}
.judge-reasons li:last-child { border-bottom: none; }

/* ルート候補リスト */
.judge-routes { list-style: none; margin: 0 0 8px; padding: 0; }
.judge-route-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 4px 12px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  margin-bottom: 6px;
  cursor: pointer;
  background: #fff;
}
.judge-route-item.selected { border-color: var(--blue); border-width: 2px; background: #F0F9FF; }
.judge-route-item .lvl {
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: #fff; font-size: 13px; font-weight: 800;
  flex-shrink: 0;
}
.lvl-go { background: var(--green); }
.lvl-maybe { background: var(--yellow); }
.lvl-hard { background: var(--red); }
.rt-label { font-size: 14px; font-weight: 700; flex: 1; }
.rt-meta { font-size: 13px; color: var(--sub); }
.rt-body { flex: 1; min-width: 0; }
.rt-reason { font-size: 13px; color: var(--sub); margin-top: 2px; }

.guide-btns { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }

/* 「ここ、つらい」ワンタップ記録 */
.pain-row { display: flex; gap: 8px; margin-top: 10px; }
.pain-btn {
  flex: 2;
  min-height: 56px;
  border: none;
  border-radius: 16px;
  background: #B78F00;
  color: #1A1A1A;
  font-size: 17px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
}
.pain-btn:active { background: #927200; color: #fff; }
.pain-photo-btn { flex: 1; min-height: 56px; margin: 0; }
.pain-thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.pain-thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

/* 案内チェックポイント */
.guide-avoid {
  background: #F0F9FF;
  border: 1.5px solid var(--blue);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--blue-hover);
  line-height: 1.55;
  margin-bottom: 4px;
}
.cp-list { list-style: none; margin: 0; padding: 0; }
.cp-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
}
.cp-item:hover { background: #F0F9FF; }
.cp-item:last-child { border-bottom: none; }
.cp-at {
  min-width: 58px;
  font-size: 13px;
  font-weight: 700;
  color: var(--sub);
  text-align: right;
  flex-shrink: 0;
}
.cp-label { font-size: 14px; line-height: 1.5; }
.cp-item .pin-icon { flex-shrink: 0; }
.cp-item.avoided .cp-label, .cp-item.avoided .cp-at { color: #949494; }

.ghost-btn {
  width: 100%;
  min-height: 48px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
}

.fb-comment {
  width: 100%;
  margin-top: 10px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  background: #fff;
  color: var(--ink);
}

#btn-go { margin-top: 4px; margin-bottom: 8px; min-height: 50px; font-size: 15px; }
#btn-fb-skip { margin-top: 8px; }

/* ---- 東京アプリ統合イメージ(モック)フレーム ----
 * 実アプリのロゴ・アイコン・アセットは使わない。構造(下部ナビ+中央ボタン+緑)の近似のみ。
 * ?frame=off で非表示。 */
.tokyo-nav {
  position: sticky;
  bottom: 0;
  z-index: 600;
  background: #fff;
  border-top: 1px solid var(--line-soft);
  box-shadow: 0 -2px 10px rgba(0,0,0,.08);
  padding-bottom: env(safe-area-inset-bottom);
}
.tokyo-nav-note {
  display: block;
  text-align: center;
  font-size: 10px;
  color: #949494;
  padding-top: 3px;
  letter-spacing: .04em;
}
.tokyo-nav-items {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  padding: 0 6px 6px;
}
.tnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 60px;
  min-height: 48px;
  border: none;
  background: transparent;
  color: #767676;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  padding-top: 6px;
}
.tnav-item.active { color: #00A040; font-weight: 700; }
.tnav-fab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 62px;
  height: 62px;
  margin-top: -26px;
  border: none;
  border-radius: 50%;
  background: #00A040;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0,0,0,.25);
}
body.tokyo-frame .sheet { border-radius: 22px 22px 0 0; }

/* ---- 今日の私 overlay ---- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 12, 8, 0.4);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
/* display:flex がUAの [hidden]{display:none} を上書きしてしまうため明示的に殺す */
.overlay[hidden] { display: none; }

.overlay-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--bg);
  border-radius: 22px 22px 0 0;
  padding: 16px 20px calc(24px + env(safe-area-inset-bottom));
}

.overlay-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.overlay-head h2 { margin: 0; font-size: 18px; font-weight: 700; }
.overlay-note { margin-left: auto; font-size: 13px; color: var(--sub); }

.icon-btn {
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  margin-left: -12px;
}

.overlay-caption { font-size: 13px; color: var(--sub); line-height: 1.6; }

.group-title {
  margin: 14px 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--sub);
  letter-spacing: .06em;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  border-radius: 999px;
  background: #fff;
  border: 1.5px solid var(--line);
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}
.chip[aria-pressed="true"] {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  font-weight: 600;
}
.chip .check { display: none; }
.chip[aria-pressed="true"] .check { display: inline; }

/* フレーム切替トグル */
.frame-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 14px;
}
.switch {
  width: 50px;
  height: 30px;
  border: none;
  border-radius: 999px;
  background: var(--line);
  padding: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: background .15s ease;
}
.switch[aria-checked="true"] { background: var(--blue); justify-content: flex-end; }
.switch .knob {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  display: block;
}

.primary-btn {
  width: 100%;
  min-height: 56px;
  margin-top: 18px;
  border: none;
  border-radius: 16px;
  background: var(--blue);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
.primary-btn:hover { background: var(--blue-hover); }
.primary-btn:disabled { background: #949494; cursor: not-allowed; }

.tagline {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--sub);
  text-align: center;
}
