html, body {
  height: 100%;
  height: 100dvh;
  margin: 0;
  background-color: rgb(100, 100, 100);
  font-family: "Hiragino Sans", "Noto Sans JP", sans-serif;
}

/* 巡回が一周して日本全体表示に戻る瞬間は、それまでズームインして1つずつ
   見せていた警報エリアが一気に画面内に収まり、MapLibreが多数のポリゴンを
   同時にラスタライズすることになる。ラズパイ3B+はソフトウェアレンダリング
   (SwiftShader、GPUドライバの不安定さを避けるため意図的に無効化している。
   qzss-kiosk@.serviceのコメント参照)のため、大雨などで同時にアクティブな
   警報が多い時にこの一気の再描画でキオスクが落ちることがある。
   カメラを動かす瞬間だけこのマスクで地図を覆い隠すことで、再描画が
   一度に集中する様子を画面に出さないようにする(処理そのものを軽くする
   わけではないが、真っ黒な画面のまま固まって見えるより「読み込み中」に
   見え、かつJS側の他の更新(パネル再描画等)をこの間に後ろへずらして
   同じフレームに集中させない=処理を分散させる効果もある)
*/
#patrol_transition_mask {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgb(100, 100, 100);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
#patrol_transition_mask.is-active {
  opacity: 1;
}

.panel {
  position: fixed;
  /* iOSのノッチ/ステータスバーとPWAのホームインジケーターに重ならないよう、
     safe-area-inset分を確保する(非対応環境では単純に12px/24pxになる)。 */
  top: calc(12px + env(safe-area-inset-top));
  left: calc(12px + env(safe-area-inset-left));
  z-index: 1000;
  width: 340px;
  max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow-y: auto;
  background: rgba(20, 22, 26, 0.88);
  backdrop-filter: blur(6px);
  border-radius: 12px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  color: azure;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

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

.satellite-info {
  font-size: 11px;
  color: #9aa0a6;
  padding: 4px 14px 0;
}

/* 同時に多数の警報が出ている時、日本全体表示では地図上に軽いマーカーの
   代表N件しか出さない(ラズパイの負荷対策)。省略していることに気付け
   ないと「なぜか地図に出ていない警報がある」と誤解されるため、その旨を
   常時表示のバナーで知らせる */
.idle-overview-notice {
  font-size: 11.5px;
  line-height: 1.4;
  color: #ffd166;
  background: rgba(255, 209, 102, 0.12);
  border: 1px solid rgba(255, 209, 102, 0.35);
  border-radius: 6px;
  margin: 6px 14px 0;
  padding: 6px 8px;
}
.idle-overview-notice[hidden] {
  display: none;
}

.settings-link {
  font-size: 16px;
  text-decoration: none;
  opacity: 0.75;
  line-height: 1;
}
.settings-link:hover {
  opacity: 1;
}

.notify-button {
  font-size: 12px;
  font-weight: bold;
  line-height: 1;
  padding: 4px 10px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.12);
  color: #9aa0a6;
  transition: background-color 0.15s, color 0.15s;
}
.notify-button:hover { background: rgba(255, 255, 255, 0.2); }
.notify-button.notify-on {
  background: rgba(46, 204, 113, 0.18);
  color: #2ecc71;
}
.notify-button.notify-on:hover { background: rgba(46, 204, 113, 0.28); }
.notify-button:disabled { opacity: 0.35; cursor: default; }
.notify-button:disabled:hover { background: rgba(255, 255, 255, 0.12); }

.clock {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
  color: azure;
}

.status-pill {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: bold;
}
.status-online {
  background: rgba(46, 204, 113, 0.18);
  color: #2ecc71;
}
.status-offline {
  background: rgba(231, 76, 60, 0.18);
  color: #e74c3c;
}
.status-reconnecting {
  background: rgba(241, 196, 15, 0.18);
  color: #f1c40f;
}

