:root {
  color-scheme: light;
  --accent: #765394;
  --accent-dark: #55366f;
  --border: #e3dbe9;
  --soft: #f6f1fa;
  --muted: #756880;
  --text: #302936;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 16px; }
body {
  margin: 0;
  background: linear-gradient(180deg, #fbf8fe 0%, #f7f3fa 42%, #f1edf5 100%);
  color: var(--text);
  font-family: "Yu Gothic", YuGothic, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  font-size: 13px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent-dark); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
a:focus-visible {
  outline: 3px solid #9b72ba;
  outline-offset: 3px;
}

.visually-hidden,
.skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link:focus {
  position: absolute;
  z-index: 10;
  top: 8px;
  left: 8px;
  padding: 12px 16px;
  background: #fff;
  color: var(--accent-dark);
  font-weight: 700;
}

.site-header {
  border-top: 3px solid var(--accent);
  border-bottom: 1px solid var(--border);
  background: #fff;
  box-shadow: 0 4px 14px rgb(67 45 84 / 4%);
}
.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  max-width: 1180px;
  min-height: 60px;
  margin: 0 auto;
  padding: 10px 15px;
}
.site-brand {
  color: var(--accent-dark);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.5;
  text-decoration: none;
}
.site-brand span { white-space: nowrap; }
.site-links { flex: 0 0 auto; }
.site-links a {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  padding: 6px 11px;
  border: 1px solid #cfc0dd;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.site-links a:hover { border-color: var(--accent); background: var(--soft); }
.site-links a span { font-size: 19px; line-height: 1; }

.site-content {
  width: 100%;
  max-width: 1180px;
  min-height: calc(100vh - 131px);
  margin: 0 auto;
  padding: 14px 10px 44px;
}
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 20px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.breadcrumb a { font-weight: 700; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .separator { color: #a296ad; }
.site-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
  gap: 20px;
}
.main-column, .sidebar { min-width: 0; }
.sidebar > .panel:first-child { margin-top: 0; }
.sidebar > .panel + .panel { margin-top: 20px; }
.panel {
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: 0 10px 30px rgb(67 45 84 / 6%);
}
.panel-header {
  padding: 14px 18px;
  border-top: 4px solid var(--accent);
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.panel-header h1,
.panel-header h2 {
  margin: 0;
  color: var(--accent-dark);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.45;
}
.ranking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.ranking-header > div { min-width: 0; }
.month-label {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}
.ranking-header p {
  max-width: 560px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}
.order-label {
  flex: 0 0 auto;
  padding: 7px 9px;
  border: 1px solid #d8c9e3;
  background: var(--soft);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.ranking-range {
  padding: 10px 18px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: 12px 14px;
  background: #fff;
}
.pagination-top { border-bottom: 1px solid var(--border); }
.pagination-bottom { border-top: 1px solid var(--border); }
.pagination > a,
.pagination > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid #d8c9e3;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
}
.pagination a:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.pagination .is-current {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.pagination .is-disabled { border-color: var(--border); background: var(--soft); color: #8e8398; }
.pagination .ellipsis { min-width: 20px; padding-right: 3px; padding-left: 3px; border-color: transparent; }

.ranking-results { background: #fff; }
.ranking-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 14px;
}
.ranking-table .rank-column { width: 64px; }
.ranking-table .population-column { width: 165px; }
.ranking-table th {
  padding: 9px 12px;
  border-bottom: 1px solid var(--accent-dark);
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  text-align: left;
}
.ranking-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  font-weight: 700;
  line-height: 1.45;
  vertical-align: top;
}
.ranking-table tbody tr:last-child td { border-bottom: 0; }
.ranking-table tbody tr:hover td { background: var(--soft); }
.ranking-table .rank { text-align: center; }
.ranking-table td.rank { padding-top: 14px; color: var(--accent-dark); font-size: 14px; font-variant-numeric: tabular-nums; }
.company-name { color: #337ab7; font-size: 15px; font-weight: 800; text-decoration: none; overflow-wrap: anywhere; }
.company-name:hover { color: #23527c; text-decoration: underline; }
.company-name--unavailable,
.company-name--unavailable:hover { color: var(--text); text-decoration: none; }
.company-address {
  margin-top: 3px;
  color: #62576c;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.ranking-table .population { text-align: right; }
.population strong { color: var(--accent-dark); font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.population > span { margin-left: 3px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.ranking-link-note { margin: 0; padding: 0 18px 13px; color: var(--muted); font-size: 11px; line-height: 1.7; }

.manual-ad-space {
  min-width: 0;
  min-height: 280px;
  margin: 20px 0;
  padding: 8px 12px 12px;
  background: #fff;
}
.manual-ad-label { margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 400; text-align: center; }
[data-catr-manual-ad-space].is-catr-unfilled-ad-space { display: none !important; }

.data-panel { margin-top: 20px; }
.data-panel .panel-header { padding: 11px 18px; border-top-width: 3px; }
.data-panel .panel-header h2 { font-size: 15px; }
.data-content { padding: 15px 18px 18px; color: #62576c; font-size: 12px; line-height: 1.8; }
.source-note { color: var(--text); }
.source-note p { margin: 0 0 5px; }
.source-note a, .bulk-download-note a { font-weight: 700; }
.data-criteria { margin: 10px 0 0; padding-left: 19px; }
.data-criteria li { padding-left: 1px; }
.data-criteria li + li { margin-top: 3px; }
.bulk-download-note { margin-top: 15px; padding: 12px 14px; border: 1px solid var(--border); border-left: 4px solid var(--accent); background: var(--soft); }
.bulk-download-note p { margin: 0; }
.bulk-download-note p + p { margin-top: 6px; }
.scraping-notice { color: var(--accent-dark); font-weight: 700; }

.prefecture-panel { box-shadow: 0 4px 14px rgb(67 45 84 / 4%); }
.prefecture-panel .panel-header { padding: 12px 14px; }
.prefecture-panel .panel-header h2 { font-size: 15px; }
.sidebar-intro { padding: 10px 14px 0; }
.sidebar-intro p { margin: 0 0 9px; color: var(--muted); font-size: 11px; }
.national-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #d8c9e3;
  background: var(--soft);
  color: var(--accent-dark);
  font-weight: 800;
  text-decoration: none;
}
.national-link:hover { border-color: var(--accent); background: var(--accent); color: #fff; }
.national-link span { font-size: 18px; line-height: 1; }
.prefectures { padding: 0 14px 15px; }
.prefecture-group { margin-top: 15px; }
.prefecture-group h3 { margin: 0 0 6px; color: var(--muted); font-size: 11px; font-weight: 800; line-height: 1.5; }
.prefecture-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.prefecture-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
}
.prefecture-links a span { font-size: 16px; line-height: 1; }
.prefecture-links a:hover { border-color: var(--accent); background: var(--soft); }
.prefecture-links a[aria-current="page"] { border-color: var(--accent); background: var(--accent); color: #fff; }

.municipality-panel { margin-top: 20px; box-shadow: 0 4px 14px rgb(67 45 84 / 4%); }
.municipality-panel .panel-header { padding: 12px 14px; }
.municipality-panel .panel-header h2 { font-size: 15px; }
.municipality-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; padding: 14px; }
.municipality-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.municipality-links a span { flex: 0 0 auto; font-size: 16px; line-height: 1; }
.municipality-links a:hover { border-color: var(--accent); background: var(--soft); }
.municipality-links a[aria-current="page"] { border-color: var(--accent); background: var(--accent); color: #fff; }

.site-footer { border-top: 1px solid var(--border); background: #fff; }
.site-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1180px;
  min-height: 66px;
  margin: 0 auto;
  padding: 15px;
  color: var(--muted);
  font-size: 11px;
}
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

@media (max-width: 1000px) {
  .ranking-header { align-items: flex-start; flex-direction: column; gap: 10px; }
  .order-label { padding: 5px 8px; }
  .ranking-table .rank-column { width: 54px; }
  .ranking-table .population-column { width: 140px; }
}

@media (max-width: 768px) {
  .site-header-inner { align-items: flex-start; flex-direction: column; gap: 9px; padding: 11px 14px 12px; }
  .site-brand { font-size: 17px; }
  .site-links a { min-height: 30px; padding: 4px 9px; font-size: 11px; }
  .site-content { padding: 12px 10px 32px; }
  .breadcrumb { margin-bottom: 10px; font-size: 11px; }
  .site-layout { grid-template-columns: 1fr; gap: 20px; }
  .panel-header { padding: 12px 14px; }
  .panel-header h1 { font-size: 18px; }
  .ranking-header { gap: 9px; }
  .ranking-header p { font-size: 11px; }
  .ranking-range { padding: 10px 12px 0; font-size: 11px; }
  .pagination { gap: 4px; padding: 10px 8px; }
  .pagination > a, .pagination > span { min-width: 32px; min-height: 36px; padding: 7px 8px; font-size: 11px; }
  .pagination .ellipsis { min-width: 15px; }
  .ranking-table .rank-column { width: 45px; }
  .ranking-table .population-column { width: 109px; }
  .ranking-table th { padding: 8px 7px; font-size: 11px; }
  .ranking-table td { padding: 10px 7px; }
  .ranking-table td.rank { padding-top: 12px; font-size: 12px; }
  .company-name { font-size: 13px; line-height: 1.5; }
  .company-address { font-size: 11px; }
  .population strong { font-size: 15px; }
  .population > span { font-size: 10px; }
  .ranking-link-note { padding: 0 12px 12px; font-size: 10px; }
  .data-panel .panel-header { padding: 11px 14px; }
  .data-content { padding: 13px 14px 15px; font-size: 11px; }
  .bulk-download-note { padding: 10px 11px; }
  .prefecture-links { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .prefecture-links a { min-height: 40px; padding: 8px; font-size: 12px; }
  .municipality-links { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .municipality-links a { min-height: 40px; padding: 8px; font-size: 12px; }
  .site-footer-inner { align-items: flex-start; flex-direction: column; gap: 6px; padding: 15px 14px; }
}

@media (max-width: 420px) {
  .site-brand { font-size: 16px; }
  .site-brand span { font-size: 13px; }
  .panel-header h1 { font-size: 17px; }
  .prefecture-links { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .municipality-links { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: no-preference) {
  a { transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease; }
}
