/* 地震ダッシュボード — Transparently デザイン準拠
   トークンは https://www.transparently.jp/ の portal.css に合わせている */

:root {
  --brand: #f04e4b;
  --brand-dark: #d43c39;
  --ink: #222;
  --ink-soft: #555;
  --ink-faint: #888;
  --line: #e3e3e3;
  --line-soft: #ececec;
  --paper: #ffffff;
  --paper-tint: #faf9f8;
  --paper-deep: #f4f3f2;
  --radius: 6px;
  --maxw: 1160px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  color: var(--ink);
  background: var(--paper-tint);
  font-size: 14px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.mono { font-family: "JetBrains Mono", monospace; }

/* ================= ヘッダー ================= */
.site-header {
  height: 56px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.site-header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 16px;
}
.brand img { height: 26px; width: auto; display: block; }
.site-catch {
  flex: 1 1 auto;
  text-align: center;
  font-size: 14px;
  color: var(--ink-soft);
  letter-spacing: .02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-actions { flex: 0 0 auto; }
.dataset-picker { display: flex; align-items: center; gap: 8px; }
.dataset-picker span { font-size: 12px; color: var(--ink-faint); }
.dataset-picker select {
  font-family: inherit;
  font-size: 14px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  transition: border-color .15s ease;
}
.dataset-picker select:hover { border-color: var(--ink-faint); }

/* ================= レイアウト ================= */
.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px 16px 40px;
}

/* ================= 表示期間フィルタ ================= */
.filter-bar {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 14px;
}
.filter-label { font-size: 13px; color: var(--ink-soft); font-weight: 500; }
.preset-pills { display: flex; gap: 6px; }
.preset-pills button {
  font-family: inherit;
  font-size: 13px; font-weight: 500;
  padding: 4px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper); color: var(--ink);
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.preset-pills button:hover { border-color: var(--brand); color: var(--brand); }
.preset-pills button.active {
  background: var(--brand); border-color: var(--brand); color: #fff;
}
.custom-range {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--ink-faint);
}
.custom-range input[type="date"] {
  font-size: 13px; padding: 3px 8px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper); color: var(--ink);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}
.tile {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
}
.tile-label { font-size: 12px; color: var(--ink-faint); margin-bottom: 2px; }
.tile-value { font-size: 24px; font-weight: 500; line-height: 1.4; }
.tile-value-small { font-size: 14px; padding-top: 8px; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 14px;
}
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--brand);
}
.panel-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: .02em;
}

/* ================= 地図 ================= */
.map-panel { position: relative; display: flex; flex-direction: column; }
#map { height: 560px; background: var(--paper-deep); } /* 「輪郭のみ」の海の色 */
.map-legend {
  position: absolute; right: 10px; top: 10px; z-index: 1000;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 12px;
  color: var(--ink-soft);
}
.map-legend .row { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
.map-legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Leaflet コントロールの角丸をサイトに合わせる */
.leaflet-bar, .leaflet-control-layers { border-radius: var(--radius) !important; }

/* ================= タイムライン ================= */
.timeline {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--line-soft);
  background: var(--paper);
}
#play-btn {
  font-family: inherit;
  font-size: 13px; font-weight: 500;
  padding: 5px 14px; white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper); color: var(--ink);
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
#play-btn:hover { border-color: var(--brand); color: var(--brand); }
#time-slider { flex: 1; accent-color: var(--brand); }
.timeline-date {
  font-size: 13px; color: var(--ink-soft); min-width: 96px; text-align: right;
}
.trail-label {
  font-size: 12px; color: var(--ink-soft); white-space: nowrap;
  display: flex; align-items: center; gap: 6px;
}
.trail-label select {
  font-family: inherit;
  font-size: 13px; padding: 3px 8px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper); color: var(--ink);
}

/* ================= グラフ ================= */
.charts-panel { display: flex; flex-direction: column; gap: 14px; }
.chart-box { padding: 14px 16px; }
#chart-daily, #chart-intensity { height: 252px; }

/* ================= 下段：散布図＋最新の地震テーブル ================= */
.bottom-row {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 14px;
  margin-top: 14px;
  align-items: start;
}
.bottom-right { display: flex; flex-direction: column; gap: 14px; }
#chart-scatter { height: 300px; }
.note-box { padding: 14px 16px; }
.note-box p {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.9;
}
.note-box .note-sub {
  margin: 0;
  font-size: 12px;
  color: var(--ink-faint);
}
.note-illust {
  display: flex;
  justify-content: center;
  margin-top: 6px;
}
.note-illust img { width: 150px; height: auto; }
.table-box { padding: 14px 16px; }
.table-note { font-size: 12px; color: var(--ink-faint); }
.table-scroll { max-height: 760px; overflow-y: auto; }
#quake-table { width: 100%; border-collapse: collapse; font-size: 13px; }
#quake-table th {
  position: sticky; top: 0;
  background: var(--paper);
  text-align: left;
  font-size: 12px; font-weight: 500; color: var(--ink-faint);
  padding: 4px 8px;
  border-bottom: 1px solid var(--line);
}
#quake-table td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
#quake-table tr:hover td { background: var(--paper-tint); }
#quake-table .num { font-family: "JetBrains Mono", monospace; }
#quake-table .int-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  margin-right: 6px; vertical-align: 0;
}

/* ================= フッター ================= */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--paper);
  padding: 16px 0;
  margin-top: 8px;
}
.footer-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 16px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 20px;
  font-size: 13px; color: var(--ink-faint);
}
.footer-copy { font-family: "JetBrains Mono", monospace; }

/* ================= レスポンシブ ================= */
@media (max-width: 960px) {
  .site-catch { display: none; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .layout { grid-template-columns: 1fr; }
  .bottom-row { grid-template-columns: 1fr; }
  #map { height: 420px; }
}
