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

.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;
}

.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;
}

.report-card {
  padding: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.report-card:last-child {
  border-bottom: none;
}

.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;
}

.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-title {
  font-size: 17px;
  font-weight: bold;
  line-height: 1.4;
  margin-bottom: 6px;
}

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

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

.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 0.15s ease-out;
}

.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);
}

/* ==================================================
   スマホ(iPhone等)向けレイアウト
   パネルを画面上部に幅いっぱいで固定し、高さを画面の
   一部(35vh)に制限してスクロール可能にすることで、
   地図が隠れすぎないようにする
   ================================================== */
@media (max-width: 700px) {
  .panel {
    top: 0;
    left: 0;
    right: 0;
    width: auto;
    max-height: 30vh;
    border-radius: 0 0 14px 14px;
  }

  /* PWAとしてホーム画面から起動した際、ノッチ/ステータスバーに
     パネルが隠れないようにする(通常のSafari表示では0になる) */
  .panel-header {
    padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  }

  .clock {
    font-size: 16px;
  }

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

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

  .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-title {
    font-size: 14px;
    margin-bottom: 0;
  }

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

  .report-summary {
    font-size: 12px;
    row-gap: 4px;
    column-gap: 8px;
  }

  .report-summary dt:nth-of-type(n + 4),
  .report-summary dd:nth-of-type(n + 4) {
    display: none;
  }
}
