:root {
  --ink: #262626;
  --muted: #62666a;
  --line: #e0e2e3;
  --accent: #116582;
  font-family: Arial, "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
/* Linked sections start a little below the sticky site header. */
html { scroll-padding-top: calc(6.25rem + 1.25rem); }
.wrap { max-width: 64rem; }

.data-page { padding-top: clamp(1.25rem, 3vw, 2.5rem); }
.data-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .3rem 1.5rem; }
.data-heading h1 { margin: 0; font-size: clamp(1.3rem, 2.3vw, 1.8rem); line-height: 1.4; letter-spacing: -.035em; font-weight: 600; }
.data-references, .data-controls { display: flex; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.data-references { gap: 0 1rem; }
.data-references a { display: inline-block; padding-block: .2rem; color: var(--muted); font-size: .78rem; text-decoration-color: #b4b8ba; }
.data-description { margin: .4rem 0 0; color: var(--muted); font-size: .9rem; }
.data-facts { display: flex; flex-wrap: wrap; gap: .15rem 1.3rem; margin: .8rem 0 0; font-size: .81rem; font-variant-numeric: tabular-nums; }
.data-facts div { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: .45rem; }
.data-facts dt { color: var(--muted); }
.data-facts dd { margin: 0; overflow-wrap: anywhere; }
.data-facts a, .data-sections a { text-decoration-color: #aabfc5; }
.data-page a:hover { text-decoration: underline; text-decoration-color: currentColor; }
.data-page button { border: 1px solid #a9afb1; border-radius: .22rem; padding: .45rem .8rem; color: var(--ink); background: #f5f6f6; font-size: .9rem; font-weight: 500; }
.data-page button:hover { background: #e8ebeb; }
.data-views { margin-top: .9rem; border-bottom: 1px solid var(--line); }
.data-controls { column-gap: 1.25rem; }
.data-controls a { display: inline-block; padding-block: .35rem; font-size: .85rem; font-weight: 400; }
.data-views a { color: var(--muted); text-decoration: none; margin-bottom: -1px; border-bottom: 2px solid transparent; }
.data-views a[aria-current] { color: var(--ink); border-bottom-color: var(--ink); }
.data-sections .data-controls a[aria-current] { color: var(--ink); font-weight: 600; text-decoration: none; }
.data-sections section { margin-top: 2.4rem; }
.data-sections section:first-child { margin-top: 1.25rem; }
.data-sections h2 { margin: 0 0 .4rem; font-size: 1.05rem; line-height: 1.5; font-weight: 600; }
.guide-page .data-sections h3 { margin: 0 0 .35rem; font-size: .95rem; line-height: 1.5; font-weight: 600; }
.guide-page section:has(> h3) { margin-top: 1.4rem; }
.guide-page section:has(> h2:only-child) { border-bottom: 1px solid var(--line); }
.guide-page p { overflow-wrap: anywhere; }
.data-sections p { margin: .35rem 0; color: var(--muted); font-size: .875rem; }
.data-sections .pills { gap: .45rem 1.3rem; font-size: .9rem; }
.data-sections .pills a { font-weight: 500; }

.data-sections .scroll { margin: .4rem 0 0; border: solid var(--line); border-width: 1px 0; }
.data-sections caption, .data-sections .visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.data-sections table { font-size: .9rem; }
.data-sections th, .data-sections td { padding: .6rem .75rem; vertical-align: middle; }
.data-sections thead th { background: #f6f7f7; color: #505659; font-size: .8rem; font-weight: 500; }
.data-sections tbody th { background: white; white-space: normal; font-size: inherit; font-weight: 500; }
.data-sections tbody tr { background: white; }
.data-sections tbody tr:last-child > * { border-bottom: 0; }
.data-sections td:first-child { font-weight: inherit; }
.data-sections time { font-size: .85em; font-variant-numeric: tabular-nums; }
.data-sections td time[datetime*="T"] { display: inline-block; min-width: 11ch; }
.quantity { white-space: nowrap; font-variant-numeric: tabular-nums; }
.quantity-number { font-size: 1.05rem; line-height: 1.1; font-weight: 600; }
.quantity-unit { font-size: .75rem; font-weight: 400; color: var(--muted); }
.reading-state { color: #54585a; font-size: .84rem; font-weight: 500; }
.reading-notes, .reading-details { display: block; margin-top: .15rem; font-size: .75rem; line-height: 1.5; color: var(--muted); }
.reading-details summary { width: fit-content; cursor: pointer; }
.reading-details summary:hover { color: var(--ink); }

.data-sections .latest-readings { table-layout: fixed; }
.latest-readings th:first-child { width: 16%; }
.data-sections .latest-readings th, .data-sections .latest-readings td { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.latest-readings thead th { text-wrap: balance; }
.data-sections .latest-readings tbody th { color: var(--muted); font-size: .8rem; }
.latest-readings .quantity-number { font-size: clamp(1.65rem, 3vw, 2.25rem); font-weight: 550; letter-spacing: -.045em; }
.latest-readings .quantity-unit { font-size: .82rem; }
.latest-readings tbody tr:first-child td { padding-block: .7rem; }
.latest-readings time { font-size: .9em; }
.data-sections .latest-readings td time { min-width: 0; }

.table-filter { gap: .25rem 1.1rem; font-size: .8rem; color: var(--muted); }
.table-filter a { color: var(--accent); text-decoration: underline; }
.data-sections .table-hint { font-size: .8rem; }
.history-readings { table-layout: fixed; }
.data-sections .history-readings th, .data-sections .history-readings td { min-width: 0; white-space: normal; }
.history-readings :is(th[scope="col"], td):not(:first-child) { text-align: end; }
.history-readings thead th { text-wrap: balance; }
.history-readings .history-time { font-size: .9rem; }
.history-time span { display: inline-block; text-decoration: underline dotted #929a9c; text-underline-offset: .25em; }
.history-time span + span { font-weight: 600; }
.data-page .reading-trigger {
  padding: .15rem 0; border: 0; background: none; color: var(--ink);
  text-align: start;
}
.data-page .reading-trigger:hover { background: none; color: var(--accent); }
.reading-notice { display: block; color: #78501b; font-weight: 500; font-size: .75rem; }
.reading-popover {
  width: min(27rem, calc(100% - 2rem)); max-height: calc(100dvh - 3rem); overflow-y: auto;
  padding: 1.25rem; border: 1px solid #c4c8ca; border-radius: .35rem;
  color: var(--ink); background: white; text-align: start; font-size: .9rem; font-weight: 400;
}
.reading-popover::backdrop { background: rgb(25 31 35 / 20%); }
.data-sections .reading-popover p { margin: 0; color: var(--ink); font-weight: 600; }
.data-sections .reading-popover p time { font-size: 1rem; }
.reading-popover dl { margin: .65rem 0 1rem; }
.reading-popover dl > div { padding-block: .45rem; border-top: 1px solid var(--line); }
.reading-popover dt { color: var(--muted); font-size: .8rem; }
.reading-popover dd { margin: .15rem 0 0; }
.reading-popover time { font-variant-numeric: tabular-nums; }

.guide-page, .data-page:has(.ranking-readings) { max-width: 48rem; }
.data-page:has(.ranking-readings) .data-facts:has(+ .data-views li:only-child) {
  display: inline-flex; margin-inline-end: 1.25rem;
}
.data-page:has(.ranking-readings) .data-views:has(li:only-child) { display: inline-flex; margin-top: .5rem; border: 0; }
.data-page:has(.ranking-readings) .data-views li:only-child a { color: var(--accent); text-decoration: underline; }
.ranking-readings { table-layout: fixed; }
.ranking-readings thead th:first-child { width: 3.6rem; }
.ranking-readings thead th:last-child { width: clamp(6.25rem, 30%, 12rem); }
.data-sections .ranking-readings :is(th, td) { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.ranking-readings tr > :last-child { text-align: end; }
.ranking-readings tbody td:first-child { color: var(--muted); font-variant-numeric: tabular-nums; }
.ranking-station > a { font-weight: 550; }
.ranking-prefecture { display: block; width: fit-content; font-size: .78rem; font-weight: 400; }
.ranking-prefecture, .ranking-prefecture a { color: var(--muted); }
.ranking-trigger .quantity { text-decoration: underline dotted #929a9c; text-underline-offset: .25em; }
.ranking-trigger .quantity-number { font-size: 1.15rem; }
.ranking-readings .reading-popover { overflow-wrap: break-word; }

#areas table { table-layout: fixed; }
#areas thead th:first-child { width: 29%; }
#areas .scroll :is(th, td) { min-width: 0; white-space: normal; }
#areas tbody a { display: inline-block; padding-block: .15rem; }
#areas tbody td { overflow-wrap: anywhere; }

@media (min-width: 48rem) {
  .data-sections section:has(> .data-controls) { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; }
  .data-sections section:has(> .data-controls) h2 { grid-area: 1 / 1; }
  .data-sections section > .data-controls { grid-area: 1 / 2; }
  .data-sections section:has(> .data-controls) > :is(p, .scroll, .pills) { grid-column: 1 / -1; }
}
@media (max-width: 63.99rem) {
  html { scroll-padding-top: calc(4.5rem + 1.25rem); }
}
@media (max-width: 47.99rem) {
  .data-heading { display: block; }
  .data-references { margin-top: .15rem; }
  .data-facts { gap: .15rem .9rem; }
  .data-sections th, .data-sections td { padding: .5rem .55rem; }
  .data-sections table:not(.latest-readings, .history-readings, .ranking-readings) th[scope="row"] { min-width: 5.4rem; }
  .data-sections td:has(> .reading-details, > .reading-notes) { min-width: 6.25rem; }
  .data-sections td:first-child:has(+ th[scope="row"]) { min-width: 2.3rem; }
  .data-sections tr > :first-child { position: sticky; inset-inline-start: 0; }
  .data-sections tbody tr > :first-child { background: white; }
  .data-sections .latest-readings th, .data-sections .latest-readings td { padding-inline: .35rem; }
  .latest-readings th:first-child { width: 16%; }
  .latest-readings td { font-size: .78rem; }
  .data-sections .history-readings th, .data-sections .history-readings td { padding-inline: .35rem; }
  .history-readings .history-time { font-size: .8rem; }
  .ranking-readings thead th:first-child { width: 2.75rem; }
  .ranking-readings .reading-notice { line-height: 1.4; }
}
