/* 地震の裏方 — scenario.html 専用スタイル
   style.css の変数・.block/.plain-link/.empty-note/.region-note/.scenario-desc/.scenario-disclaimer-full を
   そのまま流用し、このファイルでは巨大地震想定マップ固有のUIだけを追加する。
   色は既存の --lv-red/--lv-orange/--lv-yellow（style.css）に、震度7・津波20m以上用の深赤(--scn-c-s7)と
   震度5弱用の淡黄(--scn-c-s5m)だけを追加した5段階スケール。地図のfill-color（scenario.js）と完全一致させること。 */

:root {
  --scn-c-s7:  #c92a1f;  /* 深赤：震度7 / 津波20m以上 / 津波到達10分以内 */
  --scn-c-s6p: #ee564c;  /* 赤　：震度6強 / 津波10〜20m / 到達10〜20分（= --lv-red と同値） */
  --scn-c-s6m: #e2812b;  /* 橙　：震度6弱 / 津波5〜10m / 到達20〜30分（= --lv-orange と同値） */
  --scn-c-s5p: #d8b02c;  /* 黄　：震度5強 / 津波〜5m / 到達30〜60分（= --lv-yellow と同値） */
  --scn-c-s5m: #e8dc9a;  /* 淡黄：震度5弱 */
  --scn-c-green: #3f9160; /* 緑　：津波到達60分超（データありの中で最も猶予がある層） */
  --scn-c-green-text: #86d6a4;
}

/* このページはボトムナビが無いため、bottom-nav分の余白を詰める */
body.scn-page main { padding: 14px 14px 20px; }
body.scn-page footer.site-footer { padding: 14px 16px calc(20px + var(--safe-bottom)); }

/* ---- タブ／モード切替 ---- */
.scn-controls-block { margin-bottom: 18px; }
.scn-tab-row,
.scn-mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.scn-tab-row { margin-bottom: 8px; }

.scn-tab,
.scn-mode {
  flex: 1 1 auto;
  min-width: 0;
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-panel-2);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  padding: 9px 10px;
  border-radius: 999px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.scn-tab.active,
.scn-mode.active {
  color: var(--text);
  background: rgba(85, 128, 184, 0.16);
  border-color: var(--accent);
}
.scn-mode[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}
#scn-mode-note {
  margin-top: 6px;
  transition: opacity 0.15s ease;
}
#scn-mode-note[hidden] { display: none; }

/* ---- 全国マップ ---- */
.scn-map-wrap {
  position: relative;
  width: 100%;
  height: 48vh;
  min-height: 300px;
  max-height: 460px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--map-ocean);
  overflow: hidden;
}
.scn-maplibre-map {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
}
.scn-map-loading {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--map-ocean);
  color: var(--text-faint);
  font-size: 12px;
}
.scn-map-loading[hidden] { display: none; }
.scn-map-loading-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: scn-map-loading-pulse 1s ease-in-out infinite;
}
@keyframes scn-map-loading-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .scn-map-loading-dot { animation: none; opacity: 0.7; }
}
.scn-map-failed {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  background: var(--map-ocean);
  color: var(--text-faint);
  font-size: 12.5px;
  line-height: 1.7;
}
.scn-map-failed[hidden] { display: none; }

/* 凡例：地図左下に常設オーバーレイ */
.scn-legend {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  gap: 5px 9px;
  max-width: calc(100% - 16px);
  padding: 7px 9px;
  border-radius: 9px;
  background: rgba(10, 13, 18, 0.78);
  border: 1px solid var(--border);
  backdrop-filter: blur(2px);
}
.scn-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}
.scn-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: 0 0 auto;
}
.scn-swatch--s7  { background: var(--scn-c-s7); }
.scn-swatch--s6p { background: var(--scn-c-s6p); }
.scn-swatch--s6m { background: var(--scn-c-s6m); }
.scn-swatch--s5p { background: var(--scn-c-s5p); }
.scn-swatch--s5m { background: var(--scn-c-s5m); }
.scn-swatch--green { background: var(--scn-c-green); }
.scn-swatch--none {
  background: transparent;
  border: 1px dashed var(--text-faint);
}

/* ---- 詳細パネル（地図タップ／一覧タップで表示） ---- */
.scn-detail-panel {
  margin-top: 10px;
  padding: 12px 12px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--bg-panel);
  box-shadow: var(--card-inner-glow);
  min-height: 44px;
}
.scn-detail-name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 9px;
  padding-left: 9px;
  border-left: 2px solid var(--accent);
}
.scn-detail-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 8px;
}
.scn-detail-note {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 8px;
}

