/* 防災モニター v2 スタイル定義 */

:root {
  --bg: #0f1419;
  --panel: rgba(23, 29, 36, 0.82);
  --panel-solid: #171d24;
  --text: #e8edf2;
  --text-dim: #8b98a5;
  --accent: #4da3ff;
  --border: #2a3542;
  --danger: #ff2800;
  --warn: #ff9900;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

html[data-theme="light"] {
  --bg: #f2f4f7;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-solid: #ffffff;
  --text: #1a2330;
  --text-dim: #5b6875;
  --accent: #0b6bcb;
  --border: #dde3ea;
  --shadow: 0 8px 24px rgba(20, 30, 40, 0.12);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", sans-serif;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ===== ヘッダー ===== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  min-height: 52px;
  padding: 0 16px;
  background: var(--panel);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
}

.logo-mark { color: var(--accent); font-size: 14px; }

.demo-badge {
  background: var(--warn);
  color: #1a2330;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.05em;
}

.header-right { display: flex; align-items: center; gap: 12px; }

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background 0.15s;
}
.icon-btn:hover { background: rgba(128, 128, 128, 0.15); }
.icon-btn.small { width: 26px; height: 26px; font-size: 11px; }

.text-btn {
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 8px;
}
.text-btn:hover { background: rgba(77, 163, 255, 0.12); }

.theme-light-icon { display: none; }
html[data-theme="light"] .theme-dark-icon { display: none; }
html[data-theme="light"] .theme-light-icon { display: inline; }

.sound-off-icon { display: inline; }
.sound-on-icon { display: none; }
#sound-toggle[aria-pressed="true"] .sound-on-icon { display: inline; }
#sound-toggle[aria-pressed="true"] .sound-off-icon { display: none; }

