:root {
  /* 意味色の三原則: 緑=逃げられる / 赤=ダメ / 青=水 */
  --green: #007a4d;
  --green-deep: #005a39;
  --navy: #14352a;      /* 見出し・墨(緑がかった黒) */
  --navy-deep: #0b1f16;
  --sky: #2f9fe0;       /* 水・浸水表現専用 */
  --ok: #007a4d;
  --ng: #d9382a;
  --amber: #f2a03d;     /* 橙=注意書き専用(避難可否の意味には使わない) */
  --paper: #f4f7f5;
  --card: #ffffff;
  --ink: #182420;
  --ink-soft: #55645c;
  --line: #d9e3dc;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(16, 36, 26, .08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
main { max-width: 720px; margin: 0 auto; padding: 0 16px 48px; }

/* ===== ヘッダー(避難サインの緑帯) ===== */
.site-head {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  background: var(--green);
  padding: 11px max(16px, calc(50vw - 344px));
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: #ffffff; }
.brand-mark { width: 30px; height: 30px; }
.brand-name { font-size: 22px; font-weight: 800; letter-spacing: .05em; }
.brand-tag { margin: 0; font-size: 12px; color: #ffffff; font-weight: 700; padding-top: 4px; }

/* ===== 常設ナビ(隠さない=ハンバーガー不採用。結果画面ではタスク優先で非表示) ===== */
.gnav {
  display: flex; justify-content: center; gap: 2px;
  background: #fff; border-bottom: 1px solid #e2eae5;
  padding: 4px 8px; overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.gnav a {
  flex-shrink: 0; color: var(--green); font-weight: 700; font-size: 12.5px;
  text-decoration: none; padding: 10px 9px; border-radius: 8px; line-height: 1.3; white-space: nowrap;
}
.gnav a[aria-current="page"] { background: #eaf4ee; color: #14352a; }
body[data-state="result"] .gnav { display: none; }

/* ===== ヒーロー ===== */
.hero { text-align: center; padding: 20px 0 8px; }
.hero h1 {
  font-size: clamp(28px, 7.5vw, 40px);
  font-weight: 800; line-height: 1.3; margin: 8px 0 16px;
  color: var(--navy);
  text-wrap: balance;
}
.hero h1 em {
  font-style: normal; color: #ffffff; background: var(--ng);
  padding: 1px 10px 3px; border-radius: 9px; white-space: nowrap;
}
.hero-fact {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px; font-size: 15px; margin: 0 0 14px;
  text-wrap: balance;
}
.hero-fact .alert { color: var(--ng); font-size: 18px; }
.hero-lead { font-size: 14px; color: var(--ink-soft); margin: 0 0 22px; text-wrap: pretty; }

.search { display: flex; gap: 8px; margin-bottom: 10px; }
.search input {
  flex: 1; min-width: 0;
  font-size: 16px; padding: 13px 14px;
  border: 2px solid var(--navy); border-radius: 12px;
  background: #fff; color: var(--ink);
}
.search input:focus { outline: 3px solid rgba(0, 122, 77, .35); }
.search-msg { min-height: 1.4em; font-size: 13px; color: #b3271d; font-weight: 700; margin: 6px 0 0; }
.cand-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 8px; }

.btn {
  font-size: 15px; font-weight: 700; font-family: inherit;
  padding: 12px 18px; border-radius: 12px; border: none; cursor: pointer;
  text-decoration: none; display: inline-block;
  transition: transform .08s ease, box-shadow .08s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--green); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--green-deep); }
.btn-ghost { background: transparent; color: var(--navy); border: 1.5px solid var(--line); background: #fff; }
.btn-sm { font-size: 13px; padding: 8px 12px; }
.btn-wide { width: 100%; }

.steps {
  list-style: none; display: flex; gap: 8px; justify-content: center;
  padding: 0; margin: 28px 0 0; flex-wrap: wrap;
}
.steps li {
  flex: 1; min-width: 130px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 10px; font-size: 12.5px; color: var(--ink-soft);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.steps b {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--green); color: #fff; font-size: 14px;
  display: grid; place-items: center;
}

/* ===== 結果 ===== */
.result-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin: 14px 0 10px; flex-wrap: wrap;
}
.result-head h2 { font-size: 18px; margin: 0; color: var(--navy); word-break: break-all; }

.hazard-tabs-wrap { position: relative; }
.hazard-tabs {
  display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
/* タブ列が右に続くことを初見に伝えるフェード+矢印(右端までスクロールしたら消す) */
.hazard-tabs-wrap::after {
  content: "›"; position: absolute; top: 0; right: 0; bottom: 8px; width: 44px;
  display: flex; align-items: center; justify-content: flex-end; padding-right: 2px;
  font-size: 22px; font-weight: 800; color: var(--green);
  background: linear-gradient(90deg, rgba(244,247,245,0), var(--paper) 70%);
  pointer-events: none; opacity: 0; transition: opacity .15s;
}
.hazard-tabs-wrap.can-scroll::after { opacity: 1; }
.hazard-tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; font-size: 13.5px; font-weight: 700; font-family: inherit;
  padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line);
  background: #fff; color: var(--ink-soft); cursor: pointer; white-space: nowrap;
}
.tab.is-active { background: var(--navy); border-color: var(--navy); color: #fff; }

.map {
  height: 46vh; min-height: 300px;
  border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.map-legend {
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 12px; color: var(--ink-soft);
  padding: 8px 4px 0;
}
.map-legend .dot {
  display: inline-block; width: 11px; height: 11px; border-radius: 50%;
  margin-right: 4px; border: 2px solid #fff; box-shadow: 0 0 2px rgba(0,0,0,.4);
  vertical-align: -1px;
}
.map-legend .dot.ok { background: var(--ok); }
.map-legend .dot.ng { background: var(--ng); }
.map-legend .dot.stay { background: #fff; border-color: var(--green); }
.stay-toggle { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; font-weight: 700; color: var(--navy); }
.stay-toggle input { width: 15px; height: 15px; accent-color: var(--navy); margin: 0 2px 0 0; }
.recent-list { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; }
.recent-list .recent-label { font-size: 12px; color: var(--ink-soft); }
.map-legend .swatch {
  display: inline-block; width: 11px; height: 11px;
  background: rgba(255, 145, 145, .85); margin-right: 4px; vertical-align: -1px;
}
.jma-now { margin: 6px 4px 0; font-size: 13px; }
.jma-now a { color: var(--green); font-weight: 700; text-decoration: none; }
.linklike { background: none; border: none; padding: 0; font: inherit; color: var(--green); font-weight: 700; cursor: pointer; }
.traveler-badge {
  /* ヒーローは淡色地なので白抜きは不可視になる(v1.9の実装ミス)。白地+緑枠で確実に読ませる */
  display: inline-block; background: #fff; border: 1.5px solid var(--green);
  color: var(--green); font-size: 12.5px; font-weight: 700; border-radius: 999px; padding: 5px 14px; margin-bottom: 12px;
  box-shadow: 0 1px 6px rgba(16, 36, 26, .08);
}
.shindan-row { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 14px; }
.shindan-row .chara-link { flex-shrink: 0; line-height: 0; }
.shindan-cta {
  display: inline-block; background: #fff; border: 1.5px solid var(--green);
  color: var(--green); font-size: 14px; font-weight: 700; border-radius: 18px; padding: 10px 20px;
  text-decoration: none; box-shadow: 0 1px 6px rgba(16, 36, 26, .08);
  word-break: keep-all; text-align: center; /* 折り返しは<wbr>位置のみ(「診断」の分断防止) */
}
.safety-card {
  margin-top: 28px; text-align: left; background: #fff; border-radius: 16px;
  box-shadow: 0 2px 12px rgba(16,36,26,.08); padding: 16px 18px;
}
.safety-card h2 { font-size: 16.5px; color: var(--navy); margin: 0 0 8px; }
.safety-card ul { margin: 0; padding-left: 18px; font-size: 13.5px; }
.safety-card li { margin: 7px 0; }
.ja-overlay {
  position: fixed; inset: 0; z-index: 10000; background: #fff; display: flex;
  flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 24px; gap: 18px;
}
.ja-overlay .ja-main { font-size: clamp(26px, 6vw, 44px); font-weight: 800; color: var(--ink); line-height: 1.6; }
.ja-overlay .ja-dest { font-size: clamp(20px, 5vw, 34px); font-weight: 800; color: var(--green); }
.ja-overlay .ja-hint { font-size: 13px; color: var(--ink-soft); max-width: 480px; }
.map-legend .sw-red { background: rgba(250, 40, 0, .8); margin-left: 6px; }
.map-legend .sw-yel { background: rgba(250, 230, 0, .85); margin-left: 6px; }
.map-legend .sw-red:first-child, .map-legend #legendHazard .sw-red { margin-left: 0; }
.list-filter {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 700; color: var(--navy); margin: 2px 0 6px; cursor: pointer;
}
.list-filter input { width: 16px; height: 16px; accent-color: var(--navy); }

/* ===== 浸水深パネル ===== */
.depth-panel {
  display: flex; gap: 14px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px; margin-top: 14px;
}
.depth-visual { flex: 0 0 96px; }
.depth-visual svg { width: 96px; height: auto; display: block; }
.depth-text h3 { margin: 0 0 4px; font-size: 16px; color: var(--navy); }
.depth-text p { margin: 0; font-size: 13.5px; }
.depth-note { color: var(--ink-soft); font-size: 11px !important; margin-top: 6px !important; }
.depth-wide {
  background: #fff7ec; border: 1px solid #f4ddbd; border-radius: 8px;
  padding: 8px 10px; color: #6b4a1e;
  font-size: 12px !important; margin-top: 8px !important;
}
.depth-panel.is-danger h3 { color: var(--ng); }

/* ===== 避難場所リスト ===== */
.list-head h3 { font-size: 16px; color: var(--navy); margin: 22px 0 4px; }
.list-head small { font-weight: 400; color: var(--ink-soft); }
.list-caution { font-size: 12px; color: var(--ink-soft); margin: 0 0 10px; }
.shelter-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.shelter {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px 14px;
  display: grid; grid-template-columns: 1fr auto; gap: 4px 10px;
  cursor: pointer;
}
.shelter.is-ng { border-left: 6px solid var(--ng); }
.shelter.is-ok { border-left: 6px solid var(--ok); }
.shelter.is-best { border: 2px solid var(--ok); border-left-width: 6px; }
.shelter.is-note { border-left: 4px solid var(--amber); background: #fff7ec; cursor: default; }
.shelter-best {
  grid-column: 1 / -1;
  font-size: 12px; font-weight: 800; color: var(--ok);
  background: rgba(0, 122, 77, .08);
  border-radius: 6px; padding: 3px 8px; justify-self: start;
}
.shelter-name { font-weight: 700; font-size: 15px; }
.shelter-dist { font-size: 13px; color: var(--ink-soft); text-align: right; white-space: nowrap; }
.shelter-muni { grid-column: 1; font-size: 11.5px; color: var(--ink-soft); }
.shelter-muni b { color: var(--green); font-weight: 800; }
.shelter-verdict { font-size: 13px; font-weight: 700; grid-column: 1 / -1; }
.shelter.is-ok .shelter-verdict { color: var(--ok); }
.shelter.is-ng .shelter-verdict { color: var(--ng); }
.shelter-flags { grid-column: 1 / -1; font-size: 11.5px; color: var(--ink-soft); }
.shelter-stay { grid-column: 1 / -1; font-size: 11.5px; color: var(--green); font-weight: 700; }
.shelter-actions { grid-column: 1 / -1; margin-top: 6px; }
.shelter-actions .btn { font-size: 12.5px; padding: 7px 12px; margin-right: 6px; }

/* ===== プランナー ===== */
.planner-lead { font-size: 15px; }
.planner-warn {
  background: rgba(224, 69, 58, .07); border: 1.5px solid rgba(224, 69, 58, .4);
  border-radius: 10px; padding: 10px 12px;
  color: var(--ng); font-size: 13.5px; font-weight: 600;
}
.planner-stay {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 12px;
  color: var(--ink-soft); font-size: 12.5px; margin: 8px 0 12px;
}
.family {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); padding: 12px 14px; margin: 0 0 12px;
  display: flex; flex-wrap: wrap; gap: 6px 16px;
}
.family legend { font-size: 13px; font-weight: 700; color: var(--navy); padding: 0 4px; }
.family label { font-size: 14px; display: flex; align-items: center; gap: 6px; }
.family input { width: 18px; height: 18px; accent-color: var(--navy); }
.meet { display: block; font-size: 13px; font-weight: 700; color: var(--navy); margin: 0 0 14px; }
.meet input {
  display: block; width: 100%; margin-top: 6px;
  font-size: 15px; font-weight: 400; padding: 11px 12px;
  border: 1.5px solid var(--line); border-radius: 10px;
}

.card-wrap { margin-top: 18px; text-align: center; }
#cardCanvas {
  width: 100%; max-width: 420px; height: auto;
  border-radius: var(--radius); box-shadow: 0 6px 24px rgba(14, 35, 56, .18);
}
.card-actions { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }
.card-hint { font-size: 12.5px; color: var(--ink-soft); }

.kit { margin-top: 22px; }
.kit h3 { font-size: 16px; color: var(--navy); margin: 0 0 8px; }
.kit ul { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.kit li { font-size: 13.5px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.kit li a { color: var(--green); text-decoration: none; font-weight: 700; white-space: nowrap; }
.kit-note { font-size: 11.5px; color: var(--ink-soft); }

/* ===== フッター ===== */
.site-foot {
  max-width: 720px; margin: 0 auto; padding: 20px 16px 40px;
  border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-soft);
}
.disclaimer {
  background: #fff7ec; border: 1px solid #f4ddbd; border-radius: 10px;
  padding: 10px 12px; color: #6b4a1e;
}
.urgent {
  display: flex; flex-direction: column; gap: 3px;
  background: rgba(217, 56, 42, .06); border: 1.5px solid rgba(217, 56, 42, .35);
  border-radius: 10px; padding: 10px 12px; margin: 0 0 10px;
  font-size: 12.5px; color: var(--ink);
}
.urgent b { color: var(--ng); }
.urgent-links a { color: var(--green); font-weight: 700; }
.credits a { color: var(--green); }

/* ヘッダーボタン群 */
.head-btns { display: flex; gap: 6px; flex: 0 1 auto; flex-wrap: wrap; justify-content: flex-end; }

/* リスク早見 */
.risk-summary {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px 14px; margin-top: 14px;
}
.risk-summary h3 { margin: 0; font-size: 15px; color: var(--navy); }
.risk-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; flex-wrap: wrap; margin-bottom: 8px;
}
.risk-head .btn-sm { font-size: 12px; padding: 6px 10px; }
.risk-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.risk-chip {
  border: 1px solid rgba(0, 0, 0, .12); border-radius: 10px;
  padding: 6px 10px; font-family: inherit; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-width: 64px; background: #eef2f5; color: var(--ink);
}
.risk-chip:disabled { cursor: default; }
.risk-chip b { font-size: 12.5px; }
.risk-chip span { font-size: 11px; font-weight: 700; }
.risk-chip.r0 { background: #eef2f5; color: var(--ink-soft); }
.risk-chip.r1 { background: #f7f5a9; }
.risk-chip.r2 { background: #ffd8c0; }
.risk-chip.r3 { background: #ffb7b7; }
.risk-chip.r4 { background: #ff9191; }
.risk-chip.r5 { background: #f285c9; }
.risk-chip.r6 { background: #dc7adc; }
.risk-chip.zy { background: #fae600; }
.risk-chip.zr { background: #e02400; color: #fff; } /* 凡例色#fa2800に近い赤。白文字AA(4.7:1)確保のため微調整 */
.risk-elev { font-size: 12px; color: var(--ink-soft); margin: 8px 0 0; }
.risk-elev b { color: var(--ink); }
.risk-note { font-size: 11.5px; color: var(--ink-soft); margin: 8px 0 0; }
.risk-zero {
  font-size: 12px; color: var(--ink-soft);
  background: #eef2f0; border-radius: 8px; padding: 6px 10px; margin: 8px 0 0;
}
.risk-none { font-size: 13px; color: var(--ink-soft); }

/* 引越し先とくらべる */
.compare {
  margin-top: 28px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}
.compare h3 { margin: 0 0 4px; font-size: 16px; color: var(--navy); }
.compare-lead { font-size: 13px; color: var(--ink-soft); margin: 0 0 10px; }
.cmp-scroll { overflow-x: auto; }
.cmp-table { border-collapse: collapse; width: 100%; min-width: 340px; margin-top: 10px; font-size: 13px; }
.cmp-table th, .cmp-table td { border: 1px solid var(--line); padding: 8px; text-align: center; }
.cmp-table thead th { background: var(--paper); color: var(--navy); font-size: 12.5px; word-break: break-all; }
.cmp-table tbody th { background: var(--paper); color: var(--ink-soft); font-weight: 700; white-space: nowrap; }
.cmp-table small { color: var(--ink-soft); }
.cmp-table .risk-chip { margin: 0 auto; }

/* FAQ */
.guide-home { margin-top: 36px; text-align: left; }
.guide-home h2 { font-size: 18px; color: var(--navy); text-align: center; margin: 0 0 10px; }
.guide-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.guide-cards a {
  display: block; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; text-decoration: none;
}
.guide-cards a b { display: block; color: var(--green); font-size: 14px; line-height: 1.45; }
.guide-cards a span { display: block; color: var(--ink-soft); font-size: 12px; margin-top: 4px; line-height: 1.55; }
.guide-more { text-align: center; font-size: 13px; margin: 10px 0 0; }
.guide-more a { color: var(--green); font-weight: 700; }
@media (max-width: 480px) { .guide-cards { grid-template-columns: 1fr; } }

.faq { margin-top: 36px; text-align: left; }
.faq h2 { font-size: 18px; color: var(--navy); text-align: center; margin: 0 0 10px; }
.faq details {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 0 14px; margin-bottom: 8px;
}
.faq summary {
  font-size: 14px; font-weight: 700; color: var(--navy);
  padding: 12px 0; cursor: pointer; list-style-position: inside;
}
.faq details p { font-size: 13.5px; margin: 0 0 12px; color: var(--ink); }

/* トースト */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(10px);
  background: var(--navy-deep); color: #fff;
  font-size: 13.5px; font-weight: 700;
  padding: 10px 18px; border-radius: 999px;
  box-shadow: 0 4px 16px rgba(14, 35, 56, .35);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 2000;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 状態切り替え */
body[data-state="result"] #hero,
body[data-state="planner"] #hero { display: none; }

@media (max-width: 480px) {
  .site-head { flex-direction: column; align-items: flex-start; gap: 0; padding-bottom: 6px; }
  .brand-tag { margin-left: 38px; margin-top: -2px; padding-top: 0; }
  /* 狭幅では<br>を効かせず自然に折り返す(実機で「〜ましょ/う。」のような折れ方になるため) */
  .hero-lead br, .hero-fact br { display: none; }
  /* つかいかた3枚は縦積み・横並びレイアウトで大きさを揃える */
  .steps { flex-direction: column; gap: 8px; }
  .steps li {
    flex-direction: row; justify-content: flex-start; text-align: left;
    min-width: 0; width: 100%; padding: 10px 14px; font-size: 13px;
  }
  .steps b { flex: 0 0 auto; }
}
@media (max-width: 400px) {
  .kit ul { grid-template-columns: 1fr; }
  .depth-visual { flex-basis: 80px; }
}

/* ===== 使いやすさ改善(2026-09-09): 主要CTAのタップ領域44px級・警報リンクの押しやすさ・リスト段階表示 ===== */
.shelter .act-plan { font-size: 14px; padding: 13px 14px; width: 100%; }
.jma-now a, .jma-now .linklike { display: inline-block; padding: 8px 0; }
.show-more { list-style: none; text-align: center; }
.show-more button {
  width: 100%; background: #fff; color: var(--green); font-weight: 700; font-size: 14px;
  border: 1.5px solid var(--green); border-radius: 12px; padding: 12px; cursor: pointer;
}

/* 言語切替(外国語ページのヘッダー右端。旅行者が自分の言語に1タップで移れるように) */
.lang-sw { position: absolute; right: max(12px, calc(50vw - 348px)); top: 50%; transform: translateY(-50%); font-size: 12px; display: flex; gap: 10px; }
.lang-sw a { color: #d7ece1; text-decoration: underline; text-underline-offset: 2px; padding: 8px 0; }
.lang-sw b { color: #fff; padding: 8px 0; }