#events_container {
  display: flex;
  flex-direction: column;
  /* カード3件分程度の目安の高さで切り、それを超えた分はスクロールさせる
     (Web版のみ。キオスクは操作できる人がいないため、代わりにJS側で
     ページ送りする=is-kioskクラスでスクロール自体を無効化する) */
  max-height: 480px;
  overflow-y: auto;
}
/* スマホ幅は画面自体が小さく、480pxはおろか700pxにするとパネルだけで
   画面が埋まってしまう(スマホは元々パネルが上部に幅いっぱいで出る
   レイアウト)。デスクトップ幅だけ、文章が長いカードでも3件が
   スクロール無しで収まるよう高さを広げる */
@media (min-width: 701px) {
  #events_container {
    max-height: 700px;
  }
}
body.is-kiosk #events_container {
  overflow-y: hidden;
}

.panel-page-indicator {
  text-align: center;
  font-size: 11px;
  color: #9aa0a6;
  padding: 6px 0 2px;
}

.panel-group-next {
  display: block;
  margin: 8px 0 0 auto;
  padding: 3px 8px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #d5dbe3;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.report-card {
  padding: 14px 14px 14px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 4px solid #666;
}
.report-card:last-child {
  border-bottom: none;
}
/* カード左端の色帯。緊急度が一目でわかるようにする(バッジの色と対応) */
.report-card.sev-emergency { border-left-color: #ff4433; }
.report-card.sev-warning   { border-left-color: #f0a83c; }
.report-card.sev-caution   { border-left-color: #e0c437; }
.report-card.sev-info      { border-left-color: #4c8bf5; }
.report-card.sev-training  { border-left-color: #9c7fe0; }
.report-card.sev-error     { border-left-color: #888; }
.report-card.sev-cancel,
.report-card.sev-resolved  { border-left-color: #555; }
.report-card.sev-keihou    { border-left-color: #ff5c5c; }
.report-card.sev-tokubetsu { border-left-color: #b452e0; }
/* 河川(洪水予報)専用。河川は赤系がいいという要望で、気象警報の赤
   (sev-keihou #e63946・sev-warning #d9822b)とは色味(テラコッタ〜
   レンガ色)をずらした赤系にしてある。氾濫発生情報(最も深刻)は
   sev-emergencyのまま(他の緊急事態と同じ赤で統一する方を優先) */
.report-card.sev-flood-caution { border-left-color: #c97b5f; }
.report-card.sev-flood-keihou  { border-left-color: #a8402f; }

.test-data-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #3a3a3a;
  border-left: 4px solid #ffcc00;
  color: #fff;
  font-weight: bold;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 4px;
  margin-bottom: 10px;
}

.training-data-banner {
  display: inline-flex;
  align-items: center;
  background: #34363e;
  border: 1px solid #575b68;
  color: #d0d3dc;
  font-weight: 600;
  font-size: 11px;
  line-height: 1.3;
  padding: 3px 8px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.report-heading-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.report-heading-type {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.report-heading-row .training-data-banner {
  flex: none;
  margin: 2px 0 0;
  white-space: nowrap;
}

.report-heading-row .report-headline,
.report-heading-row .tsunami-alert-banner {
  margin: 0;
}

.report-heading-row .tsunami-alert-banner {
  flex: 1;
  min-width: 0;
}

.tsunami-alert-banner {
  font-size: 15px;
  font-weight: bold;
  color: #fff;
  text-align: center;
  padding: 9px 10px;
  border-radius: 6px;
  margin-bottom: 10px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.report-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.badges-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.report-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: bold;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #ccc;
}

.satellite-tag {
  font-size: 11px;
  color: #9aa0a6;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.report-badge.sev-emergency { background: #b3261e; color: #fff; }
.report-badge.sev-warning   { background: #d9822b; color: #fff; }
.report-badge.sev-caution   { background: #d0b400; color: #202020; }
.report-badge.sev-info      { background: #2f6fed; color: #fff; }
.report-badge.sev-training  { background: #7a4fd1; color: #fff; }
.report-badge.sev-error     { background: #555; color: #ddd; }
.report-badge.sev-cancel    { background: #3a3a3a; color: #bbb; border: 1px solid #777; }
.report-badge.sev-resolved  { background: #2b2b2b; color: #888; border: 1px solid #555; }
.report-badge.sev-keihou    { background: #e63946; color: #fff; }
.report-badge.sev-tokubetsu { background: #8e24aa; color: #fff; }
.report-badge.sev-flood-caution { background: #c97b5f; color: #2a0f08; }
.report-badge.sev-flood-keihou  { background: #a8402f; color: #fff; }

/* 見出し(丸角の四角): 「記録的短時間大雨情報」「土砂災害警戒情報」の
   ような長い災害種別名を、小さいバッジ(.report-badge、丸ピル型)や
   種別の行に詰め込むと読みづらいという指摘を受けて追加。バッジより
   ひとまわり大きく、角丸の四角(ピルではなく)で災害の種類そのものを
   一番目立つ位置に見出しとして置く。色はバッジ・カード左端の色帯と
   同じ深刻度カラーを流用する(cardSeverityClassのsev-*クラスをそのまま
   充てる)ため、CSSは再定義せず.report-badgeの配色をそのまま使う */
.report-headline {
  display: inline-block;
  font-size: 16px;
  font-weight: bold;
  line-height: 1.3;
  padding: 6px 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  margin-right: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: azure;
}
.report-headline.sev-emergency { background: #b3261e; color: #fff; }
.report-headline.sev-warning   { background: #d9822b; color: #fff; }
.report-headline.sev-caution   { background: #d0b400; color: #202020; }
.report-headline.sev-info      { background: #2f6fed; color: #fff; }
.report-headline.sev-training  { background: #7a4fd1; color: #fff; }
.report-headline.sev-error     { background: #555; color: #ddd; }
.report-headline.sev-cancel    { background: #3a3a3a; color: #bbb; }
.report-headline.sev-resolved  { background: #2b2b2b; color: #888; }
.report-headline.sev-keihou    { background: #e63946; color: #fff; }
.report-headline.sev-tokubetsu { background: #8e24aa; color: #fff; }
.report-headline.sev-flood-caution { background: #c97b5f; color: #2a0f08; }
.report-headline.sev-flood-keihou  { background: #a8402f; color: #fff; }

.report-title {
  font-size: 17px;
  font-weight: bold;
  line-height: 1.4;
  margin-bottom: 6px;
  color: #ffffff;
}

.report-meta {
  font-size: 12px;
  color: #9aa0a6;
  margin-bottom: 10px;
}

/* メッセージ(指示・案内文): Lアラートの「指示」(例: 河口から離れて
   ください)や気象庁の解説文など、避難行動に直結しうる自由文を、
   dt/ddの1行に詰め込むのではなく独立した目立つブロックとして見せる。
   吹き出し(コメント)っぽく見えないよう背景色・角丸・アイコンは使わず、
   カード左端の色帯と重なって二重線に見えないよう、色付きの縦罫線も
   使わない。字下げだけのシンプルな引用スタイルにする */
.report-message {
  padding-left: 12px;
  margin: 6px 0 10px;
  font-size: 13.5px;
  line-height: 1.6;
  color: #e8eaed;
  /* cleanDescriptionMessage等が残した改行をそのまま活かして複数行を
     見やすく分ける(既定のnormalだと改行が詰まって1行に潰れてしまう) */
  white-space: pre-line;
}

.report-summary {
  margin: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 12px;
  row-gap: 6px;
  font-size: 13px;
}
.report-summary dt {
  color: #9aa0a6;
  white-space: nowrap;
}
.report-summary dd {
  margin: 0;
  min-width: 0;
  color: azure;
  word-break: break-all;
}

/* 日本全国表示中のLアラート統合パネル(buildLalertNationwideCard)。
   都道府県→種別→深刻度の3階層をインデント・見出しで視覚的に分ける。
   件数が多い時に個別カードが並びすぎて見づらいという指摘を受けて
   1枚のパネルにまとめた代わりに、階層自体は一目で追えるようにする */
.lalert-summary-pref {
  margin: 10px 0 4px;
}
.lalert-summary-pref:first-child {
  margin-top: 0;
}
.lalert-summary-pref-title {
  font-size: 15px;
  font-weight: bold;
  color: #ffffff;
  margin-bottom: 4px;
  padding-bottom: 3px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}
.lalert-summary-hazard {
  margin: 6px 0 6px 8px;
}
.lalert-summary-hazard-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #e8eaed;
  margin-bottom: 3px;
}
.lalert-summary-sev {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin: 2px 0 2px 10px;
  font-size: 13px;
}
.lalert-summary-sev-label {
  flex-shrink: 0;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: bold;
}
.lalert-summary-sev.sev-emergency .lalert-summary-sev-label { background: #b3261e; color: #fff; }
.lalert-summary-sev.sev-warning   .lalert-summary-sev-label { background: #d9822b; color: #fff; }
.lalert-summary-sev.sev-caution   .lalert-summary-sev-label { background: #d0b400; color: #202020; }
.lalert-summary-sev.sev-training  .lalert-summary-sev-label { background: #5f6368; color: #fff; }
.lalert-summary-sev-names {
  min-width: 0;
  color: azure;
  word-break: break-all;
}

.cross-marker {
  width: 28px;
  height: 28px;
  position: relative;
  pointer-events: none;
}
.cross-marker::before,
.cross-marker::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 30px;
  background: #ff2800;
  border: 1px solid rgba(0, 0, 0, 0.6);
  border-radius: 2px;
}
.cross-marker::before { transform: translate(-50%, -50%) rotate(45deg); }
.cross-marker::after  { transform: translate(-50%, -50%) rotate(-45deg); }

.intensity-badge {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #111;
  font-size: 12px;
  font-weight: bold;
  pointer-events: none;
  /* transition: transform は付けない。ズーム中に applyIntensityBadgeScale が
     毎フレーム scale() を更新するため、transform にトランジションがあると
     その追従が0.15秒遅れ、バッジが伸縮ラグで「ズレて見える」。ズームイベント
     ごとに更新するので、トランジション無しでも滑らかに追従する。 */
}

.epicenter-label {
  background: rgba(20, 22, 26, 0.9);
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* スマホではOSの安全領域を避け，警報を1件ずつ表示する． */
@media (max-width: 700px) {
  .panel {
    /* 透明ステータスバーだった旧PWAやノッチ付き端末でも，OS領域を覆わない */
    top: calc(env(safe-area-inset-top, 0px) + 4px);
    left: env(safe-area-inset-left, 0px);
    right: env(safe-area-inset-right, 0px);
    width: auto;
    max-height: min(60dvh, calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 8px));
    overflow: hidden;
    border-radius: 0 0 14px 14px;
  }

  #events_container {
    max-height: none;
    overflow: hidden;
  }

  .satellite-info { padding: 3px 12px 0; }
  .panel-page-indicator { padding: 3px 0; }

  .panel-header {
    padding: 8px 12px;
  }

  .clock {
    font-size: 16px;
  }

  .status-pill,
  .notify-button {
    font-size: 11px;
    padding: 3px 8px;
  }

  .report-card {
    padding: 7px 10px;
  }

  .test-data-banner {
    font-size: 11px;
    padding: 5px 8px;
    margin-bottom: 6px;
  }

  .report-badge-row {
    margin-bottom: 6px;
  }

  .report-badge {
    font-size: 11px;
    padding: 2px 8px;
  }

  .satellite-tag {
    font-size: 10px;
  }

  .report-headline {
    font-size: 13px;
    padding: 4px 9px;
    margin-bottom: 6px;
  }

  .report-title {
    font-size: 14px;
    margin-bottom: 0;
  }

  .report-message {
    font-size: 12px;
    line-height: 1.35;
    padding: 0 0 0 8px;
    margin: 3px 0 5px;
  }

  /* シンプル化: 受信時刻(上部の時計と重複する情報)は非表示にし、
     詳細項目も要点(最大3行)だけに絞る */
  .report-meta {
    display: none;
  }

  .report-summary {
    font-size: 12px;
    line-height: 1.3;
    row-gap: 3px;
    column-gap: 8px;
  }

  .lalert-summary-pref-title {
    font-size: 13.5px;
  }
  .lalert-summary-hazard-title {
    font-size: 12.5px;
  }
  .lalert-summary-sev {
    font-size: 12px;
  }
}
