:root {
  --navy: #075b9b;
  --navy-dark: #093d62;
  --blue-soft: #e5f2fb;
  --line: #8a9aa4;
  --gray-cell: #e8edf0;
  --ink: #20313d;
  --muted: #657b88;
  --link: #12658f;
  --block-line: #344b59;
  --surface: #fff;
  --page: #f3f7fa;
}

* { box-sizing: border-box; }
html { background: var(--page); }
body {
  margin: 0;
  color: var(--ink);
  font-family: "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  font-size: 14px;
  background: linear-gradient(180deg, #f8fbfd 0, var(--page) 260px);
}
button, input { font: inherit; }
[v-cloak] { display: none; }

/* ページ共通 */
#app { max-width: 1500px; margin: 0 auto; padding: 14px 30px 8px; }
.top-page { height: 100vh; overflow: hidden; }
.page-header { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 10px; padding: 0; }
.eyebrow { margin: 0 0 6px; color: var(--navy); font-size: 11px; font-weight: 800; letter-spacing: .16em; }
h1 { margin: 0; color: var(--navy-dark); font-size: clamp(18px, 2.4vw, 24px); letter-spacing: .02em; }
.retry-button { border: 0; background: var(--navy); color: white; cursor: pointer; font-weight: 700; padding: 10px 15px; }

/* 一覧表 */
.table-shell { overflow: auto; border: 1px solid #c2d1da; background: var(--surface); box-shadow: 0 8px 24px rgba(28, 55, 73, .09); }
.warning-table-shell { height: calc(100vh - 105px); max-height: none; }
.warning-table { width: 100%; min-width: 0; border-collapse: collapse; table-layout: fixed; }
.warning-table caption { height: 0; overflow: hidden; padding: 0; }
.warning-table .region-col { width: 5%; }
.warning-table .area-col { width: 10%; }
.warning-table th, .warning-table td { border: 1px solid #7f909b; }
.warning-table thead th { position: sticky; top: 0; z-index: 2; height: 48px; background: linear-gradient(180deg, #edf7fc, var(--blue-soft)); color: #31566b; font-size: 15px; line-height: 1.15; }
.region-heading { text-align: center; }
.group-heading { height: 34px !important; font-size: 12px !important; white-space: pre-line; }
.prefecture-name { min-width: 44px; padding: 8px 5px; border-bottom: 2px solid var(--block-line) !important; background: #d7ecfa; color: #24536d; font-size: 15px; font-weight: 700; text-align: center; vertical-align: middle; writing-mode: vertical-rl; text-orientation: upright; white-space: nowrap; }
.area-row { height: 27px; }
.prefecture-start > th, .prefecture-start > td { border-top: 2px solid var(--block-line) !important; }
.prefecture-end > th, .prefecture-end > td { border-bottom: 2px solid var(--block-line) !important; }
.area-name { padding: 3px 6px; background: white; font-weight: 500; text-align: left; }
.area-row:hover .area-name { background: #f0f8fc; }
.area-link { display: block; color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
.warning-cell { height: 27px; background: var(--gray-cell); color: #555; text-align: center; font-size: 14px; }
.table-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 18px; margin: 0 0 8px; color: #4b606d; font-size: 12px; }

/* 詳細ページ */
.detail-screen { padding: 4px 0 24px; }
.back-link { display: inline-flex; align-items: center; min-height: 30px; padding: 4px 10px; border: 1px solid #c6dce8; background: #f7fbfd; color: var(--link); font-size: 13px; text-decoration: none; }
.back-link:hover { background: #e8f4fa; }
.detail-screen h2 { margin: 16px 0; padding-left: 12px; border-left: 4px solid var(--navy); color: var(--navy-dark); font-size: 22px; }
.detail-screen h2 small { color: #647683; font-size: 14px; font-weight: 400; }
.city-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.city-table th, .city-table td { border: 1px solid #7f909b; }
.city-table thead th { white-space: pre-line; }
.city-table th { width: 18%; padding: 4px 7px; background: #e1edf4; font-size: 12px; font-weight: 500; text-align: left; }
.city-table td { height: 26px; }
.city-table .local-heading-cell { width: 12%; text-align: center; }
.city-table .city-name-heading, .city-table .city-name-cell { width: 28%; }
.city-table .local-name { min-width: 44px; padding: 8px 5px; background: #d7ecfa; color: #24536d; font-size: 15px; font-weight: 700; text-align: center; vertical-align: middle; writing-mode: vertical-rl; text-orientation: upright; white-space: nowrap; }
.city-link { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
.city-status-shell { max-width: 1100px; }
.city-status-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.city-status-table th, .city-status-table td { border: 1px solid #8da5b2; }
.city-status-table thead th { height: 40px; padding: 5px 8px; background: linear-gradient(180deg, #e9f6fc, #d9edf9); color: #264d63; font-size: 16px; font-weight: 700; text-align: center; }
.city-status-table .city-status-name { width: 120px; }
.city-status-table .status-label { width: 120px; padding: 6px 8px; font-size: 16px; font-weight: 500; text-align: center; }
.city-status-content { min-height: 38px; padding: 4px 8px; background: white; text-align: left; vertical-align: middle; }
.city-warning { display: inline-block; margin: 0 5px 0 0; padding: 5px 7px; border: 1px solid #17232b; color: #111; font-size: 15px; font-weight: 500; line-height: 1.2; }
.city-warning.released-warning { background: #fff !important; color: #111 !important; }
.city-status-table .severity-5, .city-status-table .severity-4 { color: white; }
.city-status-table .severity-3 { color: #240000; }
.time-series-shell { overflow-x: auto; }
.compact-time-series-shell { width: fit-content; max-width: 100%; }
.city-status-shell + .time-series-shell { margin-top: 28px; }
.time-series-stack { display: grid; gap: 28px; margin-top: 28px; }
.time-series-table { width: max-content; min-width: 100%; border-collapse: collapse; table-layout: fixed; }
.time-series-table.compact-time-series { width: fit-content; min-width: 0; table-layout: auto; }
.time-series-table caption { padding: 9px 12px; background: linear-gradient(100deg, var(--navy-dark), var(--navy)); color: white; font-size: 15px; font-weight: 700; letter-spacing: .02em; text-align: left; }
.time-series-table th, .time-series-table td { min-width: 54px; height: 28px; padding: 3px 5px; border: 1px solid #63727c; text-align: center; white-space: nowrap; }
.time-series-table thead th { background: #d9edf9; color: #304f61; font-weight: 500; }
.time-series-table .time-series-label { width: 180px; min-width: 180px; max-width: 180px; background: #f7f9fa; text-align: left; }
.time-series-table .time-series-sub-label { width: 105px; min-width: 105px; background: #f7f9fa; text-align: center; }
.time-series-table .time-series-label small { font-size: 10px; font-weight: 400; }
.time-series-table.compact-time-series th:not(.time-series-label):not(.time-series-sub-label),
.time-series-table.compact-time-series td { width: 130px; min-width: 130px; }
.time-series-table .timeseries-cell { background: white; }
.time-series-table .forecast-level { background: #fff000; }
.time-series-table .risk-level-5 { background: #160b18; }
.time-series-table .risk-level-4 { background: #a900b7; }
.time-series-table .risk-level-3 { background: #ff3b19; }
.time-series-table .risk-level-2 { background: #fff000; }
.time-series-table .risk-level-white { background: #fff; }
.time-series-table .risk-level-none { background: var(--gray-cell); }

/* 警報レベル */
.severity-5 { background: #160b18 !important; color: white; }
.severity-4 { background: #a900b7 !important; color: white; }
.severity-3 { background: #ff3b19 !important; color: #240000; }
.severity-2 { background: #fff000 !important; color: #3c4000; }
.warning-cell:not(.active-cell) { background: var(--gray-cell); color: #555; }
.warning-cell.released-cell { background: var(--gray-cell); color: #111; }
.active-cell { font-weight: 700; }

/* 空状態・凡例 */
.empty-state { padding: 46px 24px; border: 1px solid #c8d5de; background: white; text-align: center; box-shadow: 0 8px 24px rgba(28, 55, 73, .07); }
.empty-state p { color: var(--muted); }
.empty-inline { padding: 42px; color: var(--muted); text-align: center; }
.legend { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 18px; margin-top: 18px; padding: 15px 4px 4px; border-top: 1px solid #d2e0e8; color: #4b606d; font-size: 12px; }
.legend-title { color: var(--ink); font-weight: 700; }
.legend-section { margin-left: 8px; padding-left: 20px; border-left: 1px solid #aebbc3; color: var(--ink); font-weight: 700; }
.symbol-legend-item { white-space: nowrap; }
.status-symbol { display: inline-block; min-width: 18px; margin-right: 4px; color: var(--ink); font-size: 16px; text-align: center; }
.legend-swatch { display: inline-block; width: 17px; height: 13px; margin-right: 4px; border: 1px solid var(--line); vertical-align: -2px; }
.legend-swatch.severity-5 { background: #160b18 !important; }
.legend-swatch.severity-4 { background: #a900b7 !important; }
.legend-swatch.severity-3 { background: #ff3b19 !important; }
.legend-swatch.severity-2 { background: #fff000 !important; }
.legend-swatch.empty { background: var(--gray-cell); }
.legend-swatch.risk-level-5 { background: #160b18; }
.legend-swatch.risk-level-4 { background: #a900b7; }
.legend-swatch.risk-level-3 { background: #ff3b19; }
.legend-swatch.risk-level-2 { background: #fff000; }
.legend-swatch.risk-level-white { background: #fff; }
.legend-swatch.risk-level-none { background: var(--gray-cell); }
.source { margin-left: auto; color: #8b989f; }

@media (max-width: 680px) {
  #app { padding: 14px 10px 8px; }
  .page-header { align-items: start; flex-direction: column; gap: 12px; padding: 14px 16px; }
  .detail-screen h2 { font-size: 19px; }
  .warning-table, .city-table { min-width: 900px; }
  .warning-table .region-col { width: 12%; }
  .source { flex-basis: 100%; margin-left: 0; }
}