.conn-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-dim);
}
.conn-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #5b6875;
}
.conn-dot[data-state="connected"] { background: #2ecc71; box-shadow: 0 0 6px #2ecc71; }
.conn-dot[data-state="connecting"] { background: #f1c40f; }
.conn-dot[data-state="disconnected"] { background: #ff2800; }

.clock {
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  min-width: 70px;
  text-align: right;
}

/* ===== モードタブバー ===== */
.mode-tabbar {
  display: flex;
  gap: 4px;
  padding: 6px 12px;
  background: var(--panel);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 990;
  overflow-x: auto;
  scrollbar-width: none;
}
.mode-tabbar::-webkit-scrollbar { display: none; }

.mode-tab {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  padding: 6px 14px;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.mode-tab:hover { background: rgba(128, 128, 128, 0.12); color: var(--text); }
.mode-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ===== モード別パネルの排他表示 ===== */
.mode-panel { display: none !important; }
body[data-mode="quake"] .mode-quake { display: block !important; }
body[data-mode="tsunami"] .mode-tsunami { display: block !important; }
body[data-mode="warning"] .mode-warning { display: block !important; }
body[data-mode="radar"] .mode-radar { display: block !important; }
body[data-mode="typhoon"] .mode-typhoon { display: block !important; }
body[data-mode="wind"] .mode-wind { display: block !important; }
body[data-mode="forecast"] .mode-forecast { display: block !important; }
/* hidden属性はモード表示より優先（specificityを上げる） */
body[data-mode] .mode-panel[hidden],
body[data-mode] .mode-panel[hidden] * { display: none !important; }

/* ===== レイアウト ===== */
.main-layout {
  flex: 1;
  display: flex;
  min-height: 0;
}

.side-panel {
  width: 340px;
  min-width: 340px;
  background: var(--panel);
  backdrop-filter: blur(12px);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 12px;
  z-index: 900;
}

.side-panel-handle { display: none; }

/* AP: スクロール可能領域のスクロールバー非表示（スクロール機能は維持） */
.side-panel, .side-panel-scroll, .quake-history, .settings-panel {
  scrollbar-width: none;         /* Firefox */
  -ms-overflow-style: none;      /* 旧Edge/IE */
}
.side-panel::-webkit-scrollbar,
.side-panel-scroll::-webkit-scrollbar,
.quake-history::-webkit-scrollbar,
.settings-panel::-webkit-scrollbar { display: none; }  /* Chrome/Safari */

/* AO-5: 雨雲タブでは右下の時間スライダーとズームコントロールが重ならないよう持ち上げる */
body[data-mode="radar"] .leaflet-bottom.leaflet-right .leaflet-control-zoom {
  margin-bottom: 96px;
}

.card {
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  letter-spacing: 0.02em;
  gap: 8px;
}

.placeholder {
  color: var(--text-dim);
  font-size: 13px;
  margin: 0;
}

/* ===== 地図エリア ===== */
.map-area {
  flex: 1;
  position: relative;
  min-width: 0;
}

#map {
  position: absolute;
  inset: 0;
  background: var(--bg);
}

.leaflet-container { background: var(--bg); }

/* ===== CB: 地震タブの2画面レイアウト（Electron版のみ） ===== */
.map-split {
  position: absolute;
  inset: 0;
  display: flex;
}
.map-pane { position: relative; height: 100%; min-width: 0; }
/* CM: 2画面の分割線をはっきり見せる（境界が分かりにくいという指摘への対応） */
.kmoni-pane {
  flex: 0 0 50%;
  background: var(--bg);
  border-right: 3px solid var(--accent);
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.45);
  z-index: 2;
}
.main-pane { flex: 1 1 auto; }
#kmoni-map { position: absolute; inset: 0; }
.kmoni-pane-label {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 850;
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  pointer-events: none;
}
@media (max-width: 900px) {
  /* モバイル/狭幅では2画面を強制的に無効化（Electronの最小ウィンドウ幅は900pxのため通常は非該当） */
  .kmoni-pane { display: none !important; }
  .main-pane { flex: 1 1 100% !important; }
}

/* CS: 長周期地震動カード */
.ltpgm-row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.ltpgm-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 12px;
  flex-shrink: 0;
}
.ltpgm-areas { font-size: 12px; line-height: 1.6; }

/* CQ: 振動レベル（リアルタイム震度）パネル — 強震モニタのマップ左下 */
.kmoni-level-panel {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 880;
  min-width: 190px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 9px;
  box-shadow: var(--shadow);
  pointer-events: none;
}
.kmoni-level-title { font-size: 10px; color: var(--text-dim); margin-bottom: 5px; }
.kmoni-level-bar {
  height: 9px;
  border-radius: 3px;
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.kmoni-level-bar span {
  font-size: 8px;
  color: #fff;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.9);
  padding: 0 3px;
}
.kmoni-level-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  line-height: 1.7;
}
.kmoni-level-label { color: var(--text-dim); min-width: 46px; }
.kmoni-level-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.kmoni-level-val { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
/* DD: リアルタイム加速度(Gal) */
.kmoni-level-gal { font-variant-numeric: tabular-nums; min-width: 56px; text-align: right; color: var(--accent); font-size: 10px; }
.kmoni-level-station { color: var(--text-dim); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kmoni-level-time { float: right; font-variant-numeric: tabular-nums; }
.kmoni-level-note { margin-top: 5px; font-size: 9px; color: var(--text-dim); line-height: 1.4; }
/* 地震タブ以外では非表示（1画面時にメインマップへ付いている場合の保険） */
body:not([data-mode="quake"]) .kmoni-level-panel { display: none; }

/* CL: 表示を初期状態に戻すボタン（地図右下、ズームコントロールの上） */
.map-reset-btn {
  position: absolute;
  right: 10px;
  bottom: 86px;
  z-index: 900;
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
}
.map-reset-btn:hover { border-color: var(--accent); color: var(--accent); }

/* DL: 地震履歴の手動更新 */
.quake-history-refresh-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 6px 0 4px;
}
.quake-history-refresh-row .placeholder { font-size: 10px; margin: 0; }
#quake-history-refresh.loading { opacity: 0.5; pointer-events: none; }
/* 雨雲レーダータブはスライダーがあるためさらに上へ退避 */
body[data-mode="radar"] .map-reset-btn { bottom: 150px; }

/* 県名ラベル（白地図） */
.pref-label {
  background: transparent;
  border: none;
  text-align: center;
  pointer-events: none;
}
.pref-label span {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-shadow: 0 0 4px var(--bg), 0 0 4px var(--bg);
  white-space: nowrap;
}

/* 震度バッジ（NHK風・地図/パネル/履歴共通） */
.int-badge {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  font-variant-numeric: tabular-nums;
}
.int-badge-wrap { background: transparent; border: none; }
.int-badge.map-badge {
  width: 14px;
  height: 14px;
  font-size: 9px;
  margin: 3px;
  transition: width 0.15s, height 0.15s, font-size 0.15s;
}
.badge-large .int-badge.map-badge {
  width: 20px;
  height: 20px;
  font-size: 12px;
  margin: 0;
}

/* ===== EEWバナー ===== */
.eew-banner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  padding: 10px 20px;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.eew-banner.level-warning { background: linear-gradient(135deg, #c00000, #7a0000); }
/* CJ: 緊急地震速報（予報）は黄色（サイドのカードと同色に統一）。背景が明るいため文字は黒系にする */
.eew-banner.level-forecast {
  background: linear-gradient(135deg, #ffe600, #f0b400);
  color: #1a2330;
  text-shadow: none;
}
.eew-banner.level-forecast .eew-banner-areas { color: #4a3c00; }
.eew-banner.level-forecast .eew-banner-areas.yellow { color: #4a3c00; }
.eew-banner.level-cancel { background: linear-gradient(135deg, #444, #222); }

.eew-banner-top {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
}
.eew-blink { animation: blink-mark 1s steps(1) infinite; }
@keyframes blink-mark {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.25; }
}
.eew-banner-detail {
  margin-top: 5px;
  font-size: 13px;
  font-weight: 400;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.eew-banner-areas {
  margin-top: 5px;
  font-size: 12px;
  font-weight: 400;
  color: #f2d9d9;
}
.eew-banner-areas.yellow { color: #ffe98a; }
.eew-note { font-size: 10px; opacity: 0.8; }

/* ===== EEWカード ===== */
/* CJ: 警報=赤 / 予報=黄。従来は種別によらず常に赤だったため、予報でもサイドが赤く見えていた */
.eew-card {
  border-color: #c00000;
  background: linear-gradient(160deg, rgba(192, 0, 0, 0.16), var(--panel-solid) 60%);
}
.eew-card.level-forecast {
  border-color: #f0b400;
  background: linear-gradient(160deg, rgba(255, 230, 0, 0.16), var(--panel-solid) 60%);
}

/* CI: 警報タブのデータ鮮度表示 */
.warning-status-note {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ===== 地震カード ===== */
.quake-headline {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}
.quake-int-badge {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  flex-shrink: 0;
  border: 2px solid rgba(128, 128, 128, 0.35);
}
.quake-headline-text .quake-place { font-size: 16px; font-weight: 700; }
.quake-headline-text .quake-time {
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.quake-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  font-size: 13px;
}
.quake-detail-grid .k { color: var(--text-dim); }
.quake-tsunami-comment {
  margin-top: 10px;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(77, 163, 255, 0.1);
  color: var(--text);
}

/* ===== 津波カード ===== */
.tsunami-card { border-color: var(--danger); }
.tsunami-area-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.tsunami-area-row:last-child { border-bottom: none; }
.tsunami-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.tsunami-grade-major { animation: blink-mark 1s steps(1) infinite; }
.tsunami-blink { animation: tsunami-path-blink 1s ease-in-out infinite; }
@keyframes tsunami-path-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ===== 台風カード / ミニカード ===== */
.typhoon-mini-card {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 12px;
  box-shadow: var(--shadow);
  z-index: 800;
  min-width: 160px;
}
.typhoon-mini-card .name { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.typhoon-card-row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.typhoon-card-row .k { color: var(--text-dim); }

/* AQ: 複数台風の選択リスト */
#typhoon-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.typhoon-list-item {
  background: rgba(128, 128, 128, 0.08);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}
.typhoon-list-item:hover { background: rgba(128, 128, 128, 0.16); }
.typhoon-list-item.selected {
  background: rgba(77, 163, 255, 0.16);
  border-color: var(--accent);
  font-weight: 700;
}
.typhoon-list-item .cat { color: var(--text-dim); font-size: 11px; margin-left: 4px; }

/* ===== 地震履歴 ===== */
.quake-history-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.quake-history-filter-row select { flex: 1; }
.quake-history {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 42vh;
  overflow-y: auto;
}
.quake-history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 12.5px;
  border-radius: 6px;
}
.quake-history-item:hover { background: rgba(128, 128, 128, 0.1); }
.quake-history-item.selected {
  background: rgba(77, 163, 255, 0.14);
  outline: 1px solid var(--accent);
}
.quake-history-item:last-child { border-bottom: none; }
.quake-history-badge {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.quake-history-info { flex: 1; min-width: 0; }
.quake-history-place { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quake-history-meta { color: var(--text-dim); font-variant-numeric: tabular-nums; font-size: 11px; }

/* ===== 天気予報 ===== */
.area-select {
  background: var(--panel-solid);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  padding: 3px 6px;
  max-width: 170px;
}
.forecast-days { display: flex; gap: 8px; }
.forecast-day {
  flex: 1;
  text-align: center;
  padding: 8px 4px;
  background: rgba(128, 128, 128, 0.06);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.forecast-day .d-label { font-size: 11px; color: var(--text-dim); }
.forecast-day .d-icon { font-size: 26px; margin: 4px 0; }
.forecast-day .d-temp { font-size: 12px; }
.forecast-day .d-pop { font-size: 11px; color: var(--accent); }

/* ===== AM: 現在地の降水量予測（雨雲タブ） ===== */
.precip-updated { font-size: 11px; color: var(--text-dim); margin-bottom: 8px; }
.precip-group { margin-bottom: 10px; }
.precip-group-title { font-size: 11px; color: var(--text-dim); margin-bottom: 4px; }
.precip-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 80px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
}
.precip-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.precip-bar { width: 100%; border-radius: 2px 2px 0 0; min-height: 1px; }
.precip-bar-label { font-size: 8.5px; color: var(--text-dim); margin-top: 2px; white-space: nowrap; }
.precip-bar-val { font-size: 8.5px; margin-bottom: 1px; white-space: nowrap; }

/* ===== AN: 地点クエリカード（雨雲/天気/気温/風タブ） ===== */
.point-query-card {
  position: absolute;
  left: 14px;
  top: 14px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 12px;
  box-shadow: var(--shadow);
  z-index: 810;
  width: 240px;
  max-width: calc(100vw - 28px);
}
.point-query-card .pq-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; }
.point-query-card .pq-coord { color: var(--text-dim); font-size: 11px; font-variant-numeric: tabular-nums; }
.point-query-card .pq-close { background: none; border: none; color: var(--text-dim); font-size: 14px; cursor: pointer; padding: 0 2px; }
.point-query-card .pq-main { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.point-query-card .pq-icon { font-size: 28px; }
.point-query-card .pq-temp { font-size: 20px; font-weight: 700; }
.point-query-card .pq-stats { display: flex; flex-wrap: wrap; gap: 6px 10px; font-size: 11.5px; margin-bottom: 6px; }
.point-query-card .pq-stats .pq-primary { font-weight: 700; color: var(--accent); }
.point-query-card svg.pq-chart { width: 100%; height: 70px; display: block; }

/* AX: 区域別震度のグループ表記（震度6強：宮城県中部・宮城県南部…） */
.quake-scale-groups { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.quake-scale-group-row { display: flex; align-items: flex-start; gap: 6px; font-size: 12px; }
.scale-group-badge {
  flex-shrink: 0;
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.scale-group-names { line-height: 1.5; }

/* ===== 凡例 ===== */
.legend {
  position: absolute;
  left: 14px;
  bottom: 14px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 11px;
  box-shadow: var(--shadow);
  z-index: 800;
}
.legend-title { font-weight: 700; margin-bottom: 6px; color: var(--text-dim); }
.legend-scale { display: flex; gap: 4px; flex-wrap: wrap; max-width: 220px; }
.legend-chip {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
}
.legend-tsunami { display: flex; flex-direction: column; gap: 4px; }
.legend-tsunami-row { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.legend-tsunami-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ===== 右下コントロール（レーダー） ===== */
.map-controls-bottom-right {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 800;
}
.radar-slider-panel {
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  box-shadow: var(--shadow);
  width: 280px;
}
.radar-time-label {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}
.radar-slider-row { display: flex; align-items: center; gap: 8px; }
#radar-slider { flex: 1; }

.layer-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  font-weight: 400;
}
.layer-toggle.small { font-size: 11px; }

/* ===== 風矢印 ===== */
.wind-arrow-wrap { background: transparent; border: none; }
.wind-arrow {
  width: 34px;
  height: 34px;
  transform-origin: center;
  opacity: 0.9;
}

/* ===== Leafletポップアップ・attributionのテーマ対応 ===== */
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--panel-solid);
  color: var(--text);
}
.leaflet-control-attribution {
  background: var(--panel) !important;
  color: var(--text-dim) !important;
  backdrop-filter: blur(6px);
}
.leaflet-control-attribution a { color: var(--accent) !important; }
html[data-theme="dark"] .leaflet-bar a {
  background: var(--panel-solid);
  color: var(--text);
  border-color: var(--border);
}

/* ===== EEW地図マーカー ===== */
.eew-epicenter-mark {
  color: var(--danger);
  font-size: 26px;
  font-weight: 900;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
  animation: pulse-mark 1.2s ease-in-out infinite;
}
@keyframes pulse-mark {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}

/* ===== モバイル ===== */
@media (max-width: 900px) {
  .main-layout { position: relative; }
  .side-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: auto;
    min-width: 0;
    height: 44vh;
    max-height: 80vh;
    border-right: none;
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    z-index: 950;
    padding-top: 6px;
    transition: height 0.2s ease;
    touch-action: none;
  }
  .side-panel.collapsed { height: 86px; }
  .side-panel-handle {
    display: block;
    width: 44px;
    height: 5px;
    border-radius: 3px;
    background: var(--border);
    margin: 4px auto 8px;
  }
  .side-panel-scroll {
    overflow-y: auto;
    height: calc(100% - 20px);
    padding: 0 12px 12px;
  }
  .map-area { position: absolute; inset: 0; }
  .typhoon-mini-card { top: 10px; right: 10px; font-size: 11px; }
  .legend { left: 8px; bottom: 8px; padding: 8px; }
  .map-controls-bottom-right { right: 8px; bottom: 8px; }
  .radar-slider-panel { width: 220px; }

  .app-header { padding: 0 8px; }
  .logo { font-size: 13px; gap: 6px; }
  .header-right { gap: 6px; }
  .conn-label { display: none; }
  .clock { font-size: 12px; min-width: 56px; }
  .icon-btn { width: 28px; height: 28px; font-size: 13px; }
  .demo-badge { font-size: 9px; padding: 1px 5px; }
  .mode-tabbar { padding: 4px 8px; }
  .mode-tab { font-size: 12px; padding: 5px 10px; }
}

@media (max-width: 420px) {
  .logo-text { display: none; }
}

/* ===== v4: 設定モーダル ===== */
.settings-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.settings-modal[hidden] { display: none; }
.settings-panel {
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  width: 420px;
  max-width: 92vw;
  max-height: 84vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.settings-header h2 { margin: 0; font-size: 16px; }
.settings-panel h3 {
  font-size: 13px;
  color: var(--text-dim);
  margin: 14px 0 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}
.settings-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 5px 0;
  cursor: pointer;
}
.settings-loc-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }

/* AT: 登録地域リスト */
.place-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.place-row .place-name { width: 110px; }
.place-row .place-pref { max-width: 100px; }
.place-row .place-clear { color: var(--danger); }

/* AT: 登録地域の菱形マーカー（現在地の青丸と区別できる橙色） */
.place-diamond {
  width: 10px;
  height: 10px;
  background: #ff9900;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  transform: rotate(45deg);
}

/* ===== v5: EEWミニマップ ===== */
#eew-minimap-wrap {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 200px;
  height: 150px;
  z-index: 1090;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--bg);
}
#eew-minimap { width: 100%; height: 100%; }
@media (max-width: 900px) {
  #eew-minimap-wrap { width: 130px; height: 98px; top: auto; bottom: 8px; right: 8px; }
}

/* ===== v6: 台風予報円の日時ラベル ===== */
.typhoon-time-label { background: transparent; border: none; pointer-events: none; text-align: center; }
.typhoon-time-label span {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-shadow: 0 0 3px var(--bg), 0 0 3px var(--bg);
  white-space: nowrap;
}

/* ===== v5: 気温分布 都市ラベル ===== */
.temp-city-label { background: transparent; border: none; pointer-events: none; }
.temp-city-label span {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  background: var(--panel);
  padding: 1px 5px;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ===== v5: 天気/気温サブトグル（震度モードトグルと同スタイル） ===== */
.forecast-sub-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 11px;
  padding: 3px 10px;
  font-family: inherit;
}
.forecast-sub-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.forecast-weather-only[hidden], .forecast-temp-only[hidden] { display: none !important; }

/* ===== v4: 震度分布モードトグル ===== */
.quake-mode-toggle { display: flex; gap: 4px; }
.quake-mode-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 11px;
  padding: 3px 10px;
  font-family: inherit;
}
.quake-mode-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ===== v4: 電離圏モニタ ===== */
.iono-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  margin-top: 6px;
}
.iono-name { width: 44px; flex-shrink: 0; }
.iono-bar-track {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: rgba(128, 128, 128, 0.15);
  overflow: hidden;
}
.iono-bar { height: 100%; border-radius: 4px; transition: width 0.4s; }
.iono-score { width: 26px; text-align: right; font-variant-numeric: tabular-nums; }
.iono-detail { font-size: 10px; color: var(--text-dim); margin: 1px 0 0 52px; }
.iono-disclaimer {
  margin-top: 10px;
  font-size: 10px;
  color: var(--text-dim);
  border-top: 1px dashed var(--border);
  padding-top: 6px;
  line-height: 1.5;
}