/* ---- 詳細パネル：特大数字（主役の指標） ---- */
.scn-detail-hero {
  padding: 10px 4px 12px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.scn-detail-hero-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 2px;
}
.scn-detail-hero-value {
  font-size: 48px;
  font-weight: 800;
  line-height: 1.05;
  margin: 0;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.scn-detail-hero-value--none {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-faint);
}
.scn-detail-hero-unit {
  font-size: 21px;
  font-weight: 700;
  margin-left: 3px;
  color: var(--text-muted);
}
.scn-detail-hero-note {
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.6;
  margin: 7px 0 0;
}
.scn-detail-hero-value.scn-hv--s7  { color: #ff9a90; }
.scn-detail-hero-value.scn-hv--s6p { color: var(--lv-red); }
.scn-detail-hero-value.scn-hv--s6m { color: var(--lv-orange); }
.scn-detail-hero-value.scn-hv--s5p { color: var(--lv-yellow); }
.scn-detail-hero-value.scn-hv--s5m { color: var(--scn-c-s5m); }
.scn-detail-hero-value.scn-hv--green { color: var(--scn-c-green-text); }

/* ---- 詳細パネル：想定される被害（最大ケース） ---- */
.scn-detail-damage {
  margin: 2px 0 10px;
  padding: 10px 11px;
  border-radius: 8px;
  background: var(--bg-panel-2);
}
.scn-detail-damage-heading {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  margin: 0 0 7px;
}
.scn-detail-damage-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}
.scn-detail-damage-row .scn-dd-label {
  font-size: 11.5px;
  color: var(--text-muted);
  flex: 0 0 auto;
}
.scn-detail-damage-row .scn-dd-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  text-align: right;
}
.scn-detail-damage-case {
  font-size: 10.5px;
  color: var(--text-faint);
  line-height: 1.55;
  margin: 0 0 8px;
}
.scn-detail-damage-source {
  font-size: 10.5px;
  color: var(--text-faint);
  line-height: 1.55;
  margin: 0;
}

/* チップ（一覧・詳細パネル共通）。既存 .warning-chip / .scenario-chip と同じ「淡色背景×濃色文字」の作法 */
.scn-chip {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.scn-chip--s7  { color: #ffcfc9; background: rgba(201, 42, 31, 0.22); box-shadow: 0 0 0 1px rgba(201, 42, 31, 0.32) inset; }
.scn-chip--s6p { color: var(--lv-red);    background: var(--lv-red-bg);    box-shadow: 0 0 0 1px rgba(238, 86, 76, 0.22) inset; }
.scn-chip--s6m { color: var(--lv-orange); background: var(--lv-orange-bg); box-shadow: 0 0 0 1px rgba(226, 129, 43, 0.2) inset; }
.scn-chip--s5p { color: var(--lv-yellow); background: var(--lv-yellow-bg); box-shadow: 0 0 0 1px rgba(216, 176, 44, 0.18) inset; }
.scn-chip--s5m { color: var(--scn-c-s5m); background: rgba(232, 220, 154, 0.14); box-shadow: 0 0 0 1px rgba(232, 220, 154, 0.22) inset; }
.scn-chip--green { color: var(--scn-c-green-text); background: rgba(63, 145, 96, 0.16); box-shadow: 0 0 0 1px rgba(63, 145, 96, 0.26) inset; }
.scn-chip--none { color: var(--text-faint); background: var(--bg-panel-2); box-shadow: 0 0 0 1px var(--border) inset; }

/* ---- 都道府県別一覧 ---- */
.scn-pref-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.scn-pref-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-panel);
  cursor: pointer;
}
.scn-pref-item:hover,
.scn-pref-item:focus-visible {
  border-color: var(--accent);
  outline: none;
}
.scn-pref-item.is-selected {
  border-color: var(--accent);
  background: rgba(85, 128, 184, 0.09);
}
.scn-pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.scn-pref-name {
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.scn-pref-extra {
  font-size: 10.5px;
  color: var(--text-faint);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- この想定で起こりうること ---- */
.scn-happens-card {
  padding: 10px 12px;
  margin-bottom: 8px;
  border-left: 3px solid var(--border);
  border-radius: 0 8px 8px 0;
  background: var(--bg-panel-2);
}
.scn-happens-card--s5p { border-left-color: var(--scn-c-s5p); }
.scn-happens-card--s6m { border-left-color: var(--scn-c-s6m); }
.scn-happens-card--s6p { border-left-color: var(--scn-c-s6p); }
.scn-happens-card--s7  { border-left-color: var(--scn-c-s7); }
.scn-happens-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px;
}
.scn-happens-body {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.65;
  margin: 0;
}
#scn-happens-tsunami[hidden] { display: none; }

/* ---- レスポンシブ：狭い画面ではタブ文字を少し詰める ---- */
@media (max-width: 360px) {
  .scn-tab, .scn-mode { font-size: 11.5px; padding: 8px 6px; }
  .scn-detail-name { font-size: 13.5px; }
}
